reset optind before getopt() -- fixes 'make -k clean' failure
[unix-history] / usr / src / sys / netinet / in_pcb.h
CommitLineData
8ae0e4b4 1/*
9dfba522 2 * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
2b6b6284 3 * All rights reserved.
8ae0e4b4 4 *
2b6b6284 5 * Redistribution and use in source and binary forms are permitted
616d42db
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2b6b6284 16 *
9dfba522 17 * @(#)in_pcb.h 7.5 (Berkeley) %G%
8ae0e4b4 18 */
bae4854b
BJ
19
20/*
21 * Common structure pcb for internet protocol implementation.
22 * Here are stored pointers to local and foreign host table
23 * entries, local and foreign socket numbers, and pointers
24 * up (to a socket structure) and down (to a protocol-specific)
25 * control block.
26 */
27struct inpcb {
28 struct inpcb *inp_next,*inp_prev;
29 /* pointers to other pcb's */
b454c3ea
BJ
30 struct inpcb *inp_head; /* pointer back to chain of inpcb's
31 for this protocol */
bae4854b
BJ
32 struct in_addr inp_faddr; /* foreign host table entry */
33 u_short inp_fport; /* foreign port */
34 struct in_addr inp_laddr; /* local host table entry */
35 u_short inp_lport; /* local port */
36 struct socket *inp_socket; /* back pointer to socket */
37 caddr_t inp_ppcb; /* pointer to per-protocol pcb */
c124e997 38 struct route inp_route; /* placeholder for routing entry */
9dfba522
MK
39 int inp_flags; /* generic IP/datagram flags */
40 struct ip inp_ip; /* header prototype; should have more */
ae484c2c 41 struct mbuf *inp_options; /* IP options */
bae4854b
BJ
42};
43
9dfba522
MK
44/* flags in inp_flags: */
45#define INP_RECVOPTS 0x01 /* receive incoming IP options */
46#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */
47#define INP_RECVDSTADDR 0x04 /* receive IP dst address */
48#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR)
49
b4dc7708
KS
50#ifdef sotorawcb
51/*
52 * Common structure pcb for raw internet protocol access.
53 * Here are internet specific extensions to the raw control block,
54 * and space is allocated to the necessary sockaddrs.
55 */
56struct raw_inpcb {
57 struct rawcb rinp_rcb; /* common control block prefix */
58 struct mbuf *rinp_options; /* IP options */
59 int rinp_flags; /* flags, e.g. raw sockopts */
60#define RINPF_HDRINCL 0x1 /* user supplies entire IP header */
61 struct sockaddr_in rinp_faddr; /* foreign address */
62 struct sockaddr_in rinp_laddr; /* local address */
63 struct route rinp_route; /* placeholder for routing entry */
64};
65#endif
66
ebcadd38
BJ
67#define INPLOOKUP_WILDCARD 1
68#define INPLOOKUP_SETLOCAL 2
69
bae4854b 70#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
b4dc7708 71#define sotorawinpcb(so) ((struct raw_inpcb *)(so)->so_pcb)
bae4854b
BJ
72
73#ifdef KERNEL
74struct inpcb *in_pcblookup();
75#endif