xref: /csrg-svn/sys/netinet/ip.h (revision 4501)
1*4501Swnj /* ip.h 1.2 81/10/14 */
24498Swnj struct ip {                     /* ip leader */
34498Swnj 	unsigned char ip_hl:4,          /* header length */
44498Swnj 		ip_v:4;                 /* version */
54498Swnj 	unsigned char ip_tos;           /* type of service */
64498Swnj #define ip_mff ip_tos                   /* more fragments flag (input) */
74498Swnj 	unsigned short ip_len;          /* total length */
84498Swnj 	unsigned short ip_id;           /* identification */
94498Swnj 	unsigned short ip_off;          /* fragment offset field */
104498Swnj #define ip_df 0x4000                    /* dont fragment flag */
114498Swnj #define ip_mf 0x2000                    /* more fragments flag (output) */
124498Swnj 	unsigned char ip_ttl;           /* time to live */
134498Swnj 	unsigned char ip_p;             /* protocol */
144498Swnj 	unsigned short ip_sum;          /* checksum */
154498Swnj #define ip_end ip_sum                   /* fragment end */
164498Swnj 	union {
174498Swnj 		struct socket ip_s;     /* source address */
184498Swnj 		struct ip *ip_nxt;      /* ->next fragment */
194498Swnj 	} I_sun;
204498Swnj #define ip_src  I_sun.ip_s
214498Swnj #define ip_next I_sun.ip_nxt
224498Swnj 	union {
234498Swnj 		struct socket ip_d;     /* destination address */
244498Swnj 		struct ip *ip_prv;      /* ->prev fragment */
254498Swnj 	} I_dun;
264498Swnj #define ip_dst  I_dun.ip_d
274498Swnj #define ip_prev I_dun.ip_prv
284498Swnj };
294498Swnj 
304498Swnj struct ipq {                    /* ip reass.q header */
314498Swnj 	struct ip iqx;                  /* dummy ip element for top of list */
324498Swnj 	struct ipq *iq_next;            /* -> next chain on q */
334498Swnj 	struct ipq *iq_prev;            /* -> prev chain on q */
344498Swnj 	struct ip iqh;                  /* fragment header */
354498Swnj };
364498Swnj 
374498Swnj #define IPVERSION 4             /* internet protocol version number */
384498Swnj #define IPLOLINK 155            /* internet link numbers */
394498Swnj #define IPHILINK 158
404498Swnj #define IPLINK IPLOLINK
414498Swnj #define MAXTTL 255              /* maximum time to live (seconds) */
424498Swnj 
43*4501Swnj #define	ip_bswap(p) { \
44*4501Swnj 	p->ip_len = ntohs(p->ip_len); \
45*4501Swnj 	p->ip_id = ntohs(p->ip_id); \
46*4501Swnj 	p->ip_off = ntohs(p->ip_off); }
47*4501Swnj 
48