1d04ccbb3Scarlsonj /* 2d04ccbb3Scarlsonj * CDDL HEADER START 3d04ccbb3Scarlsonj * 4d04ccbb3Scarlsonj * The contents of this file are subject to the terms of the 5d04ccbb3Scarlsonj * Common Development and Distribution License (the "License"). 6d04ccbb3Scarlsonj * You may not use this file except in compliance with the License. 7d04ccbb3Scarlsonj * 8d04ccbb3Scarlsonj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9d04ccbb3Scarlsonj * or http://www.opensolaris.org/os/licensing. 10d04ccbb3Scarlsonj * See the License for the specific language governing permissions 11d04ccbb3Scarlsonj * and limitations under the License. 12d04ccbb3Scarlsonj * 13d04ccbb3Scarlsonj * When distributing Covered Code, include this CDDL HEADER in each 14d04ccbb3Scarlsonj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15d04ccbb3Scarlsonj * If applicable, add the following below this CDDL HEADER, with the 16d04ccbb3Scarlsonj * fields enclosed by brackets "[]" replaced with your own identifying 17d04ccbb3Scarlsonj * information: Portions Copyright [yyyy] [name of copyright owner] 18d04ccbb3Scarlsonj * 19d04ccbb3Scarlsonj * CDDL HEADER END 20d04ccbb3Scarlsonj */ 21d04ccbb3Scarlsonj 22d04ccbb3Scarlsonj /* 23*36e852a1SRaja Andra * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24d04ccbb3Scarlsonj * Use is subject to license terms. 25d04ccbb3Scarlsonj */ 26d04ccbb3Scarlsonj 27d04ccbb3Scarlsonj #ifndef _DHCP6_H 28d04ccbb3Scarlsonj #define _DHCP6_H 29d04ccbb3Scarlsonj 30d04ccbb3Scarlsonj /* 31d04ccbb3Scarlsonj * This header file describes constants and on-the-wire data structures used 32d04ccbb3Scarlsonj * with DHCPv6. 33d04ccbb3Scarlsonj * 34d04ccbb3Scarlsonj * Note that the data structures contained here must be used with caution. The 35d04ccbb3Scarlsonj * DHCPv6 protocol generally does not maintain alignment. 36d04ccbb3Scarlsonj * 37d04ccbb3Scarlsonj * (Users may also need to include other header files to get ntohs/htons 38d04ccbb3Scarlsonj * definitions, if the DHCPV6_{GET,SET} macros are used.) 39d04ccbb3Scarlsonj */ 40d04ccbb3Scarlsonj 41d04ccbb3Scarlsonj #ifdef __cplusplus 42d04ccbb3Scarlsonj extern "C" { 43d04ccbb3Scarlsonj #endif 44d04ccbb3Scarlsonj 45d04ccbb3Scarlsonj #include <sys/types.h> 46d04ccbb3Scarlsonj #include <netinet/in.h> 47d04ccbb3Scarlsonj 48d04ccbb3Scarlsonj /* 49d04ccbb3Scarlsonj * Message Types 50d04ccbb3Scarlsonj */ 51d04ccbb3Scarlsonj #define DHCPV6_MSG_SOLICIT 1 /* Client sends */ 52d04ccbb3Scarlsonj #define DHCPV6_MSG_ADVERTISE 2 /* Server sends */ 53d04ccbb3Scarlsonj #define DHCPV6_MSG_REQUEST 3 /* Client sends */ 54d04ccbb3Scarlsonj #define DHCPV6_MSG_CONFIRM 4 /* Client sends */ 55d04ccbb3Scarlsonj #define DHCPV6_MSG_RENEW 5 /* Client sends */ 56d04ccbb3Scarlsonj #define DHCPV6_MSG_REBIND 6 /* Client sends */ 57d04ccbb3Scarlsonj #define DHCPV6_MSG_REPLY 7 /* Server sends */ 58d04ccbb3Scarlsonj #define DHCPV6_MSG_RELEASE 8 /* Client sends */ 59d04ccbb3Scarlsonj #define DHCPV6_MSG_DECLINE 9 /* Client sends */ 60d04ccbb3Scarlsonj #define DHCPV6_MSG_RECONFIGURE 10 /* Server sends */ 61d04ccbb3Scarlsonj #define DHCPV6_MSG_INFO_REQ 11 /* Client sends */ 62d04ccbb3Scarlsonj #define DHCPV6_MSG_RELAY_FORW 12 /* Relay agent sends to server */ 63d04ccbb3Scarlsonj #define DHCPV6_MSG_RELAY_REPL 13 /* Server sends to relay agent */ 64d04ccbb3Scarlsonj 65d04ccbb3Scarlsonj /* 66d04ccbb3Scarlsonj * Status Codes 67d04ccbb3Scarlsonj */ 68d04ccbb3Scarlsonj #define DHCPV6_STAT_SUCCESS 0 69d04ccbb3Scarlsonj #define DHCPV6_STAT_UNSPECFAIL 1 /* Unknown reason */ 70d04ccbb3Scarlsonj #define DHCPV6_STAT_NOADDRS 2 /* Server has no addresses available */ 71d04ccbb3Scarlsonj #define DHCPV6_STAT_NOBINDING 3 /* Client record unavailable */ 72d04ccbb3Scarlsonj #define DHCPV6_STAT_NOTONLINK 4 /* Prefix inappropriate for link */ 73d04ccbb3Scarlsonj #define DHCPV6_STAT_USEMCAST 5 /* Client must use multicast */ 74d04ccbb3Scarlsonj #define DHCPV6_STAT_NOPREFIX 6 /* No prefix available; RFC3633 */ 75d04ccbb3Scarlsonj 76d04ccbb3Scarlsonj /* 77d04ccbb3Scarlsonj * DHCP Unique Identifier (DUID) Types 78d04ccbb3Scarlsonj */ 79d04ccbb3Scarlsonj #define DHCPV6_DUID_LLT 1 /* Link layer address plus time */ 80d04ccbb3Scarlsonj #define DHCPV6_DUID_EN 2 /* Vendor assigned */ 81d04ccbb3Scarlsonj #define DHCPV6_DUID_LL 3 /* Link layer address */ 82d04ccbb3Scarlsonj 83d04ccbb3Scarlsonj /* 84d04ccbb3Scarlsonj * DHCPv6 Option Codes 85d04ccbb3Scarlsonj * Note: options 10 and 35 are not assigned. 86d04ccbb3Scarlsonj */ 87d04ccbb3Scarlsonj #define DHCPV6_OPT_CLIENTID 1 /* Client's DUID */ 88d04ccbb3Scarlsonj #define DHCPV6_OPT_SERVERID 2 /* Server's DUID */ 89d04ccbb3Scarlsonj #define DHCPV6_OPT_IA_NA 3 /* Non-temporary addrs; dhcpv6_ia_na */ 90d04ccbb3Scarlsonj #define DHCPV6_OPT_IA_TA 4 /* Temporary addrs; dhcpv6_ia_ta */ 91d04ccbb3Scarlsonj #define DHCPV6_OPT_IAADDR 5 /* IA Address; dhcpv6_iaaddr */ 92d04ccbb3Scarlsonj #define DHCPV6_OPT_ORO 6 /* Option Request; uint16_t array */ 93d04ccbb3Scarlsonj #define DHCPV6_OPT_PREFERENCE 7 /* Server preference; uint8_t */ 94d04ccbb3Scarlsonj #define DHCPV6_OPT_ELAPSED_TIME 8 /* Client time; uint16_t; centisec */ 95d04ccbb3Scarlsonj #define DHCPV6_OPT_RELAY_MSG 9 /* Relayed client DHCP message */ 96d04ccbb3Scarlsonj #define DHCPV6_OPT_AUTH 11 /* Authentication; dhcpv6_auth */ 97d04ccbb3Scarlsonj #define DHCPV6_OPT_UNICAST 12 /* Client may unicast; in6_addr_t */ 98d04ccbb3Scarlsonj #define DHCPV6_OPT_STATUS_CODE 13 /* Status; uint16_t plus string */ 99d04ccbb3Scarlsonj #define DHCPV6_OPT_RAPID_COMMIT 14 /* Server may do RC; boolean (len 0) */ 100d04ccbb3Scarlsonj #define DHCPV6_OPT_USER_CLASS 15 /* Classes; {uint16_t,uint8_t...}... */ 101d04ccbb3Scarlsonj #define DHCPV6_OPT_VENDOR_CLASS 16 /* Client vendor; uint32_t + list */ 102d04ccbb3Scarlsonj #define DHCPV6_OPT_VENDOR_OPT 17 /* Vendor specific; uint32_t+opts */ 103d04ccbb3Scarlsonj #define DHCPV6_OPT_INTERFACE_ID 18 /* Relay agent interface */ 104d04ccbb3Scarlsonj #define DHCPV6_OPT_RECONF_MSG 19 /* Reconfigure; uint8_t */ 105d04ccbb3Scarlsonj #define DHCPV6_OPT_RECONF_ACC 20 /* Reconfigure accept; boolean */ 106d04ccbb3Scarlsonj #define DHCPV6_OPT_SIP_NAMES 21 /* SIP srv domain names (RFC3319) */ 107d04ccbb3Scarlsonj #define DHCPV6_OPT_SIP_ADDR 22 /* SIP srv IPv6 address (RFC3319) */ 108d04ccbb3Scarlsonj #define DHCPV6_OPT_DNS_ADDR 23 /* DNS Recur. Name Server (RFC3646) */ 109d04ccbb3Scarlsonj #define DHCPV6_OPT_DNS_SEARCH 24 /* Domain Search List (RFC3646) */ 110d04ccbb3Scarlsonj #define DHCPV6_OPT_IA_PD 25 /* Delegate dhcpv6_ia_na (RFC3633) */ 111d04ccbb3Scarlsonj #define DHCPV6_OPT_IAPREFIX 26 /* Prefix dhcpv6_iaprefix (RFC3633) */ 112d04ccbb3Scarlsonj #define DHCPV6_OPT_NIS_SERVERS 27 /* NIS in6_addr_t array (RFC3898) */ 113d04ccbb3Scarlsonj #define DHCPV6_OPT_NIS_DOMAIN 29 /* NIS Domain string (RFC3898) */ 114d04ccbb3Scarlsonj #define DHCPV6_OPT_SNTP_SERVERS 31 /* SNTP in6_addr_t array (RFC4075) */ 115d04ccbb3Scarlsonj #define DHCPV6_OPT_INFO_REFTIME 32 /* Info refresh uint32_t (RFC4242) */ 116d04ccbb3Scarlsonj #define DHCPV6_OPT_BCMCS_SRV_D 33 /* NUL-term string list (RFC4280) */ 117d04ccbb3Scarlsonj #define DHCPV6_OPT_BCMCS_SRV_A 34 /* in6_addr_t array (RFC4280) */ 118d04ccbb3Scarlsonj #define DHCPV6_OPT_GEOCONF_CVC 36 /* dhcpv6_civic_t plus TLVs */ 119d04ccbb3Scarlsonj #define DHCPV6_OPT_REMOTE_ID 37 /* uint32_t plus opaque */ 120d04ccbb3Scarlsonj #define DHCPV6_OPT_SUBSCRIBER 38 /* opaque; may be NVT ASCII */ 121d04ccbb3Scarlsonj #define DHCPV6_OPT_CLIENT_FQDN 39 /* uint8_t plus domain */ 122d04ccbb3Scarlsonj 123d04ccbb3Scarlsonj /* 124d04ccbb3Scarlsonj * Reconfiguration types; used with DHCPV6_OPT_RECONF_MSG option. 125d04ccbb3Scarlsonj */ 126d04ccbb3Scarlsonj #define DHCPV6_RECONF_RENEW 5 /* Renew now */ 127d04ccbb3Scarlsonj #define DHCPV6_RECONF_INFO 11 /* Request information */ 128d04ccbb3Scarlsonj 129d04ccbb3Scarlsonj /* 130d04ccbb3Scarlsonj * FQDN Flags; used with DHCPV6_OPT_CLIENT_FQDN option. 131d04ccbb3Scarlsonj */ 132d04ccbb3Scarlsonj #define DHCPV6_FQDNF_S 0x01 /* Server should perform AAAA RR updates */ 133d04ccbb3Scarlsonj #define DHCPV6_FQDNF_O 0x02 /* Server override of 'S' bit */ 134d04ccbb3Scarlsonj #define DHCPV6_FQDNF_N 0x04 /* Server should not perform any updates */ 135d04ccbb3Scarlsonj 136d04ccbb3Scarlsonj /* 137d04ccbb3Scarlsonj * Miscellany 138d04ccbb3Scarlsonj */ 139d04ccbb3Scarlsonj #define DHCPV6_INFTIME 0xfffffffful /* Infinity; used for timers */ 140d04ccbb3Scarlsonj #define DHCPV6_FOREVER 0xffff /* Used for elapsed time option */ 141d04ccbb3Scarlsonj #define DHCPV6_SUN_ENT 42 /* Sun Microsystems enterprise ID */ 142d04ccbb3Scarlsonj 143d04ccbb3Scarlsonj /* 144d04ccbb3Scarlsonj * Basic DHCPv6 message header used for server/client communications. The 145d04ccbb3Scarlsonj * options follow this header. 146d04ccbb3Scarlsonj */ 147d04ccbb3Scarlsonj struct dhcpv6_message { 148d04ccbb3Scarlsonj uint8_t d6m_msg_type; 149d04ccbb3Scarlsonj uint8_t d6m_transid_ho; 150d04ccbb3Scarlsonj uint16_t d6m_transid_lo; 151d04ccbb3Scarlsonj }; 152d04ccbb3Scarlsonj 153d04ccbb3Scarlsonj #define DHCPV6_GET_TRANSID(msg) \ 154d04ccbb3Scarlsonj (((msg)->d6m_transid_ho << 16) + ntohs((msg)->d6m_transid_lo)) 155d04ccbb3Scarlsonj #define DHCPV6_SET_TRANSID(msg, id) \ 156d04ccbb3Scarlsonj ((msg)->d6m_transid_ho = (id) >> 16, (msg)->d6m_transid_lo = htons(id)) 157d04ccbb3Scarlsonj 158d04ccbb3Scarlsonj /* 159d04ccbb3Scarlsonj * DHCPv6 relay agent header used only for server/relay communications. The 160d04ccbb3Scarlsonj * options follow this header, and the client message is encapsulated as an 161d04ccbb3Scarlsonj * option. Note that the IPv6 addresses are not on natural word boundaries. 162d04ccbb3Scarlsonj */ 163d04ccbb3Scarlsonj struct dhcpv6_relay { 164d04ccbb3Scarlsonj uint8_t d6r_msg_type; 165d04ccbb3Scarlsonj uint8_t d6r_hop_count; 166d04ccbb3Scarlsonj uint8_t d6r_linkaddr[16]; 167d04ccbb3Scarlsonj uint8_t d6r_peeraddr[16]; 168d04ccbb3Scarlsonj }; 169d04ccbb3Scarlsonj 170d04ccbb3Scarlsonj /* 171d04ccbb3Scarlsonj * DHCPv6 generic option header. Note that options are not aligned on any 172d04ccbb3Scarlsonj * convenient boundary. 173d04ccbb3Scarlsonj */ 174d04ccbb3Scarlsonj struct dhcpv6_option { 175d04ccbb3Scarlsonj uint16_t d6o_code; 176d04ccbb3Scarlsonj uint16_t d6o_len; 177d04ccbb3Scarlsonj }; 178d04ccbb3Scarlsonj 179d04ccbb3Scarlsonj /* 180d04ccbb3Scarlsonj * Option header for IA_NA (Non-temporary addresses) and IA_PD (Prefix 181d04ccbb3Scarlsonj * delegation). Contains IA Address options for IA_NA, IA_PD Prefixes for 182d04ccbb3Scarlsonj * IA_PD. 183d04ccbb3Scarlsonj */ 184d04ccbb3Scarlsonj struct dhcpv6_ia_na { 185d04ccbb3Scarlsonj uint16_t d6in_code; 186d04ccbb3Scarlsonj uint16_t d6in_len; 187d04ccbb3Scarlsonj uint32_t d6in_iaid; /* Unique ID [interface] */ 188d04ccbb3Scarlsonj uint32_t d6in_t1; /* Extend from same server */ 189d04ccbb3Scarlsonj uint32_t d6in_t2; /* Extend from any server */ 190d04ccbb3Scarlsonj }; 191d04ccbb3Scarlsonj 192d04ccbb3Scarlsonj /* 193d04ccbb3Scarlsonj * Option header for IA_TA (Temporary addresses). Contains IA Address options. 194d04ccbb3Scarlsonj */ 195d04ccbb3Scarlsonj struct dhcpv6_ia_ta { 196d04ccbb3Scarlsonj uint16_t d6it_code; 197d04ccbb3Scarlsonj uint16_t d6it_len; 198d04ccbb3Scarlsonj uint32_t d6it_iaid; /* Unique ID [interface] */ 199d04ccbb3Scarlsonj }; 200d04ccbb3Scarlsonj 201d04ccbb3Scarlsonj /* 202d04ccbb3Scarlsonj * Option header for IA Address. Must be used inside of an IA_NA or IA_TA 203d04ccbb3Scarlsonj * option. May contain a Status Code option. 204d04ccbb3Scarlsonj */ 205d04ccbb3Scarlsonj struct dhcpv6_iaaddr { 206d04ccbb3Scarlsonj uint16_t d6ia_code; 207d04ccbb3Scarlsonj uint16_t d6ia_len; 208d04ccbb3Scarlsonj in6_addr_t d6ia_addr; /* IPv6 address */ 209d04ccbb3Scarlsonj uint32_t d6ia_preflife; /* Preferred lifetime */ 210d04ccbb3Scarlsonj uint32_t d6ia_vallife; /* Valid lifetime */ 211d04ccbb3Scarlsonj }; 212d04ccbb3Scarlsonj 213d04ccbb3Scarlsonj /* 214d04ccbb3Scarlsonj * Option header for Authentication. Followed by variable-length 215d04ccbb3Scarlsonj * authentication information field. Warning: padding may be present. Use 216d04ccbb3Scarlsonj * defined size. 217d04ccbb3Scarlsonj */ 218d04ccbb3Scarlsonj struct dhcpv6_auth { 219d04ccbb3Scarlsonj uint16_t d6a_code; 220d04ccbb3Scarlsonj uint16_t d6a_len; 221d04ccbb3Scarlsonj uint8_t d6a_proto; /* Protocol */ 222d04ccbb3Scarlsonj uint8_t d6a_alg; /* Algorithm */ 223d04ccbb3Scarlsonj uint8_t d6a_rdm; /* Replay Detection Method (RDM) */ 224d04ccbb3Scarlsonj uint8_t d6a_replay[8]; /* Information for RDM */ 225d04ccbb3Scarlsonj }; 226d04ccbb3Scarlsonj #define DHCPV6_AUTH_SIZE 15 227d04ccbb3Scarlsonj 228d04ccbb3Scarlsonj /* dhpv6_auth.d6a_proto values */ 229d04ccbb3Scarlsonj #define DHCPV6_PROTO_DELAYED 2 /* Delayed Authentication mechanism */ 230d04ccbb3Scarlsonj #define DHCPV6_PROTO_RECONFIG 3 /* Reconfigure Key mechanism */ 231d04ccbb3Scarlsonj 232d04ccbb3Scarlsonj /* dhpv6_auth.d6a_alg values */ 233d04ccbb3Scarlsonj #define DHCPV6_ALG_HMAC_MD5 1 /* HMAC-MD5 signature */ 234d04ccbb3Scarlsonj 235d04ccbb3Scarlsonj /* dhpv6_auth.d6a_rdm values */ 236d04ccbb3Scarlsonj #define DHCPV6_RDM_MONOCNT 0 /* Monotonic counter */ 237d04ccbb3Scarlsonj 238d04ccbb3Scarlsonj /* 239d04ccbb3Scarlsonj * Option header for IA_PD Prefix. Must be used inside of an IA_PD option. 240d04ccbb3Scarlsonj * May contain a Status Code option. Warning: padding may be present; use 241d04ccbb3Scarlsonj * defined size. 242d04ccbb3Scarlsonj */ 243d04ccbb3Scarlsonj struct dhcpv6_iaprefix { 244d04ccbb3Scarlsonj uint16_t d6ip_code; 245d04ccbb3Scarlsonj uint16_t d6ip_len; 246d04ccbb3Scarlsonj uint32_t d6ip_preflife; /* Preferred lifetime */ 247d04ccbb3Scarlsonj uint32_t d6ip_vallife; /* Valid lifetime */ 248d04ccbb3Scarlsonj uint8_t d6ip_preflen; /* Prefix length */ 249d04ccbb3Scarlsonj uint8_t d6ip_addr[16]; /* IPv6 prefix */ 250d04ccbb3Scarlsonj }; 251d04ccbb3Scarlsonj #define DHCPV6_IAPREFIX_SIZE 29 252d04ccbb3Scarlsonj 253d04ccbb3Scarlsonj /* 254d04ccbb3Scarlsonj * Option header for Civic Address information. Followed by single octet TLV 255d04ccbb3Scarlsonj * encoded address elements, using CIVICADDR_* values for type. Warning: 256d04ccbb3Scarlsonj * padding may be present; use defined size. 257d04ccbb3Scarlsonj */ 258d04ccbb3Scarlsonj struct dhcpv6_civic { 259d04ccbb3Scarlsonj uint16_t d6c_code; 260d04ccbb3Scarlsonj uint16_t d6c_len; 261d04ccbb3Scarlsonj uint8_t d6c_what; /* DHCPV6_CWHAT_* value */ 262d04ccbb3Scarlsonj char d6c_cc[2]; /* Country code; ISO 3166 */ 263d04ccbb3Scarlsonj }; 264d04ccbb3Scarlsonj #define DHCPV6_CIVIC_SIZE 7 265d04ccbb3Scarlsonj 266d04ccbb3Scarlsonj #define DHCPV6_CWHAT_SERVER 0 /* Location of server */ 267d04ccbb3Scarlsonj #define DHCPV6_CWHAT_NETWORK 1 /* Location of network */ 268d04ccbb3Scarlsonj #define DHCPV6_CWHAT_CLIENT 2 /* Location of client */ 269d04ccbb3Scarlsonj 270d04ccbb3Scarlsonj #define CIVICADDR_LANG 0 /* Language; RFC 2277 */ 271d04ccbb3Scarlsonj #define CIVICADDR_A1 1 /* National division (state) */ 272d04ccbb3Scarlsonj #define CIVICADDR_A2 2 /* County */ 273d04ccbb3Scarlsonj #define CIVICADDR_A3 3 /* City */ 274d04ccbb3Scarlsonj #define CIVICADDR_A4 4 /* City division */ 275d04ccbb3Scarlsonj #define CIVICADDR_A5 5 /* Neighborhood */ 276d04ccbb3Scarlsonj #define CIVICADDR_A6 6 /* Street group */ 277d04ccbb3Scarlsonj #define CIVICADDR_PRD 16 /* Leading street direction */ 278d04ccbb3Scarlsonj #define CIVICADDR_POD 17 /* Trailing street suffix */ 279d04ccbb3Scarlsonj #define CIVICADDR_STS 18 /* Street suffix or type */ 280d04ccbb3Scarlsonj #define CIVICADDR_HNO 19 /* House number */ 281d04ccbb3Scarlsonj #define CIVICADDR_HNS 20 /* House number suffix */ 282d04ccbb3Scarlsonj #define CIVICADDR_LMK 21 /* Landmark */ 283d04ccbb3Scarlsonj #define CIVICADDR_LOC 22 /* Additional location information */ 284d04ccbb3Scarlsonj #define CIVICADDR_NAM 23 /* Name/occupant */ 285d04ccbb3Scarlsonj #define CIVICADDR_PC 24 /* Postal Code/ZIP */ 286d04ccbb3Scarlsonj #define CIVICADDR_BLD 25 /* Building */ 287d04ccbb3Scarlsonj #define CIVICADDR_UNIT 26 /* Unit/apt/suite */ 288d04ccbb3Scarlsonj #define CIVICADDR_FLR 27 /* Floor */ 289d04ccbb3Scarlsonj #define CIVICADDR_ROOM 28 /* Room number */ 290d04ccbb3Scarlsonj #define CIVICADDR_TYPE 29 /* Place type */ 291d04ccbb3Scarlsonj #define CIVICADDR_PCN 30 /* Postal community name */ 292d04ccbb3Scarlsonj #define CIVICADDR_POBOX 31 /* Post office box */ 293d04ccbb3Scarlsonj #define CIVICADDR_ADDL 32 /* Additional code */ 294d04ccbb3Scarlsonj #define CIVICADDR_SEAT 33 /* Seat/desk */ 295d04ccbb3Scarlsonj #define CIVICADDR_ROAD 34 /* Primary road or street */ 296d04ccbb3Scarlsonj #define CIVICADDR_RSEC 35 /* Road section */ 297d04ccbb3Scarlsonj #define CIVICADDR_RBRA 36 /* Road branch */ 298d04ccbb3Scarlsonj #define CIVICADDR_RSBR 37 /* Road sub-branch */ 299d04ccbb3Scarlsonj #define CIVICADDR_SPRE 38 /* Street name pre-modifier */ 300d04ccbb3Scarlsonj #define CIVICADDR_SPOST 39 /* Street name post-modifier */ 301d04ccbb3Scarlsonj #define CIVICADDR_SCRIPT 128 /* Script */ 302d04ccbb3Scarlsonj 303d04ccbb3Scarlsonj /* 304d04ccbb3Scarlsonj * DHCP Unique Identifier structures. These represent the fixed portion of the 305d04ccbb3Scarlsonj * unique identifier object, and are followed by the variable-length link layer 306d04ccbb3Scarlsonj * address or identifier. 307d04ccbb3Scarlsonj */ 308d04ccbb3Scarlsonj struct duid_llt { 309d04ccbb3Scarlsonj uint16_t dllt_dutype; 310d04ccbb3Scarlsonj uint16_t dllt_hwtype; 311d04ccbb3Scarlsonj uint32_t dllt_time; 312d04ccbb3Scarlsonj }; 313d04ccbb3Scarlsonj 314d04ccbb3Scarlsonj /* DUID time stamps start on January 1st, 2000 UTC */ 315d04ccbb3Scarlsonj #define DUID_TIME_BASE 946684800ul 316d04ccbb3Scarlsonj 317d04ccbb3Scarlsonj struct duid_en { 318d04ccbb3Scarlsonj uint16_t den_dutype; 319d04ccbb3Scarlsonj uint16_t den_entho; 320d04ccbb3Scarlsonj uint16_t den_entlo; 321d04ccbb3Scarlsonj }; 322d04ccbb3Scarlsonj 323d04ccbb3Scarlsonj #define DHCPV6_GET_ENTNUM(den) \ 324d04ccbb3Scarlsonj ((ntohs((den)->den_entho) << 16) + ntohs((den)->den_entlo)) 325d04ccbb3Scarlsonj #define DHCPV6_SET_ENTNUM(den, val) \ 326d04ccbb3Scarlsonj ((den)->den_entho = htons((val) >> 16), (den)->den_entlo = htons(val)) 327d04ccbb3Scarlsonj 328d04ccbb3Scarlsonj struct duid_ll { 329d04ccbb3Scarlsonj uint16_t dll_dutype; 330d04ccbb3Scarlsonj uint16_t dll_hwtype; 331d04ccbb3Scarlsonj }; 332d04ccbb3Scarlsonj 333d04ccbb3Scarlsonj /* 334d04ccbb3Scarlsonj * Data types 335d04ccbb3Scarlsonj */ 336d04ccbb3Scarlsonj typedef struct dhcpv6_message dhcpv6_message_t; 337d04ccbb3Scarlsonj typedef struct dhcpv6_relay dhcpv6_relay_t; 338d04ccbb3Scarlsonj typedef struct dhcpv6_option dhcpv6_option_t; 339d04ccbb3Scarlsonj typedef struct dhcpv6_ia_na dhcpv6_ia_na_t; 340d04ccbb3Scarlsonj typedef struct dhcpv6_ia_ta dhcpv6_ia_ta_t; 341d04ccbb3Scarlsonj typedef struct dhcpv6_iaaddr dhcpv6_iaaddr_t; 342d04ccbb3Scarlsonj typedef struct dhcpv6_auth dhcpv6_auth_t; 343d04ccbb3Scarlsonj typedef struct dhcpv6_iaprefix dhcpv6_iaprefix_t; 344d04ccbb3Scarlsonj typedef struct dhcpv6_civic dhcpv6_civic_t; 345d04ccbb3Scarlsonj typedef struct duid_llt duid_llt_t; 346d04ccbb3Scarlsonj typedef struct duid_en duid_en_t; 347d04ccbb3Scarlsonj typedef struct duid_ll duid_ll_t; 348d04ccbb3Scarlsonj 349d04ccbb3Scarlsonj #ifdef __cplusplus 350d04ccbb3Scarlsonj } 351d04ccbb3Scarlsonj #endif 352d04ccbb3Scarlsonj 353d04ccbb3Scarlsonj #endif /* _DHCP6_H */ 354