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, fd, and memcpy().

Referenced by net_init().

void GetNextPacket ( void   ) 

Definition at line 220 of file network.c.

References buf, db2, 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 sock_addr, and sock_fd.

Referenced by net_init().

void net_init ( void   ) 

Definition at line 103 of file network.c.

References dev, device, 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, 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, fd, listenOnly, netBoot, nrof_net_packets, seq, 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.

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 set_rtc_fpga().

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 Thu Aug 7 16:21:01 2008 for elphel by  doxygen 1.5.1