xref: /original-bsd/sys/netinet/in_pcb.h (revision 48611f03)
1 /*
2  * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)in_pcb.h	7.8 (Berkeley) 04/07/93
8  */
9 
10 /*
11  * Common structure pcb for internet protocol implementation.
12  * Here are stored pointers to local and foreign host table
13  * entries, local and foreign socket numbers, and pointers
14  * up (to a socket structure) and down (to a protocol-specific)
15  * control block.
16  */
17 struct inpcb {
18 	struct	inpcb *inp_next,*inp_prev;
19 					/* pointers to other pcb's */
20 	struct	inpcb *inp_head;	/* pointer back to chain of inpcb's
21 					   for this protocol */
22 	struct	in_addr inp_faddr;	/* foreign host table entry */
23 	u_short	inp_fport;		/* foreign port */
24 	struct	in_addr inp_laddr;	/* local host table entry */
25 	u_short	inp_lport;		/* local port */
26 	struct	socket *inp_socket;	/* back pointer to socket */
27 	caddr_t	inp_ppcb;		/* pointer to per-protocol pcb */
28 	struct	route inp_route;	/* placeholder for routing entry */
29 	int	inp_flags;		/* generic IP/datagram flags */
30 	struct	ip inp_ip;		/* header prototype; should have more */
31 	struct	mbuf *inp_options;	/* IP options */
32 	struct	ip_moptions *inp_moptions; /* IP multicast options */
33 };
34 
35 /* flags in inp_flags: */
36 #define	INP_RECVOPTS		0x01	/* receive incoming IP options */
37 #define	INP_RECVRETOPTS		0x02	/* receive IP options for reply */
38 #define	INP_RECVDSTADDR		0x04	/* receive IP dst address */
39 #define	INP_CONTROLOPTS		(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR)
40 #define	INP_HDRINCL		0x08	/* user supplies entire IP header */
41 
42 #define	INPLOOKUP_WILDCARD	1
43 #define	INPLOOKUP_SETLOCAL	2
44 
45 #define	sotoinpcb(so)	((struct inpcb *)(so)->so_pcb)
46 
47 #ifdef KERNEL
48 struct	inpcb *in_pcblookup __P((struct inpcb *, struct in_addr, int,
49 				 struct in_addr,  int, int));
50 #endif
51