xref: /csrg-svn/sys/netinet/in_pcb.h (revision 63218)
123178Smckusick /*
2*63218Sbostic  * Copyright (c) 1982, 1986, 1990, 1993
3*63218Sbostic  *	The Regents of the University of California.  All rights reserved.
423178Smckusick  *
544476Sbostic  * %sccs.include.redist.c%
632787Sbostic  *
7*63218Sbostic  *	@(#)in_pcb.h	8.1 (Berkeley) 06/10/93
823178Smckusick  */
94956Swnj 
104956Swnj /*
114956Swnj  * Common structure pcb for internet protocol implementation.
124956Swnj  * Here are stored pointers to local and foreign host table
134956Swnj  * entries, local and foreign socket numbers, and pointers
144956Swnj  * up (to a socket structure) and down (to a protocol-specific)
154956Swnj  * control block.
164956Swnj  */
174956Swnj struct inpcb {
184956Swnj 	struct	inpcb *inp_next,*inp_prev;
194956Swnj 					/* pointers to other pcb's */
205172Swnj 	struct	inpcb *inp_head;	/* pointer back to chain of inpcb's
215172Swnj 					   for this protocol */
224956Swnj 	struct	in_addr inp_faddr;	/* foreign host table entry */
234956Swnj 	u_short	inp_fport;		/* foreign port */
244956Swnj 	struct	in_addr inp_laddr;	/* local host table entry */
254956Swnj 	u_short	inp_lport;		/* local port */
264956Swnj 	struct	socket *inp_socket;	/* back pointer to socket */
274956Swnj 	caddr_t	inp_ppcb;		/* pointer to per-protocol pcb */
286350Ssam 	struct	route inp_route;	/* placeholder for routing entry */
2944370Skarels 	int	inp_flags;		/* generic IP/datagram flags */
3044370Skarels 	struct	ip inp_ip;		/* header prototype; should have more */
3124808Skarels 	struct	mbuf *inp_options;	/* IP options */
3254716Ssklower 	struct	ip_moptions *inp_moptions; /* IP multicast options */
334956Swnj };
344956Swnj 
3544370Skarels /* flags in inp_flags: */
3644370Skarels #define	INP_RECVOPTS		0x01	/* receive incoming IP options */
3744370Skarels #define	INP_RECVRETOPTS		0x02	/* receive IP options for reply */
3844370Skarels #define	INP_RECVDSTADDR		0x04	/* receive IP dst address */
3944370Skarels #define	INP_CONTROLOPTS		(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR)
4054716Ssklower #define	INP_HDRINCL		0x08	/* user supplies entire IP header */
4144370Skarels 
426028Sroot #define	INPLOOKUP_WILDCARD	1
436028Sroot #define	INPLOOKUP_SETLOCAL	2
446028Sroot 
454956Swnj #define	sotoinpcb(so)	((struct inpcb *)(so)->so_pcb)
464956Swnj 
474956Swnj #ifdef KERNEL
4861335Sbostic int	 in_losing __P((struct inpcb *));
4961335Sbostic int	 in_pcballoc __P((struct socket *, struct inpcb *));
5061335Sbostic int	 in_pcbbind __P((struct inpcb *, struct mbuf *));
5161335Sbostic int	 in_pcbconnect __P((struct inpcb *, struct mbuf *));
5261335Sbostic int	 in_pcbdetach __P((struct inpcb *));
5361335Sbostic int	 in_pcbdisconnect __P((struct inpcb *));
5461335Sbostic struct inpcb *
5561335Sbostic 	 in_pcblookup __P((struct inpcb *,
5661335Sbostic 	    struct in_addr, u_int, struct in_addr, u_int, int));
5761335Sbostic int	 in_pcbnotify __P((struct inpcb *, struct sockaddr *,
5861335Sbostic 	    u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)));
5961335Sbostic void	 in_rtchange __P((struct inpcb *, int));
6061335Sbostic int	 in_setpeeraddr __P((struct inpcb *, struct mbuf *));
6161335Sbostic int	 in_setsockaddr __P((struct inpcb *, struct mbuf *));
624956Swnj #endif
63