📄 icmp6.h
字号:
/* * Neighbor Discovery */struct nd_router_solicit { /* router solicitation */ struct icmp6_hdr nd_rs_hdr; /* could be followed by options */};#define nd_rs_type nd_rs_hdr.icmp6_type#define nd_rs_code nd_rs_hdr.icmp6_code#define nd_rs_cksum nd_rs_hdr.icmp6_cksum#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]struct nd_router_advert { /* router advertisement */ struct icmp6_hdr nd_ra_hdr; u_int32_t nd_ra_reachable; /* reachable time */ u_int32_t nd_ra_retransmit; /* retransmit timer */ /* could be followed by options */};#define nd_ra_type nd_ra_hdr.icmp6_type#define nd_ra_code nd_ra_hdr.icmp6_code#define nd_ra_cksum nd_ra_hdr.icmp6_cksum#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]#define ND_RA_FLAG_MANAGED 0x80#define ND_RA_FLAG_OTHER 0x40#define ND_RA_FLAG_HOME_AGENT 0x20/* * Router preference values based on draft-draves-ipngwg-router-selection-01. * These are non-standard definitions. */#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]struct nd_neighbor_solicit { /* neighbor solicitation */ struct icmp6_hdr nd_ns_hdr; struct in6_addr nd_ns_target; /*target address */ /* could be followed by options */};#define nd_ns_type nd_ns_hdr.icmp6_type#define nd_ns_code nd_ns_hdr.icmp6_code#define nd_ns_cksum nd_ns_hdr.icmp6_cksum#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]struct nd_neighbor_advert { /* neighbor advertisement */ struct icmp6_hdr nd_na_hdr; struct in6_addr nd_na_target; /* target address */ /* could be followed by options */};#define nd_na_type nd_na_hdr.icmp6_type#define nd_na_code nd_na_hdr.icmp6_code#define nd_na_cksum nd_na_hdr.icmp6_cksum#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]#if _BYTE_ORDER == _BIG_ENDIAN#define ND_NA_FLAG_ROUTER 0x80000000#define ND_NA_FLAG_SOLICITED 0x40000000#define ND_NA_FLAG_OVERRIDE 0x20000000#else#if _BYTE_ORDER == _LITTLE_ENDIAN#define ND_NA_FLAG_ROUTER 0x80#define ND_NA_FLAG_SOLICITED 0x40#define ND_NA_FLAG_OVERRIDE 0x20#endif#endifstruct nd_redirect { /* redirect */ struct icmp6_hdr nd_rd_hdr; struct in6_addr nd_rd_target; /* target address */ struct in6_addr nd_rd_dst; /* destination address */ /* could be followed by options */};#define nd_rd_type nd_rd_hdr.icmp6_type#define nd_rd_code nd_rd_hdr.icmp6_code#define nd_rd_cksum nd_rd_hdr.icmp6_cksum#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]struct ind_neighbor_solicit { /* inverse neighbor solicitation */ struct icmp6_hdr ind_ns_hdr; /* could be followed by options */};#define ind_ns_type ind_ns_hdr.icmp6_type#define ind_ns_code ind_ns_hdr.icmp6_code#define ind_ns_cksum ind_ns_hdr.icmp6_cksum#define ind_ns_reserved ind_ns_hdr.icmp6_data32[0]struct ind_neighbor_advert { /* inverse neighbor advertisement */ struct icmp6_hdr ind_na_hdr; /* could be followed by options */};#define ind_na_type ind_na_hdr.icmp6_type#define ind_na_code ind_na_hdr.icmp6_code#define ind_na_cksum ind_na_hdr.icmp6_cksum#define ind_na_flags_reserved ind_na_hdr.icmp6_data32[0]struct mip6_dhaad_req { /* HA Address Discovery Request */ struct icmp6_hdr mip6_dhreq_hdr;};#define mip6_dhreq_type mip6_dhreq_hdr.icmp6_type#define mip6_dhreq_code mip6_dhreq_hdr.icmp6_code#define mip6_dhreq_cksum mip6_dhreq_hdr.icmp6_cksum#define mip6_dhreq_id mip6_dhreq_hdr.icmp6_data16[0]#define mip6_dhreq_reserved mip6_dhreq_hdr.icmp6_data16[1]#if _BYTE_ORDER == _BIG_ENDIAN#define MIP6_DHREQ_FLAG_MR 0x8000#endif /* _BIG_ENDIAN */#if _BYTE_ORDER == _LITTLE_ENDIAN#define MIP6_DHREQ_FLAG_MR 0x0080#endif /* _LITTLE_ENDIAN */struct mip6_dhaad_rep { /* HA Address Discovery Reply */ struct icmp6_hdr mip6_dhrep_hdr; /* could be followed by home agent addresses */};#define mip6_dhrep_type mip6_dhrep_hdr.icmp6_type#define mip6_dhrep_code mip6_dhrep_hdr.icmp6_code#define mip6_dhrep_cksum mip6_dhrep_hdr.icmp6_cksum#define mip6_dhrep_id mip6_dhrep_hdr.icmp6_data16[0]#define mip6_dhrep_reserved mip6_dhrep_hdr.icmp6_data16[1]#if _BYTE_ORDER == _BIG_ENDIAN#define MIP6_DHREP_FLAG_MR 0x8000#endif /* _BIG_ENDIAN */#if _BYTE_ORDER == _LITTLE_ENDIAN#define MIP6_DHREP_FLAG_MR 0x0080#endif /* _LITTLE_ENDIAN */struct mip6_prefix_solicit { /* Mobile Prefix Solicitation */ struct icmp6_hdr mip6_ps_hdr;};#define mip6_ps_type mip6_ps_hdr.icmp6_type#define mip6_ps_code mip6_ps_hdr.icmp6_code#define mip6_ps_cksum mip6_ps_hdr.icmp6_cksum#define mip6_ps_id mip6_ps_hdr.icmp6_data16[0]#define mip6_ps_reserved mip6_ps_hdr.icmp6_data16[1]struct mip6_prefix_advert { /* Mobile Prefix Advertisement */ struct icmp6_hdr mip6_pa_hdr; /* followed by options */};#define mip6_pa_type mip6_pa_hdr.icmp6_type#define mip6_pa_code mip6_pa_hdr.icmp6_code#define mip6_pa_cksum mip6_pa_hdr.icmp6_cksum#define mip6_pa_id mip6_pa_hdr.icmp6_data16[0]#define mip6_pa_flags_reserved mip6_pa_hdr.icmp6_data16[1]#if _BYTE_ORDER == _BIG_ENDIAN#define MIP6_PA_FLAG_MANAGED 0x8000#define MIP6_PA_FLAG_OTHER 0x4000#endif /* _BIG_ENDIAN */#if _BYTE_ORDER == _LITTLE_ENDIAN#define MIP6_PA_FLAG_MANAGED 0x0080#define MIP6_PA_FLAG_OTHER 0x0040#endif /* _LITTLE_ENDIAN */struct nd_opt_hdr { /* Neighbor discovery option header */ u_int8_t nd_opt_type; u_int8_t nd_opt_len; /* followed by option specific data*/};#define ND_OPT_SOURCE_LINKADDR 1#define ND_OPT_TARGET_LINKADDR 2#define ND_OPT_PREFIX_INFORMATION 3#define ND_OPT_REDIRECTED_HEADER 4#define ND_OPT_MTU 5#define ND_OPT_ADV_INTERVAL 7 /* 2292bis-02 */#define ND_OPT_HA_INFORMATION 8 /* 2292bis-02 */#define ND_OPT_SOURCE_ADDRLIST 9 /* will be renamed */#define ND_OPT_TARGET_ADDRLIST 10 /* will be renamed */#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */struct nd_opt_prefix_info { /* prefix information */ u_int8_t nd_opt_pi_type; u_int8_t nd_opt_pi_len; u_int8_t nd_opt_pi_prefix_len; u_int8_t nd_opt_pi_flags_reserved; u_int32_t nd_opt_pi_valid_time; u_int32_t nd_opt_pi_preferred_time; u_int32_t nd_opt_pi_reserved2; struct in6_addr nd_opt_pi_prefix;};#define ND_OPT_PI_FLAG_ONLINK 0x80#define ND_OPT_PI_FLAG_AUTO 0x40#define ND_OPT_PI_FLAG_ROUTER 0x20 /* 2292bis-02 */struct nd_opt_rd_hdr { /* redirected header */ u_int8_t nd_opt_rh_type; u_int8_t nd_opt_rh_len; u_int16_t nd_opt_rh_reserved1; u_int32_t nd_opt_rh_reserved2; /* followed by IP header and data */};struct nd_opt_mtu { /* MTU option */ u_int8_t nd_opt_mtu_type; u_int8_t nd_opt_mtu_len; u_int16_t nd_opt_mtu_reserved; u_int32_t nd_opt_mtu_mtu;};struct nd_opt_adv_interval { /* Advertisement interval option */ u_int8_t nd_opt_ai_type; u_int8_t nd_opt_ai_len; u_int16_t nd_opt_ai_reserved; u_int32_t nd_opt_ai_interval;};struct nd_opt_homeagent_info { /* Home Agent info */ u_int8_t nd_opt_hai_type; u_int8_t nd_opt_hai_len; u_int16_t nd_opt_hai_reserved; u_int16_t nd_opt_hai_preference; u_int16_t nd_opt_hai_lifetime;};#if _BYTE_ORDER == _BIG_ENDIAN#define MIP6_HAINFO_FLAG_MR 0x8000#endif /* _BIG_ENDIAN */#if _BYTE_ORDER == _LITTLE_ENDIAN#define MIP6_HAINFO_FLAG_MR 0x0080#endif /* _LITTLE_ENDIAN */struct nd_opt_route_info { /* route info */ u_int8_t nd_opt_rti_type; u_int8_t nd_opt_rti_len; u_int8_t nd_opt_rti_prefixlen; u_int8_t nd_opt_rti_flags; u_int32_t nd_opt_rti_lifetime; /* prefix follows */};/* * icmp6 namelookup */struct icmp6_namelookup { struct icmp6_hdr icmp6_nl_hdr; u_int8_t icmp6_nl_nonce[8]; int32_t icmp6_nl_ttl;#if 0 u_int8_t icmp6_nl_len; u_int8_t icmp6_nl_name[3];#endif /* could be followed by options */};/* * icmp6 node information */struct icmp6_nodeinfo { struct icmp6_hdr icmp6_ni_hdr; u_int8_t icmp6_ni_nonce[8]; /* could be followed by reply data */};#define ni_type icmp6_ni_hdr.icmp6_type#define ni_code icmp6_ni_hdr.icmp6_code#define ni_cksum icmp6_ni_hdr.icmp6_cksum#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]#define ni_flags icmp6_ni_hdr.icmp6_data16[1]#define NI_QTYPE_NOOP 0 /* NOOP */#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */#define NI_QTYPE_DNSNAME 2 /* DNS Name (draft 05-07) */#define NI_QTYPE_NODENAME 2 /* Node Name (draft 08) */#define NI_QTYPE_NODEADDR 3 /* Node Addresses */#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */#if _BYTE_ORDER == _BIG_ENDIAN#define NI_SUPTYPE_FLAG_COMPRESS 0x1#define NI_FQDN_FLAG_VALIDTTL 0x1#define NI_NODENAME_FLAG_VALIDTTL 0x1#elif _BYTE_ORDER == _LITTLE_ENDIAN#define NI_SUPTYPE_FLAG_COMPRESS 0x0100#define NI_FQDN_FLAG_VALIDTTL 0x0100#define NI_NODENAME_FLAG_VALIDTTL 0x0100#endif#ifdef NAME_LOOKUPS_04#if _BYTE_ORDER == _BIG_ENDIAN#define NI_NODEADDR_FLAG_LINKLOCAL 0x1#define NI_NODEADDR_FLAG_SITELOCAL 0x2#define NI_NODEADDR_FLAG_GLOBAL 0x4#define NI_NODEADDR_FLAG_ALL 0x8#define NI_NODEADDR_FLAG_TRUNCATE 0x10#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */#elif _BYTE_ORDER == _LITTLE_ENDIAN#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100#define NI_NODEADDR_FLAG_SITELOCAL 0x0200#define NI_NODEADDR_FLAG_GLOBAL 0x0400#define NI_NODEADDR_FLAG_ALL 0x0800#define NI_NODEADDR_FLAG_TRUNCATE 0x1000#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */#endif#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */#if _BYTE_ORDER == _BIG_ENDIAN#define NI_NODEADDR_FLAG_TRUNCATE 0x1#define NI_NODEADDR_FLAG_ALL 0x2#define NI_NODEADDR_FLAG_COMPAT 0x4#define NI_NODEADDR_FLAG_LINKLOCAL 0x8#define NI_NODEADDR_FLAG_SITELOCAL 0x10#define NI_NODEADDR_FLAG_GLOBAL 0x20#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */#elif _BYTE_ORDER == _LITTLE_ENDIAN#define NI_NODEADDR_FLAG_TRUNCATE 0x0100#define NI_NODEADDR_FLAG_ALL 0x0200#define NI_NODEADDR_FLAG_COMPAT 0x0400#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800#define NI_NODEADDR_FLAG_SITELOCAL 0x1000#define NI_NODEADDR_FLAG_GLOBAL 0x2000#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */#endif#endifstruct ni_reply_fqdn {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -