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