xref: /csrg-svn/sys/netinet/ip_var.h (revision 21022)
1*21022Skarels /*	ip_var.h	6.3	85/05/23	*/
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
414893Swnj 	u_char	ipf_mff;		/* copied from (ip_off&IP_MF) */
424893Swnj 	short	ip_len;
434893Swnj 	u_short	ip_id;
444893Swnj 	short	ip_off;
454893Swnj 	u_char	ip_ttl;
464893Swnj 	u_char	ip_p;
474893Swnj 	u_short	ip_sum;
484899Swnj 	struct	ipasfrag *ipf_next;	/* next fragment */
494899Swnj 	struct	ipasfrag *ipf_prev;	/* previous fragment */
504893Swnj };
514893Swnj 
524924Swnj struct	ipstat {
535162Swnj 	int	ips_badsum;		/* checksum bad */
545162Swnj 	int	ips_tooshort;		/* packet too short */
5511233Ssam 	int	ips_toosmall;		/* not enough data */
5611233Ssam 	int	ips_badhlen;		/* ip header length < data size */
5711233Ssam 	int	ips_badlen;		/* ip length < ip header length */
58*21022Skarels 	long	ips_forward;		/* packets forwarded */
59*21022Skarels 	long	ips_cantforward;	/* packets rcvd for unreachable dest */
604924Swnj };
614924Swnj 
624893Swnj #ifdef KERNEL
6312418Ssam /* flags passed to ip_output as last parameter */
6417051Skarels #define	IP_FORWARDING		0x1		/* most of ip header exists */
6517051Skarels #define	IP_ROUTETOIF		SO_DONTROUTE	/* bypass routing tables */
6617051Skarels #define	IP_ALLOWBROADCAST	SO_BROADCAST	/* can send broadcast packets */
6712418Ssam 
684924Swnj struct	ipstat	ipstat;
694893Swnj struct	ipq	ipq;			/* ip reass. queue */
704893Swnj u_short	ip_id;				/* ip packet ctr, for ids */
714893Swnj #endif
72