]>
Commit | Line | Data |
---|---|---|
d7837182 TL |
1 | /* dhcpd.h |
2 | ||
3 | Definitions for dhcpd... */ | |
4 | ||
5 | /* | |
98311e4b DH |
6 | * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") |
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 | ||
0c7802b1 | 35 | #ifndef __CYGWIN32__ |
d7837182 | 36 | #include <sys/types.h> |
d7837182 TL |
37 | #include <netinet/in.h> |
38 | #include <sys/socket.h> | |
5a526cf8 | 39 | #include <sys/un.h> |
d7837182 | 40 | #include <arpa/inet.h> |
972ab2aa | 41 | |
d7837182 | 42 | #include <netdb.h> |
0c7802b1 TL |
43 | #else |
44 | #define fd_set cygwin_fd_set | |
45 | #include <sys/types.h> | |
46 | #endif | |
d7837182 TL |
47 | #include <fcntl.h> |
48 | #include <stdio.h> | |
089fb364 | 49 | #include <unistd.h> |
8fdfeffe | 50 | #include <string.h> |
089fb364 TL |
51 | #include <stdlib.h> |
52 | #include <sys/stat.h> | |
53 | #include <ctype.h> | |
97ca1699 | 54 | #include <time.h> |
089fb364 | 55 | |
2f620dce | 56 | #include "cdefs.h" |
a8b53b42 | 57 | #include "osdep.h" |
e55017af TL |
58 | |
59 | #include "arpa/nameser.h" | |
60 | #if defined (NSUPDATE) | |
c7315f8d | 61 | # include "minires/minires.h" |
e55017af TL |
62 | #endif |
63 | ||
98311e4b DH |
64 | struct hash_table; |
65 | typedef struct hash_table group_hash_t; | |
66 | typedef struct hash_table universe_hash_t; | |
67 | typedef struct hash_table option_hash_t; | |
68 | typedef struct hash_table dns_zone_hash_t; | |
69 | typedef struct hash_table lease_hash_t; | |
70 | typedef struct hash_table host_hash_t; | |
71 | typedef struct hash_table class_hash_t; | |
72 | ||
d7837182 | 73 | #include "dhcp.h" |
2b9b6ff7 | 74 | #include "statement.h" |
d7837182 | 75 | #include "tree.h" |
089fb364 | 76 | #include "inet.h" |
fde86d2d | 77 | #include "dhctoken.h" |
d7837182 | 78 | |
d758ad8c | 79 | #include <isc-dhcp/result.h> |
400c0b19 | 80 | #include <omapip/omapip_p.h> |
4fe74d72 | 81 | |
27fe61a7 TL |
82 | #if !defined (OPTION_HASH_SIZE) |
83 | # define OPTION_HASH_SIZE 17 | |
0dbb132f TL |
84 | # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */ |
85 | # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */ | |
27fe61a7 TL |
86 | #endif |
87 | ||
0dbb132f TL |
88 | #define compute_option_hash(x) \ |
89 | (((x) & (OPTION_HASH_PTWO - 1)) + \ | |
90 | (((x) >> OPTION_HASH_EXP) & \ | |
91 | (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE; | |
92 | ||
d758ad8c TL |
93 | enum dhcp_shutdown_state { |
94 | shutdown_listeners, | |
95 | shutdown_omapi_connections, | |
96 | shutdown_drop_omapi_connections, | |
97 | shutdown_dhcp, | |
98 | shutdown_done | |
99 | }; | |
100 | ||
35e0fdf8 TL |
101 | /* Client FQDN option, failover FQDN option, etc. */ |
102 | typedef struct { | |
103 | u_int8_t codes [2]; | |
104 | unsigned length; | |
105 | u_int8_t *data; | |
106 | } ddns_fqdn_t; | |
107 | ||
de1863a1 | 108 | #include "failover.h" |
35e0fdf8 | 109 | |
fde86d2d TL |
110 | /* A parsing context. */ |
111 | ||
112 | struct parse { | |
113 | int lexline; | |
114 | int lexchar; | |
115 | char *token_line; | |
116 | char *prev_line; | |
117 | char *cur_line; | |
b1b7b521 | 118 | const char *tlname; |
fde86d2d TL |
119 | int eol_token; |
120 | ||
121 | char line1 [81]; | |
122 | char line2 [81]; | |
123 | int lpos; | |
124 | int line; | |
125 | int tlpos; | |
126 | int tline; | |
127 | enum dhcp_token token; | |
128 | int ugflag; | |
129 | char *tval; | |
b3519f23 | 130 | int tlen; |
fde86d2d TL |
131 | char tokbuf [1500]; |
132 | ||
133 | #ifdef OLD_LEXER | |
134 | char comments [4096]; | |
135 | int comment_index; | |
136 | #endif | |
137 | int warnings_occurred; | |
138 | int file; | |
139 | char *inbuf; | |
b1b7b521 TL |
140 | unsigned bufix, buflen; |
141 | unsigned bufsiz; | |
fde86d2d TL |
142 | }; |
143 | ||
74f45f96 | 144 | /* Variable-length array of data. */ |
74f45f96 | 145 | |
6b3b97e1 TL |
146 | struct string_list { |
147 | struct string_list *next; | |
148 | char string [1]; | |
149 | }; | |
150 | ||
0c7802b1 TL |
151 | /* A name server, from /etc/resolv.conf. */ |
152 | struct name_server { | |
153 | struct name_server *next; | |
154 | struct sockaddr_in addr; | |
155 | TIME rcdate; | |
156 | }; | |
157 | ||
158 | /* A domain search list element. */ | |
159 | struct domain_search_list { | |
160 | struct domain_search_list *next; | |
161 | char *domain; | |
162 | TIME rcdate; | |
163 | }; | |
164 | ||
5142937c TL |
165 | /* Option tag structures are used to build chains of option tags, for |
166 | when we're sure we're not going to have enough of them to justify | |
167 | maintaining an array. */ | |
168 | ||
169 | struct option_tag { | |
170 | struct option_tag *next; | |
171 | u_int8_t data [1]; | |
172 | }; | |
173 | ||
174 | /* An agent option structure. We need a special structure for the | |
175 | Relay Agent Information option because if more than one appears in | |
176 | a message, we have to keep them seperate. */ | |
177 | ||
178 | struct agent_options { | |
179 | struct agent_options *next; | |
180 | int length; | |
181 | struct option_tag *first; | |
182 | }; | |
183 | ||
27fe61a7 TL |
184 | struct option_cache { |
185 | int refcnt; | |
186 | struct option_cache *next; | |
187 | struct expression *expression; | |
188 | struct option *option; | |
189 | struct data_string data; | |
88cd8aca DH |
190 | |
191 | #define OPTION_HAD_NULLS 0x00000001 | |
192 | u_int32_t flags; | |
27fe61a7 | 193 | }; |
5142937c | 194 | |
27fe61a7 | 195 | struct option_state { |
a340de95 | 196 | int refcnt; |
4f58da18 | 197 | int universe_count; |
53ac6c6f TL |
198 | int site_universe; |
199 | int site_code_min; | |
4f58da18 | 200 | VOIDPTR universes [1]; |
5142937c TL |
201 | }; |
202 | ||
d7837182 TL |
203 | /* A dhcp packet and the pointers to its option values. */ |
204 | struct packet { | |
205 | struct dhcp_packet *raw; | |
f3e8ea32 | 206 | int refcnt; |
b1b7b521 | 207 | unsigned packet_length; |
d7837182 TL |
208 | int packet_type; |
209 | int options_valid; | |
089fb364 TL |
210 | int client_port; |
211 | struct iaddr client_addr; | |
17b95f41 TL |
212 | struct interface_info *interface; /* Interface on which packet |
213 | was received. */ | |
214 | struct hardware *haddr; /* Physical link address | |
215 | of local sender (maybe gateway). */ | |
c4763f5f TL |
216 | |
217 | /* Information for relay agent options (see | |
218 | draft-ietf-dhc-agent-options-xx.txt). */ | |
219 | u_int8_t *circuit_id; /* Circuit ID of client connection. */ | |
220 | int circuit_id_len; | |
221 | u_int8_t *remote_id; /* Remote ID of client. */ | |
222 | int remote_id_len; | |
223 | ||
f67530be TL |
224 | int got_requested_address; /* True if client sent the |
225 | dhcp-requested-address option. */ | |
226 | ||
c626ae69 | 227 | struct shared_network *shared_network; |
4f58da18 | 228 | struct option_state *options; |
102ee7e9 TL |
229 | |
230 | #if !defined (PACKET_MAX_CLASSES) | |
231 | # define PACKET_MAX_CLASSES 5 | |
232 | #endif | |
233 | int class_count; | |
234 | struct class *classes [PACKET_MAX_CLASSES]; | |
734d2258 TL |
235 | |
236 | int known; | |
237 | int authenticated; | |
d7837182 TL |
238 | }; |
239 | ||
5142937c TL |
240 | /* A network interface's MAC address. */ |
241 | ||
d7837182 | 242 | struct hardware { |
d7837182 | 243 | u_int8_t hlen; |
5b7f941d | 244 | u_int8_t hbuf [17]; |
d7837182 TL |
245 | }; |
246 | ||
d758ad8c TL |
247 | typedef enum { |
248 | server_startup = 0, | |
249 | server_running = 1, | |
250 | server_shutdown = 2, | |
251 | server_hibernate = 3, | |
252 | server_awaken = 4 | |
253 | } control_object_state_t; | |
254 | ||
255 | typedef struct { | |
256 | OMAPI_OBJECT_PREAMBLE; | |
257 | control_object_state_t state; | |
258 | } dhcp_control_object_t; | |
259 | ||
7ea8b207 | 260 | /* Lease states: */ |
98311e4b DH |
261 | #define FTS_FREE 1 |
262 | #define FTS_ACTIVE 2 | |
263 | #define FTS_EXPIRED 3 | |
264 | #define FTS_RELEASED 4 | |
265 | #define FTS_ABANDONED 5 | |
266 | #define FTS_RESET 6 | |
267 | #define FTS_BACKUP 7 | |
268 | #define FTS_RESERVED 8 | |
269 | #define FTS_BOOTP 9 | |
270 | typedef u_int8_t binding_state_t; | |
271 | ||
272 | /* FTS_LAST is the highest value that is valid for a lease binding state. */ | |
273 | #define FTS_LAST FTS_BOOTP | |
7ea8b207 | 274 | |
d7837182 TL |
275 | /* A dhcp lease declaration structure. */ |
276 | struct lease { | |
4fe74d72 | 277 | OMAPI_OBJECT_PREAMBLE; |
d7837182 | 278 | struct lease *next; |
ab370123 | 279 | struct lease *n_uid, *n_hw; |
fc2df23a | 280 | |
089fb364 | 281 | struct iaddr ip_addr; |
007e3ee4 | 282 | TIME starts, ends, timestamp, sort_time; |
0c7802b1 | 283 | char *client_hostname; |
6ceb9118 | 284 | struct binding_scope *scope; |
d7837182 | 285 | struct host_decl *host; |
c626ae69 | 286 | struct subnet *subnet; |
734d2258 | 287 | struct pool *pool; |
112a6c2c | 288 | struct class *billing_class; |
625f7cee | 289 | struct option_chain_head *agent_options; |
fc2df23a | 290 | |
79a65726 TL |
291 | struct executable_statement *on_expiry; |
292 | struct executable_statement *on_commit; | |
293 | struct executable_statement *on_release; | |
294 | ||
f3aad410 TL |
295 | unsigned char *uid; |
296 | unsigned short uid_len; | |
297 | unsigned short uid_max; | |
298 | unsigned char uid_buf [7]; | |
299 | struct hardware hardware_addr; | |
300 | ||
301 | u_int8_t flags; | |
c626ae69 | 302 | # define STATIC_LEASE 1 |
98311e4b | 303 | # define BOOTP_LEASE 2 |
2aac4312 | 304 | # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE) |
fc2df23a | 305 | # define MS_NULL_TERMINATION 8 |
007e3ee4 TL |
306 | # define ON_UPDATE_QUEUE 16 |
307 | # define ON_ACK_QUEUE 32 | |
bca94423 | 308 | # define UNICAST_BROADCAST_HACK 64 |
98311e4b | 309 | # define ON_DEFERRED_QUEUE 128 |
bca94423 TL |
310 | # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \ |
311 | UNICAST_BROADCAST_HACK) | |
2aac4312 | 312 | |
98311e4b DH |
313 | binding_state_t binding_state; |
314 | binding_state_t next_binding_state; | |
315 | binding_state_t desired_binding_state; | |
007e3ee4 | 316 | |
6e5ed8bf | 317 | struct lease_state *state; |
5b7f941d | 318 | |
88cd8aca DH |
319 | /* 'tsfp' is more of an 'effective' tsfp. It may be calculated from |
320 | * stos+mclt for example if it's an expired lease and the server is | |
321 | * in partner-down state. 'atsfp' is zeroed whenever a lease is | |
322 | * updated - and only set when the peer acknowledges it. This | |
323 | * ensures every state change is transmitted. | |
324 | */ | |
5b7f941d TL |
325 | TIME tstp; /* Time sent to partner. */ |
326 | TIME tsfp; /* Time sent from partner. */ | |
88cd8aca | 327 | TIME atsfp; /* Actual time sent from partner. */ |
5b7f941d | 328 | TIME cltt; /* Client last transaction time. */ |
aa8579c0 | 329 | struct lease *next_pending; |
6e5ed8bf TL |
330 | }; |
331 | ||
332 | struct lease_state { | |
333 | struct lease_state *next; | |
334 | ||
335 | struct interface_info *ip; | |
336 | ||
f3e8ea32 TL |
337 | struct packet *packet; /* The incoming packet. */ |
338 | ||
6e5ed8bf TL |
339 | TIME offered_expiry; |
340 | ||
4f58da18 | 341 | struct option_state *options; |
15151db6 | 342 | struct data_string parameter_request_list; |
5142937c | 343 | int max_message_size; |
88cd8aca | 344 | TIME expiry, renewal, rebind; |
2b9b6ff7 | 345 | struct data_string filename, server_name; |
f67530be TL |
346 | int got_requested_address; |
347 | int got_server_identifier; | |
348 | struct shared_network *shared_network; /* Shared network of interface | |
349 | on which request arrived. */ | |
fc2df23a TL |
350 | |
351 | u_int32_t xid; | |
352 | u_int16_t secs; | |
353 | u_int16_t bootp_flags; | |
354 | struct in_addr ciaddr; | |
c783f799 | 355 | struct in_addr siaddr; |
fc2df23a TL |
356 | struct in_addr giaddr; |
357 | u_int8_t hops; | |
358 | u_int8_t offer; | |
27fe61a7 | 359 | struct iaddr from; |
c626ae69 TL |
360 | }; |
361 | ||
ab370123 | 362 | #define ROOT_GROUP 0 |
750d0800 TL |
363 | #define HOST_DECL 1 |
364 | #define SHARED_NET_DECL 2 | |
365 | #define SUBNET_DECL 3 | |
366 | #define CLASS_DECL 4 | |
367 | #define GROUP_DECL 5 | |
74f45f96 | 368 | #define POOL_DECL 6 |
ab370123 | 369 | |
cc26de46 TL |
370 | /* Possible modes in which discover_interfaces can run. */ |
371 | ||
372 | #define DISCOVER_RUNNING 0 | |
373 | #define DISCOVER_SERVER 1 | |
374 | #define DISCOVER_UNCONFIGURED 2 | |
f79e49f3 | 375 | #define DISCOVER_RELAY 3 |
5a526cf8 | 376 | #define DISCOVER_REQUESTED 4 |
cc26de46 | 377 | |
2b9b6ff7 TL |
378 | /* Server option names. */ |
379 | ||
380 | #define SV_DEFAULT_LEASE_TIME 1 | |
381 | #define SV_MAX_LEASE_TIME 2 | |
382 | #define SV_MIN_LEASE_TIME 3 | |
383 | #define SV_BOOTP_LEASE_CUTOFF 4 | |
384 | #define SV_BOOTP_LEASE_LENGTH 5 | |
385 | #define SV_BOOT_UNKNOWN_CLIENTS 6 | |
386 | #define SV_DYNAMIC_BOOTP 7 | |
387 | #define SV_ALLOW_BOOTP 8 | |
388 | #define SV_ALLOW_BOOTING 9 | |
389 | #define SV_ONE_LEASE_PER_CLIENT 10 | |
390 | #define SV_GET_LEASE_HOSTNAMES 11 | |
391 | #define SV_USE_HOST_DECL_NAMES 12 | |
392 | #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13 | |
393 | #define SV_MIN_SECS 14 | |
394 | #define SV_FILENAME 15 | |
395 | #define SV_SERVER_NAME 16 | |
396 | #define SV_NEXT_SERVER 17 | |
d1f2c520 | 397 | #define SV_AUTHORITATIVE 18 |
4f58da18 | 398 | #define SV_VENDOR_OPTION_SPACE 19 |
4b7f8736 | 399 | #define SV_ALWAYS_REPLY_RFC1048 20 |
53ac6c6f | 400 | #define SV_SITE_OPTION_SPACE 21 |
f7b9d823 | 401 | #define SV_ALWAYS_BROADCAST 22 |
972ab2aa TL |
402 | #define SV_DDNS_DOMAIN_NAME 23 |
403 | #define SV_DDNS_HOST_NAME 24 | |
404 | #define SV_DDNS_REV_DOMAIN_NAME 25 | |
94bf482e TL |
405 | #define SV_LEASE_FILE_NAME 26 |
406 | #define SV_PID_FILE_NAME 27 | |
4c026751 TL |
407 | #define SV_DUPLICATES 28 |
408 | #define SV_DECLINES 29 | |
7f6ad5ac | 409 | #define SV_DDNS_UPDATES 30 |
aa8579c0 TL |
410 | #define SV_OMAPI_PORT 31 |
411 | #define SV_LOCAL_PORT 32 | |
412 | #define SV_LIMITED_BROADCAST_ADDRESS 33 | |
413 | #define SV_REMOTE_PORT 34 | |
414 | #define SV_LOCAL_ADDRESS 35 | |
49146f3c | 415 | #define SV_OMAPI_KEY 36 |
159bcce3 | 416 | #define SV_STASH_AGENT_OPTIONS 37 |
b992d7e2 | 417 | #define SV_DDNS_TTL 38 |
dbcc689e | 418 | #define SV_DDNS_UPDATE_STYLE 39 |
afc0ca25 TL |
419 | #define SV_CLIENT_UPDATES 40 |
420 | #define SV_UPDATE_OPTIMIZATION 41 | |
cc4473a0 TL |
421 | #define SV_PING_CHECKS 42 |
422 | #define SV_UPDATE_STATIC_LEASES 43 | |
625f7cee | 423 | #define SV_LOG_FACILITY 44 |
98311e4b DH |
424 | #define SV_DO_FORWARD_UPDATES 45 |
425 | #define SV_PING_TIMEOUT 46 | |
426 | ||
427 | #if !defined (DEFAULT_PING_TIMEOUT) | |
428 | # define DEFAULT_PING_TIMEOUT 1 | |
429 | #endif | |
2b9b6ff7 TL |
430 | |
431 | #if !defined (DEFAULT_DEFAULT_LEASE_TIME) | |
432 | # define DEFAULT_DEFAULT_LEASE_TIME 43200 | |
433 | #endif | |
434 | ||
435 | #if !defined (DEFAULT_MIN_LEASE_TIME) | |
74f45f96 | 436 | # define DEFAULT_MIN_LEASE_TIME 0 |
2b9b6ff7 TL |
437 | #endif |
438 | ||
439 | #if !defined (DEFAULT_MAX_LEASE_TIME) | |
440 | # define DEFAULT_MAX_LEASE_TIME 86400 | |
441 | #endif | |
442 | ||
b992d7e2 DN |
443 | #if !defined (DEFAULT_DDNS_TTL) |
444 | # define DEFAULT_DDNS_TTL 3600 | |
445 | #endif | |
446 | ||
27fe61a7 TL |
447 | /* Client option names */ |
448 | ||
449 | #define CL_TIMEOUT 1 | |
450 | #define CL_SELECT_INTERVAL 2 | |
451 | #define CL_REBOOT_TIMEOUT 3 | |
452 | #define CL_RETRY_INTERVAL 4 | |
453 | #define CL_BACKOFF_CUTOFF 5 | |
454 | #define CL_INITIAL_INTERVAL 6 | |
455 | #define CL_BOOTP_POLICY 7 | |
456 | #define CL_SCRIPT_NAME 8 | |
457 | #define CL_REQUESTED_OPTIONS 9 | |
458 | #define CL_REQUESTED_LEASE_TIME 10 | |
459 | #define CL_SEND_OPTIONS 11 | |
460 | #define CL_MEDIA 12 | |
461 | #define CL_REJECT_LIST 13 | |
462 | ||
463 | #ifndef CL_DEFAULT_TIMEOUT | |
464 | # define CL_DEFAULT_TIMEOUT 60 | |
465 | #endif | |
466 | ||
467 | #ifndef CL_DEFAULT_SELECT_INTERVAL | |
468 | # define CL_DEFAULT_SELECT_INTERVAL 0 | |
469 | #endif | |
470 | ||
471 | #ifndef CL_DEFAULT_REBOOT_TIMEOUT | |
472 | # define CL_DEFAULT_REBOOT_TIMEOUT 10 | |
473 | #endif | |
474 | ||
475 | #ifndef CL_DEFAULT_RETRY_INTERVAL | |
476 | # define CL_DEFAULT_RETRY_INTERVAL 300 | |
477 | #endif | |
478 | ||
479 | #ifndef CL_DEFAULT_BACKOFF_CUTOFF | |
480 | # define CL_DEFAULT_BACKOFF_CUTOFF 120 | |
481 | #endif | |
482 | ||
483 | #ifndef CL_DEFAULT_INITIAL_INTERVAL | |
484 | # define CL_DEFAULT_INITIAL_INTERVAL 10 | |
485 | #endif | |
486 | ||
487 | #ifndef CL_DEFAULT_BOOTP_POLICY | |
c5b0f529 | 488 | # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT |
27fe61a7 TL |
489 | #endif |
490 | ||
27fe61a7 TL |
491 | #ifndef CL_DEFAULT_REQUESTED_OPTIONS |
492 | # define CL_DEFAULT_REQUESTED_OPTIONS \ | |
493 | { DHO_SUBNET_MASK, \ | |
494 | DHO_BROADCAST_ADDRESS, \ | |
495 | DHO_TIME_OFFSET, \ | |
496 | DHO_ROUTERS, \ | |
497 | DHO_DOMAIN_NAME, \ | |
498 | DHO_DOMAIN_NAME_SERVERS, \ | |
499 | DHO_HOST_NAME } | |
500 | #endif | |
501 | ||
940ea8ab TL |
502 | struct group_object { |
503 | OMAPI_OBJECT_PREAMBLE; | |
504 | ||
505 | struct group_object *n_dynamic; | |
506 | struct group *group; | |
507 | char *name; | |
508 | int flags; | |
509 | #define GROUP_OBJECT_DELETED 1 | |
510 | #define GROUP_OBJECT_DYNAMIC 2 | |
511 | #define GROUP_OBJECT_STATIC 4 | |
512 | }; | |
513 | ||
750d0800 | 514 | /* Group of declarations that share common parameters. */ |
ab370123 TL |
515 | struct group { |
516 | struct group *next; | |
517 | ||
20916cae | 518 | int refcnt; |
940ea8ab | 519 | struct group_object *object; |
ab370123 TL |
520 | struct subnet *subnet; |
521 | struct shared_network *shared_network; | |
d1f2c520 | 522 | int authoritative; |
2b9b6ff7 | 523 | struct executable_statement *statements; |
ab370123 TL |
524 | }; |
525 | ||
526 | /* A dhcp host declaration structure. */ | |
527 | struct host_decl { | |
4fe74d72 | 528 | OMAPI_OBJECT_PREAMBLE; |
ab370123 | 529 | struct host_decl *n_ipaddr; |
4fe74d72 | 530 | struct host_decl *n_dynamic; |
ab370123 TL |
531 | char *name; |
532 | struct hardware interface; | |
2b9b6ff7 TL |
533 | struct data_string client_identifier; |
534 | struct option_cache *fixed_addr; | |
ab370123 | 535 | struct group *group; |
940ea8ab | 536 | struct group_object *named_group; |
74f45f96 | 537 | struct data_string auth_key_id; |
4fe74d72 | 538 | int flags; |
3c48d369 TL |
539 | #define HOST_DECL_DELETED 1 |
540 | #define HOST_DECL_DYNAMIC 2 | |
940ea8ab | 541 | #define HOST_DECL_STATIC 4 |
ab370123 TL |
542 | }; |
543 | ||
734d2258 TL |
544 | struct permit { |
545 | struct permit *next; | |
546 | enum { | |
547 | permit_unknown_clients, | |
548 | permit_known_clients, | |
549 | permit_authenticated_clients, | |
550 | permit_unauthenticated_clients, | |
551 | permit_all_clients, | |
552 | permit_dynamic_bootp_clients, | |
c859d3b8 | 553 | permit_class |
734d2258 TL |
554 | } type; |
555 | struct class *class; | |
556 | }; | |
557 | ||
558 | struct pool { | |
4fe74d72 | 559 | OMAPI_OBJECT_PREAMBLE; |
734d2258 | 560 | struct pool *next; |
74f45f96 | 561 | struct group *group; |
734d2258 TL |
562 | struct shared_network *shared_network; |
563 | struct permit *permit_list; | |
564 | struct permit *prohibit_list; | |
007e3ee4 TL |
565 | struct lease *active; |
566 | struct lease *expired; | |
567 | struct lease *free; | |
568 | struct lease *backup; | |
569 | struct lease *abandoned; | |
570 | TIME next_event_time; | |
5b7f941d | 571 | int lease_count; |
007e3ee4 TL |
572 | int free_leases; |
573 | int backup_leases; | |
d758ad8c | 574 | int index; |
7ea8b207 | 575 | #if defined (FAILOVER_PROTOCOL) |
5b7f941d TL |
576 | dhcp_failover_state_t *failover_peer; |
577 | #endif | |
d1f2c520 | 578 | }; |
d1f2c520 | 579 | |
c626ae69 | 580 | struct shared_network { |
4fe74d72 | 581 | OMAPI_OBJECT_PREAMBLE; |
c626ae69 | 582 | struct shared_network *next; |
20916cae | 583 | char *name; |
c626ae69 TL |
584 | struct subnet *subnets; |
585 | struct interface_info *interface; | |
734d2258 | 586 | struct pool *pools; |
5b7f941d | 587 | struct group *group; |
d1f2c520 | 588 | #if defined (FAILOVER_PROTOCOL) |
5b7f941d | 589 | dhcp_failover_state_t *failover_peer; |
d1f2c520 | 590 | #endif |
d7837182 TL |
591 | }; |
592 | ||
593 | struct subnet { | |
4fe74d72 | 594 | OMAPI_OBJECT_PREAMBLE; |
c626ae69 TL |
595 | struct subnet *next_subnet; |
596 | struct subnet *next_sibling; | |
597 | struct shared_network *shared_network; | |
598 | struct interface_info *interface; | |
599 | struct iaddr interface_address; | |
089fb364 TL |
600 | struct iaddr net; |
601 | struct iaddr netmask; | |
ab370123 TL |
602 | |
603 | struct group *group; | |
d7837182 TL |
604 | }; |
605 | ||
102ee7e9 TL |
606 | struct collection { |
607 | struct collection *next; | |
608 | ||
b1b7b521 | 609 | const char *name; |
102ee7e9 TL |
610 | struct class *classes; |
611 | }; | |
612 | ||
06e77c34 DH |
613 | /* Used as an argument to parse_clasS_decl() */ |
614 | #define CLASS_TYPE_VENDOR 0 | |
615 | #define CLASS_TYPE_USER 1 | |
616 | #define CLASS_TYPE_CLASS 2 | |
617 | #define CLASS_TYPE_SUBCLASS 3 | |
618 | ||
112a6c2c | 619 | /* XXX classes must be reference-counted. */ |
102ee7e9 | 620 | struct class { |
4fe74d72 | 621 | OMAPI_OBJECT_PREAMBLE; |
a609e69b | 622 | struct class *nic; /* Next in collection. */ |
112a6c2c | 623 | struct class *superclass; /* Set for spawned classes only. */ |
a609e69b | 624 | char *name; /* Not set for spawned classes. */ |
734d2258 TL |
625 | |
626 | /* A class may be configured to permit a limited number of leases. */ | |
627 | int lease_limit; | |
112a6c2c TL |
628 | int leases_consumed; |
629 | struct lease **billed_leases; | |
630 | ||
631 | /* If nonzero, class has not been saved since it was last | |
632 | modified. */ | |
633 | int dirty; | |
ab370123 | 634 | |
112a6c2c | 635 | /* Hash table containing subclasses. */ |
98311e4b | 636 | class_hash_t *hash; |
112a6c2c TL |
637 | struct data_string hash_string; |
638 | ||
639 | /* Expression used to match class. */ | |
2b9b6ff7 | 640 | struct expression *expr; |
112a6c2c TL |
641 | |
642 | /* Expression used to compute subclass identifiers for spawning | |
58bfaaa7 TL |
643 | and to do subclass matching. */ |
644 | struct expression *submatch; | |
645 | int spawning; | |
102ee7e9 | 646 | |
ab370123 | 647 | struct group *group; |
2b9b6ff7 TL |
648 | |
649 | /* Statements to execute if class matches. */ | |
650 | struct executable_statement *statements; | |
899d754f JB |
651 | |
652 | #define CLASS_DECL_DELETED 1 | |
653 | #define CLASS_DECL_DYNAMIC 2 | |
654 | #define CLASS_DECL_STATIC 4 | |
655 | #define CLASS_DECL_SUBCLASS 8 | |
656 | ||
657 | int flags; | |
709f15cc TL |
658 | }; |
659 | ||
cc26de46 TL |
660 | /* DHCP client lease structure... */ |
661 | struct client_lease { | |
41fb155b TL |
662 | struct client_lease *next; /* Next lease in list. */ |
663 | TIME expiry, renewal, rebind; /* Lease timeouts. */ | |
664 | struct iaddr address; /* Address being leased. */ | |
665 | char *server_name; /* Name of boot server. */ | |
666 | char *filename; /* Name of file we're supposed to boot. */ | |
6b3b97e1 | 667 | struct string_list *medium; /* Network medium. */ |
49146f3c | 668 | struct auth_key *key; /* Key used in basic DHCP authentication. */ |
cc26de46 | 669 | |
0c7802b1 | 670 | unsigned int is_static : 1; /* If set, lease is from config file. */ |
98311e4b | 671 | unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */ |
41fb155b | 672 | |
4f58da18 | 673 | struct option_state *options; /* Options supplied with lease. */ |
cc26de46 TL |
674 | }; |
675 | ||
41fb155b | 676 | /* Possible states in which the client can be. */ |
cc26de46 | 677 | enum dhcp_state { |
159bcce3 TL |
678 | S_REBOOTING = 1, |
679 | S_INIT = 2, | |
680 | S_SELECTING = 3, | |
681 | S_REQUESTING = 4, | |
682 | S_BOUND = 5, | |
683 | S_RENEWING = 6, | |
c1f22aef TL |
684 | S_REBINDING = 7, |
685 | S_STOPPED = 8 | |
cc26de46 TL |
686 | }; |
687 | ||
08512bce TL |
688 | /* Authentication and BOOTP policy possibilities (not all values work |
689 | for each). */ | |
690 | enum policy { P_IGNORE, P_ACCEPT, P_PREFER, P_REQUIRE, P_DONT }; | |
691 | ||
cc26de46 TL |
692 | /* Configuration information from the config file... */ |
693 | struct client_config { | |
27fe61a7 TL |
694 | /* |
695 | * When a message has been received, run these statements | |
696 | * over it. | |
697 | */ | |
112a6c2c | 698 | struct group *on_receipt; |
27fe61a7 TL |
699 | |
700 | /* | |
701 | * When a message is sent, run these statements. | |
702 | */ | |
112a6c2c | 703 | struct group *on_transmission; |
27fe61a7 TL |
704 | |
705 | u_int32_t *required_options; /* Options server must supply. */ | |
706 | u_int32_t *requested_options; /* Options to request from server. */ | |
707 | ||
cc26de46 TL |
708 | TIME timeout; /* Start to panic if we don't get a |
709 | lease in this time period when | |
710 | SELECTING. */ | |
83c1b012 TL |
711 | TIME initial_interval; /* All exponential backoff intervals |
712 | start here. */ | |
cc26de46 TL |
713 | TIME retry_interval; /* If the protocol failed to produce |
714 | an address before the timeout, | |
715 | try the protocol again after this | |
716 | many seconds. */ | |
717 | TIME select_interval; /* Wait this many seconds from the | |
718 | first DHCPDISCOVER before | |
719 | picking an offered lease. */ | |
fc2df23a TL |
720 | TIME reboot_timeout; /* When in INIT-REBOOT, wait this |
721 | long before giving up and going | |
722 | to INIT. */ | |
83c1b012 TL |
723 | TIME backoff_cutoff; /* When doing exponential backoff, |
724 | never back off to an interval | |
725 | longer than this amount. */ | |
27fe61a7 TL |
726 | u_int32_t requested_lease; /* Requested lease time, if user |
727 | doesn't configure one. */ | |
6b3b97e1 | 728 | struct string_list *media; /* Possible network media values. */ |
32a47563 | 729 | char *script_name; /* Name of config script. */ |
432604c3 | 730 | char *vendor_space_name; /* Name of config script. */ |
08512bce | 731 | enum policy bootp_policy; |
cc26de46 TL |
732 | /* Ignore, accept or prefer BOOTP |
733 | responses. */ | |
08512bce TL |
734 | enum policy auth_policy; |
735 | /* Require authentication, prefer | |
736 | authentication, or don't try to | |
737 | authenticate. */ | |
6b3b97e1 | 738 | struct string_list *medium; /* Current network medium. */ |
0c7802b1 TL |
739 | |
740 | struct iaddrlist *reject_list; /* Servers to reject. */ | |
27fe61a7 | 741 | |
626ca6a2 TL |
742 | int omapi_port; /* port on which to accept OMAPI |
743 | connections, or -1 for no | |
744 | listener. */ | |
98311e4b DH |
745 | int do_forward_update; /* If nonzero, and if we have the |
746 | information we need, update the | |
747 | A record for the address we get. */ | |
cc26de46 TL |
748 | }; |
749 | ||
750 | /* Per-interface state used in the dhcp client... */ | |
751 | struct client_state { | |
734d2258 TL |
752 | struct client_state *next; |
753 | struct interface_info *interface; | |
754 | char *name; | |
755 | ||
cc26de46 TL |
756 | struct client_lease *active; /* Currently active lease. */ |
757 | struct client_lease *new; /* New lease. */ | |
758 | struct client_lease *offered_leases; /* Leases offered to us. */ | |
759 | struct client_lease *leases; /* Leases we currently hold. */ | |
f79e49f3 | 760 | struct client_lease *alias; /* Alias lease. */ |
cc26de46 TL |
761 | |
762 | enum dhcp_state state; /* Current state for this interface. */ | |
763 | struct iaddr destination; /* Where to send packet. */ | |
764 | u_int32_t xid; /* Transaction ID. */ | |
64826b61 | 765 | u_int16_t secs; /* secs value from DHCPDISCOVER. */ |
cc26de46 | 766 | TIME first_sending; /* When was first copy sent? */ |
6b3b97e1 | 767 | TIME interval; /* What's the current resend interval? */ |
98311e4b | 768 | int dns_update_timeout; /* Last timeout set for DNS update. */ |
6b3b97e1 | 769 | struct string_list *medium; /* Last media type tried. */ |
cc26de46 | 770 | struct dhcp_packet packet; /* Outgoing DHCP packet. */ |
b1b7b521 | 771 | unsigned packet_length; /* Actual length of generated packet. */ |
cc26de46 | 772 | |
41fb155b TL |
773 | struct iaddr requested_address; /* Address we would like to get. */ |
774 | ||
27fe61a7 | 775 | struct client_config *config; /* Client configuration. */ |
32a47563 TL |
776 | struct string_list *env; /* Client script environment. */ |
777 | int envc; /* Number of entries in environment. */ | |
d758ad8c TL |
778 | |
779 | struct option_state *sent_options; /* Options we sent. */ | |
cc26de46 TL |
780 | }; |
781 | ||
17b95f41 TL |
782 | /* Information about each network interface. */ |
783 | ||
784 | struct interface_info { | |
4fe74d72 | 785 | OMAPI_OBJECT_PREAMBLE; |
17b95f41 | 786 | struct interface_info *next; /* Next interface in list... */ |
c626ae69 TL |
787 | struct shared_network *shared_network; |
788 | /* Networks connected to this interface. */ | |
17b95f41 | 789 | struct hardware hw_address; /* Its physical address. */ |
6b3b97e1 | 790 | struct in_addr primary_address; /* Primary interface address. */ |
c4763f5f TL |
791 | |
792 | u_int8_t *circuit_id; /* Circuit ID associated with this | |
793 | interface. */ | |
b1b7b521 | 794 | unsigned circuit_id_len; /* Length of Circuit ID, if there |
c4763f5f TL |
795 | is one. */ |
796 | u_int8_t *remote_id; /* Remote ID associated with this | |
797 | interface (if any). */ | |
b1b7b521 | 798 | unsigned remote_id_len; /* Length of Remote ID. */ |
c4763f5f | 799 | |
17b95f41 | 800 | char name [IFNAMSIZ]; /* Its name... */ |
f3aad410 | 801 | int index; /* Its index. */ |
17b95f41 TL |
802 | int rfdesc; /* Its read file descriptor. */ |
803 | int wfdesc; /* Its write file descriptor, if | |
804 | different. */ | |
805 | unsigned char *rbuf; /* Read buffer, if required. */ | |
98311e4b | 806 | unsigned int rbuf_max; /* Size of read buffer. */ |
17b95f41 TL |
807 | size_t rbuf_offset; /* Current offset into buffer. */ |
808 | size_t rbuf_len; /* Length of data in buffer. */ | |
c626ae69 | 809 | |
41fb155b | 810 | struct ifreq *ifp; /* Pointer to ifreq struct. */ |
7f91dcfb TL |
811 | u_int32_t flags; /* Control flags... */ |
812 | #define INTERFACE_REQUESTED 1 | |
5a526cf8 | 813 | #define INTERFACE_AUTOMATIC 2 |
347de8bd | 814 | #define INTERFACE_RUNNING 4 |
cc26de46 TL |
815 | |
816 | /* Only used by DHCP client code. */ | |
817 | struct client_state *client; | |
3d2aa1bf BC |
818 | # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) |
819 | int dlpi_sap_length; | |
820 | struct hardware dlpi_broadcast_addr; | |
821 | # endif /* DLPI_SEND || DLPI_RECEIVE */ | |
17b95f41 TL |
822 | }; |
823 | ||
824 | struct hardware_link { | |
825 | struct hardware_link *next; | |
826 | char name [IFNAMSIZ]; | |
827 | struct hardware address; | |
828 | }; | |
829 | ||
76d5bd36 TL |
830 | typedef void (*tvref_t)(void *, void *, const char *, int); |
831 | typedef void (*tvunref_t)(void *, const char *, int); | |
cc26de46 TL |
832 | struct timeout { |
833 | struct timeout *next; | |
834 | TIME when; | |
6e5ed8bf TL |
835 | void (*func) PROTO ((void *)); |
836 | void *what; | |
76d5bd36 TL |
837 | tvref_t ref; |
838 | tvunref_t unref; | |
6e5ed8bf TL |
839 | }; |
840 | ||
841 | struct protocol { | |
842 | struct protocol *next; | |
843 | int fd; | |
844 | void (*handler) PROTO ((struct protocol *)); | |
845 | void *local; | |
cc26de46 TL |
846 | }; |
847 | ||
94f08824 TL |
848 | struct dns_query; /* forward */ |
849 | ||
850 | struct dns_wakeup { | |
851 | struct dns_wakeup *next; /* Next wakeup in chain. */ | |
852 | void (*func) PROTO ((struct dns_query *)); | |
853 | }; | |
854 | ||
5142937c TL |
855 | struct dns_question { |
856 | u_int16_t type; /* Type of query. */ | |
857 | u_int16_t class; /* Class of query. */ | |
858 | unsigned char data [1]; /* Query data. */ | |
859 | }; | |
860 | ||
861 | struct dns_answer { | |
862 | u_int16_t type; /* Type of answer. */ | |
863 | u_int16_t class; /* Class of answer. */ | |
864 | int count; /* Number of answers. */ | |
865 | unsigned char *answers[1]; /* Pointers to answers. */ | |
866 | }; | |
867 | ||
94f08824 TL |
868 | struct dns_query { |
869 | struct dns_query *next; /* Next query in hash bucket. */ | |
5142937c | 870 | u_int32_t hash; /* Hash bucket index. */ |
94f08824 TL |
871 | TIME expiry; /* Query expiry time (zero if not yet |
872 | answered. */ | |
873 | u_int16_t id; /* Query ID (also hash table index) */ | |
874 | caddr_t waiters; /* Pointer to list of things waiting | |
875 | on this query. */ | |
5142937c TL |
876 | |
877 | struct dns_question *question; /* Question, internal format. */ | |
878 | struct dns_answer *answer; /* Answer, internal format. */ | |
879 | ||
880 | unsigned char *query; /* Query formatted for DNS server. */ | |
b1b7b521 | 881 | unsigned len; /* Length of entire query. */ |
94f08824 TL |
882 | int sent; /* The query has been sent. */ |
883 | struct dns_wakeup *wakeups; /* Wakeups to call if this query is | |
884 | answered. */ | |
885 | struct name_server *next_server; /* Next server to try. */ | |
886 | int backoff; /* Current backoff, in seconds. */ | |
887 | }; | |
888 | ||
3f09cb5a TL |
889 | struct dns_zone { |
890 | int refcnt; | |
891 | TIME timeout; | |
892 | char *name; | |
893 | struct option_cache *primary; | |
894 | struct option_cache *secondary; | |
49146f3c | 895 | struct auth_key *key; |
3f09cb5a TL |
896 | }; |
897 | ||
d758ad8c TL |
898 | struct icmp_state { |
899 | OMAPI_OBJECT_PREAMBLE; | |
900 | int socket; | |
901 | void (*icmp_handler) PROTO ((struct iaddr, u_int8_t *, int)); | |
902 | }; | |
903 | ||
f3aad410 TL |
904 | #include "ctrace.h" |
905 | ||
d7837182 TL |
906 | /* Bitmask of dhcp option codes. */ |
907 | typedef unsigned char option_mask [16]; | |
908 | ||
909 | /* DHCP Option mask manipulation macros... */ | |
910 | #define OPTION_ZERO(mask) (memset (mask, 0, 16)) | |
911 | #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7))) | |
912 | #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7))) | |
913 | #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7))) | |
914 | #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit)) | |
915 | ||
916 | /* An option occupies its length plus two header bytes (code and | |
917 | length) for every 255 bytes that must be stored. */ | |
918 | #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1)) | |
919 | ||
920 | /* Default path to dhcpd config file. */ | |
d7837182 | 921 | #ifdef DEBUG |
80ba033e | 922 | #undef _PATH_DHCPD_CONF |
d7837182 | 923 | #define _PATH_DHCPD_CONF "dhcpd.conf" |
80ba033e | 924 | #undef _PATH_DHCPD_DB |
1358b874 | 925 | #define _PATH_DHCPD_DB "dhcpd.leases" |
98311e4b DH |
926 | #undef _PATH_DHCPD_PID |
927 | #define _PATH_DHCPD_PID "dhcpd.pid" | |
d7837182 | 928 | #else |
a8b53b42 | 929 | #ifndef _PATH_DHCPD_CONF |
d7837182 | 930 | #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" |
a8b53b42 TL |
931 | #endif |
932 | ||
933 | #ifndef _PATH_DHCPD_DB | |
6e47d3d8 | 934 | #define _PATH_DHCPD_DB "/etc/dhcpd.leases" |
d7837182 | 935 | #endif |
a8b53b42 TL |
936 | |
937 | #ifndef _PATH_DHCPD_PID | |
938 | #define _PATH_DHCPD_PID "/var/run/dhcpd.pid" | |
939 | #endif | |
d7837182 TL |
940 | #endif |
941 | ||
cc26de46 TL |
942 | #ifndef _PATH_DHCLIENT_CONF |
943 | #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" | |
944 | #endif | |
945 | ||
e47988bf TL |
946 | #ifndef _PATH_DHCLIENT_SCRIPT |
947 | #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script" | |
948 | #endif | |
949 | ||
cc26de46 TL |
950 | #ifndef _PATH_DHCLIENT_PID |
951 | #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" | |
952 | #endif | |
953 | ||
954 | #ifndef _PATH_DHCLIENT_DB | |
955 | #define _PATH_DHCLIENT_DB "/etc/dhclient.leases" | |
956 | #endif | |
957 | ||
0c7802b1 TL |
958 | #ifndef _PATH_RESOLV_CONF |
959 | #define _PATH_RESOLV_CONF "/etc/resolv.conf" | |
960 | #endif | |
cc26de46 | 961 | |
8afb9ae0 TL |
962 | #ifndef _PATH_DHCRELAY_PID |
963 | #define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid" | |
964 | #endif | |
965 | ||
ab370123 TL |
966 | #ifndef DHCPD_LOG_FACILITY |
967 | #define DHCPD_LOG_FACILITY LOG_DAEMON | |
968 | #endif | |
969 | ||
d7837182 TL |
970 | #define MAX_TIME 0x7fffffff |
971 | #define MIN_TIME 0 | |
972 | ||
973 | /* External definitions... */ | |
974 | ||
98311e4b DH |
975 | HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t) |
976 | HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t) | |
977 | HASH_FUNCTIONS_DECL (option, const char *, struct option, option_hash_t) | |
978 | HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t) | |
979 | HASH_FUNCTIONS_DECL (lease, const unsigned char *, struct lease, lease_hash_t) | |
980 | HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t) | |
981 | HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t) | |
982 | ||
d7837182 TL |
983 | /* options.c */ |
984 | ||
432604c3 | 985 | extern struct option *vendor_cfg_option; |
27fe61a7 | 986 | int parse_options PROTO ((struct packet *)); |
6f56b7e2 TL |
987 | int parse_option_buffer PROTO ((struct option_state *, const unsigned char *, |
988 | unsigned, struct universe *)); | |
989 | struct universe *find_option_universe (struct option *, const char *); | |
432604c3 | 990 | int parse_encapsulated_suboptions (struct option_state *, struct option *, |
6f56b7e2 TL |
991 | const unsigned char *, unsigned, |
992 | struct universe *, const char *); | |
da38df14 | 993 | int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *, |
159bcce3 | 994 | struct client_state *, |
f3e8ea32 | 995 | int, struct option_state *, struct option_state *, |
6ceb9118 | 996 | struct binding_scope **, |
432604c3 TL |
997 | int, int, int, struct data_string *, const char *)); |
998 | int fqdn_universe_decode (struct option_state *, | |
6f56b7e2 | 999 | const unsigned char *, unsigned, struct universe *); |
98311e4b | 1000 | int store_options PROTO ((int *, unsigned char *, unsigned, struct packet *, |
159bcce3 TL |
1001 | struct lease *, struct client_state *, |
1002 | struct option_state *, | |
6ceb9118 | 1003 | struct option_state *, struct binding_scope **, |
432604c3 TL |
1004 | unsigned *, int, unsigned, unsigned, |
1005 | int, const char *)); | |
88cd8aca DH |
1006 | int format_has_text(const char *); |
1007 | int format_min_length(const char *, struct option_cache *); | |
6f56b7e2 | 1008 | const char *pretty_print_option PROTO ((struct option *, const unsigned char *, |
b1b7b521 | 1009 | unsigned, int, int)); |
432604c3 | 1010 | int get_option (struct data_string *, struct universe *, |
159bcce3 | 1011 | struct packet *, struct lease *, struct client_state *, |
432604c3 | 1012 | struct option_state *, struct option_state *, |
d758ad8c TL |
1013 | struct option_state *, struct binding_scope **, unsigned, |
1014 | const char *, int); | |
432604c3 TL |
1015 | void set_option (struct universe *, struct option_state *, |
1016 | struct option_cache *, enum statement_op); | |
4f58da18 | 1017 | struct option_cache *lookup_option PROTO ((struct universe *, |
b1b7b521 | 1018 | struct option_state *, unsigned)); |
4f58da18 | 1019 | struct option_cache *lookup_hashed_option PROTO ((struct universe *, |
b1b7b521 TL |
1020 | struct option_state *, |
1021 | unsigned)); | |
432604c3 TL |
1022 | int save_option_buffer (struct universe *, struct option_state *, |
1023 | struct buffer *, unsigned char *, unsigned, | |
1024 | struct option *, int); | |
4f58da18 TL |
1025 | void save_option PROTO ((struct universe *, |
1026 | struct option_state *, struct option_cache *)); | |
1027 | void save_hashed_option PROTO ((struct universe *, | |
1028 | struct option_state *, struct option_cache *)); | |
1029 | void delete_option PROTO ((struct universe *, struct option_state *, int)); | |
1030 | void delete_hashed_option PROTO ((struct universe *, | |
1031 | struct option_state *, int)); | |
4bd8800e TL |
1032 | int option_cache_dereference PROTO ((struct option_cache **, |
1033 | const char *, int)); | |
4f58da18 | 1034 | int hashed_option_state_dereference PROTO ((struct universe *, |
0dbb132f TL |
1035 | struct option_state *, |
1036 | const char *, int)); | |
4f58da18 | 1037 | int store_option PROTO ((struct data_string *, |
f3e8ea32 | 1038 | struct universe *, struct packet *, struct lease *, |
159bcce3 | 1039 | struct client_state *, |
f3e8ea32 | 1040 | struct option_state *, struct option_state *, |
6ceb9118 | 1041 | struct binding_scope **, struct option_cache *)); |
4f58da18 | 1042 | int option_space_encapsulate PROTO ((struct data_string *, |
f3e8ea32 | 1043 | struct packet *, struct lease *, |
159bcce3 | 1044 | struct client_state *, |
f3e8ea32 | 1045 | struct option_state *, |
4f58da18 | 1046 | struct option_state *, |
6ceb9118 | 1047 | struct binding_scope **, |
4f58da18 TL |
1048 | struct data_string *)); |
1049 | int hashed_option_space_encapsulate PROTO ((struct data_string *, | |
f3e8ea32 | 1050 | struct packet *, struct lease *, |
159bcce3 | 1051 | struct client_state *, |
f3e8ea32 | 1052 | struct option_state *, |
4f58da18 | 1053 | struct option_state *, |
6ceb9118 | 1054 | struct binding_scope **, |
4f58da18 | 1055 | struct universe *)); |
69bb758c TL |
1056 | int nwip_option_space_encapsulate PROTO ((struct data_string *, |
1057 | struct packet *, struct lease *, | |
159bcce3 | 1058 | struct client_state *, |
69bb758c TL |
1059 | struct option_state *, |
1060 | struct option_state *, | |
6ceb9118 | 1061 | struct binding_scope **, |
69bb758c | 1062 | struct universe *)); |
432604c3 TL |
1063 | int fqdn_option_space_encapsulate (struct data_string *, |
1064 | struct packet *, struct lease *, | |
159bcce3 | 1065 | struct client_state *, |
432604c3 TL |
1066 | struct option_state *, |
1067 | struct option_state *, | |
1068 | struct binding_scope **, | |
1069 | struct universe *); | |
159bcce3 TL |
1070 | void suboption_foreach (struct packet *, struct lease *, struct client_state *, |
1071 | struct option_state *, struct option_state *, | |
1072 | struct binding_scope **, struct universe *, void *, | |
1073 | void (*) (struct option_cache *, struct packet *, | |
1074 | struct lease *, struct client_state *, | |
1075 | struct option_state *, struct option_state *, | |
6f56b7e2 TL |
1076 | struct binding_scope **, |
1077 | struct universe *, void *), | |
1078 | struct option_cache *, const char *); | |
432604c3 | 1079 | void option_space_foreach (struct packet *, struct lease *, |
159bcce3 | 1080 | struct client_state *, |
432604c3 TL |
1081 | struct option_state *, |
1082 | struct option_state *, | |
1083 | struct binding_scope **, | |
1084 | struct universe *, void *, | |
1085 | void (*) (struct option_cache *, | |
1086 | struct packet *, | |
159bcce3 TL |
1087 | struct lease *, struct client_state *, |
1088 | struct option_state *, | |
432604c3 TL |
1089 | struct option_state *, |
1090 | struct binding_scope **, | |
1091 | struct universe *, void *)); | |
1092 | void hashed_option_space_foreach (struct packet *, struct lease *, | |
159bcce3 | 1093 | struct client_state *, |
432604c3 TL |
1094 | struct option_state *, |
1095 | struct option_state *, | |
1096 | struct binding_scope **, | |
1097 | struct universe *, void *, | |
1098 | void (*) (struct option_cache *, | |
1099 | struct packet *, | |
1100 | struct lease *, | |
159bcce3 | 1101 | struct client_state *, |
432604c3 TL |
1102 | struct option_state *, |
1103 | struct option_state *, | |
1104 | struct binding_scope **, | |
1105 | struct universe *, void *)); | |
1106 | int linked_option_get PROTO ((struct data_string *, struct universe *, | |
1107 | struct packet *, struct lease *, | |
159bcce3 | 1108 | struct client_state *, |
432604c3 TL |
1109 | struct option_state *, struct option_state *, |
1110 | struct option_state *, struct binding_scope **, | |
1111 | unsigned)); | |
1112 | int linked_option_state_dereference PROTO ((struct universe *, | |
1113 | struct option_state *, | |
1114 | const char *, int)); | |
1115 | void save_linked_option (struct universe *, struct option_state *, | |
1116 | struct option_cache *); | |
1117 | void linked_option_space_foreach (struct packet *, struct lease *, | |
159bcce3 | 1118 | struct client_state *, |
432604c3 TL |
1119 | struct option_state *, |
1120 | struct option_state *, | |
1121 | struct binding_scope **, | |
1122 | struct universe *, void *, | |
1123 | void (*) (struct option_cache *, | |
1124 | struct packet *, | |
1125 | struct lease *, | |
159bcce3 | 1126 | struct client_state *, |
432604c3 TL |
1127 | struct option_state *, |
1128 | struct option_state *, | |
1129 | struct binding_scope **, | |
1130 | struct universe *, void *)); | |
1131 | int linked_option_space_encapsulate (struct data_string *, struct packet *, | |
159bcce3 TL |
1132 | struct lease *, struct client_state *, |
1133 | struct option_state *, | |
432604c3 TL |
1134 | struct option_state *, |
1135 | struct binding_scope **, | |
1136 | struct universe *); | |
1137 | void delete_linked_option (struct universe *, struct option_state *, int); | |
1138 | struct option_cache *lookup_linked_option (struct universe *, | |
1139 | struct option_state *, unsigned); | |
1140 | void do_packet PROTO ((struct interface_info *, | |
1141 | struct dhcp_packet *, unsigned, | |
1142 | unsigned int, struct iaddr, struct hardware *)); | |
d7837182 | 1143 | |
d7837182 | 1144 | /* dhcpd.c */ |
8fdfeffe | 1145 | extern TIME cur_time; |
685963dc | 1146 | |
dbcc689e TL |
1147 | int ddns_update_style; |
1148 | ||
b1b7b521 TL |
1149 | extern const char *path_dhcpd_conf; |
1150 | extern const char *path_dhcpd_db; | |
1151 | extern const char *path_dhcpd_pid; | |
e2ac5814 | 1152 | |
5142937c TL |
1153 | extern int dhcp_max_agent_option_packet_length; |
1154 | ||
d7837182 | 1155 | int main PROTO ((int, char **, char **)); |
f3aad410 | 1156 | void postconf_initialization (int); |
d758ad8c | 1157 | void postdb_startup (void); |
d7837182 | 1158 | void cleanup PROTO ((void)); |
e5078937 TL |
1159 | void lease_pinged PROTO ((struct iaddr, u_int8_t *, int)); |
1160 | void lease_ping_timeout PROTO ((void *)); | |
20916cae | 1161 | int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia); |
d758ad8c TL |
1162 | enum dhcp_shutdown_state shutdown_state; |
1163 | isc_result_t dhcp_io_shutdown (omapi_object_t *, void *); | |
1164 | isc_result_t dhcp_set_control_state (control_object_state_t oldstate, | |
1165 | control_object_state_t newstate); | |
d7837182 TL |
1166 | |
1167 | /* conflex.c */ | |
b1b7b521 | 1168 | isc_result_t new_parse PROTO ((struct parse **, int, |
96c823d5 | 1169 | char *, unsigned, const char *, int)); |
fde86d2d | 1170 | isc_result_t end_parse PROTO ((struct parse **)); |
b3519f23 TL |
1171 | enum dhcp_token next_token PROTO ((const char **, unsigned *, struct parse *)); |
1172 | enum dhcp_token peek_token PROTO ((const char **, unsigned *, struct parse *)); | |
d7837182 TL |
1173 | |
1174 | /* confpars.c */ | |
f3aad410 | 1175 | void parse_trace_setup (void); |
fde86d2d | 1176 | isc_result_t readconf PROTO ((void)); |
f3aad410 TL |
1177 | isc_result_t read_conf_file (const char *, struct group *, int, int); |
1178 | #if defined (TRACING) | |
1179 | void trace_conf_input (trace_type_t *, unsigned, char *); | |
1180 | void trace_conf_stop (trace_type_t *ttype); | |
1181 | #endif | |
1182 | isc_result_t conf_file_subparse (struct parse *, struct group *, int); | |
1183 | isc_result_t lease_file_subparse (struct parse *); | |
fde86d2d | 1184 | int parse_statement PROTO ((struct parse *, |
750d0800 | 1185 | struct group *, int, struct host_decl *, int)); |
a7982987 | 1186 | #if defined (FAILOVER_PROTOCOL) |
fde86d2d | 1187 | void parse_failover_peer PROTO ((struct parse *, struct group *, int)); |
a7982987 TL |
1188 | void parse_failover_state_declaration (struct parse *, |
1189 | dhcp_failover_state_t *); | |
5b7f941d TL |
1190 | void parse_failover_state PROTO ((struct parse *, |
1191 | enum failover_state *, TIME *)); | |
a7982987 | 1192 | #endif |
98311e4b | 1193 | int permit_list_match (struct permit *, struct permit *); |
fde86d2d TL |
1194 | void parse_pool_statement PROTO ((struct parse *, struct group *, int)); |
1195 | int parse_boolean PROTO ((struct parse *)); | |
1196 | int parse_lbrace PROTO ((struct parse *)); | |
1197 | void parse_host_declaration PROTO ((struct parse *, struct group *)); | |
20916cae TL |
1198 | int parse_class_declaration PROTO ((struct class **, struct parse *, |
1199 | struct group *, int)); | |
fde86d2d TL |
1200 | void parse_shared_net_declaration PROTO ((struct parse *, struct group *)); |
1201 | void parse_subnet_declaration PROTO ((struct parse *, | |
1202 | struct shared_network *)); | |
1203 | void parse_group_declaration PROTO ((struct parse *, struct group *)); | |
1204 | int parse_fixed_addr_param PROTO ((struct option_cache **, struct parse *)); | |
1205 | TIME parse_timestamp PROTO ((struct parse *)); | |
20916cae | 1206 | int parse_lease_declaration PROTO ((struct lease **, struct parse *)); |
98311e4b DH |
1207 | void parse_address_range PROTO ((struct parse *, struct group *, int, |
1208 | struct pool *, struct lease **)); | |
8bdd4d02 | 1209 | |
b992d7e2 | 1210 | /* ddns.c */ |
cc4473a0 | 1211 | int ddns_updates PROTO ((struct packet *, struct lease *, struct lease *, |
b992d7e2 DN |
1212 | struct lease_state *)); |
1213 | int ddns_removals PROTO ((struct lease *)); | |
1214 | ||
8bdd4d02 | 1215 | /* parse.c */ |
dbcc689e TL |
1216 | void add_enumeration (struct enumeration *); |
1217 | struct enumeration *find_enumeration (const char *, int); | |
1218 | struct enumeration_value *find_enumeration_value (const char *, int, | |
1219 | const char *); | |
fde86d2d TL |
1220 | void skip_to_semi PROTO ((struct parse *)); |
1221 | void skip_to_rbrace PROTO ((struct parse *, int)); | |
1222 | int parse_semi PROTO ((struct parse *)); | |
b3519f23 | 1223 | int parse_string PROTO ((struct parse *, char **, unsigned *)); |
fde86d2d TL |
1224 | char *parse_host_name PROTO ((struct parse *)); |
1225 | int parse_ip_addr_or_hostname PROTO ((struct expression **, | |
1226 | struct parse *, int)); | |
1227 | void parse_hardware_param PROTO ((struct parse *, struct hardware *)); | |
1228 | void parse_lease_time PROTO ((struct parse *, TIME *)); | |
1229 | unsigned char *parse_numeric_aggregate PROTO ((struct parse *, | |
b1b7b521 TL |
1230 | unsigned char *, unsigned *, |
1231 | int, int, unsigned)); | |
1232 | void convert_num PROTO ((struct parse *, unsigned char *, const char *, | |
1233 | int, unsigned)); | |
fde86d2d | 1234 | TIME parse_date PROTO ((struct parse *)); |
b1b7b521 | 1235 | struct option *parse_option_name PROTO ((struct parse *, int, int *)); |
fde86d2d TL |
1236 | void parse_option_space_decl PROTO ((struct parse *)); |
1237 | int parse_option_code_definition PROTO ((struct parse *, struct option *)); | |
a59ea078 | 1238 | int parse_base64 (struct data_string *, struct parse *); |
fde86d2d | 1239 | int parse_cshl PROTO ((struct data_string *, struct parse *)); |
79a65726 | 1240 | int parse_executable_statement PROTO ((struct executable_statement **, |
69bb758c TL |
1241 | struct parse *, int *, |
1242 | enum expression_context)); | |
79a65726 | 1243 | int parse_executable_statements PROTO ((struct executable_statement **, |
69bb758c TL |
1244 | struct parse *, int *, |
1245 | enum expression_context)); | |
3f09cb5a | 1246 | int parse_zone (struct dns_zone *, struct parse *); |
a59ea078 | 1247 | int parse_key (struct parse *); |
fde86d2d TL |
1248 | int parse_on_statement PROTO ((struct executable_statement **, |
1249 | struct parse *, int *)); | |
69bb758c TL |
1250 | int parse_switch_statement PROTO ((struct executable_statement **, |
1251 | struct parse *, int *)); | |
1252 | int parse_case_statement PROTO ((struct executable_statement **, | |
1253 | struct parse *, int *, | |
1254 | enum expression_context)); | |
fde86d2d TL |
1255 | int parse_if_statement PROTO ((struct executable_statement **, |
1256 | struct parse *, int *)); | |
1257 | int parse_boolean_expression PROTO ((struct expression **, | |
1258 | struct parse *, int *)); | |
1259 | int parse_data_expression PROTO ((struct expression **, | |
1260 | struct parse *, int *)); | |
1261 | int parse_numeric_expression PROTO ((struct expression **, | |
1262 | struct parse *, int *)); | |
5b7f941d | 1263 | int parse_dns_expression PROTO ((struct expression **, struct parse *, int *)); |
fde86d2d | 1264 | int parse_non_binary PROTO ((struct expression **, struct parse *, int *, |
27fe61a7 | 1265 | enum expression_context)); |
fde86d2d | 1266 | int parse_expression PROTO ((struct expression **, struct parse *, int *, |
27fe61a7 TL |
1267 | enum expression_context, |
1268 | struct expression **, enum expr_op)); | |
fde86d2d TL |
1269 | int parse_option_statement PROTO ((struct executable_statement **, |
1270 | struct parse *, int, | |
79a65726 | 1271 | struct option *, enum statement_op)); |
b1b7b521 | 1272 | int parse_option_token PROTO ((struct expression **, struct parse *, |
de427245 | 1273 | const char **, struct expression *, int, int)); |
fde86d2d TL |
1274 | int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int)); |
1275 | int parse_auth_key PROTO ((struct data_string *, struct parse *)); | |
cfdfb9f1 | 1276 | int parse_warn (struct parse *, const char *, ...) |
4bd8800e | 1277 | __attribute__((__format__(__printf__,2,3))); |
d7837182 TL |
1278 | |
1279 | /* tree.c */ | |
de427245 TL |
1280 | #if defined (NSUPDATE) |
1281 | extern struct __res_state resolver_state; | |
1282 | extern int resolver_inited; | |
1283 | #endif | |
1284 | ||
6ceb9118 | 1285 | extern struct binding_scope *global_scope; |
d7837182 | 1286 | pair cons PROTO ((caddr_t, pair)); |
27fe61a7 | 1287 | int make_const_option_cache PROTO ((struct option_cache **, struct buffer **, |
b1b7b521 | 1288 | u_int8_t *, unsigned, struct option *, |
4bd8800e | 1289 | const char *, int)); |
b1b7b521 TL |
1290 | int make_host_lookup PROTO ((struct expression **, const char *)); |
1291 | int enter_dns_host PROTO ((struct dns_host_entry **, const char *)); | |
d758ad8c TL |
1292 | int make_const_data (struct expression **, |
1293 | const unsigned char *, unsigned, int, int, | |
1294 | const char *, int); | |
7f6ad5ac | 1295 | int make_const_int PROTO ((struct expression **, unsigned long)); |
27fe61a7 TL |
1296 | int make_concat PROTO ((struct expression **, |
1297 | struct expression *, struct expression *)); | |
4f58da18 | 1298 | int make_encapsulation PROTO ((struct expression **, struct data_string *)); |
27fe61a7 TL |
1299 | int make_substring PROTO ((struct expression **, struct expression *, |
1300 | struct expression *, struct expression *)); | |
1301 | int make_limit PROTO ((struct expression **, struct expression *, int)); | |
7f6ad5ac | 1302 | int make_let PROTO ((struct executable_statement **, const char *)); |
27fe61a7 | 1303 | int option_cache PROTO ((struct option_cache **, struct data_string *, |
d758ad8c TL |
1304 | struct expression *, struct option *, |
1305 | const char *, int)); | |
17a10efe | 1306 | int evaluate_expression (struct binding_value **, struct packet *, |
159bcce3 TL |
1307 | struct lease *, struct client_state *, |
1308 | struct option_state *, struct option_state *, | |
d758ad8c TL |
1309 | struct binding_scope **, struct expression *, |
1310 | const char *, int); | |
17a10efe | 1311 | int binding_value_dereference (struct binding_value **, const char *, int); |
4bd8800e | 1312 | #if defined (NSUPDATE) |
5b7f941d | 1313 | int evaluate_dns_expression PROTO ((ns_updrec **, struct packet *, |
159bcce3 TL |
1314 | struct lease *, |
1315 | struct client_state *, | |
1316 | struct option_state *, | |
5b7f941d | 1317 | struct option_state *, |
6ceb9118 | 1318 | struct binding_scope **, |
5b7f941d | 1319 | struct expression *)); |
4bd8800e | 1320 | #endif |
27fe61a7 | 1321 | int evaluate_boolean_expression PROTO ((int *, |
f3e8ea32 | 1322 | struct packet *, struct lease *, |
159bcce3 | 1323 | struct client_state *, |
f3e8ea32 TL |
1324 | struct option_state *, |
1325 | struct option_state *, | |
6ceb9118 | 1326 | struct binding_scope **, |
27fe61a7 TL |
1327 | struct expression *)); |
1328 | int evaluate_data_expression PROTO ((struct data_string *, | |
f3e8ea32 | 1329 | struct packet *, struct lease *, |
159bcce3 | 1330 | struct client_state *, |
f3e8ea32 TL |
1331 | struct option_state *, |
1332 | struct option_state *, | |
6ceb9118 | 1333 | struct binding_scope **, |
d758ad8c | 1334 | struct expression *, const char *, int)); |
159bcce3 TL |
1335 | int evaluate_numeric_expression (unsigned long *, struct packet *, |
1336 | struct lease *, struct client_state *, | |
1337 | struct option_state *, struct option_state *, | |
1338 | struct binding_scope **, | |
1339 | struct expression *); | |
27fe61a7 | 1340 | int evaluate_option_cache PROTO ((struct data_string *, |
f3e8ea32 | 1341 | struct packet *, struct lease *, |
159bcce3 | 1342 | struct client_state *, |
f3e8ea32 | 1343 | struct option_state *, struct option_state *, |
6ceb9118 | 1344 | struct binding_scope **, |
4bd8800e TL |
1345 | struct option_cache *, |
1346 | const char *, int)); | |
4c026751 TL |
1347 | int evaluate_boolean_option_cache PROTO ((int *, |
1348 | struct packet *, struct lease *, | |
159bcce3 | 1349 | struct client_state *, |
f3e8ea32 | 1350 | struct option_state *, |
27fe61a7 | 1351 | struct option_state *, |
6ceb9118 | 1352 | struct binding_scope **, |
7f6ad5ac TL |
1353 | struct option_cache *, |
1354 | const char *, int)); | |
4c026751 TL |
1355 | int evaluate_boolean_expression_result PROTO ((int *, |
1356 | struct packet *, struct lease *, | |
159bcce3 | 1357 | struct client_state *, |
f3e8ea32 | 1358 | struct option_state *, |
27fe61a7 | 1359 | struct option_state *, |
6ceb9118 | 1360 | struct binding_scope **, |
4bd8800e TL |
1361 | struct expression *)); |
1362 | void expression_dereference PROTO ((struct expression **, const char *, int)); | |
5b7f941d | 1363 | int is_dns_expression PROTO ((struct expression *)); |
27fe61a7 TL |
1364 | int is_boolean_expression PROTO ((struct expression *)); |
1365 | int is_data_expression PROTO ((struct expression *)); | |
1366 | int is_numeric_expression PROTO ((struct expression *)); | |
69bb758c | 1367 | int is_compound_expression PROTO ((struct expression *)); |
27fe61a7 | 1368 | int op_precedence PROTO ((enum expr_op, enum expr_op)); |
cc4473a0 | 1369 | enum expression_context expression_context (struct expression *); |
27fe61a7 | 1370 | enum expression_context op_context PROTO ((enum expr_op)); |
7f6ad5ac TL |
1371 | int write_expression PROTO ((FILE *, struct expression *, int, int, int)); |
1372 | struct binding *find_binding PROTO ((struct binding_scope *, const char *)); | |
4bd8800e TL |
1373 | int free_bindings PROTO ((struct binding_scope *, const char *, int)); |
1374 | int binding_scope_dereference PROTO ((struct binding_scope **, | |
1375 | const char *, int)); | |
432604c3 TL |
1376 | int fundef_dereference (struct fundef **, const char *, int); |
1377 | int data_subexpression_length (int *, struct expression *); | |
1378 | int expr_valid_for_context (struct expression *, enum expression_context); | |
2f7ca092 TL |
1379 | struct binding *create_binding (struct binding_scope **, const char *); |
1380 | int bind_ds_value (struct binding_scope **, | |
1381 | const char *, struct data_string *); | |
1382 | int find_bound_string (struct data_string *, | |
1383 | struct binding_scope *, const char *); | |
1384 | int unset (struct binding_scope *, const char *); | |
d7837182 TL |
1385 | |
1386 | /* dhcp.c */ | |
e5078937 TL |
1387 | extern int outstanding_pings; |
1388 | ||
d7837182 | 1389 | void dhcp PROTO ((struct packet *)); |
5bc2e1f2 | 1390 | void dhcpdiscover PROTO ((struct packet *, int)); |
159bcce3 | 1391 | void dhcprequest PROTO ((struct packet *, int, struct lease *)); |
5bc2e1f2 TL |
1392 | void dhcprelease PROTO ((struct packet *, int)); |
1393 | void dhcpdecline PROTO ((struct packet *, int)); | |
1394 | void dhcpinform PROTO ((struct packet *, int)); | |
a8b53b42 | 1395 | void nak_lease PROTO ((struct packet *, struct iaddr *cip)); |
112a6c2c | 1396 | void ack_lease PROTO ((struct packet *, struct lease *, |
c75473d8 | 1397 | unsigned int, TIME, char *, int, struct host_decl *)); |
fc2df23a | 1398 | void dhcp_reply PROTO ((struct lease *)); |
20916cae | 1399 | int find_lease PROTO ((struct lease **, struct packet *, |
159bcce3 | 1400 | struct shared_network *, int *, int *, struct lease *, |
c489f075 | 1401 | const char *, int)); |
20916cae TL |
1402 | int mockup_lease PROTO ((struct lease **, struct packet *, |
1403 | struct shared_network *, | |
1404 | struct host_decl *)); | |
4bd8800e | 1405 | void static_lease_dereference PROTO ((struct lease *, const char *, int)); |
d7837182 | 1406 | |
20916cae TL |
1407 | int allocate_lease PROTO ((struct lease **, struct packet *, |
1408 | struct pool *, int *)); | |
734d2258 | 1409 | int permitted PROTO ((struct packet *, struct permit *)); |
940ea8ab | 1410 | int locate_network PROTO ((struct packet *)); |
516cf43a TL |
1411 | int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *)); |
1412 | unsigned cons_agent_information_options PROTO ((struct option_state *, | |
1413 | struct dhcp_packet *, | |
1414 | unsigned, unsigned)); | |
734d2258 | 1415 | |
d7837182 TL |
1416 | /* bootp.c */ |
1417 | void bootp PROTO ((struct packet *)); | |
1418 | ||
1419 | /* memory.c */ | |
20916cae TL |
1420 | int (*group_write_hook) (struct group_object *); |
1421 | extern struct group *root_group; | |
98311e4b | 1422 | extern group_hash_t *group_name_hash; |
20916cae TL |
1423 | isc_result_t delete_group (struct group_object *, int); |
1424 | isc_result_t supersede_group (struct group_object *, int); | |
1425 | int clone_group (struct group **, struct group *, const char *, int); | |
1426 | int write_group PROTO ((struct group_object *)); | |
1427 | ||
1428 | /* salloc.c */ | |
d758ad8c | 1429 | void relinquish_lease_hunks (void); |
20916cae | 1430 | struct lease *new_leases PROTO ((unsigned, const char *, int)); |
d758ad8c TL |
1431 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ |
1432 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
1433 | void relinquish_free_lease_states (void); | |
1434 | #endif | |
20916cae TL |
1435 | OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease) |
1436 | OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class) | |
899d754f | 1437 | OMAPI_OBJECT_ALLOC_DECL (subclass, struct class, dhcp_type_subclass) |
20916cae | 1438 | OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool) |
165bce70 | 1439 | OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host) |
d7837182 TL |
1440 | |
1441 | /* alloc.c */ | |
20916cae TL |
1442 | OMAPI_OBJECT_ALLOC_DECL (subnet, struct subnet, dhcp_type_subnet) |
1443 | OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network, | |
1444 | dhcp_type_shared_network) | |
1445 | OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group) | |
d758ad8c TL |
1446 | OMAPI_OBJECT_ALLOC_DECL (dhcp_control, |
1447 | dhcp_control_object_t, dhcp_type_control) | |
1448 | ||
1449 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ | |
1450 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
1451 | void relinquish_free_pairs (void); | |
1452 | void relinquish_free_expressions (void); | |
1453 | void relinquish_free_binding_values (void); | |
1454 | void relinquish_free_option_caches (void); | |
1455 | void relinquish_free_packets (void); | |
1456 | #endif | |
20916cae | 1457 | |
625f7cee TL |
1458 | int option_chain_head_allocate (struct option_chain_head **, |
1459 | const char *, int); | |
1460 | int option_chain_head_reference (struct option_chain_head **, | |
1461 | struct option_chain_head *, | |
1462 | const char *, int); | |
1463 | int option_chain_head_dereference (struct option_chain_head **, | |
1464 | const char *, int); | |
20916cae TL |
1465 | int group_allocate (struct group **, const char *, int); |
1466 | int group_reference (struct group **, struct group *, const char *, int); | |
1467 | int group_dereference (struct group **, const char *, int); | |
7f6ad5ac | 1468 | struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int)); |
7f6ad5ac TL |
1469 | struct protocol *new_protocol PROTO ((const char *, int)); |
1470 | struct lease_state *new_lease_state PROTO ((const char *, int)); | |
1471 | struct domain_search_list *new_domain_search_list PROTO ((const char *, int)); | |
1472 | struct name_server *new_name_server PROTO ((const char *, int)); | |
1473 | void free_name_server PROTO ((struct name_server *, const char *, int)); | |
1474 | struct option *new_option PROTO ((const char *, int)); | |
20916cae TL |
1475 | int group_allocate (struct group **, const char *, int); |
1476 | int group_reference (struct group **, struct group *, const char *, int); | |
1477 | int group_dereference (struct group **, const char *, int); | |
7f6ad5ac TL |
1478 | void free_option PROTO ((struct option *, const char *, int)); |
1479 | struct universe *new_universe PROTO ((const char *, int)); | |
1480 | void free_universe PROTO ((struct universe *, const char *, int)); | |
b1b7b521 | 1481 | void free_domain_search_list PROTO ((struct domain_search_list *, |
7f6ad5ac TL |
1482 | const char *, int)); |
1483 | void free_lease_state PROTO ((struct lease_state *, const char *, int)); | |
1484 | void free_protocol PROTO ((struct protocol *, const char *, int)); | |
7f6ad5ac TL |
1485 | void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *, int)); |
1486 | struct client_lease *new_client_lease PROTO ((const char *, int)); | |
1487 | void free_client_lease PROTO ((struct client_lease *, const char *, int)); | |
7f6ad5ac TL |
1488 | struct permit *new_permit PROTO ((const char *, int)); |
1489 | void free_permit PROTO ((struct permit *, const char *, int)); | |
1490 | pair new_pair PROTO ((const char *, int)); | |
1491 | void free_pair PROTO ((pair, const char *, int)); | |
1492 | int expression_allocate PROTO ((struct expression **, const char *, int)); | |
27fe61a7 | 1493 | int expression_reference PROTO ((struct expression **, |
7f6ad5ac TL |
1494 | struct expression *, const char *, int)); |
1495 | void free_expression PROTO ((struct expression *, const char *, int)); | |
17a10efe TL |
1496 | int binding_value_allocate PROTO ((struct binding_value **, |
1497 | const char *, int)); | |
1498 | int binding_value_reference PROTO ((struct binding_value **, | |
1499 | struct binding_value *, | |
1500 | const char *, int)); | |
1501 | void free_binding_value PROTO ((struct binding_value *, const char *, int)); | |
664ec1de TL |
1502 | int fundef_allocate PROTO ((struct fundef **, const char *, int)); |
1503 | int fundef_reference PROTO ((struct fundef **, | |
1504 | struct fundef *, const char *, int)); | |
7f6ad5ac | 1505 | int option_cache_allocate PROTO ((struct option_cache **, const char *, int)); |
27fe61a7 | 1506 | int option_cache_reference PROTO ((struct option_cache **, |
7f6ad5ac TL |
1507 | struct option_cache *, const char *, int)); |
1508 | int buffer_allocate PROTO ((struct buffer **, unsigned, const char *, int)); | |
1509 | int buffer_reference PROTO ((struct buffer **, struct buffer *, | |
1510 | const char *, int)); | |
1511 | int buffer_dereference PROTO ((struct buffer **, const char *, int)); | |
b1b7b521 | 1512 | int dns_host_entry_allocate PROTO ((struct dns_host_entry **, |
7f6ad5ac | 1513 | const char *, const char *, int)); |
27fe61a7 | 1514 | int dns_host_entry_reference PROTO ((struct dns_host_entry **, |
7f6ad5ac TL |
1515 | struct dns_host_entry *, |
1516 | const char *, int)); | |
b1b7b521 | 1517 | int dns_host_entry_dereference PROTO ((struct dns_host_entry **, |
7f6ad5ac TL |
1518 | const char *, int)); |
1519 | int option_state_allocate PROTO ((struct option_state **, const char *, int)); | |
a340de95 | 1520 | int option_state_reference PROTO ((struct option_state **, |
7f6ad5ac TL |
1521 | struct option_state *, const char *, int)); |
1522 | int option_state_dereference PROTO ((struct option_state **, | |
1523 | const char *, int)); | |
1524 | void data_string_copy PROTO ((struct data_string *, | |
1525 | struct data_string *, const char *, int)); | |
1526 | void data_string_forget PROTO ((struct data_string *, const char *, int)); | |
1527 | void data_string_truncate PROTO ((struct data_string *, int)); | |
79a65726 | 1528 | int executable_statement_allocate PROTO ((struct executable_statement **, |
7f6ad5ac | 1529 | const char *, int)); |
79a65726 TL |
1530 | int executable_statement_reference PROTO ((struct executable_statement **, |
1531 | struct executable_statement *, | |
7f6ad5ac TL |
1532 | const char *, int)); |
1533 | int packet_allocate PROTO ((struct packet **, const char *, int)); | |
1534 | int packet_reference PROTO ((struct packet **, | |
1535 | struct packet *, const char *, int)); | |
1536 | int packet_dereference PROTO ((struct packet **, const char *, int)); | |
1537 | int binding_scope_allocate PROTO ((struct binding_scope **, | |
1538 | const char *, int)); | |
6ceb9118 TL |
1539 | int binding_scope_reference PROTO ((struct binding_scope **, |
1540 | struct binding_scope *, | |
1541 | const char *, int)); | |
3f09cb5a TL |
1542 | int dns_zone_allocate PROTO ((struct dns_zone **, const char *, int)); |
1543 | int dns_zone_reference PROTO ((struct dns_zone **, | |
1544 | struct dns_zone *, const char *, int)); | |
d7837182 TL |
1545 | |
1546 | /* print.c */ | |
d73c2404 TL |
1547 | char *quotify_string (const char *, const char *, int); |
1548 | char *quotify_buf (const unsigned char *, unsigned, const char *, int); | |
d758ad8c | 1549 | char *print_base64 (const unsigned char *, unsigned, const char *, int); |
d7837182 | 1550 | char *print_hw_addr PROTO ((int, int, unsigned char *)); |
97ca1699 | 1551 | void print_lease PROTO ((struct lease *)); |
b1b7b521 | 1552 | void dump_raw PROTO ((const unsigned char *, unsigned)); |
b2398d97 | 1553 | void dump_packet_option (struct option_cache *, struct packet *, |
159bcce3 TL |
1554 | struct lease *, struct client_state *, |
1555 | struct option_state *, struct option_state *, | |
1556 | struct binding_scope **, struct universe *, void *); | |
17b95f41 | 1557 | void dump_packet PROTO ((struct packet *)); |
c626ae69 | 1558 | void hash_dump PROTO ((struct hash_table *)); |
b1b7b521 TL |
1559 | char *print_hex_1 PROTO ((unsigned, const u_int8_t *, unsigned)); |
1560 | char *print_hex_2 PROTO ((unsigned, const u_int8_t *, unsigned)); | |
1561 | char *print_hex_3 PROTO ((unsigned, const u_int8_t *, unsigned)); | |
1562 | char *print_dotted_quads PROTO ((unsigned, const u_int8_t *)); | |
1563 | char *print_dec_1 PROTO ((unsigned long)); | |
1564 | char *print_dec_2 PROTO ((unsigned long)); | |
fd547e98 | 1565 | void print_expression PROTO ((const char *, struct expression *)); |
b1b7b521 TL |
1566 | int token_print_indent_concat (FILE *, int, int, |
1567 | const char *, const char *, ...); | |
1568 | int token_indent_data_string (FILE *, int, int, const char *, const char *, | |
fa098be8 | 1569 | struct data_string *); |
b1b7b521 TL |
1570 | int token_print_indent (FILE *, int, int, |
1571 | const char *, const char *, const char *); | |
fa098be8 | 1572 | void indent_spaces (FILE *, int); |
69bb758c TL |
1573 | #if defined (NSUPDATE) |
1574 | void print_dns_status (int, ns_updque *); | |
1575 | #endif | |
d7837182 TL |
1576 | |
1577 | /* socket.c */ | |
c626ae69 TL |
1578 | #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ |
1579 | || defined (USE_SOCKET_FALLBACK) | |
41fb155b | 1580 | int if_register_socket PROTO ((struct interface_info *)); |
17b95f41 TL |
1581 | #endif |
1582 | ||
5d4afdbc | 1583 | #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND) |
41fb155b TL |
1584 | void if_reinitialize_fallback PROTO ((struct interface_info *)); |
1585 | void if_register_fallback PROTO ((struct interface_info *)); | |
4595a58c TL |
1586 | ssize_t send_fallback PROTO ((struct interface_info *, |
1587 | struct packet *, struct dhcp_packet *, size_t, | |
1588 | struct in_addr, | |
1589 | struct sockaddr_in *, struct hardware *)); | |
c626ae69 TL |
1590 | #endif |
1591 | ||
6f10b1a4 | 1592 | #ifdef USE_SOCKET_SEND |
41fb155b | 1593 | void if_reinitialize_send PROTO ((struct interface_info *)); |
eb1aa668 | 1594 | void if_register_send PROTO ((struct interface_info *)); |
3f09cb5a | 1595 | void if_deregister_send PROTO ((struct interface_info *)); |
eb1aa668 | 1596 | ssize_t send_packet PROTO ((struct interface_info *, |
4595a58c TL |
1597 | struct packet *, struct dhcp_packet *, size_t, |
1598 | struct in_addr, | |
1599 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 TL |
1600 | #endif |
1601 | #ifdef USE_SOCKET_RECEIVE | |
41fb155b TL |
1602 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
1603 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 1604 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
1605 | ssize_t receive_packet PROTO ((struct interface_info *, |
1606 | unsigned char *, size_t, | |
1607 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 1608 | #endif |
b5c11cbe | 1609 | |
5d4afdbc | 1610 | #if defined (USE_SOCKET_FALLBACK) |
4fe74d72 | 1611 | isc_result_t fallback_discard PROTO ((omapi_object_t *)); |
b5c11cbe TL |
1612 | #endif |
1613 | ||
5d4afdbc | 1614 | #if defined (USE_SOCKET_SEND) |
319db03d TL |
1615 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
1616 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 1617 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 1618 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 1619 | #endif |
6f10b1a4 TL |
1620 | |
1621 | /* bpf.c */ | |
17b95f41 | 1622 | #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) |
41fb155b | 1623 | int if_register_bpf PROTO ( (struct interface_info *)); |
17b95f41 | 1624 | #endif |
6f10b1a4 | 1625 | #ifdef USE_BPF_SEND |
41fb155b TL |
1626 | void if_reinitialize_send PROTO ((struct interface_info *)); |
1627 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 1628 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
1629 | ssize_t send_packet PROTO ((struct interface_info *, |
1630 | struct packet *, struct dhcp_packet *, size_t, | |
1631 | struct in_addr, | |
1632 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 TL |
1633 | #endif |
1634 | #ifdef USE_BPF_RECEIVE | |
41fb155b TL |
1635 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
1636 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 1637 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
1638 | ssize_t receive_packet PROTO ((struct interface_info *, |
1639 | unsigned char *, size_t, | |
1640 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 1641 | #endif |
469cf3a4 | 1642 | #if defined (USE_BPF_SEND) |
319db03d TL |
1643 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
1644 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 1645 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 TL |
1646 | void maybe_setup_fallback PROTO ((void)); |
1647 | #endif | |
1648 | ||
1649 | /* lpf.c */ | |
1650 | #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) | |
1651 | int if_register_lpf PROTO ( (struct interface_info *)); | |
1652 | #endif | |
1653 | #ifdef USE_LPF_SEND | |
1654 | void if_reinitialize_send PROTO ((struct interface_info *)); | |
1655 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 1656 | void if_deregister_send PROTO ((struct interface_info *)); |
d1f2c520 TL |
1657 | ssize_t send_packet PROTO ((struct interface_info *, |
1658 | struct packet *, struct dhcp_packet *, size_t, | |
1659 | struct in_addr, | |
1660 | struct sockaddr_in *, struct hardware *)); | |
1661 | #endif | |
1662 | #ifdef USE_LPF_RECEIVE | |
1663 | void if_reinitialize_receive PROTO ((struct interface_info *)); | |
1664 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 1665 | void if_deregister_receive PROTO ((struct interface_info *)); |
d1f2c520 TL |
1666 | ssize_t receive_packet PROTO ((struct interface_info *, |
1667 | unsigned char *, size_t, | |
1668 | struct sockaddr_in *, struct hardware *)); | |
1669 | #endif | |
1670 | #if defined (USE_LPF_SEND) | |
319db03d TL |
1671 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
1672 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 1673 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 1674 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 1675 | #endif |
6f10b1a4 TL |
1676 | |
1677 | /* nit.c */ | |
41fb155b TL |
1678 | #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE) |
1679 | int if_register_nit PROTO ( (struct interface_info *)); | |
1680 | #endif | |
1681 | ||
6f10b1a4 | 1682 | #ifdef USE_NIT_SEND |
41fb155b TL |
1683 | void if_reinitialize_send PROTO ((struct interface_info *)); |
1684 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 1685 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
1686 | ssize_t send_packet PROTO ((struct interface_info *, |
1687 | struct packet *, struct dhcp_packet *, size_t, | |
1688 | struct in_addr, | |
1689 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 TL |
1690 | #endif |
1691 | #ifdef USE_NIT_RECEIVE | |
41fb155b TL |
1692 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
1693 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 1694 | void if_deregister_receive PROTO ((struct interface_info *)); |
4595a58c TL |
1695 | ssize_t receive_packet PROTO ((struct interface_info *, |
1696 | unsigned char *, size_t, | |
1697 | struct sockaddr_in *, struct hardware *)); | |
6f10b1a4 | 1698 | #endif |
94f08824 | 1699 | #if defined (USE_NIT_SEND) |
319db03d TL |
1700 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
1701 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 1702 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 1703 | void maybe_setup_fallback PROTO ((void)); |
469cf3a4 | 1704 | #endif |
6f10b1a4 | 1705 | |
94f08824 | 1706 | /* dlpi.c */ |
5142937c TL |
1707 | #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) |
1708 | int if_register_dlpi PROTO ( (struct interface_info *)); | |
1709 | #endif | |
1710 | ||
94f08824 | 1711 | #ifdef USE_DLPI_SEND |
5142937c TL |
1712 | void if_reinitialize_send PROTO ((struct interface_info *)); |
1713 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 1714 | void if_deregister_send PROTO ((struct interface_info *)); |
5142937c TL |
1715 | ssize_t send_packet PROTO ((struct interface_info *, |
1716 | struct packet *, struct dhcp_packet *, size_t, | |
1717 | struct in_addr, | |
1718 | struct sockaddr_in *, struct hardware *)); | |
94f08824 TL |
1719 | #endif |
1720 | #ifdef USE_DLPI_RECEIVE | |
5142937c TL |
1721 | void if_reinitialize_receive PROTO ((struct interface_info *)); |
1722 | void if_register_receive PROTO ((struct interface_info *)); | |
3f09cb5a | 1723 | void if_deregister_receive PROTO ((struct interface_info *)); |
5142937c TL |
1724 | ssize_t receive_packet PROTO ((struct interface_info *, |
1725 | unsigned char *, size_t, | |
1726 | struct sockaddr_in *, struct hardware *)); | |
94f08824 TL |
1727 | #endif |
1728 | ||
1729 | ||
6f10b1a4 TL |
1730 | /* raw.c */ |
1731 | #ifdef USE_RAW_SEND | |
41fb155b TL |
1732 | void if_reinitialize_send PROTO ((struct interface_info *)); |
1733 | void if_register_send PROTO ((struct interface_info *)); | |
3f09cb5a | 1734 | void if_deregister_send PROTO ((struct interface_info *)); |
4595a58c TL |
1735 | ssize_t send_packet PROTO ((struct interface_info *, |
1736 | struct packet *, struct dhcp_packet *, size_t, | |
1737 | struct in_addr, | |
1738 | struct sockaddr_in *, struct hardware *)); | |
319db03d TL |
1739 | int can_unicast_without_arp PROTO ((struct interface_info *)); |
1740 | int can_receive_unicast_unconfigured PROTO ((struct interface_info *)); | |
af380050 | 1741 | int supports_multiple_interfaces (struct interface_info *); |
d1f2c520 | 1742 | void maybe_setup_fallback PROTO ((void)); |
6f10b1a4 TL |
1743 | #endif |
1744 | ||
f3aad410 | 1745 | /* discover.c */ |
d1f2c520 | 1746 | extern struct interface_info *interfaces, |
339b0231 | 1747 | *dummy_interfaces, *fallback_interface; |
6e5ed8bf | 1748 | extern struct protocol *protocols; |
d032a71e | 1749 | extern int quiet_interface_discovery; |
8bed305d | 1750 | isc_result_t interface_setup (void); |
f3aad410 | 1751 | void interface_trace_setup (void); |
aa8579c0 TL |
1752 | |
1753 | extern struct in_addr limited_broadcast; | |
1754 | extern struct in_addr local_address; | |
1755 | ||
1756 | extern u_int16_t local_port; | |
1757 | extern u_int16_t remote_port; | |
20916cae TL |
1758 | extern int (*dhcp_interface_setup_hook) (struct interface_info *, |
1759 | struct iaddr *); | |
1760 | extern int (*dhcp_interface_discovery_hook) (struct interface_info *); | |
c1f22aef | 1761 | isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *); |
aa8579c0 | 1762 | |
6e5ed8bf | 1763 | extern void (*bootp_packet_handler) PROTO ((struct interface_info *, |
b1b7b521 | 1764 | struct dhcp_packet *, unsigned, |
2b9b6ff7 TL |
1765 | unsigned int, |
1766 | struct iaddr, struct hardware *)); | |
cc26de46 | 1767 | extern struct timeout *timeouts; |
4fe74d72 | 1768 | extern omapi_object_type_t *dhcp_type_interface; |
f3aad410 TL |
1769 | #if defined (TRACING) |
1770 | trace_type_t *interface_trace; | |
1771 | trace_type_t *inpacket_trace; | |
1772 | trace_type_t *outpacket_trace; | |
1773 | #endif | |
1774 | extern struct interface_info **interface_vector; | |
1775 | extern int interface_count; | |
1776 | extern int interface_max; | |
432604c3 | 1777 | isc_result_t interface_initialize (omapi_object_t *, const char *, int); |
8fec2c95 | 1778 | void discover_interfaces PROTO ((int)); |
20916cae | 1779 | int setup_fallback (struct interface_info **, const char *, int); |
4fe74d72 | 1780 | int if_readsocket PROTO ((omapi_object_t *)); |
41fb155b | 1781 | void reinitialize_interfaces PROTO ((void)); |
f3aad410 TL |
1782 | |
1783 | /* dispatch.c */ | |
88cd8aca | 1784 | void set_time(TIME); |
f3aad410 | 1785 | struct timeval *process_outstanding_timeouts (struct timeval *); |
6e5ed8bf | 1786 | void dispatch PROTO ((void)); |
4fe74d72 TL |
1787 | isc_result_t got_one PROTO ((omapi_object_t *)); |
1788 | isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *, | |
1789 | omapi_data_string_t *, omapi_typed_data_t *); | |
1790 | isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *, | |
1791 | omapi_data_string_t *, omapi_value_t **); | |
4bd8800e | 1792 | isc_result_t interface_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
1793 | isc_result_t interface_signal_handler (omapi_object_t *, |
1794 | const char *, va_list); | |
4fe74d72 TL |
1795 | isc_result_t interface_stuff_values (omapi_object_t *, |
1796 | omapi_object_t *, | |
1797 | omapi_object_t *); | |
1798 | ||
76d5bd36 TL |
1799 | void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *, |
1800 | tvref_t, tvunref_t)); | |
6e5ed8bf | 1801 | void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *)); |
d758ad8c TL |
1802 | void cancel_all_timeouts (void); |
1803 | void relinquish_timeouts (void); | |
1804 | #if 0 | |
b1b7b521 | 1805 | struct protocol *add_protocol PROTO ((const char *, int, |
29f5e9ce TL |
1806 | void (*) PROTO ((struct protocol *)), |
1807 | void *)); | |
d7837182 | 1808 | |
5a526cf8 | 1809 | void remove_protocol PROTO ((struct protocol *)); |
d758ad8c | 1810 | #endif |
20916cae | 1811 | OMAPI_OBJECT_ALLOC_DECL (interface, |
165bce70 | 1812 | struct interface_info, dhcp_type_interface) |
5a526cf8 | 1813 | |
d7837182 | 1814 | /* tables.c */ |
102ee7e9 | 1815 | extern struct universe dhcp_universe; |
d7837182 | 1816 | extern struct option dhcp_options [256]; |
432604c3 TL |
1817 | extern struct universe nwip_universe; |
1818 | extern struct option nwip_options [256]; | |
1819 | extern struct universe fqdn_universe; | |
1820 | extern struct option fqdn_options [256]; | |
27fe61a7 TL |
1821 | extern int dhcp_option_default_priority_list []; |
1822 | extern int dhcp_option_default_priority_list_count; | |
b1b7b521 | 1823 | extern const char *hardware_types [256]; |
4f58da18 TL |
1824 | int universe_count, universe_max; |
1825 | struct universe **universes; | |
98311e4b | 1826 | extern universe_hash_t *universe_hash; |
516cf43a | 1827 | void initialize_common_option_spaces PROTO ((void)); |
588af269 | 1828 | struct universe *config_universe; |
516cf43a TL |
1829 | |
1830 | /* stables.c */ | |
d9eefc5d | 1831 | #if defined (FAILOVER_PROTOCOL) |
76d5bd36 TL |
1832 | extern failover_option_t null_failover_option; |
1833 | extern failover_option_t skip_failover_option; | |
1834 | extern struct failover_option_info ft_options []; | |
1835 | extern u_int32_t fto_allowed []; | |
1836 | extern int ft_sizes []; | |
1837 | extern const char *dhcp_flink_state_names []; | |
d9eefc5d | 1838 | #endif |
007e3ee4 TL |
1839 | extern const char *binding_state_names []; |
1840 | ||
516cf43a TL |
1841 | extern struct universe agent_universe; |
1842 | extern struct option agent_options [256]; | |
1843 | extern struct universe server_universe; | |
1844 | extern struct option server_options [256]; | |
dbcc689e TL |
1845 | |
1846 | extern struct enumeration ddns_styles; | |
625f7cee | 1847 | extern struct enumeration syslog_enum; |
516cf43a | 1848 | void initialize_server_option_spaces PROTO ((void)); |
d7837182 | 1849 | |
089fb364 | 1850 | /* inet.c */ |
1358b874 | 1851 | struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr)); |
73fd5718 | 1852 | struct iaddr ip_addr PROTO ((struct iaddr, struct iaddr, u_int32_t)); |
69ea1884 | 1853 | struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr)); |
73fd5718 | 1854 | u_int32_t host_addr PROTO ((struct iaddr, struct iaddr)); |
1358b874 TL |
1855 | int addr_eq PROTO ((struct iaddr, struct iaddr)); |
1856 | char *piaddr PROTO ((struct iaddr)); | |
d758ad8c | 1857 | char *piaddrmask (struct iaddr, struct iaddr, const char *, int); |
95821729 TL |
1858 | |
1859 | /* dhclient.c */ | |
b1b7b521 TL |
1860 | extern const char *path_dhclient_conf; |
1861 | extern const char *path_dhclient_db; | |
1862 | extern const char *path_dhclient_pid; | |
e47988bf | 1863 | extern char *path_dhclient_script; |
5a526cf8 | 1864 | extern int interfaces_requested; |
cc26de46 TL |
1865 | |
1866 | extern struct client_config top_level_config; | |
1867 | ||
abe9a343 TL |
1868 | void dhcpoffer PROTO ((struct packet *)); |
1869 | void dhcpack PROTO ((struct packet *)); | |
1870 | void dhcpnak PROTO ((struct packet *)); | |
cc26de46 | 1871 | |
6e5ed8bf TL |
1872 | void send_discover PROTO ((void *)); |
1873 | void send_request PROTO ((void *)); | |
1874 | void send_release PROTO ((void *)); | |
1875 | void send_decline PROTO ((void *)); | |
cc26de46 | 1876 | |
6e5ed8bf TL |
1877 | void state_reboot PROTO ((void *)); |
1878 | void state_init PROTO ((void *)); | |
1879 | void state_selecting PROTO ((void *)); | |
1880 | void state_requesting PROTO ((void *)); | |
1881 | void state_bound PROTO ((void *)); | |
d758ad8c | 1882 | void state_stop PROTO ((void *)); |
6e5ed8bf | 1883 | void state_panic PROTO ((void *)); |
cc26de46 | 1884 | |
734d2258 | 1885 | void bind_lease PROTO ((struct client_state *)); |
0c7802b1 | 1886 | |
734d2258 | 1887 | void make_client_options PROTO ((struct client_state *, |
27fe61a7 TL |
1888 | struct client_lease *, u_int8_t *, |
1889 | struct option_cache *, struct iaddr *, | |
4f58da18 | 1890 | u_int32_t *, struct option_state **)); |
734d2258 TL |
1891 | void make_discover PROTO ((struct client_state *, struct client_lease *)); |
1892 | void make_request PROTO ((struct client_state *, struct client_lease *)); | |
1893 | void make_decline PROTO ((struct client_state *, struct client_lease *)); | |
1894 | void make_release PROTO ((struct client_state *, struct client_lease *)); | |
cc26de46 | 1895 | |
27fe61a7 | 1896 | void destroy_client_lease PROTO ((struct client_lease *)); |
cc26de46 | 1897 | void rewrite_client_leases PROTO ((void)); |
432604c3 | 1898 | void write_lease_option (struct option_cache *, struct packet *, |
159bcce3 TL |
1899 | struct lease *, struct client_state *, |
1900 | struct option_state *, struct option_state *, | |
1901 | struct binding_scope **, struct universe *, void *); | |
007e3ee4 TL |
1902 | int write_client_lease PROTO ((struct client_state *, |
1903 | struct client_lease *, int, int)); | |
32a47563 | 1904 | int dhcp_option_ev_name (char *, size_t, struct option *); |
cc26de46 | 1905 | |
b1b7b521 | 1906 | void script_init PROTO ((struct client_state *, const char *, |
6b3b97e1 | 1907 | struct string_list *)); |
432604c3 | 1908 | void client_option_envadd (struct option_cache *, struct packet *, |
159bcce3 TL |
1909 | struct lease *, struct client_state *, |
1910 | struct option_state *, struct option_state *, | |
1911 | struct binding_scope **, struct universe *, void *); | |
734d2258 | 1912 | void script_write_params PROTO ((struct client_state *, |
b1b7b521 | 1913 | const char *, struct client_lease *)); |
734d2258 | 1914 | int script_go PROTO ((struct client_state *)); |
32a47563 TL |
1915 | void client_envadd (struct client_state *, |
1916 | const char *, const char *, const char *, ...) | |
1917 | __attribute__((__format__(__printf__,4,5))); | |
cc26de46 | 1918 | |
6ceb9118 | 1919 | struct client_lease *packet_to_lease (struct packet *, struct client_state *); |
41fb155b | 1920 | void go_daemon PROTO ((void)); |
5a526cf8 | 1921 | void write_client_pid_file PROTO ((void)); |
5a526cf8 | 1922 | void client_location_changed PROTO ((void)); |
3f09cb5a | 1923 | void do_release PROTO ((struct client_state *)); |
20916cae TL |
1924 | int dhclient_interface_shutdown_hook (struct interface_info *); |
1925 | int dhclient_interface_discovery_hook (struct interface_info *); | |
c1f22aef | 1926 | isc_result_t dhclient_interface_startup_hook (struct interface_info *); |
98311e4b DH |
1927 | void client_dns_update_timeout (void *cp); |
1928 | isc_result_t client_dns_update (struct client_state *client, int, int); | |
95821729 | 1929 | |
1358b874 TL |
1930 | /* db.c */ |
1931 | int write_lease PROTO ((struct lease *)); | |
4fe74d72 | 1932 | int write_host PROTO ((struct host_decl *)); |
a7982987 TL |
1933 | #if defined (FAILOVER_PROTOCOL) |
1934 | int write_failover_state (dhcp_failover_state_t *); | |
1935 | #endif | |
b1b7b521 | 1936 | int db_printable PROTO ((const char *)); |
cfdfb9f1 | 1937 | int db_printable_len PROTO ((const unsigned char *, unsigned)); |
06e77c34 DH |
1938 | isc_result_t write_named_billing_class(const unsigned char *, unsigned, |
1939 | void *); | |
875d2b66 | 1940 | void write_billing_classes (void); |
112a6c2c | 1941 | int write_billing_class PROTO ((struct class *)); |
98311e4b | 1942 | void commit_leases_timeout PROTO ((void *)); |
1358b874 | 1943 | int commit_leases PROTO ((void)); |
fde86d2d | 1944 | void db_startup PROTO ((int)); |
d758ad8c | 1945 | int new_lease_file PROTO ((void)); |
20916cae | 1946 | int group_writer (struct group_object *); |
17b95f41 TL |
1947 | |
1948 | /* packet.c */ | |
b1b7b521 | 1949 | u_int32_t checksum PROTO ((unsigned char *, unsigned, u_int32_t)); |
e5078937 | 1950 | u_int32_t wrapsum PROTO ((u_int32_t)); |
17b95f41 | 1951 | void assemble_hw_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 1952 | unsigned *, struct hardware *)); |
17b95f41 | 1953 | void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 TL |
1954 | unsigned *, u_int32_t, u_int32_t, |
1955 | u_int32_t, unsigned char *, unsigned)); | |
4595a58c | 1956 | ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 1957 | unsigned, struct hardware *)); |
4595a58c | 1958 | ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *, |
b1b7b521 | 1959 | unsigned, struct sockaddr_in *, |
98311e4b | 1960 | unsigned)); |
ab370123 | 1961 | |
7d29d66d TL |
1962 | /* ethernet.c */ |
1963 | void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *, | |
b1b7b521 | 1964 | unsigned *, struct hardware *)); |
7d29d66d TL |
1965 | ssize_t decode_ethernet_header PROTO ((struct interface_info *, |
1966 | unsigned char *, | |
b1b7b521 | 1967 | unsigned, struct hardware *)); |
7d29d66d TL |
1968 | |
1969 | /* tr.c */ | |
1970 | void assemble_tr_header PROTO ((struct interface_info *, unsigned char *, | |
b1b7b521 | 1971 | unsigned *, struct hardware *)); |
7d29d66d TL |
1972 | ssize_t decode_tr_header PROTO ((struct interface_info *, |
1973 | unsigned char *, | |
b1b7b521 | 1974 | unsigned, struct hardware *)); |
7d29d66d | 1975 | |
ab370123 | 1976 | /* dhxpxlt.c */ |
fde86d2d TL |
1977 | void convert_statement PROTO ((struct parse *)); |
1978 | void convert_host_statement PROTO ((struct parse *, jrefproto)); | |
1979 | void convert_host_name PROTO ((struct parse *, jrefproto)); | |
1980 | void convert_class_statement PROTO ((struct parse *, jrefproto, int)); | |
1981 | void convert_class_decl PROTO ((struct parse *, jrefproto)); | |
1982 | void convert_lease_time PROTO ((struct parse *, jrefproto, char *)); | |
1983 | void convert_shared_net_statement PROTO ((struct parse *, jrefproto)); | |
1984 | void convert_subnet_statement PROTO ((struct parse *, jrefproto)); | |
1985 | void convert_subnet_decl PROTO ((struct parse *, jrefproto)); | |
1986 | void convert_host_decl PROTO ((struct parse *, jrefproto)); | |
1987 | void convert_hardware_decl PROTO ((struct parse *, jrefproto)); | |
1988 | void convert_hardware_addr PROTO ((struct parse *, jrefproto)); | |
1989 | void convert_filename_decl PROTO ((struct parse *, jrefproto)); | |
1990 | void convert_servername_decl PROTO ((struct parse *, jrefproto)); | |
1991 | void convert_ip_addr_or_hostname PROTO ((struct parse *, jrefproto, int)); | |
1992 | void convert_fixed_addr_decl PROTO ((struct parse *, jrefproto)); | |
1993 | void convert_option_decl PROTO ((struct parse *, jrefproto)); | |
1994 | void convert_timestamp PROTO ((struct parse *, jrefproto)); | |
1995 | void convert_lease_statement PROTO ((struct parse *, jrefproto)); | |
1996 | void convert_address_range PROTO ((struct parse *, jrefproto)); | |
1997 | void convert_date PROTO ((struct parse *, jrefproto, char *)); | |
1998 | void convert_numeric_aggregate PROTO ((struct parse *, jrefproto, int, int, int, int)); | |
ab370123 | 1999 | void indent PROTO ((int)); |
469cf3a4 TL |
2000 | |
2001 | /* route.c */ | |
2002 | void add_route_direct PROTO ((struct interface_info *, struct in_addr)); | |
2003 | void add_route_net PROTO ((struct interface_info *, struct in_addr, | |
2004 | struct in_addr)); | |
2005 | void add_route_default_gateway PROTO ((struct interface_info *, | |
2006 | struct in_addr)); | |
2007 | void remove_routes PROTO ((struct in_addr)); | |
2008 | void remove_if_route PROTO ((struct interface_info *, struct in_addr)); | |
2009 | void remove_all_if_routes PROTO ((struct interface_info *)); | |
2010 | void set_netmask PROTO ((struct interface_info *, struct in_addr)); | |
2011 | void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr)); | |
2012 | void set_ip_address PROTO ((struct interface_info *, struct in_addr)); | |
cc26de46 TL |
2013 | |
2014 | /* clparse.c */ | |
fde86d2d | 2015 | isc_result_t read_client_conf PROTO ((void)); |
d758ad8c TL |
2016 | int read_client_conf_file (const char *, |
2017 | struct interface_info *, struct client_config *); | |
cc26de46 | 2018 | void read_client_leases PROTO ((void)); |
fde86d2d | 2019 | void parse_client_statement PROTO ((struct parse *, struct interface_info *, |
cc26de46 | 2020 | struct client_config *)); |
b1b7b521 | 2021 | int parse_X PROTO ((struct parse *, u_int8_t *, unsigned)); |
fde86d2d TL |
2022 | void parse_option_list PROTO ((struct parse *, u_int32_t **)); |
2023 | void parse_interface_declaration PROTO ((struct parse *, | |
734d2258 | 2024 | struct client_config *, char *)); |
20916cae | 2025 | int interface_or_dummy PROTO ((struct interface_info **, const char *)); |
734d2258 TL |
2026 | void make_client_state PROTO ((struct client_state **)); |
2027 | void make_client_config PROTO ((struct client_state *, | |
41fb155b | 2028 | struct client_config *)); |
fde86d2d TL |
2029 | void parse_client_lease_statement PROTO ((struct parse *, int)); |
2030 | void parse_client_lease_declaration PROTO ((struct parse *, | |
2031 | struct client_lease *, | |
734d2258 TL |
2032 | struct interface_info **, |
2033 | struct client_state **)); | |
fde86d2d TL |
2034 | int parse_option_decl PROTO ((struct option_cache **, struct parse *)); |
2035 | void parse_string_list PROTO ((struct parse *, struct string_list **, int)); | |
2036 | int parse_ip_addr PROTO ((struct parse *, struct iaddr *)); | |
2037 | void parse_reject_statement PROTO ((struct parse *, struct client_config *)); | |
6b3b97e1 TL |
2038 | |
2039 | /* dhcrelay.c */ | |
b1b7b521 | 2040 | void relay PROTO ((struct interface_info *, struct dhcp_packet *, unsigned, |
a7822eac | 2041 | unsigned int, struct iaddr, struct hardware *)); |
c4763f5f TL |
2042 | int strip_relay_agent_options PROTO ((struct interface_info *, |
2043 | struct interface_info **, | |
b1b7b521 | 2044 | struct dhcp_packet *, unsigned)); |
c4763f5f TL |
2045 | int find_interface_by_agent_option PROTO ((struct dhcp_packet *, |
2046 | struct interface_info **, | |
2047 | u_int8_t *, int)); | |
b1b7b521 TL |
2048 | int add_relay_agent_options PROTO ((struct interface_info *, |
2049 | struct dhcp_packet *, | |
2050 | unsigned, struct in_addr)); | |
6e5ed8bf TL |
2051 | |
2052 | /* icmp.c */ | |
d758ad8c TL |
2053 | OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp) |
2054 | extern struct icmp_state *icmp_state; | |
6e5ed8bf | 2055 | void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr, |
fa25cc03 | 2056 | u_int8_t *, int)))); |
4fe74d72 | 2057 | int icmp_readsocket PROTO ((omapi_object_t *)); |
6e5ed8bf | 2058 | int icmp_echorequest PROTO ((struct iaddr *)); |
4fe74d72 | 2059 | isc_result_t icmp_echoreply PROTO ((omapi_object_t *)); |
83c1b012 TL |
2060 | |
2061 | /* dns.c */ | |
7d9784f6 | 2062 | #if defined (NSUPDATE) |
aa8579c0 | 2063 | isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *); |
7d9784f6 TL |
2064 | void tkey_free (ns_tsig_key **); |
2065 | #endif | |
3f09cb5a TL |
2066 | isc_result_t enter_dns_zone (struct dns_zone *); |
2067 | isc_result_t dns_zone_lookup (struct dns_zone **, const char *); | |
3f09cb5a | 2068 | int dns_zone_dereference PROTO ((struct dns_zone **, const char *, int)); |
29a026db | 2069 | #if defined (NSUPDATE) |
a861af5a TL |
2070 | isc_result_t find_cached_zone (const char *, ns_class, char *, |
2071 | size_t, struct in_addr *, int, int *, | |
2072 | struct dns_zone **); | |
aa8579c0 TL |
2073 | void forget_zone (struct dns_zone **); |
2074 | void repudiate_zone (struct dns_zone **); | |
b2398d97 | 2075 | void cache_found_zone (ns_class, char *, struct in_addr *, int); |
d758ad8c TL |
2076 | int get_dhcid (struct data_string *, int, const u_int8_t *, unsigned); |
2077 | isc_result_t ddns_update_a (struct data_string *, struct iaddr, | |
2078 | struct data_string *, unsigned long, int); | |
2079 | isc_result_t ddns_remove_a (struct data_string *, | |
2080 | struct iaddr, struct data_string *); | |
29a026db | 2081 | #endif /* NSUPDATE */ |
0c7802b1 TL |
2082 | |
2083 | /* resolv.c */ | |
2084 | extern char path_resolv_conf []; | |
2085 | struct name_server *name_servers; | |
2086 | struct domain_search_list *domains; | |
2087 | ||
2088 | void read_resolv_conf PROTO ((TIME)); | |
94f08824 | 2089 | struct name_server *first_name_server PROTO ((void)); |
2b60cc68 TL |
2090 | |
2091 | /* inet_addr.c */ | |
2092 | #ifdef NEED_INET_ATON | |
27fe61a7 | 2093 | int inet_aton PROTO ((const char *, struct in_addr *)); |
2b60cc68 | 2094 | #endif |
5a526cf8 | 2095 | |
102ee7e9 | 2096 | /* class.c */ |
112a6c2c | 2097 | extern int have_billing_classes; |
102ee7e9 TL |
2098 | struct class unknown_class; |
2099 | struct class known_class; | |
2100 | struct collection default_collection; | |
8bdd4d02 | 2101 | struct collection *collections; |
2b9b6ff7 | 2102 | struct executable_statement *default_classification_rules; |
102ee7e9 TL |
2103 | |
2104 | void classification_setup PROTO ((void)); | |
2105 | void classify_client PROTO ((struct packet *)); | |
da38df14 TL |
2106 | int check_collection PROTO ((struct packet *, struct lease *, |
2107 | struct collection *)); | |
102ee7e9 | 2108 | void classify PROTO ((struct packet *, struct class *)); |
899d754f | 2109 | isc_result_t unlink_class PROTO((struct class **class)); |
20916cae TL |
2110 | isc_result_t find_class PROTO ((struct class **, const char *, |
2111 | const char *, int)); | |
112a6c2c TL |
2112 | int unbill_class PROTO ((struct lease *, struct class *)); |
2113 | int bill_class PROTO ((struct lease *, struct class *)); | |
2b9b6ff7 TL |
2114 | |
2115 | /* execute.c */ | |
1b234d44 | 2116 | int execute_statements PROTO ((struct binding_value **result, |
159bcce3 TL |
2117 | struct packet *, struct lease *, |
2118 | struct client_state *, | |
4f58da18 | 2119 | struct option_state *, struct option_state *, |
6ceb9118 | 2120 | struct binding_scope **, |
2b9b6ff7 | 2121 | struct executable_statement *)); |
1b234d44 | 2122 | void execute_statements_in_scope PROTO ((struct binding_value **result, |
159bcce3 TL |
2123 | struct packet *, struct lease *, |
2124 | struct client_state *, | |
112a6c2c | 2125 | struct option_state *, |
2b9b6ff7 | 2126 | struct option_state *, |
6ceb9118 | 2127 | struct binding_scope **, |
2b9b6ff7 | 2128 | struct group *, struct group *)); |
7f6ad5ac TL |
2129 | int executable_statement_dereference PROTO ((struct executable_statement **, |
2130 | const char *, int)); | |
2131 | void write_statements (FILE *, struct executable_statement *, int); | |
932d739c | 2132 | int find_matching_case (struct executable_statement **, |
159bcce3 | 2133 | struct packet *, struct lease *, struct client_state *, |
932d739c | 2134 | struct option_state *, struct option_state *, |
6ceb9118 | 2135 | struct binding_scope **, |
932d739c | 2136 | struct expression *, struct executable_statement *); |
d758ad8c TL |
2137 | int executable_statement_foreach (struct executable_statement *, |
2138 | int (*) (struct executable_statement *, | |
2139 | void *, int), void *, int); | |
74f45f96 | 2140 | |
20916cae | 2141 | /* comapi.c */ |
bdcaf7b9 | 2142 | extern omapi_object_type_t *dhcp_type_interface; |
4fe74d72 | 2143 | extern omapi_object_type_t *dhcp_type_group; |
4fe74d72 TL |
2144 | extern omapi_object_type_t *dhcp_type_shared_network; |
2145 | extern omapi_object_type_t *dhcp_type_subnet; | |
d758ad8c TL |
2146 | extern omapi_object_type_t *dhcp_type_control; |
2147 | extern dhcp_control_object_t *dhcp_control_object; | |
20916cae TL |
2148 | |
2149 | void dhcp_common_objects_setup (void); | |
2150 | ||
2151 | isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *, | |
2152 | omapi_data_string_t *, | |
2153 | omapi_typed_data_t *); | |
2154 | isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *, | |
2155 | omapi_data_string_t *, | |
2156 | omapi_value_t **); | |
2157 | isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int); | |
2158 | isc_result_t dhcp_group_signal_handler (omapi_object_t *, | |
2159 | const char *, va_list); | |
2160 | isc_result_t dhcp_group_stuff_values (omapi_object_t *, | |
2161 | omapi_object_t *, | |
2162 | omapi_object_t *); | |
2163 | isc_result_t dhcp_group_lookup (omapi_object_t **, | |
2164 | omapi_object_t *, omapi_object_t *); | |
2165 | isc_result_t dhcp_group_create (omapi_object_t **, | |
2166 | omapi_object_t *); | |
2167 | isc_result_t dhcp_group_remove (omapi_object_t *, | |
2168 | omapi_object_t *); | |
2169 | ||
d758ad8c TL |
2170 | isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *, |
2171 | omapi_data_string_t *, | |
2172 | omapi_typed_data_t *); | |
2173 | isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *, | |
2174 | omapi_data_string_t *, | |
2175 | omapi_value_t **); | |
2176 | isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int); | |
2177 | isc_result_t dhcp_control_signal_handler (omapi_object_t *, | |
2178 | const char *, va_list); | |
2179 | isc_result_t dhcp_control_stuff_values (omapi_object_t *, | |
2180 | omapi_object_t *, | |
2181 | omapi_object_t *); | |
2182 | isc_result_t dhcp_control_lookup (omapi_object_t **, | |
2183 | omapi_object_t *, omapi_object_t *); | |
2184 | isc_result_t dhcp_control_create (omapi_object_t **, | |
2185 | omapi_object_t *); | |
2186 | isc_result_t dhcp_control_remove (omapi_object_t *, | |
2187 | omapi_object_t *); | |
2188 | ||
20916cae TL |
2189 | isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *, |
2190 | omapi_data_string_t *, | |
2191 | omapi_typed_data_t *); | |
2192 | isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *, | |
2193 | omapi_data_string_t *, | |
2194 | omapi_value_t **); | |
2195 | isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int); | |
2196 | isc_result_t dhcp_subnet_signal_handler (omapi_object_t *, | |
2197 | const char *, va_list); | |
2198 | isc_result_t dhcp_subnet_stuff_values (omapi_object_t *, | |
2199 | omapi_object_t *, | |
2200 | omapi_object_t *); | |
2201 | isc_result_t dhcp_subnet_lookup (omapi_object_t **, | |
2202 | omapi_object_t *, omapi_object_t *); | |
2203 | isc_result_t dhcp_subnet_create (omapi_object_t **, | |
2204 | omapi_object_t *); | |
2205 | isc_result_t dhcp_subnet_remove (omapi_object_t *, | |
2206 | omapi_object_t *); | |
2207 | ||
2208 | isc_result_t dhcp_shared_network_set_value (omapi_object_t *, | |
2209 | omapi_object_t *, | |
2210 | omapi_data_string_t *, | |
2211 | omapi_typed_data_t *); | |
2212 | isc_result_t dhcp_shared_network_get_value (omapi_object_t *, | |
2213 | omapi_object_t *, | |
2214 | omapi_data_string_t *, | |
2215 | omapi_value_t **); | |
2216 | isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int); | |
2217 | isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *, | |
2218 | const char *, va_list); | |
2219 | isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *, | |
2220 | omapi_object_t *, | |
2221 | omapi_object_t *); | |
2222 | isc_result_t dhcp_shared_network_lookup (omapi_object_t **, | |
2223 | omapi_object_t *, omapi_object_t *); | |
2224 | isc_result_t dhcp_shared_network_create (omapi_object_t **, | |
2225 | omapi_object_t *); | |
2226 | isc_result_t dhcp_shared_network_remove (omapi_object_t *, | |
2227 | omapi_object_t *); | |
2228 | ||
2229 | /* omapi.c */ | |
2230 | extern int (*dhcp_interface_shutdown_hook) (struct interface_info *); | |
2231 | ||
2232 | extern omapi_object_type_t *dhcp_type_lease; | |
2233 | extern omapi_object_type_t *dhcp_type_pool; | |
4fe74d72 | 2234 | extern omapi_object_type_t *dhcp_type_class; |
899d754f | 2235 | extern omapi_object_type_t *dhcp_type_subclass; |
bdcaf7b9 | 2236 | |
d9eefc5d TL |
2237 | #if defined (FAILOVER_PROTOCOL) |
2238 | extern omapi_object_type_t *dhcp_type_failover_state; | |
2239 | extern omapi_object_type_t *dhcp_type_failover_link; | |
2240 | extern omapi_object_type_t *dhcp_type_failover_listener; | |
2241 | #endif | |
4fe74d72 TL |
2242 | |
2243 | void dhcp_db_objects_setup (void); | |
2244 | ||
2245 | isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *, | |
2246 | omapi_data_string_t *, | |
2247 | omapi_typed_data_t *); | |
2248 | isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *, | |
2249 | omapi_data_string_t *, | |
2250 | omapi_value_t **); | |
4bd8800e | 2251 | isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2252 | isc_result_t dhcp_lease_signal_handler (omapi_object_t *, |
2253 | const char *, va_list); | |
4fe74d72 TL |
2254 | isc_result_t dhcp_lease_stuff_values (omapi_object_t *, |
2255 | omapi_object_t *, | |
2256 | omapi_object_t *); | |
2257 | isc_result_t dhcp_lease_lookup (omapi_object_t **, | |
2258 | omapi_object_t *, omapi_object_t *); | |
2259 | isc_result_t dhcp_lease_create (omapi_object_t **, | |
2260 | omapi_object_t *); | |
ccce1cc6 | 2261 | isc_result_t dhcp_lease_remove (omapi_object_t *, |
3c48d369 | 2262 | omapi_object_t *); |
4fe74d72 TL |
2263 | isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *, |
2264 | omapi_data_string_t *, | |
2265 | omapi_typed_data_t *); | |
2266 | isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *, | |
2267 | omapi_data_string_t *, | |
2268 | omapi_value_t **); | |
4bd8800e | 2269 | isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2270 | isc_result_t dhcp_group_signal_handler (omapi_object_t *, |
2271 | const char *, va_list); | |
4fe74d72 TL |
2272 | isc_result_t dhcp_group_stuff_values (omapi_object_t *, |
2273 | omapi_object_t *, | |
2274 | omapi_object_t *); | |
2275 | isc_result_t dhcp_group_lookup (omapi_object_t **, | |
2276 | omapi_object_t *, omapi_object_t *); | |
2277 | isc_result_t dhcp_group_create (omapi_object_t **, | |
2278 | omapi_object_t *); | |
940ea8ab TL |
2279 | isc_result_t dhcp_group_remove (omapi_object_t *, |
2280 | omapi_object_t *); | |
4fe74d72 TL |
2281 | isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *, |
2282 | omapi_data_string_t *, | |
2283 | omapi_typed_data_t *); | |
2284 | isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *, | |
2285 | omapi_data_string_t *, | |
2286 | omapi_value_t **); | |
4bd8800e | 2287 | isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2288 | isc_result_t dhcp_host_signal_handler (omapi_object_t *, |
2289 | const char *, va_list); | |
4fe74d72 TL |
2290 | isc_result_t dhcp_host_stuff_values (omapi_object_t *, |
2291 | omapi_object_t *, | |
2292 | omapi_object_t *); | |
2293 | isc_result_t dhcp_host_lookup (omapi_object_t **, | |
2294 | omapi_object_t *, omapi_object_t *); | |
2295 | isc_result_t dhcp_host_create (omapi_object_t **, | |
2296 | omapi_object_t *); | |
ccce1cc6 | 2297 | isc_result_t dhcp_host_remove (omapi_object_t *, |
3c48d369 | 2298 | omapi_object_t *); |
4fe74d72 TL |
2299 | isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *, |
2300 | omapi_data_string_t *, | |
2301 | omapi_typed_data_t *); | |
2302 | isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *, | |
2303 | omapi_data_string_t *, | |
2304 | omapi_value_t **); | |
4bd8800e | 2305 | isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2306 | isc_result_t dhcp_pool_signal_handler (omapi_object_t *, |
2307 | const char *, va_list); | |
4fe74d72 TL |
2308 | isc_result_t dhcp_pool_stuff_values (omapi_object_t *, |
2309 | omapi_object_t *, | |
2310 | omapi_object_t *); | |
2311 | isc_result_t dhcp_pool_lookup (omapi_object_t **, | |
2312 | omapi_object_t *, omapi_object_t *); | |
2313 | isc_result_t dhcp_pool_create (omapi_object_t **, | |
2314 | omapi_object_t *); | |
ccce1cc6 | 2315 | isc_result_t dhcp_pool_remove (omapi_object_t *, |
3c48d369 | 2316 | omapi_object_t *); |
20916cae TL |
2317 | isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *, |
2318 | omapi_data_string_t *, | |
2319 | omapi_typed_data_t *); | |
2320 | isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *, | |
2321 | omapi_data_string_t *, | |
2322 | omapi_value_t **); | |
2323 | isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int); | |
2324 | isc_result_t dhcp_class_signal_handler (omapi_object_t *, | |
2325 | const char *, va_list); | |
2326 | isc_result_t dhcp_class_stuff_values (omapi_object_t *, | |
2327 | omapi_object_t *, | |
2328 | omapi_object_t *); | |
2329 | isc_result_t dhcp_class_lookup (omapi_object_t **, | |
2330 | omapi_object_t *, omapi_object_t *); | |
2331 | isc_result_t dhcp_class_create (omapi_object_t **, | |
2332 | omapi_object_t *); | |
2333 | isc_result_t dhcp_class_remove (omapi_object_t *, | |
2334 | omapi_object_t *); | |
c1f22aef TL |
2335 | isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *, |
2336 | omapi_data_string_t *, | |
2337 | omapi_typed_data_t *); | |
2338 | isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *, | |
2339 | omapi_data_string_t *, | |
2340 | omapi_value_t **); | |
2341 | isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int); | |
2342 | isc_result_t dhcp_subclass_signal_handler (omapi_object_t *, | |
2343 | const char *, va_list); | |
2344 | isc_result_t dhcp_subclass_stuff_values (omapi_object_t *, | |
2345 | omapi_object_t *, | |
2346 | omapi_object_t *); | |
2347 | isc_result_t dhcp_subclass_lookup (omapi_object_t **, | |
2348 | omapi_object_t *, omapi_object_t *); | |
2349 | isc_result_t dhcp_subclass_create (omapi_object_t **, | |
2350 | omapi_object_t *); | |
2351 | isc_result_t dhcp_subclass_remove (omapi_object_t *, | |
2352 | omapi_object_t *); | |
4fe74d72 TL |
2353 | isc_result_t dhcp_shared_network_set_value (omapi_object_t *, |
2354 | omapi_object_t *, | |
2355 | omapi_data_string_t *, | |
2356 | omapi_typed_data_t *); | |
2357 | isc_result_t dhcp_shared_network_get_value (omapi_object_t *, omapi_object_t *, | |
2358 | omapi_data_string_t *, | |
2359 | omapi_value_t **); | |
4bd8800e | 2360 | isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int); |
4fe74d72 | 2361 | isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *, |
b1b7b521 | 2362 | const char *, va_list); |
4fe74d72 TL |
2363 | isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *, |
2364 | omapi_object_t *, | |
2365 | omapi_object_t *); | |
2366 | isc_result_t dhcp_shared_network_lookup (omapi_object_t **, | |
2367 | omapi_object_t *, omapi_object_t *); | |
2368 | isc_result_t dhcp_shared_network_create (omapi_object_t **, | |
2369 | omapi_object_t *); | |
2370 | isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *, | |
2371 | omapi_data_string_t *, | |
2372 | omapi_typed_data_t *); | |
2373 | isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *, | |
2374 | omapi_data_string_t *, | |
2375 | omapi_value_t **); | |
4bd8800e | 2376 | isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int); |
b1b7b521 TL |
2377 | isc_result_t dhcp_subnet_signal_handler (omapi_object_t *, |
2378 | const char *, va_list); | |
4fe74d72 TL |
2379 | isc_result_t dhcp_subnet_stuff_values (omapi_object_t *, |
2380 | omapi_object_t *, | |
2381 | omapi_object_t *); | |
2382 | isc_result_t dhcp_subnet_lookup (omapi_object_t **, | |
2383 | omapi_object_t *, omapi_object_t *); | |
2384 | isc_result_t dhcp_subnet_create (omapi_object_t **, | |
2385 | omapi_object_t *); | |
20916cae TL |
2386 | isc_result_t dhcp_interface_set_value (omapi_object_t *, |
2387 | omapi_object_t *, | |
2388 | omapi_data_string_t *, | |
2389 | omapi_typed_data_t *); | |
2390 | isc_result_t dhcp_interface_get_value (omapi_object_t *, | |
2391 | omapi_object_t *, | |
2392 | omapi_data_string_t *, | |
2393 | omapi_value_t **); | |
2394 | isc_result_t dhcp_interface_destroy (omapi_object_t *, | |
2395 | const char *, int); | |
2396 | isc_result_t dhcp_interface_signal_handler (omapi_object_t *, | |
2397 | const char *, | |
2398 | va_list ap); | |
2399 | isc_result_t dhcp_interface_stuff_values (omapi_object_t *, | |
2400 | omapi_object_t *, | |
2401 | omapi_object_t *); | |
2402 | isc_result_t dhcp_interface_lookup (omapi_object_t **, | |
2403 | omapi_object_t *, | |
2404 | omapi_object_t *); | |
2405 | isc_result_t dhcp_interface_create (omapi_object_t **, | |
2406 | omapi_object_t *); | |
2407 | isc_result_t dhcp_interface_remove (omapi_object_t *, | |
2408 | omapi_object_t *); | |
f3aad410 TL |
2409 | void interface_stash (struct interface_info *); |
2410 | void interface_snorf (struct interface_info *, int); | |
4fe74d72 | 2411 | |
d758ad8c TL |
2412 | isc_result_t binding_scope_set_value (struct binding_scope *, int, |
2413 | omapi_data_string_t *, | |
2414 | omapi_typed_data_t *); | |
2415 | isc_result_t binding_scope_get_value (omapi_value_t **, | |
2416 | struct binding_scope *, | |
2417 | omapi_data_string_t *); | |
2418 | isc_result_t binding_scope_stuff_values (omapi_object_t *, | |
2419 | struct binding_scope *); | |
2420 | ||
940ea8ab TL |
2421 | /* mdb.c */ |
2422 | ||
8c8e27c5 TL |
2423 | extern struct subnet *subnets; |
2424 | extern struct shared_network *shared_networks; | |
98311e4b DH |
2425 | extern host_hash_t *host_hw_addr_hash; |
2426 | extern host_hash_t *host_uid_hash; | |
2427 | extern host_hash_t *host_name_hash; | |
2428 | extern lease_hash_t *lease_uid_hash; | |
2429 | extern lease_hash_t *lease_ip_addr_hash; | |
2430 | extern lease_hash_t *lease_hw_addr_hash; | |
940ea8ab TL |
2431 | |
2432 | extern omapi_object_type_t *dhcp_type_host; | |
2433 | ||
f3fe382d JB |
2434 | extern int numclasseswritten; |
2435 | ||
2436 | ||
899d754f JB |
2437 | isc_result_t enter_class PROTO ((struct class *, int, int)); |
2438 | isc_result_t delete_class PROTO ((struct class *, int)); | |
940ea8ab | 2439 | isc_result_t enter_host PROTO ((struct host_decl *, int, int)); |
fde86d2d | 2440 | isc_result_t delete_host PROTO ((struct host_decl *, int)); |
20916cae TL |
2441 | int find_hosts_by_haddr PROTO ((struct host_decl **, int, |
2442 | const unsigned char *, unsigned, | |
2443 | const char *, int)); | |
2444 | int find_hosts_by_uid PROTO ((struct host_decl **, const unsigned char *, | |
2445 | unsigned, const char *, int)); | |
2446 | int find_host_for_network PROTO ((struct subnet **, struct host_decl **, | |
2447 | struct iaddr *, struct shared_network *)); | |
98311e4b DH |
2448 | void new_address_range PROTO ((struct parse *, struct iaddr, struct iaddr, |
2449 | struct subnet *, struct pool *, | |
2450 | struct lease **)); | |
20916cae | 2451 | isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int); |
932d739c | 2452 | isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int); |
20916cae TL |
2453 | int find_grouped_subnet PROTO ((struct subnet **, struct shared_network *, |
2454 | struct iaddr, const char *, int)); | |
2455 | int find_subnet (struct subnet **, struct iaddr, const char *, int); | |
940ea8ab | 2456 | void enter_shared_network PROTO ((struct shared_network *)); |
70984280 TL |
2457 | void new_shared_network_interface PROTO ((struct parse *, |
2458 | struct shared_network *, | |
4bd8800e | 2459 | const char *)); |
940ea8ab TL |
2460 | int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int)); |
2461 | void enter_subnet PROTO ((struct subnet *)); | |
2462 | void enter_lease PROTO ((struct lease *)); | |
007e3ee4 | 2463 | int supersede_lease PROTO ((struct lease *, struct lease *, int, int, int)); |
e540864e | 2464 | void make_binding_state_transition (struct lease *); |
20916cae | 2465 | int lease_copy PROTO ((struct lease **, struct lease *, const char *, int)); |
e495b7d1 | 2466 | void release_lease PROTO ((struct lease *, struct packet *)); |
b1b7b521 | 2467 | void abandon_lease PROTO ((struct lease *, const char *)); |
940ea8ab | 2468 | void dissociate_lease PROTO ((struct lease *)); |
a414e627 | 2469 | void pool_timer PROTO ((void *)); |
20916cae TL |
2470 | int find_lease_by_uid PROTO ((struct lease **, const unsigned char *, |
2471 | unsigned, const char *, int)); | |
2472 | int find_lease_by_hw_addr PROTO ((struct lease **, const unsigned char *, | |
2473 | unsigned, const char *, int)); | |
2474 | int find_lease_by_ip_addr PROTO ((struct lease **, struct iaddr, | |
2475 | const char *, int)); | |
940ea8ab TL |
2476 | void uid_hash_add PROTO ((struct lease *)); |
2477 | void uid_hash_delete PROTO ((struct lease *)); | |
2478 | void hw_hash_add PROTO ((struct lease *)); | |
2479 | void hw_hash_delete PROTO ((struct lease *)); | |
d758ad8c | 2480 | int write_leases PROTO ((void)); |
d0411fbd | 2481 | int lease_enqueue (struct lease *); |
06e77c34 | 2482 | isc_result_t lease_instantiate(const unsigned char *, unsigned, void *); |
a414e627 | 2483 | void expire_all_pools PROTO ((void)); |
940ea8ab | 2484 | void dump_subnets PROTO ((void)); |
d758ad8c TL |
2485 | #if defined (DEBUG_MEMORY_LEAKAGE) || \ |
2486 | defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) | |
2487 | void free_everything (void); | |
2488 | #endif | |
9ba7cdec TL |
2489 | |
2490 | /* nsupdate.c */ | |
2491 | char *ddns_rev_name (struct lease *, struct lease_state *, struct packet *); | |
2492 | char *ddns_fwd_name (struct lease *, struct lease_state *, struct packet *); | |
2493 | int nsupdateA (const char *, const unsigned char *, u_int32_t, int); | |
2494 | int nsupdatePTR (const char *, const unsigned char *, u_int32_t, int); | |
2495 | void nsupdate (struct lease *, struct lease_state *, struct packet *, int); | |
2496 | int updateA (const struct data_string *, const struct data_string *, | |
2497 | unsigned int, struct lease *); | |
2498 | int updatePTR (const struct data_string *, const struct data_string *, | |
2499 | unsigned int, struct lease *); | |
91dc2849 TL |
2500 | int deleteA (const struct data_string *, const struct data_string *, |
2501 | struct lease *); | |
2502 | int deletePTR (const struct data_string *, const struct data_string *, | |
2503 | struct lease *); | |
d9eefc5d TL |
2504 | |
2505 | /* failover.c */ | |
2506 | #if defined (FAILOVER_PROTOCOL) | |
d758ad8c | 2507 | extern dhcp_failover_state_t *failover_states; |
aa8579c0 | 2508 | void dhcp_failover_startup PROTO ((void)); |
d758ad8c | 2509 | int dhcp_failover_write_all_states (void); |
aa8579c0 TL |
2510 | isc_result_t enter_failover_peer PROTO ((dhcp_failover_state_t *)); |
2511 | isc_result_t find_failover_peer PROTO ((dhcp_failover_state_t **, | |
20916cae | 2512 | const char *, const char *, int)); |
d9eefc5d TL |
2513 | isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *)); |
2514 | isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *, | |
2515 | const char *, va_list)); | |
2516 | isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *, | |
2517 | omapi_object_t *, | |
2518 | omapi_data_string_t *, | |
2519 | omapi_typed_data_t *)); | |
2520 | isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *, | |
2521 | omapi_object_t *, | |
2522 | omapi_data_string_t *, | |
2523 | omapi_value_t **)); | |
2524 | isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 2525 | const char *, int)); |
d9eefc5d TL |
2526 | isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *, |
2527 | omapi_object_t *, | |
2528 | omapi_object_t *)); | |
2529 | isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *)); | |
2530 | ||
2531 | isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *, | |
2532 | const char *, | |
2533 | va_list)); | |
2534 | isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *, | |
2535 | omapi_object_t *, | |
2536 | omapi_data_string_t *, | |
2537 | omapi_typed_data_t *)); | |
2538 | isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *, | |
2539 | omapi_object_t *, | |
2540 | omapi_data_string_t *, | |
2541 | omapi_value_t **)); | |
2542 | isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 2543 | const char *, int)); |
d9eefc5d TL |
2544 | isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *, |
2545 | omapi_object_t *, | |
2546 | omapi_object_t *)); | |
2547 | isc_result_t dhcp_failover_register PROTO ((omapi_object_t *)); | |
2548 | isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *, | |
2549 | const char *, va_list)); | |
aa8579c0 TL |
2550 | isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *, |
2551 | const char *); | |
c489f075 | 2552 | isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state); |
aa8579c0 TL |
2553 | isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *, |
2554 | enum failover_state); | |
c489f075 TL |
2555 | isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *, |
2556 | failover_message_t *); | |
8c8e27c5 TL |
2557 | int dhcp_failover_pool_rebalance (dhcp_failover_state_t *); |
2558 | int dhcp_failover_pool_check (struct pool *); | |
2559 | int dhcp_failover_state_pool_check (dhcp_failover_state_t *); | |
d0411fbd TL |
2560 | void dhcp_failover_timeout (void *); |
2561 | void dhcp_failover_send_contact (void *); | |
8d3aec71 | 2562 | isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *); |
a7982987 | 2563 | isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *); |
007e3ee4 | 2564 | int dhcp_failover_queue_update (struct lease *, int); |
988c1ca7 | 2565 | int dhcp_failover_send_acks (dhcp_failover_state_t *); |
af5ad6df | 2566 | void dhcp_failover_toack_queue_timeout (void *); |
988c1ca7 | 2567 | int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg); |
f9d43a9a | 2568 | void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *); |
d9eefc5d TL |
2569 | isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *, |
2570 | omapi_object_t *, | |
2571 | omapi_data_string_t *, | |
2572 | omapi_typed_data_t *)); | |
aa8579c0 | 2573 | void dhcp_failover_keepalive (void *); |
a7982987 | 2574 | void dhcp_failover_reconnect (void *); |
c489f075 | 2575 | void dhcp_failover_startup_timeout (void *); |
8d3aec71 | 2576 | void dhcp_failover_link_startup_timeout (void *); |
a7982987 | 2577 | void dhcp_failover_listener_restart (void *); |
d9eefc5d TL |
2578 | isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *, |
2579 | omapi_object_t *, | |
2580 | omapi_data_string_t *, | |
2581 | omapi_value_t **)); | |
2582 | isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *, | |
4bd8800e | 2583 | const char *, int)); |
d9eefc5d TL |
2584 | isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *, |
2585 | omapi_object_t *, | |
2586 | omapi_object_t *)); | |
35e0fdf8 TL |
2587 | isc_result_t dhcp_failover_state_lookup PROTO ((omapi_object_t **, |
2588 | omapi_object_t *, | |
2589 | omapi_object_t *)); | |
2590 | isc_result_t dhcp_failover_state_create PROTO ((omapi_object_t **, | |
2591 | omapi_object_t *)); | |
2592 | isc_result_t dhcp_failover_state_remove PROTO ((omapi_object_t *, | |
2593 | omapi_object_t *)); | |
a7982987 TL |
2594 | int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned); |
2595 | const char *dhcp_failover_reject_reason_print (int); | |
2596 | const char *dhcp_failover_state_name_print (enum failover_state); | |
af380050 TL |
2597 | const char *dhcp_failover_message_name (unsigned); |
2598 | const char *dhcp_failover_option_name (unsigned); | |
165bce70 TL |
2599 | failover_option_t *dhcp_failover_option_printf (unsigned, char *, |
2600 | unsigned *, | |
2601 | unsigned, | |
72896e9f TL |
2602 | const char *, ...) |
2603 | __attribute__((__format__(__printf__,5,6))); | |
2604 | failover_option_t *dhcp_failover_make_option (unsigned, char *, | |
2605 | unsigned *, unsigned, ...); | |
165bce70 TL |
2606 | isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *, |
2607 | omapi_object_t *, int, ...); | |
35e0fdf8 | 2608 | isc_result_t dhcp_failover_send_connect PROTO ((omapi_object_t *)); |
007e3ee4 TL |
2609 | isc_result_t dhcp_failover_send_connectack PROTO ((omapi_object_t *, |
2610 | dhcp_failover_state_t *, | |
2611 | int, const char *)); | |
a7982987 TL |
2612 | isc_result_t dhcp_failover_send_disconnect PROTO ((omapi_object_t *, |
2613 | int, const char *)); | |
2614 | isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *, | |
2615 | struct lease *); | |
8c8e27c5 | 2616 | isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *, |
988c1ca7 | 2617 | failover_message_t *, |
8c8e27c5 TL |
2618 | int, const char *); |
2619 | isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *); | |
2620 | isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int); | |
c489f075 TL |
2621 | isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *); |
2622 | isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *); | |
2623 | isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *); | |
8c8e27c5 TL |
2624 | isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *, |
2625 | failover_message_t *); | |
2626 | isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *, | |
2627 | failover_message_t *); | |
c489f075 TL |
2628 | isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *, |
2629 | int); | |
2630 | isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *, | |
2631 | failover_message_t *); | |
2632 | isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *, | |
2633 | failover_message_t *); | |
2634 | isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *, | |
2635 | failover_message_t *); | |
2636 | void dhcp_failover_recover_done (void *); | |
35e0fdf8 | 2637 | void failover_print PROTO ((char *, unsigned *, unsigned, const char *)); |
5b7f941d | 2638 | void update_partner PROTO ((struct lease *)); |
aa8579c0 | 2639 | int load_balance_mine (struct packet *, dhcp_failover_state_t *); |
e540864e TL |
2640 | binding_state_t normal_binding_state_transition_check (struct lease *, |
2641 | dhcp_failover_state_t *, | |
31bbee78 TL |
2642 | binding_state_t, |
2643 | u_int32_t); | |
e540864e TL |
2644 | binding_state_t |
2645 | conflict_binding_state_transition_check (struct lease *, | |
2646 | dhcp_failover_state_t *, | |
31bbee78 | 2647 | binding_state_t, u_int32_t); |
c489f075 | 2648 | int lease_mine_to_reallocate (struct lease *); |
007e3ee4 | 2649 | |
20916cae TL |
2650 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t, |
2651 | dhcp_type_failover_state) | |
2652 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener, dhcp_failover_listener_t, | |
2653 | dhcp_type_failover_listener) | |
2654 | OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t, | |
57c8fdd7 | 2655 | dhcp_type_failover_link) |
d9eefc5d | 2656 | #endif /* FAILOVER_PROTOCOL */ |
e540864e TL |
2657 | |
2658 | const char *binding_state_print (enum failover_state); |