1*12418Ssam /* ip_var.h 4.10 83/05/12 */ 24893Swnj 34893Swnj /* 44893Swnj * Overlay for ip header used by other protocols (tcp, udp). 54893Swnj */ 64893Swnj struct ipovly { 74899Swnj caddr_t ih_next, ih_prev; /* for protocol sequence q's */ 84899Swnj u_char ih_x1; /* (unused) */ 94899Swnj u_char ih_pr; /* protocol */ 104924Swnj short ih_len; /* protocol length */ 114924Swnj struct in_addr ih_src; /* source internet address */ 124924Swnj struct in_addr ih_dst; /* destination internet address */ 134893Swnj }; 144893Swnj 154893Swnj /* 164893Swnj * Ip reassembly queue structure. Each fragment 174893Swnj * being reassembled is attached to one of these structures. 184893Swnj * They are timed out after ipq_ttl drops to 0, and may also 194893Swnj * be reclaimed if memory becomes tight. 204893Swnj */ 214893Swnj struct ipq { 224893Swnj struct ipq *next,*prev; /* to other reass headers */ 234893Swnj u_char ipq_ttl; /* time for reass q to live */ 244893Swnj u_char ipq_p; /* protocol of this fragment */ 254893Swnj u_short ipq_id; /* sequence id for reassembly */ 264893Swnj struct ipasfrag *ipq_next,*ipq_prev; 274893Swnj /* to ip headers of fragments */ 284924Swnj struct in_addr ipq_src,ipq_dst; 294893Swnj }; 304893Swnj 314893Swnj /* 324893Swnj * Ip header, when holding a fragment. 339185Ssam * 349185Ssam * Note: ipf_next must be at same offset as ipq_next above 354893Swnj */ 364893Swnj struct ipasfrag { 379992Ssam #ifdef vax 384893Swnj u_char ip_hl:4, 394893Swnj ip_v:4; 409992Ssam #endif 419992Ssam #ifdef sun 429992Ssam u_char ip_v:4, 439992Ssam ip_hl:4; 449992Ssam #endif 454893Swnj u_char ipf_mff; /* copied from (ip_off&IP_MF) */ 464893Swnj short ip_len; 474893Swnj u_short ip_id; 484893Swnj short ip_off; 494893Swnj u_char ip_ttl; 504893Swnj u_char ip_p; 514893Swnj u_short ip_sum; 524899Swnj struct ipasfrag *ipf_next; /* next fragment */ 534899Swnj struct ipasfrag *ipf_prev; /* previous fragment */ 544893Swnj }; 554893Swnj 564924Swnj struct ipstat { 575162Swnj int ips_badsum; /* checksum bad */ 585162Swnj int ips_tooshort; /* packet too short */ 5911233Ssam int ips_toosmall; /* not enough data */ 6011233Ssam int ips_badhlen; /* ip header length < data size */ 6111233Ssam int ips_badlen; /* ip length < ip header length */ 624924Swnj }; 634924Swnj 644893Swnj #ifdef KERNEL 65*12418Ssam /* flags passed to ip_output as last parameter */ 66*12418Ssam #define IP_FORWARDING 0x1 /* most of ip header exists */ 67*12418Ssam #define IP_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ 68*12418Ssam #define IP_ALLOWBROADCAST SS_PRIV /* can send broadcast packets */ 69*12418Ssam 704924Swnj struct ipstat ipstat; 714893Swnj struct ipq ipq; /* ip reass. queue */ 724893Swnj u_short ip_id; /* ip packet ctr, for ids */ 734893Swnj #endif 74