]>
Commit | Line | Data |
---|---|---|
d7837182 TL |
1 | /* dhcpd.h |
2 | ||
3 | Definitions for dhcpd... */ | |
4 | ||
5 | /* | |
dccb6edf | 6 | * Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC") |
98311e4b | 7 | * Copyright (c) 1996-2003 by Internet Software Consortium |
d7837182 | 8 | * |
98311e4b DH |
9 | * Permission to use, copy, modify, and distribute this software for any |
10 | * purpose with or without fee is hereby granted, provided that the above | |
11 | * copyright notice and this permission notice appear in all copies. | |
d7837182 | 12 | * |
98311e4b DH |
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES |
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR | |
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
19 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
d7837182 | 20 | * |
98311e4b DH |
21 | * Internet Systems Consortium, Inc. |
22 | * 950 Charter Street | |
23 | * Redwood City, CA 94063 | |
24 | * <info@isc.org> | |
25 | * http://www.isc.org/ | |
49733f31 | 26 | * |
98311e4b | 27 | * This software has been written for Internet Systems Consortium |
49733f31 | 28 | * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. |
98311e4b | 29 | * To learn more about Internet Systems Consortium, see |
49733f31 TL |
30 | * ``http://www.isc.org/''. To learn more about Vixie Enterprises, |
31 | * see ``http://www.vix.com''. To learn more about Nominum, Inc., see | |
32 | * ``http://www.nominum.com''. | |
d7837182 TL |
33 | */ |
34 | ||
fe5b0fdd | 35 | #include "config.h" |
98bd7ca0 | 36 | |
0c7802b1 | 37 | #ifndef __CYGWIN32__ |
d7837182 | 38 | #include <sys/types.h> |
d7837182 TL |
39 | #include <netinet/in.h> |
40 | #include <sys/socket.h> | |
5a526cf8 | 41 | #include <sys/un.h> |
d7837182 | 42 | #include <arpa/inet.h> |
972ab2aa | 43 | |
d7837182 | 44 | #include <netdb.h> |
0c7802b1 TL |
45 | #else |
46 | #define fd_set cygwin_fd_set | |
47 | #include <sys/types.h> | |
48 | #endif | |
d7837182 TL |
49 | #include <fcntl.h> |
50 | #include <stdio.h> | |
089fb364 | 51 | #include <unistd.h> |
8fdfeffe | 52 | #include <string.h> |
089fb364 TL |
53 | #include <stdlib.h> |
54 | #include <sys/stat.h> | |
66eaae18 | 55 | #include <sys/mman.h> |
089fb364 | 56 | #include <ctype.h> |
97ca1699 | 57 | #include <time.h> |
089fb364 | 58 | |
fe5b0fdd | 59 | #include <net/if.h> |
b8c0eda0 | 60 | #undef FDDI |
fe5b0fdd DH |
61 | #include <net/route.h> |
62 | #include <net/if_arp.h> | |
627ad6d6 | 63 | #if HAVE_NET_IF_DL_H |
6dd7efa2 DH |
64 | # include <net/if_dl.h> |
65 | #endif | |
fe5b0fdd DH |
66 | |
67 | #include <setjmp.h> | |
68 | ||
2f620dce | 69 | #include "cdefs.h" |
a8b53b42 | 70 | #include "osdep.h" |
e55017af TL |
71 | |
72 | #include "arpa/nameser.h" | |
73 | #if defined (NSUPDATE) | |
c7315f8d | 74 | # include "minires/minires.h" |
e55017af TL |
75 | #endif |
76 | ||
98311e4b DH |
77 | struct hash_table; |
78 | typedef struct hash_table group_hash_t; | |
79 | typedef struct hash_table universe_hash_t; | |
f7fdb216 DH |
80 | typedef struct hash_table option_name_hash_t; |
81 | typedef struct hash_table option_code_hash_t; | |
98311e4b | 82 | typedef struct hash_table dns_zone_hash_t; |
6708d944 DH |
83 | typedef struct hash_table lease_ip_hash_t; |
84 | typedef struct hash_table lease_id_hash_t; | |
98311e4b DH |
85 | typedef struct hash_table host_hash_t; |
86 | typedef struct hash_table class_hash_t; | |
87 | ||
fe5b0fdd DH |
88 | typedef time_t TIME; |
89 | ||
90 | #ifndef EOL | |
91 | #define EOL '\n' | |
92 | #endif | |
93 | ||
d7837182 | 94 | #include "dhcp.h" |
98bd7ca0 | 95 | #include "dhcp6.h" |
2b9b6ff7 | 96 | #include "statement.h" |
d7837182 | 97 | #include "tree.h" |
089fb364 | 98 | #include "inet.h" |
fde86d2d | 99 | #include "dhctoken.h" |
98bd7ca0 | 100 | #include "heap.h" |
d7837182 | 101 | |
d758ad8c | 102 | #include <isc-dhcp/result.h> |
400c0b19 | 103 | #include <omapip/omapip_p.h> |
4fe74d72 | 104 | |
f7fdb216 | 105 | #if !defined (BYTE_NAME_HASH_SIZE) |
20ae1aff | 106 | # define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */ |
f7fdb216 DH |
107 | #endif |
108 | #if !defined (BYTE_CODE_HASH_SIZE) | |
20ae1aff | 109 | # define BYTE_CODE_HASH_SIZE 254 /* Default would be ridiculous. */ |
f7fdb216 DH |
110 | #endif |
111 | ||
6708d944 DH |
112 | /* Although it is highly improbable that a 16-bit option space might |
113 | * actually use 2^16 actual defined options, it is the worst case | |
114 | * scenario we must prepare for. Having 4 options per bucket in this | |
115 | * case is pretty reasonable. | |
116 | */ | |
f7fdb216 | 117 | #if !defined (WORD_NAME_HASH_SIZE) |
6708d944 | 118 | # define WORD_NAME_HASH_SIZE 20479 |
f7fdb216 DH |
119 | #endif |
120 | #if !defined (WORD_CODE_HASH_SIZE) | |
6708d944 | 121 | # define WORD_CODE_HASH_SIZE 16384 |
f7fdb216 DH |
122 | #endif |
123 | ||
6708d944 | 124 | /* Not only is it improbable that the 32-bit spaces might actually use 2^32 |
20ae1aff | 125 | * defined options, it is infeasible. It would be best for this kind of |
6708d944 DH |
126 | * space to be dynamically sized. Instead we size it at the word hash's |
127 | * level. | |
128 | */ | |
f7fdb216 DH |
129 | #if !defined (QUAD_NAME_HASH_SIZE) |
130 | # define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE | |
131 | #endif | |
132 | #if !defined (QUAD_CODE_HASH_SIZE) | |
133 | # define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE | |
134 | #endif | |
135 | ||
136 | #if !defined (DNS_HASH_SIZE) | |
137 | # define DNS_HASH_SIZE 0 /* Default. */ | |
138 | #endif | |
139 | ||
140 | /* Default size to use for name/code hashes on user-defined option spaces. */ | |
141 | #if !defined (DEFAULT_SPACE_HASH_SIZE) | |
142 | # define DEFAULT_SPACE_HASH_SIZE 11 | |
143 | #endif | |
144 | ||
145 | #if !defined (NWIP_HASH_SIZE) | |
6708d944 | 146 | # define NWIP_HASH_SIZE 17 /* A really small table. */ |
f7fdb216 DH |
147 | #endif |
148 | ||
149 | #if !defined (FQDN_HASH_SIZE) | |
20ae1aff | 150 | # define FQDN_HASH_SIZE 13 /* A ridiculously small table. */ |
f7fdb216 DH |
151 | #endif |
152 | ||
6708d944 DH |
153 | /* I really doubt a given installation is going to have more than a few |
154 | * hundred vendors involved. | |
155 | */ | |
f7fdb216 | 156 | #if !defined (VIVCO_HASH_SIZE) |
6708d944 | 157 | # define VIVCO_HASH_SIZE 127 |
f7fdb216 DH |
158 | #endif |
159 | ||
160 | #if !defined (VIVSO_HASH_SIZE) | |
161 | # define VIVSO_HASH_SIZE VIVCO_HASH_SIZE | |
162 | #endif | |
163 | ||
98bd7ca0 DH |
164 | #if !defined (VSIO_HASH_SIZE) |
165 | # define VSIO_HASH_SIZE VIVCO_HASH_SIZE | |
166 | #endif | |
167 | ||
f7fdb216 DH |
168 | #if !defined (VIV_ISC_HASH_SIZE) |
169 | # define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */ | |
170 | #endif | |
171 | ||
172 | #if !defined (UNIVERSE_HASH_SIZE) | |
6708d944 | 173 | # define UNIVERSE_HASH_SIZE 13 /* A really small table. */ |
f7fdb216 DH |
174 | #endif |
175 | ||
176 | #if !defined (GROUP_HASH_SIZE) | |
177 | # define GROUP_HASH_SIZE 0 /* Default. */ | |
178 | #endif | |
179 | ||
6708d944 DH |
180 | /* At least one person has indicated they use ~20k host records. |
181 | */ | |
f7fdb216 | 182 | #if !defined (HOST_HASH_SIZE) |
6708d944 | 183 | # define HOST_HASH_SIZE 22501 |
f7fdb216 DH |
184 | #endif |
185 | ||
6708d944 DH |
186 | /* We have user reports of use of ISC DHCP numbering leases in the 200k's. |
187 | * | |
188 | * We also have reports of folks using 10.0/8 as a dynamic range. The | |
189 | * following is something of a compromise between the two. At the ~2-3 | |
190 | * hundred thousand leases, there's ~2-3 leases to search in each bucket. | |
191 | */ | |
f7fdb216 | 192 | #if !defined (LEASE_HASH_SIZE) |
6708d944 | 193 | # define LEASE_HASH_SIZE 100003 |
f7fdb216 DH |
194 | #endif |
195 | ||
6708d944 DH |
196 | /* It is not known what the worst case subclass hash size is. We estimate |
197 | * high, I think. | |
198 | */ | |
f7fdb216 | 199 | #if !defined (SCLASS_HASH_SIZE) |
6708d944 | 200 | # define SCLASS_HASH_SIZE 12007 |
f7fdb216 DH |
201 | #endif |
202 | ||
203 | #if !defined (AGENT_HASH_SIZE) | |
204 | # define AGENT_HASH_SIZE 11 /* A really small table. */ | |
205 | #endif | |
206 | ||
6708d944 DH |
207 | /* The server hash size is used for both names and codes. There aren't |
208 | * many (roughly 50 at the moment), so we use a smaller table. If we | |
209 | * use a 1:1 table size, then we get name collisions due to poor name | |
210 | * hashing. So we use double the space we need, which drastically | |
211 | * reduces collisions. | |
212 | */ | |
f7fdb216 | 213 | #if !defined (SERVER_HASH_SIZE) |
6708d944 | 214 | # define SERVER_HASH_SIZE (2*(sizeof(server_options) / sizeof(struct option))) |
f7fdb216 DH |
215 | #endif |
216 | ||
217 | ||
6708d944 | 218 | /* How many options are likely to appear in a single packet? */ |
27fe61a7 TL |
219 | #if !defined (OPTION_HASH_SIZE) |
220 | # define OPTION_HASH_SIZE 17 | |
0dbb132f TL |
221 | # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */ |
222 | # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */ | |
27fe61a7 TL |
223 | #endif |
224 | ||
0dbb132f TL |
225 | #define compute_option_hash(x) \ |
226 | (((x) & (OPTION_HASH_PTWO - 1)) + \ | |
227 | (((x) >> OPTION_HASH_EXP) & \ | |
228 | (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE; | |
229 | ||
d758ad8c TL |
230 | enum dhcp_shutdown_state { |
231 | shutdown_listeners, | |
232 | shutdown_omapi_connections, | |
233 | shutdown_drop_omapi_connections, | |
234 | shutdown_dhcp, | |
235 | shutdown_done | |
236 | }; | |
237 | ||
35e0fdf8 TL |
238 | /* Client FQDN option, failover FQDN option, etc. */ |
239 | typedef struct { | |
240 | u_int8_t codes [2]; | |
241 | unsigned length; | |
242 | u_int8_t *data; | |
243 | } ddns_fqdn_t; | |
244 | ||
de1863a1 | 245 | #include "failover.h" |
35e0fdf8 | 246 | |
fde86d2d TL |
247 | /* A parsing context. */ |
248 | ||
249 | struct parse { | |
250 | int lexline; | |
251 | int lexchar; | |
252 | char *token_line; | |
253 | char *prev_line; | |
254 | char *cur_line; | |
b1b7b521 | 255 | const char *tlname; |
fde86d2d TL |
256 | int eol_token; |
257 | ||
d19e816e SK |
258 | /* |
259 | * In order to give nice output when we have a parsing error | |
260 | * in our file, we keep track of where we are in the line so | |
261 | * that we can show the user. | |
262 | * | |
263 | * We need to keep track of two lines, because we can look | |
264 | * ahead, via the "peek" function, to the next line sometimes. | |
265 | * | |
266 | * The "line1" and "line2" variables act as buffers for this | |
267 | * information. The "lpos" variable tells us where we are in the | |
268 | * line. | |
269 | * | |
270 | * When we "put back" a character from the parsing context, we | |
271 | * do not want to have the character appear twice in the error | |
272 | * output. So, we set a flag, the "ugflag", which the | |
273 | * get_char() function uses to check for this condition. | |
274 | */ | |
fde86d2d TL |
275 | char line1 [81]; |
276 | char line2 [81]; | |
277 | int lpos; | |
278 | int line; | |
279 | int tlpos; | |
280 | int tline; | |
281 | enum dhcp_token token; | |
282 | int ugflag; | |
283 | char *tval; | |
b3519f23 | 284 | int tlen; |
fde86d2d TL |
285 | char tokbuf [1500]; |
286 | ||
fde86d2d TL |
287 | int warnings_occurred; |
288 | int file; | |
289 | char *inbuf; | |
66eaae18 SK |
290 | size_t bufix, buflen; |
291 | size_t bufsiz; | |
bda33169 SK |
292 | |
293 | struct parse *saved_state; | |
fde86d2d TL |
294 | }; |
295 | ||
74f45f96 | 296 | /* Variable-length array of data. */ |
74f45f96 | 297 | |
6b3b97e1 TL |
298 | struct string_list { |
299 | struct string_list *next; | |
300 | char string [1]; | |
301 | }; | |
302 | ||
0c7802b1 TL |
303 | /* A name server, from /etc/resolv.conf. */ |
304 | struct name_server { | |
305 | struct name_server *next; | |
306 | struct sockaddr_in addr; | |
307 | TIME rcdate; | |
308 | }; | |
309 | ||
310 | /* A domain search list element. */ | |
311 | struct domain_search_list { | |
312 | struct domain_search_list *next; | |
313 | char *domain; | |
314 | TIME rcdate; | |
315 | }; | |
316 | ||
5142937c TL |
317 | /* Option tag structures are used to build chains of option tags, for |
318 | when we're sure we're not going to have enough of them to justify | |
319 | maintaining an array. */ | |
320 | ||
321 | struct option_tag { | |
322 | struct option_tag *next; | |
323 | u_int8_t data [1]; | |
324 | }; | |
325 | ||
326 | /* An agent option structure. We need a special structure for the | |
327 | Relay Agent Information option because if more than one appears in | |
c57db45c | 328 | a message, we have to keep them separate. */ |
5142937c TL |
329 | |
330 | struct agent_options { | |
331 | struct agent_options *next; | |
332 | int length; | |
333 | struct option_tag *first; | |
334 | }; | |
335 | ||
27fe61a7 TL |
336 | struct option_cache { |
337 | int refcnt; | |
338 | struct option_cache *next; | |
339 | struct expression *expression; | |
340 | struct option *option; | |
341 | struct data_string data; | |
88cd8aca DH |
342 | |
343 | #define OPTION_HAD_NULLS 0x00000001 | |
344 | u_int32_t flags; | |
27fe61a7 | 345 | }; |
5142937c | 346 | |
27fe61a7 | 347 | struct option_state { |
a340de95 | 348 | int refcnt; |
4f58da18 | 349 | int universe_count; |
53ac6c6f TL |
350 | int site_universe; |
351 | int site_code_min; | |
fe5b0fdd | 352 | void *universes [1]; |
5142937c TL |
353 | }; |
354 | ||
d7837182 TL |
355 | /* A dhcp packet and the pointers to its option values. */ |
356 | struct packet { | |
357 | struct dhcp_packet *raw; | |
f3e8ea32 | 358 | int refcnt; |
b1b7b521 | 359 | unsigned packet_length; |
d7837182 | 360 | int packet_type; |
98bd7ca0 DH |
361 | |
362 | unsigned char dhcpv6_msg_type; /* DHCPv6 message type */ | |
363 | ||
364 | /* DHCPv6 transaction ID */ | |
365 | unsigned char dhcpv6_transaction_id[3]; | |
366 | ||
367 | /* DHCPv6 relay information */ | |
368 | unsigned char dhcpv6_hop_count; | |
369 | struct in6_addr dhcpv6_link_address; | |
370 | struct in6_addr dhcpv6_peer_address; | |
371 | ||
372 | /* DHCPv6 packet containing this one, or NULL if none */ | |
373 | struct packet *dhcpv6_container_packet; | |
374 | ||
d7837182 | 375 | int options_valid; |
089fb364 TL |
376 | int client_port; |
377 | struct iaddr client_addr; | |
17b95f41 TL |
378 | struct interface_info *interface; /* Interface on which packet |
379 | was received. */ | |
380 | struct hardware *haddr; /* Physical link address | |
381 | of local sender (maybe gateway). */ | |
c4763f5f TL |
382 | |
383 | /* Information for relay agent options (see | |
384 | draft-ietf-dhc-agent-options-xx.txt). */ | |
385 | u_int8_t *circuit_id; /* Circuit ID of client connection. */ | |
386 | int circuit_id_len; | |
387 | u_int8_t *remote_id; /* Remote ID of client. */ | |
388 | int remote_id_len; | |
389 | ||
f67530be TL |
390 | int got_requested_address; /* True if client sent the |
391 | dhcp-requested-address option. */ | |
392 | ||
c626ae69 | 393 | struct shared_network *shared_network; |
4f58da18 | 394 | struct option_state *options; |
102ee7e9 TL |
395 | |
396 | #if !defined (PACKET_MAX_CLASSES) | |
397 | # define PACKET_MAX_CLASSES 5 | |
398 | #endif | |
399 | int class_count; | |
400 | struct class *classes [PACKET_MAX_CLASSES]; | |
734d2258 TL |
401 | |
402 | int known; | |
403 | int authenticated; | |
9aa3f3a5 DH |
404 | |
405 | /* If we stash agent options onto the packet option state, to pretend | |
406 | * options we got in a previous exchange were still there, we need | |
407 | * to signal this in a reliable way. | |
408 | */ | |
409 | isc_boolean_t agent_options_stashed; | |
98bd7ca0 DH |
410 | |
411 | /* | |
412 | * ISC_TRUE if packet received unicast (as opposed to multicast). | |
413 | * Only used in DHCPv6. | |
414 | */ | |
415 | isc_boolean_t unicast; | |
d7837182 TL |
416 | }; |
417 | ||
5142937c TL |
418 | /* A network interface's MAC address. */ |
419 | ||
d7837182 | 420 | struct hardware { |
d7837182 | 421 | u_int8_t hlen; |
5b7f941d | 422 | u_int8_t hbuf [17]; |
d7837182 TL |
423 | }; |
424 | ||
d758ad8c TL |
425 | typedef enum { |
426 | server_startup = 0, | |
427 | server_running = 1, | |
428 | server_shutdown = 2, | |
429 | server_hibernate = 3, | |
430 | server_awaken = 4 | |
431 | } control_object_state_t; | |
432 | ||
433 | typedef struct { | |
434 | OMAPI_OBJECT_PREAMBLE; | |
435 | control_object_state_t state; | |
436 | } dhcp_control_object_t; | |
437 | ||
7ea8b207 | 438 | /* Lease states: */ |
98311e4b DH |
439 | #define FTS_FREE 1 |
440 | #define FTS_ACTIVE 2 | |
441 | #define FTS_EXPIRED 3 | |
442 | #define FTS_RELEASED 4 | |
443 | #define FTS_ABANDONED 5 | |
444 | #define FTS_RESET 6 | |
445 | #define FTS_BACKUP 7 | |
98311e4b DH |
446 | typedef u_int8_t binding_state_t; |
447 | ||
448 | /* FTS_LAST is the highest value that is valid for a lease binding state. */ | |
a55ccdd0 | 449 | #define FTS_LAST FTS_BACKUP |
7ea8b207 | 450 | |
d7837182 TL |
451 | /* A dhcp lease declaration structure. */ |
452 | struct lease { | |
4fe74d72 | 453 | OMAPI_OBJECT_PREAMBLE; |
d7837182 | 454 | struct lease *next; |
ab370123 | 455 | struct lease *n_uid, *n_hw; |
fc2df23a | 456 | |
089fb364 | 457 | struct iaddr ip_addr; |
6d103865 | 458 | TIME starts, ends, sort_time; |
0c7802b1 | 459 | char *client_hostname; |
6ceb9118 | 460 | struct binding_scope *scope; |
d7837182 | 461 | struct host_decl *host; |
c626ae69 | 462 | struct subnet *subnet; |
734d2258 | 463 | struct pool *pool; |
112a6c2c | 464 | struct class *billing_class; |
625f7cee | 465 | struct option_chain_head *agent_options; |
fc2df23a | 466 | |
79a65726 TL |
467 | struct executable_statement *on_expiry; |
468 | struct executable_statement *on_commit; | |
469 | struct executable_statement *on_release; | |
470 | ||
f3aad410 TL |
471 | unsigned char *uid; |
472 | unsigned short uid_len; | |
473 | unsigned short uid_max; | |
474 | unsigned char uid_buf [7]; | |
475 | struct hardware hardware_addr; | |
476 | ||
477 | u_int8_t flags; | |
c626ae69 | 478 | # define STATIC_LEASE 1 |
98311e4b | 479 | # define BOOTP_LEASE 2 |
a55ccdd0 | 480 | # define RESERVED_LEASE 4 |
fc2df23a | 481 | # define MS_NULL_TERMINATION 8 |
007e3ee4 TL |
482 | # define ON_UPDATE_QUEUE 16 |
483 | # define ON_ACK_QUEUE 32 | |
4c7ffd58 | 484 | # define ON_QUEUE (ON_UPDATE_QUEUE | ON_ACK_QUEUE) |
bca94423 | 485 | # define UNICAST_BROADCAST_HACK 64 |
98311e4b | 486 | # define ON_DEFERRED_QUEUE 128 |
a55ccdd0 DH |
487 | |
488 | /* Persistent flags are to be preserved on a given lease structure. */ | |
489 | # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE) | |
490 | /* Ephemeral flags are to be preserved on a given lease (copied etc). */ | |
bca94423 | 491 | # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \ |
a55ccdd0 DH |
492 | UNICAST_BROADCAST_HACK | \ |
493 | RESERVED_LEASE | \ | |
494 | BOOTP_LEASE) | |
2aac4312 | 495 | |
98311e4b DH |
496 | binding_state_t binding_state; |
497 | binding_state_t next_binding_state; | |
498 | binding_state_t desired_binding_state; | |
007e3ee4 | 499 | |
6e5ed8bf | 500 | struct lease_state *state; |
5b7f941d | 501 | |
88cd8aca DH |
502 | /* 'tsfp' is more of an 'effective' tsfp. It may be calculated from |
503 | * stos+mclt for example if it's an expired lease and the server is | |
504 | * in partner-down state. 'atsfp' is zeroed whenever a lease is | |
505 | * updated - and only set when the peer acknowledges it. This | |
506 | * ensures every state change is transmitted. | |
507 | */ | |
5b7f941d TL |
508 | TIME tstp; /* Time sent to partner. */ |
509 | TIME tsfp; /* Time sent from partner. */ | |
88cd8aca | 510 | TIME atsfp; /* Actual time sent from partner. */ |
5b7f941d | 511 | TIME cltt; /* Client last transaction time. */ |
a55ccdd0 | 512 | u_int32_t last_xid; /* XID we sent in this lease's BNDUPD */ |
aa8579c0 | 513 | struct lease *next_pending; |
6e5ed8bf TL |
514 | }; |
515 | ||
516 | struct lease_state { | |
517 | struct lease_state *next; | |
518 | ||
519 | struct interface_info *ip; | |
520 | ||
f3e8ea32 TL |
521 | struct packet *packet; /* The incoming packet. */ |
522 | ||
6e5ed8bf TL |
523 | TIME offered_expiry; |
524 | ||
4f58da18 | 525 | struct option_state *options; |
15151db6 | 526 | struct data_string parameter_request_list; |
5142937c | 527 | int max_message_size; |
dcc557db | 528 | unsigned char expiry[4], renewal[4], rebind[4]; |
2b9b6ff7 | 529 | struct data_string filename, server_name; |
f67530be TL |
530 | int got_requested_address; |
531 | int got_server_identifier; | |
532 | struct shared_network *shared_network; /* Shared network of interface | |
533 | on which request arrived. */ | |
fc2df23a TL |
534 | |
535 | u_int32_t xid; | |
536 | u_int16_t secs; | |
537 | u_int16_t bootp_flags; | |
538 | struct in_addr ciaddr; | |
c783f799 | 539 | struct in_addr siaddr; |
fc2df23a TL |
540 | struct in_addr giaddr; |
541 | u_int8_t hops; | |
542 | u_int8_t offer; | |
27fe61a7 | 543 | struct iaddr from; |
c626ae69 TL |
544 | }; |
545 | ||
ab370123 | 546 | #define ROOT_GROUP 0 |
750d0800 TL |
547 | #define HOST_DECL 1 |
548 | #define SHARED_NET_DECL 2 | |
549 | #define SUBNET_DECL 3 | |
550 | #define CLASS_DECL 4 | |
551 | #define GROUP_DECL 5 | |
74f45f96 | 552 | #define POOL_DECL 6 |
ab370123 | 553 | |
cc26de46 TL |
554 | /* Possible modes in which discover_interfaces can run. */ |
555 | ||
556 | #define DISCOVER_RUNNING 0 | |
557 | #define DISCOVER_SERVER 1 | |
558 | #define DISCOVER_UNCONFIGURED 2 | |
f79e49f3 | 559 | #define DISCOVER_RELAY 3 |
5a526cf8 | 560 | #define DISCOVER_REQUESTED 4 |
cc26de46 | 561 | |
98bd7ca0 DH |
562 | /* DDNS_UPDATE_STYLE enumerations. */ |
563 | #define DDNS_UPDATE_STYLE_NONE 0 | |
564 | #define DDNS_UPDATE_STYLE_AD_HOC 1 | |
565 | #define DDNS_UPDATE_STYLE_INTERIM 2 | |
566 | ||
2b9b6ff7 TL |
567 | /* Server option names. */ |
568 | ||
569 | #define SV_DEFAULT_LEASE_TIME 1 | |
570 | #define SV_MAX_LEASE_TIME 2 | |
571 | #define SV_MIN_LEASE_TIME 3 | |
572 | #define SV_BOOTP_LEASE_CUTOFF 4 | |
573 | #define SV_BOOTP_LEASE_LENGTH 5 | |
574 | #define SV_BOOT_UNKNOWN_CLIENTS 6 | |
575 | #define SV_DYNAMIC_BOOTP 7 | |
576 | #define SV_ALLOW_BOOTP 8 | |
577 | #define SV_ALLOW_BOOTING 9 | |
578 | #define SV_ONE_LEASE_PER_CLIENT 10 | |
579 | #define SV_GET_LEASE_HOSTNAMES 11 | |
580 | #define SV_USE_HOST_DECL_NAMES 12 | |
581 | #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13 | |
582 | #define SV_MIN_SECS 14 | |
583 | #define SV_FILENAME 15 | |
584 | #define SV_SERVER_NAME 16 | |
585 | #define SV_NEXT_SERVER 17 | |
d1f2c520 | 586 | #define SV_AUTHORITATIVE 18 |
4f58da18 | 587 | #define SV_VENDOR_OPTION_SPACE 19 |
4b7f8736 | 588 | #define SV_ALWAYS_REPLY_RFC1048 20 |
53ac6c6f | 589 | #define SV_SITE_OPTION_SPACE 21 |
f7b9d823 | 590 | #define SV_ALWAYS_BROADCAST 22 |
972ab2aa TL |
591 | #define SV_DDNS_DOMAIN_NAME 23 |
592 | #define SV_DDNS_HOST_NAME 24 | |
593 | #define SV_DDNS_REV_DOMAIN_NAME 25 | |
94bf482e TL |
594 | #define SV_LEASE_FILE_NAME 26 |
595 | #define SV_PID_FILE_NAME 27 | |
4c026751 TL |
596 | #define SV_DUPLICATES 28 |
597 | #define SV_DECLINES 29 | |
7f6ad5ac | 598 | #define SV_DDNS_UPDATES 30 |
aa8579c0 TL |
599 | #define SV_OMAPI_PORT 31 |
600 | #define SV_LOCAL_PORT 32 | |
601 | #define SV_LIMITED_BROADCAST_ADDRESS 33 | |
602 | #define SV_REMOTE_PORT 34 | |
603 | #define SV_LOCAL_ADDRESS 35 | |
49146f3c | 604 | #define SV_OMAPI_KEY 36 |
159bcce3 | 605 | #define SV_STASH_AGENT_OPTIONS 37 |
b992d7e2 | 606 | #define SV_DDNS_TTL 38 |
dbcc689e | 607 | #define SV_DDNS_UPDATE_STYLE 39 |
afc0ca25 TL |
608 | #define SV_CLIENT_UPDATES 40 |
609 | #define SV_UPDATE_OPTIMIZATION 41 | |
cc4473a0 TL |
610 | #define SV_PING_CHECKS 42 |
611 | #define SV_UPDATE_STATIC_LEASES 43 | |
625f7cee | 612 | #define SV_LOG_FACILITY 44 |
98311e4b | 613 | #define SV_DO_FORWARD_UPDATES 45 |
a55ccdd0 DH |
614 | #define SV_PING_TIMEOUT 46 |
615 | #define SV_RESERVE_INFINITE 47 | |
3004bebf | 616 | #define SV_DDNS_CONFLICT_DETECT 48 |
6d103865 | 617 | #define SV_LEASEQUERY 49 |
b22de500 | 618 | #define SV_ADAPTIVE_LEASE_TIME_THRESHOLD 50 |
4d2eaafb | 619 | #define SV_DO_REVERSE_UPDATES 51 |
1ba87b37 | 620 | #define SV_FQDN_REPLY 52 |
98bd7ca0 | 621 | #define SV_PREFER_LIFETIME 53 |
75135a3f EH |
622 | #define SV_DHCPV6_LEASE_FILE_NAME 54 |
623 | #define SV_DHCPV6_PID_FILE_NAME 55 | |
b024480e | 624 | #define SV_LIMIT_ADDRS_PER_IA 56 |
80c9fdb0 FD |
625 | #define SV_LIMIT_PREFS_PER_IA 57 |
626 | #define SV_DELAYED_ACK 58 | |
f8cbf390 | 627 | #define SV_MAX_ACK_DELAY 59 |
98311e4b DH |
628 | |
629 | #if !defined (DEFAULT_PING_TIMEOUT) | |
630 | # define DEFAULT_PING_TIMEOUT 1 | |
631 | #endif | |
2b9b6ff7 | 632 | |
6368a1bd DH |
633 | #if !defined (DEFAULT_DELAYED_ACK) |
634 | # define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */ | |
635 | #endif | |
636 | ||
f8cbf390 DH |
637 | #if !defined (DEFAULT_ACK_DELAY_SECS) |
638 | # define DEFAULT_ACK_DELAY_SECS 0 | |
639 | #endif | |
640 | ||
641 | #if !defined (DEFAULT_ACK_DELAY_USECS) | |
642 | # define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */ | |
643 | #endif | |
644 | ||
2b9b6ff7 TL |
645 | #if !defined (DEFAULT_DEFAULT_LEASE_TIME) |
646 | # define DEFAULT_DEFAULT_LEASE_TIME 43200 | |
647 | #endif | |
648 | ||
649 | #if !defined (DEFAULT_MIN_LEASE_TIME) | |
3a16098f | 650 | # define DEFAULT_MIN_LEASE_TIME 300 |
2b9b6ff7 TL |
651 | #endif |
652 | ||
653 | #if !defined (DEFAULT_MAX_LEASE_TIME) | |
654 | # define DEFAULT_MAX_LEASE_TIME 86400 | |
655 | #endif | |
656 | ||
b992d7e2 DN |
657 | #if !defined (DEFAULT_DDNS_TTL) |
658 | # define DEFAULT_DDNS_TTL 3600 | |
659 | #endif | |
660 | ||
27fe61a7 TL |
661 | /* Client option names */ |
662 | ||
663 | #define CL_TIMEOUT 1 | |
664 | #define CL_SELECT_INTERVAL 2 | |
665 | #define CL_REBOOT_TIMEOUT 3 | |
666 | #define CL_RETRY_INTERVAL 4 | |
667 | #define CL_BACKOFF_CUTOFF 5 | |
668 | #define CL_INITIAL_INTERVAL 6 | |
669 | #define CL_BOOTP_POLICY 7 | |
670 | #define CL_SCRIPT_NAME 8 | |
671 | #define CL_REQUESTED_OPTIONS 9 | |
672 | #define CL_REQUESTED_LEASE_TIME 10 | |
673 | #define CL_SEND_OPTIONS 11 | |
674 | #define CL_MEDIA 12 | |
675 | #define CL_REJECT_LIST 13 | |
676 | ||
677 | #ifndef CL_DEFAULT_TIMEOUT | |
678 | # define CL_DEFAULT_TIMEOUT 60 | |
679 | #endif | |
680 | ||
681 | #ifndef CL_DEFAULT_SELECT_INTERVAL | |
682 | # define CL_DEFAULT_SELECT_INTERVAL 0 | |
683 | #endif | |
684 | ||
685 | #ifndef CL_DEFAULT_REBOOT_TIMEOUT | |
686 | # define CL_DEFAULT_REBOOT_TIMEOUT 10 | |
687 | #endif | |
688 | ||
689 | #ifndef CL_DEFAULT_RETRY_INTERVAL | |
690 | # define CL_DEFAULT_RETRY_INTERVAL 300 | |
691 | #endif | |
692 | ||
693 | #ifndef CL_DEFAULT_BACKOFF_CUTOFF | |
694 | # define CL_DEFAULT_BACKOFF_CUTOFF 120 | |
695 | #endif | |
696 | ||
697 | #ifndef CL_DEFAULT_INITIAL_INTERVAL | |
698 | # define CL_DEFAULT_INITIAL_INTERVAL 10 | |
699 | #endif | |
700 | ||
701 | #ifndef CL_DEFAULT_BOOTP_POLICY | |
c5b0f529 | 702 | # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT |
27fe61a7 TL |
703 | #endif |
704 | ||
27fe61a7 TL |
705 | #ifndef CL_DEFAULT_REQUESTED_OPTIONS |
706 | # define CL_DEFAULT_REQUESTED_OPTIONS \ | |
707 | { DHO_SUBNET_MASK, \ | |
708 | DHO_BROADCAST_ADDRESS, \ | |
709 | DHO_TIME_OFFSET, \ | |
710 | DHO_ROUTERS, \ | |
711 | DHO_DOMAIN_NAME, \ | |
712 | DHO_DOMAIN_NAME_SERVERS, \ | |
713 | DHO_HOST_NAME } | |
714 | #endif | |
715 | ||
940ea8ab TL |
716 | struct group_object { |
717 | OMAPI_OBJECT_PREAMBLE; | |
718 | ||
719 | struct group_object *n_dynamic; | |
720 | struct group *group; | |
721 | char *name; | |
722 | int flags; | |
723 | #define GROUP_OBJECT_DELETED 1 | |
724 | #define GROUP_OBJECT_DYNAMIC 2 | |
725 | #define GROUP_OBJECT_STATIC 4 | |
726 | }; | |
727 | ||
750d0800 | 728 | /* Group of declarations that share common parameters. */ |
ab370123 TL |
729 | struct group { |
730 | struct group *next; | |
731 | ||
20916cae | 732 | int refcnt; |
940ea8ab | 733 | struct group_object *object; |
ab370123 TL |
734 | struct subnet *subnet; |
735 | struct shared_network *shared_network; | |
d1f2c520 | 736 | int authoritative; |
2b9b6ff7 | 737 | struct executable_statement *statements; |
ab370123 TL |
738 | }; |
739 | ||
740 | /* A dhcp host declaration structure. */ | |
741 | struct host_decl { | |
4fe74d72 | 742 | OMAPI_OBJECT_PREAMBLE; |
ab370123 | 743 | struct host_decl *n_ipaddr; |
4fe74d72 | 744 | struct host_decl *n_dynamic; |
ab370123 TL |
745 | char *name; |
746 | struct hardware interface; | |
2b9b6ff7 | 747 | struct data_string client_identifier; |
98bd7ca0 DH |
748 | struct option *host_id_option; |
749 | struct data_string host_id; | |
750 | /* XXXSK: fixed_addr should be an array of iaddr values, | |
751 | not an option_cache, but it's referenced in a lot of | |
752 | places, so we'll leave it for now. */ | |
2b9b6ff7 | 753 | struct option_cache *fixed_addr; |
80c9fdb0 | 754 | struct iaddrcidrnetlist *fixed_prefix; |
ab370123 | 755 | struct group *group; |
940ea8ab | 756 | struct group_object *named_group; |
74f45f96 | 757 | struct data_string auth_key_id; |
4fe74d72 | 758 | int flags; |
3c48d369 TL |
759 | #define HOST_DECL_DELETED 1 |
760 | #define HOST_DECL_DYNAMIC 2 | |
940ea8ab | 761 | #define HOST_DECL_STATIC 4 |
ab370123 TL |
762 | }; |
763 | ||
734d2258 TL |
764 | struct permit { |
765 | struct permit *next; | |
766 | enum { | |
767 | permit_unknown_clients, | |
768 | permit_known_clients, | |
769 | permit_authenticated_clients, | |
770 | permit_unauthenticated_clients, | |
771 | permit_all_clients, | |
772 | permit_dynamic_bootp_clients, | |
b1d3778c DH |
773 | permit_class, |
774 | permit_after | |
734d2258 TL |
775 | } type; |
776 | struct class *class; | |
b1d3778c | 777 | TIME after; /* date after which this clause applies */ |
734d2258 TL |
778 | }; |
779 | ||
780 | struct pool { | |
4fe74d72 | 781 | OMAPI_OBJECT_PREAMBLE; |
734d2258 | 782 | struct pool *next; |
74f45f96 | 783 | struct group *group; |
734d2258 TL |
784 | struct shared_network *shared_network; |
785 | struct permit *permit_list; | |
786 | struct permit *prohibit_list; | |
007e3ee4 TL |
787 | struct lease *active; |
788 | struct lease *expired; | |
789 | struct lease *free; | |
790 | struct lease *backup; | |
791 | struct lease *abandoned; | |
a55ccdd0 | 792 | struct lease *reserved; |
007e3ee4 | 793 | TIME next_event_time; |
5b7f941d | 794 | int lease_count; |
007e3ee4 TL |
795 | int free_leases; |
796 | int backup_leases; | |
d758ad8c | 797 | int index; |
b1d3778c DH |
798 | TIME valid_from; /* deny pool use before this date */ |
799 | TIME valid_until; /* deny pool use after this date */ | |
800 | ||
7ea8b207 | 801 | #if defined (FAILOVER_PROTOCOL) |
5b7f941d TL |
802 | dhcp_failover_state_t *failover_peer; |
803 | #endif | |
d1f2c520 | 804 | }; |
d1f2c520 | 805 | |
c626ae69 | 806 | struct shared_network { |
4fe74d72 | 807 | OMAPI_OBJECT_PREAMBLE; |
c626ae69 | 808 | struct shared_network *next; |
20916cae | 809 | char *name; |
7d6180be DH |
810 | |
811 | #define SHARED_IMPLICIT 1 /* This network was synthesized. */ | |
812 | int flags; | |
813 | ||
c626ae69 TL |
814 | struct subnet *subnets; |
815 | struct interface_info *interface; | |
734d2258 | 816 | struct pool *pools; |
98bd7ca0 DH |
817 | struct ipv6_pool **ipv6_pools; /* NULL-terminated array */ |
818 | int last_ipv6_pool; /* offset of last IPv6 pool | |
819 | used to issue a lease */ | |
5b7f941d | 820 | struct group *group; |
d1f2c520 | 821 | #if defined (FAILOVER_PROTOCOL) |
5b7f941d | 822 | dhcp_failover_state_t *failover_peer; |
d1f2c520 | 823 | #endif |
d7837182 TL |
824 | }; |
825 | ||
826 | struct subnet { | |
4fe74d72 | 827 | OMAPI_OBJECT_PREAMBLE; |
c626ae69 TL |
828 | struct subnet *next_subnet; |
829 | struct subnet *next_sibling; | |
830 | struct shared_network *shared_network; | |
831 | struct interface_info *interface; | |
832 | struct iaddr interface_address; | |
089fb364 TL |
833 | struct iaddr net; |
834 | struct iaddr netmask; | |
98bd7ca0 | 835 | int prefix_len; /* XXX: currently for IPv6 only */ |
ab370123 | 836 | struct group *group; |
d7837182 TL |
837 | }; |
838 | ||
102ee7e9 TL |
839 | struct collection { |
840 | struct collection *next; | |
841 | ||
b1b7b521 | 842 | const char *name; |
102ee7e9 TL |
843 | struct class *classes; |
844 | }; | |
845 | ||
06e77c34 DH |
846 | /* Used as an argument to parse_clasS_decl() */ |
847 | #define CLASS_TYPE_VENDOR 0 | |
848 | #define CLASS_TYPE_USER 1 | |
849 | #define CLASS_TYPE_CLASS 2 | |
850 | #define CLASS_TYPE_SUBCLASS 3 | |
851 | ||
112a6c2c | 852 | /* XXX classes must be reference-counted. */ |
102ee7e9 | 853 | struct class { |
4fe74d72 | 854 | OMAPI_OBJECT_PREAMBLE; |
a609e69b | 855 | struct class *nic; /* Next in collection. */ |
112a6c2c | 856 | struct class *superclass; /* Set for spawned classes only. */ |
a609e69b | 857 | char *name; /* Not set for spawned classes. */ |
734d2258 TL |
858 | |
859 | /* A class may be configured to permit a limited number of leases. */ | |
860 | int lease_limit; | |
112a6c2c TL |
861 | int leases_consumed; |
862 | struct lease **billed_leases; | |
863 | ||
864 | /* If nonzero, class has not been saved since it was last | |
865 | modified. */ | |
866 | int dirty; | |
ab370123 | 867 | |
112a6c2c | 868 | /* Hash table containing subclasses. */ |
98311e4b | 869 | class_hash_t *hash; |
112a6c2c TL |
870 | struct data_string hash_string; |
871 | ||
872 | /* Expression used to match class. */ | |
2b9b6ff7 | 873 | struct expression *expr; |
112a6c2c TL |
874 | |
875 | /* Expression used to compute subclass identifiers for spawning | |
58bfaaa7 TL |
876 | and to do subclass matching. */ |
877 | struct expression *submatch; | |
878 | int spawning; | |
102ee7e9 | 879 | |
ab370123 | 880 | struct group *group; |
2b9b6ff7 TL |
881 | |
882 | /* Statements to execute if class matches. */ | |
883 | struct executable_statement *statements; | |
899d754f JB |
884 | |
885 | #define CLASS_DECL_DELETED 1 | |
886 | #define CLASS_DECL_DYNAMIC 2 | |
887 | #define CLASS_DECL_STATIC 4 | |
888 | #define CLASS_DECL_SUBCLASS 8 | |
889 | ||
890 | int flags; | |
709f15cc TL |
891 | }; |
892 | ||
cc26de46 TL |
893 | /* DHCP client lease structure... */ |
894 | struct client_lease { | |
41fb155b TL |
895 | struct client_lease *next; /* Next lease in list. */ |
896 | TIME expiry, renewal, rebind; /* Lease timeouts. */ | |
897 | struct iaddr address; /* Address being leased. */ | |
898 | char *server_name; /* Name of boot server. */ | |
899 | char *filename; /* Name of file we're supposed to boot. */ | |
6b3b97e1 | 900 | struct string_list *medium; /* Network medium. */ |
49146f3c | 901 | struct auth_key *key; /* Key used in basic DHCP authentication. */ |
cc26de46 | 902 | |
0c7802b1 | 903 | unsigned int is_static : 1; /* If set, lease is from config file. */ |
98311e4b | 904 | unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */ |
41fb155b | 905 | |
4f58da18 | 906 | struct option_state *options; /* Options supplied with lease. */ |
cc26de46 TL |
907 | }; |
908 | ||
98bd7ca0 DH |
909 | /* DHCPv6 lease structures */ |
910 | struct dhc6_addr { | |
911 | struct dhc6_addr *next; | |
912 | struct iaddr address; | |
1d9774ab | 913 | u_int8_t plen; |
98bd7ca0 DH |
914 | |
915 | /* Address state flags. */ | |
916 | #define DHC6_ADDR_DEPREFFED 0x01 | |
917 | #define DHC6_ADDR_EXPIRED 0x02 | |
918 | u_int8_t flags; | |
919 | ||
920 | TIME starts; | |
921 | u_int32_t preferred_life; | |
922 | u_int32_t max_life; | |
923 | ||
924 | struct option_state *options; | |
925 | }; | |
926 | ||
927 | struct dhc6_ia { | |
928 | struct dhc6_ia *next; | |
929 | unsigned char iaid[4]; | |
1d9774ab | 930 | u_int16_t ia_type; |
98bd7ca0 DH |
931 | |
932 | TIME starts; | |
933 | u_int32_t renew; | |
934 | u_int32_t rebind; | |
935 | struct dhc6_addr *addrs; | |
936 | ||
937 | struct option_state *options; | |
938 | }; | |
939 | ||
940 | struct dhc6_lease { | |
941 | struct dhc6_lease *next; | |
942 | struct data_string server_id; | |
943 | ||
cabdb9b1 | 944 | isc_boolean_t released; |
98bd7ca0 DH |
945 | int score; |
946 | u_int8_t pref; | |
947 | ||
948 | unsigned char dhcpv6_transaction_id[3]; | |
949 | struct dhc6_ia *bindings; | |
950 | ||
951 | struct option_state *options; | |
952 | }; | |
953 | ||
41fb155b | 954 | /* Possible states in which the client can be. */ |
cc26de46 | 955 | enum dhcp_state { |
159bcce3 TL |
956 | S_REBOOTING = 1, |
957 | S_INIT = 2, | |
958 | S_SELECTING = 3, | |
959 | S_REQUESTING = 4, | |
960 | S_BOUND = 5, | |
961 | S_RENEWING = 6, | |
c1f22aef TL |
962 | S_REBINDING = 7, |
963 | S_STOPPED = 8 | |
cc26de46 TL |
964 | }; |
965 | ||
08512bce TL |
966 | /* Authentication and BOOTP policy possibilities (not all values work |
967 | for each). */ | |
968 | enum policy { P_IGNORE, P_ACCEPT, P_PREFER, P_REQUIRE, P_DONT }; | |
969 | ||
cc26de46 TL |
970 | /* Configuration information from the config file... */ |
971 | struct client_config { | |
27fe61a7 TL |
972 | /* |
973 | * When a message has been received, run these statements | |
974 | * over it. | |
975 | */ | |
112a6c2c | 976 | struct group *on_receipt; |
27fe61a7 TL |
977 | |
978 | /* | |
979 | * When a message is sent, run these statements. | |
980 | */ | |
112a6c2c | 981 | struct group *on_transmission; |
27fe61a7 | 982 | |
0c20eab3 DH |
983 | struct option **required_options; /* Options that MUST be present. */ |
984 | struct option **requested_options; /* Options to request (ORO/PRL). */ | |
27fe61a7 | 985 | |
cc26de46 TL |
986 | TIME timeout; /* Start to panic if we don't get a |
987 | lease in this time period when | |
988 | SELECTING. */ | |
83c1b012 TL |
989 | TIME initial_interval; /* All exponential backoff intervals |
990 | start here. */ | |
cc26de46 TL |
991 | TIME retry_interval; /* If the protocol failed to produce |
992 | an address before the timeout, | |
993 | try the protocol again after this | |
994 | many seconds. */ | |
995 | TIME select_interval; /* Wait this many seconds from the | |
996 | first DHCPDISCOVER before | |
997 | picking an offered lease. */ | |
fc2df23a TL |
998 | TIME reboot_timeout; /* When in INIT-REBOOT, wait this |
999 | long before giving up and going | |
1000 | to INIT. */ | |
83c1b012 TL |
1001 | TIME backoff_cutoff; /* When doing exponential backoff, |
1002 | never back off to an interval | |
1003 | longer than this amount. */ | |
27fe61a7 TL |
1004 | u_int32_t requested_lease; /* Requested lease time, if user |
1005 | doesn't configure one. */ | |
6b3b97e1 | 1006 | struct string_list *media; /* Possible network media values. */ |
32a47563 | 1007 | char *script_name; /* Name of config script. */ |
432604c3 | 1008 | char *vendor_space_name; /* Name of config script. */ |
08512bce | 1009 | enum policy bootp_policy; |
cc26de46 TL |
1010 | /* Ignore, accept or prefer BOOTP |
1011 | responses. */ | |
08512bce TL |
1012 | enum policy auth_policy; |
1013 | /* Require authentication, prefer | |
1014 | authentication, or don't try to | |
1015 | authenticate. */ | |
6b3b97e1 | 1016 | struct string_list *medium; /* Current network medium. */ |
0c7802b1 | 1017 | |
febbd402 | 1018 | struct iaddrmatchlist *reject_list; /* Servers to reject. */ |
27fe61a7 | 1019 | |
626ca6a2 TL |
1020 | int omapi_port; /* port on which to accept OMAPI |
1021 | connections, or -1 for no | |
1022 | listener. */ | |
98311e4b DH |
1023 | int do_forward_update; /* If nonzero, and if we have the |
1024 | information we need, update the | |
1025 | A record for the address we get. */ | |
cc26de46 TL |
1026 | }; |
1027 | ||
1028 | /* Per-interface state used in the dhcp client... */ | |
98bd7ca0 | 1029 | /* XXX: consider union {}'ing this for v4/v6. */ |
cc26de46 | 1030 | struct client_state { |
734d2258 TL |
1031 | struct client_state *next; |
1032 | struct interface_info *interface; | |
1033 | char *name; | |
1034 | ||
98bd7ca0 DH |
1035 | /* Common values. */ |
1036 | struct client_config *config; /* Client configuration. */ | |
1037 | struct string_list *env; /* Client script environment. */ | |
1038 | int envc; /* Number of entries in environment. */ | |
1039 | struct option_state *sent_options; /* Options we sent. */ | |
1040 | enum dhcp_state state; /* Current state for this interface. */ | |
1041 | ||
1042 | ||
1043 | /* DHCPv4 values. */ | |
cc26de46 TL |
1044 | struct client_lease *active; /* Currently active lease. */ |
1045 | struct client_lease *new; /* New lease. */ | |
1046 | struct client_lease *offered_leases; /* Leases offered to us. */ | |
1047 | struct client_lease *leases; /* Leases we currently hold. */ | |
f79e49f3 | 1048 | struct client_lease *alias; /* Alias lease. */ |
cc26de46 | 1049 | |
cc26de46 TL |
1050 | struct iaddr destination; /* Where to send packet. */ |
1051 | u_int32_t xid; /* Transaction ID. */ | |
64826b61 | 1052 | u_int16_t secs; /* secs value from DHCPDISCOVER. */ |
cc26de46 | 1053 | TIME first_sending; /* When was first copy sent? */ |
6b3b97e1 TL |
1054 | TIME interval; /* What's the current resend interval? */ |
1055 | struct string_list *medium; /* Last media type tried. */ | |
cc26de46 | 1056 | struct dhcp_packet packet; /* Outgoing DHCP packet. */ |
b1b7b521 | 1057 | unsigned packet_length; /* Actual length of generated packet. */ |
cc26de46 | 1058 | |
41fb155b TL |
1059 | struct iaddr requested_address; /* Address we would like to get. */ |
1060 | ||
98bd7ca0 DH |
1061 | /* DHCPv6 values. */ |
1062 | unsigned char dhcpv6_transaction_id[3]; | |
1063 | u_int8_t refresh_type; | |
1064 | ||
1065 | struct dhc6_lease *active_lease; | |
1066 | struct dhc6_lease *old_lease; | |
1067 | struct dhc6_lease *advertised_leases; | |
1068 | struct dhc6_lease *selected_lease; | |
1069 | struct dhc6_lease *held_leases; | |
1070 | ||
be62cf06 | 1071 | struct timeval start_time; |
98bd7ca0 DH |
1072 | u_int16_t elapsed; |
1073 | int txcount; | |
1074 | ||
1075 | /* See RFC3315 section 14. */ | |
be62cf06 FD |
1076 | TIME RT; /* In hundredths of seconds. */ |
1077 | TIME IRT; /* In hundredths of seconds. */ | |
1078 | TIME MRC; /* Count. */ | |
1079 | TIME MRT; /* In hundredths of seconds. */ | |
1080 | TIME MRD; /* In seconds, relative. */ | |
1081 | TIME next_MRD; /* In seconds, absolute. */ | |
98bd7ca0 DH |
1082 | |
1083 | /* Rather than a state, we use a function that shifts around | |
1084 | * depending what stage of life the v6 state machine is in. | |
1085 | * This is where incoming packets are dispatched to (sometimes | |
1086 | * a no-op). | |
1087 | */ | |
1088 | void (*v6_handler)(struct packet *, struct client_state *); | |
1089 | }; | |
d758ad8c | 1090 | |
98bd7ca0 DH |
1091 | struct envadd_state { |
1092 | struct client_state *client; | |
1093 | const char *prefix; | |
1094 | }; | |
1095 | ||
1096 | struct dns_update_state { | |
1097 | struct client_state *client; | |
1098 | struct iaddr address; | |
1099 | int dns_update_timeout; | |
cc26de46 TL |
1100 | }; |
1101 | ||
17b95f41 TL |
1102 | /* Information about each network interface. */ |
1103 | ||
1104 | struct interface_info { | |
4fe74d72 | 1105 | OMAPI_OBJECT_PREAMBLE; |
17b95f41 | 1106 | struct interface_info *next; /* Next interface in list... */ |
c626ae69 TL |
1107 | struct shared_network *shared_network; |
1108 | /* Networks connected to this interface. */ | |
17b95f41 | 1109 | struct hardware hw_address; /* Its physical address. */ |
98bd7ca0 DH |
1110 | struct in_addr *addresses; /* Addresses associated with this |
1111 | * interface. | |
1112 | */ | |
1113 | int address_count; /* Number of addresses stored. */ | |
1114 | int address_max; /* Size of addresses buffer. */ | |
1115 | struct in6_addr *v6addresses; /* IPv6 addresses associated with | |
1116 | this interface. */ | |
1117 | int v6address_count; /* Number of IPv6 addresses associated | |
1118 | with this interface. */ | |
1119 | int v6address_max; /* Maximum number of IPv6 addresses | |
1120 | we can store in current buffer. */ | |
c4763f5f TL |
1121 | |
1122 | u_int8_t *circuit_id; /* Circuit ID associated with this | |
1123 | interface. */ | |
b1b7b521 | 1124 | unsigned circuit_id_len; /* Length of Circuit ID, if there |
c4763f5f TL |
1125 | is one. */ |
1126 | u_int8_t *remote_id; /* Remote ID associated with this | |
1127 | interface (if any). */ | |
b1b7b521 | 1128 | unsigned remote_id_len; /* Length of Remote ID. */ |
c4763f5f | 1129 | |
17b95f41 | 1130 | char name [IFNAMSIZ]; /* Its name... */ |
ecddae64 | 1131 | int index; /* Its if_nametoindex(). */ |
17b95f41 TL |
1132 | int rfdesc; /* Its read file descriptor. */ |
1133 | int wfdesc; /* Its write file descriptor, if | |
1134 | different. */ | |
1135 | unsigned char *rbuf; /* Read buffer, if required. */ | |
98311e4b | 1136 | unsigned int rbuf_max; /* Size of read buffer. */ |
17b95f41 TL |
1137 | size_t rbuf_offset; /* Current offset into buffer. */ |
1138 | size_t rbuf_len; /* Length of data in buffer. */ | |
c626ae69 | 1139 | |
41fb155b | 1140 | struct ifreq *ifp; /* Pointer to ifreq struct. */ |
98bd7ca0 DH |
1141 | int configured; /* If set to 1, interface has at least |
1142 | * one valid IP address. | |
1143 | */ | |
7f91dcfb TL |
1144 | u_int32_t flags; /* Control flags... */ |
1145 | #define INTERFACE_REQUESTED 1 | |
5a526cf8 | 1146 | #define INTERFACE_AUTOMATIC 2 |
347de8bd | 1147 | #define INTERFACE_RUNNING 4 |
7de20a95 EH |
1148 | #define INTERFACE_DOWNSTREAM 8 |
1149 | #define INTERFACE_UPSTREAM 16 | |
1150 | #define INTERFACE_STREAMS (INTERFACE_DOWNSTREAM | INTERFACE_UPSTREAM) | |
cc26de46 TL |
1151 | |
1152 | /* Only used by DHCP client code. */ | |
1153 | struct client_state *client; | |
3d2aa1bf BC |
1154 | # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) |
1155 | int dlpi_sap_length; | |
1156 | struct hardware dlpi_broadcast_addr; | |
1157 | # endif /* DLPI_SEND || DLPI_RECEIVE */ | |
17b95f41 TL |
1158 | }; |
1159 | ||
1160 | struct hardware_link { | |
1161 | struct hardware_link *next; | |
1162 | char name [IFNAMSIZ]; | |
1163 | struct hardware address; | |
1164 | }; | |
1165 | ||
6368a1bd DH |
1166 | struct leasequeue { |
1167 | struct leasequeue *prev; | |
1168 | struct leasequeue *next; | |
1169 | struct lease *lease; | |
1170 | }; | |
1171 | ||
76d5bd36 TL |
1172 | typedef void (*tvref_t)(void *, void *, const char *, int); |
1173 | typedef void (*tvunref_t)(void *, const char *, int); | |
cc26de46 TL |
1174 | struct timeout { |
1175 | struct timeout *next; | |
be62cf06 | 1176 | struct timeval when; |
6e5ed8bf TL |
1177 | void (*func) PROTO ((void *)); |
1178 | void *what; | |
76d5bd36 TL |
1179 | tvref_t ref; |
1180 | tvunref_t unref; | |
6e5ed8bf TL |
1181 | }; |
1182 | ||
6368a1bd DH |
1183 | struct eventqueue { |
1184 | struct eventqueue *next; | |
1185 | void (*handler)(void *); | |
1186 | }; | |
1187 | ||
6e5ed8bf TL |
1188 | struct protocol { |
1189 | struct protocol *next; | |
1190 | int fd; | |
1191 | void (*handler) PROTO ((struct protocol *)); | |
1192 | void *local; | |
cc26de46 TL |
1193 | }; |
1194 | ||
94f08824 TL |
1195 | struct dns_query; /* forward */ |
1196 | ||
1197 | struct dns_wakeup { | |
1198 | struct dns_wakeup *next; /* Next wakeup in chain. */ | |
1199 | void (*func) PROTO ((struct dns_query *)); | |
1200 | }; | |
1201 | ||
5142937c TL |
1202 | struct dns_question { |
1203 | u_int16_t type; /* Type of query. */ | |
1204 | u_int16_t class; /* Class of query. */ | |
1205 | unsigned char data [1]; /* Query data. */ | |
1206 | }; | |
1207 | ||
1208 | struct dns_answer { | |
1209 | u_int16_t type; /* Type of answer. */ | |
1210 | u_int16_t class; /* Class of answer. */ | |
1211 | int count; /* Number of answers. */ | |
1212 | unsigned char *answers[1]; /* Pointers to answers. */ | |
1213 | }; | |
1214 | ||
94f08824 TL |
1215 | struct dns_query { |
1216 | struct dns_query *next; /* Next query in hash bucket. */ | |
5142937c | 1217 | u_int32_t hash; /* Hash bucket index. */ |
94f08824 TL |
1218 | TIME expiry; /* Query expiry time (zero if not yet |
1219 | answered. */ | |
1220 | u_int16_t id; /* Query ID (also hash table index) */ | |
1221 | caddr_t waiters; /* Pointer to list of things waiting | |
1222 | on this query. */ | |
5142937c TL |
1223 | |
1224 | struct dns_question *question; /* Question, internal format. */ | |
1225 | struct dns_answer *answer; /* Answer, internal format. */ | |
1226 | ||
1227 | unsigned char *query; /* Query formatted for DNS server. */ | |
b1b7b521 | 1228 | unsigned len; /* Length of entire query. */ |
94f08824 TL |
1229 | int sent; /* The query has been sent. */ |
1230 | struct dns_wakeup *wakeups; /* Wakeups to call if this query is | |
1231 | answered. */ | |
1232 | struct name_server *next_server; /* Next server to try. */ | |
1233 | int backoff; /* Current backoff, in seconds. */ | |
1234 | }; | |
1235 | ||
3f09cb5a TL |
1236 | struct dns_zone { |
1237 | int refcnt; | |
1238 | TIME timeout; | |
1239 | char *name; | |
1240 | struct option_cache *primary; | |
1241 | struct option_cache *secondary; | |
49146f3c | 1242 | struct auth_key *key; |
3f09cb5a TL |
1243 | }; |
1244 | ||
d758ad8c TL |
1245 | struct icmp_state { |
1246 | OMAPI_OBJECT_PREAMBLE; | |
1247 | int socket; | |
1248 | void (*icmp_handler) PROTO ((struct iaddr, u_int8_t *, int)); | |
1249 | }; | |
1250 | ||
f3aad410 TL |
1251 | #include "ctrace.h" |
1252 | ||
d7837182 TL |
1253 | /* Bitmask of dhcp option codes. */ |
1254 | typedef unsigned char option_mask [16]; | |
1255 | ||
1256 | /* DHCP Option mask manipulation macros... */ | |
1257 | #define OPTION_ZERO(mask) (memset (mask, 0, 16)) | |
1258 | #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7))) | |
1259 | #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7))) | |
1260 | #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7))) | |
1261 | #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit)) | |
1262 | ||
1263 | /* An option occupies its length plus two header bytes (code and | |
1264 | length) for every 255 bytes that must be stored. */ | |
1265 | #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1)) | |
1266 | ||
1267 | /* Default path to dhcpd config file. */ | |
d7837182 | 1268 | #ifdef DEBUG |
80ba033e | 1269 | #undef _PATH_DHCPD_CONF |
d7837182 | 1270 | #define _PATH_DHCPD_CONF "dhcpd.conf" |
80ba033e | 1271 | #undef _PATH_DHCPD_DB |
1358b874 | 1272 | #define _PATH_DHCPD_DB "dhcpd.leases" |
75135a3f EH |
1273 | #undef _PATH_DHCPD6_DB |
1274 | #define _PATH_DHCPD6_DB "dhcpd6.leases" | |
98311e4b DH |
1275 | #undef _PATH_DHCPD_PID |
1276 | #define _PATH_DHCPD_PID "dhcpd.pid" | |
75135a3f EH |
1277 | #undef _PATH_DHCPD6_PID |
1278 | #define _PATH_DHCPD6_PID "dhcpd6.pid" | |
fe5b0fdd | 1279 | #else /* !DEBUG */ |
75135a3f | 1280 | |
a8b53b42 | 1281 | #ifndef _PATH_DHCPD_CONF |
d7837182 | 1282 | #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" |
fe5b0fdd | 1283 | #endif /* DEBUG */ |
a8b53b42 TL |
1284 | |
1285 | #ifndef _PATH_DHCPD_DB | |
fe5b0fdd | 1286 | #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases" |
d7837182 | 1287 | #endif |
a8b53b42 | 1288 | |
75135a3f EH |
1289 | #ifndef _PATH_DHCPD6_DB |
1290 | #define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases" | |
1291 | #endif | |
1292 | ||
a8b53b42 | 1293 | #ifndef _PATH_DHCPD_PID |
fe5b0fdd | 1294 | #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid" |
a8b53b42 | 1295 | #endif |
75135a3f EH |
1296 | |
1297 | #ifndef _PATH_DHCPD6_PID | |
1298 | #define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid" | |
d7837182 TL |
1299 | #endif |
1300 | ||
75135a3f EH |
1301 | #endif /* DEBUG */ |
1302 | ||
cc26de46 TL |
1303 | #ifndef _PATH_DHCLIENT_CONF |
1304 | #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" | |
1305 | #endif | |
1306 | ||
e47988bf TL |
1307 | #ifndef _PATH_DHCLIENT_SCRIPT |
1308 | #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script" | |
1309 | #endif | |
1310 | ||
cc26de46 | 1311 | #ifndef _PATH_DHCLIENT_PID |
fe5b0fdd | 1312 | #define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid" |
cc26de46 TL |
1313 | #endif |
1314 | ||
98bd7ca0 | 1315 | #ifndef _PATH_DHCLIENT6_PID |
fe5b0fdd | 1316 | #define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid" |
98bd7ca0 DH |
1317 | #endif |
1318 | ||
cc26de46 | 1319 | #ifndef _PATH_DHCLIENT_DB |
fe5b0fdd | 1320 | #define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases" |
cc26de46 TL |
1321 | #endif |
1322 | ||
98bd7ca0 | 1323 | #ifndef _PATH_DHCLIENT6_DB |
fe5b0fdd | 1324 | #define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases" |
98bd7ca0 DH |
1325 | #endif |
1326 | ||
0c7802b1 TL |
1327 | #ifndef _PATH_RESOLV_CONF |
1328 | #define _PATH_RESOLV_CONF "/etc/resolv.conf" | |
1329 | #endif | |
cc26de46 | 1330 | |
8afb9ae0 | 1331 | #ifndef _PATH_DHCRELAY_PID |
fe5b0fdd | 1332 | #define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid" |
8afb9ae0 TL |
1333 | #endif |
1334 | ||
7de20a95 EH |
1335 | #ifndef _PATH_DHCRELAY6_PID |
1336 | #define _PATH_DHCRELAY6_PID LOCALSTATEDIR"/run/dhcrelay6.pid" | |
1337 | #endif | |
1338 | ||
ab370123 TL |
1339 | #ifndef DHCPD_LOG_FACILITY |
1340 | #define DHCPD_LOG_FACILITY LOG_DAEMON | |
1341 | #endif | |
1342 | ||
d7837182 TL |
1343 | #define MAX_TIME 0x7fffffff |
1344 | #define MIN_TIME 0 | |
1345 | ||
d9b43370 | 1346 | /* these are referenced */ |
9322442f | 1347 | typedef struct hash_table ia_hash_t; |
1d17db44 | 1348 | typedef struct hash_table iasubopt_hash_t; |
98bd7ca0 | 1349 | |
1d17db44 | 1350 | /* IAADDR/IAPREFIX lease */ |
9322442f | 1351 | |
1d17db44 | 1352 | struct iasubopt { |
98bd7ca0 | 1353 | int refcnt; /* reference count */ |
9322442f FD |
1354 | struct in6_addr addr; /* IPv6 address/prefix */ |
1355 | u_int8_t plen; /* iaprefix prefix length */ | |
98bd7ca0 DH |
1356 | binding_state_t state; /* state */ |
1357 | struct binding_scope *scope; /* "set var = value;" */ | |
5d89d60f FD |
1358 | time_t hard_lifetime_end_time; /* time address expires */ |
1359 | time_t soft_lifetime_end_time; /* time ephemeral expires */ | |
1acab09f FD |
1360 | u_int32_t prefer; /* cached preferred lifetime */ |
1361 | u_int32_t valid; /* cached valid lifetime */ | |
9322442f FD |
1362 | struct ia_xx *ia; /* IA for this lease */ |
1363 | struct ipv6_pool *ipv6_pool; /* pool for this lease */ | |
d9b43370 | 1364 | /* |
5d89d60f | 1365 | * For now, just pick an arbitrary time to keep old hard leases |
d9b43370 SK |
1366 | * around (value in seconds). |
1367 | */ | |
1368 | #define EXPIRED_IPV6_CLEANUP_TIME (60*60) | |
1369 | ||
98bd7ca0 DH |
1370 | int heap_index; /* index into heap, or -1 |
1371 | (internal use only) */ | |
1372 | }; | |
1373 | ||
9322442f | 1374 | struct ia_xx { |
98bd7ca0 DH |
1375 | int refcnt; /* reference count */ |
1376 | struct data_string iaid_duid; /* from the client */ | |
9322442f | 1377 | u_int16_t ia_type; /* IA_XX */ |
1d17db44 FD |
1378 | int num_iasubopt; /* number of IAADDR/PREFIX */ |
1379 | int max_iasubopt; /* space available for IAADDR/PREFIX */ | |
1acab09f | 1380 | time_t cltt; /* client last transaction time */ |
1d17db44 | 1381 | struct iasubopt **iasubopt; /* pointers to the IAADDR/IAPREFIXs */ |
98bd7ca0 DH |
1382 | }; |
1383 | ||
9322442f FD |
1384 | extern ia_hash_t *ia_na_active; |
1385 | extern ia_hash_t *ia_ta_active; | |
1386 | extern ia_hash_t *ia_pd_active; | |
98bd7ca0 DH |
1387 | |
1388 | struct ipv6_pool { | |
1389 | int refcnt; /* reference count */ | |
9322442f | 1390 | u_int16_t pool_type; /* IA_xx */ |
98bd7ca0 DH |
1391 | struct in6_addr start_addr; /* first IPv6 address */ |
1392 | int bits; /* number of bits, CIDR style */ | |
9322442f | 1393 | int units; /* allocation unit in bits */ |
1d17db44 FD |
1394 | iasubopt_hash_t *leases; /* non-free leases */ |
1395 | int num_active; /* count of active leases */ | |
98bd7ca0 | 1396 | isc_heap_t *active_timeouts; /* timeouts for active leases */ |
1d17db44 | 1397 | int num_inactive; /* count of inactive leases */ |
98bd7ca0 DH |
1398 | isc_heap_t *inactive_timeouts; /* timeouts for expired or |
1399 | released leases */ | |
1400 | struct shared_network *shared_network; /* shared_network for | |
1401 | this pool */ | |
7d6180be | 1402 | struct subnet *subnet; /* subnet for this pool */ |
98bd7ca0 DH |
1403 | }; |
1404 | ||
1405 | extern struct ipv6_pool **pools; | |
1406 | extern int num_pools; | |
1407 | ||
d7837182 TL |
1408 | /* External definitions... */ |
1409 | ||
98311e4b DH |
1410 | HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t) |
1411 | HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t) | |
f7fdb216 DH |
1412 | HASH_FUNCTIONS_DECL (option_name, const char *, struct option, |
1413 | option_name_hash_t) | |
1414 | HASH_FUNCTIONS_DECL (option_code, const unsigned *, struct option, | |
1415 | option_code_hash_t) | |
98311e4b | 1416 | HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t) |
6708d944 DH |
1417 | HASH_FUNCTIONS_DECL(lease_ip, const unsigned char *, struct lease, |
1418 | lease_ip_hash_t) | |
1419 | HASH_FUNCTIONS_DECL(lease_id, const unsigned char *, struct lease, | |
1420 | lease_id_hash_t) | |
98311e4b DH |
1421 | HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t) |
1422 | HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t) | |
1423 | ||
d7837182 TL |
1424 | /* options.c */ |
1425 | ||
432604c3 | 1426 | extern struct option *vendor_cfg_option; |
27fe61a7 | 1427 | int parse_options PROTO ((struct packet *)); |
6f56b7e2 TL |
1428 | int parse_option_buffer PROTO ((struct option_state *, const unsigned char *, |
1429 | unsigned, struct universe *)); | |
1430 | struct universe *find_option_universe (struct option *, const char *); | |
432604c3 | 1431 | int parse_encapsulated_suboptions (struct option_state *, struct option *, |
6f56b7e2 TL |
1432 | const unsigned char *, unsigned, |
1433 | struct universe *, const char *); | |
da38df14 | 1434 | int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *, |
159bcce3 | 1435 | struct client_state *, |
f3e8ea32 | 1436 | int, struct option_state *, struct option_state *, |
6ceb9118 | 1437 | struct binding_scope **, |
432604c3 TL |
1438 | int, int, int, struct data_string *, const char *)); |
1439 | int fqdn_universe_decode (struct option_state *, | |
6f56b7e2 | 1440 | const unsigned char *, unsigned, struct universe *); |
98bd7ca0 DH |
1441 | struct option_cache * |
1442 | lookup_fqdn6_option(struct universe *universe, struct option_state *options, | |
1443 | unsigned code); | |
1444 | void | |
1445 | save_fqdn6_option(struct universe *universe, struct option_state *options, | |
bead14ea | 1446 | struct option_cache *oc, isc_boolean_t appendp); |
98bd7ca0 DH |
1447 | void |
1448 | delete_fqdn6_option(struct universe *universe, struct option_state *options, | |
1449 | int code); | |
1450 | void | |
1451 | fqdn6_option_space_foreach(struct packet *packet, struct lease *lease, | |
1452 | struct client_state *client_state, | |
1453 | struct option_state *in_options, | |
1454 | struct option_state *cfg_options, | |
1455 | struct binding_scope **scope, | |
1456 | struct universe *u, void *stuff, | |
1457 | void (*func)(struct option_cache *, | |
1458 | struct packet *, | |
1459 | struct lease *, | |
1460 | struct client_state *, | |
1461 | struct option_state *, | |
1462 | struct option_state *, | |
1463 | struct binding_scope **, | |
1464 | struct universe *, void *)); | |
1465 | int | |
1466 | fqdn6_option_space_encapsulate(struct data_string *result, | |
1467 | struct packet *packet, struct lease *lease, | |
1468 | struct client_state *client_state, | |
1469 | struct option_state *in_options, | |
1470 | struct option_state *cfg_options, | |
1471 | struct binding_scope **scope, | |
1472 | struct universe *universe); | |
1473 | int | |
1474 | fqdn6_universe_decode(struct option_state *options, | |
1475 | const unsigned char *buffer, unsigned length, | |
1476 | struct universe *u); | |
1477 | int append_option(struct data_string *dst, struct universe *universe, | |
1478 | struct option *option, struct data_string *src); | |
e2624b82 EH |
1479 | int |
1480 | store_options(int *ocount, | |
1481 | unsigned char *buffer, unsigned buflen, unsigned index, | |
1482 | struct packet *packet, struct lease *lease, | |
1483 | struct client_state *client_state, | |
1484 | struct option_state *in_options, | |
1485 | struct option_state *cfg_options, | |
1486 | struct binding_scope **scope, | |
1487 | unsigned *priority_list, int priority_len, | |
1488 | unsigned first_cutoff, int second_cutoff, int terminate, | |
1489 | const char *vuname); | |
98bd7ca0 DH |
1490 | int store_options6(char *, int, struct option_state *, struct packet *, |
1491 | const int *, struct data_string *); | |
88cd8aca DH |
1492 | int format_has_text(const char *); |
1493 | int format_min_length(const char *, struct option_cache *); | |
6f56b7e2 | 1494 | const char *pretty_print_option PROTO ((struct option *, const unsigned char *, |
b1b7b521 | 1495 | unsigned, int, int)); |
b543fea9 DH |
1496 | int pretty_escape(char **, char *, const unsigned char **, |
1497 | const unsigned char *); | |
432604c3 | 1498 | int get_option (struct data_string *, struct universe *, |
159bcce3 | 1499 | struct packet *, struct lease *, struct client_state *, |
432604c3 | 1500 | struct option_state *, struct option_state *, |
d758ad8c TL |
1501 | struct option_state *, struct binding_scope **, unsigned, |
1502 | const char *, int); | |
432604c3 TL |
1503 | void set_option (struct universe *, struct option_state *, |
1504 | struct option_cache *, enum statement_op); | |
4f58da18 | 1505 | struct option_cache *lookup_option PROTO ((struct universe *, |
b1b7b521 | 1506 | struct option_state *, unsigned)); |
4f58da18 | 1507 | struct option_cache *lookup_hashed_option PROTO ((struct universe *, |
b1b7b521 TL |
1508 | struct option_state *, |
1509 | unsigned)); | |
98bd7ca0 DH |
1510 | struct option_cache *next_hashed_option(struct universe *, |
1511 | struct option_state *, | |
1512 | struct option_cache *); | |
432604c3 TL |
1513 | int save_option_buffer (struct universe *, struct option_state *, |
1514 | struct buffer *, unsigned char *, unsigned, | |
f7fdb216 | 1515 | unsigned, int); |
bead14ea DH |
1516 | int append_option_buffer(struct universe *, struct option_state *, |
1517 | struct buffer *, unsigned char *, unsigned, | |
1518 | unsigned, int); | |
98bd7ca0 DH |
1519 | void build_server_oro(struct data_string *, struct option_state *, |
1520 | const char *, int); | |
bead14ea DH |
1521 | void save_option(struct universe *, struct option_state *, |
1522 | struct option_cache *); | |
1523 | void also_save_option(struct universe *, struct option_state *, | |
1524 | struct option_cache *); | |
1525 | void save_hashed_option(struct universe *, struct option_state *, | |
1526 | struct option_cache *, isc_boolean_t appendp); | |
4f58da18 TL |
1527 | void delete_option PROTO ((struct universe *, struct option_state *, int)); |
1528 | void delete_hashed_option PROTO ((struct universe *, | |
1529 | struct option_state *, int)); | |
4bd8800e TL |
1530 | int option_cache_dereference PROTO ((struct option_cache **, |
1531 | const char *, int)); | |
4f58da18 | 1532 | int hashed_option_state_dereference PROTO ((struct universe *, |
0dbb132f TL |
1533 | struct option_state *, |
1534 | const char *, int)); | |
4f58da18 | 1535 | int store_option PROTO ((struct data_string *, |
f3e8ea32 | 1536 | struct universe *, struct packet *, struct lease *, |
159bcce3 | 1537 | struct client_state *, |
f3e8ea32 | 1538 | struct option_state *, struct option_state *, |
6ceb9118 | 1539 | struct binding_scope **, struct option_cache *)); |
4f58da18 | 1540 | int option_space_encapsulate PROTO ((struct data_string *, |
f3e8ea32 | 1541 | struct packet *, struct lease *, |
159bcce3 | 1542 | struct client_state *, |
f3e8ea32 | 1543 | struct option_state *, |
4f58da18 | 1544 | struct option_state *, |
6ceb9118 | 1545 | struct binding_scope **, |
4f58da18 TL |
1546 | struct data_string *)); |
1547 | int hashed_option_space_encapsulate PROTO ((struct data_string *, | |
f3e8ea32 | 1548 | struct packet *, struct lease *, |
159bcce3 | 1549 | struct client_state *, |
f3e8ea32 | 1550 | struct option_state *, |
4f58da18 | 1551 | struct option_state *, |
6ceb9118 | 1552 | struct binding_scope **, |
4f58da18 | 1553 | struct universe *)); |
69bb758c TL |
1554 | int nwip_option_space_encapsulate PROTO ((struct data_string *, |
1555 | struct packet *, struct lease *, | |
159bcce3 | 1556 | struct client_state *, |
69bb758c TL |
1557 | struct option_state *, |
1558 | struct option_state *, | |
6ceb9118 | 1559 | struct binding_scope **, |
69bb758c | 1560 | struct universe *)); |
432604c3 TL |
1561 | int fqdn_option_space_encapsulate (struct data_string *, |
1562 | struct packet *, struct lease *, | |
159bcce3 | 1563 | struct client_state *, |
432604c3 TL |
1564 | struct option_state *, |
1565 | struct option_state *, | |
1566 | struct binding_scope **, | |
1567 | struct universe *); | |
159bcce3 TL |
1568 | void suboption_foreach (struct packet *, struct lease *, struct client_state *, |
1569 | struct option_state *, struct option_state *, | |
1570 | struct binding_scope **, struct universe *, void *, | |
1571 | void (*) (struct option_cache *, struct packet *, | |
1572 | struct lease *, struct client_state *, | |
1573 | struct option_state *, struct option_state *, | |
6f56b7e2 TL |
1574 | struct binding_scope **, |
1575 | struct universe *, void *), | |
1576 | struct option_cache *, const char *); | |
432604c3 | 1577 | void option_space_foreach (struct packet *, struct lease *, |
159bcce3 | 1578 | struct client_state *, |
432604c3 TL |
1579 | struct option_state *, |
1580 | struct option_state *, | |
1581 | struct binding_scope **, | |
1582 | struct universe *, void *, | |
1583 | void (*) (struct option_cache *, | |
1584 | struct packet *, | |
159bcce3 TL |
1585 | struct lease *, struct client_state *, |
1586 | struct option_state *, | |
432604c3 TL |
1587 | struct option_state *, |
1588 | struct binding_scope **, | |
1589 | struct universe *, void *)); | |
1590 | void hashed_option_space_foreach (struct packet *, struct lease *, | |
159bcce3 | 1591 | struct client_state *, |
432604c3 TL |
1592 | struct option_state *, |
1593 | struct option_state *, | |
1594 | struct binding_scope **, | |
1595 | struct universe *, void *, | |
1596 | void (*) (struct option_cache *, | |
1597 | struct packet *, | |
1598 | struct lease *, | |
159bcce3 | 1599 | struct client_state *, |
432604c3 TL |
1600 | struct option_state *, |
1601 | struct option_state *, | |
1602 | struct binding_scope **, | |
1603 | struct universe *, void *)); | |
1604 | int linked_option_get PROTO ((struct data_string *, struct universe *, | |
1605 | struct packet *, struct lease *, | |
159bcce3 | 1606 | struct client_state *, |
432604c3 TL |
1607 | struct option_state *, struct option_state *, |
1608 | struct option_state *, struct binding_scope **, | |
1609 | unsigned)); | |
1610 | int linked_option_state_dereference PROTO ((struct universe *, | |
1611 | struct option_state *, | |
1612 | const char *, int)); | |
bead14ea DH |
1613 | void save_linked_option(struct universe *, struct option_state *, |
1614 | struct option_cache *, isc_boolean_t appendp); | |
432604c3 | 1615 | void linked_option_space_foreach (struct packet *, struct lease *, |
159bcce3 | 1616 | struct client_state *, |
432604c3 TL |
1617 | struct option_state *, |
1618 | struct option_state *, | |
1619 | struct binding_scope **, | |
1620 | struct universe *, void *, | |
1621 | void (*) (struct option_cache *, | |
1622 | struct packet *, | |
1623 | struct lease *, | |
159bcce3 | 1624 | struct client_state *, |
432604c3 TL |
1625 | struct option_state *, |
1626 | struct option_state *, | |
1627 | struct binding_scope **, | |
1628 | struct universe *, void *)); | |
1629 | int linked_option_space_encapsulate (struct data_string *, struct packet *, | |
159bcce3 TL |
1630 | struct lease *, struct client_state *, |
1631 | struct option_state *, | |
432604c3 TL |
1632 | struct option_state *, |
1633 | struct binding_scope **, | |
1634 | struct universe *); | |
1635 | void delete_linked_option (struct universe *, struct option_state *, int); | |
1636 | struct option_cache *lookup_linked_option (struct universe *, | |
1637 | struct option_state *, unsigned); | |
1638 | void do_packet PROTO ((struct interface_info *, | |
1639 | struct dhcp_packet *, unsigned, | |
1640 | unsigned int, struct iaddr, struct hardware *)); | |
98bd7ca0 DH |
1641 | void do_packet6(struct interface_info *, const char *, |
1642 | int, int, const struct iaddr *, isc_boolean_t); | |
1643 | int packet6_len_okay(const char *, int); | |
1644 | ||
1645 | int add_option(struct option_state *options, | |
1646 | unsigned int option_num, | |
1647 | void *data, | |
1648 | unsigned int data_len); | |
d7837182 | 1649 | |
d7837182 | 1650 | /* dhcpd.c */ |
be62cf06 FD |
1651 | extern struct timeval cur_tv; |
1652 | #define cur_time cur_tv.tv_sec | |
685963dc | 1653 | |
06eb8bab | 1654 | extern int ddns_update_style; |
dbcc689e | 1655 | |
b1b7b521 TL |
1656 | extern const char *path_dhcpd_conf; |
1657 | extern const char *path_dhcpd_db; | |
1658 | extern const char *path_dhcpd_pid; | |
e2ac5814 | 1659 | |
5142937c | 1660 | extern int dhcp_max_agent_option_packet_length; |
6368a1bd | 1661 | extern struct eventqueue *rw_queue_empty; |
5142937c | 1662 | |
98bd7ca0 DH |
1663 | int main(int, char **); |
1664 | void postconf_initialization(int); | |
1665 | void postdb_startup(void); | |
d7837182 | 1666 | void cleanup PROTO ((void)); |
e5078937 TL |
1667 | void lease_pinged PROTO ((struct iaddr, u_int8_t *, int)); |
1668 | void lease_ping_timeout PROTO ((void *)); | |
20916cae | 1669 | int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia); |
06eb8bab | 1670 | extern enum dhcp_shutdown_state shutdown_state; |
d758ad8c TL |
1671 | isc_result_t dhcp_io_shutdown (omapi_object_t *, void *); |
1672 | isc_result_t dhcp_set_control_state (control_object_state_t oldstate, | |
1673 | control_object_state_t newstate); | |
d7837182 TL |
1674 | |
1675 | /* conflex.c */ | |
b1b7b521 | 1676 | isc_result_t new_parse PROTO ((struct parse **, int, |
96c823d5 | 1677 | char *, unsigned, const char *, int)); |
fde86d2d | 1678 | isc_result_t end_parse PROTO ((struct parse **)); |
bda33169 SK |
1679 | isc_result_t save_parse_state(struct parse *cfile); |
1680 | isc_result_t restore_parse_state(struct parse *cfile); | |
b3519f23 TL |
1681 | enum dhcp_token next_token PROTO ((const char **, unsigned *, struct parse *)); |
1682 | enum dhcp_token peek_token PROTO ((const char **, unsigned *, struct parse *)); | |
bda33169 SK |
1683 | enum dhcp_token next_raw_token(const char **rval, unsigned *rlen, |
1684 | struct parse *cfile); | |
1685 | enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen, | |
1686 | struct parse *cfile); | |
d7837182 TL |
1687 | |
1688 | /* confpars.c */ | |
f3aad410 | 1689 | void parse_trace_setup (void); |
fde86d2d | 1690 | isc_result_t readconf PROTO ((void)); |
f3aad410 TL |
1691 | isc_result_t read_conf_file (const char *, struct group *, int, int); |
1692 | #if defined (TRACING) | |
1693 | void trace_conf_input (trace_type_t *, unsigned, char *); | |
1694 | void trace_conf_stop (trace_type_t *ttype); | |
1695 | #endif | |
1696 | isc_result_t conf_file_subparse (struct parse *, struct group *, int); | |
1697 | isc_result_t lease_file_subparse (struct parse *); | |
fde86d2d | 1698 | int parse_statement PROTO ((struct parse *, |
750d0800 | 1699 | struct group *, int, struct host_decl *, int)); |
a7982987 | 1700 | #if defined (FAILOVER_PROTOCOL) |
fde86d2d | 1701 | void parse_failover_peer PROTO ((struct parse *, struct group *, int)); |
a7982987 TL |
1702 | void parse_failover_state_declaration (struct parse *, |
1703 | dhcp_failover_state_t *); | |
5b7f941d TL |
1704 | void parse_failover_state PROTO ((struct parse *, |
1705 | enum failover_state *, TIME *)); | |
a7982987 | 1706 | #endif |
98311e4b | 1707 | int permit_list_match (struct permit *, struct permit *); |
fde86d2d TL |
1708 | void parse_pool_statement PROTO ((struct parse *, struct group *, int)); |
1709 | int parse_boolean PROTO ((struct parse *)); | |
1710 | int parse_lbrace PROTO ((struct parse *)); | |
1711 | void parse_host_declaration PROTO ((struct parse *, struct group *)); | |
20916cae TL |
1712 | int parse_class_declaration PROTO ((struct class **, struct parse *, |
1713 | struct group *, int)); | |
fde86d2d TL |
1714 | void parse_shared_net_declaration PROTO ((struct parse *, struct group *)); |
1715 | void parse_subnet_declaration PROTO ((struct parse *, | |
1716 | struct shared_network *)); | |
98bd7ca0 DH |
1717 | void parse_subnet6_declaration PROTO ((struct parse *, |
1718 | struct shared_network *)); | |
fde86d2d | 1719 | void parse_group_declaration PROTO ((struct parse *, struct group *)); |
98bd7ca0 DH |
1720 | int parse_fixed_addr_param PROTO ((struct option_cache **, |
1721 | struct parse *, enum dhcp_token)); | |
20916cae | 1722 | int parse_lease_declaration PROTO ((struct lease **, struct parse *)); |
6705543f DH |
1723 | int parse_ip6_addr(struct parse *, struct iaddr *); |
1724 | int parse_ip6_addr_expr(struct expression **, struct parse *); | |
1d9774ab | 1725 | int parse_ip6_prefix(struct parse *, struct iaddr *, u_int8_t *); |
98311e4b DH |
1726 | void parse_address_range PROTO ((struct parse *, struct group *, int, |
1727 | struct pool *, struct lease **)); | |
98bd7ca0 | 1728 | void parse_address_range6(struct parse *cfile, struct group *group); |
80c9fdb0 FD |
1729 | void parse_prefix6(struct parse *cfile, struct group *group); |
1730 | void parse_fixed_prefix6(struct parse *cfile, struct host_decl *host_decl); | |
98bd7ca0 | 1731 | void parse_ia_na_declaration(struct parse *); |
1d9774ab FD |
1732 | void parse_ia_ta_declaration(struct parse *); |
1733 | void parse_ia_pd_declaration(struct parse *); | |
98bd7ca0 DH |
1734 | void parse_server_duid(struct parse *cfile); |
1735 | void parse_server_duid_conf(struct parse *cfile); | |
8bdd4d02 | 1736 | |
b992d7e2 | 1737 | /* ddns.c */ |
98bd7ca0 | 1738 | int ddns_updates(struct packet *, struct lease *, struct lease *, |
1d17db44 FD |
1739 | struct iasubopt *, struct iasubopt *, struct option_state *); |
1740 | int ddns_removals(struct lease *, struct iasubopt *); | |
b992d7e2 | 1741 | |
8bdd4d02 | 1742 | /* parse.c */ |
dbcc689e TL |
1743 | void add_enumeration (struct enumeration *); |
1744 | struct enumeration *find_enumeration (const char *, int); | |
1745 | struct enumeration_value *find_enumeration_value (const char *, int, | |
c54db708 | 1746 | unsigned *, |
dbcc689e | 1747 | const char *); |
fde86d2d TL |
1748 | void skip_to_semi PROTO ((struct parse *)); |
1749 | void skip_to_rbrace PROTO ((struct parse *, int)); | |
1750 | int parse_semi PROTO ((struct parse *)); | |
b3519f23 | 1751 | int parse_string PROTO ((struct parse *, char **, unsigned *)); |
fde86d2d TL |
1752 | char *parse_host_name PROTO ((struct parse *)); |
1753 | int parse_ip_addr_or_hostname PROTO ((struct expression **, | |
1754 | struct parse *, int)); | |
1755 | void parse_hardware_param PROTO ((struct parse *, struct hardware *)); | |
1756 | void parse_lease_time PROTO ((struct parse *, TIME *)); | |
1757 | unsigned char *parse_numeric_aggregate PROTO ((struct parse *, | |
b1b7b521 TL |
1758 | unsigned char *, unsigned *, |
1759 | int, int, unsigned)); | |
1760 | void convert_num PROTO ((struct parse *, unsigned char *, const char *, | |
1761 | int, unsigned)); | |
fde86d2d | 1762 | TIME parse_date PROTO ((struct parse *)); |
b1d3778c | 1763 | TIME parse_date_core(struct parse *); |
f7fdb216 DH |
1764 | isc_result_t parse_option_name PROTO ((struct parse *, int, int *, |
1765 | struct option **)); | |
fde86d2d TL |
1766 | void parse_option_space_decl PROTO ((struct parse *)); |
1767 | int parse_option_code_definition PROTO ((struct parse *, struct option *)); | |
a59ea078 | 1768 | int parse_base64 (struct data_string *, struct parse *); |
fde86d2d | 1769 | int parse_cshl PROTO ((struct data_string *, struct parse *)); |
79a65726 | 1770 | int parse_executable_statement PROTO ((struct executable_statement **, |
69bb758c TL |
1771 | struct parse *, int *, |
1772 | enum expression_context)); | |
79a65726 | 1773 | int parse_executable_statements PROTO ((struct executable_statement **, |
69bb758c TL |
1774 | struct parse *, int *, |
1775 | enum expression_context)); | |
3f09cb5a | 1776 | int parse_zone (struct dns_zone *, struct parse *); |
a59ea078 | 1777 | int parse_key (struct parse *); |
fde86d2d TL |
1778 | int parse_on_statement PROTO ((struct executable_statement **, |
1779 | struct parse *, int *)); | |
69bb758c TL |
1780 | int parse_switch_statement PROTO ((struct executable_statement **, |
1781 | struct parse *, int *)); | |
1782 | int parse_case_statement PROTO ((struct executable_statement **, | |
1783 | struct parse *, int *, | |
1784 | enum expression_context)); | |
fde86d2d TL |
1785 | int parse_if_statement PROTO ((struct executable_statement **, |
1786 | struct parse *, int *)); | |
1787 | int parse_boolean_expression PROTO ((struct expression **, | |
1788 | struct parse *, int *)); | |
1789 | int parse_data_expression PROTO ((struct expression **, | |
1790 | struct parse *, int *)); | |
1791 | int parse_numeric_expression PROTO ((struct expression **, | |
1792 | struct parse *, int *)); | |
5b7f941d | 1793 | int parse_dns_expression PROTO ((struct expression **, struct parse *, int *)); |
fde86d2d | 1794 | int parse_non_binary PROTO ((struct expression **, struct parse *, int *, |
27fe61a7 | 1795 | enum expression_context)); |
fde86d2d | 1796 | int parse_expression PROTO ((struct expression **, struct parse *, int *, |
27fe61a7 TL |
1797 | enum expression_context, |
1798 | struct expression **, enum expr_op)); | |
28868515 SK |
1799 | int parse_option_data(struct expression **expr, struct parse *cfile, |
1800 | int lookups, struct option *option); | |
fde86d2d TL |
1801 | int parse_option_statement PROTO ((struct executable_statement **, |
1802 | struct parse *, int, | |
79a65726 | 1803 | struct option *, enum statement_op)); |
b1b7b521 | 1804 | int parse_option_token PROTO ((struct expression **, struct parse *, |
de427245 | 1805 | const char **, struct expression *, int, int)); |
fde86d2d TL |
1806 | int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int)); |
1807 | int parse_auth_key PROTO ((struct data_string *, struct parse *)); | |
cfdfb9f1 | 1808 | int parse_warn (struct parse *, const char *, ...) |
4bd8800e | 1809 | __attribute__((__format__(__printf__,2,3))); |
98bd7ca0 | 1810 | struct expression *parse_domain_list(struct parse *cfile, int); |
dba5803b | 1811 | |
d7837182 TL |
1812 | |
1813 | /* tree.c */ | |
de427245 TL |
1814 | #if defined (NSUPDATE) |
1815 | extern struct __res_state resolver_state; | |
1816 | extern int resolver_inited; | |
1817 | #endif | |
1818 | ||
6ceb9118 | 1819 | extern struct binding_scope *global_scope; |
d7837182 | 1820 | pair cons PROTO ((caddr_t, pair)); |
27fe61a7 | 1821 | int make_const_option_cache PROTO ((struct option_cache **, struct buffer **, |
b1b7b521 | 1822 | u_int8_t *, unsigned, struct option *, |
4bd8800e | 1823 | const char *, int)); |
b1b7b521 TL |
1824 | int make_host_lookup PROTO ((struct expression **, const char *)); |
1825 | int enter_dns_host PROTO ((struct dns_host_entry **, const char *)); | |
d758ad8c TL |
1826 | int make_const_data (struct expression **, |
1827 | const unsigned char *, unsigned, int, int, | |
1828 | const char *, int); | |
7f6ad5ac | 1829 | int make_const_int PROTO ((struct expression **, unsigned long)); |
27fe61a7 TL |
1830 | int make_concat PROTO ((struct expression **, |
1831 | struct expression *, struct expression *)); | |
4f58da18 | 1832 | int make_encapsulation PROTO ((struct expression **, struct data_string *)); |
27fe61a7 TL |
1833 | int make_substring PROTO ((struct expression **, struct expression *, |
1834 | struct expression *, struct expression *)); | |
1835 | int make_limit PROTO ((struct expression **, struct expression *, int)); | |
7f6ad5ac | 1836 | int make_let PROTO ((struct executable_statement **, const char *)); |
27fe61a7 | 1837 | int option_cache PROTO ((struct option_cache **, struct data_string *, |
d758ad8c TL |
1838 | struct expression *, struct option *, |
1839 | const char *, int)); | |
17a10efe | 1840 | int evaluate_expression (struct binding_value **, struct packet *, |
159bcce3 TL |
1841 | struct lease *, struct client_state *, |
1842 | struct option_state *, struct option_state *, | |
d758ad8c TL |
1843 | struct binding_scope **, struct expression *, |
1844 | const char *, int); | |
17a10efe | 1845 | int binding_value_dereference (struct binding_value **, const char *, int); |
4bd8800e | 1846 | #if defined (NSUPDATE) |
5b7f941d | 1847 | int evaluate_dns_expression PROTO ((ns_updrec **, struct packet *, |
159bcce3 TL |
1848 | struct lease *, |
1849 | struct client_state *, | |
1850 | struct option_state *, | |
5b7f941d | 1851 | struct option_state *, |
6ceb9118 | 1852 | struct binding_scope **, |
5b7f941d | 1853 | struct expression *)); |
4bd8800e | 1854 | #endif |
27fe61a7 | 1855 | int evaluate_boolean_expression PROTO ((int *, |
f3e8ea32 | 1856 | struct packet *, struct lease *, |
159bcce3 | 1857 | struct client_state *, |
f3e8ea32 TL |
1858 | struct option_state *, |
1859 | struct option_state *, | |
6ceb9118 | 1860 | struct binding_scope **, |
27fe61a7 TL |
1861 | struct expression *)); |
1862 | int evaluate_data_expression PROTO ((struct data_string *, | |
f3e8ea32 | 1863 | struct packet *, struct lease *, |
159bcce3 | 1864 | struct client_state *, |
f3e8ea32 TL |
1865 | struct option_state *, |
1866 | struct option_state *, | |
6ceb9118 | 1867 | struct binding_scope **, |
d758ad8c | 1868 | struct expression *, const char *, int)); |
159bcce3 TL |
1869 | int evaluate_numeric_expression (unsigned long *, struct packet *, |
1870 | struct lease *, struct client_state *, | |
1871 | struct option_state *, struct option_state *, | |
1872 | struct binding_scope **, | |
1873 | struct expression *); | |
27fe61a7 | 1874 | int evaluate_option_cache PROTO ((struct data_string *, |
f3e8ea32 | 1875 | struct packet *, struct lease *, |
159bcce3 | 1876 | struct client_state *, |
f3e8ea32 | 1877 | struct option_state *, struct option_state *, |
6ceb9118 | 1878 | struct binding_scope **, |
4bd8800e TL |
1879 | struct option_cache *, |
1880 | const char *, int)); | |
4c026751 TL |
1881 | int evaluate_boolean_option_cache PROTO ((int *, |
1882 | struct packet *, struct lease *, | |
159bcce3 | 1883 | struct client_state *, |
f3e8ea32 | 1884 | struct option_state *, |
27fe61a7 | 1885 | struct option_state *, |
6ceb9118 | 1886 | struct binding_scope **, |
7f6ad5ac TL |
1887 | struct option_cache *, |
1888 | const char *, int)); | |
4c026751 TL |
1889 | int evaluate_boolean_expression_result PROTO ((int *, |
1890 | struct packet *, struct lease *, | |
159bcce3 | 1891 | struct client_state *, |
f3e8ea32 | 1892 | struct option_state *, |
27fe61a7 | 1893 | struct option_state *, |
6ceb9118 | 1894 | struct binding_scope **, |
4bd8800e TL |
1895 | struct expression *)); |
1896 | void expression_dereference PROTO ((struct expression **, const char *, int)); | |
5b7f941d | 1897 | int is_dns_expression PROTO ((struct expression *)); |
27fe61a7 TL |
1898 | int is_boolean_expression PROTO ((struct expression *)); |
1899 | int is_data_expression PROTO ((struct expression *)); | |
1900 | int is_numeric_expression PROTO ((struct expression *)); | |
69bb758c | 1901 | int is_compound_expression PROTO ((struct expression *)); |
27fe61a7 | 1902 | int op_precedence PROTO ((enum expr_op, enum expr_op)); |
cc4473a0 | 1903 | enum expression_context expression_context (struct expression *); |
27fe61a7 | 1904 | enum expression_context op_context PROTO ((enum expr_op)); |
7f6ad5ac TL |
1905 | int write_expression PROTO ((FILE *, struct expression *, int, int, int)); |
1906 | struct binding *find_binding PROTO ((struct binding_scope *, const char *)); | |
4bd8800e TL |
1907 | int free_bindings PROTO ((struct binding_scope *, const char *, int)); |
1908 | int binding_scope_dereference PROTO ((struct binding_scope **, | |
1909 | const char *, int)); | |
432604c3 TL |
1910 | int fundef_dereference (struct fundef **, const char *, int); |
1911 | int data_subexpression_length (int *, struct expression *); | |
1912 | int expr_valid_for_context (struct expression *, enum expression_context); | |
2f7ca092 TL |
1913 | struct binding *create_binding (struct binding_scope **, const char *); |
1914 | int bind_ds_value (struct binding_scope **, | |
1915 | const char *, struct data_string *); | |
1916 | int find_bound_string (struct data_string *, | |
1917 | struct binding_scope *, const char *); | |
1918 | int unset (struct binding_scope *, const char *); | |
98bd7ca0 | 1919 | int data_string_sprintfa(struct data_string *ds, const char *fmt, ...); |
d7837182 TL |
1920 | |
1921 | /* dhcp.c */ | |
e5078937 | 1922 | extern int outstanding_pings; |
6368a1bd | 1923 | extern int max_outstanding_acks; |
f8cbf390 DH |
1924 | extern int max_ack_delay_secs; |
1925 | extern int max_ack_delay_usecs; | |
e5078937 | 1926 | |
d7837182 | 1927 | void dhcp PROTO ((struct packet *)); |
5bc2e1f2 | 1928 | void dhcpdiscover PROTO ((struct packet *, int)); |
159bcce3 | 1929 | void dhcprequest PROTO ((struct packet *, int, struct lease *)); |
5bc2e1f2 TL |
1930 | void dhcprelease PROTO ((struct packet *, int)); |
1931 | void dhcpdecline PROTO ((struct packet *, int)); | |
1932 | void dhcpinform PROTO ((struct packet *, int)); | |
a8b53b42 | 1933 | void nak_lease PROTO ((struct packet *, struct iaddr *cip)); |
112a6c2c | 1934 | void ack_lease PROTO ((struct packet *, struct lease *, |
c75473d8 | 1935 | unsigned int, TIME, char *, int, struct host_decl *)); |
6368a1bd DH |
1936 | void delayed_ack_enqueue(struct lease *); |
1937 | void commit_leases_readerdry(void *); | |
1938 | void flush_ackqueue(void *); | |
fc2df23a | 1939 | void dhcp_reply PROTO ((struct lease *)); |
20916cae | 1940 | int find_lease PROTO ((struct lease **, struct packet *, |
159bcce3 | 1941 | struct shared_network *, int *, int *, struct lease *, |
c489f075 | 1942 | const char *, int)); |
20916cae TL |
1943 | int mockup_lease PROTO ((struct lease **, struct packet *, |
1944 | struct shared_network *, | |
1945 | struct host_decl *)); | |
4bd8800e | 1946 | void static_lease_dereference PROTO ((struct lease *, const char *, int)); |
d7837182 | 1947 | |
20916cae TL |
1948 | int allocate_lease PROTO ((struct lease **, struct packet *, |
1949 | struct pool *, int *)); | |
734d2258 | 1950 | int permitted PROTO ((struct packet *, struct permit *)); |
940ea8ab | 1951 | int locate_network PROTO ((struct packet *)); |
516cf43a TL |
1952 | int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *)); |
1953 | unsigned cons_agent_information_options PROTO ((struct option_state *, | |
1954 | struct dhcp_packet *, | |
1955 | unsigned, unsigned)); | |
6d103865 SK |
1956 | void get_server_source_address(struct in_addr *from, |
1957 | struct option_state *options, | |
1958 | struct packet *packet); | |
734d2258 | 1959 | |
37ec5845 FD |
1960 | /* dhcpleasequery.c */ |
1961 | void dhcpleasequery PROTO ((struct packet *, int)); | |
1962 | void dhcpv6_leasequery PROTO ((struct data_string *, struct packet *)); | |
1963 | ||
98bd7ca0 DH |
1964 | /* dhcpv6.c */ |
1965 | isc_boolean_t server_duid_isset(void); | |
1966 | void copy_server_duid(struct data_string *ds, const char *file, int line); | |
1967 | void set_server_duid(struct data_string *new_duid); | |
1968 | isc_result_t set_server_duid_from_option(void); | |
6705543f | 1969 | void set_server_duid_type(int type); |
98bd7ca0 | 1970 | isc_result_t generate_new_server_duid(void); |
37ec5845 | 1971 | isc_result_t get_client_id(struct packet *, struct data_string *); |
98bd7ca0 DH |
1972 | void dhcpv6(struct packet *); |
1973 | ||
d7837182 TL |
1974 | /* bootp.c */ |
1975 | void bootp PROTO ((struct packet *)); | |
1976 | ||
1977 | /* memory.c */ | |
06eb8bab | 1978 | extern int (*group_write_hook) (struct group_object *); |
20916cae | 1979 | extern struct group *root_group; |
98311e4b | 1980 | extern group_hash_t *group_name_hash; |
20916cae TL |
1981 | isc_result_t delete_group (struct group_object *, int); |
1982 | isc_result_t supersede_group (struct group_object *, int); | |
1983 | int clone_group (struct group **, struct group *, const char *, int); | |
1984 | int write_group PROTO ((struct group_object *)); | |
1985 | ||
1986 | /* salloc.c */ | |
d758ad8c | 1987 | void relinquish_lease_hunks (void); |
20916cae | 1988 | struct lease *new_leases PROTO ((unsigned, const char *, int)); |
d758ad8c TL |
1989 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ |
1990 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
1991 | void relinquish_free_lease_states (void); | |
1992 | #endif | |
20916cae TL |
1993 | OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease) |
1994 | OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class) | |
899d754f | 1995 | OMAPI_OBJECT_ALLOC_DECL (subclass, struct class, dhcp_type_subclass) |
20916cae | 1996 | OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool) |
165bce70 | 1997 | OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host) |
d7837182 TL |
1998 | |
1999 | /* alloc.c */ | |
20916cae TL |
2000 | OMAPI_OBJECT_ALLOC_DECL (subnet, struct subnet, dhcp_type_subnet) |
2001 | OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network, | |
2002 | dhcp_type_shared_network) | |
2003 | OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group) | |
d758ad8c TL |
2004 | OMAPI_OBJECT_ALLOC_DECL (dhcp_control, |
2005 | dhcp_control_object_t, dhcp_type_control) | |
2006 | ||
2007 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ | |
2008 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
2009 | void relinquish_free_pairs (void); | |
2010 | void relinquish_free_expressions (void); | |
2011 | void relinquish_free_binding_values (void); | |
2012 | void relinquish_free_option_caches (void); | |
2013 | void relinquish_free_packets (void); | |
2014 | #endif | |
20916cae | 2015 | |
625f7cee TL |
2016 | int option_chain_head_allocate (struct option_chain_head **, |
2017 | const char *, int); | |
2018 | int option_chain_head_reference (struct option_chain_head **, | |
2019 | struct option_chain_head *, | |
2020 | const char *, int); | |
2021 | int option_chain_head_dereference (struct option_chain_head **, | |
2022 | const char *, int); | |
20916cae TL |
2023 | int group_allocate (struct group **, const char *, int); |
2024 | int group_reference (struct group **, struct group *, const char *, int); | |
2025 | int group_dereference (struct group **, const char *, int); | |
7f6ad5ac | 2026 | struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int)); |
7f6ad5ac TL |
2027 | struct protocol *new_protocol PROTO ((const char *, int)); |
2028 | struct lease_state *new_lease_state PROTO ((const char *, int)); | |
2029 | struct domain_search_list *new_domain_search_list PROTO ((const char *, int)); | |
2030 | struct name_server *new_name_server PROTO ((const char *, int)); | |
2031 | void free_name_server PROTO ((struct name_server *, const char *, int)); | |
f7fdb216 DH |
2032 | struct option *new_option PROTO ((const char *, const char *, int)); |
2033 | int option_reference(struct option **dest, struct option *src, | |
2034 | const char * file, int line); | |
2035 | int option_dereference(struct option **dest, const char *file, int line); | |
7f6ad5ac TL |
2036 | struct universe *new_universe PROTO ((const char *, int)); |
2037 | void free_universe PROTO ((struct universe *, const char *, int)); | |
b1b7b521 | 2038 | void free_domain_search_list PROTO ((struct domain_search_list *, |
7f6ad5ac TL |
2039 | const char *, int)); |
2040 | void free_lease_state PROTO ((struct lease_state *, const char *, int)); | |
2041 | void free_protocol PROTO ((struct protocol *, const char *, int)); | |
7f6ad5ac TL |
2042 | void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *, int)); |
2043 | struct client_lease *new_client_lease PROTO ((const char *, int)); | |
2044 | void free_client_lease PROTO ((struct client_lease *, const char *, int)); | |
7f6ad5ac TL |
2045 | struct permit *new_permit PROTO ((const char *, int)); |
2046 | void free_permit PROTO ((struct permit *, const char *, int)); | |
2047 | pair new_pair PROTO ((const char *, int)); | |
2048 | void free_pair PROTO ((pair, const char *, int)); | |
2049 | int expression_allocate PROTO ((struct expression **, const char *, int)); | |
27fe61a7 | 2050 | int expression_reference PROTO ((struct expression **, |
7f6ad5ac TL |
2051 | struct expression *, const char *, int)); |
2052 | void free_expression PROTO ((struct expression *, const char *, int)); | |
17a10efe TL |
2053 | int binding_value_allocate PROTO ((struct binding_value **, |
2054 | const char *, int)); | |
2055 | int binding_value_reference PROTO ((struct binding_value **, | |
2056 | struct binding_value *, | |
2057 | const char *, int)); | |
2058 | void free_binding_value PROTO ((struct binding_value *, const char *, int)); | |
664ec1de TL |
2059 | int fundef_allocate PROTO ((struct fundef **, const char *, int)); |
2060 | int fundef_reference PROTO ((struct fundef **, | |
2061 | struct fundef *, const char *, int)); | |
7f6ad5ac | 2062 | int option_cache_allocate PROTO ((struct option_cache **, const char *, int)); |
27fe61a7 | 2063 | int option_cache_reference PROTO ((struct option_cache **, |
7f6ad5ac TL |
2064 | struct option_cache *, const char *, int)); |
2065 | int buffer_allocate PROTO ((struct buffer **, unsigned, const char *, int)); | |
2066 | int buffer_reference PROTO ((struct buffer **, struct buffer *, | |
2067 | const char *, int)); | |
2068 | int buffer_dereference PROTO ((struct buffer **, const char *, int)); | |
b1b7b521 | 2069 | int dns_host_entry_allocate PROTO ((struct dns_host_entry **, |
7f6ad5ac | 2070 | const char *, const char *, int)); |
27fe61a7 | 2071 | int dns_host_entry_reference PROTO ((struct dns_host_entry **, |
7f6ad5ac TL |
2072 | struct dns_host_entry *, |
2073 | const char *, int)); | |
b1b7b521 | 2074 | int dns_host_entry_dereference PROTO ((struct dns_host_entry **, |
7f6ad5ac TL |
2075 | const char *, int)); |
2076 | int option_state_allocate PROTO ((struct option_state **, const char *, int)); | |
a340de95 | 2077 | int option_state_reference PROTO ((struct option_state **, |
7f6ad5ac TL |
2078 | struct option_state *, const char *, int)); |
2079 | int option_state_dereference PROTO ((struct option_state **, | |
2080 | const char *, int)); | |
5279b8f3 DH |
2081 | void data_string_copy(struct data_string *, const struct data_string *, |
2082 | const char *, int); | |
7f6ad5ac TL |
2083 | void data_string_forget PROTO ((struct data_string *, const char *, int)); |
2084 | void data_string_truncate PROTO ((struct data_string *, int)); | |
79a65726 | 2085 | int executable_statement_allocate PROTO ((struct executable_statement **, |
7f6ad5ac | 2086 | const char *, int)); |
79a65726 TL |
2087 | int executable_statement_reference PROTO ((struct executable_statement **, |
2088 | struct executable_statement *, | |
7f6ad5ac TL |
2089 | const char *, int)); |
2090 | int packet_allocate PROTO ((struct packet **, const char *, int)); | |
2091 | int packet_reference PROTO ((struct packet **, | |
2092 | struct packet *, const char *, int)); | |
2093 | int packet_dereference PROTO ((struct packet **, const char *, int)); | |
2094 | int binding_scope_allocate PROTO ((struct binding_scope **, | |
2095 | const char *, int)); | |
6ceb9118 TL |
2096 | int binding_scope_reference PROTO ((struct binding_scope **, |
2097 | struct binding_scope *, | |
2098 | const char *, int)); | |
3f09cb5a TL |
2099 | int dns_zone_allocate PROTO ((struct dns_zone **, const char *, int)); |
2100 | int dns_zone_reference PROTO ((struct dns_zone **, | |
2101 | struct dns_zone *, const char *, int)); | |
d7837182 TL |
2102 | |
2103 | /* print.c */ | |
5e864416 DH |
2104 | #define DEFAULT_TIME_FORMAT 0 |
2105 | #define LOCAL_TIME_FORMAT 1 | |
2106 | extern int db_time_format; | |
d73c2404 TL |
2107 | char *quotify_string (const char *, const char *, int); |
2108 | char *quotify_buf (const unsigned char *, unsigned, const char *, int); | |
d758ad8c | 2109 | char *print_base64 (const unsigned char *, unsigned, const char *, int); |
d7837182 | 2110 | char *print_hw_addr PROTO ((int, int, unsigned char *)); |
97ca1699 | 2111 | void print_lease PROTO ((struct lease *)); |
b1b7b521 | 2112 | void dump_raw PROTO ((const unsigned char *, unsigned)); |
b2398d97 | 2113 | void dump_packet_option (struct option_cache *, struct packet *, |
159bcce3 TL |
2114 | struct lease *, struct client_state *, |
2115 | struct option_state *, struct option_state *, | |
2116 | struct binding_scope **, struct universe *, void *); | |
17b95f41 | 2117 | void dump_packet PROTO ((struct packet *)); |
c626ae69 | 2118 | void hash_dump PROTO ((struct hash_table *)); |
b1b7b521 TL |
2119 | char *print_hex_1 PROTO ((unsigned, const u_int8_t *, unsigned)); |
2120 | char *print_hex_2 PROTO ((unsigned, const u_int8_t *, unsigned)); | |
2121 | char *print_hex_3 PROTO ((unsigned, const u_int8_t *, unsigned)); | |
2122 | char *print_dotted_quads PROTO ((unsigned, const u_int8_t *)); | |
2123 | char *print_dec_1 PROTO ((unsigned long)); | |
2124 | char *print_dec_2 PROTO ((unsigned long)); | |
fd547e98 | 2125 | void print_expression PROTO ((const char *, struct expression *)); |
b1b7b521 TL |
2126 | int token_print_indent_concat (FILE *, int, int, |
2127 | const char *, const char *, ...); | |
2128 | int token_indent_data_string (FILE *, int, int, const char *, const char *, | |
fa098be8 | 2129 | struct data_string *); |
b1b7b521 TL |
2130 | int token_print_indent (FILE *, int, int, |
2131 | const char *, const char *, const char *); | |
fa098be8 | 2132 | void indent_spaces (FILE *, int); |
69bb758c TL |
2133 | #if defined (NSUPDATE) |
2134 | void print_dns_status (int, ns_updque *); | |
2135 | #endif | |
5e864416 | 2136 | const char *print_time(TIME); |
d7837182 | 2137 | |
98bd7ca0 DH |
2138 | void get_hw_addr(const char *name, struct hardware *hw); |
2139 | ||
d7837182 | 2140 | /* socket.c */ |
c626ae69 TL |
2141 | #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ |
2142 | || defined (USE_SOCKET_FALLBACK) | |
ecddae64 | 2143 | int if_register_socket(struct interface_info *, int, int *); |
17b95f41 TL |
2144 | #endif |
2145 | ||
5d4afdbc | 2146 | #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND) |
41fb155b TL |
2147 | void if_reinitialize_fallback PROTO ((struct interface_info *)); |
2148 | void if_register_fallback PROTO ((struct interface_info *)); | |
4595a58c TL |
2149 | ssize_t send_fallback PROTO ((struct interface_info *, |
2150 | struct packet *, struct dhcp_packet *, size_t, | |
2151 | struct in_addr, | |
2152 | struct sockaddr_in *, struct hardware *)); | |
98bd7ca0 DH |
2153 | ssize_t send_fallback6(struct interface_info *, struct packet *, |
2154 | struct dhcp_packet *, size_t, struct in6_addr, | |
2155 | struct sockaddr_in6 *, struct hardware *); | |
c626ae69 TL |
2156 | #endif |
2157 | ||
6f10b1a4 | 2158 | #ifdef USE_SOCKET_SEND |
41fb155b | 2159 | void if_reinitialize_send PROTO ((struct interface_info *)); |
eb1aa668 | 2160 | void if_register_send PROTO ((struct interface_info *)); |
3f09cb5a | 2161 | void if_deregister_send PROTO ((struct interface_info *)); |
eb1aa668 | 2162 | ssize_t send_packet PROTO ((struct interface_info *, |
4595a58c TL |
2163 | struct packet *, struct dhcp_packet *, size_t, |
2164 | struct in_addr, | |
2165 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 2166 | #endif |
6705543f DH |
2167 | ssize_t send_packet6(struct interface_info *, const unsigned char *, size_t, |
2168 | struct sockaddr_in6 *); | |
6f10b1a4 | 2169 | #ifdef USE_SOCKET_RECEIVE |
41fb155b TL |
2170 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
2171 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 2172 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
2173 | ssize_t receive_packet PROTO ((struct interface_info *, |
2174 | unsigned char *, size_t, | |
2175 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 2176 | #endif |
b5c11cbe | 2177 | |
5d4afdbc | 2178 | #if defined (USE_SOCKET_FALLBACK) |
4fe74d72 | 2179 | isc_result_t fallback_discard PROTO ((omapi_object_t *)); |
b5c11cbe TL |
2180 | #endif |
2181 | ||
5d4afdbc | 2182 | #if defined (USE_SOCKET_SEND) |
319db03d TL |
2183 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2184 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 2185 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 2186 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 2187 | #endif |
6f10b1a4 | 2188 | |
99fe695e SK |
2189 | void if_register6(struct interface_info *info, int do_multicast); |
2190 | ssize_t receive_packet6(struct interface_info *interface, | |
2191 | unsigned char *buf, size_t len, | |
ecddae64 DH |
2192 | struct sockaddr_in6 *from, struct in6_addr *to_addr, |
2193 | unsigned int *if_index); | |
99fe695e SK |
2194 | void if_deregister6(struct interface_info *info); |
2195 | ||
2196 | ||
6f10b1a4 | 2197 | /* bpf.c */ |
17b95f41 | 2198 | #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) |
41fb155b | 2199 | int if_register_bpf PROTO ( (struct interface_info *)); |
17b95f41 | 2200 | #endif |
6f10b1a4 | 2201 | #ifdef USE_BPF_SEND |
41fb155b TL |
2202 | void if_reinitialize_send PROTO ((struct interface_info *)); |
2203 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 2204 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
2205 | ssize_t send_packet PROTO ((struct interface_info *, |
2206 | struct packet *, struct dhcp_packet *, size_t, | |
2207 | struct in_addr, | |
2208 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 TL |
2209 | #endif |
2210 | #ifdef USE_BPF_RECEIVE | |
41fb155b TL |
2211 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
2212 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 2213 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
2214 | ssize_t receive_packet PROTO ((struct interface_info *, |
2215 | unsigned char *, size_t, | |
2216 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 2217 | #endif |
469cf3a4 | 2218 | #if defined (USE_BPF_SEND) |
319db03d TL |
2219 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2220 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 2221 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 TL |
2222 | void maybe_setup_fallback PROTO ((void)); |
2223 | #endif | |
2224 | ||
2225 | /* lpf.c */ | |
2226 | #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) | |
2227 | int if_register_lpf PROTO ( (struct interface_info *)); | |
2228 | #endif | |
2229 | #ifdef USE_LPF_SEND | |
2230 | void if_reinitialize_send PROTO ((struct interface_info *)); | |
2231 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 2232 | void if_deregister_send PROTO ((struct interface_info *)); |
d1f2c520 TL |
2233 | ssize_t send_packet PROTO ((struct interface_info *, |
2234 | struct packet *, struct dhcp_packet *, size_t, | |
2235 | struct in_addr, | |
2236 | struct sockaddr_in *, struct hardware *)); | |
2237 | #endif | |
2238 | #ifdef USE_LPF_RECEIVE | |
2239 | void if_reinitialize_receive PROTO ((struct interface_info *)); | |
2240 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 2241 | void if_deregister_receive PROTO ((struct interface_info *)); |
d1f2c520 TL |
2242 | ssize_t receive_packet PROTO ((struct interface_info *, |
2243 | unsigned char *, size_t, | |
2244 | struct sockaddr_in *, struct hardware *)); | |
2245 | #endif | |
2246 | #if defined (USE_LPF_SEND) | |
319db03d TL |
2247 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2248 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 2249 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 2250 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 2251 | #endif |
6f10b1a4 TL |
2252 | |
2253 | /* nit.c */ | |
41fb155b TL |
2254 | #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE) |
2255 | int if_register_nit PROTO ( (struct interface_info *)); | |
2256 | #endif | |
2257 | ||
6f10b1a4 | 2258 | #ifdef USE_NIT_SEND |
41fb155b TL |
2259 | void if_reinitialize_send PROTO ((struct interface_info *)); |
2260 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 2261 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
2262 | ssize_t send_packet PROTO ((struct interface_info *, |
2263 | struct packet *, struct dhcp_packet *, size_t, | |
2264 | struct in_addr, | |
2265 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 TL |
2266 | #endif |
2267 | #ifdef USE_NIT_RECEIVE | |
41fb155b TL |
2268 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
2269 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 2270 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
2271 | ssize_t receive_packet PROTO ((struct interface_info *, |
2272 | unsigned char *, size_t, | |
2273 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 2274 | #endif |
94f08824 | 2275 | #if defined (USE_NIT_SEND) |
319db03d TL |
2276 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2277 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 2278 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 2279 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 2280 | #endif |
6f10b1a4 | 2281 | |
94f08824 | 2282 | /* dlpi.c */ |
5142937c TL |
2283 | #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) |
2284 | int if_register_dlpi PROTO ( (struct interface_info *)); | |
2285 | #endif | |
2286 | ||
94f08824 | 2287 | #ifdef USE_DLPI_SEND |
109e00db DH |
2288 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2289 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
5142937c TL |
2290 | void if_reinitialize_send PROTO ((struct interface_info *)); |
2291 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 2292 | void if_deregister_send PROTO ((struct interface_info *)); |
5142937c TL |
2293 | ssize_t send_packet PROTO ((struct interface_info *, |
2294 | struct packet *, struct dhcp_packet *, size_t, | |
2295 | struct in_addr, | |
2296 | struct sockaddr_in *, struct hardware *)); | |
109e00db DH |
2297 | int supports_multiple_interfaces (struct interface_info *); |
2298 | void maybe_setup_fallback PROTO ((void)); | |
94f08824 TL |
2299 | #endif |
2300 | #ifdef USE_DLPI_RECEIVE | |
5142937c TL |
2301 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
2302 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 2303 | void if_deregister_receive PROTO ((struct interface_info *)); |
5142937c TL |
2304 | ssize_t receive_packet PROTO ((struct interface_info *, |
2305 | unsigned char *, size_t, | |
2306 | struct sockaddr_in *, struct hardware *)); | |
94f08824 TL |
2307 | #endif |
2308 | ||
2309 | ||
6f10b1a4 TL |
2310 | /* raw.c */ |
2311 | #ifdef USE_RAW_SEND | |
41fb155b TL |
2312 | void if_reinitialize_send PROTO ((struct interface_info *)); |
2313 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 2314 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
2315 | ssize_t send_packet PROTO ((struct interface_info *, |
2316 | struct packet *, struct dhcp_packet *, size_t, | |
2317 | struct in_addr, | |
2318 | struct sockaddr_in *, struct hardware *)); | |
319db03d TL |
2319 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
2320 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 2321 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 2322 | void maybe_setup_fallback PROTO ((void)); |
6f10b1a4 TL |
2323 | #endif |
2324 | ||
f3aad410 | 2325 | /* discover.c */ |
d1f2c520 | 2326 | extern struct interface_info *interfaces, |
339b0231 | 2327 | *dummy_interfaces, *fallback_interface; |
6e5ed8bf | 2328 | extern struct protocol *protocols; |
d032a71e | 2329 | extern int quiet_interface_discovery; |
8bed305d | 2330 | isc_result_t interface_setup (void); |
f3aad410 | 2331 | void interface_trace_setup (void); |
aa8579c0 TL |
2332 | |
2333 | extern struct in_addr limited_broadcast; | |
98bd7ca0 | 2334 | extern int local_family; |
aa8579c0 | 2335 | extern struct in_addr local_address; |
98bd7ca0 | 2336 | extern struct in6_addr local_address6; |
aa8579c0 TL |
2337 | |
2338 | extern u_int16_t local_port; | |
2339 | extern u_int16_t remote_port; | |
20916cae TL |
2340 | extern int (*dhcp_interface_setup_hook) (struct interface_info *, |
2341 | struct iaddr *); | |
2342 | extern int (*dhcp_interface_discovery_hook) (struct interface_info *); | |
06eb8bab | 2343 | extern isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *); |
aa8579c0 | 2344 | |
6e5ed8bf | 2345 | extern void (*bootp_packet_handler) PROTO ((struct interface_info *, |
b1b7b521 | 2346 | struct dhcp_packet *, unsigned, |
2b9b6ff7 TL |
2347 | unsigned int, |
2348 | struct iaddr, struct hardware *)); | |
98bd7ca0 DH |
2349 | extern void (*dhcpv6_packet_handler)(struct interface_info *, |
2350 | const char *, int, | |
2351 | int, const struct iaddr *, isc_boolean_t); | |
cc26de46 | 2352 | extern struct timeout *timeouts; |
4fe74d72 | 2353 | extern omapi_object_type_t *dhcp_type_interface; |
f3aad410 | 2354 | #if defined (TRACING) |
06eb8bab SK |
2355 | extern trace_type_t *interface_trace; |
2356 | extern trace_type_t *inpacket_trace; | |
2357 | extern trace_type_t *outpacket_trace; | |
f3aad410 TL |
2358 | #endif |
2359 | extern struct interface_info **interface_vector; | |
2360 | extern int interface_count; | |
2361 | extern int interface_max; | |
98bd7ca0 DH |
2362 | isc_result_t interface_initialize(omapi_object_t *, const char *, int); |
2363 | void discover_interfaces(int); | |
20916cae | 2364 | int setup_fallback (struct interface_info **, const char *, int); |
4fe74d72 | 2365 | int if_readsocket PROTO ((omapi_object_t *)); |
41fb155b | 2366 | void reinitialize_interfaces PROTO ((void)); |
f3aad410 TL |
2367 | |
2368 | /* dispatch.c */ | |
88cd8aca | 2369 | void set_time(TIME); |
f3aad410 | 2370 | struct timeval *process_outstanding_timeouts (struct timeval *); |
6e5ed8bf | 2371 | void dispatch PROTO ((void)); |
98bd7ca0 DH |
2372 | isc_result_t got_one(omapi_object_t *); |
2373 | isc_result_t got_one_v6(omapi_object_t *); | |
4fe74d72 TL |
2374 | isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *, |
2375 | omapi_data_string_t *, omapi_typed_data_t *); | |
2376 | isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *, | |
2377 | omapi_data_string_t *, omapi_value_t **); | |
4bd8800e | 2378 | isc_result_t interface_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2379 | isc_result_t interface_signal_handler (omapi_object_t *, |
2380 | const char *, va_list); | |
4fe74d72 TL |
2381 | isc_result_t interface_stuff_values (omapi_object_t *, |
2382 | omapi_object_t *, | |
2383 | omapi_object_t *); | |
2384 | ||
be62cf06 | 2385 | void add_timeout PROTO ((struct timeval *, void (*) PROTO ((void *)), void *, |
76d5bd36 | 2386 | tvref_t, tvunref_t)); |
6e5ed8bf | 2387 | void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *)); |
d758ad8c TL |
2388 | void cancel_all_timeouts (void); |
2389 | void relinquish_timeouts (void); | |
2390 | #if 0 | |
b1b7b521 | 2391 | struct protocol *add_protocol PROTO ((const char *, int, |
29f5e9ce TL |
2392 | void (*) PROTO ((struct protocol *)), |
2393 | void *)); | |
d7837182 | 2394 | |
5a526cf8 | 2395 | void remove_protocol PROTO ((struct protocol *)); |
d758ad8c | 2396 | #endif |
20916cae | 2397 | OMAPI_OBJECT_ALLOC_DECL (interface, |
165bce70 | 2398 | struct interface_info, dhcp_type_interface) |
5a526cf8 | 2399 | |
d7837182 | 2400 | /* tables.c */ |
f7fdb216 | 2401 | extern char *default_option_format; |
102ee7e9 | 2402 | extern struct universe dhcp_universe; |
98bd7ca0 | 2403 | extern struct universe dhcpv6_universe; |
432604c3 | 2404 | extern struct universe nwip_universe; |
432604c3 | 2405 | extern struct universe fqdn_universe; |
98bd7ca0 | 2406 | extern struct universe vsio_universe; |
27fe61a7 TL |
2407 | extern int dhcp_option_default_priority_list []; |
2408 | extern int dhcp_option_default_priority_list_count; | |
b1b7b521 | 2409 | extern const char *hardware_types [256]; |
06eb8bab SK |
2410 | extern int universe_count, universe_max; |
2411 | extern struct universe **universes; | |
98311e4b | 2412 | extern universe_hash_t *universe_hash; |
516cf43a | 2413 | void initialize_common_option_spaces PROTO ((void)); |
06eb8bab | 2414 | extern struct universe *config_universe; |
516cf43a TL |
2415 | |
2416 | /* stables.c */ | |
d9eefc5d | 2417 | #if defined (FAILOVER_PROTOCOL) |
76d5bd36 TL |
2418 | extern failover_option_t null_failover_option; |
2419 | extern failover_option_t skip_failover_option; | |
2420 | extern struct failover_option_info ft_options []; | |
2421 | extern u_int32_t fto_allowed []; | |
2422 | extern int ft_sizes []; | |
2423 | extern const char *dhcp_flink_state_names []; | |
d9eefc5d | 2424 | #endif |
007e3ee4 TL |
2425 | extern const char *binding_state_names []; |
2426 | ||
516cf43a | 2427 | extern struct universe agent_universe; |
516cf43a | 2428 | extern struct universe server_universe; |
dbcc689e TL |
2429 | |
2430 | extern struct enumeration ddns_styles; | |
625f7cee | 2431 | extern struct enumeration syslog_enum; |
516cf43a | 2432 | void initialize_server_option_spaces PROTO ((void)); |
d7837182 | 2433 | |
089fb364 | 2434 | /* inet.c */ |
1358b874 | 2435 | struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr)); |
73fd5718 | 2436 | struct iaddr ip_addr PROTO ((struct iaddr, struct iaddr, u_int32_t)); |
69ea1884 | 2437 | struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr)); |
73fd5718 | 2438 | u_int32_t host_addr PROTO ((struct iaddr, struct iaddr)); |
1358b874 | 2439 | int addr_eq PROTO ((struct iaddr, struct iaddr)); |
febbd402 | 2440 | int addr_match(struct iaddr *, struct iaddrmatch *); |
98bd7ca0 DH |
2441 | int addr_cmp(const struct iaddr *a1, const struct iaddr *a2); |
2442 | int addr_or(struct iaddr *result, | |
2443 | const struct iaddr *a1, const struct iaddr *a2); | |
2444 | int addr_and(struct iaddr *result, | |
2445 | const struct iaddr *a1, const struct iaddr *a2); | |
9b21e73e | 2446 | isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits); |
98bd7ca0 DH |
2447 | isc_result_t range2cidr(struct iaddrcidrnetlist **result, |
2448 | const struct iaddr *lo, const struct iaddr *hi); | |
2449 | isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result); | |
2450 | const char *piaddr PROTO ((struct iaddr)); | |
2451 | char *piaddrmask(struct iaddr *, struct iaddr *); | |
2452 | char *piaddrcidr(const struct iaddr *, unsigned int); | |
95821729 TL |
2453 | |
2454 | /* dhclient.c */ | |
8ea19a71 DH |
2455 | extern int nowait; |
2456 | ||
420d8b3f FD |
2457 | extern int wanted_ia_na; |
2458 | extern int wanted_ia_ta; | |
2459 | extern int wanted_ia_pd; | |
2460 | ||
b1b7b521 TL |
2461 | extern const char *path_dhclient_conf; |
2462 | extern const char *path_dhclient_db; | |
2463 | extern const char *path_dhclient_pid; | |
e47988bf | 2464 | extern char *path_dhclient_script; |
5a526cf8 | 2465 | extern int interfaces_requested; |
98bd7ca0 | 2466 | extern struct data_string default_duid; |
cc26de46 TL |
2467 | |
2468 | extern struct client_config top_level_config; | |
2469 | ||
abe9a343 TL |
2470 | void dhcpoffer PROTO ((struct packet *)); |
2471 | void dhcpack PROTO ((struct packet *)); | |
2472 | void dhcpnak PROTO ((struct packet *)); | |
cc26de46 | 2473 | |
6e5ed8bf TL |
2474 | void send_discover PROTO ((void *)); |
2475 | void send_request PROTO ((void *)); | |
2476 | void send_release PROTO ((void *)); | |
2477 | void send_decline PROTO ((void *)); | |
cc26de46 | 2478 | |
6e5ed8bf TL |
2479 | void state_reboot PROTO ((void *)); |
2480 | void state_init PROTO ((void *)); | |
2481 | void state_selecting PROTO ((void *)); | |
2482 | void state_requesting PROTO ((void *)); | |
2483 | void state_bound PROTO ((void *)); | |
d758ad8c | 2484 | void state_stop PROTO ((void *)); |
6e5ed8bf | 2485 | void state_panic PROTO ((void *)); |
cc26de46 | 2486 | |
734d2258 | 2487 | void bind_lease PROTO ((struct client_state *)); |
0c7802b1 | 2488 | |
734d2258 | 2489 | void make_client_options PROTO ((struct client_state *, |
27fe61a7 TL |
2490 | struct client_lease *, u_int8_t *, |
2491 | struct option_cache *, struct iaddr *, | |
0c20eab3 | 2492 | struct option **, struct option_state **)); |
734d2258 TL |
2493 | void make_discover PROTO ((struct client_state *, struct client_lease *)); |
2494 | void make_request PROTO ((struct client_state *, struct client_lease *)); | |
2495 | void make_decline PROTO ((struct client_state *, struct client_lease *)); | |
2496 | void make_release PROTO ((struct client_state *, struct client_lease *)); | |
cc26de46 | 2497 | |
27fe61a7 | 2498 | void destroy_client_lease PROTO ((struct client_lease *)); |
cc26de46 | 2499 | void rewrite_client_leases PROTO ((void)); |
432604c3 | 2500 | void write_lease_option (struct option_cache *, struct packet *, |
159bcce3 TL |
2501 | struct lease *, struct client_state *, |
2502 | struct option_state *, struct option_state *, | |
2503 | struct binding_scope **, struct universe *, void *); | |
007e3ee4 TL |
2504 | int write_client_lease PROTO ((struct client_state *, |
2505 | struct client_lease *, int, int)); | |
98bd7ca0 DH |
2506 | isc_result_t write_client6_lease(struct client_state *client, |
2507 | struct dhc6_lease *lease, | |
2508 | int rewrite, int sync); | |
32a47563 | 2509 | int dhcp_option_ev_name (char *, size_t, struct option *); |
cc26de46 | 2510 | |
b1b7b521 | 2511 | void script_init PROTO ((struct client_state *, const char *, |
6b3b97e1 | 2512 | struct string_list *)); |
432604c3 | 2513 | void client_option_envadd (struct option_cache *, struct packet *, |
159bcce3 TL |
2514 | struct lease *, struct client_state *, |
2515 | struct option_state *, struct option_state *, | |
2516 | struct binding_scope **, struct universe *, void *); | |
734d2258 | 2517 | void script_write_params PROTO ((struct client_state *, |
b1b7b521 | 2518 | const char *, struct client_lease *)); |
734d2258 | 2519 | int script_go PROTO ((struct client_state *)); |
32a47563 TL |
2520 | void client_envadd (struct client_state *, |
2521 | const char *, const char *, const char *, ...) | |
2522 | __attribute__((__format__(__printf__,4,5))); | |
cc26de46 | 2523 | |
6ceb9118 | 2524 | struct client_lease *packet_to_lease (struct packet *, struct client_state *); |
41fb155b | 2525 | void go_daemon PROTO ((void)); |
5a526cf8 | 2526 | void write_client_pid_file PROTO ((void)); |
5a526cf8 | 2527 | void client_location_changed PROTO ((void)); |
3f09cb5a | 2528 | void do_release PROTO ((struct client_state *)); |
20916cae TL |
2529 | int dhclient_interface_shutdown_hook (struct interface_info *); |
2530 | int dhclient_interface_discovery_hook (struct interface_info *); | |
c1f22aef | 2531 | isc_result_t dhclient_interface_startup_hook (struct interface_info *); |
98bd7ca0 DH |
2532 | void dhclient_schedule_updates(struct client_state *client, |
2533 | struct iaddr *addr, int offset); | |
98311e4b | 2534 | void client_dns_update_timeout (void *cp); |
98bd7ca0 DH |
2535 | isc_result_t client_dns_update(struct client_state *client, int, int, |
2536 | struct iaddr *); | |
2537 | ||
2538 | void dhcpv4_client_assignments(void); | |
2539 | void dhcpv6_client_assignments(void); | |
2540 | ||
2541 | /* dhc6.c */ | |
06eb8bab | 2542 | void form_duid(struct data_string *duid, const char *file, int line); |
e32529a5 | 2543 | void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line); |
98bd7ca0 | 2544 | void start_init6(struct client_state *client); |
3dbe2246 | 2545 | void start_info_request6(struct client_state *client); |
98bd7ca0 | 2546 | void start_confirm6(struct client_state *client); |
af5fa176 | 2547 | void start_release6(struct client_state *client); |
98bd7ca0 | 2548 | void start_selecting6(struct client_state *client); |
af5fa176 | 2549 | void unconfigure6(struct client_state *client, const char *reason); |
95821729 | 2550 | |
1358b874 TL |
2551 | /* db.c */ |
2552 | int write_lease PROTO ((struct lease *)); | |
4fe74d72 | 2553 | int write_host PROTO ((struct host_decl *)); |
6705543f | 2554 | int write_server_duid(void); |
a7982987 TL |
2555 | #if defined (FAILOVER_PROTOCOL) |
2556 | int write_failover_state (dhcp_failover_state_t *); | |
2557 | #endif | |
804401cc | 2558 | int db_printable PROTO ((const unsigned char *)); |
cfdfb9f1 | 2559 | int db_printable_len PROTO ((const unsigned char *, unsigned)); |
f7fdb216 | 2560 | isc_result_t write_named_billing_class(const void *, unsigned, void *); |
875d2b66 | 2561 | void write_billing_classes (void); |
112a6c2c | 2562 | int write_billing_class PROTO ((struct class *)); |
98311e4b | 2563 | void commit_leases_timeout PROTO ((void *)); |
6368a1bd | 2564 | void commit_leases_readerdry(void *); |
1358b874 | 2565 | int commit_leases PROTO ((void)); |
fde86d2d | 2566 | void db_startup PROTO ((int)); |
d758ad8c | 2567 | int new_lease_file PROTO ((void)); |
20916cae | 2568 | int group_writer (struct group_object *); |
9322442f | 2569 | int write_ia(const struct ia_xx *); |
17b95f41 TL |
2570 | |
2571 | /* packet.c */ | |
b1b7b521 | 2572 | u_int32_t checksum PROTO ((unsigned char *, unsigned, u_int32_t)); |
e5078937 | 2573 | u_int32_t wrapsum PROTO ((u_int32_t)); |
17b95f41 | 2574 | void assemble_hw_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 2575 | unsigned *, struct hardware *)); |
17b95f41 | 2576 | void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 TL |
2577 | unsigned *, u_int32_t, u_int32_t, |
2578 | u_int32_t, unsigned char *, unsigned)); | |
4595a58c | 2579 | ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 2580 | unsigned, struct hardware *)); |
4595a58c | 2581 | ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 2582 | unsigned, struct sockaddr_in *, |
83c0372e | 2583 | unsigned, unsigned *)); |
ab370123 | 2584 | |
7d29d66d TL |
2585 | /* ethernet.c */ |
2586 | void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *, | |
b1b7b521 | 2587 | unsigned *, struct hardware *)); |
7d29d66d TL |
2588 | ssize_t decode_ethernet_header PROTO ((struct interface_info *, |
2589 | unsigned char *, | |
b1b7b521 | 2590 | unsigned, struct hardware *)); |
7d29d66d TL |
2591 | |
2592 | /* tr.c */ | |
2593 | void assemble_tr_header PROTO ((struct interface_info *, unsigned char *, | |
b1b7b521 | 2594 | unsigned *, struct hardware *)); |
7d29d66d TL |
2595 | ssize_t decode_tr_header PROTO ((struct interface_info *, |
2596 | unsigned char *, | |
b1b7b521 | 2597 | unsigned, struct hardware *)); |
7d29d66d | 2598 | |
ab370123 | 2599 | /* dhxpxlt.c */ |
fde86d2d TL |
2600 | void convert_statement PROTO ((struct parse *)); |
2601 | void convert_host_statement PROTO ((struct parse *, jrefproto)); | |
2602 | void convert_host_name PROTO ((struct parse *, jrefproto)); | |
2603 | void convert_class_statement PROTO ((struct parse *, jrefproto, int)); | |
2604 | void convert_class_decl PROTO ((struct parse *, jrefproto)); | |
2605 | void convert_lease_time PROTO ((struct parse *, jrefproto, char *)); | |
2606 | void convert_shared_net_statement PROTO ((struct parse *, jrefproto)); | |
2607 | void convert_subnet_statement PROTO ((struct parse *, jrefproto)); | |
2608 | void convert_subnet_decl PROTO ((struct parse *, jrefproto)); | |
2609 | void convert_host_decl PROTO ((struct parse *, jrefproto)); | |
2610 | void convert_hardware_decl PROTO ((struct parse *, jrefproto)); | |
2611 | void convert_hardware_addr PROTO ((struct parse *, jrefproto)); | |
2612 | void convert_filename_decl PROTO ((struct parse *, jrefproto)); | |
2613 | void convert_servername_decl PROTO ((struct parse *, jrefproto)); | |
2614 | void convert_ip_addr_or_hostname PROTO ((struct parse *, jrefproto, int)); | |
2615 | void convert_fixed_addr_decl PROTO ((struct parse *, jrefproto)); | |
2616 | void convert_option_decl PROTO ((struct parse *, jrefproto)); | |
fde86d2d TL |
2617 | void convert_lease_statement PROTO ((struct parse *, jrefproto)); |
2618 | void convert_address_range PROTO ((struct parse *, jrefproto)); | |
2619 | void convert_date PROTO ((struct parse *, jrefproto, char *)); | |
2620 | void convert_numeric_aggregate PROTO ((struct parse *, jrefproto, int, int, int, int)); | |
ab370123 | 2621 | void indent PROTO ((int)); |
469cf3a4 TL |
2622 | |
2623 | /* route.c */ | |
2624 | void add_route_direct PROTO ((struct interface_info *, struct in_addr)); | |
2625 | void add_route_net PROTO ((struct interface_info *, struct in_addr, | |
2626 | struct in_addr)); | |
2627 | void add_route_default_gateway PROTO ((struct interface_info *, | |
2628 | struct in_addr)); | |
2629 | void remove_routes PROTO ((struct in_addr)); | |
2630 | void remove_if_route PROTO ((struct interface_info *, struct in_addr)); | |
2631 | void remove_all_if_routes PROTO ((struct interface_info *)); | |
2632 | void set_netmask PROTO ((struct interface_info *, struct in_addr)); | |
2633 | void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr)); | |
2634 | void set_ip_address PROTO ((struct interface_info *, struct in_addr)); | |
cc26de46 TL |
2635 | |
2636 | /* clparse.c */ | |
fde86d2d | 2637 | isc_result_t read_client_conf PROTO ((void)); |
d758ad8c TL |
2638 | int read_client_conf_file (const char *, |
2639 | struct interface_info *, struct client_config *); | |
cc26de46 | 2640 | void read_client_leases PROTO ((void)); |
fde86d2d | 2641 | void parse_client_statement PROTO ((struct parse *, struct interface_info *, |
cc26de46 | 2642 | struct client_config *)); |
b1b7b521 | 2643 | int parse_X PROTO ((struct parse *, u_int8_t *, unsigned)); |
0c20eab3 | 2644 | int parse_option_list PROTO ((struct parse *, struct option ***)); |
fde86d2d | 2645 | void parse_interface_declaration PROTO ((struct parse *, |
734d2258 | 2646 | struct client_config *, char *)); |
20916cae | 2647 | int interface_or_dummy PROTO ((struct interface_info **, const char *)); |
734d2258 TL |
2648 | void make_client_state PROTO ((struct client_state **)); |
2649 | void make_client_config PROTO ((struct client_state *, | |
41fb155b | 2650 | struct client_config *)); |
fde86d2d TL |
2651 | void parse_client_lease_statement PROTO ((struct parse *, int)); |
2652 | void parse_client_lease_declaration PROTO ((struct parse *, | |
2653 | struct client_lease *, | |
734d2258 TL |
2654 | struct interface_info **, |
2655 | struct client_state **)); | |
fde86d2d TL |
2656 | int parse_option_decl PROTO ((struct option_cache **, struct parse *)); |
2657 | void parse_string_list PROTO ((struct parse *, struct string_list **, int)); | |
2658 | int parse_ip_addr PROTO ((struct parse *, struct iaddr *)); | |
d19e2cf7 | 2659 | int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *); |
fde86d2d | 2660 | void parse_reject_statement PROTO ((struct parse *, struct client_config *)); |
6b3b97e1 | 2661 | |
6e5ed8bf | 2662 | /* icmp.c */ |
d758ad8c TL |
2663 | OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp) |
2664 | extern struct icmp_state *icmp_state; | |
6e5ed8bf | 2665 | void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr, |
fa25cc03 | 2666 | u_int8_t *, int)))); |
4fe74d72 | 2667 | int icmp_readsocket PROTO ((omapi_object_t *)); |
6e5ed8bf | 2668 | int icmp_echorequest PROTO ((struct iaddr *)); |
4fe74d72 | 2669 | isc_result_t icmp_echoreply PROTO ((omapi_object_t *)); |
83c1b012 TL |
2670 | |
2671 | /* dns.c */ | |
7d9784f6 | 2672 | #if defined (NSUPDATE) |
aa8579c0 | 2673 | isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *); |
7d9784f6 TL |
2674 | void tkey_free (ns_tsig_key **); |
2675 | #endif | |
3f09cb5a TL |
2676 | isc_result_t enter_dns_zone (struct dns_zone *); |
2677 | isc_result_t dns_zone_lookup (struct dns_zone **, const char *); | |
3f09cb5a | 2678 | int dns_zone_dereference PROTO ((struct dns_zone **, const char *, int)); |
29a026db | 2679 | #if defined (NSUPDATE) |
a861af5a TL |
2680 | isc_result_t find_cached_zone (const char *, ns_class, char *, |
2681 | size_t, struct in_addr *, int, int *, | |
2682 | struct dns_zone **); | |
aa8579c0 TL |
2683 | void forget_zone (struct dns_zone **); |
2684 | void repudiate_zone (struct dns_zone **); | |
b2398d97 | 2685 | void cache_found_zone (ns_class, char *, struct in_addr *, int); |
d758ad8c | 2686 | int get_dhcid (struct data_string *, int, const u_int8_t *, unsigned); |
98bd7ca0 DH |
2687 | isc_result_t ddns_update_fwd(struct data_string *, struct iaddr, |
2688 | struct data_string *, unsigned long, unsigned, | |
2689 | unsigned); | |
2690 | isc_result_t ddns_remove_fwd(struct data_string *, | |
2691 | struct iaddr, struct data_string *); | |
29a026db | 2692 | #endif /* NSUPDATE */ |
0c7802b1 TL |
2693 | |
2694 | /* resolv.c */ | |
2695 | extern char path_resolv_conf []; | |
06eb8bab SK |
2696 | extern struct name_server *name_servers; |
2697 | extern struct domain_search_list *domains; | |
0c7802b1 TL |
2698 | |
2699 | void read_resolv_conf PROTO ((TIME)); | |
94f08824 | 2700 | struct name_server *first_name_server PROTO ((void)); |
2b60cc68 TL |
2701 | |
2702 | /* inet_addr.c */ | |
2703 | #ifdef NEED_INET_ATON | |
27fe61a7 | 2704 | int inet_aton PROTO ((const char *, struct in_addr *)); |
2b60cc68 | 2705 | #endif |
5a526cf8 | 2706 | |
102ee7e9 | 2707 | /* class.c */ |
112a6c2c | 2708 | extern int have_billing_classes; |
102ee7e9 TL |
2709 | struct class unknown_class; |
2710 | struct class known_class; | |
2711 | struct collection default_collection; | |
8bdd4d02 | 2712 | struct collection *collections; |
06eb8bab | 2713 | extern struct executable_statement *default_classification_rules; |
102ee7e9 TL |
2714 | |
2715 | void classification_setup PROTO ((void)); | |
2716 | void classify_client PROTO ((struct packet *)); | |
da38df14 TL |
2717 | int check_collection PROTO ((struct packet *, struct lease *, |
2718 | struct collection *)); | |
102ee7e9 | 2719 | void classify PROTO ((struct packet *, struct class *)); |
899d754f | 2720 | isc_result_t unlink_class PROTO((struct class **class)); |
20916cae TL |
2721 | isc_result_t find_class PROTO ((struct class **, const char *, |
2722 | const char *, int)); | |
112a6c2c TL |
2723 | int unbill_class PROTO ((struct lease *, struct class *)); |
2724 | int bill_class PROTO ((struct lease *, struct class *)); | |
2b9b6ff7 TL |
2725 | |
2726 | /* execute.c */ | |
1b234d44 | 2727 | int execute_statements PROTO ((struct binding_value **result, |
159bcce3 TL |
2728 | struct packet *, struct lease *, |
2729 | struct client_state *, | |
4f58da18 | 2730 | struct option_state *, struct option_state *, |
6ceb9118 | 2731 | struct binding_scope **, |
2b9b6ff7 | 2732 | struct executable_statement *)); |
1b234d44 | 2733 | void execute_statements_in_scope PROTO ((struct binding_value **result, |
159bcce3 TL |
2734 | struct packet *, struct lease *, |
2735 | struct client_state *, | |
112a6c2c | 2736 | struct option_state *, |
2b9b6ff7 | 2737 | struct option_state *, |
6ceb9118 | 2738 | struct binding_scope **, |
2b9b6ff7 | 2739 | struct group *, struct group *)); |
7f6ad5ac TL |
2740 | int executable_statement_dereference PROTO ((struct executable_statement **, |
2741 | const char *, int)); | |
2742 | void write_statements (FILE *, struct executable_statement *, int); | |
932d739c | 2743 | int find_matching_case (struct executable_statement **, |
159bcce3 | 2744 | struct packet *, struct lease *, struct client_state *, |
932d739c | 2745 | struct option_state *, struct option_state *, |
6ceb9118 | 2746 | struct binding_scope **, |
932d739c | 2747 | struct expression *, struct executable_statement *); |
d758ad8c TL |
2748 | int executable_statement_foreach (struct executable_statement *, |
2749 | int (*) (struct executable_statement *, | |
2750 | void *, int), void *, int); | |
74f45f96 | 2751 | |
20916cae | 2752 | /* comapi.c */ |
4fe74d72 | 2753 | extern omapi_object_type_t *dhcp_type_group; |
4fe74d72 TL |
2754 | extern omapi_object_type_t *dhcp_type_shared_network; |
2755 | extern omapi_object_type_t *dhcp_type_subnet; | |
d758ad8c TL |
2756 | extern omapi_object_type_t *dhcp_type_control; |
2757 | extern dhcp_control_object_t *dhcp_control_object; | |
20916cae TL |
2758 | |
2759 | void dhcp_common_objects_setup (void); | |
2760 | ||
2761 | isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *, | |
2762 | omapi_data_string_t *, | |
2763 | omapi_typed_data_t *); | |
2764 | isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *, | |
2765 | omapi_data_string_t *, | |
2766 | omapi_value_t **); | |
2767 | isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int); | |
2768 | isc_result_t dhcp_group_signal_handler (omapi_object_t *, | |
2769 | const char *, va_list); | |
2770 | isc_result_t dhcp_group_stuff_values (omapi_object_t *, | |
2771 | omapi_object_t *, | |
2772 | omapi_object_t *); | |
2773 | isc_result_t dhcp_group_lookup (omapi_object_t **, | |
2774 | omapi_object_t *, omapi_object_t *); | |
2775 | isc_result_t dhcp_group_create (omapi_object_t **, | |
2776 | omapi_object_t *); | |
2777 | isc_result_t dhcp_group_remove (omapi_object_t *, | |
2778 | omapi_object_t *); | |
2779 | ||
d758ad8c TL |
2780 | isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *, |
2781 | omapi_data_string_t *, | |
2782 | omapi_typed_data_t *); | |
2783 | isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *, | |
2784 | omapi_data_string_t *, | |
2785 | omapi_value_t **); | |
2786 | isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int); | |
2787 | isc_result_t dhcp_control_signal_handler (omapi_object_t *, | |
2788 | const char *, va_list); | |
2789 | isc_result_t dhcp_control_stuff_values (omapi_object_t *, | |
2790 | omapi_object_t *, | |
2791 | omapi_object_t *); | |
2792 | isc_result_t dhcp_control_lookup (omapi_object_t **, | |
2793 | omapi_object_t *, omapi_object_t *); | |
2794 | isc_result_t dhcp_control_create (omapi_object_t **, | |
2795 | omapi_object_t *); | |
2796 | isc_result_t dhcp_control_remove (omapi_object_t *, | |
2797 | omapi_object_t *); | |
2798 | ||
20916cae TL |
2799 | isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *, |
2800 | omapi_data_string_t *, | |
2801 | omapi_typed_data_t *); | |
2802 | isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *, | |
2803 | omapi_data_string_t *, | |
2804 | omapi_value_t **); | |
2805 | isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int); | |
2806 | isc_result_t dhcp_subnet_signal_handler (omapi_object_t *, | |
2807 | const char *, va_list); | |
2808 | isc_result_t dhcp_subnet_stuff_values (omapi_object_t *, | |
2809 | omapi_object_t *, | |
2810 | omapi_object_t *); | |
2811 | isc_result_t dhcp_subnet_lookup (omapi_object_t **, | |
2812 | omapi_object_t *, omapi_object_t *); | |
2813 | isc_result_t dhcp_subnet_create (omapi_object_t **, | |
2814 | omapi_object_t *); | |
2815 | isc_result_t dhcp_subnet_remove (omapi_object_t *, | |
2816 | omapi_object_t *); | |
2817 | ||
2818 | isc_result_t dhcp_shared_network_set_value (omapi_object_t *, | |
2819 | omapi_object_t *, | |
2820 | omapi_data_string_t *, | |
2821 | omapi_typed_data_t *); | |
2822 | isc_result_t dhcp_shared_network_get_value (omapi_object_t *, | |
2823 | omapi_object_t *, | |
2824 | omapi_data_string_t *, | |
2825 | omapi_value_t **); | |
2826 | isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int); | |
2827 | isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *, | |
2828 | const char *, va_list); | |
2829 | isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *, | |
2830 | omapi_object_t *, | |
2831 | omapi_object_t *); | |
2832 | isc_result_t dhcp_shared_network_lookup (omapi_object_t **, | |
2833 | omapi_object_t *, omapi_object_t *); | |
2834 | isc_result_t dhcp_shared_network_create (omapi_object_t **, | |
2835 | omapi_object_t *); | |
2836 | isc_result_t dhcp_shared_network_remove (omapi_object_t *, | |
2837 | omapi_object_t *); | |
2838 | ||
2839 | /* omapi.c */ | |
2840 | extern int (*dhcp_interface_shutdown_hook) (struct interface_info *); | |
2841 | ||
2842 | extern omapi_object_type_t *dhcp_type_lease; | |
2843 | extern omapi_object_type_t *dhcp_type_pool; | |
4fe74d72 | 2844 | extern omapi_object_type_t *dhcp_type_class; |
899d754f | 2845 | extern omapi_object_type_t *dhcp_type_subclass; |
bdcaf7b9 | 2846 | |
d9eefc5d TL |
2847 | #if defined (FAILOVER_PROTOCOL) |
2848 | extern omapi_object_type_t *dhcp_type_failover_state; | |
2849 | extern omapi_object_type_t *dhcp_type_failover_link; | |
2850 | extern omapi_object_type_t *dhcp_type_failover_listener; | |
2851 | #endif | |
4fe74d72 TL |
2852 | |
2853 | void dhcp_db_objects_setup (void); | |
2854 | ||
2855 | isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *, | |
2856 | omapi_data_string_t *, | |
2857 | omapi_typed_data_t *); | |
2858 | isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *, | |
2859 | omapi_data_string_t *, | |
2860 | omapi_value_t **); | |
4bd8800e | 2861 | isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2862 | isc_result_t dhcp_lease_signal_handler (omapi_object_t *, |
2863 | const char *, va_list); | |
4fe74d72 TL |
2864 | isc_result_t dhcp_lease_stuff_values (omapi_object_t *, |
2865 | omapi_object_t *, | |
2866 | omapi_object_t *); | |
2867 | isc_result_t dhcp_lease_lookup (omapi_object_t **, | |
2868 | omapi_object_t *, omapi_object_t *); | |
2869 | isc_result_t dhcp_lease_create (omapi_object_t **, | |
2870 | omapi_object_t *); | |
ccce1cc6 | 2871 | isc_result_t dhcp_lease_remove (omapi_object_t *, |
3c48d369 | 2872 | omapi_object_t *); |
4fe74d72 TL |
2873 | isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *, |
2874 | omapi_data_string_t *, | |
2875 | omapi_typed_data_t *); | |
2876 | isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *, | |
2877 | omapi_data_string_t *, | |
2878 | omapi_value_t **); | |
4bd8800e | 2879 | isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2880 | isc_result_t dhcp_host_signal_handler (omapi_object_t *, |
2881 | const char *, va_list); | |
4fe74d72 TL |
2882 | isc_result_t dhcp_host_stuff_values (omapi_object_t *, |
2883 | omapi_object_t *, | |
2884 | omapi_object_t *); | |
2885 | isc_result_t dhcp_host_lookup (omapi_object_t **, | |
2886 | omapi_object_t *, omapi_object_t *); | |
2887 | isc_result_t dhcp_host_create (omapi_object_t **, | |
2888 | omapi_object_t *); | |
ccce1cc6 | 2889 | isc_result_t dhcp_host_remove (omapi_object_t *, |
3c48d369 | 2890 | omapi_object_t *); |
4fe74d72 TL |
2891 | isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *, |
2892 | omapi_data_string_t *, | |
2893 | omapi_typed_data_t *); | |
2894 | isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *, | |
2895 | omapi_data_string_t *, | |
2896 | omapi_value_t **); | |
4bd8800e | 2897 | isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2898 | isc_result_t dhcp_pool_signal_handler (omapi_object_t *, |
2899 | const char *, va_list); | |
4fe74d72 TL |
2900 | isc_result_t dhcp_pool_stuff_values (omapi_object_t *, |
2901 | omapi_object_t *, | |
2902 | omapi_object_t *); | |
2903 | isc_result_t dhcp_pool_lookup (omapi_object_t **, | |
2904 | omapi_object_t *, omapi_object_t *); | |
2905 | isc_result_t dhcp_pool_create (omapi_object_t **, | |
2906 | omapi_object_t *); | |
ccce1cc6 | 2907 | isc_result_t dhcp_pool_remove (omapi_object_t *, |
3c48d369 | 2908 | omapi_object_t *); |
20916cae TL |
2909 | isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *, |
2910 | omapi_data_string_t *, | |
2911 | omapi_typed_data_t *); | |
2912 | isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *, | |
2913 | omapi_data_string_t *, | |
2914 | omapi_value_t **); | |
2915 | isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int); | |
2916 | isc_result_t dhcp_class_signal_handler (omapi_object_t *, | |
2917 | const char *, va_list); | |
2918 | isc_result_t dhcp_class_stuff_values (omapi_object_t *, | |
2919 | omapi_object_t *, | |
2920 | omapi_object_t *); | |
2921 | isc_result_t dhcp_class_lookup (omapi_object_t **, | |
2922 | omapi_object_t *, omapi_object_t *); | |
2923 | isc_result_t dhcp_class_create (omapi_object_t **, | |
2924 | omapi_object_t *); | |
2925 | isc_result_t dhcp_class_remove (omapi_object_t *, | |
2926 | omapi_object_t *); | |
c1f22aef TL |
2927 | isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *, |
2928 | omapi_data_string_t *, | |
2929 | omapi_typed_data_t *); | |
2930 | isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *, | |
2931 | omapi_data_string_t *, | |
2932 | omapi_value_t **); | |
2933 | isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int); | |
2934 | isc_result_t dhcp_subclass_signal_handler (omapi_object_t *, | |
2935 | const char *, va_list); | |
2936 | isc_result_t dhcp_subclass_stuff_values (omapi_object_t *, | |
2937 | omapi_object_t *, | |
2938 | omapi_object_t *); | |
2939 | isc_result_t dhcp_subclass_lookup (omapi_object_t **, | |
2940 | omapi_object_t *, omapi_object_t *); | |
2941 | isc_result_t dhcp_subclass_create (omapi_object_t **, | |
2942 | omapi_object_t *); | |
2943 | isc_result_t dhcp_subclass_remove (omapi_object_t *, | |
2944 | omapi_object_t *); | |
20916cae TL |
2945 | isc_result_t dhcp_interface_set_value (omapi_object_t *, |
2946 | omapi_object_t *, | |
2947 | omapi_data_string_t *, | |
2948 | omapi_typed_data_t *); | |
2949 | isc_result_t dhcp_interface_get_value (omapi_object_t *, | |
2950 | omapi_object_t *, | |
2951 | omapi_data_string_t *, | |
2952 | omapi_value_t **); | |
2953 | isc_result_t dhcp_interface_destroy (omapi_object_t *, | |
2954 | const char *, int); | |
2955 | isc_result_t dhcp_interface_signal_handler (omapi_object_t *, | |
2956 | const char *, | |
2957 | va_list ap); | |
2958 | isc_result_t dhcp_interface_stuff_values (omapi_object_t *, | |
2959 | omapi_object_t *, | |
2960 | omapi_object_t *); | |
2961 | isc_result_t dhcp_interface_lookup (omapi_object_t **, | |
2962 | omapi_object_t *, | |
2963 | omapi_object_t *); | |
2964 | isc_result_t dhcp_interface_create (omapi_object_t **, | |
2965 | omapi_object_t *); | |
2966 | isc_result_t dhcp_interface_remove (omapi_object_t *, | |
2967 | omapi_object_t *); | |
f3aad410 TL |
2968 | void interface_stash (struct interface_info *); |
2969 | void interface_snorf (struct interface_info *, int); | |
4fe74d72 | 2970 | |
d758ad8c TL |
2971 | isc_result_t binding_scope_set_value (struct binding_scope *, int, |
2972 | omapi_data_string_t *, | |
2973 | omapi_typed_data_t *); | |
2974 | isc_result_t binding_scope_get_value (omapi_value_t **, | |
2975 | struct binding_scope *, | |
2976 | omapi_data_string_t *); | |
2977 | isc_result_t binding_scope_stuff_values (omapi_object_t *, | |
2978 | struct binding_scope *); | |
2979 | ||
6368a1bd DH |
2980 | void register_eventhandler(struct eventqueue **, void (*handler)(void *)); |
2981 | void unregister_eventhandler(struct eventqueue **, void (*handler)(void *)); | |
2982 | void trigger_event(struct eventqueue **); | |
2983 | ||
940ea8ab TL |
2984 | /* mdb.c */ |
2985 | ||
8c8e27c5 TL |
2986 | extern struct subnet *subnets; |
2987 | extern struct shared_network *shared_networks; | |
98311e4b DH |
2988 | extern host_hash_t *host_hw_addr_hash; |
2989 | extern host_hash_t *host_uid_hash; | |
2990 | extern host_hash_t *host_name_hash; | |
6708d944 DH |
2991 | extern lease_id_hash_t *lease_uid_hash; |
2992 | extern lease_ip_hash_t *lease_ip_addr_hash; | |
2993 | extern lease_id_hash_t *lease_hw_addr_hash; | |
940ea8ab TL |
2994 | |
2995 | extern omapi_object_type_t *dhcp_type_host; | |
2996 | ||
f3fe382d JB |
2997 | extern int numclasseswritten; |
2998 | ||
2999 | ||
899d754f JB |
3000 | isc_result_t enter_class PROTO ((struct class *, int, int)); |
3001 | isc_result_t delete_class PROTO ((struct class *, int)); | |
940ea8ab | 3002 | isc_result_t enter_host PROTO ((struct host_decl *, int, int)); |
fde86d2d | 3003 | isc_result_t delete_host PROTO ((struct host_decl *, int)); |
98bd7ca0 | 3004 | void change_host_uid(struct host_decl *host, const char *data, int len); |
20916cae TL |
3005 | int find_hosts_by_haddr PROTO ((struct host_decl **, int, |
3006 | const unsigned char *, unsigned, | |
3007 | const char *, int)); | |
3008 | int find_hosts_by_uid PROTO ((struct host_decl **, const unsigned char *, | |
3009 | unsigned, const char *, int)); | |
98bd7ca0 DH |
3010 | int find_hosts_by_option(struct host_decl **, struct packet *, |
3011 | struct option_state *, const char *, int); | |
20916cae TL |
3012 | int find_host_for_network PROTO ((struct subnet **, struct host_decl **, |
3013 | struct iaddr *, struct shared_network *)); | |
98311e4b DH |
3014 | void new_address_range PROTO ((struct parse *, struct iaddr, struct iaddr, |
3015 | struct subnet *, struct pool *, | |
3016 | struct lease **)); | |
20916cae | 3017 | isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int); |
932d739c | 3018 | isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int); |
20916cae TL |
3019 | int find_grouped_subnet PROTO ((struct subnet **, struct shared_network *, |
3020 | struct iaddr, const char *, int)); | |
98bd7ca0 | 3021 | int find_subnet(struct subnet **, struct iaddr, const char *, int); |
940ea8ab | 3022 | void enter_shared_network PROTO ((struct shared_network *)); |
70984280 TL |
3023 | void new_shared_network_interface PROTO ((struct parse *, |
3024 | struct shared_network *, | |
4bd8800e | 3025 | const char *)); |
98bd7ca0 | 3026 | int subnet_inner_than(const struct subnet *, const struct subnet *, int); |
940ea8ab TL |
3027 | void enter_subnet PROTO ((struct subnet *)); |
3028 | void enter_lease PROTO ((struct lease *)); | |
007e3ee4 | 3029 | int supersede_lease PROTO ((struct lease *, struct lease *, int, int, int)); |
e540864e | 3030 | void make_binding_state_transition (struct lease *); |
20916cae | 3031 | int lease_copy PROTO ((struct lease **, struct lease *, const char *, int)); |
e495b7d1 | 3032 | void release_lease PROTO ((struct lease *, struct packet *)); |
b1b7b521 | 3033 | void abandon_lease PROTO ((struct lease *, const char *)); |
940ea8ab | 3034 | void dissociate_lease PROTO ((struct lease *)); |
a414e627 | 3035 | void pool_timer PROTO ((void *)); |
20916cae TL |
3036 | int find_lease_by_uid PROTO ((struct lease **, const unsigned char *, |
3037 | unsigned, const char *, int)); | |
3038 | int find_lease_by_hw_addr PROTO ((struct lease **, const unsigned char *, | |
3039 | unsigned, const char *, int)); | |
3040 | int find_lease_by_ip_addr PROTO ((struct lease **, struct iaddr, | |
3041 | const char *, int)); | |
940ea8ab TL |
3042 | void uid_hash_add PROTO ((struct lease *)); |
3043 | void uid_hash_delete PROTO ((struct lease *)); | |
3044 | void hw_hash_add PROTO ((struct lease *)); | |
3045 | void hw_hash_delete PROTO ((struct lease *)); | |
d758ad8c | 3046 | int write_leases PROTO ((void)); |
98bd7ca0 | 3047 | int write_leases6(void); |
d0411fbd | 3048 | int lease_enqueue (struct lease *); |
f7fdb216 | 3049 | isc_result_t lease_instantiate(const void *, unsigned, void *); |
a414e627 | 3050 | void expire_all_pools PROTO ((void)); |
940ea8ab | 3051 | void dump_subnets PROTO ((void)); |
d758ad8c TL |
3052 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ |
3053 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
3054 | void free_everything (void); | |
3055 | #endif | |
9ba7cdec TL |
3056 | |
3057 | /* nsupdate.c */ | |
3058 | char *ddns_rev_name (struct lease *, struct lease_state *, struct packet *); | |
3059 | char *ddns_fwd_name (struct lease *, struct lease_state *, struct packet *); | |
3060 | int nsupdateA (const char *, const unsigned char *, u_int32_t, int); | |
3061 | int nsupdatePTR (const char *, const unsigned char *, u_int32_t, int); | |
3062 | void nsupdate (struct lease *, struct lease_state *, struct packet *, int); | |
3063 | int updateA (const struct data_string *, const struct data_string *, | |
3064 | unsigned int, struct lease *); | |
3065 | int updatePTR (const struct data_string *, const struct data_string *, | |
3066 | unsigned int, struct lease *); | |
91dc2849 TL |
3067 | int deleteA (const struct data_string *, const struct data_string *, |
3068 | struct lease *); | |
3069 | int deletePTR (const struct data_string *, const struct data_string *, | |
3070 | struct lease *); | |
d9eefc5d TL |
3071 | |
3072 | /* failover.c */ | |
3073 | #if defined (FAILOVER_PROTOCOL) | |
d758ad8c | 3074 | extern dhcp_failover_state_t *failover_states; |
aa8579c0 | 3075 | void dhcp_failover_startup PROTO ((void)); |
d758ad8c | 3076 | int dhcp_failover_write_all_states (void); |
aa8579c0 TL |
3077 | isc_result_t enter_failover_peer PROTO ((dhcp_failover_state_t *)); |
3078 | isc_result_t find_failover_peer PROTO ((dhcp_failover_state_t **, | |
20916cae | 3079 | const char *, const char *, int)); |
d9eefc5d TL |
3080 | isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *)); |
3081 | isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *, | |
3082 | const char *, va_list)); | |
3083 | isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *, | |
3084 | omapi_object_t *, | |
3085 | omapi_data_string_t *, | |
3086 | omapi_typed_data_t *)); | |
3087 | isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *, | |
3088 | omapi_object_t *, | |
3089 | omapi_data_string_t *, | |
3090 | omapi_value_t **)); | |
3091 | isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 3092 | const char *, int)); |
d9eefc5d TL |
3093 | isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *, |
3094 | omapi_object_t *, | |
3095 | omapi_object_t *)); | |
3096 | isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *)); | |
3097 | ||
3098 | isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *, | |
3099 | const char *, | |
3100 | va_list)); | |
3101 | isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *, | |
3102 | omapi_object_t *, | |
3103 | omapi_data_string_t *, | |
3104 | omapi_typed_data_t *)); | |
3105 | isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *, | |
3106 | omapi_object_t *, | |
3107 | omapi_data_string_t *, | |
3108 | omapi_value_t **)); | |
3109 | isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 3110 | const char *, int)); |
d9eefc5d TL |
3111 | isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *, |
3112 | omapi_object_t *, | |
3113 | omapi_object_t *)); | |
3114 | isc_result_t dhcp_failover_register PROTO ((omapi_object_t *)); | |
3115 | isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *, | |
3116 | const char *, va_list)); | |
aa8579c0 TL |
3117 | isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *, |
3118 | const char *); | |
c489f075 | 3119 | isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state); |
aa8579c0 TL |
3120 | isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *, |
3121 | enum failover_state); | |
c489f075 TL |
3122 | isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *, |
3123 | failover_message_t *); | |
2426234f DH |
3124 | void dhcp_failover_pool_rebalance (void *); |
3125 | void dhcp_failover_pool_check (struct pool *); | |
8c8e27c5 | 3126 | int dhcp_failover_state_pool_check (dhcp_failover_state_t *); |
d0411fbd TL |
3127 | void dhcp_failover_timeout (void *); |
3128 | void dhcp_failover_send_contact (void *); | |
8d3aec71 | 3129 | isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *); |
a7982987 | 3130 | isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *); |
007e3ee4 | 3131 | int dhcp_failover_queue_update (struct lease *, int); |
988c1ca7 | 3132 | int dhcp_failover_send_acks (dhcp_failover_state_t *); |
af5ad6df | 3133 | void dhcp_failover_toack_queue_timeout (void *); |
988c1ca7 | 3134 | int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg); |
f9d43a9a | 3135 | void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *); |
d9eefc5d TL |
3136 | isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *, |
3137 | omapi_object_t *, | |
3138 | omapi_data_string_t *, | |
3139 | omapi_typed_data_t *)); | |
aa8579c0 | 3140 | void dhcp_failover_keepalive (void *); |
a7982987 | 3141 | void dhcp_failover_reconnect (void *); |
c489f075 | 3142 | void dhcp_failover_startup_timeout (void *); |
8d3aec71 | 3143 | void dhcp_failover_link_startup_timeout (void *); |
a7982987 | 3144 | void dhcp_failover_listener_restart (void *); |
d9eefc5d TL |
3145 | isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *, |
3146 | omapi_object_t *, | |
3147 | omapi_data_string_t *, | |
3148 | omapi_value_t **)); | |
3149 | isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 3150 | const char *, int)); |
d9eefc5d TL |
3151 | isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *, |
3152 | omapi_object_t *, | |
3153 | omapi_object_t *)); | |
35e0fdf8 TL |
3154 | isc_result_t dhcp_failover_state_lookup PROTO ((omapi_object_t **, |
3155 | omapi_object_t *, | |
3156 | omapi_object_t *)); | |
3157 | isc_result_t dhcp_failover_state_create PROTO ((omapi_object_t **, | |
3158 | omapi_object_t *)); | |
3159 | isc_result_t dhcp_failover_state_remove PROTO ((omapi_object_t *, | |
3160 | omapi_object_t *)); | |
a7982987 | 3161 | int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned); |
a55ccdd0 DH |
3162 | int dhcp_failover_state_match_by_name(dhcp_failover_state_t *, |
3163 | failover_option_t *); | |
a7982987 TL |
3164 | const char *dhcp_failover_reject_reason_print (int); |
3165 | const char *dhcp_failover_state_name_print (enum failover_state); | |
af380050 TL |
3166 | const char *dhcp_failover_message_name (unsigned); |
3167 | const char *dhcp_failover_option_name (unsigned); | |
165bce70 TL |
3168 | failover_option_t *dhcp_failover_option_printf (unsigned, char *, |
3169 | unsigned *, | |
3170 | unsigned, | |
72896e9f TL |
3171 | const char *, ...) |
3172 | __attribute__((__format__(__printf__,5,6))); | |
3173 | failover_option_t *dhcp_failover_make_option (unsigned, char *, | |
3174 | unsigned *, unsigned, ...); | |
165bce70 | 3175 | isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *, |
a55ccdd0 | 3176 | omapi_object_t *, int, u_int32_t, ...); |
35e0fdf8 | 3177 | isc_result_t dhcp_failover_send_connect PROTO ((omapi_object_t *)); |
007e3ee4 TL |
3178 | isc_result_t dhcp_failover_send_connectack PROTO ((omapi_object_t *, |
3179 | dhcp_failover_state_t *, | |
3180 | int, const char *)); | |
a7982987 TL |
3181 | isc_result_t dhcp_failover_send_disconnect PROTO ((omapi_object_t *, |
3182 | int, const char *)); | |
3183 | isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *, | |
3184 | struct lease *); | |
8c8e27c5 | 3185 | isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *, |
988c1ca7 | 3186 | failover_message_t *, |
8c8e27c5 TL |
3187 | int, const char *); |
3188 | isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *); | |
3189 | isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int); | |
c489f075 TL |
3190 | isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *); |
3191 | isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *); | |
3192 | isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *); | |
8c8e27c5 TL |
3193 | isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *, |
3194 | failover_message_t *); | |
3195 | isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *, | |
3196 | failover_message_t *); | |
c489f075 TL |
3197 | isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *, |
3198 | int); | |
3199 | isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *, | |
3200 | failover_message_t *); | |
3201 | isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *, | |
3202 | failover_message_t *); | |
3203 | isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *, | |
3204 | failover_message_t *); | |
1d17db44 | 3205 | void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line); |
c489f075 | 3206 | void dhcp_failover_recover_done (void *); |
35e0fdf8 | 3207 | void failover_print PROTO ((char *, unsigned *, unsigned, const char *)); |
5b7f941d | 3208 | void update_partner PROTO ((struct lease *)); |
aa8579c0 | 3209 | int load_balance_mine (struct packet *, dhcp_failover_state_t *); |
2426234f | 3210 | int peer_wants_lease (struct lease *); |
e540864e TL |
3211 | binding_state_t normal_binding_state_transition_check (struct lease *, |
3212 | dhcp_failover_state_t *, | |
31bbee78 TL |
3213 | binding_state_t, |
3214 | u_int32_t); | |
e540864e TL |
3215 | binding_state_t |
3216 | conflict_binding_state_transition_check (struct lease *, | |
3217 | dhcp_failover_state_t *, | |
31bbee78 | 3218 | binding_state_t, u_int32_t); |
c489f075 | 3219 | int lease_mine_to_reallocate (struct lease *); |
007e3ee4 | 3220 | |
20916cae TL |
3221 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t, |
3222 | dhcp_type_failover_state) | |
3223 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener, dhcp_failover_listener_t, | |
3224 | dhcp_type_failover_listener) | |
3225 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t, | |
57c8fdd7 | 3226 | dhcp_type_failover_link) |
d9eefc5d | 3227 | #endif /* FAILOVER_PROTOCOL */ |
e540864e TL |
3228 | |
3229 | const char *binding_state_print (enum failover_state); | |
98bd7ca0 DH |
3230 | |
3231 | ||
3232 | /* mdb6.c */ | |
9322442f | 3233 | HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t); |
1d17db44 FD |
3234 | HASH_FUNCTIONS_DECL(iasubopt, struct in6_addr *, struct iasubopt, |
3235 | iasubopt_hash_t); | |
98bd7ca0 | 3236 | |
1d17db44 FD |
3237 | isc_result_t iasubopt_allocate(struct iasubopt **iasubopt, |
3238 | const char *file, int line); | |
3239 | isc_result_t iasubopt_reference(struct iasubopt **iasubopt, | |
3240 | struct iasubopt *src, | |
98bd7ca0 | 3241 | const char *file, int line); |
1d17db44 FD |
3242 | isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, |
3243 | const char *file, int line); | |
98bd7ca0 | 3244 | |
1d9774ab FD |
3245 | isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid, |
3246 | const char *duid, unsigned int duid_len, | |
3247 | const char *file, int line); | |
9322442f FD |
3248 | isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid, |
3249 | const char *duid, unsigned int duid_len, | |
98bd7ca0 | 3250 | const char *file, int line); |
9322442f FD |
3251 | isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, |
3252 | const char *file, int line); | |
3253 | isc_result_t ia_dereference(struct ia_xx **ia, | |
1d9774ab | 3254 | const char *file, int line); |
1d17db44 FD |
3255 | isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, |
3256 | const char *file, int line); | |
3257 | void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, | |
3258 | const char *file, int line); | |
9322442f | 3259 | isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b); |
1d9774ab | 3260 | |
9322442f FD |
3261 | isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type, |
3262 | const struct in6_addr *start_addr, | |
3263 | int bits, int units, | |
98bd7ca0 DH |
3264 | const char *file, int line); |
3265 | isc_result_t ipv6_pool_reference(struct ipv6_pool **pool, | |
3266 | struct ipv6_pool *src, | |
3267 | const char *file, int line); | |
3268 | isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool, | |
3269 | const char *file, int line); | |
5d89d60f | 3270 | isc_result_t create_lease6(struct ipv6_pool *pool, |
1d17db44 | 3271 | struct iasubopt **addr, |
5d89d60f FD |
3272 | unsigned int *attempts, |
3273 | const struct data_string *uid, | |
3274 | time_t soft_lifetime_end_time); | |
98bd7ca0 | 3275 | isc_result_t add_lease6(struct ipv6_pool *pool, |
1d17db44 | 3276 | struct iasubopt *lease, |
98bd7ca0 | 3277 | time_t valid_lifetime_end_time); |
1d17db44 FD |
3278 | isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease); |
3279 | isc_result_t expire_lease6(struct iasubopt **leasep, | |
98bd7ca0 | 3280 | struct ipv6_pool *pool, time_t now); |
1d17db44 FD |
3281 | isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease); |
3282 | isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease); | |
98bd7ca0 DH |
3283 | isc_boolean_t lease6_exists(const struct ipv6_pool *pool, |
3284 | const struct in6_addr *addr); | |
9322442f FD |
3285 | isc_result_t mark_lease_unavailble(struct ipv6_pool *pool, |
3286 | const struct in6_addr *addr); | |
98bd7ca0 | 3287 | |
9322442f | 3288 | isc_result_t create_prefix6(struct ipv6_pool *pool, |
1d17db44 | 3289 | struct iasubopt **pref, |
5d89d60f FD |
3290 | unsigned int *attempts, |
3291 | const struct data_string *uid, | |
3292 | time_t soft_lifetime_end_time); | |
9322442f | 3293 | isc_boolean_t prefix6_exists(const struct ipv6_pool *pool, |
1d9774ab FD |
3294 | const struct in6_addr *pref, u_int8_t plen); |
3295 | ||
98bd7ca0 | 3296 | isc_result_t add_ipv6_pool(struct ipv6_pool *pool); |
9322442f | 3297 | isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, |
98bd7ca0 | 3298 | const struct in6_addr *addr); |
9322442f FD |
3299 | isc_boolean_t ipv6_in_pool(const struct in6_addr *addr, |
3300 | const struct ipv6_pool *pool); | |
3301 | ||
3302 | isc_result_t renew_leases(struct ia_xx *ia); | |
3303 | isc_result_t release_leases(struct ia_xx *ia); | |
3304 | isc_result_t decline_leases(struct ia_xx *ia); | |
d9b43370 SK |
3305 | void schedule_lease_timeout(struct ipv6_pool *pool); |
3306 | void schedule_all_ipv6_lease_timeouts(); | |
98bd7ca0 DH |
3307 | |
3308 | void mark_hosts_unavailable(void); | |
80c9fdb0 | 3309 | void mark_phosts_unavailable(void); |
98bd7ca0 DH |
3310 | void mark_interfaces_unavailable(void); |
3311 |