From: Stefan E. <se...@us...> - 2003-04-01 18:50:06
|
Update of /cvsroot/blob/blob/include/net In directory sc8-pr-cvs1:/tmp/cvs-serv369 Modified Files: arp.h ether.h Log Message: - packet header structs. Tired of counting byte offsets ;) Index: arp.h =================================================================== RCS file: /cvsroot/blob/blob/include/net/arp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- arp.h 18 Mar 2003 16:18:53 -0000 1.2 +++ arp.h 1 Apr 2003 18:50:01 -0000 1.3 @@ -8,6 +8,21 @@ * published by the Free Software Foundation. */ +struct arp_ethernet { + unsigned char hw[6]; + unsigned char ip[4]; +} __attribute__ ((packed)); + +struct arp_packet { + unsigned short hw_type; + unsigned short proto_type; + unsigned char hw_len; + unsigned char proto_len; + unsigned short opcode; + struct arp_ethernet sender; + struct arp_ethernet target; +} __attribute__ ((packed)); + /********************************************************************** * do_arp - send ARP request to server * @thwaddr: the target HW address we received @@ -17,3 +32,5 @@ * ethernet HW address <thwaddr> for the IP address <tipaddr>. */ int do_arp(unsigned char *thwaddr, unsigned char *tipaddr); + +int do_arp_reply(unsigned char *rx_pkt, unsigned int size); Index: ether.h =================================================================== RCS file: /cvsroot/blob/blob/include/net/ether.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ether.h 18 Mar 2003 16:18:54 -0000 1.2 +++ ether.h 1 Apr 2003 18:50:01 -0000 1.3 @@ -11,6 +11,14 @@ #ifndef _BLOB_ETHER_H #define _BLOB_ETHER_H 1 +struct ether_hdr { + unsigned char dest[6]; + unsigned char src[6]; + unsigned short proto; +} __attribute__ ((packed)); + +#define HTON( s ) ( ((s&0xff00)>>8 ) | ((s&0xff)<<8) ) + /********************************************************************** * writeether - send a ethernet packet * @buf: the packet |