10 typedef struct sIPv4Header tIPv4Header;
15 // Spec says Version is first, but stupid bit ordering
16 unsigned HeaderLength: 4; // in 4-byte chunks
17 unsigned Version: 4; // = 4
18 } __attribute__((packed));
19 Uint8 DiffServices; // Differentiated Services
25 unsigned DontFragment: 1;
26 unsigned MoreFragments: 1;
27 unsigned FragOffLow: 5;
28 } __attribute__((packed));
29 Uint8 FragOffHi; // Number of 8-byte blocks from the original start
31 Uint8 TTL; // Max number of hops, effectively
33 Uint16 HeaderChecksum; // One's Complement Sum of the entire header must equal zero
39 } __attribute__((packed));
41 #define IP4PROT_ICMP 1
43 #define IP4PROT_UDP 17
45 #define IPV4_ETHERNET_ID 0x0800
48 extern int IPv4_RegisterCallback(int ID, tIPCallback Callback);
49 extern Uint16 IPv4_Checksum(const void *Buf, size_t Length);
50 extern int IPv4_SendPacket(tInterface *Iface, tIPv4 Address, int Protocol, int ID, int Length, const void *Data);