import resolver portion of bind-9.4.0-rc2

This commit is contained in:
christos 2007-01-27 21:45:34 +00:00
parent 16317a9d71
commit 8e42b6c984
8 changed files with 145 additions and 83 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: assertions.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/* $NetBSD: assertions.h,v 1.1.1.2 2007/01/27 21:45:34 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -18,7 +18,7 @@
*/
/*
* Id: assertions.h,v 1.1.206.1 2004/03/09 08:33:30 marka Exp
* Id: assertions.h,v 1.2.18.1 2005/04/27 05:00:50 sra Exp
*/
#ifndef ASSERTIONS_H
@ -31,18 +31,20 @@ typedef enum {
typedef void (*assertion_failure_callback)(const char *, int, assertion_type,
const char *, int);
/* coverity[+kill] */
extern assertion_failure_callback __assertion_failed;
void set_assertion_failure_callback(assertion_failure_callback f);
const char *assertion_type_to_text(assertion_type type);
#ifdef CHECK_ALL
#if defined(CHECK_ALL) || defined(__COVERITY__)
#define CHECK_REQUIRE 1
#define CHECK_ENSURE 1
#define CHECK_INSIST 1
#define CHECK_INVARIANT 1
#endif
#ifdef CHECK_NONE
#if defined(CHECK_NONE) && !defined(__COVERITY__)
#define CHECK_REQUIRE 0
#define CHECK_ENSURE 0
#define CHECK_INSIST 0
@ -120,5 +122,5 @@ const char *assertion_type_to_text(assertion_type type);
#define INVARIANT(cond) ((void) (cond))
#define INVARIANT_ERR(cond) ((void) (cond))
#endif /* CHECK_INVARIANT */
#endif /* ASSERTIONS_H */
/*! \file */

View File

@ -1,19 +1,18 @@
/* $NetBSD: dst.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/* $NetBSD: dst.h,v 1.1.1.2 2007/01/27 21:45:34 christos Exp $ */
#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 */
u_int32_t dk_flags; /* and the flags of the public key */
u_int16_t dk_id; /* identifier of the 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 */
u_int32_t dk_flags; /*%< and the flags of the public key */
u_int16_t dk_id; /*%< identifier of the key */
} DST_KEY;
#endif /* HAS_DST_KEY */
/*
* do not taint namespace
*/
@ -61,58 +60,47 @@ typedef struct dst_key {
void dst_init(void);
int dst_check_algorithm(const int);
int dst_sign_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be signed */
const int, /* length of input data */
u_char *, /* buffer to write signature to */
const int); /* size of output buffer */
int dst_verify_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /* the key to use */
void **, /* pointer to state structure */
const u_char *, /* data to be verified */
const int, /* length of input data */
const u_char *, /* buffer containing signature */
const int); /* length of signature */
DST_KEY *dst_read_key(const char *, /* name of key */
const u_int16_t, /* key tag identifier */
const int, /* key algorithm */
const int); /* Private/PublicKey wanted*/
int dst_write_key(const DST_KEY *, /* key to write out */
const int); /* Public/Private */
DST_KEY *dst_dnskey_to_key(const char *, /* KEY record name */
const u_char *, /* KEY RDATA */
const int); /* size of input buffer*/
int dst_key_to_dnskey(const DST_KEY *, /* key to translate */
u_char *, /* output buffer */
const int); /* size of out_storage*/
DST_KEY *dst_buffer_to_key(const char *, /* name of the key */
const int, /* algorithm */
const int, /* dns flags */
const int, /* dns protocol */
const u_char *, /* key in dns wire fmt */
const int); /* size of key */
int dst_sign_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /*!< the key to use */
void **, /*!< pointer to state structure */
const u_char *, /*!< data to be signed */
const int, /*!< length of input data */
u_char *, /*!< buffer to write signature to */
const int); /*!< size of output buffer */
int dst_verify_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
DST_KEY *, /*!< the key to use */
void **, /*!< pointer to state structure */
const u_char *, /*!< data to be verified */
const int, /*!< length of input data */
const u_char *, /*!< buffer containing signature */
const int); /*!< length of signature */
DST_KEY *dst_read_key(const char *, /*!< name of key */
const u_int16_t, /*!< key tag identifier */
const int, /*!< key algorithm */
const int); /*!< Private/PublicKey wanted */
int dst_write_key(const DST_KEY *, /*!< key to write out */
const int); /*!< Public/Private */
DST_KEY *dst_dnskey_to_key(const char *, /*!< KEY record name */
const u_char *, /*!< KEY RDATA */
const int); /*!< size of input buffer */
int dst_key_to_dnskey(const DST_KEY *, /*!< key to translate */
u_char *, /*!< output buffer */
const int); /*!< size of out_storage */
DST_KEY *dst_buffer_to_key(const char *, /*!< name of the key */
const int, /*!< algorithm */
const int, /*!< dns flags */
const int, /*!< dns protocol */
const u_char *, /*!< key in dns wire fmt */
const int); /*!< size of key */
int dst_key_to_buffer(DST_KEY *, u_char *, int);
DST_KEY *dst_generate_key(const char *, /* name of new key */
const int, /* key algorithm to generate */
const int, /* size of new key */
const int, /* alg dependent parameter*/
const int, /* key DNS flags */
const int); /* key DNS protocol */
DST_KEY *dst_generate_key(const char *, /*!< name of new key */
const int, /*!< key algorithm to generate */
const int, /*!< size of new key */
const int, /*!< alg dependent parameter */
const int, /*!< key DNS flags */
const int); /*!< key DNS protocol */
DST_KEY *dst_free_key(DST_KEY *);
int dst_compare_keys(const DST_KEY *, const DST_KEY *);
@ -124,13 +112,12 @@ u_int16_t dst_s_dns_key_id(const u_char *, const int);
u_int16_t dst_s_id_calc(const u_char *, const int);
/* Used by callers as well as by the library. */
#define RAW_KEY_SIZE 8192 /* large enough to store any key */
#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 /* initialize digest */
#define SIG_MODE_UPDATE 2 /* add data to digest */
#define SIG_MODE_FINAL 4 /* generate/verify signature */
#define SIG_MODE_INIT 1 /*%< initialize 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() */
@ -180,3 +167,4 @@ u_int16_t dst_s_id_calc(const u_char *, const int);
#define UNSUPPORTED_KEYALG (-31)
#endif /* DST_H */
/*! \file */

View File

@ -1,4 +1,4 @@
/* $NetBSD: eventlib.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/* $NetBSD: eventlib.h,v 1.1.1.2 2007/01/27 21:45:35 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -20,7 +20,7 @@
/* eventlib.h - exported interfaces for eventlib
* vix 09sep95 [initial]
*
* Id: eventlib.h,v 1.1.2.1.4.1 2004/03/09 08:33:31 marka Exp
* Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp
*/
#ifndef _EVENTLIB_H
@ -78,6 +78,8 @@ typedef struct { unsigned char mask[256/8]; } evByteMask;
#define EV_WRITE 2
#define EV_EXCEPT 4
#define EV_WASNONBLOCKING 8 /* Internal library use. */
/* eventlib.c */
#define evCreate __evCreate
#define evSetDebug __evSetDebug
@ -200,3 +202,5 @@ int evDefer __P((evContext, evWaitFunc, void *));
#endif
#endif /*_EVENTLIB_H*/
/*! \file */

View File

@ -1,4 +1,4 @@
/* $NetBSD: heap.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/* $NetBSD: heap.h,v 1.1.1.2 2007/01/27 21:45:35 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -47,3 +47,5 @@ int heap_increased(heap_context, int);
int heap_decreased(heap_context, int);
void * heap_element(heap_context, int);
int heap_for_each(heap_context, heap_for_each_func, void *);
/*! \file */

View File

@ -1,4 +1,4 @@
/* $NetBSD: memcluster.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
/* $NetBSD: memcluster.h,v 1.1.1.2 2007/01/27 21:45:35 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -49,3 +49,4 @@ void memstats(FILE *);
int memactive(void);
#endif /* MEMCLUSTER_H */
/*! \file */

View File

@ -1,7 +1,7 @@
/* $NetBSD: eventlib_p.h,v 1.1.1.1 2004/05/20 19:34:32 christos Exp $ */
/* $NetBSD: eventlib_p.h,v 1.1.1.2 2007/01/27 21:45:37 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-1999 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@ -17,10 +17,11 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* eventlib_p.h - private interfaces for eventlib
* vix 09sep95 [initial]
/*! \file
* \brief private interfaces for eventlib
* \author vix 09sep95 [initial]
*
* Id: eventlib_p.h,v 1.3.2.1.4.1 2004/03/09 08:33:43 marka Exp
* Id: eventlib_p.h,v 1.5.18.4 2006/03/10 00:20:08 marka Exp
*/
#ifndef _EVENTLIB_P_H
@ -47,6 +48,8 @@
#define EV_MASK_ALL (EV_READ | EV_WRITE | EV_EXCEPT)
#define EV_ERR(e) return (errno = (e), -1)
#define OK(x) if ((x) < 0) EV_ERR(errno); else (void)NULL
#define OKFREE(x, y) if ((x) < 0) { FREE((y)); EV_ERR(errno); } \
else (void)NULL
#define NEW(p) if (((p) = memget(sizeof *(p))) != NULL) \
FILL(p); \
@ -65,14 +68,21 @@
#define FILL(p)
#endif
#ifdef USE_POLL
#ifdef HAVE_STROPTS_H
#include <stropts.h>
#endif
#include <poll.h>
#endif /* USE_POLL */
typedef struct evConn {
evConnFunc func;
void * uap;
int fd;
int flags;
#define EV_CONN_LISTEN 0x0001 /* Connection is a listener. */
#define EV_CONN_SELECTED 0x0002 /* evSelectFD(conn->file). */
#define EV_CONN_BLOCK 0x0004 /* Listener fd was blocking. */
#define EV_CONN_LISTEN 0x0001 /*%< Connection is a listener. */
#define EV_CONN_SELECTED 0x0002 /*%< evSelectFD(conn->file). */
#define EV_CONN_BLOCK 0x0004 /*%< Listener fd was blocking. */
evFileID file;
struct evConn * prev;
struct evConn * next;
@ -119,7 +129,7 @@ typedef struct evStream {
evFileID file;
evTimerID timer;
int flags;
#define EV_STR_TIMEROK 0x0001 /* IFF timer valid. */
#define EV_STR_TIMEROK 0x0001 /*%< IFF timer valid. */
int fd;
struct iovec * iovOrig;
int iovOrigCount;
@ -168,6 +178,40 @@ typedef struct evEvent_p {
} u;
} evEvent_p;
#ifdef USE_POLL
typedef struct {
void *ctx; /* pointer to the evContext_p */
uint32_t type; /* READ, WRITE, EXCEPT, nonblk */
uint32_t result; /* 1 => revents, 0 => events */
} __evEmulMask;
#define emulMaskInit(ctx, field, ev, lastnext) \
ctx->field.ctx = ctx; \
ctx->field.type = ev; \
ctx->field.result = lastnext;
extern short *__fd_eventfield(int fd, __evEmulMask *maskp);
extern short __poll_event(__evEmulMask *maskp);
extern void __fd_clr(int fd, __evEmulMask *maskp);
extern void __fd_set(int fd, __evEmulMask *maskp);
#undef FD_ZERO
#define FD_ZERO(maskp)
#undef FD_SET
#define FD_SET(fd, maskp) \
__fd_set(fd, maskp)
#undef FD_CLR
#define FD_CLR(fd, maskp) \
__fd_clr(fd, maskp)
#undef FD_ISSET
#define FD_ISSET(fd, maskp) \
((*__fd_eventfield(fd, maskp) & __poll_event(maskp)) != 0)
#endif /* USE_POLL */
typedef struct {
/* Global. */
const evEvent_p *cur;
@ -179,12 +223,26 @@ typedef struct {
LIST(evAccept) accepts;
/* Files. */
evFile *files, *fdNext;
#ifndef USE_POLL
fd_set rdLast, rdNext;
fd_set wrLast, wrNext;
fd_set exLast, exNext;
fd_set nonblockBefore;
int fdMax, fdCount, highestFD;
evFile *fdTable[FD_SETSIZE];
#else
struct pollfd *pollfds; /* Allocated as needed */
evFile **fdTable; /* Ditto */
int maxnfds; /* # elements in above */
int firstfd; /* First active fd */
int fdMax; /* Last active fd */
int fdCount; /* # fd:s with I/O */
int highestFD; /* max fd allowed by OS */
__evEmulMask rdLast, rdNext;
__evEmulMask wrLast, wrNext;
__evEmulMask exLast, exNext;
__evEmulMask nonblockBefore;
#endif /* USE_POLL */
#ifdef EVENTLIB_TIME_CHECKS
struct timespec lastSelectTime;
int lastFdCount;
@ -205,6 +263,10 @@ typedef struct {
void evPrintf(const evContext_p *ctx, int level, const char *fmt, ...)
ISC_FORMAT_PRINTF(3, 4);
#ifdef USE_POLL
extern int evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd);
#endif /* USE_POLL */
/* ev_timers.c */
#define evCreateTimers __evCreateTimers
heap_context evCreateTimers(const evContext_p *);
@ -216,6 +278,6 @@ void evDestroyTimers(const evContext_p *);
evWait *evFreeWait(evContext_p *ctx, evWait *old);
/* Global options */
int __evOptMonoTime;
extern int __evOptMonoTime;
#endif /*_EVENTLIB_P_H*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_debug.h,v 1.1.1.1 2004/05/20 17:18:55 christos Exp $ */
/* $NetBSD: res_debug.h,v 1.1.1.2 2007/01/27 21:45:38 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -34,3 +34,4 @@
#endif
#endif /* _RES_DEBUG_H_ */
/*! \file */

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_private.h,v 1.1.1.1 2004/05/20 17:18:54 christos Exp $ */
/* $NetBSD: res_private.h,v 1.1.1.2 2007/01/27 21:45:39 christos Exp $ */
#ifndef res_private_h
#define res_private_h
@ -20,3 +20,5 @@ extern int
res_ourserver_p(const res_state statp, const struct sockaddr *sa);
#endif
/*! \file */