3 Definitions for dhcpd... */
6 * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1996-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 #include <sys/socket.h>
40 #include <arpa/inet.h>
44 #define fd_set cygwin_fd_set
45 #include <sys/types.h>
59 #include "arpa/nameser.h"
60 #if defined (NSUPDATE)
61 # include "minires/minires.h"
65 typedef struct hash_table group_hash_t
;
66 typedef struct hash_table universe_hash_t
;
67 typedef struct hash_table option_name_hash_t
;
68 typedef struct hash_table option_code_hash_t
;
69 typedef struct hash_table dns_zone_hash_t
;
70 typedef struct hash_table lease_hash_t
;
71 typedef struct hash_table host_hash_t
;
72 typedef struct hash_table class_hash_t
;
75 #include "statement.h"
80 #include <isc-dhcp/result.h>
81 #include <omapip/omapip_p.h>
83 #if !defined (BYTE_NAME_HASH_SIZE)
84 # define BYTE_NAME_HASH_SIZE 401 /* Default would be rediculous. */
86 #if !defined (BYTE_CODE_HASH_SIZE)
87 # define BYTE_CODE_HASH_SIZE 254 /* Default would be rediculous. */
90 #if !defined (WORD_NAME_HASH_SIZE)
91 # define WORD_NAME_HASH_SIZE 0 /* Default. */
93 #if !defined (WORD_CODE_HASH_SIZE)
94 # define WORD_CODE_HASH_SIZE 0 /* Default. */
97 #if !defined (QUAD_NAME_HASH_SIZE)
98 # define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE
100 #if !defined (QUAD_CODE_HASH_SIZE)
101 # define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE
104 #if !defined (DNS_HASH_SIZE)
105 # define DNS_HASH_SIZE 0 /* Default. */
108 /* Default size to use for name/code hashes on user-defined option spaces. */
109 #if !defined (DEFAULT_SPACE_HASH_SIZE)
110 # define DEFAULT_SPACE_HASH_SIZE 11
113 #if !defined (NWIP_HASH_SIZE)
114 # define NWIP_HASH_SIZE 11 /* A really small table. */
117 #if !defined (FQDN_HASH_SIZE)
118 # define FQDN_HASH_SIZE 7 /* A rediculously small table. */
121 #if !defined (VIVCO_HASH_SIZE)
122 # define VIVCO_HASH_SIZE QUAD_CODE_HASH_SIZE
125 #if !defined (VIVSO_HASH_SIZE)
126 # define VIVSO_HASH_SIZE VIVCO_HASH_SIZE
129 #if !defined (VIV_ISC_HASH_SIZE)
130 # define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */
133 #if !defined (UNIVERSE_HASH_SIZE)
134 # define UNIVERSE_HASH_SIZE 11 /* A really small table. */
137 #if !defined (GROUP_HASH_SIZE)
138 # define GROUP_HASH_SIZE 0 /* Default. */
141 #if !defined (HOST_HASH_SIZE)
142 # define HOST_HASH_SIZE 0 /* Default. */
145 #if !defined (LEASE_HASH_SIZE)
146 # define LEASE_HASH_SIZE 0 /* Default. */
149 #if !defined (SCLASS_HASH_SIZE)
150 # define SCLASS_HASH_SIZE 1009 /* A less than gigantic sized table. */
153 #if !defined (AGENT_HASH_SIZE)
154 # define AGENT_HASH_SIZE 11 /* A really small table. */
157 #if !defined (SERVER_HASH_SIZE)
158 # define SERVER_HASH_SIZE (sizeof(server_options) / sizeof(struct option))
163 #if !defined (OPTION_HASH_SIZE)
164 # define OPTION_HASH_SIZE 17
165 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
166 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
169 #define compute_option_hash(x) \
170 (((x) & (OPTION_HASH_PTWO - 1)) + \
171 (((x) >> OPTION_HASH_EXP) & \
172 (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
174 enum dhcp_shutdown_state
{
176 shutdown_omapi_connections
,
177 shutdown_drop_omapi_connections
,
182 /* Client FQDN option, failover FQDN option, etc. */
189 #include "failover.h"
191 /* A parsing context. */
208 enum dhcp_token token
;
215 char comments
[4096];
218 int warnings_occurred
;
221 unsigned bufix
, buflen
;
225 /* Variable-length array of data. */
228 struct string_list
*next
;
232 /* A name server, from /etc/resolv.conf. */
234 struct name_server
*next
;
235 struct sockaddr_in addr
;
239 /* A domain search list element. */
240 struct domain_search_list
{
241 struct domain_search_list
*next
;
246 /* Option tag structures are used to build chains of option tags, for
247 when we're sure we're not going to have enough of them to justify
248 maintaining an array. */
251 struct option_tag
*next
;
255 /* An agent option structure. We need a special structure for the
256 Relay Agent Information option because if more than one appears in
257 a message, we have to keep them seperate. */
259 struct agent_options
{
260 struct agent_options
*next
;
262 struct option_tag
*first
;
265 struct option_cache
{
267 struct option_cache
*next
;
268 struct expression
*expression
;
269 struct option
*option
;
270 struct data_string data
;
272 #define OPTION_HAD_NULLS 0x00000001
276 struct option_state
{
281 VOIDPTR universes
[1];
284 /* A dhcp packet and the pointers to its option values. */
286 struct dhcp_packet
*raw
;
288 unsigned packet_length
;
292 struct iaddr client_addr
;
293 struct interface_info
*interface
; /* Interface on which packet
295 struct hardware
*haddr
; /* Physical link address
296 of local sender (maybe gateway). */
298 /* Information for relay agent options (see
299 draft-ietf-dhc-agent-options-xx.txt). */
300 u_int8_t
*circuit_id
; /* Circuit ID of client connection. */
302 u_int8_t
*remote_id
; /* Remote ID of client. */
305 int got_requested_address
; /* True if client sent the
306 dhcp-requested-address option. */
308 struct shared_network
*shared_network
;
309 struct option_state
*options
;
311 #if !defined (PACKET_MAX_CLASSES)
312 # define PACKET_MAX_CLASSES 5
315 struct class *classes
[PACKET_MAX_CLASSES
];
321 /* A network interface's MAC address. */
332 server_hibernate
= 3,
334 } control_object_state_t
;
337 OMAPI_OBJECT_PREAMBLE
;
338 control_object_state_t state
;
339 } dhcp_control_object_t
;
344 #define FTS_EXPIRED 3
345 #define FTS_RELEASED 4
346 #define FTS_ABANDONED 5
349 typedef u_int8_t binding_state_t
;
351 /* FTS_LAST is the highest value that is valid for a lease binding state. */
352 #define FTS_LAST FTS_BACKUP
354 /* A dhcp lease declaration structure. */
356 OMAPI_OBJECT_PREAMBLE
;
358 struct lease
*n_uid
, *n_hw
;
360 struct iaddr ip_addr
;
361 TIME starts
, ends
, timestamp
, sort_time
;
362 char *client_hostname
;
363 struct binding_scope
*scope
;
364 struct host_decl
*host
;
365 struct subnet
*subnet
;
367 struct class *billing_class
;
368 struct option_chain_head
*agent_options
;
370 struct executable_statement
*on_expiry
;
371 struct executable_statement
*on_commit
;
372 struct executable_statement
*on_release
;
375 unsigned short uid_len
;
376 unsigned short uid_max
;
377 unsigned char uid_buf
[7];
378 struct hardware hardware_addr
;
381 # define STATIC_LEASE 1
382 # define BOOTP_LEASE 2
383 # define RESERVED_LEASE 4
384 # define MS_NULL_TERMINATION 8
385 # define ON_UPDATE_QUEUE 16
386 # define ON_ACK_QUEUE 32
387 # define UNICAST_BROADCAST_HACK 64
388 # define ON_DEFERRED_QUEUE 128
390 /* Persistent flags are to be preserved on a given lease structure. */
391 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
392 /* Ephemeral flags are to be preserved on a given lease (copied etc). */
393 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
394 UNICAST_BROADCAST_HACK | \
398 binding_state_t binding_state
;
399 binding_state_t next_binding_state
;
400 binding_state_t desired_binding_state
;
402 struct lease_state
*state
;
404 /* 'tsfp' is more of an 'effective' tsfp. It may be calculated from
405 * stos+mclt for example if it's an expired lease and the server is
406 * in partner-down state. 'atsfp' is zeroed whenever a lease is
407 * updated - and only set when the peer acknowledges it. This
408 * ensures every state change is transmitted.
410 TIME tstp
; /* Time sent to partner. */
411 TIME tsfp
; /* Time sent from partner. */
412 TIME atsfp
; /* Actual time sent from partner. */
413 TIME cltt
; /* Client last transaction time. */
414 u_int32_t last_xid
; /* XID we sent in this lease's BNDUPD */
415 struct lease
*next_pending
;
419 struct lease_state
*next
;
421 struct interface_info
*ip
;
423 struct packet
*packet
; /* The incoming packet. */
427 struct option_state
*options
;
428 struct data_string parameter_request_list
;
429 int max_message_size
;
430 unsigned char expiry
[4], renewal
[4], rebind
[4];
431 struct data_string filename
, server_name
;
432 int got_requested_address
;
433 int got_server_identifier
;
434 struct shared_network
*shared_network
; /* Shared network of interface
435 on which request arrived. */
439 u_int16_t bootp_flags
;
440 struct in_addr ciaddr
;
441 struct in_addr siaddr
;
442 struct in_addr giaddr
;
450 #define SHARED_NET_DECL 2
451 #define SUBNET_DECL 3
456 /* Possible modes in which discover_interfaces can run. */
458 #define DISCOVER_RUNNING 0
459 #define DISCOVER_SERVER 1
460 #define DISCOVER_UNCONFIGURED 2
461 #define DISCOVER_RELAY 3
462 #define DISCOVER_REQUESTED 4
464 /* Server option names. */
466 #define SV_DEFAULT_LEASE_TIME 1
467 #define SV_MAX_LEASE_TIME 2
468 #define SV_MIN_LEASE_TIME 3
469 #define SV_BOOTP_LEASE_CUTOFF 4
470 #define SV_BOOTP_LEASE_LENGTH 5
471 #define SV_BOOT_UNKNOWN_CLIENTS 6
472 #define SV_DYNAMIC_BOOTP 7
473 #define SV_ALLOW_BOOTP 8
474 #define SV_ALLOW_BOOTING 9
475 #define SV_ONE_LEASE_PER_CLIENT 10
476 #define SV_GET_LEASE_HOSTNAMES 11
477 #define SV_USE_HOST_DECL_NAMES 12
478 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
479 #define SV_MIN_SECS 14
480 #define SV_FILENAME 15
481 #define SV_SERVER_NAME 16
482 #define SV_NEXT_SERVER 17
483 #define SV_AUTHORITATIVE 18
484 #define SV_VENDOR_OPTION_SPACE 19
485 #define SV_ALWAYS_REPLY_RFC1048 20
486 #define SV_SITE_OPTION_SPACE 21
487 #define SV_ALWAYS_BROADCAST 22
488 #define SV_DDNS_DOMAIN_NAME 23
489 #define SV_DDNS_HOST_NAME 24
490 #define SV_DDNS_REV_DOMAIN_NAME 25
491 #define SV_LEASE_FILE_NAME 26
492 #define SV_PID_FILE_NAME 27
493 #define SV_DUPLICATES 28
494 #define SV_DECLINES 29
495 #define SV_DDNS_UPDATES 30
496 #define SV_OMAPI_PORT 31
497 #define SV_LOCAL_PORT 32
498 #define SV_LIMITED_BROADCAST_ADDRESS 33
499 #define SV_REMOTE_PORT 34
500 #define SV_LOCAL_ADDRESS 35
501 #define SV_OMAPI_KEY 36
502 #define SV_STASH_AGENT_OPTIONS 37
503 #define SV_DDNS_TTL 38
504 #define SV_DDNS_UPDATE_STYLE 39
505 #define SV_CLIENT_UPDATES 40
506 #define SV_UPDATE_OPTIMIZATION 41
507 #define SV_PING_CHECKS 42
508 #define SV_UPDATE_STATIC_LEASES 43
509 #define SV_LOG_FACILITY 44
510 #define SV_DO_FORWARD_UPDATES 45
511 #define SV_PING_TIMEOUT 46
512 #define SV_RESERVE_INFINITE 47
513 #define SV_DDNS_CONFLICT_DETECT 48
515 #if !defined (DEFAULT_PING_TIMEOUT)
516 # define DEFAULT_PING_TIMEOUT 1
519 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
520 # define DEFAULT_DEFAULT_LEASE_TIME 43200
523 #if !defined (DEFAULT_MIN_LEASE_TIME)
524 # define DEFAULT_MIN_LEASE_TIME 300
527 #if !defined (DEFAULT_MAX_LEASE_TIME)
528 # define DEFAULT_MAX_LEASE_TIME 86400
531 #if !defined (DEFAULT_DDNS_TTL)
532 # define DEFAULT_DDNS_TTL 3600
535 /* Client option names */
538 #define CL_SELECT_INTERVAL 2
539 #define CL_REBOOT_TIMEOUT 3
540 #define CL_RETRY_INTERVAL 4
541 #define CL_BACKOFF_CUTOFF 5
542 #define CL_INITIAL_INTERVAL 6
543 #define CL_BOOTP_POLICY 7
544 #define CL_SCRIPT_NAME 8
545 #define CL_REQUESTED_OPTIONS 9
546 #define CL_REQUESTED_LEASE_TIME 10
547 #define CL_SEND_OPTIONS 11
549 #define CL_REJECT_LIST 13
551 #ifndef CL_DEFAULT_TIMEOUT
552 # define CL_DEFAULT_TIMEOUT 60
555 #ifndef CL_DEFAULT_SELECT_INTERVAL
556 # define CL_DEFAULT_SELECT_INTERVAL 0
559 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
560 # define CL_DEFAULT_REBOOT_TIMEOUT 10
563 #ifndef CL_DEFAULT_RETRY_INTERVAL
564 # define CL_DEFAULT_RETRY_INTERVAL 300
567 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
568 # define CL_DEFAULT_BACKOFF_CUTOFF 120
571 #ifndef CL_DEFAULT_INITIAL_INTERVAL
572 # define CL_DEFAULT_INITIAL_INTERVAL 10
575 #ifndef CL_DEFAULT_BOOTP_POLICY
576 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
579 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
580 # define CL_DEFAULT_REQUESTED_OPTIONS \
582 DHO_BROADCAST_ADDRESS, \
586 DHO_DOMAIN_NAME_SERVERS, \
590 struct group_object
{
591 OMAPI_OBJECT_PREAMBLE
;
593 struct group_object
*n_dynamic
;
597 #define GROUP_OBJECT_DELETED 1
598 #define GROUP_OBJECT_DYNAMIC 2
599 #define GROUP_OBJECT_STATIC 4
602 /* Group of declarations that share common parameters. */
607 struct group_object
*object
;
608 struct subnet
*subnet
;
609 struct shared_network
*shared_network
;
611 struct executable_statement
*statements
;
614 /* A dhcp host declaration structure. */
616 OMAPI_OBJECT_PREAMBLE
;
617 struct host_decl
*n_ipaddr
;
618 struct host_decl
*n_dynamic
;
620 struct hardware interface
;
621 struct data_string client_identifier
;
622 struct option_cache
*fixed_addr
;
624 struct group_object
*named_group
;
625 struct data_string auth_key_id
;
627 #define HOST_DECL_DELETED 1
628 #define HOST_DECL_DYNAMIC 2
629 #define HOST_DECL_STATIC 4
635 permit_unknown_clients
,
636 permit_known_clients
,
637 permit_authenticated_clients
,
638 permit_unauthenticated_clients
,
640 permit_dynamic_bootp_clients
,
647 OMAPI_OBJECT_PREAMBLE
;
650 struct shared_network
*shared_network
;
651 struct permit
*permit_list
;
652 struct permit
*prohibit_list
;
653 struct lease
*active
;
654 struct lease
*expired
;
656 struct lease
*backup
;
657 struct lease
*abandoned
;
658 struct lease
*reserved
;
659 TIME next_event_time
;
664 #if defined (FAILOVER_PROTOCOL)
665 dhcp_failover_state_t
*failover_peer
;
669 struct shared_network
{
670 OMAPI_OBJECT_PREAMBLE
;
671 struct shared_network
*next
;
673 struct subnet
*subnets
;
674 struct interface_info
*interface
;
677 #if defined (FAILOVER_PROTOCOL)
678 dhcp_failover_state_t
*failover_peer
;
683 OMAPI_OBJECT_PREAMBLE
;
684 struct subnet
*next_subnet
;
685 struct subnet
*next_sibling
;
686 struct shared_network
*shared_network
;
687 struct interface_info
*interface
;
688 struct iaddr interface_address
;
690 struct iaddr netmask
;
696 struct collection
*next
;
699 struct class *classes
;
702 /* Used as an argument to parse_clasS_decl() */
703 #define CLASS_TYPE_VENDOR 0
704 #define CLASS_TYPE_USER 1
705 #define CLASS_TYPE_CLASS 2
706 #define CLASS_TYPE_SUBCLASS 3
708 /* XXX classes must be reference-counted. */
710 OMAPI_OBJECT_PREAMBLE
;
711 struct class *nic
; /* Next in collection. */
712 struct class *superclass
; /* Set for spawned classes only. */
713 char *name
; /* Not set for spawned classes. */
715 /* A class may be configured to permit a limited number of leases. */
718 struct lease
**billed_leases
;
720 /* If nonzero, class has not been saved since it was last
724 /* Hash table containing subclasses. */
726 struct data_string hash_string
;
728 /* Expression used to match class. */
729 struct expression
*expr
;
731 /* Expression used to compute subclass identifiers for spawning
732 and to do subclass matching. */
733 struct expression
*submatch
;
738 /* Statements to execute if class matches. */
739 struct executable_statement
*statements
;
741 #define CLASS_DECL_DELETED 1
742 #define CLASS_DECL_DYNAMIC 2
743 #define CLASS_DECL_STATIC 4
744 #define CLASS_DECL_SUBCLASS 8
749 /* DHCP client lease structure... */
750 struct client_lease
{
751 struct client_lease
*next
; /* Next lease in list. */
752 TIME expiry
, renewal
, rebind
; /* Lease timeouts. */
753 struct iaddr address
; /* Address being leased. */
754 char *server_name
; /* Name of boot server. */
755 char *filename
; /* Name of file we're supposed to boot. */
756 struct string_list
*medium
; /* Network medium. */
757 struct auth_key
*key
; /* Key used in basic DHCP authentication. */
759 unsigned int is_static
: 1; /* If set, lease is from config file. */
760 unsigned int is_bootp
: 1; /* If set, lease was acquired with BOOTP. */
762 struct option_state
*options
; /* Options supplied with lease. */
765 /* Possible states in which the client can be. */
777 /* Authentication and BOOTP policy possibilities (not all values work
779 enum policy
{ P_IGNORE
, P_ACCEPT
, P_PREFER
, P_REQUIRE
, P_DONT
};
781 /* Configuration information from the config file... */
782 struct client_config
{
784 * When a message has been received, run these statements
787 struct group
*on_receipt
;
790 * When a message is sent, run these statements.
792 struct group
*on_transmission
;
794 u_int32_t
*required_options
; /* Options server must supply. */
795 u_int32_t
*requested_options
; /* Options to request from server. */
797 TIME timeout
; /* Start to panic if we don't get a
798 lease in this time period when
800 TIME initial_interval
; /* All exponential backoff intervals
802 TIME retry_interval
; /* If the protocol failed to produce
803 an address before the timeout,
804 try the protocol again after this
806 TIME select_interval
; /* Wait this many seconds from the
807 first DHCPDISCOVER before
808 picking an offered lease. */
809 TIME reboot_timeout
; /* When in INIT-REBOOT, wait this
810 long before giving up and going
812 TIME backoff_cutoff
; /* When doing exponential backoff,
813 never back off to an interval
814 longer than this amount. */
815 u_int32_t requested_lease
; /* Requested lease time, if user
816 doesn't configure one. */
817 struct string_list
*media
; /* Possible network media values. */
818 char *script_name
; /* Name of config script. */
819 char *vendor_space_name
; /* Name of config script. */
820 enum policy bootp_policy
;
821 /* Ignore, accept or prefer BOOTP
823 enum policy auth_policy
;
824 /* Require authentication, prefer
825 authentication, or don't try to
827 struct string_list
*medium
; /* Current network medium. */
829 struct iaddrmatchlist
*reject_list
; /* Servers to reject. */
831 int omapi_port
; /* port on which to accept OMAPI
832 connections, or -1 for no
834 int do_forward_update
; /* If nonzero, and if we have the
835 information we need, update the
836 A record for the address we get. */
839 /* Per-interface state used in the dhcp client... */
840 struct client_state
{
841 struct client_state
*next
;
842 struct interface_info
*interface
;
845 struct client_lease
*active
; /* Currently active lease. */
846 struct client_lease
*new; /* New lease. */
847 struct client_lease
*offered_leases
; /* Leases offered to us. */
848 struct client_lease
*leases
; /* Leases we currently hold. */
849 struct client_lease
*alias
; /* Alias lease. */
851 enum dhcp_state state
; /* Current state for this interface. */
852 struct iaddr destination
; /* Where to send packet. */
853 u_int32_t xid
; /* Transaction ID. */
854 u_int16_t secs
; /* secs value from DHCPDISCOVER. */
855 TIME first_sending
; /* When was first copy sent? */
856 TIME interval
; /* What's the current resend interval? */
857 int dns_update_timeout
; /* Last timeout set for DNS update. */
858 struct string_list
*medium
; /* Last media type tried. */
859 struct dhcp_packet packet
; /* Outgoing DHCP packet. */
860 unsigned packet_length
; /* Actual length of generated packet. */
862 struct iaddr requested_address
; /* Address we would like to get. */
864 struct client_config
*config
; /* Client configuration. */
865 struct string_list
*env
; /* Client script environment. */
866 int envc
; /* Number of entries in environment. */
868 struct option_state
*sent_options
; /* Options we sent. */
871 /* Relay agent server list. */
873 struct server_list
*next
;
874 struct sockaddr_in to
;
877 /* Information about each network interface. */
879 struct interface_info
{
880 OMAPI_OBJECT_PREAMBLE
;
881 struct interface_info
*next
; /* Next interface in list... */
882 struct shared_network
*shared_network
;
883 /* Networks connected to this interface. */
884 struct hardware hw_address
; /* Its physical address. */
885 struct in_addr
*addresses
; /* Addresses associated with
887 int address_count
; /* Number of addresses associated with
889 int address_max
; /* Max number of addresses we can
890 store in current buffer. */
892 u_int8_t
*circuit_id
; /* Circuit ID associated with this
894 unsigned circuit_id_len
; /* Length of Circuit ID, if there
896 u_int8_t
*remote_id
; /* Remote ID associated with this
897 interface (if any). */
898 unsigned remote_id_len
; /* Length of Remote ID. */
899 struct server_list
*servers
; /* List of relay servers for this
902 char name
[IFNAMSIZ
]; /* Its name... */
903 int index
; /* Its index. */
904 int rfdesc
; /* Its read file descriptor. */
905 int wfdesc
; /* Its write file descriptor, if
907 unsigned char *rbuf
; /* Read buffer, if required. */
908 unsigned int rbuf_max
; /* Size of read buffer. */
909 size_t rbuf_offset
; /* Current offset into buffer. */
910 size_t rbuf_len
; /* Length of data in buffer. */
912 struct ifreq
*ifp
; /* Pointer to ifreq struct. */
913 int configured
; /* If set to 1, interface has at
914 * least one valid IP address.
916 u_int32_t flags
; /* Control flags... */
917 #define INTERFACE_REQUESTED 1
918 #define INTERFACE_AUTOMATIC 2
919 #define INTERFACE_RUNNING 4
921 /* Only used by DHCP client code. */
922 struct client_state
*client
;
923 # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
925 struct hardware dlpi_broadcast_addr
;
926 # endif /* DLPI_SEND || DLPI_RECEIVE */
929 struct hardware_link
{
930 struct hardware_link
*next
;
931 char name
[IFNAMSIZ
];
932 struct hardware address
;
935 typedef void (*tvref_t
)(void *, void *, const char *, int);
936 typedef void (*tvunref_t
)(void *, const char *, int);
938 struct timeout
*next
;
940 void (*func
) PROTO ((void *));
947 struct protocol
*next
;
949 void (*handler
) PROTO ((struct protocol
*));
953 struct dns_query
; /* forward */
956 struct dns_wakeup
*next
; /* Next wakeup in chain. */
957 void (*func
) PROTO ((struct dns_query
*));
960 struct dns_question
{
961 u_int16_t type
; /* Type of query. */
962 u_int16_t
class; /* Class of query. */
963 unsigned char data
[1]; /* Query data. */
967 u_int16_t type
; /* Type of answer. */
968 u_int16_t
class; /* Class of answer. */
969 int count
; /* Number of answers. */
970 unsigned char *answers
[1]; /* Pointers to answers. */
974 struct dns_query
*next
; /* Next query in hash bucket. */
975 u_int32_t hash
; /* Hash bucket index. */
976 TIME expiry
; /* Query expiry time (zero if not yet
978 u_int16_t id
; /* Query ID (also hash table index) */
979 caddr_t waiters
; /* Pointer to list of things waiting
982 struct dns_question
*question
; /* Question, internal format. */
983 struct dns_answer
*answer
; /* Answer, internal format. */
985 unsigned char *query
; /* Query formatted for DNS server. */
986 unsigned len
; /* Length of entire query. */
987 int sent
; /* The query has been sent. */
988 struct dns_wakeup
*wakeups
; /* Wakeups to call if this query is
990 struct name_server
*next_server
; /* Next server to try. */
991 int backoff
; /* Current backoff, in seconds. */
998 struct option_cache
*primary
;
999 struct option_cache
*secondary
;
1000 struct auth_key
*key
;
1004 OMAPI_OBJECT_PREAMBLE
;
1006 void (*icmp_handler
) PROTO ((struct iaddr
, u_int8_t
*, int));
1011 /* Bitmask of dhcp option codes. */
1012 typedef unsigned char option_mask
[16];
1014 /* DHCP Option mask manipulation macros... */
1015 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
1016 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1017 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1018 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1019 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1021 /* An option occupies its length plus two header bytes (code and
1022 length) for every 255 bytes that must be stored. */
1023 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1025 /* Default path to dhcpd config file. */
1027 #undef _PATH_DHCPD_CONF
1028 #define _PATH_DHCPD_CONF "dhcpd.conf"
1029 #undef _PATH_DHCPD_DB
1030 #define _PATH_DHCPD_DB "dhcpd.leases"
1031 #undef _PATH_DHCPD_PID
1032 #define _PATH_DHCPD_PID "dhcpd.pid"
1034 #ifndef _PATH_DHCPD_CONF
1035 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
1038 #ifndef _PATH_DHCPD_DB
1039 #define _PATH_DHCPD_DB "/etc/dhcpd.leases"
1042 #ifndef _PATH_DHCPD_PID
1043 #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
1047 #ifndef _PATH_DHCLIENT_CONF
1048 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
1051 #ifndef _PATH_DHCLIENT_SCRIPT
1052 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
1055 #ifndef _PATH_DHCLIENT_PID
1056 #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
1059 #ifndef _PATH_DHCLIENT_DB
1060 #define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
1063 #ifndef _PATH_RESOLV_CONF
1064 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
1067 #ifndef _PATH_DHCRELAY_PID
1068 #define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid"
1071 #ifndef DHCPD_LOG_FACILITY
1072 #define DHCPD_LOG_FACILITY LOG_DAEMON
1075 #define MAX_TIME 0x7fffffff
1078 /* External definitions... */
1080 HASH_FUNCTIONS_DECL (group
, const char *, struct group_object
, group_hash_t
)
1081 HASH_FUNCTIONS_DECL (universe
, const char *, struct universe
, universe_hash_t
)
1082 HASH_FUNCTIONS_DECL (option_name
, const char *, struct option
,
1084 HASH_FUNCTIONS_DECL (option_code
, const unsigned *, struct option
,
1086 HASH_FUNCTIONS_DECL (dns_zone
, const char *, struct dns_zone
, dns_zone_hash_t
)
1087 HASH_FUNCTIONS_DECL (lease
, const unsigned char *, struct lease
, lease_hash_t
)
1088 HASH_FUNCTIONS_DECL (host
, const unsigned char *, struct host_decl
, host_hash_t
)
1089 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t
)
1093 extern struct option
*vendor_cfg_option
;
1094 int parse_options
PROTO ((struct packet
*));
1095 int parse_option_buffer
PROTO ((struct option_state
*, const unsigned char *,
1096 unsigned, struct universe
*));
1097 struct universe
*find_option_universe (struct option
*, const char *);
1098 int parse_encapsulated_suboptions (struct option_state
*, struct option
*,
1099 const unsigned char *, unsigned,
1100 struct universe
*, const char *);
1101 int cons_options
PROTO ((struct packet
*, struct dhcp_packet
*, struct lease
*,
1102 struct client_state
*,
1103 int, struct option_state
*, struct option_state
*,
1104 struct binding_scope
**,
1105 int, int, int, struct data_string
*, const char *));
1106 int fqdn_universe_decode (struct option_state
*,
1107 const unsigned char *, unsigned, struct universe
*);
1108 int store_options
PROTO ((int *, unsigned char *, unsigned, struct packet
*,
1109 struct lease
*, struct client_state
*,
1110 struct option_state
*,
1111 struct option_state
*, struct binding_scope
**,
1112 unsigned *, int, unsigned, unsigned,
1113 int, const char *));
1114 int format_has_text(const char *);
1115 int format_min_length(const char *, struct option_cache
*);
1116 const char *pretty_print_option
PROTO ((struct option
*, const unsigned char *,
1117 unsigned, int, int));
1118 int get_option (struct data_string
*, struct universe
*,
1119 struct packet
*, struct lease
*, struct client_state
*,
1120 struct option_state
*, struct option_state
*,
1121 struct option_state
*, struct binding_scope
**, unsigned,
1123 void set_option (struct universe
*, struct option_state
*,
1124 struct option_cache
*, enum statement_op
);
1125 struct option_cache
*lookup_option
PROTO ((struct universe
*,
1126 struct option_state
*, unsigned));
1127 struct option_cache
*lookup_hashed_option
PROTO ((struct universe
*,
1128 struct option_state
*,
1130 int save_option_buffer (struct universe
*, struct option_state
*,
1131 struct buffer
*, unsigned char *, unsigned,
1133 void save_option
PROTO ((struct universe
*,
1134 struct option_state
*, struct option_cache
*));
1135 void save_hashed_option
PROTO ((struct universe
*,
1136 struct option_state
*, struct option_cache
*));
1137 void delete_option
PROTO ((struct universe
*, struct option_state
*, int));
1138 void delete_hashed_option
PROTO ((struct universe
*,
1139 struct option_state
*, int));
1140 int option_cache_dereference
PROTO ((struct option_cache
**,
1141 const char *, int));
1142 int hashed_option_state_dereference
PROTO ((struct universe
*,
1143 struct option_state
*,
1144 const char *, int));
1145 int store_option
PROTO ((struct data_string
*,
1146 struct universe
*, struct packet
*, struct lease
*,
1147 struct client_state
*,
1148 struct option_state
*, struct option_state
*,
1149 struct binding_scope
**, struct option_cache
*));
1150 int option_space_encapsulate
PROTO ((struct data_string
*,
1151 struct packet
*, struct lease
*,
1152 struct client_state
*,
1153 struct option_state
*,
1154 struct option_state
*,
1155 struct binding_scope
**,
1156 struct data_string
*));
1157 int hashed_option_space_encapsulate
PROTO ((struct data_string
*,
1158 struct packet
*, struct lease
*,
1159 struct client_state
*,
1160 struct option_state
*,
1161 struct option_state
*,
1162 struct binding_scope
**,
1163 struct universe
*));
1164 int nwip_option_space_encapsulate
PROTO ((struct data_string
*,
1165 struct packet
*, struct lease
*,
1166 struct client_state
*,
1167 struct option_state
*,
1168 struct option_state
*,
1169 struct binding_scope
**,
1170 struct universe
*));
1171 int fqdn_option_space_encapsulate (struct data_string
*,
1172 struct packet
*, struct lease
*,
1173 struct client_state
*,
1174 struct option_state
*,
1175 struct option_state
*,
1176 struct binding_scope
**,
1178 void suboption_foreach (struct packet
*, struct lease
*, struct client_state
*,
1179 struct option_state
*, struct option_state
*,
1180 struct binding_scope
**, struct universe
*, void *,
1181 void (*) (struct option_cache
*, struct packet
*,
1182 struct lease
*, struct client_state
*,
1183 struct option_state
*, struct option_state
*,
1184 struct binding_scope
**,
1185 struct universe
*, void *),
1186 struct option_cache
*, const char *);
1187 void option_space_foreach (struct packet
*, struct lease
*,
1188 struct client_state
*,
1189 struct option_state
*,
1190 struct option_state
*,
1191 struct binding_scope
**,
1192 struct universe
*, void *,
1193 void (*) (struct option_cache
*,
1195 struct lease
*, struct client_state
*,
1196 struct option_state
*,
1197 struct option_state
*,
1198 struct binding_scope
**,
1199 struct universe
*, void *));
1200 void hashed_option_space_foreach (struct packet
*, struct lease
*,
1201 struct client_state
*,
1202 struct option_state
*,
1203 struct option_state
*,
1204 struct binding_scope
**,
1205 struct universe
*, void *,
1206 void (*) (struct option_cache
*,
1209 struct client_state
*,
1210 struct option_state
*,
1211 struct option_state
*,
1212 struct binding_scope
**,
1213 struct universe
*, void *));
1214 int linked_option_get
PROTO ((struct data_string
*, struct universe
*,
1215 struct packet
*, struct lease
*,
1216 struct client_state
*,
1217 struct option_state
*, struct option_state
*,
1218 struct option_state
*, struct binding_scope
**,
1220 int linked_option_state_dereference
PROTO ((struct universe
*,
1221 struct option_state
*,
1222 const char *, int));
1223 void save_linked_option (struct universe
*, struct option_state
*,
1224 struct option_cache
*);
1225 void linked_option_space_foreach (struct packet
*, struct lease
*,
1226 struct client_state
*,
1227 struct option_state
*,
1228 struct option_state
*,
1229 struct binding_scope
**,
1230 struct universe
*, void *,
1231 void (*) (struct option_cache
*,
1234 struct client_state
*,
1235 struct option_state
*,
1236 struct option_state
*,
1237 struct binding_scope
**,
1238 struct universe
*, void *));
1239 int linked_option_space_encapsulate (struct data_string
*, struct packet
*,
1240 struct lease
*, struct client_state
*,
1241 struct option_state
*,
1242 struct option_state
*,
1243 struct binding_scope
**,
1245 void delete_linked_option (struct universe
*, struct option_state
*, int);
1246 struct option_cache
*lookup_linked_option (struct universe
*,
1247 struct option_state
*, unsigned);
1248 void do_packet
PROTO ((struct interface_info
*,
1249 struct dhcp_packet
*, unsigned,
1250 unsigned int, struct iaddr
, struct hardware
*));
1253 extern TIME cur_time
;
1255 int ddns_update_style
;
1257 extern const char *path_dhcpd_conf
;
1258 extern const char *path_dhcpd_db
;
1259 extern const char *path_dhcpd_pid
;
1261 extern int dhcp_max_agent_option_packet_length
;
1263 int main
PROTO ((int, char **, char **));
1264 void postconf_initialization (int);
1265 void postdb_startup (void);
1266 void cleanup
PROTO ((void));
1267 void lease_pinged
PROTO ((struct iaddr
, u_int8_t
*, int));
1268 void lease_ping_timeout
PROTO ((void *));
1269 int dhcpd_interface_setup_hook (struct interface_info
*ip
, struct iaddr
*ia
);
1270 enum dhcp_shutdown_state shutdown_state
;
1271 isc_result_t
dhcp_io_shutdown (omapi_object_t
*, void *);
1272 isc_result_t
dhcp_set_control_state (control_object_state_t oldstate
,
1273 control_object_state_t newstate
);
1276 isc_result_t new_parse
PROTO ((struct parse
**, int,
1277 char *, unsigned, const char *, int));
1278 isc_result_t end_parse
PROTO ((struct parse
**));
1279 enum dhcp_token next_token
PROTO ((const char **, unsigned *, struct parse
*));
1280 enum dhcp_token peek_token
PROTO ((const char **, unsigned *, struct parse
*));
1283 void parse_trace_setup (void);
1284 isc_result_t readconf
PROTO ((void));
1285 isc_result_t
read_conf_file (const char *, struct group
*, int, int);
1286 #if defined (TRACING)
1287 void trace_conf_input (trace_type_t
*, unsigned, char *);
1288 void trace_conf_stop (trace_type_t
*ttype
);
1290 isc_result_t
conf_file_subparse (struct parse
*, struct group
*, int);
1291 isc_result_t
lease_file_subparse (struct parse
*);
1292 int parse_statement
PROTO ((struct parse
*,
1293 struct group
*, int, struct host_decl
*, int));
1294 #if defined (FAILOVER_PROTOCOL)
1295 void parse_failover_peer
PROTO ((struct parse
*, struct group
*, int));
1296 void parse_failover_state_declaration (struct parse
*,
1297 dhcp_failover_state_t
*);
1298 void parse_failover_state
PROTO ((struct parse
*,
1299 enum failover_state
*, TIME
*));
1301 int permit_list_match (struct permit
*, struct permit
*);
1302 void parse_pool_statement
PROTO ((struct parse
*, struct group
*, int));
1303 int parse_boolean
PROTO ((struct parse
*));
1304 int parse_lbrace
PROTO ((struct parse
*));
1305 void parse_host_declaration
PROTO ((struct parse
*, struct group
*));
1306 int parse_class_declaration
PROTO ((struct class **, struct parse
*,
1307 struct group
*, int));
1308 void parse_shared_net_declaration
PROTO ((struct parse
*, struct group
*));
1309 void parse_subnet_declaration
PROTO ((struct parse
*,
1310 struct shared_network
*));
1311 void parse_group_declaration
PROTO ((struct parse
*, struct group
*));
1312 int parse_fixed_addr_param
PROTO ((struct option_cache
**, struct parse
*));
1313 TIME parse_timestamp
PROTO ((struct parse
*));
1314 int parse_lease_declaration
PROTO ((struct lease
**, struct parse
*));
1315 void parse_address_range
PROTO ((struct parse
*, struct group
*, int,
1316 struct pool
*, struct lease
**));
1319 int ddns_updates
PROTO ((struct packet
*, struct lease
*, struct lease
*,
1320 struct lease_state
*));
1321 int ddns_removals
PROTO ((struct lease
*));
1324 void add_enumeration (struct enumeration
*);
1325 struct enumeration
*find_enumeration (const char *, int);
1326 struct enumeration_value
*find_enumeration_value (const char *, int,
1328 void skip_to_semi
PROTO ((struct parse
*));
1329 void skip_to_rbrace
PROTO ((struct parse
*, int));
1330 int parse_semi
PROTO ((struct parse
*));
1331 int parse_string
PROTO ((struct parse
*, char **, unsigned *));
1332 char *parse_host_name
PROTO ((struct parse
*));
1333 int parse_ip_addr_or_hostname
PROTO ((struct expression
**,
1334 struct parse
*, int));
1335 void parse_hardware_param
PROTO ((struct parse
*, struct hardware
*));
1336 void parse_lease_time
PROTO ((struct parse
*, TIME
*));
1337 unsigned char *parse_numeric_aggregate
PROTO ((struct parse
*,
1338 unsigned char *, unsigned *,
1339 int, int, unsigned));
1340 void convert_num
PROTO ((struct parse
*, unsigned char *, const char *,
1342 TIME parse_date
PROTO ((struct parse
*));
1343 isc_result_t parse_option_name
PROTO ((struct parse
*, int, int *,
1345 void parse_option_space_decl
PROTO ((struct parse
*));
1346 int parse_option_code_definition
PROTO ((struct parse
*, struct option
*));
1347 int parse_base64 (struct data_string
*, struct parse
*);
1348 int parse_cshl
PROTO ((struct data_string
*, struct parse
*));
1349 int parse_executable_statement
PROTO ((struct executable_statement
**,
1350 struct parse
*, int *,
1351 enum expression_context
));
1352 int parse_executable_statements
PROTO ((struct executable_statement
**,
1353 struct parse
*, int *,
1354 enum expression_context
));
1355 int parse_zone (struct dns_zone
*, struct parse
*);
1356 int parse_key (struct parse
*);
1357 int parse_on_statement
PROTO ((struct executable_statement
**,
1358 struct parse
*, int *));
1359 int parse_switch_statement
PROTO ((struct executable_statement
**,
1360 struct parse
*, int *));
1361 int parse_case_statement
PROTO ((struct executable_statement
**,
1362 struct parse
*, int *,
1363 enum expression_context
));
1364 int parse_if_statement
PROTO ((struct executable_statement
**,
1365 struct parse
*, int *));
1366 int parse_boolean_expression
PROTO ((struct expression
**,
1367 struct parse
*, int *));
1368 int parse_data_expression
PROTO ((struct expression
**,
1369 struct parse
*, int *));
1370 int parse_numeric_expression
PROTO ((struct expression
**,
1371 struct parse
*, int *));
1372 int parse_dns_expression
PROTO ((struct expression
**, struct parse
*, int *));
1373 int parse_non_binary
PROTO ((struct expression
**, struct parse
*, int *,
1374 enum expression_context
));
1375 int parse_expression
PROTO ((struct expression
**, struct parse
*, int *,
1376 enum expression_context
,
1377 struct expression
**, enum expr_op
));
1378 int parse_option_statement
PROTO ((struct executable_statement
**,
1379 struct parse
*, int,
1380 struct option
*, enum statement_op
));
1381 int parse_option_token
PROTO ((struct expression
**, struct parse
*,
1382 const char **, struct expression
*, int, int));
1383 int parse_allow_deny
PROTO ((struct option_cache
**, struct parse
*, int));
1384 int parse_auth_key
PROTO ((struct data_string
*, struct parse
*));
1385 int parse_warn (struct parse
*, const char *, ...)
1386 __attribute__((__format__(__printf__
,2,3)));
1389 #if defined (NSUPDATE)
1390 extern struct __res_state resolver_state
;
1391 extern int resolver_inited
;
1394 extern struct binding_scope
*global_scope
;
1395 pair cons
PROTO ((caddr_t
, pair
));
1396 int make_const_option_cache
PROTO ((struct option_cache
**, struct buffer
**,
1397 u_int8_t
*, unsigned, struct option
*,
1398 const char *, int));
1399 int make_host_lookup
PROTO ((struct expression
**, const char *));
1400 int enter_dns_host
PROTO ((struct dns_host_entry
**, const char *));
1401 int make_const_data (struct expression
**,
1402 const unsigned char *, unsigned, int, int,
1404 int make_const_int
PROTO ((struct expression
**, unsigned long));
1405 int make_concat
PROTO ((struct expression
**,
1406 struct expression
*, struct expression
*));
1407 int make_encapsulation
PROTO ((struct expression
**, struct data_string
*));
1408 int make_substring
PROTO ((struct expression
**, struct expression
*,
1409 struct expression
*, struct expression
*));
1410 int make_limit
PROTO ((struct expression
**, struct expression
*, int));
1411 int make_let
PROTO ((struct executable_statement
**, const char *));
1412 int option_cache
PROTO ((struct option_cache
**, struct data_string
*,
1413 struct expression
*, struct option
*,
1414 const char *, int));
1415 int evaluate_expression (struct binding_value
**, struct packet
*,
1416 struct lease
*, struct client_state
*,
1417 struct option_state
*, struct option_state
*,
1418 struct binding_scope
**, struct expression
*,
1420 int binding_value_dereference (struct binding_value
**, const char *, int);
1421 #if defined (NSUPDATE)
1422 int evaluate_dns_expression
PROTO ((ns_updrec
**, struct packet
*,
1424 struct client_state
*,
1425 struct option_state
*,
1426 struct option_state
*,
1427 struct binding_scope
**,
1428 struct expression
*));
1430 int evaluate_boolean_expression
PROTO ((int *,
1431 struct packet
*, struct lease
*,
1432 struct client_state
*,
1433 struct option_state
*,
1434 struct option_state
*,
1435 struct binding_scope
**,
1436 struct expression
*));
1437 int evaluate_data_expression
PROTO ((struct data_string
*,
1438 struct packet
*, struct lease
*,
1439 struct client_state
*,
1440 struct option_state
*,
1441 struct option_state
*,
1442 struct binding_scope
**,
1443 struct expression
*, const char *, int));
1444 int evaluate_numeric_expression (unsigned long *, struct packet
*,
1445 struct lease
*, struct client_state
*,
1446 struct option_state
*, struct option_state
*,
1447 struct binding_scope
**,
1448 struct expression
*);
1449 int evaluate_option_cache
PROTO ((struct data_string
*,
1450 struct packet
*, struct lease
*,
1451 struct client_state
*,
1452 struct option_state
*, struct option_state
*,
1453 struct binding_scope
**,
1454 struct option_cache
*,
1455 const char *, int));
1456 int evaluate_boolean_option_cache
PROTO ((int *,
1457 struct packet
*, struct lease
*,
1458 struct client_state
*,
1459 struct option_state
*,
1460 struct option_state
*,
1461 struct binding_scope
**,
1462 struct option_cache
*,
1463 const char *, int));
1464 int evaluate_boolean_expression_result
PROTO ((int *,
1465 struct packet
*, struct lease
*,
1466 struct client_state
*,
1467 struct option_state
*,
1468 struct option_state
*,
1469 struct binding_scope
**,
1470 struct expression
*));
1471 void expression_dereference
PROTO ((struct expression
**, const char *, int));
1472 int is_dns_expression
PROTO ((struct expression
*));
1473 int is_boolean_expression
PROTO ((struct expression
*));
1474 int is_data_expression
PROTO ((struct expression
*));
1475 int is_numeric_expression
PROTO ((struct expression
*));
1476 int is_compound_expression
PROTO ((struct expression
*));
1477 int op_precedence
PROTO ((enum expr_op
, enum expr_op
));
1478 enum expression_context
expression_context (struct expression
*);
1479 enum expression_context op_context
PROTO ((enum expr_op
));
1480 int write_expression
PROTO ((FILE *, struct expression
*, int, int, int));
1481 struct binding
*find_binding
PROTO ((struct binding_scope
*, const char *));
1482 int free_bindings
PROTO ((struct binding_scope
*, const char *, int));
1483 int binding_scope_dereference
PROTO ((struct binding_scope
**,
1484 const char *, int));
1485 int fundef_dereference (struct fundef
**, const char *, int);
1486 int data_subexpression_length (int *, struct expression
*);
1487 int expr_valid_for_context (struct expression
*, enum expression_context
);
1488 struct binding
*create_binding (struct binding_scope
**, const char *);
1489 int bind_ds_value (struct binding_scope
**,
1490 const char *, struct data_string
*);
1491 int find_bound_string (struct data_string
*,
1492 struct binding_scope
*, const char *);
1493 int unset (struct binding_scope
*, const char *);
1496 extern int outstanding_pings
;
1498 void dhcp
PROTO ((struct packet
*));
1499 void dhcpdiscover
PROTO ((struct packet
*, int));
1500 void dhcprequest
PROTO ((struct packet
*, int, struct lease
*));
1501 void dhcprelease
PROTO ((struct packet
*, int));
1502 void dhcpdecline
PROTO ((struct packet
*, int));
1503 void dhcpinform
PROTO ((struct packet
*, int));
1504 void nak_lease
PROTO ((struct packet
*, struct iaddr
*cip
));
1505 void ack_lease
PROTO ((struct packet
*, struct lease
*,
1506 unsigned int, TIME
, char *, int, struct host_decl
*));
1507 void dhcp_reply
PROTO ((struct lease
*));
1508 int find_lease
PROTO ((struct lease
**, struct packet
*,
1509 struct shared_network
*, int *, int *, struct lease
*,
1510 const char *, int));
1511 int mockup_lease
PROTO ((struct lease
**, struct packet
*,
1512 struct shared_network
*,
1513 struct host_decl
*));
1514 void static_lease_dereference
PROTO ((struct lease
*, const char *, int));
1516 int allocate_lease
PROTO ((struct lease
**, struct packet
*,
1517 struct pool
*, int *));
1518 int permitted
PROTO ((struct packet
*, struct permit
*));
1519 int locate_network
PROTO ((struct packet
*));
1520 int parse_agent_information_option
PROTO ((struct packet
*, int, u_int8_t
*));
1521 unsigned cons_agent_information_options
PROTO ((struct option_state
*,
1522 struct dhcp_packet
*,
1523 unsigned, unsigned));
1526 void bootp
PROTO ((struct packet
*));
1529 int (*group_write_hook
) (struct group_object
*);
1530 extern struct group
*root_group
;
1531 extern group_hash_t
*group_name_hash
;
1532 isc_result_t
delete_group (struct group_object
*, int);
1533 isc_result_t
supersede_group (struct group_object
*, int);
1534 int clone_group (struct group
**, struct group
*, const char *, int);
1535 int write_group
PROTO ((struct group_object
*));
1538 void relinquish_lease_hunks (void);
1539 struct lease
*new_leases
PROTO ((unsigned, const char *, int));
1540 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1541 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1542 void relinquish_free_lease_states (void);
1544 OMAPI_OBJECT_ALLOC_DECL (lease
, struct lease
, dhcp_type_lease
)
1545 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class
)
1546 OMAPI_OBJECT_ALLOC_DECL (subclass
, struct class, dhcp_type_subclass
)
1547 OMAPI_OBJECT_ALLOC_DECL (pool
, struct pool
, dhcp_type_pool
)
1548 OMAPI_OBJECT_ALLOC_DECL (host
, struct host_decl
, dhcp_type_host
)
1551 OMAPI_OBJECT_ALLOC_DECL (subnet
, struct subnet
, dhcp_type_subnet
)
1552 OMAPI_OBJECT_ALLOC_DECL (shared_network
, struct shared_network
,
1553 dhcp_type_shared_network
)
1554 OMAPI_OBJECT_ALLOC_DECL (group_object
, struct group_object
, dhcp_type_group
)
1555 OMAPI_OBJECT_ALLOC_DECL (dhcp_control
,
1556 dhcp_control_object_t
, dhcp_type_control
)
1558 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1559 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1560 void relinquish_free_pairs (void);
1561 void relinquish_free_expressions (void);
1562 void relinquish_free_binding_values (void);
1563 void relinquish_free_option_caches (void);
1564 void relinquish_free_packets (void);
1567 int option_chain_head_allocate (struct option_chain_head
**,
1569 int option_chain_head_reference (struct option_chain_head
**,
1570 struct option_chain_head
*,
1572 int option_chain_head_dereference (struct option_chain_head
**,
1574 int group_allocate (struct group
**, const char *, int);
1575 int group_reference (struct group
**, struct group
*, const char *, int);
1576 int group_dereference (struct group
**, const char *, int);
1577 struct dhcp_packet
*new_dhcp_packet
PROTO ((const char *, int));
1578 struct protocol
*new_protocol
PROTO ((const char *, int));
1579 struct lease_state
*new_lease_state
PROTO ((const char *, int));
1580 struct domain_search_list
*new_domain_search_list
PROTO ((const char *, int));
1581 struct name_server
*new_name_server
PROTO ((const char *, int));
1582 void free_name_server
PROTO ((struct name_server
*, const char *, int));
1583 struct option
*new_option
PROTO ((const char *, const char *, int));
1584 int option_reference(struct option
**dest
, struct option
*src
,
1585 const char * file
, int line
);
1586 int option_dereference(struct option
**dest
, const char *file
, int line
);
1587 int group_allocate (struct group
**, const char *, int);
1588 int group_reference (struct group
**, struct group
*, const char *, int);
1589 int group_dereference (struct group
**, const char *, int);
1590 struct universe
*new_universe
PROTO ((const char *, int));
1591 void free_universe
PROTO ((struct universe
*, const char *, int));
1592 void free_domain_search_list
PROTO ((struct domain_search_list
*,
1593 const char *, int));
1594 void free_lease_state
PROTO ((struct lease_state
*, const char *, int));
1595 void free_protocol
PROTO ((struct protocol
*, const char *, int));
1596 void free_dhcp_packet
PROTO ((struct dhcp_packet
*, const char *, int));
1597 struct client_lease
*new_client_lease
PROTO ((const char *, int));
1598 void free_client_lease
PROTO ((struct client_lease
*, const char *, int));
1599 struct permit
*new_permit
PROTO ((const char *, int));
1600 void free_permit
PROTO ((struct permit
*, const char *, int));
1601 pair new_pair
PROTO ((const char *, int));
1602 void free_pair
PROTO ((pair
, const char *, int));
1603 int expression_allocate
PROTO ((struct expression
**, const char *, int));
1604 int expression_reference
PROTO ((struct expression
**,
1605 struct expression
*, const char *, int));
1606 void free_expression
PROTO ((struct expression
*, const char *, int));
1607 int binding_value_allocate
PROTO ((struct binding_value
**,
1608 const char *, int));
1609 int binding_value_reference
PROTO ((struct binding_value
**,
1610 struct binding_value
*,
1611 const char *, int));
1612 void free_binding_value
PROTO ((struct binding_value
*, const char *, int));
1613 int fundef_allocate
PROTO ((struct fundef
**, const char *, int));
1614 int fundef_reference
PROTO ((struct fundef
**,
1615 struct fundef
*, const char *, int));
1616 int option_cache_allocate
PROTO ((struct option_cache
**, const char *, int));
1617 int option_cache_reference
PROTO ((struct option_cache
**,
1618 struct option_cache
*, const char *, int));
1619 int buffer_allocate
PROTO ((struct buffer
**, unsigned, const char *, int));
1620 int buffer_reference
PROTO ((struct buffer
**, struct buffer
*,
1621 const char *, int));
1622 int buffer_dereference
PROTO ((struct buffer
**, const char *, int));
1623 int dns_host_entry_allocate
PROTO ((struct dns_host_entry
**,
1624 const char *, const char *, int));
1625 int dns_host_entry_reference
PROTO ((struct dns_host_entry
**,
1626 struct dns_host_entry
*,
1627 const char *, int));
1628 int dns_host_entry_dereference
PROTO ((struct dns_host_entry
**,
1629 const char *, int));
1630 int option_state_allocate
PROTO ((struct option_state
**, const char *, int));
1631 int option_state_reference
PROTO ((struct option_state
**,
1632 struct option_state
*, const char *, int));
1633 int option_state_dereference
PROTO ((struct option_state
**,
1634 const char *, int));
1635 void data_string_copy
PROTO ((struct data_string
*,
1636 struct data_string
*, const char *, int));
1637 void data_string_forget
PROTO ((struct data_string
*, const char *, int));
1638 void data_string_truncate
PROTO ((struct data_string
*, int));
1639 int executable_statement_allocate
PROTO ((struct executable_statement
**,
1640 const char *, int));
1641 int executable_statement_reference
PROTO ((struct executable_statement
**,
1642 struct executable_statement
*,
1643 const char *, int));
1644 int packet_allocate
PROTO ((struct packet
**, const char *, int));
1645 int packet_reference
PROTO ((struct packet
**,
1646 struct packet
*, const char *, int));
1647 int packet_dereference
PROTO ((struct packet
**, const char *, int));
1648 int binding_scope_allocate
PROTO ((struct binding_scope
**,
1649 const char *, int));
1650 int binding_scope_reference
PROTO ((struct binding_scope
**,
1651 struct binding_scope
*,
1652 const char *, int));
1653 int dns_zone_allocate
PROTO ((struct dns_zone
**, const char *, int));
1654 int dns_zone_reference
PROTO ((struct dns_zone
**,
1655 struct dns_zone
*, const char *, int));
1658 #define DEFAULT_TIME_FORMAT 0
1659 #define LOCAL_TIME_FORMAT 1
1660 extern int db_time_format
;
1661 char *quotify_string (const char *, const char *, int);
1662 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1663 char *print_base64 (const unsigned char *, unsigned, const char *, int);
1664 char *print_hw_addr
PROTO ((int, int, unsigned char *));
1665 void print_lease
PROTO ((struct lease
*));
1666 void dump_raw
PROTO ((const unsigned char *, unsigned));
1667 void dump_packet_option (struct option_cache
*, struct packet
*,
1668 struct lease
*, struct client_state
*,
1669 struct option_state
*, struct option_state
*,
1670 struct binding_scope
**, struct universe
*, void *);
1671 void dump_packet
PROTO ((struct packet
*));
1672 void hash_dump
PROTO ((struct hash_table
*));
1673 char *print_hex_1
PROTO ((unsigned, const u_int8_t
*, unsigned));
1674 char *print_hex_2
PROTO ((unsigned, const u_int8_t
*, unsigned));
1675 char *print_hex_3
PROTO ((unsigned, const u_int8_t
*, unsigned));
1676 char *print_dotted_quads
PROTO ((unsigned, const u_int8_t
*));
1677 char *print_dec_1
PROTO ((unsigned long));
1678 char *print_dec_2
PROTO ((unsigned long));
1679 void print_expression
PROTO ((const char *, struct expression
*));
1680 int token_print_indent_concat (FILE *, int, int,
1681 const char *, const char *, ...);
1682 int token_indent_data_string (FILE *, int, int, const char *, const char *,
1683 struct data_string
*);
1684 int token_print_indent (FILE *, int, int,
1685 const char *, const char *, const char *);
1686 void indent_spaces (FILE *, int);
1687 #if defined (NSUPDATE)
1688 void print_dns_status (int, ns_updque
*);
1690 const char *print_time(TIME
);
1693 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
1694 || defined (USE_SOCKET_FALLBACK)
1695 int if_register_socket
PROTO ((struct interface_info
*));
1698 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
1699 void if_reinitialize_fallback
PROTO ((struct interface_info
*));
1700 void if_register_fallback
PROTO ((struct interface_info
*));
1701 ssize_t send_fallback
PROTO ((struct interface_info
*,
1702 struct packet
*, struct dhcp_packet
*, size_t,
1704 struct sockaddr_in
*, struct hardware
*));
1707 #ifdef USE_SOCKET_SEND
1708 void if_reinitialize_send
PROTO ((struct interface_info
*));
1709 void if_register_send
PROTO ((struct interface_info
*));
1710 void if_deregister_send
PROTO ((struct interface_info
*));
1711 ssize_t send_packet
PROTO ((struct interface_info
*,
1712 struct packet
*, struct dhcp_packet
*, size_t,
1714 struct sockaddr_in
*, struct hardware
*));
1716 #ifdef USE_SOCKET_RECEIVE
1717 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1718 void if_register_receive
PROTO ((struct interface_info
*));
1719 void if_deregister_receive
PROTO ((struct interface_info
*));
1720 ssize_t receive_packet
PROTO ((struct interface_info
*,
1721 unsigned char *, size_t,
1722 struct sockaddr_in
*, struct hardware
*));
1725 #if defined (USE_SOCKET_FALLBACK)
1726 isc_result_t fallback_discard
PROTO ((omapi_object_t
*));
1729 #if defined (USE_SOCKET_SEND)
1730 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1731 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1732 int supports_multiple_interfaces (struct interface_info
*);
1733 void maybe_setup_fallback
PROTO ((void));
1737 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
1738 int if_register_bpf
PROTO ( (struct interface_info
*));
1741 void if_reinitialize_send
PROTO ((struct interface_info
*));
1742 void if_register_send
PROTO ((struct interface_info
*));
1743 void if_deregister_send
PROTO ((struct interface_info
*));
1744 ssize_t send_packet
PROTO ((struct interface_info
*,
1745 struct packet
*, struct dhcp_packet
*, size_t,
1747 struct sockaddr_in
*, struct hardware
*));
1749 #ifdef USE_BPF_RECEIVE
1750 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1751 void if_register_receive
PROTO ((struct interface_info
*));
1752 void if_deregister_receive
PROTO ((struct interface_info
*));
1753 ssize_t receive_packet
PROTO ((struct interface_info
*,
1754 unsigned char *, size_t,
1755 struct sockaddr_in
*, struct hardware
*));
1757 #if defined (USE_BPF_SEND)
1758 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1759 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1760 int supports_multiple_interfaces (struct interface_info
*);
1761 void maybe_setup_fallback
PROTO ((void));
1765 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
1766 int if_register_lpf
PROTO ( (struct interface_info
*));
1769 void if_reinitialize_send
PROTO ((struct interface_info
*));
1770 void if_register_send
PROTO ((struct interface_info
*));
1771 void if_deregister_send
PROTO ((struct interface_info
*));
1772 ssize_t send_packet
PROTO ((struct interface_info
*,
1773 struct packet
*, struct dhcp_packet
*, size_t,
1775 struct sockaddr_in
*, struct hardware
*));
1777 #ifdef USE_LPF_RECEIVE
1778 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1779 void if_register_receive
PROTO ((struct interface_info
*));
1780 void if_deregister_receive
PROTO ((struct interface_info
*));
1781 ssize_t receive_packet
PROTO ((struct interface_info
*,
1782 unsigned char *, size_t,
1783 struct sockaddr_in
*, struct hardware
*));
1785 #if defined (USE_LPF_SEND)
1786 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1787 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1788 int supports_multiple_interfaces (struct interface_info
*);
1789 void maybe_setup_fallback
PROTO ((void));
1793 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
1794 int if_register_nit
PROTO ( (struct interface_info
*));
1798 void if_reinitialize_send
PROTO ((struct interface_info
*));
1799 void if_register_send
PROTO ((struct interface_info
*));
1800 void if_deregister_send
PROTO ((struct interface_info
*));
1801 ssize_t send_packet
PROTO ((struct interface_info
*,
1802 struct packet
*, struct dhcp_packet
*, size_t,
1804 struct sockaddr_in
*, struct hardware
*));
1806 #ifdef USE_NIT_RECEIVE
1807 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1808 void if_register_receive
PROTO ((struct interface_info
*));
1809 void if_deregister_receive
PROTO ((struct interface_info
*));
1810 ssize_t receive_packet
PROTO ((struct interface_info
*,
1811 unsigned char *, size_t,
1812 struct sockaddr_in
*, struct hardware
*));
1814 #if defined (USE_NIT_SEND)
1815 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1816 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1817 int supports_multiple_interfaces (struct interface_info
*);
1818 void maybe_setup_fallback
PROTO ((void));
1822 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
1823 int if_register_dlpi
PROTO ( (struct interface_info
*));
1826 #ifdef USE_DLPI_SEND
1827 void if_reinitialize_send
PROTO ((struct interface_info
*));
1828 void if_register_send
PROTO ((struct interface_info
*));
1829 void if_deregister_send
PROTO ((struct interface_info
*));
1830 ssize_t send_packet
PROTO ((struct interface_info
*,
1831 struct packet
*, struct dhcp_packet
*, size_t,
1833 struct sockaddr_in
*, struct hardware
*));
1835 #ifdef USE_DLPI_RECEIVE
1836 void if_reinitialize_receive
PROTO ((struct interface_info
*));
1837 void if_register_receive
PROTO ((struct interface_info
*));
1838 void if_deregister_receive
PROTO ((struct interface_info
*));
1839 ssize_t receive_packet
PROTO ((struct interface_info
*,
1840 unsigned char *, size_t,
1841 struct sockaddr_in
*, struct hardware
*));
1847 void if_reinitialize_send
PROTO ((struct interface_info
*));
1848 void if_register_send
PROTO ((struct interface_info
*));
1849 void if_deregister_send
PROTO ((struct interface_info
*));
1850 ssize_t send_packet
PROTO ((struct interface_info
*,
1851 struct packet
*, struct dhcp_packet
*, size_t,
1853 struct sockaddr_in
*, struct hardware
*));
1854 int can_unicast_without_arp
PROTO ((struct interface_info
*));
1855 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
1856 int supports_multiple_interfaces (struct interface_info
*);
1857 void maybe_setup_fallback
PROTO ((void));
1861 extern struct interface_info
*interfaces
,
1862 *dummy_interfaces
, *fallback_interface
;
1863 extern struct protocol
*protocols
;
1864 extern int quiet_interface_discovery
;
1865 isc_result_t
interface_setup (void);
1866 void interface_trace_setup (void);
1868 extern struct in_addr limited_broadcast
;
1869 extern struct in_addr local_address
;
1871 extern u_int16_t local_port
;
1872 extern u_int16_t remote_port
;
1873 extern int (*dhcp_interface_setup_hook
) (struct interface_info
*,
1875 extern int (*dhcp_interface_discovery_hook
) (struct interface_info
*);
1876 isc_result_t (*dhcp_interface_startup_hook
) (struct interface_info
*);
1878 extern void (*bootp_packet_handler
) PROTO ((struct interface_info
*,
1879 struct dhcp_packet
*, unsigned,
1881 struct iaddr
, struct hardware
*));
1882 extern struct timeout
*timeouts
;
1883 extern omapi_object_type_t
*dhcp_type_interface
;
1884 #if defined (TRACING)
1885 trace_type_t
*interface_trace
;
1886 trace_type_t
*inpacket_trace
;
1887 trace_type_t
*outpacket_trace
;
1889 extern struct interface_info
**interface_vector
;
1890 extern int interface_count
;
1891 extern int interface_max
;
1892 isc_result_t
interface_initialize (omapi_object_t
*, const char *, int);
1893 void discover_interfaces
PROTO ((int));
1894 int setup_fallback (struct interface_info
**, const char *, int);
1895 int if_readsocket
PROTO ((omapi_object_t
*));
1896 void reinitialize_interfaces
PROTO ((void));
1899 void set_time(TIME
);
1900 struct timeval
*process_outstanding_timeouts (struct timeval
*);
1901 void dispatch
PROTO ((void));
1902 isc_result_t got_one
PROTO ((omapi_object_t
*));
1903 isc_result_t
interface_set_value (omapi_object_t
*, omapi_object_t
*,
1904 omapi_data_string_t
*, omapi_typed_data_t
*);
1905 isc_result_t
interface_get_value (omapi_object_t
*, omapi_object_t
*,
1906 omapi_data_string_t
*, omapi_value_t
**);
1907 isc_result_t
interface_destroy (omapi_object_t
*, const char *, int);
1908 isc_result_t
interface_signal_handler (omapi_object_t
*,
1909 const char *, va_list);
1910 isc_result_t
interface_stuff_values (omapi_object_t
*,
1914 void add_timeout
PROTO ((TIME
, void (*) PROTO ((void *)), void *,
1915 tvref_t
, tvunref_t
));
1916 void cancel_timeout
PROTO ((void (*) PROTO ((void *)), void *));
1917 void cancel_all_timeouts (void);
1918 void relinquish_timeouts (void);
1920 struct protocol
*add_protocol
PROTO ((const char *, int,
1921 void (*) PROTO ((struct protocol
*)),
1924 void remove_protocol
PROTO ((struct protocol
*));
1926 OMAPI_OBJECT_ALLOC_DECL (interface
,
1927 struct interface_info
, dhcp_type_interface
)
1930 extern char *default_option_format
;
1931 extern struct universe dhcp_universe
;
1932 extern struct universe nwip_universe
;
1933 extern struct universe fqdn_universe
;
1934 extern int dhcp_option_default_priority_list
[];
1935 extern int dhcp_option_default_priority_list_count
;
1936 extern const char *hardware_types
[256];
1937 int universe_count
, universe_max
;
1938 struct universe
**universes
;
1939 extern universe_hash_t
*universe_hash
;
1940 void initialize_common_option_spaces
PROTO ((void));
1941 struct universe
*config_universe
;
1944 #if defined (FAILOVER_PROTOCOL)
1945 extern failover_option_t null_failover_option
;
1946 extern failover_option_t skip_failover_option
;
1947 extern struct failover_option_info ft_options
[];
1948 extern u_int32_t fto_allowed
[];
1949 extern int ft_sizes
[];
1950 extern const char *dhcp_flink_state_names
[];
1952 extern const char *binding_state_names
[];
1954 extern struct universe agent_universe
;
1955 extern struct universe server_universe
;
1957 extern struct enumeration ddns_styles
;
1958 extern struct enumeration syslog_enum
;
1959 void initialize_server_option_spaces
PROTO ((void));
1962 struct iaddr subnet_number
PROTO ((struct iaddr
, struct iaddr
));
1963 struct iaddr ip_addr
PROTO ((struct iaddr
, struct iaddr
, u_int32_t
));
1964 struct iaddr broadcast_addr
PROTO ((struct iaddr
, struct iaddr
));
1965 u_int32_t host_addr
PROTO ((struct iaddr
, struct iaddr
));
1966 int addr_eq
PROTO ((struct iaddr
, struct iaddr
));
1967 int addr_match(struct iaddr
*, struct iaddrmatch
*);
1968 char *piaddr
PROTO ((struct iaddr
));
1969 char *piaddrmask (struct iaddr
, struct iaddr
, const char *, int);
1972 extern const char *path_dhclient_conf
;
1973 extern const char *path_dhclient_db
;
1974 extern const char *path_dhclient_pid
;
1975 extern char *path_dhclient_script
;
1976 extern int interfaces_requested
;
1978 extern struct client_config top_level_config
;
1980 void dhcpoffer
PROTO ((struct packet
*));
1981 void dhcpack
PROTO ((struct packet
*));
1982 void dhcpnak
PROTO ((struct packet
*));
1984 void send_discover
PROTO ((void *));
1985 void send_request
PROTO ((void *));
1986 void send_release
PROTO ((void *));
1987 void send_decline
PROTO ((void *));
1989 void state_reboot
PROTO ((void *));
1990 void state_init
PROTO ((void *));
1991 void state_selecting
PROTO ((void *));
1992 void state_requesting
PROTO ((void *));
1993 void state_bound
PROTO ((void *));
1994 void state_stop
PROTO ((void *));
1995 void state_panic
PROTO ((void *));
1997 void bind_lease
PROTO ((struct client_state
*));
1999 void make_client_options
PROTO ((struct client_state
*,
2000 struct client_lease
*, u_int8_t
*,
2001 struct option_cache
*, struct iaddr
*,
2002 u_int32_t
*, struct option_state
**));
2003 void make_discover
PROTO ((struct client_state
*, struct client_lease
*));
2004 void make_request
PROTO ((struct client_state
*, struct client_lease
*));
2005 void make_decline
PROTO ((struct client_state
*, struct client_lease
*));
2006 void make_release
PROTO ((struct client_state
*, struct client_lease
*));
2008 void destroy_client_lease
PROTO ((struct client_lease
*));
2009 void rewrite_client_leases
PROTO ((void));
2010 void write_lease_option (struct option_cache
*, struct packet
*,
2011 struct lease
*, struct client_state
*,
2012 struct option_state
*, struct option_state
*,
2013 struct binding_scope
**, struct universe
*, void *);
2014 int write_client_lease
PROTO ((struct client_state
*,
2015 struct client_lease
*, int, int));
2016 int dhcp_option_ev_name (char *, size_t, struct option
*);
2018 void script_init
PROTO ((struct client_state
*, const char *,
2019 struct string_list
*));
2020 void client_option_envadd (struct option_cache
*, struct packet
*,
2021 struct lease
*, struct client_state
*,
2022 struct option_state
*, struct option_state
*,
2023 struct binding_scope
**, struct universe
*, void *);
2024 void script_write_params
PROTO ((struct client_state
*,
2025 const char *, struct client_lease
*));
2026 int script_go
PROTO ((struct client_state
*));
2027 void client_envadd (struct client_state
*,
2028 const char *, const char *, const char *, ...)
2029 __attribute__((__format__(__printf__
,4,5)));
2031 struct client_lease
*packet_to_lease (struct packet
*, struct client_state
*);
2032 void go_daemon
PROTO ((void));
2033 void write_client_pid_file
PROTO ((void));
2034 void client_location_changed
PROTO ((void));
2035 void do_release
PROTO ((struct client_state
*));
2036 int dhclient_interface_shutdown_hook (struct interface_info
*);
2037 int dhclient_interface_discovery_hook (struct interface_info
*);
2038 isc_result_t
dhclient_interface_startup_hook (struct interface_info
*);
2039 void client_dns_update_timeout (void *cp
);
2040 isc_result_t
client_dns_update (struct client_state
*client
, int, int);
2043 int write_lease
PROTO ((struct lease
*));
2044 int write_host
PROTO ((struct host_decl
*));
2045 #if defined (FAILOVER_PROTOCOL)
2046 int write_failover_state (dhcp_failover_state_t
*);
2048 int db_printable
PROTO ((const char *));
2049 int db_printable_len
PROTO ((const unsigned char *, unsigned));
2050 isc_result_t
write_named_billing_class(const void *, unsigned, void *);
2051 void write_billing_classes (void);
2052 int write_billing_class
PROTO ((struct class *));
2053 void commit_leases_timeout
PROTO ((void *));
2054 int commit_leases
PROTO ((void));
2055 void db_startup
PROTO ((int));
2056 int new_lease_file
PROTO ((void));
2057 int group_writer (struct group_object
*);
2060 u_int32_t checksum
PROTO ((unsigned char *, unsigned, u_int32_t
));
2061 u_int32_t wrapsum
PROTO ((u_int32_t
));
2062 void assemble_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2063 unsigned *, struct hardware
*));
2064 void assemble_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2065 unsigned *, u_int32_t
, u_int32_t
,
2066 u_int32_t
, unsigned char *, unsigned));
2067 ssize_t decode_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2068 unsigned, struct hardware
*));
2069 ssize_t decode_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2070 unsigned, struct sockaddr_in
*,
2074 void assemble_ethernet_header
PROTO ((struct interface_info
*, unsigned char *,
2075 unsigned *, struct hardware
*));
2076 ssize_t decode_ethernet_header
PROTO ((struct interface_info
*,
2078 unsigned, struct hardware
*));
2081 void assemble_tr_header
PROTO ((struct interface_info
*, unsigned char *,
2082 unsigned *, struct hardware
*));
2083 ssize_t decode_tr_header
PROTO ((struct interface_info
*,
2085 unsigned, struct hardware
*));
2088 void convert_statement
PROTO ((struct parse
*));
2089 void convert_host_statement
PROTO ((struct parse
*, jrefproto
));
2090 void convert_host_name
PROTO ((struct parse
*, jrefproto
));
2091 void convert_class_statement
PROTO ((struct parse
*, jrefproto
, int));
2092 void convert_class_decl
PROTO ((struct parse
*, jrefproto
));
2093 void convert_lease_time
PROTO ((struct parse
*, jrefproto
, char *));
2094 void convert_shared_net_statement
PROTO ((struct parse
*, jrefproto
));
2095 void convert_subnet_statement
PROTO ((struct parse
*, jrefproto
));
2096 void convert_subnet_decl
PROTO ((struct parse
*, jrefproto
));
2097 void convert_host_decl
PROTO ((struct parse
*, jrefproto
));
2098 void convert_hardware_decl
PROTO ((struct parse
*, jrefproto
));
2099 void convert_hardware_addr
PROTO ((struct parse
*, jrefproto
));
2100 void convert_filename_decl
PROTO ((struct parse
*, jrefproto
));
2101 void convert_servername_decl
PROTO ((struct parse
*, jrefproto
));
2102 void convert_ip_addr_or_hostname
PROTO ((struct parse
*, jrefproto
, int));
2103 void convert_fixed_addr_decl
PROTO ((struct parse
*, jrefproto
));
2104 void convert_option_decl
PROTO ((struct parse
*, jrefproto
));
2105 void convert_timestamp
PROTO ((struct parse
*, jrefproto
));
2106 void convert_lease_statement
PROTO ((struct parse
*, jrefproto
));
2107 void convert_address_range
PROTO ((struct parse
*, jrefproto
));
2108 void convert_date
PROTO ((struct parse
*, jrefproto
, char *));
2109 void convert_numeric_aggregate
PROTO ((struct parse
*, jrefproto
, int, int, int, int));
2110 void indent
PROTO ((int));
2113 void add_route_direct
PROTO ((struct interface_info
*, struct in_addr
));
2114 void add_route_net
PROTO ((struct interface_info
*, struct in_addr
,
2116 void add_route_default_gateway
PROTO ((struct interface_info
*,
2118 void remove_routes
PROTO ((struct in_addr
));
2119 void remove_if_route
PROTO ((struct interface_info
*, struct in_addr
));
2120 void remove_all_if_routes
PROTO ((struct interface_info
*));
2121 void set_netmask
PROTO ((struct interface_info
*, struct in_addr
));
2122 void set_broadcast_addr
PROTO ((struct interface_info
*, struct in_addr
));
2123 void set_ip_address
PROTO ((struct interface_info
*, struct in_addr
));
2126 isc_result_t read_client_conf
PROTO ((void));
2127 int read_client_conf_file (const char *,
2128 struct interface_info
*, struct client_config
*);
2129 void read_client_leases
PROTO ((void));
2130 void parse_client_statement
PROTO ((struct parse
*, struct interface_info
*,
2131 struct client_config
*));
2132 int parse_X
PROTO ((struct parse
*, u_int8_t
*, unsigned));
2133 void parse_option_list
PROTO ((struct parse
*, u_int32_t
**));
2134 void parse_interface_declaration
PROTO ((struct parse
*,
2135 struct client_config
*, char *));
2136 int interface_or_dummy
PROTO ((struct interface_info
**, const char *));
2137 void make_client_state
PROTO ((struct client_state
**));
2138 void make_client_config
PROTO ((struct client_state
*,
2139 struct client_config
*));
2140 void parse_client_lease_statement
PROTO ((struct parse
*, int));
2141 void parse_client_lease_declaration
PROTO ((struct parse
*,
2142 struct client_lease
*,
2143 struct interface_info
**,
2144 struct client_state
**));
2145 int parse_option_decl
PROTO ((struct option_cache
**, struct parse
*));
2146 void parse_string_list
PROTO ((struct parse
*, struct string_list
**, int));
2147 int parse_ip_addr
PROTO ((struct parse
*, struct iaddr
*));
2148 int parse_ip_addr_with_subnet(struct parse
*, struct iaddrmatch
*);
2149 void parse_reject_statement
PROTO ((struct parse
*, struct client_config
*));
2152 void new_relay_server (char *, struct server_list
**);
2153 void relay
PROTO ((struct interface_info
*, struct dhcp_packet
*, unsigned,
2154 unsigned int, struct iaddr
, struct hardware
*));
2155 int strip_relay_agent_options
PROTO ((struct interface_info
*,
2156 struct interface_info
**,
2157 struct dhcp_packet
*, unsigned));
2158 int find_interface_by_agent_option
PROTO ((struct dhcp_packet
*,
2159 struct interface_info
**,
2161 int add_relay_agent_options
PROTO ((struct interface_info
*,
2162 struct dhcp_packet
*,
2163 unsigned, struct in_addr
));
2166 OMAPI_OBJECT_ALLOC_DECL (icmp_state
, struct icmp_state
, dhcp_type_icmp
)
2167 extern struct icmp_state
*icmp_state
;
2168 void icmp_startup
PROTO ((int, void (*) PROTO ((struct iaddr
,
2169 u_int8_t
*, int))));
2170 int icmp_readsocket
PROTO ((omapi_object_t
*));
2171 int icmp_echorequest
PROTO ((struct iaddr
*));
2172 isc_result_t icmp_echoreply
PROTO ((omapi_object_t
*));
2175 #if defined (NSUPDATE)
2176 isc_result_t
find_tsig_key (ns_tsig_key
**, const char *, struct dns_zone
*);
2177 void tkey_free (ns_tsig_key
**);
2179 isc_result_t
enter_dns_zone (struct dns_zone
*);
2180 isc_result_t
dns_zone_lookup (struct dns_zone
**, const char *);
2181 int dns_zone_dereference
PROTO ((struct dns_zone
**, const char *, int));
2182 #if defined (NSUPDATE)
2183 isc_result_t
find_cached_zone (const char *, ns_class
, char *,
2184 size_t, struct in_addr
*, int, int *,
2185 struct dns_zone
**);
2186 void forget_zone (struct dns_zone
**);
2187 void repudiate_zone (struct dns_zone
**);
2188 void cache_found_zone (ns_class
, char *, struct in_addr
*, int);
2189 int get_dhcid (struct data_string
*, int, const u_int8_t
*, unsigned);
2190 isc_result_t
ddns_update_a(struct data_string
*, struct iaddr
,
2191 struct data_string
*, unsigned long, unsigned,
2193 isc_result_t
ddns_remove_a (struct data_string
*,
2194 struct iaddr
, struct data_string
*);
2195 #endif /* NSUPDATE */
2198 extern char path_resolv_conf
[];
2199 struct name_server
*name_servers
;
2200 struct domain_search_list
*domains
;
2202 void read_resolv_conf
PROTO ((TIME
));
2203 struct name_server
*first_name_server
PROTO ((void));
2206 #ifdef NEED_INET_ATON
2207 int inet_aton
PROTO ((const char *, struct in_addr
*));
2211 extern int have_billing_classes
;
2212 struct class unknown_class
;
2213 struct class known_class
;
2214 struct collection default_collection
;
2215 struct collection
*collections
;
2216 struct executable_statement
*default_classification_rules
;
2218 void classification_setup
PROTO ((void));
2219 void classify_client
PROTO ((struct packet
*));
2220 int check_collection
PROTO ((struct packet
*, struct lease
*,
2221 struct collection
*));
2222 void classify
PROTO ((struct packet
*, struct class *));
2223 isc_result_t unlink_class
PROTO((struct class **class));
2224 isc_result_t find_class
PROTO ((struct class **, const char *,
2225 const char *, int));
2226 int unbill_class
PROTO ((struct lease
*, struct class *));
2227 int bill_class
PROTO ((struct lease
*, struct class *));
2230 int execute_statements
PROTO ((struct binding_value
**result
,
2231 struct packet
*, struct lease
*,
2232 struct client_state
*,
2233 struct option_state
*, struct option_state
*,
2234 struct binding_scope
**,
2235 struct executable_statement
*));
2236 void execute_statements_in_scope
PROTO ((struct binding_value
**result
,
2237 struct packet
*, struct lease
*,
2238 struct client_state
*,
2239 struct option_state
*,
2240 struct option_state
*,
2241 struct binding_scope
**,
2242 struct group
*, struct group
*));
2243 int executable_statement_dereference
PROTO ((struct executable_statement
**,
2244 const char *, int));
2245 void write_statements (FILE *, struct executable_statement
*, int);
2246 int find_matching_case (struct executable_statement
**,
2247 struct packet
*, struct lease
*, struct client_state
*,
2248 struct option_state
*, struct option_state
*,
2249 struct binding_scope
**,
2250 struct expression
*, struct executable_statement
*);
2251 int executable_statement_foreach (struct executable_statement
*,
2252 int (*) (struct executable_statement
*,
2253 void *, int), void *, int);
2256 extern omapi_object_type_t
*dhcp_type_interface
;
2257 extern omapi_object_type_t
*dhcp_type_group
;
2258 extern omapi_object_type_t
*dhcp_type_shared_network
;
2259 extern omapi_object_type_t
*dhcp_type_subnet
;
2260 extern omapi_object_type_t
*dhcp_type_control
;
2261 extern dhcp_control_object_t
*dhcp_control_object
;
2263 void dhcp_common_objects_setup (void);
2265 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2266 omapi_data_string_t
*,
2267 omapi_typed_data_t
*);
2268 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2269 omapi_data_string_t
*,
2271 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2272 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2273 const char *, va_list);
2274 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2277 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2278 omapi_object_t
*, omapi_object_t
*);
2279 isc_result_t
dhcp_group_create (omapi_object_t
**,
2281 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2284 isc_result_t
dhcp_control_set_value (omapi_object_t
*, omapi_object_t
*,
2285 omapi_data_string_t
*,
2286 omapi_typed_data_t
*);
2287 isc_result_t
dhcp_control_get_value (omapi_object_t
*, omapi_object_t
*,
2288 omapi_data_string_t
*,
2290 isc_result_t
dhcp_control_destroy (omapi_object_t
*, const char *, int);
2291 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*,
2292 const char *, va_list);
2293 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*,
2296 isc_result_t
dhcp_control_lookup (omapi_object_t
**,
2297 omapi_object_t
*, omapi_object_t
*);
2298 isc_result_t
dhcp_control_create (omapi_object_t
**,
2300 isc_result_t
dhcp_control_remove (omapi_object_t
*,
2303 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2304 omapi_data_string_t
*,
2305 omapi_typed_data_t
*);
2306 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2307 omapi_data_string_t
*,
2309 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2310 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2311 const char *, va_list);
2312 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2315 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2316 omapi_object_t
*, omapi_object_t
*);
2317 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2319 isc_result_t
dhcp_subnet_remove (omapi_object_t
*,
2322 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2324 omapi_data_string_t
*,
2325 omapi_typed_data_t
*);
2326 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*,
2328 omapi_data_string_t
*,
2330 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2331 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2332 const char *, va_list);
2333 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2336 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2337 omapi_object_t
*, omapi_object_t
*);
2338 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2340 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*,
2344 extern int (*dhcp_interface_shutdown_hook
) (struct interface_info
*);
2346 extern omapi_object_type_t
*dhcp_type_lease
;
2347 extern omapi_object_type_t
*dhcp_type_pool
;
2348 extern omapi_object_type_t
*dhcp_type_class
;
2349 extern omapi_object_type_t
*dhcp_type_subclass
;
2351 #if defined (FAILOVER_PROTOCOL)
2352 extern omapi_object_type_t
*dhcp_type_failover_state
;
2353 extern omapi_object_type_t
*dhcp_type_failover_link
;
2354 extern omapi_object_type_t
*dhcp_type_failover_listener
;
2357 void dhcp_db_objects_setup (void);
2359 isc_result_t
dhcp_lease_set_value (omapi_object_t
*, omapi_object_t
*,
2360 omapi_data_string_t
*,
2361 omapi_typed_data_t
*);
2362 isc_result_t
dhcp_lease_get_value (omapi_object_t
*, omapi_object_t
*,
2363 omapi_data_string_t
*,
2365 isc_result_t
dhcp_lease_destroy (omapi_object_t
*, const char *, int);
2366 isc_result_t
dhcp_lease_signal_handler (omapi_object_t
*,
2367 const char *, va_list);
2368 isc_result_t
dhcp_lease_stuff_values (omapi_object_t
*,
2371 isc_result_t
dhcp_lease_lookup (omapi_object_t
**,
2372 omapi_object_t
*, omapi_object_t
*);
2373 isc_result_t
dhcp_lease_create (omapi_object_t
**,
2375 isc_result_t
dhcp_lease_remove (omapi_object_t
*,
2377 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2378 omapi_data_string_t
*,
2379 omapi_typed_data_t
*);
2380 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2381 omapi_data_string_t
*,
2383 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2384 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2385 const char *, va_list);
2386 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2389 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2390 omapi_object_t
*, omapi_object_t
*);
2391 isc_result_t
dhcp_group_create (omapi_object_t
**,
2393 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2395 isc_result_t
dhcp_host_set_value (omapi_object_t
*, omapi_object_t
*,
2396 omapi_data_string_t
*,
2397 omapi_typed_data_t
*);
2398 isc_result_t
dhcp_host_get_value (omapi_object_t
*, omapi_object_t
*,
2399 omapi_data_string_t
*,
2401 isc_result_t
dhcp_host_destroy (omapi_object_t
*, const char *, int);
2402 isc_result_t
dhcp_host_signal_handler (omapi_object_t
*,
2403 const char *, va_list);
2404 isc_result_t
dhcp_host_stuff_values (omapi_object_t
*,
2407 isc_result_t
dhcp_host_lookup (omapi_object_t
**,
2408 omapi_object_t
*, omapi_object_t
*);
2409 isc_result_t
dhcp_host_create (omapi_object_t
**,
2411 isc_result_t
dhcp_host_remove (omapi_object_t
*,
2413 isc_result_t
dhcp_pool_set_value (omapi_object_t
*, omapi_object_t
*,
2414 omapi_data_string_t
*,
2415 omapi_typed_data_t
*);
2416 isc_result_t
dhcp_pool_get_value (omapi_object_t
*, omapi_object_t
*,
2417 omapi_data_string_t
*,
2419 isc_result_t
dhcp_pool_destroy (omapi_object_t
*, const char *, int);
2420 isc_result_t
dhcp_pool_signal_handler (omapi_object_t
*,
2421 const char *, va_list);
2422 isc_result_t
dhcp_pool_stuff_values (omapi_object_t
*,
2425 isc_result_t
dhcp_pool_lookup (omapi_object_t
**,
2426 omapi_object_t
*, omapi_object_t
*);
2427 isc_result_t
dhcp_pool_create (omapi_object_t
**,
2429 isc_result_t
dhcp_pool_remove (omapi_object_t
*,
2431 isc_result_t
dhcp_class_set_value (omapi_object_t
*, omapi_object_t
*,
2432 omapi_data_string_t
*,
2433 omapi_typed_data_t
*);
2434 isc_result_t
dhcp_class_get_value (omapi_object_t
*, omapi_object_t
*,
2435 omapi_data_string_t
*,
2437 isc_result_t
dhcp_class_destroy (omapi_object_t
*, const char *, int);
2438 isc_result_t
dhcp_class_signal_handler (omapi_object_t
*,
2439 const char *, va_list);
2440 isc_result_t
dhcp_class_stuff_values (omapi_object_t
*,
2443 isc_result_t
dhcp_class_lookup (omapi_object_t
**,
2444 omapi_object_t
*, omapi_object_t
*);
2445 isc_result_t
dhcp_class_create (omapi_object_t
**,
2447 isc_result_t
dhcp_class_remove (omapi_object_t
*,
2449 isc_result_t
dhcp_subclass_set_value (omapi_object_t
*, omapi_object_t
*,
2450 omapi_data_string_t
*,
2451 omapi_typed_data_t
*);
2452 isc_result_t
dhcp_subclass_get_value (omapi_object_t
*, omapi_object_t
*,
2453 omapi_data_string_t
*,
2455 isc_result_t
dhcp_subclass_destroy (omapi_object_t
*, const char *, int);
2456 isc_result_t
dhcp_subclass_signal_handler (omapi_object_t
*,
2457 const char *, va_list);
2458 isc_result_t
dhcp_subclass_stuff_values (omapi_object_t
*,
2461 isc_result_t
dhcp_subclass_lookup (omapi_object_t
**,
2462 omapi_object_t
*, omapi_object_t
*);
2463 isc_result_t
dhcp_subclass_create (omapi_object_t
**,
2465 isc_result_t
dhcp_subclass_remove (omapi_object_t
*,
2467 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2469 omapi_data_string_t
*,
2470 omapi_typed_data_t
*);
2471 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*, omapi_object_t
*,
2472 omapi_data_string_t
*,
2474 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2475 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2476 const char *, va_list);
2477 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2480 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2481 omapi_object_t
*, omapi_object_t
*);
2482 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2484 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2485 omapi_data_string_t
*,
2486 omapi_typed_data_t
*);
2487 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2488 omapi_data_string_t
*,
2490 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2491 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2492 const char *, va_list);
2493 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2496 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2497 omapi_object_t
*, omapi_object_t
*);
2498 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2500 isc_result_t
dhcp_interface_set_value (omapi_object_t
*,
2502 omapi_data_string_t
*,
2503 omapi_typed_data_t
*);
2504 isc_result_t
dhcp_interface_get_value (omapi_object_t
*,
2506 omapi_data_string_t
*,
2508 isc_result_t
dhcp_interface_destroy (omapi_object_t
*,
2510 isc_result_t
dhcp_interface_signal_handler (omapi_object_t
*,
2513 isc_result_t
dhcp_interface_stuff_values (omapi_object_t
*,
2516 isc_result_t
dhcp_interface_lookup (omapi_object_t
**,
2519 isc_result_t
dhcp_interface_create (omapi_object_t
**,
2521 isc_result_t
dhcp_interface_remove (omapi_object_t
*,
2523 void interface_stash (struct interface_info
*);
2524 void interface_snorf (struct interface_info
*, int);
2526 isc_result_t
binding_scope_set_value (struct binding_scope
*, int,
2527 omapi_data_string_t
*,
2528 omapi_typed_data_t
*);
2529 isc_result_t
binding_scope_get_value (omapi_value_t
**,
2530 struct binding_scope
*,
2531 omapi_data_string_t
*);
2532 isc_result_t
binding_scope_stuff_values (omapi_object_t
*,
2533 struct binding_scope
*);
2537 extern struct subnet
*subnets
;
2538 extern struct shared_network
*shared_networks
;
2539 extern host_hash_t
*host_hw_addr_hash
;
2540 extern host_hash_t
*host_uid_hash
;
2541 extern host_hash_t
*host_name_hash
;
2542 extern lease_hash_t
*lease_uid_hash
;
2543 extern lease_hash_t
*lease_ip_addr_hash
;
2544 extern lease_hash_t
*lease_hw_addr_hash
;
2546 extern omapi_object_type_t
*dhcp_type_host
;
2548 extern int numclasseswritten
;
2551 isc_result_t enter_class
PROTO ((struct class *, int, int));
2552 isc_result_t delete_class
PROTO ((struct class *, int));
2553 isc_result_t enter_host
PROTO ((struct host_decl
*, int, int));
2554 isc_result_t delete_host
PROTO ((struct host_decl
*, int));
2555 int find_hosts_by_haddr
PROTO ((struct host_decl
**, int,
2556 const unsigned char *, unsigned,
2557 const char *, int));
2558 int find_hosts_by_uid
PROTO ((struct host_decl
**, const unsigned char *,
2559 unsigned, const char *, int));
2560 int find_host_for_network
PROTO ((struct subnet
**, struct host_decl
**,
2561 struct iaddr
*, struct shared_network
*));
2562 void new_address_range
PROTO ((struct parse
*, struct iaddr
, struct iaddr
,
2563 struct subnet
*, struct pool
*,
2565 isc_result_t
dhcp_lease_free (omapi_object_t
*, const char *, int);
2566 isc_result_t
dhcp_lease_get (omapi_object_t
**, const char *, int);
2567 int find_grouped_subnet
PROTO ((struct subnet
**, struct shared_network
*,
2568 struct iaddr
, const char *, int));
2569 int find_subnet (struct subnet
**, struct iaddr
, const char *, int);
2570 void enter_shared_network
PROTO ((struct shared_network
*));
2571 void new_shared_network_interface
PROTO ((struct parse
*,
2572 struct shared_network
*,
2574 int subnet_inner_than
PROTO ((struct subnet
*, struct subnet
*, int));
2575 void enter_subnet
PROTO ((struct subnet
*));
2576 void enter_lease
PROTO ((struct lease
*));
2577 int supersede_lease
PROTO ((struct lease
*, struct lease
*, int, int, int));
2578 void make_binding_state_transition (struct lease
*);
2579 int lease_copy
PROTO ((struct lease
**, struct lease
*, const char *, int));
2580 void release_lease
PROTO ((struct lease
*, struct packet
*));
2581 void abandon_lease
PROTO ((struct lease
*, const char *));
2582 void dissociate_lease
PROTO ((struct lease
*));
2583 void pool_timer
PROTO ((void *));
2584 int find_lease_by_uid
PROTO ((struct lease
**, const unsigned char *,
2585 unsigned, const char *, int));
2586 int find_lease_by_hw_addr
PROTO ((struct lease
**, const unsigned char *,
2587 unsigned, const char *, int));
2588 int find_lease_by_ip_addr
PROTO ((struct lease
**, struct iaddr
,
2589 const char *, int));
2590 void uid_hash_add
PROTO ((struct lease
*));
2591 void uid_hash_delete
PROTO ((struct lease
*));
2592 void hw_hash_add
PROTO ((struct lease
*));
2593 void hw_hash_delete
PROTO ((struct lease
*));
2594 int write_leases
PROTO ((void));
2595 int lease_enqueue (struct lease
*);
2596 isc_result_t
lease_instantiate(const void *, unsigned, void *);
2597 void expire_all_pools
PROTO ((void));
2598 void dump_subnets
PROTO ((void));
2599 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2600 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2601 void free_everything (void);
2605 char *ddns_rev_name (struct lease
*, struct lease_state
*, struct packet
*);
2606 char *ddns_fwd_name (struct lease
*, struct lease_state
*, struct packet
*);
2607 int nsupdateA (const char *, const unsigned char *, u_int32_t
, int);
2608 int nsupdatePTR (const char *, const unsigned char *, u_int32_t
, int);
2609 void nsupdate (struct lease
*, struct lease_state
*, struct packet
*, int);
2610 int updateA (const struct data_string
*, const struct data_string
*,
2611 unsigned int, struct lease
*);
2612 int updatePTR (const struct data_string
*, const struct data_string
*,
2613 unsigned int, struct lease
*);
2614 int deleteA (const struct data_string
*, const struct data_string
*,
2616 int deletePTR (const struct data_string
*, const struct data_string
*,
2620 #if defined (FAILOVER_PROTOCOL)
2621 extern dhcp_failover_state_t
*failover_states
;
2622 void dhcp_failover_startup
PROTO ((void));
2623 int dhcp_failover_write_all_states (void);
2624 isc_result_t enter_failover_peer
PROTO ((dhcp_failover_state_t
*));
2625 isc_result_t find_failover_peer
PROTO ((dhcp_failover_state_t
**,
2626 const char *, const char *, int));
2627 isc_result_t dhcp_failover_link_initiate
PROTO ((omapi_object_t
*));
2628 isc_result_t dhcp_failover_link_signal
PROTO ((omapi_object_t
*,
2629 const char *, va_list));
2630 isc_result_t dhcp_failover_link_set_value
PROTO ((omapi_object_t
*,
2632 omapi_data_string_t
*,
2633 omapi_typed_data_t
*));
2634 isc_result_t dhcp_failover_link_get_value
PROTO ((omapi_object_t
*,
2636 omapi_data_string_t
*,
2638 isc_result_t dhcp_failover_link_destroy
PROTO ((omapi_object_t
*,
2639 const char *, int));
2640 isc_result_t dhcp_failover_link_stuff_values
PROTO ((omapi_object_t
*,
2643 isc_result_t dhcp_failover_listen
PROTO ((omapi_object_t
*));
2645 isc_result_t dhcp_failover_listener_signal
PROTO ((omapi_object_t
*,
2648 isc_result_t dhcp_failover_listener_set_value
PROTO ((omapi_object_t
*,
2650 omapi_data_string_t
*,
2651 omapi_typed_data_t
*));
2652 isc_result_t dhcp_failover_listener_get_value
PROTO ((omapi_object_t
*,
2654 omapi_data_string_t
*,
2656 isc_result_t dhcp_failover_listener_destroy
PROTO ((omapi_object_t
*,
2657 const char *, int));
2658 isc_result_t dhcp_failover_listener_stuff
PROTO ((omapi_object_t
*,
2661 isc_result_t dhcp_failover_register
PROTO ((omapi_object_t
*));
2662 isc_result_t dhcp_failover_state_signal
PROTO ((omapi_object_t
*,
2663 const char *, va_list));
2664 isc_result_t
dhcp_failover_state_transition (dhcp_failover_state_t
*,
2666 isc_result_t
dhcp_failover_set_service_state (dhcp_failover_state_t
*state
);
2667 isc_result_t
dhcp_failover_set_state (dhcp_failover_state_t
*,
2668 enum failover_state
);
2669 isc_result_t
dhcp_failover_peer_state_changed (dhcp_failover_state_t
*,
2670 failover_message_t
*);
2671 void dhcp_failover_pool_rebalance (void *);
2672 void dhcp_failover_pool_check (struct pool
*);
2673 int dhcp_failover_state_pool_check (dhcp_failover_state_t
*);
2674 void dhcp_failover_timeout (void *);
2675 void dhcp_failover_send_contact (void *);
2676 isc_result_t
dhcp_failover_send_state (dhcp_failover_state_t
*);
2677 isc_result_t
dhcp_failover_send_updates (dhcp_failover_state_t
*);
2678 int dhcp_failover_queue_update (struct lease
*, int);
2679 int dhcp_failover_send_acks (dhcp_failover_state_t
*);
2680 void dhcp_failover_toack_queue_timeout (void *);
2681 int dhcp_failover_queue_ack (dhcp_failover_state_t
*, failover_message_t
*msg
);
2682 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t
*, struct lease
*);
2683 isc_result_t dhcp_failover_state_set_value
PROTO ((omapi_object_t
*,
2685 omapi_data_string_t
*,
2686 omapi_typed_data_t
*));
2687 void dhcp_failover_keepalive (void *);
2688 void dhcp_failover_reconnect (void *);
2689 void dhcp_failover_startup_timeout (void *);
2690 void dhcp_failover_link_startup_timeout (void *);
2691 void dhcp_failover_listener_restart (void *);
2692 isc_result_t dhcp_failover_state_get_value
PROTO ((omapi_object_t
*,
2694 omapi_data_string_t
*,
2696 isc_result_t dhcp_failover_state_destroy
PROTO ((omapi_object_t
*,
2697 const char *, int));
2698 isc_result_t dhcp_failover_state_stuff
PROTO ((omapi_object_t
*,
2701 isc_result_t dhcp_failover_state_lookup
PROTO ((omapi_object_t
**,
2704 isc_result_t dhcp_failover_state_create
PROTO ((omapi_object_t
**,
2706 isc_result_t dhcp_failover_state_remove
PROTO ((omapi_object_t
*,
2708 int dhcp_failover_state_match (dhcp_failover_state_t
*, u_int8_t
*, unsigned);
2709 int dhcp_failover_state_match_by_name(dhcp_failover_state_t
*,
2710 failover_option_t
*);
2711 const char *dhcp_failover_reject_reason_print (int);
2712 const char *dhcp_failover_state_name_print (enum failover_state
);
2713 const char *dhcp_failover_message_name (unsigned);
2714 const char *dhcp_failover_option_name (unsigned);
2715 failover_option_t
*dhcp_failover_option_printf (unsigned, char *,
2719 __attribute__((__format__(__printf__
,5,6)));
2720 failover_option_t
*dhcp_failover_make_option (unsigned, char *,
2721 unsigned *, unsigned, ...);
2722 isc_result_t
dhcp_failover_put_message (dhcp_failover_link_t
*,
2723 omapi_object_t
*, int, u_int32_t
, ...);
2724 isc_result_t dhcp_failover_send_connect
PROTO ((omapi_object_t
*));
2725 isc_result_t dhcp_failover_send_connectack
PROTO ((omapi_object_t
*,
2726 dhcp_failover_state_t
*,
2727 int, const char *));
2728 isc_result_t dhcp_failover_send_disconnect
PROTO ((omapi_object_t
*,
2729 int, const char *));
2730 isc_result_t
dhcp_failover_send_bind_update (dhcp_failover_state_t
*,
2732 isc_result_t
dhcp_failover_send_bind_ack (dhcp_failover_state_t
*,
2733 failover_message_t
*,
2735 isc_result_t
dhcp_failover_send_poolreq (dhcp_failover_state_t
*);
2736 isc_result_t
dhcp_failover_send_poolresp (dhcp_failover_state_t
*, int);
2737 isc_result_t
dhcp_failover_send_update_request (dhcp_failover_state_t
*);
2738 isc_result_t
dhcp_failover_send_update_request_all (dhcp_failover_state_t
*);
2739 isc_result_t
dhcp_failover_send_update_done (dhcp_failover_state_t
*);
2740 isc_result_t
dhcp_failover_process_bind_update (dhcp_failover_state_t
*,
2741 failover_message_t
*);
2742 isc_result_t
dhcp_failover_process_bind_ack (dhcp_failover_state_t
*,
2743 failover_message_t
*);
2744 isc_result_t
dhcp_failover_generate_update_queue (dhcp_failover_state_t
*,
2746 isc_result_t
dhcp_failover_process_update_request (dhcp_failover_state_t
*,
2747 failover_message_t
*);
2748 isc_result_t
dhcp_failover_process_update_request_all (dhcp_failover_state_t
*,
2749 failover_message_t
*);
2750 isc_result_t
dhcp_failover_process_update_done (dhcp_failover_state_t
*,
2751 failover_message_t
*);
2752 void dhcp_failover_recover_done (void *);
2753 void failover_print
PROTO ((char *, unsigned *, unsigned, const char *));
2754 void update_partner
PROTO ((struct lease
*));
2755 int load_balance_mine (struct packet
*, dhcp_failover_state_t
*);
2756 int peer_wants_lease (struct lease
*);
2757 binding_state_t
normal_binding_state_transition_check (struct lease
*,
2758 dhcp_failover_state_t
*,
2762 conflict_binding_state_transition_check (struct lease
*,
2763 dhcp_failover_state_t
*,
2764 binding_state_t
, u_int32_t
);
2765 int lease_mine_to_reallocate (struct lease
*);
2767 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state
, dhcp_failover_state_t
,
2768 dhcp_type_failover_state
)
2769 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener
, dhcp_failover_listener_t
,
2770 dhcp_type_failover_listener
)
2771 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link
, dhcp_failover_link_t
,
2772 dhcp_type_failover_link
)
2773 #endif /* FAILOVER_PROTOCOL */
2775 const char *binding_state_print (enum failover_state
);