2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

Fix compilation errors introduced in the last set of checkins.

This commit is contained in:
Ted Lemon
2000-01-26 14:56:18 +00:00
parent 3c0b59d354
commit 4bd8800e89
57 changed files with 3721 additions and 3212 deletions

View File

@@ -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,528 @@
* 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
* $Id: nameser.h,v 1.2 2000/01/26 14:55:58 mellon Exp $
*/
#ifndef _NAMESER_H_
#define _NAMESER_H_
#ifndef _ARPA_NAMESER_H_
#define _ARPA_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 */
#define BIND_4_COMPAT
/*
* 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 */
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#else
# include <sys/types.h>
#endif
#include <sys/cdefs.h>
/*
* Currently defined response codes
* 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 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
#define __NAMESER 19991006 /* New interface version stamp. */
/*
* Type values for resources and queries
* Define constants based on RFC 883, RFC 1034, RFC 1035
*/
#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 */
#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_char *_msg, *_eom;
u_int16_t _id, _flags, _counts[ns_s_max];
const u_char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
const u_char *_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_char * 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;
int 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];
int 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
*/
#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) */
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 */
#define C_ANY 255 /* wildcard match */
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
/*
* Status return codes for T_UNSPEC conversion routines
* Inline versions of get/put short/long. Pointer is advanced.
*/
#define CONV_SUCCESS 0
#define CONV_OVERFLOW (-1)
#define CONV_BADFMT (-2)
#define CONV_BADCKSUM (-3)
#define CONV_BADBUFLEN (-4)
#define NS_GET16(s, cp) do { \
register u_char *t_cp = (u_char *)(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_char *t_cp = (u_char *)(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_char *t_cp = (u_char *)(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_char *t_cp = (u_char *)(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)
/*
* 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.
* ANSI C identifier hiding for bind's lib/nameser.
*/
#define ns_get16 __ns_get16
#define ns_get32 __ns_get32
#define ns_put16 __ns_put16
#define ns_put32 __ns_put32
#define ns_initparse __ns_initparse
#define ns_skiprr __ns_skiprr
#define ns_parserr __ns_parserr
#define ns_sprintrr __ns_sprintrr
#define ns_sprintrrf __ns_sprintrrf
#define ns_format_ttl __ns_format_ttl
#define ns_parse_ttl __ns_parse_ttl
#define ns_datetosecs __ns_datetosecs
#define ns_name_ntol __ns_name_ntol
#define ns_name_ntop __ns_name_ntop
#define ns_name_pton __ns_name_pton
#define ns_name_unpack __ns_name_unpack
#define ns_name_pack __ns_name_pack
#define ns_name_compress __ns_name_compress
#define ns_name_uncompress __ns_name_uncompress
#define ns_name_skip __ns_name_skip
#define ns_sign __ns_sign
#define ns_sign_tcp __ns_sign_tcp
#define ns_sign_tcp_init __ns_sign_tcp_init
#define ns_find_tsig __ns_find_tsig
#define ns_verify __ns_verify
#define ns_verify_tcp __ns_verify_tcp
#define ns_verify_tcp_init __ns_verify_tcp_init
#define ns_samedomain __ns_samedomain
#define ns_subdomain __ns_subdomain
#define ns_makecanon __ns_makecanon
#define ns_samename __ns_samename
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 */
__BEGIN_DECLS
u_int ns_get16 __P((const u_char *));
u_long ns_get32 __P((const u_char *));
void ns_put16 __P((u_int, u_char *));
void ns_put32 __P((u_long, u_char *));
int ns_initparse __P((const u_char *, int, ns_msg *));
int ns_skiprr __P((const u_char *, const u_char *, ns_sect, int));
int ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *));
int ns_sprintrr __P((const ns_msg *, const ns_rr *,
const char *, const char *, char *, size_t));
int ns_sprintrrf __P((const u_char *, size_t, const char *,
ns_class, ns_type, u_long, const u_char *,
size_t, const char *, const char *,
char *, size_t));
int ns_format_ttl __P((u_long, char *, size_t));
int ns_parse_ttl __P((const char *, u_long *));
u_int32_t ns_datetosecs __P((const char *cp, int *errp));
int ns_name_ntol __P((const u_char *, u_char *, size_t));
int ns_name_ntop __P((const u_char *, char *, size_t));
int ns_name_pton __P((const char *, u_char *, size_t));
int ns_name_unpack __P((const u_char *, const u_char *,
const u_char *, u_char *, size_t));
int ns_name_pack __P((const u_char *, u_char *, int,
const u_char **, const u_char **));
int ns_name_uncompress __P((const u_char *, const u_char *,
const u_char *, char *, size_t));
int ns_name_compress __P((const char *, u_char *, size_t,
const u_char **, const u_char **));
int ns_name_skip __P((const u_char **, const u_char *));
int ns_sign __P((u_char *, int *, int, int, void *,
const u_char *, int, u_char *, int *, time_t));
int ns_sign_tcp __P((u_char *, int *, int, int,
ns_tcp_tsig_state *, int));
int ns_sign_tcp_init __P((void *, const u_char *, int,
ns_tcp_tsig_state *));
u_char *ns_find_tsig __P((u_char *, u_char *));
int ns_verify __P((u_char *, int *, void *,
const u_char *, int, u_char *, int *,
time_t *, int));
int ns_verify_tcp __P((u_char *, int *, ns_tcp_tsig_state *, int));
int ns_verify_tcp_init __P((void *, const u_char *, int,
ns_tcp_tsig_state *));
int ns_samedomain __P((const char *, const char *));
int ns_subdomain __P((const char *, const char *));
int ns_makecanon __P((const char *, char *, size_t));
int ns_samename __P((const char *, const char *));
__END_DECLS
#ifdef BIND_4_COMPAT
#include <arpa/nameser_compat.h>
#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 */
};
#endif /* !_NAMESER_H_ */
#endif /* !_ARPA_NAMESER_H_ */

View File

@@ -0,0 +1,229 @@
/* 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.1 2000/01/26 14:55:58 mellon Exp $
*/
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
#define __BIND 19950621 /* (DEAD) interface version stamp. */
#ifndef BYTE_ORDER
#if (BSD >= 199103)
# include <machine/endian.h>
#else
#ifdef linux
# include <endian.h>
#else
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
defined(__alpha__) || defined(__alpha) || \
(defined(__Lynx__) && defined(__x86__))
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
defined(apollo) || defined(__convex__) || defined(_CRAY) || \
defined(__hppa) || defined(__hp9000) || \
defined(__hp9000s300) || defined(__hp9000s700) || \
defined (BIT_ZERO_ON_LEFT) || defined(m68k) || \
(defined(__Lynx__) && \
(defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif /* linux */
#endif /* BSD */
#endif /* BYTE_ORDER */
#if !defined(BYTE_ORDER) || \
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
BYTE_ORDER != PDP_ENDIAN)
/* you must determine what the correct bit order is for
* your compiler - the next line is an intentional error
* which will force your compiles to bomb until you fix
* the above macros.
*/
error "Undefined or invalid BYTE_ORDER";
#endif
/*
* 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_ */

View File

@@ -3,7 +3,7 @@
Definitions for dhcpd... */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Copyright (c) 1996-2000 Internet Software Consortium.
* Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this
@@ -27,8 +27,8 @@
#include <sys/un.h>
#include <arpa/inet.h>
#include "arpa/nameser.h"
#if defined (NSUPDATE)
# include <arpa/nameser.h>
# include <resolv.h>
# include <res_update.h>
#endif
@@ -748,48 +748,6 @@ struct dns_query {
int backoff; /* Current backoff, in seconds. */
};
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
#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;
size_t size;
const char *file;
int line;
unsigned long generation;
unsigned char low_fence [DMLFSIZE];
};
#else
#define DMDOFFSET 0
#define DMDSIZE 0
#endif
#if defined (DEBUG_RC_HISTORY)
#if !defined (RC_HISTORY_MAX)
# define RC_HISTORY_MAX 256
#endif
struct rc_history_entry {
char *name;
VOIDPTR addr;
int refcnt;
};
#define rc_register(x, l, y, z) do { \
rc_history [rc_history_index].file = (x); \
rc_history [rc_history_index].line = (l); \
rc_history [rc_history_index].addr = (y); \
rc_history [rc_history_index].refcnt = (z); \
if (++rc_history_index == RC_HISTORY_MAX) \
rc_history_index = 0;\
} while (0)
#else
#define rc_register(name, addr, refcnt)
#endif
/* Bitmask of dhcp option codes. */
typedef unsigned char option_mask [16];
@@ -895,7 +853,8 @@ void save_hashed_option PROTO ((struct universe *,
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 option_cache_dereference PROTO ((struct option_cache **,
const char *, int));
int hashed_option_state_dereference PROTO ((struct universe *,
struct option_state *));
int agent_option_state_dereference PROTO ((struct universe *,
@@ -923,28 +882,13 @@ int nwip_option_space_encapsulate PROTO ((struct data_string *,
struct binding_scope *,
struct universe *));
/* errwarn.c */
void log_fatal PROTO ((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
int log_error PROTO ((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
int log_info PROTO ((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
int log_debug PROTO ((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
int parse_warn PROTO ((struct parse *, const char *, ...))
__attribute__((__format__(__printf__,2,3)));
/* dhcpd.c */
extern TIME cur_time;
extern struct group root_group;
extern struct binding_scope global_scope;
extern struct in_addr limited_broadcast;
extern u_int16_t local_port;
extern u_int16_t remote_port;
extern int log_priority;
extern int log_perror;
extern const char *path_dhcpd_conf;
extern const char *path_dhcpd_db;
@@ -1042,12 +986,15 @@ 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 PROTO ((struct parse *, const char *, ...))
__attribute__((__format__(__printf__,2,3)));
/* tree.c */
extern struct binding_scope global_scope;
pair cons PROTO ((caddr_t, pair));
int make_const_option_cache PROTO ((struct option_cache **, struct buffer **,
u_int8_t *, unsigned, struct option *,
const char *));
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 PROTO ((struct expression **,
@@ -1062,11 +1009,13 @@ 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 *));
#if defined (NSUPDATE)
int evaluate_dns_expression PROTO ((ns_updrec **, struct packet *,
struct lease *, struct option_state *,
struct option_state *,
struct binding_scope *,
struct expression *));
#endif
int evaluate_boolean_expression PROTO ((int *,
struct packet *, struct lease *,
struct option_state *,
@@ -1087,7 +1036,8 @@ int evaluate_option_cache PROTO ((struct data_string *,
struct packet *, struct lease *,
struct option_state *, struct option_state *,
struct binding_scope *,
struct option_cache *));
struct option_cache *,
const char *, int));
int evaluate_boolean_option_cache PROTO ((int *,
struct packet *, struct lease *,
struct option_state *,
@@ -1100,9 +1050,8 @@ int evaluate_boolean_expression_result PROTO ((int *,
struct option_state *,
struct option_state *,
struct binding_scope *,
struct expression *,
const char *, int));
void expression_dereference PROTO ((struct expression **, const char *));
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 *));
@@ -1112,8 +1061,9 @@ int op_precedence PROTO ((enum expr_op, enum expr_op));
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 binding_scope_dereference 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));
/* dhcp.c */
extern int outstanding_pings;
@@ -1133,7 +1083,7 @@ struct lease *find_lease PROTO ((struct packet *,
struct lease *mockup_lease PROTO ((struct packet *,
struct shared_network *,
struct host_decl *));
void static_lease_dereference PROTO ((struct lease *, const char *));
void static_lease_dereference PROTO ((struct lease *, const char *, int));
struct lease *allocate_lease PROTO ((struct packet *, struct pool *, int));
int permitted PROTO ((struct packet *, struct permit *));
@@ -1147,32 +1097,9 @@ unsigned cons_agent_information_options PROTO ((struct option_state *,
void bootp PROTO ((struct packet *));
/* memory.c */
struct group *clone_group PROTO ((struct group *, const char *));
struct group *clone_group PROTO ((struct group *, const char *, int));
/* alloc.c */
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
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;
#endif
VOIDPTR dmalloc PROTO ((unsigned, const char *, int));
void dfree PROTO ((VOIDPTR, const char *, int));
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
void dmalloc_reuse PROTO ((VOIDPTR, const char *, int, int));
void dmalloc_dump_outstanding PROTO ((void));
#else
#define dmalloc_reuse(x,y,z)
#endif
#if defined (DEBUG_RC_HISTORY)
void dump_rc_history PROTO ((void));
#endif
struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int));
struct hash_table *new_hash_table PROTO ((int, const char *, int));
struct hash_bucket *new_hash_bucket PROTO ((const char *, int));
@@ -1449,7 +1376,7 @@ 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 *);
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 *,
@@ -1784,7 +1711,7 @@ isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1802,7 +1729,7 @@ isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1820,7 +1747,7 @@ isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1838,7 +1765,7 @@ isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1857,7 +1784,7 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_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 *);
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 *,
@@ -1873,7 +1800,7 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1889,7 +1816,7 @@ isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -1931,7 +1858,7 @@ extern struct subnet *find_subnet PROTO ((struct iaddr));
void enter_shared_network PROTO ((struct shared_network *));
void new_shared_network_interface PROTO ((struct parse *,
struct shared_network *,
const char *, int));
const char *));
int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int));
void enter_subnet PROTO ((struct subnet *));
void enter_lease PROTO ((struct lease *));
@@ -1982,7 +1909,7 @@ isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **));
isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *,
const char *));
const char *, int));
isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *,
omapi_object_t *,
omapi_object_t *));
@@ -2000,7 +1927,7 @@ isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **));
isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *,
const char *));
const char *, int));
isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *,
omapi_object_t *,
omapi_object_t *));
@@ -2016,7 +1943,7 @@ isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **));
isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *,
const char *));
const char *, int));
isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *,
omapi_object_t *,
omapi_object_t *));

View File

@@ -20,7 +20,66 @@
* http://www.isc.org for more information.
*/
isc_result_t omapi_buffer_new (omapi_buffer_t **, const char *);
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 *);
isc_result_t omapi_buffer_dereference (omapi_buffer_t **, const char *);
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)
#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
#if defined (DEBUG_RC_HISTORY)
#if !defined (RC_HISTORY_MAX)
# define RC_HISTORY_MAX 256
#endif
struct rc_history_entry {
const char *file;
int line;
VOIDPTR addr;
int refcnt;
};
#define rc_register(x, l, y, z) do { \
rc_history [rc_history_index].file = (x); \
rc_history [rc_history_index].line = (l); \
rc_history [rc_history_index].addr = (y); \
rc_history [rc_history_index].refcnt = (z); \
if (++rc_history_index == RC_HISTORY_MAX) \
rc_history_index = 0;\
} while (0)
#define rc_register_mdl(y, z) \
rc_register (__FILE__, __LINE__, y, z)
#else
#define rc_register(file, line, addr, refcnt)
#define rc_register_mdl(addr, refcnt)
#endif
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
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;
#endif

View File

@@ -57,8 +57,9 @@ typedef struct {
struct {
void *ptr;
isc_result_t (*reference) (void *,
void *, char *);
isc_result_t (*dereference) (void *, char *);
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) + \
@@ -90,7 +91,7 @@ typedef struct __omapi_object_type_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 *);
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 *,
@@ -131,7 +132,7 @@ 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 *);
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 *,
@@ -146,7 +147,8 @@ 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 *);
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 *,
@@ -170,7 +172,7 @@ isc_result_t omapi_connection_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -194,7 +196,7 @@ isc_result_t omapi_listener_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -215,7 +217,7 @@ isc_result_t omapi_io_set_value (omapi_object_t *, omapi_object_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 *);
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 *,
@@ -223,28 +225,28 @@ isc_result_t omapi_io_stuff_values (omapi_object_t *,
isc_result_t omapi_waiter_signal_handler (omapi_object_t *,
const char *, va_list);
isc_result_t omapi_generic_new (omapi_object_t **, const char *);
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 *);
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_message_new (omapi_object_t **, const char *);
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 *);
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 *,
@@ -280,7 +282,7 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **,
omapi_data_string_t *,
omapi_value_t **),
isc_result_t (*) (omapi_object_t *,
const char *),
const char *, int),
isc_result_t (*) (omapi_object_t *,
const char *,
va_list),
@@ -325,16 +327,16 @@ 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 *);
isc_result_t omapi_make_value (omapi_value_t **, omapi_data_string_t *,
omapi_typed_data_t *, const char *);
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 *);
unsigned, const char *, int);
isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *,
int, const char *);
int, const char *, int);
isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
omapi_object_t *, const char *);
omapi_object_t *, const char *, int);
isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
const char *, const char *);
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 *);
@@ -342,24 +344,52 @@ 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 *);
isc_result_t omapi_object_reference (omapi_object_t **,
omapi_object_t *, const char *);
isc_result_t omapi_object_dereference (omapi_object_t **, const char *);
isc_result_t omapi_typed_data_new (omapi_typed_data_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 *);
omapi_typed_data_t *,
const char *, int);
isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **,
const char *);
const char *, int);
isc_result_t omapi_data_string_new (omapi_data_string_t **,
unsigned, const char *);
unsigned, const char *, int);
isc_result_t omapi_data_string_reference (omapi_data_string_t **,
omapi_data_string_t *, const char *);
omapi_data_string_t *,
const char *, int);
isc_result_t omapi_data_string_dereference (omapi_data_string_t **,
const char *);
isc_result_t omapi_value_new (omapi_value_t **, const char *);
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 *);
isc_result_t omapi_value_dereference (omapi_value_t **, const char *);
omapi_value_t *, const char *, int);
isc_result_t omapi_value_dereference (omapi_value_t **, const char *, int);
void * dmalloc (unsigned, const char *, int);
void dfree (void *, const char *, int);
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
void dmalloc_reuse (void *, const char *, int, int);
void dmalloc_dump_outstanding (void);
#define MDL __FILE__, __LINE__
#else
#define dmalloc_reuse(x,y,l,z)
#define MDL (char *)0, __LINE__
#endif
#if defined (DEBUG_RC_HISTORY)
void dump_rc_history (void);
#endif
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);
#endif /* _OMAPIP_H_ */

View File

@@ -71,17 +71,17 @@
/* Define this if you want debugging output for DHCP failover protocol
messages. */
/* #define DEBUG_FAILOVER_MESSAGES */
#define DEBUG_FAILOVER_MESSAGES
/* Define this if you want debugging output for DHCP failover protocol
lease assignment timing. */
/* #define DEBUG_FAILOVER_TIMING */
#define DEBUG_FAILOVER_TIMING
/* Define this if you want DHCP failover protocol support in the DHCP
server. */
/* #define FAILOVER_PROTOCOL */
#define FAILOVER_PROTOCOL
/* 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