📄 nd6.h
字号:
/* nd6.h - IPv6 Neighbor Discovery structures and definitions *//* * Copyright (c) 2001-2005 Wind River Systems, Inc. * * The right to copy, distribute, modify or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. *//* $KAME: nd6.h,v 1.116 2005/01/22 19:23:44 suz Exp $ *//* $KAME: nd6.h,v 1.113 2004/08/11 10:20:48 jinmei Exp $ *//* $FreeBSD: src/sys/netinet6/nd6.h,v 1.2.2.5 2002/04/28 05:40:27 suz Exp $ *//* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ *//* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#ifndef _NETINET6_ND6_H_#define _NETINET6_ND6_H_/*modification history--------------------01x,10may05,rp merged from kame v1.11601w,03may05,kch Fixed sysctl variables virtualization (SPR#108823).01v,29apr05,kch Fixed virtual stack build.01u,20apr05,kch Merged from comp_wn_ipv6_mld_interim-dev branch.01t,29mar05,sar Simplify ND_COMPUTE_RTIME calculation01s,30mar05,nee Add prefix state flag NDPRF_SUBNETANYCAST01r,19mar05,nee Add IN6_LINKMTU and ND6_IFINFO macros01q,07feb05,vvv _KERNEL cleanup01p,26jan05,vvv fixed bitfield definitions (SPR #92171)01o,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE01n,10aug04,ppp Put in a fix for ND_COMPUTE_RTIME macro to return lower bound to be greater than 0.5x01m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver /main/vdt/base6_itn5_networking-int/1)01l,24feb04,nee Adding the prototype for ip6EtherResolvRtnwrapper01k,21nov03,vvv added INET6 protection01j,20nov03,niq Remove copyright_wrs.h file inclusion01i,05nov03,cdw Removal of unnecessary _KERNEL guards.01h,04nov03,rlm Ran batch header path update for header re-org.01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.01f,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in accordion codeline to Base601e,14may03,vvv included in6_var.h01d,01feb03,pas merge from FreeBSD 4.7 - changed nd6_rtrequest() arg01c,23oct02,ppp removed __attribute__((__packed__)) from some of the structures inorder to fix alignment issues with some of the architectures such as mips and sh01b,10sep02,hsh add c++ protection01a,02feb02,ham changed for tornado build.*/#ifdef INET6/* see net/route.h, or net/if_inarp.h */#ifndef RTF_ANNOUNCE#define RTF_ANNOUNCE RTF_PROTO2#endif#include <sys/queue.h>#include <sys/callout.h>#include <sys/socket.h> /* XXX for sockaddr in if.h */#include <net/if.h>#include <netinet/in.h>#include <netinet6/in6_var.h>#ifdef __cplusplusextern "C" {#endif struct llinfo_nd6 { struct llinfo_nd6 *ln_next; struct llinfo_nd6 *ln_prev; struct rtentry *ln_rt; struct mbuf *ln_hold; /* last packet until resolved/timeout */ long ln_asked; /* number of queries already sent for this addr */ u_long ln_expire; /* lifetime for NDP state transition */ short ln_state; /* reachability state */ short ln_router; /* 2^0: ND6 router bit */ int ln_byhint; /* # of times we made it reachable by UL hint */ long ln_ntick; struct callout ln_timer_ch;};#define ND6_LLINFO_NOSTATE -2/* * We don't need the WAITDELETE state any more, but we keep the definition * in a comment line instead of removing it. This is necessary to avoid * unintentionally reusing the value for another purpose, which might * affect backward compatibility with old applications. * (20000711 jinmei@kame.net) *//* #define ND6_LLINFO_WAITDELETE -1 */#define ND6_LLINFO_INCOMPLETE 0#define ND6_LLINFO_REACHABLE 1#define ND6_LLINFO_STALE 2#define ND6_LLINFO_DELAY 3#define ND6_LLINFO_PROBE 4#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)#define ND6_LLINFO_PERMANENT(n) (((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))struct nd_ifinfo { u_int32_t linkmtu; /* LinkMTU */ u_int32_t maxmtu; /* Upper bound of LinkMTU */ u_int32_t basereachable; /* BaseReachableTime */ u_int32_t reachable; /* Reachable Time */ u_int32_t retrans; /* Retrans Timer */ u_int32_t flags; /* Flags */ int recalctm; /* BaseReacable re-calculation timer */ u_int8_t chlim; /* CurHopLimit */ u_int8_t initialized; /* Flag to see the entry is initialized */ /* the following 3 members are for privacy extension for addrconf */ u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */ u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */ u_int8_t randomid[8]; /* current random ID */};#define ND6_IFF_PERFORMNUD 0x1#define ND6_IFF_ACCEPT_RTADV 0x2#define ND6_IFF_PREFER_SOURCE 0x4 /* XXX: not related to ND. */#define ND6_IFF_IFDISABLED 0x8 /* IPv6 operation is disabled due to * DAD failure. (XXX: not ND-specific) */#define ND6_IFF_DONT_SET_IFROUTE 0x10#ifdef _WRS_KERNEL#define ND_IFINFO(ifp) \ (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)#define IN6_LINKMTU(ifp) \ ((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \ ? ND_IFINFO(ifp)->linkmtu \ : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \ ? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))#endifstruct in6_nbrinfo { char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ struct in6_addr addr; /* IPv6 address of the neighbor */ long asked; /* number of queries already sent for this addr */ int isrouter; /* if it acts as a router */ int state; /* reachability state */ int expire; /* lifetime for NDP state transition */};#define DRLSTSIZ 10#define PRLSTSIZ 10struct in6_drlist { char ifname[IFNAMSIZ]; struct { struct in6_addr rtaddr; u_char flags; u_short rtlifetime; u_long expire; u_short if_index; } defrouter[DRLSTSIZ];};struct in6_defrouter { struct in6_addr rtaddr; u_char flags; u_short rtlifetime; u_long expire; u_short if_index;};#ifdef _WRS_KERNELstruct in6_oprlist { char ifname[IFNAMSIZ]; struct { struct in6_addr prefix; u_char raflags; u_char prefixlen; u_char origin; u_long vltime; u_long pltime; u_long expire; u_short if_index; u_short advrtrs; /* number of advertisement routers */ struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ } prefix[PRLSTSIZ];};#endifstruct in6_prlist { char ifname[IFNAMSIZ]; struct { struct in6_addr prefix; u_char raflags; u_char prefixlen; u_char origin; u_int32_t vltime; u_int32_t pltime; time_t expire; u_short if_index; u_short advrtrs; /* number of advertisement routers */ struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ } prefix[PRLSTSIZ];};struct in6_prefix { struct sockaddr_in6 prefix; u_char raflags; u_char prefixlen; u_char origin; u_int32_t vltime; u_int32_t pltime; time_t expire; u_int32_t flags; int refcnt; u_short if_index; u_short advrtrs; /* number of advertisement routers */ /* struct in6_addr advrtr[] */};#ifdef _WRS_KERNELstruct in6_ondireq { char ifname[IFNAMSIZ]; struct { u_int32_t linkmtu; /* LinkMTU */ u_int32_t maxmtu; /* Upper bound of LinkMTU */ u_int32_t basereachable; /* BaseReachableTime */ u_int32_t reachable; /* Reachable Time */ u_int32_t retrans; /* Retrans Timer */ u_int32_t flags; /* Flags */ int recalctm; /* BaseReacable re-calculation timer */ u_int8_t chlim; /* CurHopLimit */ u_int8_t receivedra; } ndi;};#endifstruct in6_ndireq { char ifname[IFNAMSIZ]; struct nd_ifinfo ndi;};struct in6_ndifreq { char ifname[IFNAMSIZ]; u_long ifindex;};/* Prefix status */#define NDPRF_ONLINK 0x1#define NDPRF_DETACHED 0x2#define NDPRF_HOME 0x4#define NDPRF_SUBNETANYCAST 0x8/* protocol constants */#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */#define MAX_RTR_SOLICITATIONS 3#define ND6_INFINITE_LIFETIME 0xffffffff#ifdef _WRS_KERNEL/* node constants */#define MAX_REACHABLE_TIME 3600000 /* msec */#define REACHABLE_TIME 30000 /* msec */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -