3 /* @(#) Header: /tcpdump/master/tcpdump/Attic/dhcp6.h,v 1.4 2000/12/17 23:07:48 guy Exp (LBL) */
5 * Copyright (C) 1998 and 1999 WIDE Project.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * draft-ietf-dhc-dhcpv6-15
36 #ifndef __DHCP6_H_DEFINED
37 #define __DHCP6_H_DEFINED
40 #define DH6ERR_FAILURE 16
41 #define DH6ERR_AUTHFAIL 17
42 #define DH6ERR_POORLYFORMED 18
43 #define DH6ERR_UNAVAIL 19
44 #define DH6ERR_NOBINDING 20
45 #define DH6ERR_INVALIDSOURCE 21
46 #define DH6ERR_NOSERVER 23
47 #define DH6ERR_ICMPERROR 64
55 #define DH6_RECONFIG 6
57 /* Predefined addresses */
58 #define DH6ADDR_ALLAGENT "ff02::1:2"
59 #define DH6ADDR_ALLSERVER "ff05::1:3"
60 #define DH6ADDR_ALLRELAY "ff05::1:4"
61 #define DH6PORT_DOWNSTREAM "546"
62 #define DH6PORT_UPSTREAM "547"
64 /* Protocol constants */
65 #define ADV_CLIENT_WAIT 2 /* sec */
66 #define DEFAULT_SOLICIT_HOPCOUNT 4
67 #define SERVER_MIN_ADV_DELAY 100 /* msec */
68 #define SERVER_MAX_ADV_DELAY 1000 /* msec */
69 #define REPLY_MSG_TIMEOUT 2 /* sec */
70 #define REQUEST_MSG_MIN_RETRANS 10 /* retransmissions */
71 #define RECONF_MSG_MIN_RETRANS 10 /* retransmissions */
72 #define RECONF_MSG_RETRANS_INTERVAL 12 /* sec */
73 #define RECONF_MMSG_MIN_RESP 2 /* sec */
74 #define RECONF_MMSG_MAX_RESP 10 /* sec */
75 #define RECONF_MULTICAST_REQUEST_WAIT 120 /* sec */
76 #define MIN_SOLICIT_DELAY 1 /* sec */
77 #define MAX_SOLICIT_DELAY 5 /* sec */
78 #define XID_TIMEOUT 600 /* sec */
80 /* DHCP6 base packet format */
81 struct dhcp6_solicit
{
82 u_int8_t dh6sol_msgtype
; /* DH6_SOLICIT */
83 u_int8_t dh6sol_flags
;
84 #define DH6SOL_CLOSE 0x80
85 #define DH6SOL_PREFIX 0x40
86 /* XXX: solicit-ID is a 9-bit field...ugly! */
87 #define DH6SOL_SOLICIT_ID_MASK 0x01ff
88 #define DH6SOL_SOLICIT_ID_SHIFT 0
89 #define DH6SOL_SOLICIT_ID(x) \
90 (((x) & DH6SOL_SOLICIT_ID_MASK) >> DH6SOL_SOLICIT_ID_SHIFT)
91 #define DH6SOL_SOLICIT_PLEN_MASK 0xfe00
92 #define DH6SOL_SOLICIT_PLEN_SHIFT 9
93 #define DH6SOL_SOLICIT_PLEN(x) \
94 (((x) & DH6SOL_SOLICIT_PLEN_MASK) >> DH6SOL_SOLICIT_PLEN_SHIFT)
95 u_int16_t dh6sol_plen_id
; /* prefix-len and solict-ID */
96 struct in6_addr dh6sol_cliaddr
; /* client's lladdr */
97 struct in6_addr dh6sol_relayaddr
; /* relay agent's lladdr */
100 struct dhcp6_advert
{
101 u_int8_t dh6adv_msgtype
; /* DH6_ADVERT */
102 u_int8_t dh6adv_rsv_id
; /* reserved and uppermost bit of ID */
103 u_int8_t dh6adv_solcit_id
; /* lower 8 bits of solicit-ID */
104 u_int8_t dh6adv_pref
;
105 struct in6_addr dh6adv_cliaddr
; /* client's link-local addr */
106 struct in6_addr dh6adv_relayaddr
; /* relay agent's (non-ll) addr */
107 struct in6_addr dh6adv_serveraddr
; /* server's addr */
111 struct dhcp6_request
{
112 u_int8_t dh6req_msgtype
; /* DH6_REQUEST */
113 u_int8_t dh6req_flags
;
114 #define DH6REQ_CLOSE 0x80
115 #define DH6REQ_REBOOT 0x40
116 u_int16_t dh6req_xid
; /* transaction-ID */
117 struct in6_addr dh6req_cliaddr
; /* client's lladdr */
118 struct in6_addr dh6req_relayaddr
; /* relay agent's (non-ll) addr */
119 struct in6_addr dh6req_serveraddr
; /* server's addr */
124 u_int8_t dh6rep_msgtype
; /* DH6_REPLY */
125 u_int8_t dh6rep_flagandstat
;
126 #define DH6REP_RELAYPRESENT 0x80
127 #define DH6REP_STATMASK 0x7f
128 u_int16_t dh6rep_xid
; /* transaction-ID */
129 struct in6_addr dh6rep_cliaddr
; /* client's lladdr */
130 /* struct in6_addr dh6rep_relayaddr; optional: relay address */
134 /* XXX: followings are based on older drafts */
135 struct dhcp6_release
{
136 u_int8_t dh6rel_msgtype
; /* DH6_RELEASE */
137 u_int8_t dh6rel_flags
;
138 #define DH6REL_DIRECT 0x80
139 u_int16_t dh6rel_xid
; /* transaction-ID */
140 struct in6_addr dh6rel_cliaddr
; /* client's lladdr */
141 struct in6_addr dh6rel_relayaddr
; /* relay agent's (non-ll) addr */
142 struct in6_addr dh6rel_reladdr
; /* server's addr to be released */
146 struct dhcp6_reconfig
{
147 u_int8_t dh6cfg_msgtype
; /* DH6_RECONFIG */
148 u_int8_t dh6cfg_flags
;
149 #define DH6REP_NOREPLY 0x80
150 u_int16_t dh6cfg_xid
; /* transaction-ID */
151 struct in6_addr dh6cfg_servaddr
; /* server's addr */
156 u_int8_t dh6_msgtype
;
157 struct dhcp6_solicit dh6_sol
;
158 struct dhcp6_advert dh6_adv
;
159 struct dhcp6_request dh6_req
;
160 struct dhcp6_reply dh6_rep
;
161 struct dhcp6_release dh6_rel
;
162 struct dhcp6_reconfig dh6_cfg
;
165 /* DHCP6 extension */
166 struct dhcp6e_ipaddr
{
167 u_int16_t dh6eip_type
;
168 u_int16_t dh6eip_len
;
169 u_int8_t dh6eip_status
;
170 #define DH6EX_IP_SUCCESS 0 /* request granted, no errors */
171 #define DH6EX_IP_SECFAIL 18 /* Security parameters failed */
172 #define DH6EX_IP_AAAAFAIL 20 /* AAAA Record Parameter Problem */
173 #define DH6EX_IP_PTRFAIL 21 /* PTR Record Parameter Problem */
174 #define DH6EX_IP_PARAMFAIL 22 /* Unable to honor required params */
175 #define DH6EX_IP_DNSNAMEFAIL 23 /* DNS name string error */
176 #define DH6EX_IP_NODYNDNS 24 /* dynDNS Not Implemented */
177 #define DH6EX_IP_NOAUTHDNS 25 /* Authoritative DNS Server not found */
178 #define DH6EX_IP_DNSFORMFAIL 33 /* DNS format error */
179 #define DH6EX_IP_SERVFAIL 34 /* dynDNS unavailable at this time */
180 #define DH6EX_IP_NXDOMAIN 35 /* name does not exist */
181 #define DH6EX_IP_NOTIMP 36 /* DNS does not support the Opcode */
182 #define DH6EX_IP_REFUSED 37 /* DNS refuses specified operation */
183 #define DH6EX_IP_YXDOMAIN 38 /* name does not exist */
184 #define DH6EX_IP_YXRRSET 39 /* RRset does not exist */
185 #define DH6EX_IP_NXRRSET 40 /* RRset does not exist */
186 #define DH6EX_IP_NOTAUTH 41 /* non authoritative name server */
187 #define DH6EX_IP_NOTZONE 42 /* prerequisite out of zone */
188 u_int8_t dh6eip_flags
;
189 #define DH6EX_IP_CLIANTADDR 0x80 /* C: cliant's addr */
190 #define DH6EX_IP_LIFETIME 0x40 /* L: preferred/valid lifetime */
191 #define DH6EX_IP_FORCEOPTS 0x20 /* Q: options are mandatory */
192 #define DH6EX_IP_AAAA 0x10 /* A: DNS dynamic update for AAAA */
193 #define DH6EX_IP_PTR 0x08 /* P: DNS dynamic update for PTR*/
195 u_int8_t dh6eip_prefixlen
;
196 /* struct in6_addr: client's address (if C bit = 1) */
197 /* u_int: preferred lifetime (if L bit = 1) */
198 /* u_int: valid lifetime (if L bit = 1) */
199 /* string: DNS name */
202 #endif /*__DHCP6_H_DEFINED*/