1 |
1254 |
phoenix |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/netinet6_in6_pcb.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
//
|
12 |
|
|
// Portions of this software may have been derived from OpenBSD or other sources,
|
13 |
|
|
// and are covered by the appropriate copyright disclaimers included herein.
|
14 |
|
|
//
|
15 |
|
|
// -------------------------------------------
|
16 |
|
|
//
|
17 |
|
|
//####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
//#####DESCRIPTIONBEGIN####
|
20 |
|
|
//
|
21 |
|
|
// Author(s): gthomas
|
22 |
|
|
// Contributors: gthomas
|
23 |
|
|
// Date: 2000-01-10
|
24 |
|
|
// Purpose:
|
25 |
|
|
// Description:
|
26 |
|
|
//
|
27 |
|
|
//
|
28 |
|
|
//####DESCRIPTIONEND####
|
29 |
|
|
//
|
30 |
|
|
//==========================================================================
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/* $OpenBSD: in6_pcb.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
|
34 |
|
|
|
35 |
|
|
/*
|
36 |
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
37 |
|
|
* All rights reserved.
|
38 |
|
|
*
|
39 |
|
|
* Redistribution and use in source and binary forms, with or without
|
40 |
|
|
* modification, are permitted provided that the following conditions
|
41 |
|
|
* are met:
|
42 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
43 |
|
|
* notice, this list of conditions and the following disclaimer.
|
44 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
45 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
46 |
|
|
* documentation and/or other materials provided with the distribution.
|
47 |
|
|
* 3. Neither the name of the project nor the names of its contributors
|
48 |
|
|
* may be used to endorse or promote products derived from this software
|
49 |
|
|
* without specific prior written permission.
|
50 |
|
|
*
|
51 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
52 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
53 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
54 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
55 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
56 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
57 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
58 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
59 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
60 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
61 |
|
|
* SUCH DAMAGE.
|
62 |
|
|
*/
|
63 |
|
|
|
64 |
|
|
/*
|
65 |
|
|
* Copyright (c) 1982, 1986, 1990, 1993
|
66 |
|
|
* The Regents of the University of California. All rights reserved.
|
67 |
|
|
*
|
68 |
|
|
* Redistribution and use in source and binary forms, with or without
|
69 |
|
|
* modification, are permitted provided that the following conditions
|
70 |
|
|
* are met:
|
71 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
72 |
|
|
* notice, this list of conditions and the following disclaimer.
|
73 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
74 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
75 |
|
|
* documentation and/or other materials provided with the distribution.
|
76 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
77 |
|
|
* must display the following acknowledgement:
|
78 |
|
|
* This product includes software developed by the University of
|
79 |
|
|
* California, Berkeley and its contributors.
|
80 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
81 |
|
|
* may be used to endorse or promote products derived from this software
|
82 |
|
|
* without specific prior written permission.
|
83 |
|
|
*
|
84 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
85 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
86 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
87 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
88 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
89 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
90 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
91 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
92 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
93 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
94 |
|
|
* SUCH DAMAGE.
|
95 |
|
|
*
|
96 |
|
|
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
|
97 |
|
|
*/
|
98 |
|
|
|
99 |
|
|
#ifndef _NETINET6_IN6_PCB_H_
|
100 |
|
|
#define _NETINET6_IN6_PCB_H_
|
101 |
|
|
|
102 |
|
|
#include <sys/queue.h>
|
103 |
|
|
|
104 |
|
|
/*
|
105 |
|
|
* Common structure pcb for internet protocol implementation.
|
106 |
|
|
* Here are stored pointers to local and foreign host table
|
107 |
|
|
* entries, local and foreign socket numbers, and pointers
|
108 |
|
|
* up (to a socket structure) and down (to a protocol-specific)
|
109 |
|
|
* control block.
|
110 |
|
|
*/
|
111 |
|
|
struct icmp6_filter;
|
112 |
|
|
struct inpcbpolicy;
|
113 |
|
|
|
114 |
|
|
struct in6pcb {
|
115 |
|
|
struct in6pcb *in6p_next, *in6p_prev;
|
116 |
|
|
/* pointers to other pcb's */
|
117 |
|
|
struct in6pcb *in6p_head; /* pointer back to chain of
|
118 |
|
|
in6pcb's for this protocol */
|
119 |
|
|
struct in6_addr in6p_faddr; /* foreign host table entry */
|
120 |
|
|
u_short in6p_fport; /* foreign port */
|
121 |
|
|
struct in6_addr in6p_laddr; /* local host table entry */
|
122 |
|
|
u_short in6p_lport; /* local port */
|
123 |
|
|
u_int32_t in6p_flowinfo; /* priority and flowlabel */
|
124 |
|
|
struct socket *in6p_socket; /* back pointer to socket */
|
125 |
|
|
caddr_t in6p_ppcb; /* pointer to per-protocol pcb */
|
126 |
|
|
struct route_in6 in6p_route; /* placeholder for routing entry */
|
127 |
|
|
int in6p_flags; /* generic IP6/datagram flags */
|
128 |
|
|
int in6p_hops; /* default hop limit */
|
129 |
|
|
struct ip6_hdr in6p_ip6; /* header prototype */
|
130 |
|
|
struct mbuf *in6p_options; /* IP6 options */
|
131 |
|
|
struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
|
132 |
|
|
struct ip6_moptions *in6p_moptions; /* IP6 multicast options */
|
133 |
|
|
u_short in6p_ifindex;
|
134 |
|
|
/* should move the following just after next/prev */
|
135 |
|
|
LIST_ENTRY(in6pcb) in6p_hlist; /* hash chain */
|
136 |
|
|
u_long in6p_hash; /* hash value */
|
137 |
|
|
#if 1 /*IPSEC*/
|
138 |
|
|
struct inpcbpolicy *in6p_sp; /* security policy. */
|
139 |
|
|
#endif
|
140 |
|
|
struct icmp6_filter *in6p_icmp6filt;
|
141 |
|
|
int in6p_cksum; /* IPV6_CHECKSUM setsockopt */
|
142 |
|
|
};
|
143 |
|
|
|
144 |
|
|
#define in6p_ip6_nxt in6p_ip6.ip6_nxt /* for KAME src sync over BSD*'s */
|
145 |
|
|
|
146 |
|
|
/* flags in in6p_flags */
|
147 |
|
|
#define IN6P_RECVOPTS 0x01 /* receive incoming IP6 options */
|
148 |
|
|
#define IN6P_RECVRETOPTS 0x02 /* receive IP6 options for reply */
|
149 |
|
|
#define IN6P_RECVDSTADDR 0x04 /* receive IP6 dst address */
|
150 |
|
|
#define IN6P_HIGHPORT 0x10 /* user wants "high" port binding */
|
151 |
|
|
#define IN6P_LOWPORT 0x20 /* user wants "low" port binding */
|
152 |
|
|
#define IN6P_ANONPORT 0x40 /* port chosen for user */
|
153 |
|
|
#define IN6P_FAITH 0x80 /* accept FAITH'ed connections */
|
154 |
|
|
#define IN6P_PKTINFO 0x010000
|
155 |
|
|
#define IN6P_HOPLIMIT 0x020000
|
156 |
|
|
#define IN6P_NEXTHOP 0x040000
|
157 |
|
|
#define IN6P_HOPOPTS 0x080000
|
158 |
|
|
#define IN6P_DSTOPTS 0x100000
|
159 |
|
|
#define IN6P_RTHDR 0x200000
|
160 |
|
|
#define IN6P_CONTROLOPTS (0x3f0000 | IN6P_RECVOPTS | IN6P_RECVRETOPTS | IN6P_RECVDSTADDR)
|
161 |
|
|
|
162 |
|
|
#define IN6PLOOKUP_WILDCARD 1
|
163 |
|
|
#define IN6PLOOKUP_SETLOCAL 2
|
164 |
|
|
|
165 |
|
|
/* compute hash value for foreign and local in6_addr and port */
|
166 |
|
|
#define IN6_HASH(faddr, fport, laddr, lport) \
|
167 |
|
|
(((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \
|
168 |
|
|
(faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^ \
|
169 |
|
|
(laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \
|
170 |
|
|
(laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) \
|
171 |
|
|
+ (fport) + (lport))
|
172 |
|
|
|
173 |
|
|
#define sotoin6pcb(so) ((struct in6pcb *)(so)->so_pcb)
|
174 |
|
|
|
175 |
|
|
#ifdef _KERNEL
|
176 |
|
|
void in6_losing __P((struct in6pcb *));
|
177 |
|
|
int in6_pcballoc __P((struct socket *, struct in6pcb *));
|
178 |
|
|
int in6_pcbbind __P((struct in6pcb *, struct mbuf *));
|
179 |
|
|
int in6_pcbconnect __P((struct in6pcb *, struct mbuf *));
|
180 |
|
|
void in6_pcbdetach __P((struct in6pcb *));
|
181 |
|
|
void in6_pcbdisconnect __P((struct in6pcb *));
|
182 |
|
|
struct in6pcb *
|
183 |
|
|
in6_pcblookup __P((struct in6pcb *,
|
184 |
|
|
struct in6_addr *, u_int, struct in6_addr *,
|
185 |
|
|
u_int, int));
|
186 |
|
|
int in6_pcbnotify __P((struct in6pcb *, struct sockaddr *,
|
187 |
|
|
u_int, struct in6_addr *, u_int, int,
|
188 |
|
|
void (*)(struct in6pcb *, int)));
|
189 |
|
|
int in6_pcbsetport __P((struct in6_addr *, struct in6pcb *));
|
190 |
|
|
void in6_rtchange __P((struct in6pcb *, int));
|
191 |
|
|
void in6_setpeeraddr __P((struct in6pcb *, struct mbuf *));
|
192 |
|
|
void in6_setsockaddr __P((struct in6pcb *, struct mbuf *));
|
193 |
|
|
struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
|
194 |
|
|
struct ip6_pktopts *,
|
195 |
|
|
struct ip6_moptions *,
|
196 |
|
|
struct route_in6 *,
|
197 |
|
|
struct in6_addr *, int *));
|
198 |
|
|
int in6_selecthlim __P((struct in6pcb *, struct ifnet *));
|
199 |
|
|
|
200 |
|
|
#ifndef TCP6
|
201 |
|
|
extern struct rtentry *
|
202 |
|
|
in6_pcbrtentry __P((struct in6pcb *));
|
203 |
|
|
extern struct in6pcb *in6_pcblookup_connect __P((struct in6pcb *,
|
204 |
|
|
struct in6_addr *, u_int, struct in6_addr *, u_int, int));
|
205 |
|
|
extern struct in6pcb *in6_pcblookup_bind __P((struct in6pcb *,
|
206 |
|
|
struct in6_addr *, u_int, int));
|
207 |
|
|
#endif
|
208 |
|
|
#endif /* _KERNEL */
|
209 |
|
|
|
210 |
|
|
#endif /* !_NETINET6_IN6_PCB_H_ */
|