1 #ifndef _IP_H 2 #define _IP_H 3 4 /* We need 'uint16_t' */ 5 #include "types.h" 6 /* We need 'in_addr' */ 7 #include "in.h" 8 9 struct iphdr { 10 uint8_t verhdrlen; 11 uint8_t service; 12 uint16_t len; 13 uint16_t ident; 14 uint16_t frags; 15 uint8_t ttl; 16 uint8_t protocol; 17 uint16_t chksum; 18 in_addr src; 19 in_addr dest; 20 }; 21 22 extern void build_ip_hdr(unsigned long __destip, int __ttl, int __protocol, 23 int __option_len, int __len, const void * __buf); 24 25 extern int ip_transmit(int __len, const void * __buf); 26 27 extern uint16_t ipchksum(const void * __data, unsigned long __length); 28 29 extern uint16_t add_ipchksums(unsigned long __offset, uint16_t __sum, 30 uint16_t __new); 31 32 33 34 35 36 #endif /* _IP_H */ 37