diff options
Diffstat (limited to 'contrib/bind9/lib/isccc')
26 files changed, 0 insertions, 3396 deletions
diff --git a/contrib/bind9/lib/isccc/Makefile.in b/contrib/bind9/lib/isccc/Makefile.in deleted file mode 100644 index cb41681..0000000 --- a/contrib/bind9/lib/isccc/Makefile.in +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") -# Copyright (C) 2001, 2003 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 ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC 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: Makefile.in,v 1.6.18.1 2004/07/20 07:03:29 marka Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -@LIBISCCC_API@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCC_INCLUDES} - -CDEFINES = -CWARNINGS = - -ISCLIBS = ../../lib/isc/libisc.@A@ -ISCCCLIBS = ../../lib/isccc/libisccc.@A@ - -ISCDEPLIBS = ../../lib/isc/libisc.@A@ -ISCCCDEPLIBS = libisccc.@A@ - -LIBS = @LIBS@ - -SUBDIRS = include - -# Alphabetically -OBJS = alist.@O@ base64.@O@ cc.@O@ ccmsg.@O@ \ - lib.@O@ \ - result.@O@ sexpr.@O@ symtab.@O@ version.@O@ - -# Alphabetically -SRCS = alist.c base64.c cc.c ccmsg.c \ - lib.c \ - result.c sexpr.c symtab.c version.c - - -TARGETS = timestamp - -@BIND9_MAKE_RULES@ - -version.@O@: version.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ - -DLIBINTERFACE=${LIBINTERFACE} \ - -DLIBREVISION=${LIBREVISION} \ - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - -libisccc.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - -libisccc.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisccc.la -rpath ${libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${LIBS} ${ISCLIBS} - -timestamp: libisccc.@A@ - touch timestamp - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} - -install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisccc.@A@ ${DESTDIR}${libdir} - -clean distclean:: - rm -f libisccc.@A@ timestamp diff --git a/contrib/bind9/lib/isccc/alist.c b/contrib/bind9/lib/isccc/alist.c deleted file mode 100644 index a8335c8..0000000 --- a/contrib/bind9/lib/isccc/alist.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: alist.c,v 1.3.18.2 2005/04/29 00:17:11 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <stdlib.h> -#include <string.h> - -#include <isccc/alist.h> -#include <isc/assertions.h> -#include <isccc/result.h> -#include <isccc/sexpr.h> -#include <isccc/util.h> - -#define CAR(s) (s)->value.as_dottedpair.car -#define CDR(s) (s)->value.as_dottedpair.cdr - -#define ALIST_TAG "*alist*" -#define MAX_INDENT 64 - -static char spaces[MAX_INDENT + 1] = - " "; - -isccc_sexpr_t * -isccc_alist_create(void) -{ - isccc_sexpr_t *alist, *tag; - - tag = isccc_sexpr_fromstring(ALIST_TAG); - if (tag == NULL) - return (NULL); - alist = isccc_sexpr_cons(tag, NULL); - if (alist == NULL) { - isccc_sexpr_free(&tag); - return (NULL); - } - - return (alist); -} - -isc_boolean_t -isccc_alist_alistp(isccc_sexpr_t *alist) -{ - isccc_sexpr_t *car; - - if (alist == NULL || alist->type != ISCCC_SEXPRTYPE_DOTTEDPAIR) - return (ISC_FALSE); - car = CAR(alist); - if (car == NULL || car->type != ISCCC_SEXPRTYPE_STRING) - return (ISC_FALSE); - if (strcmp(car->value.as_string, ALIST_TAG) != 0) - return (ISC_FALSE); - return (ISC_TRUE); -} - -isc_boolean_t -isccc_alist_emptyp(isccc_sexpr_t *alist) -{ - REQUIRE(isccc_alist_alistp(alist)); - - if (CDR(alist) == NULL) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isccc_sexpr_t * -isccc_alist_first(isccc_sexpr_t *alist) -{ - REQUIRE(isccc_alist_alistp(alist)); - - return (CDR(alist)); -} - -isccc_sexpr_t * -isccc_alist_assq(isccc_sexpr_t *alist, const char *key) -{ - isccc_sexpr_t *car, *caar; - - REQUIRE(isccc_alist_alistp(alist)); - - /* - * Skip alist type tag. - */ - alist = CDR(alist); - - while (alist != NULL) { - INSIST(alist->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - car = CAR(alist); - INSIST(car->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - caar = CAR(car); - if (caar->type == ISCCC_SEXPRTYPE_STRING && - strcmp(caar->value.as_string, key) == 0) - return (car); - alist = CDR(alist); - } - - return (NULL); -} - -void -isccc_alist_delete(isccc_sexpr_t *alist, const char *key) -{ - isccc_sexpr_t *car, *caar, *rest, *prev; - - REQUIRE(isccc_alist_alistp(alist)); - - prev = alist; - rest = CDR(alist); - while (rest != NULL) { - INSIST(rest->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - car = CAR(rest); - INSIST(car != NULL && car->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - caar = CAR(car); - if (caar->type == ISCCC_SEXPRTYPE_STRING && - strcmp(caar->value.as_string, key) == 0) { - CDR(prev) = CDR(rest); - CDR(rest) = NULL; - isccc_sexpr_free(&rest); - break; - } - prev = rest; - rest = CDR(rest); - } -} - -isccc_sexpr_t * -isccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value) -{ - isccc_sexpr_t *kv, *k, *elt; - - kv = isccc_alist_assq(alist, key); - if (kv == NULL) { - /* - * New association. - */ - k = isccc_sexpr_fromstring(key); - if (k == NULL) - return (NULL); - kv = isccc_sexpr_cons(k, value); - if (kv == NULL) { - isccc_sexpr_free(&kv); - return (NULL); - } - elt = isccc_sexpr_addtolist(&alist, kv); - if (elt == NULL) { - isccc_sexpr_free(&kv); - return (NULL); - } - } else { - /* - * We've already got an entry for this key. Replace it. - */ - isccc_sexpr_free(&CDR(kv)); - CDR(kv) = value; - } - - return (kv); -} - -isccc_sexpr_t * -isccc_alist_definestring(isccc_sexpr_t *alist, const char *key, const char *str) -{ - isccc_sexpr_t *v, *kv; - - v = isccc_sexpr_fromstring(str); - if (v == NULL) - return (NULL); - kv = isccc_alist_define(alist, key, v); - if (kv == NULL) - isccc_sexpr_free(&v); - - return (kv); -} - -isccc_sexpr_t * -isccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, isccc_region_t *r) -{ - isccc_sexpr_t *v, *kv; - - v = isccc_sexpr_frombinary(r); - if (v == NULL) - return (NULL); - kv = isccc_alist_define(alist, key, v); - if (kv == NULL) - isccc_sexpr_free(&v); - - return (kv); -} - -isccc_sexpr_t * -isccc_alist_lookup(isccc_sexpr_t *alist, const char *key) -{ - isccc_sexpr_t *kv; - - kv = isccc_alist_assq(alist, key); - if (kv != NULL) - return (CDR(kv)); - return (NULL); -} - -isc_result_t -isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) -{ - isccc_sexpr_t *kv, *v; - - kv = isccc_alist_assq(alist, key); - if (kv != NULL) { - v = CDR(kv); - if (isccc_sexpr_stringp(v)) { - if (strp != NULL) - *strp = isccc_sexpr_tostring(v); - return (ISC_R_SUCCESS); - } else - return (ISC_R_EXISTS); - } - - return (ISC_R_NOTFOUND); -} - -isc_result_t -isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, isccc_region_t **r) -{ - isccc_sexpr_t *kv, *v; - - kv = isccc_alist_assq(alist, key); - if (kv != NULL) { - v = CDR(kv); - if (isccc_sexpr_binaryp(v)) { - if (r != NULL) - *r = isccc_sexpr_tobinary(v); - return (ISC_R_SUCCESS); - } else - return (ISC_R_EXISTS); - } - - return (ISC_R_NOTFOUND); -} - -void -isccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, FILE *stream) -{ - isccc_sexpr_t *elt, *kv, *k, *v; - - if (isccc_alist_alistp(sexpr)) { - fprintf(stream, "{\n"); - indent += 4; - for (elt = isccc_alist_first(sexpr); - elt != NULL; - elt = CDR(elt)) { - kv = CAR(elt); - INSIST(isccc_sexpr_listp(kv)); - k = CAR(kv); - v = CDR(kv); - INSIST(isccc_sexpr_stringp(k)); - fprintf(stream, "%.*s%s => ", (int)indent, spaces, - isccc_sexpr_tostring(k)); - isccc_alist_prettyprint(v, indent, stream); - if (CDR(elt) != NULL) - fprintf(stream, ","); - fprintf(stream, "\n"); - } - indent -= 4; - fprintf(stream, "%.*s}", (int)indent, spaces); - } else if (isccc_sexpr_listp(sexpr)) { - fprintf(stream, "(\n"); - indent += 4; - for (elt = sexpr; - elt != NULL; - elt = CDR(elt)) { - fprintf(stream, "%.*s", (int)indent, spaces); - isccc_alist_prettyprint(CAR(elt), indent, stream); - if (CDR(elt) != NULL) - fprintf(stream, ","); - fprintf(stream, "\n"); - } - indent -= 4; - fprintf(stream, "%.*s)", (int)indent, spaces); - } else - isccc_sexpr_print(sexpr, stream); -} diff --git a/contrib/bind9/lib/isccc/api b/contrib/bind9/lib/isccc/api deleted file mode 100644 index cd8c055..0000000 --- a/contrib/bind9/lib/isccc/api +++ /dev/null @@ -1,3 +0,0 @@ -LIBINTERFACE = 30 -LIBREVISION = 1 -LIBAGE = 0 diff --git a/contrib/bind9/lib/isccc/base64.c b/contrib/bind9/lib/isccc/base64.c deleted file mode 100644 index e723cf2..0000000 --- a/contrib/bind9/lib/isccc/base64.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: base64.c,v 1.3.18.2 2005/04/29 00:17:11 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <isc/base64.h> -#include <isc/buffer.h> -#include <isc/region.h> -#include <isc/result.h> - -#include <isccc/base64.h> -#include <isccc/result.h> -#include <isccc/util.h> - -isc_result_t -isccc_base64_encode(isccc_region_t *source, int wordlength, - const char *wordbreak, isccc_region_t *target) -{ - isc_region_t sr; - isc_buffer_t tb; - isc_result_t result; - - sr.base = source->rstart; - sr.length = source->rend - source->rstart; - isc_buffer_init(&tb, target->rstart, target->rend - target->rstart); - - result = isc_base64_totext(&sr, wordlength, wordbreak, &tb); - if (result != ISC_R_SUCCESS) - return (result); - source->rstart = source->rend; - target->rstart = isc_buffer_used(&tb); - return (ISC_R_SUCCESS); -} - -isc_result_t -isccc_base64_decode(const char *cstr, isccc_region_t *target) { - isc_buffer_t b; - isc_result_t result; - - isc_buffer_init(&b, target->rstart, target->rend - target->rstart); - result = isc_base64_decodestring(cstr, &b); - if (result != ISC_R_SUCCESS) - return (result); - target->rstart = isc_buffer_used(&b); - return (ISC_R_SUCCESS); -} diff --git a/contrib/bind9/lib/isccc/cc.c b/contrib/bind9/lib/isccc/cc.c deleted file mode 100644 index e65349e..0000000 --- a/contrib/bind9/lib/isccc/cc.c +++ /dev/null @@ -1,818 +0,0 @@ -/* - * Portions Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001-2003 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: cc.c,v 1.10.18.5 2006/12/07 23:57:58 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#include <isc/assertions.h> -#include <isc/hmacmd5.h> -#include <isc/print.h> -#include <isc/stdlib.h> - -#include <isccc/alist.h> -#include <isccc/base64.h> -#include <isccc/cc.h> -#include <isccc/result.h> -#include <isccc/sexpr.h> -#include <isccc/symtab.h> -#include <isccc/symtype.h> -#include <isccc/util.h> - -#define MAX_TAGS 256 -#define DUP_LIFETIME 900 - -typedef isccc_sexpr_t *sexpr_ptr; - -static unsigned char auth_hmd5[] = { - 0x05, 0x5f, 0x61, 0x75, 0x74, 0x68, /*%< len + _auth */ - ISCCC_CCMSGTYPE_TABLE, /*%< message type */ - 0x00, 0x00, 0x00, 0x20, /*%< length == 32 */ - 0x04, 0x68, 0x6d, 0x64, 0x35, /*%< len + hmd5 */ - ISCCC_CCMSGTYPE_BINARYDATA, /*%< message type */ - 0x00, 0x00, 0x00, 0x16, /*%< length == 22 */ - /* - * The base64 encoding of one of our HMAC-MD5 signatures is - * 22 bytes. - */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -#define HMD5_OFFSET 21 /*%< 21 = 6 + 1 + 4 + 5 + 1 + 4 */ -#define HMD5_LENGTH 22 - -static isc_result_t -table_towire(isccc_sexpr_t *alist, isccc_region_t *target); - -static isc_result_t -list_towire(isccc_sexpr_t *alist, isccc_region_t *target); - -static isc_result_t -value_towire(isccc_sexpr_t *elt, isccc_region_t *target) -{ - size_t len; - unsigned char *lenp; - isccc_region_t *vr; - isc_result_t result; - - if (isccc_sexpr_binaryp(elt)) { - vr = isccc_sexpr_tobinary(elt); - len = REGION_SIZE(*vr); - if (REGION_SIZE(*target) < 1 + 4 + len) - return (ISC_R_NOSPACE); - PUT8(ISCCC_CCMSGTYPE_BINARYDATA, target->rstart); - PUT32(len, target->rstart); - if (REGION_SIZE(*target) < len) - return (ISC_R_NOSPACE); - PUT_MEM(vr->rstart, len, target->rstart); - } else if (isccc_alist_alistp(elt)) { - if (REGION_SIZE(*target) < 1 + 4) - return (ISC_R_NOSPACE); - PUT8(ISCCC_CCMSGTYPE_TABLE, target->rstart); - /* - * Emit a placeholder length. - */ - lenp = target->rstart; - PUT32(0, target->rstart); - /* - * Emit the table. - */ - result = table_towire(elt, target); - if (result != ISC_R_SUCCESS) - return (result); - len = (size_t)(target->rstart - lenp); - /* - * 'len' is 4 bytes too big, since it counts - * the placeholder length too. Adjust and - * emit. - */ - INSIST(len >= 4U); - len -= 4; - PUT32(len, lenp); - } else if (isccc_sexpr_listp(elt)) { - if (REGION_SIZE(*target) < 1 + 4) - return (ISC_R_NOSPACE); - PUT8(ISCCC_CCMSGTYPE_LIST, target->rstart); - /* - * Emit a placeholder length and count. - */ - lenp = target->rstart; - PUT32(0, target->rstart); - /* - * Emit the list. - */ - result = list_towire(elt, target); - if (result != ISC_R_SUCCESS) - return (result); - len = (size_t)(target->rstart - lenp); - /* - * 'len' is 4 bytes too big, since it counts - * the placeholder length. Adjust and emit. - */ - INSIST(len >= 4U); - len -= 4; - PUT32(len, lenp); - } - - return (ISC_R_SUCCESS); -} - -static isc_result_t -table_towire(isccc_sexpr_t *alist, isccc_region_t *target) -{ - isccc_sexpr_t *kv, *elt, *k, *v; - char *ks; - isc_result_t result; - size_t len; - - for (elt = isccc_alist_first(alist); - elt != NULL; - elt = ISCCC_SEXPR_CDR(elt)) { - kv = ISCCC_SEXPR_CAR(elt); - k = ISCCC_SEXPR_CAR(kv); - ks = isccc_sexpr_tostring(k); - v = ISCCC_SEXPR_CDR(kv); - len = strlen(ks); - INSIST(len <= 255U); - /* - * Emit the key name. - */ - if (REGION_SIZE(*target) < 1 + len) - return (ISC_R_NOSPACE); - PUT8(len, target->rstart); - PUT_MEM(ks, len, target->rstart); - /* - * Emit the value. - */ - result = value_towire(v, target); - if (result != ISC_R_SUCCESS) - return (result); - } - - return (ISC_R_SUCCESS); -} - -static isc_result_t -list_towire(isccc_sexpr_t *list, isccc_region_t *target) -{ - isc_result_t result; - - while (list != NULL) { - result = value_towire(ISCCC_SEXPR_CAR(list), target); - if (result != ISC_R_SUCCESS) - return (result); - list = ISCCC_SEXPR_CDR(list); - } - - return (ISC_R_SUCCESS); -} - -static isc_result_t -sign(unsigned char *data, unsigned int length, unsigned char *hmd5, - isccc_region_t *secret) -{ - isc_hmacmd5_t ctx; - isc_result_t result; - isccc_region_t source, target; - unsigned char digest[ISC_MD5_DIGESTLENGTH]; - unsigned char digestb64[ISC_MD5_DIGESTLENGTH * 4]; - - isc_hmacmd5_init(&ctx, secret->rstart, REGION_SIZE(*secret)); - isc_hmacmd5_update(&ctx, data, length); - isc_hmacmd5_sign(&ctx, digest); - source.rstart = digest; - source.rend = digest + ISC_MD5_DIGESTLENGTH; - target.rstart = digestb64; - target.rend = digestb64 + ISC_MD5_DIGESTLENGTH * 4; - result = isccc_base64_encode(&source, 64, "", &target); - if (result != ISC_R_SUCCESS) - return (result); - PUT_MEM(digestb64, HMD5_LENGTH, hmd5); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isccc_cc_towire(isccc_sexpr_t *alist, isccc_region_t *target, - isccc_region_t *secret) -{ - unsigned char *hmd5_rstart, *signed_rstart; - isc_result_t result; - - if (REGION_SIZE(*target) < 4 + sizeof(auth_hmd5)) - return (ISC_R_NOSPACE); - /* - * Emit protocol version. - */ - PUT32(1, target->rstart); - if (secret != NULL) { - /* - * Emit _auth section with zeroed HMAC-MD5 signature. - * We'll replace the zeros with the real signature once - * we know what it is. - */ - hmd5_rstart = target->rstart + HMD5_OFFSET; - PUT_MEM(auth_hmd5, sizeof(auth_hmd5), target->rstart); - } else - hmd5_rstart = NULL; - signed_rstart = target->rstart; - /* - * Delete any existing _auth section so that we don't try - * to encode it. - */ - isccc_alist_delete(alist, "_auth"); - /* - * Emit the message. - */ - result = table_towire(alist, target); - if (result != ISC_R_SUCCESS) - return (result); - if (secret != NULL) - return (sign(signed_rstart, (target->rstart - signed_rstart), - hmd5_rstart, secret)); - return (ISC_R_SUCCESS); -} - -static isc_result_t -verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length, - isccc_region_t *secret) -{ - isc_hmacmd5_t ctx; - isccc_region_t source; - isccc_region_t target; - isc_result_t result; - isccc_sexpr_t *_auth, *hmd5; - unsigned char digest[ISC_MD5_DIGESTLENGTH]; - unsigned char digestb64[ISC_MD5_DIGESTLENGTH * 4]; - - /* - * Extract digest. - */ - _auth = isccc_alist_lookup(alist, "_auth"); - if (_auth == NULL) - return (ISC_R_FAILURE); - hmd5 = isccc_alist_lookup(_auth, "hmd5"); - if (hmd5 == NULL) - return (ISC_R_FAILURE); - /* - * Compute digest. - */ - isc_hmacmd5_init(&ctx, secret->rstart, REGION_SIZE(*secret)); - isc_hmacmd5_update(&ctx, data, length); - isc_hmacmd5_sign(&ctx, digest); - source.rstart = digest; - source.rend = digest + ISC_MD5_DIGESTLENGTH; - target.rstart = digestb64; - target.rend = digestb64 + ISC_MD5_DIGESTLENGTH * 4; - result = isccc_base64_encode(&source, 64, "", &target); - if (result != ISC_R_SUCCESS) - return (result); - /* - * Strip trailing == and NUL terminate target. - */ - target.rstart -= 2; - *target.rstart++ = '\0'; - /* - * Verify. - */ - if (strcmp((char *)digestb64, isccc_sexpr_tostring(hmd5)) != 0) - return (ISCCC_R_BADAUTH); - - return (ISC_R_SUCCESS); -} - -static isc_result_t -table_fromwire(isccc_region_t *source, isccc_region_t *secret, - isccc_sexpr_t **alistp); - -static isc_result_t -list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp); - -static isc_result_t -value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) -{ - unsigned int msgtype; - isc_uint32_t len; - isccc_sexpr_t *value; - isccc_region_t active; - isc_result_t result; - - if (REGION_SIZE(*source) < 1 + 4) - return (ISC_R_UNEXPECTEDEND); - GET8(msgtype, source->rstart); - GET32(len, source->rstart); - if (REGION_SIZE(*source) < len) - return (ISC_R_UNEXPECTEDEND); - active.rstart = source->rstart; - active.rend = active.rstart + len; - source->rstart = active.rend; - if (msgtype == ISCCC_CCMSGTYPE_BINARYDATA) { - value = isccc_sexpr_frombinary(&active); - if (value != NULL) { - *valuep = value; - result = ISC_R_SUCCESS; - } else - result = ISC_R_NOMEMORY; - } else if (msgtype == ISCCC_CCMSGTYPE_TABLE) - result = table_fromwire(&active, NULL, valuep); - else if (msgtype == ISCCC_CCMSGTYPE_LIST) - result = list_fromwire(&active, valuep); - else - result = ISCCC_R_SYNTAX; - - return (result); -} - -static isc_result_t -table_fromwire(isccc_region_t *source, isccc_region_t *secret, - isccc_sexpr_t **alistp) -{ - char key[256]; - isc_uint32_t len; - isc_result_t result; - isccc_sexpr_t *alist, *value; - isc_boolean_t first_tag; - unsigned char *checksum_rstart; - - REQUIRE(alistp != NULL && *alistp == NULL); - - checksum_rstart = NULL; - first_tag = ISC_TRUE; - alist = isccc_alist_create(); - if (alist == NULL) - return (ISC_R_NOMEMORY); - - while (!REGION_EMPTY(*source)) { - GET8(len, source->rstart); - if (REGION_SIZE(*source) < len) { - result = ISC_R_UNEXPECTEDEND; - goto bad; - } - GET_MEM(key, len, source->rstart); - key[len] = '\0'; /* Ensure NUL termination. */ - value = NULL; - result = value_fromwire(source, &value); - if (result != ISC_R_SUCCESS) - goto bad; - if (isccc_alist_define(alist, key, value) == NULL) { - result = ISC_R_NOMEMORY; - goto bad; - } - if (first_tag && secret != NULL && strcmp(key, "_auth") == 0) - checksum_rstart = source->rstart; - first_tag = ISC_FALSE; - } - - *alistp = alist; - - if (secret != NULL) { - if (checksum_rstart != NULL) - return (verify(alist, checksum_rstart, - (source->rend - checksum_rstart), - secret)); - return (ISCCC_R_BADAUTH); - } - - return (ISC_R_SUCCESS); - - bad: - isccc_sexpr_free(&alist); - - return (result); -} - -static isc_result_t -list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) -{ - isccc_sexpr_t *list, *value; - isc_result_t result; - - list = NULL; - while (!REGION_EMPTY(*source)) { - value = NULL; - result = value_fromwire(source, &value); - if (result != ISC_R_SUCCESS) { - isccc_sexpr_free(&list); - return (result); - } - if (isccc_sexpr_addtolist(&list, value) == NULL) { - isccc_sexpr_free(&value); - isccc_sexpr_free(&list); - return (result); - } - } - - *listp = list; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp, - isccc_region_t *secret) -{ - unsigned int size; - isc_uint32_t version; - - size = REGION_SIZE(*source); - if (size < 4) - return (ISC_R_UNEXPECTEDEND); - GET32(version, source->rstart); - if (version != 1) - return (ISCCC_R_UNKNOWNVERSION); - - return (table_fromwire(source, secret, alistp)); -} - -static isc_result_t -createmessage(isc_uint32_t version, const char *from, const char *to, - isc_uint32_t serial, isccc_time_t now, - isccc_time_t expires, isccc_sexpr_t **alistp, - isc_boolean_t want_expires) -{ - isccc_sexpr_t *alist, *_ctrl, *_data; - isc_result_t result; - - REQUIRE(alistp != NULL && *alistp == NULL); - - if (version != 1) - return (ISCCC_R_UNKNOWNVERSION); - - alist = isccc_alist_create(); - if (alist == NULL) - return (ISC_R_NOMEMORY); - - result = ISC_R_NOMEMORY; - - _ctrl = isccc_alist_create(); - if (_ctrl == NULL) - goto bad; - if (isccc_alist_define(alist, "_ctrl", _ctrl) == NULL) { - isccc_sexpr_free(&_ctrl); - goto bad; - } - - _data = isccc_alist_create(); - if (_data == NULL) - goto bad; - if (isccc_alist_define(alist, "_data", _data) == NULL) { - isccc_sexpr_free(&_data); - goto bad; - } - - if (isccc_cc_defineuint32(_ctrl, "_ser", serial) == NULL || - isccc_cc_defineuint32(_ctrl, "_tim", now) == NULL || - (want_expires && - isccc_cc_defineuint32(_ctrl, "_exp", expires) == NULL)) - goto bad; - if (from != NULL && - isccc_cc_definestring(_ctrl, "_frm", from) == NULL) - goto bad; - if (to != NULL && - isccc_cc_definestring(_ctrl, "_to", to) == NULL) - goto bad; - - *alistp = alist; - - return (ISC_R_SUCCESS); - - bad: - isccc_sexpr_free(&alist); - - return (result); -} - -isc_result_t -isccc_cc_createmessage(isc_uint32_t version, const char *from, const char *to, - isc_uint32_t serial, isccc_time_t now, - isccc_time_t expires, isccc_sexpr_t **alistp) -{ - return (createmessage(version, from, to, serial, now, expires, - alistp, ISC_TRUE)); -} - -isc_result_t -isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, - isccc_sexpr_t **ackp) -{ - char *_frm, *_to; - isc_uint32_t serial; - isccc_sexpr_t *ack, *_ctrl; - isc_result_t result; - isccc_time_t t; - - REQUIRE(ackp != NULL && *ackp == NULL); - - _ctrl = isccc_alist_lookup(message, "_ctrl"); - if (_ctrl == NULL || - isccc_cc_lookupuint32(_ctrl, "_ser", &serial) != ISC_R_SUCCESS || - isccc_cc_lookupuint32(_ctrl, "_tim", &t) != ISC_R_SUCCESS) - return (ISC_R_FAILURE); - /* - * _frm and _to are optional. - */ - _frm = NULL; - (void)isccc_cc_lookupstring(_ctrl, "_frm", &_frm); - _to = NULL; - (void)isccc_cc_lookupstring(_ctrl, "_to", &_to); - /* - * Create the ack. - */ - ack = NULL; - result = createmessage(1, _to, _frm, serial, t, 0, &ack, ISC_FALSE); - if (result != ISC_R_SUCCESS) - return (result); - - _ctrl = isccc_alist_lookup(ack, "_ctrl"); - if (_ctrl == NULL) - return (ISC_R_FAILURE); - if (isccc_cc_definestring(ack, "_ack", (ok) ? "1" : "0") == NULL) { - result = ISC_R_NOMEMORY; - goto bad; - } - - *ackp = ack; - - return (ISC_R_SUCCESS); - - bad: - isccc_sexpr_free(&ack); - - return (result); -} - -isc_boolean_t -isccc_cc_isack(isccc_sexpr_t *message) -{ - isccc_sexpr_t *_ctrl; - - _ctrl = isccc_alist_lookup(message, "_ctrl"); - if (_ctrl == NULL) - return (ISC_FALSE); - if (isccc_cc_lookupstring(_ctrl, "_ack", NULL) == ISC_R_SUCCESS) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -isccc_cc_isreply(isccc_sexpr_t *message) -{ - isccc_sexpr_t *_ctrl; - - _ctrl = isccc_alist_lookup(message, "_ctrl"); - if (_ctrl == NULL) - return (ISC_FALSE); - if (isccc_cc_lookupstring(_ctrl, "_rpl", NULL) == ISC_R_SUCCESS) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_result_t -isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now, - isccc_time_t expires, isccc_sexpr_t **alistp) -{ - char *_frm, *_to, *type; - isc_uint32_t serial; - isccc_sexpr_t *alist, *_ctrl, *_data; - isc_result_t result; - - REQUIRE(alistp != NULL && *alistp == NULL); - - _ctrl = isccc_alist_lookup(message, "_ctrl"); - _data = isccc_alist_lookup(message, "_data"); - if (_ctrl == NULL || - _data == NULL || - isccc_cc_lookupuint32(_ctrl, "_ser", &serial) != ISC_R_SUCCESS || - isccc_cc_lookupstring(_data, "type", &type) != ISC_R_SUCCESS) - return (ISC_R_FAILURE); - /* - * _frm and _to are optional. - */ - _frm = NULL; - (void)isccc_cc_lookupstring(_ctrl, "_frm", &_frm); - _to = NULL; - (void)isccc_cc_lookupstring(_ctrl, "_to", &_to); - /* - * Create the response. - */ - alist = NULL; - result = isccc_cc_createmessage(1, _to, _frm, serial, now, expires, - &alist); - if (result != ISC_R_SUCCESS) - return (result); - _ctrl = isccc_alist_lookup(alist, "_ctrl"); - if (_ctrl == NULL) - return (ISC_R_FAILURE); - _data = isccc_alist_lookup(alist, "_data"); - if (_data == NULL) - return (ISC_R_FAILURE); - if (isccc_cc_definestring(_ctrl, "_rpl", "1") == NULL || - isccc_cc_definestring(_data, "type", type) == NULL) { - isccc_sexpr_free(&alist); - return (ISC_R_NOMEMORY); - } - - *alistp = alist; - - return (ISC_R_SUCCESS); -} - -isccc_sexpr_t * -isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str) -{ - size_t len; - isccc_region_t r; - - len = strlen(str); - DE_CONST(str, r.rstart); - r.rend = r.rstart + len; - - return (isccc_alist_definebinary(alist, key, &r)); -} - -isccc_sexpr_t * -isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i) -{ - char b[100]; - size_t len; - isccc_region_t r; - - snprintf(b, sizeof(b), "%u", i); - len = strlen(b); - r.rstart = (unsigned char *)b; - r.rend = (unsigned char *)b + len; - - return (isccc_alist_definebinary(alist, key, &r)); -} - -isc_result_t -isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) -{ - isccc_sexpr_t *kv, *v; - - kv = isccc_alist_assq(alist, key); - if (kv != NULL) { - v = ISCCC_SEXPR_CDR(kv); - if (isccc_sexpr_binaryp(v)) { - if (strp != NULL) - *strp = isccc_sexpr_tostring(v); - return (ISC_R_SUCCESS); - } else - return (ISC_R_EXISTS); - } - - return (ISC_R_NOTFOUND); -} - -isc_result_t -isccc_cc_lookupuint32(isccc_sexpr_t *alist, const char *key, - isc_uint32_t *uintp) -{ - isccc_sexpr_t *kv, *v; - - kv = isccc_alist_assq(alist, key); - if (kv != NULL) { - v = ISCCC_SEXPR_CDR(kv); - if (isccc_sexpr_binaryp(v)) { - if (uintp != NULL) - *uintp = (isc_uint32_t) - strtoul(isccc_sexpr_tostring(v), - NULL, 10); - return (ISC_R_SUCCESS); - } else - return (ISC_R_EXISTS); - } - - return (ISC_R_NOTFOUND); -} - -static void -symtab_undefine(char *key, unsigned int type, isccc_symvalue_t value, - void *arg) -{ - UNUSED(type); - UNUSED(value); - UNUSED(arg); - - free(key); -} - -static isc_boolean_t -symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, - void *arg) -{ - isccc_time_t *now; - - UNUSED(key); - UNUSED(type); - - now = arg; - - if (*now < value.as_uinteger) - return (ISC_FALSE); - if ((*now - value.as_uinteger) < DUP_LIFETIME) - return (ISC_FALSE); - return (ISC_TRUE); -} - -isc_result_t -isccc_cc_createsymtab(isccc_symtab_t **symtabp) -{ - return (isccc_symtab_create(11897, symtab_undefine, NULL, ISC_FALSE, - symtabp)); -} - -void -isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now) -{ - isccc_symtab_foreach(symtab, symtab_clean, &now); -} - -static isc_boolean_t -has_whitespace(const char *str) -{ - char c; - - if (str == NULL) - return (ISC_FALSE); - while ((c = *str++) != '\0') { - if (c == ' ' || c == '\t' || c == '\n') - return (ISC_TRUE); - } - return (ISC_FALSE); -} - -isc_result_t -isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message, - isccc_time_t now) -{ - const char *_frm; - const char *_to; - char *_ser, *_tim, *tmp; - isc_result_t result; - char *key; - size_t len; - isccc_symvalue_t value; - isccc_sexpr_t *_ctrl; - - _ctrl = isccc_alist_lookup(message, "_ctrl"); - if (_ctrl == NULL || - isccc_cc_lookupstring(_ctrl, "_ser", &_ser) != ISC_R_SUCCESS || - isccc_cc_lookupstring(_ctrl, "_tim", &_tim) != ISC_R_SUCCESS) - return (ISC_R_FAILURE); - /* - * _frm and _to are optional. - */ - if (isccc_cc_lookupstring(_ctrl, "_frm", &tmp) != ISC_R_SUCCESS) - _frm = ""; - else - _frm = tmp; - if (isccc_cc_lookupstring(_ctrl, "_to", &tmp) != ISC_R_SUCCESS) - _to = ""; - else - _to = tmp; - /* - * Ensure there is no newline in any of the strings. This is so - * we can write them to a file later. - */ - if (has_whitespace(_frm) || has_whitespace(_to) || - has_whitespace(_ser) || has_whitespace(_tim)) - return (ISC_R_FAILURE); - len = strlen(_frm) + strlen(_to) + strlen(_ser) + strlen(_tim) + 4; - key = malloc(len); - if (key == NULL) - return (ISC_R_NOMEMORY); - snprintf(key, len, "%s;%s;%s;%s", _frm, _to, _ser, _tim); - value.as_uinteger = now; - result = isccc_symtab_define(symtab, key, ISCCC_SYMTYPE_CCDUP, value, - isccc_symexists_reject); - if (result != ISC_R_SUCCESS) { - free(key); - return (result); - } - - return (ISC_R_SUCCESS); -} diff --git a/contrib/bind9/lib/isccc/ccmsg.c b/contrib/bind9/lib/isccc/ccmsg.c deleted file mode 100644 index d624c9b..0000000 --- a/contrib/bind9/lib/isccc/ccmsg.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: ccmsg.c,v 1.5.18.2 2005/04/29 00:17:11 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <isc/mem.h> -#include <isc/result.h> -#include <isc/task.h> -#include <isc/util.h> - -#include <isccc/events.h> -#include <isccc/ccmsg.h> - -#define CCMSG_MAGIC ISC_MAGIC('C', 'C', 'm', 's') -#define VALID_CCMSG(foo) ISC_MAGIC_VALID(foo, CCMSG_MAGIC) - -static void recv_length(isc_task_t *, isc_event_t *); -static void recv_message(isc_task_t *, isc_event_t *); - - -static void -recv_length(isc_task_t *task, isc_event_t *ev_in) { - isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; - isc_event_t *dev; - isccc_ccmsg_t *ccmsg = ev_in->ev_arg; - isc_region_t region; - isc_result_t result; - - INSIST(VALID_CCMSG(ccmsg)); - - dev = &ccmsg->event; - - if (ev->result != ISC_R_SUCCESS) { - ccmsg->result = ev->result; - goto send_and_free; - } - - /* - * Success. - */ - ccmsg->size = ntohl(ccmsg->size); - if (ccmsg->size == 0) { - ccmsg->result = ISC_R_UNEXPECTEDEND; - goto send_and_free; - } - if (ccmsg->size > ccmsg->maxsize) { - ccmsg->result = ISC_R_RANGE; - goto send_and_free; - } - - region.base = isc_mem_get(ccmsg->mctx, ccmsg->size); - region.length = ccmsg->size; - if (region.base == NULL) { - ccmsg->result = ISC_R_NOMEMORY; - goto send_and_free; - } - - isc_buffer_init(&ccmsg->buffer, region.base, region.length); - result = isc_socket_recv(ccmsg->sock, ®ion, 0, - task, recv_message, ccmsg); - if (result != ISC_R_SUCCESS) { - ccmsg->result = result; - goto send_and_free; - } - - isc_event_free(&ev_in); - return; - - send_and_free: - isc_task_send(ccmsg->task, &dev); - ccmsg->task = NULL; - isc_event_free(&ev_in); - return; -} - -static void -recv_message(isc_task_t *task, isc_event_t *ev_in) { - isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; - isc_event_t *dev; - isccc_ccmsg_t *ccmsg = ev_in->ev_arg; - - (void)task; - - INSIST(VALID_CCMSG(ccmsg)); - - dev = &ccmsg->event; - - if (ev->result != ISC_R_SUCCESS) { - ccmsg->result = ev->result; - goto send_and_free; - } - - ccmsg->result = ISC_R_SUCCESS; - isc_buffer_add(&ccmsg->buffer, ev->n); - ccmsg->address = ev->address; - - send_and_free: - isc_task_send(ccmsg->task, &dev); - ccmsg->task = NULL; - isc_event_free(&ev_in); -} - -void -isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg) { - REQUIRE(mctx != NULL); - REQUIRE(sock != NULL); - REQUIRE(ccmsg != NULL); - - ccmsg->magic = CCMSG_MAGIC; - ccmsg->size = 0; - ccmsg->buffer.base = NULL; - ccmsg->buffer.length = 0; - ccmsg->maxsize = 4294967295U; /* Largest message possible. */ - ccmsg->mctx = mctx; - ccmsg->sock = sock; - ccmsg->task = NULL; /* None yet. */ - ccmsg->result = ISC_R_UNEXPECTED; /* None yet. */ - /* - * Should probably initialize the event here, but it can wait. - */ -} - - -void -isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize) { - REQUIRE(VALID_CCMSG(ccmsg)); - - ccmsg->maxsize = maxsize; -} - - -isc_result_t -isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, - isc_task_t *task, isc_taskaction_t action, void *arg) -{ - isc_result_t result; - isc_region_t region; - - REQUIRE(VALID_CCMSG(ccmsg)); - REQUIRE(task != NULL); - REQUIRE(ccmsg->task == NULL); /* not currently in use */ - - if (ccmsg->buffer.base != NULL) { - isc_mem_put(ccmsg->mctx, ccmsg->buffer.base, - ccmsg->buffer.length); - ccmsg->buffer.base = NULL; - ccmsg->buffer.length = 0; - } - - ccmsg->task = task; - ccmsg->action = action; - ccmsg->arg = arg; - ccmsg->result = ISC_R_UNEXPECTED; /* unknown right now */ - - ISC_EVENT_INIT(&ccmsg->event, sizeof(isc_event_t), 0, 0, - ISCCC_EVENT_CCMSG, action, arg, ccmsg, - NULL, NULL); - - region.base = (unsigned char *)&ccmsg->size; - region.length = 4; /* isc_uint32_t */ - result = isc_socket_recv(ccmsg->sock, ®ion, 0, - ccmsg->task, recv_length, ccmsg); - - if (result != ISC_R_SUCCESS) - ccmsg->task = NULL; - - return (result); -} - -void -isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg) { - REQUIRE(VALID_CCMSG(ccmsg)); - - isc_socket_cancel(ccmsg->sock, NULL, ISC_SOCKCANCEL_RECV); -} - -#if 0 -void -isccc_ccmsg_freebuffer(isccc_ccmsg_t *ccmsg) { - REQUIRE(VALID_CCMSG(ccmsg)); - - if (ccmsg->buffer.base == NULL) - return; - - isc_mem_put(ccmsg->mctx, ccmsg->buffer.base, ccmsg->buffer.length); - ccmsg->buffer.base = NULL; - ccmsg->buffer.length = 0; -} -#endif - -void -isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg) { - REQUIRE(VALID_CCMSG(ccmsg)); - - ccmsg->magic = 0; - - if (ccmsg->buffer.base != NULL) { - isc_mem_put(ccmsg->mctx, ccmsg->buffer.base, - ccmsg->buffer.length); - ccmsg->buffer.base = NULL; - ccmsg->buffer.length = 0; - } -} diff --git a/contrib/bind9/lib/isccc/include/Makefile.in b/contrib/bind9/lib/isccc/include/Makefile.in deleted file mode 100644 index f3d46ab..0000000 --- a/contrib/bind9/lib/isccc/include/Makefile.in +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") -# Copyright (C) 2001 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 ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC 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: Makefile.in,v 1.3 2004/03/05 05:12:12 marka Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isccc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/contrib/bind9/lib/isccc/include/isccc/Makefile.in b/contrib/bind9/lib/isccc/include/isccc/Makefile.in deleted file mode 100644 index b7b1d55..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") -# Copyright (C) 2001 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 ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC 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: Makefile.in,v 1.5 2004/03/05 05:12:15 marka Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -# -# Only list headers that are to be installed and are not -# machine generated. The latter are handled specially in the -# install target below. -# -HEADERS = alist.h base64.h cc.h ccmsg.h events.h lib.h result.h \ - sexpr.h symtab.h symtype.h types.h util.h version.h -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isccc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${srcdir}/$$i ${DESTDIR}${includedir}/isccc ; \ - done diff --git a/contrib/bind9/lib/isccc/include/isccc/alist.h b/contrib/bind9/lib/isccc/include/isccc/alist.h deleted file mode 100644 index 16b5ba2..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/alist.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: alist.h,v 1.3.18.2 2005/04/29 00:17:12 marka Exp $ */ - -#ifndef ISCCC_ALIST_H -#define ISCCC_ALIST_H 1 - -/*! \file */ - -#include <stdio.h> - -#include <isc/lang.h> -#include <isccc/types.h> - -ISC_LANG_BEGINDECLS - -isccc_sexpr_t * -isccc_alist_create(void); - -isc_boolean_t -isccc_alist_alistp(isccc_sexpr_t *alist); - -isc_boolean_t -isccc_alist_emptyp(isccc_sexpr_t *alist); - -isccc_sexpr_t * -isccc_alist_first(isccc_sexpr_t *alist); - -isccc_sexpr_t * -isccc_alist_assq(isccc_sexpr_t *alist, const char *key); - -void -isccc_alist_delete(isccc_sexpr_t *alist, const char *key); - -isccc_sexpr_t * -isccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value); - -isccc_sexpr_t * -isccc_alist_definestring(isccc_sexpr_t *alist, const char *key, const char *str); - -isccc_sexpr_t * -isccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, isccc_region_t *r); - -isccc_sexpr_t * -isccc_alist_lookup(isccc_sexpr_t *alist, const char *key); - -isc_result_t -isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp); - -isc_result_t -isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, isccc_region_t **r); - -void -isccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, FILE *stream); - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_ALIST_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/base64.h b/contrib/bind9/lib/isccc/include/isccc/base64.h deleted file mode 100644 index dd70e8d..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/base64.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: base64.h,v 1.3.18.2 2005/04/29 00:17:13 marka Exp $ */ - -#ifndef ISCCC_BASE64_H -#define ISCCC_BASE64_H 1 - -/*! \file */ - -#include <isc/lang.h> -#include <isccc/types.h> - -ISC_LANG_BEGINDECLS - -/*** - *** Functions - ***/ - -isc_result_t -isccc_base64_encode(isccc_region_t *source, int wordlength, - const char *wordbreak, isccc_region_t *target); -/*%< - * Convert data into base64 encoded text. - * - * Notes: - *\li The base64 encoded text in 'target' will be divided into - * words of at most 'wordlength' characters, separated by - * the 'wordbreak' string. No parentheses will surround - * the text. - * - * Requires: - *\li 'source' is a region containing binary data. - *\li 'target' is a text region containing available space. - *\li 'wordbreak' points to a null-terminated string of - * zero or more whitespace characters. - */ - -isc_result_t -isccc_base64_decode(const char *cstr, isccc_region_t *target); -/*%< - * Decode a null-terminated base64 string. - * - * Requires: - *\li 'cstr' is non-null. - *\li 'target' is a valid region. - * - * Returns: - *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' - * fit in 'target'. - *\li #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding. - *\li #ISC_R_NOSPACE -- 'target' is not big enough. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_BASE64_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/cc.h b/contrib/bind9/lib/isccc/include/isccc/cc.h deleted file mode 100644 index 2e291ea..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/cc.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: cc.h,v 1.4.18.2 2005/04/29 00:17:13 marka Exp $ */ - -#ifndef ISCCC_CC_H -#define ISCCC_CC_H 1 - -/*! \file */ - -#include <isc/lang.h> -#include <isccc/types.h> - -ISC_LANG_BEGINDECLS - -/*% Maximum Datagram Package */ -#define ISCCC_CC_MAXDGRAMPACKET 4096 - -/*% Message Type String */ -#define ISCCC_CCMSGTYPE_STRING 0x00 -/*% Message Type Binary Data */ -#define ISCCC_CCMSGTYPE_BINARYDATA 0x01 -/*% Message Type Table */ -#define ISCCC_CCMSGTYPE_TABLE 0x02 -/*% Message Type List */ -#define ISCCC_CCMSGTYPE_LIST 0x03 - -/*% Send to Wire */ -isc_result_t -isccc_cc_towire(isccc_sexpr_t *alist, isccc_region_t *target, - isccc_region_t *secret); - -/*% Get From Wire */ -isc_result_t -isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp, - isccc_region_t *secret); - -/*% Create Message */ -isc_result_t -isccc_cc_createmessage(isc_uint32_t version, const char *from, const char *to, - isc_uint32_t serial, isccc_time_t now, - isccc_time_t expires, isccc_sexpr_t **alistp); - -/*% Create Acknowledgment */ -isc_result_t -isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, - isccc_sexpr_t **ackp); - -/*% Is Ack? */ -isc_boolean_t -isccc_cc_isack(isccc_sexpr_t *message); - -/*% Is Reply? */ -isc_boolean_t -isccc_cc_isreply(isccc_sexpr_t *message); - -/*% Create Response */ -isc_result_t -isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now, - isccc_time_t expires, isccc_sexpr_t **alistp); - -/*% Define String */ -isccc_sexpr_t * -isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str); - -/*% Define uint 32 */ -isccc_sexpr_t * -isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i); - -/*% Lookup String */ -isc_result_t -isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp); - -/*% Lookup uint 32 */ -isc_result_t -isccc_cc_lookupuint32(isccc_sexpr_t *alist, const char *key, - isc_uint32_t *uintp); - -/*% Create Symbol Table */ -isc_result_t -isccc_cc_createsymtab(isccc_symtab_t **symtabp); - -/*% Clean up Symbol Table */ -void -isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now); - -/*% Check for Duplicates */ -isc_result_t -isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message, - isccc_time_t now); - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_CC_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/ccmsg.h b/contrib/bind9/lib/isccc/include/isccc/ccmsg.h deleted file mode 100644 index 372047d..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/ccmsg.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: ccmsg.h,v 1.4.18.2 2005/04/29 00:17:13 marka Exp $ */ - -#ifndef ISCCC_CCMSG_H -#define ISCCC_CCMSG_H 1 - -/*! \file */ - -#include <isc/buffer.h> -#include <isc/lang.h> -#include <isc/socket.h> - -/*% ISCCC Message Structure */ -typedef struct isccc_ccmsg { - /* private (don't touch!) */ - unsigned int magic; - isc_uint32_t size; - isc_buffer_t buffer; - unsigned int maxsize; - isc_mem_t *mctx; - isc_socket_t *sock; - isc_task_t *task; - isc_taskaction_t action; - void *arg; - isc_event_t event; - /* public (read-only) */ - isc_result_t result; - isc_sockaddr_t address; -} isccc_ccmsg_t; - -ISC_LANG_BEGINDECLS - -void -isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg); -/*% - * Associate a cc message state with a given memory context and - * TCP socket. - * - * Requires: - * - *\li "mctx" and "sock" be non-NULL and valid types. - * - *\li "sock" be a read/write TCP socket. - * - *\li "ccmsg" be non-NULL and an uninitialized or invalidated structure. - * - * Ensures: - * - *\li "ccmsg" is a valid structure. - */ - -void -isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize); -/*% - * Set the maximum packet size to "maxsize" - * - * Requires: - * - *\li "ccmsg" be valid. - * - *\li 512 <= "maxsize" <= 4294967296 - */ - -isc_result_t -isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, - isc_task_t *task, isc_taskaction_t action, void *arg); -/*% - * Schedule an event to be delivered when a command channel message is - * readable, or when an error occurs on the socket. - * - * Requires: - * - *\li "ccmsg" be valid. - * - *\li "task", "taskaction", and "arg" be valid. - * - * Returns: - * - *\li #ISC_R_SUCCESS -- no error - *\li Anything that the isc_socket_recv() call can return. XXXMLG - * - * Notes: - * - *\li The event delivered is a fully generic event. It will contain no - * actual data. The sender will be a pointer to the isccc_ccmsg_t. - * The result code inside that structure should be checked to see - * what the final result was. - */ - -void -isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg); -/*% - * Cancel a readmessage() call. The event will still be posted with a - * CANCELED result code. - * - * Requires: - * - *\li "ccmsg" be valid. - */ - -void -isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg); -/*% - * Clean up all allocated state, and invalidate the structure. - * - * Requires: - * - *\li "ccmsg" be valid. - * - * Ensures: - * - *\li "ccmsg" is invalidated and disassociated with all memory contexts, - * sockets, etc. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_CCMSG_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/events.h b/contrib/bind9/lib/isccc/include/isccc/events.h deleted file mode 100644 index 0ac365f..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/events.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: events.h,v 1.3.18.2 2005/04/29 00:17:13 marka Exp $ */ - -#ifndef ISCCC_EVENTS_H -#define ISCCC_EVENTS_H 1 - -/*! \file */ - -#include <isc/eventclass.h> - -/*% - * Registry of ISCCC event numbers. - */ - -#define ISCCC_EVENT_CCMSG (ISC_EVENTCLASS_ISCCC + 0) - -#define ISCCC_EVENT_FIRSTEVENT (ISC_EVENTCLASS_ISCCC + 0) -#define ISCCC_EVENT_LASTEVENT (ISC_EVENTCLASS_ISCCC + 65535) - -#endif /* ISCCC_EVENTS_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/lib.h b/contrib/bind9/lib/isccc/include/isccc/lib.h deleted file mode 100644 index 247267c..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/lib.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: lib.h,v 1.4.18.2 2005/04/29 00:17:13 marka Exp $ */ - -#ifndef ISCCC_LIB_H -#define ISCCC_LIB_H 1 - -/*! \file */ - -#include <isc/types.h> -#include <isc/lang.h> - -ISC_LANG_BEGINDECLS - -LIBISCCC_EXTERNAL_DATA extern isc_msgcat_t *isccc_msgcat; - -void -isccc_lib_initmsgcat(void); -/*% - * Initialize the ISCCC library's message catalog, isccc_msgcat, if it - * has not already been initialized. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_LIB_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/result.h b/contrib/bind9/lib/isccc/include/isccc/result.h deleted file mode 100644 index 6fbc298..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/result.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001, 2003 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: result.h,v 1.5.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_RESULT_H -#define ISCCC_RESULT_H 1 - -/*! \file */ - -#include <isc/lang.h> -#include <isc/resultclass.h> -#include <isc/result.h> - -#include <isccc/types.h> - -/*% Unknown Version */ -#define ISCCC_R_UNKNOWNVERSION (ISC_RESULTCLASS_ISCCC + 0) -/*% Syntax Error */ -#define ISCCC_R_SYNTAX (ISC_RESULTCLASS_ISCCC + 1) -/*% Bad Authorization */ -#define ISCCC_R_BADAUTH (ISC_RESULTCLASS_ISCCC + 2) -/*% Expired */ -#define ISCCC_R_EXPIRED (ISC_RESULTCLASS_ISCCC + 3) -/*% Clock Skew */ -#define ISCCC_R_CLOCKSKEW (ISC_RESULTCLASS_ISCCC + 4) -/*% Duplicate */ -#define ISCCC_R_DUPLICATE (ISC_RESULTCLASS_ISCCC + 5) - -#define ISCCC_R_NRESULTS 6 /*%< Number of results */ - -ISC_LANG_BEGINDECLS - -const char * -isccc_result_totext(isc_result_t result); -/*% - * Convert a isccc_result_t into a string message describing the result. - */ - -void -isccc_result_register(void); - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_RESULT_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/sexpr.h b/contrib/bind9/lib/isccc/include/isccc/sexpr.h deleted file mode 100644 index cb1d297..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/sexpr.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: sexpr.h,v 1.4.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_SEXPR_H -#define ISCCC_SEXPR_H 1 - -/*! \file */ - -#include <stdio.h> - -#include <isc/lang.h> -#include <isccc/types.h> - -ISC_LANG_BEGINDECLS - -/*% dotted pair structure */ -struct isccc_dottedpair { - isccc_sexpr_t *car; - isccc_sexpr_t *cdr; -}; - -/*% iscc_sexpr structure */ -struct isccc_sexpr { - unsigned int type; - union { - char * as_string; - isccc_dottedpair_t as_dottedpair; - isccc_region_t as_region; - } value; -}; - -#define ISCCC_SEXPRTYPE_NONE 0x00 /*%< Illegal. */ -#define ISCCC_SEXPRTYPE_T 0x01 -#define ISCCC_SEXPRTYPE_STRING 0x02 -#define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03 -#define ISCCC_SEXPRTYPE_BINARY 0x04 - -#define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car -#define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr - -isccc_sexpr_t * -isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr); - -isccc_sexpr_t * -isccc_sexpr_tconst(void); - -isccc_sexpr_t * -isccc_sexpr_fromstring(const char *str); - -isccc_sexpr_t * -isccc_sexpr_frombinary(const isccc_region_t *region); - -void -isccc_sexpr_free(isccc_sexpr_t **sexprp); - -void -isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream); - -isccc_sexpr_t * -isccc_sexpr_car(isccc_sexpr_t *list); - -isccc_sexpr_t * -isccc_sexpr_cdr(isccc_sexpr_t *list); - -void -isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car); - -void -isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr); - -isccc_sexpr_t * -isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2); - -isc_boolean_t -isccc_sexpr_listp(isccc_sexpr_t *sexpr); - -isc_boolean_t -isccc_sexpr_emptyp(isccc_sexpr_t *sexpr); - -isc_boolean_t -isccc_sexpr_stringp(isccc_sexpr_t *sexpr); - -isc_boolean_t -isccc_sexpr_binaryp(isccc_sexpr_t *sexpr); - -char * -isccc_sexpr_tostring(isccc_sexpr_t *sexpr); - -isccc_region_t * -isccc_sexpr_tobinary(isccc_sexpr_t *sexpr); - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_SEXPR_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/symtab.h b/contrib/bind9/lib/isccc/include/isccc/symtab.h deleted file mode 100644 index 5b11a01..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/symtab.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: symtab.h,v 1.3.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_SYMTAB_H -#define ISCCC_SYMTAB_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file - * \brief - * Provides a simple memory-based symbol table. - * - * Keys are C strings. A type may be specified when looking up, - * defining, or undefining. A type value of 0 means "match any type"; - * any other value will only match the given type. - * - * It's possible that a client will attempt to define a <key, type, - * value> tuple when a tuple with the given key and type already - * exists in the table. What to do in this case is specified by the - * client. Possible policies are: - * - *\li isccc_symexists_reject Disallow the define, returning #ISC_R_EXISTS - *\li isccc_symexists_replace Replace the old value with the new. The - * undefine action (if provided) will be called - * with the old <key, type, value> tuple. - *\li isccc_symexists_add Add the new tuple, leaving the old tuple in - * the table. Subsequent lookups will retrieve - * the most-recently-defined tuple. - * - * A lookup of a key using type 0 will return the most-recently - * defined symbol with that key. An undefine of a key using type 0 - * will undefine the most-recently defined symbol with that key. - * Trying to define a key with type 0 is illegal. - * - * The symbol table library does not make a copy the key field, so the - * caller must ensure that any key it passes to isccc_symtab_define() - * will not change until it calls isccc_symtab_undefine() or - * isccc_symtab_destroy(). - * - * A user-specified action will be called (if provided) when a symbol - * is undefined. It can be used to free memory associated with keys - * and/or values. - */ - -/*** - *** Imports. - ***/ - -#include <isc/lang.h> -#include <isccc/types.h> - -/*** - *** Symbol Tables. - ***/ - -typedef union isccc_symvalue { - void * as_pointer; - int as_integer; - unsigned int as_uinteger; -} isccc_symvalue_t; - -typedef void (*isccc_symtabundefaction_t)(char *key, unsigned int type, - isccc_symvalue_t value, void *userarg); - -typedef isc_boolean_t (*isccc_symtabforeachaction_t)(char *key, - unsigned int type, - isccc_symvalue_t value, - void *userarg); - -typedef enum { - isccc_symexists_reject = 0, - isccc_symexists_replace = 1, - isccc_symexists_add = 2 -} isccc_symexists_t; - -ISC_LANG_BEGINDECLS - -isc_result_t -isccc_symtab_create(unsigned int size, - isccc_symtabundefaction_t undefine_action, void *undefine_arg, - isc_boolean_t case_sensitive, isccc_symtab_t **symtabp); - -void -isccc_symtab_destroy(isccc_symtab_t **symtabp); - -isc_result_t -isccc_symtab_lookup(isccc_symtab_t *symtab, const char *key, unsigned int type, - isccc_symvalue_t *value); - -isc_result_t -isccc_symtab_define(isccc_symtab_t *symtab, char *key, unsigned int type, - isccc_symvalue_t value, isccc_symexists_t exists_policy); - -isc_result_t -isccc_symtab_undefine(isccc_symtab_t *symtab, const char *key, unsigned int type); - -void -isccc_symtab_foreach(isccc_symtab_t *symtab, isccc_symtabforeachaction_t action, - void *arg); - -ISC_LANG_ENDDECLS - -#endif /* ISCCC_SYMTAB_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/symtype.h b/contrib/bind9/lib/isccc/include/isccc/symtype.h deleted file mode 100644 index e72ae92..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/symtype.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: symtype.h,v 1.3.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_SYMTYPE_H -#define ISCCC_SYMTYPE_H 1 - -/*! \file */ - -#define ISCCC_SYMTYPE_ZONESTATS 0x0001 -#define ISCCC_SYMTYPE_CCDUP 0x0002 -#define ISCCC_SYMTYPE_TELLSERVICE 0x0003 -#define ISCCC_SYMTYPE_TELLRESPONSE 0x0004 - -#endif /* ISCCC_SYMTYPE_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/types.h b/contrib/bind9/lib/isccc/include/isccc/types.h deleted file mode 100644 index f46d257..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/types.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: types.h,v 1.3.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_TYPES_H -#define ISCCC_TYPES_H 1 - -/*! \file */ - -#include <isc/boolean.h> -#include <isc/int.h> -#include <isc/result.h> - -/*% isccc_time_t typedef */ -typedef isc_uint32_t isccc_time_t; - -/*% isccc_sexpr_t typedef */ -typedef struct isccc_sexpr isccc_sexpr_t; -/*% isccc_dottedpair_t typedef */ -typedef struct isccc_dottedpair isccc_dottedpair_t; -/*% isccc_symtab_t typedef */ -typedef struct isccc_symtab isccc_symtab_t; - -/*% iscc region structure */ -typedef struct isccc_region { - unsigned char * rstart; - unsigned char * rend; -} isccc_region_t; - -#endif /* ISCCC_TYPES_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/util.h b/contrib/bind9/lib/isccc/include/isccc/util.h deleted file mode 100644 index 7662483..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/util.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: util.h,v 1.4.18.2 2005/04/29 00:17:14 marka Exp $ */ - -#ifndef ISCCC_UTIL_H -#define ISCCC_UTIL_H 1 - -#include <isc/util.h> - -/*! \file - * \brief - * Macros for dealing with unaligned numbers. - * - * \note no side effects are allowed when invoking these macros! - */ - -#define GET8(v, w) \ - do { \ - v = *w; \ - w++; \ - } while (0) - -#define GET16(v, w) \ - do { \ - v = (unsigned int)w[0] << 8; \ - v |= (unsigned int)w[1]; \ - w += 2; \ - } while (0) - -#define GET24(v, w) \ - do { \ - v = (unsigned int)w[0] << 16; \ - v |= (unsigned int)w[1] << 8; \ - v |= (unsigned int)w[2]; \ - w += 3; \ - } while (0) - -#define GET32(v, w) \ - do { \ - v = (unsigned int)w[0] << 24; \ - v |= (unsigned int)w[1] << 16; \ - v |= (unsigned int)w[2] << 8; \ - v |= (unsigned int)w[3]; \ - w += 4; \ - } while (0) - -#define GET64(v, w) \ - do { \ - v = (isc_uint64_t)w[0] << 56; \ - v |= (isc_uint64_t)w[1] << 48; \ - v |= (isc_uint64_t)w[2] << 40; \ - v |= (isc_uint64_t)w[3] << 32; \ - v |= (isc_uint64_t)w[4] << 24; \ - v |= (isc_uint64_t)w[5] << 16; \ - v |= (isc_uint64_t)w[6] << 8; \ - v |= (isc_uint64_t)w[7]; \ - w += 8; \ - } while (0) - -#define GETC16(v, w, d) \ - do { \ - GET8(v, w); \ - if (v == 0) \ - d = ISCCC_TRUE; \ - else { \ - d = ISCCC_FALSE; \ - if (v == 255) \ - GET16(v, w); \ - } \ - } while (0) - -#define GETC32(v, w) \ - do { \ - GET24(v, w); \ - if (v == 0xffffffu) \ - GET32(v, w); \ - } while (0) - -#define GET_OFFSET(v, w) GET32(v, w) - -#define GET_MEM(v, c, w) \ - do { \ - memcpy(v, w, c); \ - w += c; \ - } while (0) - -#define GET_TYPE(v, w) \ - do { \ - GET8(v, w); \ - if (v > 127) { \ - if (v < 255) \ - v = ((v & 0x7f) << 16) | ISCCC_RDATATYPE_SIG; \ - else \ - GET32(v, w); \ - } \ - } while (0) - -#define PUT8(v, w) \ - do { \ - *w = (v & 0x000000ffU); \ - w++; \ - } while (0) - -#define PUT16(v, w) \ - do { \ - w[0] = (v & 0x0000ff00U) >> 8; \ - w[1] = (v & 0x000000ffU); \ - w += 2; \ - } while (0) - -#define PUT24(v, w) \ - do { \ - w[0] = (v & 0x00ff0000U) >> 16; \ - w[1] = (v & 0x0000ff00U) >> 8; \ - w[2] = (v & 0x000000ffU); \ - w += 3; \ - } while (0) - -#define PUT32(v, w) \ - do { \ - w[0] = (v & 0xff000000U) >> 24; \ - w[1] = (v & 0x00ff0000U) >> 16; \ - w[2] = (v & 0x0000ff00U) >> 8; \ - w[3] = (v & 0x000000ffU); \ - w += 4; \ - } while (0) - -#define PUT64(v, w) \ - do { \ - w[0] = (v & 0xff00000000000000ULL) >> 56; \ - w[1] = (v & 0x00ff000000000000ULL) >> 48; \ - w[2] = (v & 0x0000ff0000000000ULL) >> 40; \ - w[3] = (v & 0x000000ff00000000ULL) >> 32; \ - w[4] = (v & 0x00000000ff000000ULL) >> 24; \ - w[5] = (v & 0x0000000000ff0000ULL) >> 16; \ - w[6] = (v & 0x000000000000ff00ULL) >> 8; \ - w[7] = (v & 0x00000000000000ffULL); \ - w += 8; \ - } while (0) - -#define PUTC16(v, w) \ - do { \ - if (v > 0 && v < 255) \ - PUT8(v, w); \ - else { \ - PUT8(255, w); \ - PUT16(v, w); \ - } \ - } while (0) - -#define PUTC32(v, w) \ - do { \ - if (v < 0xffffffU) \ - PUT24(v, w); \ - else { \ - PUT24(0xffffffU, w); \ - PUT32(v, w); \ - } \ - } while (0) - -#define PUT_OFFSET(v, w) PUT32(v, w) - -#include <string.h> - -#define PUT_MEM(s, c, w) \ - do { \ - memcpy(w, s, c); \ - w += c; \ - } while (0) - -/* - * Regions. - */ -#define REGION_SIZE(r) ((unsigned int)((r).rend - (r).rstart)) -#define REGION_EMPTY(r) ((r).rstart == (r).rend) -#define REGION_FROMSTRING(r, s) do { \ - (r).rstart = (unsigned char *)s; \ - (r).rend = (r).rstart + strlen(s); \ -} while (0) - -/*% - * Use this to remove the const qualifier of a variable to assign it to - * a non-const variable or pass it as a non-const function argument ... - * but only when you are sure it won't then be changed! - * This is necessary to sometimes shut up some compilers - * (as with gcc -Wcast-qual) when there is just no other good way to avoid the - * situation. - */ -#define DE_CONST(konst, var) \ - do { \ - union { const void *k; void *v; } _u; \ - _u.k = konst; \ - var = _u.v; \ - } while (0) - -#endif /* ISCCC_UTIL_H */ diff --git a/contrib/bind9/lib/isccc/include/isccc/version.h b/contrib/bind9/lib/isccc/include/isccc/version.h deleted file mode 100644 index b82ed8b..0000000 --- a/contrib/bind9/lib/isccc/include/isccc/version.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 2001 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 ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC 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: version.h,v 1.3.18.2 2005/04/29 00:17:15 marka Exp $ */ - -/*! \file */ - -#include <isc/platform.h> - -LIBISCCC_EXTERNAL_DATA extern const char isccc_version[]; - -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libinterface; -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_librevision; -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libage; diff --git a/contrib/bind9/lib/isccc/lib.c b/contrib/bind9/lib/isccc/lib.c deleted file mode 100644 index bef2d9a..0000000 --- a/contrib/bind9/lib/isccc/lib.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: lib.c,v 1.4.18.2 2005/04/29 00:17:12 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <stddef.h> - -#include <isc/once.h> -#include <isc/msgcat.h> -#include <isc/util.h> - -#include <isccc/lib.h> - -/*** - *** Globals - ***/ - -LIBISCCC_EXTERNAL_DATA isc_msgcat_t * isccc_msgcat = NULL; - - -/*** - *** Private - ***/ - -static isc_once_t msgcat_once = ISC_ONCE_INIT; - - -/*** - *** Functions - ***/ - -static void -open_msgcat(void) { - isc_msgcat_open("libisccc.cat", &isccc_msgcat); -} - -void -isccc_lib_initmsgcat(void) { - - /* - * Initialize the DNS library's message catalog, isccc_msgcat, if it - * has not already been initialized. - */ - - RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS); -} diff --git a/contrib/bind9/lib/isccc/result.c b/contrib/bind9/lib/isccc/result.c deleted file mode 100644 index 974e51b..0000000 --- a/contrib/bind9/lib/isccc/result.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001, 2003 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: result.c,v 1.5.18.2 2005/04/29 00:17:12 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <isc/once.h> -#include <isc/util.h> - -#include <isccc/result.h> -#include <isccc/lib.h> - -static const char *text[ISCCC_R_NRESULTS] = { - "unknown version", /* 1 */ - "syntax error", /* 2 */ - "bad auth", /* 3 */ - "expired", /* 4 */ - "clock skew", /* 5 */ - "duplicate" /* 6 */ -}; - -#define ISCCC_RESULT_RESULTSET 2 - -static isc_once_t once = ISC_ONCE_INIT; - -static void -initialize_action(void) { - isc_result_t result; - - result = isc_result_register(ISC_RESULTCLASS_ISCCC, ISCCC_R_NRESULTS, - text, isccc_msgcat, - ISCCC_RESULT_RESULTSET); - if (result != ISC_R_SUCCESS) - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_result_register() failed: %u", result); -} - -static void -initialize(void) { - isccc_lib_initmsgcat(); - RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); -} - -const char * -isccc_result_totext(isc_result_t result) { - initialize(); - - return (isc_result_totext(result)); -} - -void -isccc_result_register(void) { - initialize(); -} diff --git a/contrib/bind9/lib/isccc/sexpr.c b/contrib/bind9/lib/isccc/sexpr.c deleted file mode 100644 index 573a63c..0000000 --- a/contrib/bind9/lib/isccc/sexpr.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: sexpr.c,v 1.4.18.2 2005/04/29 00:17:12 marka Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <ctype.h> -#include <stdlib.h> -#include <string.h> - -#include <isc/assertions.h> -#include <isccc/sexpr.h> -#include <isccc/util.h> - -static isccc_sexpr_t sexpr_t = { ISCCC_SEXPRTYPE_T, { NULL } }; - -#define CAR(s) (s)->value.as_dottedpair.car -#define CDR(s) (s)->value.as_dottedpair.cdr - -isccc_sexpr_t * -isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr) -{ - isccc_sexpr_t *sexpr; - - sexpr = malloc(sizeof(*sexpr)); - if (sexpr == NULL) - return (NULL); - sexpr->type = ISCCC_SEXPRTYPE_DOTTEDPAIR; - CAR(sexpr) = car; - CDR(sexpr) = cdr; - - return (sexpr); -} - -isccc_sexpr_t * -isccc_sexpr_tconst(void) -{ - return (&sexpr_t); -} - -isccc_sexpr_t * -isccc_sexpr_fromstring(const char *str) -{ - isccc_sexpr_t *sexpr; - - sexpr = malloc(sizeof(*sexpr)); - if (sexpr == NULL) - return (NULL); - sexpr->type = ISCCC_SEXPRTYPE_STRING; - sexpr->value.as_string = strdup(str); - if (sexpr->value.as_string == NULL) { - free(sexpr); - return (NULL); - } - - return (sexpr); -} - -isccc_sexpr_t * -isccc_sexpr_frombinary(const isccc_region_t *region) -{ - isccc_sexpr_t *sexpr; - unsigned int region_size; - - sexpr = malloc(sizeof(*sexpr)); - if (sexpr == NULL) - return (NULL); - sexpr->type = ISCCC_SEXPRTYPE_BINARY; - region_size = REGION_SIZE(*region); - /* - * We add an extra byte when we malloc so we can NUL terminate - * the binary data. This allows the caller to use it as a C - * string. It's up to the caller to ensure this is safe. We don't - * add 1 to the length of the binary region, because the NUL is - * not part of the binary data. - */ - sexpr->value.as_region.rstart = malloc(region_size + 1); - if (sexpr->value.as_region.rstart == NULL) { - free(sexpr); - return (NULL); - } - sexpr->value.as_region.rend = sexpr->value.as_region.rstart + - region_size; - memcpy(sexpr->value.as_region.rstart, region->rstart, region_size); - /* - * NUL terminate. - */ - sexpr->value.as_region.rstart[region_size] = '\0'; - - return (sexpr); -} - -void -isccc_sexpr_free(isccc_sexpr_t **sexprp) -{ - isccc_sexpr_t *sexpr; - isccc_sexpr_t *item; - - sexpr = *sexprp; - if (sexpr == NULL) - return; - switch (sexpr->type) { - case ISCCC_SEXPRTYPE_STRING: - free(sexpr->value.as_string); - break; - case ISCCC_SEXPRTYPE_DOTTEDPAIR: - item = CAR(sexpr); - if (item != NULL) - isccc_sexpr_free(&item); - item = CDR(sexpr); - if (item != NULL) - isccc_sexpr_free(&item); - break; - case ISCCC_SEXPRTYPE_BINARY: - free(sexpr->value.as_region.rstart); - break; - } - free(sexpr); - - *sexprp = NULL; -} - -static isc_boolean_t -printable(isccc_region_t *r) -{ - unsigned char *curr; - - curr = r->rstart; - while (curr != r->rend) { - if (!isprint(*curr)) - return (ISC_FALSE); - curr++; - } - - return (ISC_TRUE); -} - -void -isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) -{ - isccc_sexpr_t *cdr; - unsigned int size, i; - unsigned char *curr; - - if (sexpr == NULL) { - fprintf(stream, "nil"); - return; - } - - switch (sexpr->type) { - case ISCCC_SEXPRTYPE_T: - fprintf(stream, "t"); - break; - case ISCCC_SEXPRTYPE_STRING: - fprintf(stream, "\"%s\"", sexpr->value.as_string); - break; - case ISCCC_SEXPRTYPE_DOTTEDPAIR: - fprintf(stream, "("); - do { - isccc_sexpr_print(CAR(sexpr), stream); - cdr = CDR(sexpr); - if (cdr != NULL) { - fprintf(stream, " "); - if (cdr->type != ISCCC_SEXPRTYPE_DOTTEDPAIR) { - fprintf(stream, ". "); - isccc_sexpr_print(cdr, stream); - cdr = NULL; - } - } - sexpr = cdr; - } while (sexpr != NULL); - fprintf(stream, ")"); - break; - case ISCCC_SEXPRTYPE_BINARY: - size = REGION_SIZE(sexpr->value.as_region); - curr = sexpr->value.as_region.rstart; - if (printable(&sexpr->value.as_region)) { - fprintf(stream, "'%.*s'", (int)size, curr); - } else { - fprintf(stream, "0x"); - for (i = 0; i < size; i++) - fprintf(stream, "%02x", *curr++); - } - break; - default: - INSIST(0); - } -} - -isccc_sexpr_t * -isccc_sexpr_car(isccc_sexpr_t *list) -{ - REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - - return (CAR(list)); -} - -isccc_sexpr_t * -isccc_sexpr_cdr(isccc_sexpr_t *list) -{ - REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - - return (CDR(list)); -} - -void -isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car) -{ - REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - - CAR(pair) = car; -} - -void -isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr) -{ - REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - - CDR(pair) = cdr; -} - -isccc_sexpr_t * -isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) -{ - isccc_sexpr_t *last, *elt, *l1; - - REQUIRE(l1p != NULL); - l1 = *l1p; - REQUIRE(l1 == NULL || l1->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); - - elt = isccc_sexpr_cons(l2, NULL); - if (elt == NULL) - return (NULL); - if (l1 == NULL) { - *l1p = elt; - return (elt); - } - for (last = l1; CDR(last) != NULL; last = CDR(last)) - /* Nothing */; - CDR(last) = elt; - - return (elt); -} - -isc_boolean_t -isccc_sexpr_listp(isccc_sexpr_t *sexpr) -{ - if (sexpr == NULL || sexpr->type == ISCCC_SEXPRTYPE_DOTTEDPAIR) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -isccc_sexpr_emptyp(isccc_sexpr_t *sexpr) -{ - if (sexpr == NULL) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -isccc_sexpr_stringp(isccc_sexpr_t *sexpr) -{ - if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_STRING) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -isccc_sexpr_binaryp(isccc_sexpr_t *sexpr) -{ - if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY) - return (ISC_TRUE); - return (ISC_FALSE); -} - -char * -isccc_sexpr_tostring(isccc_sexpr_t *sexpr) -{ - REQUIRE(sexpr != NULL && - (sexpr->type == ISCCC_SEXPRTYPE_STRING || - sexpr->type == ISCCC_SEXPRTYPE_BINARY)); - - if (sexpr->type == ISCCC_SEXPRTYPE_BINARY) - return ((char *)sexpr->value.as_region.rstart); - return (sexpr->value.as_string); -} - -isccc_region_t * -isccc_sexpr_tobinary(isccc_sexpr_t *sexpr) -{ - REQUIRE(sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY); - return (&sexpr->value.as_region); -} diff --git a/contrib/bind9/lib/isccc/symtab.c b/contrib/bind9/lib/isccc/symtab.c deleted file mode 100644 index 7ec6d55..0000000 --- a/contrib/bind9/lib/isccc/symtab.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Portions Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (C) 2001 Internet Software Consortium. - * Portions Copyright (C) 2001 Nominum, Inc. - * - * Permission to use, copy, modify, and/or 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 ISC AND NOMINUM DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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: symtab.c,v 1.5.18.4 2007/09/13 23:46:26 tbox Exp $ */ - -/*! \file */ - -#include <config.h> - -#include <ctype.h> -#include <stdlib.h> - -#include <isc/assertions.h> -#include <isc/magic.h> -#include <isc/string.h> - -#include <isccc/result.h> -#include <isccc/symtab.h> -#include <isccc/util.h> - -typedef struct elt { - char * key; - unsigned int type; - isccc_symvalue_t value; - ISC_LINK(struct elt) link; -} elt_t; - -typedef ISC_LIST(elt_t) eltlist_t; - -#define SYMTAB_MAGIC ISC_MAGIC('S', 'y', 'm', 'T') -#define VALID_SYMTAB(st) ISC_MAGIC_VALID(st, SYMTAB_MAGIC) - -struct isccc_symtab { - unsigned int magic; - unsigned int size; - eltlist_t * table; - isccc_symtabundefaction_t undefine_action; - void * undefine_arg; - isc_boolean_t case_sensitive; -}; - -isc_result_t -isccc_symtab_create(unsigned int size, - isccc_symtabundefaction_t undefine_action, - void *undefine_arg, - isc_boolean_t case_sensitive, - isccc_symtab_t **symtabp) -{ - isccc_symtab_t *symtab; - unsigned int i; - - REQUIRE(symtabp != NULL && *symtabp == NULL); - REQUIRE(size > 0); /* Should be prime. */ - - symtab = malloc(sizeof(*symtab)); - if (symtab == NULL) - return (ISC_R_NOMEMORY); - symtab->table = malloc(size * sizeof(eltlist_t)); - if (symtab->table == NULL) { - free(symtab); - return (ISC_R_NOMEMORY); - } - for (i = 0; i < size; i++) - ISC_LIST_INIT(symtab->table[i]); - symtab->size = size; - symtab->undefine_action = undefine_action; - symtab->undefine_arg = undefine_arg; - symtab->case_sensitive = case_sensitive; - symtab->magic = SYMTAB_MAGIC; - - *symtabp = symtab; - - return (ISC_R_SUCCESS); -} - -static inline void -free_elt(isccc_symtab_t *symtab, unsigned int bucket, elt_t *elt) { - ISC_LIST_UNLINK(symtab->table[bucket], elt, link); - if (symtab->undefine_action != NULL) - (symtab->undefine_action)(elt->key, elt->type, elt->value, - symtab->undefine_arg); - free(elt); -} - -void -isccc_symtab_destroy(isccc_symtab_t **symtabp) { - isccc_symtab_t *symtab; - unsigned int i; - elt_t *elt, *nelt; - - REQUIRE(symtabp != NULL); - symtab = *symtabp; - REQUIRE(VALID_SYMTAB(symtab)); - - for (i = 0; i < symtab->size; i++) { - for (elt = ISC_LIST_HEAD(symtab->table[i]); - elt != NULL; - elt = nelt) { - nelt = ISC_LIST_NEXT(elt, link); - free_elt(symtab, i, elt); - } - } - free(symtab->table); - symtab->magic = 0; - free(symtab); - - *symtabp = NULL; -} - -static inline unsigned int -hash(const char *key, isc_boolean_t case_sensitive) { - const char *s; - unsigned int h = 0; - unsigned int g; - int c; - - /* - * P. J. Weinberger's hash function, adapted from p. 436 of - * _Compilers: Principles, Techniques, and Tools_, Aho, Sethi - * and Ullman, Addison-Wesley, 1986, ISBN 0-201-10088-6. - */ - - if (case_sensitive) { - for (s = key; *s != '\0'; s++) { - h = ( h << 4 ) + *s; - if ((g = ( h & 0xf0000000 )) != 0) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - } else { - for (s = key; *s != '\0'; s++) { - c = *s; - c = tolower((unsigned char)c); - h = ( h << 4 ) + c; - if ((g = ( h & 0xf0000000 )) != 0) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - } - - return (h); -} - -#define FIND(s, k, t, b, e) \ - b = hash((k), (s)->case_sensitive) % (s)->size; \ - if ((s)->case_sensitive) { \ - for (e = ISC_LIST_HEAD((s)->table[b]); \ - e != NULL; \ - e = ISC_LIST_NEXT(e, link)) { \ - if (((t) == 0 || e->type == (t)) && \ - strcmp(e->key, (k)) == 0) \ - break; \ - } \ - } else { \ - for (e = ISC_LIST_HEAD((s)->table[b]); \ - e != NULL; \ - e = ISC_LIST_NEXT(e, link)) { \ - if (((t) == 0 || e->type == (t)) && \ - strcasecmp(e->key, (k)) == 0) \ - break; \ - } \ - } - -isc_result_t -isccc_symtab_lookup(isccc_symtab_t *symtab, const char *key, unsigned int type, - isccc_symvalue_t *value) -{ - unsigned int bucket; - elt_t *elt; - - REQUIRE(VALID_SYMTAB(symtab)); - REQUIRE(key != NULL); - - FIND(symtab, key, type, bucket, elt); - - if (elt == NULL) - return (ISC_R_NOTFOUND); - - if (value != NULL) - *value = elt->value; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isccc_symtab_define(isccc_symtab_t *symtab, char *key, unsigned int type, - isccc_symvalue_t value, isccc_symexists_t exists_policy) -{ - unsigned int bucket; - elt_t *elt; - - REQUIRE(VALID_SYMTAB(symtab)); - REQUIRE(key != NULL); - REQUIRE(type != 0); - - FIND(symtab, key, type, bucket, elt); - - if (exists_policy != isccc_symexists_add && elt != NULL) { - if (exists_policy == isccc_symexists_reject) - return (ISC_R_EXISTS); - INSIST(exists_policy == isccc_symexists_replace); - ISC_LIST_UNLINK(symtab->table[bucket], elt, link); - if (symtab->undefine_action != NULL) - (symtab->undefine_action)(elt->key, elt->type, - elt->value, - symtab->undefine_arg); - } else { - elt = malloc(sizeof(*elt)); - if (elt == NULL) - return (ISC_R_NOMEMORY); - ISC_LINK_INIT(elt, link); - } - - elt->key = key; - elt->type = type; - elt->value = value; - - /* - * We prepend so that the most recent definition will be found. - */ - ISC_LIST_PREPEND(symtab->table[bucket], elt, link); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isccc_symtab_undefine(isccc_symtab_t *symtab, const char *key, unsigned int type) { - unsigned int bucket; - elt_t *elt; - - REQUIRE(VALID_SYMTAB(symtab)); - REQUIRE(key != NULL); - - FIND(symtab, key, type, bucket, elt); - - if (elt == NULL) - return (ISC_R_NOTFOUND); - - free_elt(symtab, bucket, elt); - - return (ISC_R_SUCCESS); -} - -void -isccc_symtab_foreach(isccc_symtab_t *symtab, isccc_symtabforeachaction_t action, - void *arg) -{ - unsigned int i; - elt_t *elt, *nelt; - - REQUIRE(VALID_SYMTAB(symtab)); - REQUIRE(action != NULL); - - for (i = 0; i < symtab->size; i++) { - for (elt = ISC_LIST_HEAD(symtab->table[i]); - elt != NULL; - elt = nelt) { - nelt = ISC_LIST_NEXT(elt, link); - if ((action)(elt->key, elt->type, elt->value, arg)) - free_elt(symtab, i, elt); - } - } -} diff --git a/contrib/bind9/lib/isccc/version.c b/contrib/bind9/lib/isccc/version.c deleted file mode 100644 index 0d65dcb..0000000 --- a/contrib/bind9/lib/isccc/version.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2001 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 ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC 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: version.c,v 1.3.18.2 2005/04/29 00:17:12 marka Exp $ */ - -/*! \file */ - -#include <isccc/version.h> - -const char isccc_version[] = VERSION; - -const unsigned int isccc_libinterface = LIBINTERFACE; -const unsigned int isccc_librevision = LIBREVISION; -const unsigned int isccc_libage = LIBAGE; |