3 Definitions for dhcpd... */
6 * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1996-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 #include <sys/socket.h>
39 #include <arpa/inet.h>
43 #define fd_set cygwin_fd_set
44 #include <sys/types.h>
55 #include "dhcp_osdep.h"
57 #include "arpa/nameser.h"
58 #if defined (NSUPDATE)
59 # include "minires/minires.h"
63 typedef struct hash_table group_hash_t
;
64 typedef struct hash_table universe_hash_t
;
65 typedef struct hash_table option_hash_t
;
66 typedef struct hash_table dns_zone_hash_t
;
67 typedef struct hash_table lease_hash_t
;
68 typedef struct hash_table host_hash_t
;
69 typedef struct hash_table class_hash_t
;
72 #include "statement.h"
77 #include <isc-dhcp/result.h>
78 #include <omapip/omapip_p.h>
80 #if !defined (OPTION_HASH_SIZE)
81 # define OPTION_HASH_SIZE 17
82 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
83 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
86 #define compute_option_hash(x) \
87 (((x) & (OPTION_HASH_PTWO - 1)) + \
88 (((x) >> OPTION_HASH_EXP) & \
89 (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
91 enum dhcp_shutdown_state
{
93 shutdown_omapi_connections
,
94 shutdown_drop_omapi_connections
,
99 /* Client FQDN option, failover FQDN option, etc. */
106 #include "failover.h"
108 /* A parsing context. */
125 enum dhcp_token token
;
132 char comments
[4096];
135 int warnings_occurred
;
138 unsigned bufix
, buflen
;
142 /* Variable-length array of data. */
145 struct string_list
*next
;
149 /* A name server, from /etc/resolv.conf. */
151 struct name_server
*next
;
152 struct sockaddr_in addr
;
156 /* A domain search list element. */
157 struct domain_search_list
{
158 struct domain_search_list
*next
;
163 /* Option tag structures are used to build chains of option tags, for
164 when we're sure we're not going to have enough of them to justify
165 maintaining an array. */
168 struct option_tag
*next
;
172 /* An agent option structure. We need a special structure for the
173 Relay Agent Information option because if more than one appears in
174 a message, we have to keep them seperate. */
176 struct agent_options
{
177 struct agent_options
*next
;
179 struct option_tag
*first
;
182 struct option_cache
{
184 struct option_cache
*next
;
185 struct expression
*expression
;
186 struct option
*option
;
187 struct data_string data
;
190 struct option_state
{
195 VOIDPTR universes
[1];
198 /* A dhcp packet and the pointers to its option values. */
200 struct dhcp_packet
*raw
;
202 unsigned packet_length
;
206 struct iaddr client_addr
;
207 struct interface_info
*interface
; /* Interface on which packet
209 struct hardware
*haddr
; /* Physical link address
210 of local sender (maybe gateway). */
212 /* Information for relay agent options (see
213 draft-ietf-dhc-agent-options-xx.txt). */
214 u_int8_t
*circuit_id
; /* Circuit ID of client connection. */
216 u_int8_t
*remote_id
; /* Remote ID of client. */
219 int got_requested_address
; /* True if client sent the
220 dhcp-requested-address option. */
222 struct shared_network
*shared_network
;
223 struct option_state
*options
;
225 #if !defined (PACKET_MAX_CLASSES)
226 # define PACKET_MAX_CLASSES 5
229 struct class *classes
[PACKET_MAX_CLASSES
];
235 /* A network interface's MAC address. */
246 server_hibernate
= 3,
248 } control_object_state_t
;
251 OMAPI_OBJECT_PREAMBLE
;
252 control_object_state_t state
;
253 } dhcp_control_object_t
;
258 #define FTS_EXPIRED 3
259 #define FTS_RELEASED 4
260 #define FTS_ABANDONED 5
263 typedef u_int8_t binding_state_t
;
265 /* FTS_LAST is the highest value that is valid for a lease binding state. */
266 #define FTS_LAST FTS_BACKUP
268 /* A dhcp lease declaration structure. */
270 OMAPI_OBJECT_PREAMBLE
;
272 struct lease
*n_uid
, *n_hw
;
274 struct iaddr ip_addr
;
275 TIME starts
, ends
, timestamp
, sort_time
;
276 char *client_hostname
;
277 struct binding_scope
*scope
;
278 struct host_decl
*host
;
279 struct subnet
*subnet
;
281 struct class *billing_class
;
282 struct option_chain_head
*agent_options
;
284 struct executable_statement
*on_expiry
;
285 struct executable_statement
*on_commit
;
286 struct executable_statement
*on_release
;
289 unsigned short uid_len
;
290 unsigned short uid_max
;
291 unsigned char uid_buf
[7];
292 struct hardware hardware_addr
;
295 # define STATIC_LEASE 1
296 # define BOOTP_LEASE 2
297 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
298 # define MS_NULL_TERMINATION 8
299 # define ON_UPDATE_QUEUE 16
300 # define ON_ACK_QUEUE 32
301 # define UNICAST_BROADCAST_HACK 64
302 # define ON_DEFERRED_QUEUE 128
303 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
304 UNICAST_BROADCAST_HACK)
306 binding_state_t binding_state
;
307 binding_state_t next_binding_state
;
308 binding_state_t desired_binding_state
;
310 struct lease_state
*state
;
312 TIME tstp
; /* Time sent to partner. */
313 TIME tsfp
; /* Time sent from partner. */
314 TIME cltt
; /* Client last transaction time. */
315 struct lease
*next_pending
;
319 struct lease_state
*next
;
321 struct interface_info
*ip
;
323 struct packet
*packet
; /* The incoming packet. */
327 struct option_state
*options
;
328 struct data_string parameter_request_list
;
329 int max_message_size
;
330 u_int32_t expiry
, renewal
, rebind
;
331 struct data_string filename
, server_name
;
332 int got_requested_address
;
333 int got_server_identifier
;
334 struct shared_network
*shared_network
; /* Shared network of interface
335 on which request arrived. */
339 u_int16_t bootp_flags
;
340 struct in_addr ciaddr
;
341 struct in_addr siaddr
;
342 struct in_addr giaddr
;
350 #define SHARED_NET_DECL 2
351 #define SUBNET_DECL 3
356 /* Possible modes in which discover_interfaces can run. */
358 #define DISCOVER_RUNNING 0
359 #define DISCOVER_SERVER 1
360 #define DISCOVER_UNCONFIGURED 2
361 #define DISCOVER_RELAY 3
362 #define DISCOVER_REQUESTED 4
364 /* Server option names. */
366 #define SV_DEFAULT_LEASE_TIME 1
367 #define SV_MAX_LEASE_TIME 2
368 #define SV_MIN_LEASE_TIME 3
369 #define SV_BOOTP_LEASE_CUTOFF 4
370 #define SV_BOOTP_LEASE_LENGTH 5
371 #define SV_BOOT_UNKNOWN_CLIENTS 6
372 #define SV_DYNAMIC_BOOTP 7
373 #define SV_ALLOW_BOOTP 8
374 #define SV_ALLOW_BOOTING 9
375 #define SV_ONE_LEASE_PER_CLIENT 10
376 #define SV_GET_LEASE_HOSTNAMES 11
377 #define SV_USE_HOST_DECL_NAMES 12
378 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
379 #define SV_MIN_SECS 14
380 #define SV_FILENAME 15
381 #define SV_SERVER_NAME 16
382 #define SV_NEXT_SERVER 17
383 #define SV_AUTHORITATIVE 18
384 #define SV_VENDOR_OPTION_SPACE 19
385 #define SV_ALWAYS_REPLY_RFC1048 20
386 #define SV_SITE_OPTION_SPACE 21
387 #define SV_ALWAYS_BROADCAST 22
388 #define SV_DDNS_DOMAIN_NAME 23
389 #define SV_DDNS_HOST_NAME 24
390 #define SV_DDNS_REV_DOMAIN_NAME 25
391 #define SV_LEASE_FILE_NAME 26
392 #define SV_PID_FILE_NAME 27
393 #define SV_DUPLICATES 28
394 #define SV_DECLINES 29
395 #define SV_DDNS_UPDATES 30
396 #define SV_OMAPI_PORT 31
397 #define SV_LOCAL_PORT 32
398 #define SV_LIMITED_BROADCAST_ADDRESS 33
399 #define SV_REMOTE_PORT 34
400 #define SV_LOCAL_ADDRESS 35
401 #define SV_OMAPI_KEY 36
402 #define SV_STASH_AGENT_OPTIONS 37
403 #define SV_DDNS_TTL 38
404 #define SV_DDNS_UPDATE_STYLE 39
405 #define SV_CLIENT_UPDATES 40
406 #define SV_UPDATE_OPTIMIZATION 41
407 #define SV_PING_CHECKS 42
408 #define SV_UPDATE_STATIC_LEASES 43
409 #define SV_LOG_FACILITY 44
410 #define SV_DO_FORWARD_UPDATES 45
411 #define SV_PING_TIMEOUT 46
413 #if !defined (DEFAULT_PING_TIMEOUT)
414 # define DEFAULT_PING_TIMEOUT 1
417 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
418 # define DEFAULT_DEFAULT_LEASE_TIME 43200
421 #if !defined (DEFAULT_MIN_LEASE_TIME)
422 # define DEFAULT_MIN_LEASE_TIME 0
425 #if !defined (DEFAULT_MAX_LEASE_TIME)
426 # define DEFAULT_MAX_LEASE_TIME 86400
429 #if !defined (DEFAULT_DDNS_TTL)
430 # define DEFAULT_DDNS_TTL 3600
433 /* Client option names */
436 #define CL_SELECT_INTERVAL 2
437 #define CL_REBOOT_TIMEOUT 3
438 #define CL_RETRY_INTERVAL 4
439 #define CL_BACKOFF_CUTOFF 5
440 #define CL_INITIAL_INTERVAL 6
441 #define CL_BOOTP_POLICY 7
442 #define CL_SCRIPT_NAME 8
443 #define CL_REQUESTED_OPTIONS 9
444 #define CL_REQUESTED_LEASE_TIME 10
445 #define CL_SEND_OPTIONS 11
447 #define CL_REJECT_LIST 13
449 #ifndef CL_DEFAULT_TIMEOUT
450 # define CL_DEFAULT_TIMEOUT 60
453 #ifndef CL_DEFAULT_SELECT_INTERVAL
454 # define CL_DEFAULT_SELECT_INTERVAL 0
457 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
458 # define CL_DEFAULT_REBOOT_TIMEOUT 10
461 #ifndef CL_DEFAULT_RETRY_INTERVAL
462 # define CL_DEFAULT_RETRY_INTERVAL 300
465 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
466 # define CL_DEFAULT_BACKOFF_CUTOFF 120
469 #ifndef CL_DEFAULT_INITIAL_INTERVAL
470 # define CL_DEFAULT_INITIAL_INTERVAL 10
473 #ifndef CL_DEFAULT_BOOTP_POLICY
474 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
477 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
478 # define CL_DEFAULT_REQUESTED_OPTIONS \
480 DHO_BROADCAST_ADDRESS, \
484 DHO_DOMAIN_NAME_SERVERS, \
488 struct group_object
{
489 OMAPI_OBJECT_PREAMBLE
;
491 struct group_object
*n_dynamic
;
495 #define GROUP_OBJECT_DELETED 1
496 #define GROUP_OBJECT_DYNAMIC 2
497 #define GROUP_OBJECT_STATIC 4
500 /* Group of declarations that share common parameters. */
505 struct group_object
*object
;
506 struct subnet
*subnet
;
507 struct shared_network
*shared_network
;
509 struct executable_statement
*statements
;
512 /* A dhcp host declaration structure. */
514 OMAPI_OBJECT_PREAMBLE
;
515 struct host_decl
*n_ipaddr
;
516 struct host_decl
*n_dynamic
;
518 struct hardware interface
;
519 struct data_string client_identifier
;
520 struct option_cache
*fixed_addr
;
522 struct group_object
*named_group
;
523 struct data_string auth_key_id
;
525 #define HOST_DECL_DELETED 1
526 #define HOST_DECL_DYNAMIC 2
527 #define HOST_DECL_STATIC 4
533 permit_unknown_clients
,
534 permit_known_clients
,
535 permit_authenticated_clients
,
536 permit_unauthenticated_clients
,
538 permit_dynamic_bootp_clients
,
545 OMAPI_OBJECT_PREAMBLE
;
548 struct shared_network
*shared_network
;
549 struct permit
*permit_list
;
550 struct permit
*prohibit_list
;
551 struct lease
*active
;
552 struct lease
*expired
;
554 struct lease
*backup
;
555 struct lease
*abandoned
;
556 TIME next_event_time
;
561 #if defined (FAILOVER_PROTOCOL)
562 dhcp_failover_state_t
*failover_peer
;
566 struct shared_network
{
567 OMAPI_OBJECT_PREAMBLE
;
568 struct shared_network
*next
;
570 struct subnet
*subnets
;
571 struct interface_info
*interface
;
574 #if defined (FAILOVER_PROTOCOL)
575 dhcp_failover_state_t
*failover_peer
;
580 OMAPI_OBJECT_PREAMBLE
;
581 struct subnet
*next_subnet
;
582 struct subnet
*next_sibling
;
583 struct shared_network
*shared_network
;
584 struct interface_info
*interface
;
585 struct iaddr interface_address
;
587 struct iaddr netmask
;
593 struct collection
*next
;
596 struct class *classes
;
599 /* XXX classes must be reference-counted. */
601 OMAPI_OBJECT_PREAMBLE
;
602 struct class *nic
; /* Next in collection. */
603 struct class *superclass
; /* Set for spawned classes only. */
604 char *name
; /* Not set for spawned classes. */
606 /* A class may be configured to permit a limited number of leases. */
609 struct lease
**billed_leases
;
611 /* If nonzero, class has not been saved since it was last
615 /* Hash table containing subclasses. */
617 struct data_string hash_string
;
619 /* Expression used to match class. */
620 struct expression
*expr
;
622 /* Expression used to compute subclass identifiers for spawning
623 and to do subclass matching. */
624 struct expression
*submatch
;
629 /* Statements to execute if class matches. */
630 struct executable_statement
*statements
;
633 /* DHCP client lease structure... */
634 struct client_lease
{
635 struct client_lease
*next
; /* Next lease in list. */
636 TIME expiry
, renewal
, rebind
; /* Lease timeouts. */
637 struct iaddr address
; /* Address being leased. */
638 char *server_name
; /* Name of boot server. */
639 char *filename
; /* Name of file we're supposed to boot. */
640 struct string_list
*medium
; /* Network medium. */
641 struct auth_key
*key
; /* Key used in basic DHCP authentication. */
643 unsigned int is_static
: 1; /* If set, lease is from config file. */
644 unsigned int is_bootp
: 1; /* If set, lease was acquired with BOOTP. */
646 struct option_state
*options
; /* Options supplied with lease. */
649 /* Possible states in which the client can be. */
661 /* Authentication and BOOTP policy possibilities (not all values work
663 enum policy
{ P_IGNORE
, P_ACCEPT
, P_PREFER
, P_REQUIRE
, P_DONT
};
665 /* Configuration information from the config file... */
666 struct client_config
{
668 * When a message has been received, run these statements
671 struct group
*on_receipt
;
674 * When a message is sent, run these statements.
676 struct group
*on_transmission
;
678 u_int32_t
*required_options
; /* Options server must supply. */
679 u_int32_t
*requested_options
; /* Options to request from server. */
681 TIME timeout
; /* Start to panic if we don't get a
682 lease in this time period when
684 TIME initial_interval
; /* All exponential backoff intervals
686 TIME retry_interval
; /* If the protocol failed to produce
687 an address before the timeout,
688 try the protocol again after this
690 TIME select_interval
; /* Wait this many seconds from the
691 first DHCPDISCOVER before
692 picking an offered lease. */
693 TIME reboot_timeout
; /* When in INIT-REBOOT, wait this
694 long before giving up and going
696 TIME backoff_cutoff
; /* When doing exponential backoff,
697 never back off to an interval
698 longer than this amount. */
699 u_int32_t requested_lease
; /* Requested lease time, if user
700 doesn't configure one. */
701 struct string_list
*media
; /* Possible network media values. */
702 char *script_name
; /* Name of config script. */
703 char *vendor_space_name
; /* Name of config script. */
704 enum policy bootp_policy
;
705 /* Ignore, accept or prefer BOOTP
707 enum policy auth_policy
;
708 /* Require authentication, prefer
709 authentication, or don't try to
711 struct string_list
*medium
; /* Current network medium. */
713 struct iaddrlist
*reject_list
; /* Servers to reject. */
715 int omapi_port
; /* port on which to accept OMAPI
716 connections, or -1 for no
718 int do_forward_update
; /* If nonzero, and if we have the
719 information we need, update the
720 A record for the address we get. */
723 /* Per-interface state used in the dhcp client... */
724 struct client_state
{
725 struct client_state
*next
;
726 struct interface_info
*interface
;
729 struct client_lease
*active
; /* Currently active lease. */
730 struct client_lease
*new; /* New lease. */
731 struct client_lease
*offered_leases
; /* Leases offered to us. */
732 struct client_lease
*leases
; /* Leases we currently hold. */
733 struct client_lease
*alias
; /* Alias lease. */
735 enum dhcp_state state
; /* Current state for this interface. */
736 struct iaddr destination
; /* Where to send packet. */
737 u_int32_t xid
; /* Transaction ID. */
738 u_int16_t secs
; /* secs value from DHCPDISCOVER. */
739 TIME first_sending
; /* When was first copy sent? */
740 TIME interval
; /* What's the current resend interval? */
741 int dns_update_timeout
; /* Last timeout set for DNS update. */
742 struct string_list
*medium
; /* Last media type tried. */
743 struct dhcp_packet packet
; /* Outgoing DHCP packet. */
744 unsigned packet_length
; /* Actual length of generated packet. */
746 struct iaddr requested_address
; /* Address we would like to get. */
748 struct client_config
*config
; /* Client configuration. */
749 struct string_list
*env
; /* Client script environment. */
750 int envc
; /* Number of entries in environment. */
752 struct option_state
*sent_options
; /* Options we sent. */
755 /* Information about each network interface. */
757 struct interface_info
{
758 OMAPI_OBJECT_PREAMBLE
;
759 struct interface_info
*next
; /* Next interface in list... */
760 struct shared_network
*shared_network
;
761 /* Networks connected to this interface. */
762 struct hardware hw_address
; /* Its physical address. */
763 struct in_addr primary_address
; /* Primary interface address. */
765 u_int8_t
*circuit_id
; /* Circuit ID associated with this
767 unsigned circuit_id_len
; /* Length of Circuit ID, if there
769 u_int8_t
*remote_id
; /* Remote ID associated with this
770 interface (if any). */
771 unsigned remote_id_len
; /* Length of Remote ID. */
773 char name
[IFNAMSIZ
]; /* Its name... */
774 int index
; /* Its index. */
775 int rfdesc
; /* Its read file descriptor. */
776 int wfdesc
; /* Its write file descriptor, if
778 unsigned char *rbuf
; /* Read buffer, if required. */
779 unsigned int rbuf_max
; /* Size of read buffer. */
780 size_t rbuf_offset
; /* Current offset into buffer. */
781 size_t rbuf_len
; /* Length of data in buffer. */
783 struct ifreq
*ifp
; /* Pointer to ifreq struct. */
784 u_int32_t flags
; /* Control flags... */
785 #define INTERFACE_REQUESTED 1
786 #define INTERFACE_AUTOMATIC 2
787 #define INTERFACE_RUNNING 4
789 /* Only used by DHCP client code. */
790 struct client_state
*client
;
791 # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
793 struct hardware dlpi_broadcast_addr
;
794 # endif /* DLPI_SEND || DLPI_RECEIVE */
797 struct hardware_link
{
798 struct hardware_link
*next
;
799 char name
[IFNAMSIZ
];
800 struct hardware address
;
803 typedef void (*tvref_t
)(void *, void *, const char *, int);
804 typedef void (*tvunref_t
)(void *, const char *, int);
806 struct timeout
*next
;
808 void (*func
) PROTO ((void *));
815 struct protocol
*next
;
817 void (*handler
) PROTO ((struct protocol
*));
821 struct dns_query
; /* forward */
824 struct dns_wakeup
*next
; /* Next wakeup in chain. */
825 void (*func
) PROTO ((struct dns_query
*));
828 struct dns_question
{
829 u_int16_t type
; /* Type of query. */
830 u_int16_t
class; /* Class of query. */
831 unsigned char data
[1]; /* Query data. */
835 u_int16_t type
; /* Type of answer. */
836 u_int16_t
class; /* Class of answer. */
837 int count
; /* Number of answers. */
838 unsigned char *answers
[1]; /* Pointers to answers. */
842 struct dns_query
*next
; /* Next query in hash bucket. */
843 u_int32_t hash
; /* Hash bucket index. */
844 TIME expiry
; /* Query expiry time (zero if not yet
846 u_int16_t id
; /* Query ID (also hash table index) */
847 caddr_t waiters
; /* Pointer to list of things waiting
850 struct dns_question
*question
; /* Question, internal format. */
851 struct dns_answer
*answer
; /* Answer, internal format. */
853 unsigned char *query
; /* Query formatted for DNS server. */
854 unsigned len
; /* Length of entire query. */
855 int sent
; /* The query has been sent. */
856 struct dns_wakeup
*wakeups
; /* Wakeups to call if this query is
858 struct name_server
*next_server
; /* Next server to try. */
859 int backoff
; /* Current backoff, in seconds. */
866 struct option_cache
*primary
;
867 struct option_cache
*secondary
;
868 struct auth_key
*key
;
872 OMAPI_OBJECT_PREAMBLE
;
874 void (*icmp_handler
) PROTO ((struct iaddr
, u_int8_t
*, int));
879 /* Bitmask of dhcp option codes. */
880 typedef unsigned char option_mask
[16];
882 /* DHCP Option mask manipulation macros... */
883 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
884 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
885 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
886 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
887 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
889 /* An option occupies its length plus two header bytes (code and
890 length) for every 255 bytes that must be stored. */
891 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
893 /* Default path to dhcpd config file. */
895 #undef _PATH_DHCPD_CONF
896 #define _PATH_DHCPD_CONF "dhcpd.conf"
897 #undef _PATH_DHCPD_DB
898 #define _PATH_DHCPD_DB "dhcpd.leases"
899 #undef _PATH_DHCPD_PID
900 #define _PATH_DHCPD_PID "dhcpd.pid"
902 #ifndef _PATH_DHCPD_CONF
903 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
906 #ifndef _PATH_DHCPD_DB
907 #define _PATH_DHCPD_DB "/etc/dhcpd.leases"
910 #ifndef _PATH_DHCPD_PID
911 #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
915 #ifndef _PATH_DHCLIENT_CONF
916 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
919 #ifndef _PATH_DHCLIENT_SCRIPT
920 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
923 #ifndef _PATH_DHCLIENT_PID
924 #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
927 #ifndef _PATH_DHCLIENT_DB
928 #define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
931 #ifndef _PATH_RESOLV_CONF
932 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
935 #ifndef _PATH_DHCRELAY_PID
936 #define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid"
939 #ifndef DHCPD_LOG_FACILITY
940 #define DHCPD_LOG_FACILITY LOG_DAEMON
943 #define MAX_TIME 0x7fffffff
946 /* External definitions... */
948 HASH_FUNCTIONS_DECL (group
, const char *, struct group_object
, group_hash_t
)
949 HASH_FUNCTIONS_DECL (universe
, const char *, struct universe
, universe_hash_t
)
950 HASH_FUNCTIONS_DECL (option
, const char *, struct option
, option_hash_t
)
951 HASH_FUNCTIONS_DECL (dns_zone
, const char *, struct dns_zone
, dns_zone_hash_t
)
952 HASH_FUNCTIONS_DECL (lease
, const unsigned char *, struct lease
, lease_hash_t
)
953 HASH_FUNCTIONS_DECL (host
, const unsigned char *, struct host_decl
, host_hash_t
)
954 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t
)
958 extern struct option
*vendor_cfg_option
;
959 int parse_options
PROTO ((struct packet
*));
960 int parse_option_buffer
PROTO ((struct option_state
*, const unsigned char *,
961 unsigned, struct universe
*));
962 struct universe
*find_option_universe (struct option
*, const char *);
963 int parse_encapsulated_suboptions (struct option_state
*, struct option
*,
964 const unsigned char *, unsigned,
965 struct universe
*, const char *);
966 int cons_options
PROTO ((struct packet
*, struct dhcp_packet
*, struct lease
*,
967 struct client_state
*,
968 int, struct option_state
*, struct option_state
*,
969 struct binding_scope
**,
970 int, int, int, struct data_string
*, const char *));
971 int fqdn_universe_decode (struct option_state
*,
972 const unsigned char *, unsigned, struct universe
*);
973 int store_options
PROTO ((int *, unsigned char *, unsigned, struct packet
*,
974 struct lease
*, struct client_state
*,
975 struct option_state
*,
976 struct option_state
*, struct binding_scope
**,
977 unsigned *, int, unsigned, unsigned,
979 const char *pretty_print_option
PROTO ((struct option
*, const unsigned char *,
980 unsigned, int, int));
981 int get_option (struct data_string
*, struct universe
*,
982 struct packet
*, struct lease
*, struct client_state
*,
983 struct option_state
*, struct option_state
*,
984 struct option_state
*, struct binding_scope
**, unsigned,
986 void set_option (struct universe
*, struct option_state
*,
987 struct option_cache
*, enum statement_op
);
988 struct option_cache
*lookup_option
PROTO ((struct universe
*,
989 struct option_state
*, unsigned));
990 struct option_cache
*lookup_hashed_option
PROTO ((struct universe
*,
991 struct option_state
*,
993 int save_option_buffer (struct universe
*, struct option_state
*,
994 struct buffer
*, unsigned char *, unsigned,
995 struct option
*, int);
996 void save_option
PROTO ((struct universe
*,
997 struct option_state
*, struct option_cache
*));
998 void save_hashed_option
PROTO ((struct universe
*,
999 struct option_state
*, struct option_cache
*));
1000 void delete_option
PROTO ((struct universe
*, struct option_state
*, int));
1001 void delete_hashed_option
PROTO ((struct universe
*,
1002 struct option_state
*, int));
1003 int option_cache_dereference
PROTO ((struct option_cache
**,
1004 const char *, int));
1005 int hashed_option_state_dereference
PROTO ((struct universe
*,
1006 struct option_state
*,
1007 const char *, int));
1008 int store_option
PROTO ((struct data_string
*,
1009 struct universe
*, struct packet
*, struct lease
*,
1010 struct client_state
*,
1011 struct option_state
*, struct option_state
*,
1012 struct binding_scope
**, struct option_cache
*));
1013 int option_space_encapsulate
PROTO ((struct data_string
*,
1014 struct packet
*, struct lease
*,
1015 struct client_state
*,
1016 struct option_state
*,
1017 struct option_state
*,
1018 struct binding_scope
**,
1019 struct data_string
*));
1020 int hashed_option_space_encapsulate
PROTO ((struct data_string
*,
1021 struct packet
*, struct lease
*,
1022 struct client_state
*,
1023 struct option_state
*,
1024 struct option_state
*,
1025 struct binding_scope
**,
1026 struct universe
*));
1027 int nwip_option_space_encapsulate
PROTO ((struct data_string
*,
1028 struct packet
*, struct lease
*,
1029 struct client_state
*,
1030 struct option_state
*,
1031 struct option_state
*,
1032 struct binding_scope
**,
1033 struct universe
*));
1034 int fqdn_option_space_encapsulate (struct data_string
*,
1035 struct packet
*, struct lease
*,
1036 struct client_state
*,
1037 struct option_state
*,
1038 struct option_state
*,
1039 struct binding_scope
**,
1041 void suboption_foreach (struct packet
*, struct lease
*, struct client_state
*,
1042 struct option_state
*, struct option_state
*,
1043 struct binding_scope
**, struct universe
*, void *,
1044 void (*) (struct option_cache
*, struct packet
*,
1045 struct lease
*, struct client_state
*,
1046 struct option_state
*, struct option_state
*,
1047 struct binding_scope
**,
1048 struct universe
*, void *),
1049 struct option_cache
*, const char *);
1050 void option_space_foreach (struct packet
*, struct lease
*,
1051 struct client_state
*,
1052 struct option_state
*,
1053 struct option_state
*,
1054 struct binding_scope
**,
1055 struct universe
*, void *,
1056 void (*) (struct option_cache
*,
1058 struct lease
*, struct client_state
*,
1059 struct option_state
*,
1060 struct option_state
*,
1061 struct binding_scope
**,
1062 struct universe
*, void *));
1063 void hashed_option_space_foreach (struct packet
*, struct lease
*,
1064 struct client_state
*,
1065 struct option_state
*,
1066 struct option_state
*,
1067 struct binding_scope
**,
1068 struct universe
*, void *,
1069 void (*) (struct option_cache
*,
1072 struct client_state
*,
1073 struct option_state
*,
1074 struct option_state
*,
1075 struct binding_scope
**,
1076 struct universe
*, void *));
1077 int linked_option_get
PROTO ((struct data_string
*, struct universe
*,
1078 struct packet
*, struct lease
*,
1079 struct client_state
*,
1080 struct option_state
*, struct option_state
*,
1081 struct option_state
*, struct binding_scope
**,
1083 int linked_option_state_dereference
PROTO ((struct universe
*,
1084 struct option_state
*,
1085 const char *, int));
1086 void save_linked_option (struct universe
*, struct option_state
*,
1087 struct option_cache
*);
1088 void linked_option_space_foreach (struct packet
*, struct lease
*,
1089 struct client_state
*,
1090 struct option_state
*,
1091 struct option_state
*,
1092 struct binding_scope
**,
1093 struct universe
*, void *,
1094 void (*) (struct option_cache
*,
1097 struct client_state
*,
1098 struct option_state
*,
1099 struct option_state
*,
1100 struct binding_scope
**,
1101 struct universe
*, void *));
1102 int linked_option_space_encapsulate (struct data_string
*, struct packet
*,
1103 struct lease
*, struct client_state
*,
1104 struct option_state
*,
1105 struct option_state
*,
1106 struct binding_scope
**,
1108 void delete_linked_option (struct universe
*, struct option_state
*, int);
1109 struct option_cache
*lookup_linked_option (struct universe
*,
1110 struct option_state
*, unsigned);
1111 void do_packet
PROTO ((struct interface_info
*,
1112 struct dhcp_packet
*, unsigned,
1113 unsigned int, struct iaddr
, struct hardware
*));
1116 extern TIME cur_time
;
1118 int ddns_update_style
;
1120 extern const char *path_dhcpd_conf
;
1121 extern const char *path_dhcpd_db
;
1122 extern const char *path_dhcpd_pid
;
1124 extern int dhcp_max_agent_option_packet_length
;
1126 int main
PROTO ((int, char **, char **));
1127 void postconf_initialization (int);
1128 void postdb_startup (void);
1129 void cleanup
PROTO ((void));
1130 void lease_pinged
PROTO ((struct iaddr
, u_int8_t
*, int));
1131 void lease_ping_timeout
PROTO ((void *));
1132 int dhcpd_interface_setup_hook (struct interface_info
*ip
, struct iaddr
*ia
);
1133 enum dhcp_shutdown_state shutdown_state
;
1134 isc_result_t
dhcp_io_shutdown (omapi_object_t
*, void *);
1135 isc_result_t
dhcp_set_control_state (control_object_state_t oldstate
,
1136 control_object_state_t newstate
);
1139 isc_result_t new_parse
PROTO ((struct parse
**, int,
1140 char *, unsigned, const char *, int));
1141 isc_result_t end_parse
PROTO ((struct parse
**));
1142 enum dhcp_token next_token
PROTO ((const char **, unsigned *, struct parse
*));
1143 enum dhcp_token peek_token
PROTO ((const char **, unsigned *, struct parse
*));
1146 void parse_trace_setup (void);
1147 isc_result_t readconf
PROTO ((void));
1148 isc_result_t
read_conf_file (const char *, struct group
*, int, int);
1149 #if defined (TRACING)
1150 void trace_conf_input (trace_type_t
*, unsigned, char *);
1151 void trace_conf_stop (trace_type_t
*ttype
);
1153 isc_result_t
conf_file_subparse (struct parse
*, struct group
*, int);
1154 isc_result_t
lease_file_subparse (struct parse
*);
1155 int parse_statement
PROTO ((struct parse
*,
1156 struct group
*, int, struct host_decl
*, int));
1157 #if defined (FAILOVER_PROTOCOL)
1158 void parse_failover_peer
PROTO ((struct parse
*, struct group
*, int));
1159 void parse_failover_state_declaration (struct parse
*,
1160 dhcp_failover_state_t
*);
1161 void parse_failover_state
PROTO ((struct parse
*,
1162 enum failover_state
*, TIME
*));
1164 int permit_list_match (struct permit
*, struct permit
*);
1165 void parse_pool_statement
PROTO ((struct parse
*, struct group
*, int));
1166 int parse_boolean
PROTO ((struct parse
*));
1167 int parse_lbrace
PROTO ((struct parse
*));
1168 void parse_host_declaration
PROTO ((struct parse
*, struct group
*));
1169 int parse_class_declaration
PROTO ((struct class **, struct parse
*,
1170 struct group
*, int));
1171 void parse_shared_net_declaration
PROTO ((struct parse
*, struct group
*));
1172 void parse_subnet_declaration
PROTO ((struct parse
*,
1173 struct shared_network
*));
1174 void parse_group_declaration
PROTO ((struct parse
*, struct group
*));
1175 int parse_fixed_addr_param
PROTO ((struct option_cache
**, struct parse
*));
1176 TIME parse_timestamp
PROTO ((struct parse
*));
1177 int parse_lease_declaration
PROTO ((struct lease
**, struct parse
*));
1178 void parse_address_range
PROTO ((struct parse
*, struct group
*, int,
1179 struct pool
*, struct lease
**));
1182 int ddns_updates
PROTO ((struct packet
*, struct lease
*, struct lease
*,
1183 struct lease_state
*));
1184 int ddns_removals
PROTO ((struct lease
*));
1187 void add_enumeration (struct enumeration
*);
1188 struct enumeration
*find_enumeration (const char *, int);
1189 struct enumeration_value
*find_enumeration_value (const char *, int,
1191 void skip_to_semi
PROTO ((struct parse
*));
1192 void skip_to_rbrace
PROTO ((struct parse
*, int));
1193 int parse_semi
PROTO ((struct parse
*));
1194 int parse_string
PROTO ((struct parse
*, char **, unsigned *));
1195 char *parse_host_name
PROTO ((struct parse
*));
1196 int parse_ip_addr_or_hostname
PROTO ((struct expression
**,
1197 struct parse
*, int));
1198 void parse_hardware_param
PROTO ((struct parse
*, struct hardware
*));
1199 void parse_lease_time
PROTO ((struct parse
*, TIME
*));
1200 unsigned char *parse_numeric_aggregate
PROTO ((struct parse
*,
1201 unsigned char *, unsigned *,
1202 int, int, unsigned));
1203 void convert_num
PROTO ((struct parse
*, unsigned char *, const char *,
1205 TIME parse_date
PROTO ((struct parse
*));
1206 struct option
*parse_option_name
PROTO ((struct parse
*, int, int *));
1207 void parse_option_space_decl
PROTO ((struct parse
*));
1208 int parse_option_code_definition
PROTO ((struct parse
*, struct option
*));
1209 int parse_base64 (struct data_string
*, struct parse
*);
1210 int parse_cshl
PROTO ((struct data_string
*, struct parse
*));
1211 int parse_executable_statement
PROTO ((struct executable_statement
**,
1212 struct parse
*, int *,
1213 enum expression_context
));
1214 int parse_executable_statements
PROTO ((struct executable_statement
**,
1215 struct parse
*, int *,
1216 enum expression_context
));
1217 int parse_zone (struct dns_zone
*, struct parse
*);
1218 int parse_key (struct parse
*);
1219 int parse_on_statement
PROTO ((struct executable_statement
**,
1220 struct parse
*, int *));
1221 int parse_switch_statement
PROTO ((struct executable_statement
**,
1222 struct parse
*, int *));
1223 int parse_case_statement
PROTO ((struct executable_statement
**,
1224 struct parse
*, int *,
1225 enum expression_context
));
1226 int parse_if_statement
PROTO ((struct executable_statement
**,
1227 struct parse
*, int *));
1228 int parse_boolean_expression
PROTO ((struct expression
**,
1229 struct parse
*, int *));
1230 int parse_data_expression
PROTO ((struct expression
**,
1231 struct parse
*, int *));
1232 int parse_numeric_expression
PROTO ((struct expression
**,
1233 struct parse
*, int *));
1234 int parse_dns_expression
PROTO ((struct expression
**, struct parse
*, int *));
1235 int parse_non_binary
PROTO ((struct expression
**, struct parse
*, int *,
1236 enum expression_context
));
1237 int parse_expression
PROTO ((struct expression
**, struct parse
*, int *,
1238 enum expression_context
,
1239 struct expression
**, enum expr_op
));
1240 int parse_option_statement
PROTO ((struct executable_statement
**,
1241 struct parse
*, int,
1242 struct option
*, enum statement_op
));
1243 int parse_option_token
PROTO ((struct expression
**, struct parse
*,
1244 const char **, struct expression
*, int, int));
1245 int parse_allow_deny
PROTO ((struct option_cache
**, struct parse
*, int));
1246 int parse_auth_key
PROTO ((struct data_string
*, struct parse
*));
1247 int parse_warn (struct parse
*, const char *, ...)
1248 __attribute__((__format__(__printf__
,2,3)));
1251 #if defined (NSUPDATE)
1252 extern struct __res_state resolver_state
;
1253 extern int resolver_inited
;
1256 extern struct binding_scope
*global_scope
;
1257 pair cons
PROTO ((caddr_t
, pair
));
1258 int make_const_option_cache
PROTO ((struct option_cache
**, struct buffer
**,
1259 u_int8_t
*, unsigned, struct option
*,
1260 const char *, int));
1261 int make_host_lookup
PROTO ((struct expression
**, const char *));
1262 int enter_dns_host
PROTO ((struct dns_host_entry
**, const char *));
1263 int make_const_data (struct expression
**,
1264 const unsigned char *, unsigned, int, int,
1266 int make_const_int
PROTO ((struct expression
**, unsigned long));
1267 int make_concat
PROTO ((struct expression
**,
1268 struct expression
*, struct expression
*));
1269 int make_encapsulation
PROTO ((struct expression
**, struct data_string
*));
1270 int make_substring
PROTO ((struct expression
**, struct expression
*,
1271 struct expression
*, struct expression
*));
1272 int make_limit
PROTO ((struct expression
**, struct expression
*, int));
1273 int make_let
PROTO ((struct executable_statement
**, const char *));
1274 int option_cache
PROTO ((struct option_cache
**, struct data_string
*,
1275 struct expression
*, struct option
*,
1276 const char *, int));
1277 int evaluate_expression (struct binding_value
**, struct packet
*,
1278 struct lease
*, struct client_state
*,
1279 struct option_state
*, struct option_state
*,
1280 struct binding_scope
**, struct expression
*,
1282 int binding_value_dereference (struct binding_value
**, const char *, int);
1283 #if defined (NSUPDATE)
1284 int evaluate_dns_expression
PROTO ((ns_updrec
**, struct packet
*,
1286 struct client_state
*,
1287 struct option_state
*,
1288 struct option_state
*,
1289 struct binding_scope
**,
1290 struct expression
*));
1292 int evaluate_boolean_expression
PROTO ((int *,
1293 struct packet
*, struct lease
*,
1294 struct client_state
*,
1295 struct option_state
*,
1296 struct option_state
*,
1297 struct binding_scope
**,
1298 struct expression
*));
1299 int evaluate_data_expression
PROTO ((struct data_string
*,
1300 struct packet
*, struct lease
*,
1301 struct client_state
*,
1302 struct option_state
*,
1303 struct option_state
*,
1304 struct binding_scope
**,
1305 struct expression
*, const char *, int));
1306 int evaluate_numeric_expression (unsigned long *, struct packet
*,
1307 struct lease
*, struct client_state
*,
1308 struct option_state
*, struct option_state
*,
1309 struct binding_scope
**,
1310 struct expression
*);
1311 int evaluate_option_cache
PROTO ((struct data_string
*,
1312 struct packet
*, struct lease
*,
1313 struct client_state
*,
1314 struct option_state
*, struct option_state
*,
1315 struct binding_scope
**,
1316 struct option_cache
*,
1317 const char *, int));
1318 int evaluate_boolean_option_cache
PROTO ((int *,
1319 struct packet
*, struct lease
*,
1320 struct client_state
*,
1321 struct option_state
*,
1322 struct option_state
*,
1323 struct binding_scope
**,
1324 struct option_cache
*,
1325 const char *, int));
1326 int evaluate_boolean_expression_result
PROTO ((int *,
1327 struct packet
*, struct lease
*,
1328 struct client_state
*,
1329 struct option_state
*,
1330 struct option_state
*,
1331 struct binding_scope
**,
1332 struct expression
*));
1333 void expression_dereference
PROTO ((struct expression
**, const char *, int));
1334 int is_dns_expression
PROTO ((struct expression
*));
1335 int is_boolean_expression
PROTO ((struct expression
*));
1336 int is_data_expression
PROTO ((struct expression
*));
1337 int is_numeric_expression
PROTO ((struct expression
*));
1338 int is_compound_expression
PROTO ((struct expression
*));
1339 int op_precedence
PROTO ((enum expr_op
, enum expr_op
));
1340 enum expression_context
expression_context (struct expression
*);
1341 enum expression_context op_context
PROTO ((enum expr_op
));
1342 int write_expression
PROTO ((FILE *, struct expression
*, int, int, int));
1343 struct binding
*find_binding
PROTO ((struct binding_scope
*, const char *));
1344 int free_bindings
PROTO ((struct binding_scope
*, const char *, int));
1345 int binding_scope_dereference
PROTO ((struct binding_scope
**,
1346 const char *, int));
1347 int fundef_dereference (struct fundef
**, const char *, int);
1348 int data_subexpression_length (int *, struct expression
*);
1349 int expr_valid_for_context (struct expression
*, enum expression_context
);
1350 struct binding
*create_binding (struct binding_scope
**, const char *);
1351 int bind_ds_value (struct binding_scope
**,
1352 const char *, struct data_string
*);
1353 int find_bound_string (struct data_string
*,
1354 struct binding_scope
*, const char *);
1355 int unset (struct binding_scope
*, const char *);
1358 extern int outstanding_pings
;
1360 void dhcp
PROTO ((struct packet
*));
1361 void dhcpdiscover
PROTO ((struct packet
*, int));
1362 void dhcprequest
PROTO ((struct packet
*, int, struct lease
*));
1363 void dhcprelease
PROTO ((struct packet
*, int));
1364 void dhcpdecline
PROTO ((struct packet
*, int));
1365 void dhcpinform
PROTO ((struct packet
*, int));
1366 void nak_lease
PROTO ((struct packet
*, struct iaddr
*cip
));
1367 void ack_lease
PROTO ((struct packet
*, struct lease
*,
1368 unsigned int, TIME
, char *, int, struct host_decl
*));
1369 void dhcp_reply
PROTO ((struct lease
*));
1370 int find_lease
PROTO ((struct lease
**, struct packet
*,
1371 struct shared_network
*, int *, int *, struct lease
*,
1372 const char *, int));
1373 int mockup_lease
PROTO ((struct lease
**, struct packet
*,
1374 struct shared_network
*,
1375 struct host_decl
*));
1376 void static_lease_dereference
PROTO ((struct lease
*, const char *, int));
1378 int allocate_lease
PROTO ((struct lease
**, struct packet
*,
1379 struct pool
*, int *));
1380 int permitted
PROTO ((struct packet
*, struct permit
*));
1381 int locate_network
PROTO ((struct packet
*));
1382 int parse_agent_information_option
PROTO ((struct packet
*, int, u_int8_t
*));
1383 unsigned cons_agent_information_options
PROTO ((struct option_state
*,
1384 struct dhcp_packet
*,
1385 unsigned, unsigned));
1388 void bootp
PROTO ((struct packet
*));
1391 int (*group_write_hook
) (struct group_object
*);
1392 extern struct group
*root_group
;
1393 extern group_hash_t
*group_name_hash
;
1394 isc_result_t
delete_group (struct group_object
*, int);
1395 isc_result_t
supersede_group (struct group_object
*, int);
1396 int clone_group (struct group
**, struct group
*, const char *, int);
1397 int write_group
PROTO ((struct group_object
*));
1400 void relinquish_lease_hunks (void);
1401 struct lease
*new_leases
PROTO ((unsigned, const char *, int));
1402 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1403 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1404 void relinquish_free_lease_states (void);
1406 OMAPI_OBJECT_ALLOC_DECL (lease
, struct lease
, dhcp_type_lease
)
1407 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class
)
1408 OMAPI_OBJECT_ALLOC_DECL (pool
, struct pool
, dhcp_type_pool
)
1409 OMAPI_OBJECT_ALLOC_DECL (host
, struct host_decl
, dhcp_type_host
)
1412 OMAPI_OBJECT_ALLOC_DECL (subnet
, struct subnet
, dhcp_type_subnet
)
1413 OMAPI_OBJECT_ALLOC_DECL (shared_network
, struct shared_network
,
1414 dhcp_type_shared_network
)
1415 OMAPI_OBJECT_ALLOC_DECL (group_object
, struct group_object
, dhcp_type_group
)
1416 OMAPI_OBJECT_ALLOC_DECL (dhcp_control
,
1417 dhcp_control_object_t
, dhcp_type_control
)
1419 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1420 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1421 void relinquish_free_pairs (void);
1422 void relinquish_free_expressions (void);
1423 void relinquish_free_binding_values (void);
1424 void relinquish_free_option_caches (void);
1425 void relinquish_free_packets (void);
1428 int option_chain_head_allocate (struct option_chain_head
**,
1430 int option_chain_head_reference (struct option_chain_head
**,
1431 struct option_chain_head
*,
1433 int option_chain_head_dereference (struct option_chain_head
**,
1435 int group_allocate (struct group
**, const char *, int);
1436 int group_reference (struct group
**, struct group
*, const char *, int);
1437 int group_dereference (struct group
**, const char *, int);
1438 struct dhcp_packet
*new_dhcp_packet
PROTO ((const char *, int));
1439 struct protocol
*new_protocol
PROTO ((const char *, int));
1440 struct lease_state
*new_lease_state
PROTO ((const char *, int));
1441 struct domain_search_list
*new_domain_search_list
PROTO ((const char *, int));
1442 struct name_server
*new_name_server
PROTO ((const char *, int));
1443 void free_name_server
PROTO ((struct name_server
*, const char *, int));
1444 struct option
*new_option
PROTO ((const char *, int));
1445 int group_allocate (struct group
**, const char *, int);
1446 int group_reference (struct group
**, struct group
*, const char *, int);
1447 int group_dereference (struct group
**, const char *, int);
1448 void free_option
PROTO ((struct option
*, const char *, int));
1449 struct universe
*new_universe
PROTO ((const char *, int));
1450 void free_universe
PROTO ((struct universe
*, const char *, int));
1451 void free_domain_search_list
PROTO ((struct domain_search_list
*,
1452 const char *, int));
1453 void free_lease_state
PROTO ((struct lease_state
*, const char *, int));
1454 void free_protocol
PROTO ((struct protocol
*, const char *, int));
1455 void free_dhcp_packet
PROTO ((struct dhcp_packet
*, const char *, int));
1456 struct client_lease
*new_client_lease
PROTO ((const char *, int));
1457 void free_client_lease
PROTO ((struct client_lease
*, const char *, int));
1458 struct permit
*new_permit
PROTO ((const char *, int));
1459 void free_permit
PROTO ((struct permit
*, const char *, int));
1460 pair new_pair
PROTO ((const char *, int));
1461 void free_pair
PROTO ((pair
, const char *, int));
1462 int expression_allocate
PROTO ((struct expression
**, const char *, int));
1463 int expression_reference
PROTO ((struct expression
**,
1464 struct expression
*, const char *, int));
1465 void free_expression
PROTO ((struct expression
*, const char *, int));
1466 int binding_value_allocate
PROTO ((struct binding_value
**,
1467 const char *, int));
1468 int binding_value_reference
PROTO ((struct binding_value
**,
1469 struct binding_value
*,
1470 const char *, int));
1471 void free_binding_value
PROTO ((struct binding_value
*, const char *, int));
1472 int fundef_allocate
PROTO ((struct fundef
**, const char *, int));
1473 int fundef_reference
PROTO ((struct fundef
**,
1474 struct fundef
*, const char *, int));
1475 int option_cache_allocate
PROTO ((struct option_cache
**, const char *, int));
1476 int option_cache_reference
PROTO ((struct option_cache
**,
1477 struct option_cache
*, const char *, int));
1478 int buffer_allocate
PROTO ((struct buffer
**, unsigned, const char *, int));
1479 int buffer_reference
PROTO ((struct buffer
**, struct buffer
*,
1480 const char *, int));
1481 int buffer_dereference
PROTO ((struct buffer
**, const char *, int));
1482 int dns_host_entry_allocate
PROTO ((struct dns_host_entry
**,
1483 const char *, const char *, int));
1484 int dns_host_entry_reference
PROTO ((struct dns_host_entry
**,
1485 struct dns_host_entry
*,
1486 const char *, int));
1487 int dns_host_entry_dereference
PROTO ((struct dns_host_entry
**,
1488 const char *, int));
1489 int option_state_allocate
PROTO ((struct option_state
**, const char *, int));
1490 int option_state_reference
PROTO ((struct option_state
**,
1491 struct option_state
*, const char *, int));
1492 int option_state_dereference
PROTO ((struct option_state
**,
1493 const char *, int));
1494 void data_string_copy
PROTO ((struct data_string
*,
1495 struct data_string
*, const char *, int));
1496 void data_string_forget
PROTO ((struct data_string
*, const char *, int));
1497 void data_string_truncate
PROTO ((struct data_string
*, int));
1498 int executable_statement_allocate
PROTO ((struct executable_statement
**,
1499 const char *, int));
1500 int executable_statement_reference
PROTO ((struct executable_statement
**,
1501 struct executable_statement
*,
1502 const char *, int));
1503 int packet_allocate
PROTO ((struct packet
**, const char *, int));
1504 int packet_reference
PROTO ((struct packet
**,
1505 struct packet
*, const char *, int));
1506 int packet_dereference
PROTO ((struct packet
**, const char *, int));
1507 int binding_scope_allocate
PROTO ((struct binding_scope
**,
1508 const char *, int));
1509 int binding_scope_reference
PROTO ((struct binding_scope
**,
1510 struct binding_scope
*,
1511 const char *, int));
1512 int dns_zone_allocate
PROTO ((struct dns_zone
**, const char *, int));
1513 int dns_zone_reference
PROTO ((struct dns_zone
**,
1514 struct dns_zone
*, const char *, int));
1517 char *quotify_string (const char *, const char *, int);
1518 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1519 char *print_base64 (const unsigned char *, unsigned, const char *, int);
1520 char *print_hw_addr
PROTO ((int, int, unsigned char *));
1521 void print_lease
PROTO ((struct lease
*));
1522 void dump_raw
PROTO ((const unsigned char *, unsigned));
1523 void dump_packet_option (struct option_cache
*, struct packet
*,
1524 struct lease
*, struct client_state
*,
1525 struct option_state
*, struct option_state
*,
1526 struct binding_scope
**, struct universe
*, void *);
1527 void dump_packet
PROTO ((struct packet
*));
1528 void hash_dump
PROTO ((struct hash_table
*));
1529 char *print_hex_1
PROTO ((unsigned, const u_int8_t
*, unsigned));
1530 char *print_hex_2
PROTO ((unsigned, const u_int8_t
*, unsigned));
1531 char *print_hex_3
PROTO ((unsigned, const u_int8_t
*, unsigned));
1532 char *print_dotted_quads
PROTO ((unsigned, const u_int8_t
*));
1533 char *print_dec_1
PROTO ((unsigned long));
1534 char *print_dec_2
PROTO ((unsigned long));
1535 void print_expression
PROTO ((const char *, struct expression
*));
1536 int token_print_indent_concat (FILE *, int, int,
1537 const char *, const char *, ...);
1538 int token_indent_data_string (FILE *, int, int, const char *, const char *,
1539 struct data_string
*);
1540 int token_print_indent (FILE *, int, int,
1541 const char *, const char *, const char *);
1542 void indent_spaces (FILE *, int);
1543 #if defined (NSUPDATE)
1544 void print_dns_status (int, ns_updque
*);
1548 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
1549 || defined (USE_SOCKET_FALLBACK)
1550 int if_register_socket
PROTO ((struct interface_info
*));
1553 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
1554 void if_reinitialize_fallback
PROTO ((struct interface_info
*));
1555 void if_register_fallback
PROTO ((struct interface_info
*));
1556 ssize_t send_fallback
PROTO ((struct interface_info
*,
1557 struct packet
*, struct dhcp_packet
*, size_t,
1559 struct sockaddr_in
*, struct hardware
*));
1562 #ifdef USE_SOCKET_SEND
1563 void if_reinitialize_send
PROTO ((struct interface_info
*));
1564 void if_register_send
PROTO ((struct interface_info
*));
1565 void if_deregister_send
PROTO ((struct interface_info
*));
1566 ssize_t send_packet
PROTO ((struct interface_info
*,
1567 struct packet
*, struct dhcp_packet
*, size_t,
1569 struct sockaddr_in
*, struct hardware
*));
1571 #ifdef USE_SOCKET_RECEIVE
1572 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1573 void if_register_receive
PROTO ((struct interface_info
*));
1574 void if_deregister_receive
PROTO ((struct interface_info
*));
1575 ssize_t receive_packet
PROTO ((struct interface_info
*,
1576 unsigned char *, size_t,
1577 struct sockaddr_in
*, struct hardware
*));
1580 #if defined (USE_SOCKET_FALLBACK)
1581 isc_result_t fallback_discard
PROTO ((omapi_object_t
*));
1584 #if defined (USE_SOCKET_SEND)
1585 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1586 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1587 int supports_multiple_interfaces (struct interface_info
*);
1588 void maybe_setup_fallback
PROTO ((void));
1592 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
1593 int if_register_bpf
PROTO ( (struct interface_info
*));
1596 void if_reinitialize_send
PROTO ((struct interface_info
*));
1597 void if_register_send
PROTO ((struct interface_info
*));
1598 void if_deregister_send
PROTO ((struct interface_info
*));
1599 ssize_t send_packet
PROTO ((struct interface_info
*,
1600 struct packet
*, struct dhcp_packet
*, size_t,
1602 struct sockaddr_in
*, struct hardware
*));
1604 #ifdef USE_BPF_RECEIVE
1605 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1606 void if_register_receive
PROTO ((struct interface_info
*));
1607 void if_deregister_receive
PROTO ((struct interface_info
*));
1608 ssize_t receive_packet
PROTO ((struct interface_info
*,
1609 unsigned char *, size_t,
1610 struct sockaddr_in
*, struct hardware
*));
1612 #if defined (USE_BPF_SEND)
1613 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1614 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1615 int supports_multiple_interfaces (struct interface_info
*);
1616 void maybe_setup_fallback
PROTO ((void));
1620 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
1621 int if_register_lpf
PROTO ( (struct interface_info
*));
1624 void if_reinitialize_send
PROTO ((struct interface_info
*));
1625 void if_register_send
PROTO ((struct interface_info
*));
1626 void if_deregister_send
PROTO ((struct interface_info
*));
1627 ssize_t send_packet
PROTO ((struct interface_info
*,
1628 struct packet
*, struct dhcp_packet
*, size_t,
1630 struct sockaddr_in
*, struct hardware
*));
1632 #ifdef USE_LPF_RECEIVE
1633 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1634 void if_register_receive
PROTO ((struct interface_info
*));
1635 void if_deregister_receive
PROTO ((struct interface_info
*));
1636 ssize_t receive_packet
PROTO ((struct interface_info
*,
1637 unsigned char *, size_t,
1638 struct sockaddr_in
*, struct hardware
*));
1640 #if defined (USE_LPF_SEND)
1641 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1642 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1643 int supports_multiple_interfaces (struct interface_info
*);
1644 void maybe_setup_fallback
PROTO ((void));
1648 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
1649 int if_register_nit
PROTO ( (struct interface_info
*));
1653 void if_reinitialize_send
PROTO ((struct interface_info
*));
1654 void if_register_send
PROTO ((struct interface_info
*));
1655 void if_deregister_send
PROTO ((struct interface_info
*));
1656 ssize_t send_packet
PROTO ((struct interface_info
*,
1657 struct packet
*, struct dhcp_packet
*, size_t,
1659 struct sockaddr_in
*, struct hardware
*));
1661 #ifdef USE_NIT_RECEIVE
1662 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1663 void if_register_receive
PROTO ((struct interface_info
*));
1664 void if_deregister_receive
PROTO ((struct interface_info
*));
1665 ssize_t receive_packet
PROTO ((struct interface_info
*,
1666 unsigned char *, size_t,
1667 struct sockaddr_in
*, struct hardware
*));
1669 #if defined (USE_NIT_SEND)
1670 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1671 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1672 int supports_multiple_interfaces (struct interface_info
*);
1673 void maybe_setup_fallback
PROTO ((void));
1677 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
1678 int if_register_dlpi
PROTO ( (struct interface_info
*));
1681 #ifdef USE_DLPI_SEND
1682 void if_reinitialize_send
PROTO ((struct interface_info
*));
1683 void if_register_send
PROTO ((struct interface_info
*));
1684 void if_deregister_send
PROTO ((struct interface_info
*));
1685 ssize_t send_packet
PROTO ((struct interface_info
*,
1686 struct packet
*, struct dhcp_packet
*, size_t,
1688 struct sockaddr_in
*, struct hardware
*));
1690 #ifdef USE_DLPI_RECEIVE
1691 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1692 void if_register_receive
PROTO ((struct interface_info
*));
1693 void if_deregister_receive
PROTO ((struct interface_info
*));
1694 ssize_t receive_packet
PROTO ((struct interface_info
*,
1695 unsigned char *, size_t,
1696 struct sockaddr_in
*, struct hardware
*));
1702 void if_reinitialize_send
PROTO ((struct interface_info
*));
1703 void if_register_send
PROTO ((struct interface_info
*));
1704 void if_deregister_send
PROTO ((struct interface_info
*));
1705 ssize_t send_packet
PROTO ((struct interface_info
*,
1706 struct packet
*, struct dhcp_packet
*, size_t,
1708 struct sockaddr_in
*, struct hardware
*));
1709 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1710 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1711 int supports_multiple_interfaces (struct interface_info
*);
1712 void maybe_setup_fallback
PROTO ((void));
1716 extern struct interface_info
*interfaces
,
1717 *dummy_interfaces
, *fallback_interface
;
1718 extern struct protocol
*protocols
;
1719 extern int quiet_interface_discovery
;
1720 isc_result_t
interface_setup (void);
1721 void interface_trace_setup (void);
1723 extern struct in_addr limited_broadcast
;
1724 extern struct in_addr local_address
;
1726 extern u_int16_t local_port
;
1727 extern u_int16_t remote_port
;
1728 extern int (*dhcp_interface_setup_hook
) (struct interface_info
*,
1730 extern int (*dhcp_interface_discovery_hook
) (struct interface_info
*);
1731 isc_result_t (*dhcp_interface_startup_hook
) (struct interface_info
*);
1733 extern void (*bootp_packet_handler
) PROTO ((struct interface_info
*,
1734 struct dhcp_packet
*, unsigned,
1736 struct iaddr
, struct hardware
*));
1737 #if 0 /* this can be private to common/dispatch.c */
1738 extern struct timeout
*timeouts
;
1740 extern omapi_object_type_t
*dhcp_type_interface
;
1741 #if defined (TRACING)
1742 trace_type_t
*interface_trace
;
1743 trace_type_t
*inpacket_trace
;
1744 trace_type_t
*outpacket_trace
;
1746 extern struct interface_info
**interface_vector
;
1747 extern int interface_count
;
1748 extern int interface_max
;
1749 isc_result_t
interface_initialize (omapi_object_t
*, const char *, int);
1750 void discover_interfaces
PROTO ((int));
1751 int setup_fallback (struct interface_info
**, const char *, int);
1752 int if_readsocket
PROTO ((omapi_object_t
*));
1753 void reinitialize_interfaces
PROTO ((void));
1756 void set_time (u_int32_t
);
1757 struct timeval
*process_outstanding_timeouts (struct timeval
*);
1758 void dispatch
PROTO ((void));
1759 isc_result_t got_one
PROTO ((omapi_object_t
*));
1760 isc_result_t
interface_set_value (omapi_object_t
*, omapi_object_t
*,
1761 omapi_data_string_t
*, omapi_typed_data_t
*);
1762 isc_result_t
interface_get_value (omapi_object_t
*, omapi_object_t
*,
1763 omapi_data_string_t
*, omapi_value_t
**);
1764 isc_result_t
interface_destroy (omapi_object_t
*, const char *, int);
1765 isc_result_t
interface_signal_handler (omapi_object_t
*,
1766 const char *, va_list);
1767 isc_result_t
interface_stuff_values (omapi_object_t
*,
1771 void add_timeout
PROTO ((TIME
, void (*) PROTO ((void *)), void *,
1772 tvref_t
, tvunref_t
));
1773 void cancel_timeout
PROTO ((void (*) PROTO ((void *)), void *));
1774 void cancel_all_timeouts (void);
1775 void relinquish_timeouts (void);
1777 struct protocol
*add_protocol
PROTO ((const char *, int,
1778 void (*) PROTO ((struct protocol
*)),
1781 void remove_protocol
PROTO ((struct protocol
*));
1783 OMAPI_OBJECT_ALLOC_DECL (interface
,
1784 struct interface_info
, dhcp_type_interface
)
1787 extern struct universe dhcp_universe
;
1788 extern struct option dhcp_options
[256];
1789 extern struct universe nwip_universe
;
1790 extern struct option nwip_options
[256];
1791 extern struct universe fqdn_universe
;
1792 extern struct option fqdn_options
[256];
1793 extern int dhcp_option_default_priority_list
[];
1794 extern int dhcp_option_default_priority_list_count
;
1795 extern const char *hardware_types
[256];
1796 int universe_count
, universe_max
;
1797 struct universe
**universes
;
1798 extern universe_hash_t
*universe_hash
;
1799 void initialize_common_option_spaces
PROTO ((void));
1800 struct universe
*config_universe
;
1803 #if defined (FAILOVER_PROTOCOL)
1804 extern failover_option_t null_failover_option
;
1805 extern failover_option_t skip_failover_option
;
1806 extern struct failover_option_info ft_options
[];
1807 extern u_int32_t fto_allowed
[];
1808 extern int ft_sizes
[];
1809 extern const char *dhcp_flink_state_names
[];
1811 extern const char *binding_state_names
[];
1813 extern struct universe agent_universe
;
1814 extern struct option agent_options
[256];
1815 extern struct universe server_universe
;
1816 extern struct option server_options
[256];
1818 extern struct enumeration ddns_styles
;
1819 extern struct enumeration syslog_enum
;
1820 void initialize_server_option_spaces
PROTO ((void));
1823 struct iaddr subnet_number
PROTO ((struct iaddr
, struct iaddr
));
1824 struct iaddr ip_addr
PROTO ((struct iaddr
, struct iaddr
, u_int32_t
));
1825 struct iaddr broadcast_addr
PROTO ((struct iaddr
, struct iaddr
));
1826 u_int32_t host_addr
PROTO ((struct iaddr
, struct iaddr
));
1827 int addr_eq
PROTO ((struct iaddr
, struct iaddr
));
1828 char *piaddr
PROTO ((struct iaddr
));
1829 char *piaddrmask (struct iaddr
, struct iaddr
, const char *, int);
1832 extern const char *path_dhclient_conf
;
1833 extern const char *path_dhclient_db
;
1834 extern const char *path_dhclient_pid
;
1835 extern char *path_dhclient_script
;
1836 extern int interfaces_requested
;
1838 extern struct client_config top_level_config
;
1840 void dhcpoffer
PROTO ((struct packet
*));
1841 void dhcpack
PROTO ((struct packet
*));
1842 void dhcpnak
PROTO ((struct packet
*));
1844 void send_discover
PROTO ((void *));
1845 void send_request
PROTO ((void *));
1846 void send_release
PROTO ((void *));
1847 void send_decline
PROTO ((void *));
1849 void state_reboot
PROTO ((void *));
1850 void state_init
PROTO ((void *));
1851 void state_selecting
PROTO ((void *));
1852 void state_requesting
PROTO ((void *));
1853 void state_bound
PROTO ((void *));
1854 void state_stop
PROTO ((void *));
1855 void state_panic
PROTO ((void *));
1857 void bind_lease
PROTO ((struct client_state
*));
1859 void make_client_options
PROTO ((struct client_state
*,
1860 struct client_lease
*, u_int8_t
*,
1861 struct option_cache
*, struct iaddr
*,
1862 u_int32_t
*, struct option_state
**));
1863 void make_discover
PROTO ((struct client_state
*, struct client_lease
*));
1864 void make_request
PROTO ((struct client_state
*, struct client_lease
*));
1865 void make_decline
PROTO ((struct client_state
*, struct client_lease
*));
1866 void make_release
PROTO ((struct client_state
*, struct client_lease
*));
1868 void destroy_client_lease
PROTO ((struct client_lease
*));
1869 void rewrite_client_leases
PROTO ((void));
1870 void write_lease_option (struct option_cache
*, struct packet
*,
1871 struct lease
*, struct client_state
*,
1872 struct option_state
*, struct option_state
*,
1873 struct binding_scope
**, struct universe
*, void *);
1874 int write_client_lease
PROTO ((struct client_state
*,
1875 struct client_lease
*, int, int));
1876 int dhcp_option_ev_name (char *, size_t, struct option
*);
1878 void script_init
PROTO ((struct client_state
*, const char *,
1879 struct string_list
*));
1880 void client_option_envadd (struct option_cache
*, struct packet
*,
1881 struct lease
*, struct client_state
*,
1882 struct option_state
*, struct option_state
*,
1883 struct binding_scope
**, struct universe
*, void *);
1884 void script_write_params
PROTO ((struct client_state
*,
1885 const char *, struct client_lease
*));
1886 int script_go
PROTO ((struct client_state
*));
1887 void client_envadd (struct client_state
*,
1888 const char *, const char *, const char *, ...)
1889 __attribute__((__format__(__printf__
,4,5)));
1891 struct client_lease
*packet_to_lease (struct packet
*, struct client_state
*);
1892 void go_daemon
PROTO ((void));
1893 void write_client_pid_file
PROTO ((void));
1894 void client_location_changed
PROTO ((void));
1895 void do_release
PROTO ((struct client_state
*));
1896 int dhclient_interface_shutdown_hook (struct interface_info
*);
1897 int dhclient_interface_discovery_hook (struct interface_info
*);
1898 isc_result_t
dhclient_interface_startup_hook (struct interface_info
*);
1899 void client_dns_update_timeout (void *cp
);
1900 isc_result_t
client_dns_update (struct client_state
*client
, int, int);
1903 int write_lease
PROTO ((struct lease
*));
1904 int write_host
PROTO ((struct host_decl
*));
1905 #if defined (FAILOVER_PROTOCOL)
1906 int write_failover_state (dhcp_failover_state_t
*);
1908 int db_printable
PROTO ((const char *));
1909 int db_printable_len
PROTO ((const unsigned char *, unsigned));
1910 void write_named_billing_class (const char *, unsigned, struct class *);
1911 void write_billing_classes (void);
1912 int write_billing_class
PROTO ((struct class *));
1913 void commit_leases_timeout
PROTO ((void *));
1914 int commit_leases
PROTO ((void));
1915 void db_startup
PROTO ((int));
1916 int new_lease_file
PROTO ((void));
1917 int group_writer (struct group_object
*);
1920 u_int32_t checksum
PROTO ((unsigned char *, unsigned, u_int32_t
));
1921 u_int32_t wrapsum
PROTO ((u_int32_t
));
1922 void assemble_hw_header
PROTO ((struct interface_info
*, unsigned char *,
1923 unsigned *, struct hardware
*));
1924 void assemble_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
1925 unsigned *, u_int32_t
, u_int32_t
,
1926 u_int32_t
, unsigned char *, unsigned));
1927 ssize_t decode_hw_header
PROTO ((struct interface_info
*, unsigned char *,
1928 unsigned, struct hardware
*));
1929 ssize_t decode_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
1930 unsigned, struct sockaddr_in
*,
1934 void assemble_ethernet_header
PROTO ((struct interface_info
*, unsigned char *,
1935 unsigned *, struct hardware
*));
1936 ssize_t decode_ethernet_header
PROTO ((struct interface_info
*,
1938 unsigned, struct hardware
*));
1941 void assemble_tr_header
PROTO ((struct interface_info
*, unsigned char *,
1942 unsigned *, struct hardware
*));
1943 ssize_t decode_tr_header
PROTO ((struct interface_info
*,
1945 unsigned, struct hardware
*));
1948 void convert_statement
PROTO ((struct parse
*));
1949 void convert_host_statement
PROTO ((struct parse
*, jrefproto
));
1950 void convert_host_name
PROTO ((struct parse
*, jrefproto
));
1951 void convert_class_statement
PROTO ((struct parse
*, jrefproto
, int));
1952 void convert_class_decl
PROTO ((struct parse
*, jrefproto
));
1953 void convert_lease_time
PROTO ((struct parse
*, jrefproto
, char *));
1954 void convert_shared_net_statement
PROTO ((struct parse
*, jrefproto
));
1955 void convert_subnet_statement
PROTO ((struct parse
*, jrefproto
));
1956 void convert_subnet_decl
PROTO ((struct parse
*, jrefproto
));
1957 void convert_host_decl
PROTO ((struct parse
*, jrefproto
));
1958 void convert_hardware_decl
PROTO ((struct parse
*, jrefproto
));
1959 void convert_hardware_addr
PROTO ((struct parse
*, jrefproto
));
1960 void convert_filename_decl
PROTO ((struct parse
*, jrefproto
));
1961 void convert_servername_decl
PROTO ((struct parse
*, jrefproto
));
1962 void convert_ip_addr_or_hostname
PROTO ((struct parse
*, jrefproto
, int));
1963 void convert_fixed_addr_decl
PROTO ((struct parse
*, jrefproto
));
1964 void convert_option_decl
PROTO ((struct parse
*, jrefproto
));
1965 void convert_timestamp
PROTO ((struct parse
*, jrefproto
));
1966 void convert_lease_statement
PROTO ((struct parse
*, jrefproto
));
1967 void convert_address_range
PROTO ((struct parse
*, jrefproto
));
1968 void convert_date
PROTO ((struct parse
*, jrefproto
, char *));
1969 void convert_numeric_aggregate
PROTO ((struct parse
*, jrefproto
, int, int, int, int));
1970 void indent
PROTO ((int));
1973 void add_route_direct
PROTO ((struct interface_info
*, struct in_addr
));
1974 void add_route_net
PROTO ((struct interface_info
*, struct in_addr
,
1976 void add_route_default_gateway
PROTO ((struct interface_info
*,
1978 void remove_routes
PROTO ((struct in_addr
));
1979 void remove_if_route
PROTO ((struct interface_info
*, struct in_addr
));
1980 void remove_all_if_routes
PROTO ((struct interface_info
*));
1981 void set_netmask
PROTO ((struct interface_info
*, struct in_addr
));
1982 void set_broadcast_addr
PROTO ((struct interface_info
*, struct in_addr
));
1983 void set_ip_address
PROTO ((struct interface_info
*, struct in_addr
));
1986 isc_result_t read_client_conf
PROTO ((void));
1987 int read_client_conf_file (const char *,
1988 struct interface_info
*, struct client_config
*);
1989 void read_client_leases
PROTO ((void));
1990 void parse_client_statement
PROTO ((struct parse
*, struct interface_info
*,
1991 struct client_config
*));
1992 int parse_X
PROTO ((struct parse
*, u_int8_t
*, unsigned));
1993 void parse_option_list
PROTO ((struct parse
*, u_int32_t
**));
1994 void parse_interface_declaration
PROTO ((struct parse
*,
1995 struct client_config
*, char *));
1996 int interface_or_dummy
PROTO ((struct interface_info
**, const char *));
1997 void make_client_state
PROTO ((struct client_state
**));
1998 void make_client_config
PROTO ((struct client_state
*,
1999 struct client_config
*));
2000 void parse_client_lease_statement
PROTO ((struct parse
*, int));
2001 void parse_client_lease_declaration
PROTO ((struct parse
*,
2002 struct client_lease
*,
2003 struct interface_info
**,
2004 struct client_state
**));
2005 int parse_option_decl
PROTO ((struct option_cache
**, struct parse
*));
2006 void parse_string_list
PROTO ((struct parse
*, struct string_list
**, int));
2007 int parse_ip_addr
PROTO ((struct parse
*, struct iaddr
*));
2008 void parse_reject_statement
PROTO ((struct parse
*, struct client_config
*));
2011 void relay
PROTO ((struct interface_info
*, struct dhcp_packet
*, unsigned,
2012 unsigned int, struct iaddr
, struct hardware
*));
2013 int strip_relay_agent_options
PROTO ((struct interface_info
*,
2014 struct interface_info
**,
2015 struct dhcp_packet
*, unsigned));
2016 int find_interface_by_agent_option
PROTO ((struct dhcp_packet
*,
2017 struct interface_info
**,
2019 int add_relay_agent_options
PROTO ((struct interface_info
*,
2020 struct dhcp_packet
*,
2021 unsigned, struct in_addr
));
2024 OMAPI_OBJECT_ALLOC_DECL (icmp_state
, struct icmp_state
, dhcp_type_icmp
)
2025 extern struct icmp_state
*icmp_state
;
2026 void icmp_startup
PROTO ((int, void (*) PROTO ((struct iaddr
,
2027 u_int8_t
*, int))));
2028 int icmp_readsocket
PROTO ((omapi_object_t
*));
2029 int icmp_echorequest
PROTO ((struct iaddr
*));
2030 isc_result_t icmp_echoreply
PROTO ((omapi_object_t
*));
2033 #if defined (NSUPDATE)
2034 isc_result_t
find_tsig_key (ns_tsig_key
**, const char *, struct dns_zone
*);
2035 void tkey_free (ns_tsig_key
**);
2037 isc_result_t
enter_dns_zone (struct dns_zone
*);
2038 isc_result_t
dns_zone_lookup (struct dns_zone
**, const char *);
2039 int dns_zone_dereference
PROTO ((struct dns_zone
**, const char *, int));
2040 #if defined (NSUPDATE)
2041 isc_result_t
find_cached_zone (const char *, ns_class
, char *,
2042 size_t, struct in_addr
*, int, int *,
2043 struct dns_zone
**);
2044 void forget_zone (struct dns_zone
**);
2045 void repudiate_zone (struct dns_zone
**);
2046 void cache_found_zone (ns_class
, char *, struct in_addr
*, int);
2047 int get_dhcid (struct data_string
*, int, const u_int8_t
*, unsigned);
2048 isc_result_t
ddns_update_a (struct data_string
*, struct iaddr
,
2049 struct data_string
*, unsigned long, int);
2050 isc_result_t
ddns_remove_a (struct data_string
*,
2051 struct iaddr
, struct data_string
*);
2052 #endif /* NSUPDATE */
2055 extern char path_resolv_conf
[];
2056 struct name_server
*name_servers
;
2057 struct domain_search_list
*domains
;
2059 void read_resolv_conf
PROTO ((TIME
));
2060 struct name_server
*first_name_server
PROTO ((void));
2063 #ifdef NEED_INET_ATON
2064 int inet_aton
PROTO ((const char *, struct in_addr
*));
2068 extern int have_billing_classes
;
2069 struct class unknown_class
;
2070 struct class known_class
;
2071 struct collection default_collection
;
2072 struct collection
*collections
;
2073 struct executable_statement
*default_classification_rules
;
2075 void classification_setup
PROTO ((void));
2076 void classify_client
PROTO ((struct packet
*));
2077 int check_collection
PROTO ((struct packet
*, struct lease
*,
2078 struct collection
*));
2079 void classify
PROTO ((struct packet
*, struct class *));
2080 isc_result_t find_class
PROTO ((struct class **, const char *,
2081 const char *, int));
2082 int unbill_class
PROTO ((struct lease
*, struct class *));
2083 int bill_class
PROTO ((struct lease
*, struct class *));
2086 int execute_statements
PROTO ((struct binding_value
**result
,
2087 struct packet
*, struct lease
*,
2088 struct client_state
*,
2089 struct option_state
*, struct option_state
*,
2090 struct binding_scope
**,
2091 struct executable_statement
*));
2092 void execute_statements_in_scope
PROTO ((struct binding_value
**result
,
2093 struct packet
*, struct lease
*,
2094 struct client_state
*,
2095 struct option_state
*,
2096 struct option_state
*,
2097 struct binding_scope
**,
2098 struct group
*, struct group
*));
2099 int executable_statement_dereference
PROTO ((struct executable_statement
**,
2100 const char *, int));
2101 void write_statements (FILE *, struct executable_statement
*, int);
2102 int find_matching_case (struct executable_statement
**,
2103 struct packet
*, struct lease
*, struct client_state
*,
2104 struct option_state
*, struct option_state
*,
2105 struct binding_scope
**,
2106 struct expression
*, struct executable_statement
*);
2107 int executable_statement_foreach (struct executable_statement
*,
2108 int (*) (struct executable_statement
*,
2109 void *, int), void *, int);
2112 extern omapi_object_type_t
*dhcp_type_interface
;
2113 extern omapi_object_type_t
*dhcp_type_group
;
2114 extern omapi_object_type_t
*dhcp_type_shared_network
;
2115 extern omapi_object_type_t
*dhcp_type_subnet
;
2116 extern omapi_object_type_t
*dhcp_type_control
;
2117 extern dhcp_control_object_t
*dhcp_control_object
;
2119 void dhcp_common_objects_setup (void);
2121 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2122 omapi_data_string_t
*,
2123 omapi_typed_data_t
*);
2124 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2125 omapi_data_string_t
*,
2127 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2128 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2129 const char *, va_list);
2130 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2133 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2134 omapi_object_t
*, omapi_object_t
*);
2135 isc_result_t
dhcp_group_create (omapi_object_t
**,
2137 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2140 isc_result_t
dhcp_control_set_value (omapi_object_t
*, omapi_object_t
*,
2141 omapi_data_string_t
*,
2142 omapi_typed_data_t
*);
2143 isc_result_t
dhcp_control_get_value (omapi_object_t
*, omapi_object_t
*,
2144 omapi_data_string_t
*,
2146 isc_result_t
dhcp_control_destroy (omapi_object_t
*, const char *, int);
2147 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*,
2148 const char *, va_list);
2149 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*,
2152 isc_result_t
dhcp_control_lookup (omapi_object_t
**,
2153 omapi_object_t
*, omapi_object_t
*);
2154 isc_result_t
dhcp_control_create (omapi_object_t
**,
2156 isc_result_t
dhcp_control_remove (omapi_object_t
*,
2159 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2160 omapi_data_string_t
*,
2161 omapi_typed_data_t
*);
2162 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2163 omapi_data_string_t
*,
2165 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2166 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2167 const char *, va_list);
2168 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2171 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2172 omapi_object_t
*, omapi_object_t
*);
2173 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2175 isc_result_t
dhcp_subnet_remove (omapi_object_t
*,
2178 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2180 omapi_data_string_t
*,
2181 omapi_typed_data_t
*);
2182 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*,
2184 omapi_data_string_t
*,
2186 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2187 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2188 const char *, va_list);
2189 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2192 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2193 omapi_object_t
*, omapi_object_t
*);
2194 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2196 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*,
2200 extern int (*dhcp_interface_shutdown_hook
) (struct interface_info
*);
2202 extern omapi_object_type_t
*dhcp_type_lease
;
2203 extern omapi_object_type_t
*dhcp_type_pool
;
2204 extern omapi_object_type_t
*dhcp_type_class
;
2206 #if defined (FAILOVER_PROTOCOL)
2207 extern omapi_object_type_t
*dhcp_type_failover_state
;
2208 extern omapi_object_type_t
*dhcp_type_failover_link
;
2209 extern omapi_object_type_t
*dhcp_type_failover_listener
;
2212 void dhcp_db_objects_setup (void);
2214 isc_result_t
dhcp_lease_set_value (omapi_object_t
*, omapi_object_t
*,
2215 omapi_data_string_t
*,
2216 omapi_typed_data_t
*);
2217 isc_result_t
dhcp_lease_get_value (omapi_object_t
*, omapi_object_t
*,
2218 omapi_data_string_t
*,
2220 isc_result_t
dhcp_lease_destroy (omapi_object_t
*, const char *, int);
2221 isc_result_t
dhcp_lease_signal_handler (omapi_object_t
*,
2222 const char *, va_list);
2223 isc_result_t
dhcp_lease_stuff_values (omapi_object_t
*,
2226 isc_result_t
dhcp_lease_lookup (omapi_object_t
**,
2227 omapi_object_t
*, omapi_object_t
*);
2228 isc_result_t
dhcp_lease_create (omapi_object_t
**,
2230 isc_result_t
dhcp_lease_remove (omapi_object_t
*,
2232 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2233 omapi_data_string_t
*,
2234 omapi_typed_data_t
*);
2235 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2236 omapi_data_string_t
*,
2238 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2239 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2240 const char *, va_list);
2241 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2244 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2245 omapi_object_t
*, omapi_object_t
*);
2246 isc_result_t
dhcp_group_create (omapi_object_t
**,
2248 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2250 isc_result_t
dhcp_host_set_value (omapi_object_t
*, omapi_object_t
*,
2251 omapi_data_string_t
*,
2252 omapi_typed_data_t
*);
2253 isc_result_t
dhcp_host_get_value (omapi_object_t
*, omapi_object_t
*,
2254 omapi_data_string_t
*,
2256 isc_result_t
dhcp_host_destroy (omapi_object_t
*, const char *, int);
2257 isc_result_t
dhcp_host_signal_handler (omapi_object_t
*,
2258 const char *, va_list);
2259 isc_result_t
dhcp_host_stuff_values (omapi_object_t
*,
2262 isc_result_t
dhcp_host_lookup (omapi_object_t
**,
2263 omapi_object_t
*, omapi_object_t
*);
2264 isc_result_t
dhcp_host_create (omapi_object_t
**,
2266 isc_result_t
dhcp_host_remove (omapi_object_t
*,
2268 isc_result_t
dhcp_pool_set_value (omapi_object_t
*, omapi_object_t
*,
2269 omapi_data_string_t
*,
2270 omapi_typed_data_t
*);
2271 isc_result_t
dhcp_pool_get_value (omapi_object_t
*, omapi_object_t
*,
2272 omapi_data_string_t
*,
2274 isc_result_t
dhcp_pool_destroy (omapi_object_t
*, const char *, int);
2275 isc_result_t
dhcp_pool_signal_handler (omapi_object_t
*,
2276 const char *, va_list);
2277 isc_result_t
dhcp_pool_stuff_values (omapi_object_t
*,
2280 isc_result_t
dhcp_pool_lookup (omapi_object_t
**,
2281 omapi_object_t
*, omapi_object_t
*);
2282 isc_result_t
dhcp_pool_create (omapi_object_t
**,
2284 isc_result_t
dhcp_pool_remove (omapi_object_t
*,
2286 isc_result_t
dhcp_class_set_value (omapi_object_t
*, omapi_object_t
*,
2287 omapi_data_string_t
*,
2288 omapi_typed_data_t
*);
2289 isc_result_t
dhcp_class_get_value (omapi_object_t
*, omapi_object_t
*,
2290 omapi_data_string_t
*,
2292 isc_result_t
dhcp_class_destroy (omapi_object_t
*, const char *, int);
2293 isc_result_t
dhcp_class_signal_handler (omapi_object_t
*,
2294 const char *, va_list);
2295 isc_result_t
dhcp_class_stuff_values (omapi_object_t
*,
2298 isc_result_t
dhcp_class_lookup (omapi_object_t
**,
2299 omapi_object_t
*, omapi_object_t
*);
2300 isc_result_t
dhcp_class_create (omapi_object_t
**,
2302 isc_result_t
dhcp_class_remove (omapi_object_t
*,
2304 isc_result_t
dhcp_subclass_set_value (omapi_object_t
*, omapi_object_t
*,
2305 omapi_data_string_t
*,
2306 omapi_typed_data_t
*);
2307 isc_result_t
dhcp_subclass_get_value (omapi_object_t
*, omapi_object_t
*,
2308 omapi_data_string_t
*,
2310 isc_result_t
dhcp_subclass_destroy (omapi_object_t
*, const char *, int);
2311 isc_result_t
dhcp_subclass_signal_handler (omapi_object_t
*,
2312 const char *, va_list);
2313 isc_result_t
dhcp_subclass_stuff_values (omapi_object_t
*,
2316 isc_result_t
dhcp_subclass_lookup (omapi_object_t
**,
2317 omapi_object_t
*, omapi_object_t
*);
2318 isc_result_t
dhcp_subclass_create (omapi_object_t
**,
2320 isc_result_t
dhcp_subclass_remove (omapi_object_t
*,
2322 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2324 omapi_data_string_t
*,
2325 omapi_typed_data_t
*);
2326 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*, omapi_object_t
*,
2327 omapi_data_string_t
*,
2329 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2330 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2331 const char *, va_list);
2332 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2335 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2336 omapi_object_t
*, omapi_object_t
*);
2337 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2339 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2340 omapi_data_string_t
*,
2341 omapi_typed_data_t
*);
2342 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2343 omapi_data_string_t
*,
2345 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2346 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2347 const char *, va_list);
2348 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2351 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2352 omapi_object_t
*, omapi_object_t
*);
2353 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2355 isc_result_t
dhcp_interface_set_value (omapi_object_t
*,
2357 omapi_data_string_t
*,
2358 omapi_typed_data_t
*);
2359 isc_result_t
dhcp_interface_get_value (omapi_object_t
*,
2361 omapi_data_string_t
*,
2363 isc_result_t
dhcp_interface_destroy (omapi_object_t
*,
2365 isc_result_t
dhcp_interface_signal_handler (omapi_object_t
*,
2368 isc_result_t
dhcp_interface_stuff_values (omapi_object_t
*,
2371 isc_result_t
dhcp_interface_lookup (omapi_object_t
**,
2374 isc_result_t
dhcp_interface_create (omapi_object_t
**,
2376 isc_result_t
dhcp_interface_remove (omapi_object_t
*,
2378 void interface_stash (struct interface_info
*);
2379 void interface_snorf (struct interface_info
*, int);
2381 isc_result_t
binding_scope_set_value (struct binding_scope
*, int,
2382 omapi_data_string_t
*,
2383 omapi_typed_data_t
*);
2384 isc_result_t
binding_scope_get_value (omapi_value_t
**,
2385 struct binding_scope
*,
2386 omapi_data_string_t
*);
2387 isc_result_t
binding_scope_stuff_values (omapi_object_t
*,
2388 struct binding_scope
*);
2392 extern struct subnet
*subnets
;
2393 extern struct shared_network
*shared_networks
;
2394 extern host_hash_t
*host_hw_addr_hash
;
2395 extern host_hash_t
*host_uid_hash
;
2396 extern host_hash_t
*host_name_hash
;
2397 extern lease_hash_t
*lease_uid_hash
;
2398 extern lease_hash_t
*lease_ip_addr_hash
;
2399 extern lease_hash_t
*lease_hw_addr_hash
;
2401 extern omapi_object_type_t
*dhcp_type_host
;
2403 isc_result_t enter_host
PROTO ((struct host_decl
*, int, int));
2404 isc_result_t delete_host
PROTO ((struct host_decl
*, int));
2405 int find_hosts_by_haddr
PROTO ((struct host_decl
**, int,
2406 const unsigned char *, unsigned,
2407 const char *, int));
2408 int find_hosts_by_uid
PROTO ((struct host_decl
**, const unsigned char *,
2409 unsigned, const char *, int));
2410 int find_host_for_network
PROTO ((struct subnet
**, struct host_decl
**,
2411 struct iaddr
*, struct shared_network
*));
2412 void new_address_range
PROTO ((struct parse
*, struct iaddr
, struct iaddr
,
2413 struct subnet
*, struct pool
*,
2415 isc_result_t
dhcp_lease_free (omapi_object_t
*, const char *, int);
2416 isc_result_t
dhcp_lease_get (omapi_object_t
**, const char *, int);
2417 int find_grouped_subnet
PROTO ((struct subnet
**, struct shared_network
*,
2418 struct iaddr
, const char *, int));
2419 int find_subnet (struct subnet
**, struct iaddr
, const char *, int);
2420 void enter_shared_network
PROTO ((struct shared_network
*));
2421 void new_shared_network_interface
PROTO ((struct parse
*,
2422 struct shared_network
*,
2424 int subnet_inner_than
PROTO ((struct subnet
*, struct subnet
*, int));
2425 void enter_subnet
PROTO ((struct subnet
*));
2426 void enter_lease
PROTO ((struct lease
*));
2427 int supersede_lease
PROTO ((struct lease
*, struct lease
*, int, int, int));
2428 void make_binding_state_transition (struct lease
*);
2429 int lease_copy
PROTO ((struct lease
**, struct lease
*, const char *, int));
2430 void release_lease
PROTO ((struct lease
*, struct packet
*));
2431 void abandon_lease
PROTO ((struct lease
*, const char *));
2432 void dissociate_lease
PROTO ((struct lease
*));
2433 void pool_timer
PROTO ((void *));
2434 int find_lease_by_uid
PROTO ((struct lease
**, const unsigned char *,
2435 unsigned, const char *, int));
2436 int find_lease_by_hw_addr
PROTO ((struct lease
**, const unsigned char *,
2437 unsigned, const char *, int));
2438 int find_lease_by_ip_addr
PROTO ((struct lease
**, struct iaddr
,
2439 const char *, int));
2440 void uid_hash_add
PROTO ((struct lease
*));
2441 void uid_hash_delete
PROTO ((struct lease
*));
2442 void hw_hash_add
PROTO ((struct lease
*));
2443 void hw_hash_delete
PROTO ((struct lease
*));
2444 int write_leases
PROTO ((void));
2445 int lease_enqueue (struct lease
*);
2446 void lease_instantiate (const unsigned char *, unsigned, struct lease
*);
2447 void expire_all_pools
PROTO ((void));
2448 void dump_subnets
PROTO ((void));
2449 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2450 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2451 void free_everything (void);
2455 char *ddns_rev_name (struct lease
*, struct lease_state
*, struct packet
*);
2456 char *ddns_fwd_name (struct lease
*, struct lease_state
*, struct packet
*);
2457 int nsupdateA (const char *, const unsigned char *, u_int32_t
, int);
2458 int nsupdatePTR (const char *, const unsigned char *, u_int32_t
, int);
2459 void nsupdate (struct lease
*, struct lease_state
*, struct packet
*, int);
2460 int updateA (const struct data_string
*, const struct data_string
*,
2461 unsigned int, struct lease
*);
2462 int updatePTR (const struct data_string
*, const struct data_string
*,
2463 unsigned int, struct lease
*);
2464 int deleteA (const struct data_string
*, const struct data_string
*,
2466 int deletePTR (const struct data_string
*, const struct data_string
*,
2470 #if defined (FAILOVER_PROTOCOL)
2471 extern dhcp_failover_state_t
*failover_states
;
2472 void dhcp_failover_startup
PROTO ((void));
2473 int dhcp_failover_write_all_states (void);
2474 isc_result_t enter_failover_peer
PROTO ((dhcp_failover_state_t
*));
2475 isc_result_t find_failover_peer
PROTO ((dhcp_failover_state_t
**,
2476 const char *, const char *, int));
2477 isc_result_t dhcp_failover_link_initiate
PROTO ((omapi_object_t
*));
2478 isc_result_t dhcp_failover_link_signal
PROTO ((omapi_object_t
*,
2479 const char *, va_list));
2480 isc_result_t dhcp_failover_link_set_value
PROTO ((omapi_object_t
*,
2482 omapi_data_string_t
*,
2483 omapi_typed_data_t
*));
2484 isc_result_t dhcp_failover_link_get_value
PROTO ((omapi_object_t
*,
2486 omapi_data_string_t
*,
2488 isc_result_t dhcp_failover_link_destroy
PROTO ((omapi_object_t
*,
2489 const char *, int));
2490 isc_result_t dhcp_failover_link_stuff_values
PROTO ((omapi_object_t
*,
2493 isc_result_t dhcp_failover_listen
PROTO ((omapi_object_t
*));
2495 isc_result_t dhcp_failover_listener_signal
PROTO ((omapi_object_t
*,
2498 isc_result_t dhcp_failover_listener_set_value
PROTO ((omapi_object_t
*,
2500 omapi_data_string_t
*,
2501 omapi_typed_data_t
*));
2502 isc_result_t dhcp_failover_listener_get_value
PROTO ((omapi_object_t
*,
2504 omapi_data_string_t
*,
2506 isc_result_t dhcp_failover_listener_destroy
PROTO ((omapi_object_t
*,
2507 const char *, int));
2508 isc_result_t dhcp_failover_listener_stuff
PROTO ((omapi_object_t
*,
2511 isc_result_t dhcp_failover_register
PROTO ((omapi_object_t
*));
2512 isc_result_t dhcp_failover_state_signal
PROTO ((omapi_object_t
*,
2513 const char *, va_list));
2514 isc_result_t
dhcp_failover_state_transition (dhcp_failover_state_t
*,
2516 isc_result_t
dhcp_failover_set_service_state (dhcp_failover_state_t
*state
);
2517 isc_result_t
dhcp_failover_set_state (dhcp_failover_state_t
*,
2518 enum failover_state
);
2519 isc_result_t
dhcp_failover_peer_state_changed (dhcp_failover_state_t
*,
2520 failover_message_t
*);
2521 int dhcp_failover_pool_rebalance (dhcp_failover_state_t
*);
2522 int dhcp_failover_pool_check (struct pool
*);
2523 int dhcp_failover_state_pool_check (dhcp_failover_state_t
*);
2524 void dhcp_failover_timeout (void *);
2525 void dhcp_failover_send_contact (void *);
2526 isc_result_t
dhcp_failover_send_state (dhcp_failover_state_t
*);
2527 isc_result_t
dhcp_failover_send_updates (dhcp_failover_state_t
*);
2528 int dhcp_failover_queue_update (struct lease
*, int);
2529 int dhcp_failover_send_acks (dhcp_failover_state_t
*);
2530 void dhcp_failover_toack_queue_timeout (void *);
2531 int dhcp_failover_queue_ack (dhcp_failover_state_t
*, failover_message_t
*msg
);
2532 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t
*, struct lease
*);
2533 isc_result_t dhcp_failover_state_set_value
PROTO ((omapi_object_t
*,
2535 omapi_data_string_t
*,
2536 omapi_typed_data_t
*));
2537 void dhcp_failover_keepalive (void *);
2538 void dhcp_failover_reconnect (void *);
2539 void dhcp_failover_startup_timeout (void *);
2540 void dhcp_failover_link_startup_timeout (void *);
2541 void dhcp_failover_listener_restart (void *);
2542 isc_result_t dhcp_failover_state_get_value
PROTO ((omapi_object_t
*,
2544 omapi_data_string_t
*,
2546 isc_result_t dhcp_failover_state_destroy
PROTO ((omapi_object_t
*,
2547 const char *, int));
2548 isc_result_t dhcp_failover_state_stuff
PROTO ((omapi_object_t
*,
2551 isc_result_t dhcp_failover_state_lookup
PROTO ((omapi_object_t
**,
2554 isc_result_t dhcp_failover_state_create
PROTO ((omapi_object_t
**,
2556 isc_result_t dhcp_failover_state_remove
PROTO ((omapi_object_t
*,
2558 int dhcp_failover_state_match (dhcp_failover_state_t
*, u_int8_t
*, unsigned);
2559 const char *dhcp_failover_reject_reason_print (int);
2560 const char *dhcp_failover_state_name_print (enum failover_state
);
2561 const char *dhcp_failover_message_name (unsigned);
2562 const char *dhcp_failover_option_name (unsigned);
2563 failover_option_t
*dhcp_failover_option_printf (unsigned, char *,
2567 __attribute__((__format__(__printf__
,5,6)));
2568 failover_option_t
*dhcp_failover_make_option (unsigned, char *,
2569 unsigned *, unsigned, ...);
2570 isc_result_t
dhcp_failover_put_message (dhcp_failover_link_t
*,
2571 omapi_object_t
*, int, ...);
2572 isc_result_t dhcp_failover_send_connect
PROTO ((omapi_object_t
*));
2573 isc_result_t dhcp_failover_send_connectack
PROTO ((omapi_object_t
*,
2574 dhcp_failover_state_t
*,
2575 int, const char *));
2576 isc_result_t dhcp_failover_send_disconnect
PROTO ((omapi_object_t
*,
2577 int, const char *));
2578 isc_result_t
dhcp_failover_send_bind_update (dhcp_failover_state_t
*,
2580 isc_result_t
dhcp_failover_send_bind_ack (dhcp_failover_state_t
*,
2581 failover_message_t
*,
2583 isc_result_t
dhcp_failover_send_poolreq (dhcp_failover_state_t
*);
2584 isc_result_t
dhcp_failover_send_poolresp (dhcp_failover_state_t
*, int);
2585 isc_result_t
dhcp_failover_send_update_request (dhcp_failover_state_t
*);
2586 isc_result_t
dhcp_failover_send_update_request_all (dhcp_failover_state_t
*);
2587 isc_result_t
dhcp_failover_send_update_done (dhcp_failover_state_t
*);
2588 isc_result_t
dhcp_failover_process_bind_update (dhcp_failover_state_t
*,
2589 failover_message_t
*);
2590 isc_result_t
dhcp_failover_process_bind_ack (dhcp_failover_state_t
*,
2591 failover_message_t
*);
2592 isc_result_t
dhcp_failover_generate_update_queue (dhcp_failover_state_t
*,
2594 isc_result_t
dhcp_failover_process_update_request (dhcp_failover_state_t
*,
2595 failover_message_t
*);
2596 isc_result_t
dhcp_failover_process_update_request_all (dhcp_failover_state_t
*,
2597 failover_message_t
*);
2598 isc_result_t
dhcp_failover_process_update_done (dhcp_failover_state_t
*,
2599 failover_message_t
*);
2600 void dhcp_failover_recover_done (void *);
2601 void failover_print
PROTO ((char *, unsigned *, unsigned, const char *));
2602 void update_partner
PROTO ((struct lease
*));
2603 int load_balance_mine (struct packet
*, dhcp_failover_state_t
*);
2604 binding_state_t
normal_binding_state_transition_check (struct lease
*,
2605 dhcp_failover_state_t
*,
2609 conflict_binding_state_transition_check (struct lease
*,
2610 dhcp_failover_state_t
*,
2611 binding_state_t
, u_int32_t
);
2612 int lease_mine_to_reallocate (struct lease
*);
2614 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state
, dhcp_failover_state_t
,
2615 dhcp_type_failover_state
)
2616 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener
, dhcp_failover_listener_t
,
2617 dhcp_type_failover_listener
)
2618 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link
, dhcp_failover_link_t
,
2619 dhcp_type_failover_link
)
2620 #endif /* FAILOVER_PROTOCOL */
2622 const char *binding_state_print (enum failover_state
);