fixes for range locking
[unix-history] / usr / src / sys / deprecated / bbnnet / in_pcb.h
CommitLineData
17efd7fe
MK
1#define RCSINPCBHDR "$Header: in_pcb.h,v 1.7 85/07/31 09:31:17 walsh Exp $"
2
3/*
4 * Common structure pcb for internet protocol implementation.
5 * Here are stored pointers to local and foreign host table
6 * entries, local and foreign socket numbers, and pointers
7 * up (to a socket structure) and down (to a protocol-specific)
8 * control block.
9 */
10#define MAX_IPOPTLEN 60
11
12struct inpcb {
13 struct inpcb *inp_next,*inp_prev;
14 /* pointers to other pcb's */
15 struct in_addr inp_faddr; /* foreign host table entry */
16 struct in_addr inp_laddr; /* local host table entry */
17 u_short inp_fport; /* foreign port */
18 u_short inp_lport; /* local port */
19 struct socket *inp_socket; /* back pointer to socket */
20 caddr_t inp_ppcb; /* pointer to per-protocol pcb */
21 struct route inp_route; /* routing entry */
22 char inp_optlen;
23 char inp_options[MAX_IPOPTLEN];
24};
25
26/*
27 * protocol specific structure passed to some pcb controlling routines.
28 * new in 4.3 because addition of new protocols required a more generalized
29 * in_pcbbind(). rootport <= resvport <= maxport. non-superuser can
30 * bind rootport -> maxport, but kernel will bind resvport -> maxport so
31 * that projects can test things without being root and without fearing
32 * someone may accidentally take their port.
33 */
34
35struct pr_advice {
36 u_short rootport; /* ports reserved exclusively for root */
37 u_short resvport; /* ports reserved from random allocation */
38 u_short maxport; /* absolute max port */
39 u_short nowport; /* port last used, initialize to resvport! */
40 u_short portsize; /* size of port (in bytes) */
41 int (*bind_used)(); /* routine called to check before binding */
42};
43
44/*
45 * protocol specific setsockopt/getsockopt calls.
46 */
47#define SO_IPROUTE 2
48
49#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
50
51
52#ifdef KERNEL
53
54extern struct inpcb *in_pcblookup();
55
56#define uwake(inp) \
57{ \
58 sbwakeup(&inp->inp_socket->so_rcv); \
59 sbwakeup(&inp->inp_socket->so_snd); \
60}
61
62#endif