3 Definitions for dhcpd... */
6 * Copyright (c) 1996-2001 Internet Software Consortium.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The Internet Software Consortium nor the names
19 * of its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * This software has been written for the Internet Software Consortium
37 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
38 * To learn more about the Internet Software Consortium, see
39 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
40 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
41 * ``http://www.nominum.com''.
43 * $FreeBSD: src/contrib/isc-dhcp/includes/dhcpd.h,v 1.8 2003/09/02 11:13:21 mbr Exp $
44 * $DragonFly: src/contrib/isc-dhcp/includes/Attic/dhcpd.h,v 1.2 2003/10/11 21:14:19 dillon Exp $
48 #include <sys/types.h>
49 #include <netinet/in.h>
50 #include <sys/socket.h>
52 #include <arpa/inet.h>
56 #define fd_set cygwin_fd_set
57 #include <sys/types.h>
71 #include "arpa/nameser.h"
72 #if defined (NSUPDATE)
73 # include "minires/minires.h"
77 typedef struct hash_table group_hash_t;
78 typedef struct hash_table universe_hash_t;
79 typedef struct hash_table option_hash_t;
80 typedef struct hash_table dns_zone_hash_t;
81 typedef struct hash_table lease_hash_t;
82 typedef struct hash_table host_hash_t;
83 typedef struct hash_table class_hash_t;
86 #include "statement.h"
91 #include <isc-dhcp/result.h>
92 #include <omapip/omapip_p.h>
94 #if !defined (OPTION_HASH_SIZE)
95 # define OPTION_HASH_SIZE 17
96 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
97 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
100 #define compute_option_hash(x) \
101 (((x) & (OPTION_HASH_PTWO - 1)) + \
102 (((x) >> OPTION_HASH_EXP) & \
103 (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
108 enum dhcp_shutdown_state {
110 shutdown_omapi_connections,
111 shutdown_drop_omapi_connections,
116 /* Client FQDN option, failover FQDN option, etc. */
123 #include "failover.h"
125 /* A parsing context. */
142 enum dhcp_token token;
149 char comments [4096];
152 int warnings_occurred;
155 unsigned bufix, buflen;
159 /* Variable-length array of data. */
162 struct string_list *next;
166 /* A name server, from /etc/resolv.conf. */
168 struct name_server *next;
169 struct sockaddr_in addr;
173 /* A domain search list element. */
174 struct domain_search_list {
175 struct domain_search_list *next;
180 /* Option tag structures are used to build chains of option tags, for
181 when we're sure we're not going to have enough of them to justify
182 maintaining an array. */
185 struct option_tag *next;
189 /* An agent option structure. We need a special structure for the
190 Relay Agent Information option because if more than one appears in
191 a message, we have to keep them seperate. */
193 struct agent_options {
194 struct agent_options *next;
196 struct option_tag *first;
199 struct option_cache {
201 struct option_cache *next;
202 struct expression *expression;
203 struct option *option;
204 struct data_string data;
207 struct option_state {
212 VOIDPTR universes [1];
215 /* A dhcp packet and the pointers to its option values. */
217 struct dhcp_packet *raw;
219 unsigned packet_length;
223 struct iaddr client_addr;
224 struct interface_info *interface; /* Interface on which packet
226 struct hardware *haddr; /* Physical link address
227 of local sender (maybe gateway). */
229 /* Information for relay agent options (see
230 draft-ietf-dhc-agent-options-xx.txt). */
231 u_int8_t *circuit_id; /* Circuit ID of client connection. */
233 u_int8_t *remote_id; /* Remote ID of client. */
236 int got_requested_address; /* True if client sent the
237 dhcp-requested-address option. */
239 struct shared_network *shared_network;
240 struct option_state *options;
242 #if !defined (PACKET_MAX_CLASSES)
243 # define PACKET_MAX_CLASSES 5
246 struct class *classes [PACKET_MAX_CLASSES];
252 /* A network interface's MAC address. */
263 server_hibernate = 3,
265 } control_object_state_t;
268 OMAPI_OBJECT_PREAMBLE;
269 control_object_state_t state;
270 } dhcp_control_object_t;
283 /* FTS_LAST is the highest value that is valid for a lease binding state. */
284 #define FTS_LAST FTS_BACKUP
286 /* A dhcp lease declaration structure. */
288 OMAPI_OBJECT_PREAMBLE;
290 struct lease *n_uid, *n_hw;
292 struct iaddr ip_addr;
293 TIME starts, ends, timestamp, sort_time;
294 char *client_hostname;
295 struct binding_scope *scope;
296 struct host_decl *host;
297 struct subnet *subnet;
299 struct class *billing_class;
300 struct option_chain_head *agent_options;
302 struct executable_statement *on_expiry;
303 struct executable_statement *on_commit;
304 struct executable_statement *on_release;
307 unsigned short uid_len;
308 unsigned short uid_max;
309 unsigned char uid_buf [7];
310 struct hardware hardware_addr;
313 # define STATIC_LEASE 1
314 # define BOOTP_LEASE 2
315 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
316 # define MS_NULL_TERMINATION 8
317 # define ON_UPDATE_QUEUE 16
318 # define ON_ACK_QUEUE 32
319 # define UNICAST_BROADCAST_HACK 64
320 # define ON_DEFERRED_QUEUE 128
321 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
322 UNICAST_BROADCAST_HACK)
324 binding_state_t __attribute__ ((mode (__byte__))) binding_state;
325 binding_state_t __attribute__ ((mode (__byte__))) next_binding_state;
326 binding_state_t __attribute__ ((mode (__byte__))) desired_binding_state;
328 struct lease_state *state;
330 TIME tstp; /* Time sent to partner. */
331 TIME tsfp; /* Time sent from partner. */
332 TIME cltt; /* Client last transaction time. */
333 struct lease *next_pending;
337 struct lease_state *next;
339 struct interface_info *ip;
341 struct packet *packet; /* The incoming packet. */
345 struct option_state *options;
346 struct data_string parameter_request_list;
347 int max_message_size;
348 u_int32_t expiry, renewal, rebind;
349 struct data_string filename, server_name;
350 int got_requested_address;
351 int got_server_identifier;
352 struct shared_network *shared_network; /* Shared network of interface
353 on which request arrived. */
357 u_int16_t bootp_flags;
358 struct in_addr ciaddr;
359 struct in_addr siaddr;
360 struct in_addr giaddr;
368 #define SHARED_NET_DECL 2
369 #define SUBNET_DECL 3
374 /* Possible modes in which discover_interfaces can run. */
376 #define DISCOVER_RUNNING 0
377 #define DISCOVER_SERVER 1
378 #define DISCOVER_UNCONFIGURED 2
379 #define DISCOVER_RELAY 3
380 #define DISCOVER_REQUESTED 4
382 /* Server option names. */
384 #define SV_DEFAULT_LEASE_TIME 1
385 #define SV_MAX_LEASE_TIME 2
386 #define SV_MIN_LEASE_TIME 3
387 #define SV_BOOTP_LEASE_CUTOFF 4
388 #define SV_BOOTP_LEASE_LENGTH 5
389 #define SV_BOOT_UNKNOWN_CLIENTS 6
390 #define SV_DYNAMIC_BOOTP 7
391 #define SV_ALLOW_BOOTP 8
392 #define SV_ALLOW_BOOTING 9
393 #define SV_ONE_LEASE_PER_CLIENT 10
394 #define SV_GET_LEASE_HOSTNAMES 11
395 #define SV_USE_HOST_DECL_NAMES 12
396 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
397 #define SV_MIN_SECS 14
398 #define SV_FILENAME 15
399 #define SV_SERVER_NAME 16
400 #define SV_NEXT_SERVER 17
401 #define SV_AUTHORITATIVE 18
402 #define SV_VENDOR_OPTION_SPACE 19
403 #define SV_ALWAYS_REPLY_RFC1048 20
404 #define SV_SITE_OPTION_SPACE 21
405 #define SV_ALWAYS_BROADCAST 22
406 #define SV_DDNS_DOMAIN_NAME 23
407 #define SV_DDNS_HOST_NAME 24
408 #define SV_DDNS_REV_DOMAIN_NAME 25
409 #define SV_LEASE_FILE_NAME 26
410 #define SV_PID_FILE_NAME 27
411 #define SV_DUPLICATES 28
412 #define SV_DECLINES 29
413 #define SV_DDNS_UPDATES 30
414 #define SV_OMAPI_PORT 31
415 #define SV_LOCAL_PORT 32
416 #define SV_LIMITED_BROADCAST_ADDRESS 33
417 #define SV_REMOTE_PORT 34
418 #define SV_LOCAL_ADDRESS 35
419 #define SV_OMAPI_KEY 36
420 #define SV_STASH_AGENT_OPTIONS 37
421 #define SV_DDNS_TTL 38
422 #define SV_DDNS_UPDATE_STYLE 39
423 #define SV_CLIENT_UPDATES 40
424 #define SV_UPDATE_OPTIMIZATION 41
425 #define SV_PING_CHECKS 42
426 #define SV_UPDATE_STATIC_LEASES 43
427 #define SV_LOG_FACILITY 44
428 #define SV_DO_FORWARD_UPDATES 45
429 #define SV_PING_TIMEOUT 46
431 #if !defined (DEFAULT_PING_TIMEOUT)
432 # define DEFAULT_PING_TIMEOUT 1
435 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
436 # define DEFAULT_DEFAULT_LEASE_TIME 43200
439 #if !defined (DEFAULT_MIN_LEASE_TIME)
440 # define DEFAULT_MIN_LEASE_TIME 0
443 #if !defined (DEFAULT_MAX_LEASE_TIME)
444 # define DEFAULT_MAX_LEASE_TIME 86400
447 #if !defined (DEFAULT_DDNS_TTL)
448 # define DEFAULT_DDNS_TTL 3600
451 /* Client option names */
454 #define CL_SELECT_INTERVAL 2
455 #define CL_REBOOT_TIMEOUT 3
456 #define CL_RETRY_INTERVAL 4
457 #define CL_BACKOFF_CUTOFF 5
458 #define CL_INITIAL_INTERVAL 6
459 #define CL_BOOTP_POLICY 7
460 #define CL_SCRIPT_NAME 8
461 #define CL_REQUESTED_OPTIONS 9
462 #define CL_REQUESTED_LEASE_TIME 10
463 #define CL_SEND_OPTIONS 11
465 #define CL_REJECT_LIST 13
467 #ifndef CL_DEFAULT_TIMEOUT
468 # define CL_DEFAULT_TIMEOUT 60
471 #ifndef CL_DEFAULT_SELECT_INTERVAL
472 # define CL_DEFAULT_SELECT_INTERVAL 0
475 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
476 # define CL_DEFAULT_REBOOT_TIMEOUT 10
479 #ifndef CL_DEFAULT_RETRY_INTERVAL
480 # define CL_DEFAULT_RETRY_INTERVAL 300
483 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
484 # define CL_DEFAULT_BACKOFF_CUTOFF 120
487 #ifndef CL_DEFAULT_INITIAL_INTERVAL
488 # define CL_DEFAULT_INITIAL_INTERVAL 10
491 #ifndef CL_DEFAULT_BOOTP_POLICY
492 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
495 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
496 # define CL_DEFAULT_REQUESTED_OPTIONS \
498 DHO_BROADCAST_ADDRESS, \
502 DHO_DOMAIN_NAME_SERVERS, \
506 struct group_object {
507 OMAPI_OBJECT_PREAMBLE;
509 struct group_object *n_dynamic;
513 #define GROUP_OBJECT_DELETED 1
514 #define GROUP_OBJECT_DYNAMIC 2
515 #define GROUP_OBJECT_STATIC 4
518 /* Group of declarations that share common parameters. */
523 struct group_object *object;
524 struct subnet *subnet;
525 struct shared_network *shared_network;
527 struct executable_statement *statements;
530 /* A dhcp host declaration structure. */
532 OMAPI_OBJECT_PREAMBLE;
533 struct host_decl *n_ipaddr;
534 struct host_decl *n_dynamic;
536 struct hardware interface;
537 struct data_string client_identifier;
538 struct option_cache *fixed_addr;
540 struct group_object *named_group;
541 struct data_string auth_key_id;
543 #define HOST_DECL_DELETED 1
544 #define HOST_DECL_DYNAMIC 2
545 #define HOST_DECL_STATIC 4
551 permit_unknown_clients,
552 permit_known_clients,
553 permit_authenticated_clients,
554 permit_unauthenticated_clients,
556 permit_dynamic_bootp_clients,
563 OMAPI_OBJECT_PREAMBLE;
566 struct shared_network *shared_network;
567 struct permit *permit_list;
568 struct permit *prohibit_list;
569 struct lease *active;
570 struct lease *expired;
572 struct lease *backup;
573 struct lease *abandoned;
574 TIME next_event_time;
579 #if defined (FAILOVER_PROTOCOL)
580 dhcp_failover_state_t *failover_peer;
584 struct shared_network {
585 OMAPI_OBJECT_PREAMBLE;
586 struct shared_network *next;
588 struct subnet *subnets;
589 struct interface_info *interface;
592 #if defined (FAILOVER_PROTOCOL)
593 dhcp_failover_state_t *failover_peer;
598 OMAPI_OBJECT_PREAMBLE;
599 struct subnet *next_subnet;
600 struct subnet *next_sibling;
601 struct shared_network *shared_network;
602 struct interface_info *interface;
603 struct iaddr interface_address;
605 struct iaddr netmask;
611 struct collection *next;
614 struct class *classes;
617 /* XXX classes must be reference-counted. */
619 OMAPI_OBJECT_PREAMBLE;
620 struct class *nic; /* Next in collection. */
621 struct class *superclass; /* Set for spawned classes only. */
622 char *name; /* Not set for spawned classes. */
624 /* A class may be configured to permit a limited number of leases. */
627 struct lease **billed_leases;
629 /* If nonzero, class has not been saved since it was last
633 /* Hash table containing subclasses. */
635 struct data_string hash_string;
637 /* Expression used to match class. */
638 struct expression *expr;
640 /* Expression used to compute subclass identifiers for spawning
641 and to do subclass matching. */
642 struct expression *submatch;
647 /* Statements to execute if class matches. */
648 struct executable_statement *statements;
651 /* DHCP client lease structure... */
652 struct client_lease {
653 struct client_lease *next; /* Next lease in list. */
654 TIME expiry, renewal, rebind; /* Lease timeouts. */
655 struct iaddr address; /* Address being leased. */
656 char *server_name; /* Name of boot server. */
657 char *filename; /* Name of file we're supposed to boot. */
658 struct string_list *medium; /* Network medium. */
659 struct auth_key *key; /* Key used in basic DHCP authentication. */
661 unsigned int is_static : 1; /* If set, lease is from config file. */
662 unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */
664 struct option_state *options; /* Options supplied with lease. */
667 /* Possible states in which the client can be. */
679 /* Authentication and BOOTP policy possibilities (not all values work
681 enum policy { P_IGNORE, P_ACCEPT, P_PREFER, P_REQUIRE, P_DONT };
683 /* Configuration information from the config file... */
684 struct client_config {
686 * When a message has been received, run these statements
689 struct group *on_receipt;
692 * When a message is sent, run these statements.
694 struct group *on_transmission;
696 u_int32_t *required_options; /* Options server must supply. */
697 u_int32_t *requested_options; /* Options to request from server. */
699 TIME timeout; /* Start to panic if we don't get a
700 lease in this time period when
702 TIME initial_interval; /* All exponential backoff intervals
704 TIME retry_interval; /* If the protocol failed to produce
705 an address before the timeout,
706 try the protocol again after this
708 TIME select_interval; /* Wait this many seconds from the
709 first DHCPDISCOVER before
710 picking an offered lease. */
711 TIME reboot_timeout; /* When in INIT-REBOOT, wait this
712 long before giving up and going
714 TIME backoff_cutoff; /* When doing exponential backoff,
715 never back off to an interval
716 longer than this amount. */
717 u_int32_t requested_lease; /* Requested lease time, if user
718 doesn't configure one. */
719 struct string_list *media; /* Possible network media values. */
720 char *script_name; /* Name of config script. */
721 char *vendor_space_name; /* Name of config script. */
722 enum policy bootp_policy;
723 /* Ignore, accept or prefer BOOTP
725 enum policy auth_policy;
726 /* Require authentication, prefer
727 authentication, or don't try to
729 struct string_list *medium; /* Current network medium. */
731 struct iaddrlist *reject_list; /* Servers to reject. */
733 int omapi_port; /* port on which to accept OMAPI
734 connections, or -1 for no
736 int do_forward_update; /* If nonzero, and if we have the
737 information we need, update the
738 A record for the address we get. */
741 /* Per-interface state used in the dhcp client... */
742 struct client_state {
743 struct client_state *next;
744 struct interface_info *interface;
747 struct client_lease *active; /* Currently active lease. */
748 struct client_lease *new; /* New lease. */
749 struct client_lease *offered_leases; /* Leases offered to us. */
750 struct client_lease *leases; /* Leases we currently hold. */
751 struct client_lease *alias; /* Alias lease. */
753 enum dhcp_state state; /* Current state for this interface. */
754 struct iaddr destination; /* Where to send packet. */
755 u_int32_t xid; /* Transaction ID. */
756 u_int16_t secs; /* secs value from DHCPDISCOVER. */
757 TIME first_sending; /* When was first copy sent? */
758 TIME interval; /* What's the current resend interval? */
759 int dns_update_timeout; /* Last timeout set for DNS update. */
760 struct string_list *medium; /* Last media type tried. */
761 struct dhcp_packet packet; /* Outgoing DHCP packet. */
762 unsigned packet_length; /* Actual length of generated packet. */
764 struct iaddr requested_address; /* Address we would like to get. */
766 struct client_config *config; /* Client configuration. */
767 struct string_list *env; /* Client script environment. */
768 int envc; /* Number of entries in environment. */
770 struct option_state *sent_options; /* Options we sent. */
773 /* Information about each network interface. */
775 struct interface_info {
776 OMAPI_OBJECT_PREAMBLE;
777 struct interface_info *next; /* Next interface in list... */
778 struct shared_network *shared_network;
779 /* Networks connected to this interface. */
780 struct hardware hw_address; /* Its physical address. */
781 struct in_addr primary_address; /* Primary interface address. */
783 u_int8_t *circuit_id; /* Circuit ID associated with this
785 unsigned circuit_id_len; /* Length of Circuit ID, if there
787 u_int8_t *remote_id; /* Remote ID associated with this
788 interface (if any). */
789 unsigned remote_id_len; /* Length of Remote ID. */
791 char name [IFNAMSIZ]; /* Its name... */
792 int ieee80211; /* True if media is ieee802.11 */
793 int havemedia; /* True if we have a media table */
794 int linkstate; /* True if we have link */
795 int polling; /* True if polling is enabled */
796 int forcediscover; /* True if a discover is needed */
797 int index; /* Its index. */
798 int rfdesc; /* Its read file descriptor. */
799 int wfdesc; /* Its write file descriptor, if
801 unsigned char *rbuf; /* Read buffer, if required. */
802 unsigned int rbuf_max; /* Size of read buffer. */
803 size_t rbuf_offset; /* Current offset into buffer. */
804 size_t rbuf_len; /* Length of data in buffer. */
806 struct ifreq *ifp; /* Pointer to ifreq struct. */
807 u_int32_t flags; /* Control flags... */
808 #define INTERFACE_REQUESTED 1
809 #define INTERFACE_AUTOMATIC 2
810 #define INTERFACE_RUNNING 4
812 /* Only used by DHCP client code. */
813 struct client_state *client;
814 # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
816 struct hardware dlpi_broadcast_addr;
817 # endif /* DLPI_SEND || DLPI_RECEIVE */
820 struct hardware_link {
821 struct hardware_link *next;
822 char name [IFNAMSIZ];
823 struct hardware address;
826 typedef void (*tvref_t)(void *, void *, const char *, int);
827 typedef void (*tvunref_t)(void *, const char *, int);
829 struct timeout *next;
831 void (*func) PROTO ((void *));
838 struct protocol *next;
840 void (*handler) PROTO ((struct protocol *));
844 struct dns_query; /* forward */
847 struct dns_wakeup *next; /* Next wakeup in chain. */
848 void (*func) PROTO ((struct dns_query *));
851 struct dns_question {
852 u_int16_t type; /* Type of query. */
853 u_int16_t class; /* Class of query. */
854 unsigned char data [1]; /* Query data. */
858 u_int16_t type; /* Type of answer. */
859 u_int16_t class; /* Class of answer. */
860 int count; /* Number of answers. */
861 unsigned char *answers[1]; /* Pointers to answers. */
865 struct dns_query *next; /* Next query in hash bucket. */
866 u_int32_t hash; /* Hash bucket index. */
867 TIME expiry; /* Query expiry time (zero if not yet
869 u_int16_t id; /* Query ID (also hash table index) */
870 caddr_t waiters; /* Pointer to list of things waiting
873 struct dns_question *question; /* Question, internal format. */
874 struct dns_answer *answer; /* Answer, internal format. */
876 unsigned char *query; /* Query formatted for DNS server. */
877 unsigned len; /* Length of entire query. */
878 int sent; /* The query has been sent. */
879 struct dns_wakeup *wakeups; /* Wakeups to call if this query is
881 struct name_server *next_server; /* Next server to try. */
882 int backoff; /* Current backoff, in seconds. */
889 struct option_cache *primary;
890 struct option_cache *secondary;
891 struct auth_key *key;
895 OMAPI_OBJECT_PREAMBLE;
897 void (*icmp_handler) PROTO ((struct iaddr, u_int8_t *, int));
902 /* Bitmask of dhcp option codes. */
903 typedef unsigned char option_mask [16];
905 /* DHCP Option mask manipulation macros... */
906 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
907 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
908 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
909 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
910 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
912 /* An option occupies its length plus two header bytes (code and
913 length) for every 255 bytes that must be stored. */
914 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
916 /* Default path to dhcpd config file. */
918 #undef _PATH_DHCPD_CONF
919 #define _PATH_DHCPD_CONF "dhcpd.conf"
920 #undef _PATH_DHCPD_DB
921 #define _PATH_DHCPD_DB "dhcpd.leases"
922 #undef _PATH_DHCPD_PID
923 #define _PATH_DHCPD_PID "dhcpd.pid"
925 #ifndef _PATH_DHCPD_CONF
926 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
929 #ifndef _PATH_DHCPD_DB
930 #define _PATH_DHCPD_DB "/etc/dhcpd.leases"
933 #ifndef _PATH_DHCPD_PID
934 #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
938 #ifndef _PATH_DHCLIENT_CONF
939 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
942 #ifndef _PATH_DHCLIENT_SCRIPT
943 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
946 #ifndef _PATH_DHCLIENT_PID
947 #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
950 #ifndef _PATH_DHCLIENT_DB
951 #define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
954 #ifndef _PATH_RESOLV_CONF
955 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
958 #ifndef _PATH_DHCRELAY_PID
959 #define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid"
962 #ifndef DHCPD_LOG_FACILITY
963 #define DHCPD_LOG_FACILITY LOG_DAEMON
966 #define MAX_TIME 0x7fffffff
969 /* External definitions... */
971 HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t)
972 HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t)
973 HASH_FUNCTIONS_DECL (option, const char *, struct option, option_hash_t)
974 HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t)
975 HASH_FUNCTIONS_DECL (lease, const unsigned char *, struct lease, lease_hash_t)
976 HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t)
977 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t)
981 extern struct option *vendor_cfg_option;
982 int parse_options PROTO ((struct packet *));
983 int parse_option_buffer PROTO ((struct option_state *, const unsigned char *,
984 unsigned, struct universe *));
985 struct universe *find_option_universe (struct option *, const char *);
986 int parse_encapsulated_suboptions (struct option_state *, struct option *,
987 const unsigned char *, unsigned,
988 struct universe *, const char *);
989 int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *,
990 struct client_state *,
991 int, struct option_state *, struct option_state *,
992 struct binding_scope **,
993 int, int, int, struct data_string *, const char *));
994 int fqdn_universe_decode (struct option_state *,
995 const unsigned char *, unsigned, struct universe *);
996 int store_options PROTO ((unsigned char *, unsigned, struct packet *,
997 struct lease *, struct client_state *,
998 struct option_state *,
999 struct option_state *, struct binding_scope **,
1000 unsigned *, int, unsigned, unsigned,
1001 int, const char *));
1002 const char *pretty_print_option PROTO ((struct option *, const unsigned char *,
1003 unsigned, int, int));
1004 int get_option (struct data_string *, struct universe *,
1005 struct packet *, struct lease *, struct client_state *,
1006 struct option_state *, struct option_state *,
1007 struct option_state *, struct binding_scope **, unsigned,
1009 void set_option (struct universe *, struct option_state *,
1010 struct option_cache *, enum statement_op);
1011 struct option_cache *lookup_option PROTO ((struct universe *,
1012 struct option_state *, unsigned));
1013 struct option_cache *lookup_hashed_option PROTO ((struct universe *,
1014 struct option_state *,
1016 int save_option_buffer (struct universe *, struct option_state *,
1017 struct buffer *, unsigned char *, unsigned,
1018 struct option *, int);
1019 void save_option PROTO ((struct universe *,
1020 struct option_state *, struct option_cache *));
1021 void save_hashed_option PROTO ((struct universe *,
1022 struct option_state *, struct option_cache *));
1023 void delete_option PROTO ((struct universe *, struct option_state *, int));
1024 void delete_hashed_option PROTO ((struct universe *,
1025 struct option_state *, int));
1026 int option_cache_dereference PROTO ((struct option_cache **,
1027 const char *, int));
1028 int hashed_option_state_dereference PROTO ((struct universe *,
1029 struct option_state *,
1030 const char *, int));
1031 int store_option PROTO ((struct data_string *,
1032 struct universe *, struct packet *, struct lease *,
1033 struct client_state *,
1034 struct option_state *, struct option_state *,
1035 struct binding_scope **, struct option_cache *));
1036 int option_space_encapsulate PROTO ((struct data_string *,
1037 struct packet *, struct lease *,
1038 struct client_state *,
1039 struct option_state *,
1040 struct option_state *,
1041 struct binding_scope **,
1042 struct data_string *));
1043 int hashed_option_space_encapsulate PROTO ((struct data_string *,
1044 struct packet *, struct lease *,
1045 struct client_state *,
1046 struct option_state *,
1047 struct option_state *,
1048 struct binding_scope **,
1049 struct universe *));
1050 int nwip_option_space_encapsulate PROTO ((struct data_string *,
1051 struct packet *, struct lease *,
1052 struct client_state *,
1053 struct option_state *,
1054 struct option_state *,
1055 struct binding_scope **,
1056 struct universe *));
1057 int fqdn_option_space_encapsulate (struct data_string *,
1058 struct packet *, struct lease *,
1059 struct client_state *,
1060 struct option_state *,
1061 struct option_state *,
1062 struct binding_scope **,
1064 void suboption_foreach (struct packet *, struct lease *, struct client_state *,
1065 struct option_state *, struct option_state *,
1066 struct binding_scope **, struct universe *, void *,
1067 void (*) (struct option_cache *, struct packet *,
1068 struct lease *, struct client_state *,
1069 struct option_state *, struct option_state *,
1070 struct binding_scope **,
1071 struct universe *, void *),
1072 struct option_cache *, const char *);
1073 void option_space_foreach (struct packet *, struct lease *,
1074 struct client_state *,
1075 struct option_state *,
1076 struct option_state *,
1077 struct binding_scope **,
1078 struct universe *, void *,
1079 void (*) (struct option_cache *,
1081 struct lease *, struct client_state *,
1082 struct option_state *,
1083 struct option_state *,
1084 struct binding_scope **,
1085 struct universe *, void *));
1086 void hashed_option_space_foreach (struct packet *, struct lease *,
1087 struct client_state *,
1088 struct option_state *,
1089 struct option_state *,
1090 struct binding_scope **,
1091 struct universe *, void *,
1092 void (*) (struct option_cache *,
1095 struct client_state *,
1096 struct option_state *,
1097 struct option_state *,
1098 struct binding_scope **,
1099 struct universe *, void *));
1100 int linked_option_get PROTO ((struct data_string *, struct universe *,
1101 struct packet *, struct lease *,
1102 struct client_state *,
1103 struct option_state *, struct option_state *,
1104 struct option_state *, struct binding_scope **,
1106 int linked_option_state_dereference PROTO ((struct universe *,
1107 struct option_state *,
1108 const char *, int));
1109 void save_linked_option (struct universe *, struct option_state *,
1110 struct option_cache *);
1111 void linked_option_space_foreach (struct packet *, struct lease *,
1112 struct client_state *,
1113 struct option_state *,
1114 struct option_state *,
1115 struct binding_scope **,
1116 struct universe *, void *,
1117 void (*) (struct option_cache *,
1120 struct client_state *,
1121 struct option_state *,
1122 struct option_state *,
1123 struct binding_scope **,
1124 struct universe *, void *));
1125 int linked_option_space_encapsulate (struct data_string *, struct packet *,
1126 struct lease *, struct client_state *,
1127 struct option_state *,
1128 struct option_state *,
1129 struct binding_scope **,
1131 void delete_linked_option (struct universe *, struct option_state *, int);
1132 struct option_cache *lookup_linked_option (struct universe *,
1133 struct option_state *, unsigned);
1134 void do_packet PROTO ((struct interface_info *,
1135 struct dhcp_packet *, unsigned,
1136 unsigned int, struct iaddr, struct hardware *));
1139 extern TIME cur_time;
1141 int ddns_update_style;
1143 extern const char *path_dhcpd_conf;
1144 extern const char *path_dhcpd_db;
1145 extern const char *path_dhcpd_pid;
1147 extern int dhcp_max_agent_option_packet_length;
1149 int main PROTO ((int, char **, char **));
1150 void postconf_initialization (int);
1151 void postdb_startup (void);
1152 void cleanup PROTO ((void));
1153 void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));
1154 void lease_ping_timeout PROTO ((void *));
1155 int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
1156 enum dhcp_shutdown_state shutdown_state;
1157 isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);
1158 isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
1159 control_object_state_t newstate);
1162 isc_result_t new_parse PROTO ((struct parse **, int,
1163 char *, unsigned, const char *, int));
1164 isc_result_t end_parse PROTO ((struct parse **));
1165 enum dhcp_token next_token PROTO ((const char **, unsigned *, struct parse *));
1166 enum dhcp_token peek_token PROTO ((const char **, unsigned *, struct parse *));
1169 void parse_trace_setup (void);
1170 isc_result_t readconf PROTO ((void));
1171 isc_result_t read_conf_file (const char *, struct group *, int, int);
1172 #if defined (TRACING)
1173 void trace_conf_input (trace_type_t *, unsigned, char *);
1174 void trace_conf_stop (trace_type_t *ttype);
1176 isc_result_t conf_file_subparse (struct parse *, struct group *, int);
1177 isc_result_t lease_file_subparse (struct parse *);
1178 int parse_statement PROTO ((struct parse *,
1179 struct group *, int, struct host_decl *, int));
1180 #if defined (FAILOVER_PROTOCOL)
1181 void parse_failover_peer PROTO ((struct parse *, struct group *, int));
1182 void parse_failover_state_declaration (struct parse *,
1183 dhcp_failover_state_t *);
1184 void parse_failover_state PROTO ((struct parse *,
1185 enum failover_state *, TIME *));
1187 int permit_list_match (struct permit *, struct permit *);
1188 void parse_pool_statement PROTO ((struct parse *, struct group *, int));
1189 int parse_boolean PROTO ((struct parse *));
1190 int parse_lbrace PROTO ((struct parse *));
1191 void parse_host_declaration PROTO ((struct parse *, struct group *));
1192 int parse_class_declaration PROTO ((struct class **, struct parse *,
1193 struct group *, int));
1194 void parse_shared_net_declaration PROTO ((struct parse *, struct group *));
1195 void parse_subnet_declaration PROTO ((struct parse *,
1196 struct shared_network *));
1197 void parse_group_declaration PROTO ((struct parse *, struct group *));
1198 int parse_fixed_addr_param PROTO ((struct option_cache **, struct parse *));
1199 TIME parse_timestamp PROTO ((struct parse *));
1200 int parse_lease_declaration PROTO ((struct lease **, struct parse *));
1201 void parse_address_range PROTO ((struct parse *, struct group *, int,
1202 struct pool *, struct lease **));
1205 int ddns_updates PROTO ((struct packet *, struct lease *, struct lease *,
1206 struct lease_state *));
1207 int ddns_removals PROTO ((struct lease *));
1210 void add_enumeration (struct enumeration *);
1211 struct enumeration *find_enumeration (const char *, int);
1212 struct enumeration_value *find_enumeration_value (const char *, int,
1214 void skip_to_semi PROTO ((struct parse *));
1215 void skip_to_rbrace PROTO ((struct parse *, int));
1216 int parse_semi PROTO ((struct parse *));
1217 int parse_string PROTO ((struct parse *, char **, unsigned *));
1218 char *parse_host_name PROTO ((struct parse *));
1219 int parse_ip_addr_or_hostname PROTO ((struct expression **,
1220 struct parse *, int));
1221 void parse_hardware_param PROTO ((struct parse *, struct hardware *));
1222 void parse_lease_time PROTO ((struct parse *, TIME *));
1223 unsigned char *parse_numeric_aggregate PROTO ((struct parse *,
1224 unsigned char *, unsigned *,
1225 int, int, unsigned));
1226 void convert_num PROTO ((struct parse *, unsigned char *, const char *,
1228 TIME parse_date PROTO ((struct parse *));
1229 struct option *parse_option_name PROTO ((struct parse *, int, int *));
1230 void parse_option_space_decl PROTO ((struct parse *));
1231 int parse_option_code_definition PROTO ((struct parse *, struct option *));
1232 int parse_base64 (struct data_string *, struct parse *);
1233 int parse_cshl PROTO ((struct data_string *, struct parse *));
1234 int parse_executable_statement PROTO ((struct executable_statement **,
1235 struct parse *, int *,
1236 enum expression_context));
1237 int parse_executable_statements PROTO ((struct executable_statement **,
1238 struct parse *, int *,
1239 enum expression_context));
1240 int parse_zone (struct dns_zone *, struct parse *);
1241 int parse_key (struct parse *);
1242 int parse_on_statement PROTO ((struct executable_statement **,
1243 struct parse *, int *));
1244 int parse_switch_statement PROTO ((struct executable_statement **,
1245 struct parse *, int *));
1246 int parse_case_statement PROTO ((struct executable_statement **,
1247 struct parse *, int *,
1248 enum expression_context));
1249 int parse_if_statement PROTO ((struct executable_statement **,
1250 struct parse *, int *));
1251 int parse_boolean_expression PROTO ((struct expression **,
1252 struct parse *, int *));
1253 int parse_data_expression PROTO ((struct expression **,
1254 struct parse *, int *));
1255 int parse_numeric_expression PROTO ((struct expression **,
1256 struct parse *, int *));
1257 int parse_dns_expression PROTO ((struct expression **, struct parse *, int *));
1258 int parse_non_binary PROTO ((struct expression **, struct parse *, int *,
1259 enum expression_context));
1260 int parse_expression PROTO ((struct expression **, struct parse *, int *,
1261 enum expression_context,
1262 struct expression **, enum expr_op));
1263 int parse_option_statement PROTO ((struct executable_statement **,
1264 struct parse *, int,
1265 struct option *, enum statement_op));
1266 int parse_option_token PROTO ((struct expression **, struct parse *,
1267 const char **, struct expression *, int, int));
1268 int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
1269 int parse_auth_key PROTO ((struct data_string *, struct parse *));
1270 int parse_warn (struct parse *, const char *, ...)
1271 __attribute__((__format__(__printf__,2,3)));
1274 #if defined (NSUPDATE)
1275 extern struct __res_state resolver_state;
1276 extern int resolver_inited;
1279 extern struct binding_scope *global_scope;
1280 pair cons PROTO ((caddr_t, pair));
1281 int make_const_option_cache PROTO ((struct option_cache **, struct buffer **,
1282 u_int8_t *, unsigned, struct option *,
1283 const char *, int));
1284 int make_host_lookup PROTO ((struct expression **, const char *));
1285 int enter_dns_host PROTO ((struct dns_host_entry **, const char *));
1286 int make_const_data (struct expression **,
1287 const unsigned char *, unsigned, int, int,
1289 int make_const_int PROTO ((struct expression **, unsigned long));
1290 int make_concat PROTO ((struct expression **,
1291 struct expression *, struct expression *));
1292 int make_encapsulation PROTO ((struct expression **, struct data_string *));
1293 int make_substring PROTO ((struct expression **, struct expression *,
1294 struct expression *, struct expression *));
1295 int make_limit PROTO ((struct expression **, struct expression *, int));
1296 int make_let PROTO ((struct executable_statement **, const char *));
1297 int option_cache PROTO ((struct option_cache **, struct data_string *,
1298 struct expression *, struct option *,
1299 const char *, int));
1300 int evaluate_expression (struct binding_value **, struct packet *,
1301 struct lease *, struct client_state *,
1302 struct option_state *, struct option_state *,
1303 struct binding_scope **, struct expression *,
1305 int binding_value_dereference (struct binding_value **, const char *, int);
1306 #if defined (NSUPDATE)
1307 int evaluate_dns_expression PROTO ((ns_updrec **, struct packet *,
1309 struct client_state *,
1310 struct option_state *,
1311 struct option_state *,
1312 struct binding_scope **,
1313 struct expression *));
1315 int evaluate_boolean_expression PROTO ((int *,
1316 struct packet *, struct lease *,
1317 struct client_state *,
1318 struct option_state *,
1319 struct option_state *,
1320 struct binding_scope **,
1321 struct expression *));
1322 int evaluate_data_expression PROTO ((struct data_string *,
1323 struct packet *, struct lease *,
1324 struct client_state *,
1325 struct option_state *,
1326 struct option_state *,
1327 struct binding_scope **,
1328 struct expression *, const char *, int));
1329 int evaluate_numeric_expression (unsigned long *, struct packet *,
1330 struct lease *, struct client_state *,
1331 struct option_state *, struct option_state *,
1332 struct binding_scope **,
1333 struct expression *);
1334 int evaluate_option_cache PROTO ((struct data_string *,
1335 struct packet *, struct lease *,
1336 struct client_state *,
1337 struct option_state *, struct option_state *,
1338 struct binding_scope **,
1339 struct option_cache *,
1340 const char *, int));
1341 int evaluate_boolean_option_cache PROTO ((int *,
1342 struct packet *, struct lease *,
1343 struct client_state *,
1344 struct option_state *,
1345 struct option_state *,
1346 struct binding_scope **,
1347 struct option_cache *,
1348 const char *, int));
1349 int evaluate_boolean_expression_result PROTO ((int *,
1350 struct packet *, struct lease *,
1351 struct client_state *,
1352 struct option_state *,
1353 struct option_state *,
1354 struct binding_scope **,
1355 struct expression *));
1356 void expression_dereference PROTO ((struct expression **, const char *, int));
1357 int is_dns_expression PROTO ((struct expression *));
1358 int is_boolean_expression PROTO ((struct expression *));
1359 int is_data_expression PROTO ((struct expression *));
1360 int is_numeric_expression PROTO ((struct expression *));
1361 int is_compound_expression PROTO ((struct expression *));
1362 int op_precedence PROTO ((enum expr_op, enum expr_op));
1363 enum expression_context expression_context (struct expression *);
1364 enum expression_context op_context PROTO ((enum expr_op));
1365 int write_expression PROTO ((FILE *, struct expression *, int, int, int));
1366 struct binding *find_binding PROTO ((struct binding_scope *, const char *));
1367 int free_bindings PROTO ((struct binding_scope *, const char *, int));
1368 int binding_scope_dereference PROTO ((struct binding_scope **,
1369 const char *, int));
1370 int fundef_dereference (struct fundef **, const char *, int);
1371 int data_subexpression_length (int *, struct expression *);
1372 int expr_valid_for_context (struct expression *, enum expression_context);
1373 struct binding *create_binding (struct binding_scope **, const char *);
1374 int bind_ds_value (struct binding_scope **,
1375 const char *, struct data_string *);
1376 int find_bound_string (struct data_string *,
1377 struct binding_scope *, const char *);
1378 int unset (struct binding_scope *, const char *);
1381 extern int outstanding_pings;
1383 void dhcp PROTO ((struct packet *));
1384 void dhcpdiscover PROTO ((struct packet *, int));
1385 void dhcprequest PROTO ((struct packet *, int, struct lease *));
1386 void dhcprelease PROTO ((struct packet *, int));
1387 void dhcpdecline PROTO ((struct packet *, int));
1388 void dhcpinform PROTO ((struct packet *, int));
1389 void nak_lease PROTO ((struct packet *, struct iaddr *cip));
1390 void ack_lease PROTO ((struct packet *, struct lease *,
1391 unsigned int, TIME, char *, int));
1392 void dhcp_reply PROTO ((struct lease *));
1393 int find_lease PROTO ((struct lease **, struct packet *,
1394 struct shared_network *, int *, int *, struct lease *,
1395 const char *, int));
1396 int mockup_lease PROTO ((struct lease **, struct packet *,
1397 struct shared_network *,
1398 struct host_decl *));
1399 void static_lease_dereference PROTO ((struct lease *, const char *, int));
1401 int allocate_lease PROTO ((struct lease **, struct packet *,
1402 struct pool *, int *));
1403 int permitted PROTO ((struct packet *, struct permit *));
1404 int locate_network PROTO ((struct packet *));
1405 int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *));
1406 unsigned cons_agent_information_options PROTO ((struct option_state *,
1407 struct dhcp_packet *,
1408 unsigned, unsigned));
1411 void bootp PROTO ((struct packet *));
1414 int (*group_write_hook) (struct group_object *);
1415 extern struct group *root_group;
1416 extern group_hash_t *group_name_hash;
1417 isc_result_t delete_group (struct group_object *, int);
1418 isc_result_t supersede_group (struct group_object *, int);
1419 int clone_group (struct group **, struct group *, const char *, int);
1420 int write_group PROTO ((struct group_object *));
1423 void relinquish_lease_hunks (void);
1424 struct lease *new_leases PROTO ((unsigned, const char *, int));
1425 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1426 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1427 void relinquish_free_lease_states (void);
1429 OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease)
1430 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class)
1431 OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool)
1432 OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host)
1435 OMAPI_OBJECT_ALLOC_DECL (subnet, struct subnet, dhcp_type_subnet)
1436 OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network,
1437 dhcp_type_shared_network)
1438 OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group)
1439 OMAPI_OBJECT_ALLOC_DECL (dhcp_control,
1440 dhcp_control_object_t, dhcp_type_control)
1442 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1443 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1444 void relinquish_free_pairs (void);
1445 void relinquish_free_expressions (void);
1446 void relinquish_free_binding_values (void);
1447 void relinquish_free_option_caches (void);
1448 void relinquish_free_packets (void);
1451 int option_chain_head_allocate (struct option_chain_head **,
1453 int option_chain_head_reference (struct option_chain_head **,
1454 struct option_chain_head *,
1456 int option_chain_head_dereference (struct option_chain_head **,
1458 int group_allocate (struct group **, const char *, int);
1459 int group_reference (struct group **, struct group *, const char *, int);
1460 int group_dereference (struct group **, const char *, int);
1461 struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int));
1462 struct protocol *new_protocol PROTO ((const char *, int));
1463 struct lease_state *new_lease_state PROTO ((const char *, int));
1464 struct domain_search_list *new_domain_search_list PROTO ((const char *, int));
1465 struct name_server *new_name_server PROTO ((const char *, int));
1466 void free_name_server PROTO ((struct name_server *, const char *, int));
1467 struct option *new_option PROTO ((const char *, int));
1468 int group_allocate (struct group **, const char *, int);
1469 int group_reference (struct group **, struct group *, const char *, int);
1470 int group_dereference (struct group **, const char *, int);
1471 void free_option PROTO ((struct option *, const char *, int));
1472 struct universe *new_universe PROTO ((const char *, int));
1473 void free_universe PROTO ((struct universe *, const char *, int));
1474 void free_domain_search_list PROTO ((struct domain_search_list *,
1475 const char *, int));
1476 void free_lease_state PROTO ((struct lease_state *, const char *, int));
1477 void free_protocol PROTO ((struct protocol *, const char *, int));
1478 void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *, int));
1479 struct client_lease *new_client_lease PROTO ((const char *, int));
1480 void free_client_lease PROTO ((struct client_lease *, const char *, int));
1481 struct permit *new_permit PROTO ((const char *, int));
1482 void free_permit PROTO ((struct permit *, const char *, int));
1483 pair new_pair PROTO ((const char *, int));
1484 void free_pair PROTO ((pair, const char *, int));
1485 int expression_allocate PROTO ((struct expression **, const char *, int));
1486 int expression_reference PROTO ((struct expression **,
1487 struct expression *, const char *, int));
1488 void free_expression PROTO ((struct expression *, const char *, int));
1489 int binding_value_allocate PROTO ((struct binding_value **,
1490 const char *, int));
1491 int binding_value_reference PROTO ((struct binding_value **,
1492 struct binding_value *,
1493 const char *, int));
1494 void free_binding_value PROTO ((struct binding_value *, const char *, int));
1495 int fundef_allocate PROTO ((struct fundef **, const char *, int));
1496 int fundef_reference PROTO ((struct fundef **,
1497 struct fundef *, const char *, int));
1498 int option_cache_allocate PROTO ((struct option_cache **, const char *, int));
1499 int option_cache_reference PROTO ((struct option_cache **,
1500 struct option_cache *, const char *, int));
1501 int buffer_allocate PROTO ((struct buffer **, unsigned, const char *, int));
1502 int buffer_reference PROTO ((struct buffer **, struct buffer *,
1503 const char *, int));
1504 int buffer_dereference PROTO ((struct buffer **, const char *, int));
1505 int dns_host_entry_allocate PROTO ((struct dns_host_entry **,
1506 const char *, const char *, int));
1507 int dns_host_entry_reference PROTO ((struct dns_host_entry **,
1508 struct dns_host_entry *,
1509 const char *, int));
1510 int dns_host_entry_dereference PROTO ((struct dns_host_entry **,
1511 const char *, int));
1512 int option_state_allocate PROTO ((struct option_state **, const char *, int));
1513 int option_state_reference PROTO ((struct option_state **,
1514 struct option_state *, const char *, int));
1515 int option_state_dereference PROTO ((struct option_state **,
1516 const char *, int));
1517 void data_string_copy PROTO ((struct data_string *,
1518 struct data_string *, const char *, int));
1519 void data_string_forget PROTO ((struct data_string *, const char *, int));
1520 void data_string_truncate PROTO ((struct data_string *, int));
1521 int executable_statement_allocate PROTO ((struct executable_statement **,
1522 const char *, int));
1523 int executable_statement_reference PROTO ((struct executable_statement **,
1524 struct executable_statement *,
1525 const char *, int));
1526 int packet_allocate PROTO ((struct packet **, const char *, int));
1527 int packet_reference PROTO ((struct packet **,
1528 struct packet *, const char *, int));
1529 int packet_dereference PROTO ((struct packet **, const char *, int));
1530 int binding_scope_allocate PROTO ((struct binding_scope **,
1531 const char *, int));
1532 int binding_scope_reference PROTO ((struct binding_scope **,
1533 struct binding_scope *,
1534 const char *, int));
1535 int dns_zone_allocate PROTO ((struct dns_zone **, const char *, int));
1536 int dns_zone_reference PROTO ((struct dns_zone **,
1537 struct dns_zone *, const char *, int));
1540 char *quotify_string (const char *, const char *, int);
1541 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1542 char *print_base64 (const unsigned char *, unsigned, const char *, int);
1543 char *print_hw_addr PROTO ((int, int, unsigned char *));
1544 void print_lease PROTO ((struct lease *));
1545 void dump_raw PROTO ((const unsigned char *, unsigned));
1546 void dump_packet_option (struct option_cache *, struct packet *,
1547 struct lease *, struct client_state *,
1548 struct option_state *, struct option_state *,
1549 struct binding_scope **, struct universe *, void *);
1550 void dump_packet PROTO ((struct packet *));
1551 void hash_dump PROTO ((struct hash_table *));
1552 char *print_hex_1 PROTO ((unsigned, const u_int8_t *, unsigned));
1553 char *print_hex_2 PROTO ((unsigned, const u_int8_t *, unsigned));
1554 char *print_hex_3 PROTO ((unsigned, const u_int8_t *, unsigned));
1555 char *print_dotted_quads PROTO ((unsigned, const u_int8_t *));
1556 char *print_dec_1 PROTO ((unsigned long));
1557 char *print_dec_2 PROTO ((unsigned long));
1558 void print_expression PROTO ((const char *, struct expression *));
1559 int token_print_indent_concat (FILE *, int, int,
1560 const char *, const char *, ...);
1561 int token_indent_data_string (FILE *, int, int, const char *, const char *,
1562 struct data_string *);
1563 int token_print_indent (FILE *, int, int,
1564 const char *, const char *, const char *);
1565 void indent_spaces (FILE *, int);
1566 #if defined (NSUPDATE)
1567 void print_dns_status (int, ns_updque *);
1571 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
1572 || defined (USE_SOCKET_FALLBACK)
1573 int if_register_socket PROTO ((struct interface_info *));
1576 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
1577 void if_reinitialize_fallback PROTO ((struct interface_info *));
1578 void if_register_fallback PROTO ((struct interface_info *));
1579 ssize_t send_fallback PROTO ((struct interface_info *,
1580 struct packet *, struct dhcp_packet *, size_t,
1582 struct sockaddr_in *, struct hardware *));
1585 #ifdef USE_SOCKET_SEND
1586 void if_reinitialize_send PROTO ((struct interface_info *));
1587 void if_register_send PROTO ((struct interface_info *));
1588 void if_deregister_send PROTO ((struct interface_info *));
1589 ssize_t send_packet PROTO ((struct interface_info *,
1590 struct packet *, struct dhcp_packet *, size_t,
1592 struct sockaddr_in *, struct hardware *));
1594 #ifdef USE_SOCKET_RECEIVE
1595 void if_reinitialize_receive PROTO ((struct interface_info *));
1596 void if_register_receive PROTO ((struct interface_info *));
1597 void if_deregister_receive PROTO ((struct interface_info *));
1598 ssize_t receive_packet PROTO ((struct interface_info *,
1599 unsigned char *, size_t,
1600 struct sockaddr_in *, struct hardware *));
1603 #if defined (USE_SOCKET_FALLBACK)
1604 isc_result_t fallback_discard PROTO ((omapi_object_t *));
1607 #if defined (USE_SOCKET_SEND)
1608 int can_unicast_without_arp PROTO ((struct interface_info *));
1609 int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
1610 int supports_multiple_interfaces (struct interface_info *);
1611 void maybe_setup_fallback PROTO ((void));
1615 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
1616 int if_register_bpf PROTO ( (struct interface_info *));
1619 void if_reinitialize_send PROTO ((struct interface_info *));
1620 void if_register_send PROTO ((struct interface_info *));
1621 void if_deregister_send PROTO ((struct interface_info *));
1622 ssize_t send_packet PROTO ((struct interface_info *,
1623 struct packet *, struct dhcp_packet *, size_t,
1625 struct sockaddr_in *, struct hardware *));
1627 #ifdef USE_BPF_RECEIVE
1628 void if_reinitialize_receive PROTO ((struct interface_info *));
1629 void if_register_receive PROTO ((struct interface_info *));
1630 void if_deregister_receive PROTO ((struct interface_info *));
1631 ssize_t receive_packet PROTO ((struct interface_info *,
1632 unsigned char *, size_t,
1633 struct sockaddr_in *, struct hardware *));
1635 #if defined (USE_BPF_SEND)
1636 int can_unicast_without_arp PROTO ((struct interface_info *));
1637 int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
1638 int supports_multiple_interfaces (struct interface_info *);
1639 void maybe_setup_fallback PROTO ((void));
1643 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
1644 int if_register_lpf PROTO ( (struct interface_info *));
1647 void if_reinitialize_send PROTO ((struct interface_info *));
1648 void if_register_send PROTO ((struct interface_info *));
1649 void if_deregister_send PROTO ((struct interface_info *));
1650 ssize_t send_packet PROTO ((struct interface_info *,
1651 struct packet *, struct dhcp_packet *, size_t,
1653 struct sockaddr_in *, struct hardware *));
1655 #ifdef USE_LPF_RECEIVE
1656 void if_reinitialize_receive PROTO ((struct interface_info *));
1657 void if_register_receive PROTO ((struct interface_info *));
1658 void if_deregister_receive PROTO ((struct interface_info *));
1659 ssize_t receive_packet PROTO ((struct interface_info *,
1660 unsigned char *, size_t,
1661 struct sockaddr_in *, struct hardware *));
1663 #if defined (USE_LPF_SEND)
1664 int can_unicast_without_arp PROTO ((struct interface_info *));
1665 int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
1666 int supports_multiple_interfaces (struct interface_info *);
1667 void maybe_setup_fallback PROTO ((void));
1671 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
1672 int if_register_nit PROTO ( (struct interface_info *));
1676 void if_reinitialize_send PROTO ((struct interface_info *));
1677 void if_register_send PROTO ((struct interface_info *));
1678 void if_deregister_send PROTO ((struct interface_info *));
1679 ssize_t send_packet PROTO ((struct interface_info *,
1680 struct packet *, struct dhcp_packet *, size_t,
1682 struct sockaddr_in *, struct hardware *));
1684 #ifdef USE_NIT_RECEIVE
1685 void if_reinitialize_receive PROTO ((struct interface_info *));
1686 void if_register_receive PROTO ((struct interface_info *));
1687 void if_deregister_receive PROTO ((struct interface_info *));
1688 ssize_t receive_packet PROTO ((struct interface_info *,
1689 unsigned char *, size_t,
1690 struct sockaddr_in *, struct hardware *));
1692 #if defined (USE_NIT_SEND)
1693 int can_unicast_without_arp PROTO ((struct interface_info *));
1694 int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
1695 int supports_multiple_interfaces (struct interface_info *);
1696 void maybe_setup_fallback PROTO ((void));
1700 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
1701 int if_register_dlpi PROTO ( (struct interface_info *));
1704 #ifdef USE_DLPI_SEND
1705 void if_reinitialize_send PROTO ((struct interface_info *));
1706 void if_register_send PROTO ((struct interface_info *));
1707 void if_deregister_send PROTO ((struct interface_info *));
1708 ssize_t send_packet PROTO ((struct interface_info *,
1709 struct packet *, struct dhcp_packet *, size_t,
1711 struct sockaddr_in *, struct hardware *));
1713 #ifdef USE_DLPI_RECEIVE
1714 void if_reinitialize_receive PROTO ((struct interface_info *));
1715 void if_register_receive PROTO ((struct interface_info *));
1716 void if_deregister_receive PROTO ((struct interface_info *));
1717 ssize_t receive_packet PROTO ((struct interface_info *,
1718 unsigned char *, size_t,
1719 struct sockaddr_in *, struct hardware *));
1725 void if_reinitialize_send PROTO ((struct interface_info *));
1726 void if_register_send PROTO ((struct interface_info *));
1727 void if_deregister_send PROTO ((struct interface_info *));
1728 ssize_t send_packet PROTO ((struct interface_info *,
1729 struct packet *, struct dhcp_packet *, size_t,
1731 struct sockaddr_in *, struct hardware *));
1732 int can_unicast_without_arp PROTO ((struct interface_info *));
1733 int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
1734 int supports_multiple_interfaces (struct interface_info *);
1735 void maybe_setup_fallback PROTO ((void));
1739 extern struct interface_info *interfaces,
1740 *dummy_interfaces, *fallback_interface;
1741 extern struct protocol *protocols;
1742 extern int quiet_interface_discovery;
1743 isc_result_t interface_setup (void);
1744 void interface_trace_setup (void);
1746 extern struct in_addr limited_broadcast;
1747 extern struct in_addr local_address;
1749 extern u_int16_t local_port;
1750 extern u_int16_t remote_port;
1751 extern int (*dhcp_interface_setup_hook) (struct interface_info *,
1753 extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
1754 isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
1756 extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
1757 struct dhcp_packet *, unsigned,
1759 struct iaddr, struct hardware *));
1760 extern struct timeout *timeouts;
1761 extern omapi_object_type_t *dhcp_type_interface;
1762 #if defined (TRACING)
1763 trace_type_t *interface_trace;
1764 trace_type_t *inpacket_trace;
1765 trace_type_t *outpacket_trace;
1767 extern struct interface_info **interface_vector;
1768 extern int interface_count;
1769 extern int interface_max;
1770 isc_result_t interface_initialize (omapi_object_t *, const char *, int);
1771 void discover_interfaces PROTO ((int));
1772 int setup_fallback (struct interface_info **, const char *, int);
1773 int if_readsocket PROTO ((omapi_object_t *));
1774 void reinitialize_interfaces PROTO ((void));
1777 void set_time (u_int32_t);
1778 struct timeval *process_outstanding_timeouts (struct timeval *);
1779 void dispatch PROTO ((void));
1780 isc_result_t got_one PROTO ((omapi_object_t *));
1781 isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *,
1782 omapi_data_string_t *, omapi_typed_data_t *);
1783 isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *,
1784 omapi_data_string_t *, omapi_value_t **);
1785 isc_result_t interface_destroy (omapi_object_t *, const char *, int);
1786 isc_result_t interface_signal_handler (omapi_object_t *,
1787 const char *, va_list);
1788 isc_result_t interface_stuff_values (omapi_object_t *,
1792 void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *,
1793 tvref_t, tvunref_t));
1794 void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *));
1795 void cancel_all_timeouts (void);
1796 void relinquish_timeouts (void);
1798 struct protocol *add_protocol PROTO ((const char *, int,
1799 void (*) PROTO ((struct protocol *)),
1802 void remove_protocol PROTO ((struct protocol *));
1804 OMAPI_OBJECT_ALLOC_DECL (interface,
1805 struct interface_info, dhcp_type_interface)
1808 extern struct universe dhcp_universe;
1809 extern struct option dhcp_options [256];
1810 extern struct universe nwip_universe;
1811 extern struct option nwip_options [256];
1812 extern struct universe fqdn_universe;
1813 extern struct option fqdn_options [256];
1814 extern int dhcp_option_default_priority_list [];
1815 extern int dhcp_option_default_priority_list_count;
1816 extern const char *hardware_types [256];
1817 int universe_count, universe_max;
1818 struct universe **universes;
1819 extern universe_hash_t *universe_hash;
1820 void initialize_common_option_spaces PROTO ((void));
1821 struct universe *config_universe;
1824 #if defined (FAILOVER_PROTOCOL)
1825 extern failover_option_t null_failover_option;
1826 extern failover_option_t skip_failover_option;
1827 extern struct failover_option_info ft_options [];
1828 extern u_int32_t fto_allowed [];
1829 extern int ft_sizes [];
1830 extern const char *dhcp_flink_state_names [];
1832 extern const char *binding_state_names [];
1834 extern struct universe agent_universe;
1835 extern struct option agent_options [256];
1836 extern struct universe server_universe;
1837 extern struct option server_options [256];
1839 extern struct enumeration ddns_styles;
1840 extern struct enumeration syslog_enum;
1841 void initialize_server_option_spaces PROTO ((void));
1844 struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
1845 struct iaddr ip_addr PROTO ((struct iaddr, struct iaddr, u_int32_t));
1846 struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr));
1847 u_int32_t host_addr PROTO ((struct iaddr, struct iaddr));
1848 int addr_eq PROTO ((struct iaddr, struct iaddr));
1849 char *piaddr PROTO ((struct iaddr));
1850 char *piaddrmask (struct iaddr, struct iaddr, const char *, int);
1851 char *piaddr1 PROTO ((struct iaddr));
1854 extern const char *path_dhclient_conf;
1855 extern const char *path_dhclient_db;
1856 extern const char *path_dhclient_pid;
1857 extern char *path_dhclient_script;
1858 extern int interfaces_requested;
1860 extern struct client_config top_level_config;
1862 void dhcpoffer PROTO ((struct packet *));
1863 void dhcpack PROTO ((struct packet *));
1864 void dhcpnak PROTO ((struct packet *));
1866 void send_discover PROTO ((void *));
1867 void send_request PROTO ((void *));
1868 void send_release PROTO ((void *));
1869 void send_decline PROTO ((void *));
1871 void state_reboot PROTO ((void *));
1872 #ifdef ENABLE_POLLING_MODE
1873 void state_polling PROTO (());
1874 void state_background PROTO ((void *));
1876 void state_init PROTO ((void *));
1877 void state_selecting PROTO ((void *));
1878 void state_requesting PROTO ((void *));
1879 void state_bound PROTO ((void *));
1880 void state_stop PROTO ((void *));
1881 void state_panic PROTO ((void *));
1884 void set_ieee80211 PROTO ((struct interface_info *));
1886 int interface_active PROTO ((struct interface_info *));
1888 void bind_lease PROTO ((struct client_state *));
1890 void make_client_options PROTO ((struct client_state *,
1891 struct client_lease *, u_int8_t *,
1892 struct option_cache *, struct iaddr *,
1893 u_int32_t *, struct option_state **));
1894 void make_discover PROTO ((struct client_state *, struct client_lease *));
1895 void make_request PROTO ((struct client_state *, struct client_lease *));
1896 void make_decline PROTO ((struct client_state *, struct client_lease *));
1897 void make_release PROTO ((struct client_state *, struct client_lease *));
1899 void destroy_client_lease PROTO ((struct client_lease *));
1900 void rewrite_client_leases PROTO ((void));
1901 void write_lease_option (struct option_cache *, struct packet *,
1902 struct lease *, struct client_state *,
1903 struct option_state *, struct option_state *,
1904 struct binding_scope **, struct universe *, void *);
1905 int write_client_lease PROTO ((struct client_state *,
1906 struct client_lease *, int, int));
1907 int dhcp_option_ev_name (char *, size_t, struct option *);
1909 void script_init PROTO ((struct client_state *, const char *,
1910 struct string_list *));
1911 void client_option_envadd (struct option_cache *, struct packet *,
1912 struct lease *, struct client_state *,
1913 struct option_state *, struct option_state *,
1914 struct binding_scope **, struct universe *, void *);
1915 void script_write_params PROTO ((struct client_state *,
1916 const char *, struct client_lease *));
1917 int script_go PROTO ((struct client_state *));
1918 void client_envadd (struct client_state *,
1919 const char *, const char *, const char *, ...)
1920 __attribute__((__format__(__printf__,4,5)));
1922 struct client_lease *packet_to_lease (struct packet *, struct client_state *);
1923 void go_daemon PROTO ((void));
1924 void write_client_pid_file PROTO ((void));
1925 void client_location_changed PROTO ((void));
1926 void do_release PROTO ((struct client_state *));
1927 int dhclient_interface_shutdown_hook (struct interface_info *);
1928 int dhclient_interface_discovery_hook (struct interface_info *);
1929 isc_result_t dhclient_interface_startup_hook (struct interface_info *);
1930 void client_dns_update_timeout (void *cp);
1931 isc_result_t client_dns_update (struct client_state *client, int, int);
1934 int write_lease PROTO ((struct lease *));
1935 int write_host PROTO ((struct host_decl *));
1936 #if defined (FAILOVER_PROTOCOL)
1937 int write_failover_state (dhcp_failover_state_t *);
1939 int db_printable PROTO ((const char *));
1940 int db_printable_len PROTO ((const unsigned char *, unsigned));
1941 void write_named_billing_class (const char *, unsigned, struct class *);
1942 void write_billing_classes (void);
1943 int write_billing_class PROTO ((struct class *));
1944 void commit_leases_timeout PROTO ((void *));
1945 int commit_leases PROTO ((void));
1946 void db_startup PROTO ((int));
1947 int new_lease_file PROTO ((void));
1948 int group_writer (struct group_object *);
1951 u_int32_t checksum PROTO ((unsigned char *, unsigned, u_int32_t));
1952 u_int32_t wrapsum PROTO ((u_int32_t));
1953 void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
1954 unsigned *, struct hardware *));
1955 void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
1956 unsigned *, u_int32_t, u_int32_t,
1957 u_int32_t, unsigned char *, unsigned));
1958 ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
1959 unsigned, struct hardware *));
1960 ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
1961 unsigned, struct sockaddr_in *,
1962 unsigned char *, unsigned));
1965 void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
1966 unsigned *, struct hardware *));
1967 ssize_t decode_ethernet_header PROTO ((struct interface_info *,
1969 unsigned, struct hardware *));
1972 void assemble_tr_header PROTO ((struct interface_info *, unsigned char *,
1973 unsigned *, struct hardware *));
1974 ssize_t decode_tr_header PROTO ((struct interface_info *,
1976 unsigned, struct hardware *));
1979 void convert_statement PROTO ((struct parse *));
1980 void convert_host_statement PROTO ((struct parse *, jrefproto));
1981 void convert_host_name PROTO ((struct parse *, jrefproto));
1982 void convert_class_statement PROTO ((struct parse *, jrefproto, int));
1983 void convert_class_decl PROTO ((struct parse *, jrefproto));
1984 void convert_lease_time PROTO ((struct parse *, jrefproto, char *));
1985 void convert_shared_net_statement PROTO ((struct parse *, jrefproto));
1986 void convert_subnet_statement PROTO ((struct parse *, jrefproto));
1987 void convert_subnet_decl PROTO ((struct parse *, jrefproto));
1988 void convert_host_decl PROTO ((struct parse *, jrefproto));
1989 void convert_hardware_decl PROTO ((struct parse *, jrefproto));
1990 void convert_hardware_addr PROTO ((struct parse *, jrefproto));
1991 void convert_filename_decl PROTO ((struct parse *, jrefproto));
1992 void convert_servername_decl PROTO ((struct parse *, jrefproto));
1993 void convert_ip_addr_or_hostname PROTO ((struct parse *, jrefproto, int));
1994 void convert_fixed_addr_decl PROTO ((struct parse *, jrefproto));
1995 void convert_option_decl PROTO ((struct parse *, jrefproto));
1996 void convert_timestamp PROTO ((struct parse *, jrefproto));
1997 void convert_lease_statement PROTO ((struct parse *, jrefproto));
1998 void convert_address_range PROTO ((struct parse *, jrefproto));
1999 void convert_date PROTO ((struct parse *, jrefproto, char *));
2000 void convert_numeric_aggregate PROTO ((struct parse *, jrefproto, int, int, int, int));
2001 void indent PROTO ((int));
2004 void add_route_direct PROTO ((struct interface_info *, struct in_addr));
2005 void add_route_net PROTO ((struct interface_info *, struct in_addr,
2007 void add_route_default_gateway PROTO ((struct interface_info *,
2009 void remove_routes PROTO ((struct in_addr));
2010 void remove_if_route PROTO ((struct interface_info *, struct in_addr));
2011 void remove_all_if_routes PROTO ((struct interface_info *));
2012 void set_netmask PROTO ((struct interface_info *, struct in_addr));
2013 void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr));
2014 void set_ip_address PROTO ((struct interface_info *, struct in_addr));
2017 isc_result_t read_client_conf PROTO ((void));
2018 int read_client_conf_file (const char *,
2019 struct interface_info *, struct client_config *);
2020 void read_client_leases PROTO ((void));
2021 void parse_client_statement PROTO ((struct parse *, struct interface_info *,
2022 struct client_config *));
2023 int parse_X PROTO ((struct parse *, u_int8_t *, unsigned));
2024 void parse_option_list PROTO ((struct parse *, u_int32_t **));
2025 void parse_interface_declaration PROTO ((struct parse *,
2026 struct client_config *, char *));
2027 int interface_or_dummy PROTO ((struct interface_info **, const char *));
2028 void make_client_state PROTO ((struct client_state **));
2029 void make_client_config PROTO ((struct client_state *,
2030 struct client_config *));
2031 void parse_client_lease_statement PROTO ((struct parse *, int));
2032 void parse_client_lease_declaration PROTO ((struct parse *,
2033 struct client_lease *,
2034 struct interface_info **,
2035 struct client_state **));
2036 int parse_option_decl PROTO ((struct option_cache **, struct parse *));
2037 void parse_string_list PROTO ((struct parse *, struct string_list **, int));
2038 int parse_ip_addr PROTO ((struct parse *, struct iaddr *));
2039 void parse_reject_statement PROTO ((struct parse *, struct client_config *));
2042 void relay PROTO ((struct interface_info *, struct dhcp_packet *, unsigned,
2043 unsigned int, struct iaddr, struct hardware *));
2044 int strip_relay_agent_options PROTO ((struct interface_info *,
2045 struct interface_info **,
2046 struct dhcp_packet *, unsigned));
2047 int find_interface_by_agent_option PROTO ((struct dhcp_packet *,
2048 struct interface_info **,
2050 int add_relay_agent_options PROTO ((struct interface_info *,
2051 struct dhcp_packet *,
2052 unsigned, struct in_addr));
2055 OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp)
2056 extern struct icmp_state *icmp_state;
2057 void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
2058 u_int8_t *, int))));
2059 int icmp_readsocket PROTO ((omapi_object_t *));
2060 int icmp_echorequest PROTO ((struct iaddr *));
2061 isc_result_t icmp_echoreply PROTO ((omapi_object_t *));
2064 #if defined (NSUPDATE)
2065 isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *);
2066 void tkey_free (ns_tsig_key **);
2068 isc_result_t enter_dns_zone (struct dns_zone *);
2069 isc_result_t dns_zone_lookup (struct dns_zone **, const char *);
2070 int dns_zone_dereference PROTO ((struct dns_zone **, const char *, int));
2071 #if defined (NSUPDATE)
2072 isc_result_t find_cached_zone (const char *, ns_class, char *,
2073 size_t, struct in_addr *, int, int *,
2074 struct dns_zone **);
2075 void forget_zone (struct dns_zone **);
2076 void repudiate_zone (struct dns_zone **);
2077 void cache_found_zone (ns_class, char *, struct in_addr *, int);
2078 int get_dhcid (struct data_string *, int, const u_int8_t *, unsigned);
2079 isc_result_t ddns_update_a (struct data_string *, struct iaddr,
2080 struct data_string *, unsigned long, int);
2081 isc_result_t ddns_remove_a (struct data_string *,
2082 struct iaddr, struct data_string *);
2083 #endif /* NSUPDATE */
2086 extern char path_resolv_conf [];
2087 struct name_server *name_servers;
2088 struct domain_search_list *domains;
2090 void read_resolv_conf PROTO ((TIME));
2091 struct name_server *first_name_server PROTO ((void));
2094 #ifdef NEED_INET_ATON
2095 int inet_aton PROTO ((const char *, struct in_addr *));
2099 extern int have_billing_classes;
2100 struct class unknown_class;
2101 struct class known_class;
2102 struct collection default_collection;
2103 struct collection *collections;
2104 struct executable_statement *default_classification_rules;
2106 void classification_setup PROTO ((void));
2107 void classify_client PROTO ((struct packet *));
2108 int check_collection PROTO ((struct packet *, struct lease *,
2109 struct collection *));
2110 void classify PROTO ((struct packet *, struct class *));
2111 isc_result_t find_class PROTO ((struct class **, const char *,
2112 const char *, int));
2113 int unbill_class PROTO ((struct lease *, struct class *));
2114 int bill_class PROTO ((struct lease *, struct class *));
2117 int execute_statements PROTO ((struct binding_value **result,
2118 struct packet *, struct lease *,
2119 struct client_state *,
2120 struct option_state *, struct option_state *,
2121 struct binding_scope **,
2122 struct executable_statement *));
2123 void execute_statements_in_scope PROTO ((struct binding_value **result,
2124 struct packet *, struct lease *,
2125 struct client_state *,
2126 struct option_state *,
2127 struct option_state *,
2128 struct binding_scope **,
2129 struct group *, struct group *));
2130 int executable_statement_dereference PROTO ((struct executable_statement **,
2131 const char *, int));
2132 void write_statements (FILE *, struct executable_statement *, int);
2133 int find_matching_case (struct executable_statement **,
2134 struct packet *, struct lease *, struct client_state *,
2135 struct option_state *, struct option_state *,
2136 struct binding_scope **,
2137 struct expression *, struct executable_statement *);
2138 int executable_statement_foreach (struct executable_statement *,
2139 int (*) (struct executable_statement *,
2140 void *, int), void *, int);
2143 extern omapi_object_type_t *dhcp_type_interface;
2144 extern omapi_object_type_t *dhcp_type_group;
2145 extern omapi_object_type_t *dhcp_type_shared_network;
2146 extern omapi_object_type_t *dhcp_type_subnet;
2147 extern omapi_object_type_t *dhcp_type_control;
2148 extern dhcp_control_object_t *dhcp_control_object;
2150 void dhcp_common_objects_setup (void);
2152 isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
2153 omapi_data_string_t *,
2154 omapi_typed_data_t *);
2155 isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
2156 omapi_data_string_t *,
2158 isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
2159 isc_result_t dhcp_group_signal_handler (omapi_object_t *,
2160 const char *, va_list);
2161 isc_result_t dhcp_group_stuff_values (omapi_object_t *,
2164 isc_result_t dhcp_group_lookup (omapi_object_t **,
2165 omapi_object_t *, omapi_object_t *);
2166 isc_result_t dhcp_group_create (omapi_object_t **,
2168 isc_result_t dhcp_group_remove (omapi_object_t *,
2171 isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *,
2172 omapi_data_string_t *,
2173 omapi_typed_data_t *);
2174 isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *,
2175 omapi_data_string_t *,
2177 isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int);
2178 isc_result_t dhcp_control_signal_handler (omapi_object_t *,
2179 const char *, va_list);
2180 isc_result_t dhcp_control_stuff_values (omapi_object_t *,
2183 isc_result_t dhcp_control_lookup (omapi_object_t **,
2184 omapi_object_t *, omapi_object_t *);
2185 isc_result_t dhcp_control_create (omapi_object_t **,
2187 isc_result_t dhcp_control_remove (omapi_object_t *,
2190 isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
2191 omapi_data_string_t *,
2192 omapi_typed_data_t *);
2193 isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
2194 omapi_data_string_t *,
2196 isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
2197 isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
2198 const char *, va_list);
2199 isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
2202 isc_result_t dhcp_subnet_lookup (omapi_object_t **,
2203 omapi_object_t *, omapi_object_t *);
2204 isc_result_t dhcp_subnet_create (omapi_object_t **,
2206 isc_result_t dhcp_subnet_remove (omapi_object_t *,
2209 isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
2211 omapi_data_string_t *,
2212 omapi_typed_data_t *);
2213 isc_result_t dhcp_shared_network_get_value (omapi_object_t *,
2215 omapi_data_string_t *,
2217 isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
2218 isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
2219 const char *, va_list);
2220 isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
2223 isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
2224 omapi_object_t *, omapi_object_t *);
2225 isc_result_t dhcp_shared_network_create (omapi_object_t **,
2227 isc_result_t dhcp_shared_network_remove (omapi_object_t *,
2231 extern int (*dhcp_interface_shutdown_hook) (struct interface_info *);
2233 extern omapi_object_type_t *dhcp_type_lease;
2234 extern omapi_object_type_t *dhcp_type_pool;
2235 extern omapi_object_type_t *dhcp_type_class;
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;
2243 void dhcp_db_objects_setup (void);
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 *,
2251 isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int);
2252 isc_result_t dhcp_lease_signal_handler (omapi_object_t *,
2253 const char *, va_list);
2254 isc_result_t dhcp_lease_stuff_values (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 **,
2261 isc_result_t dhcp_lease_remove (omapi_object_t *,
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 *,
2269 isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
2270 isc_result_t dhcp_group_signal_handler (omapi_object_t *,
2271 const char *, va_list);
2272 isc_result_t dhcp_group_stuff_values (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 **,
2279 isc_result_t dhcp_group_remove (omapi_object_t *,
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 *,
2287 isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int);
2288 isc_result_t dhcp_host_signal_handler (omapi_object_t *,
2289 const char *, va_list);
2290 isc_result_t dhcp_host_stuff_values (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 **,
2297 isc_result_t dhcp_host_remove (omapi_object_t *,
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 *,
2305 isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int);
2306 isc_result_t dhcp_pool_signal_handler (omapi_object_t *,
2307 const char *, va_list);
2308 isc_result_t dhcp_pool_stuff_values (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 **,
2315 isc_result_t dhcp_pool_remove (omapi_object_t *,
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 *,
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 *,
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 **,
2333 isc_result_t dhcp_class_remove (omapi_object_t *,
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 *,
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 *,
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 **,
2351 isc_result_t dhcp_subclass_remove (omapi_object_t *,
2353 isc_result_t dhcp_shared_network_set_value (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 *,
2360 isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
2361 isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
2362 const char *, va_list);
2363 isc_result_t dhcp_shared_network_stuff_values (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 **,
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 *,
2376 isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
2377 isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
2378 const char *, va_list);
2379 isc_result_t dhcp_subnet_stuff_values (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 **,
2386 isc_result_t dhcp_interface_set_value (omapi_object_t *,
2388 omapi_data_string_t *,
2389 omapi_typed_data_t *);
2390 isc_result_t dhcp_interface_get_value (omapi_object_t *,
2392 omapi_data_string_t *,
2394 isc_result_t dhcp_interface_destroy (omapi_object_t *,
2396 isc_result_t dhcp_interface_signal_handler (omapi_object_t *,
2399 isc_result_t dhcp_interface_stuff_values (omapi_object_t *,
2402 isc_result_t dhcp_interface_lookup (omapi_object_t **,
2405 isc_result_t dhcp_interface_create (omapi_object_t **,
2407 isc_result_t dhcp_interface_remove (omapi_object_t *,
2409 void interface_stash (struct interface_info *);
2410 void interface_snorf (struct interface_info *, int);
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 *);
2423 extern struct subnet *subnets;
2424 extern struct shared_network *shared_networks;
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;
2432 extern omapi_object_type_t *dhcp_type_host;
2434 isc_result_t enter_host PROTO ((struct host_decl *, int, int));
2435 isc_result_t delete_host PROTO ((struct host_decl *, int));
2436 int find_hosts_by_haddr PROTO ((struct host_decl **, int,
2437 const unsigned char *, unsigned,
2438 const char *, int));
2439 int find_hosts_by_uid PROTO ((struct host_decl **, const unsigned char *,
2440 unsigned, const char *, int));
2441 int find_host_for_network PROTO ((struct subnet **, struct host_decl **,
2442 struct iaddr *, struct shared_network *));
2443 void new_address_range PROTO ((struct parse *, struct iaddr, struct iaddr,
2444 struct subnet *, struct pool *,
2446 isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int);
2447 isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int);
2448 int find_grouped_subnet PROTO ((struct subnet **, struct shared_network *,
2449 struct iaddr, const char *, int));
2450 int find_subnet (struct subnet **, struct iaddr, const char *, int);
2451 void enter_shared_network PROTO ((struct shared_network *));
2452 void new_shared_network_interface PROTO ((struct parse *,
2453 struct shared_network *,
2455 int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int));
2456 void enter_subnet PROTO ((struct subnet *));
2457 void enter_lease PROTO ((struct lease *));
2458 int supersede_lease PROTO ((struct lease *, struct lease *, int, int, int));
2459 void make_binding_state_transition (struct lease *);
2460 int lease_copy PROTO ((struct lease **, struct lease *, const char *, int));
2461 void release_lease PROTO ((struct lease *, struct packet *));
2462 void abandon_lease PROTO ((struct lease *, const char *));
2463 void dissociate_lease PROTO ((struct lease *));
2464 void pool_timer PROTO ((void *));
2465 int find_lease_by_uid PROTO ((struct lease **, const unsigned char *,
2466 unsigned, const char *, int));
2467 int find_lease_by_hw_addr PROTO ((struct lease **, const unsigned char *,
2468 unsigned, const char *, int));
2469 int find_lease_by_ip_addr PROTO ((struct lease **, struct iaddr,
2470 const char *, int));
2471 void uid_hash_add PROTO ((struct lease *));
2472 void uid_hash_delete PROTO ((struct lease *));
2473 void hw_hash_add PROTO ((struct lease *));
2474 void hw_hash_delete PROTO ((struct lease *));
2475 int write_leases PROTO ((void));
2476 int lease_enqueue (struct lease *);
2477 void lease_instantiate (const unsigned char *, unsigned, struct lease *);
2478 void expire_all_pools PROTO ((void));
2479 void dump_subnets PROTO ((void));
2480 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2481 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2482 void free_everything (void);
2486 char *ddns_rev_name (struct lease *, struct lease_state *, struct packet *);
2487 char *ddns_fwd_name (struct lease *, struct lease_state *, struct packet *);
2488 int nsupdateA (const char *, const unsigned char *, u_int32_t, int);
2489 int nsupdatePTR (const char *, const unsigned char *, u_int32_t, int);
2490 void nsupdate (struct lease *, struct lease_state *, struct packet *, int);
2491 int updateA (const struct data_string *, const struct data_string *,
2492 unsigned int, struct lease *);
2493 int updatePTR (const struct data_string *, const struct data_string *,
2494 unsigned int, struct lease *);
2495 int deleteA (const struct data_string *, const struct data_string *,
2497 int deletePTR (const struct data_string *, const struct data_string *,
2501 #if defined (FAILOVER_PROTOCOL)
2502 extern dhcp_failover_state_t *failover_states;
2503 void dhcp_failover_startup PROTO ((void));
2504 int dhcp_failover_write_all_states (void);
2505 isc_result_t enter_failover_peer PROTO ((dhcp_failover_state_t *));
2506 isc_result_t find_failover_peer PROTO ((dhcp_failover_state_t **,
2507 const char *, const char *, int));
2508 isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *));
2509 isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *,
2510 const char *, va_list));
2511 isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *,
2513 omapi_data_string_t *,
2514 omapi_typed_data_t *));
2515 isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *,
2517 omapi_data_string_t *,
2519 isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *,
2520 const char *, int));
2521 isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *,
2524 isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *));
2526 isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *,
2529 isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *,
2531 omapi_data_string_t *,
2532 omapi_typed_data_t *));
2533 isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *,
2535 omapi_data_string_t *,
2537 isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *,
2538 const char *, int));
2539 isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *,
2542 isc_result_t dhcp_failover_register PROTO ((omapi_object_t *));
2543 isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *,
2544 const char *, va_list));
2545 isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *,
2547 isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state);
2548 isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *,
2549 enum failover_state);
2550 isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *,
2551 failover_message_t *);
2552 int dhcp_failover_pool_rebalance (dhcp_failover_state_t *);
2553 int dhcp_failover_pool_check (struct pool *);
2554 int dhcp_failover_state_pool_check (dhcp_failover_state_t *);
2555 void dhcp_failover_timeout (void *);
2556 void dhcp_failover_send_contact (void *);
2557 isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *);
2558 isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *);
2559 int dhcp_failover_queue_update (struct lease *, int);
2560 int dhcp_failover_send_acks (dhcp_failover_state_t *);
2561 void dhcp_failover_toack_queue_timeout (void *);
2562 int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg);
2563 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *);
2564 isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *,
2566 omapi_data_string_t *,
2567 omapi_typed_data_t *));
2568 void dhcp_failover_keepalive (void *);
2569 void dhcp_failover_reconnect (void *);
2570 void dhcp_failover_startup_timeout (void *);
2571 void dhcp_failover_link_startup_timeout (void *);
2572 void dhcp_failover_listener_restart (void *);
2573 isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *,
2575 omapi_data_string_t *,
2577 isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *,
2578 const char *, int));
2579 isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *,
2582 isc_result_t dhcp_failover_state_lookup PROTO ((omapi_object_t **,
2585 isc_result_t dhcp_failover_state_create PROTO ((omapi_object_t **,
2587 isc_result_t dhcp_failover_state_remove PROTO ((omapi_object_t *,
2589 int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned);
2590 const char *dhcp_failover_reject_reason_print (int);
2591 const char *dhcp_failover_state_name_print (enum failover_state);
2592 const char *dhcp_failover_message_name (unsigned);
2593 const char *dhcp_failover_option_name (unsigned);
2594 failover_option_t *dhcp_failover_option_printf (unsigned, char *,
2598 __attribute__((__format__(__printf__,5,6)));
2599 failover_option_t *dhcp_failover_make_option (unsigned, char *,
2600 unsigned *, unsigned, ...);
2601 isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *,
2602 omapi_object_t *, int, ...);
2603 isc_result_t dhcp_failover_send_connect PROTO ((omapi_object_t *));
2604 isc_result_t dhcp_failover_send_connectack PROTO ((omapi_object_t *,
2605 dhcp_failover_state_t *,
2606 int, const char *));
2607 isc_result_t dhcp_failover_send_disconnect PROTO ((omapi_object_t *,
2608 int, const char *));
2609 isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *,
2611 isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *,
2612 failover_message_t *,
2614 isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *);
2615 isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int);
2616 isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *);
2617 isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *);
2618 isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *);
2619 isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *,
2620 failover_message_t *);
2621 isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *,
2622 failover_message_t *);
2623 isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *,
2625 isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *,
2626 failover_message_t *);
2627 isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *,
2628 failover_message_t *);
2629 isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
2630 failover_message_t *);
2631 void dhcp_failover_recover_done (void *);
2632 void failover_print PROTO ((char *, unsigned *, unsigned, const char *));
2633 void update_partner PROTO ((struct lease *));
2634 int load_balance_mine (struct packet *, dhcp_failover_state_t *);
2635 binding_state_t normal_binding_state_transition_check (struct lease *,
2636 dhcp_failover_state_t *,
2640 conflict_binding_state_transition_check (struct lease *,
2641 dhcp_failover_state_t *,
2642 binding_state_t, u_int32_t);
2643 int lease_mine_to_reallocate (struct lease *);
2645 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t,
2646 dhcp_type_failover_state)
2647 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener, dhcp_failover_listener_t,
2648 dhcp_type_failover_listener)
2649 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t,
2650 dhcp_type_failover_link)
2651 #endif /* FAILOVER_PROTOCOL */
2653 const char *binding_state_print (enum failover_state);