Last change
on this file was
1649,
checked in by murphpo, 13 years ago
|
dyspan workshop prep
|
-
Property svn:executable set to
*
|
File size:
1016 bytes
|
Line | |
---|
1 | typedef struct { |
---|
2 | unsigned char version; |
---|
3 | unsigned char typeOfService; |
---|
4 | unsigned short length; |
---|
5 | unsigned short identification; |
---|
6 | unsigned short frag_offset; |
---|
7 | unsigned char ttl; |
---|
8 | unsigned char protocol; |
---|
9 | unsigned short checksum; |
---|
10 | unsigned int src_addr_ip; |
---|
11 | unsigned int dest_addr_ip; |
---|
12 | } __attribute__((packed)) ipv4_header; |
---|
13 | |
---|
14 | typedef struct { |
---|
15 | unsigned short hardware_type; |
---|
16 | unsigned short protocol_type; |
---|
17 | unsigned char hard_addr_len; |
---|
18 | unsigned char prot_addr_len; |
---|
19 | unsigned short opcode; |
---|
20 | // unsigned char src_addr_mac[6]; |
---|
21 | unsigned int src_addr_mac_hi; |
---|
22 | unsigned short src_addr_mac_lo; |
---|
23 | unsigned int src_addr_ip; |
---|
24 | // unsigned char dest_addr_mac[6]; |
---|
25 | unsigned int dest_addr_mac_hi; |
---|
26 | unsigned short dest_addr_mac_lo; |
---|
27 | unsigned int dest_addr_ip; |
---|
28 | } __attribute__((packed)) arp_header; |
---|
29 | |
---|
30 | typedef struct { |
---|
31 | unsigned char dest_addr_mac[6]; |
---|
32 | unsigned char src_addr_mac[6]; |
---|
33 | unsigned short ethertype; |
---|
34 | } __attribute__((packed)) ethernet_header; |
---|
35 | |
---|
36 | #define ETHERTYPE_ARP 0x0806 |
---|
37 | #define ETHERTYPE_IP 0x0800 |
---|
Note: See
TracBrowser
for help on using the repository browser.