#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 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 |
struct packet_buf * ack_on_seq | ( | int | seq | ) |
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 | ) |
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 | ) |
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 | ) |
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().
struct timeval timeval_subtract | ( | struct timeval * | x, | |
struct timeval * | y | |||
) |
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 } |
int both_addresses = FALSE |
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 |
pcap_handler handler |
udword highest_ack_received |
char host1[MAX_STRING_LEN] |
char host2[MAX_STRING_LEN] |
udword last_ack_received = -1 |
struct packet_buf* last_rec_packet = &first_rec_packet |
int one_id_only = TRUE |
int p_packet_bpl = 8 |
pcap_t* pd |
Definition at line 51 of file network.c.
Referenced by exif_open(), exif_release(), GetNextPacket(), net_init(), and xi2c_open().
int printPacketType = CHAR |
struct sockaddr sock_addr |