This digest is from Linux kernel ip.h, thanks to the open source GNU
struct IP
{
#if __byte_order = = __little_endian
unsigned int ip_hl:4;/* header length */
unsigned int ip_v:4;/* version */
#endif
#if __byte_order = = __big_endian
unsigned int ip_v:4;/* version */
unsigned int ip_hl:4;/* header length */
#endif
u_int8_t ip_tos;/* Type of service */
U_short ip_len;/* Total length */
U_short ip_id;/* Identification * *
U_short ip_off;/* Fragment Offset field */
#defineIP_RF 0x8000/* Reserved Fragment flag * *
#defineIP_DF 0x4000/* dont fragment flag * *
#defineIP_MF 0x2000/* MORE Fragments flag * *
#defineIP_OFFMASK 0x1fff/* mask for fragmenting bits */
u_int8_t ip_ttl;/* Time to live */
u_int8_t ip_p;/* Protocol * *
U_short ip_sum;/* Checksum * *
struct in_addr ip_src, ip_dst;/* source and dest address */
};
struct TIMESTAMP
{
u_int8_t Len;
u_int8_t ptr;
#if __byte_order = = __little_endian
unsigned int flags:4;
unsigned int overflow:4;
#elif __byte_order = = __big_endian
unsigned int overflow:4;
unsigned int flags:4;
#else
# error "Please fix <bits/endian.h>"
#endif
u_int32_t Data[9];
};
struct IPHDR
{
#if __byte_order = = __little_endian
unsigned int ihl:4;
unsigned int version:4;
#elif __byte_order = = __big_endian
unsigned int version:4;
unsigned int ihl:4;
#else
# error "Please fix <bits/endian.h>"
#endif
u_int8_t tos;
u_int16_t Tot_len;
u_int16_t ID;
u_int16_t Frag_off;
u_int8_t TTL;
u_int8_t Protocol;
u_int16_t check;
u_int32_t saddr;
u_int32_t daddr;
/*the options start here. */
};
/*
* Time stamp option structure.
*/
struct IP_TIMESTAMP
{
u_int8_t ipt_code;/* ipopt_ts * *
u_int8_t ipt_len;/* size of structure (variable) */
u_int8_t ipt_ptr;/* Index of current entry */
#if __byte_order = = __little_endian
unsigned int ipt_flg:4;/* flags, see below */
unsigned int ipt_oflw:4;/* overflow counter */
#endif
#if __byte_order = = __big_endian
unsigned int ipt_oflw:4;/* overflow counter */
unsigned int ipt_flg:4;/* flags, see below */
#endif
u_int32_t Data[9];
};
IP Data Structures