tools/build-R2_19_3/fsboot/sbl/network.c File Reference

#include <stdio.h>
#include <pcap.h>
#include <conf.h>
#include <e100boot.h>
#include <common.h>
#include <network.h>

Include dependency graph for network.c:

Go to the source code of this file.

Defines

#define CRC_LEN   4
#define PKT_BUF_LEN   200

Functions

int timeout (struct timeval *tvThen, int ms)
int InitSendSocket (char *device_name)
int highest_seq_received (void)
packet_buf * ack_on_seq (int seq)
packet_buf * packet_with_seq (int seq)
timeval timeval_subtract (struct timeval *x, struct timeval *y)
void GetNextPacket (void)
void PrintPacket (const unsigned char *p, int size, int type)
void net_init (void)
void NetBoot (void)
void Handler (unsigned char *buf, const struct pcap_pkthdr *hdr, const unsigned char *p)
void DecodeSvintoBoot (const unsigned char *p)
void GetLocalEthAddr (void)
void SendToDevice (unsigned char *data, int data_len)

Variables

udword highest_ack_received
udword last_ack_received = -1
int new_ack = FALSE
int got_new_packet = FALSE
const unsigned char axis_000200 [] = { 0x01, 0x40, 0x8c, 0x00, 0x02, 0x00 }
const unsigned char axis_000400 [] = { 0x01, 0x40, 0x8c, 0x00, 0x04, 0x00 }
unsigned char eth_addr_local [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
sockaddr sock_addr
int sock_fd
int pPacket = 0
pcap_t * pd
pcap_handler handler
packet_buf first_rec_packet
packet_buf * last_rec_packet = &first_rec_packet
int promisc = 1
int all_ids = TRUE
int both_addresses = FALSE
int p_packet_bpl = 8
int printPacketType = CHAR
unsigned int id = 0
int one_id_only = TRUE
unsigned char buf [PKT_BUF_LEN]
pcap_pkthdr * hdrG
char host1 [MAX_STRING_LEN]
char host2 [MAX_STRING_LEN]


Define Documentation

#define CRC_LEN   4

*************************************************************************** ! ! FILE NAME : network.c ! ! DESCRIPTION: Network boot stuff for boot loader. ! ! --------------------------------------------------------------------------- ! HISTORY ! ! DATE NAME CHANGES ! ---- ---- ------- ! 1996 Ronny Raneup Initial version ! 2002 05 02 Ronny Ranerup Moved it into this file ! --------------------------------------------------------------------------- ! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 ! Axis Communications AB, LUND, SWEDEN !

Definition at line 29 of file network.c.

Referenced by decode_load_info(), read_file(), and read_load_info().

#define PKT_BUF_LEN   200

Definition at line 69 of file network.c.

Referenced by net_init().


Function Documentation

struct packet_buf * ack_on_seq ( int  seq  ) 

Definition at line 362 of file network.c.

References all_ids, db1, and first_rec_packet.

void DecodeSvintoBoot ( const unsigned char *  p  ) 

Definition at line 482 of file network.c.

References db1, db4, find_string(), and stderr.

Referenced by CreateBootCmds(), CreateBootLoader(), CreateNewBootPacket(), Handler(), and SendToDevice().

void GetLocalEthAddr ( void   ) 

Definition at line 587 of file network.c.

References db1, device, eth_addr_local, exit, fd, and memcpy().

Referenced by net_init().

void GetNextPacket ( void   ) 

Definition at line 220 of file network.c.

References buf, db2, exit, handler, and pd.

Referenced by NetBoot().

void Handler ( unsigned char *  buf,
const struct pcap_pkthdr *  hdr,
const unsigned char *  p 
)

Definition at line 253 of file network.c.

References all_ids, axis_000200, axis_000400, db1, db2, DecodeSvintoBoot(), dst, eth_addr_local, got_new_packet, highest_ack_received, last_ack_received, listenOnly, new_ack, one_id_only, pPacket, PrintPacket(), printPacketType, and src.

Referenced by net_init().

int highest_seq_received ( void   ) 

Definition at line 386 of file network.c.

References all_ids, db1, db4, and first_rec_packet.

int InitSendSocket ( char *  device_name  ) 

Definition at line 715 of file network.c.

References exit, sock_addr, and sock_fd.

Referenced by net_init().

void net_init ( void   ) 

Definition at line 103 of file network.c.

References dev, device, exit, first_rec_packet, GetLocalEthAddr(), Handler(), handler, InitSendSocket(), malloc(), pd, PKT_BUF_LEN, and promisc.

Referenced by next_level_boot().

void NetBoot ( void   ) 

Definition at line 143 of file network.c.

References create_packet(), db4, exit, first_packet, free_packet(), GetNextPacket(), got_new_packet, last_ack_received, new_ack, SendToDevice(), and timeout.

struct packet_buf * packet_with_seq ( int  seq  ) 

Definition at line 341 of file network.c.

References first_packet.

void PrintPacket ( const unsigned char *  p,
int  size,
int  type 
)

Definition at line 430 of file network.c.

References p_packet_bpl.

Referenced by Handler().

void SendToDevice ( unsigned char *  data,
int  data_len 
)

Definition at line 632 of file network.c.

References cmdsOnly, db1, DecodeSvintoBoot(), device, exit, fd, listenOnly, netBoot, nrof_net_packets, seq, set, sock_addr, sock_fd, and toFiles.

Referenced by NetBoot().

int timeout ( struct timeval *  tvThen,
int  ms 
)

struct timeval timeval_subtract ( struct timeval *  x,
struct timeval *  y 
)

Definition at line 779 of file network.c.


Variable Documentation

int all_ids = TRUE

Definition at line 59 of file network.c.

Referenced by ack_on_seq(), Handler(), and highest_seq_received().

const unsigned char axis_000200[] = { 0x01, 0x40, 0x8c, 0x00, 0x02, 0x00 }

Definition at line 39 of file network.c.

Referenced by CreateBootCmds(), CreateBootLoader(), CreateNewBootPacket(), and Handler().

const unsigned char axis_000400[] = { 0x01, 0x40, 0x8c, 0x00, 0x04, 0x00 }

Definition at line 43 of file network.c.

Referenced by Handler().

int both_addresses = FALSE

Definition at line 61 of file network.c.

Referenced by ParseArgs().

unsigned char buf[PKT_BUF_LEN]

Definition at line 70 of file network.c.

Referenced by _snd_config_evaluate(), alloc_dummy_buf(), camogm_audio_end(), camogm_end_ogm(), camogm_set_audio_format(), CreateBootLoader(), CreateNewBootPacket(), crisv32_eth_send_packet(), GetNextPacket(), grab_and_send(), init_alloc_static_descr(), iop_usb_trans_init(), listener_loop(), log(), main(), nand_default_block_markbad(), nand_do_read_oob(), nand_do_read_ops(), nand_do_write_ops(), nand_read_oob_syndrome(), nand_scan_bbt(), nand_update_bbt(), nand_write_oob_std(), parse_args(), parse_string(), png_handle_bKGD(), png_handle_cHRM(), png_handle_gAMA(), png_handle_hIST(), png_handle_IHDR(), png_handle_oFFs(), png_handle_pCAL(), png_handle_pHYs(), png_handle_PLTE(), png_handle_sBIT(), png_handle_sRGB(), png_handle_tIME(), png_handle_tRNS(), png_write_bKGD(), png_write_cHRM(), png_write_cHRM_fixed(), png_write_chunk_end(), png_write_chunk_start(), png_write_gAMA(), png_write_gAMA_fixed(), png_write_hIST(), png_write_IHDR(), png_write_oFFs(), png_write_pCAL(), png_write_pHYs(), png_write_PLTE(), png_write_sBIT(), png_write_sRGB(), png_write_tIME(), png_write_tRNS(), png_write_zTXt(), readParamAt(), Socket::recv(), rflflash_dump_oob(), rflflash_nand_rw(), RTP_Stream::rtcp_send_sr(), send_pack(), signal_recv(), snd_config_hooks_call(), write_regular_file(), writeMagic(), writeParamAt(), x313_setDMABuffer(), and xreadlink().

unsigned char eth_addr_local[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

Definition at line 46 of file network.c.

Referenced by CreateBootCmds(), CreateBootLoader(), CreateNewBootPacket(), GetLocalEthAddr(), and Handler().

struct packet_buf first_rec_packet

Definition at line 55 of file network.c.

Referenced by ack_on_seq(), highest_seq_received(), and net_init().

int got_new_packet = FALSE

Definition at line 36 of file network.c.

Referenced by Handler(), and NetBoot().

pcap_handler handler

Definition at line 53 of file network.c.

Referenced by GetNextPacket(), and net_init().

struct pcap_pkthdr* hdrG

Definition at line 72 of file network.c.

udword highest_ack_received

Definition at line 33 of file network.c.

Referenced by Handler().

char host1[MAX_STRING_LEN]

Definition at line 74 of file network.c.

Referenced by ParseArgs().

char host2[MAX_STRING_LEN]

Definition at line 75 of file network.c.

Referenced by ParseArgs().

unsigned int id = 0

Definition at line 65 of file network.c.

Referenced by find_module(), replace_object(), set_object(), set_object_direct(), snd_config_get_bool(), snd_config_get_ctl_iface(), snd_func_card_id(), snd_func_concat(), snd_func_datadir(), snd_func_getenv(), snd_func_igetenv(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), snd_func_private_card_driver(), snd_func_private_pcm_subdevice(), snd_func_private_string(), snd_func_refer(), and unset_object().

udword last_ack_received = -1

Definition at line 34 of file network.c.

Referenced by Handler(), and NetBoot().

struct packet_buf* last_rec_packet = &first_rec_packet

Definition at line 56 of file network.c.

int new_ack = FALSE

Definition at line 35 of file network.c.

Referenced by Handler(), and NetBoot().

int one_id_only = TRUE

Definition at line 66 of file network.c.

Referenced by Handler().

int p_packet_bpl = 8

Definition at line 62 of file network.c.

Referenced by ParseArgs(), and PrintPacket().

pcap_t* pd

Definition at line 51 of file network.c.

Referenced by exif_open(), exif_release(), GetNextPacket(), net_init(), and xi2c_open().

int pPacket = 0

Definition at line 50 of file network.c.

Referenced by Handler(), and ParseArgs().

int printPacketType = CHAR

Definition at line 63 of file network.c.

Referenced by Handler(), and ParseArgs().

int promisc = 1

Definition at line 58 of file network.c.

Referenced by net_init(), and ParseArgs().

struct sockaddr sock_addr

Definition at line 48 of file network.c.

Referenced by InitSendSocket(), and SendToDevice().

int sock_fd

Definition at line 49 of file network.c.

Referenced by InitSendSocket(), and SendToDevice().


Generated on Fri Nov 28 00:08:40 2008 for elphel by  doxygen 1.5.1