#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, exit, 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 | ) |
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 | ) |
void PrintPacket | ( | const unsigned char * | p, | |
int | size, | |||
int | type | |||
) |
void SendToDevice | ( | unsigned char * | data, | |
int | data_len | |||
) |
int timeout | ( | struct timeval * | tvThen, | |
int | ms | |||
) |
struct timeval timeval_subtract | ( | struct timeval * | x, | |
struct timeval * | y | |||
) |
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 } |
int both_addresses = FALSE |
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 |
pcap_handler handler |
udword highest_ack_received |
char host1[MAX_STRING_LEN] |
char host2[MAX_STRING_LEN] |
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 |
struct packet_buf* last_rec_packet = &first_rec_packet |
int new_ack = FALSE |
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 pPacket = 0 |
int printPacketType = CHAR |
int promisc = 1 |
struct sockaddr sock_addr |
int sock_fd |