1 /* ip.h 1.3 81/10/21 */ 2 3 struct ip { 4 u_char ip_hl:4, /* header length */ 5 ip_v:4; /* version */ 6 u_char ip_tos; /* type of service */ 7 #define ip_mff ip_tos /* more fragments flag (input) */ 8 u_short ip_len; /* total length */ 9 u_short ip_id; /* identification */ 10 u_short ip_off; /* fragment offset field */ 11 #define ip_df 0x4000 /* dont fragment flag */ 12 #define ip_mf 0x2000 /* more fragments flag (output) */ 13 u_char ip_ttl; /* time to live */ 14 u_char ip_p; /* protocol */ 15 u_short ip_sum; /* checksum */ 16 #define ip_end ip_sum /* fragment end */ 17 union { 18 struct socket ip_s; /* source address */ 19 struct ip *ip_nxt; /* next fragment */ 20 } I_sun; 21 #define ip_src I_sun.ip_s 22 #define ip_next I_sun.ip_nxt 23 union { 24 struct socket ip_d; /* destination address */ 25 struct ip *ip_prv; /* prev fragment */ 26 } I_dun; 27 #define ip_dst I_dun.ip_d 28 #define ip_prev I_dun.ip_prv 29 }; 30 31 /* 32 * Ip reassembly queue. 33 */ 34 struct ipq { 35 struct ip iqx; /* dummy ip element for top of list */ 36 struct ipq *iq_next; /* -> next chain on q */ 37 struct ipq *iq_prev; /* -> prev chain on q */ 38 struct ip iqh; /* fragment header */ 39 }; 40 41 #define IPVERSION 4 /* internet protocol version number */ 42 #define IPLOLINK 155 /* internet link numbers */ 43 #define IPHILINK 158 44 #define IPLINK IPLOLINK 45 #define MAXTTL 255 /* maximum time to live (seconds) */ 46 47 #define ip_bswap(p) { \ 48 p->ip_len = ntohs(p->ip_len); \ 49 p->ip_id = ntohs(p->ip_id); \ 50 p->ip_off = ntohs(p->ip_off); } 51 52