d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * CDDL HEADER START
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * The contents of this file are subject to the terms of the
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Common Development and Distribution License (the "License").
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * You may not use this file except in compliance with the License.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * See the License for the specific language governing permissions
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * and limitations under the License.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * When distributing Covered Code, include this CDDL HEADER in each
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * If applicable, add the following below this CDDL HEADER, with the
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * fields enclosed by brackets "[]" replaced with your own identifying
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * information: Portions Copyright [yyyy] [name of copyright owner]
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * CDDL HEADER END
36e852a172cba914383d7341c988128b2c667fbdRaja Andra * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Use is subject to license terms.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * This header file describes constants and on-the-wire data structures used
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * with DHCPv6.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Note that the data structures contained here must be used with caution. The
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCPv6 protocol generally does not maintain alignment.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * (Users may also need to include other header files to get ntohs/htons
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * definitions, if the DHCPV6_{GET,SET} macros are used.)
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonjextern "C" {
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Message Types
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_MSG_RECONFIGURE 10 /* Server sends */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_MSG_RELAY_FORW 12 /* Relay agent sends to server */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_MSG_RELAY_REPL 13 /* Server sends to relay agent */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Status Codes
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_UNSPECFAIL 1 /* Unknown reason */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_NOADDRS 2 /* Server has no addresses available */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_NOBINDING 3 /* Client record unavailable */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_NOTONLINK 4 /* Prefix inappropriate for link */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_USEMCAST 5 /* Client must use multicast */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_STAT_NOPREFIX 6 /* No prefix available; RFC3633 */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCP Unique Identifier (DUID) Types
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_DUID_LLT 1 /* Link layer address plus time */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCPv6 Option Codes
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Note: options 10 and 35 are not assigned.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_IA_NA 3 /* Non-temporary addrs; dhcpv6_ia_na */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_IA_TA 4 /* Temporary addrs; dhcpv6_ia_ta */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_IAADDR 5 /* IA Address; dhcpv6_iaaddr */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_ORO 6 /* Option Request; uint16_t array */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_PREFERENCE 7 /* Server preference; uint8_t */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_ELAPSED_TIME 8 /* Client time; uint16_t; centisec */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_RELAY_MSG 9 /* Relayed client DHCP message */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_AUTH 11 /* Authentication; dhcpv6_auth */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_UNICAST 12 /* Client may unicast; in6_addr_t */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_STATUS_CODE 13 /* Status; uint16_t plus string */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_RAPID_COMMIT 14 /* Server may do RC; boolean (len 0) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_USER_CLASS 15 /* Classes; {uint16_t,uint8_t...}... */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_VENDOR_CLASS 16 /* Client vendor; uint32_t + list */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_VENDOR_OPT 17 /* Vendor specific; uint32_t+opts */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_INTERFACE_ID 18 /* Relay agent interface */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_RECONF_MSG 19 /* Reconfigure; uint8_t */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_RECONF_ACC 20 /* Reconfigure accept; boolean */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_SIP_NAMES 21 /* SIP srv domain names (RFC3319) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_SIP_ADDR 22 /* SIP srv IPv6 address (RFC3319) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_DNS_ADDR 23 /* DNS Recur. Name Server (RFC3646) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_DNS_SEARCH 24 /* Domain Search List (RFC3646) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_IA_PD 25 /* Delegate dhcpv6_ia_na (RFC3633) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_IAPREFIX 26 /* Prefix dhcpv6_iaprefix (RFC3633) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_NIS_SERVERS 27 /* NIS in6_addr_t array (RFC3898) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_NIS_DOMAIN 29 /* NIS Domain string (RFC3898) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_SNTP_SERVERS 31 /* SNTP in6_addr_t array (RFC4075) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_INFO_REFTIME 32 /* Info refresh uint32_t (RFC4242) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_BCMCS_SRV_D 33 /* NUL-term string list (RFC4280) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_BCMCS_SRV_A 34 /* in6_addr_t array (RFC4280) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_GEOCONF_CVC 36 /* dhcpv6_civic_t plus TLVs */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_REMOTE_ID 37 /* uint32_t plus opaque */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_SUBSCRIBER 38 /* opaque; may be NVT ASCII */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_OPT_CLIENT_FQDN 39 /* uint8_t plus domain */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Reconfiguration types; used with DHCPV6_OPT_RECONF_MSG option.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_RECONF_INFO 11 /* Request information */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * FQDN Flags; used with DHCPV6_OPT_CLIENT_FQDN option.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_FQDNF_S 0x01 /* Server should perform AAAA RR updates */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_FQDNF_O 0x02 /* Server override of 'S' bit */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_FQDNF_N 0x04 /* Server should not perform any updates */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Miscellany
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_INFTIME 0xfffffffful /* Infinity; used for timers */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_FOREVER 0xffff /* Used for elapsed time option */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_SUN_ENT 42 /* Sun Microsystems enterprise ID */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Basic DHCPv6 message header used for server/client communications. The
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * options follow this header.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj (((msg)->d6m_transid_ho << 16) + ntohs((msg)->d6m_transid_lo))
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj ((msg)->d6m_transid_ho = (id) >> 16, (msg)->d6m_transid_lo = htons(id))
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCPv6 relay agent header used only for server/relay communications. The
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * options follow this header, and the client message is encapsulated as an
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * option. Note that the IPv6 addresses are not on natural word boundaries.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCPv6 generic option header. Note that options are not aligned on any
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * convenient boundary.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for IA_NA (Non-temporary addresses) and IA_PD (Prefix
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * delegation). Contains IA Address options for IA_NA, IA_PD Prefixes for
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for IA_TA (Temporary addresses). Contains IA Address options.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for IA Address. Must be used inside of an IA_NA or IA_TA
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * option. May contain a Status Code option.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for Authentication. Followed by variable-length
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * authentication information field. Warning: padding may be present. Use
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * defined size.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj uint8_t d6a_rdm; /* Replay Detection Method (RDM) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj/* dhpv6_auth.d6a_proto values */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_PROTO_DELAYED 2 /* Delayed Authentication mechanism */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_PROTO_RECONFIG 3 /* Reconfigure Key mechanism */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj/* dhpv6_auth.d6a_alg values */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_ALG_HMAC_MD5 1 /* HMAC-MD5 signature */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj/* dhpv6_auth.d6a_rdm values */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_RDM_MONOCNT 0 /* Monotonic counter */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for IA_PD Prefix. Must be used inside of an IA_PD option.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * May contain a Status Code option. Warning: padding may be present; use
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * defined size.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Option header for Civic Address information. Followed by single octet TLV
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * encoded address elements, using CIVICADDR_* values for type. Warning:
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * padding may be present; use defined size.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_CWHAT_SERVER 0 /* Location of server */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_CWHAT_NETWORK 1 /* Location of network */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define DHCPV6_CWHAT_CLIENT 2 /* Location of client */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_A1 1 /* National division (state) */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_PRD 16 /* Leading street direction */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_POD 17 /* Trailing street suffix */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_STS 18 /* Street suffix or type */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_LOC 22 /* Additional location information */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_PCN 30 /* Postal community name */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_ROAD 34 /* Primary road or street */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_SPRE 38 /* Street name pre-modifier */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#define CIVICADDR_SPOST 39 /* Street name post-modifier */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * DHCP Unique Identifier structures. These represent the fixed portion of the
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * unique identifier object, and are followed by the variable-length link layer
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * address or identifier.
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj/* DUID time stamps start on January 1st, 2000 UTC */
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj ((ntohs((den)->den_entho) << 16) + ntohs((den)->den_entlo))
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj ((den)->den_entho = htons((val) >> 16), (den)->den_entlo = htons(val))
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj * Data types
d04ccbb3f3163ae5962a8b7465d9796bff6ca434carlsonj#endif /* _DHCP6_H */