ip6_var.h revision 1.1.2.2 1 1.1.2.1 itojun /*
2 1.1.2.1 itojun * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 1.1.2.1 itojun * All rights reserved.
4 1.1.2.1 itojun *
5 1.1.2.1 itojun * Redistribution and use in source and binary forms, with or without
6 1.1.2.1 itojun * modification, are permitted provided that the following conditions
7 1.1.2.1 itojun * are met:
8 1.1.2.1 itojun * 1. Redistributions of source code must retain the above copyright
9 1.1.2.1 itojun * notice, this list of conditions and the following disclaimer.
10 1.1.2.1 itojun * 2. Redistributions in binary form must reproduce the above copyright
11 1.1.2.1 itojun * notice, this list of conditions and the following disclaimer in the
12 1.1.2.1 itojun * documentation and/or other materials provided with the distribution.
13 1.1.2.1 itojun * 3. Neither the name of the project nor the names of its contributors
14 1.1.2.1 itojun * may be used to endorse or promote products derived from this software
15 1.1.2.1 itojun * without specific prior written permission.
16 1.1.2.1 itojun *
17 1.1.2.1 itojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 1.1.2.1 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 1.1.2.1 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 1.1.2.1 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 1.1.2.1 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1.2.1 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1.2.1 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1.2.1 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1.2.1 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1.2.1 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1.2.1 itojun * SUCH DAMAGE.
28 1.1.2.1 itojun */
29 1.1.2.1 itojun
30 1.1.2.1 itojun /*
31 1.1.2.1 itojun * Copyright (c) 1982, 1986, 1993
32 1.1.2.1 itojun * The Regents of the University of California. All rights reserved.
33 1.1.2.1 itojun *
34 1.1.2.1 itojun * Redistribution and use in source and binary forms, with or without
35 1.1.2.1 itojun * modification, are permitted provided that the following conditions
36 1.1.2.1 itojun * are met:
37 1.1.2.1 itojun * 1. Redistributions of source code must retain the above copyright
38 1.1.2.1 itojun * notice, this list of conditions and the following disclaimer.
39 1.1.2.1 itojun * 2. Redistributions in binary form must reproduce the above copyright
40 1.1.2.1 itojun * notice, this list of conditions and the following disclaimer in the
41 1.1.2.1 itojun * documentation and/or other materials provided with the distribution.
42 1.1.2.1 itojun * 3. All advertising materials mentioning features or use of this software
43 1.1.2.1 itojun * must display the following acknowledgement:
44 1.1.2.1 itojun * This product includes software developed by the University of
45 1.1.2.1 itojun * California, Berkeley and its contributors.
46 1.1.2.1 itojun * 4. Neither the name of the University nor the names of its contributors
47 1.1.2.1 itojun * may be used to endorse or promote products derived from this software
48 1.1.2.1 itojun * without specific prior written permission.
49 1.1.2.1 itojun *
50 1.1.2.1 itojun * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 1.1.2.1 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 1.1.2.1 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 1.1.2.1 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 1.1.2.1 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 1.1.2.1 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 1.1.2.1 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 1.1.2.1 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 1.1.2.1 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 1.1.2.1 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 1.1.2.1 itojun * SUCH DAMAGE.
61 1.1.2.1 itojun *
62 1.1.2.1 itojun * @(#)ip_var.h 8.1 (Berkeley) 6/10/93
63 1.1.2.1 itojun */
64 1.1.2.1 itojun
65 1.1.2.1 itojun #ifndef _NETINET6_IP6_VAR_H_
66 1.1.2.1 itojun #define _NETINET6_IP6_VAR_H_
67 1.1.2.1 itojun
68 1.1.2.1 itojun /*
69 1.1.2.1 itojun * IP6 reassembly queue structure. Each fragment
70 1.1.2.1 itojun * being reassembled is attached to one of these structures.
71 1.1.2.1 itojun */
72 1.1.2.1 itojun struct ip6q {
73 1.1.2.1 itojun u_long ip6q_head;
74 1.1.2.1 itojun u_short ip6q_len;
75 1.1.2.1 itojun u_char ip6q_nxt;
76 1.1.2.1 itojun u_char ip6q_hlim;
77 1.1.2.1 itojun struct ip6asfrag *ip6q_down;
78 1.1.2.1 itojun struct ip6asfrag *ip6q_up;
79 1.1.2.1 itojun u_long ip6q_ident;
80 1.1.2.1 itojun u_char ip6q_arrive;
81 1.1.2.1 itojun u_char ip6q_ttl;
82 1.1.2.1 itojun struct in6_addr ip6q_src, ip6q_dst;
83 1.1.2.1 itojun struct ip6q *ip6q_next;
84 1.1.2.1 itojun struct ip6q *ip6q_prev;
85 1.1.2.1 itojun int ip6q_unfrglen;
86 1.1.2.1 itojun #ifdef notyet
87 1.1.2.1 itojun u_char *ip6q_nxtp;
88 1.1.2.1 itojun #endif
89 1.1.2.1 itojun };
90 1.1.2.1 itojun
91 1.1.2.1 itojun struct ip6asfrag {
92 1.1.2.1 itojun u_long ip6af_head;
93 1.1.2.1 itojun u_short ip6af_len;
94 1.1.2.1 itojun u_char ip6af_nxt;
95 1.1.2.1 itojun u_char ip6af_hlim;
96 1.1.2.1 itojun /* must not override the above members during reassembling */
97 1.1.2.1 itojun struct ip6asfrag *ip6af_down;
98 1.1.2.1 itojun struct ip6asfrag *ip6af_up;
99 1.1.2.1 itojun u_short ip6af_mff;
100 1.1.2.1 itojun u_short ip6af_off;
101 1.1.2.1 itojun struct mbuf *ip6af_m;
102 1.1.2.1 itojun u_long ip6af_offset; /* offset where next header starts */
103 1.1.2.1 itojun u_short ip6af_frglen; /* fragmentable part length */
104 1.1.2.1 itojun u_char ip6af_x1[10];
105 1.1.2.1 itojun };
106 1.1.2.1 itojun
107 1.1.2.1 itojun #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
108 1.1.2.1 itojun
109 1.1.2.1 itojun struct ip6_moptions {
110 1.1.2.1 itojun struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
111 1.1.2.1 itojun u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
112 1.1.2.1 itojun u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
113 1.1.2.1 itojun LIST_HEAD(, in6_multi_mship) im6o_memberships;
114 1.1.2.1 itojun };
115 1.1.2.1 itojun
116 1.1.2.1 itojun /*
117 1.1.2.1 itojun * Control options for outgoing packets
118 1.1.2.1 itojun */
119 1.1.2.1 itojun
120 1.1.2.1 itojun /* Routing header related info */
121 1.1.2.1 itojun struct ip6po_rhinfo {
122 1.1.2.1 itojun struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
123 1.1.2.1 itojun struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
124 1.1.2.1 itojun };
125 1.1.2.1 itojun #define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
126 1.1.2.1 itojun #define ip6po_route ip6po_rhinfo.ip6po_rhi_route
127 1.1.2.1 itojun
128 1.1.2.1 itojun struct ip6_pktopts {
129 1.1.2.1 itojun struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
130 1.1.2.1 itojun int ip6po_hlim; /* Hoplimit for outgoing packets */
131 1.1.2.1 itojun struct in6_pktinfo *ip6po_pktinfo; /* Outgoing IF/address information */
132 1.1.2.1 itojun struct sockaddr *ip6po_nexthop; /* Next-hop address */
133 1.1.2.1 itojun struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
134 1.1.2.1 itojun struct ip6_dest *ip6po_dest1; /* Destination options header(1st part) */
135 1.1.2.1 itojun struct ip6po_rhinfo ip6po_rhinfo; /* Routing header related info. */
136 1.1.2.1 itojun struct ip6_dest *ip6po_dest2; /* Destination options header(2nd part) */
137 1.1.2.1 itojun };
138 1.1.2.1 itojun
139 1.1.2.1 itojun struct ip6stat {
140 1.1.2.1 itojun u_long ip6s_total; /* total packets received */
141 1.1.2.1 itojun u_long ip6s_tooshort; /* packet too short */
142 1.1.2.1 itojun u_long ip6s_toosmall; /* not enough data */
143 1.1.2.1 itojun u_long ip6s_fragments; /* fragments received */
144 1.1.2.1 itojun u_long ip6s_fragdropped; /* frags dropped(dups, out of space) */
145 1.1.2.1 itojun u_long ip6s_fragtimeout; /* fragments timed out */
146 1.1.2.1 itojun u_long ip6s_fragoverflow; /* fragments that exceeded limit */
147 1.1.2.1 itojun u_long ip6s_forward; /* packets forwarded */
148 1.1.2.1 itojun u_long ip6s_cantforward; /* packets rcvd for unreachable dest */
149 1.1.2.1 itojun u_long ip6s_redirectsent; /* packets forwarded on same net */
150 1.1.2.1 itojun u_long ip6s_delivered; /* datagrams delivered to upper level*/
151 1.1.2.1 itojun u_long ip6s_localout; /* total ip packets generated here */
152 1.1.2.1 itojun u_long ip6s_odropped; /* lost packets due to nobufs, etc. */
153 1.1.2.1 itojun u_long ip6s_reassembled; /* total packets reassembled ok */
154 1.1.2.1 itojun u_long ip6s_fragmented; /* datagrams sucessfully fragmented */
155 1.1.2.1 itojun u_long ip6s_ofragments; /* output fragments created */
156 1.1.2.1 itojun u_long ip6s_cantfrag; /* don't fragment flag was set, etc. */
157 1.1.2.1 itojun u_long ip6s_badoptions; /* error in option processing */
158 1.1.2.1 itojun u_long ip6s_noroute; /* packets discarded due to no route */
159 1.1.2.1 itojun u_long ip6s_badvers; /* ip6 version != 6 */
160 1.1.2.1 itojun u_long ip6s_rawout; /* total raw ip packets generated */
161 1.1.2.1 itojun u_long ip6s_badscope; /* scope error */
162 1.1.2.1 itojun u_long ip6s_notmember; /* don't join this multicast group */
163 1.1.2.1 itojun u_long ip6s_nxthist[256]; /* next header history */
164 1.1.2.1 itojun u_long ip6s_m1; /* one mbuf */
165 1.1.2.1 itojun u_long ip6s_m2m[32]; /* two or more mbuf */
166 1.1.2.1 itojun u_long ip6s_mext1; /* one ext mbuf */
167 1.1.2.1 itojun u_long ip6s_mext2m; /* two or more ext mbuf */
168 1.1.2.1 itojun u_long ip6s_exthdrtoolong; /* ext hdr are not continuous */
169 1.1.2.1 itojun u_long ip6s_nogif; /* no match gif found */
170 1.1.2.1 itojun u_long ip6s_toomanyhdr; /* discarded due to too many headers */
171 1.1.2.1 itojun };
172 1.1.2.1 itojun
173 1.1.2.1 itojun #ifdef _KERNEL
174 1.1.2.1 itojun /* flags passed to ip6_output as last parameter */
175 1.1.2.1 itojun #define IPV6_DADOUTPUT 0x01 /* DAD */
176 1.1.2.1 itojun #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
177 1.1.2.1 itojun
178 1.1.2.1 itojun extern struct ip6stat ip6stat; /* statistics */
179 1.1.2.1 itojun extern u_long ip6_id; /* fragment identifier */
180 1.1.2.1 itojun extern int ip6_defhlim; /* default hop limit */
181 1.1.2.1 itojun extern int ip6_defmcasthlim; /* default multicast hop limit */
182 1.1.2.1 itojun extern int ip6_forwarding; /* act as router? */
183 1.1.2.1 itojun extern int ip6_forward_srcrt; /* forward src-routed? */
184 1.1.2.1 itojun extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
185 1.1.2.1 itojun extern struct socket *ip6_mrouter; /* multicast routing daemon */
186 1.1.2.1 itojun extern int ip6_sendredirects; /* send IP redirects when forwarding? */
187 1.1.2.1 itojun extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
188 1.1.2.1 itojun extern int ip6_sourcecheck; /* Verify source interface */
189 1.1.2.1 itojun extern int ip6_sourcecheck_interval; /* Interval between log messages */
190 1.1.2.1 itojun extern int ip6_accept_rtadv; /* Acts as a host not a router */
191 1.1.2.1 itojun extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
192 1.1.2.1 itojun extern int ip6_log_interval;
193 1.1.2.1 itojun extern time_t ip6_log_time;
194 1.1.2.1 itojun extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
195 1.1.2.1 itojun extern int ip6_dad_count; /* DupAddrDetectionTransmits */
196 1.1.2.1 itojun
197 1.1.2.1 itojun extern u_int32_t ip6_flow_seq;
198 1.1.2.1 itojun extern int ip6_auto_flowlabel;
199 1.1.2.1 itojun
200 1.1.2.1 itojun #if !defined(__FreeBSD__) || __FreeBSD__ < 3
201 1.1.2.1 itojun struct in6pcb;
202 1.1.2.1 itojun #endif
203 1.1.2.1 itojun
204 1.1.2.1 itojun int icmp6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
205 1.1.2.1 itojun void ip6_init __P((void));
206 1.1.2.1 itojun void ip6intr __P((void));
207 1.1.2.1 itojun void ip6_input __P((struct mbuf *));
208 1.1.2.1 itojun void ip6_freemoptions __P((struct ip6_moptions *));
209 1.1.2.1 itojun int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
210 1.1.2.1 itojun char * ip6_get_prevhdr __P((struct mbuf *, int));
211 1.1.2.1 itojun int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *));
212 1.1.2.1 itojun int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, long *,
213 1.1.2.1 itojun u_int32_t *));
214 1.1.2.1 itojun void ip6_savecontrol __P((struct in6pcb *, struct mbuf **, struct ip6_hdr *,
215 1.1.2.1 itojun struct mbuf *));
216 1.1.2.1 itojun int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
217 1.1.2.1 itojun
218 1.1.2.1 itojun void ip6_forward __P((struct mbuf *, int));
219 1.1.2.1 itojun
220 1.1.2.1 itojun void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
221 1.1.2.1 itojun int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
222 1.1.2.1 itojun struct route_in6 *, int,
223 1.1.2.1 itojun struct ip6_moptions *));
224 1.1.2.1 itojun int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
225 1.1.2.1 itojun int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int));
226 1.1.2.1 itojun int ip6_optlen __P((struct in6pcb *));
227 1.1.2.1 itojun
228 1.1.2.1 itojun int route6_input __P((struct mbuf **, int *, int));
229 1.1.2.1 itojun
230 1.1.2.1 itojun void frag6_init __P((void));
231 1.1.2.1 itojun int frag6_input __P((struct mbuf **, int *, int));
232 1.1.2.1 itojun void frag6_slowtimo __P((void));
233 1.1.2.1 itojun void frag6_drain __P((void));
234 1.1.2.1 itojun
235 1.1.2.1 itojun void rip6_init __P((void));
236 1.1.2.1 itojun int rip6_input __P((struct mbuf **mp, int *offp, int proto));
237 1.1.2.1 itojun int rip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
238 1.1.2.1 itojun int rip6_output __P((struct mbuf *, ...));
239 1.1.2.1 itojun int rip6_usrreq __P((struct socket *,
240 1.1.2.1 itojun int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
241 1.1.2.1 itojun
242 1.1.2.1 itojun int dest6_input __P((struct mbuf **, int *, int));
243 1.1.2.1 itojun int none_input __P((struct mbuf **, int *, int));
244 1.1.2.1 itojun #endif /* _KERNEL */
245 1.1.2.1 itojun
246 1.1.2.1 itojun #endif /* !_NETINET6_IP6_VAR_H_ */
247