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