revert between 56095 -> 55830 in arch
[AROS.git] / workbench / network / common / include / netinet / in_pcb.h
blob0ea809a69aeefaff830a26424a267a7c6625ceb3
1 /*
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copytight (c) 2006 Pavel Fedin
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by the University of
17 * California, Berkeley and its contributors.
18 * 4. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
35 * $Id$
38 #ifndef _NETINET_IN_PCB_H_
39 #define _NETINET_IN_PCB_H_
42 * Common structure pcb for internet protocol implementation.
43 * Here are stored pointers to local and foreign host table
44 * entries, local and foreign socket numbers, and pointers
45 * up (to a socket structure) and down (to a protocol-specific)
46 * control block.
48 LIST_HEAD(inpcbhead, inpcb);
50 struct inpcb {
51 LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */
52 LIST_ENTRY(inpcb) inp_hash; /* hash list */
53 struct inpcbinfo *inp_pcbinfo;
54 struct in_addr inp_faddr; /* foreign host table entry */
55 u_short inp_fport; /* foreign port */
56 struct in_addr inp_laddr; /* local host table entry */
57 u_short inp_lport; /* local port */
58 struct socket *inp_socket; /* back pointer to socket */
59 caddr_t inp_ppcb; /* pointer to per-protocol pcb */
60 struct route inp_route; /* placeholder for routing entry */
61 int inp_flags; /* generic IP/datagram flags */
62 struct ip inp_ip; /* header prototype; should have more */
63 struct mbuf *inp_options; /* IP options */
64 struct ip_moptions *inp_moptions; /* IP multicast options */
67 struct inpcbinfo {
68 struct inpcbhead *listhead;
69 struct inpcbhead *hashbase;
70 unsigned long hashsize;
71 unsigned short lastport;
74 /* flags in inp_flags: */
75 #define INP_RECVOPTS 0x01 /* receive incoming IP options */
76 #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */
77 #define INP_RECVDSTADDR 0x04 /* receive IP dst address */
78 #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR)
79 #define INP_HDRINCL 0x08 /* user supplies entire IP header */
81 #ifdef sotorawcb /* defined in net/raw_cb.h */
83 * Common structure pcb for raw internet protocol access.
84 * Here are internet specific extensions to the raw control block,
85 * and space is allocated to the necessary sockaddrs.
87 struct raw_inpcb {
88 struct rawcb rinp_rcb; /* common control block prefix */
89 struct mbuf *rinp_options; /* IP options */
90 int rinp_flags; /* flags, e.g. raw sockopts */
91 #define RINPF_HDRINCL 0x1 /* user supplies entire IP header */
92 struct sockaddr_in rinp_faddr; /* foreign address */
93 struct sockaddr_in rinp_laddr; /* local address */
94 struct route rinp_route; /* placeholder for routing entry */
96 #endif
98 #define INPLOOKUP_WILDCARD 1
100 #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
101 #define sotorawinpcb(so) ((struct raw_inpcb *)(so)->so_pcb)
103 #ifdef KERNEL
104 void in_losing __P((struct inpcb *));
105 int in_pcballoc __P((struct socket *, struct inpcbinfo *));
106 int in_pcbbind __P((struct inpcb *, struct mbuf *));
107 int in_pcbconnect __P((struct inpcb *, struct mbuf *));
108 void in_pcbdetach __P((struct inpcb *));
109 void in_pcbdisconnect __P((struct inpcb *));
110 void in_pcbinshash __P((struct inpcb *));
111 int in_pcbladdr __P((struct inpcb *, struct mbuf *,
112 struct sockaddr_in **));
113 struct inpcb *
114 in_pcblookup __P((struct inpcbhead *,
115 struct in_addr, u_int, struct in_addr, u_int, int));
116 struct inpcb *
117 in_pcblookuphash __P((struct inpcbinfo *,
118 struct in_addr, u_int, struct in_addr, u_int));
119 void in_pcbnotify __P((struct inpcbhead *, struct sockaddr *,
120 u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)));
121 void in_pcbrehash __P((struct inpcb *));
122 void in_rtchange __P((struct inpcb *, int));
123 void in_setpeeraddr __P((struct inpcb *, struct mbuf *));
124 void in_setsockaddr __P((struct inpcb *, struct mbuf *));
125 #endif
127 #endif