4 #define LITTLE_ENDIAN 1234
5 #define BIG_ENDIAN 4321
6 #if defined(__BIG_ENDIAN)
7 #error we are in bigendian
8 #elif defined(__LITTLE_ENDIAN)
9 //#warning we are in littleendian
10 #define BYTE_ORDER LITTLE_ENDIAN
15 /* XXX endiannes doesn't belong here */
16 // #define LITTLE_ENDIAN 1234
17 // #define BIG_ENDIAN 4321
18 // #define BYTE_ORDER LITTLE_ENDIAN
21 * Structure of an internet header, naked of options.
24 #if BYTE_ORDER == LITTLE_ENDIAN
25 u_char ip_hl:4, /* header length */
28 #if BYTE_ORDER == BIG_ENDIAN
29 u_char ip_v:4, /* version */
30 ip_hl:4; /* header length */
32 u_char ip_tos; /* type of service */
33 u_short ip_len; /* total length */
34 u_short ip_id; /* identification */
35 u_short ip_off; /* fragment offset field */
36 #define IP_RF 0x8000 /* reserved fragment flag */
37 #define IP_DF 0x4000 /* dont fragment flag */
38 #define IP_MF 0x2000 /* more fragments flag */
39 #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
40 u_char ip_ttl; /* time to live */
41 u_char ip_p; /* protocol */
42 u_short ip_sum; /* checksum */
43 struct in_addr ip_src,ip_dst; /* source and dest address */
44 } __packed __aligned(4);
46 #endif /* _NETINET_IP_H_ */