xref: /csrg-svn/sys/netinet/ip_var.h (revision 23185)
1*23185Smckusick /*
2*23185Smckusick  * Copyright (c) 1982 Regents of the University of California.
3*23185Smckusick  * All rights reserved.  The Berkeley software License Agreement
4*23185Smckusick  * specifies the terms and conditions for redistribution.
5*23185Smckusick  *
6*23185Smckusick  *	@(#)ip_var.h	6.4 (Berkeley) 06/08/85
7*23185Smckusick  */
84893Swnj 
94893Swnj /*
104893Swnj  * Overlay for ip header used by other protocols (tcp, udp).
114893Swnj  */
124893Swnj struct ipovly {
134899Swnj 	caddr_t	ih_next, ih_prev;	/* for protocol sequence q's */
144899Swnj 	u_char	ih_x1;			/* (unused) */
154899Swnj 	u_char	ih_pr;			/* protocol */
164924Swnj 	short	ih_len;			/* protocol length */
174924Swnj 	struct	in_addr ih_src;		/* source internet address */
184924Swnj 	struct	in_addr ih_dst;		/* destination internet address */
194893Swnj };
204893Swnj 
214893Swnj /*
224893Swnj  * Ip reassembly queue structure.  Each fragment
234893Swnj  * being reassembled is attached to one of these structures.
244893Swnj  * They are timed out after ipq_ttl drops to 0, and may also
254893Swnj  * be reclaimed if memory becomes tight.
264893Swnj  */
274893Swnj struct ipq {
284893Swnj 	struct	ipq *next,*prev;	/* to other reass headers */
294893Swnj 	u_char	ipq_ttl;		/* time for reass q to live */
304893Swnj 	u_char	ipq_p;			/* protocol of this fragment */
314893Swnj 	u_short	ipq_id;			/* sequence id for reassembly */
324893Swnj 	struct	ipasfrag *ipq_next,*ipq_prev;
334893Swnj 					/* to ip headers of fragments */
344924Swnj 	struct	in_addr ipq_src,ipq_dst;
354893Swnj };
364893Swnj 
374893Swnj /*
384893Swnj  * Ip header, when holding a fragment.
399185Ssam  *
409185Ssam  * Note: ipf_next must be at same offset as ipq_next above
414893Swnj  */
424893Swnj struct	ipasfrag {
439992Ssam #ifdef vax
444893Swnj 	u_char	ip_hl:4,
454893Swnj 		ip_v:4;
469992Ssam #endif
474893Swnj 	u_char	ipf_mff;		/* copied from (ip_off&IP_MF) */
484893Swnj 	short	ip_len;
494893Swnj 	u_short	ip_id;
504893Swnj 	short	ip_off;
514893Swnj 	u_char	ip_ttl;
524893Swnj 	u_char	ip_p;
534893Swnj 	u_short	ip_sum;
544899Swnj 	struct	ipasfrag *ipf_next;	/* next fragment */
554899Swnj 	struct	ipasfrag *ipf_prev;	/* previous fragment */
564893Swnj };
574893Swnj 
584924Swnj struct	ipstat {
595162Swnj 	int	ips_badsum;		/* checksum bad */
605162Swnj 	int	ips_tooshort;		/* packet too short */
6111233Ssam 	int	ips_toosmall;		/* not enough data */
6211233Ssam 	int	ips_badhlen;		/* ip header length < data size */
6311233Ssam 	int	ips_badlen;		/* ip length < ip header length */
6421022Skarels 	long	ips_forward;		/* packets forwarded */
6521022Skarels 	long	ips_cantforward;	/* packets rcvd for unreachable dest */
664924Swnj };
674924Swnj 
684893Swnj #ifdef KERNEL
6912418Ssam /* flags passed to ip_output as last parameter */
7017051Skarels #define	IP_FORWARDING		0x1		/* most of ip header exists */
7117051Skarels #define	IP_ROUTETOIF		SO_DONTROUTE	/* bypass routing tables */
7217051Skarels #define	IP_ALLOWBROADCAST	SO_BROADCAST	/* can send broadcast packets */
7312418Ssam 
744924Swnj struct	ipstat	ipstat;
754893Swnj struct	ipq	ipq;			/* ip reass. queue */
764893Swnj u_short	ip_id;				/* ip packet ctr, for ids */
774893Swnj #endif
78