3 Definitions for dhcpd... */
6 * Copyright (c) 2004-2008 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''.
38 #include <sys/types.h>
39 #include <netinet/in.h>
40 #include <sys/socket.h>
42 #include <arpa/inet.h>
47 #define fd_set cygwin_fd_set
48 #include <sys/types.h>
62 #include <net/route.h>
63 #include <net/if_arp.h>
65 # include <net/if_dl.h>
73 #include "arpa/nameser.h"
74 #if defined (NSUPDATE)
75 # include "minires/minires.h"
79 typedef struct hash_table group_hash_t
;
80 typedef struct hash_table universe_hash_t
;
81 typedef struct hash_table option_name_hash_t
;
82 typedef struct hash_table option_code_hash_t
;
83 typedef struct hash_table dns_zone_hash_t
;
84 typedef struct hash_table lease_ip_hash_t
;
85 typedef struct hash_table lease_id_hash_t
;
86 typedef struct hash_table host_hash_t
;
87 typedef struct hash_table class_hash_t
;
97 #include "statement.h"
100 #include "dhctoken.h"
103 #include <isc-dhcp/result.h>
104 #include <omapip/omapip_p.h>
106 #if !defined (BYTE_NAME_HASH_SIZE)
107 # define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
109 #if !defined (BYTE_CODE_HASH_SIZE)
110 # define BYTE_CODE_HASH_SIZE 254 /* Default would be ridiculous. */
113 /* Although it is highly improbable that a 16-bit option space might
114 * actually use 2^16 actual defined options, it is the worst case
115 * scenario we must prepare for. Having 4 options per bucket in this
116 * case is pretty reasonable.
118 #if !defined (WORD_NAME_HASH_SIZE)
119 # define WORD_NAME_HASH_SIZE 20479
121 #if !defined (WORD_CODE_HASH_SIZE)
122 # define WORD_CODE_HASH_SIZE 16384
125 /* Not only is it improbable that the 32-bit spaces might actually use 2^32
126 * defined options, it is infeasible. It would be best for this kind of
127 * space to be dynamically sized. Instead we size it at the word hash's
130 #if !defined (QUAD_NAME_HASH_SIZE)
131 # define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE
133 #if !defined (QUAD_CODE_HASH_SIZE)
134 # define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE
137 #if !defined (DNS_HASH_SIZE)
138 # define DNS_HASH_SIZE 0 /* Default. */
141 /* Default size to use for name/code hashes on user-defined option spaces. */
142 #if !defined (DEFAULT_SPACE_HASH_SIZE)
143 # define DEFAULT_SPACE_HASH_SIZE 11
146 #if !defined (NWIP_HASH_SIZE)
147 # define NWIP_HASH_SIZE 17 /* A really small table. */
150 #if !defined (FQDN_HASH_SIZE)
151 # define FQDN_HASH_SIZE 13 /* A ridiculously small table. */
154 /* I really doubt a given installation is going to have more than a few
155 * hundred vendors involved.
157 #if !defined (VIVCO_HASH_SIZE)
158 # define VIVCO_HASH_SIZE 127
161 #if !defined (VIVSO_HASH_SIZE)
162 # define VIVSO_HASH_SIZE VIVCO_HASH_SIZE
165 #if !defined (VSIO_HASH_SIZE)
166 # define VSIO_HASH_SIZE VIVCO_HASH_SIZE
169 #if !defined (VIV_ISC_HASH_SIZE)
170 # define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */
173 #if !defined (UNIVERSE_HASH_SIZE)
174 # define UNIVERSE_HASH_SIZE 13 /* A really small table. */
177 #if !defined (GROUP_HASH_SIZE)
178 # define GROUP_HASH_SIZE 0 /* Default. */
181 /* At least one person has indicated they use ~20k host records.
183 #if !defined (HOST_HASH_SIZE)
184 # define HOST_HASH_SIZE 22501
187 /* We have user reports of use of ISC DHCP numbering leases in the 200k's.
189 * We also have reports of folks using 10.0/8 as a dynamic range. The
190 * following is something of a compromise between the two. At the ~2-3
191 * hundred thousand leases, there's ~2-3 leases to search in each bucket.
193 #if !defined (LEASE_HASH_SIZE)
194 # define LEASE_HASH_SIZE 100003
197 /* It is not known what the worst case subclass hash size is. We estimate
200 #if !defined (SCLASS_HASH_SIZE)
201 # define SCLASS_HASH_SIZE 12007
204 #if !defined (AGENT_HASH_SIZE)
205 # define AGENT_HASH_SIZE 11 /* A really small table. */
208 /* The server hash size is used for both names and codes. There aren't
209 * many (roughly 50 at the moment), so we use a smaller table. If we
210 * use a 1:1 table size, then we get name collisions due to poor name
211 * hashing. So we use double the space we need, which drastically
212 * reduces collisions.
214 #if !defined (SERVER_HASH_SIZE)
215 # define SERVER_HASH_SIZE (2*(sizeof(server_options) / sizeof(struct option)))
219 /* How many options are likely to appear in a single packet? */
220 #if !defined (OPTION_HASH_SIZE)
221 # define OPTION_HASH_SIZE 17
222 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
223 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
226 #define compute_option_hash(x) \
227 (((x) & (OPTION_HASH_PTWO - 1)) + \
228 (((x) >> OPTION_HASH_EXP) & \
229 (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
231 enum dhcp_shutdown_state
{
233 shutdown_omapi_connections
,
234 shutdown_drop_omapi_connections
,
239 /* Client FQDN option, failover FQDN option, etc. */
246 #include "failover.h"
248 /* A parsing context. */
260 * In order to give nice output when we have a parsing error
261 * in our file, we keep track of where we are in the line so
262 * that we can show the user.
264 * We need to keep track of two lines, because we can look
265 * ahead, via the "peek" function, to the next line sometimes.
267 * The "line1" and "line2" variables act as buffers for this
268 * information. The "lpos" variable tells us where we are in the
271 * When we "put back" a character from the parsing context, we
272 * do not want to have the character appear twice in the error
273 * output. So, we set a flag, the "ugflag", which the
274 * get_char() function uses to check for this condition.
282 enum dhcp_token token
;
288 int warnings_occurred
;
291 size_t bufix
, buflen
;
294 struct parse
*saved_state
;
297 /* Variable-length array of data. */
300 struct string_list
*next
;
304 /* A name server, from /etc/resolv.conf. */
306 struct name_server
*next
;
307 struct sockaddr_in addr
;
311 /* A domain search list element. */
312 struct domain_search_list
{
313 struct domain_search_list
*next
;
318 /* Option tag structures are used to build chains of option tags, for
319 when we're sure we're not going to have enough of them to justify
320 maintaining an array. */
323 struct option_tag
*next
;
327 /* An agent option structure. We need a special structure for the
328 Relay Agent Information option because if more than one appears in
329 a message, we have to keep them separate. */
331 struct agent_options
{
332 struct agent_options
*next
;
334 struct option_tag
*first
;
337 struct option_cache
{
339 struct option_cache
*next
;
340 struct expression
*expression
;
341 struct option
*option
;
342 struct data_string data
;
344 #define OPTION_HAD_NULLS 0x00000001
348 struct option_state
{
356 /* A dhcp packet and the pointers to its option values. */
358 struct dhcp_packet
*raw
;
360 unsigned packet_length
;
363 unsigned char dhcpv6_msg_type
; /* DHCPv6 message type */
365 /* DHCPv6 transaction ID */
366 unsigned char dhcpv6_transaction_id
[3];
368 /* DHCPv6 relay information */
369 unsigned char dhcpv6_hop_count
;
370 struct in6_addr dhcpv6_link_address
;
371 struct in6_addr dhcpv6_peer_address
;
373 /* DHCPv6 packet containing this one, or NULL if none */
374 struct packet
*dhcpv6_container_packet
;
378 struct iaddr client_addr
;
379 struct interface_info
*interface
; /* Interface on which packet
381 struct hardware
*haddr
; /* Physical link address
382 of local sender (maybe gateway). */
384 /* Information for relay agent options (see
385 draft-ietf-dhc-agent-options-xx.txt). */
386 u_int8_t
*circuit_id
; /* Circuit ID of client connection. */
388 u_int8_t
*remote_id
; /* Remote ID of client. */
391 int got_requested_address
; /* True if client sent the
392 dhcp-requested-address option. */
394 struct shared_network
*shared_network
;
395 struct option_state
*options
;
397 #if !defined (PACKET_MAX_CLASSES)
398 # define PACKET_MAX_CLASSES 5
401 struct class *classes
[PACKET_MAX_CLASSES
];
406 /* If we stash agent options onto the packet option state, to pretend
407 * options we got in a previous exchange were still there, we need
408 * to signal this in a reliable way.
410 isc_boolean_t agent_options_stashed
;
413 * ISC_TRUE if packet received unicast (as opposed to multicast).
414 * Only used in DHCPv6.
416 isc_boolean_t unicast
;
419 /* A network interface's MAC address. */
430 server_hibernate
= 3,
432 } control_object_state_t
;
435 OMAPI_OBJECT_PREAMBLE
;
436 control_object_state_t state
;
437 } dhcp_control_object_t
;
442 #define FTS_EXPIRED 3
443 #define FTS_RELEASED 4
444 #define FTS_ABANDONED 5
447 typedef u_int8_t binding_state_t
;
449 /* FTS_LAST is the highest value that is valid for a lease binding state. */
450 #define FTS_LAST FTS_BACKUP
452 /* A dhcp lease declaration structure. */
454 OMAPI_OBJECT_PREAMBLE
;
456 struct lease
*n_uid
, *n_hw
;
458 struct iaddr ip_addr
;
459 TIME starts
, ends
, sort_time
;
460 char *client_hostname
;
461 struct binding_scope
*scope
;
462 struct host_decl
*host
;
463 struct subnet
*subnet
;
465 struct class *billing_class
;
466 struct option_chain_head
*agent_options
;
468 struct executable_statement
*on_expiry
;
469 struct executable_statement
*on_commit
;
470 struct executable_statement
*on_release
;
473 unsigned short uid_len
;
474 unsigned short uid_max
;
475 unsigned char uid_buf
[7];
476 struct hardware hardware_addr
;
479 # define STATIC_LEASE 1
480 # define BOOTP_LEASE 2
481 # define RESERVED_LEASE 4
482 # define MS_NULL_TERMINATION 8
483 # define ON_UPDATE_QUEUE 16
484 # define ON_ACK_QUEUE 32
485 # define ON_QUEUE (ON_UPDATE_QUEUE | ON_ACK_QUEUE)
486 # define UNICAST_BROADCAST_HACK 64
487 # define ON_DEFERRED_QUEUE 128
489 /* Persistent flags are to be preserved on a given lease structure. */
490 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
491 /* Ephemeral flags are to be preserved on a given lease (copied etc). */
492 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
493 UNICAST_BROADCAST_HACK | \
497 binding_state_t binding_state
;
498 binding_state_t next_binding_state
;
499 binding_state_t desired_binding_state
;
501 struct lease_state
*state
;
503 /* 'tsfp' is more of an 'effective' tsfp. It may be calculated from
504 * stos+mclt for example if it's an expired lease and the server is
505 * in partner-down state. 'atsfp' is zeroed whenever a lease is
506 * updated - and only set when the peer acknowledges it. This
507 * ensures every state change is transmitted.
509 TIME tstp
; /* Time sent to partner. */
510 TIME tsfp
; /* Time sent from partner. */
511 TIME atsfp
; /* Actual time sent from partner. */
512 TIME cltt
; /* Client last transaction time. */
513 u_int32_t last_xid
; /* XID we sent in this lease's BNDUPD */
514 struct lease
*next_pending
;
518 struct lease_state
*next
;
520 struct interface_info
*ip
;
522 struct packet
*packet
; /* The incoming packet. */
526 struct option_state
*options
;
527 struct data_string parameter_request_list
;
528 int max_message_size
;
529 unsigned char expiry
[4], renewal
[4], rebind
[4];
530 struct data_string filename
, server_name
;
531 int got_requested_address
;
532 int got_server_identifier
;
533 struct shared_network
*shared_network
; /* Shared network of interface
534 on which request arrived. */
538 u_int16_t bootp_flags
;
539 struct in_addr ciaddr
;
540 struct in_addr siaddr
;
541 struct in_addr giaddr
;
549 #define SHARED_NET_DECL 2
550 #define SUBNET_DECL 3
555 /* Possible modes in which discover_interfaces can run. */
557 #define DISCOVER_RUNNING 0
558 #define DISCOVER_SERVER 1
559 #define DISCOVER_UNCONFIGURED 2
560 #define DISCOVER_RELAY 3
561 #define DISCOVER_REQUESTED 4
563 /* DDNS_UPDATE_STYLE enumerations. */
564 #define DDNS_UPDATE_STYLE_NONE 0
565 #define DDNS_UPDATE_STYLE_AD_HOC 1
566 #define DDNS_UPDATE_STYLE_INTERIM 2
568 /* Server option names. */
570 #define SV_DEFAULT_LEASE_TIME 1
571 #define SV_MAX_LEASE_TIME 2
572 #define SV_MIN_LEASE_TIME 3
573 #define SV_BOOTP_LEASE_CUTOFF 4
574 #define SV_BOOTP_LEASE_LENGTH 5
575 #define SV_BOOT_UNKNOWN_CLIENTS 6
576 #define SV_DYNAMIC_BOOTP 7
577 #define SV_ALLOW_BOOTP 8
578 #define SV_ALLOW_BOOTING 9
579 #define SV_ONE_LEASE_PER_CLIENT 10
580 #define SV_GET_LEASE_HOSTNAMES 11
581 #define SV_USE_HOST_DECL_NAMES 12
582 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
583 #define SV_MIN_SECS 14
584 #define SV_FILENAME 15
585 #define SV_SERVER_NAME 16
586 #define SV_NEXT_SERVER 17
587 #define SV_AUTHORITATIVE 18
588 #define SV_VENDOR_OPTION_SPACE 19
589 #define SV_ALWAYS_REPLY_RFC1048 20
590 #define SV_SITE_OPTION_SPACE 21
591 #define SV_ALWAYS_BROADCAST 22
592 #define SV_DDNS_DOMAIN_NAME 23
593 #define SV_DDNS_HOST_NAME 24
594 #define SV_DDNS_REV_DOMAIN_NAME 25
595 #define SV_LEASE_FILE_NAME 26
596 #define SV_PID_FILE_NAME 27
597 #define SV_DUPLICATES 28
598 #define SV_DECLINES 29
599 #define SV_DDNS_UPDATES 30
600 #define SV_OMAPI_PORT 31
601 #define SV_LOCAL_PORT 32
602 #define SV_LIMITED_BROADCAST_ADDRESS 33
603 #define SV_REMOTE_PORT 34
604 #define SV_LOCAL_ADDRESS 35
605 #define SV_OMAPI_KEY 36
606 #define SV_STASH_AGENT_OPTIONS 37
607 #define SV_DDNS_TTL 38
608 #define SV_DDNS_UPDATE_STYLE 39
609 #define SV_CLIENT_UPDATES 40
610 #define SV_UPDATE_OPTIMIZATION 41
611 #define SV_PING_CHECKS 42
612 #define SV_UPDATE_STATIC_LEASES 43
613 #define SV_LOG_FACILITY 44
614 #define SV_DO_FORWARD_UPDATES 45
615 #define SV_PING_TIMEOUT 46
616 #define SV_RESERVE_INFINITE 47
617 #define SV_DDNS_CONFLICT_DETECT 48
618 #define SV_LEASEQUERY 49
619 #define SV_ADAPTIVE_LEASE_TIME_THRESHOLD 50
620 #define SV_DO_REVERSE_UPDATES 51
621 #define SV_FQDN_REPLY 52
622 #define SV_PREFER_LIFETIME 53
623 #define SV_DHCPV6_LEASE_FILE_NAME 54
624 #define SV_DHCPV6_PID_FILE_NAME 55
625 #define SV_LIMIT_ADDRS_PER_IA 56
626 #define SV_LIMIT_PREFS_PER_IA 57
627 #define SV_DELAYED_ACK 58
628 #define SV_MAX_ACK_DELAY 59
630 #if !defined (DEFAULT_PING_TIMEOUT)
631 # define DEFAULT_PING_TIMEOUT 1
634 #if !defined (DEFAULT_DELAYED_ACK)
635 # define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */
638 #if !defined (DEFAULT_ACK_DELAY_SECS)
639 # define DEFAULT_ACK_DELAY_SECS 0
642 #if !defined (DEFAULT_ACK_DELAY_USECS)
643 # define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */
646 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
647 # define DEFAULT_DEFAULT_LEASE_TIME 43200
650 #if !defined (DEFAULT_MIN_LEASE_TIME)
651 # define DEFAULT_MIN_LEASE_TIME 300
654 #if !defined (DEFAULT_MAX_LEASE_TIME)
655 # define DEFAULT_MAX_LEASE_TIME 86400
658 #if !defined (DEFAULT_DDNS_TTL)
659 # define DEFAULT_DDNS_TTL 3600
662 /* Client option names */
665 #define CL_SELECT_INTERVAL 2
666 #define CL_REBOOT_TIMEOUT 3
667 #define CL_RETRY_INTERVAL 4
668 #define CL_BACKOFF_CUTOFF 5
669 #define CL_INITIAL_INTERVAL 6
670 #define CL_BOOTP_POLICY 7
671 #define CL_SCRIPT_NAME 8
672 #define CL_REQUESTED_OPTIONS 9
673 #define CL_REQUESTED_LEASE_TIME 10
674 #define CL_SEND_OPTIONS 11
676 #define CL_REJECT_LIST 13
678 #ifndef CL_DEFAULT_TIMEOUT
679 # define CL_DEFAULT_TIMEOUT 60
682 #ifndef CL_DEFAULT_SELECT_INTERVAL
683 # define CL_DEFAULT_SELECT_INTERVAL 0
686 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
687 # define CL_DEFAULT_REBOOT_TIMEOUT 10
690 #ifndef CL_DEFAULT_RETRY_INTERVAL
691 # define CL_DEFAULT_RETRY_INTERVAL 300
694 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
695 # define CL_DEFAULT_BACKOFF_CUTOFF 120
698 #ifndef CL_DEFAULT_INITIAL_INTERVAL
699 # define CL_DEFAULT_INITIAL_INTERVAL 10
702 #ifndef CL_DEFAULT_BOOTP_POLICY
703 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
706 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
707 # define CL_DEFAULT_REQUESTED_OPTIONS \
709 DHO_BROADCAST_ADDRESS, \
713 DHO_DOMAIN_NAME_SERVERS, \
717 struct group_object
{
718 OMAPI_OBJECT_PREAMBLE
;
720 struct group_object
*n_dynamic
;
724 #define GROUP_OBJECT_DELETED 1
725 #define GROUP_OBJECT_DYNAMIC 2
726 #define GROUP_OBJECT_STATIC 4
729 /* Group of declarations that share common parameters. */
734 struct group_object
*object
;
735 struct subnet
*subnet
;
736 struct shared_network
*shared_network
;
738 struct executable_statement
*statements
;
741 /* A dhcp host declaration structure. */
743 OMAPI_OBJECT_PREAMBLE
;
744 struct host_decl
*n_ipaddr
;
745 struct host_decl
*n_dynamic
;
747 struct hardware interface
;
748 struct data_string client_identifier
;
749 struct option
*host_id_option
;
750 struct data_string host_id
;
751 /* XXXSK: fixed_addr should be an array of iaddr values,
752 not an option_cache, but it's referenced in a lot of
753 places, so we'll leave it for now. */
754 struct option_cache
*fixed_addr
;
755 struct iaddrcidrnetlist
*fixed_prefix
;
757 struct group_object
*named_group
;
758 struct data_string auth_key_id
;
760 #define HOST_DECL_DELETED 1
761 #define HOST_DECL_DYNAMIC 2
762 #define HOST_DECL_STATIC 4
768 permit_unknown_clients
,
769 permit_known_clients
,
770 permit_authenticated_clients
,
771 permit_unauthenticated_clients
,
773 permit_dynamic_bootp_clients
,
778 TIME after
; /* date after which this clause applies */
782 OMAPI_OBJECT_PREAMBLE
;
785 struct shared_network
*shared_network
;
786 struct permit
*permit_list
;
787 struct permit
*prohibit_list
;
788 struct lease
*active
;
789 struct lease
*expired
;
791 struct lease
*backup
;
792 struct lease
*abandoned
;
793 struct lease
*reserved
;
794 TIME next_event_time
;
799 TIME valid_from
; /* deny pool use before this date */
800 TIME valid_until
; /* deny pool use after this date */
802 #if defined (FAILOVER_PROTOCOL)
803 dhcp_failover_state_t
*failover_peer
;
807 struct shared_network
{
808 OMAPI_OBJECT_PREAMBLE
;
809 struct shared_network
*next
;
812 #define SHARED_IMPLICIT 1 /* This network was synthesized. */
815 struct subnet
*subnets
;
816 struct interface_info
*interface
;
818 struct ipv6_pool
**ipv6_pools
; /* NULL-terminated array */
819 int last_ipv6_pool
; /* offset of last IPv6 pool
820 used to issue a lease */
822 #if defined (FAILOVER_PROTOCOL)
823 dhcp_failover_state_t
*failover_peer
;
828 OMAPI_OBJECT_PREAMBLE
;
829 struct subnet
*next_subnet
;
830 struct subnet
*next_sibling
;
831 struct shared_network
*shared_network
;
832 struct interface_info
*interface
;
833 struct iaddr interface_address
;
835 struct iaddr netmask
;
836 int prefix_len
; /* XXX: currently for IPv6 only */
841 struct collection
*next
;
844 struct class *classes
;
847 /* Used as an argument to parse_clasS_decl() */
848 #define CLASS_TYPE_VENDOR 0
849 #define CLASS_TYPE_USER 1
850 #define CLASS_TYPE_CLASS 2
851 #define CLASS_TYPE_SUBCLASS 3
853 /* XXX classes must be reference-counted. */
855 OMAPI_OBJECT_PREAMBLE
;
856 struct class *nic
; /* Next in collection. */
857 struct class *superclass
; /* Set for spawned classes only. */
858 char *name
; /* Not set for spawned classes. */
860 /* A class may be configured to permit a limited number of leases. */
863 struct lease
**billed_leases
;
865 /* If nonzero, class has not been saved since it was last
869 /* Hash table containing subclasses. */
871 struct data_string hash_string
;
873 /* Expression used to match class. */
874 struct expression
*expr
;
876 /* Expression used to compute subclass identifiers for spawning
877 and to do subclass matching. */
878 struct expression
*submatch
;
883 /* Statements to execute if class matches. */
884 struct executable_statement
*statements
;
886 #define CLASS_DECL_DELETED 1
887 #define CLASS_DECL_DYNAMIC 2
888 #define CLASS_DECL_STATIC 4
889 #define CLASS_DECL_SUBCLASS 8
894 /* DHCP client lease structure... */
895 struct client_lease
{
896 struct client_lease
*next
; /* Next lease in list. */
897 TIME expiry
, renewal
, rebind
; /* Lease timeouts. */
898 struct iaddr address
; /* Address being leased. */
899 char *server_name
; /* Name of boot server. */
900 char *filename
; /* Name of file we're supposed to boot. */
901 struct string_list
*medium
; /* Network medium. */
902 struct auth_key
*key
; /* Key used in basic DHCP authentication. */
904 unsigned int is_static
: 1; /* If set, lease is from config file. */
905 unsigned int is_bootp
: 1; /* If set, lease was acquired with BOOTP. */
907 struct option_state
*options
; /* Options supplied with lease. */
910 /* DHCPv6 lease structures */
912 struct dhc6_addr
*next
;
913 struct iaddr address
;
916 /* Address state flags. */
917 #define DHC6_ADDR_DEPREFFED 0x01
918 #define DHC6_ADDR_EXPIRED 0x02
922 u_int32_t preferred_life
;
925 struct option_state
*options
;
929 struct dhc6_ia
*next
;
930 unsigned char iaid
[4];
936 struct dhc6_addr
*addrs
;
938 struct option_state
*options
;
942 struct dhc6_lease
*next
;
943 struct data_string server_id
;
945 isc_boolean_t released
;
949 unsigned char dhcpv6_transaction_id
[3];
950 struct dhc6_ia
*bindings
;
952 struct option_state
*options
;
955 /* Possible states in which the client can be. */
967 /* Authentication and BOOTP policy possibilities (not all values work
969 enum policy
{ P_IGNORE
, P_ACCEPT
, P_PREFER
, P_REQUIRE
, P_DONT
};
971 /* Configuration information from the config file... */
972 struct client_config
{
974 * When a message has been received, run these statements
977 struct group
*on_receipt
;
980 * When a message is sent, run these statements.
982 struct group
*on_transmission
;
984 struct option
**required_options
; /* Options that MUST be present. */
985 struct option
**requested_options
; /* Options to request (ORO/PRL). */
987 TIME timeout
; /* Start to panic if we don't get a
988 lease in this time period when
990 TIME initial_interval
; /* All exponential backoff intervals
992 TIME retry_interval
; /* If the protocol failed to produce
993 an address before the timeout,
994 try the protocol again after this
996 TIME select_interval
; /* Wait this many seconds from the
997 first DHCPDISCOVER before
998 picking an offered lease. */
999 TIME reboot_timeout
; /* When in INIT-REBOOT, wait this
1000 long before giving up and going
1002 TIME backoff_cutoff
; /* When doing exponential backoff,
1003 never back off to an interval
1004 longer than this amount. */
1005 u_int32_t requested_lease
; /* Requested lease time, if user
1006 doesn't configure one. */
1007 struct string_list
*media
; /* Possible network media values. */
1008 char *script_name
; /* Name of config script. */
1009 char *vendor_space_name
; /* Name of config script. */
1010 enum policy bootp_policy
;
1011 /* Ignore, accept or prefer BOOTP
1013 enum policy auth_policy
;
1014 /* Require authentication, prefer
1015 authentication, or don't try to
1017 struct string_list
*medium
; /* Current network medium. */
1019 struct iaddrmatchlist
*reject_list
; /* Servers to reject. */
1021 int omapi_port
; /* port on which to accept OMAPI
1022 connections, or -1 for no
1024 int do_forward_update
; /* If nonzero, and if we have the
1025 information we need, update the
1026 A record for the address we get. */
1029 /* Per-interface state used in the dhcp client... */
1030 /* XXX: consider union {}'ing this for v4/v6. */
1031 struct client_state
{
1032 struct client_state
*next
;
1033 struct interface_info
*interface
;
1036 /* Common values. */
1037 struct client_config
*config
; /* Client configuration. */
1038 struct string_list
*env
; /* Client script environment. */
1039 int envc
; /* Number of entries in environment. */
1040 struct option_state
*sent_options
; /* Options we sent. */
1041 enum dhcp_state state
; /* Current state for this interface. */
1044 /* DHCPv4 values. */
1045 struct client_lease
*active
; /* Currently active lease. */
1046 struct client_lease
*new; /* New lease. */
1047 struct client_lease
*offered_leases
; /* Leases offered to us. */
1048 struct client_lease
*leases
; /* Leases we currently hold. */
1049 struct client_lease
*alias
; /* Alias lease. */
1051 struct iaddr destination
; /* Where to send packet. */
1052 u_int32_t xid
; /* Transaction ID. */
1053 u_int16_t secs
; /* secs value from DHCPDISCOVER. */
1054 TIME first_sending
; /* When was first copy sent? */
1055 TIME interval
; /* What's the current resend interval? */
1056 struct string_list
*medium
; /* Last media type tried. */
1057 struct dhcp_packet packet
; /* Outgoing DHCP packet. */
1058 unsigned packet_length
; /* Actual length of generated packet. */
1060 struct iaddr requested_address
; /* Address we would like to get. */
1062 /* DHCPv6 values. */
1063 unsigned char dhcpv6_transaction_id
[3];
1064 u_int8_t refresh_type
;
1066 struct dhc6_lease
*active_lease
;
1067 struct dhc6_lease
*old_lease
;
1068 struct dhc6_lease
*advertised_leases
;
1069 struct dhc6_lease
*selected_lease
;
1070 struct dhc6_lease
*held_leases
;
1072 struct timeval start_time
;
1076 /* See RFC3315 section 14. */
1077 TIME RT
; /* In hundredths of seconds. */
1078 TIME IRT
; /* In hundredths of seconds. */
1079 TIME MRC
; /* Count. */
1080 TIME MRT
; /* In hundredths of seconds. */
1081 TIME MRD
; /* In seconds, relative. */
1082 TIME next_MRD
; /* In seconds, absolute. */
1084 /* Rather than a state, we use a function that shifts around
1085 * depending what stage of life the v6 state machine is in.
1086 * This is where incoming packets are dispatched to (sometimes
1089 void (*v6_handler
)(struct packet
*, struct client_state
*);
1092 struct envadd_state
{
1093 struct client_state
*client
;
1097 struct dns_update_state
{
1098 struct client_state
*client
;
1099 struct iaddr address
;
1100 int dns_update_timeout
;
1103 /* Information about each network interface. */
1105 struct interface_info
{
1106 OMAPI_OBJECT_PREAMBLE
;
1107 struct interface_info
*next
; /* Next interface in list... */
1108 struct shared_network
*shared_network
;
1109 /* Networks connected to this interface. */
1110 struct hardware hw_address
; /* Its physical address. */
1111 struct in_addr
*addresses
; /* Addresses associated with this
1114 int address_count
; /* Number of addresses stored. */
1115 int address_max
; /* Size of addresses buffer. */
1116 struct in6_addr
*v6addresses
; /* IPv6 addresses associated with
1118 int v6address_count
; /* Number of IPv6 addresses associated
1119 with this interface. */
1120 int v6address_max
; /* Maximum number of IPv6 addresses
1121 we can store in current buffer. */
1123 u_int8_t
*circuit_id
; /* Circuit ID associated with this
1125 unsigned circuit_id_len
; /* Length of Circuit ID, if there
1127 u_int8_t
*remote_id
; /* Remote ID associated with this
1128 interface (if any). */
1129 unsigned remote_id_len
; /* Length of Remote ID. */
1131 char name
[IFNAMSIZ
]; /* Its name... */
1132 int index
; /* Its if_nametoindex(). */
1133 int rfdesc
; /* Its read file descriptor. */
1134 int wfdesc
; /* Its write file descriptor, if
1136 unsigned char *rbuf
; /* Read buffer, if required. */
1137 unsigned int rbuf_max
; /* Size of read buffer. */
1138 size_t rbuf_offset
; /* Current offset into buffer. */
1139 size_t rbuf_len
; /* Length of data in buffer. */
1141 struct ifreq
*ifp
; /* Pointer to ifreq struct. */
1142 int configured
; /* If set to 1, interface has at least
1143 * one valid IP address.
1145 u_int32_t flags
; /* Control flags... */
1146 #define INTERFACE_REQUESTED 1
1147 #define INTERFACE_AUTOMATIC 2
1148 #define INTERFACE_RUNNING 4
1149 #define INTERFACE_DOWNSTREAM 8
1150 #define INTERFACE_UPSTREAM 16
1151 #define INTERFACE_STREAMS (INTERFACE_DOWNSTREAM | INTERFACE_UPSTREAM)
1153 /* Only used by DHCP client code. */
1154 struct client_state
*client
;
1155 # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
1156 int dlpi_sap_length
;
1157 struct hardware dlpi_broadcast_addr
;
1158 # endif /* DLPI_SEND || DLPI_RECEIVE */
1159 struct hardware anycast_mac_addr
;
1162 struct hardware_link
{
1163 struct hardware_link
*next
;
1164 char name
[IFNAMSIZ
];
1165 struct hardware address
;
1169 struct leasequeue
*prev
;
1170 struct leasequeue
*next
;
1171 struct lease
*lease
;
1174 typedef void (*tvref_t
)(void *, void *, const char *, int);
1175 typedef void (*tvunref_t
)(void *, const char *, int);
1177 struct timeout
*next
;
1178 struct timeval when
;
1179 void (*func
) PROTO ((void *));
1186 struct eventqueue
*next
;
1187 void (*handler
)(void *);
1191 struct protocol
*next
;
1193 void (*handler
) PROTO ((struct protocol
*));
1197 struct dns_query
; /* forward */
1200 struct dns_wakeup
*next
; /* Next wakeup in chain. */
1201 void (*func
) PROTO ((struct dns_query
*));
1204 struct dns_question
{
1205 u_int16_t type
; /* Type of query. */
1206 u_int16_t
class; /* Class of query. */
1207 unsigned char data
[1]; /* Query data. */
1211 u_int16_t type
; /* Type of answer. */
1212 u_int16_t
class; /* Class of answer. */
1213 int count
; /* Number of answers. */
1214 unsigned char *answers
[1]; /* Pointers to answers. */
1218 struct dns_query
*next
; /* Next query in hash bucket. */
1219 u_int32_t hash
; /* Hash bucket index. */
1220 TIME expiry
; /* Query expiry time (zero if not yet
1222 u_int16_t id
; /* Query ID (also hash table index) */
1223 caddr_t waiters
; /* Pointer to list of things waiting
1226 struct dns_question
*question
; /* Question, internal format. */
1227 struct dns_answer
*answer
; /* Answer, internal format. */
1229 unsigned char *query
; /* Query formatted for DNS server. */
1230 unsigned len
; /* Length of entire query. */
1231 int sent
; /* The query has been sent. */
1232 struct dns_wakeup
*wakeups
; /* Wakeups to call if this query is
1234 struct name_server
*next_server
; /* Next server to try. */
1235 int backoff
; /* Current backoff, in seconds. */
1242 struct option_cache
*primary
;
1243 struct option_cache
*secondary
;
1244 struct auth_key
*key
;
1248 OMAPI_OBJECT_PREAMBLE
;
1250 void (*icmp_handler
) PROTO ((struct iaddr
, u_int8_t
*, int));
1255 /* Bitmask of dhcp option codes. */
1256 typedef unsigned char option_mask
[16];
1258 /* DHCP Option mask manipulation macros... */
1259 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
1260 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1261 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1262 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1263 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1265 /* An option occupies its length plus two header bytes (code and
1266 length) for every 255 bytes that must be stored. */
1267 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1269 /* Default path to dhcpd config file. */
1271 #undef _PATH_DHCPD_CONF
1272 #define _PATH_DHCPD_CONF "dhcpd.conf"
1273 #undef _PATH_DHCPD_DB
1274 #define _PATH_DHCPD_DB "dhcpd.leases"
1275 #undef _PATH_DHCPD6_DB
1276 #define _PATH_DHCPD6_DB "dhcpd6.leases"
1277 #undef _PATH_DHCPD_PID
1278 #define _PATH_DHCPD_PID "dhcpd.pid"
1279 #undef _PATH_DHCPD6_PID
1280 #define _PATH_DHCPD6_PID "dhcpd6.pid"
1283 #ifndef _PATH_DHCPD_CONF
1284 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
1287 #ifndef _PATH_DHCPD_DB
1288 #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
1291 #ifndef _PATH_DHCPD6_DB
1292 #define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
1295 #ifndef _PATH_DHCPD_PID
1296 #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
1299 #ifndef _PATH_DHCPD6_PID
1300 #define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid"
1305 #ifndef _PATH_DHCLIENT_CONF
1306 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
1309 #ifndef _PATH_DHCLIENT_SCRIPT
1310 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
1313 #ifndef _PATH_DHCLIENT_PID
1314 #define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid"
1317 #ifndef _PATH_DHCLIENT6_PID
1318 #define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid"
1321 #ifndef _PATH_DHCLIENT_DB
1322 #define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
1325 #ifndef _PATH_DHCLIENT6_DB
1326 #define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
1329 #ifndef _PATH_RESOLV_CONF
1330 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
1333 #ifndef _PATH_DHCRELAY_PID
1334 #define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid"
1337 #ifndef _PATH_DHCRELAY6_PID
1338 #define _PATH_DHCRELAY6_PID LOCALSTATEDIR"/run/dhcrelay6.pid"
1341 #ifndef DHCPD_LOG_FACILITY
1342 #define DHCPD_LOG_FACILITY LOG_DAEMON
1345 #define MAX_TIME 0x7fffffff
1348 /* these are referenced */
1349 typedef struct hash_table ia_hash_t
;
1350 typedef struct hash_table iasubopt_hash_t
;
1352 /* IAADDR/IAPREFIX lease */
1355 int refcnt
; /* reference count */
1356 struct in6_addr addr
; /* IPv6 address/prefix */
1357 u_int8_t plen
; /* iaprefix prefix length */
1358 binding_state_t state
; /* state */
1359 struct binding_scope
*scope
; /* "set var = value;" */
1360 time_t hard_lifetime_end_time
; /* time address expires */
1361 time_t soft_lifetime_end_time
; /* time ephemeral expires */
1362 u_int32_t prefer
; /* cached preferred lifetime */
1363 u_int32_t valid
; /* cached valid lifetime */
1364 struct ia_xx
*ia
; /* IA for this lease */
1365 struct ipv6_pool
*ipv6_pool
; /* pool for this lease */
1367 * For now, just pick an arbitrary time to keep old hard leases
1368 * around (value in seconds).
1370 #define EXPIRED_IPV6_CLEANUP_TIME (60*60)
1372 int heap_index
; /* index into heap, or -1
1373 (internal use only) */
1377 int refcnt
; /* reference count */
1378 struct data_string iaid_duid
; /* from the client */
1379 u_int16_t ia_type
; /* IA_XX */
1380 int num_iasubopt
; /* number of IAADDR/PREFIX */
1381 int max_iasubopt
; /* space available for IAADDR/PREFIX */
1382 time_t cltt
; /* client last transaction time */
1383 struct iasubopt
**iasubopt
; /* pointers to the IAADDR/IAPREFIXs */
1386 extern ia_hash_t
*ia_na_active
;
1387 extern ia_hash_t
*ia_ta_active
;
1388 extern ia_hash_t
*ia_pd_active
;
1391 int refcnt
; /* reference count */
1392 u_int16_t pool_type
; /* IA_xx */
1393 struct in6_addr start_addr
; /* first IPv6 address */
1394 int bits
; /* number of bits, CIDR style */
1395 int units
; /* allocation unit in bits */
1396 iasubopt_hash_t
*leases
; /* non-free leases */
1397 int num_active
; /* count of active leases */
1398 isc_heap_t
*active_timeouts
; /* timeouts for active leases */
1399 int num_inactive
; /* count of inactive leases */
1400 isc_heap_t
*inactive_timeouts
; /* timeouts for expired or
1402 struct shared_network
*shared_network
; /* shared_network for
1404 struct subnet
*subnet
; /* subnet for this pool */
1407 extern struct ipv6_pool
**pools
;
1408 extern int num_pools
;
1410 /* External definitions... */
1412 HASH_FUNCTIONS_DECL (group
, const char *, struct group_object
, group_hash_t
)
1413 HASH_FUNCTIONS_DECL (universe
, const char *, struct universe
, universe_hash_t
)
1414 HASH_FUNCTIONS_DECL (option_name
, const char *, struct option
,
1416 HASH_FUNCTIONS_DECL (option_code
, const unsigned *, struct option
,
1418 HASH_FUNCTIONS_DECL (dns_zone
, const char *, struct dns_zone
, dns_zone_hash_t
)
1419 HASH_FUNCTIONS_DECL(lease_ip
, const unsigned char *, struct lease
,
1421 HASH_FUNCTIONS_DECL(lease_id
, const unsigned char *, struct lease
,
1423 HASH_FUNCTIONS_DECL (host
, const unsigned char *, struct host_decl
, host_hash_t
)
1424 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t
)
1428 extern struct option
*vendor_cfg_option
;
1429 int parse_options
PROTO ((struct packet
*));
1430 int parse_option_buffer
PROTO ((struct option_state
*, const unsigned char *,
1431 unsigned, struct universe
*));
1432 struct universe
*find_option_universe (struct option
*, const char *);
1433 int parse_encapsulated_suboptions (struct option_state
*, struct option
*,
1434 const unsigned char *, unsigned,
1435 struct universe
*, const char *);
1436 int cons_options
PROTO ((struct packet
*, struct dhcp_packet
*, struct lease
*,
1437 struct client_state
*,
1438 int, struct option_state
*, struct option_state
*,
1439 struct binding_scope
**,
1440 int, int, int, struct data_string
*, const char *));
1441 int fqdn_universe_decode (struct option_state
*,
1442 const unsigned char *, unsigned, struct universe
*);
1443 struct option_cache
*
1444 lookup_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1447 save_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1448 struct option_cache
*oc
, isc_boolean_t appendp
);
1450 delete_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1453 fqdn6_option_space_foreach(struct packet
*packet
, struct lease
*lease
,
1454 struct client_state
*client_state
,
1455 struct option_state
*in_options
,
1456 struct option_state
*cfg_options
,
1457 struct binding_scope
**scope
,
1458 struct universe
*u
, void *stuff
,
1459 void (*func
)(struct option_cache
*,
1462 struct client_state
*,
1463 struct option_state
*,
1464 struct option_state
*,
1465 struct binding_scope
**,
1466 struct universe
*, void *));
1468 fqdn6_option_space_encapsulate(struct data_string
*result
,
1469 struct packet
*packet
, struct lease
*lease
,
1470 struct client_state
*client_state
,
1471 struct option_state
*in_options
,
1472 struct option_state
*cfg_options
,
1473 struct binding_scope
**scope
,
1474 struct universe
*universe
);
1476 fqdn6_universe_decode(struct option_state
*options
,
1477 const unsigned char *buffer
, unsigned length
,
1478 struct universe
*u
);
1479 int append_option(struct data_string
*dst
, struct universe
*universe
,
1480 struct option
*option
, struct data_string
*src
);
1482 store_options(int *ocount
,
1483 unsigned char *buffer
, unsigned buflen
, unsigned index
,
1484 struct packet
*packet
, struct lease
*lease
,
1485 struct client_state
*client_state
,
1486 struct option_state
*in_options
,
1487 struct option_state
*cfg_options
,
1488 struct binding_scope
**scope
,
1489 unsigned *priority_list
, int priority_len
,
1490 unsigned first_cutoff
, int second_cutoff
, int terminate
,
1491 const char *vuname
);
1492 int store_options6(char *, int, struct option_state
*, struct packet
*,
1493 const int *, struct data_string
*);
1494 int format_has_text(const char *);
1495 int format_min_length(const char *, struct option_cache
*);
1496 const char *pretty_print_option
PROTO ((struct option
*, const unsigned char *,
1497 unsigned, int, int));
1498 int pretty_escape(char **, char *, const unsigned char **,
1499 const unsigned char *);
1500 int get_option (struct data_string
*, struct universe
*,
1501 struct packet
*, struct lease
*, struct client_state
*,
1502 struct option_state
*, struct option_state
*,
1503 struct option_state
*, struct binding_scope
**, unsigned,
1505 void set_option (struct universe
*, struct option_state
*,
1506 struct option_cache
*, enum statement_op
);
1507 struct option_cache
*lookup_option
PROTO ((struct universe
*,
1508 struct option_state
*, unsigned));
1509 struct option_cache
*lookup_hashed_option
PROTO ((struct universe
*,
1510 struct option_state
*,
1512 struct option_cache
*next_hashed_option(struct universe
*,
1513 struct option_state
*,
1514 struct option_cache
*);
1515 int save_option_buffer (struct universe
*, struct option_state
*,
1516 struct buffer
*, unsigned char *, unsigned,
1518 int append_option_buffer(struct universe
*, struct option_state
*,
1519 struct buffer
*, unsigned char *, unsigned,
1521 void build_server_oro(struct data_string
*, struct option_state
*,
1523 void save_option(struct universe
*, struct option_state
*,
1524 struct option_cache
*);
1525 void also_save_option(struct universe
*, struct option_state
*,
1526 struct option_cache
*);
1527 void save_hashed_option(struct universe
*, struct option_state
*,
1528 struct option_cache
*, isc_boolean_t appendp
);
1529 void delete_option
PROTO ((struct universe
*, struct option_state
*, int));
1530 void delete_hashed_option
PROTO ((struct universe
*,
1531 struct option_state
*, int));
1532 int option_cache_dereference
PROTO ((struct option_cache
**,
1533 const char *, int));
1534 int hashed_option_state_dereference
PROTO ((struct universe
*,
1535 struct option_state
*,
1536 const char *, int));
1537 int store_option
PROTO ((struct data_string
*,
1538 struct universe
*, struct packet
*, struct lease
*,
1539 struct client_state
*,
1540 struct option_state
*, struct option_state
*,
1541 struct binding_scope
**, struct option_cache
*));
1542 int option_space_encapsulate
PROTO ((struct data_string
*,
1543 struct packet
*, struct lease
*,
1544 struct client_state
*,
1545 struct option_state
*,
1546 struct option_state
*,
1547 struct binding_scope
**,
1548 struct data_string
*));
1549 int hashed_option_space_encapsulate
PROTO ((struct data_string
*,
1550 struct packet
*, struct lease
*,
1551 struct client_state
*,
1552 struct option_state
*,
1553 struct option_state
*,
1554 struct binding_scope
**,
1555 struct universe
*));
1556 int nwip_option_space_encapsulate
PROTO ((struct data_string
*,
1557 struct packet
*, struct lease
*,
1558 struct client_state
*,
1559 struct option_state
*,
1560 struct option_state
*,
1561 struct binding_scope
**,
1562 struct universe
*));
1563 int fqdn_option_space_encapsulate (struct data_string
*,
1564 struct packet
*, struct lease
*,
1565 struct client_state
*,
1566 struct option_state
*,
1567 struct option_state
*,
1568 struct binding_scope
**,
1570 void suboption_foreach (struct packet
*, struct lease
*, struct client_state
*,
1571 struct option_state
*, struct option_state
*,
1572 struct binding_scope
**, struct universe
*, void *,
1573 void (*) (struct option_cache
*, struct packet
*,
1574 struct lease
*, struct client_state
*,
1575 struct option_state
*, struct option_state
*,
1576 struct binding_scope
**,
1577 struct universe
*, void *),
1578 struct option_cache
*, const char *);
1579 void option_space_foreach (struct packet
*, struct lease
*,
1580 struct client_state
*,
1581 struct option_state
*,
1582 struct option_state
*,
1583 struct binding_scope
**,
1584 struct universe
*, void *,
1585 void (*) (struct option_cache
*,
1587 struct lease
*, struct client_state
*,
1588 struct option_state
*,
1589 struct option_state
*,
1590 struct binding_scope
**,
1591 struct universe
*, void *));
1592 void hashed_option_space_foreach (struct packet
*, struct lease
*,
1593 struct client_state
*,
1594 struct option_state
*,
1595 struct option_state
*,
1596 struct binding_scope
**,
1597 struct universe
*, void *,
1598 void (*) (struct option_cache
*,
1601 struct client_state
*,
1602 struct option_state
*,
1603 struct option_state
*,
1604 struct binding_scope
**,
1605 struct universe
*, void *));
1606 int linked_option_get
PROTO ((struct data_string
*, struct universe
*,
1607 struct packet
*, struct lease
*,
1608 struct client_state
*,
1609 struct option_state
*, struct option_state
*,
1610 struct option_state
*, struct binding_scope
**,
1612 int linked_option_state_dereference
PROTO ((struct universe
*,
1613 struct option_state
*,
1614 const char *, int));
1615 void save_linked_option(struct universe
*, struct option_state
*,
1616 struct option_cache
*, isc_boolean_t appendp
);
1617 void linked_option_space_foreach (struct packet
*, struct lease
*,
1618 struct client_state
*,
1619 struct option_state
*,
1620 struct option_state
*,
1621 struct binding_scope
**,
1622 struct universe
*, void *,
1623 void (*) (struct option_cache
*,
1626 struct client_state
*,
1627 struct option_state
*,
1628 struct option_state
*,
1629 struct binding_scope
**,
1630 struct universe
*, void *));
1631 int linked_option_space_encapsulate (struct data_string
*, struct packet
*,
1632 struct lease
*, struct client_state
*,
1633 struct option_state
*,
1634 struct option_state
*,
1635 struct binding_scope
**,
1637 void delete_linked_option (struct universe
*, struct option_state
*, int);
1638 struct option_cache
*lookup_linked_option (struct universe
*,
1639 struct option_state
*, unsigned);
1640 void do_packet
PROTO ((struct interface_info
*,
1641 struct dhcp_packet
*, unsigned,
1642 unsigned int, struct iaddr
, struct hardware
*));
1643 void do_packet6(struct interface_info
*, const char *,
1644 int, int, const struct iaddr
*, isc_boolean_t
);
1645 int packet6_len_okay(const char *, int);
1647 int add_option(struct option_state
*options
,
1648 unsigned int option_num
,
1650 unsigned int data_len
);
1653 extern struct timeval cur_tv
;
1654 #define cur_time cur_tv.tv_sec
1656 extern int ddns_update_style
;
1658 extern const char *path_dhcpd_conf
;
1659 extern const char *path_dhcpd_db
;
1660 extern const char *path_dhcpd_pid
;
1662 extern int dhcp_max_agent_option_packet_length
;
1663 extern struct eventqueue
*rw_queue_empty
;
1665 int main(int, char **);
1666 void postconf_initialization(int);
1667 void postdb_startup(void);
1668 void cleanup
PROTO ((void));
1669 void lease_pinged
PROTO ((struct iaddr
, u_int8_t
*, int));
1670 void lease_ping_timeout
PROTO ((void *));
1671 int dhcpd_interface_setup_hook (struct interface_info
*ip
, struct iaddr
*ia
);
1672 extern enum dhcp_shutdown_state shutdown_state
;
1673 isc_result_t
dhcp_io_shutdown (omapi_object_t
*, void *);
1674 isc_result_t
dhcp_set_control_state (control_object_state_t oldstate
,
1675 control_object_state_t newstate
);
1676 #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1677 void relinquish_ackqueue(void);
1681 isc_result_t new_parse
PROTO ((struct parse
**, int,
1682 char *, unsigned, const char *, int));
1683 isc_result_t end_parse
PROTO ((struct parse
**));
1684 isc_result_t
save_parse_state(struct parse
*cfile
);
1685 isc_result_t
restore_parse_state(struct parse
*cfile
);
1686 enum dhcp_token next_token
PROTO ((const char **, unsigned *, struct parse
*));
1687 enum dhcp_token peek_token
PROTO ((const char **, unsigned *, struct parse
*));
1688 enum dhcp_token
next_raw_token(const char **rval
, unsigned *rlen
,
1689 struct parse
*cfile
);
1690 enum dhcp_token
peek_raw_token(const char **rval
, unsigned *rlen
,
1691 struct parse
*cfile
);
1694 void parse_trace_setup (void);
1695 isc_result_t readconf
PROTO ((void));
1696 isc_result_t
read_conf_file (const char *, struct group
*, int, int);
1697 #if defined (TRACING)
1698 void trace_conf_input (trace_type_t
*, unsigned, char *);
1699 void trace_conf_stop (trace_type_t
*ttype
);
1701 isc_result_t
conf_file_subparse (struct parse
*, struct group
*, int);
1702 isc_result_t
lease_file_subparse (struct parse
*);
1703 int parse_statement
PROTO ((struct parse
*,
1704 struct group
*, int, struct host_decl
*, int));
1705 #if defined (FAILOVER_PROTOCOL)
1706 void parse_failover_peer
PROTO ((struct parse
*, struct group
*, int));
1707 void parse_failover_state_declaration (struct parse
*,
1708 dhcp_failover_state_t
*);
1709 void parse_failover_state
PROTO ((struct parse
*,
1710 enum failover_state
*, TIME
*));
1712 int permit_list_match (struct permit
*, struct permit
*);
1713 void parse_pool_statement
PROTO ((struct parse
*, struct group
*, int));
1714 int parse_boolean
PROTO ((struct parse
*));
1715 int parse_lbrace
PROTO ((struct parse
*));
1716 void parse_host_declaration
PROTO ((struct parse
*, struct group
*));
1717 int parse_class_declaration
PROTO ((struct class **, struct parse
*,
1718 struct group
*, int));
1719 void parse_shared_net_declaration
PROTO ((struct parse
*, struct group
*));
1720 void parse_subnet_declaration
PROTO ((struct parse
*,
1721 struct shared_network
*));
1722 void parse_subnet6_declaration
PROTO ((struct parse
*,
1723 struct shared_network
*));
1724 void parse_group_declaration
PROTO ((struct parse
*, struct group
*));
1725 int parse_fixed_addr_param
PROTO ((struct option_cache
**,
1726 struct parse
*, enum dhcp_token
));
1727 int parse_lease_declaration
PROTO ((struct lease
**, struct parse
*));
1728 int parse_ip6_addr(struct parse
*, struct iaddr
*);
1729 int parse_ip6_addr_expr(struct expression
**, struct parse
*);
1730 int parse_ip6_prefix(struct parse
*, struct iaddr
*, u_int8_t
*);
1731 void parse_address_range
PROTO ((struct parse
*, struct group
*, int,
1732 struct pool
*, struct lease
**));
1733 void parse_address_range6(struct parse
*cfile
, struct group
*group
);
1734 void parse_prefix6(struct parse
*cfile
, struct group
*group
);
1735 void parse_fixed_prefix6(struct parse
*cfile
, struct host_decl
*host_decl
);
1736 void parse_ia_na_declaration(struct parse
*);
1737 void parse_ia_ta_declaration(struct parse
*);
1738 void parse_ia_pd_declaration(struct parse
*);
1739 void parse_server_duid(struct parse
*cfile
);
1740 void parse_server_duid_conf(struct parse
*cfile
);
1743 int ddns_updates(struct packet
*, struct lease
*, struct lease
*,
1744 struct iasubopt
*, struct iasubopt
*, struct option_state
*);
1745 int ddns_removals(struct lease
*, struct iasubopt
*);
1748 void add_enumeration (struct enumeration
*);
1749 struct enumeration
*find_enumeration (const char *, int);
1750 struct enumeration_value
*find_enumeration_value (const char *, int,
1753 void skip_to_semi
PROTO ((struct parse
*));
1754 void skip_to_rbrace
PROTO ((struct parse
*, int));
1755 int parse_semi
PROTO ((struct parse
*));
1756 int parse_string
PROTO ((struct parse
*, char **, unsigned *));
1757 char *parse_host_name
PROTO ((struct parse
*));
1758 int parse_ip_addr_or_hostname
PROTO ((struct expression
**,
1759 struct parse
*, int));
1760 void parse_hardware_param
PROTO ((struct parse
*, struct hardware
*));
1761 void parse_lease_time
PROTO ((struct parse
*, TIME
*));
1762 unsigned char *parse_numeric_aggregate
PROTO ((struct parse
*,
1763 unsigned char *, unsigned *,
1764 int, int, unsigned));
1765 void convert_num
PROTO ((struct parse
*, unsigned char *, const char *,
1767 TIME parse_date
PROTO ((struct parse
*));
1768 TIME
parse_date_core(struct parse
*);
1769 isc_result_t parse_option_name
PROTO ((struct parse
*, int, int *,
1771 void parse_option_space_decl
PROTO ((struct parse
*));
1772 int parse_option_code_definition
PROTO ((struct parse
*, struct option
*));
1773 int parse_base64 (struct data_string
*, struct parse
*);
1774 int parse_cshl
PROTO ((struct data_string
*, struct parse
*));
1775 int parse_executable_statement
PROTO ((struct executable_statement
**,
1776 struct parse
*, int *,
1777 enum expression_context
));
1778 int parse_executable_statements
PROTO ((struct executable_statement
**,
1779 struct parse
*, int *,
1780 enum expression_context
));
1781 int parse_zone (struct dns_zone
*, struct parse
*);
1782 int parse_key (struct parse
*);
1783 int parse_on_statement
PROTO ((struct executable_statement
**,
1784 struct parse
*, int *));
1785 int parse_switch_statement
PROTO ((struct executable_statement
**,
1786 struct parse
*, int *));
1787 int parse_case_statement
PROTO ((struct executable_statement
**,
1788 struct parse
*, int *,
1789 enum expression_context
));
1790 int parse_if_statement
PROTO ((struct executable_statement
**,
1791 struct parse
*, int *));
1792 int parse_boolean_expression
PROTO ((struct expression
**,
1793 struct parse
*, int *));
1794 int parse_data_expression
PROTO ((struct expression
**,
1795 struct parse
*, int *));
1796 int parse_numeric_expression
PROTO ((struct expression
**,
1797 struct parse
*, int *));
1798 int parse_dns_expression
PROTO ((struct expression
**, struct parse
*, int *));
1799 int parse_non_binary
PROTO ((struct expression
**, struct parse
*, int *,
1800 enum expression_context
));
1801 int parse_expression
PROTO ((struct expression
**, struct parse
*, int *,
1802 enum expression_context
,
1803 struct expression
**, enum expr_op
));
1804 int parse_option_data(struct expression
**expr
, struct parse
*cfile
,
1805 int lookups
, struct option
*option
);
1806 int parse_option_statement
PROTO ((struct executable_statement
**,
1807 struct parse
*, int,
1808 struct option
*, enum statement_op
));
1809 int parse_option_token
PROTO ((struct expression
**, struct parse
*,
1810 const char **, struct expression
*, int, int));
1811 int parse_allow_deny
PROTO ((struct option_cache
**, struct parse
*, int));
1812 int parse_auth_key
PROTO ((struct data_string
*, struct parse
*));
1813 int parse_warn (struct parse
*, const char *, ...)
1814 __attribute__((__format__(__printf__
,2,3)));
1815 struct expression
*parse_domain_list(struct parse
*cfile
, int);
1819 #if defined (NSUPDATE)
1820 extern struct __res_state resolver_state
;
1821 extern int resolver_inited
;
1824 extern struct binding_scope
*global_scope
;
1825 pair cons
PROTO ((caddr_t
, pair
));
1826 int make_const_option_cache
PROTO ((struct option_cache
**, struct buffer
**,
1827 u_int8_t
*, unsigned, struct option
*,
1828 const char *, int));
1829 int make_host_lookup
PROTO ((struct expression
**, const char *));
1830 int enter_dns_host
PROTO ((struct dns_host_entry
**, const char *));
1831 int make_const_data (struct expression
**,
1832 const unsigned char *, unsigned, int, int,
1834 int make_const_int
PROTO ((struct expression
**, unsigned long));
1835 int make_concat
PROTO ((struct expression
**,
1836 struct expression
*, struct expression
*));
1837 int make_encapsulation
PROTO ((struct expression
**, struct data_string
*));
1838 int make_substring
PROTO ((struct expression
**, struct expression
*,
1839 struct expression
*, struct expression
*));
1840 int make_limit
PROTO ((struct expression
**, struct expression
*, int));
1841 int make_let
PROTO ((struct executable_statement
**, const char *));
1842 int option_cache
PROTO ((struct option_cache
**, struct data_string
*,
1843 struct expression
*, struct option
*,
1844 const char *, int));
1845 int evaluate_expression (struct binding_value
**, struct packet
*,
1846 struct lease
*, struct client_state
*,
1847 struct option_state
*, struct option_state
*,
1848 struct binding_scope
**, struct expression
*,
1850 int binding_value_dereference (struct binding_value
**, const char *, int);
1851 #if defined (NSUPDATE)
1852 int evaluate_dns_expression
PROTO ((ns_updrec
**, struct packet
*,
1854 struct client_state
*,
1855 struct option_state
*,
1856 struct option_state
*,
1857 struct binding_scope
**,
1858 struct expression
*));
1860 int evaluate_boolean_expression
PROTO ((int *,
1861 struct packet
*, struct lease
*,
1862 struct client_state
*,
1863 struct option_state
*,
1864 struct option_state
*,
1865 struct binding_scope
**,
1866 struct expression
*));
1867 int evaluate_data_expression
PROTO ((struct data_string
*,
1868 struct packet
*, struct lease
*,
1869 struct client_state
*,
1870 struct option_state
*,
1871 struct option_state
*,
1872 struct binding_scope
**,
1873 struct expression
*, const char *, int));
1874 int evaluate_numeric_expression (unsigned long *, struct packet
*,
1875 struct lease
*, struct client_state
*,
1876 struct option_state
*, struct option_state
*,
1877 struct binding_scope
**,
1878 struct expression
*);
1879 int evaluate_option_cache
PROTO ((struct data_string
*,
1880 struct packet
*, struct lease
*,
1881 struct client_state
*,
1882 struct option_state
*, struct option_state
*,
1883 struct binding_scope
**,
1884 struct option_cache
*,
1885 const char *, int));
1886 int evaluate_boolean_option_cache
PROTO ((int *,
1887 struct packet
*, struct lease
*,
1888 struct client_state
*,
1889 struct option_state
*,
1890 struct option_state
*,
1891 struct binding_scope
**,
1892 struct option_cache
*,
1893 const char *, int));
1894 int evaluate_boolean_expression_result
PROTO ((int *,
1895 struct packet
*, struct lease
*,
1896 struct client_state
*,
1897 struct option_state
*,
1898 struct option_state
*,
1899 struct binding_scope
**,
1900 struct expression
*));
1901 void expression_dereference
PROTO ((struct expression
**, const char *, int));
1902 int is_dns_expression
PROTO ((struct expression
*));
1903 int is_boolean_expression
PROTO ((struct expression
*));
1904 int is_data_expression
PROTO ((struct expression
*));
1905 int is_numeric_expression
PROTO ((struct expression
*));
1906 int is_compound_expression
PROTO ((struct expression
*));
1907 int op_precedence
PROTO ((enum expr_op
, enum expr_op
));
1908 enum expression_context
expression_context (struct expression
*);
1909 enum expression_context op_context
PROTO ((enum expr_op
));
1910 int write_expression
PROTO ((FILE *, struct expression
*, int, int, int));
1911 struct binding
*find_binding
PROTO ((struct binding_scope
*, const char *));
1912 int free_bindings
PROTO ((struct binding_scope
*, const char *, int));
1913 int binding_scope_dereference
PROTO ((struct binding_scope
**,
1914 const char *, int));
1915 int fundef_dereference (struct fundef
**, const char *, int);
1916 int data_subexpression_length (int *, struct expression
*);
1917 int expr_valid_for_context (struct expression
*, enum expression_context
);
1918 struct binding
*create_binding (struct binding_scope
**, const char *);
1919 int bind_ds_value (struct binding_scope
**,
1920 const char *, struct data_string
*);
1921 int find_bound_string (struct data_string
*,
1922 struct binding_scope
*, const char *);
1923 int unset (struct binding_scope
*, const char *);
1924 int data_string_sprintfa(struct data_string
*ds
, const char *fmt
, ...);
1927 extern int outstanding_pings
;
1928 extern int max_outstanding_acks
;
1929 extern int max_ack_delay_secs
;
1930 extern int max_ack_delay_usecs
;
1932 void dhcp
PROTO ((struct packet
*));
1933 void dhcpdiscover
PROTO ((struct packet
*, int));
1934 void dhcprequest
PROTO ((struct packet
*, int, struct lease
*));
1935 void dhcprelease
PROTO ((struct packet
*, int));
1936 void dhcpdecline
PROTO ((struct packet
*, int));
1937 void dhcpinform
PROTO ((struct packet
*, int));
1938 void nak_lease
PROTO ((struct packet
*, struct iaddr
*cip
));
1939 void ack_lease
PROTO ((struct packet
*, struct lease
*,
1940 unsigned int, TIME
, char *, int, struct host_decl
*));
1941 void delayed_ack_enqueue(struct lease
*);
1942 void commit_leases_readerdry(void *);
1943 void flush_ackqueue(void *);
1944 void dhcp_reply
PROTO ((struct lease
*));
1945 int find_lease
PROTO ((struct lease
**, struct packet
*,
1946 struct shared_network
*, int *, int *, struct lease
*,
1947 const char *, int));
1948 int mockup_lease
PROTO ((struct lease
**, struct packet
*,
1949 struct shared_network
*,
1950 struct host_decl
*));
1951 void static_lease_dereference
PROTO ((struct lease
*, const char *, int));
1953 int allocate_lease
PROTO ((struct lease
**, struct packet
*,
1954 struct pool
*, int *));
1955 int permitted
PROTO ((struct packet
*, struct permit
*));
1956 int locate_network
PROTO ((struct packet
*));
1957 int parse_agent_information_option
PROTO ((struct packet
*, int, u_int8_t
*));
1958 unsigned cons_agent_information_options
PROTO ((struct option_state
*,
1959 struct dhcp_packet
*,
1960 unsigned, unsigned));
1961 void get_server_source_address(struct in_addr
*from
,
1962 struct option_state
*options
,
1963 struct packet
*packet
);
1965 /* dhcpleasequery.c */
1966 void dhcpleasequery
PROTO ((struct packet
*, int));
1967 void dhcpv6_leasequery
PROTO ((struct data_string
*, struct packet
*));
1970 isc_boolean_t
server_duid_isset(void);
1971 void copy_server_duid(struct data_string
*ds
, const char *file
, int line
);
1972 void set_server_duid(struct data_string
*new_duid
);
1973 isc_result_t
set_server_duid_from_option(void);
1974 void set_server_duid_type(int type
);
1975 isc_result_t
generate_new_server_duid(void);
1976 isc_result_t
get_client_id(struct packet
*, struct data_string
*);
1977 void dhcpv6(struct packet
*);
1980 void bootp
PROTO ((struct packet
*));
1983 extern int (*group_write_hook
) (struct group_object
*);
1984 extern struct group
*root_group
;
1985 extern group_hash_t
*group_name_hash
;
1986 isc_result_t
delete_group (struct group_object
*, int);
1987 isc_result_t
supersede_group (struct group_object
*, int);
1988 int clone_group (struct group
**, struct group
*, const char *, int);
1989 int write_group
PROTO ((struct group_object
*));
1992 void relinquish_lease_hunks (void);
1993 struct lease
*new_leases
PROTO ((unsigned, const char *, int));
1994 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1995 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1996 void relinquish_free_lease_states (void);
1998 OMAPI_OBJECT_ALLOC_DECL (lease
, struct lease
, dhcp_type_lease
)
1999 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class
)
2000 OMAPI_OBJECT_ALLOC_DECL (subclass
, struct class, dhcp_type_subclass
)
2001 OMAPI_OBJECT_ALLOC_DECL (pool
, struct pool
, dhcp_type_pool
)
2002 OMAPI_OBJECT_ALLOC_DECL (host
, struct host_decl
, dhcp_type_host
)
2005 OMAPI_OBJECT_ALLOC_DECL (subnet
, struct subnet
, dhcp_type_subnet
)
2006 OMAPI_OBJECT_ALLOC_DECL (shared_network
, struct shared_network
,
2007 dhcp_type_shared_network
)
2008 OMAPI_OBJECT_ALLOC_DECL (group_object
, struct group_object
, dhcp_type_group
)
2009 OMAPI_OBJECT_ALLOC_DECL (dhcp_control
,
2010 dhcp_control_object_t
, dhcp_type_control
)
2012 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2013 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2014 void relinquish_free_pairs (void);
2015 void relinquish_free_expressions (void);
2016 void relinquish_free_binding_values (void);
2017 void relinquish_free_option_caches (void);
2018 void relinquish_free_packets (void);
2021 int option_chain_head_allocate (struct option_chain_head
**,
2023 int option_chain_head_reference (struct option_chain_head
**,
2024 struct option_chain_head
*,
2026 int option_chain_head_dereference (struct option_chain_head
**,
2028 int group_allocate (struct group
**, const char *, int);
2029 int group_reference (struct group
**, struct group
*, const char *, int);
2030 int group_dereference (struct group
**, const char *, int);
2031 struct dhcp_packet
*new_dhcp_packet
PROTO ((const char *, int));
2032 struct protocol
*new_protocol
PROTO ((const char *, int));
2033 struct lease_state
*new_lease_state
PROTO ((const char *, int));
2034 struct domain_search_list
*new_domain_search_list
PROTO ((const char *, int));
2035 struct name_server
*new_name_server
PROTO ((const char *, int));
2036 void free_name_server
PROTO ((struct name_server
*, const char *, int));
2037 struct option
*new_option
PROTO ((const char *, const char *, int));
2038 int option_reference(struct option
**dest
, struct option
*src
,
2039 const char * file
, int line
);
2040 int option_dereference(struct option
**dest
, const char *file
, int line
);
2041 struct universe
*new_universe
PROTO ((const char *, int));
2042 void free_universe
PROTO ((struct universe
*, const char *, int));
2043 void free_domain_search_list
PROTO ((struct domain_search_list
*,
2044 const char *, int));
2045 void free_lease_state
PROTO ((struct lease_state
*, const char *, int));
2046 void free_protocol
PROTO ((struct protocol
*, const char *, int));
2047 void free_dhcp_packet
PROTO ((struct dhcp_packet
*, const char *, int));
2048 struct client_lease
*new_client_lease
PROTO ((const char *, int));
2049 void free_client_lease
PROTO ((struct client_lease
*, const char *, int));
2050 struct permit
*new_permit
PROTO ((const char *, int));
2051 void free_permit
PROTO ((struct permit
*, const char *, int));
2052 pair new_pair
PROTO ((const char *, int));
2053 void free_pair
PROTO ((pair
, const char *, int));
2054 int expression_allocate
PROTO ((struct expression
**, const char *, int));
2055 int expression_reference
PROTO ((struct expression
**,
2056 struct expression
*, const char *, int));
2057 void free_expression
PROTO ((struct expression
*, const char *, int));
2058 int binding_value_allocate
PROTO ((struct binding_value
**,
2059 const char *, int));
2060 int binding_value_reference
PROTO ((struct binding_value
**,
2061 struct binding_value
*,
2062 const char *, int));
2063 void free_binding_value
PROTO ((struct binding_value
*, const char *, int));
2064 int fundef_allocate
PROTO ((struct fundef
**, const char *, int));
2065 int fundef_reference
PROTO ((struct fundef
**,
2066 struct fundef
*, const char *, int));
2067 int option_cache_allocate
PROTO ((struct option_cache
**, const char *, int));
2068 int option_cache_reference
PROTO ((struct option_cache
**,
2069 struct option_cache
*, const char *, int));
2070 int buffer_allocate
PROTO ((struct buffer
**, unsigned, const char *, int));
2071 int buffer_reference
PROTO ((struct buffer
**, struct buffer
*,
2072 const char *, int));
2073 int buffer_dereference
PROTO ((struct buffer
**, const char *, int));
2074 int dns_host_entry_allocate
PROTO ((struct dns_host_entry
**,
2075 const char *, const char *, int));
2076 int dns_host_entry_reference
PROTO ((struct dns_host_entry
**,
2077 struct dns_host_entry
*,
2078 const char *, int));
2079 int dns_host_entry_dereference
PROTO ((struct dns_host_entry
**,
2080 const char *, int));
2081 int option_state_allocate
PROTO ((struct option_state
**, const char *, int));
2082 int option_state_reference
PROTO ((struct option_state
**,
2083 struct option_state
*, const char *, int));
2084 int option_state_dereference
PROTO ((struct option_state
**,
2085 const char *, int));
2086 void data_string_copy(struct data_string
*, const struct data_string
*,
2088 void data_string_forget
PROTO ((struct data_string
*, const char *, int));
2089 void data_string_truncate
PROTO ((struct data_string
*, int));
2090 int executable_statement_allocate
PROTO ((struct executable_statement
**,
2091 const char *, int));
2092 int executable_statement_reference
PROTO ((struct executable_statement
**,
2093 struct executable_statement
*,
2094 const char *, int));
2095 int packet_allocate
PROTO ((struct packet
**, const char *, int));
2096 int packet_reference
PROTO ((struct packet
**,
2097 struct packet
*, const char *, int));
2098 int packet_dereference
PROTO ((struct packet
**, const char *, int));
2099 int binding_scope_allocate
PROTO ((struct binding_scope
**,
2100 const char *, int));
2101 int binding_scope_reference
PROTO ((struct binding_scope
**,
2102 struct binding_scope
*,
2103 const char *, int));
2104 int dns_zone_allocate
PROTO ((struct dns_zone
**, const char *, int));
2105 int dns_zone_reference
PROTO ((struct dns_zone
**,
2106 struct dns_zone
*, const char *, int));
2109 #define DEFAULT_TIME_FORMAT 0
2110 #define LOCAL_TIME_FORMAT 1
2111 extern int db_time_format
;
2112 char *quotify_string (const char *, const char *, int);
2113 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
2114 char *print_base64 (const unsigned char *, unsigned, const char *, int);
2115 char *print_hw_addr
PROTO ((int, int, unsigned char *));
2116 void print_lease
PROTO ((struct lease
*));
2117 void dump_raw
PROTO ((const unsigned char *, unsigned));
2118 void dump_packet_option (struct option_cache
*, struct packet
*,
2119 struct lease
*, struct client_state
*,
2120 struct option_state
*, struct option_state
*,
2121 struct binding_scope
**, struct universe
*, void *);
2122 void dump_packet
PROTO ((struct packet
*));
2123 void hash_dump
PROTO ((struct hash_table
*));
2124 char *print_hex_1
PROTO ((unsigned, const u_int8_t
*, unsigned));
2125 char *print_hex_2
PROTO ((unsigned, const u_int8_t
*, unsigned));
2126 char *print_hex_3
PROTO ((unsigned, const u_int8_t
*, unsigned));
2127 char *print_dotted_quads
PROTO ((unsigned, const u_int8_t
*));
2128 char *print_dec_1
PROTO ((unsigned long));
2129 char *print_dec_2
PROTO ((unsigned long));
2130 void print_expression
PROTO ((const char *, struct expression
*));
2131 int token_print_indent_concat (FILE *, int, int,
2132 const char *, const char *, ...);
2133 int token_indent_data_string (FILE *, int, int, const char *, const char *,
2134 struct data_string
*);
2135 int token_print_indent (FILE *, int, int,
2136 const char *, const char *, const char *);
2137 void indent_spaces (FILE *, int);
2138 #if defined (NSUPDATE)
2139 void print_dns_status (int, ns_updque
*);
2141 const char *print_time(TIME
);
2143 void get_hw_addr(const char *name
, struct hardware
*hw
);
2146 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
2147 || defined (USE_SOCKET_FALLBACK)
2148 int if_register_socket(struct interface_info
*, int, int *);
2151 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
2152 void if_reinitialize_fallback
PROTO ((struct interface_info
*));
2153 void if_register_fallback
PROTO ((struct interface_info
*));
2154 ssize_t send_fallback
PROTO ((struct interface_info
*,
2155 struct packet
*, struct dhcp_packet
*, size_t,
2157 struct sockaddr_in
*, struct hardware
*));
2158 ssize_t
send_fallback6(struct interface_info
*, struct packet
*,
2159 struct dhcp_packet
*, size_t, struct in6_addr
,
2160 struct sockaddr_in6
*, struct hardware
*);
2163 #ifdef USE_SOCKET_SEND
2164 void if_reinitialize_send
PROTO ((struct interface_info
*));
2165 void if_register_send
PROTO ((struct interface_info
*));
2166 void if_deregister_send
PROTO ((struct interface_info
*));
2167 ssize_t send_packet
PROTO ((struct interface_info
*,
2168 struct packet
*, struct dhcp_packet
*, size_t,
2170 struct sockaddr_in
*, struct hardware
*));
2172 ssize_t
send_packet6(struct interface_info
*, const unsigned char *, size_t,
2173 struct sockaddr_in6
*);
2174 #ifdef USE_SOCKET_RECEIVE
2175 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2176 void if_register_receive
PROTO ((struct interface_info
*));
2177 void if_deregister_receive
PROTO ((struct interface_info
*));
2178 ssize_t receive_packet
PROTO ((struct interface_info
*,
2179 unsigned char *, size_t,
2180 struct sockaddr_in
*, struct hardware
*));
2183 #if defined (USE_SOCKET_FALLBACK)
2184 isc_result_t fallback_discard
PROTO ((omapi_object_t
*));
2187 #if defined (USE_SOCKET_SEND)
2188 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2189 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2190 int supports_multiple_interfaces (struct interface_info
*);
2191 void maybe_setup_fallback
PROTO ((void));
2194 void if_register6(struct interface_info
*info
, int do_multicast
);
2195 ssize_t
receive_packet6(struct interface_info
*interface
,
2196 unsigned char *buf
, size_t len
,
2197 struct sockaddr_in6
*from
, struct in6_addr
*to_addr
,
2198 unsigned int *if_index
);
2199 void if_deregister6(struct interface_info
*info
);
2203 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
2204 int if_register_bpf
PROTO ( (struct interface_info
*));
2207 void if_reinitialize_send
PROTO ((struct interface_info
*));
2208 void if_register_send
PROTO ((struct interface_info
*));
2209 void if_deregister_send
PROTO ((struct interface_info
*));
2210 ssize_t send_packet
PROTO ((struct interface_info
*,
2211 struct packet
*, struct dhcp_packet
*, size_t,
2213 struct sockaddr_in
*, struct hardware
*));
2215 #ifdef USE_BPF_RECEIVE
2216 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2217 void if_register_receive
PROTO ((struct interface_info
*));
2218 void if_deregister_receive
PROTO ((struct interface_info
*));
2219 ssize_t receive_packet
PROTO ((struct interface_info
*,
2220 unsigned char *, size_t,
2221 struct sockaddr_in
*, struct hardware
*));
2223 #if defined (USE_BPF_SEND)
2224 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2225 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2226 int supports_multiple_interfaces (struct interface_info
*);
2227 void maybe_setup_fallback
PROTO ((void));
2231 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
2232 int if_register_lpf
PROTO ( (struct interface_info
*));
2235 void if_reinitialize_send
PROTO ((struct interface_info
*));
2236 void if_register_send
PROTO ((struct interface_info
*));
2237 void if_deregister_send
PROTO ((struct interface_info
*));
2238 ssize_t send_packet
PROTO ((struct interface_info
*,
2239 struct packet
*, struct dhcp_packet
*, size_t,
2241 struct sockaddr_in
*, struct hardware
*));
2243 #ifdef USE_LPF_RECEIVE
2244 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2245 void if_register_receive
PROTO ((struct interface_info
*));
2246 void if_deregister_receive
PROTO ((struct interface_info
*));
2247 ssize_t receive_packet
PROTO ((struct interface_info
*,
2248 unsigned char *, size_t,
2249 struct sockaddr_in
*, struct hardware
*));
2251 #if defined (USE_LPF_SEND)
2252 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2253 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2254 int supports_multiple_interfaces (struct interface_info
*);
2255 void maybe_setup_fallback
PROTO ((void));
2259 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
2260 int if_register_nit
PROTO ( (struct interface_info
*));
2264 void if_reinitialize_send
PROTO ((struct interface_info
*));
2265 void if_register_send
PROTO ((struct interface_info
*));
2266 void if_deregister_send
PROTO ((struct interface_info
*));
2267 ssize_t send_packet
PROTO ((struct interface_info
*,
2268 struct packet
*, struct dhcp_packet
*, size_t,
2270 struct sockaddr_in
*, struct hardware
*));
2272 #ifdef USE_NIT_RECEIVE
2273 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2274 void if_register_receive
PROTO ((struct interface_info
*));
2275 void if_deregister_receive
PROTO ((struct interface_info
*));
2276 ssize_t receive_packet
PROTO ((struct interface_info
*,
2277 unsigned char *, size_t,
2278 struct sockaddr_in
*, struct hardware
*));
2280 #if defined (USE_NIT_SEND)
2281 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2282 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2283 int supports_multiple_interfaces (struct interface_info
*);
2284 void maybe_setup_fallback
PROTO ((void));
2288 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
2289 int if_register_dlpi
PROTO ( (struct interface_info
*));
2292 #ifdef USE_DLPI_SEND
2293 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2294 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2295 void if_reinitialize_send
PROTO ((struct interface_info
*));
2296 void if_register_send
PROTO ((struct interface_info
*));
2297 void if_deregister_send
PROTO ((struct interface_info
*));
2298 ssize_t send_packet
PROTO ((struct interface_info
*,
2299 struct packet
*, struct dhcp_packet
*, size_t,
2301 struct sockaddr_in
*, struct hardware
*));
2302 int supports_multiple_interfaces (struct interface_info
*);
2303 void maybe_setup_fallback
PROTO ((void));
2305 #ifdef USE_DLPI_RECEIVE
2306 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2307 void if_register_receive
PROTO ((struct interface_info
*));
2308 void if_deregister_receive
PROTO ((struct interface_info
*));
2309 ssize_t receive_packet
PROTO ((struct interface_info
*,
2310 unsigned char *, size_t,
2311 struct sockaddr_in
*, struct hardware
*));
2317 void if_reinitialize_send
PROTO ((struct interface_info
*));
2318 void if_register_send
PROTO ((struct interface_info
*));
2319 void if_deregister_send
PROTO ((struct interface_info
*));
2320 ssize_t send_packet
PROTO ((struct interface_info
*,
2321 struct packet
*, struct dhcp_packet
*, size_t,
2323 struct sockaddr_in
*, struct hardware
*));
2324 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2325 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2326 int supports_multiple_interfaces (struct interface_info
*);
2327 void maybe_setup_fallback
PROTO ((void));
2331 extern struct interface_info
*interfaces
,
2332 *dummy_interfaces
, *fallback_interface
;
2333 extern struct protocol
*protocols
;
2334 extern int quiet_interface_discovery
;
2335 isc_result_t
interface_setup (void);
2336 void interface_trace_setup (void);
2338 extern struct in_addr limited_broadcast
;
2339 extern int local_family
;
2340 extern struct in_addr local_address
;
2341 extern struct in6_addr local_address6
;
2343 extern u_int16_t local_port
;
2344 extern u_int16_t remote_port
;
2345 extern int (*dhcp_interface_setup_hook
) (struct interface_info
*,
2347 extern int (*dhcp_interface_discovery_hook
) (struct interface_info
*);
2348 extern isc_result_t (*dhcp_interface_startup_hook
) (struct interface_info
*);
2350 extern void (*bootp_packet_handler
) PROTO ((struct interface_info
*,
2351 struct dhcp_packet
*, unsigned,
2353 struct iaddr
, struct hardware
*));
2354 extern void (*dhcpv6_packet_handler
)(struct interface_info
*,
2356 int, const struct iaddr
*, isc_boolean_t
);
2357 extern struct timeout
*timeouts
;
2358 extern omapi_object_type_t
*dhcp_type_interface
;
2359 #if defined (TRACING)
2360 extern trace_type_t
*interface_trace
;
2361 extern trace_type_t
*inpacket_trace
;
2362 extern trace_type_t
*outpacket_trace
;
2364 extern struct interface_info
**interface_vector
;
2365 extern int interface_count
;
2366 extern int interface_max
;
2367 isc_result_t
interface_initialize(omapi_object_t
*, const char *, int);
2368 void discover_interfaces(int);
2369 int setup_fallback (struct interface_info
**, const char *, int);
2370 int if_readsocket
PROTO ((omapi_object_t
*));
2371 void reinitialize_interfaces
PROTO ((void));
2374 void set_time(TIME
);
2375 struct timeval
*process_outstanding_timeouts (struct timeval
*);
2376 void dispatch
PROTO ((void));
2377 isc_result_t
got_one(omapi_object_t
*);
2378 isc_result_t
got_one_v6(omapi_object_t
*);
2379 isc_result_t
interface_set_value (omapi_object_t
*, omapi_object_t
*,
2380 omapi_data_string_t
*, omapi_typed_data_t
*);
2381 isc_result_t
interface_get_value (omapi_object_t
*, omapi_object_t
*,
2382 omapi_data_string_t
*, omapi_value_t
**);
2383 isc_result_t
interface_destroy (omapi_object_t
*, const char *, int);
2384 isc_result_t
interface_signal_handler (omapi_object_t
*,
2385 const char *, va_list);
2386 isc_result_t
interface_stuff_values (omapi_object_t
*,
2390 void add_timeout
PROTO ((struct timeval
*, void (*) PROTO ((void *)), void *,
2391 tvref_t
, tvunref_t
));
2392 void cancel_timeout
PROTO ((void (*) PROTO ((void *)), void *));
2393 void cancel_all_timeouts (void);
2394 void relinquish_timeouts (void);
2396 struct protocol
*add_protocol
PROTO ((const char *, int,
2397 void (*) PROTO ((struct protocol
*)),
2400 void remove_protocol
PROTO ((struct protocol
*));
2402 OMAPI_OBJECT_ALLOC_DECL (interface
,
2403 struct interface_info
, dhcp_type_interface
)
2406 extern char *default_option_format
;
2407 extern struct universe dhcp_universe
;
2408 extern struct universe dhcpv6_universe
;
2409 extern struct universe nwip_universe
;
2410 extern struct universe fqdn_universe
;
2411 extern struct universe vsio_universe
;
2412 extern int dhcp_option_default_priority_list
[];
2413 extern int dhcp_option_default_priority_list_count
;
2414 extern const char *hardware_types
[256];
2415 extern int universe_count
, universe_max
;
2416 extern struct universe
**universes
;
2417 extern universe_hash_t
*universe_hash
;
2418 void initialize_common_option_spaces
PROTO ((void));
2419 extern struct universe
*config_universe
;
2422 #if defined (FAILOVER_PROTOCOL)
2423 extern failover_option_t null_failover_option
;
2424 extern failover_option_t skip_failover_option
;
2425 extern struct failover_option_info ft_options
[];
2426 extern u_int32_t fto_allowed
[];
2427 extern int ft_sizes
[];
2428 extern const char *dhcp_flink_state_names
[];
2430 extern const char *binding_state_names
[];
2432 extern struct universe agent_universe
;
2433 extern struct universe server_universe
;
2435 extern struct enumeration ddns_styles
;
2436 extern struct enumeration syslog_enum
;
2437 void initialize_server_option_spaces
PROTO ((void));
2440 struct iaddr subnet_number
PROTO ((struct iaddr
, struct iaddr
));
2441 struct iaddr ip_addr
PROTO ((struct iaddr
, struct iaddr
, u_int32_t
));
2442 struct iaddr broadcast_addr
PROTO ((struct iaddr
, struct iaddr
));
2443 u_int32_t host_addr
PROTO ((struct iaddr
, struct iaddr
));
2444 int addr_eq
PROTO ((struct iaddr
, struct iaddr
));
2445 int addr_match(struct iaddr
*, struct iaddrmatch
*);
2446 int addr_cmp(const struct iaddr
*a1
, const struct iaddr
*a2
);
2447 int addr_or(struct iaddr
*result
,
2448 const struct iaddr
*a1
, const struct iaddr
*a2
);
2449 int addr_and(struct iaddr
*result
,
2450 const struct iaddr
*a1
, const struct iaddr
*a2
);
2451 isc_boolean_t
is_cidr_mask_valid(const struct iaddr
*addr
, int bits
);
2452 isc_result_t
range2cidr(struct iaddrcidrnetlist
**result
,
2453 const struct iaddr
*lo
, const struct iaddr
*hi
);
2454 isc_result_t
free_iaddrcidrnetlist(struct iaddrcidrnetlist
**result
);
2455 const char *piaddr
PROTO ((struct iaddr
));
2456 char *piaddrmask(struct iaddr
*, struct iaddr
*);
2457 char *piaddrcidr(const struct iaddr
*, unsigned int);
2458 u_int16_t
validate_port(char *);
2463 extern int wanted_ia_na
;
2464 extern int wanted_ia_ta
;
2465 extern int wanted_ia_pd
;
2467 extern const char *path_dhclient_conf
;
2468 extern const char *path_dhclient_db
;
2469 extern const char *path_dhclient_pid
;
2470 extern char *path_dhclient_script
;
2471 extern int interfaces_requested
;
2472 extern struct data_string default_duid
;
2474 extern struct client_config top_level_config
;
2476 void dhcpoffer
PROTO ((struct packet
*));
2477 void dhcpack
PROTO ((struct packet
*));
2478 void dhcpnak
PROTO ((struct packet
*));
2480 void send_discover
PROTO ((void *));
2481 void send_request
PROTO ((void *));
2482 void send_release
PROTO ((void *));
2483 void send_decline
PROTO ((void *));
2485 void state_reboot
PROTO ((void *));
2486 void state_init
PROTO ((void *));
2487 void state_selecting
PROTO ((void *));
2488 void state_requesting
PROTO ((void *));
2489 void state_bound
PROTO ((void *));
2490 void state_stop
PROTO ((void *));
2491 void state_panic
PROTO ((void *));
2493 void bind_lease
PROTO ((struct client_state
*));
2495 void make_client_options
PROTO ((struct client_state
*,
2496 struct client_lease
*, u_int8_t
*,
2497 struct option_cache
*, struct iaddr
*,
2498 struct option
**, struct option_state
**));
2499 void make_discover
PROTO ((struct client_state
*, struct client_lease
*));
2500 void make_request
PROTO ((struct client_state
*, struct client_lease
*));
2501 void make_decline
PROTO ((struct client_state
*, struct client_lease
*));
2502 void make_release
PROTO ((struct client_state
*, struct client_lease
*));
2504 void destroy_client_lease
PROTO ((struct client_lease
*));
2505 void rewrite_client_leases
PROTO ((void));
2506 void write_lease_option (struct option_cache
*, struct packet
*,
2507 struct lease
*, struct client_state
*,
2508 struct option_state
*, struct option_state
*,
2509 struct binding_scope
**, struct universe
*, void *);
2510 int write_client_lease
PROTO ((struct client_state
*,
2511 struct client_lease
*, int, int));
2512 isc_result_t
write_client6_lease(struct client_state
*client
,
2513 struct dhc6_lease
*lease
,
2514 int rewrite
, int sync
);
2515 int dhcp_option_ev_name (char *, size_t, struct option
*);
2517 void script_init
PROTO ((struct client_state
*, const char *,
2518 struct string_list
*));
2519 void client_option_envadd (struct option_cache
*, struct packet
*,
2520 struct lease
*, struct client_state
*,
2521 struct option_state
*, struct option_state
*,
2522 struct binding_scope
**, struct universe
*, void *);
2523 void script_write_params
PROTO ((struct client_state
*,
2524 const char *, struct client_lease
*));
2525 int script_go
PROTO ((struct client_state
*));
2526 void client_envadd (struct client_state
*,
2527 const char *, const char *, const char *, ...)
2528 __attribute__((__format__(__printf__
,4,5)));
2530 struct client_lease
*packet_to_lease (struct packet
*, struct client_state
*);
2531 void go_daemon
PROTO ((void));
2532 void write_client_pid_file
PROTO ((void));
2533 void client_location_changed
PROTO ((void));
2534 void do_release
PROTO ((struct client_state
*));
2535 int dhclient_interface_shutdown_hook (struct interface_info
*);
2536 int dhclient_interface_discovery_hook (struct interface_info
*);
2537 isc_result_t
dhclient_interface_startup_hook (struct interface_info
*);
2538 void dhclient_schedule_updates(struct client_state
*client
,
2539 struct iaddr
*addr
, int offset
);
2540 void client_dns_update_timeout (void *cp
);
2541 isc_result_t
client_dns_update(struct client_state
*client
, int, int,
2544 void dhcpv4_client_assignments(void);
2545 void dhcpv6_client_assignments(void);
2548 void form_duid(struct data_string
*duid
, const char *file
, int line
);
2549 void dhc6_lease_destroy(struct dhc6_lease
**src
, const char *file
, int line
);
2550 void start_init6(struct client_state
*client
);
2551 void start_info_request6(struct client_state
*client
);
2552 void start_confirm6(struct client_state
*client
);
2553 void start_release6(struct client_state
*client
);
2554 void start_selecting6(struct client_state
*client
);
2555 void unconfigure6(struct client_state
*client
, const char *reason
);
2558 int write_lease
PROTO ((struct lease
*));
2559 int write_host
PROTO ((struct host_decl
*));
2560 int write_server_duid(void);
2561 #if defined (FAILOVER_PROTOCOL)
2562 int write_failover_state (dhcp_failover_state_t
*);
2564 int db_printable
PROTO ((const unsigned char *));
2565 int db_printable_len
PROTO ((const unsigned char *, unsigned));
2566 isc_result_t
write_named_billing_class(const void *, unsigned, void *);
2567 void write_billing_classes (void);
2568 int write_billing_class
PROTO ((struct class *));
2569 void commit_leases_timeout
PROTO ((void *));
2570 void commit_leases_readerdry(void *);
2571 int commit_leases
PROTO ((void));
2572 void db_startup
PROTO ((int));
2573 int new_lease_file
PROTO ((void));
2574 int group_writer (struct group_object
*);
2575 int write_ia(const struct ia_xx
*);
2578 u_int32_t checksum
PROTO ((unsigned char *, unsigned, u_int32_t
));
2579 u_int32_t wrapsum
PROTO ((u_int32_t
));
2580 void assemble_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2581 unsigned *, struct hardware
*));
2582 void assemble_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2583 unsigned *, u_int32_t
, u_int32_t
,
2584 u_int32_t
, unsigned char *, unsigned));
2585 ssize_t decode_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2586 unsigned, struct hardware
*));
2587 ssize_t decode_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2588 unsigned, struct sockaddr_in
*,
2589 unsigned, unsigned *));
2592 void assemble_ethernet_header
PROTO ((struct interface_info
*, unsigned char *,
2593 unsigned *, struct hardware
*));
2594 ssize_t decode_ethernet_header
PROTO ((struct interface_info
*,
2596 unsigned, struct hardware
*));
2599 void assemble_tr_header
PROTO ((struct interface_info
*, unsigned char *,
2600 unsigned *, struct hardware
*));
2601 ssize_t decode_tr_header
PROTO ((struct interface_info
*,
2603 unsigned, struct hardware
*));
2606 void convert_statement
PROTO ((struct parse
*));
2607 void convert_host_statement
PROTO ((struct parse
*, jrefproto
));
2608 void convert_host_name
PROTO ((struct parse
*, jrefproto
));
2609 void convert_class_statement
PROTO ((struct parse
*, jrefproto
, int));
2610 void convert_class_decl
PROTO ((struct parse
*, jrefproto
));
2611 void convert_lease_time
PROTO ((struct parse
*, jrefproto
, char *));
2612 void convert_shared_net_statement
PROTO ((struct parse
*, jrefproto
));
2613 void convert_subnet_statement
PROTO ((struct parse
*, jrefproto
));
2614 void convert_subnet_decl
PROTO ((struct parse
*, jrefproto
));
2615 void convert_host_decl
PROTO ((struct parse
*, jrefproto
));
2616 void convert_hardware_decl
PROTO ((struct parse
*, jrefproto
));
2617 void convert_hardware_addr
PROTO ((struct parse
*, jrefproto
));
2618 void convert_filename_decl
PROTO ((struct parse
*, jrefproto
));
2619 void convert_servername_decl
PROTO ((struct parse
*, jrefproto
));
2620 void convert_ip_addr_or_hostname
PROTO ((struct parse
*, jrefproto
, int));
2621 void convert_fixed_addr_decl
PROTO ((struct parse
*, jrefproto
));
2622 void convert_option_decl
PROTO ((struct parse
*, jrefproto
));
2623 void convert_lease_statement
PROTO ((struct parse
*, jrefproto
));
2624 void convert_address_range
PROTO ((struct parse
*, jrefproto
));
2625 void convert_date
PROTO ((struct parse
*, jrefproto
, char *));
2626 void convert_numeric_aggregate
PROTO ((struct parse
*, jrefproto
, int, int, int, int));
2627 void indent
PROTO ((int));
2630 void add_route_direct
PROTO ((struct interface_info
*, struct in_addr
));
2631 void add_route_net
PROTO ((struct interface_info
*, struct in_addr
,
2633 void add_route_default_gateway
PROTO ((struct interface_info
*,
2635 void remove_routes
PROTO ((struct in_addr
));
2636 void remove_if_route
PROTO ((struct interface_info
*, struct in_addr
));
2637 void remove_all_if_routes
PROTO ((struct interface_info
*));
2638 void set_netmask
PROTO ((struct interface_info
*, struct in_addr
));
2639 void set_broadcast_addr
PROTO ((struct interface_info
*, struct in_addr
));
2640 void set_ip_address
PROTO ((struct interface_info
*, struct in_addr
));
2643 isc_result_t read_client_conf
PROTO ((void));
2644 int read_client_conf_file (const char *,
2645 struct interface_info
*, struct client_config
*);
2646 void read_client_leases
PROTO ((void));
2647 void parse_client_statement
PROTO ((struct parse
*, struct interface_info
*,
2648 struct client_config
*));
2649 int parse_X
PROTO ((struct parse
*, u_int8_t
*, unsigned));
2650 int parse_option_list
PROTO ((struct parse
*, struct option
***));
2651 void parse_interface_declaration
PROTO ((struct parse
*,
2652 struct client_config
*, char *));
2653 int interface_or_dummy
PROTO ((struct interface_info
**, const char *));
2654 void make_client_state
PROTO ((struct client_state
**));
2655 void make_client_config
PROTO ((struct client_state
*,
2656 struct client_config
*));
2657 void parse_client_lease_statement
PROTO ((struct parse
*, int));
2658 void parse_client_lease_declaration
PROTO ((struct parse
*,
2659 struct client_lease
*,
2660 struct interface_info
**,
2661 struct client_state
**));
2662 int parse_option_decl
PROTO ((struct option_cache
**, struct parse
*));
2663 void parse_string_list
PROTO ((struct parse
*, struct string_list
**, int));
2664 int parse_ip_addr
PROTO ((struct parse
*, struct iaddr
*));
2665 int parse_ip_addr_with_subnet(struct parse
*, struct iaddrmatch
*);
2666 void parse_reject_statement
PROTO ((struct parse
*, struct client_config
*));
2669 OMAPI_OBJECT_ALLOC_DECL (icmp_state
, struct icmp_state
, dhcp_type_icmp
)
2670 extern struct icmp_state
*icmp_state
;
2671 void icmp_startup
PROTO ((int, void (*) PROTO ((struct iaddr
,
2672 u_int8_t
*, int))));
2673 int icmp_readsocket
PROTO ((omapi_object_t
*));
2674 int icmp_echorequest
PROTO ((struct iaddr
*));
2675 isc_result_t icmp_echoreply
PROTO ((omapi_object_t
*));
2678 #if defined (NSUPDATE)
2679 isc_result_t
find_tsig_key (ns_tsig_key
**, const char *, struct dns_zone
*);
2680 void tkey_free (ns_tsig_key
**);
2682 isc_result_t
enter_dns_zone (struct dns_zone
*);
2683 isc_result_t
dns_zone_lookup (struct dns_zone
**, const char *);
2684 int dns_zone_dereference
PROTO ((struct dns_zone
**, const char *, int));
2685 #if defined (NSUPDATE)
2686 isc_result_t
find_cached_zone (const char *, ns_class
, char *,
2687 size_t, struct in_addr
*, int, int *,
2688 struct dns_zone
**);
2689 void forget_zone (struct dns_zone
**);
2690 void repudiate_zone (struct dns_zone
**);
2691 void cache_found_zone (ns_class
, char *, struct in_addr
*, int);
2692 int get_dhcid (struct data_string
*, int, const u_int8_t
*, unsigned);
2693 isc_result_t
ddns_update_fwd(struct data_string
*, struct iaddr
,
2694 struct data_string
*, unsigned long, unsigned,
2696 isc_result_t
ddns_remove_fwd(struct data_string
*,
2697 struct iaddr
, struct data_string
*);
2698 #endif /* NSUPDATE */
2701 extern char path_resolv_conf
[];
2702 extern struct name_server
*name_servers
;
2703 extern struct domain_search_list
*domains
;
2705 void read_resolv_conf
PROTO ((TIME
));
2706 struct name_server
*first_name_server
PROTO ((void));
2709 #ifdef NEED_INET_ATON
2710 int inet_aton
PROTO ((const char *, struct in_addr
*));
2714 extern int have_billing_classes
;
2715 struct class unknown_class
;
2716 struct class known_class
;
2717 struct collection default_collection
;
2718 struct collection
*collections
;
2719 extern struct executable_statement
*default_classification_rules
;
2721 void classification_setup
PROTO ((void));
2722 void classify_client
PROTO ((struct packet
*));
2723 int check_collection
PROTO ((struct packet
*, struct lease
*,
2724 struct collection
*));
2725 void classify
PROTO ((struct packet
*, struct class *));
2726 isc_result_t unlink_class
PROTO((struct class **class));
2727 isc_result_t find_class
PROTO ((struct class **, const char *,
2728 const char *, int));
2729 int unbill_class
PROTO ((struct lease
*, struct class *));
2730 int bill_class
PROTO ((struct lease
*, struct class *));
2733 int execute_statements
PROTO ((struct binding_value
**result
,
2734 struct packet
*, struct lease
*,
2735 struct client_state
*,
2736 struct option_state
*, struct option_state
*,
2737 struct binding_scope
**,
2738 struct executable_statement
*));
2739 void execute_statements_in_scope
PROTO ((struct binding_value
**result
,
2740 struct packet
*, struct lease
*,
2741 struct client_state
*,
2742 struct option_state
*,
2743 struct option_state
*,
2744 struct binding_scope
**,
2745 struct group
*, struct group
*));
2746 int executable_statement_dereference
PROTO ((struct executable_statement
**,
2747 const char *, int));
2748 void write_statements (FILE *, struct executable_statement
*, int);
2749 int find_matching_case (struct executable_statement
**,
2750 struct packet
*, struct lease
*, struct client_state
*,
2751 struct option_state
*, struct option_state
*,
2752 struct binding_scope
**,
2753 struct expression
*, struct executable_statement
*);
2754 int executable_statement_foreach (struct executable_statement
*,
2755 int (*) (struct executable_statement
*,
2756 void *, int), void *, int);
2759 extern omapi_object_type_t
*dhcp_type_group
;
2760 extern omapi_object_type_t
*dhcp_type_shared_network
;
2761 extern omapi_object_type_t
*dhcp_type_subnet
;
2762 extern omapi_object_type_t
*dhcp_type_control
;
2763 extern dhcp_control_object_t
*dhcp_control_object
;
2765 void dhcp_common_objects_setup (void);
2767 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2768 omapi_data_string_t
*,
2769 omapi_typed_data_t
*);
2770 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2771 omapi_data_string_t
*,
2773 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2774 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2775 const char *, va_list);
2776 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2779 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2780 omapi_object_t
*, omapi_object_t
*);
2781 isc_result_t
dhcp_group_create (omapi_object_t
**,
2783 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2786 isc_result_t
dhcp_control_set_value (omapi_object_t
*, omapi_object_t
*,
2787 omapi_data_string_t
*,
2788 omapi_typed_data_t
*);
2789 isc_result_t
dhcp_control_get_value (omapi_object_t
*, omapi_object_t
*,
2790 omapi_data_string_t
*,
2792 isc_result_t
dhcp_control_destroy (omapi_object_t
*, const char *, int);
2793 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*,
2794 const char *, va_list);
2795 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*,
2798 isc_result_t
dhcp_control_lookup (omapi_object_t
**,
2799 omapi_object_t
*, omapi_object_t
*);
2800 isc_result_t
dhcp_control_create (omapi_object_t
**,
2802 isc_result_t
dhcp_control_remove (omapi_object_t
*,
2805 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2806 omapi_data_string_t
*,
2807 omapi_typed_data_t
*);
2808 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2809 omapi_data_string_t
*,
2811 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2812 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2813 const char *, va_list);
2814 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2817 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2818 omapi_object_t
*, omapi_object_t
*);
2819 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2821 isc_result_t
dhcp_subnet_remove (omapi_object_t
*,
2824 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2826 omapi_data_string_t
*,
2827 omapi_typed_data_t
*);
2828 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*,
2830 omapi_data_string_t
*,
2832 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2833 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2834 const char *, va_list);
2835 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2838 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2839 omapi_object_t
*, omapi_object_t
*);
2840 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2842 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*,
2846 extern int (*dhcp_interface_shutdown_hook
) (struct interface_info
*);
2848 extern omapi_object_type_t
*dhcp_type_lease
;
2849 extern omapi_object_type_t
*dhcp_type_pool
;
2850 extern omapi_object_type_t
*dhcp_type_class
;
2851 extern omapi_object_type_t
*dhcp_type_subclass
;
2853 #if defined (FAILOVER_PROTOCOL)
2854 extern omapi_object_type_t
*dhcp_type_failover_state
;
2855 extern omapi_object_type_t
*dhcp_type_failover_link
;
2856 extern omapi_object_type_t
*dhcp_type_failover_listener
;
2859 void dhcp_db_objects_setup (void);
2861 isc_result_t
dhcp_lease_set_value (omapi_object_t
*, omapi_object_t
*,
2862 omapi_data_string_t
*,
2863 omapi_typed_data_t
*);
2864 isc_result_t
dhcp_lease_get_value (omapi_object_t
*, omapi_object_t
*,
2865 omapi_data_string_t
*,
2867 isc_result_t
dhcp_lease_destroy (omapi_object_t
*, const char *, int);
2868 isc_result_t
dhcp_lease_signal_handler (omapi_object_t
*,
2869 const char *, va_list);
2870 isc_result_t
dhcp_lease_stuff_values (omapi_object_t
*,
2873 isc_result_t
dhcp_lease_lookup (omapi_object_t
**,
2874 omapi_object_t
*, omapi_object_t
*);
2875 isc_result_t
dhcp_lease_create (omapi_object_t
**,
2877 isc_result_t
dhcp_lease_remove (omapi_object_t
*,
2879 isc_result_t
dhcp_host_set_value (omapi_object_t
*, omapi_object_t
*,
2880 omapi_data_string_t
*,
2881 omapi_typed_data_t
*);
2882 isc_result_t
dhcp_host_get_value (omapi_object_t
*, omapi_object_t
*,
2883 omapi_data_string_t
*,
2885 isc_result_t
dhcp_host_destroy (omapi_object_t
*, const char *, int);
2886 isc_result_t
dhcp_host_signal_handler (omapi_object_t
*,
2887 const char *, va_list);
2888 isc_result_t
dhcp_host_stuff_values (omapi_object_t
*,
2891 isc_result_t
dhcp_host_lookup (omapi_object_t
**,
2892 omapi_object_t
*, omapi_object_t
*);
2893 isc_result_t
dhcp_host_create (omapi_object_t
**,
2895 isc_result_t
dhcp_host_remove (omapi_object_t
*,
2897 isc_result_t
dhcp_pool_set_value (omapi_object_t
*, omapi_object_t
*,
2898 omapi_data_string_t
*,
2899 omapi_typed_data_t
*);
2900 isc_result_t
dhcp_pool_get_value (omapi_object_t
*, omapi_object_t
*,
2901 omapi_data_string_t
*,
2903 isc_result_t
dhcp_pool_destroy (omapi_object_t
*, const char *, int);
2904 isc_result_t
dhcp_pool_signal_handler (omapi_object_t
*,
2905 const char *, va_list);
2906 isc_result_t
dhcp_pool_stuff_values (omapi_object_t
*,
2909 isc_result_t
dhcp_pool_lookup (omapi_object_t
**,
2910 omapi_object_t
*, omapi_object_t
*);
2911 isc_result_t
dhcp_pool_create (omapi_object_t
**,
2913 isc_result_t
dhcp_pool_remove (omapi_object_t
*,
2915 isc_result_t
dhcp_class_set_value (omapi_object_t
*, omapi_object_t
*,
2916 omapi_data_string_t
*,
2917 omapi_typed_data_t
*);
2918 isc_result_t
dhcp_class_get_value (omapi_object_t
*, omapi_object_t
*,
2919 omapi_data_string_t
*,
2921 isc_result_t
dhcp_class_destroy (omapi_object_t
*, const char *, int);
2922 isc_result_t
dhcp_class_signal_handler (omapi_object_t
*,
2923 const char *, va_list);
2924 isc_result_t
dhcp_class_stuff_values (omapi_object_t
*,
2927 isc_result_t
dhcp_class_lookup (omapi_object_t
**,
2928 omapi_object_t
*, omapi_object_t
*);
2929 isc_result_t
dhcp_class_create (omapi_object_t
**,
2931 isc_result_t
dhcp_class_remove (omapi_object_t
*,
2933 isc_result_t
dhcp_subclass_set_value (omapi_object_t
*, omapi_object_t
*,
2934 omapi_data_string_t
*,
2935 omapi_typed_data_t
*);
2936 isc_result_t
dhcp_subclass_get_value (omapi_object_t
*, omapi_object_t
*,
2937 omapi_data_string_t
*,
2939 isc_result_t
dhcp_subclass_destroy (omapi_object_t
*, const char *, int);
2940 isc_result_t
dhcp_subclass_signal_handler (omapi_object_t
*,
2941 const char *, va_list);
2942 isc_result_t
dhcp_subclass_stuff_values (omapi_object_t
*,
2945 isc_result_t
dhcp_subclass_lookup (omapi_object_t
**,
2946 omapi_object_t
*, omapi_object_t
*);
2947 isc_result_t
dhcp_subclass_create (omapi_object_t
**,
2949 isc_result_t
dhcp_subclass_remove (omapi_object_t
*,
2951 isc_result_t
dhcp_interface_set_value (omapi_object_t
*,
2953 omapi_data_string_t
*,
2954 omapi_typed_data_t
*);
2955 isc_result_t
dhcp_interface_get_value (omapi_object_t
*,
2957 omapi_data_string_t
*,
2959 isc_result_t
dhcp_interface_destroy (omapi_object_t
*,
2961 isc_result_t
dhcp_interface_signal_handler (omapi_object_t
*,
2964 isc_result_t
dhcp_interface_stuff_values (omapi_object_t
*,
2967 isc_result_t
dhcp_interface_lookup (omapi_object_t
**,
2970 isc_result_t
dhcp_interface_create (omapi_object_t
**,
2972 isc_result_t
dhcp_interface_remove (omapi_object_t
*,
2974 void interface_stash (struct interface_info
*);
2975 void interface_snorf (struct interface_info
*, int);
2977 isc_result_t
binding_scope_set_value (struct binding_scope
*, int,
2978 omapi_data_string_t
*,
2979 omapi_typed_data_t
*);
2980 isc_result_t
binding_scope_get_value (omapi_value_t
**,
2981 struct binding_scope
*,
2982 omapi_data_string_t
*);
2983 isc_result_t
binding_scope_stuff_values (omapi_object_t
*,
2984 struct binding_scope
*);
2986 void register_eventhandler(struct eventqueue
**, void (*handler
)(void *));
2987 void unregister_eventhandler(struct eventqueue
**, void (*handler
)(void *));
2988 void trigger_event(struct eventqueue
**);
2992 extern struct subnet
*subnets
;
2993 extern struct shared_network
*shared_networks
;
2994 extern host_hash_t
*host_hw_addr_hash
;
2995 extern host_hash_t
*host_uid_hash
;
2996 extern host_hash_t
*host_name_hash
;
2997 extern lease_id_hash_t
*lease_uid_hash
;
2998 extern lease_ip_hash_t
*lease_ip_addr_hash
;
2999 extern lease_id_hash_t
*lease_hw_addr_hash
;
3001 extern omapi_object_type_t
*dhcp_type_host
;
3003 extern int numclasseswritten
;
3006 isc_result_t enter_class
PROTO ((struct class *, int, int));
3007 isc_result_t delete_class
PROTO ((struct class *, int));
3008 isc_result_t enter_host
PROTO ((struct host_decl
*, int, int));
3009 isc_result_t delete_host
PROTO ((struct host_decl
*, int));
3010 void change_host_uid(struct host_decl
*host
, const char *data
, int len
);
3011 int find_hosts_by_haddr
PROTO ((struct host_decl
**, int,
3012 const unsigned char *, unsigned,
3013 const char *, int));
3014 int find_hosts_by_uid
PROTO ((struct host_decl
**, const unsigned char *,
3015 unsigned, const char *, int));
3016 int find_hosts_by_option(struct host_decl
**, struct packet
*,
3017 struct option_state
*, const char *, int);
3018 int find_host_for_network
PROTO ((struct subnet
**, struct host_decl
**,
3019 struct iaddr
*, struct shared_network
*));
3020 void new_address_range
PROTO ((struct parse
*, struct iaddr
, struct iaddr
,
3021 struct subnet
*, struct pool
*,
3023 isc_result_t
dhcp_lease_free (omapi_object_t
*, const char *, int);
3024 isc_result_t
dhcp_lease_get (omapi_object_t
**, const char *, int);
3025 int find_grouped_subnet
PROTO ((struct subnet
**, struct shared_network
*,
3026 struct iaddr
, const char *, int));
3027 int find_subnet(struct subnet
**, struct iaddr
, const char *, int);
3028 void enter_shared_network
PROTO ((struct shared_network
*));
3029 void new_shared_network_interface
PROTO ((struct parse
*,
3030 struct shared_network
*,
3032 int subnet_inner_than(const struct subnet
*, const struct subnet
*, int);
3033 void enter_subnet
PROTO ((struct subnet
*));
3034 void enter_lease
PROTO ((struct lease
*));
3035 int supersede_lease
PROTO ((struct lease
*, struct lease
*, int, int, int));
3036 void make_binding_state_transition (struct lease
*);
3037 int lease_copy
PROTO ((struct lease
**, struct lease
*, const char *, int));
3038 void release_lease
PROTO ((struct lease
*, struct packet
*));
3039 void abandon_lease
PROTO ((struct lease
*, const char *));
3040 void dissociate_lease
PROTO ((struct lease
*));
3041 void pool_timer
PROTO ((void *));
3042 int find_lease_by_uid
PROTO ((struct lease
**, const unsigned char *,
3043 unsigned, const char *, int));
3044 int find_lease_by_hw_addr
PROTO ((struct lease
**, const unsigned char *,
3045 unsigned, const char *, int));
3046 int find_lease_by_ip_addr
PROTO ((struct lease
**, struct iaddr
,
3047 const char *, int));
3048 void uid_hash_add
PROTO ((struct lease
*));
3049 void uid_hash_delete
PROTO ((struct lease
*));
3050 void hw_hash_add
PROTO ((struct lease
*));
3051 void hw_hash_delete
PROTO ((struct lease
*));
3052 int write_leases
PROTO ((void));
3053 int write_leases6(void);
3054 int lease_enqueue (struct lease
*);
3055 isc_result_t
lease_instantiate(const void *, unsigned, void *);
3056 void expire_all_pools
PROTO ((void));
3057 void dump_subnets
PROTO ((void));
3058 #if defined (DEBUG_MEMORY_LEAKAGE) || \
3059 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
3060 void free_everything (void);
3064 char *ddns_rev_name (struct lease
*, struct lease_state
*, struct packet
*);
3065 char *ddns_fwd_name (struct lease
*, struct lease_state
*, struct packet
*);
3066 int nsupdateA (const char *, const unsigned char *, u_int32_t
, int);
3067 int nsupdatePTR (const char *, const unsigned char *, u_int32_t
, int);
3068 void nsupdate (struct lease
*, struct lease_state
*, struct packet
*, int);
3069 int updateA (const struct data_string
*, const struct data_string
*,
3070 unsigned int, struct lease
*);
3071 int updatePTR (const struct data_string
*, const struct data_string
*,
3072 unsigned int, struct lease
*);
3073 int deleteA (const struct data_string
*, const struct data_string
*,
3075 int deletePTR (const struct data_string
*, const struct data_string
*,
3079 #if defined (FAILOVER_PROTOCOL)
3080 extern dhcp_failover_state_t
*failover_states
;
3081 void dhcp_failover_startup
PROTO ((void));
3082 int dhcp_failover_write_all_states (void);
3083 isc_result_t enter_failover_peer
PROTO ((dhcp_failover_state_t
*));
3084 isc_result_t find_failover_peer
PROTO ((dhcp_failover_state_t
**,
3085 const char *, const char *, int));
3086 isc_result_t dhcp_failover_link_initiate
PROTO ((omapi_object_t
*));
3087 isc_result_t dhcp_failover_link_signal
PROTO ((omapi_object_t
*,
3088 const char *, va_list));
3089 isc_result_t dhcp_failover_link_set_value
PROTO ((omapi_object_t
*,
3091 omapi_data_string_t
*,
3092 omapi_typed_data_t
*));
3093 isc_result_t dhcp_failover_link_get_value
PROTO ((omapi_object_t
*,
3095 omapi_data_string_t
*,
3097 isc_result_t dhcp_failover_link_destroy
PROTO ((omapi_object_t
*,
3098 const char *, int));
3099 isc_result_t dhcp_failover_link_stuff_values
PROTO ((omapi_object_t
*,
3102 isc_result_t dhcp_failover_listen
PROTO ((omapi_object_t
*));
3104 isc_result_t dhcp_failover_listener_signal
PROTO ((omapi_object_t
*,
3107 isc_result_t dhcp_failover_listener_set_value
PROTO ((omapi_object_t
*,
3109 omapi_data_string_t
*,
3110 omapi_typed_data_t
*));
3111 isc_result_t dhcp_failover_listener_get_value
PROTO ((omapi_object_t
*,
3113 omapi_data_string_t
*,
3115 isc_result_t dhcp_failover_listener_destroy
PROTO ((omapi_object_t
*,
3116 const char *, int));
3117 isc_result_t dhcp_failover_listener_stuff
PROTO ((omapi_object_t
*,
3120 isc_result_t dhcp_failover_register
PROTO ((omapi_object_t
*));
3121 isc_result_t dhcp_failover_state_signal
PROTO ((omapi_object_t
*,
3122 const char *, va_list));
3123 isc_result_t
dhcp_failover_state_transition (dhcp_failover_state_t
*,
3125 isc_result_t
dhcp_failover_set_service_state (dhcp_failover_state_t
*state
);
3126 isc_result_t
dhcp_failover_set_state (dhcp_failover_state_t
*,
3127 enum failover_state
);
3128 isc_result_t
dhcp_failover_peer_state_changed (dhcp_failover_state_t
*,
3129 failover_message_t
*);
3130 void dhcp_failover_pool_rebalance (void *);
3131 void dhcp_failover_pool_check (struct pool
*);
3132 int dhcp_failover_state_pool_check (dhcp_failover_state_t
*);
3133 void dhcp_failover_timeout (void *);
3134 void dhcp_failover_send_contact (void *);
3135 isc_result_t
dhcp_failover_send_state (dhcp_failover_state_t
*);
3136 isc_result_t
dhcp_failover_send_updates (dhcp_failover_state_t
*);
3137 int dhcp_failover_queue_update (struct lease
*, int);
3138 int dhcp_failover_send_acks (dhcp_failover_state_t
*);
3139 void dhcp_failover_toack_queue_timeout (void *);
3140 int dhcp_failover_queue_ack (dhcp_failover_state_t
*, failover_message_t
*msg
);
3141 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t
*, struct lease
*);
3142 isc_result_t dhcp_failover_state_set_value
PROTO ((omapi_object_t
*,
3144 omapi_data_string_t
*,
3145 omapi_typed_data_t
*));
3146 void dhcp_failover_keepalive (void *);
3147 void dhcp_failover_reconnect (void *);
3148 void dhcp_failover_startup_timeout (void *);
3149 void dhcp_failover_link_startup_timeout (void *);
3150 void dhcp_failover_listener_restart (void *);
3151 isc_result_t dhcp_failover_state_get_value
PROTO ((omapi_object_t
*,
3153 omapi_data_string_t
*,
3155 isc_result_t dhcp_failover_state_destroy
PROTO ((omapi_object_t
*,
3156 const char *, int));
3157 isc_result_t dhcp_failover_state_stuff
PROTO ((omapi_object_t
*,
3160 isc_result_t dhcp_failover_state_lookup
PROTO ((omapi_object_t
**,
3163 isc_result_t dhcp_failover_state_create
PROTO ((omapi_object_t
**,
3165 isc_result_t dhcp_failover_state_remove
PROTO ((omapi_object_t
*,
3167 int dhcp_failover_state_match (dhcp_failover_state_t
*, u_int8_t
*, unsigned);
3168 int dhcp_failover_state_match_by_name(dhcp_failover_state_t
*,
3169 failover_option_t
*);
3170 const char *dhcp_failover_reject_reason_print (int);
3171 const char *dhcp_failover_state_name_print (enum failover_state
);
3172 const char *dhcp_failover_message_name (unsigned);
3173 const char *dhcp_failover_option_name (unsigned);
3174 failover_option_t
*dhcp_failover_option_printf (unsigned, char *,
3178 __attribute__((__format__(__printf__
,5,6)));
3179 failover_option_t
*dhcp_failover_make_option (unsigned, char *,
3180 unsigned *, unsigned, ...);
3181 isc_result_t
dhcp_failover_put_message (dhcp_failover_link_t
*,
3182 omapi_object_t
*, int, u_int32_t
, ...);
3183 isc_result_t dhcp_failover_send_connect
PROTO ((omapi_object_t
*));
3184 isc_result_t dhcp_failover_send_connectack
PROTO ((omapi_object_t
*,
3185 dhcp_failover_state_t
*,
3186 int, const char *));
3187 isc_result_t dhcp_failover_send_disconnect
PROTO ((omapi_object_t
*,
3188 int, const char *));
3189 isc_result_t
dhcp_failover_send_bind_update (dhcp_failover_state_t
*,
3191 isc_result_t
dhcp_failover_send_bind_ack (dhcp_failover_state_t
*,
3192 failover_message_t
*,
3194 isc_result_t
dhcp_failover_send_poolreq (dhcp_failover_state_t
*);
3195 isc_result_t
dhcp_failover_send_poolresp (dhcp_failover_state_t
*, int);
3196 isc_result_t
dhcp_failover_send_update_request (dhcp_failover_state_t
*);
3197 isc_result_t
dhcp_failover_send_update_request_all (dhcp_failover_state_t
*);
3198 isc_result_t
dhcp_failover_send_update_done (dhcp_failover_state_t
*);
3199 isc_result_t
dhcp_failover_process_bind_update (dhcp_failover_state_t
*,
3200 failover_message_t
*);
3201 isc_result_t
dhcp_failover_process_bind_ack (dhcp_failover_state_t
*,
3202 failover_message_t
*);
3203 isc_result_t
dhcp_failover_generate_update_queue (dhcp_failover_state_t
*,
3205 isc_result_t
dhcp_failover_process_update_request (dhcp_failover_state_t
*,
3206 failover_message_t
*);
3207 isc_result_t
dhcp_failover_process_update_request_all (dhcp_failover_state_t
*,
3208 failover_message_t
*);
3209 isc_result_t
dhcp_failover_process_update_done (dhcp_failover_state_t
*,
3210 failover_message_t
*);
3211 void ia_remove_all_lease(struct ia_xx
*ia
, const char *file
, int line
);
3212 void dhcp_failover_recover_done (void *);
3213 void failover_print
PROTO ((char *, unsigned *, unsigned, const char *));
3214 void update_partner
PROTO ((struct lease
*));
3215 int load_balance_mine (struct packet
*, dhcp_failover_state_t
*);
3216 int peer_wants_lease (struct lease
*);
3217 binding_state_t
normal_binding_state_transition_check (struct lease
*,
3218 dhcp_failover_state_t
*,
3222 conflict_binding_state_transition_check (struct lease
*,
3223 dhcp_failover_state_t
*,
3224 binding_state_t
, u_int32_t
);
3225 int lease_mine_to_reallocate (struct lease
*);
3227 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state
, dhcp_failover_state_t
,
3228 dhcp_type_failover_state
)
3229 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener
, dhcp_failover_listener_t
,
3230 dhcp_type_failover_listener
)
3231 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link
, dhcp_failover_link_t
,
3232 dhcp_type_failover_link
)
3233 #endif /* FAILOVER_PROTOCOL */
3235 const char *binding_state_print (enum failover_state
);
3239 HASH_FUNCTIONS_DECL(ia
, unsigned char *, struct ia_xx
, ia_hash_t
);
3240 HASH_FUNCTIONS_DECL(iasubopt
, struct in6_addr
*, struct iasubopt
,
3243 isc_result_t
iasubopt_allocate(struct iasubopt
**iasubopt
,
3244 const char *file
, int line
);
3245 isc_result_t
iasubopt_reference(struct iasubopt
**iasubopt
,
3246 struct iasubopt
*src
,
3247 const char *file
, int line
);
3248 isc_result_t
iasubopt_dereference(struct iasubopt
**iasubopt
,
3249 const char *file
, int line
);
3251 isc_result_t
ia_make_key(struct data_string
*key
, u_int32_t iaid
,
3252 const char *duid
, unsigned int duid_len
,
3253 const char *file
, int line
);
3254 isc_result_t
ia_allocate(struct ia_xx
**ia
, u_int32_t iaid
,
3255 const char *duid
, unsigned int duid_len
,
3256 const char *file
, int line
);
3257 isc_result_t
ia_reference(struct ia_xx
**ia
, struct ia_xx
*src
,
3258 const char *file
, int line
);
3259 isc_result_t
ia_dereference(struct ia_xx
**ia
,
3260 const char *file
, int line
);
3261 isc_result_t
ia_add_iasubopt(struct ia_xx
*ia
, struct iasubopt
*iasubopt
,
3262 const char *file
, int line
);
3263 void ia_remove_iasubopt(struct ia_xx
*ia
, struct iasubopt
*iasubopt
,
3264 const char *file
, int line
);
3265 isc_boolean_t
ia_equal(const struct ia_xx
*a
, const struct ia_xx
*b
);
3267 isc_result_t
ipv6_pool_allocate(struct ipv6_pool
**pool
, u_int16_t type
,
3268 const struct in6_addr
*start_addr
,
3269 int bits
, int units
,
3270 const char *file
, int line
);
3271 isc_result_t
ipv6_pool_reference(struct ipv6_pool
**pool
,
3272 struct ipv6_pool
*src
,
3273 const char *file
, int line
);
3274 isc_result_t
ipv6_pool_dereference(struct ipv6_pool
**pool
,
3275 const char *file
, int line
);
3276 isc_result_t
create_lease6(struct ipv6_pool
*pool
,
3277 struct iasubopt
**addr
,
3278 unsigned int *attempts
,
3279 const struct data_string
*uid
,
3280 time_t soft_lifetime_end_time
);
3281 isc_result_t
add_lease6(struct ipv6_pool
*pool
,
3282 struct iasubopt
*lease
,
3283 time_t valid_lifetime_end_time
);
3284 isc_result_t
renew_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3285 isc_result_t
expire_lease6(struct iasubopt
**leasep
,
3286 struct ipv6_pool
*pool
, time_t now
);
3287 isc_result_t
release_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3288 isc_result_t
decline_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3289 isc_boolean_t
lease6_exists(const struct ipv6_pool
*pool
,
3290 const struct in6_addr
*addr
);
3291 isc_result_t
mark_lease_unavailble(struct ipv6_pool
*pool
,
3292 const struct in6_addr
*addr
);
3294 isc_result_t
create_prefix6(struct ipv6_pool
*pool
,
3295 struct iasubopt
**pref
,
3296 unsigned int *attempts
,
3297 const struct data_string
*uid
,
3298 time_t soft_lifetime_end_time
);
3299 isc_boolean_t
prefix6_exists(const struct ipv6_pool
*pool
,
3300 const struct in6_addr
*pref
, u_int8_t plen
);
3302 isc_result_t
add_ipv6_pool(struct ipv6_pool
*pool
);
3303 isc_result_t
find_ipv6_pool(struct ipv6_pool
**pool
, u_int16_t type
,
3304 const struct in6_addr
*addr
);
3305 isc_boolean_t
ipv6_in_pool(const struct in6_addr
*addr
,
3306 const struct ipv6_pool
*pool
);
3308 isc_result_t
renew_leases(struct ia_xx
*ia
);
3309 isc_result_t
release_leases(struct ia_xx
*ia
);
3310 isc_result_t
decline_leases(struct ia_xx
*ia
);
3311 void schedule_lease_timeout(struct ipv6_pool
*pool
);
3312 void schedule_all_ipv6_lease_timeouts();
3314 void mark_hosts_unavailable(void);
3315 void mark_phosts_unavailable(void);
3316 void mark_interfaces_unavailable(void);