Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DHCPConst.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
5  * Marek Senderski <msend@o2.pl>
6  * changes: Michal Kowalczuk <michal@kowalczuk.eu>
7  *
8  * Released under GNU GPL v2 licence
9  *
10  */
11 
12 #ifndef DHCPCONST_H
13 #define DHCPCONST_H
14 
15 #define ALL_DHCP_RELAY_AGENTS_AND_SERVERS "ff02::1:2"
16 #define ALL_DHCP_SERVERS "ff05::1:3"
17 
18 #define DHCPCLIENT_PORT 546
19 #define DHCPSERVER_PORT 547
20 
21 // messages
22 #define SOLICIT_MSG 1
23 #define ADVERTISE_MSG 2
24 #define REQUEST_MSG 3
25 #define CONFIRM_MSG 4
26 #define RENEW_MSG 5
27 #define REBIND_MSG 6
28 #define REPLY_MSG 7
29 #define RELEASE_MSG 8
30 #define DECLINE_MSG 9
31 #define RECONFIGURE_MSG 10
32 #define INFORMATION_REQUEST_MSG 11
33 #define RELAY_FORW_MSG 12
34 #define RELAY_REPL_MSG 13
35 #define LEASEQUERY_MSG 14
36 #define LEASEQUERY_REPLY_MSG 15
37 
38 // implementation specific
39 #define CONTROL_MSG 255
40 
41 // timers, timeouts
42 
43 #define SOL_MAX_DELAY 1
44 #define SOL_TIMEOUT 1
45 #define SOL_MAX_RT 120
46 #define REQ_TIMEOUT 1
47 #define REQ_MAX_RT 30
48 #define REQ_MAX_RC 10
49 #define CNF_MAX_DELAY 1
50 #define CNF_TIMEOUT 1
51 #define CNF_MAX_RT 4
52 #define CNF_MAX_RD 10
53 #define REN_TIMEOUT 10
54 #define REN_MAX_RT 600
55 #define REB_TIMEOUT 10
56 #define REB_MAX_RT 600
57 #define INF_MAX_DELAY 1
58 #define INF_TIMEOUT 1
59 #define INF_MAX_RT 120
60 #define REL_TIMEOUT 1
61 #define REL_MAX_RC 5
62 #define DEC_TIMEOUT 1
63 #define DEC_MAX_RC 5
64 #define REC_TIMEOUT 2
65 #define REC_MAX_RC 8
66 
67 #define HOP_COUNT_LIMIT 32
68 
69 // how long does server caches its replies?
70 #define SERVER_REPLY_CACHE_TIMEOUT 60
71 
72 // RFC3315: supported options
73 #define OPTION_CLIENTID 1
74 #define OPTION_SERVERID 2
75 #define OPTION_IA_NA 3
76 #define OPTION_IA_TA 4
77 #define OPTION_IAADDR 5
78 #define OPTION_ORO 6
79 #define OPTION_PREFERENCE 7
80 #define OPTION_ELAPSED_TIME 8
81 #define OPTION_UNICAST 12
82 #define OPTION_STATUS_CODE 13
83 #define OPTION_RAPID_COMMIT 14
84 
85 // RFC3315: options not supported yet
86 #define OPTION_RELAY_MSG 9
87 #define OPTION_AUTH 11
88 #define OPTION_USER_CLASS 15
89 #define OPTION_VENDOR_CLASS 16
90 #define OPTION_VENDOR_OPTS 17
91 #define OPTION_INTERFACE_ID 18
92 #define OPTION_RECONF_MSG 19
93 #define OPTION_RECONF_ACCEPT 20
94 
95 // additional options
96 
97 // RFC3319: SIP servers and domains
98 #define OPTION_SIP_SERVER_D 21
99 #define OPTION_SIP_SERVER_A 22
100 
101 // RFC3646: DNS servers and domains
102 #define OPTION_DNS_SERVERS 23
103 #define OPTION_DOMAIN_LIST 24
104 
105 // RFC3633: Prefix options
106 #define OPTION_IA_PD 25
107 #define OPTION_IAPREFIX 26
108 
109 // RFC3898: NIS options
110 #define OPTION_NIS_SERVERS 27
111 #define OPTION_NISP_SERVERS 28
112 #define OPTION_NIS_DOMAIN_NAME 29
113 #define OPTION_NISP_DOMAIN_NAME 30
114 
115 // RFC4075: Simple Network Time Protocol (SNTP)
116 #define OPTION_SNTP_SERVERS 31
117 
118 // RFC4242: Information Refresh Time Option
119 #define OPTION_INFORMATION_REFRESH_TIME 32
120 
121 // RFC4280: Broadcast and Multicast Control Servers
122 #define OPTION_BCMCS_SERVER_D 33
123 #define OPTION_BCMCS_SERVER_A 34
124 
125 // RFC4776: Option for Civic Addresses Configuration Information
126 #define OPTION_GEOCONF_CIVIC 36
127 
128 // RFC4649: Relay Agent Remote-ID Option
129 #define OPTION_REMOTE_ID 37
130 
131 // RFC4580: Relay Agent Subscriber-ID Option
132 #define OPTION_SUBSCRIBER_ID 38
133 
134 // RFC4704: Client Fully Qualified Domain Name (FQDN) Option
135 #define OPTION_FQDN 39
136 
137 // RFC-ietf-dhc-paa-option-05.txt
138 #define OPTION_PANA_AGENT 40
139 
140 // RFC4833: Timezone options for DHCP
141 #define OPTION_NEW_POSIX_TIMEZONE 41
142 #define OPTION_NEW_TZDB_TIMEZONE 42
143 
144 // RFC-ietf-dhc-dhcpv6-ero-01.txt
145 #define OPTION_ERO 43
146 
147 // RFC5007: Leasequery
148 #define OPTION_LQ_QUERY 44
149 #define OPTION_CLIENT_DATA 45
150 #define OPTION_CLT_TIME 46
151 #define OPTION_LQ_RELAY_DATA 47
152 #define OPTION_LQ_CLIENT_LINK 48
153 
154 #define OPTION_RELAY_ID 53
155 
156 // draft-ietf-softwire-ds-lite-tunnel-option-10, approved by IESG
157 #define OPTION_AFTR_NAME 64
158 
159 // RFC6939
160 #define OPTION_CLIENT_LINKLAYER_ADDR 79
161 
162 // draft-ietf-mif-dhcpv6-route-option-04
163 #define OPTION_NEXT_HOP 242
164 #define OPTION_RTPREFIX 243
165 
166 // Experimental implementation for address prefix length information
167 // See: http://klub.com.pl/dhcpv6/doc/draft-mrugalski-addropts-XX-2007-04-17.txt
168 #define OPTION_ADDRPARAMS 251
169 
170 // draft-mrugalski-remote-dhcpv6-00
171 #define OPTION_NEIGHBORS 254
172 
173 // -- Query types (RFC5007) --
174 typedef enum {
178 
179 // --- Option lengths --
180 // (value of the len field, so actual option length is +4 bytes)
181 #define OPTION_ELAPSED_TIME_LEN 2
182 #define OPTION_INFORMATION_REFRESH_TIME_LEN 4
183 
184 // --- Status Codes ---
186 #define STATUSCODE_SUCCESS 0
187 #define STATUSCODE_UNSPECFAIL 1
188 #define STATUSCODE_NOADDRSAVAIL 2
189 #define STATUSCODE_NOBINDING 3
190 #define STATUSCODE_NOTONLINK 4
191 #define STATUSCODE_USEMULTICAST 5
192 #define STATUSCODE_NOPREFIXAVAIL 6
193 // Leasequery status codes
194 #define STATUSCODE_UNKNOWNQUERYTYPE 7
195 #define STATUSCODE_MALFORMEDQUERY 8
196 #define STATUSCODE_NOTCONFIGURED 9
197 #define STATUSCODE_NOTALLOWED 10
198 
199 // INFINITY + 1 is 0. That's cool!
200 #define DHCPV6_INFINITY 0xffffffffu
201 
209 };
210 
211 enum EState {
220 
221 // specifies server behavior, when receiving unknown FQDN
223  UNKNOWN_FQDN_REJECT = 0, // reject unknown FQDNs (do not assign a name from pool)
224  UNKKOWN_FQDN_ACCEPT_POOL = 1, // assign other name available in pool
225  UNKNOWN_FQDN_ACCEPT = 2, // accept unknown FQDNs
226  UNKNOWN_FQDN_APPEND = 3, // accept, but append defined domain suffix
227  UNKNOWN_FQDN_PROCEDURAL = 4 // generate name procedurally, append defined domain suffix
228 };
229 
230 // defines Identity assotiation type
231 enum TIAType {
232  IATYPE_IA, // IA_NA - non-temporary addresses
233  IATYPE_TA, // IA_TA - temporary addresses
234  IATYPE_PD // IA_PD - prefix delegation
235 };
236 
237 // FQDN option flags
238 #define FQDN_N 0x4
239 #define FQDN_O 0x2
240 #define FQDN_S 0x1
241 
242 // --- Bitfield in ADDRPARAMS option ---
243 #define ADDRPARAMS_MASK_PREFIX 0x01
244 #define ADDRPARAMS_MASK_ANYCAST 0x02
245 #define ADDRPARAMS_MASK_MULTICAST 0x04
246 
247 int allowOptInOpt(int msgType, int optOut, int optIn);
248 int allowOptInMsg(int msgType, int optType);
249 
250 // Supported authorization protocols
252  AUTH_PROTO_NONE = 0, // disabled
253  AUTH_PROTO_DELAYED = 2, // RFC 3315
254  AUTH_PROTO_RECONFIGURE_KEY = 3, // RFC 3315, section 21.5.1
255  AUTH_PROTO_DIBBLER = 4 // Mechanism proposed by Kowalczuk
256 };
257 
261 };
262 
263 // AUTH_ALGORITHM values for protocol type None (0)
264 // 0
265 
266 // AUTH_ALGORITHM values for delayed auth (2)
267 
268 // AUTH_ALGORITHM values for reconfigure key (3)
269 // This is protocol specific value and is useful only when AuthProtocols = 3
273 };
274 
275 // AUTH_ALGORITHM values for protocol type Dibbler (4)
277 // This is protocol specific value and is useful only when AuthProtocols = 4
287  //this must be last, increase it if necessary
289 };
290 
291 #ifdef __cplusplus
292 #include <vector>
293 typedef std::vector<DigestTypes> DigestTypesLst;
294 #endif
295 
296 unsigned getDigestSize(enum DigestTypes type);
297 char *getDigestName(enum DigestTypes type);
298 
299 // key is generated this way:
300 // key = HMAC-SHA1 (AAA-key, {Key Generation Nonce || client identifier})
301 // so it's size is always size of HMAC-SHA1 result which is 160bits = 20bytes
302 #define AUTHKEYLEN 20
303 
304 // Values used in reconfigure-key algorithm (see RFC3315, section 21.5.1)
305 const static unsigned int RECONFIGURE_KEY_AUTHINFO_SIZE = 17;
306 const static unsigned int RECONFIGURE_KEY_SIZE = 16; // HMAC-MD5 key
307 const static unsigned int RECONFIGURE_DIGEST_SIZE = 16; // HMAC-MD5 digest
308 
309 // Values used in delayed-auth algorithm (see RFC3315, section 21.4)
310 const static unsigned int DELAYED_AUTH_KEY_SIZE = 16; // HMAC-MD5 key
311 const static unsigned int DELAYED_AUTH_DIGEST_SIZE = 16; // HMAC-MD5 digest
312 const static unsigned int DELAYED_AUTH_KEY_ID_SIZE = 4; // uint32
313 
314 #endif
315