📄 in6.h
字号:
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))#define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))#endif#ifdef _WRS_KERNEL /* nonstandard *//* * KAME Scope */#define IN6_IS_SCOPE_LINKLOCAL(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_LINKLOCAL(a)))#define IFA6_IS_DEPRECATED(a) \ ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ (a)->ia6_lifetime.ia6t_pltime)#define IFA6_IS_INVALID(a) \ ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ (a)->ia6_lifetime.ia6t_vltime)#endif /* _WRS_KERNEL *//* * IP6 route structure */#ifndef _XOPEN_SOURCE#include <net/route.h>struct route_in6 { struct rtentry *ro_rt; struct sockaddr_in6 ro_dst;};#endif/* * Kame has the following define in the application's Makefile. */#define USE_RFC2292BIS/* * Options for use with [gs]etsockopt at the IPV6 level. * First word of comment is data type; bool is stored in int. *//* no hdrincl */#if 0 /* the followings are relic in IPv4 and hence are disabled */#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */#endif#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter *//* RFC2292 options */#ifdef _WRS_KERNEL#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */#define IPV6_2292RTHDR 24 /* bool; routing header */#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */#endif#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */#define IPV6_BINDV6ONLY IPV6_V6ONLY#if 1 /* IPSEC */#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */#endif#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections *//* We currently don't support the ipv6_fw options. They are * retained in this file for consistency with other systems */#if 0 /* IPV6FIREWALL */#define IPV6_FW_ADD 30 /* add a firewall rule to chain */#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */#define IPV6_FW_GET 34 /* get entire firewall rule chain */#endif/* new socket options introduced in RFC2292bis */#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */#define IPV6_RECVRTHDR 38 /* bool; recv routing header */#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */#ifdef _WRS_KERNEL#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */#endif#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), 4 bytes int; MTU notification (cmsg) */#if 0 /*obsoleted during 2292bis -> 3542*/#define IPV6_REACHCONF 45 /* no data; ND reachability confirm (cmsg only/not in of RFC3542) */#endif/* more new socket options introduced in RFC2292bis */#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */#define IPV6_HOPLIMIT 47 /* int; send hop limit */#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */#if 0#define IPV6_PKTOPTIONS 52 /* buf/cmsghdr; set/get IPv6 options */ /* obsoleted by 2292bis */#endif#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */#ifdef _WRS_KERNEL#define IPV6_OTCLASS 58 /* u_int8_t; send traffic class value */#endif#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */#define IPV6_TCLASS 61 /* int; send traffic class value */#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */#define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as * the source address. *//* to define items, should talk with KAME guys first, for *BSD compatibility */#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */#define IPV6_RTHDR_TYPE_2 2 /* IPv6 routing header type 2 for Mobile IPv6 *//* * Defaults and limits for options */#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member *//* * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. */struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; unsigned int ipv6mr_interface;};/* * IPV6_PKTINFO: Packet information(RFC2292 sec 5) */struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */};/* * Control structure for IPV6_RECVPATHMTU socket option. */struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */ u_int32_t ip6m_mtu;};/* * Argument for IPV6_PORTRANGE: * - which range to search when port is unspecified at bind() or connect() */#define IPV6_PORTRANGE_DEFAULT 0 /* default range */#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security *//* * Definitions for inet6 sysctl operations. * * Third level is protocol number. * Fourth level is desired variable within that protocol. */#define IPV6PROTO_MAXID (IPPROTO_MH + 1) /* don't list to IPV6PROTO_MAX */#define CTL_IPV6PROTO_NAMES { \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { "tcp6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { "udp6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { "ip6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { "ipsec6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { "icmp6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { 0, 0 }, \ { "pim6", CTLTYPE_NODE }, \ { 0, 0 }, \ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ { "mip6", CTLTYPE_NODE }, \}/* * Names for IP sysctl objects */#define IPV6CTL_FORWARDING 1 /* act as router */#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */#ifdef notyet#define IPV6CTL_DEFMTU 4 /* default MTU */#endif#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */#define IPV6CTL_STATS 6 /* stats */#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */#define IPV6CTL_ACCEPT_RTADV 12#define IPV6CTL_KEEPFAITH 13#define IPV6CTL_LOG_INTERVAL 14#define IPV6CTL_HDRNESTLIMIT 15#define IPV6CTL_DAD_COUNT 16#define IPV6CTL_AUTO_FLOWLABEL 17#define IPV6CTL_DEFMCASTHLIM 18#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */#define IPV6CTL_KAME_VERSION 20#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */#if 0 /* obsolete */#define IPV6CTL_MAPPED_ADDR 23#endif#define IPV6CTL_V6ONLY 24#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */#define IPV6CTL_PMTU_EXPIRE 40 /* path MTU expiration timer */#define IPV6CTL_MAXFRAGS 41 /* max fragments */#define IPV6CTL_IFQ 42 /* ip6intrq node */#define IPV6CTL_ISATAPRTR 43 /* isatap router */#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */#define IPV6CTL_RTTIMEOUT 45 /* timeout in seconds *//* New entries should be added here from current IPV6CTL_MAXID value. *//* to define items, should talk with KAME guys first, for *BSD compatibility */#define IPV6CTL_MAXID 46/* Remove the mbuf flags that are used by the KAME IPsec code. * We don't use them and they may cause problems if defined. * Eventually we should remove them completely, I've currently left * them in as part of the history of the file. * * The M_LOOP flag is used in the main line code and so I've left * it's definiton in. It should be moved to mbuf.h when convienent. * sar */#if 0/* * Redefinition of mbuf flags */#define M_AUTHIPHDR M_PROTO2#define M_DECRYPTED M_PROTO3#define M_AUTHIPDGM M_PROTO5#endif /* 0 */#define M_LOOP M_PROTO4#ifdef _WRS_KERNELstruct cmsghdr;int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));int in6_pseudo __P((struct in6_addr *, struct in6_addr *, u_int32_t, u_int8_t));int in6_localaddr __P((struct in6_addr *));int in6_addrscope __P((struct in6_addr *));struct in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *));struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));struct in6_ifaddr *in6_ifexists_ifa __P((struct ifnet *));extern void in6_if_up __P((struct ifnet *));struct sockaddr;void in6_sin6_2_sin __P((struct sockaddr_in *sin, struct sockaddr_in6 *sin6));void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin, struct sockaddr_in6 *sin6));void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));int in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));extern void addrsel_policy_init __P((void));#define satosin6(sa) ((struct sockaddr_in6 *)(sa))#define sin6tosa(sin6) ((struct sockaddr *)(sin6))#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))extern int (*faithprefix_p)(struct in6_addr *);#endif /* _WRS_KERNEL *//* Hop-by-Hop/Destination options processing API from RFC 2292 */extern int inet6_option_space __P((int));extern int inet6_option_init __P((void *, struct cmsghdr **, int));extern int inet6_option_append __P((struct cmsghdr *, const u_int8_t *, int, int));extern u_int8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int));extern int inet6_option_next __P((const struct cmsghdr *, u_int8_t **));extern int inet6_option_find __P((const struct cmsghdr *, u_int8_t **, int));/* Hop-by-Hop/Destination options processing API from RFC 3542 */extern int inet6_opt_init __P((void *, socklen_t));extern int inet6_opt_append __P((void *, socklen_t, int, u_int8_t, socklen_t, u_int8_t, void **));extern int inet6_opt_finish __P((void *, socklen_t, int));extern int inet6_opt_set_val __P((void *, int, void *, socklen_t));extern int inet6_opt_next __P((void *, socklen_t, int, u_int8_t *, socklen_t *, void **));extern int inet6_opt_find __P((void *, socklen_t, int, u_int8_t, socklen_t *, void **));extern int inet6_opt_get_val __P((void *, int, void *, socklen_t));/* Defined in rthdr.c, these are implemented in user space also */extern size_t inet6_rthdr_space __P((int, int));extern struct cmsghdr *inet6_rthdr_init __P((void *, int));extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *, unsigned int));extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));#if 0 /* not implemented yet */extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));#endifextern int inet6_rthdr_segments __P((const struct cmsghdr *));extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));extern socklen_t inet6_rth_space __P((int, int));extern void *inet6_rth_init __P((void *, socklen_t, int, int));extern int inet6_rth_add __P((void *, const struct in6_addr *));extern int inet6_rth_reverse __P((const void *, void *));extern int inet6_rth_segments __P((const void *));extern struct in6_addr *inet6_rth_getaddr __P((const void *, int));/* end rthdr.c functions */#ifdef __cplusplus}#endif#endif /* !_NETINET6_IN6_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -