icmp6.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NETINET_ICMP6_H
#define _NETINET_ICMP6_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Type and code definitions for ICMPv6.
* Based on RFC2292.
*/
/* Minimum ICMPv6 header length. */
#define ICMP6_MINLEN 8
typedef struct icmp6_hdr {
union {
} icmp6_dataun;
} icmp6_t;
/* Multicast Listener Discovery messages (RFC 3542 (v1), RFC 3810 (v2)). */
#define MLD_MINLEN 24
#define MLD_V2_QUERY_MINLEN 28
/* Query Header, common to v1 and v2 */
typedef struct mld_hdr {
struct icmp6_hdr mld_icmp6_hdr;
} mld_hdr_t;
/* MLDv2 query */
typedef struct mld2q {
} mld2q_t;
/* definitions used to extract max response delay from mrc field */
#define MLD_V2_MAXRT_FPMIN 0x8000
#define MLD_V2_MAXRT_MANT_MASK 0x0fff
#define MLD_V2_MAXRT_EXP_MASK 0x7000
/* definitions used to extract querier's query interval from qqic field */
#define MLD_V2_QQI_FPMIN 0x80
#define MLD_V2_QQI_MANT_MASK 0x0f
#define MLD_V2_QQI_EXP_MASK 0x70
/* MLDv2 response */
#define mld2r_type icmp6_type
#define mld2r_res icmp6_code
#define mld2r_cksum icmp6_cksum
#define mld2r_res1 icmp6_data16[0]
/* MLDv2 multicast address record */
typedef struct mld2mar {
} mld2mar_t;
/* For router renumbering. */
struct icmp6_router_renum { /* router renumbering header */
};
/* Router renumbering flags */
#define ICMP6_RR_FLAGS_TEST 0x80
#define ICMP6_RR_FLAGS_REQRESULT 0x40
#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20
#define ICMP6_RR_FLAGS_SPECSITE 0x10
#define ICMP6_RR_FLAGS_PREVDONE 0x08
struct rr_pco_match { /* match prefix part */
struct in6_addr rpm_prefix;
};
/* PCO code values */
#define RPM_PCO_ADD 1
#define RPM_PCO_CHANGE 2
#define RPM_PCO_SETGLOBAL 3
struct rr_pco_use { /* use prefix part */
struct in6_addr rpu_prefix;
};
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10
#ifdef _BIG_ENDIAN
#define ICMP_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
#define ICMP_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
#else /* _BIG_ENDIAN */
#define ICMP_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
#define ICMP_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
#endif /* _BIG_ENDIAN */
struct rr_result { /* router renumbering result message */
struct in6_addr rrr_prefix;
};
#ifdef _BIG_ENDIAN
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
#else /* _BIG_ENDIAN */
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
#endif /* _BIG_ENDIAN */
/* ICMPv6 error types */
#define ICMP6_DST_UNREACH 1
#define ICMP6_PACKET_TOO_BIG 2
#define ICMP6_TIME_EXCEEDED 3
#define ICMP6_PARAM_PROB 4
/* ICMPv6 query types */
#define ICMP6_ECHO_REQUEST 128
#define ICMP6_ECHO_REPLY 129
/*
* ICMPv6 group membership types
* ICMP6_MEMBERSHIP* types are the older names for these constants and should
* not be used in new code.
*/
#define MLD_LISTENER_QUERY 130
#define ICMP6_MEMBERSHIP_QUERY 130
#define MLD_LISTENER_REPORT 131
#define ICMP6_MEMBERSHIP_REPORT 131
#define MLD_LISTENER_REDUCTION 132
#define ICMP6_MEMBERSHIP_REDUCTION 132
#define MLD_V2_LISTENER_REPORT 143
/* types for neighbor discovery */
#define ND_ROUTER_SOLICIT 133
#define ND_ROUTER_ADVERT 134
#define ND_NEIGHBOR_SOLICIT 135
#define ND_NEIGHBOR_ADVERT 136
#define ND_REDIRECT 137
/* router renumbering */
#define ICMP6_ROUTER_RENUMBERING 138
#define ICMP6_MAX_INFO_TYPE 138
#define ICMP6_IS_ERROR(x) ((x) < 128)
/* codes for ICMP6_DST_UNREACH */
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
/* administratively prohibited */
/* codes for ICMP6_TIME_EXCEEDED */
#define ICMP6_TIME_EXCEED_TRANSIT 0 /* Hop Limit == 0 in transit */
/* codes for ICMP6_PARAM_PROB */
#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
/* Default MLD max report delay value */
/* query (in seconds) */
typedef struct nd_router_solicit { /* router solicitation */
/* could be followed by options */
typedef struct nd_router_advert { /* router advertisement */
/* could be followed by options */
#define ND_RA_FLAG_OTHER 0x40
#define ND_RA_FLAG_MANAGED 0x80
typedef struct nd_neighbor_solicit { /* neighbor solicitation */
/* could be followed by options */
typedef struct nd_neighbor_advert { /* neighbor advertisement */
/* could be followed by options */
/*
* The first three bits of the flgs_reserved field of the ND structure are
* defined in this order:
* Router flag
* Solicited flag
* Override flag
*/
/* Save valuable htonl() cycles on little-endian boxen. */
#ifdef _BIG_ENDIAN
#define ND_NA_FLAG_ROUTER 0x80000000
#define ND_NA_FLAG_SOLICITED 0x40000000
#define ND_NA_FLAG_OVERRIDE 0x20000000
#else /* _BIG_ENDIAN */
#define ND_NA_FLAG_ROUTER 0x80
#define ND_NA_FLAG_SOLICITED 0x40
#define ND_NA_FLAG_OVERRIDE 0x20
#endif /* _BIG_ENDIAN */
typedef struct nd_redirect { /* redirect */
/* could be followed by options */
typedef struct nd_opt_hdr { /* Neighbor discovery option header */
/* followed by option specific data */
} nd_opt_hdr_t;
/* Neighbor discovery option types */
#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
typedef struct nd_opt_prefix_info { /* prefix information */
struct in6_addr nd_opt_pi_prefix;
#define ND_OPT_PI_FLAG_AUTO 0x40
#define ND_OPT_PI_FLAG_ONLINK 0x80
typedef struct nd_opt_rd_hdr { /* redirected header */
/* followed by IP header and data */
typedef struct nd_opt_mtu { /* MTU option */
} nd_opt_mtu_t;
/* Note: the option is variable length (at least 8 bytes long) */
#ifndef ND_MAX_HDW_LEN
#define ND_MAX_HDW_LEN 64
#endif
struct nd_opt_lla {
};
/* Neighbor discovery protocol constants */
/* Router constants */
/* Host constants */
/* Node constants */
#define ND_MIN_RANDOM_FACTOR .5
#define ND_MAX_RANDOM_FACTOR 1.5
/*
* ICMPv6 type filtering for IPPROTO_ICMPV6 ICMP6_FILTER socket option
*/
typedef struct icmp6_filter {
/* Pass all ICMPv6 messages to the application */
#define ICMP6_FILTER_SETPASSALL(filterp) ( \
/* ICMPv6 messages are blocked from being passed to the application */
#define ICMP6_FILTER_SETBLOCKALL(filterp) ( \
/* Pass messages of a given type to the application */
/* Block messages of a given type from being passed to the application */
/* Test if message of a given type will be passed to an application */
/*
* Test if message of a given type will blocked from
* being passed to an application
*/
#ifdef __cplusplus
}
#endif
#endif /* _NETINET_ICMP6_H */