aboutsummaryrefslogtreecommitdiff
path: root/contrib/isc-dhcp/includes
diff options
context:
space:
mode:
authorMurray Stokely <murray@FreeBSD.org>2002-02-19 11:04:34 +0000
committerMurray Stokely <murray@FreeBSD.org>2002-02-19 11:04:34 +0000
commitce99b771f886a2c842db7aa803c9a5a5918f42c8 (patch)
tree229464d9b3244ab78e2784c9a0a1f78de317089a /contrib/isc-dhcp/includes
parent7657fb140fbd218ea326d55bd3c43c4077f03d9a (diff)
downloadsrc-ce99b771f886a2c842db7aa803c9a5a5918f42c8.tar.gz
src-ce99b771f886a2c842db7aa803c9a5a5918f42c8.zip
Import ISC DHCP 3.0.1 RC6 client.
Notes
Notes: svn path=/vendor/isc-dhcp/dist/; revision=90908
Diffstat (limited to 'contrib/isc-dhcp/includes')
-rw-r--r--contrib/isc-dhcp/includes/arpa/nameser.h612
-rw-r--r--contrib/isc-dhcp/includes/arpa/nameser_compat.h183
-rw-r--r--contrib/isc-dhcp/includes/cdefs.h45
-rw-r--r--contrib/isc-dhcp/includes/cf/freebsd.h87
-rw-r--r--contrib/isc-dhcp/includes/ctrace.h86
-rw-r--r--contrib/isc-dhcp/includes/dhcp.h71
-rw-r--r--contrib/isc-dhcp/includes/dhcpd.h2309
-rw-r--r--contrib/isc-dhcp/includes/dhctoken.h376
-rw-r--r--contrib/isc-dhcp/includes/failover.h322
-rw-r--r--contrib/isc-dhcp/includes/inet.h14
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/boolean.h32
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/dst.h142
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/int.h36
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/lang.h29
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/list.h116
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/result.h113
-rw-r--r--contrib/isc-dhcp/includes/isc-dhcp/types.h40
-rw-r--r--contrib/isc-dhcp/includes/minires/minires.h221
-rw-r--r--contrib/isc-dhcp/includes/minires/res_update.h51
-rw-r--r--contrib/isc-dhcp/includes/minires/resolv.h314
-rw-r--r--contrib/isc-dhcp/includes/netinet/if_ether.h22
-rw-r--r--contrib/isc-dhcp/includes/netinet/ip.h24
-rw-r--r--contrib/isc-dhcp/includes/netinet/udp.h2
-rw-r--r--contrib/isc-dhcp/includes/omapip/alloc.h120
-rw-r--r--contrib/isc-dhcp/includes/omapip/buffer.h92
-rw-r--r--contrib/isc-dhcp/includes/omapip/convert.h61
-rw-r--r--contrib/isc-dhcp/includes/omapip/hash.h159
-rw-r--r--contrib/isc-dhcp/includes/omapip/omapip.h620
-rw-r--r--contrib/isc-dhcp/includes/omapip/omapip_p.h302
-rw-r--r--contrib/isc-dhcp/includes/omapip/trace.h124
-rw-r--r--contrib/isc-dhcp/includes/osdep.h82
-rw-r--r--contrib/isc-dhcp/includes/site.h82
-rw-r--r--contrib/isc-dhcp/includes/statement.h113
-rw-r--r--contrib/isc-dhcp/includes/tree.h325
-rw-r--r--contrib/isc-dhcp/includes/version.h2
35 files changed, 6497 insertions, 832 deletions
diff --git a/contrib/isc-dhcp/includes/arpa/nameser.h b/contrib/isc-dhcp/includes/arpa/nameser.h
index 5b38997aba01..19c9d5df0349 100644
--- a/contrib/isc-dhcp/includes/arpa/nameser.h
+++ b/contrib/isc-dhcp/includes/arpa/nameser.h
@@ -1,6 +1,4 @@
/*
- * ++Copyright++ 1983, 1989, 1993
- * -
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -31,207 +29,433 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
+ */
+
+/*
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- * -
- * --Copyright--
- */
-
-/*
- * @(#)nameser.h 8.1 (Berkeley) 6/2/93
- * $Id: nameser.h,v 8.3 1995/08/21 01:27:12 vixie Exp
- */
-
-#ifndef _NAMESER_H_
-#define _NAMESER_H_
-
-/*
- * Define constants based on rfc883
- */
-#define PACKETSZ 512 /* maximum packet size */
-#define MAXDNAME 256 /* maximum domain name */
-#define MAXCDNAME 255 /* maximum compressed domain name */
-#define MAXLABEL 63 /* maximum length of domain label */
-#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
-#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
-#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
-#define INT32SZ 4 /* for systems without 32-bit ints */
-#define INT16SZ 2 /* for systems without 16-bit ints */
-#define INADDRSZ 4 /* for sizeof(struct inaddr) != 4 */
-
-/*
- * Internet nameserver port number
- */
-#define NAMESERVER_PORT 53
-
-/*
- * Currently defined opcodes
- */
-#define QUERY 0x0 /* standard query */
-#define IQUERY 0x1 /* inverse query */
-#define STATUS 0x2 /* nameserver status query */
-/*#define xxx 0x3*/ /* 0x3 reserved */
-#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
-#ifdef ALLOW_UPDATES
- /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
-# define UPDATEA 0x9 /* add resource record */
-# define UPDATED 0xa /* delete a specific resource record */
-# define UPDATEDA 0xb /* delete all named resource record */
-# define UPDATEM 0xc /* modify a specific resource record */
-# define UPDATEMA 0xd /* modify all named resource record */
-# define ZONEINIT 0xe /* initial zone transfer */
-# define ZONEREF 0xf /* incremental zone referesh */
-#endif
-
-/*
- * Currently defined response codes
- */
-#define NOERROR 0 /* no error */
-#define FORMERR 1 /* format error */
-#define SERVFAIL 2 /* server failure */
-#define NXDOMAIN 3 /* non existent domain */
-#define NOTIMP 4 /* not implemented */
-#define REFUSED 5 /* query refused */
-#ifdef ALLOW_UPDATES
- /* non standard */
-# define NOCHANGE 0xf /* update failed to change db */
-#endif
-
-/*
- * Type values for resources and queries
- */
-#define T_A 1 /* host address */
-#define T_NS 2 /* authoritative server */
-#define T_MD 3 /* mail destination */
-#define T_MF 4 /* mail forwarder */
-#define T_CNAME 5 /* canonical name */
-#define T_SOA 6 /* start of authority zone */
-#define T_MB 7 /* mailbox domain name */
-#define T_MG 8 /* mail group member */
-#define T_MR 9 /* mail rename name */
-#define T_NULL 10 /* null resource record */
-#define T_WKS 11 /* well known service */
-#define T_PTR 12 /* domain name pointer */
-#define T_HINFO 13 /* host information */
-#define T_MINFO 14 /* mailbox information */
-#define T_MX 15 /* mail routing information */
-#define T_TXT 16 /* text strings */
-#define T_RP 17 /* responsible person */
-#define T_AFSDB 18 /* AFS cell database */
-#define T_X25 19 /* X_25 calling address */
-#define T_ISDN 20 /* ISDN calling address */
-#define T_RT 21 /* router */
-#define T_NSAP 22 /* NSAP address */
-#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
-#define T_SIG 24 /* security signature */
-#define T_KEY 25 /* security key */
-#define T_PX 26 /* X.400 mail mapping */
-#define T_GPOS 27 /* geographical position (withdrawn) */
-#define T_AAAA 28 /* IP6 Address */
-#define T_LOC 29 /* Location Information */
- /* non standard */
-#define T_UINFO 100 /* user (finger) information */
-#define T_UID 101 /* user ID */
-#define T_GID 102 /* group ID */
-#define T_UNSPEC 103 /* Unspecified format (binary data) */
- /* Query type values which do not appear in resource records */
-#define T_AXFR 252 /* transfer zone of authority */
-#define T_MAILB 253 /* transfer mailbox records */
-#define T_MAILA 254 /* transfer mail agent records */
-#define T_ANY 255 /* wildcard match */
+ */
/*
- * Values for class field
+ * $Id: nameser.h,v 1.4 2000/02/02 07:23:18 mellon Exp $
*/
-#define C_IN 1 /* the arpa internet */
-#define C_CHAOS 3 /* for chaos net (MIT) */
-#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
- /* Query class values which do not appear in resource records */
-#define C_ANY 255 /* wildcard match */
-
-/*
- * Status return codes for T_UNSPEC conversion routines
- */
-#define CONV_SUCCESS 0
-#define CONV_OVERFLOW (-1)
-#define CONV_BADFMT (-2)
-#define CONV_BADCKSUM (-3)
-#define CONV_BADBUFLEN (-4)
-
-/*
- * Structure for query header. The order of the fields is machine- and
- * compiler-dependent, depending on the byte/bit order and the layout
- * of bit fields. We use bit fields only in int variables, as this
- * is all ANSI requires. This requires a somewhat confusing rearrangement.
- */
-
-typedef struct {
- unsigned id :16; /* query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
- /* fields in third byte */
- unsigned qr: 1; /* response flag */
- unsigned opcode: 4; /* purpose of message */
- unsigned aa: 1; /* authoritive answer */
- unsigned tc: 1; /* truncated message */
- unsigned rd: 1; /* recursion desired */
- /* fields in fourth byte */
- unsigned ra: 1; /* recursion available */
- unsigned pr:1; /* primary server required (non standard) */
- unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned rcode :4; /* response code */
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
- /* fields in third byte */
- unsigned rd :1; /* recursion desired */
- unsigned tc :1; /* truncated message */
- unsigned aa :1; /* authoritive answer */
- unsigned opcode :4; /* purpose of message */
- unsigned qr :1; /* response flag */
- /* fields in fourth byte */
- unsigned rcode :4; /* response code */
- unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned pr:1; /* primary server required (non standard) */
- unsigned ra :1; /* recursion available */
-#endif
- /* remaining bytes */
- unsigned qdcount :16; /* number of question entries */
- unsigned ancount :16; /* number of answer entries */
- unsigned nscount :16; /* number of authority entries */
- unsigned arcount :16; /* number of resource entries */
-} HEADER;
-
-/*
- * Defines for handling compressed domain names
- */
-#define INDIR_MASK 0xc0
-
-/*
- * Structure for passing resource records around.
- */
-struct rrec {
- int16_t r_zone; /* zone number */
- int16_t r_class; /* class number */
- int16_t r_type; /* type number */
- u_int32_t r_ttl; /* time to live */
- int r_size; /* size of data area */
- char *r_data; /* pointer to data */
+#ifndef _ARPA_NAMESER_H_
+#define _ARPA_NAMESER_H_
+
+/*
+ * Revision information. This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not
+ * compare for equality; rather, use it to determine whether your libbind.a
+ * contains a new enough lib/nameser/ to support the feature you need.
+ */
+
+#define __NAMESER 19991006 /* New interface version stamp. */
+
+/*
+ * Define constants based on RFC 883, RFC 1034, RFC 1035
+ */
+#define NS_PACKETSZ 512 /* maximum packet size */
+#define NS_MAXDNAME 1025 /* maximum domain name */
+#define NS_MAXCDNAME 255 /* maximum compressed domain name */
+#define NS_MAXLABEL 63 /* maximum length of domain label */
+#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
+#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
+#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
+#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
+#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ 4 /* IPv4 T_A */
+#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
+#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
+#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
+
+/*
+ * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
+ * in synch with it.
+ */
+typedef enum __ns_sect {
+ ns_s_qd = 0, /* Query: Question. */
+ ns_s_zn = 0, /* Update: Zone. */
+ ns_s_an = 1, /* Query: Answer. */
+ ns_s_pr = 1, /* Update: Prerequisites. */
+ ns_s_ns = 2, /* Query: Name servers. */
+ ns_s_ud = 2, /* Update: Update. */
+ ns_s_ar = 3, /* Query|Update: Additional records. */
+ ns_s_max = 4
+} ns_sect;
+
+/*
+ * This is a message handle. It is caller allocated and has no dynamic data.
+ * This structure is intended to be opaque to all but ns_parse.c, thus the
+ * leading _'s on the member names. Use the accessor functions, not the _'s.
+ */
+typedef struct __ns_msg {
+ const u_int8_t *_msg, *_eom;
+ u_int16_t _id, _flags, _counts[ns_s_max];
+ const u_int8_t *_sections[ns_s_max];
+ ns_sect _sect;
+ int _rrnum;
+ const u_int8_t *_ptr;
+} ns_msg;
+
+/* Private data structure - do not use from outside library. */
+struct _ns_flagdata { int mask, shift; };
+extern struct _ns_flagdata _ns_flagdata[];
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_msg_getflag(handle, flag) ( \
+ ((handle)._flags & _ns_flagdata[flag].mask) \
+ >> _ns_flagdata[flag].shift \
+ )
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+
+/*
+ * This is a parsed record. It is caller allocated and has no dynamic data.
+ */
+typedef struct __ns_rr {
+ char name[NS_MAXDNAME];
+ u_int16_t type;
+ u_int16_t rr_class;
+ u_int32_t ttl;
+ u_int16_t rdlength;
+ const u_int8_t *rdata;
+} ns_rr;
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
+#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr) ((rr).ttl + 0)
+#define ns_rr_rdlen(rr) ((rr).rdlength + 0)
+#define ns_rr_rdata(rr) ((rr).rdata + 0)
+
+/*
+ * These don't have to be in the same order as in the packet flags word,
+ * and they can even overlap in some cases, but they will need to be kept
+ * in synch with ns_parse.c:ns_flagdata[].
+ */
+typedef enum __ns_flag {
+ ns_f_qr, /* Question/Response. */
+ ns_f_opcode, /* Operation code. */
+ ns_f_aa, /* Authoritative Answer. */
+ ns_f_tc, /* Truncation occurred. */
+ ns_f_rd, /* Recursion Desired. */
+ ns_f_ra, /* Recursion Available. */
+ ns_f_z, /* MBZ. */
+ ns_f_ad, /* Authentic Data (DNSSEC). */
+ ns_f_cd, /* Checking Disabled (DNSSEC). */
+ ns_f_rcode, /* Response code. */
+ ns_f_max
+} ns_flag;
+
+/*
+ * Currently defined opcodes.
+ */
+typedef enum __ns_opcode {
+ ns_o_query = 0, /* Standard query. */
+ ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
+ ns_o_status = 2, /* Name server status query (unsupported). */
+ /* Opcode 3 is undefined/reserved. */
+ ns_o_notify = 4, /* Zone change notification. */
+ ns_o_update = 5, /* Zone update message. */
+ ns_o_max = 6
+} ns_opcode;
+
+/*
+ * Currently defined response codes.
+ */
+typedef enum __ns_rcode {
+ ns_r_noerror = 0, /* No error occurred. */
+ ns_r_formerr = 1, /* Format error. */
+ ns_r_servfail = 2, /* Server failure. */
+ ns_r_nxdomain = 3, /* Name error. */
+ ns_r_notimpl = 4, /* Unimplemented. */
+ ns_r_refused = 5, /* Operation refused. */
+ /* these are for BIND_UPDATE */
+ ns_r_yxdomain = 6, /* Name exists */
+ ns_r_yxrrset = 7, /* RRset exists */
+ ns_r_nxrrset = 8, /* RRset does not exist */
+ ns_r_notauth = 9, /* Not authoritative for zone */
+ ns_r_notzone = 10, /* Zone of record different from zone section */
+ ns_r_max = 11,
+ /* The following are TSIG extended errors */
+ ns_r_badsig = 16,
+ ns_r_badkey = 17,
+ ns_r_badtime = 18
+} ns_rcode;
+
+/* BIND_UPDATE */
+typedef enum __ns_update_operation {
+ ns_uop_delete = 0,
+ ns_uop_add = 1,
+ ns_uop_max = 2
+} ns_update_operation;
+
+/*
+ * This structure is used for TSIG authenticated messages
+ */
+struct ns_tsig_key {
+ char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+ unsigned char *data;
+ unsigned len;
};
+typedef struct ns_tsig_key ns_tsig_key;
+
+/*
+ * This structure is used for TSIG authenticated TCP messages
+ */
+struct ns_tcp_tsig_state {
+ int counter;
+ struct dst_key *key;
+ void *ctx;
+ unsigned char sig[NS_PACKETSZ];
+ unsigned siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+/*
+ * Currently defined type values for resources and queries.
+ */
+typedef enum __ns_type {
+ ns_t_invalid = 0, /* Cookie. */
+ ns_t_a = 1, /* Host address. */
+ ns_t_ns = 2, /* Authoritative server. */
+ ns_t_md = 3, /* Mail destination. */
+ ns_t_mf = 4, /* Mail forwarder. */
+ ns_t_cname = 5, /* Canonical name. */
+ ns_t_soa = 6, /* Start of authority zone. */
+ ns_t_mb = 7, /* Mailbox domain name. */
+ ns_t_mg = 8, /* Mail group member. */
+ ns_t_mr = 9, /* Mail rename name. */
+ ns_t_null = 10, /* Null resource record. */
+ ns_t_wks = 11, /* Well known service. */
+ ns_t_ptr = 12, /* Domain name pointer. */
+ ns_t_hinfo = 13, /* Host information. */
+ ns_t_minfo = 14, /* Mailbox information. */
+ ns_t_mx = 15, /* Mail routing information. */
+ ns_t_txt = 16, /* Text strings. */
+ ns_t_rp = 17, /* Responsible person. */
+ ns_t_afsdb = 18, /* AFS cell database. */
+ ns_t_x25 = 19, /* X_25 calling address. */
+ ns_t_isdn = 20, /* ISDN calling address. */
+ ns_t_rt = 21, /* Router. */
+ ns_t_nsap = 22, /* NSAP address. */
+ ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
+ ns_t_sig = 24, /* Security signature. */
+ ns_t_key = 25, /* Security key. */
+ ns_t_px = 26, /* X.400 mail mapping. */
+ ns_t_gpos = 27, /* Geographical position (withdrawn). */
+ ns_t_aaaa = 28, /* Ip6 Address. */
+ ns_t_loc = 29, /* Location Information. */
+ ns_t_nxt = 30, /* Next domain (security). */
+ ns_t_eid = 31, /* Endpoint identifier. */
+ ns_t_nimloc = 32, /* Nimrod Locator. */
+ ns_t_srv = 33, /* Server Selection. */
+ ns_t_atma = 34, /* ATM Address */
+ ns_t_naptr = 35, /* Naming Authority PoinTeR */
+ ns_t_kx = 36, /* Key Exchange */
+ ns_t_cert = 37, /* Certification record */
+ ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
+ ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
+ ns_t_sink = 40, /* Kitchen sink (experimentatl) */
+ ns_t_opt = 41, /* EDNS0 option (meta-RR) */
+ ns_t_tsig = 250, /* Transaction signature. */
+ ns_t_ixfr = 251, /* Incremental zone transfer. */
+ ns_t_axfr = 252, /* Transfer zone of authority. */
+ ns_t_mailb = 253, /* Transfer mailbox records. */
+ ns_t_maila = 254, /* Transfer mail agent records. */
+ ns_t_any = 255, /* Wildcard match. */
+ ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
+ ns_t_max = 65536
+} ns_type;
+
+/* Exclusively a QTYPE? (not also an RTYPE) */
+#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+ (t) == ns_t_mailb || (t) == ns_t_maila)
+/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
+#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+ (t) == ns_t_zxfr)
+
+/*
+ * Values for class field
+ */
+typedef enum __ns_class {
+ ns_c_invalid = 0, /* Cookie. */
+ ns_c_in = 1, /* Internet. */
+ ns_c_2 = 2, /* unallocated/unsupported. */
+ ns_c_chaos = 3, /* MIT Chaos-net. */
+ ns_c_hs = 4, /* MIT Hesiod. */
+ /* Query class values which do not appear in resource records */
+ ns_c_none = 254, /* for prereq. sections in update requests */
+ ns_c_any = 255, /* Wildcard match. */
+ ns_c_max = 65536
+} ns_class;
+
+/* DNSSEC constants. */
+
+typedef enum __ns_key_types {
+ ns_kt_rsa = 1, /* key type RSA/MD5 */
+ ns_kt_dh = 2, /* Diffie Hellman */
+ ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */
+ ns_kt_private = 254 /* Private key type starts with OID */
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+ cert_t_pkix = 1, /* PKIX (X.509v3) */
+ cert_t_spki = 2, /* SPKI */
+ cert_t_pgp = 3, /* PGP */
+ cert_t_url = 253, /* URL private type */
+ cert_t_oid = 254 /* OID private type */
+} ns_cert_types;
+
+/* Flags field of the KEY RR rdata. */
+#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */
+#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
+#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
+#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
+#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
+/* The type bits can also be interpreted independently, as single bits: */
+#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */
+#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */
+#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
+#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */
+#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */
+#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */
+#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */
+#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */
+#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */
+#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */
+#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */
+#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */
+#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */
+#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */
+#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */
+#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
+#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+ NS_KEY_RESERVED4 | \
+ NS_KEY_RESERVED5 | \
+ NS_KEY_RESERVED8 | \
+ NS_KEY_RESERVED9 | \
+ NS_KEY_RESERVED10 | \
+ NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
+
+/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
+#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
+#define NS_ALG_DH 2 /* Diffie Hellman KEY */
+#define NS_ALG_DSA 3 /* DSA KEY */
+#define NS_ALG_DSS NS_ALG_DSA
+#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
+#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
+
+/* Protocol values */
+/* value 0 is reserved */
+#define NS_KEY_PROT_TLS 1
+#define NS_KEY_PROT_EMAIL 2
+#define NS_KEY_PROT_DNSSEC 3
+#define NS_KEY_PROT_IPSEC 4
+#define NS_KEY_PROT_ANY 255
+
+/* Signatures */
+#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
+#define NS_MD5RSA_MAX_BITS 2552
+ /* Total of binary mod and exp */
+#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+ /* Max length of text sig block */
+#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE 41
+#define NS_DSA_MIN_SIZE 213
+#define NS_DSA_MAX_BYTES 405
+
+/* Offsets into SIG record rdata to find various values */
+#define NS_SIG_TYPE 0 /* Type flags */
+#define NS_SIG_ALG 2 /* Algorithm */
+#define NS_SIG_LABELS 3 /* How many labels in name */
+#define NS_SIG_OTTL 4 /* Original TTL */
+#define NS_SIG_EXPIR 8 /* Expiration time */
+#define NS_SIG_SIGNED 12 /* Signature time */
+#define NS_SIG_FOOT 16 /* Key footprint */
+#define NS_SIG_SIGNER 18 /* Domain name of who signed it */
+
+/* How RR types are represented as bit-flags in NXT records */
+#define NS_NXT_BITS 8
+#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+/*
+ * Inline versions of get/put short/long. Pointer is advanced.
+ */
+#define NS_GET16(s, cp) do { \
+ register u_int8_t *t_cp = (u_int8_t *)(cp); \
+ (s) = ((u_int16_t)t_cp[0] << 8) \
+ | ((u_int16_t)t_cp[1]) \
+ ; \
+ (cp) += NS_INT16SZ; \
+} while (0)
+
+#define NS_GET32(l, cp) do { \
+ register u_int8_t *t_cp = (u_int8_t *)(cp); \
+ (l) = ((u_int32_t)t_cp[0] << 24) \
+ | ((u_int32_t)t_cp[1] << 16) \
+ | ((u_int32_t)t_cp[2] << 8) \
+ | ((u_int32_t)t_cp[3]) \
+ ; \
+ (cp) += NS_INT32SZ; \
+} while (0)
+
+#define NS_PUT16(s, cp) do { \
+ register u_int16_t t_s = (u_int16_t)(s); \
+ register u_int8_t *t_cp = (u_int8_t *)(cp); \
+ *t_cp++ = t_s >> 8; \
+ *t_cp = t_s; \
+ (cp) += NS_INT16SZ; \
+} while (0)
+
+#define NS_PUT32(l, cp) do { \
+ register u_int32_t t_l = (u_int32_t)(l); \
+ register u_int8_t *t_cp = (u_int8_t *)(cp); \
+ *t_cp++ = t_l >> 24; \
+ *t_cp++ = t_l >> 16; \
+ *t_cp++ = t_l >> 8; \
+ *t_cp = t_l; \
+ (cp) += NS_INT32SZ; \
+} while (0)
+
+#include <arpa/nameser_compat.h>
-#endif /* !_NAMESER_H_ */
+#endif /* !_ARPA_NAMESER_H_ */
diff --git a/contrib/isc-dhcp/includes/arpa/nameser_compat.h b/contrib/isc-dhcp/includes/arpa/nameser_compat.h
new file mode 100644
index 000000000000..3ae17f0ee683
--- /dev/null
+++ b/contrib/isc-dhcp/includes/arpa/nameser_compat.h
@@ -0,0 +1,183 @@
+/* Copyright (c) 1983, 1989
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * from nameser.h 8.1 (Berkeley) 6/2/93
+ * $Id: nameser_compat.h,v 1.2 2000/01/27 23:28:08 mellon Exp $
+ */
+
+#ifndef _ARPA_NAMESER_COMPAT_
+#define _ARPA_NAMESER_COMPAT_
+
+/*
+ * Structure for query header. The order of the fields is machine- and
+ * compiler-dependent, depending on the byte/bit order and the layout
+ * of bit fields. We use bit fields only in int variables, as this
+ * is all ANSI requires. This requires a somewhat confusing rearrangement.
+ */
+
+typedef struct {
+ unsigned id :16; /* query identification number */
+#if BYTE_ORDER == BIG_ENDIAN
+ /* fields in third byte */
+ unsigned qr: 1; /* response flag */
+ unsigned opcode: 4; /* purpose of message */
+ unsigned aa: 1; /* authoritive answer */
+ unsigned tc: 1; /* truncated message */
+ unsigned rd: 1; /* recursion desired */
+ /* fields in fourth byte */
+ unsigned ra: 1; /* recursion available */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned cd: 1; /* checking disabled by resolver */
+ unsigned rcode :4; /* response code */
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+ /* fields in third byte */
+ unsigned rd :1; /* recursion desired */
+ unsigned tc :1; /* truncated message */
+ unsigned aa :1; /* authoritive answer */
+ unsigned opcode :4; /* purpose of message */
+ unsigned qr :1; /* response flag */
+ /* fields in fourth byte */
+ unsigned rcode :4; /* response code */
+ unsigned cd: 1; /* checking disabled by resolver */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned ra :1; /* recursion available */
+#endif
+ /* remaining bytes */
+ unsigned qdcount :16; /* number of question entries */
+ unsigned ancount :16; /* number of answer entries */
+ unsigned nscount :16; /* number of authority entries */
+ unsigned arcount :16; /* number of resource entries */
+} HEADER;
+
+#define PACKETSZ NS_PACKETSZ
+#define MAXDNAME NS_MAXDNAME
+#define MAXCDNAME NS_MAXCDNAME
+#define MAXLABEL NS_MAXLABEL
+#define HFIXEDSZ NS_HFIXEDSZ
+#define QFIXEDSZ NS_QFIXEDSZ
+#define RRFIXEDSZ NS_RRFIXEDSZ
+#define INT32SZ NS_INT32SZ
+#define INT16SZ NS_INT16SZ
+#define INADDRSZ NS_INADDRSZ
+#define IN6ADDRSZ NS_IN6ADDRSZ
+#define INDIR_MASK NS_CMPRSFLGS
+#define NAMESERVER_PORT NS_DEFAULTPORT
+
+#define S_ZONE ns_s_zn
+#define S_PREREQ ns_s_pr
+#define S_UPDATE ns_s_ud
+#define S_ADDT ns_s_ar
+
+#define QUERY ns_o_query
+#define IQUERY ns_o_iquery
+#define STATUS ns_o_status
+#define NS_NOTIFY_OP ns_o_notify
+#define NS_UPDATE_OP ns_o_update
+
+#define NOERROR ns_r_noerror
+#define FORMERR ns_r_formerr
+#define SERVFAIL ns_r_servfail
+#define NXDOMAIN ns_r_nxdomain
+#define NOTIMP ns_r_notimpl
+#define REFUSED ns_r_refused
+#define YXDOMAIN ns_r_yxdomain
+#define YXRRSET ns_r_yxrrset
+#define NXRRSET ns_r_nxrrset
+#define NOTAUTH ns_r_notauth
+#define NOTZONE ns_r_notzone
+/*#define BADSIG ns_r_badsig*/
+/*#define BADKEY ns_r_badkey*/
+/*#define BADTIME ns_r_badtime*/
+
+
+#define DELETE ns_uop_delete
+#define ADD ns_uop_add
+
+#define T_A ns_t_a
+#define T_NS ns_t_ns
+#define T_MD ns_t_md
+#define T_MF ns_t_mf
+#define T_CNAME ns_t_cname
+#define T_SOA ns_t_soa
+#define T_MB ns_t_mb
+#define T_MG ns_t_mg
+#define T_MR ns_t_mr
+#define T_NULL ns_t_null
+#define T_WKS ns_t_wks
+#define T_PTR ns_t_ptr
+#define T_HINFO ns_t_hinfo
+#define T_MINFO ns_t_minfo
+#define T_MX ns_t_mx
+#define T_TXT ns_t_txt
+#define T_RP ns_t_rp
+#define T_AFSDB ns_t_afsdb
+#define T_X25 ns_t_x25
+#define T_ISDN ns_t_isdn
+#define T_RT ns_t_rt
+#define T_NSAP ns_t_nsap
+#define T_NSAP_PTR ns_t_nsap_ptr
+#define T_SIG ns_t_sig
+#define T_KEY ns_t_key
+#define T_PX ns_t_px
+#define T_GPOS ns_t_gpos
+#define T_AAAA ns_t_aaaa
+#define T_LOC ns_t_loc
+#define T_NXT ns_t_nxt
+#define T_EID ns_t_eid
+#define T_NIMLOC ns_t_nimloc
+#define T_SRV ns_t_srv
+#define T_ATMA ns_t_atma
+#define T_NAPTR ns_t_naptr
+#define T_TSIG ns_t_tsig
+#define T_IXFR ns_t_ixfr
+#define T_AXFR ns_t_axfr
+#define T_MAILB ns_t_mailb
+#define T_MAILA ns_t_maila
+#define T_ANY ns_t_any
+
+#define C_IN ns_c_in
+#define C_CHAOS ns_c_chaos
+#define C_HS ns_c_hs
+/* BIND_UPDATE */
+#define C_NONE ns_c_none
+#define C_ANY ns_c_any
+
+#define GETSHORT NS_GET16
+#define GETLONG NS_GET32
+#define PUTSHORT NS_PUT16
+#define PUTLONG NS_PUT32
+
+#endif /* _ARPA_NAMESER_COMPAT_ */
diff --git a/contrib/isc-dhcp/includes/cdefs.h b/contrib/isc-dhcp/includes/cdefs.h
index 2bc67a5251a9..4aadc0af5445 100644
--- a/contrib/isc-dhcp/includes/cdefs.h
+++ b/contrib/isc-dhcp/includes/cdefs.h
@@ -3,9 +3,9 @@
Standard C definitions... */
/*
- * Copyright (c) 1996 The Internet Software Consortium.
- * All Rights Reserved.
* Copyright (c) 1995 RadioMail Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -16,23 +16,23 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of RadioMail Corporation, the Internet Software
- * Consortium nor the names of its contributors may be used to endorse
- * or promote products derived from this software without specific
- * prior written permission.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY RADIOMAIL CORPORATION, THE INTERNET
- * SOFTWARE CONSORTIUM AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL RADIOMAIL CORPORATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
* This software was written for RadioMail Corporation by Ted Lemon
* under a contract with Vixie Enterprises. Further modifications have
@@ -40,6 +40,14 @@
* with Vixie Laboratories.
*/
+#if !defined (__ISC_DHCP_CDEFS_H__)
+#define __ISC_DHCP_CDEFS_H__
+/* Delete attributes if not gcc or not the right version of gcc. */
+#if !defined(__GNUC__) || __GNUC__ < 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined (darwin)
+#define __attribute__(x)
+#endif
+
#if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI)
#define PROTO(x) x
#define KandR(x)
@@ -55,3 +63,4 @@
#define ANSI_DECL(x)
#define INLINE
#endif /* __GNUC__ || __STDC__ */
+#endif /* __ISC_DHCP_CDEFS_H__ */
diff --git a/contrib/isc-dhcp/includes/cf/freebsd.h b/contrib/isc-dhcp/includes/cf/freebsd.h
index 032d52c2b002..590d0e81ea08 100644
--- a/contrib/isc-dhcp/includes/cf/freebsd.h
+++ b/contrib/isc-dhcp/includes/cf/freebsd.h
@@ -3,7 +3,7 @@
System dependencies for FreeBSD... */
/*
- * Copyright (c) 1996, 1998 The Internet Software Consortium.
+ * Copyright (c) 1996-1999 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,25 +15,30 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The Internet Software Consortium nor the names of its
- * contributors may be used to endorse or promote products derived
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
- * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
- * This software was written for the Internet Software Consortium by Ted Lemon
- * under a contract with Vixie Laboratories.
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
#define _ANSI_SOURCE
@@ -88,6 +93,56 @@ extern int h_errno;
#define HAVE_SA_LEN
+/* socklen_t was first defined on November 24 in sys/socket.h, and
+ __FreeBSD_version was changed to 400013 on December 4, so if you
+ get a compile error on this, and you updated between those dates,
+ that's why. Also, it may be that some 3.x version after 3.4 will
+ have socklen_t, but no such change has been made so far. */
+
+#if __FreeBSD_version < 400013
+#define SOCKLEN_T int
+#endif
+
#if defined (USE_DEFAULT_NETWORK)
# define USE_BPF
#endif
+#define HAVE_MKSTEMP
+#ifdef NEED_PRAND_CONF
+#ifndef HAVE_DEV_RANDOM
+ # define HAVE_DEV_RANDOM 1
+ #endif /* HAVE_DEV_RANDOM */
+
+const char *cmds[] = {
+ "/bin/ps -axlw 2>&1",
+ "/usr/sbin/arp -an 2>&1",
+ "/usr/bin/netstat -an 2>&1",
+ "/bin/df 2>&1",
+ "/usr/bin/dig com. soa +ti=1 +retry=0 2>&1",
+ "/usr/bin/netstat -an 2>&1",
+ "/usr/bin/dig . soa +ti=1 +retry=0 2>&1",
+ "/usr/sbin/iostat 2>&1",
+ "/usr/bin/vmstat 2>&1",
+ "/usr/bin/w 2>&1",
+ NULL
+};
+
+const char *dirs[] = {
+ "/tmp",
+ "/usr/tmp",
+ ".",
+ "/",
+ "/var/spool",
+ "/dev",
+ "/var/mail",
+ "/home",
+ "/usr/home",
+ NULL
+};
+
+const char *files[] = {
+ "/var/log/messages",
+ "/var/log/wtmp",
+ "/var/log/lastlog",
+ NULL
+};
+#endif /* NEED_PRAND_CONF */
diff --git a/contrib/isc-dhcp/includes/ctrace.h b/contrib/isc-dhcp/includes/ctrace.h
new file mode 100644
index 000000000000..a0a7ef844a09
--- /dev/null
+++ b/contrib/isc-dhcp/includes/ctrace.h
@@ -0,0 +1,86 @@
+/* trace.h
+
+ Definitions for dhcp tracing facility... */
+
+/*
+ * Copyright (c) 2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon, as part of a project for Nominum, Inc. To learn more
+ * about the Internet Software Consortium, see http://www.isc.org/. To
+ * learn more about Nominum, Inc., see ``http://www.nominum.com''.
+ */
+
+typedef struct {
+ struct in_addr primary_address;
+ u_int32_t index;
+ struct hardware hw_address;
+ char name [IFNAMSIZ];
+} trace_interface_packet_t;
+
+typedef struct {
+ u_int32_t index;
+ struct iaddr from;
+ u_int16_t from_port;
+ struct hardware hfrom;
+ u_int8_t havehfrom;
+} trace_inpacket_t;
+
+typedef struct {
+ u_int32_t index;
+ struct iaddr from;
+ struct iaddr to;
+ u_int16_t to_port;
+ struct hardware hto;
+ u_int8_t havehto;
+} trace_outpacket_t;
+
+void trace_interface_register (trace_type_t *, struct interface_info *);
+void trace_interface_input (trace_type_t *, unsigned, char *);
+void trace_interface_stop (trace_type_t *);
+void trace_inpacket_stash (struct interface_info *,
+ struct dhcp_packet *, unsigned, unsigned int,
+ struct iaddr, struct hardware *);
+void trace_inpacket_input (trace_type_t *, unsigned, char *);
+void trace_inpacket_stop (trace_type_t *);
+void trace_outpacket_input (trace_type_t *, unsigned, char *);
+void trace_outpacket_stop (trace_type_t *);
+ssize_t trace_packet_send (struct interface_info *,
+ struct packet *, struct dhcp_packet *, size_t,
+ struct in_addr,
+ struct sockaddr_in *, struct hardware *);
+void trace_icmp_input_input (trace_type_t *, unsigned, char *);
+void trace_icmp_input_stop (trace_type_t *);
+void trace_icmp_output_input (trace_type_t *, unsigned, char *);
+void trace_icmp_output_stop (trace_type_t *);
+void trace_seed_stash (trace_type_t *, unsigned);
+void trace_seed_input (trace_type_t *, unsigned, char *);
+void trace_seed_stop (trace_type_t *);
diff --git a/contrib/isc-dhcp/includes/dhcp.h b/contrib/isc-dhcp/includes/dhcp.h
index b96ec3d096df..9b6683a94b43 100644
--- a/contrib/isc-dhcp/includes/dhcp.h
+++ b/contrib/isc-dhcp/includes/dhcp.h
@@ -3,7 +3,7 @@
Protocol structures... */
/*
- * Copyright (c) 1995, 1996 The Internet Software Consortium.
+ * Copyright (c) 1995-2001 The Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,10 +34,9 @@
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
+ * by Ted Lemon in cooperation with Vixie Enterprises. To learn more
+ * about the Internet Software Consortium, see ``http://www.isc.org''.
+ * To learn more about Vixie Enterprises, see ``http://www.vix.com''.
*/
#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \
@@ -55,22 +54,22 @@
#define DHCP_MIN_LEN 548
struct dhcp_packet {
- u_int8_t op; /* Message opcode/type */
- u_int8_t htype; /* Hardware addr type (see net/if_types.h) */
- u_int8_t hlen; /* Hardware addr length */
- u_int8_t hops; /* Number of relay agent hops from client */
- u_int32_t xid; /* Transaction ID */
- u_int16_t secs; /* Seconds since client started looking */
- u_int16_t flags; /* Flag bits */
- struct in_addr ciaddr; /* Client IP address (if already in use) */
- struct in_addr yiaddr; /* Client IP address */
- struct in_addr siaddr; /* IP address of next server to talk to */
- struct in_addr giaddr; /* DHCP relay agent IP address */
- unsigned char chaddr [16]; /* Client hardware address */
- char sname [DHCP_SNAME_LEN]; /* Server name */
- char file [DHCP_FILE_LEN]; /* Boot filename */
+ u_int8_t op; /* 0: Message opcode/type */
+ u_int8_t htype; /* 1: Hardware addr type (net/if_types.h) */
+ u_int8_t hlen; /* 2: Hardware addr length */
+ u_int8_t hops; /* 3: Number of relay agent hops from client */
+ u_int32_t xid; /* 4: Transaction ID */
+ u_int16_t secs; /* 8: Seconds since client started looking */
+ u_int16_t flags; /* 10: Flag bits */
+ struct in_addr ciaddr; /* 12: Client IP address (if already in use) */
+ struct in_addr yiaddr; /* 16: Client IP address */
+ struct in_addr siaddr; /* 18: IP address of next server to talk to */
+ struct in_addr giaddr; /* 20: DHCP relay agent IP address */
+ unsigned char chaddr [16]; /* 24: Client hardware address */
+ char sname [DHCP_SNAME_LEN]; /* 40: Server name */
+ char file [DHCP_FILE_LEN]; /* 104: Boot filename */
unsigned char options [DHCP_OPTION_LEN];
- /* Optional parameters
+ /* 212: Optional parameters
(actual length dependent on MTU). */
};
@@ -152,9 +151,21 @@ struct dhcp_packet {
#define DHO_DHCP_MAX_MESSAGE_SIZE 57
#define DHO_DHCP_RENEWAL_TIME 58
#define DHO_DHCP_REBINDING_TIME 59
-#define DHO_DHCP_CLASS_IDENTIFIER 60
+#define DHO_VENDOR_CLASS_IDENTIFIER 60
#define DHO_DHCP_CLIENT_IDENTIFIER 61
-#define DHO_DHCP_USER_CLASS_ID 77
+#define DHO_NWIP_DOMAIN_NAME 62
+#define DHO_NWIP_SUBOPTIONS 63
+#define DHO_USER_CLASS 77
+#define DHO_FQDN 81
+#define DHO_DHCP_AGENT_OPTIONS 82
+#define DHO_SUBNET_SELECTION 118 /* RFC3011! */
+/* The DHO_AUTHENTICATE option is not a standard yet, so I've
+ allocated an option out of the "local" option space for it on a
+ temporary basis. Once an option code number is assigned, I will
+ immediately and shamelessly break this, so don't count on it
+ continuing to work. */
+#define DHO_AUTHENTICATE 210
+
#define DHO_END 255
/* DHCP message types. */
@@ -166,3 +177,19 @@ struct dhcp_packet {
#define DHCPNAK 6
#define DHCPRELEASE 7
#define DHCPINFORM 8
+
+/* Relay Agent Information option subtypes: */
+#define RAI_CIRCUIT_ID 1
+#define RAI_REMOTE_ID 2
+#define RAI_AGENT_ID 3
+
+/* FQDN suboptions: */
+#define FQDN_NO_CLIENT_UPDATE 1
+#define FQDN_SERVER_UPDATE 2
+#define FQDN_ENCODED 3
+#define FQDN_RCODE1 4
+#define FQDN_RCODE2 5
+#define FQDN_HOSTNAME 6
+#define FQDN_DOMAINNAME 7
+#define FQDN_FQDN 8
+#define FQDN_SUBOPTION_COUNT 8
diff --git a/contrib/isc-dhcp/includes/dhcpd.h b/contrib/isc-dhcp/includes/dhcpd.h
index d46ddf1bfae5..dc76d0e8ff73 100644
--- a/contrib/isc-dhcp/includes/dhcpd.h
+++ b/contrib/isc-dhcp/includes/dhcpd.h
@@ -3,8 +3,8 @@
Definitions for dhcpd... */
/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999
- * The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996-2001 Internet Software Consortium.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,10 +34,11 @@
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
#ifndef __CYGWIN32__
@@ -46,6 +47,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
+
#include <netdb.h>
#else
#define fd_set cygwin_fd_set
@@ -62,17 +64,94 @@
#include "cdefs.h"
#include "osdep.h"
+
+#include "arpa/nameser.h"
+#if defined (NSUPDATE)
+# include "minires/minires.h"
+#endif
+
+struct hash_table;
+typedef struct hash_table group_hash_t;
+typedef struct hash_table universe_hash_t;
+typedef struct hash_table option_hash_t;
+typedef struct hash_table dns_zone_hash_t;
+typedef struct hash_table lease_hash_t;
+typedef struct hash_table host_hash_t;
+typedef struct hash_table class_hash_t;
+
#include "dhcp.h"
+#include "statement.h"
#include "tree.h"
-#include "hash.h"
#include "inet.h"
-#include "sysconf.h"
+#include "dhctoken.h"
+
+#include <isc-dhcp/result.h>
+#include <omapip/omapip_p.h>
-struct option_data {
- int len;
+#if !defined (OPTION_HASH_SIZE)
+# define OPTION_HASH_SIZE 17
+# define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
+# define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
+#endif
+
+#define compute_option_hash(x) \
+ (((x) & (OPTION_HASH_PTWO - 1)) + \
+ (((x) >> OPTION_HASH_EXP) & \
+ (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
+
+enum dhcp_shutdown_state {
+ shutdown_listeners,
+ shutdown_omapi_connections,
+ shutdown_drop_omapi_connections,
+ shutdown_dhcp,
+ shutdown_done
+};
+
+/* Client FQDN option, failover FQDN option, etc. */
+typedef struct {
+ u_int8_t codes [2];
+ unsigned length;
u_int8_t *data;
+} ddns_fqdn_t;
+
+#include "failover.h"
+
+/* A parsing context. */
+
+struct parse {
+ int lexline;
+ int lexchar;
+ char *token_line;
+ char *prev_line;
+ char *cur_line;
+ const char *tlname;
+ int eol_token;
+
+ char line1 [81];
+ char line2 [81];
+ int lpos;
+ int line;
+ int tlpos;
+ int tline;
+ enum dhcp_token token;
+ int ugflag;
+ char *tval;
+ int tlen;
+ char tokbuf [1500];
+
+#ifdef OLD_LEXER
+ char comments [4096];
+ int comment_index;
+#endif
+ int warnings_occurred;
+ int file;
+ char *inbuf;
+ unsigned bufix, buflen;
+ unsigned bufsiz;
};
+/* Variable-length array of data. */
+
struct string_list {
struct string_list *next;
char string [1];
@@ -92,10 +171,46 @@ struct domain_search_list {
TIME rcdate;
};
+/* Option tag structures are used to build chains of option tags, for
+ when we're sure we're not going to have enough of them to justify
+ maintaining an array. */
+
+struct option_tag {
+ struct option_tag *next;
+ u_int8_t data [1];
+};
+
+/* An agent option structure. We need a special structure for the
+ Relay Agent Information option because if more than one appears in
+ a message, we have to keep them seperate. */
+
+struct agent_options {
+ struct agent_options *next;
+ int length;
+ struct option_tag *first;
+};
+
+struct option_cache {
+ int refcnt;
+ struct option_cache *next;
+ struct expression *expression;
+ struct option *option;
+ struct data_string data;
+};
+
+struct option_state {
+ int refcnt;
+ int universe_count;
+ int site_universe;
+ int site_code_min;
+ VOIDPTR universes [1];
+};
+
/* A dhcp packet and the pointers to its option values. */
struct packet {
struct dhcp_packet *raw;
- int packet_length;
+ int refcnt;
+ unsigned packet_length;
int packet_type;
int options_valid;
int client_port;
@@ -104,48 +219,108 @@ struct packet {
was received. */
struct hardware *haddr; /* Physical link address
of local sender (maybe gateway). */
- struct shared_network *shared_network;
- struct option_data options [256];
+
+ /* Information for relay agent options (see
+ draft-ietf-dhc-agent-options-xx.txt). */
+ u_int8_t *circuit_id; /* Circuit ID of client connection. */
+ int circuit_id_len;
+ u_int8_t *remote_id; /* Remote ID of client. */
+ int remote_id_len;
+
int got_requested_address; /* True if client sent the
dhcp-requested-address option. */
+
+ struct shared_network *shared_network;
+ struct option_state *options;
+
+#if !defined (PACKET_MAX_CLASSES)
+# define PACKET_MAX_CLASSES 5
+#endif
+ int class_count;
+ struct class *classes [PACKET_MAX_CLASSES];
+
+ int known;
+ int authenticated;
};
+/* A network interface's MAC address. */
+
struct hardware {
- u_int8_t htype;
u_int8_t hlen;
- u_int8_t haddr [16];
+ u_int8_t hbuf [17];
};
+typedef enum {
+ server_startup = 0,
+ server_running = 1,
+ server_shutdown = 2,
+ server_hibernate = 3,
+ server_awaken = 4
+} control_object_state_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ control_object_state_t state;
+} dhcp_control_object_t;
+
+/* Lease states: */
+typedef enum {
+ FTS_FREE = 1,
+ FTS_ACTIVE = 2,
+ FTS_EXPIRED = 3,
+ FTS_RELEASED = 4,
+ FTS_ABANDONED = 5,
+ FTS_RESET = 6,
+ FTS_BACKUP = 7,
+ FTS_RESERVED = 8,
+ FTS_BOOTP = 9
+} binding_state_t;
+
/* A dhcp lease declaration structure. */
struct lease {
+ OMAPI_OBJECT_PREAMBLE;
struct lease *next;
- struct lease *prev;
struct lease *n_uid, *n_hw;
- struct lease *waitq_next;
struct iaddr ip_addr;
- TIME starts, ends, timestamp;
- unsigned char *uid;
- int uid_len;
- int uid_max;
- unsigned char uid_buf [32];
- char *hostname;
+ TIME starts, ends, timestamp, sort_time;
char *client_hostname;
+ struct binding_scope *scope;
struct host_decl *host;
struct subnet *subnet;
- struct shared_network *shared_network;
+ struct pool *pool;
+ struct class *billing_class;
+ struct option_chain_head *agent_options;
+
+ struct executable_statement *on_expiry;
+ struct executable_statement *on_commit;
+ struct executable_statement *on_release;
+
+ unsigned char *uid;
+ unsigned short uid_len;
+ unsigned short uid_max;
+ unsigned char uid_buf [7];
struct hardware hardware_addr;
- int flags;
+ u_int8_t flags;
# define STATIC_LEASE 1
-# define BOOTP_LEASE 2
-# define DYNAMIC_BOOTP_OK 4
-# define PERSISTENT_FLAGS (DYNAMIC_BOOTP_OK)
-# define EPHEMERAL_FLAGS (BOOTP_LEASE)
+# define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
# define MS_NULL_TERMINATION 8
-# define ABANDONED_LEASE 16
-
+# define ON_UPDATE_QUEUE 16
+# define ON_ACK_QUEUE 32
+# define UNICAST_BROADCAST_HACK 64
+# define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
+ UNICAST_BROADCAST_HACK)
+
+ binding_state_t __attribute__ ((mode (__byte__))) binding_state;
+ binding_state_t __attribute__ ((mode (__byte__))) next_binding_state;
+
struct lease_state *state;
+
+ TIME tstp; /* Time sent to partner. */
+ TIME tsfp; /* Time sent from partner. */
+ TIME cltt; /* Client last transaction time. */
+ struct lease *next_pending;
};
struct lease_state {
@@ -153,22 +328,17 @@ struct lease_state {
struct interface_info *ip;
- TIME offered_expiry;
-
- struct tree_cache *options [256];
- u_int32_t expiry, renewal, rebind;
- char filename [DHCP_FILE_LEN];
- char *server_name;
+ struct packet *packet; /* The incoming packet. */
- struct iaddr from;
+ TIME offered_expiry;
+ struct option_state *options;
+ struct data_string parameter_request_list;
int max_message_size;
- u_int8_t *prl;
- int prl_len;
- int got_requested_address; /* True if client sent the
- dhcp-requested-address option. */
- int got_server_identifier; /* True if client sent the
- dhcp-server-identifier option. */
+ u_int32_t expiry, renewal, rebind;
+ struct data_string filename, server_name;
+ int got_requested_address;
+ int got_server_identifier;
struct shared_network *shared_network; /* Shared network of interface
on which request arrived. */
@@ -176,9 +346,11 @@ struct lease_state {
u_int16_t secs;
u_int16_t bootp_flags;
struct in_addr ciaddr;
+ struct in_addr siaddr;
struct in_addr giaddr;
u_int8_t hops;
u_int8_t offer;
+ struct iaddr from;
};
#define ROOT_GROUP 0
@@ -187,6 +359,7 @@ struct lease_state {
#define SUBNET_DECL 3
#define CLASS_DECL 4
#define GROUP_DECL 5
+#define POOL_DECL 6
/* Possible modes in which discover_interfaces can run. */
@@ -196,58 +369,217 @@ struct lease_state {
#define DISCOVER_RELAY 3
#define DISCOVER_REQUESTED 4
+/* Server option names. */
+
+#define SV_DEFAULT_LEASE_TIME 1
+#define SV_MAX_LEASE_TIME 2
+#define SV_MIN_LEASE_TIME 3
+#define SV_BOOTP_LEASE_CUTOFF 4
+#define SV_BOOTP_LEASE_LENGTH 5
+#define SV_BOOT_UNKNOWN_CLIENTS 6
+#define SV_DYNAMIC_BOOTP 7
+#define SV_ALLOW_BOOTP 8
+#define SV_ALLOW_BOOTING 9
+#define SV_ONE_LEASE_PER_CLIENT 10
+#define SV_GET_LEASE_HOSTNAMES 11
+#define SV_USE_HOST_DECL_NAMES 12
+#define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
+#define SV_MIN_SECS 14
+#define SV_FILENAME 15
+#define SV_SERVER_NAME 16
+#define SV_NEXT_SERVER 17
+#define SV_AUTHORITATIVE 18
+#define SV_VENDOR_OPTION_SPACE 19
+#define SV_ALWAYS_REPLY_RFC1048 20
+#define SV_SITE_OPTION_SPACE 21
+#define SV_ALWAYS_BROADCAST 22
+#define SV_DDNS_DOMAIN_NAME 23
+#define SV_DDNS_HOST_NAME 24
+#define SV_DDNS_REV_DOMAIN_NAME 25
+#define SV_LEASE_FILE_NAME 26
+#define SV_PID_FILE_NAME 27
+#define SV_DUPLICATES 28
+#define SV_DECLINES 29
+#define SV_DDNS_UPDATES 30
+#define SV_OMAPI_PORT 31
+#define SV_LOCAL_PORT 32
+#define SV_LIMITED_BROADCAST_ADDRESS 33
+#define SV_REMOTE_PORT 34
+#define SV_LOCAL_ADDRESS 35
+#define SV_OMAPI_KEY 36
+#define SV_STASH_AGENT_OPTIONS 37
+#define SV_DDNS_TTL 38
+#define SV_DDNS_UPDATE_STYLE 39
+#define SV_CLIENT_UPDATES 40
+#define SV_UPDATE_OPTIMIZATION 41
+#define SV_PING_CHECKS 42
+#define SV_UPDATE_STATIC_LEASES 43
+#define SV_LOG_FACILITY 44
+
+#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
+# define DEFAULT_DEFAULT_LEASE_TIME 43200
+#endif
+
+#if !defined (DEFAULT_MIN_LEASE_TIME)
+# define DEFAULT_MIN_LEASE_TIME 0
+#endif
+
+#if !defined (DEFAULT_MAX_LEASE_TIME)
+# define DEFAULT_MAX_LEASE_TIME 86400
+#endif
+
+#if !defined (DEFAULT_DDNS_TTL)
+# define DEFAULT_DDNS_TTL 3600
+#endif
+
+/* Client option names */
+
+#define CL_TIMEOUT 1
+#define CL_SELECT_INTERVAL 2
+#define CL_REBOOT_TIMEOUT 3
+#define CL_RETRY_INTERVAL 4
+#define CL_BACKOFF_CUTOFF 5
+#define CL_INITIAL_INTERVAL 6
+#define CL_BOOTP_POLICY 7
+#define CL_SCRIPT_NAME 8
+#define CL_REQUESTED_OPTIONS 9
+#define CL_REQUESTED_LEASE_TIME 10
+#define CL_SEND_OPTIONS 11
+#define CL_MEDIA 12
+#define CL_REJECT_LIST 13
+
+#ifndef CL_DEFAULT_TIMEOUT
+# define CL_DEFAULT_TIMEOUT 60
+#endif
+
+#ifndef CL_DEFAULT_SELECT_INTERVAL
+# define CL_DEFAULT_SELECT_INTERVAL 0
+#endif
+
+#ifndef CL_DEFAULT_REBOOT_TIMEOUT
+# define CL_DEFAULT_REBOOT_TIMEOUT 10
+#endif
+
+#ifndef CL_DEFAULT_RETRY_INTERVAL
+# define CL_DEFAULT_RETRY_INTERVAL 300
+#endif
+
+#ifndef CL_DEFAULT_BACKOFF_CUTOFF
+# define CL_DEFAULT_BACKOFF_CUTOFF 120
+#endif
+
+#ifndef CL_DEFAULT_INITIAL_INTERVAL
+# define CL_DEFAULT_INITIAL_INTERVAL 10
+#endif
+
+#ifndef CL_DEFAULT_BOOTP_POLICY
+# define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
+#endif
+
+#ifndef CL_DEFAULT_REQUESTED_OPTIONS
+# define CL_DEFAULT_REQUESTED_OPTIONS \
+ { DHO_SUBNET_MASK, \
+ DHO_BROADCAST_ADDRESS, \
+ DHO_TIME_OFFSET, \
+ DHO_ROUTERS, \
+ DHO_DOMAIN_NAME, \
+ DHO_DOMAIN_NAME_SERVERS, \
+ DHO_HOST_NAME }
+#endif
+
+struct group_object {
+ OMAPI_OBJECT_PREAMBLE;
+
+ struct group_object *n_dynamic;
+ struct group *group;
+ char *name;
+ int flags;
+#define GROUP_OBJECT_DELETED 1
+#define GROUP_OBJECT_DYNAMIC 2
+#define GROUP_OBJECT_STATIC 4
+};
+
/* Group of declarations that share common parameters. */
struct group {
struct group *next;
+ int refcnt;
+ struct group_object *object;
struct subnet *subnet;
struct shared_network *shared_network;
-
- TIME default_lease_time;
- TIME max_lease_time;
- TIME bootp_lease_cutoff;
- TIME bootp_lease_length;
-
- char *filename;
- char *server_name;
- struct iaddr next_server;
-
- int boot_unknown_clients;
- int dynamic_bootp;
- int allow_bootp;
- int allow_booting;
- int one_lease_per_client;
- int get_lease_hostnames;
- int use_host_decl_names;
- int use_lease_addr_for_default_route;
int authoritative;
- int always_reply_rfc1048;
-
- struct tree_cache *options [256];
+ struct executable_statement *statements;
};
/* A dhcp host declaration structure. */
struct host_decl {
+ OMAPI_OBJECT_PREAMBLE;
struct host_decl *n_ipaddr;
+ struct host_decl *n_dynamic;
char *name;
struct hardware interface;
- struct tree_cache *fixed_addr;
+ struct data_string client_identifier;
+ struct option_cache *fixed_addr;
struct group *group;
+ struct group_object *named_group;
+ struct data_string auth_key_id;
+ int flags;
+#define HOST_DECL_DELETED 1
+#define HOST_DECL_DYNAMIC 2
+#define HOST_DECL_STATIC 4
+};
+
+struct permit {
+ struct permit *next;
+ enum {
+ permit_unknown_clients,
+ permit_known_clients,
+ permit_authenticated_clients,
+ permit_unauthenticated_clients,
+ permit_all_clients,
+ permit_dynamic_bootp_clients,
+ permit_class
+ } type;
+ struct class *class;
+};
+
+struct pool {
+ OMAPI_OBJECT_PREAMBLE;
+ struct pool *next;
+ struct group *group;
+ struct shared_network *shared_network;
+ struct permit *permit_list;
+ struct permit *prohibit_list;
+ struct lease *active;
+ struct lease *expired;
+ struct lease *free;
+ struct lease *backup;
+ struct lease *abandoned;
+ TIME next_event_time;
+ int lease_count;
+ int free_leases;
+ int backup_leases;
+ int index;
+#if defined (FAILOVER_PROTOCOL)
+ dhcp_failover_state_t *failover_peer;
+#endif
};
struct shared_network {
+ OMAPI_OBJECT_PREAMBLE;
struct shared_network *next;
char *name;
struct subnet *subnets;
struct interface_info *interface;
- struct lease *leases;
- struct lease *insertion_point;
- struct lease *last_lease;
-
+ struct pool *pools;
struct group *group;
+#if defined (FAILOVER_PROTOCOL)
+ dhcp_failover_state_t *failover_peer;
+#endif
};
struct subnet {
+ OMAPI_OBJECT_PREAMBLE;
struct subnet *next_subnet;
struct subnet *next_sibling;
struct shared_network *shared_network;
@@ -259,10 +591,45 @@ struct subnet {
struct group *group;
};
-struct class {
- char *name;
+struct collection {
+ struct collection *next;
+
+ const char *name;
+ struct class *classes;
+};
+/* XXX classes must be reference-counted. */
+struct class {
+ OMAPI_OBJECT_PREAMBLE;
+ struct class *nic; /* Next in collection. */
+ struct class *superclass; /* Set for spawned classes only. */
+ char *name; /* Not set for spawned classes. */
+
+ /* A class may be configured to permit a limited number of leases. */
+ int lease_limit;
+ int leases_consumed;
+ struct lease **billed_leases;
+
+ /* If nonzero, class has not been saved since it was last
+ modified. */
+ int dirty;
+
+ /* Hash table containing subclasses. */
+ class_hash_t *hash;
+ struct data_string hash_string;
+
+ /* Expression used to match class. */
+ struct expression *expr;
+
+ /* Expression used to compute subclass identifiers for spawning
+ and to do subclass matching. */
+ struct expression *submatch;
+ int spawning;
+
struct group *group;
+
+ /* Statements to execute if class matches. */
+ struct executable_statement *statements;
};
/* DHCP client lease structure... */
@@ -273,39 +640,46 @@ struct client_lease {
char *server_name; /* Name of boot server. */
char *filename; /* Name of file we're supposed to boot. */
struct string_list *medium; /* Network medium. */
+ struct auth_key *key; /* Key used in basic DHCP authentication. */
unsigned int is_static : 1; /* If set, lease is from config file. */
unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */
- struct option_data options [256]; /* Options supplied with lease. */
+ struct option_state *options; /* Options supplied with lease. */
};
/* Possible states in which the client can be. */
enum dhcp_state {
- S_REBOOTING,
- S_INIT,
- S_SELECTING,
- S_REQUESTING,
- S_BOUND,
- S_RENEWING,
- S_REBINDING
+ S_REBOOTING = 1,
+ S_INIT = 2,
+ S_SELECTING = 3,
+ S_REQUESTING = 4,
+ S_BOUND = 5,
+ S_RENEWING = 6,
+ S_REBINDING = 7,
+ S_STOPPED = 8
};
+/* Authentication and BOOTP policy possibilities (not all values work
+ for each). */
+enum policy { P_IGNORE, P_ACCEPT, P_PREFER, P_REQUIRE, P_DONT };
+
/* Configuration information from the config file... */
struct client_config {
- struct option_data defaults [256]; /* Default values for options. */
- enum {
- ACTION_DEFAULT, /* Use server value if present,
- otherwise default. */
- ACTION_SUPERSEDE, /* Always use default. */
- ACTION_PREPEND, /* Prepend default to server. */
- ACTION_APPEND, /* Append default to server. */
- } default_actions [256];
-
- struct option_data send_options [256]; /* Send these to server. */
- u_int8_t required_options [256]; /* Options server must supply. */
- u_int8_t requested_options [256]; /* Options to request from server. */
- int requested_option_count; /* Number of requested options. */
+ /*
+ * When a message has been received, run these statements
+ * over it.
+ */
+ struct group *on_receipt;
+
+ /*
+ * When a message is sent, run these statements.
+ */
+ struct group *on_transmission;
+
+ u_int32_t *required_options; /* Options server must supply. */
+ u_int32_t *requested_options; /* Options to request from server. */
+
TIME timeout; /* Start to panic if we don't get a
lease in this time period when
SELECTING. */
@@ -324,18 +698,33 @@ struct client_config {
TIME backoff_cutoff; /* When doing exponential backoff,
never back off to an interval
longer than this amount. */
+ u_int32_t requested_lease; /* Requested lease time, if user
+ doesn't configure one. */
struct string_list *media; /* Possible network media values. */
char *script_name; /* Name of config script. */
- enum { IGNORE, ACCEPT, PREFER } bootp_policy;
+ char *vendor_space_name; /* Name of config script. */
+ enum policy bootp_policy;
/* Ignore, accept or prefer BOOTP
responses. */
+ enum policy auth_policy;
+ /* Require authentication, prefer
+ authentication, or don't try to
+ authenticate. */
struct string_list *medium; /* Current network medium. */
struct iaddrlist *reject_list; /* Servers to reject. */
+
+ int omapi_port; /* port on which to accept OMAPI
+ connections, or -1 for no
+ listener. */
};
/* Per-interface state used in the dhcp client... */
struct client_state {
+ struct client_state *next;
+ struct interface_info *interface;
+ char *name;
+
struct client_lease *active; /* Currently active lease. */
struct client_lease *new; /* New lease. */
struct client_lease *offered_leases; /* Leases offered to us. */
@@ -349,27 +738,38 @@ struct client_state {
TIME first_sending; /* When was first copy sent? */
TIME interval; /* What's the current resend interval? */
struct string_list *medium; /* Last media type tried. */
-
struct dhcp_packet packet; /* Outgoing DHCP packet. */
- int packet_length; /* Actual length of generated packet. */
+ unsigned packet_length; /* Actual length of generated packet. */
struct iaddr requested_address; /* Address we would like to get. */
- struct client_config *config; /* Information from config file. */
-
+ struct client_config *config; /* Client configuration. */
struct string_list *env; /* Client script environment. */
int envc; /* Number of entries in environment. */
+
+ struct option_state *sent_options; /* Options we sent. */
};
/* Information about each network interface. */
struct interface_info {
+ OMAPI_OBJECT_PREAMBLE;
struct interface_info *next; /* Next interface in list... */
struct shared_network *shared_network;
/* Networks connected to this interface. */
struct hardware hw_address; /* Its physical address. */
struct in_addr primary_address; /* Primary interface address. */
+
+ u_int8_t *circuit_id; /* Circuit ID associated with this
+ interface. */
+ unsigned circuit_id_len; /* Length of Circuit ID, if there
+ is one. */
+ u_int8_t *remote_id; /* Remote ID associated with this
+ interface (if any). */
+ unsigned remote_id_len; /* Length of Remote ID. */
+
char name [IFNAMSIZ]; /* Its name... */
+ int index; /* Its index. */
int rfdesc; /* Its read file descriptor. */
int wfdesc; /* Its write file descriptor, if
different. */
@@ -382,9 +782,14 @@ struct interface_info {
u_int32_t flags; /* Control flags... */
#define INTERFACE_REQUESTED 1
#define INTERFACE_AUTOMATIC 2
+#define INTERFACE_RUNNING 4
/* Only used by DHCP client code. */
struct client_state *client;
+# if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
+ int dlpi_sap_length;
+ struct hardware dlpi_broadcast_addr;
+# endif /* DLPI_SEND || DLPI_RECEIVE */
};
struct hardware_link {
@@ -393,11 +798,15 @@ struct hardware_link {
struct hardware address;
};
+typedef void (*tvref_t)(void *, void *, const char *, int);
+typedef void (*tvunref_t)(void *, const char *, int);
struct timeout {
struct timeout *next;
TIME when;
void (*func) PROTO ((void *));
void *what;
+ tvref_t ref;
+ tvunref_t unref;
};
struct protocol {
@@ -407,6 +816,64 @@ struct protocol {
void *local;
};
+struct dns_query; /* forward */
+
+struct dns_wakeup {
+ struct dns_wakeup *next; /* Next wakeup in chain. */
+ void (*func) PROTO ((struct dns_query *));
+};
+
+struct dns_question {
+ u_int16_t type; /* Type of query. */
+ u_int16_t class; /* Class of query. */
+ unsigned char data [1]; /* Query data. */
+};
+
+struct dns_answer {
+ u_int16_t type; /* Type of answer. */
+ u_int16_t class; /* Class of answer. */
+ int count; /* Number of answers. */
+ unsigned char *answers[1]; /* Pointers to answers. */
+};
+
+struct dns_query {
+ struct dns_query *next; /* Next query in hash bucket. */
+ u_int32_t hash; /* Hash bucket index. */
+ TIME expiry; /* Query expiry time (zero if not yet
+ answered. */
+ u_int16_t id; /* Query ID (also hash table index) */
+ caddr_t waiters; /* Pointer to list of things waiting
+ on this query. */
+
+ struct dns_question *question; /* Question, internal format. */
+ struct dns_answer *answer; /* Answer, internal format. */
+
+ unsigned char *query; /* Query formatted for DNS server. */
+ unsigned len; /* Length of entire query. */
+ int sent; /* The query has been sent. */
+ struct dns_wakeup *wakeups; /* Wakeups to call if this query is
+ answered. */
+ struct name_server *next_server; /* Next server to try. */
+ int backoff; /* Current backoff, in seconds. */
+};
+
+struct dns_zone {
+ int refcnt;
+ TIME timeout;
+ char *name;
+ struct option_cache *primary;
+ struct option_cache *secondary;
+ struct auth_key *key;
+};
+
+struct icmp_state {
+ OMAPI_OBJECT_PREAMBLE;
+ int socket;
+ void (*icmp_handler) PROTO ((struct iaddr, u_int8_t *, int));
+};
+
+#include "ctrace.h"
+
/* Bitmask of dhcp option codes. */
typedef unsigned char option_mask [16];
@@ -445,6 +912,10 @@ typedef unsigned char option_mask [16];
#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
#endif
+#ifndef _PATH_DHCLIENT_SCRIPT
+#define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
+#endif
+
#ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif
@@ -470,192 +941,604 @@ typedef unsigned char option_mask [16];
/* External definitions... */
+HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t)
+HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t)
+HASH_FUNCTIONS_DECL (option, const char *, struct option, option_hash_t)
+HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t)
+HASH_FUNCTIONS_DECL (lease, const unsigned char *, struct lease, lease_hash_t)
+HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t)
+HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t)
+
/* options.c */
-void parse_options PROTO ((struct packet *));
-void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
-int cons_options PROTO ((struct packet *, struct dhcp_packet *, int,
- struct tree_cache **, int, int, int,
- u_int8_t *, int));
-int store_options PROTO ((unsigned char *, int, struct tree_cache **,
- unsigned char *, int, int, int, int));
-char *pretty_print_option PROTO ((unsigned int,
- unsigned char *, int, int, int));
+extern struct option *vendor_cfg_option;
+int parse_options PROTO ((struct packet *));
+int parse_option_buffer PROTO ((struct option_state *, const unsigned char *,
+ unsigned, struct universe *));
+struct universe *find_option_universe (struct option *, const char *);
+int parse_encapsulated_suboptions (struct option_state *, struct option *,
+ const unsigned char *, unsigned,
+ struct universe *, const char *);
+int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *,
+ struct client_state *,
+ int, struct option_state *, struct option_state *,
+ struct binding_scope **,
+ int, int, int, struct data_string *, const char *));
+int fqdn_universe_decode (struct option_state *,
+ const unsigned char *, unsigned, struct universe *);
+int store_options PROTO ((unsigned char *, unsigned, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *,
+ struct option_state *, struct binding_scope **,
+ unsigned *, int, unsigned, unsigned,
+ int, const char *));
+const char *pretty_print_option PROTO ((struct option *, const unsigned char *,
+ unsigned, int, int));
+int get_option (struct data_string *, struct universe *,
+ struct packet *, struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct option_state *, struct binding_scope **, unsigned,
+ const char *, int);
+void set_option (struct universe *, struct option_state *,
+ struct option_cache *, enum statement_op);
+struct option_cache *lookup_option PROTO ((struct universe *,
+ struct option_state *, unsigned));
+struct option_cache *lookup_hashed_option PROTO ((struct universe *,
+ struct option_state *,
+ unsigned));
+int save_option_buffer (struct universe *, struct option_state *,
+ struct buffer *, unsigned char *, unsigned,
+ struct option *, int);
+void save_option PROTO ((struct universe *,
+ struct option_state *, struct option_cache *));
+void save_hashed_option PROTO ((struct universe *,
+ struct option_state *, struct option_cache *));
+void delete_option PROTO ((struct universe *, struct option_state *, int));
+void delete_hashed_option PROTO ((struct universe *,
+ struct option_state *, int));
+int option_cache_dereference PROTO ((struct option_cache **,
+ const char *, int));
+int hashed_option_state_dereference PROTO ((struct universe *,
+ struct option_state *,
+ const char *, int));
+int store_option PROTO ((struct data_string *,
+ struct universe *, struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct option_cache *));
+int option_space_encapsulate PROTO ((struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct data_string *));
+int hashed_option_space_encapsulate PROTO ((struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *));
+int nwip_option_space_encapsulate PROTO ((struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *));
+int fqdn_option_space_encapsulate (struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *);
+void suboption_foreach (struct packet *, struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct universe *, void *,
+ void (*) (struct option_cache *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *),
+ struct option_cache *, const char *);
+void option_space_foreach (struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *,
+ void (*) (struct option_cache *,
+ struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *));
+void hashed_option_space_foreach (struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *,
+ void (*) (struct option_cache *,
+ struct packet *,
+ struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *));
+int linked_option_get PROTO ((struct data_string *, struct universe *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *, struct option_state *,
+ struct option_state *, struct binding_scope **,
+ unsigned));
+int linked_option_state_dereference PROTO ((struct universe *,
+ struct option_state *,
+ const char *, int));
+void save_linked_option (struct universe *, struct option_state *,
+ struct option_cache *);
+void linked_option_space_foreach (struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *,
+ void (*) (struct option_cache *,
+ struct packet *,
+ struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *));
+int linked_option_space_encapsulate (struct data_string *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *);
+void delete_linked_option (struct universe *, struct option_state *, int);
+struct option_cache *lookup_linked_option (struct universe *,
+ struct option_state *, unsigned);
void do_packet PROTO ((struct interface_info *,
- struct dhcp_packet *, int,
+ struct dhcp_packet *, unsigned,
unsigned int, struct iaddr, struct hardware *));
-/* errwarn.c */
-extern int warnings_occurred;
-void error PROTO ((char *, ...));
-int warn PROTO ((char *, ...));
-int note PROTO ((char *, ...));
-int debug PROTO ((char *, ...));
-int parse_warn PROTO ((char *, ...));
-
/* dhcpd.c */
extern TIME cur_time;
-extern struct group root_group;
-extern u_int16_t local_port;
-extern u_int16_t remote_port;
-extern int log_priority;
-extern int log_perror;
+int ddns_update_style;
+
+extern const char *path_dhcpd_conf;
+extern const char *path_dhcpd_db;
+extern const char *path_dhcpd_pid;
-extern char *path_dhcpd_conf;
-extern char *path_dhcpd_db;
-extern char *path_dhcpd_pid;
+extern int dhcp_max_agent_option_packet_length;
int main PROTO ((int, char **, char **));
+void postconf_initialization (int);
+void postdb_startup (void);
void cleanup PROTO ((void));
void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));
void lease_ping_timeout PROTO ((void *));
+int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
+enum dhcp_shutdown_state shutdown_state;
+isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);
+isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
+ control_object_state_t newstate);
/* conflex.c */
-extern int lexline, lexchar;
-extern char *token_line, *tlname;
-extern char comments [4096];
-extern int comment_index;
-extern int eol_token;
-void new_parse PROTO ((char *));
-int next_token PROTO ((char **, FILE *));
-int peek_token PROTO ((char **, FILE *));
+isc_result_t new_parse PROTO ((struct parse **, int,
+ char *, unsigned, const char *, int));
+isc_result_t end_parse PROTO ((struct parse **));
+enum dhcp_token next_token PROTO ((const char **, unsigned *, struct parse *));
+enum dhcp_token peek_token PROTO ((const char **, unsigned *, struct parse *));
/* confpars.c */
-int readconf PROTO ((void));
-void read_leases PROTO ((void));
-int parse_statement PROTO ((FILE *,
+void parse_trace_setup (void);
+isc_result_t readconf PROTO ((void));
+isc_result_t read_conf_file (const char *, struct group *, int, int);
+#if defined (TRACING)
+void trace_conf_input (trace_type_t *, unsigned, char *);
+void trace_conf_stop (trace_type_t *ttype);
+#endif
+isc_result_t conf_file_subparse (struct parse *, struct group *, int);
+isc_result_t lease_file_subparse (struct parse *);
+int parse_statement PROTO ((struct parse *,
struct group *, int, struct host_decl *, int));
-void parse_allow_deny PROTO ((FILE *, struct group *, int));
-void skip_to_semi PROTO ((FILE *));
-int parse_boolean PROTO ((FILE *));
-int parse_semi PROTO ((FILE *));
-int parse_lbrace PROTO ((FILE *));
-void parse_host_declaration PROTO ((FILE *, struct group *));
-char *parse_host_name PROTO ((FILE *));
-void parse_class_declaration PROTO ((FILE *, struct group *, int));
-void parse_lease_time PROTO ((FILE *, TIME *));
-void parse_shared_net_declaration PROTO ((FILE *, struct group *));
-void parse_subnet_declaration PROTO ((FILE *, struct shared_network *));
-void parse_group_declaration PROTO ((FILE *, struct group *));
-void parse_hardware_param PROTO ((FILE *, struct hardware *));
-char *parse_string PROTO ((FILE *));
-struct tree *parse_ip_addr_or_hostname PROTO ((FILE *, int));
-struct tree_cache *parse_fixed_addr_param PROTO ((FILE *));
-void parse_option_param PROTO ((FILE *, struct group *));
-TIME parse_timestamp PROTO ((FILE *));
-struct lease *parse_lease_declaration PROTO ((FILE *));
-void parse_address_range PROTO ((FILE *, struct subnet *));
-TIME parse_date PROTO ((FILE *));
-unsigned char *parse_numeric_aggregate PROTO ((FILE *,
- unsigned char *, int *,
- int, int, int));
-void convert_num PROTO ((unsigned char *, char *, int, int));
+#if defined (FAILOVER_PROTOCOL)
+void parse_failover_peer PROTO ((struct parse *, struct group *, int));
+void parse_failover_state_declaration (struct parse *,
+ dhcp_failover_state_t *);
+void parse_failover_state PROTO ((struct parse *,
+ enum failover_state *, TIME *));
+#endif
+int permit_list_match (struct permit *, struct permit *);
+void parse_pool_statement PROTO ((struct parse *, struct group *, int));
+int parse_boolean PROTO ((struct parse *));
+int parse_lbrace PROTO ((struct parse *));
+void parse_host_declaration PROTO ((struct parse *, struct group *));
+int parse_class_declaration PROTO ((struct class **, struct parse *,
+ struct group *, int));
+void parse_shared_net_declaration PROTO ((struct parse *, struct group *));
+void parse_subnet_declaration PROTO ((struct parse *,
+ struct shared_network *));
+void parse_group_declaration PROTO ((struct parse *, struct group *));
+int parse_fixed_addr_param PROTO ((struct option_cache **, struct parse *));
+TIME parse_timestamp PROTO ((struct parse *));
+int parse_lease_declaration PROTO ((struct lease **, struct parse *));
+void parse_address_range PROTO ((struct parse *, struct group *, int,
+ struct pool *, struct lease **));
+
+/* ddns.c */
+int ddns_updates PROTO ((struct packet *, struct lease *, struct lease *,
+ struct lease_state *));
+int ddns_removals PROTO ((struct lease *));
+
+/* parse.c */
+void add_enumeration (struct enumeration *);
+struct enumeration *find_enumeration (const char *, int);
+struct enumeration_value *find_enumeration_value (const char *, int,
+ const char *);
+void skip_to_semi PROTO ((struct parse *));
+void skip_to_rbrace PROTO ((struct parse *, int));
+int parse_semi PROTO ((struct parse *));
+int parse_string PROTO ((struct parse *, char **, unsigned *));
+char *parse_host_name PROTO ((struct parse *));
+int parse_ip_addr_or_hostname PROTO ((struct expression **,
+ struct parse *, int));
+void parse_hardware_param PROTO ((struct parse *, struct hardware *));
+void parse_lease_time PROTO ((struct parse *, TIME *));
+unsigned char *parse_numeric_aggregate PROTO ((struct parse *,
+ unsigned char *, unsigned *,
+ int, int, unsigned));
+void convert_num PROTO ((struct parse *, unsigned char *, const char *,
+ int, unsigned));
+TIME parse_date PROTO ((struct parse *));
+struct option *parse_option_name PROTO ((struct parse *, int, int *));
+void parse_option_space_decl PROTO ((struct parse *));
+int parse_option_code_definition PROTO ((struct parse *, struct option *));
+int parse_base64 (struct data_string *, struct parse *);
+int parse_cshl PROTO ((struct data_string *, struct parse *));
+int parse_executable_statement PROTO ((struct executable_statement **,
+ struct parse *, int *,
+ enum expression_context));
+int parse_executable_statements PROTO ((struct executable_statement **,
+ struct parse *, int *,
+ enum expression_context));
+int parse_zone (struct dns_zone *, struct parse *);
+int parse_key (struct parse *);
+int parse_on_statement PROTO ((struct executable_statement **,
+ struct parse *, int *));
+int parse_switch_statement PROTO ((struct executable_statement **,
+ struct parse *, int *));
+int parse_case_statement PROTO ((struct executable_statement **,
+ struct parse *, int *,
+ enum expression_context));
+int parse_if_statement PROTO ((struct executable_statement **,
+ struct parse *, int *));
+int parse_boolean_expression PROTO ((struct expression **,
+ struct parse *, int *));
+int parse_data_expression PROTO ((struct expression **,
+ struct parse *, int *));
+int parse_numeric_expression PROTO ((struct expression **,
+ struct parse *, int *));
+int parse_dns_expression PROTO ((struct expression **, struct parse *, int *));
+int parse_non_binary PROTO ((struct expression **, struct parse *, int *,
+ enum expression_context));
+int parse_expression PROTO ((struct expression **, struct parse *, int *,
+ enum expression_context,
+ struct expression **, enum expr_op));
+int parse_option_statement PROTO ((struct executable_statement **,
+ struct parse *, int,
+ struct option *, enum statement_op));
+int parse_option_token PROTO ((struct expression **, struct parse *,
+ const char **, struct expression *, int, int));
+int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
+int parse_auth_key PROTO ((struct data_string *, struct parse *));
+int parse_warn (struct parse *, const char *, ...)
+ __attribute__((__format__(__printf__,2,3)));
/* tree.c */
+#if defined (NSUPDATE)
+extern struct __res_state resolver_state;
+extern int resolver_inited;
+#endif
+
+extern struct binding_scope *global_scope;
pair cons PROTO ((caddr_t, pair));
-struct tree_cache *tree_cache PROTO ((struct tree *));
-struct tree *tree_host_lookup PROTO ((char *));
-struct dns_host_entry *enter_dns_host PROTO ((char *));
-struct tree *tree_const PROTO ((unsigned char *, int));
-struct tree *tree_concat PROTO ((struct tree *, struct tree *));
-struct tree *tree_limit PROTO ((struct tree *, int));
-int tree_evaluate PROTO ((struct tree_cache *));
+int make_const_option_cache PROTO ((struct option_cache **, struct buffer **,
+ u_int8_t *, unsigned, struct option *,
+ const char *, int));
+int make_host_lookup PROTO ((struct expression **, const char *));
+int enter_dns_host PROTO ((struct dns_host_entry **, const char *));
+int make_const_data (struct expression **,
+ const unsigned char *, unsigned, int, int,
+ const char *, int);
+int make_const_int PROTO ((struct expression **, unsigned long));
+int make_concat PROTO ((struct expression **,
+ struct expression *, struct expression *));
+int make_encapsulation PROTO ((struct expression **, struct data_string *));
+int make_substring PROTO ((struct expression **, struct expression *,
+ struct expression *, struct expression *));
+int make_limit PROTO ((struct expression **, struct expression *, int));
+int make_let PROTO ((struct executable_statement **, const char *));
+int option_cache PROTO ((struct option_cache **, struct data_string *,
+ struct expression *, struct option *,
+ const char *, int));
+int evaluate_expression (struct binding_value **, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct expression *,
+ const char *, int);
+int binding_value_dereference (struct binding_value **, const char *, int);
+#if defined (NSUPDATE)
+int evaluate_dns_expression PROTO ((ns_updrec **, struct packet *,
+ struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct expression *));
+#endif
+int evaluate_boolean_expression PROTO ((int *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct expression *));
+int evaluate_data_expression PROTO ((struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct expression *, const char *, int));
+int evaluate_numeric_expression (unsigned long *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct expression *);
+int evaluate_option_cache PROTO ((struct data_string *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct option_cache *,
+ const char *, int));
+int evaluate_boolean_option_cache PROTO ((int *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct option_cache *,
+ const char *, int));
+int evaluate_boolean_expression_result PROTO ((int *,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct expression *));
+void expression_dereference PROTO ((struct expression **, const char *, int));
+int is_dns_expression PROTO ((struct expression *));
+int is_boolean_expression PROTO ((struct expression *));
+int is_data_expression PROTO ((struct expression *));
+int is_numeric_expression PROTO ((struct expression *));
+int is_compound_expression PROTO ((struct expression *));
+int op_precedence PROTO ((enum expr_op, enum expr_op));
+enum expression_context expression_context (struct expression *);
+enum expression_context op_context PROTO ((enum expr_op));
+int write_expression PROTO ((FILE *, struct expression *, int, int, int));
+struct binding *find_binding PROTO ((struct binding_scope *, const char *));
+int free_bindings PROTO ((struct binding_scope *, const char *, int));
+int binding_scope_dereference PROTO ((struct binding_scope **,
+ const char *, int));
+int fundef_dereference (struct fundef **, const char *, int);
+int data_subexpression_length (int *, struct expression *);
+int expr_valid_for_context (struct expression *, enum expression_context);
+struct binding *create_binding (struct binding_scope **, const char *);
+int bind_ds_value (struct binding_scope **,
+ const char *, struct data_string *);
+int find_bound_string (struct data_string *,
+ struct binding_scope *, const char *);
+int unset (struct binding_scope *, const char *);
/* dhcp.c */
extern int outstanding_pings;
void dhcp PROTO ((struct packet *));
-void dhcpdiscover PROTO ((struct packet *));
-void dhcprequest PROTO ((struct packet *));
-void dhcprelease PROTO ((struct packet *));
-void dhcpdecline PROTO ((struct packet *));
-void dhcpinform PROTO ((struct packet *));
+void dhcpdiscover PROTO ((struct packet *, int));
+void dhcprequest PROTO ((struct packet *, int, struct lease *));
+void dhcprelease PROTO ((struct packet *, int));
+void dhcpdecline PROTO ((struct packet *, int));
+void dhcpinform PROTO ((struct packet *, int));
void nak_lease PROTO ((struct packet *, struct iaddr *cip));
-void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME));
+void ack_lease PROTO ((struct packet *, struct lease *,
+ unsigned int, TIME, char *, int));
void dhcp_reply PROTO ((struct lease *));
-struct lease *find_lease PROTO ((struct packet *,
- struct shared_network *, int *));
-struct lease *mockup_lease PROTO ((struct packet *,
- struct shared_network *,
- struct host_decl *));
+int find_lease PROTO ((struct lease **, struct packet *,
+ struct shared_network *, int *, int *, struct lease *,
+ const char *, int));
+int mockup_lease PROTO ((struct lease **, struct packet *,
+ struct shared_network *,
+ struct host_decl *));
+void static_lease_dereference PROTO ((struct lease *, const char *, int));
+
+int allocate_lease PROTO ((struct lease **, struct packet *,
+ struct pool *, int *));
+int permitted PROTO ((struct packet *, struct permit *));
+int locate_network PROTO ((struct packet *));
+int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *));
+unsigned cons_agent_information_options PROTO ((struct option_state *,
+ struct dhcp_packet *,
+ unsigned, unsigned));
/* bootp.c */
void bootp PROTO ((struct packet *));
/* memory.c */
-void enter_host PROTO ((struct host_decl *));
-struct host_decl *find_hosts_by_haddr PROTO ((int, unsigned char *, int));
-struct host_decl *find_hosts_by_uid PROTO ((unsigned char *, int));
-struct subnet *find_host_for_network PROTO ((struct host_decl **,
- struct iaddr *,
- struct shared_network *));
-void new_address_range PROTO ((struct iaddr, struct iaddr,
- struct subnet *, int));
-extern struct subnet *find_grouped_subnet PROTO ((struct shared_network *,
- struct iaddr));
-extern struct subnet *find_subnet PROTO ((struct iaddr));
-void enter_shared_network PROTO ((struct shared_network *));
-int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int));
-void enter_subnet PROTO ((struct subnet *));
-void enter_lease PROTO ((struct lease *));
-int supersede_lease PROTO ((struct lease *, struct lease *, int));
-void release_lease PROTO ((struct lease *));
-void abandon_lease PROTO ((struct lease *, char *));
-struct lease *find_lease_by_uid PROTO ((unsigned char *, int));
-struct lease *find_lease_by_hw_addr PROTO ((unsigned char *, int));
-struct lease *find_lease_by_ip_addr PROTO ((struct iaddr));
-void uid_hash_add PROTO ((struct lease *));
-void uid_hash_delete PROTO ((struct lease *));
-void hw_hash_add PROTO ((struct lease *));
-void hw_hash_delete PROTO ((struct lease *));
-struct class *add_class PROTO ((int, char *));
-struct class *find_class PROTO ((int, unsigned char *, int));
-struct group *clone_group PROTO ((struct group *, char *));
-void write_leases PROTO ((void));
-void dump_subnets PROTO ((void));
+int (*group_write_hook) (struct group_object *);
+extern struct group *root_group;
+extern group_hash_t *group_name_hash;
+isc_result_t delete_group (struct group_object *, int);
+isc_result_t supersede_group (struct group_object *, int);
+int clone_group (struct group **, struct group *, const char *, int);
+int write_group PROTO ((struct group_object *));
+
+/* salloc.c */
+void relinquish_lease_hunks (void);
+struct lease *new_leases PROTO ((unsigned, const char *, int));
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+void relinquish_free_lease_states (void);
+#endif
+OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease)
+OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class)
+OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool)
+OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host)
/* alloc.c */
-VOIDPTR dmalloc PROTO ((int, char *));
-void dfree PROTO ((VOIDPTR, char *));
-struct packet *new_packet PROTO ((char *));
-struct dhcp_packet *new_dhcp_packet PROTO ((char *));
-struct tree *new_tree PROTO ((char *));
-struct tree_cache *new_tree_cache PROTO ((char *));
-struct hash_table *new_hash_table PROTO ((int, char *));
-struct hash_bucket *new_hash_bucket PROTO ((char *));
-struct lease *new_lease PROTO ((char *));
-struct lease *new_leases PROTO ((int, char *));
-struct subnet *new_subnet PROTO ((char *));
-struct class *new_class PROTO ((char *));
-struct shared_network *new_shared_network PROTO ((char *));
-struct group *new_group PROTO ((char *));
-struct protocol *new_protocol PROTO ((char *));
-struct lease_state *new_lease_state PROTO ((char *));
-struct domain_search_list *new_domain_search_list PROTO ((char *));
-struct name_server *new_name_server PROTO ((char *));
-void free_name_server PROTO ((struct name_server *, char *));
-void free_domain_search_list PROTO ((struct domain_search_list *, char *));
-void free_lease_state PROTO ((struct lease_state *, char *));
-void free_protocol PROTO ((struct protocol *, char *));
-void free_group PROTO ((struct group *, char *));
-void free_shared_network PROTO ((struct shared_network *, char *));
-void free_class PROTO ((struct class *, char *));
-void free_subnet PROTO ((struct subnet *, char *));
-void free_lease PROTO ((struct lease *, char *));
-void free_hash_bucket PROTO ((struct hash_bucket *, char *));
-void free_hash_table PROTO ((struct hash_table *, char *));
-void free_tree_cache PROTO ((struct tree_cache *, char *));
-void free_packet PROTO ((struct packet *, char *));
-void free_dhcp_packet PROTO ((struct dhcp_packet *, char *));
-void free_tree PROTO ((struct tree *, char *));
+OMAPI_OBJECT_ALLOC_DECL (subnet, struct subnet, dhcp_type_subnet)
+OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network,
+ dhcp_type_shared_network)
+OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group)
+OMAPI_OBJECT_ALLOC_DECL (dhcp_control,
+ dhcp_control_object_t, dhcp_type_control)
+
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+void relinquish_free_pairs (void);
+void relinquish_free_expressions (void);
+void relinquish_free_binding_values (void);
+void relinquish_free_option_caches (void);
+void relinquish_free_packets (void);
+#endif
+
+int option_chain_head_allocate (struct option_chain_head **,
+ const char *, int);
+int option_chain_head_reference (struct option_chain_head **,
+ struct option_chain_head *,
+ const char *, int);
+int option_chain_head_dereference (struct option_chain_head **,
+ const char *, int);
+int group_allocate (struct group **, const char *, int);
+int group_reference (struct group **, struct group *, const char *, int);
+int group_dereference (struct group **, const char *, int);
+struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int));
+struct protocol *new_protocol PROTO ((const char *, int));
+struct lease_state *new_lease_state PROTO ((const char *, int));
+struct domain_search_list *new_domain_search_list PROTO ((const char *, int));
+struct name_server *new_name_server PROTO ((const char *, int));
+void free_name_server PROTO ((struct name_server *, const char *, int));
+struct option *new_option PROTO ((const char *, int));
+int group_allocate (struct group **, const char *, int);
+int group_reference (struct group **, struct group *, const char *, int);
+int group_dereference (struct group **, const char *, int);
+void free_option PROTO ((struct option *, const char *, int));
+struct universe *new_universe PROTO ((const char *, int));
+void free_universe PROTO ((struct universe *, const char *, int));
+void free_domain_search_list PROTO ((struct domain_search_list *,
+ const char *, int));
+void free_lease_state PROTO ((struct lease_state *, const char *, int));
+void free_protocol PROTO ((struct protocol *, const char *, int));
+void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *, int));
+struct client_lease *new_client_lease PROTO ((const char *, int));
+void free_client_lease PROTO ((struct client_lease *, const char *, int));
+struct permit *new_permit PROTO ((const char *, int));
+void free_permit PROTO ((struct permit *, const char *, int));
+pair new_pair PROTO ((const char *, int));
+void free_pair PROTO ((pair, const char *, int));
+int expression_allocate PROTO ((struct expression **, const char *, int));
+int expression_reference PROTO ((struct expression **,
+ struct expression *, const char *, int));
+void free_expression PROTO ((struct expression *, const char *, int));
+int binding_value_allocate PROTO ((struct binding_value **,
+ const char *, int));
+int binding_value_reference PROTO ((struct binding_value **,
+ struct binding_value *,
+ const char *, int));
+void free_binding_value PROTO ((struct binding_value *, const char *, int));
+int fundef_allocate PROTO ((struct fundef **, const char *, int));
+int fundef_reference PROTO ((struct fundef **,
+ struct fundef *, const char *, int));
+int option_cache_allocate PROTO ((struct option_cache **, const char *, int));
+int option_cache_reference PROTO ((struct option_cache **,
+ struct option_cache *, const char *, int));
+int buffer_allocate PROTO ((struct buffer **, unsigned, const char *, int));
+int buffer_reference PROTO ((struct buffer **, struct buffer *,
+ const char *, int));
+int buffer_dereference PROTO ((struct buffer **, const char *, int));
+int dns_host_entry_allocate PROTO ((struct dns_host_entry **,
+ const char *, const char *, int));
+int dns_host_entry_reference PROTO ((struct dns_host_entry **,
+ struct dns_host_entry *,
+ const char *, int));
+int dns_host_entry_dereference PROTO ((struct dns_host_entry **,
+ const char *, int));
+int option_state_allocate PROTO ((struct option_state **, const char *, int));
+int option_state_reference PROTO ((struct option_state **,
+ struct option_state *, const char *, int));
+int option_state_dereference PROTO ((struct option_state **,
+ const char *, int));
+void data_string_copy PROTO ((struct data_string *,
+ struct data_string *, const char *, int));
+void data_string_forget PROTO ((struct data_string *, const char *, int));
+void data_string_truncate PROTO ((struct data_string *, int));
+int executable_statement_allocate PROTO ((struct executable_statement **,
+ const char *, int));
+int executable_statement_reference PROTO ((struct executable_statement **,
+ struct executable_statement *,
+ const char *, int));
+int packet_allocate PROTO ((struct packet **, const char *, int));
+int packet_reference PROTO ((struct packet **,
+ struct packet *, const char *, int));
+int packet_dereference PROTO ((struct packet **, const char *, int));
+int binding_scope_allocate PROTO ((struct binding_scope **,
+ const char *, int));
+int binding_scope_reference PROTO ((struct binding_scope **,
+ struct binding_scope *,
+ const char *, int));
+int dns_zone_allocate PROTO ((struct dns_zone **, const char *, int));
+int dns_zone_reference PROTO ((struct dns_zone **,
+ struct dns_zone *, const char *, int));
/* print.c */
+char *quotify_string (const char *, const char *, int);
+char *quotify_buf (const unsigned char *, unsigned, const char *, int);
+char *print_base64 (const unsigned char *, unsigned, const char *, int);
char *print_hw_addr PROTO ((int, int, unsigned char *));
void print_lease PROTO ((struct lease *));
-void dump_raw PROTO ((unsigned char *, int));
+void dump_raw PROTO ((const unsigned char *, unsigned));
+void dump_packet_option (struct option_cache *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct universe *, void *);
void dump_packet PROTO ((struct packet *));
void hash_dump PROTO ((struct hash_table *));
+char *print_hex_1 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_hex_2 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_hex_3 PROTO ((unsigned, const u_int8_t *, unsigned));
+char *print_dotted_quads PROTO ((unsigned, const u_int8_t *));
+char *print_dec_1 PROTO ((unsigned long));
+char *print_dec_2 PROTO ((unsigned long));
+void print_expression PROTO ((const char *, struct expression *));
+int token_print_indent_concat (FILE *, int, int,
+ const char *, const char *, ...);
+int token_indent_data_string (FILE *, int, int, const char *, const char *,
+ struct data_string *);
+int token_print_indent (FILE *, int, int,
+ const char *, const char *, const char *);
+void indent_spaces (FILE *, int);
+#if defined (NSUPDATE)
+void print_dns_status (int, ns_updque *);
+#endif
/* socket.c */
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
@@ -675,24 +1558,29 @@ ssize_t send_fallback PROTO ((struct interface_info *,
#ifdef USE_SOCKET_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
struct sockaddr_in *, struct hardware *));
#endif
-#if defined (USE_SOCKET_FALLBACK)
-void fallback_discard PROTO ((struct protocol *));
-#endif
#ifdef USE_SOCKET_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
+void if_deregister_receive PROTO ((struct interface_info *));
ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
+
+#if defined (USE_SOCKET_FALLBACK)
+isc_result_t fallback_discard PROTO ((omapi_object_t *));
+#endif
+
#if defined (USE_SOCKET_SEND)
-int can_unicast_without_arp PROTO ((void));
+int can_unicast_without_arp PROTO ((struct interface_info *));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+int supports_multiple_interfaces (struct interface_info *);
void maybe_setup_fallback PROTO ((void));
#endif
@@ -703,6 +1591,7 @@ int if_register_bpf PROTO ( (struct interface_info *));
#ifdef USE_BPF_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
@@ -711,13 +1600,15 @@ ssize_t send_packet PROTO ((struct interface_info *,
#ifdef USE_BPF_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
+void if_deregister_receive PROTO ((struct interface_info *));
ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
#if defined (USE_BPF_SEND)
-int can_unicast_without_arp PROTO ((void));
+int can_unicast_without_arp PROTO ((struct interface_info *));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+int supports_multiple_interfaces (struct interface_info *);
void maybe_setup_fallback PROTO ((void));
#endif
@@ -728,6 +1619,7 @@ int if_register_lpf PROTO ( (struct interface_info *));
#ifdef USE_LPF_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
@@ -736,13 +1628,15 @@ ssize_t send_packet PROTO ((struct interface_info *,
#ifdef USE_LPF_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
+void if_deregister_receive PROTO ((struct interface_info *));
ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
#if defined (USE_LPF_SEND)
-int can_unicast_without_arp PROTO ((void));
+int can_unicast_without_arp PROTO ((struct interface_info *));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+int supports_multiple_interfaces (struct interface_info *);
void maybe_setup_fallback PROTO ((void));
#endif
@@ -754,6 +1648,7 @@ int if_register_nit PROTO ( (struct interface_info *));
#ifdef USE_NIT_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
@@ -762,19 +1657,27 @@ ssize_t send_packet PROTO ((struct interface_info *,
#ifdef USE_NIT_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
+void if_deregister_receive PROTO ((struct interface_info *));
ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
#if defined (USE_NIT_SEND)
-int can_unicast_without_arp PROTO ((void));
+int can_unicast_without_arp PROTO ((struct interface_info *));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+int supports_multiple_interfaces (struct interface_info *);
void maybe_setup_fallback PROTO ((void));
#endif
+/* dlpi.c */
+#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
+int if_register_dlpi PROTO ( (struct interface_info *));
+#endif
+
#ifdef USE_DLPI_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
@@ -783,77 +1686,132 @@ ssize_t send_packet PROTO ((struct interface_info *,
#ifdef USE_DLPI_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
+void if_deregister_receive PROTO ((struct interface_info *));
ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
-#if defined (USE_DLPI_SEND)
-int can_unicast_without_arp PROTO ((void));
-int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
-void maybe_setup_fallback PROTO ((void));
-#endif
+
/* raw.c */
#ifdef USE_RAW_SEND
void if_reinitialize_send PROTO ((struct interface_info *));
void if_register_send PROTO ((struct interface_info *));
+void if_deregister_send PROTO ((struct interface_info *));
ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
struct sockaddr_in *, struct hardware *));
-int can_unicast_without_arp PROTO ((void));
+int can_unicast_without_arp PROTO ((struct interface_info *));
int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+int supports_multiple_interfaces (struct interface_info *);
void maybe_setup_fallback PROTO ((void));
#endif
-/* dispatch.c */
+/* discover.c */
extern struct interface_info *interfaces,
*dummy_interfaces, *fallback_interface;
extern struct protocol *protocols;
extern int quiet_interface_discovery;
+isc_result_t interface_setup (void);
+void interface_trace_setup (void);
+
+extern struct in_addr limited_broadcast;
+extern struct in_addr local_address;
+
+extern u_int16_t local_port;
+extern u_int16_t remote_port;
+extern int (*dhcp_interface_setup_hook) (struct interface_info *,
+ struct iaddr *);
+extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
+isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
+
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
- struct dhcp_packet *, int,
+ struct dhcp_packet *, unsigned,
unsigned int,
struct iaddr, struct hardware *));
extern struct timeout *timeouts;
+extern omapi_object_type_t *dhcp_type_interface;
+#if defined (TRACING)
+trace_type_t *interface_trace;
+trace_type_t *inpacket_trace;
+trace_type_t *outpacket_trace;
+#endif
+extern struct interface_info **interface_vector;
+extern int interface_count;
+extern int interface_max;
+isc_result_t interface_initialize (omapi_object_t *, const char *, int);
void discover_interfaces PROTO ((int));
-struct interface_info *setup_fallback PROTO ((void));
+int setup_fallback (struct interface_info **, const char *, int);
+int if_readsocket PROTO ((omapi_object_t *));
void reinitialize_interfaces PROTO ((void));
+
+/* dispatch.c */
+void set_time (u_int32_t);
+struct timeval *process_outstanding_timeouts (struct timeval *);
void dispatch PROTO ((void));
-int locate_network PROTO ((struct packet *));
-void got_one PROTO ((struct protocol *));
-void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *));
+isc_result_t got_one PROTO ((omapi_object_t *));
+isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *, omapi_typed_data_t *);
+isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *, omapi_value_t **);
+isc_result_t interface_destroy (omapi_object_t *, const char *, int);
+isc_result_t interface_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t interface_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+
+void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *,
+ tvref_t, tvunref_t));
void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *));
-void add_protocol PROTO ((char *, int,
- void (*) PROTO ((struct protocol *)), void *));
+void cancel_all_timeouts (void);
+void relinquish_timeouts (void);
+#if 0
+struct protocol *add_protocol PROTO ((const char *, int,
+ void (*) PROTO ((struct protocol *)),
+ void *));
void remove_protocol PROTO ((struct protocol *));
-
-/* hash.c */
-struct hash_table *new_hash PROTO ((void));
-void add_hash PROTO ((struct hash_table *, unsigned char *,
- int, unsigned char *));
-void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
-unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
+#endif
+OMAPI_OBJECT_ALLOC_DECL (interface,
+ struct interface_info, dhcp_type_interface)
/* tables.c */
-extern struct option dhcp_options [256];
-extern unsigned char dhcp_option_default_priority_list [];
-extern int sizeof_dhcp_option_default_priority_list;
-extern char *hardware_types [256];
-extern struct hash_table universe_hash;
extern struct universe dhcp_universe;
-void initialize_universes PROTO ((void));
-
-/* convert.c */
-u_int32_t getULong PROTO ((unsigned char *));
-int32_t getLong PROTO ((unsigned char *));
-u_int16_t getUShort PROTO ((unsigned char *));
-int16_t getShort PROTO ((unsigned char *));
-void putULong PROTO ((unsigned char *, u_int32_t));
-void putLong PROTO ((unsigned char *, int32_t));
-void putUShort PROTO ((unsigned char *, unsigned int));
-void putShort PROTO ((unsigned char *, int));
+extern struct option dhcp_options [256];
+extern struct universe nwip_universe;
+extern struct option nwip_options [256];
+extern struct universe fqdn_universe;
+extern struct option fqdn_options [256];
+extern int dhcp_option_default_priority_list [];
+extern int dhcp_option_default_priority_list_count;
+extern const char *hardware_types [256];
+int universe_count, universe_max;
+struct universe **universes;
+extern universe_hash_t *universe_hash;
+void initialize_common_option_spaces PROTO ((void));
+struct universe *config_universe;
+
+/* stables.c */
+#if defined (FAILOVER_PROTOCOL)
+extern failover_option_t null_failover_option;
+extern failover_option_t skip_failover_option;
+extern struct failover_option_info ft_options [];
+extern u_int32_t fto_allowed [];
+extern int ft_sizes [];
+extern const char *dhcp_flink_state_names [];
+#endif
+extern const char *binding_state_names [];
+
+extern struct universe agent_universe;
+extern struct option agent_options [256];
+extern struct universe server_universe;
+extern struct option server_options [256];
+
+extern struct enumeration ddns_styles;
+extern struct enumeration syslog_enum;
+void initialize_server_option_spaces PROTO ((void));
/* inet.c */
struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
@@ -862,11 +1820,14 @@ struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr));
u_int32_t host_addr PROTO ((struct iaddr, struct iaddr));
int addr_eq PROTO ((struct iaddr, struct iaddr));
char *piaddr PROTO ((struct iaddr));
+char *piaddrmask (struct iaddr, struct iaddr, const char *, int);
+char *piaddr1 PROTO ((struct iaddr));
/* dhclient.c */
-extern char *path_dhclient_conf;
-extern char *path_dhclient_db;
-extern char *path_dhclient_pid;
+extern const char *path_dhclient_conf;
+extern const char *path_dhclient_db;
+extern const char *path_dhclient_pid;
+extern char *path_dhclient_script;
extern int interfaces_requested;
extern struct client_config top_level_config;
@@ -885,92 +1846,120 @@ void state_init PROTO ((void *));
void state_selecting PROTO ((void *));
void state_requesting PROTO ((void *));
void state_bound PROTO ((void *));
+void state_stop PROTO ((void *));
void state_panic PROTO ((void *));
-void bind_lease PROTO ((struct interface_info *));
+void bind_lease PROTO ((struct client_state *));
-void make_discover PROTO ((struct interface_info *, struct client_lease *));
-void make_request PROTO ((struct interface_info *, struct client_lease *));
-void make_decline PROTO ((struct interface_info *, struct client_lease *));
-void make_release PROTO ((struct interface_info *, struct client_lease *));
+void make_client_options PROTO ((struct client_state *,
+ struct client_lease *, u_int8_t *,
+ struct option_cache *, struct iaddr *,
+ u_int32_t *, struct option_state **));
+void make_discover PROTO ((struct client_state *, struct client_lease *));
+void make_request PROTO ((struct client_state *, struct client_lease *));
+void make_decline PROTO ((struct client_state *, struct client_lease *));
+void make_release PROTO ((struct client_state *, struct client_lease *));
-void free_client_lease PROTO ((struct client_lease *));
+void destroy_client_lease PROTO ((struct client_lease *));
void rewrite_client_leases PROTO ((void));
-void write_client_lease PROTO ((struct interface_info *,
- struct client_lease *, int));
-
-void script_init PROTO ((struct interface_info *, char *,
- struct string_list *));
-void script_write_params PROTO ((struct interface_info *,
- char *, struct client_lease *));
-int script_go PROTO ((struct interface_info *));
-void client_envadd PROTO ((struct client_state *,
- const char *, const char *, const char *, ...));
+void write_lease_option (struct option_cache *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct universe *, void *);
+int write_client_lease PROTO ((struct client_state *,
+ struct client_lease *, int, int));
int dhcp_option_ev_name (char *, size_t, struct option *);
-struct client_lease *packet_to_lease PROTO ((struct packet *));
+void script_init PROTO ((struct client_state *, const char *,
+ struct string_list *));
+void client_option_envadd (struct option_cache *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct universe *, void *);
+void script_write_params PROTO ((struct client_state *,
+ const char *, struct client_lease *));
+int script_go PROTO ((struct client_state *));
+void client_envadd (struct client_state *,
+ const char *, const char *, const char *, ...)
+ __attribute__((__format__(__printf__,4,5)));
+
+struct client_lease *packet_to_lease (struct packet *, struct client_state *);
void go_daemon PROTO ((void));
void write_client_pid_file PROTO ((void));
-void status_message PROTO ((struct sysconf_header *, void *));
void client_location_changed PROTO ((void));
+void do_release PROTO ((struct client_state *));
+int dhclient_interface_shutdown_hook (struct interface_info *);
+int dhclient_interface_discovery_hook (struct interface_info *);
+isc_result_t dhclient_interface_startup_hook (struct interface_info *);
+void client_dns_update (struct client_state *client, int);
/* db.c */
int write_lease PROTO ((struct lease *));
+int write_host PROTO ((struct host_decl *));
+#if defined (FAILOVER_PROTOCOL)
+int write_failover_state (dhcp_failover_state_t *);
+#endif
+int db_printable PROTO ((const char *));
+int db_printable_len PROTO ((const unsigned char *, unsigned));
+void write_named_billing_class (const char *, unsigned, struct class *);
+void write_billing_classes (void);
+int write_billing_class PROTO ((struct class *));
int commit_leases PROTO ((void));
-void db_startup PROTO ((void));
-void new_lease_file PROTO ((void));
+void db_startup PROTO ((int));
+int new_lease_file PROTO ((void));
+int group_writer (struct group_object *);
/* packet.c */
-u_int32_t checksum PROTO ((unsigned char *, int, u_int32_t));
+u_int32_t checksum PROTO ((unsigned char *, unsigned, u_int32_t));
u_int32_t wrapsum PROTO ((u_int32_t));
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int *, u_int32_t, u_int32_t, unsigned int,
- unsigned char *, int));
+ unsigned *, u_int32_t, u_int32_t,
+ u_int32_t, unsigned char *, unsigned));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int, struct sockaddr_in *,
- unsigned char *, int));
+ unsigned, struct sockaddr_in *,
+ unsigned char *, unsigned));
/* ethernet.c */
void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
ssize_t decode_ethernet_header PROTO ((struct interface_info *,
unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
/* tr.c */
void assemble_tr_header PROTO ((struct interface_info *, unsigned char *,
- int *, struct hardware *));
+ unsigned *, struct hardware *));
ssize_t decode_tr_header PROTO ((struct interface_info *,
unsigned char *,
- int, struct hardware *));
+ unsigned, struct hardware *));
/* dhxpxlt.c */
-void convert_statement PROTO ((FILE *));
-void convert_host_statement PROTO ((FILE *, jrefproto));
-void convert_host_name PROTO ((FILE *, jrefproto));
-void convert_class_statement PROTO ((FILE *, jrefproto, int));
-void convert_class_decl PROTO ((FILE *, jrefproto));
-void convert_lease_time PROTO ((FILE *, jrefproto, char *));
-void convert_shared_net_statement PROTO ((FILE *, jrefproto));
-void convert_subnet_statement PROTO ((FILE *, jrefproto));
-void convert_subnet_decl PROTO ((FILE *, jrefproto));
-void convert_host_decl PROTO ((FILE *, jrefproto));
-void convert_hardware_decl PROTO ((FILE *, jrefproto));
-void convert_hardware_addr PROTO ((FILE *, jrefproto));
-void convert_filename_decl PROTO ((FILE *, jrefproto));
-void convert_servername_decl PROTO ((FILE *, jrefproto));
-void convert_ip_addr_or_hostname PROTO ((FILE *, jrefproto, int));
-void convert_fixed_addr_decl PROTO ((FILE *, jrefproto));
-void convert_option_decl PROTO ((FILE *, jrefproto));
-void convert_timestamp PROTO ((FILE *, jrefproto));
-void convert_lease_statement PROTO ((FILE *, jrefproto));
-void convert_address_range PROTO ((FILE *, jrefproto));
-void convert_date PROTO ((FILE *, jrefproto, char *));
-void convert_numeric_aggregate PROTO ((FILE *, jrefproto, int, int, int, int));
+void convert_statement PROTO ((struct parse *));
+void convert_host_statement PROTO ((struct parse *, jrefproto));
+void convert_host_name PROTO ((struct parse *, jrefproto));
+void convert_class_statement PROTO ((struct parse *, jrefproto, int));
+void convert_class_decl PROTO ((struct parse *, jrefproto));
+void convert_lease_time PROTO ((struct parse *, jrefproto, char *));
+void convert_shared_net_statement PROTO ((struct parse *, jrefproto));
+void convert_subnet_statement PROTO ((struct parse *, jrefproto));
+void convert_subnet_decl PROTO ((struct parse *, jrefproto));
+void convert_host_decl PROTO ((struct parse *, jrefproto));
+void convert_hardware_decl PROTO ((struct parse *, jrefproto));
+void convert_hardware_addr PROTO ((struct parse *, jrefproto));
+void convert_filename_decl PROTO ((struct parse *, jrefproto));
+void convert_servername_decl PROTO ((struct parse *, jrefproto));
+void convert_ip_addr_or_hostname PROTO ((struct parse *, jrefproto, int));
+void convert_fixed_addr_decl PROTO ((struct parse *, jrefproto));
+void convert_option_decl PROTO ((struct parse *, jrefproto));
+void convert_timestamp PROTO ((struct parse *, jrefproto));
+void convert_lease_statement PROTO ((struct parse *, jrefproto));
+void convert_address_range PROTO ((struct parse *, jrefproto));
+void convert_date PROTO ((struct parse *, jrefproto, char *));
+void convert_numeric_aggregate PROTO ((struct parse *, jrefproto, int, int, int, int));
void indent PROTO ((int));
/* route.c */
@@ -987,39 +1976,73 @@ void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr));
void set_ip_address PROTO ((struct interface_info *, struct in_addr));
/* clparse.c */
-int read_client_conf PROTO ((void));
+isc_result_t read_client_conf PROTO ((void));
+int read_client_conf_file (const char *,
+ struct interface_info *, struct client_config *);
void read_client_leases PROTO ((void));
-void parse_client_statement PROTO ((FILE *, struct interface_info *,
+void parse_client_statement PROTO ((struct parse *, struct interface_info *,
struct client_config *));
-int parse_X PROTO ((FILE *, u_int8_t *, int));
-int parse_option_list PROTO ((FILE *, u_int8_t *));
-void parse_interface_declaration PROTO ((FILE *, struct client_config *));
-struct interface_info *interface_or_dummy PROTO ((char *));
-void make_client_state PROTO ((struct interface_info *));
-void make_client_config PROTO ((struct interface_info *,
+int parse_X PROTO ((struct parse *, u_int8_t *, unsigned));
+void parse_option_list PROTO ((struct parse *, u_int32_t **));
+void parse_interface_declaration PROTO ((struct parse *,
+ struct client_config *, char *));
+int interface_or_dummy PROTO ((struct interface_info **, const char *));
+void make_client_state PROTO ((struct client_state **));
+void make_client_config PROTO ((struct client_state *,
struct client_config *));
-void parse_client_lease_statement PROTO ((FILE *, int));
-void parse_client_lease_declaration PROTO ((FILE *, struct client_lease *,
- struct interface_info **));
-struct option *parse_option_decl PROTO ((FILE *, struct option_data *));
-void parse_string_list PROTO ((FILE *, struct string_list **, int));
-int parse_ip_addr PROTO ((FILE *, struct iaddr *));
-void parse_reject_statement PROTO ((FILE *, struct client_config *));
+void parse_client_lease_statement PROTO ((struct parse *, int));
+void parse_client_lease_declaration PROTO ((struct parse *,
+ struct client_lease *,
+ struct interface_info **,
+ struct client_state **));
+int parse_option_decl PROTO ((struct option_cache **, struct parse *));
+void parse_string_list PROTO ((struct parse *, struct string_list **, int));
+int parse_ip_addr PROTO ((struct parse *, struct iaddr *));
+void parse_reject_statement PROTO ((struct parse *, struct client_config *));
/* dhcrelay.c */
-void relay PROTO ((struct interface_info *, struct dhcp_packet *, int,
+void relay PROTO ((struct interface_info *, struct dhcp_packet *, unsigned,
unsigned int, struct iaddr, struct hardware *));
+int strip_relay_agent_options PROTO ((struct interface_info *,
+ struct interface_info **,
+ struct dhcp_packet *, unsigned));
+int find_interface_by_agent_option PROTO ((struct dhcp_packet *,
+ struct interface_info **,
+ u_int8_t *, int));
+int add_relay_agent_options PROTO ((struct interface_info *,
+ struct dhcp_packet *,
+ unsigned, struct in_addr));
/* icmp.c */
+OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp)
+extern struct icmp_state *icmp_state;
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
u_int8_t *, int))));
+int icmp_readsocket PROTO ((omapi_object_t *));
int icmp_echorequest PROTO ((struct iaddr *));
-void icmp_echoreply PROTO ((struct protocol *));
+isc_result_t icmp_echoreply PROTO ((omapi_object_t *));
/* dns.c */
-void dns_startup PROTO ((void));
-int ns_inaddr_lookup PROTO ((u_int16_t, struct iaddr));
-void dns_packet PROTO ((struct protocol *));
+#if defined (NSUPDATE)
+isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *);
+void tkey_free (ns_tsig_key **);
+#endif
+isc_result_t enter_dns_zone (struct dns_zone *);
+isc_result_t dns_zone_lookup (struct dns_zone **, const char *);
+int dns_zone_dereference PROTO ((struct dns_zone **, const char *, int));
+#if defined (NSUPDATE)
+isc_result_t find_cached_zone (const char *, ns_class, char *,
+ size_t, struct in_addr *, int, int *,
+ struct dns_zone **);
+void forget_zone (struct dns_zone **);
+void repudiate_zone (struct dns_zone **);
+void cache_found_zone (ns_class, char *, struct in_addr *, int);
+int get_dhcid (struct data_string *, int, const u_int8_t *, unsigned);
+isc_result_t ddns_update_a (struct data_string *, struct iaddr,
+ struct data_string *, unsigned long, int);
+isc_result_t ddns_remove_a (struct data_string *,
+ struct iaddr, struct data_string *);
+#endif /* NSUPDATE */
/* resolv.c */
extern char path_resolv_conf [];
@@ -1027,14 +2050,566 @@ struct name_server *name_servers;
struct domain_search_list *domains;
void read_resolv_conf PROTO ((TIME));
-struct sockaddr_in *pick_name_server PROTO ((void));
+struct name_server *first_name_server PROTO ((void));
/* inet_addr.c */
#ifdef NEED_INET_ATON
int inet_aton PROTO ((const char *, struct in_addr *));
#endif
-/* sysconf.c */
-void sysconf_startup PROTO ((void (*) (struct sysconf_header *, void *)));
-void sysconf_restart PROTO ((void *));
-void sysconf_message PROTO ((struct protocol *proto));
+/* class.c */
+extern int have_billing_classes;
+struct class unknown_class;
+struct class known_class;
+struct collection default_collection;
+struct collection *collections;
+struct executable_statement *default_classification_rules;
+
+void classification_setup PROTO ((void));
+void classify_client PROTO ((struct packet *));
+int check_collection PROTO ((struct packet *, struct lease *,
+ struct collection *));
+void classify PROTO ((struct packet *, struct class *));
+isc_result_t find_class PROTO ((struct class **, const char *,
+ const char *, int));
+int unbill_class PROTO ((struct lease *, struct class *));
+int bill_class PROTO ((struct lease *, struct class *));
+
+/* execute.c */
+int execute_statements PROTO ((struct binding_value **result,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct executable_statement *));
+void execute_statements_in_scope PROTO ((struct binding_value **result,
+ struct packet *, struct lease *,
+ struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct group *, struct group *));
+int executable_statement_dereference PROTO ((struct executable_statement **,
+ const char *, int));
+void write_statements (FILE *, struct executable_statement *, int);
+int find_matching_case (struct executable_statement **,
+ struct packet *, struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct expression *, struct executable_statement *);
+int executable_statement_foreach (struct executable_statement *,
+ int (*) (struct executable_statement *,
+ void *, int), void *, int);
+
+/* comapi.c */
+extern omapi_object_type_t *dhcp_type_interface;
+extern omapi_object_type_t *dhcp_type_group;
+extern omapi_object_type_t *dhcp_type_shared_network;
+extern omapi_object_type_t *dhcp_type_subnet;
+extern omapi_object_type_t *dhcp_type_control;
+extern dhcp_control_object_t *dhcp_control_object;
+
+void dhcp_common_objects_setup (void);
+
+isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_group_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_group_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_group_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_group_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_group_remove (omapi_object_t *,
+ omapi_object_t *);
+
+isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_control_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_control_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_control_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_control_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_control_remove (omapi_object_t *,
+ omapi_object_t *);
+
+isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_subnet_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_subnet_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_subnet_remove (omapi_object_t *,
+ omapi_object_t *);
+
+isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_shared_network_get_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_shared_network_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_shared_network_remove (omapi_object_t *,
+ omapi_object_t *);
+
+/* omapi.c */
+extern int (*dhcp_interface_shutdown_hook) (struct interface_info *);
+
+extern omapi_object_type_t *dhcp_type_lease;
+extern omapi_object_type_t *dhcp_type_pool;
+extern omapi_object_type_t *dhcp_type_class;
+
+#if defined (FAILOVER_PROTOCOL)
+extern omapi_object_type_t *dhcp_type_failover_state;
+extern omapi_object_type_t *dhcp_type_failover_link;
+extern omapi_object_type_t *dhcp_type_failover_listener;
+#endif
+
+void dhcp_db_objects_setup (void);
+
+isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_lease_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_lease_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_lease_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_lease_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_lease_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_group_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_group_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_group_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_group_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_group_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_host_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_host_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_host_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_host_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_host_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_pool_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_pool_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_pool_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_pool_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_pool_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_class_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_class_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_class_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_class_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_class_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_subclass_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_subclass_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_subclass_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_subclass_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_subclass_remove (omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_shared_network_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_shared_network_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
+isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_subnet_lookup (omapi_object_t **,
+ omapi_object_t *, omapi_object_t *);
+isc_result_t dhcp_subnet_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_interface_set_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t dhcp_interface_get_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t dhcp_interface_destroy (omapi_object_t *,
+ const char *, int);
+isc_result_t dhcp_interface_signal_handler (omapi_object_t *,
+ const char *,
+ va_list ap);
+isc_result_t dhcp_interface_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_interface_lookup (omapi_object_t **,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t dhcp_interface_create (omapi_object_t **,
+ omapi_object_t *);
+isc_result_t dhcp_interface_remove (omapi_object_t *,
+ omapi_object_t *);
+void interface_stash (struct interface_info *);
+void interface_snorf (struct interface_info *, int);
+
+isc_result_t binding_scope_set_value (struct binding_scope *, int,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t binding_scope_get_value (omapi_value_t **,
+ struct binding_scope *,
+ omapi_data_string_t *);
+isc_result_t binding_scope_stuff_values (omapi_object_t *,
+ struct binding_scope *);
+
+/* mdb.c */
+
+extern struct subnet *subnets;
+extern struct shared_network *shared_networks;
+extern host_hash_t *host_hw_addr_hash;
+extern host_hash_t *host_uid_hash;
+extern host_hash_t *host_name_hash;
+extern lease_hash_t *lease_uid_hash;
+extern lease_hash_t *lease_ip_addr_hash;
+extern lease_hash_t *lease_hw_addr_hash;
+
+extern omapi_object_type_t *dhcp_type_host;
+
+isc_result_t enter_host PROTO ((struct host_decl *, int, int));
+isc_result_t delete_host PROTO ((struct host_decl *, int));
+int find_hosts_by_haddr PROTO ((struct host_decl **, int,
+ const unsigned char *, unsigned,
+ const char *, int));
+int find_hosts_by_uid PROTO ((struct host_decl **, const unsigned char *,
+ unsigned, const char *, int));
+int find_host_for_network PROTO ((struct subnet **, struct host_decl **,
+ struct iaddr *, struct shared_network *));
+void new_address_range PROTO ((struct iaddr, struct iaddr,
+ struct subnet *, struct pool *,
+ struct lease **));
+isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int);
+isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int);
+int find_grouped_subnet PROTO ((struct subnet **, struct shared_network *,
+ struct iaddr, const char *, int));
+int find_subnet (struct subnet **, struct iaddr, const char *, int);
+void enter_shared_network PROTO ((struct shared_network *));
+void new_shared_network_interface PROTO ((struct parse *,
+ struct shared_network *,
+ const char *));
+int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int));
+void enter_subnet PROTO ((struct subnet *));
+void enter_lease PROTO ((struct lease *));
+int supersede_lease PROTO ((struct lease *, struct lease *, int, int, int));
+void make_binding_state_transition (struct lease *);
+int lease_copy PROTO ((struct lease **, struct lease *, const char *, int));
+void release_lease PROTO ((struct lease *, struct packet *));
+void abandon_lease PROTO ((struct lease *, const char *));
+void dissociate_lease PROTO ((struct lease *));
+void pool_timer PROTO ((void *));
+int find_lease_by_uid PROTO ((struct lease **, const unsigned char *,
+ unsigned, const char *, int));
+int find_lease_by_hw_addr PROTO ((struct lease **, const unsigned char *,
+ unsigned, const char *, int));
+int find_lease_by_ip_addr PROTO ((struct lease **, struct iaddr,
+ const char *, int));
+void uid_hash_add PROTO ((struct lease *));
+void uid_hash_delete PROTO ((struct lease *));
+void hw_hash_add PROTO ((struct lease *));
+void hw_hash_delete PROTO ((struct lease *));
+int write_leases PROTO ((void));
+int lease_enqueue (struct lease *);
+void lease_instantiate (const unsigned char *, unsigned, struct lease *);
+void expire_all_pools PROTO ((void));
+void dump_subnets PROTO ((void));
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+void free_everything (void);
+#endif
+
+/* nsupdate.c */
+char *ddns_rev_name (struct lease *, struct lease_state *, struct packet *);
+char *ddns_fwd_name (struct lease *, struct lease_state *, struct packet *);
+int nsupdateA (const char *, const unsigned char *, u_int32_t, int);
+int nsupdatePTR (const char *, const unsigned char *, u_int32_t, int);
+void nsupdate (struct lease *, struct lease_state *, struct packet *, int);
+int updateA (const struct data_string *, const struct data_string *,
+ unsigned int, struct lease *);
+int updatePTR (const struct data_string *, const struct data_string *,
+ unsigned int, struct lease *);
+int deleteA (const struct data_string *, const struct data_string *,
+ struct lease *);
+int deletePTR (const struct data_string *, const struct data_string *,
+ struct lease *);
+
+/* failover.c */
+#if defined (FAILOVER_PROTOCOL)
+extern dhcp_failover_state_t *failover_states;
+void dhcp_failover_startup PROTO ((void));
+int dhcp_failover_write_all_states (void);
+isc_result_t enter_failover_peer PROTO ((dhcp_failover_state_t *));
+isc_result_t find_failover_peer PROTO ((dhcp_failover_state_t **,
+ const char *, const char *, int));
+isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *,
+ const char *, int));
+isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *));
+
+isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *,
+ const char *,
+ va_list));
+isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *,
+ const char *, int));
+isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_register PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *,
+ const char *);
+isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state);
+isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *,
+ enum failover_state);
+isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *,
+ failover_message_t *);
+int dhcp_failover_pool_rebalance (dhcp_failover_state_t *);
+int dhcp_failover_pool_check (struct pool *);
+int dhcp_failover_state_pool_check (dhcp_failover_state_t *);
+void dhcp_failover_timeout (void *);
+void dhcp_failover_send_contact (void *);
+isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *);
+isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *);
+int dhcp_failover_queue_update (struct lease *, int);
+int dhcp_failover_send_acks (dhcp_failover_state_t *);
+void dhcp_failover_toack_queue_timeout (void *);
+int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg);
+void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *);
+isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+void dhcp_failover_keepalive (void *);
+void dhcp_failover_reconnect (void *);
+void dhcp_failover_startup_timeout (void *);
+void dhcp_failover_link_startup_timeout (void *);
+void dhcp_failover_listener_restart (void *);
+isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *,
+ const char *, int));
+isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_state_lookup PROTO ((omapi_object_t **,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_state_create PROTO ((omapi_object_t **,
+ omapi_object_t *));
+isc_result_t dhcp_failover_state_remove PROTO ((omapi_object_t *,
+ omapi_object_t *));
+int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned);
+const char *dhcp_failover_reject_reason_print (int);
+const char *dhcp_failover_state_name_print (enum failover_state);
+const char *dhcp_failover_message_name (unsigned);
+const char *dhcp_failover_option_name (unsigned);
+failover_option_t *dhcp_failover_option_printf (unsigned, char *,
+ unsigned *,
+ unsigned,
+ const char *, ...)
+ __attribute__((__format__(__printf__,5,6)));
+failover_option_t *dhcp_failover_make_option (unsigned, char *,
+ unsigned *, unsigned, ...);
+isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *,
+ omapi_object_t *, int, ...);
+isc_result_t dhcp_failover_send_connect PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_send_connectack PROTO ((omapi_object_t *,
+ dhcp_failover_state_t *,
+ int, const char *));
+isc_result_t dhcp_failover_send_disconnect PROTO ((omapi_object_t *,
+ int, const char *));
+isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *,
+ struct lease *);
+isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *,
+ failover_message_t *,
+ int, const char *);
+isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *);
+isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int);
+isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *);
+isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *);
+isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *);
+isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *,
+ failover_message_t *);
+isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *,
+ failover_message_t *);
+isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *,
+ int);
+isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *,
+ failover_message_t *);
+isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *,
+ failover_message_t *);
+isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
+ failover_message_t *);
+void dhcp_failover_recover_done (void *);
+void failover_print PROTO ((char *, unsigned *, unsigned, const char *));
+void update_partner PROTO ((struct lease *));
+int load_balance_mine (struct packet *, dhcp_failover_state_t *);
+binding_state_t normal_binding_state_transition_check (struct lease *,
+ dhcp_failover_state_t *,
+ binding_state_t,
+ u_int32_t);
+binding_state_t
+conflict_binding_state_transition_check (struct lease *,
+ dhcp_failover_state_t *,
+ binding_state_t, u_int32_t);
+int lease_mine_to_reallocate (struct lease *);
+
+OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t,
+ dhcp_type_failover_state)
+OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener, dhcp_failover_listener_t,
+ dhcp_type_failover_listener)
+OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t,
+ dhcp_type_failover_link)
+#endif /* FAILOVER_PROTOCOL */
+
+const char *binding_state_print (enum failover_state);
diff --git a/contrib/isc-dhcp/includes/dhctoken.h b/contrib/isc-dhcp/includes/dhctoken.h
index 2aeb5303af10..876d8f396179 100644
--- a/contrib/isc-dhcp/includes/dhctoken.h
+++ b/contrib/isc-dhcp/includes/dhctoken.h
@@ -3,8 +3,8 @@
Tokens for config file lexer and parser. */
/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999
- * The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,101 +34,289 @@
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
-#define SEMI ';'
-#define DOT '.'
-#define COLON ':'
-#define COMMA ','
-#define SLASH '/'
-#define LBRACE '{'
-#define RBRACE '}'
+enum dhcp_token {
+ SEMI = ';',
+ DOT = '.',
+ COLON = ':',
+ COMMA = ',',
+ SLASH = '/',
+ LBRACE = '{',
+ RBRACE = '}',
+ LPAREN = '(',
+ RPAREN = ')',
+ EQUAL = '=',
+ BANG = '!',
+ PERCENT = '%',
+ PLUS = '+',
+ MINUS = '-',
+ ASTERISK = '*',
+ AMPERSAND = '&',
+ PIPE = '|',
+ CARET = '^',
-#define FIRST_TOKEN HOST
-#define HOST 256
-#define HARDWARE 257
-#define FILENAME 258
-#define FIXED_ADDR 259
-#define OPTION 260
-#define ETHERNET 261
-#define STRING 262
-#define NUMBER 263
-#define NUMBER_OR_NAME 264
-#define NAME 265
-#define TIMESTAMP 266
-#define STARTS 267
-#define ENDS 268
-#define UID 269
-#define CLASS 270
-#define LEASE 271
-#define RANGE 272
-#define PACKET 273
-#define CIADDR 274
-#define YIADDR 275
-#define SIADDR 276
-#define GIADDR 277
-#define SUBNET 278
-#define NETMASK 279
-#define DEFAULT_LEASE_TIME 280
-#define MAX_LEASE_TIME 281
-#define VENDOR_CLASS 282
-#define USER_CLASS 283
-#define SHARED_NETWORK 284
-#define SERVER_NAME 285
-#define DYNAMIC_BOOTP 286
-#define SERVER_IDENTIFIER 287
-#define DYNAMIC_BOOTP_LEASE_CUTOFF 288
-#define DYNAMIC_BOOTP_LEASE_LENGTH 289
-#define BOOT_UNKNOWN_CLIENTS 290
-#define NEXT_SERVER 291
-#define TOKEN_RING 292
-#define GROUP 293
-#define ONE_LEASE_PER_CLIENT 294
-#define GET_LEASE_HOSTNAMES 295
-#define USE_HOST_DECL_NAMES 296
-#define SEND 297
-#define CLIENT_IDENTIFIER 298
-#define REQUEST 299
-#define REQUIRE 300
-#define TIMEOUT 301
-#define RETRY 302
-#define SELECT_TIMEOUT 303
-#define SCRIPT 304
-#define INTERFACE 305
-#define RENEW 306
-#define REBIND 307
-#define EXPIRE 308
-#define UNKNOWN_CLIENTS 309
-#define ALLOW 310
-#define BOOTP 311
-#define DENY 312
-#define BOOTING 313
-#define DEFAULT 314
-#define MEDIA 315
-#define MEDIUM 316
-#define ALIAS 317
-#define REBOOT 318
-#define ABANDONED 319
-#define BACKOFF_CUTOFF 320
-#define INITIAL_INTERVAL 321
-#define NAMESERVER 322
-#define DOMAIN 323
-#define SEARCH 324
-#define SUPERSEDE 325
-#define APPEND 326
-#define PREPEND 327
-#define HOSTNAME 328
-#define CLIENT_HOSTNAME 329
-#define REJECT 330
-#define FDDI 331
-#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332
-#define AUTHORITATIVE 333
-#define TOKEN_NOT 334
-#define ALWAYS_REPLY_RFC1048 335
+ HOST = 256,
+ FIRST_TOKEN = HOST,
+ HARDWARE = 257,
+ FILENAME = 258,
+ FIXED_ADDR = 259,
+ OPTION = 260,
+ ETHERNET = 261,
+ STRING = 262,
+ NUMBER = 263,
+ NUMBER_OR_NAME = 264,
+ NAME = 265,
+ TIMESTAMP = 266,
+ STARTS = 267,
+ ENDS = 268,
+ UID = 269,
+ CLASS = 270,
+ LEASE = 271,
+ RANGE = 272,
+ PACKET = 273,
+ CIADDR = 274,
+ YIADDR = 275,
+ SIADDR = 276,
+ GIADDR = 277,
+ SUBNET = 278,
+ NETMASK = 279,
+ DEFAULT_LEASE_TIME = 280,
+ MAX_LEASE_TIME = 281,
+ VENDOR_CLASS = 282,
+ USER_CLASS = 283,
+ SHARED_NETWORK = 284,
+ SERVER_NAME = 285,
+ DYNAMIC_BOOTP = 286,
+ SERVER_IDENTIFIER = 287,
+ DYNAMIC_BOOTP_LEASE_CUTOFF = 288,
+ DYNAMIC_BOOTP_LEASE_LENGTH = 289,
+ BOOT_UNKNOWN_CLIENTS = 290,
+ NEXT_SERVER = 291,
+ TOKEN_RING = 292,
+ GROUP = 293,
+ ONE_LEASE_PER_CLIENT = 294,
+ GET_LEASE_HOSTNAMES = 295,
+ USE_HOST_DECL_NAMES = 296,
+ SEND = 297,
+ CLIENT_IDENTIFIER = 298,
+ REQUEST = 299,
+ REQUIRE = 300,
+ TIMEOUT = 301,
+ RETRY = 302,
+ SELECT_TIMEOUT = 303,
+ SCRIPT = 304,
+ INTERFACE = 305,
+ RENEW = 306,
+ REBIND = 307,
+ EXPIRE = 308,
+ UNKNOWN_CLIENTS = 309,
+ ALLOW = 310,
+ DENY = 312,
+ BOOTING = 313,
+ DEFAULT = 314,
+ MEDIA = 315,
+ MEDIUM = 316,
+ ALIAS = 317,
+ REBOOT = 318,
+ TOKEN_ABANDONED = 319,
+ BACKOFF_CUTOFF = 320,
+ INITIAL_INTERVAL = 321,
+ NAMESERVER = 322,
+ DOMAIN = 323,
+ SEARCH = 324,
+ SUPERSEDE = 325,
+ APPEND = 326,
+ PREPEND = 327,
+ HOSTNAME = 328,
+ CLIENT_HOSTNAME = 329,
+ REJECT = 330,
+ USE_LEASE_ADDR_FOR_DEFAULT_ROUTE = 331,
+ MIN_LEASE_TIME = 332,
+ MIN_SECS = 333,
+ AND = 334,
+ OR = 335,
+ SUBSTRING = 337,
+ SUFFIX = 338,
+ CHECK = 339,
+ EXTRACT_INT = 340,
+ IF = 341,
+ TOKEN_ADD = 342,
+ BREAK = 343,
+ ELSE = 344,
+ ELSIF = 345,
+ SUBCLASS = 346,
+ MATCH = 347,
+ SPAWN = 348,
+ WITH = 349,
+ EXISTS = 350,
+ POOL = 351,
+ UNKNOWN = 352,
+ CLIENTS = 353,
+ KNOWN = 354,
+ AUTHENTICATED = 355,
+ UNAUTHENTICATED = 356,
+ ALL = 357,
+ DYNAMIC = 358,
+ MEMBERS = 359,
+ OF = 360,
+ PSEUDO = 361,
+ LIMIT = 362,
+ BILLING = 363,
+ PEER = 364,
+ FAILOVER = 365,
+ MY = 366,
+ PARTNER = 367,
+ PRIMARY = 368,
+ SECONDARY = 369,
+ IDENTIFIER = 370,
+ PORT = 371,
+ MAX_TRANSMIT_IDLE = 372,
+ MAX_RESPONSE_DELAY = 373,
+ PARTNER_DOWN = 374,
+ NORMAL = 375,
+ COMMUNICATIONS_INTERRUPTED = 376,
+ POTENTIAL_CONFLICT = 377,
+ RECOVER = 378,
+ FDDI = 379,
+ AUTHORITATIVE = 380,
+ TOKEN_NOT = 381,
+ AUTHENTICATION = 383,
+ IGNORE = 384,
+ ACCEPT = 385,
+ PREFER = 386,
+ DONT = 387,
+ CODE = 388,
+ ARRAY = 389,
+ BOOLEAN = 390,
+ INTEGER = 391,
+ SIGNED = 392,
+ UNSIGNED = 393,
+ IP_ADDRESS = 394,
+ TEXT = 395,
+ STRING_TOKEN = 396,
+ SPACE = 397,
+ CONCAT = 398,
+ ENCODE_INT = 399,
+ REVERSE = 402,
+ LEASED_ADDRESS = 403,
+ BINARY_TO_ASCII = 404,
+ PICK = 405,
+ CONFIG_OPTION = 406,
+ HOST_DECL_NAME = 407,
+ ON = 408,
+ EXPIRY = 409,
+ RELEASE = 410,
+ COMMIT = 411,
+ DNS_UPDATE = 412,
+ LEASE_TIME = 413,
+ STATIC = 414,
+ NEVER = 415,
+ INFINITE = 416,
+ TOKEN_DELETED = 417,
+ UPDATED_DNS_RR = 418,
+ DNS_DELETE = 419,
+ DUPLICATES = 420,
+ DECLINES = 421,
+ TSTP = 422,
+ TSFP = 423,
+ OWNER = 424,
+ IS = 425,
+ HBA = 426,
+ MAX_UNACKED_UPDATES = 427,
+ MCLT = 428,
+ SPLIT = 429,
+ AT = 430,
+ NO = 431,
+ TOKEN_DELETE = 432,
+ NS_UPDATE = 433,
+ UPDATE = 434,
+ SWITCH = 435,
+ CASE = 436,
+ NS_FORMERR = 437,
+ NS_NOERROR = 438,
+ NS_NOTAUTH = 439,
+ NS_NOTIMP = 440,
+ NS_NOTZONE = 441,
+ NS_NXDOMAIN = 442,
+ NS_NXRRSET = 443,
+ NS_REFUSED = 444,
+ NS_SERVFAIL = 445,
+ NS_YXDOMAIN = 446,
+ NS_YXRRSET = 447,
+ TOKEN_NULL = 448,
+ TOKEN_SET = 449,
+ DEFINED = 450,
+ UNSET = 451,
+ EVAL = 452,
+ LET = 453,
+ FUNCTION = 454,
+ DEFINE = 455,
+ ZONE = 456,
+ KEY = 457,
+ SECRET = 458,
+ ALGORITHM = 459,
+ LOAD = 460,
+ BALANCE = 461,
+ TOKEN_MAX = 462,
+ SECONDS = 463,
+ ADDRESS = 464,
+ RESOLUTION_INTERRUPTED = 465,
+ STATE = 466,
+ UNKNOWN_STATE = 567,
+ CLTT = 568,
+ INCLUDE = 569,
+ BINDING = 570,
+ TOKEN_FREE = 571,
+ TOKEN_ACTIVE = 572,
+ TOKEN_EXPIRED = 573,
+ TOKEN_RELEASED = 574,
+ TOKEN_RESET = 575,
+ TOKEN_BACKUP = 576,
+ TOKEN_RESERVED = 577,
+ TOKEN_BOOTP = 578,
+ TOKEN_NEXT = 579,
+ OMAPI = 580,
+ LOG = 581,
+ FATAL = 582,
+ ERROR = 583,
+ TOKEN_DEBUG = 584,
+ INFO = 585,
+ RETURN = 586,
+ PAUSED = 587,
+ RECOVER_DONE = 588,
+ SHUTDOWN = 589,
+ STARTUP = 590,
+ ENCAPSULATE = 591,
+ VENDOR = 592,
+ CLIENT_STATE = 593,
+ INIT_REBOOT = 594,
+ TOKEN_INIT = 595,
+ SELECT = 596,
+ BOUND = 597,
+ RENEWING = 598,
+ REBINDING = 599,
+ RECONTACT_INTERVAL = 600,
+ CLIENT_UPDATES = 601,
+ TOKEN_NEW = 601,
+ TRANSMISSION = 602,
+ TOKEN_CLOSE = 603,
+ TOKEN_CREATE = 604,
+ TOKEN_OPEN = 605,
+ TOKEN_HELP = 606,
+ END_OF_FILE = 607,
+ RECOVER_WAIT = 608,
+ SERVER = 609,
+ CONNECT = 610,
+ REMOVE = 611,
+ REFRESH = 612,
+ DOMAIN_NAME = 613
+};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) != STRING && \
diff --git a/contrib/isc-dhcp/includes/failover.h b/contrib/isc-dhcp/includes/failover.h
new file mode 100644
index 000000000000..e27a9115ceaf
--- /dev/null
+++ b/contrib/isc-dhcp/includes/failover.h
@@ -0,0 +1,322 @@
+/* failover.h
+
+ Definitions for address trees... */
+
+/*
+ * Copyright (c) 2000-2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+#if defined (FAILOVER_PROTOCOL)
+struct failover_option_info {
+ int code;
+ const char *name;
+ enum { FT_UINT8, FT_IPADDR, FT_UINT32, FT_BYTES, FT_TEXT_OR_BYTES,
+ FT_DDNS, FT_DDNS1, FT_UINT16, FT_TEXT,
+ FT_UNDEF, FT_DIGEST } type;
+ int num_present;
+ int offset;
+ u_int32_t bit;
+};
+
+typedef struct {
+ unsigned count;
+ u_int8_t *data;
+} failover_option_t;
+
+#define FM_OFFSET(x) (long)(&(((failover_message_t *)0) -> x))
+
+/* Failover message options: */
+#define FTO_BINDING_STATUS 1
+#define FTB_BINDING_STATUS 0x00000002
+#define FTO_ASSIGNED_IP_ADDRESS 2
+#define FTB_ASSIGNED_IP_ADDRESS 0x00000004
+#define FTO_SERVER_ADDR 3
+#define FTB_SERVER_ADDR 0x00000008
+#define FTO_ADDRESSES_TRANSFERRED 4
+#define FTB_ADDRESSES_TRANSFERRED 0x00000010
+#define FTO_CLIENT_IDENTIFIER 5
+#define FTB_CLIENT_IDENTIFIER 0x00000020
+#define FTO_CHADDR 6
+#define FTB_CHADDR 0x00000040
+#define FTO_DDNS 7
+#define FTB_DDNS 0x00000080
+#define FTO_REJECT_REASON 8
+#define FTB_REJECT_REASON 0x00000100
+#define FTO_MESSAGE 9
+#define FTB_MESSAGE 0x00000200
+#define FTO_MCLT 10
+#define FTB_MCLT 0x00000400
+#define FTO_VENDOR_CLASS 11
+#define FTB_VENDOR_CLASS 0x00000800
+#define FTO_LEASE_EXPIRY 13
+#define FTB_LEASE_EXPIRY 0x00002000
+#define FTO_POTENTIAL_EXPIRY 14
+#define FTB_POTENTIAL_EXPIRY 0x00004000
+#define FTO_GRACE_EXPIRY 15
+#define FTB_GRACE_EXPIRY 0x00008000
+#define FTO_CLTT 16
+#define FTB_CLTT 0x00010000
+#define FTO_STOS 17
+#define FTB_STOS 0x00020000
+#define FTO_SERVER_STATE 18
+#define FTB_SERVER_STATE 0x00040000
+#define FTO_SERVER_FLAGS 19
+#define FTB_SERVER_FLAGS 0x00080000
+#define FTO_VENDOR_OPTIONS 20
+#define FTB_VENDOR_OPTIONS 0x00100000
+#define FTO_MAX_UNACKED 21
+#define FTB_MAX_UNACKED 0x00200000
+#define FTO_RECEIVE_TIMER 23
+#define FTB_RECEIVE_TIMER 0x00800000
+#define FTO_HBA 24
+#define FTB_HBA 0x01000000
+#define FTO_MESSAGE_DIGEST 25
+#define FTB_MESSAGE_DIGEST 0x02000000
+#define FTO_PROTOCOL_VERSION 26
+#define FTB_PROTOCOL_VERSION 0x04000000
+#define FTO_TLS_REQUEST 27
+#define FTB_TLS_REQUEST 0x08000000
+#define FTO_TLS_REPLY 28
+#define FTB_TLS_REPLY 0x10000000
+#define FTO_REQUEST_OPTIONS 29
+#define FTB_REQUEST_OPTIONS 0x20000000
+#define FTO_REPLY_OPTIONS 30
+#define FTB_REPLY_OPTIONS 0x40000000
+#define FTO_MAX FTO_REPLY_OPTIONS
+
+/* Failover protocol message types: */
+#define FTM_POOLREQ 1
+#define FTM_POOLRESP 2
+#define FTM_BNDUPD 3
+#define FTM_BNDACK 4
+#define FTM_CONNECT 5
+#define FTM_CONNECTACK 6
+#define FTM_UPDREQ 7
+#define FTM_UPDDONE 8
+#define FTM_UPDREQALL 9
+#define FTM_STATE 10
+#define FTM_CONTACT 11
+#define FTM_DISCONNECT 12
+
+/* Reject reasons: */
+
+#define FTR_ILLEGAL_IP_ADDR 1
+#define FTR_FATAL_CONFLICT 2
+#define FTR_MISSING_BINDINFO 3
+#define FTR_TIMEMISMATCH 4
+#define FTR_INVALID_MCLT 5
+#define FTR_MISC_REJECT 6
+#define FTR_DUP_CONNECTION 7
+#define FTR_INVALID_PARTNER 8
+#define FTR_TLS_UNSUPPORTED 9
+#define FTR_TLS_UNCONFIGURED 10
+#define FTR_TLS_REQUIRED 11
+#define FTR_DIGEST_UNSUPPORTED 12
+#define FTR_DIGEST_UNCONFIGURED 13
+#define FTR_VERSION_MISMATCH 14
+#define FTR_MISSING_BIND_INFO 15
+#define FTR_OUTDATED_BIND_INFO 16
+#define FTR_LESS_CRIT_BIND_INFO 17
+#define FTR_NO_TRAFFIC 18
+#define FTR_HBA_CONFLICT 19
+#define FTR_UNKNOWN 254
+
+#define DHCP_FAILOVER_MAX_MESSAGE_SIZE 2048
+
+/* Failover server flags. */
+#define FTF_STARTUP 1
+
+typedef struct failover_message {
+ int refcnt;
+ struct failover_message *next;
+
+ u_int8_t type;
+
+ u_int8_t binding_status;
+ u_int8_t protocol_version;
+ u_int8_t reject_reason;
+ u_int8_t server_flags;
+ u_int8_t server_state;
+ u_int8_t tls_reply;
+ u_int8_t tls_request;
+ u_int32_t stos;
+ u_int32_t time;
+ u_int32_t xid;
+ u_int32_t addresses_transferred;
+ u_int32_t assigned_addr;
+ u_int32_t client_ltt;
+ u_int32_t expiry;
+ u_int32_t grace_expiry;
+ u_int32_t max_unacked;
+ u_int32_t mclt;
+ u_int32_t potential_expiry;
+ u_int32_t receive_timer;
+ u_int32_t server_addr;
+ failover_option_t chaddr;
+ failover_option_t client_identifier;
+ failover_option_t hba;
+ failover_option_t message;
+ failover_option_t reply_options;
+ failover_option_t request_options;
+ ddns_fqdn_t ddns;
+ failover_option_t vendor_class;
+ failover_option_t vendor_options;
+
+ int options_present;
+} failover_message_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ struct option_cache *peer_address;
+ unsigned peer_port;
+ int options_present;
+ enum dhcp_flink_state {
+ dhcp_flink_start,
+ dhcp_flink_message_length_wait,
+ dhcp_flink_message_wait,
+ dhcp_flink_disconnected,
+ dhcp_flink_state_max
+ } state;
+ failover_message_t *imsg;
+ struct _dhcp_failover_state *state_object;
+ u_int16_t imsg_len;
+ unsigned imsg_count;
+ u_int8_t imsg_payoff; /* Pay*load* offset. :') */
+ u_int32_t xid;
+} dhcp_failover_link_t;
+
+typedef struct _dhcp_failover_listener {
+ OMAPI_OBJECT_PREAMBLE;
+ struct _dhcp_failover_listener *next;
+ omapi_addr_t address;
+} dhcp_failover_listener_t;
+#endif /* FAILOVER_PROTOCOL */
+
+/* A failover peer. */
+enum failover_state {
+ unknown_state,
+ partner_down,
+ normal,
+ communications_interrupted,
+ resolution_interrupted,
+ potential_conflict,
+ recover,
+ recover_done,
+ shut_down,
+ paused,
+ startup,
+ recover_wait
+};
+
+/* Service states are simplifications of failover states, particularly
+ useful because the startup state isn't actually implementable as a
+ seperate failover state without maintaining a state stack. */
+
+enum service_state {
+ unknown_service_state,
+ cooperating,
+ not_cooperating,
+ service_partner_down,
+ not_responding,
+ service_startup
+};
+
+#if defined (FAILOVER_PROTOCOL)
+typedef struct _dhcp_failover_config {
+ struct option_cache *address;
+ int port;
+ u_int32_t max_flying_updates;
+ enum failover_state state;
+ TIME stos;
+ u_int32_t max_response_delay;
+} dhcp_failover_config_t;
+
+typedef struct _dhcp_failover_state {
+ OMAPI_OBJECT_PREAMBLE;
+ struct _dhcp_failover_state *next;
+ char *name; /* Name of this failover instance. */
+ dhcp_failover_config_t me; /* My configuration. */
+ dhcp_failover_config_t partner; /* Partner's configuration. */
+ enum failover_state saved_state; /* Saved state during startup. */
+ struct data_string server_identifier; /* Server identifier (IP addr) */
+ u_int32_t mclt;
+
+ u_int8_t *hba; /* Hash bucket array for load balancing. */
+ int load_balance_max_secs;
+
+ enum service_state service_state;
+ const char *nrr; /* Printable reason why we're in the
+ not_responding service state (empty
+ string if we are responding. */
+
+ dhcp_failover_link_t *link_to_peer; /* Currently-established link
+ to peer. */
+
+ enum {
+ primary, secondary
+ } i_am; /* We are primary or secondary in this relationship. */
+
+ TIME last_packet_sent; /* Timestamp on last packet we sent. */
+ TIME last_timestamp_received; /* The last timestamp we sent that
+ has been returned by our partner. */
+ TIME skew; /* The skew between our clock and our partner's. */
+ struct lease *update_queue_head; /* List of leases we haven't sent
+ to peer. */
+ struct lease *update_queue_tail;
+
+ struct lease *ack_queue_head; /* List of lease updates the peer
+ hasn't yet acked. */
+ struct lease *ack_queue_tail;
+
+ struct lease *send_update_done; /* When we get a BNDACK for this
+ lease, send an UPDDONE message. */
+ int cur_unacked_updates; /* Number of updates we've sent
+ that have not yet been acked. */
+
+ /* List of messages which we haven't
+ acked yet. */
+ failover_message_t *toack_queue_head;
+ failover_message_t *toack_queue_tail;
+ int pending_acks; /* Number of messages in the toack
+ queue. */
+ int pool_count; /* Number of pools referencing this
+ failover state object. */
+} dhcp_failover_state_t;
+
+#define DHCP_FAILOVER_VERSION 1
+#endif /* FAILOVER_PROTOCOL */
diff --git a/contrib/isc-dhcp/includes/inet.h b/contrib/isc-dhcp/includes/inet.h
index 1cedc2331a24..01541724e23f 100644
--- a/contrib/isc-dhcp/includes/inet.h
+++ b/contrib/isc-dhcp/includes/inet.h
@@ -3,7 +3,8 @@
Portable definitions for internet addresses */
/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,16 +34,17 @@
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
/* An internet address of up to 128 bits. */
struct iaddr {
- int len;
+ unsigned len;
unsigned char iabuf [16];
};
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/boolean.h b/contrib/isc-dhcp/includes/isc-dhcp/boolean.h
new file mode 100644
index 000000000000..08d8c2457b33
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/boolean.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 1998, 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_BOOLEAN_H
+#define ISC_BOOLEAN_H 1
+
+#include <isc-dhcp/lang.h>
+
+ISC_LANG_BEGINDECLS
+
+typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t;
+
+#define ISC_FALSE isc_boolean_false
+#define ISC_TRUE isc_boolean_true
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_BOOLEAN_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/dst.h b/contrib/isc-dhcp/includes/isc-dhcp/dst.h
new file mode 100644
index 000000000000..65c54d24ebab
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/dst.h
@@ -0,0 +1,142 @@
+#ifndef DST_H
+#define DST_H
+
+#ifndef HAS_DST_KEY
+typedef struct dst_key {
+ char *dk_key_name; /* name of the key */
+ int dk_key_size; /* this is the size of the key in bits */
+ int dk_proto; /* what protocols this key can be used for */
+ int dk_alg; /* algorithm number from key record */
+ unsigned dk_flags; /* and the flags of the public key */
+ unsigned dk_id; /* identifier of the key */
+} DST_KEY;
+#endif /* HAS_DST_KEY */
+
+/*
+ * DST Crypto API defintions
+ */
+void dst_init(void);
+int dst_check_algorithm(const int);
+
+int dst_sign_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *in_key, /* the key to use */
+ void **context, /* pointer to state structure */
+ const u_char *data, /* data to be signed */
+ const unsigned len, /* length of input data */
+ u_char *signature, /* buffer to write signature to */
+ const unsigned sig_len); /* size of output buffer */
+
+int dst_verify_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *in_key, /* the key to use */
+ void **context, /* pointer to state structure */
+ const u_char *data, /* data to be verified */
+ const unsigned len, /* length of input data */
+ const u_char *signature,/* buffer containing signature */
+ const unsigned sig_len); /* length of signature */
+
+
+DST_KEY *dst_read_key(const char *in_name, /* name of key */
+ const unsigned in_id, /* key tag identifier */
+ const int in_alg, /* key algorithm */
+ const int key_type); /* Private/PublicKey wanted*/
+
+int dst_write_key(const DST_KEY *key, /* key to write out */
+ const int key_type); /* Public/Private */
+
+DST_KEY *dst_dnskey_to_key(const char *in_name, /* KEY record name */
+ const u_char *key, /* KEY RDATA */
+ const unsigned len); /* size of input buffer*/
+
+
+int dst_key_to_dnskey(const DST_KEY *key, /* key to translate */
+ u_char *out_storage, /* output buffer */
+ const unsigned out_len); /* size of out_storage*/
+
+
+DST_KEY *dst_buffer_to_key(const char *key_name, /* name of the key */
+ const int alg, /* algorithm */
+ const unsigned flags, /* dns flags */
+ const int protocol, /* dns protocol */
+ const u_char *key_buf, /* key in dns wire fmt */
+ const unsigned key_len); /* size of key */
+
+
+int dst_key_to_buffer(DST_KEY *key, u_char *out_buff, unsigned buf_len);
+
+DST_KEY *dst_generate_key(const char *name, /* name of new key */
+ const int bits, /* size of new key */
+ const int exp, /* alg dependent parameter*/
+ const unsigned flags, /* key DNS flags */
+ const int protocol, /* key DNS protocol */
+ const int alg); /* key algorithm to generate */
+
+DST_KEY *dst_free_key(DST_KEY *f_key);
+int dst_compare_keys(const DST_KEY *key1, const DST_KEY *key2);
+
+int dst_sig_size(DST_KEY *key);
+
+int dst_random(const int mode, unsigned wanted, u_char *outran);
+
+
+/* support for dns key tags/ids */
+u_int16_t dst_s_dns_key_id(const u_char *dns_key_rdata,
+ const unsigned rdata_len);
+u_int16_t dst_s_id_calc(const u_char *key_data, const unsigned key_len);
+
+/* Used by callers as well as by the library. */
+#define RAW_KEY_SIZE 8192 /* large enough to store any key */
+
+/* DST_API control flags */
+/* These are used used in functions dst_sign_data and dst_verify_data */
+#define SIG_MODE_INIT 1 /* initalize digest */
+#define SIG_MODE_UPDATE 2 /* add data to digest */
+#define SIG_MODE_FINAL 4 /* generate/verify signature */
+#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL)
+
+/* Flags for dst_read_private_key() */
+#define DST_FORCE_READ 0x1000000
+#define DST_CAN_SIGN 0x010F
+#define DST_NO_AUTHEN 0x8000
+#define DST_EXTEND_FLAG 0x1000
+#define DST_STANDARD 0
+#define DST_PRIVATE 0x2000000
+#define DST_PUBLIC 0x4000000
+#define DST_RAND_SEMI 1
+#define DST_RAND_STD 2
+#define DST_RAND_KEY 3
+#define DST_RAND_DSS 4
+
+
+/* DST algorithm codes */
+#define KEY_RSA 1
+#define KEY_DH 2
+#define KEY_DSA 3
+#define KEY_PRIVATE 254
+#define KEY_EXPAND 255
+#define KEY_HMAC_MD5 157
+#define KEY_HMAC_SHA1 158
+#define UNKNOWN_KEYALG 0
+#define DST_MAX_ALGS KEY_HMAC_SHA1
+
+/* DST constants to locations in KEY record changes in new KEY record */
+#define DST_FLAGS_SIZE 2
+#define DST_KEY_PROT 2
+#define DST_KEY_ALG 3
+#define DST_EXT_FLAG 4
+#define DST_KEY_START 4
+
+#ifndef SIGN_F_NOKEY
+#define SIGN_F_NOKEY 0xC000
+#endif
+
+/* error codes from dst routines */
+#define SIGN_INIT_FAILURE (-23)
+#define SIGN_UPDATE_FAILURE (-24)
+#define SIGN_FINAL_FAILURE (-25)
+#define VERIFY_INIT_FAILURE (-26)
+#define VERIFY_UPDATE_FAILURE (-27)
+#define VERIFY_FINAL_FAILURE (-28)
+#define MISSING_KEY_OR_SIGNATURE (-30)
+#define UNSUPPORTED_KEYALG (-31)
+
+#endif /* DST_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/int.h b/contrib/isc-dhcp/includes/isc-dhcp/int.h
new file mode 100644
index 000000000000..98159f53f354
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/int.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_INT_H
+#define ISC_INT_H 1
+
+#include <isc-dhcp/lang.h>
+
+ISC_LANG_BEGINDECLS
+
+typedef char isc_int8_t;
+typedef unsigned char isc_uint8_t;
+typedef short isc_int16_t;
+typedef unsigned short isc_uint16_t;
+typedef int isc_int32_t;
+typedef unsigned int isc_uint32_t;
+typedef long long isc_int64_t;
+typedef unsigned long long isc_uint64_t;
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_INT_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/lang.h b/contrib/isc-dhcp/includes/isc-dhcp/lang.h
new file mode 100644
index 000000000000..3edeb72da130
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/lang.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_LANG_H
+#define ISC_LANG_H 1
+
+#ifdef __cplusplus
+#define ISC_LANG_BEGINDECLS extern "C" {
+#define ISC_LANG_ENDDECLS }
+#else
+#define ISC_LANG_BEGINDECLS
+#define ISC_LANG_ENDDECLS
+#endif
+
+#endif /* ISC_LANG_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/list.h b/contrib/isc-dhcp/includes/isc-dhcp/list.h
new file mode 100644
index 000000000000..d9660088b2d4
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/list.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 1997, 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_LIST_H
+#define ISC_LIST_H 1
+
+#define ISC_LIST(type) struct { type *head, *tail; }
+#define ISC_LIST_INIT(list) \
+ do { (list).head = NULL; (list).tail = NULL; } while (0)
+
+#define ISC_LINK(type) struct { type *prev, *next; }
+#define ISC_LINK_INIT(elt, link) \
+ do { \
+ (elt)->link.prev = (void *)(-1); \
+ (elt)->link.next = (void *)(-1); \
+ } while (0)
+#define ISC_LINK_LINKED(elt, link) ((elt)->link.prev != (void *)(-1))
+
+#define ISC_LIST_HEAD(list) ((list).head)
+#define ISC_LIST_TAIL(list) ((list).tail)
+#define ISC_LIST_EMPTY(list) ((list).head == NULL)
+
+#define ISC_LIST_PREPEND(list, elt, link) \
+ do { \
+ if ((list).head != NULL) \
+ (list).head->link.prev = (elt); \
+ else \
+ (list).tail = (elt); \
+ (elt)->link.prev = NULL; \
+ (elt)->link.next = (list).head; \
+ (list).head = (elt); \
+ } while (0)
+
+#define ISC_LIST_APPEND(list, elt, link) \
+ do { \
+ if ((list).tail != NULL) \
+ (list).tail->link.next = (elt); \
+ else \
+ (list).head = (elt); \
+ (elt)->link.prev = (list).tail; \
+ (elt)->link.next = NULL; \
+ (list).tail = (elt); \
+ } while (0)
+
+#define ISC_LIST_UNLINK(list, elt, link) \
+ do { \
+ if ((elt)->link.next != NULL) \
+ (elt)->link.next->link.prev = (elt)->link.prev; \
+ else \
+ (list).tail = (elt)->link.prev; \
+ if ((elt)->link.prev != NULL) \
+ (elt)->link.prev->link.next = (elt)->link.next; \
+ else \
+ (list).head = (elt)->link.next; \
+ (elt)->link.prev = (void *)(-1); \
+ (elt)->link.next = (void *)(-1); \
+ } while (0)
+
+#define ISC_LIST_PREV(elt, link) ((elt)->link.prev)
+#define ISC_LIST_NEXT(elt, link) ((elt)->link.next)
+
+#define ISC_LIST_INSERTBEFORE(list, before, elt, link) \
+ do { \
+ if ((before)->link.prev == NULL) \
+ ISC_LIST_PREPEND(list, elt, link); \
+ else { \
+ (elt)->link.prev = (before)->link.prev; \
+ (before)->link.prev = (elt); \
+ (elt)->link.prev->link.next = (elt); \
+ (elt)->link.next = (before); \
+ } \
+ } while (0)
+
+#define ISC_LIST_INSERTAFTER(list, after, elt, link) \
+ do { \
+ if ((after)->link.next == NULL) \
+ ISC_LIST_APPEND(list, elt, link); \
+ else { \
+ (elt)->link.next = (after)->link.next; \
+ (after)->link.next = (elt); \
+ (elt)->link.next->link.prev = (elt); \
+ (elt)->link.prev = (after); \
+ } \
+ } while (0)
+
+#define ISC_LIST_APPENDLIST(list1, list2, link) \
+ do { \
+ if (ISC_LIST_EMPTY(list1)) \
+ (list1) = (list2); \
+ else if (!ISC_LIST_EMPTY(list2)) { \
+ (list1).tail->link.next = (list2).head; \
+ (list2).head->link.prev = (list1).tail; \
+ (list1).tail = (list2).tail; \
+ (list2).head = NULL; \
+ (list2).tail = NULL; \
+ } \
+ } while (0)
+
+#define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link)
+#define ISC_LIST_DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link)
+
+#endif /* ISC_LIST_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/result.h b/contrib/isc-dhcp/includes/isc-dhcp/result.h
new file mode 100644
index 000000000000..a2de1fcdae8c
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/result.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 1998, 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_RESULT_H
+#define ISC_RESULT_H 1
+
+#include <isc-dhcp/boolean.h>
+#include <isc-dhcp/lang.h>
+#include <isc-dhcp/list.h>
+#include <isc-dhcp/types.h>
+
+ISC_LANG_BEGINDECLS
+
+typedef enum {
+ ISC_R_SUCCESS = 0,
+ ISC_R_NOMEMORY = 1,
+ ISC_R_TIMEDOUT = 2,
+ ISC_R_NOTHREADS = 3,
+ ISC_R_ADDRNOTAVAIL = 4,
+ ISC_R_ADDRINUSE = 5,
+ ISC_R_NOPERM = 6,
+ ISC_R_NOCONN = 7,
+ ISC_R_NETUNREACH = 8,
+ ISC_R_HOSTUNREACH = 9,
+ ISC_R_NETDOWN = 10,
+ ISC_R_HOSTDOWN = 11,
+ ISC_R_CONNREFUSED = 12,
+ ISC_R_NORESOURCES = 13,
+ ISC_R_EOF = 14,
+ ISC_R_BOUND = 15,
+ ISC_R_TASKDONE = 16,
+ ISC_R_LOCKBUSY = 17,
+ ISC_R_EXISTS = 18,
+ ISC_R_NOSPACE = 19,
+ ISC_R_CANCELED = 20,
+ ISC_R_TASKNOSEND = 21,
+ ISC_R_SHUTTINGDOWN = 22,
+ ISC_R_NOTFOUND = 23,
+ ISC_R_UNEXPECTEDEND = 24,
+ ISC_R_FAILURE = 25,
+ ISC_R_IOERROR = 26,
+ ISC_R_NOTIMPLEMENTED = 27,
+ ISC_R_UNBALANCED = 28,
+ ISC_R_NOMORE = 29,
+ ISC_R_INVALIDFILE = 30,
+ ISC_R_BADBASE64 = 31,
+ ISC_R_UNEXPECTEDTOKEN = 32,
+ ISC_R_QUOTA = 33,
+ ISC_R_UNEXPECTED = 34,
+ ISC_R_ALREADYRUNNING = 35,
+ ISC_R_HOSTUNKNOWN = 36,
+ ISC_R_VERSIONMISMATCH = 37,
+ ISC_R_PROTOCOLERROR = 38,
+ ISC_R_INVALIDARG = 39,
+ ISC_R_NOTCONNECTED = 40,
+ ISC_R_NOTYET = 41,
+ ISC_R_UNCHANGED = 42,
+ ISC_R_MULTIPLE = 43,
+ ISC_R_KEYCONFLICT = 44,
+ ISC_R_BADPARSE = 45,
+ ISC_R_NOKEYS = 46,
+ ISC_R_KEY_UNKNOWN = 47,
+ ISC_R_INVALIDKEY = 48,
+ ISC_R_INCOMPLETE = 49,
+ ISC_R_FORMERR = 50,
+ ISC_R_SERVFAIL = 51,
+ ISC_R_NXDOMAIN = 52,
+ ISC_R_NOTIMPL = 53,
+ ISC_R_REFUSED = 54,
+ ISC_R_YXDOMAIN = 55,
+ ISC_R_YXRRSET = 56,
+ ISC_R_NXRRSET = 57,
+ ISC_R_NOTAUTH = 58,
+ ISC_R_NOTZONE = 59,
+ ISC_R_BADSIG = 60,
+ ISC_R_BADKEY = 61,
+ ISC_R_BADTIME = 62,
+ ISC_R_NOROOTZONE = 63,
+ ISC_R_DESTADDRREQ = 64,
+ ISC_R_CROSSZONE = 65,
+ ISC_R_NO_TSIG = 66,
+ ISC_R_NOT_EQUAL = 67,
+ ISC_R_CONNRESET = 68,
+ ISC_R_UNKNOWNATTRIBUTE = 69
+} isc_result_t;
+
+
+#define ISC_R_NRESULTS 70 /* Number of results */
+
+const char * isc_result_totext(isc_result_t);
+isc_result_t isc_result_register(unsigned int base,
+ unsigned int nresults,
+ char **text,
+ isc_msgcat_t *msgcat,
+ int set);
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_RESULT_H */
diff --git a/contrib/isc-dhcp/includes/isc-dhcp/types.h b/contrib/isc-dhcp/includes/isc-dhcp/types.h
new file mode 100644
index 000000000000..862bd376c258
--- /dev/null
+++ b/contrib/isc-dhcp/includes/isc-dhcp/types.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 1999 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef ISC_TYPES_H
+#define ISC_TYPES_H 1
+
+#include <isc-dhcp/int.h>
+#include <isc-dhcp/boolean.h>
+#include <isc-dhcp/list.h>
+
+/***
+ *** Core Types.
+ ***/
+
+typedef struct isc_mem isc_mem_t;
+typedef struct isc_mempool isc_mempool_t;
+typedef struct isc_msgcat isc_msgcat_t;
+typedef unsigned int isc_eventtype_t;
+typedef struct isc_event isc_event_t;
+typedef struct isc_task isc_task_t;
+typedef struct isc_taskmgr isc_taskmgr_t;
+typedef struct isc_rwlock isc_rwlock_t;
+
+typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
+
+#endif /* ISC_TYPES_H */
diff --git a/contrib/isc-dhcp/includes/minires/minires.h b/contrib/isc-dhcp/includes/minires/minires.h
new file mode 100644
index 000000000000..2a6a1336ffcb
--- /dev/null
+++ b/contrib/isc-dhcp/includes/minires/minires.h
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2001 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "cdefs.h"
+#include "osdep.h"
+
+#include "minires/resolv.h"
+#include "minires/res_update.h"
+#include "isc-dhcp/result.h"
+
+/*
+ * Based on the Dynamic DNS reference implementation by Viraj Bais
+ * <viraj_bais@ccm.fm.intel.com>
+ */
+
+int minires_mkupdate (ns_updrec *, unsigned char *, unsigned);
+int minires_update (ns_updrec *);
+ns_updrec *minires_mkupdrec (int, const char *, unsigned int,
+ unsigned int, unsigned long);
+void minires_freeupdrec (ns_updrec *);
+int minires_nmkupdate (res_state, ns_updrec *, double *, unsigned *);
+isc_result_t minires_nupdate (res_state, ns_updrec *);
+int minires_ninit (res_state);
+ns_rcode isc_rcode_to_ns (isc_result_t);
+
+#if defined (MINIRES_LIB)
+#define res_update minires_update
+#define res_mkupdate minires_mkupdate
+#define res_mkupdrec minires_mkupdrec
+#define res_freeupdrec minires_freeupdrec
+#define res_nmkupdate minires_nmkupdate
+#define res_nupdate minires_nupdate
+#define __p_type_syms MR__p_type_syms
+#define dn_comp MRdn_comp
+#define loc_aton MRloc_aton
+#define sym_ston MRsym_ston
+#define res_buildservicelist MRres_buildservicelist
+#define res_destroyservicelist MRres_destroyservicelist
+#define res_buildprotolist MRres_buildprotolist
+#define res_destroyprotolist MRres_destroyprotolist
+#define res_servicenumber MRres_servicenumber
+#define res_protocolnumber MRres_protocolnumber
+#define res_protocolname MRres_protocolname
+#define res_servicename MRres_servicename
+#define ns_datetosecs MRns_datetosecs
+#define b64_pton MRb64_pton
+#define res_ninit minires_ninit
+#define res_randomid MRres_randomid
+#define res_findzonecut MRres_findzonecut
+#define res_nsend MRres_nsend
+#define res_nsendsigned MRres_nsendsigned
+#define ns_samename MRns_samename
+#define res_nameinquery MRres_nameinquery
+#define res_queriesmatch MRres_queriesmatch
+#define dn_expand MRdn_expand
+#define ns_get16 MRns_get16
+#define res_close MRres_close
+#define res_nclose MRres_nclose
+#define res_ourserver_p MRres_ourserver_p
+#define ns_sign MRns_sign
+#define p_class MRp_class
+#define p_section MRp_section
+#define ns_makecanon MRns_makecanon
+#define ns_parserr MRns_parserr
+#define ns_samedomain MRns_samedomain
+#define ns_name_uncompress MRns_name_uncompress
+#define res_nmkquery MRres_nmkquery
+#define ns_initparse MRns_initparse
+#define res_nquery MRres_nquery
+#define res_nsearch MRres_nsearch
+#define res_hostalias MRres_hostalias
+#define res_nquerydomain MRres_nquerydomain
+#define ns_skiprr MRns_skiprr
+#define dn_skipname MRdn_skipname
+#define ns_name_ntol MRns_name_ntol
+#define ns_sign_tcp_init MRns_sign_tcp_init
+#define ns_sign_tcp MRns_sign_tcp
+#define ns_name_ntop MRns_name_ntop
+#define ns_name_pton MRns_name_pton
+#define ns_name_unpack MRns_name_unpack
+#define ns_name_pack MRns_name_pack
+#define ns_name_compress MRns_name_compress
+#define ns_name_skip MRns_name_skip
+#define ns_subdomain MRns_subdomain
+#define ns_find_tsig MRns_find_tsig
+#define ns_verify MRns_verify
+#define ns_verify_tcp_init MRns_verify_tcp_init
+#define ns_verify_tcp MRns_verify_tcp
+#define b64_ntop MRb64_ntop
+
+extern const struct res_sym __p_type_syms[];
+extern time_t cur_time;
+
+int dn_comp (const char *,
+ unsigned char *, unsigned, unsigned char **, unsigned char **);
+int loc_aton (const char *, u_char *);
+int sym_ston (const struct res_sym *, const char *, int *);
+void res_buildservicelist (void);
+void res_destroyservicelist (void);
+void res_buildprotolist(void);
+void res_destroyprotolist(void);
+int res_servicenumber(const char *);
+int res_protocolnumber(const char *);
+const char *res_protocolname(int);
+const char *res_servicename(u_int16_t, const char *);
+u_int32_t ns_datetosecs (const char *cp, int *errp);
+int b64_pton (char const *, unsigned char *, size_t);
+unsigned int res_randomid (void);
+isc_result_t res_findzonecut (res_state, const char *, ns_class, int, char *,
+ size_t, struct in_addr *, int, int *, void *);
+isc_result_t res_nsend (res_state,
+ double *, unsigned, double *, unsigned, unsigned *);
+isc_result_t res_nsendsigned (res_state, double *, unsigned, ns_tsig_key *,
+ double *, unsigned, unsigned *);
+int ns_samename (const char *, const char *);
+int res_nameinquery (const char *, int, int,
+ const unsigned char *, const unsigned char *);
+int res_queriesmatch (const unsigned char *, const unsigned char *,
+ const unsigned char *, const unsigned char *);
+int dn_expand (const unsigned char *,
+ const unsigned char *, const unsigned char *, char *, unsigned);
+unsigned int ns_get16 (const unsigned char *);
+void res_close (void);
+void res_nclose (res_state);
+int res_ourserver_p (const res_state, const struct sockaddr_in *);
+isc_result_t ns_sign (unsigned char *, unsigned *,
+ unsigned, int, void *, const unsigned char *,
+ unsigned, unsigned char *, unsigned *, time_t);
+const char *p_class (int);
+const char *p_section (int section, int opcode);
+isc_result_t ns_makecanon (const char *, char *, size_t);
+isc_result_t ns_parserr (ns_msg *, ns_sect, int, ns_rr *);
+int ns_samedomain (const char *, const char *);
+int ns_name_uncompress (const u_char *, const u_char *,
+ const u_char *, char *, size_t);
+isc_result_t res_nmkquery (res_state, int, const char *, ns_class, ns_type,
+ const unsigned char *, unsigned,
+ const unsigned char *, double *,
+ unsigned, unsigned *);
+int ns_initparse (const unsigned char *, unsigned, ns_msg *);
+isc_result_t res_nquery(res_state, const char *,
+ ns_class, ns_type, double *, unsigned, unsigned *);
+isc_result_t res_nsearch(res_state, const char *,
+ ns_class, ns_type, double *, unsigned, unsigned *);
+const char *res_hostalias (const res_state, const char *, char *, size_t);
+isc_result_t res_nquerydomain(res_state, const char *, const char *,
+ ns_class class, ns_type type,
+ double *, unsigned, unsigned *);
+
+int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
+int dn_skipname (const unsigned char *, const unsigned char *);
+u_int32_t getULong (const unsigned char *);
+int32_t getLong (const unsigned char *);
+u_int32_t getUShort (const unsigned char *);
+int32_t getShort (const unsigned char *);
+u_int32_t getUChar (const unsigned char *);
+void putULong (unsigned char *, u_int32_t);
+void putLong (unsigned char *, int32_t);
+void putUShort (unsigned char *, u_int32_t);
+void putShort (unsigned char *, int32_t);
+void putUChar (unsigned char *, u_int32_t);
+int ns_name_ntol (const unsigned char *, unsigned char *, size_t);
+isc_result_t ns_sign_tcp_init (void *, const unsigned char *,
+ unsigned, ns_tcp_tsig_state *);
+isc_result_t ns_sign_tcp (unsigned char *,
+ unsigned *, unsigned, int, ns_tcp_tsig_state *, int);
+int ns_name_ntop (const unsigned char *, char *, size_t);
+int ns_name_pton (const char *, unsigned char *, size_t);
+int ns_name_unpack (const unsigned char *, const unsigned char *,
+ const unsigned char *, unsigned char *, size_t);
+int ns_name_pack (const unsigned char *, unsigned char *,
+ unsigned, const unsigned char **, const unsigned char **);
+int ns_name_compress (const char *, unsigned char *,
+ size_t, const unsigned char **, const unsigned char **);
+int ns_name_skip (const unsigned char **, const unsigned char *);
+int ns_subdomain (const char *, const char *);
+unsigned char *ns_find_tsig (unsigned char *, unsigned char *);
+isc_result_t ns_verify (unsigned char *, unsigned *, void *,
+ const unsigned char *,
+ unsigned, unsigned char *, unsigned *, time_t *, int);
+isc_result_t ns_verify_tcp_init (void *, const unsigned char *, unsigned,
+ ns_tcp_tsig_state *);
+isc_result_t ns_verify_tcp (unsigned char *, unsigned *,
+ ns_tcp_tsig_state *, int);
+int b64_ntop (unsigned char const *, size_t, char *, size_t);
+
+ns_rcode find_cached_zone (const char *, ns_class, char *,
+ size_t, struct in_addr *, int, int *, void *);
+int find_tsig_key (ns_tsig_key **, const char *, void *);
+int forget_zone (void *);
+int repudiate_zone (void *);
+void cache_found_zone (ns_class, char *, struct in_addr *, int);
+isc_result_t uerr2isc (int);
+isc_result_t ns_rcode_to_isc (int);
+
+#define DprintQ(a,b,c,d)
+#define Dprint(a,b)
+#define Perror(a, b, c, d)
+#define Aerror(a, b, c, d, e)
+#define DPRINTF(x)
+
+#define USE_MD5
+#endif
+
+#if defined (TRACING)
+void trace_mr_statp_setup (res_state);
+#endif
diff --git a/contrib/isc-dhcp/includes/minires/res_update.h b/contrib/isc-dhcp/includes/minires/res_update.h
new file mode 100644
index 000000000000..45a5ac35432e
--- /dev/null
+++ b/contrib/isc-dhcp/includes/minires/res_update.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * $Id: res_update.h,v 1.2.2.1 2001/05/17 20:47:28 mellon Exp $
+ */
+
+#ifndef __RES_UPDATE_H
+#define __RES_UPDATE_H
+
+#include <sys/types.h>
+#include "arpa/nameser.h"
+#include <isc-dhcp/list.h>
+
+/*
+ * This RR-like structure is particular to UPDATE.
+ */
+typedef struct ns_updrec {
+ ISC_LINK(struct ns_updrec) r_link, r_glink;
+ ns_sect r_section; /* ZONE/PREREQUISITE/UPDATE */
+ char *r_dname; /* owner of the RR */
+ ns_class r_class; /* class number */
+ ns_type r_type; /* type number */
+ u_int32_t r_ttl; /* time to live */
+ const unsigned char *r_data; /* rdata fields as text string */
+ unsigned char *r_data_ephem; /* pointer to freeable r_data */
+ unsigned int r_size; /* size of r_data field */
+ int r_opcode; /* type of operation */
+ /* following fields for private use by the resolver/server
+ routines */
+ struct databuf *r_dp; /* databuf to process */
+ struct databuf *r_deldp; /* databuf's deleted/overwritten */
+ unsigned int r_zone; /* zone number on server */
+} ns_updrec;
+typedef ISC_LIST(ns_updrec) ns_updque;
+
+#endif /*__RES_UPDATE_H*/
diff --git a/contrib/isc-dhcp/includes/minires/resolv.h b/contrib/isc-dhcp/includes/minires/resolv.h
new file mode 100644
index 000000000000..233971d80a20
--- /dev/null
+++ b/contrib/isc-dhcp/includes/minires/resolv.h
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 1983, 1987, 1989
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * @(#)resolv.h 8.1 (Berkeley) 6/2/93
+ * $Id: resolv.h,v 1.3 2000/07/17 20:54:12 mellon Exp $
+ */
+
+#ifndef _RESOLV_H_
+#define _RESOLV_H_
+
+/*
+ * This used to be defined in res_query.c, now it's in herror.c.
+ * [XXX no it's not. It's in irs/irs_data.c]
+ * It was
+ * never extern'd by any *.h file before it was placed here. For thread
+ * aware programs, the last h_errno value set is stored in res->h_errno.
+ *
+ * XXX: There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO
+ * (and __h_errno_set) to the public via <resolv.h>.
+ * XXX: __h_errno_set is really part of IRS, not part of the resolver.
+ * If somebody wants to build and use a resolver that doesn't use IRS,
+ * what do they do? Perhaps something like
+ * #ifdef WANT_IRS
+ * # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+ * #else
+ * # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))
+ * #endif
+ */
+
+#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+struct __res_state; /* forward */
+void __h_errno_set(struct __res_state *res, int err);
+
+/*
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * inital name server(s) to query and the domain search list.
+ */
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF "/etc/resolv.conf"
+#endif
+
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+ res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns,
+ double **query,
+ unsigned *querylen,
+ double *ans,
+ unsigned anssiz,
+ int *resplen);
+
+typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns,
+ double *query,
+ unsigned querylen,
+ double *ans,
+ unsigned anssiz,
+ int *resplen);
+
+struct res_sym {
+ int number; /* Identifying number, like T_MX */
+ char * name; /* Its symbolic name, like "MX" */
+ char * humanname; /* Its fun name, like "mail exchanger" */
+};
+
+/*
+ * Global defines and variables for resolver stub.
+ */
+#define MAXNS 3 /* max # name servers we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+
+#define RES_TIMEOUT 5 /* min. seconds between retries */
+#define MAXRESOLVSORT 10 /* number of net to sort on */
+#define RES_MAXNDOTS 15 /* should reflect bit field size */
+#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
+#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
+#define RES_DFLRETRY 2 /* Default #/tries. */
+
+struct __res_state {
+ int retrans; /* retransmition time interval */
+ int retry; /* number of times to retransmit */
+ u_long options; /* option flags - see below. */
+ int nscount; /* number of name servers */
+ struct sockaddr_in
+ nsaddr_list[MAXNS]; /* address of name server */
+#define nsaddr nsaddr_list[0] /* for backward compatibility */
+ u_short id; /* current message id */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ char defdname[256]; /* default domain (deprecated) */
+ u_long pfcode; /* RES_PRF_ flags - see below. */
+ unsigned ndots:4; /* threshold for initial abs. query */
+ unsigned nsort:4; /* number of elements in sort_list[] */
+ char unused[3];
+ struct {
+ struct in_addr addr;
+ u_int32_t mask;
+ } sort_list[MAXRESOLVSORT];
+ res_send_qhook qhook; /* query hook */
+ res_send_rhook rhook; /* response hook */
+ int res_h_errno; /* last one set for this context */
+ int _sock; /* PRIVATE: for res_send i/o */
+ u_int _flags; /* PRIVATE: see below */
+ char pad[52]; /* On an i386 this means 512b total. */
+};
+
+typedef struct __res_state *res_state;
+
+/*
+ * Resolver flags (used to be discrete per-module statics ints).
+ */
+#define RES_F_VC 0x00000001 /* socket is TCP */
+#define RES_F_CONN 0x00000002 /* socket is connected */
+
+/* res_findzonecut() options */
+#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */
+
+/*
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT 0x00000001 /* address initialized */
+#define RES_DEBUG 0x00000002 /* print debug messages */
+#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
+#define RES_USEVC 0x00000008 /* use virtual circuit */
+#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
+#define RES_IGNTC 0x00000020 /* ignore trucation errors */
+#define RES_RECURSE 0x00000040 /* recursion desired */
+#define RES_DEFNAMES 0x00000080 /* use default domain name */
+#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
+#define RES_DNSRCH 0x00000200 /* search up local domain tree */
+#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
+#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
+#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
+#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
+#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
+#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
+#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
+
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+/*
+ * Resolver "pfcode" values. Used by dig.
+ */
+#define RES_PRF_STATS 0x00000001
+#define RES_PRF_UPDATE 0x00000002
+#define RES_PRF_CLASS 0x00000004
+#define RES_PRF_CMD 0x00000008
+#define RES_PRF_QUES 0x00000010
+#define RES_PRF_ANS 0x00000020
+#define RES_PRF_AUTH 0x00000040
+#define RES_PRF_ADD 0x00000080
+#define RES_PRF_HEAD1 0x00000100
+#define RES_PRF_HEAD2 0x00000200
+#define RES_PRF_TTLID 0x00000400
+#define RES_PRF_HEADX 0x00000800
+#define RES_PRF_QUERY 0x00001000
+#define RES_PRF_REPLY 0x00002000
+#define RES_PRF_INIT 0x00004000
+/* 0x00008000 */
+
+#if 0
+/* Things involving an internal (static) resolver context. */
+#ifdef _REENTRANT
+extern struct __res_state *__res_state(void);
+#define _res (*__res_state())
+#else
+#ifndef __BIND_NOSTATIC
+extern struct __res_state _res;
+#endif
+#endif
+
+void fp_nquery (const u_char *, int, FILE *);
+void fp_query (const u_char *, FILE *);
+const char * hostalias (const char *);
+void p_query (const u_char *);
+void res_close (void);
+int res_init (void);
+int res_isourserver (const struct sockaddr_in *);
+int res_mkquery (int, const char *, int, int, const u_char *,
+ int, const u_char *, u_char *, int);
+int res_query (const char *, int, int, u_char *, int);
+int res_querydomain (const char *, const char *, int, int,
+ u_char *, int);
+int res_search (const char *, int, int, u_char *, int);
+int res_send (const u_char *, int, u_char *, int);
+int res_sendsigned (const u_char *, int, ns_tsig_key *,
+ u_char *, int);
+
+#if !defined(SHARED_LIBBIND) || defined(LIB)
+/*
+ * If libbind is a shared object (well, DLL anyway)
+ * these externs break the linker when resolv.h is
+ * included by a lib client (like named)
+ * Make them go away if a client is including this
+ *
+ */
+extern const struct res_sym __p_key_syms[];
+extern const struct res_sym __p_cert_syms[];
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+extern const struct res_sym __p_rcode_syms[];
+#endif /* SHARED_LIBBIND */
+
+int res_hnok (const char *);
+int res_ownok (const char *);
+int res_mailok (const char *);
+int res_dnok (const char *);
+int sym_ston (const struct res_sym *, const char *, int *);
+const char * sym_ntos (const struct res_sym *, int, int *);
+const char * sym_ntop (const struct res_sym *, int, int *);
+int b64_ntop (u_char const *, size_t, char *, size_t);
+int b64_pton (char const *, u_char *, size_t);
+int loc_aton (const char *ascii, u_char *binary);
+const char * loc_ntoa (const u_char *binary, char *ascii);
+int dn_skipname (const u_char *, const u_char *);
+void putlong (u_int32_t, u_char *);
+void putshort (u_int16_t, u_char *);
+const char * p_class (int);
+const char * p_time (u_int32_t);
+const char * p_type (int);
+const char * p_rcode (int);
+const u_char * p_cdnname (const u_char *, const u_char *, int, FILE *);
+const u_char * p_cdname (const u_char *, const u_char *, FILE *);
+const u_char * p_fqnname (const u_char *cp, const u_char *msg,
+ int, char *, int);
+const u_char * p_fqname (const u_char *, const u_char *, FILE *);
+const char * p_option (u_long option);
+char * p_secstodate (u_long);
+int dn_count_labels (const char *);
+int dn_expand (const u_char *, const u_char *, const u_char *,
+ char *, int);
+u_int res_randomid (void);
+int res_nameinquery (const char *, int, int,
+ const u_char *, const u_char *);
+int res_queriesmatch (const u_char *, const u_char *,
+ const u_char *, const u_char *);
+const char * p_section (int section, int opcode);
+/* Things involving a resolver context. */
+int res_ninit (res_state);
+int res_nisourserver (const res_state,
+ const struct sockaddr_in *);
+void fp_resstat (const res_state, FILE *);
+void res_npquery (const res_state, const u_char *, int, FILE *);
+const char * res_hostalias (const res_state, const char *,
+ char *, size_t);
+int res_nquery (res_state,
+ const char *, int, int, u_char *, int);
+int res_nsearch (res_state, const char *, int,
+ int, u_char *, int);
+int res_nquerydomain (res_state,
+ const char *, const char *, int, int,
+ u_char *, int);
+int res_nmkquery (res_state,
+ int, const char *, int, int, const u_char *,
+ int, const u_char *, u_char *, int);
+int res_nsend (res_state, const u_char *, int, u_char *, int);
+int res_nsendsigned (res_state, const u_char *, int,
+ ns_tsig_key *, u_char *, int);
+int res_findzonecut (res_state, const char *, ns_class, int,
+ char *, size_t, struct in_addr *, int);
+void res_nclose (res_state);
+
+#endif /* 0 */
+#endif /* !_RESOLV_H_ */
diff --git a/contrib/isc-dhcp/includes/netinet/if_ether.h b/contrib/isc-dhcp/includes/netinet/if_ether.h
index f61b18b62fee..e53b4c7f66bc 100644
--- a/contrib/isc-dhcp/includes/netinet/if_ether.h
+++ b/contrib/isc-dhcp/includes/netinet/if_ether.h
@@ -48,28 +48,14 @@ struct ether_addr {
*/
#define ETHER_ADDR_LEN 6
-struct ether_header {
+struct isc_ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN];
u_int8_t ether_shost[ETHER_ADDR_LEN];
u_int16_t ether_type;
};
-#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
-#define ETHERTYPE_IP 0x0800 /* IP protocol */
-#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
-#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */
-
-/*
- * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
- * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
- * by an ETHER type (as given above) and then the (variable-length) header.
- */
-#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
-#define ETHERTYPE_NTRAILER 16
-
-#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
-
-#define ETHERMTU 1500
-#define ETHERMIN (60-14)
+#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
+#define ETHERTYPE_IP 0x0800 /* IP protocol */
+#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
#define ETHER_HEADER_SIZE (ETHER_ADDR_LEN * 2 + sizeof (u_int16_t))
diff --git a/contrib/isc-dhcp/includes/netinet/ip.h b/contrib/isc-dhcp/includes/netinet/ip.h
index 233abd6e69b5..0a1e35840443 100644
--- a/contrib/isc-dhcp/includes/netinet/ip.h
+++ b/contrib/isc-dhcp/includes/netinet/ip.h
@@ -49,14 +49,7 @@
* against negative integers quite easily, and fail in subtle ways.
*/
struct ip {
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int8_t ip_hl:4, /* header length */
- ip_v:4; /* version */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t ip_v:4, /* version */
- ip_hl:4; /* header length */
-#endif
+ u_int8_t ip_fvhl; /* header length, version */
u_int8_t ip_tos; /* type of service */
int16_t ip_len; /* total length */
u_int16_t ip_id; /* identification */
@@ -70,6 +63,12 @@ struct ip {
struct in_addr ip_src, ip_dst; /* source and dest address */
};
+#define IP_V(iph) ((iph)->ip_fvhl >> 4)
+#define IP_HL(iph) (((iph)->ip_fvhl & 0x0F) << 2)
+#define IP_V_SET(iph,x) ((iph)->ip_fvhl = ((iph)->ip_fvhl & 0x0F) | ((x) << 4))
+#define IP_HL_SET(iph,x) ((iph)->ip_fvhl = \
+ ((iph)->ip_fvhl & 0xF0) | (((x) >> 2) & 0x0F))
+
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
@@ -129,14 +128,7 @@ struct ip_timestamp {
u_int8_t ipt_code; /* IPOPT_TS */
u_int8_t ipt_len; /* size of structure (variable) */
u_int8_t ipt_ptr; /* index of current entry */
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int8_t ipt_flg:4, /* flags, see below */
- ipt_oflw:4; /* overflow counter */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t ipt_oflw:4, /* overflow counter */
- ipt_flg:4; /* flags, see below */
-#endif
+ u_int8_t ipt_flg_oflw; /* flags, see below, overflow counter */
union ipt_timestamp {
u_int32_t ipt_time[1];
struct ipt_ta {
diff --git a/contrib/isc-dhcp/includes/netinet/udp.h b/contrib/isc-dhcp/includes/netinet/udp.h
index c7964dfd30fc..95bc044f7d90 100644
--- a/contrib/isc-dhcp/includes/netinet/udp.h
+++ b/contrib/isc-dhcp/includes/netinet/udp.h
@@ -42,6 +42,6 @@
struct udphdr {
u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */
- int16_t uh_ulen; /* udp length */
+ u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
};
diff --git a/contrib/isc-dhcp/includes/omapip/alloc.h b/contrib/isc-dhcp/includes/omapip/alloc.h
new file mode 100644
index 000000000000..0c1efbf9ab32
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/alloc.h
@@ -0,0 +1,120 @@
+/* alloc.h
+
+ Definitions for the object management API protocol memory allocation... */
+
+/*
+ * Copyright (c) 1996-2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+isc_result_t omapi_buffer_new (omapi_buffer_t **, const char *, int);
+isc_result_t omapi_buffer_reference (omapi_buffer_t **,
+ omapi_buffer_t *, const char *, int);
+isc_result_t omapi_buffer_dereference (omapi_buffer_t **, const char *, int);
+
+#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+#define DMDOFFSET (sizeof (struct dmalloc_preamble))
+#define DMLFSIZE 16
+#define DMUFSIZE 16
+#define DMDSIZE (DMDOFFSET + DMLFSIZE + DMUFSIZE)
+
+struct dmalloc_preamble {
+ struct dmalloc_preamble *prev, *next;
+ const char *file;
+ int line;
+ size_t size;
+ unsigned long generation;
+ unsigned char low_fence [DMLFSIZE];
+};
+#else
+#define DMDOFFSET 0
+#define DMDSIZE 0
+#endif
+
+/* rc_history flags... */
+#define RC_LEASE 1
+#define RC_MISC 2
+
+#if defined (DEBUG_RC_HISTORY)
+#if !defined (RC_HISTORY_MAX)
+# define RC_HISTORY_MAX 256
+#endif
+
+#if !defined (RC_HISTORY_FLAGS)
+# define RC_HISTORY_FLAGS (RC_LEASE | RC_MISC)
+#endif
+
+struct rc_history_entry {
+ const char *file;
+ int line;
+ void *reference;
+ void *addr;
+ int refcnt;
+};
+
+#define rc_register(x, l, r, y, z, d, f) do { \
+ if (RC_HISTORY_FLAGS & ~(f)) { \
+ rc_history [rc_history_index].file = (x); \
+ rc_history [rc_history_index].line = (l); \
+ rc_history [rc_history_index].reference = (r); \
+ rc_history [rc_history_index].addr = (y); \
+ rc_history [rc_history_index].refcnt = (z); \
+ rc_history_next (d); \
+ } \
+ } while (0)
+#define rc_register_mdl(r, y, z, d, f) \
+ rc_register (__FILE__, __LINE__, r, y, z, d, f)
+#else
+#define rc_register(file, line, reference, addr, refcnt, d, f)
+#define rc_register_mdl(reference, addr, refcnt, d, f)
+#endif
+
+#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+extern struct dmalloc_preamble *dmalloc_list;
+extern unsigned long dmalloc_outstanding;
+extern unsigned long dmalloc_longterm;
+extern unsigned long dmalloc_generation;
+extern unsigned long dmalloc_cutoff_generation;
+#endif
+
+#if defined (DEBUG_RC_HISTORY)
+extern struct rc_history_entry rc_history [RC_HISTORY_MAX];
+extern int rc_history_index;
+extern int rc_history_count;
+#endif
diff --git a/contrib/isc-dhcp/includes/omapip/buffer.h b/contrib/isc-dhcp/includes/omapip/buffer.h
new file mode 100644
index 000000000000..16705559a8f7
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/buffer.h
@@ -0,0 +1,92 @@
+/* buffer.h
+
+ Definitions for the object management API protocol buffering... */
+
+/*
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+/* OMAPI buffers are ring buffers, which means that the beginning of the
+ buffer and the end of the buffer chase each other around. As long as
+ the tail never catches up to the head, there's room in the buffer for
+ data.
+
+ - If the tail and the head are equal, the buffer is empty.
+
+ - If the tail is less than the head, the contents of the buffer
+ are the bytes from the head to the end of buffer, and in addition,
+ the bytes between the beginning of the buffer and the tail, not
+ including the byte addressed by the tail.
+
+ - If the tail is greater than the head, then the buffer contains
+ valid bytes starting with the byte addressed by the head, and
+ ending with the byte before the byte addressed by the tail.
+
+ There will always be at least one byte of waste, because the tail can't
+ increase so that it's equal to the head (that would represent an empty
+ buffer. */
+#define OMAPI_BUF_SIZE 4048
+typedef struct _omapi_buffer {
+ struct _omapi_buffer *next; /* Buffers can be chained. */
+ u_int32_t refcnt; /* Buffers are reference counted. */
+ u_int16_t head, tail; /* Buffers are organized in a ring. */
+ char buf [OMAPI_BUF_SIZE]; /* The actual buffer is included in
+ the buffer data structure. */
+} omapi_buffer_t;
+
+#define BUFFER_BYTES_FREE(x) \
+ ((x) -> tail > (x) -> head \
+ ? sizeof ((x) -> buf) - ((x) -> tail - (x) -> head) \
+ : (x) -> head - (x) -> tail)
+
+#define BYTES_IN_BUFFER(x) \
+ ((x) -> tail > (x) -> head \
+ ? (x) -> tail - (x) -> head - 1 \
+ : sizeof ((x) -> buf) - ((x) -> head - (x) -> tail) - 1)
+
+isc_result_t omapi_connection_require (omapi_object_t *, unsigned);
+isc_result_t omapi_connection_copyout (unsigned char *,
+ omapi_object_t *, unsigned);
+isc_result_t omapi_connection_copyin (omapi_object_t *,
+ const unsigned char *, unsigned);
+isc_result_t omapi_connection_flush (omapi_object_t *);
+isc_result_t omapi_connection_get_uint32 (omapi_object_t *, u_int32_t *);
+isc_result_t omapi_connection_put_uint32 (omapi_object_t *, u_int32_t);
+isc_result_t omapi_connection_get_uint16 (omapi_object_t *, u_int16_t *);
+isc_result_t omapi_connection_put_uint16 (omapi_object_t *, u_int32_t);
+
diff --git a/contrib/isc-dhcp/includes/omapip/convert.h b/contrib/isc-dhcp/includes/omapip/convert.h
new file mode 100644
index 000000000000..b6d2d9fb0303
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/convert.h
@@ -0,0 +1,61 @@
+/* convert.h
+
+ Safe copying of integers into and out of a non-aligned memory buffer. */
+
+/*
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+#ifndef OMAPI_CONVERT_H
+#define OMAPI_CONVERT_H
+
+u_int32_t getULong (const unsigned char *);
+int32_t getLong (const unsigned char *);
+u_int32_t getUShort (const unsigned char *);
+int32_t getShort (const unsigned char *);
+u_int32_t getUChar (const unsigned char *);
+void putULong (unsigned char *, u_int32_t);
+void putLong (unsigned char *, int32_t);
+void putUShort (unsigned char *, u_int32_t);
+void putShort (unsigned char *, int32_t);
+void putUChar (unsigned char *, u_int32_t);
+int converted_length (const unsigned char *, unsigned int, unsigned int);
+int binary_to_ascii (unsigned char *, const unsigned char *,
+ unsigned int, unsigned int);
+
+#endif /* OMAPI_CONVERT_H */
diff --git a/contrib/isc-dhcp/includes/omapip/hash.h b/contrib/isc-dhcp/includes/omapip/hash.h
new file mode 100644
index 000000000000..5ad2305cbbac
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/hash.h
@@ -0,0 +1,159 @@
+/* hash.h
+
+ Definitions for hashing... */
+
+/*
+ * Copyright (c) 1995-2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+#ifndef OMAPI_HASH_H
+#define OMAPI_HASH_H
+
+#define DEFAULT_HASH_SIZE 9973
+
+/* The purpose of the hashed_object_t struct is to not match anything else. */
+typedef struct {
+ int foo;
+} hashed_object_t;
+
+typedef void (*hash_foreach_func) (const unsigned char *,
+ unsigned, hashed_object_t *);
+typedef int (*hash_reference) (hashed_object_t **, hashed_object_t *,
+ const char *, int);
+typedef int (*hash_dereference) (hashed_object_t **, const char *, int);
+
+struct hash_bucket {
+ struct hash_bucket *next;
+ const unsigned char *name;
+ unsigned len;
+ hashed_object_t *value;
+};
+
+typedef int (*hash_comparator_t)(const void *, const void *, unsigned long);
+
+struct hash_table {
+ unsigned hash_count;
+ struct hash_bucket *buckets [DEFAULT_HASH_SIZE];
+ hash_reference referencer;
+ hash_dereference dereferencer;
+ hash_comparator_t cmp;
+ int (*do_hash) (const unsigned char *, unsigned, unsigned);
+};
+
+struct named_hash {
+ struct named_hash *next;
+ const char *name;
+ struct hash_table *hash;
+};
+
+#define HASH_FUNCTIONS_DECL(name, bufarg, type, hashtype) \
+void name##_hash_add (hashtype *, bufarg, unsigned, type *, \
+ const char *, int); \
+void name##_hash_delete (hashtype *, bufarg, unsigned, \
+ const char *, int); \
+int name##_hash_lookup (type **, hashtype *, bufarg, unsigned, \
+ const char *, int); \
+int name##_hash_foreach (hashtype *, \
+ void (*) (bufarg, unsigned, type *)); \
+int name##_new_hash (hashtype **, int, const char *, int); \
+void name##_free_hash_table (hashtype **, const char *, int);
+
+
+#define HASH_FUNCTIONS(name, bufarg, type, hashtype, ref, deref) \
+void name##_hash_add (hashtype *table, \
+ bufarg buf, unsigned len, type *ptr, \
+ const char *file, int line) \
+{ \
+ add_hash ((struct hash_table *)table, \
+ (const unsigned char *)buf, \
+ len, (hashed_object_t *)ptr, file, line); \
+} \
+ \
+void name##_hash_delete (hashtype *table, \
+ bufarg buf, unsigned len, const char *file, int line)\
+{ \
+ delete_hash_entry ((struct hash_table *)table, \
+ (const unsigned char *)buf, \
+ len, file, line); \
+} \
+ \
+int name##_hash_lookup (type **ptr, hashtype *table, \
+ bufarg buf, unsigned len, const char *file, int line) \
+{ \
+ return hash_lookup ((hashed_object_t **)ptr, \
+ (struct hash_table *)table, \
+ (const unsigned char *)buf, len, file, line); \
+} \
+ \
+int name##_hash_foreach (hashtype *table, \
+ void (*func) (bufarg, unsigned, type *)) \
+{ \
+ return hash_foreach ((struct hash_table *)table, \
+ (hash_foreach_func)func); \
+} \
+ \
+int name##_new_hash (hashtype **tp, int c, const char *file, int line) \
+{ \
+ return new_hash ((struct hash_table **)tp, \
+ (hash_reference)ref, (hash_dereference)deref, c, \
+ file, line); \
+} \
+ \
+void name##_free_hash_table (hashtype **table, const char *file, int line) \
+{ \
+ free_hash_table ((struct hash_table **)table, file, line); \
+}
+
+void relinquish_hash_bucket_hunks (void);
+int new_hash_table (struct hash_table **, int, const char *, int);
+void free_hash_table (struct hash_table **, const char *, int);
+struct hash_bucket *new_hash_bucket (const char *, int);
+void free_hash_bucket (struct hash_bucket *, const char *, int);
+int new_hash (struct hash_table **,
+ hash_reference, hash_dereference, int, const char *, int);
+void add_hash (struct hash_table *,
+ const unsigned char *, unsigned, hashed_object_t *,
+ const char *, int);
+void delete_hash_entry (struct hash_table *, const unsigned char *,
+ unsigned, const char *, int);
+int hash_lookup (hashed_object_t **, struct hash_table *,
+ const unsigned char *, unsigned, const char *, int);
+int hash_foreach (struct hash_table *, hash_foreach_func);
+int casecmp (const void *s, const void *t, unsigned long len);
+
+#endif /* OMAPI_HASH_H */
diff --git a/contrib/isc-dhcp/includes/omapip/omapip.h b/contrib/isc-dhcp/includes/omapip/omapip.h
new file mode 100644
index 000000000000..7f51c3ff0f94
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/omapip.h
@@ -0,0 +1,620 @@
+/* omapip.h
+
+ Definitions for the object management API and protocol... */
+
+/*
+ * Copyright (c) 1996-2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+#ifndef _OMAPIP_H_
+#define _OMAPIP_H_
+#include <isc-dhcp/result.h>
+
+typedef unsigned int omapi_handle_t;
+
+struct __omapi_object;
+typedef struct __omapi_object omapi_object_t;
+
+typedef enum {
+ omapi_datatype_int,
+ omapi_datatype_string,
+ omapi_datatype_data,
+ omapi_datatype_object
+} omapi_datatype_t;
+
+typedef struct {
+ int refcnt;
+ omapi_datatype_t type;
+ union {
+ struct {
+ unsigned len;
+#define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \
+ sizeof (omapi_datatype_t) + \
+ sizeof (int))
+ unsigned char value [1];
+ } buffer;
+#define OMAPI_TYPED_DATA_OBJECT_LEN (sizeof (int) + \
+ sizeof (omapi_datatype_t) + \
+ sizeof (omapi_object_t *))
+ omapi_object_t *object;
+#define OMAPI_TYPED_DATA_REF_LEN (sizeof (int) + \
+ sizeof (omapi_datatype_t) + \
+ 3 * sizeof (void *))
+ struct {
+ void *ptr;
+ isc_result_t (*reference) (void *,
+ void *, const char *, int);
+ isc_result_t (*dereference) (void *,
+ const char *, int);
+ } ref;
+#define OMAPI_TYPED_DATA_INT_LEN (sizeof (int) + \
+ sizeof (omapi_datatype_t) + \
+ sizeof (int))
+ int integer;
+ } u;
+} omapi_typed_data_t;
+
+typedef struct {
+ int refcnt;
+ unsigned len;
+#define OMAPI_DATA_STRING_EMPTY_SIZE (2 * sizeof (int))
+ unsigned char value [1];
+} omapi_data_string_t;
+
+typedef struct {
+ int refcnt;
+ omapi_data_string_t *name;
+ omapi_typed_data_t *value;
+} omapi_value_t;
+
+typedef struct __omapi_object_type_t {
+ const char *name;
+ struct __omapi_object_type_t *next;
+
+ isc_result_t (*set_value) (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+ isc_result_t (*get_value) (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *, omapi_value_t **);
+ isc_result_t (*destroy) (omapi_object_t *, const char *, int);
+ isc_result_t (*signal_handler) (omapi_object_t *,
+ const char *, va_list);
+ isc_result_t (*stuff_values) (omapi_object_t *,
+ omapi_object_t *, omapi_object_t *);
+ isc_result_t (*lookup) (omapi_object_t **, omapi_object_t *,
+ omapi_object_t *);
+ isc_result_t (*create) (omapi_object_t **, omapi_object_t *);
+ isc_result_t (*remove) (omapi_object_t *, omapi_object_t *);
+ isc_result_t (*freer) (omapi_object_t *, const char *, int);
+ isc_result_t (*allocator) (omapi_object_t **, const char *, int);
+ isc_result_t (*sizer) (size_t);
+ size_t size;
+ int rc_flag;
+ isc_result_t (*initialize) (omapi_object_t *, const char *, int);
+} omapi_object_type_t;
+
+#define OMAPI_OBJECT_PREAMBLE \
+ omapi_object_type_t *type; \
+ int refcnt; \
+ omapi_handle_t handle; \
+ omapi_object_t *outer, *inner
+
+/* The omapi handle structure. */
+struct __omapi_object {
+ OMAPI_OBJECT_PREAMBLE;
+};
+
+/* The port on which applications should listen for OMAPI connections. */
+#define OMAPI_PROTOCOL_PORT 7911
+
+typedef struct {
+ unsigned addrtype;
+ unsigned addrlen;
+ unsigned char address [16];
+ unsigned port;
+} omapi_addr_t;
+
+typedef struct {
+ int refcnt;
+ unsigned count;
+ omapi_addr_t *addresses;
+} omapi_addr_list_t;
+
+typedef struct auth_key {
+ OMAPI_OBJECT_PREAMBLE;
+ char *name;
+ char *algorithm;
+ omapi_data_string_t *key;
+} omapi_auth_key_t;
+
+#define OMAPI_CREATE 1
+#define OMAPI_UPDATE 2
+#define OMAPI_EXCL 4
+#define OMAPI_NOTIFY_PROTOCOL 8
+
+#define OMAPI_OBJECT_ALLOC(name, stype, type) \
+isc_result_t name##_allocate (stype **p, const char *file, int line) \
+{ \
+ return omapi_object_allocate ((omapi_object_t **)p, \
+ type, 0, file, line); \
+} \
+ \
+isc_result_t name##_reference (stype **pptr, stype *ptr, \
+ const char *file, int line) \
+{ \
+ return omapi_object_reference ((omapi_object_t **)pptr, \
+ (omapi_object_t *)ptr, file, line); \
+} \
+ \
+isc_result_t name##_dereference (stype **ptr, const char *file, int line) \
+{ \
+ return omapi_object_dereference ((omapi_object_t **)ptr, file, line); \
+}
+
+#define OMAPI_OBJECT_ALLOC_DECL(name, stype, type) \
+isc_result_t name##_allocate (stype **p, const char *file, int line); \
+isc_result_t name##_reference (stype **pptr, stype *ptr, \
+ const char *file, int line); \
+isc_result_t name##_dereference (stype **ptr, const char *file, int line);
+
+typedef isc_result_t (*omapi_array_ref_t) (char **, char *, const char *, int);
+typedef isc_result_t (*omapi_array_deref_t) (char **, const char *, int);
+
+/* An extensible array type. */
+typedef struct {
+ char **data;
+ omapi_array_ref_t ref;
+ omapi_array_deref_t deref;
+ int count;
+ int max;
+} omapi_array_t;
+
+#define OMAPI_ARRAY_TYPE(name, stype) \
+isc_result_t name##_array_allocate (omapi_array_t **p, \
+ const char *file, int line) \
+{ \
+ return (omapi_array_allocate \
+ (p, \
+ (omapi_array_ref_t)name##_reference, \
+ (omapi_array_deref_t)name##_dereference, \
+ file, line)); \
+} \
+ \
+isc_result_t name##_array_free (omapi_array_t **p, \
+ const char *file, int line) \
+{ \
+ return omapi_array_free (p, file, line); \
+} \
+ \
+isc_result_t name##_array_extend (omapi_array_t *pptr, stype *ptr, int *index,\
+ const char *file, int line) \
+{ \
+ return omapi_array_extend (pptr, (char *)ptr, index, file, line); \
+} \
+ \
+isc_result_t name##_array_set (omapi_array_t *pptr, stype *ptr, int index, \
+ const char *file, int line) \
+{ \
+ return omapi_array_set (pptr, (char *)ptr, index, file, line); \
+} \
+ \
+isc_result_t name##_array_lookup (stype **ptr, omapi_array_t *pptr, \
+ int index, const char *file, int line) \
+{ \
+ return omapi_array_lookup ((char **)ptr, pptr, index, file, line); \
+}
+
+#define OMAPI_ARRAY_TYPE_DECL(name, stype) \
+isc_result_t name##_array_allocate (omapi_array_t **, const char *, int); \
+isc_result_t name##_array_free (omapi_array_t **, const char *, int); \
+isc_result_t name##_array_extend (omapi_array_t *, stype *, int *, \
+ const char *, int); \
+isc_result_t name##_array_set (omapi_array_t *, \
+ stype *, int, const char *, int); \
+isc_result_t name##_array_lookup (stype **, \
+ omapi_array_t *, int, const char *, int)
+
+#define omapi_array_foreach_begin(array, stype, var) \
+ { \
+ int omapi_array_foreach_index; \
+ stype *var = (stype *)0; \
+ for (omapi_array_foreach_index = 0; \
+ array && \
+ omapi_array_foreach_index < (array) -> count; \
+ omapi_array_foreach_index++) { \
+ if ((array) -> data [omapi_array_foreach_index]) { \
+ ((*(array) -> ref) \
+ ((char **)&var, \
+ (array) -> data [omapi_array_foreach_index],\
+ MDL));
+
+#define omapi_array_foreach_end(array, stype, var) \
+ (*(array) -> deref) ((char **)&var, MDL); \
+ } \
+ } \
+ }
+
+isc_result_t omapi_protocol_connect (omapi_object_t *,
+ const char *, unsigned, omapi_object_t *);
+isc_result_t omapi_connect_list (omapi_object_t *, omapi_addr_list_t *,
+ omapi_addr_t *);
+isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int);
+isc_boolean_t omapi_protocol_authenticated (omapi_object_t *);
+isc_result_t omapi_protocol_configure_security (omapi_object_t *,
+ isc_result_t (*)
+ (omapi_object_t *,
+ omapi_addr_t *),
+ isc_result_t (*)
+ (omapi_object_t *,
+ omapi_auth_key_t *));
+isc_result_t omapi_protocol_accept (omapi_object_t *);
+isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);
+isc_result_t omapi_protocol_ready (omapi_object_t *);
+isc_result_t omapi_protocol_add_auth (omapi_object_t *, omapi_object_t *,
+ omapi_handle_t);
+isc_result_t omapi_protocol_lookup_auth (omapi_object_t **, omapi_object_t *,
+ omapi_handle_t);
+isc_result_t omapi_protocol_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_protocol_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_protocol_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+
+isc_result_t omapi_protocol_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_protocol_send_message (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_protocol_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_protocol_listener_set_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_protocol_listener_get_value (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_protocol_listener_destroy (omapi_object_t *,
+ const char *, int);
+isc_result_t omapi_protocol_listener_signal (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_protocol_listener_stuff (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_protocol_send_status (omapi_object_t *, omapi_object_t *,
+ isc_result_t, unsigned, const char *);
+isc_result_t omapi_protocol_send_open (omapi_object_t *, omapi_object_t *,
+ const char *, omapi_object_t *,
+ unsigned);
+isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *,
+ unsigned, omapi_object_t *);
+
+isc_result_t omapi_connect (omapi_object_t *, const char *, unsigned);
+isc_result_t omapi_disconnect (omapi_object_t *, int);
+int omapi_connection_readfd (omapi_object_t *);
+int omapi_connection_writefd (omapi_object_t *);
+isc_result_t omapi_connection_connect (omapi_object_t *);
+isc_result_t omapi_connection_reader (omapi_object_t *);
+isc_result_t omapi_connection_writer (omapi_object_t *);
+isc_result_t omapi_connection_reaper (omapi_object_t *);
+isc_result_t omapi_connection_output_auth_length (omapi_object_t *,
+ unsigned *);
+isc_result_t omapi_connection_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_connection_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_connection_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_connection_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_connection_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_connection_write_typed_data (omapi_object_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_connection_put_name (omapi_object_t *, const char *);
+isc_result_t omapi_connection_put_string (omapi_object_t *, const char *);
+isc_result_t omapi_connection_put_handle (omapi_object_t *c,
+ omapi_object_t *h);
+
+isc_result_t omapi_listen (omapi_object_t *, unsigned, int);
+isc_result_t omapi_listen_addr (omapi_object_t *,
+ omapi_addr_t *, int);
+isc_result_t omapi_listener_accept (omapi_object_t *);
+int omapi_listener_readfd (omapi_object_t *);
+isc_result_t omapi_accept (omapi_object_t *);
+isc_result_t omapi_listener_configure_security (omapi_object_t *,
+ isc_result_t (*)
+ (omapi_object_t *,
+ omapi_addr_t *));
+isc_result_t omapi_listener_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_listener_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_listener_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_listener_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_listener_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+
+isc_result_t omapi_register_io_object (omapi_object_t *,
+ int (*)(omapi_object_t *),
+ int (*)(omapi_object_t *),
+ isc_result_t (*)(omapi_object_t *),
+ isc_result_t (*)(omapi_object_t *),
+ isc_result_t (*)(omapi_object_t *));
+isc_result_t omapi_unregister_io_object (omapi_object_t *);
+isc_result_t omapi_dispatch (struct timeval *);
+isc_result_t omapi_wait_for_completion (omapi_object_t *, struct timeval *);
+isc_result_t omapi_one_dispatch (omapi_object_t *, struct timeval *);
+isc_result_t omapi_io_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_io_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *, omapi_value_t **);
+isc_result_t omapi_io_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_io_signal_handler (omapi_object_t *, const char *, va_list);
+isc_result_t omapi_io_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_waiter_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_io_state_foreach (isc_result_t (*func) (omapi_object_t *,
+ void *),
+ void *p);
+
+isc_result_t omapi_generic_new (omapi_object_t **, const char *, int);
+isc_result_t omapi_generic_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_generic_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_generic_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_generic_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_generic_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_generic_clear_flags (omapi_object_t *);
+
+isc_result_t omapi_message_new (omapi_object_t **, const char *, int);
+isc_result_t omapi_message_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_message_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_message_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_message_signal_handler (omapi_object_t *,
+ const char *, va_list);
+isc_result_t omapi_message_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_message_register (omapi_object_t *);
+isc_result_t omapi_message_unregister (omapi_object_t *);
+isc_result_t omapi_message_process (omapi_object_t *, omapi_object_t *);
+
+OMAPI_OBJECT_ALLOC_DECL (omapi_auth_key,
+ omapi_auth_key_t, omapi_type_auth_key)
+isc_result_t omapi_auth_key_new (omapi_auth_key_t **, const char *, int);
+isc_result_t omapi_auth_key_destroy (omapi_object_t *, const char *, int);
+isc_result_t omapi_auth_key_enter (omapi_auth_key_t *);
+isc_result_t omapi_auth_key_lookup_name (omapi_auth_key_t **, const char *);
+isc_result_t omapi_auth_key_lookup (omapi_object_t **,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_auth_key_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_auth_key_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+
+extern omapi_object_type_t *omapi_type_connection;
+extern omapi_object_type_t *omapi_type_listener;
+extern omapi_object_type_t *omapi_type_io_object;
+extern omapi_object_type_t *omapi_type_generic;
+extern omapi_object_type_t *omapi_type_protocol;
+extern omapi_object_type_t *omapi_type_protocol_listener;
+extern omapi_object_type_t *omapi_type_waiter;
+extern omapi_object_type_t *omapi_type_remote;
+extern omapi_object_type_t *omapi_type_message;
+extern omapi_object_type_t *omapi_type_auth_key;
+
+extern omapi_object_type_t *omapi_object_types;
+
+void omapi_type_relinquish (void);
+isc_result_t omapi_init (void);
+isc_result_t omapi_object_type_register (omapi_object_type_t **,
+ const char *,
+ isc_result_t (*)
+ (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *),
+ isc_result_t (*)
+ (omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **),
+ isc_result_t (*) (omapi_object_t *,
+ const char *, int),
+ isc_result_t (*) (omapi_object_t *,
+ const char *,
+ va_list),
+ isc_result_t (*) (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *),
+ isc_result_t (*) (omapi_object_t **,
+ omapi_object_t *,
+ omapi_object_t *),
+ isc_result_t (*) (omapi_object_t **,
+ omapi_object_t *),
+ isc_result_t (*) (omapi_object_t *,
+ omapi_object_t *),
+ isc_result_t (*) (omapi_object_t *,
+ const char *, int),
+ isc_result_t (*) (omapi_object_t **,
+ const char *, int),
+ isc_result_t (*) (size_t), size_t,
+ isc_result_t (*) (omapi_object_t *,
+ const char *, int),
+ int);
+isc_result_t omapi_signal (omapi_object_t *, const char *, ...);
+isc_result_t omapi_signal_in (omapi_object_t *, const char *, ...);
+isc_result_t omapi_set_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *);
+isc_result_t omapi_set_value_str (omapi_object_t *, omapi_object_t *,
+ const char *, omapi_typed_data_t *);
+isc_result_t omapi_set_boolean_value (omapi_object_t *, omapi_object_t *,
+ const char *, int);
+isc_result_t omapi_set_int_value (omapi_object_t *, omapi_object_t *,
+ const char *, int);
+isc_result_t omapi_set_object_value (omapi_object_t *, omapi_object_t *,
+ const char *, omapi_object_t *);
+isc_result_t omapi_set_string_value (omapi_object_t *, omapi_object_t *,
+ const char *, const char *);
+isc_result_t omapi_get_value (omapi_object_t *, omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **);
+isc_result_t omapi_get_value_str (omapi_object_t *, omapi_object_t *,
+ const char *, omapi_value_t **);
+isc_result_t omapi_stuff_values (omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *);
+isc_result_t omapi_object_create (omapi_object_t **, omapi_object_t *,
+ omapi_object_type_t *);
+isc_result_t omapi_object_update (omapi_object_t *, omapi_object_t *,
+ omapi_object_t *, omapi_handle_t);
+int omapi_data_string_cmp (omapi_data_string_t *, omapi_data_string_t *);
+int omapi_ds_strcmp (omapi_data_string_t *, const char *);
+int omapi_td_strcmp (omapi_typed_data_t *, const char *);
+int omapi_td_strcasecmp (omapi_typed_data_t *, const char *);
+isc_result_t omapi_make_value (omapi_value_t **, omapi_data_string_t *,
+ omapi_typed_data_t *, const char *, int);
+isc_result_t omapi_make_const_value (omapi_value_t **, omapi_data_string_t *,
+ const unsigned char *,
+ unsigned, const char *, int);
+isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *,
+ int, const char *, int);
+isc_result_t omapi_make_uint_value (omapi_value_t **, omapi_data_string_t *,
+ unsigned int, const char *, int);
+isc_result_t omapi_make_object_value (omapi_value_t **, omapi_data_string_t *,
+ omapi_object_t *, const char *, int);
+isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
+ omapi_object_t *, const char *, int);
+isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
+ const char *, const char *, int);
+isc_result_t omapi_get_int_value (unsigned long *, omapi_typed_data_t *);
+
+isc_result_t omapi_object_handle (omapi_handle_t *, omapi_object_t *);
+isc_result_t omapi_handle_lookup (omapi_object_t **, omapi_handle_t);
+isc_result_t omapi_handle_td_lookup (omapi_object_t **, omapi_typed_data_t *);
+
+void * dmalloc (unsigned, const char *, int);
+void dfree (void *, const char *, int);
+#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+void dmalloc_reuse (void *, const char *, int, int);
+void dmalloc_dump_outstanding (void);
+#else
+#define dmalloc_reuse(x,y,l,z)
+#endif
+#define MDL __FILE__, __LINE__
+#if defined (DEBUG_RC_HISTORY)
+void dump_rc_history (void *);
+void rc_history_next (int);
+#endif
+void omapi_print_dmalloc_usage_by_caller (void);
+isc_result_t omapi_object_allocate (omapi_object_t **,
+ omapi_object_type_t *,
+ size_t, const char *, int);
+isc_result_t omapi_object_initialize (omapi_object_t *,
+ omapi_object_type_t *,
+ size_t, size_t, const char *, int);
+isc_result_t omapi_object_reference (omapi_object_t **,
+ omapi_object_t *, const char *, int);
+isc_result_t omapi_object_dereference (omapi_object_t **, const char *, int);
+isc_result_t omapi_typed_data_new (const char *, int, omapi_typed_data_t **,
+ omapi_datatype_t, ...);
+isc_result_t omapi_typed_data_reference (omapi_typed_data_t **,
+ omapi_typed_data_t *,
+ const char *, int);
+isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **,
+ const char *, int);
+isc_result_t omapi_data_string_new (omapi_data_string_t **,
+ unsigned, const char *, int);
+isc_result_t omapi_data_string_reference (omapi_data_string_t **,
+ omapi_data_string_t *,
+ const char *, int);
+isc_result_t omapi_data_string_dereference (omapi_data_string_t **,
+ const char *, int);
+isc_result_t omapi_value_new (omapi_value_t **, const char *, int);
+isc_result_t omapi_value_reference (omapi_value_t **,
+ omapi_value_t *, const char *, int);
+isc_result_t omapi_value_dereference (omapi_value_t **, const char *, int);
+isc_result_t omapi_addr_list_new (omapi_addr_list_t **, unsigned,
+ const char *, int);
+isc_result_t omapi_addr_list_reference (omapi_addr_list_t **,
+ omapi_addr_list_t *,
+ const char *, int);
+isc_result_t omapi_addr_list_dereference (omapi_addr_list_t **,
+ const char *, int);
+
+isc_result_t omapi_array_allocate (omapi_array_t **, omapi_array_ref_t,
+ omapi_array_deref_t, const char *, int);
+isc_result_t omapi_array_free (omapi_array_t **, const char *, int);
+isc_result_t omapi_array_extend (omapi_array_t *, char *, int *,
+ const char *, int);
+isc_result_t omapi_array_set (omapi_array_t *, void *, int, const char *, int);
+isc_result_t omapi_array_lookup (char **,
+ omapi_array_t *, int, const char *, int);
+OMAPI_ARRAY_TYPE_DECL(omapi_object, omapi_object_t);
+#endif /* _OMAPIP_H_ */
diff --git a/contrib/isc-dhcp/includes/omapip/omapip_p.h b/contrib/isc-dhcp/includes/omapip/omapip_p.h
new file mode 100644
index 000000000000..d64df0ec0556
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/omapip_p.h
@@ -0,0 +1,302 @@
+/* omapip_p.h
+
+ Private master include file for the OMAPI library. */
+
+/*
+ * Copyright (c) 1996-2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+#ifndef __OMAPIP_OMAPIP_P_H__
+#define __OMAPIP_OMAPIP_P_H__
+
+#ifndef __CYGWIN32__
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <arpa/inet.h>
+
+#include <netdb.h>
+#else
+#define fd_set cygwin_fd_set
+#include <sys/types.h>
+#endif
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <time.h>
+
+#include "cdefs.h"
+#include "osdep.h"
+
+#include <isc-dhcp/dst.h>
+#include <isc-dhcp/result.h>
+
+#include <omapip/convert.h>
+#include <omapip/hash.h>
+#include <omapip/omapip.h>
+#include <omapip/trace.h>
+
+/* OMAPI protocol header, version 1.00 */
+typedef struct {
+ u_int32_t authlen; /* Length of authenticator. */
+ u_int32_t authid; /* Authenticator object ID. */
+ u_int32_t op; /* Opcode. */
+ omapi_handle_t handle; /* Handle of object being operated on,
+ or zero. */
+ u_int32_t id; /* Transaction ID. */
+ u_int32_t rid; /* ID of transaction to which this is a response. */
+} omapi_protocol_header_t;
+
+#define OMAPI_PROTOCOL_VERSION 100
+
+#define OMAPI_OP_OPEN 1
+#define OMAPI_OP_REFRESH 2
+#define OMAPI_OP_UPDATE 3
+#define OMAPI_OP_NOTIFY 4
+#define OMAPI_OP_STATUS 5
+#define OMAPI_OP_DELETE 6
+
+typedef enum {
+ omapi_connection_unconnected,
+ omapi_connection_connecting,
+ omapi_connection_connected,
+ omapi_connection_disconnecting,
+ omapi_connection_closed
+} omapi_connection_state_t;
+
+typedef enum {
+ omapi_protocol_intro_wait,
+ omapi_protocol_header_wait,
+ omapi_protocol_signature_wait,
+ omapi_protocol_name_wait,
+ omapi_protocol_name_length_wait,
+ omapi_protocol_value_wait,
+ omapi_protocol_value_length_wait
+} omapi_protocol_state_t;
+
+typedef struct __omapi_message_object {
+ OMAPI_OBJECT_PREAMBLE;
+ struct __omapi_message_object *next, *prev;
+ omapi_object_t *object;
+ omapi_object_t *notify_object;
+ struct __omapi_protocol_object *protocol_object;
+ u_int32_t authlen;
+ omapi_typed_data_t *authenticator;
+ u_int32_t authid;
+ omapi_object_t *id_object;
+ u_int32_t op;
+ u_int32_t h;
+ u_int32_t id;
+ u_int32_t rid;
+} omapi_message_object_t;
+
+typedef struct __omapi_remote_auth {
+ struct __omapi_remote_auth *next;
+ omapi_handle_t remote_handle;
+ omapi_object_t *a;
+} omapi_remote_auth_t;
+
+typedef struct __omapi_protocol_object {
+ OMAPI_OBJECT_PREAMBLE;
+ u_int32_t header_size;
+ u_int32_t protocol_version;
+ u_int32_t next_xid;
+
+ omapi_protocol_state_t state; /* Input state. */
+ int reading_message_values; /* True if reading message-specific
+ values. */
+ omapi_message_object_t *message; /* Incoming message. */
+ omapi_data_string_t *name; /* Incoming name. */
+ omapi_typed_data_t *value; /* Incoming value. */
+ isc_result_t verify_result;
+ omapi_remote_auth_t *default_auth; /* Default authinfo to use. */
+ omapi_remote_auth_t *remote_auth_list; /* Authenticators active on
+ this connection. */
+
+ isc_boolean_t insecure; /* Set to allow unauthenticated
+ messages. */
+
+ isc_result_t (*verify_auth) (omapi_object_t *, omapi_auth_key_t *);
+} omapi_protocol_object_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+
+ isc_boolean_t insecure; /* Set to allow unauthenticated
+ messages. */
+
+ isc_result_t (*verify_auth) (omapi_object_t *, omapi_auth_key_t *);
+} omapi_protocol_listener_object_t;
+
+#include <omapip/buffer.h>
+
+typedef struct __omapi_listener_object {
+ OMAPI_OBJECT_PREAMBLE;
+ int socket; /* Connection socket. */
+ int index;
+ struct sockaddr_in address;
+ isc_result_t (*verify_addr) (omapi_object_t *, omapi_addr_t *);
+} omapi_listener_object_t;
+
+typedef struct __omapi_connection_object {
+ OMAPI_OBJECT_PREAMBLE;
+ int socket; /* Connection socket. */
+ int32_t index;
+ omapi_connection_state_t state;
+ struct sockaddr_in remote_addr;
+ struct sockaddr_in local_addr;
+ omapi_addr_list_t *connect_list; /* List of addresses to which
+ to connect. */
+ int cptr; /* Current element we are connecting to. */
+ u_int32_t bytes_needed; /* Bytes of input needed before wakeup. */
+ u_int32_t in_bytes; /* Bytes of input already buffered. */
+ omapi_buffer_t *inbufs;
+ u_int32_t out_bytes; /* Bytes of output in buffers. */
+ omapi_buffer_t *outbufs;
+ omapi_listener_object_t *listener; /* Listener that accepted this
+ connection, if any. */
+ DST_KEY *in_key; /* Authenticator signing incoming
+ data. */
+ void *in_context; /* Input hash context. */
+ DST_KEY *out_key; /* Authenticator signing outgoing
+ data. */
+ void *out_context; /* Output hash context. */
+} omapi_connection_object_t;
+
+typedef struct __omapi_io_object {
+ OMAPI_OBJECT_PREAMBLE;
+ struct __omapi_io_object *next;
+ int (*readfd) (omapi_object_t *);
+ int (*writefd) (omapi_object_t *);
+ isc_result_t (*reader) (omapi_object_t *);
+ isc_result_t (*writer) (omapi_object_t *);
+ isc_result_t (*reaper) (omapi_object_t *);
+} omapi_io_object_t;
+
+typedef struct __omapi_generic_object {
+ OMAPI_OBJECT_PREAMBLE;
+ omapi_value_t **values;
+ u_int8_t *changed;
+ int nvalues, va_max;
+} omapi_generic_object_t;
+
+typedef struct __omapi_waiter_object {
+ OMAPI_OBJECT_PREAMBLE;
+ int ready;
+ isc_result_t waitstatus;
+ struct __omapi_waiter_object *next;
+} omapi_waiter_object_t;
+
+#define OMAPI_HANDLE_TABLE_SIZE 120
+
+typedef struct __omapi_handle_table {
+ omapi_handle_t first, limit;
+ omapi_handle_t next;
+ int leafp;
+ union {
+ omapi_object_t *object;
+ struct __omapi_handle_table *table;
+ } children [OMAPI_HANDLE_TABLE_SIZE];
+} omapi_handle_table_t;
+
+#include <omapip/alloc.h>
+
+OMAPI_OBJECT_ALLOC_DECL (omapi_protocol, omapi_protocol_object_t,
+ omapi_type_protocol)
+OMAPI_OBJECT_ALLOC_DECL (omapi_protocol_listener,
+ omapi_protocol_listener_object_t,
+ omapi_type_protocol_listener)
+OMAPI_OBJECT_ALLOC_DECL (omapi_connection,
+ omapi_connection_object_t, omapi_type_connection)
+OMAPI_OBJECT_ALLOC_DECL (omapi_listener,
+ omapi_listener_object_t, omapi_type_listener)
+OMAPI_OBJECT_ALLOC_DECL (omapi_io,
+ omapi_io_object_t, omapi_type_io_object)
+OMAPI_OBJECT_ALLOC_DECL (omapi_waiter,
+ omapi_waiter_object_t, omapi_type_waiter)
+OMAPI_OBJECT_ALLOC_DECL (omapi_generic,
+ omapi_generic_object_t, omapi_type_generic)
+OMAPI_OBJECT_ALLOC_DECL (omapi_message,
+ omapi_message_object_t, omapi_type_message)
+
+isc_result_t omapi_connection_sign_data (int mode,
+ DST_KEY *key,
+ void **context,
+ const unsigned char *data,
+ const unsigned len,
+ omapi_typed_data_t **result);
+isc_result_t omapi_listener_connect (omapi_connection_object_t **obj,
+ omapi_listener_object_t *listener,
+ int socket,
+ struct sockaddr_in *remote_addr);
+void omapi_listener_trace_setup (void);
+void omapi_connection_trace_setup (void);
+void omapi_buffer_trace_setup (void);
+void omapi_connection_register (omapi_connection_object_t *,
+ const char *, int);
+void trace_mr_init (void);
+
+OMAPI_ARRAY_TYPE_DECL(omapi_listener, omapi_listener_object_t);
+OMAPI_ARRAY_TYPE_DECL(omapi_connection, omapi_connection_object_t);
+
+extern int log_priority;
+extern int log_perror;
+extern void (*log_cleanup) (void);
+
+void log_fatal (const char *, ...)
+ __attribute__((__format__(__printf__,1,2)));
+int log_error (const char *, ...)
+ __attribute__((__format__(__printf__,1,2)));
+int log_info (const char *, ...)
+ __attribute__((__format__(__printf__,1,2)));
+int log_debug (const char *, ...)
+ __attribute__((__format__(__printf__,1,2)));
+void do_percentm (char *obuf, const char *ibuf);
+
+isc_result_t uerr2isc (int);
+isc_result_t ns_rcode_to_isc (int);
+
+extern omapi_message_object_t *omapi_registered_messages;
+
+#endif /* __OMAPIP_OMAPIP_P_H__ */
diff --git a/contrib/isc-dhcp/includes/omapip/trace.h b/contrib/isc-dhcp/includes/omapip/trace.h
new file mode 100644
index 000000000000..69cb3edb2ff6
--- /dev/null
+++ b/contrib/isc-dhcp/includes/omapip/trace.h
@@ -0,0 +1,124 @@
+/* trace.h
+
+ Definitions for omapi tracing facility... */
+
+/*
+ * Copyright (c) 2001 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon, as part of a project for Nominum, Inc. To learn more
+ * about the Internet Software Consortium, see http://www.isc.org/. To
+ * learn more about Nominum, Inc., see ``http://www.nominum.com''.
+ */
+
+#define TRACEFILE_MAGIC 0x64484370UL /* dHCp */
+#define TRACEFILE_VERSION 1
+
+/* The first thing in a trace file is the header, which basically just
+ defines the version of the file. */
+typedef struct {
+ u_int32_t magic; /* Magic number for trace file. */
+ u_int32_t version; /* Version of file. */
+ int32_t hlen; /* Length of this header. */
+ int32_t phlen; /* Length of packet headers. */
+} tracefile_header_t;
+
+/* The trace file is composed of a bunch of trace packets. Each such packet
+ has a type, followed by a length, followed by a timestamp, followed by
+ the actual contents of the packet. The type indexes are not fixed -
+ they are allocated either on readback or when writing a trace file.
+ One index type is reserved - type zero means that this record is a type
+ name to index mapping. */
+typedef struct {
+ u_int32_t type_index; /* Index to the type of handler that this
+ packet needs. */
+ u_int32_t length; /* Length of the packet. This includes
+ everything except the fixed header. */
+ u_int32_t when; /* When the packet was written. */
+ u_int32_t pad; /* Round this out to a quad boundary. */
+} tracepacket_t;
+
+#define TRACE_INDEX_MAPPING_SIZE 4 /* trace_index_mapping_t less name. */
+typedef struct {
+ u_int32_t index;
+ char name [1];
+} trace_index_mapping_t;
+
+struct trace_type; /* forward */
+typedef struct trace_type trace_type_t;
+
+struct trace_type {
+ trace_type_t *next;
+ int index;
+ char *name;
+ void *baggage;
+ void (*have_packet) (trace_type_t *, unsigned, char *);
+ void (*stop_tracing) (trace_type_t *);
+};
+
+typedef struct trace_iov {
+ const char *buf;
+ unsigned len;
+} trace_iov_t;
+
+typedef struct {
+ u_int16_t addrtype;
+ u_int16_t addrlen;
+ u_int8_t address [16];
+ u_int16_t port;
+} trace_addr_t;
+
+void trace_free_all (void);
+int trace_playback (void);
+int trace_record (void);
+isc_result_t trace_init (void (*set_time) (u_int32_t), const char *, int);
+isc_result_t trace_begin (const char *, const char *, int);
+isc_result_t trace_write_packet (trace_type_t *, unsigned, const char *,
+ const char *, int);
+isc_result_t trace_write_packet_iov (trace_type_t *, int, trace_iov_t *,
+ const char *, int);
+void trace_type_stash (trace_type_t *);
+trace_type_t *trace_type_register (const char *, void *,
+ void (*) (trace_type_t *,
+ unsigned, char *),
+ void (*) (trace_type_t *),
+ const char *, int);
+void trace_stop (void);
+void trace_index_map_input (trace_type_t *, unsigned, char *);
+void trace_index_stop_tracing (trace_type_t *);
+void trace_replay_init (void);
+void trace_file_replay (const char *);
+isc_result_t trace_get_next_packet (trace_type_t **, tracepacket_t *,
+ char **, unsigned *, unsigned *);
+isc_result_t trace_get_file (trace_type_t *,
+ const char *, unsigned *, char **);
+isc_result_t trace_get_packet (trace_type_t **, unsigned *, char **);
+time_t trace_snoop_time (trace_type_t **);
diff --git a/contrib/isc-dhcp/includes/osdep.h b/contrib/isc-dhcp/includes/osdep.h
index 71a985980e16..c4486e856dc2 100644
--- a/contrib/isc-dhcp/includes/osdep.h
+++ b/contrib/isc-dhcp/includes/osdep.h
@@ -3,7 +3,7 @@
Operating system dependencies... */
/*
- * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium.
+ * Copyright (c) 1996-1999 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,27 +15,35 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The Internet Software Consortium nor the names of its
- * contributors may be used to endorse or promote products derived
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
- * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
- * This software was written for the Internet Software Consortium by Ted Lemon
- * under a contract with Vixie Laboratories.
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
+#if !defined (__ISC_DHCP_OSDEP_H__)
+#define __ISC_DHCP_OSDEP_H__
+
#include "site.h"
/* Porting::
@@ -62,6 +70,9 @@
# define USE_DEFAULT_NETWORK
#endif
+#if !defined (TIME_MAX)
+# define TIME_MAX 2147483647
+#endif
/* Porting::
@@ -91,6 +102,10 @@
# include "cf/freebsd.h"
#endif
+#ifdef OpenBSD
+# include "cf/openbsd.h"
+#endif
+
#if defined (__osf__) && defined (__alpha)
# include "cf/alphaosf.h"
#endif
@@ -127,14 +142,6 @@
# endif
#endif
-#if defined(IRIX) || defined(__sgi)
-# include "cf/irix.h"
-#endif
-
-#if !defined (TIME_MAX)
-# define TIME_MAX 2147483647
-#endif
-
/* Porting::
If you add a new network API, and have it set up so that it can be
@@ -185,7 +192,9 @@
fallback. */
#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
- defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND)
+ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \
+ defined (USE_LPF_SEND) || \
+ (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE))
# define USE_SOCKET_FALLBACK
# define USE_FALLBACK
#endif
@@ -210,9 +219,7 @@
#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \
defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \
- defined (USE_DLPI_RECEIVE) || \
- defined (USE_LPF_SEND) || \
- (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE))
+ defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE)
# define PACKET_DECODING
#endif
@@ -241,6 +248,10 @@
# define BPF_FORMAT "/dev/bpf%d"
#endif
+#if defined (F_SETFD) && !defined (HAVE_SETFD)
+# define HAVE_SETFD
+#endif
+
#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
# define HAVE_IFF_POINTOPOINT
#endif
@@ -285,10 +296,17 @@
# define HAVE_SO_BINDTODEVICE
#endif
-#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR)
-# define HAVE_SIOCGIFHWADDR
-#endif
-
#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
# define HAVE_AF_LINK
#endif
+
+/* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */
+#if !defined (SHUT_RD)
+# define SHUT_RD 0
+#endif
+
+#if !defined (SOCKLEN_T)
+#define SOCKLEN_T socklen_t
+#endif
+
+#endif /* __ISC_DHCP_OSDEP_H__ */
diff --git a/contrib/isc-dhcp/includes/site.h b/contrib/isc-dhcp/includes/site.h
index 30fdb7030050..d103ef09b30a 100644
--- a/contrib/isc-dhcp/includes/site.h
+++ b/contrib/isc-dhcp/includes/site.h
@@ -26,11 +26,74 @@
/* #define DEBUG_PACKET */
-/* Define this if you want to see dumps of tree evaluations. The most
- common reason for doing this is to watch what happens with DNS name
- lookups. */
+/* Define this if you want to see dumps of expression evaluation. */
-/* #define DEBUG_EVAL */
+/* #define DEBUG_EXPRESSIONS */
+
+/* Define this if you want to see dumps of find_lease() in action. */
+
+/* #define DEBUG_FIND_LEASE */
+
+/* Define this if you want to see dumps of parsed expressions. */
+
+/* #define DEBUG_EXPRESSION_PARSE */
+
+/* Define this if you want to watch the class matching process. */
+
+/* #define DEBUG_CLASS_MATCHING */
+
+/* Define this if you want to track memory usage for the purpose of
+ noticing memory leaks quickly. */
+
+/* #define DEBUG_MEMORY_LEAKAGE */
+
+/* Define this if you want exhaustive (and very slow) checking of the
+ malloc pool for corruption. */
+
+/* #define DEBUG_MALLOC_POOL */
+
+/* Define this if you want to see a message every time a lease's state
+ changes. */
+/* #define DEBUG_LEASE_STATE_TRANSITIONS */
+
+/* Define this if you want to maintain a history of the last N operations
+ that changed reference counts on objects. This can be used to debug
+ cases where an object is dereferenced too often, or not often enough. */
+
+/* #define DEBUG_RC_HISTORY */
+
+/* Define this if you want to see the history every cycle. */
+
+/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
+
+/* This is the number of history entries to maintain - by default, 256. */
+
+/* #define RC_HISTORY_MAX 10240 */
+
+/* Define this if you want dhcpd to dump core when a non-fatal memory
+ allocation error is detected (i.e., something that would cause a
+ memory leak rather than a memory smash). */
+
+/* #define POINTER_DEBUG */
+
+/* Define this if you want debugging output for DHCP failover protocol
+ messages. */
+
+/* #define DEBUG_FAILOVER_MESSAGES */
+
+/* Define this if you want debugging output for DHCP failover protocol
+ lease assignment timing. */
+
+/* #define DEBUG_FAILOVER_TIMING */
+
+/* Define this if you want DHCP failover protocol support in the DHCP
+ server. */
+
+#define FAILOVER_PROTOCOL
+
+/* Define this if you want DNS update functionality to be available. */
+
+#define NSUPDATE
/* Define this if you want the dhcpd.pid file to go somewhere other than
the default (which varies from system to system, but is usually either
@@ -98,3 +161,14 @@
/* Define this to change the logging facility used by dhcpd. */
/* #define DHCPD_LOG_FACILITY LOG_DAEMON */
+
+/* Define this if you aren't debugging and you want to save memory
+ (potentially a _lot_ of memory) by allocating leases in chunks rather
+ than one at a time. */
+
+#define COMPACT_LEASES
+
+/* Define this if you want to be able to save and playback server operational
+ traces. */
+
+#define TRACING
diff --git a/contrib/isc-dhcp/includes/statement.h b/contrib/isc-dhcp/includes/statement.h
new file mode 100644
index 000000000000..fa865f38d719
--- /dev/null
+++ b/contrib/isc-dhcp/includes/statement.h
@@ -0,0 +1,113 @@
+/* statement.h
+
+ Definitions for executable statements... */
+
+/*
+ * Copyright (c) 1996-1999 Internet Software Consortium.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The Internet Software Consortium nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This software has been written for the Internet Software Consortium
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
+ */
+
+struct executable_statement {
+ int refcnt;
+ struct executable_statement *next;
+ enum statement_op {
+ null_statement,
+ if_statement,
+ add_statement,
+ eval_statement,
+ break_statement,
+ default_option_statement,
+ supersede_option_statement,
+ append_option_statement,
+ prepend_option_statement,
+ send_option_statement,
+ statements_statement,
+ on_statement,
+ switch_statement,
+ case_statement,
+ default_statement,
+ set_statement,
+ unset_statement,
+ let_statement,
+ define_statement,
+ log_statement,
+ return_statement
+ } op;
+ union {
+ struct {
+ struct executable_statement *tc, *fc;
+ struct expression *expr;
+ } ie;
+ struct expression *eval;
+ struct expression *retval;
+ struct class *add;
+ struct option_cache *option;
+ struct option_cache *supersede;
+ struct option_cache *prepend;
+ struct option_cache *append;
+ struct executable_statement *statements;
+ struct {
+ int evtypes;
+# define ON_COMMIT 1
+# define ON_EXPIRY 2
+# define ON_RELEASE 4
+# define ON_TRANSMISSION 8
+ struct executable_statement *statements;
+ } on;
+ struct {
+ struct expression *expr;
+ struct executable_statement *statements;
+ } s_switch;
+ struct expression *c_case;
+ struct {
+ char *name;
+ struct expression *expr;
+ struct executable_statement *statements;
+ } set, let;
+ char *unset;
+ struct {
+ enum {
+ log_priority_fatal,
+ log_priority_error,
+ log_priority_debug,
+ log_priority_info
+ } priority;
+ struct expression *expr;
+ } log;
+ } data;
+};
+
diff --git a/contrib/isc-dhcp/includes/tree.h b/contrib/isc-dhcp/includes/tree.h
index c2df41f52b11..03047f3c83fd 100644
--- a/contrib/isc-dhcp/includes/tree.h
+++ b/contrib/isc-dhcp/includes/tree.h
@@ -3,7 +3,8 @@
Definitions for address trees... */
/*
- * Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996-2001 Internet Software Consortium.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,10 +34,11 @@
* SUCH DAMAGE.
*
* This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
+ * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+ * To learn more about the Internet Software Consortium, see
+ * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
+ * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
+ * ``http://www.nominum.com''.
*/
/* A pair of pointers, suitable for making a linked list. */
@@ -45,63 +47,300 @@ typedef struct _pair {
struct _pair *cdr;
} *pair;
+struct option_chain_head {
+ int refcnt;
+ pair first;
+};
+
+struct enumeration_value {
+ const char *name;
+ u_int8_t value;
+};
+
+struct enumeration {
+ struct enumeration *next;
+ const char *name;
+ struct enumeration_value *values;
+};
+
/* Tree node types... */
#define TREE_CONCAT 1
#define TREE_HOST_LOOKUP 2
#define TREE_CONST 3
#define TREE_LIMIT 4
+#define TREE_DATA_EXPR 5
+
+/* A data buffer with a reference count. */
+struct buffer {
+ int refcnt;
+ unsigned char data [1];
+};
+
+/* XXX The mechanism by which data strings are returned is currently
+ XXX broken: rather than returning an ephemeral pointer, we create
+ XXX a reference to the data in the caller's space, which the caller
+ XXX then has to dereference - instead, the reference should be
+ XXX ephemeral by default and be made a persistent reference explicitly. */
+/* XXX on the other hand, it seems to work pretty nicely, so maybe the
+ XXX above comment is meshuggenah. */
+
+/* A string of data bytes, possibly accompanied by a larger buffer. */
+struct data_string {
+ struct buffer *buffer;
+ const unsigned char *data;
+ unsigned len; /* Does not include NUL terminator, if any. */
+ int terminated;
+};
+
+enum expression_context {
+ context_any, /* indefinite */
+ context_boolean,
+ context_data,
+ context_numeric,
+ context_dns,
+ context_data_or_numeric, /* indefinite */
+ context_function
+};
+
+struct fundef {
+ int refcnt;
+ struct string_list *args;
+ struct executable_statement *statements;
+};
+
+struct binding_value {
+ int refcnt;
+ enum {
+ binding_boolean,
+ binding_data,
+ binding_numeric,
+ binding_dns,
+ binding_function
+ } type;
+ union value {
+ struct data_string data;
+ unsigned long intval;
+ int boolean;
+#if defined (NSUPDATE)
+ ns_updrec *dns;
+#endif
+ struct fundef *fundef;
+ struct binding_value *bv;
+ } value;
+};
-/* Tree structure for deferred evaluation of changing values. */
-struct tree {
- int op;
+struct binding {
+ struct binding *next;
+ char *name;
+ struct binding_value *value;
+};
+
+struct binding_scope {
+ int refcnt;
+ struct binding_scope *outer;
+ struct binding *bindings;
+};
+
+/* Expression tree structure. */
+
+enum expr_op {
+ expr_none,
+ expr_match,
+ expr_check,
+ expr_equal,
+ expr_substring,
+ expr_suffix,
+ expr_concat,
+ expr_host_lookup,
+ expr_and,
+ expr_or,
+ expr_not,
+ expr_option,
+ expr_hardware,
+ expr_packet,
+ expr_const_data,
+ expr_extract_int8,
+ expr_extract_int16,
+ expr_extract_int32,
+ expr_encode_int8,
+ expr_encode_int16,
+ expr_encode_int32,
+ expr_const_int,
+ expr_exists,
+ expr_encapsulate,
+ expr_known,
+ expr_reverse,
+ expr_leased_address,
+ expr_binary_to_ascii,
+ expr_config_option,
+ expr_host_decl_name,
+ expr_pick_first_value,
+ expr_lease_time,
+ expr_dns_transaction,
+ expr_static,
+ expr_ns_add,
+ expr_ns_delete,
+ expr_ns_exists,
+ expr_ns_not_exists,
+ expr_not_equal,
+ expr_null,
+ expr_variable_exists,
+ expr_variable_reference,
+ expr_filename,
+ expr_sname,
+ expr_arg,
+ expr_funcall,
+ expr_function,
+ expr_add,
+ expr_subtract,
+ expr_multiply,
+ expr_divide,
+ expr_remainder,
+ expr_binary_and,
+ expr_binary_or,
+ expr_binary_xor,
+ expr_client_state
+};
+
+struct expression {
+ int refcnt;
+ enum expr_op op;
union {
- struct concat {
- struct tree *left;
- struct tree *right;
- } concat;
- struct host_lookup {
- struct dns_host_entry *host;
- } host_lookup;
- struct const_val {
- unsigned char *data;
- int len;
- } const_val;
- struct limit {
- struct tree *tree;
- int limit;
- } limit;
+ struct {
+ struct expression *expr;
+ struct expression *offset;
+ struct expression *len;
+ } substring;
+ struct expression *equal [2];
+ struct expression *and [2];
+ struct expression *or [2];
+ struct expression *not;
+ struct expression *add;
+ struct expression *subtract;
+ struct expression *multiply;
+ struct expression *divide;
+ struct expression *remainder;
+ struct collection *check;
+ struct {
+ struct expression *expr;
+ struct expression *len;
+ } suffix;
+ struct option *option;
+ struct option *config_option;
+ struct {
+ struct expression *offset;
+ struct expression *len;
+ } packet;
+ struct data_string const_data;
+ struct expression *extract_int;
+ struct expression *encode_int;
+ unsigned long const_int;
+ struct expression *concat [2];
+ struct dns_host_entry *host_lookup;
+ struct option *exists;
+ struct data_string encapsulate;
+ struct {
+ struct expression *base;
+ struct expression *width;
+ struct expression *seperator;
+ struct expression *buffer;
+ } b2a;
+ struct {
+ struct expression *width;
+ struct expression *buffer;
+ } reverse;
+ struct {
+ struct expression *car;
+ struct expression *cdr;
+ } pick_first_value;
+ struct {
+ struct expression *car;
+ struct expression *cdr;
+ } dns_transaction;
+ struct {
+ unsigned rrclass;
+ unsigned rrtype;
+ struct expression *rrname;
+ struct expression *rrdata;
+ struct expression *ttl;
+ } ns_add;
+ struct {
+ unsigned rrclass;
+ unsigned rrtype;
+ struct expression *rrname;
+ struct expression *rrdata;
+ } ns_delete, ns_exists, ns_not_exists;
+ char *variable;
+ struct {
+ struct expression *val;
+ struct expression *next;
+ } arg;
+ struct {
+ char *name;
+ struct expression *arglist;
+ } funcall;
+ struct fundef *func;
} data;
-};
+ int flags;
+# define EXPR_EPHEMERAL 1
+};
/* DNS host entry structure... */
struct dns_host_entry {
- char *hostname;
- unsigned char *data;
- int data_len;
- int buf_len;
+ int refcnt;
TIME timeout;
+ struct data_string data;
+ char hostname [1];
};
-struct tree_cache {
- unsigned char *value;
- int len;
- int buf_size;
- TIME timeout;
- struct tree *tree;
- int flags;
-#define TC_AWAITING_RESOLUTION 1
-#define TC_TEMPORARY 2
-};
+struct option_cache; /* forward */
+struct packet; /* forward */
+struct option_state; /* forward */
+struct decoded_option_state; /* forward */
+struct lease; /* forward */
+struct client_state; /* forward */
struct universe {
- char *name;
- struct hash_table *hash;
+ const char *name;
+ struct option_cache *(*lookup_func) (struct universe *,
+ struct option_state *,
+ unsigned);
+ void (*save_func) (struct universe *, struct option_state *,
+ struct option_cache *);
+ void (*foreach) (struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **, struct universe *, void *,
+ void (*) (struct option_cache *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *,
+ struct option_state *,
+ struct binding_scope **,
+ struct universe *, void *));
+ void (*delete_func) (struct universe *universe,
+ struct option_state *, int);
+ int (*option_state_dereference) (struct universe *,
+ struct option_state *,
+ const char *, int);
+ int (*decode) (struct option_state *,
+ const unsigned char *, unsigned, struct universe *);
+ int (*encapsulate) (struct data_string *, struct packet *,
+ struct lease *, struct client_state *,
+ struct option_state *, struct option_state *,
+ struct binding_scope **,
+ struct universe *);
+ void (*store_tag) PROTO ((unsigned char *, u_int32_t));
+ void (*store_length) PROTO ((unsigned char *, u_int32_t));
+ int tag_size, length_size;
+ option_hash_t *hash;
struct option *options [256];
+ struct option *enc_opt;
+ int index;
};
struct option {
- char *name;
- char *format;
+ const char *name;
+ const char *format;
struct universe *universe;
- unsigned char code;
+ unsigned code;
};
diff --git a/contrib/isc-dhcp/includes/version.h b/contrib/isc-dhcp/includes/version.h
index 45b89ff897e1..919ddc76137d 100644
--- a/contrib/isc-dhcp/includes/version.h
+++ b/contrib/isc-dhcp/includes/version.h
@@ -1,3 +1,3 @@
/* Current version of ISC DHCP Distribution. */
-#define DHCP_VERSION "2.0pl5+v3_fixes"
+#define DHCP_VERSION "V3.0.1rc6"