1 #ifndef __PROTOCOL_IP4_H__
2 #define __PROTOCOL_IP4_H__
3 
4 #ifndef IPVERSION
5 #define IPVERSION	 4
6 #endif
7 
8 struct ip {
9 #if BYTE_ORDER == LITTLE_ENDIAN
10 		u_int		ip_hl:4,				/* header length */
11 						ip_v:4;					/* version */
12 #endif
13 #if BYTE_ORDER == BIG_ENDIAN
14 		u_int		ip_v:4,				 	/* version */
15 						ip_hl:4;				/* header length */
16 #endif
17 		u_int8_t		ip_tos;		 	/* type of service */
18 		u_int16_t	 ip_len;		 	/* total length */
19 		u_int16_t	 ip_id;				/* identification */
20 		u_int16_t	 ip_off;		 	/* fragment offset field */
21 #define IP_DF 0x4000				/* dont fragment flag */
22 #define IP_MF 0x2000				/* more fragments flag */
23 #define IP_OFFMASK 0x1fff		 /* mask for fragmenting bits */
24 		u_int8_t		ip_ttl;		 	/* time to live */
25 		u_int8_t		ip_p;			 	/* protocol */
26 		u_int16_t	 ip_sum;		 	/* checksum */
27 		struct	in_addr ip_src,ip_dst;	/* source and dest address */
28 };
29 
30 #endif
31