00001 //These definitions are borrowed from tcpdump 00002 #ifndef ETHER_HDRLEN 00003 #define ETHER_HDRLEN 14 00004 #endif 00005 00006 struct ip_s { 00007 u_int8_t ip_vhl; /* header length, version */ 00008 #define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4) 00009 #define IP_HL(ip) ((ip)->ip_vhl & 0x0f) 00010 u_int8_t ip_tos; /* type of service */ 00011 u_int16_t ip_len; /* total length */ 00012 u_int16_t ip_id; /* identification */ 00013 u_int16_t ip_off; /* fragment offset field */ 00014 #define IP_DF 0x4000 /* dont fragment flag */ 00015 #define IP_MF 0x2000 /* more fragments flag */ 00016 #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ 00017 u_int8_t ip_ttl; /* time to live */ 00018 u_int8_t ip_p; /* protocol */ 00019 u_int16_t ip_sum; /* checksum */ 00020 struct in_addr ip_src,ip_dst; /* source and dest address */ 00021 };