xref: /csrg-svn/sys/netinet/ip_var.h (revision 5162)
1*5162Swnj /*	ip_var.h	4.5	81/12/02	*/
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.
334893Swnj  */
344893Swnj struct	ipasfrag {
354893Swnj 	u_char	ip_hl:4,
364893Swnj 		ip_v:4;
374893Swnj 	u_char	ipf_mff;		/* copied from (ip_off&IP_MF) */
384893Swnj 	short	ip_len;
394893Swnj 	u_short	ip_id;
404893Swnj 	short	ip_off;
414893Swnj 	u_char	ip_ttl;
424893Swnj 	u_char	ip_p;
434893Swnj 	u_short	ip_sum;
444899Swnj 	struct	ipasfrag *ipf_next;	/* next fragment */
454899Swnj 	struct	ipasfrag *ipf_prev;	/* previous fragment */
464893Swnj };
474893Swnj 
484924Swnj struct	ipstat {
49*5162Swnj 	int	ips_badsum;		/* checksum bad */
50*5162Swnj 	int	ips_tooshort;		/* packet too short */
514924Swnj };
524924Swnj 
534893Swnj #ifdef KERNEL
544924Swnj struct	ipstat	ipstat;
554893Swnj struct	ipq	ipq;			/* ip reass. queue */
564893Swnj struct	ipq	*ip_freef();
574893Swnj u_short	ip_id;				/* ip packet ctr, for ids */
584893Swnj #endif
59