Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

inc/netinet6/ip6_var.h

Go to the documentation of this file.
00001 00005 /* $FreeBSD: src/sys/netinet6/ip6_var.h,v 1.9 2002/07/25 17:40:45 ume Exp $ */ 00006 /* $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $ */ 00007 00008 /* 00009 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions 00014 * are met: 00015 * 1. Redistributions of source code must retain the above copyright 00016 * notice, this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright 00018 * notice, this list of conditions and the following disclaimer in the 00019 * documentation and/or other materials provided with the distribution. 00020 * 3. Neither the name of the project nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 00025 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00027 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00030 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00031 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00033 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00034 * SUCH DAMAGE. 00035 */ 00036 00037 /* 00038 * Copyright (c) 1982, 1986, 1993 00039 * The Regents of the University of California. All rights reserved. 00040 * 00041 * Redistribution and use in source and binary forms, with or without 00042 * modification, are permitted provided that the following conditions 00043 * are met: 00044 * 1. Redistributions of source code must retain the above copyright 00045 * notice, this list of conditions and the following disclaimer. 00046 * 2. Redistributions in binary form must reproduce the above copyright 00047 * notice, this list of conditions and the following disclaimer in the 00048 * documentation and/or other materials provided with the distribution. 00049 * 3. All advertising materials mentioning features or use of this software 00050 * must display the following acknowledgement: 00051 * This product includes software developed by the University of 00052 * California, Berkeley and its contributors. 00053 * 4. Neither the name of the University nor the names of its contributors 00054 * may be used to endorse or promote products derived from this software 00055 * without specific prior written permission. 00056 * 00057 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00058 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00059 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00060 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00061 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00062 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00063 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00064 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00065 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00066 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00067 * SUCH DAMAGE. 00068 * 00069 * @(#)ip_var.h 8.1 (Berkeley) 6/10/93 00070 */ 00071 00072 #ifndef _NETINET6_IP6_VAR_H_ 00073 #define _NETINET6_IP6_VAR_H_ 00074 00075 #ifndef __SYS_QUEUE_H 00076 #include <sys/queue.h> 00077 #endif 00078 00079 #ifndef __SYS_MBUF_H 00080 #include <sys/mbuf.h> 00081 #endif 00082 00083 #if !defined(__BORLANDC__) /* stop warnings for undefined structs */ 00084 /* 00085 * IP6 reassembly queue structure. Each fragment 00086 * being reassembled is attached to one of these structures. 00087 */ 00088 struct ip6q { 00089 u_int32_t ip6q_head; 00090 u_int16_t ip6q_len; 00091 u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */ 00092 u_int8_t ip6q_hlim; 00093 struct ip6asfrag *ip6q_down; 00094 struct ip6asfrag *ip6q_up; 00095 u_int32_t ip6q_ident; 00096 u_int8_t ip6q_arrive; 00097 u_int8_t ip6q_ttl; 00098 struct in6_addr ip6q_src, ip6q_dst; 00099 struct ip6q *ip6q_next; 00100 struct ip6q *ip6q_prev; 00101 int ip6q_unfrglen; /* len of unfragmentable part */ 00102 #ifdef notyet 00103 u_char *ip6q_nxtp; 00104 #endif 00105 }; 00106 00107 struct ip6asfrag { 00108 u_int32_t ip6af_head; 00109 u_int16_t ip6af_len; 00110 u_int8_t ip6af_nxt; 00111 u_int8_t ip6af_hlim; 00112 /* must not override the above members during reassembling */ 00113 struct ip6asfrag *ip6af_down; 00114 struct ip6asfrag *ip6af_up; 00115 struct mbuf *ip6af_m; 00116 int ip6af_offset; /* offset in ip6af_m to next header */ 00117 int ip6af_frglen; /* fragmentable part length */ 00118 int ip6af_off; /* fragment offset */ 00119 u_int16_t ip6af_mff; /* more fragment bit in frag off */ 00120 }; 00121 00122 #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) 00123 00124 struct ip6_moptions { 00125 struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */ 00126 u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */ 00127 u_char im6o_multicast_loop; /* 1 >= hear sends if a member */ 00128 LIST_HEAD(dummy, in6_multi_mship) im6o_memberships; 00129 }; 00130 #endif /* __BORLANDC__ */ 00131 00132 #ifndef _NETINET6_IN6_H_ 00133 struct route_in6 { 00134 struct rtentry *ro_rt; 00135 struct sockaddr_in6 ro_dst; 00136 }; 00137 #endif 00138 00139 /* 00140 * Control options for outgoing packets 00141 */ 00142 00143 /* Routing header related info */ 00144 #if !defined(__BORLANDC__) 00145 struct ip6po_rhinfo { 00146 struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */ 00147 struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */ 00148 }; 00149 #define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr 00150 #define ip6po_route ip6po_rhinfo.ip6po_rhi_route 00151 00152 struct ip6_pktopts { 00153 struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */ 00154 int ip6po_hlim; /* Hoplimit for outgoing packets */ 00155 00156 /* Outgoing IF/address information */ 00157 struct in6_pktinfo *ip6po_pktinfo; 00158 00159 struct sockaddr *ip6po_nexthop; /* Next-hop address */ 00160 00161 struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ 00162 00163 /* Destination options header (before a routing header) */ 00164 struct ip6_dest *ip6po_dest1; 00165 00166 /* Routing header related info. */ 00167 struct ip6po_rhinfo ip6po_rhinfo; 00168 00169 /* Destination options header (after a routing header) */ 00170 struct ip6_dest *ip6po_dest2; 00171 }; 00172 #endif /* __BORLANDC__ */ 00173 00174 /* 00175 * Control options for incoming packets 00176 */ 00177 00178 struct ip6stat { 00179 u_quad_t ip6s_total; /* total packets received */ 00180 u_quad_t ip6s_tooshort; /* packet too short */ 00181 u_quad_t ip6s_toosmall; /* not enough data */ 00182 u_quad_t ip6s_fragments; /* fragments received */ 00183 u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */ 00184 u_quad_t ip6s_fragtimeout; /* fragments timed out */ 00185 u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */ 00186 u_quad_t ip6s_forward; /* packets forwarded */ 00187 u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */ 00188 u_quad_t ip6s_redirectsent; /* packets forwarded on same net */ 00189 u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/ 00190 u_quad_t ip6s_localout; /* total ip packets generated here */ 00191 u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */ 00192 u_quad_t ip6s_reassembled; /* total packets reassembled ok */ 00193 u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */ 00194 u_quad_t ip6s_ofragments; /* output fragments created */ 00195 u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */ 00196 u_quad_t ip6s_badoptions; /* error in option processing */ 00197 u_quad_t ip6s_noroute; /* packets discarded due to no route */ 00198 u_quad_t ip6s_badvers; /* ip6 version != 6 */ 00199 u_quad_t ip6s_rawout; /* total raw ip packets generated */ 00200 u_quad_t ip6s_badscope; /* scope error */ 00201 u_quad_t ip6s_notmember; /* don't join this multicast group */ 00202 u_quad_t ip6s_nxthist[256]; /* next header history */ 00203 u_quad_t ip6s_m1; /* one mbuf */ 00204 u_quad_t ip6s_m2m[32]; /* two or more mbuf */ 00205 u_quad_t ip6s_mext1; /* one ext mbuf */ 00206 u_quad_t ip6s_mext2m; /* two or more ext mbuf */ 00207 u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */ 00208 u_quad_t ip6s_nogif; /* no match gif found */ 00209 u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */ 00210 00211 /* 00212 * statistics for improvement of the source address selection 00213 * algorithm: 00214 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 00215 */ 00216 /* number of times that address selection fails */ 00217 u_quad_t ip6s_sources_none; 00218 /* number of times that an address on the outgoing I/F is chosen */ 00219 u_quad_t ip6s_sources_sameif[16]; 00220 /* number of times that an address on a non-outgoing I/F is chosen */ 00221 u_quad_t ip6s_sources_otherif[16]; 00222 /* 00223 * number of times that an address that has the same scope 00224 * from the destination is chosen. 00225 */ 00226 u_quad_t ip6s_sources_samescope[16]; 00227 /* 00228 * number of times that an address that has a different scope 00229 * from the destination is chosen. 00230 */ 00231 u_quad_t ip6s_sources_otherscope[16]; 00232 /* number of times that an deprecated address is chosen */ 00233 u_quad_t ip6s_sources_deprecated[16]; 00234 00235 u_quad_t ip6s_forward_cachehit; 00236 u_quad_t ip6s_forward_cachemiss; 00237 }; 00238 00239 #ifdef _KERNEL 00240 /* 00241 * IPv6 onion peeling state. 00242 * it will be initialized when we come into ip6_input(). 00243 * XXX do not make it a kitchen sink! 00244 */ 00245 struct ip6aux { 00246 u_int32_t ip6a_flags; 00247 #define IP6A_SWAP 0x01 /* swapped home/care-of on packet */ 00248 #define IP6A_HASEEN 0x02 /* HA was present */ 00249 #define IP6A_BRUID 0x04 /* BR Unique Identifier was present */ 00250 #define IP6A_RTALERTSEEN 0x08 /* rtalert present */ 00251 00252 /* ip6.ip6_src */ 00253 struct in6_addr ip6a_careof; /* care-of address of the peer */ 00254 struct in6_addr ip6a_home; /* home address of the peer */ 00255 u_int16_t ip6a_bruid; /* BR unique identifier */ 00256 00257 /* ip6.ip6_dst */ 00258 struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */ 00259 00260 /* rtalert */ 00261 u_int16_t ip6a_rtalert; /* rtalert option value */ 00262 00263 /* 00264 * decapsulation history will be here. 00265 * with IPsec it may not be accurate. 00266 */ 00267 }; 00268 #endif 00269 00270 #ifdef _KERNEL 00271 /* flags passed to ip6_output as last parameter */ 00272 #define IPV6_DADOUTPUT 0x01 /* DAD */ 00273 #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ 00274 #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ 00275 00276 extern struct ip6stat ip6stat; /* statistics */ 00277 extern u_int32_t ip6_id; /* fragment identifier */ 00278 extern int ip6_defhlim; /* default hop limit */ 00279 extern int ip6_defmcasthlim; /* default multicast hop limit */ 00280 extern int ip6_forwarding; /* act as router? */ 00281 extern int ip6_forward_srcrt; /* forward src-routed? */ 00282 extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ 00283 extern int ip6_use_deprecated; /* allow deprecated addr as source */ 00284 extern int ip6_rr_prune; /* router renumbering prefix 00285 * walk list every 5 sec. */ 00286 extern int ip6_v6only; 00287 00288 extern struct socket *ip6_mrouter; /* multicast routing daemon */ 00289 extern int ip6_sendredirects; /* send IP redirects when forwarding? */ 00290 extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ 00291 extern int ip6_sourcecheck; /* Verify source interface */ 00292 extern int ip6_sourcecheck_interval; /* Interval between log messages */ 00293 extern int ip6_accept_rtadv; /* Acts as a host not a router */ 00294 extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ 00295 extern int ip6_log_interval; 00296 extern time_t ip6_log_time; 00297 extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */ 00298 extern int ip6_dad_count; /* DupAddrDetectionTransmits */ 00299 00300 extern u_int32_t ip6_flow_seq; 00301 extern int ip6_auto_flowlabel; 00302 extern int ip6_auto_linklocal; 00303 00304 extern int ip6_anonportmin; /* minimum ephemeral port */ 00305 extern int ip6_anonportmax; /* maximum ephemeral port */ 00306 extern int ip6_lowportmin; /* minimum reserved port */ 00307 extern int ip6_lowportmax; /* maximum reserved port */ 00308 00309 extern int ip6_use_tempaddr; /* whether to use temporary addresses. */ 00310 00311 extern struct pr_usrreqs rip6_usrreqs; 00312 struct sockopt; 00313 00314 struct inpcb; 00315 00316 int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt)); 00317 00318 struct in6_ifaddr; 00319 void ip6_init __P((void)); 00320 void ip6intr __P((void)); 00321 void ip6_input __P((struct mbuf *)); 00322 struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); 00323 void ip6_freepcbopts __P((struct ip6_pktopts *)); 00324 void ip6_freemoptions __P((struct ip6_moptions *)); 00325 int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int)); 00326 char * ip6_get_prevhdr __P((struct mbuf *, int)); 00327 int ip6_nexthdr __P((struct mbuf *, int, int, int *)); 00328 int ip6_lasthdr __P((struct mbuf *, int, int, int *)); 00329 00330 struct mbuf *ip6_addaux __P((struct mbuf *)); 00331 struct mbuf *ip6_findaux __P((struct mbuf *)); 00332 void ip6_delaux __P((struct mbuf *)); 00333 00334 int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *)); 00335 int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *, 00336 u_int32_t *)); 00337 void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *, 00338 struct mbuf *)); 00339 void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *, 00340 u_int32_t *)); 00341 int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); 00342 00343 void ip6_forward __P((struct mbuf *, int)); 00344 00345 void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *)); 00346 int ip6_output __P((struct mbuf *, struct ip6_pktopts *, 00347 struct route_in6 *, 00348 int, 00349 struct ip6_moptions *, struct ifnet **)); 00350 int ip6_ctloutput __P((struct socket *, struct sockopt *sopt)); 00351 void init_ip6pktopts __P((struct ip6_pktopts *)); 00352 int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int, int)); 00353 void ip6_clearpktopts __P((struct ip6_pktopts *, int, int)); 00354 struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int)); 00355 int ip6_optlen __P((struct inpcb *)); 00356 00357 int route6_input __P((struct mbuf **, int *, int)); 00358 00359 void frag6_init __P((void)); 00360 int frag6_input __P((struct mbuf **, int *, int)); 00361 void frag6_slowtimo __P((void)); 00362 void frag6_drain __P((void)); 00363 00364 void rip6_init __P((void)); 00365 int rip6_input __P((struct mbuf **mp, int *offp, int proto)); 00366 void rip6_ctlinput __P((int, struct sockaddr *, void *)); 00367 int rip6_ctloutput __P((struct socket *so, struct sockopt *sopt)); 00368 int rip6_output __P((struct mbuf *, ...)); 00369 int rip6_usrreq __P((struct socket *, 00370 int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *)); 00371 00372 int dest6_input __P((struct mbuf **, int *, int)); 00373 int none_input __P((struct mbuf **, int *, int)); 00374 #endif /* _KERNEL */ 00375 00376 #endif /* !_NETINET6_IP6_VAR_H_ */

Generated on Wed Aug 4 08:55:46 2010 for Watt-32 tcp/ip by doxygen 1.3.8