From 1a69a1a78cfaa86f3b68bbc965232b7876d4da2a Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 8 May 2000 14:38:29 +0000 Subject: [PATCH] Megacommit of dozens of files. Cleanup of redundant/useless header file inclusion. ISC style lint, primarily for function declarations and standalone comments -- ie, those that appear on a line without any code, which should be written as follows: /* * This is a comment. */ --- bin/dig/dig.c | 26 +- bin/dig/dighost.c | 21 +- bin/dig/host.c | 28 +- bin/dnssec/dnssec-keygen.c | 44 +- bin/dnssec/dnssec-makekeyset.c | 46 +- bin/dnssec/dnssec-signkey.c | 26 +- bin/dnssec/dnssec-signzone.c | 60 +-- bin/lwresd/client.c | 49 +- bin/lwresd/err_pkt.c | 19 +- bin/lwresd/main.c | 11 +- bin/lwresd/process_gabn.c | 33 +- bin/lwresd/process_gnba.c | 21 +- bin/lwresd/process_noop.c | 15 +- bin/named/aclconf.c | 26 +- bin/named/client.c | 14 +- bin/named/include/named/aclconf.h | 6 +- bin/named/include/named/client.h | 102 ++-- bin/named/include/named/globals.h | 9 +- bin/named/include/named/interfacemgr.h | 21 +- bin/named/include/named/listenlist.h | 7 +- bin/named/include/named/log.h | 19 +- bin/named/include/named/logconf.h | 6 +- bin/named/include/named/main.h | 6 +- bin/named/include/named/notify.h | 3 +- bin/named/include/named/omapi.h | 4 + bin/named/include/named/query.h | 6 +- bin/named/include/named/server.h | 6 +- bin/named/include/named/tkeyconf.h | 4 +- bin/named/include/named/tsigconf.h | 1 - bin/named/include/named/types.h | 8 +- bin/named/include/named/update.h | 10 +- bin/named/include/named/xfrout.h | 9 +- bin/named/include/named/zoneconf.h | 15 +- bin/named/interfacemgr.c | 59 +-- bin/named/listenlist.c | 11 +- bin/named/log.c | 7 - bin/named/logconf.c | 3 - bin/named/main.c | 20 +- bin/named/notify.c | 27 - bin/named/omapi.c | 7 +- bin/named/query.c | 14 - bin/named/server.c | 39 +- bin/named/tkeyconf.c | 7 +- bin/named/tsigconf.c | 16 +- bin/named/unix/os.c | 12 +- bin/named/update.c | 20 - bin/named/xfrout.c | 237 ++++----- bin/named/zoneconf.c | 70 +-- bin/rndc/rndc.c | 7 +- bin/tests/adb_test.c | 66 +-- bin/tests/byaddr_test.c | 14 +- bin/tests/byname_test.c | 25 +- bin/tests/compress_test.c | 18 +- bin/tests/db/t_db.c | 83 +--- bin/tests/db_test.c | 26 +- bin/tests/dispatch_tcp_test.c | 16 +- bin/tests/dispatch_test.c | 64 +-- bin/tests/dst/dst_test.c | 8 +- bin/tests/dst/t_dst.c | 78 +-- bin/tests/gxba_test.c | 3 +- bin/tests/gxbn_test.c | 4 +- bin/tests/inter_test.c | 15 +- bin/tests/keygen.c | 44 +- bin/tests/keysettool.c | 46 +- bin/tests/keysigner.c | 26 +- bin/tests/lex_test.c | 7 - bin/tests/lfsr_test.c | 17 +- bin/tests/log_test.c | 10 +- bin/tests/lwres_test.c | 32 +- bin/tests/lwresconf_test.c | 22 +- bin/tests/master/t_master.c | 74 ++- bin/tests/master_test.c | 7 +- bin/tests/mem/t_mem.c | 16 +- bin/tests/mempool_test.c | 16 +- bin/tests/name_test.c | 11 +- bin/tests/names/t_names.c | 22 +- bin/tests/nconf_test.c | 56 +-- bin/tests/ndcconf_test.c | 6 +- bin/tests/nxtify.c | 15 +- bin/tests/omapi_test.c | 12 +- bin/tests/printmsg.c | 21 +- bin/tests/ratelimiter_test.c | 14 +- bin/tests/rbt/t_rbt.c | 623 +++++++++++++----------- bin/tests/rbt_test.c | 6 +- bin/tests/rdata_test.c | 8 +- bin/tests/rwlock_test.c | 5 +- bin/tests/sdig.c | 17 +- bin/tests/serial_test.c | 4 +- bin/tests/shutdown_test.c | 15 +- bin/tests/signer.c | 60 +-- bin/tests/sock_test.c | 102 ++-- bin/tests/sockaddr/t_sockaddr.c | 8 - bin/tests/sym_test.c | 14 +- bin/tests/task_test.c | 5 - bin/tests/tasks/t_tasks.c | 543 +++++++++++---------- bin/tests/timer_test.c | 6 - bin/tests/timers/t_timers.c | 171 +++---- bin/tests/tkey_test.c | 31 +- bin/tests/wire_test.c | 21 +- bin/tests/zone2_test.c | 14 +- bin/tests/zone_test.c | 20 +- lib/dns/a6.c | 11 +- lib/dns/acl.c | 49 +- lib/dns/aclconf.c | 26 +- lib/dns/adb.c | 206 +++----- lib/dns/byaddr.c | 11 +- lib/dns/cache.c | 32 +- lib/dns/callbacks.c | 9 +- lib/dns/compress.c | 12 +- lib/dns/config/confacl.c | 45 +- lib/dns/config/confcommon.c | 61 +-- lib/dns/config/confctl.c | 36 +- lib/dns/config/confctx.c | 11 +- lib/dns/config/confip.c | 112 +---- lib/dns/config/confkeys.c | 7 +- lib/dns/config/conflog.c | 117 ++--- lib/dns/config/conflsn.c | 37 +- lib/dns/config/confndc.c | 27 +- lib/dns/config/confparser.y | 40 +- lib/dns/config/confresolv.c | 3 +- lib/dns/config/confrrset.c | 43 +- lib/dns/config/confview.c | 103 +--- lib/dns/config/confzone.c | 366 +++----------- lib/dns/db.c | 11 +- lib/dns/dbiterator.c | 3 - lib/dns/dbtable.c | 3 +- lib/dns/dispatch.c | 78 +-- lib/dns/dnssec.c | 125 +++-- lib/dns/gen-unix.h | 3 +- lib/dns/gen.c | 29 +- lib/dns/include/dns/a6.h | 5 +- lib/dns/include/dns/acl.h | 8 +- lib/dns/include/dns/aclconf.h | 6 +- lib/dns/include/dns/adb.h | 8 - lib/dns/include/dns/bit.h | 3 + lib/dns/include/dns/byaddr.h | 2 - lib/dns/include/dns/cache.h | 3 - lib/dns/include/dns/callbacks.h | 26 +- lib/dns/include/dns/compress.h | 6 +- lib/dns/include/dns/confacl.h | 13 +- lib/dns/include/dns/confcommon.h | 42 +- lib/dns/include/dns/confctl.h | 5 +- lib/dns/include/dns/confctx.h | 18 +- lib/dns/include/dns/confip.h | 35 +- lib/dns/include/dns/confkeys.h | 1 + lib/dns/include/dns/conflog.h | 2 +- lib/dns/include/dns/conflsn.h | 3 +- lib/dns/include/dns/confndc.h | 1 - lib/dns/include/dns/confrrset.h | 7 +- lib/dns/include/dns/confview.h | 10 +- lib/dns/include/dns/confzone.h | 5 +- lib/dns/include/dns/db.h | 13 +- lib/dns/include/dns/dbiterator.h | 8 +- lib/dns/include/dns/dbtable.h | 1 - lib/dns/include/dns/dispatch.h | 3 +- lib/dns/include/dns/dnssec.h | 2 - lib/dns/include/dns/fixedname.h | 1 - lib/dns/include/dns/journal.h | 10 +- lib/dns/include/dns/keytable.h | 1 - lib/dns/include/dns/master.h | 7 +- lib/dns/include/dns/masterdump.h | 7 +- lib/dns/include/dns/message.h | 9 +- lib/dns/include/dns/name.h | 7 +- lib/dns/include/dns/namedconf.h | 24 +- lib/dns/include/dns/ncache.h | 2 - lib/dns/include/dns/nxt.h | 2 + lib/dns/include/dns/peer.h | 8 +- lib/dns/include/dns/rbt.h | 2 - lib/dns/include/dns/rdata.h | 4 - lib/dns/include/dns/rdataset.h | 10 +- lib/dns/include/dns/rdatasetiter.h | 9 +- lib/dns/include/dns/rdataslab.h | 1 - lib/dns/include/dns/request.h | 5 +- lib/dns/include/dns/resolver.h | 13 +- lib/dns/include/dns/result.h | 2 +- lib/dns/include/dns/ssu.h | 3 - lib/dns/include/dns/tcpmsg.h | 8 +- lib/dns/include/dns/time.h | 15 +- lib/dns/include/dns/tkey.h | 2 - lib/dns/include/dns/tkeyconf.h | 4 +- lib/dns/include/dns/tsig.h | 13 +- lib/dns/include/dns/tsigconf.h | 1 - lib/dns/include/dns/ttl.h | 2 +- lib/dns/include/dns/types.h | 156 +++--- lib/dns/include/dns/view.h | 5 +- lib/dns/include/dns/zone.h | 8 +- lib/dns/include/dns/zoneconf.h | 15 +- lib/dns/include/dns/zt.h | 42 +- lib/dns/journal.c | 159 +++--- lib/dns/keytable.c | 12 +- lib/dns/lib.c | 3 - lib/dns/log.c | 12 +- lib/dns/master.c | 74 +-- lib/dns/masterdump.c | 60 +-- lib/dns/message.c | 163 +++---- lib/dns/name.c | 11 +- lib/dns/ncache.c | 15 +- lib/dns/nxt.c | 6 +- lib/dns/peer.c | 10 +- lib/dns/rbt.c | 21 +- lib/dns/rbtdb.c | 10 +- lib/dns/rbtdb.h | 7 + lib/dns/rbtdb64.h | 6 + lib/dns/rdata.c | 37 +- lib/dns/rdata/generic/cname_5.h | 4 +- lib/dns/rdata/generic/dname_39.h | 4 +- lib/dns/rdata/generic/mb_7.h | 4 +- lib/dns/rdata/generic/md_3.h | 4 +- lib/dns/rdata/generic/mf_4.h | 4 +- lib/dns/rdata/generic/mg_8.h | 4 +- lib/dns/rdata/generic/minfo_14.h | 4 +- lib/dns/rdata/generic/mr_9.h | 4 +- lib/dns/rdata/generic/mx_15.h | 4 +- lib/dns/rdata/generic/ptr_12.h | 5 +- lib/dns/rdata/generic/rp_17.h | 4 +- lib/dns/rdata/generic/rt_21.h | 4 +- lib/dns/rdata/generic/soa_6.h | 4 +- lib/dns/rdatalist.c | 1 - lib/dns/rdataset.c | 11 +- lib/dns/rdatasetiter.c | 1 - lib/dns/rdataslab.c | 10 +- lib/dns/request.c | 7 +- lib/dns/resolver.c | 23 +- lib/dns/result.c | 4 - lib/dns/rootns.c | 9 +- lib/dns/sec/dst/bsafe_link.c | 37 +- lib/dns/sec/dst/dst_api.c | 41 +- lib/dns/sec/dst/dst_lib.c | 5 +- lib/dns/sec/dst/dst_parse.c | 35 +- lib/dns/sec/dst/dst_parse.h | 25 +- lib/dns/sec/dst/dst_result.c | 6 +- lib/dns/sec/dst/dst_support.c | 37 +- lib/dns/sec/dst/hmac_link.c | 34 +- lib/dns/sec/dst/include/dst/dst.h | 6 +- lib/dns/sec/dst/include/dst/result.h | 2 +- lib/dns/sec/dst/openssl_link.c | 41 +- lib/dns/sec/dst/openssldh_link.c | 116 +++-- lib/dns/sec/dst/opensslmd5_link.c | 41 +- lib/dns/ssu.c | 10 +- lib/dns/tcpmsg.c | 52 +- lib/dns/time.c | 18 +- lib/dns/tkey.c | 60 ++- lib/dns/tkeyconf.c | 7 +- lib/dns/tsig.c | 128 +++-- lib/dns/tsigconf.c | 16 +- lib/dns/ttl.c | 7 +- lib/dns/validator.c | 96 ++-- lib/dns/view.c | 13 +- lib/dns/xfrin.c | 93 ++-- lib/dns/zone.c | 38 +- lib/dns/zoneconf.c | 70 +-- lib/dns/zt.c | 11 +- lib/isc/assertions.c | 2 - lib/isc/base64.c | 15 +- lib/isc/bitstring.c | 2 - lib/isc/buffer.c | 5 +- lib/isc/bufferlist.c | 2 - lib/isc/commandline.c | 6 +- lib/isc/error.c | 8 +- lib/isc/event.c | 1 - lib/isc/heap.c | 5 - lib/isc/include/isc/buffer.h | 5 +- lib/isc/include/isc/quota.h | 4 +- lib/isc/include/isc/types.h | 1 + lib/isc/include/isc/util.h | 10 +- lib/isc/lex.c | 9 +- lib/isc/lib.c | 2 - lib/isc/log.c | 14 +- lib/isc/mem.c | 5 +- lib/isc/mutexblock.c | 2 - lib/isc/netaddr.c | 7 +- lib/isc/nls/msgcat.c | 4 +- lib/isc/ondestroy.c | 5 +- lib/isc/pthreads/condition.c | 3 +- lib/isc/pthreads/thread.c | 4 - lib/isc/quota.c | 2 +- lib/isc/random.c | 3 +- lib/isc/ratelimiter.c | 3 - lib/isc/result.c | 10 +- lib/isc/rwlock.c | 15 +- lib/isc/serial.c | 3 +- lib/isc/sockaddr.c | 7 +- lib/isc/symtab.c | 5 +- lib/isc/task.c | 7 +- lib/isc/taskpool.c | 4 - lib/isc/timer.c | 6 +- lib/isc/unix/app.c | 6 +- lib/isc/unix/dir.c | 9 +- lib/isc/unix/file.c | 10 +- lib/isc/unix/ifiter_sysctl.c | 17 +- lib/isc/unix/include/isc/net.h | 19 +- lib/isc/unix/interfaceiter.c | 6 +- lib/isc/unix/net.c | 4 +- lib/isc/unix/socket.c | 2 - lib/isc/unix/stdtime.c | 12 +- lib/isc/unix/time.c | 11 +- lib/lwres/context.c | 27 +- lib/lwres/gethost.c | 34 +- lib/lwres/include/lwres/lwbuffer.h | 6 +- lib/omapi/auth.c | 12 +- lib/omapi/connection.c | 12 +- lib/omapi/data.c | 9 +- lib/omapi/generic.c | 9 +- lib/omapi/handle.c | 10 +- lib/omapi/include/omapi/compatibility.h | 7 + lib/omapi/include/omapi/omapi.h | 12 +- lib/omapi/include/omapi/private.h | 15 +- lib/omapi/include/omapi/result.h | 13 +- lib/omapi/include/omapi/types.h | 12 +- lib/omapi/lib.c | 10 +- lib/omapi/listener.c | 7 +- lib/omapi/message.c | 9 +- lib/omapi/object.c | 9 +- lib/omapi/protocol.c | 5 +- lib/omapi/result.c | 7 +- lib/omapi/string.c | 9 +- lib/omapi/value.c | 9 +- lib/tests/t_api.c | 270 +++++----- 318 files changed, 3525 insertions(+), 5094 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index a4e7eed100..c238a0731c 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -17,42 +17,18 @@ #include -#include -#include #include -#include -#include -#include extern int h_errno; -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include #include -#include -#include #include -#include #include -#include #include -#include #include diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 3dae94a223..cbbd213e47 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -17,39 +17,22 @@ #include -#include -#include #include -#include #include extern int h_errno; -#include #include -#include -#include -#include -#include #include -#include -#include -#include +#include #include #include -#include -#include -#include #include -#include #include -#include -#include #include -#include -#include #include +#include #include #include diff --git a/bin/dig/host.c b/bin/dig/host.c index f106127943..4c45c5ca34 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -17,42 +17,18 @@ #include -#include -#include #include -#include -#include extern int h_errno; -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include -#include #include -#include -#include #include -#include #include -#include -#include -#include #include diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index a7d9cd023c..bc51262831 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -15,21 +15,16 @@ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE. */ -/* $Id: dnssec-keygen.c,v 1.14 2000/05/05 19:55:56 gson Exp $ */ +/* $Id: dnssec-keygen.c,v 1.15 2000/05/08 14:33:32 tale Exp $ */ #include -#include -#include #include -#include -#include -#include #include -#include #include -#include +#include +#include #include #include @@ -45,17 +40,17 @@ static int verbose; int main(int argc, char **argv) { - char *algname = NULL, *nametype = NULL, *type = NULL; - char *prog, *endp; - dst_key_t *key; - char *name = NULL; - isc_uint16_t flags = 0; - dns_secalg_t alg; - isc_mem_t *mctx = NULL; - int ch, rsa_exp = 0, generator = 0, param = 0; - int protocol = -1, size = -1, signatory = 0; - isc_textregion_t r; - isc_result_t ret; + char *algname = NULL, *nametype = NULL, *type = NULL; + char *prog, *endp; + dst_key_t *key; + char *name = NULL; + isc_uint16_t flags = 0; + dns_secalg_t alg; + isc_mem_t *mctx = NULL; + int ch, rsa_exp = 0, generator = 0, param = 0; + int protocol = -1, size = -1, signatory = 0; + isc_result_t ret; + isc_textregion_t r; RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); @@ -106,10 +101,12 @@ main(int argc, char **argv) { case 'p': protocol = strtol(isc_commandline_argument, &endp, 10); if (*endp != '\0' || protocol < 0 || protocol > 255) - die("-p must be followed by a number [0..255]"); + die("-p must be followed by " + "a number [0..255]"); break; case 's': - signatory = strtol(isc_commandline_argument, &endp, 10); + signatory = strtol(isc_commandline_argument, + &endp, 10); if (*endp != '\0' || signatory < 0 || signatory > 15) die("-s must be followed by a number [0..15]"); break; @@ -284,7 +281,7 @@ die(char *str) { static void usage(char *prog) { printf("Usage:\n"); - printf (" %s [options] name\n\n", prog); + printf(" %s [options] name\n\n", prog); printf("Required options:\n"); printf(" -a algorithm: RSA | RSAMD5 | DH | DSA | HMAC-MD5\n"); printf(" -b key size, in bits:\n"); @@ -300,7 +297,8 @@ usage(char *prog) { printf(" -t type: AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF\n"); printf(" default: AUTHCONF\n"); printf(" -p protocol value\n"); - printf(" default: 2 (email) for User keys, 3 (dnssec) for all others\n"); + printf(" default: 2 (email) for User keys, " + "3 (dnssec) for all others\n"); printf(" -s strength value this key signs DNS records with\n"); printf(" default: 0\n"); printf(" -v verbose level\n"); diff --git a/bin/dnssec/dnssec-makekeyset.c b/bin/dnssec/dnssec-makekeyset.c index 5557d34a94..21fdf43d55 100644 --- a/bin/dnssec/dnssec-makekeyset.c +++ b/bin/dnssec/dnssec-makekeyset.c @@ -17,41 +17,22 @@ #include -#include #include -#include -#include -#include #include -#include -#include -#include #include -#include -#include +#include #include -#include -#include -#include #include -#include +#include +#include +#include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include -#include - -#include #define BUFSIZE 2048 @@ -69,6 +50,7 @@ static int verbose; static isc_mem_t *mctx = NULL; static keylist_t keylist; + static inline void fatal(char *message) { fprintf(stderr, "%s\n", message); @@ -119,7 +101,8 @@ usage() { fprintf(stderr, "\t-s YYYYMMDDHHMMSS|+offset:\n"); fprintf(stderr, "\t\tSIG start time - absolute|offset (now)\n"); fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n"); - fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n"); + fprintf(stderr, "\t\tSIG end time - " + "absolute|from start|from now (now + 30 days)\n"); fprintf(stderr, "\t-t ttl\n"); fprintf(stderr, "\t-v level:\n"); fprintf(stderr, "\t\tverbose level (0)\n"); @@ -170,14 +153,16 @@ main(int argc, char *argv[]) { startstr = isc_mem_strdup(mctx, isc_commandline_argument); if (startstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'e': endstr = isc_mem_strdup(mctx, isc_commandline_argument); if (endstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 't': @@ -249,7 +234,8 @@ main(int argc, char *argv[]) { isc_buffer_usedregion(&b, &r); tdomain[r.length] = 0; - output = isc_mem_allocate(mctx, strlen(tdomain) + strlen("keyset") + 1); + output = isc_mem_allocate(mctx, + strlen(tdomain) + strlen("keyset") + 1); if (output == NULL) check_result(ISC_R_FAILURE, "isc_mem_allocate()"); strcpy(output, tdomain); @@ -344,7 +330,8 @@ main(int argc, char *argv[]) { check_result(ISC_R_NOMEMORY, "isc_mem_get()"); isc_buffer_init(&b, data, BUFSIZE); result = dns_dnssec_sign(domain, &rdataset, keynode->key, - &starttime, &endtime, mctx, &b, rdata); + &starttime, &endtime, mctx, &b, + rdata); check_result(result, "dst_key_todns()"); ISC_LIST_APPEND(sigrdatalist.rdata, rdata, link); dns_rdataset_init(&sigrdataset); @@ -366,7 +353,8 @@ main(int argc, char *argv[]) { dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL); if (!ISC_LIST_EMPTY(keylist)) - dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, NULL); + dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, + NULL); dns_db_detachnode(db, &node); dns_db_closeversion(db, &version, ISC_TRUE); diff --git a/bin/dnssec/dnssec-signkey.c b/bin/dnssec/dnssec-signkey.c index d93142e113..1d48f19598 100644 --- a/bin/dnssec/dnssec-signkey.c +++ b/bin/dnssec/dnssec-signkey.c @@ -17,40 +17,21 @@ #include -#include #include -#include -#include -#include +#include #include -#include -#include -#include #include -#include -#include #include -#include -#include -#include #include -#include +#include +#include #include #include #include -#include #include -#include #include -#include -#include -#include -#include -#include - -#include #define BUFSIZE 2048 @@ -68,7 +49,6 @@ static int verbose; static isc_mem_t *mctx = NULL; static keylist_t keylist; - static inline void fatal(char *message) { fprintf(stderr, "%s\n", message); diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index ddb52a55e1..4c7360bd1c 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -17,23 +17,18 @@ #include -#include #include -#include #include -#include #include -#include +#include #include #include #include #include -#include #include #include -#include #include #include #include @@ -44,10 +39,8 @@ #include #include #include -#include #include -#include #include /*#define USE_ZONESTATUS*/ @@ -377,7 +370,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, setverifies(name, set, key, &oldsigrdata)) { vbprintf(2, - "\tsig by %s/%s/%d retained\n", + "\tsig by %s/%s/%d retained\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid); @@ -402,7 +395,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, setverifies(name, set, key, &oldsigrdata)) { vbprintf(2, - "\tsig by %s/%s/%d retained\n", + "\tsig by %s/%s/%d retained\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid); @@ -412,8 +405,8 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, } else { vbprintf(2, - "\tsig by %s/%s/%d dropped - ", - "%s\n", + "\tsig by %s/%s/%d " + "dropped - %s\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid, @@ -442,7 +435,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, allocbufferandrdata; result = dns_rdata_fromstruct(trdata, set->rdclass, - dns_rdatatype_sig, + dns_rdatatype_sig, &sig, &b); nowsignedby[sig.algorithm] = ISC_TRUE; ISC_LIST_APPEND(siglist.rdata, trdata, link); @@ -602,8 +595,8 @@ importparentsig(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, goto failure; dns_rdataset_init(&newset); dns_rdataset_init(&sigset); - result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0, - 0, &newset, &sigset); + result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, + 0, 0, &newset, &sigset); if (result != ISC_R_SUCCESS) goto failure; @@ -681,8 +674,8 @@ haschildkey(dns_db_t *db, dns_name_t *name) { goto failure; dns_rdataset_init(&set); dns_rdataset_init(&sigset); - result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0, - 0, &set, &sigset); + result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, + 0, 0, &set, &sigset); if (result != ISC_R_SUCCESS) goto failure; @@ -884,8 +877,9 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, keyrdatalist.type = dns_rdatatype_key; keyrdatalist.covers = 0; keyrdatalist.ttl = rdataset.ttl; - result = dns_rdatalist_tordataset(&keyrdatalist, - &keyset); + result = + dns_rdatalist_tordataset(&keyrdatalist, + &keyset); check_result(result, "dns_rdatalist_tordataset"); dns_db_addrdataset(db, node, version, 0, @@ -1252,7 +1246,8 @@ usage() { fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n"); fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n"); fprintf(stderr, "\t-c ttl:\n"); - fprintf(stderr, "\t\tcycle period - regenerate if < cycle from end ( (end-start)/4 )\n"); + fprintf(stderr, "\t\tcycle period - regenerate " + "if < cycle from end ( (end-start)/4 )\n"); fprintf(stderr, "\t-v level:\n"); fprintf(stderr, "\t\tverbose level (0)\n"); fprintf(stderr, "\t-o origin:\n"); @@ -1261,7 +1256,8 @@ usage() { fprintf(stderr, "\t\tfile the signed zone is written in " \ "(zonefile + .signed)\n"); fprintf(stderr, "\t-a:\n"); - fprintf(stderr, "\t\tverify generated signatures (if currently valid)\n"); + fprintf(stderr, "\t\tverify generated signatures " + "(if currently valid)\n"); fprintf(stderr, "\n"); @@ -1331,21 +1327,23 @@ main(int argc, char *argv[]) { result = isc_mem_create(0, 0, &mctx); check_result(result, "isc_mem_create()"); - while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) != -1) - { + while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) + != -1) { switch (ch) { case 's': startstr = isc_mem_strdup(mctx, isc_commandline_argument); if (startstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'e': endstr = isc_mem_strdup(mctx, isc_commandline_argument); if (endstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'c': @@ -1366,14 +1364,16 @@ main(int argc, char *argv[]) { origin = isc_mem_strdup(mctx, isc_commandline_argument); if (origin == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'f': output = isc_mem_strdup(mctx, isc_commandline_argument); if (output == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'a': @@ -1439,7 +1439,7 @@ main(int argc, char *argv[]) { if (output == NULL) { output = isc_mem_allocate(mctx, - strlen(file) + strlen(".signed") + 1); + strlen(file) + strlen(".signed") + 1); if (output == NULL) check_result(ISC_R_FAILURE, "isc_mem_allocate()"); sprintf(output, "%s.signed", file); @@ -1546,7 +1546,9 @@ main(int argc, char *argv[]) { signzone(db, version); - /* should we update the SOA serial? */ + /* + * Should we update the SOA serial? + */ dns_db_closeversion(db, &version, ISC_TRUE); dumpzone(zone, output); dns_db_detach(&db); diff --git a/bin/lwresd/client.c b/bin/lwresd/client.c index 968a75f216..1aec433410 100644 --- a/bin/lwresd/client.c +++ b/bin/lwresd/client.c @@ -17,27 +17,18 @@ #include -#include -#include - -#include -#include -#include -#include #include +#include #include #include #include #include -#include - #include "client.h" void -DP(int level, char *format, ...) -{ +DP(int level, char *format, ...) { va_list args; va_start(args, format); @@ -48,8 +39,7 @@ DP(int level, char *format, ...) } void -hexdump(char *msg, void *base, size_t len) -{ +hexdump(char *msg, void *base, size_t len) { unsigned char *p; unsigned int cnt; char buffer[180]; @@ -89,8 +79,7 @@ hexdump(char *msg, void *base, size_t len) } static void -clientmgr_can_die(clientmgr_t *cm) -{ +clientmgr_can_die(clientmgr_t *cm) { if ((cm->flags & CLIENTMGR_FLAG_SHUTTINGDOWN) == 0) return; @@ -103,8 +92,7 @@ clientmgr_can_die(clientmgr_t *cm) } static void -process_request(client_t *client) -{ +process_request(client_t *client) { lwres_buffer_t b; isc_result_t result; @@ -143,8 +131,7 @@ process_request(client_t *client) } void -client_recv(isc_task_t *task, isc_event_t *ev) -{ +client_recv(isc_task_t *task, isc_event_t *ev) { client_t *client = ev->ev_arg; clientmgr_t *cm = client->clientmgr; isc_socketevent_t *dev = (isc_socketevent_t *)ev; @@ -190,8 +177,7 @@ client_recv(isc_task_t *task, isc_event_t *ev) * This function will start a new recv() on a socket for this client manager. */ isc_result_t -client_start_recv(clientmgr_t *cm) -{ +client_start_recv(clientmgr_t *cm) { client_t *client; isc_result_t result; isc_region_t r; @@ -240,8 +226,7 @@ client_start_recv(clientmgr_t *cm) } void -client_shutdown(isc_task_t *task, isc_event_t *ev) -{ +client_shutdown(isc_task_t *task, isc_event_t *ev) { clientmgr_t *cm = ev->ev_arg; REQUIRE(task == cm->task); @@ -270,8 +255,7 @@ client_shutdown(isc_task_t *task, isc_event_t *ev) * queue. */ void -client_state_idle(client_t *client) -{ +client_state_idle(client_t *client) { clientmgr_t *cm; cm = client->clientmgr; @@ -293,8 +277,7 @@ client_state_idle(client_t *client) } void -client_send(isc_task_t *task, isc_event_t *ev) -{ +client_send(isc_task_t *task, isc_event_t *ev) { client_t *client = ev->ev_arg; clientmgr_t *cm = client->clientmgr; isc_socketevent_t *dev = (isc_socketevent_t *)ev; @@ -319,8 +302,7 @@ client_send(isc_task_t *task, isc_event_t *ev) } void -client_initialize(client_t *client, clientmgr_t *cmgr) -{ +client_initialize(client_t *client, clientmgr_t *cmgr) { client->clientmgr = cmgr; ISC_LINK_INIT(client, link); CLIENT_SETIDLE(client); @@ -344,8 +326,7 @@ client_initialize(client_t *client, clientmgr_t *cmgr) } void -client_init_aliases(client_t *client) -{ +client_init_aliases(client_t *client) { int i; for (i = 0 ; i < LWRES_MAX_ALIASES ; i++) { @@ -361,8 +342,7 @@ client_init_aliases(client_t *client) } void -client_init_gabn(client_t *client) -{ +client_init_gabn(client_t *client) { /* * Initialize the real name and alias arrays in the reply we're * going to build up. @@ -386,8 +366,7 @@ client_init_gabn(client_t *client) } void -client_init_gnba(client_t *client) -{ +client_init_gnba(client_t *client) { /* * Initialize the real name and alias arrays in the reply we're * going to build up. diff --git a/bin/lwresd/err_pkt.c b/bin/lwresd/err_pkt.c index 28e64d7b32..8d170a55a8 100644 --- a/bin/lwresd/err_pkt.c +++ b/bin/lwresd/err_pkt.c @@ -17,21 +17,9 @@ #include -#include - -#include -#include -#include -#include #include -#include #include -#include - -#include -#include - #include "client.h" /* @@ -47,8 +35,7 @@ * size we use, set the reply bit, and recompute any security information. */ void -error_pkt_send(client_t *client, isc_uint32_t _result) -{ +error_pkt_send(client_t *client, isc_uint32_t _result) { isc_result_t result; int lwres; isc_region_t r; @@ -90,7 +77,3 @@ error_pkt_send(client_t *client, isc_uint32_t _result) CLIENT_SETSEND(client); } - - - - diff --git a/bin/lwresd/main.c b/bin/lwresd/main.c index cb10be6f20..efb5c3d0ba 100644 --- a/bin/lwresd/main.c +++ b/bin/lwresd/main.c @@ -17,16 +17,10 @@ #include -#include - #include -#include #include -#include -#include -#include -#include #include +#include #include #include @@ -37,9 +31,6 @@ #include #include -#include -#include - #include "client.h" /* diff --git a/bin/lwresd/process_gabn.c b/bin/lwresd/process_gabn.c index 56e0b22617..136ca20392 100644 --- a/bin/lwresd/process_gabn.c +++ b/bin/lwresd/process_gabn.c @@ -17,22 +17,13 @@ #include -#include - -#include -#include #include -#include #include #include -#include #include #include -#include -#include - #include "client.h" #define NEED_V4(c) ((((c)->find_wanted & LWRES_ADDRTYPE_V4) != 0) \ @@ -47,8 +38,7 @@ static void start_find(client_t *); * should only be called when events are _not_ being generated by the finds. */ static void -cleanup_gabn(client_t *client) -{ +cleanup_gabn(client_t *client) { dns_adbfind_t *v4; DP(50, "Cleaning up client %p", client); @@ -66,8 +56,7 @@ cleanup_gabn(client_t *client) } static void -setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at) -{ +setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at) { dns_adbaddrinfo_t *ai; lwres_addr_t *addr; int af; @@ -118,8 +107,7 @@ setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at) } static void -generate_reply(client_t *client) -{ +generate_reply(client_t *client) { isc_result_t result; int lwres; isc_region_t r; @@ -214,8 +202,7 @@ generate_reply(client_t *client) * not having enough alias slots open is NOT a failure. */ static isc_result_t -add_alias(client_t *client) -{ +add_alias(client_t *client) { isc_buffer_t b; isc_result_t result; isc_uint16_t naliases; @@ -250,8 +237,7 @@ add_alias(client_t *client) } static isc_result_t -store_realname(client_t *client) -{ +store_realname(client_t *client) { isc_buffer_t b; isc_result_t result; @@ -275,8 +261,7 @@ store_realname(client_t *client) } static void -process_gabn_finddone(isc_task_t *task, isc_event_t *ev) -{ +process_gabn_finddone(isc_task_t *task, isc_event_t *ev) { client_t *client = ev->ev_arg; isc_eventtype_t evtype; isc_boolean_t claimed; @@ -340,8 +325,7 @@ process_gabn_finddone(isc_task_t *task, isc_event_t *ev) } static void -start_find(client_t *client) -{ +start_find(client_t *client) { unsigned int options; isc_result_t result; isc_boolean_t claimed; @@ -481,8 +465,7 @@ start_find(client_t *client) * FINDWAIT state if we need to look things up. */ void -process_gabn(client_t *client, lwres_buffer_t *b) -{ +process_gabn(client_t *client, lwres_buffer_t *b) { isc_result_t result; lwres_gabnrequest_t *req; isc_buffer_t namebuf; diff --git a/bin/lwresd/process_gnba.c b/bin/lwresd/process_gnba.c index 10c96b05e2..9ebb3fbf8c 100644 --- a/bin/lwresd/process_gnba.c +++ b/bin/lwresd/process_gnba.c @@ -17,32 +17,19 @@ #include -#include - -#include - -#include -#include -#include #include -#include -#include #include #include #include #include -#include -#include - #include "client.h" static void start_byaddr(client_t *); static void -byaddr_done(isc_task_t *task, isc_event_t *event) -{ +byaddr_done(isc_task_t *task, isc_event_t *event) { client_t *client; clientmgr_t *cm; dns_byaddrevent_t *bevent; @@ -175,8 +162,7 @@ byaddr_done(isc_task_t *task, isc_event_t *event) } static void -start_byaddr(client_t *client) -{ +start_byaddr(client_t *client) { isc_result_t result; clientmgr_t *cm; @@ -195,8 +181,7 @@ start_byaddr(client_t *client) } void -process_gnba(client_t *client, lwres_buffer_t *b) -{ +process_gnba(client_t *client, lwres_buffer_t *b) { lwres_gnbarequest_t *req; isc_result_t result; isc_sockaddr_t sa; diff --git a/bin/lwresd/process_noop.c b/bin/lwresd/process_noop.c index feb2e8173f..d2d431fa7c 100644 --- a/bin/lwresd/process_noop.c +++ b/bin/lwresd/process_noop.c @@ -17,26 +17,13 @@ #include -#include - -#include -#include -#include -#include #include -#include #include -#include - -#include -#include - #include "client.h" void -process_noop(client_t *client, lwres_buffer_t *b) -{ +process_noop(client_t *client, lwres_buffer_t *b) { lwres_nooprequest_t *req; lwres_noopresponse_t resp; isc_result_t result; diff --git a/bin/named/aclconf.c b/bin/named/aclconf.c index 5af2117028..082b50eeb6 100644 --- a/bin/named/aclconf.c +++ b/bin/named/aclconf.c @@ -17,23 +17,20 @@ #include -#include -#include -#include #include +#include #include #include #include -#include -void dns_aclconfctx_init(dns_aclconfctx_t *ctx) -{ +void +dns_aclconfctx_init(dns_aclconfctx_t *ctx) { ISC_LIST_INIT(ctx->named_acl_cache); } -void dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) -{ +void +dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) { dns_acl_t *dacl, *next; for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache); dacl != NULL; @@ -146,14 +143,16 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml, case dns_c_ipmatch_key: de->type = dns_aclelementtype_keyname; dns_name_init(&de->u.keyname, NULL); - result = convert_keyname(ce->u.key, mctx, &de->u.keyname); + result = convert_keyname(ce->u.key, mctx, + &de->u.keyname); if (result != ISC_R_SUCCESS) goto cleanup; break; case dns_c_ipmatch_indirect: de->type = dns_aclelementtype_nestedacl; - result = dns_acl_fromconfig(ce->u.indirect.list, cctx, - ctx, mctx, &de->u.nestedacl); + result = dns_acl_fromconfig(ce->u.indirect.list, + cctx, ctx, mctx, + &de->u.nestedacl); if (result != ISC_R_SUCCESS) goto cleanup; break; @@ -170,8 +169,9 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml, break; case dns_c_ipmatch_acl: de->type = dns_aclelementtype_nestedacl; - result = convert_named_acl(ce->u.aclname, cctx, - ctx, mctx, &de->u.nestedacl); + result = convert_named_acl(ce->u.aclname, + cctx, ctx, mctx, + &de->u.nestedacl); if (result != ISC_R_SUCCESS) goto cleanup; break; diff --git a/bin/named/client.c b/bin/named/client.c index ae3f13e0cd..701ad26f7b 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -17,19 +17,12 @@ #include -#include - -#include -#include -#include -#include -#include -#include #include +#include +#include #include #include -#include #include #include #include @@ -39,12 +32,9 @@ #include #include -#include -#include #include #include #include -#include #include #include diff --git a/bin/named/include/named/aclconf.h b/bin/named/include/named/aclconf.h index 6665d55c84..8df15f65cf 100644 --- a/bin/named/include/named/aclconf.h +++ b/bin/named/include/named/aclconf.h @@ -20,12 +20,10 @@ #include -#include -#include #include -#include +#include -typedef struct { +typedef struct dns_aclconfctx { ISC_LIST(dns_acl_t) named_acl_cache; } dns_aclconfctx_t; diff --git a/bin/named/include/named/client.h b/bin/named/include/named/client.h index 29f5a10be0..5c90190174 100644 --- a/bin/named/include/named/client.h +++ b/bin/named/include/named/client.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_CLIENT_H -#define NS_CLIENT_H 1 +#ifndef NAMED_CLIENT_H +#define NAMED_CLIENT_H 1 /***** ***** Module Info @@ -60,9 +60,8 @@ *** Imports ***/ -#include -#include #include +#include #include #include @@ -79,55 +78,56 @@ typedef ISC_LIST(ns_client_t) client_list_t; struct ns_client { - unsigned int magic; - isc_mem_t * mctx; - ns_clientmgr_t * manager; - int state; - int newstate; - isc_boolean_t disconnect; - int naccepts; - int nreads; - int nsends; - int references; - unsigned int attributes; - isc_task_t * task; - dns_view_t * view; - dns_view_t * lockview; - dns_dispatch_t * dispatch; - dns_dispentry_t * dispentry; - dns_dispatchevent_t * dispevent; - isc_socket_t * tcplistener; - isc_socket_t * tcpsocket; - dns_tcpmsg_t tcpmsg; - isc_boolean_t tcpmsg_valid; - isc_timer_t * timer; - dns_message_t * message; - unsigned char * sendbuf; - dns_rdataset_t * opt; - isc_uint16_t udpsize; - void (*next)(ns_client_t *); - void (*shutdown)(void *arg, isc_result_t result); - void *shutdown_arg; - ns_query_t query; - isc_stdtime_t requesttime; - isc_stdtime_t now; - dns_name_t signername; /* [T]SIG key name */ - dns_name_t * signer; /* NULL if not valid sig */ - isc_boolean_t mortal; /* Die after handling request. */ - isc_quota_t *tcpquota; - isc_quota_t *recursionquota; - ns_interface_t *interface; - isc_sockaddr_t peeraddr; - isc_boolean_t peeraddr_valid; - struct in6_pktinfo pktinfo; - ISC_LINK(ns_client_t) link; - client_list_t *list; /* The list 'link' is part of, - or NULL if not on any list. */ + unsigned int magic; + isc_mem_t * mctx; + ns_clientmgr_t * manager; + int state; + int newstate; + isc_boolean_t disconnect; + int naccepts; + int nreads; + int nsends; + int references; + unsigned int attributes; + isc_task_t * task; + dns_view_t * view; + dns_view_t * lockview; + dns_dispatch_t * dispatch; + dns_dispentry_t * dispentry; + dns_dispatchevent_t * dispevent; + isc_socket_t * tcplistener; + isc_socket_t * tcpsocket; + dns_tcpmsg_t tcpmsg; + isc_boolean_t tcpmsg_valid; + isc_timer_t * timer; + dns_message_t * message; + unsigned char * sendbuf; + dns_rdataset_t * opt; + isc_uint16_t udpsize; + void (*next)(ns_client_t *); + void (*shutdown)(void *arg, isc_result_t result); + void *shutdown_arg; + ns_query_t query; + isc_stdtime_t requesttime; + isc_stdtime_t now; + dns_name_t signername; /* [T]SIG key name */ + dns_name_t * signer; /* NULL if not valid sig */ + isc_boolean_t mortal; /* Die after handling request */ + isc_quota_t *tcpquota; + isc_quota_t *recursionquota; + ns_interface_t *interface; + isc_sockaddr_t peeraddr; + isc_boolean_t peeraddr_valid; + struct in6_pktinfo pktinfo; + ISC_LINK(ns_client_t) link; + /* + * The list 'link' is part of, or NULL if not on any list. + */ + client_list_t *list; }; #define NS_CLIENT_MAGIC 0x4E534363U /* NSCc */ -#define NS_CLIENT_VALID(c) ((c) != NULL && \ - (c)->magic == NS_CLIENT_MAGIC) +#define NS_CLIENT_VALID(c) ISC_MAGIC_VALID(c, NS_CLIENT_MAGIC) #define NS_CLIENTATTR_TCP 0x01 #define NS_CLIENTATTR_RA 0x02 /* Client gets recusive service */ @@ -255,4 +255,4 @@ ns_client_log(ns_client_t *client, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *fmt, ...); -#endif /* NS_CLIENT_H */ +#endif /* NAMED_CLIENT_H */ diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index 66681e06f4..cf2875c06a 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -15,16 +15,13 @@ * SOFTWARE. */ -#ifndef NS_GLOBALS_H -#define NS_GLOBALS_H 1 +#ifndef NAMED_GLOBALS_H +#define NAMED_GLOBALS_H 1 -#include #include #include #include -#include - #include #include @@ -89,4 +86,4 @@ EXTERN const char * ns_g_cachefile INIT(NULL); #undef EXTERN #undef INIT -#endif /* NS_GLOBALS_H */ +#endif /* NAMED_GLOBALS_H */ diff --git a/bin/named/include/named/interfacemgr.h b/bin/named/include/named/interfacemgr.h index df896633c2..78c5307089 100644 --- a/bin/named/include/named/interfacemgr.h +++ b/bin/named/include/named/interfacemgr.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_INTERFACEMGR_H -#define NS_INTERFACEMGR_H 1 +#ifndef NAMED_INTERFACEMGR_H +#define NAMED_INTERFACEMGR_H 1 /***** ***** Module Info @@ -47,8 +47,7 @@ *** Imports ***/ -#include -#include +#include #include #include @@ -62,7 +61,7 @@ ***/ #define IFACE_MAGIC 0x493A2D29U /* I:-). */ -#define NS_INTERFACE_VALID(t) ((t) != NULL && (t)->magic == IFACE_MAGIC) +#define NS_INTERFACE_VALID(t) ISC_MAGIC_VALID(t, IFACE_MAGIC) struct ns_interface { unsigned int magic; /* Magic number. */ @@ -86,15 +85,13 @@ struct ns_interface { *** Functions ***/ - isc_result_t ns_interfacemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_socketmgr_t *socketmgr, ns_clientmgr_t *clientmgr, ns_interfacemgr_t **mgrp); void -ns_interfacemgr_attach(ns_interfacemgr_t *source, - ns_interfacemgr_t **target); +ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target); void ns_interfacemgr_detach(ns_interfacemgr_t **targetp); @@ -115,8 +112,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr); */ void -ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, - ns_listenlist_t *value); +ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, ns_listenlist_t *value); /* * Set the "listen-on" list of 'mgr' to 'value'. * The previous listen-on list is freed. @@ -134,10 +130,9 @@ dns_aclenv_t * ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr); void -ns_interface_attach(ns_interface_t *source, - ns_interface_t **target); +ns_interface_attach(ns_interface_t *source, ns_interface_t **target); void ns_interface_detach(ns_interface_t **targetp); -#endif /* NS_INTERFACEMGR_H */ +#endif /* NAMED_INTERFACEMGR_H */ diff --git a/bin/named/include/named/listenlist.h b/bin/named/include/named/listenlist.h index cd03f3f5fc..00ab6cbc06 100644 --- a/bin/named/include/named/listenlist.h +++ b/bin/named/include/named/listenlist.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_LISTENLIST_H -#define NS_LISTENLIST_H 1 +#ifndef NAMED_LISTENLIST_H +#define NAMED_LISTENLIST_H 1 /***** ***** Module Info @@ -29,6 +29,7 @@ /*** *** Imports ***/ +#include #include @@ -80,6 +81,6 @@ ns_listenlist_default(isc_mem_t *mctx, in_port_t port, * all addresses with port 'port'. */ -#endif /* NS_LISTENLIST_H */ +#endif /* NAMED_LISTENLIST_H */ diff --git a/bin/named/include/named/log.h b/bin/named/include/named/log.h index a4562ee7dc..0ce529c90b 100644 --- a/bin/named/include/named/log.h +++ b/bin/named/include/named/log.h @@ -15,22 +15,24 @@ * SOFTWARE. */ -#ifndef NS_LOG_H -#define NS_LOG_H 1 +#ifndef NAMED_LOG_H +#define NAMED_LOG_H 1 -#include #include +#include #include -#include +#include /* Required for ns_g_(categories|modules). */ -/* Unused slot */ +/* Unused slot 0. */ #define NS_LOGCATEGORY_CLIENT (&ns_g_categories[1]) #define NS_LOGCATEGORY_NETWORK (&ns_g_categories[2]) #define NS_LOGCATEGORY_UPDATE (&ns_g_categories[3]) -/* Backwards compatibility. */ +/* + * Backwards compatibility. + */ #define NS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL #define NS_LOGMODULE_MAIN (&ns_g_modules[0]) @@ -67,8 +69,7 @@ ns_log_setdefaultchannels(isc_logconfig_t *lcfg); isc_result_t ns_log_setsafechannels(isc_logconfig_t *lcfg); /* - * Like ns_log_setdefaultchannels(), but omits any logging - * to files. + * Like ns_log_setdefaultchannels(), but omits any logging to files. */ isc_result_t @@ -80,4 +81,4 @@ ns_log_setdefaultcategory(isc_logconfig_t *lcfg); void ns_log_shutdown(void); -#endif /* NS_LOG_H */ +#endif /* NAMED_LOG_H */ diff --git a/bin/named/include/named/logconf.h b/bin/named/include/named/logconf.h index d456a951cf..5ccd3e91c4 100644 --- a/bin/named/include/named/logconf.h +++ b/bin/named/include/named/logconf.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_LOGCONF_H -#define NS_LOGCONF_H 1 +#ifndef NAMED_LOGCONF_H +#define NAMED_LOGCONF_H 1 #include @@ -29,4 +29,4 @@ ns_log_configure(isc_logconfig_t *logconf, dns_c_logginglist_t *clog); * the named.conf data in 'clog'. */ -#endif /* NS_LOGCONF_H */ +#endif /* NAMED_LOGCONF_H */ diff --git a/bin/named/include/named/main.h b/bin/named/include/named/main.h index b737b7c189..7a2caf0760 100644 --- a/bin/named/include/named/main.h +++ b/bin/named/include/named/main.h @@ -15,10 +15,10 @@ * SOFTWARE. */ -#ifndef NS_MAIN_H -#define NS_MAIN_H 1 +#ifndef NAMED_MAIN_H +#define NAMED_MAIN_H 1 void ns_main_earlyfatal(const char *format, ...); -#endif /* NS_MAIN_H */ +#endif /* NAMED_MAIN_H */ diff --git a/bin/named/include/named/notify.h b/bin/named/include/named/notify.h index a3b43a3732..51873a9f7f 100644 --- a/bin/named/include/named/notify.h +++ b/bin/named/include/named/notify.h @@ -48,4 +48,5 @@ ns_notify_start(ns_client_t *client); * client to be valid. */ -#endif +#endif /* NAMED_NOTIFY_H */ + diff --git a/bin/named/include/named/omapi.h b/bin/named/include/named/omapi.h index 828106e4ed..1f83107fac 100644 --- a/bin/named/include/named/omapi.h +++ b/bin/named/include/named/omapi.h @@ -15,6 +15,9 @@ * SOFTWARE. */ +#ifndef NAMED_OMAPI_H +#define NAMED_OMAPI_H 1 + #include #define NS_OMAPI_PORT 953 @@ -34,3 +37,4 @@ ns_omapi_init(void); isc_result_t ns_omapi_listen(omapi_object_t **managerp); +#endif /* NAMED_OMAPI_H */ diff --git a/bin/named/include/named/query.h b/bin/named/include/named/query.h index 6db90d2e03..4fc259eda7 100644 --- a/bin/named/include/named/query.h +++ b/bin/named/include/named/query.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_QUERY_H -#define NS_QUERY_H 1 +#ifndef NAMED_QUERY_H +#define NAMED_QUERY_H 1 #include #include @@ -66,4 +66,4 @@ ns_query_free(ns_client_t *client); void ns_query_start(ns_client_t *client); -#endif /* NS_QUERY_H */ +#endif /* NAMED_QUERY_H */ diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index 999df47f7d..9dabd1dd18 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_SERVER_H -#define NS_SERVER_H 1 +#ifndef NAMED_SERVER_H +#define NAMED_SERVER_H 1 #include #include @@ -94,4 +94,4 @@ ns_server_reloadwanted(ns_server_t *server); */ -#endif /* NS_SERVER_H */ +#endif /* NAMED_SERVER_H */ diff --git a/bin/named/include/named/tkeyconf.h b/bin/named/include/named/tkeyconf.h index 165885156c..1c49a7caa8 100644 --- a/bin/named/include/named/tkeyconf.h +++ b/bin/named/include/named/tkeyconf.h @@ -21,13 +21,13 @@ #include #include -#include #include ISC_LANG_BEGINDECLS isc_result_t -dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, dns_tkey_ctx_t **tctxp); +dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, + dns_tkey_ctx_t **tctxp); /* * Create a TKEY context and configure it, including the default DH key * and default domain, according to 'cfg'. diff --git a/bin/named/include/named/tsigconf.h b/bin/named/include/named/tsigconf.h index c43067f68a..d97c9c94c0 100644 --- a/bin/named/include/named/tsigconf.h +++ b/bin/named/include/named/tsigconf.h @@ -21,7 +21,6 @@ #include #include -#include #include ISC_LANG_BEGINDECLS diff --git a/bin/named/include/named/types.h b/bin/named/include/named/types.h index d3f4b2ef9b..cc061ab3e8 100644 --- a/bin/named/include/named/types.h +++ b/bin/named/include/named/types.h @@ -15,10 +15,8 @@ * SOFTWARE. */ -#ifndef NS_TYPES_H -#define NS_TYPES_H 1 - -#include +#ifndef NAMED_TYPES_H +#define NAMED_TYPES_H 1 #include @@ -29,4 +27,4 @@ typedef struct ns_server ns_server_t; typedef struct ns_interface ns_interface_t; typedef struct ns_interfacemgr ns_interfacemgr_t; -#endif /* NS_TYPES_H */ +#endif /* NAMED_TYPES_H */ diff --git a/bin/named/include/named/update.h b/bin/named/include/named/update.h index 721097562b..ad5d33b8a5 100644 --- a/bin/named/include/named/update.h +++ b/bin/named/include/named/update.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_UPDATE_H -#define NS_UPDATE_H 1 +#ifndef NAMED_UPDATE_H +#define NAMED_UPDATE_H 1 /***** ***** Module Info @@ -30,7 +30,6 @@ *** Imports ***/ -#include #include #include @@ -42,6 +41,7 @@ *** Functions ***/ -void ns_update_start(ns_client_t *client); +void +ns_update_start(ns_client_t *client); -#endif /* NS_UPDATE_H */ +#endif /* NAMED_UPDATE_H */ diff --git a/bin/named/include/named/xfrout.h b/bin/named/include/named/xfrout.h index bb2dfecf66..66b1e43914 100644 --- a/bin/named/include/named/xfrout.h +++ b/bin/named/include/named/xfrout.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef NS_XFROUT_H -#define NS_XFROUT_H 1 +#ifndef NAMED_XFROUT_H +#define NAMED_XFROUT_H 1 /***** ***** Module Info @@ -30,6 +30,7 @@ *** Functions ***/ -void ns_xfr_start(ns_client_t *client, dns_rdatatype_t xfrtype); +void +ns_xfr_start(ns_client_t *client, dns_rdatatype_t xfrtype); -#endif /* NS_XFROUT_H */ +#endif /* NAMED_XFROUT_H */ diff --git a/bin/named/include/named/zoneconf.h b/bin/named/include/named/zoneconf.h index 064e772a95..d3bf66a91c 100644 --- a/bin/named/include/named/zoneconf.h +++ b/bin/named/include/named/zoneconf.h @@ -18,19 +18,16 @@ #ifndef DNS_ZONECONF_H #define DNS_ZONECONF_H 1 -#include +#include #include -#include #include -#include -#include -#include -#include -isc_result_t dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, - dns_c_zone_t *czone, dns_aclconfctx_t *ac, - dns_zone_t *zone); +ISC_LANG_BEGINDECLS + +isc_result_t +dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_c_zone_t *czone, + dns_aclconfctx_t *ac, dns_zone_t *zone); /* * Configure or reconfigure a zone according to the named.conf * data in 'cctx' and 'czone'. diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index 2021f20b23..d4f95ff2e3 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -17,34 +17,20 @@ #include -#include -#include -#include -#include -#include - -#include -#include #include -#include -#include -#include -#include +#include #include -#include #include #include #include #include -#include -#include #include #include #define IFMGR_MAGIC 0x49464D47U /* IFMG. */ -#define NS_INTERFACEMGR_VALID(t) ((t) != NULL && (t)->magic == IFMGR_MAGIC) +#define NS_INTERFACEMGR_VALID(t) ISC_MAGIC_VALID(t, IFMGR_MAGIC) #define IFMGR_COMMON_LOGARGS \ ns_g_lctx, NS_LOGCATEGORY_NETWORK, NS_LOGMODULE_INTERFACEMGR @@ -63,7 +49,8 @@ struct ns_interfacemgr { ISC_LIST(ns_interface_t) interfaces; /* List of interfaces. */ }; -static void purge_old_interfaces(ns_interfacemgr_t *mgr); +static void +purge_old_interfaces(ns_interfacemgr_t *mgr); /* * Format a human-readable representation of the socket address '*sa' @@ -71,8 +58,7 @@ static void purge_old_interfaces(ns_interfacemgr_t *mgr); * The resulting string is guaranteed to be null-terminated. */ static void -sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) -{ +sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) { isc_result_t result; isc_buffer_t buf; isc_buffer_init(&buf, array, size); @@ -133,8 +119,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, } static void -ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) -{ +ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) { REQUIRE(NS_INTERFACEMGR_VALID(mgr)); dns_aclenv_destroy(&mgr->aclenv); ns_listenlist_detach(&mgr->listenon); @@ -144,15 +129,12 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) } dns_aclenv_t * -ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr) -{ +ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr) { return (&mgr->aclenv); } void -ns_interfacemgr_attach(ns_interfacemgr_t *source, - ns_interfacemgr_t **target) -{ +ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target) { REQUIRE(NS_INTERFACEMGR_VALID(source)); LOCK(&source->lock); INSIST(source->references > 0); @@ -162,8 +144,7 @@ ns_interfacemgr_attach(ns_interfacemgr_t *source, } void -ns_interfacemgr_detach(ns_interfacemgr_t **targetp) -{ +ns_interfacemgr_detach(ns_interfacemgr_t **targetp) { isc_result_t need_destroy = ISC_FALSE; ns_interfacemgr_t *target = *targetp; REQUIRE(target != NULL); @@ -180,8 +161,7 @@ ns_interfacemgr_detach(ns_interfacemgr_t **targetp) } void -ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr) -{ +ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr) { REQUIRE(NS_INTERFACEMGR_VALID(mgr)); LOCK(&mgr->lock); @@ -385,10 +365,10 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, result = ns_interface_accepttcp(ifp); if (result != ISC_R_SUCCESS) { /* - * XXXRTH We don't currently have a way to easily stop dispatch - * service, so we return currently return ISC_R_SUCCESS (the UDP - * stuff will work even if TCP creation failed). This will be fixed - * later. + * XXXRTH We don't currently have a way to easily stop dispatch + * service, so we return currently return ISC_R_SUCCESS (the + * UDP stuff will work even if TCP creation failed). This will + * be fixed later. */ result = ISC_R_SUCCESS; } @@ -427,9 +407,7 @@ ns_interface_destroy(ns_interface_t *ifp) { } void -ns_interface_attach(ns_interface_t *source, - ns_interface_t **target) -{ +ns_interface_attach(ns_interface_t *source, ns_interface_t **target) { REQUIRE(NS_INTERFACE_VALID(source)); LOCK(&source->lock); INSIST(source->references > 0); @@ -439,8 +417,7 @@ ns_interface_attach(ns_interface_t *source, } void -ns_interface_detach(ns_interface_t **targetp) -{ +ns_interface_detach(ns_interface_t **targetp) { isc_result_t need_destroy = ISC_FALSE; ns_interface_t *target = *targetp; REQUIRE(target != NULL); @@ -693,9 +670,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr) { } void -ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, - ns_listenlist_t *value) -{ +ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, ns_listenlist_t *value) { LOCK(&mgr->lock); ns_listenlist_detach(&mgr->listenon); ns_listenlist_attach(value, &mgr->listenon); diff --git a/bin/named/listenlist.c b/bin/named/listenlist.c index d0d799219a..c5f36e0908 100644 --- a/bin/named/listenlist.c +++ b/bin/named/listenlist.c @@ -17,16 +17,15 @@ #include -#include #include -#include #include #include #include -static void destroy(ns_listenlist_t *list); +static void +destroy(ns_listenlist_t *list); isc_result_t ns_listenelt_create(isc_mem_t *mctx, in_port_t port, @@ -80,16 +79,14 @@ destroy(ns_listenlist_t *list) { } void -ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target) -{ +ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target) { INSIST(source->refcount > 0); source->refcount++; *target = source; } void -ns_listenlist_detach(ns_listenlist_t **listp) -{ +ns_listenlist_detach(ns_listenlist_t **listp) { ns_listenlist_t *list = *listp; INSIST(list->refcount > 0); list->refcount--; diff --git a/bin/named/log.c b/bin/named/log.c index fce173d0ac..4811a4d0bb 100644 --- a/bin/named/log.c +++ b/bin/named/log.c @@ -17,13 +17,6 @@ #include -#include -#include -#include - -#include - -#include #include /* diff --git a/bin/named/logconf.c b/bin/named/logconf.c index 3951ab2e71..6a3d485ac1 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -17,9 +17,6 @@ #include -#include - -#include #include #include diff --git a/bin/named/main.c b/bin/named/main.c index e70f61cc16..594071ceed 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -17,31 +17,23 @@ #include -#include -#include -#include #include -#include #include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include - #include -#define NS_MAIN 1 +/* + * Defining NS_MAIN provides storage declaratons (rather than extern) + * for variables in named/globals.h. + */ +#define NS_MAIN 1 -#include +#include /* Explicit, though named/log.h includes it. */ #include #include #include diff --git a/bin/named/notify.c b/bin/named/notify.c index 93374065fe..28a30777ec 100644 --- a/bin/named/notify.c +++ b/bin/named/notify.c @@ -17,40 +17,13 @@ #include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include #include -#include -#include #include -#include #include #include #include -#include -#include #include #include diff --git a/bin/named/omapi.c b/bin/named/omapi.c index 04e74d31a1..09238b8a05 100644 --- a/bin/named/omapi.c +++ b/bin/named/omapi.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: omapi.c,v 1.12 2000/04/28 02:07:57 tale Exp $ */ +/* $Id: omapi.c,v 1.13 2000/05/08 14:32:57 tale Exp $ */ /* * Principal Author: DCL @@ -23,14 +23,9 @@ #include -#include -#include - -#include #include #include -#include #include #include #include diff --git a/bin/named/query.c b/bin/named/query.c index 82e0d6363f..e702e432da 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -17,24 +17,12 @@ #include -#include -#include -#include #include -#include -#include -#include #include -#include -#include #include -#include -#include #include -#include #include -#include #include #include #include @@ -48,9 +36,7 @@ #include #include -#include #include -#include #include #include diff --git a/bin/named/server.c b/bin/named/server.c index 4459f4a467..e79896b973 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -17,64 +17,39 @@ #include -#include -#include -#include -#include #include -#include -#include -#include #include -#include #include #include -#include -#include -#include -#include -#include +#include #include -#include #include #include -#include -#include #include -#include -#include -#include #include #include #include -#include #include #include -#include -#include -#include +#include #include #include -#include #include +#include #include #include -#include #include #include #include #include -#include #include -#include #include #include #include #include -#include /* * Check an operation for failure. Assumes that the function @@ -261,7 +236,8 @@ configure_view_dnsseckeys(dns_c_ctx_t *cctx, keystruct.datalen = r.length; keystruct.data = r.base; - CHECK(dns_rdata_fromstruct(NULL, keystruct.common.rdclass, + CHECK(dns_rdata_fromstruct(NULL, + keystruct.common.rdclass, keystruct.common.rdtype, &keystruct, &rrdatabuf)); CHECK(dst_key_fromdns(ckey->domain, &rrdatabuf, mctx, @@ -351,7 +327,8 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview, result = ISC_R_NOTFOUND; if (cview != NULL) - result = dns_c_view_getcleaninterval(cview, &cleaning_interval); + result = dns_c_view_getcleaninterval(cview, + &cleaning_interval); if (result != ISC_R_SUCCESS) result = dns_c_ctx_getcleaninterval(cctx, &cleaning_interval); if (result != ISC_R_SUCCESS) @@ -410,7 +387,7 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview, * elminated. */ if ((cview != NULL && - dns_c_view_getforward(cview, &forward) == ISC_R_SUCCESS) || + dns_c_view_getforward(cview, &forward) == ISC_R_SUCCESS) || (dns_c_ctx_getforward(cctx, &forward) == ISC_R_SUCCESS)) { INSIST(forward == dns_c_forw_first || forward == dns_c_forw_only); diff --git a/bin/named/tkeyconf.c b/bin/named/tkeyconf.c index dd1b3fb01e..f662effc48 100644 --- a/bin/named/tkeyconf.c +++ b/bin/named/tkeyconf.c @@ -17,13 +17,12 @@ #include -#include -#include +#include +#include -#include -#include #include #include +#include #include #define RETERR(x) do { \ diff --git a/bin/named/tsigconf.c b/bin/named/tsigconf.c index 0340c78ac7..ad175b7a84 100644 --- a/bin/named/tsigconf.c +++ b/bin/named/tsigconf.c @@ -18,12 +18,12 @@ #include #include +#include #include -#include +#include +#include -#include -#include -#include +#include #include static isc_result_t @@ -49,7 +49,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring, dns_name_init(&keyname, NULL); dns_name_init(&alg, NULL); - /* Create the key name */ + /* + * Create the key name. + */ isc_buffer_init(&keynamesrc, key->keyid, strlen(key->keyid)); isc_buffer_add(&keynamesrc, strlen(key->keyid)); isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata)); @@ -58,7 +60,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring, if (ret != ISC_R_SUCCESS) goto failure; - /* Create the algorithm */ + /* + * Create the algorithm. + */ if (strcasecmp(key->algorithm, "hmac-md5") == 0) alg = *dns_tsig_hmacmd5_name; else { diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index f72a358523..4be1921052 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -17,22 +17,18 @@ #include -#include #include #include #include #include -#include #include #include #include #include #include -#include -#include -#include +#include #include #include @@ -53,11 +49,11 @@ static isc_boolean_t non_root_caps = ISC_FALSE; */ #define _LINUX_FS_H -#include -#include +#include /* Required for syscall(). */ +#include /* Required for _LINUX_CAPABILITY_VERSION. */ #ifdef HAVE_LINUX_PRCTL_H -#include +#include /* Required for prctl(). */ #endif #ifndef SYS_capset diff --git a/bin/named/update.c b/bin/named/update.c index 2427cbe1a7..cae6967efd 100644 --- a/bin/named/update.c +++ b/bin/named/update.c @@ -17,45 +17,25 @@ #include -#include -#include -#include -#include - -#include -#include -#include -#include #include #include -#include #include #include -#include #include #include -#include #include #include -#include #include -#include -#include #include #include -#include -#include #include -#include #include #include #include #include -#include #include -#include #include /* diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c index b0df1329dd..0539d5f344 100644 --- a/bin/named/xfrout.c +++ b/bin/named/xfrout.c @@ -15,45 +15,29 @@ * SOFTWARE. */ -/* $Id: xfrout.c,v 1.59 2000/04/27 00:00:40 tale Exp $ */ +/* $Id: xfrout.c,v 1.60 2000/05/08 14:33:01 tale Exp $ */ #include -#include -#include -#include - -#include - -#include -#include #include -#include -#include #include +#include #include -#include #include #include -#include #include #include -#include #include -#include #include #include #include -#include #include -#include #include #include #include #include -#include #include #include #include @@ -115,17 +99,22 @@ struct db_rr_iterator { dns_rdata_t rdata; }; -isc_result_t db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, - dns_dbversion_t *ver, isc_stdtime_t now); +isc_result_t +db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver, + isc_stdtime_t now); -isc_result_t db_rr_iterator_first(db_rr_iterator_t *it); +isc_result_t +db_rr_iterator_first(db_rr_iterator_t *it); -isc_result_t db_rr_iterator_next(db_rr_iterator_t *it); +isc_result_t +db_rr_iterator_next(db_rr_iterator_t *it); -void db_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name, - isc_uint32_t *ttl, dns_rdata_t **rdata); +void +db_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name, + isc_uint32_t *ttl, dns_rdata_t **rdata); -void db_rr_iterator_destroy(db_rr_iterator_t *it); +void +db_rr_iterator_destroy(db_rr_iterator_t *it); isc_result_t db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver, @@ -326,7 +315,9 @@ typedef struct ixfr_rrstream { } ixfr_rrstream_t; /* Forward declarations. */ -static void ixfr_rrstream_destroy(rrstream_t **sp); +static void +ixfr_rrstream_destroy(rrstream_t **sp); + static rrstream_methods_t ixfr_rrstream_methods; /* @@ -366,20 +357,17 @@ ixfr_rrstream_create(isc_mem_t *mctx, } static isc_result_t -ixfr_rrstream_first(rrstream_t *rs) -{ +ixfr_rrstream_first(rrstream_t *rs) { ixfr_rrstream_t *s = (ixfr_rrstream_t *) rs; return (dns_journal_first_rr(s->journal)); } static isc_result_t -ixfr_rrstream_next(rrstream_t *rs) -{ +ixfr_rrstream_next(rrstream_t *rs) { ixfr_rrstream_t *s = (ixfr_rrstream_t *) rs; return (dns_journal_next_rr(s->journal)); } - static void ixfr_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl, @@ -397,8 +385,7 @@ ixfr_rrstream_destroy(rrstream_t **rsp) { isc_mem_put(s->common.mctx, s, sizeof(*s)); } -static rrstream_methods_t ixfr_rrstream_methods = -{ +static rrstream_methods_t ixfr_rrstream_methods = { ixfr_rrstream_first, ixfr_rrstream_next, ixfr_rrstream_current, @@ -421,15 +408,17 @@ typedef struct axfr_rrstream { isc_boolean_t it_valid; } axfr_rrstream_t; -/* Forward declarations. */ -static void axfr_rrstream_destroy(rrstream_t **rsp); +/* + * Forward declarations. + */ +static void +axfr_rrstream_destroy(rrstream_t **rsp); + static rrstream_methods_t axfr_rrstream_methods; static isc_result_t -axfr_rrstream_create(isc_mem_t *mctx, - dns_db_t *db, - dns_dbversion_t *ver, - rrstream_t **sp) +axfr_rrstream_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *ver, + rrstream_t **sp) { axfr_rrstream_t *s; isc_result_t result; @@ -455,8 +444,7 @@ axfr_rrstream_create(isc_mem_t *mctx, } static isc_result_t -axfr_rrstream_first(rrstream_t *rs) -{ +axfr_rrstream_first(rrstream_t *rs) { axfr_rrstream_t *s = (axfr_rrstream_t *) rs; isc_result_t result; result = db_rr_iterator_first(&s->it); @@ -479,8 +467,7 @@ axfr_rrstream_first(rrstream_t *rs) } static isc_result_t -axfr_rrstream_next(rrstream_t *rs) -{ +axfr_rrstream_next(rrstream_t *rs) { axfr_rrstream_t *s = (axfr_rrstream_t *) rs; isc_result_t result; @@ -501,9 +488,8 @@ axfr_rrstream_next(rrstream_t *rs) } static void -axfr_rrstream_current(rrstream_t *rs, - dns_name_t **name, isc_uint32_t *ttl, - dns_rdata_t **rdata) +axfr_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl, + dns_rdata_t **rdata) { axfr_rrstream_t *s = (axfr_rrstream_t *) rs; db_rr_iterator_current(&s->it, name, ttl, rdata); @@ -517,8 +503,7 @@ axfr_rrstream_destroy(rrstream_t **rsp) { isc_mem_put(s->common.mctx, s, sizeof(*s)); } -static rrstream_methods_t axfr_rrstream_methods = -{ +static rrstream_methods_t axfr_rrstream_methods = { axfr_rrstream_first, axfr_rrstream_next, axfr_rrstream_current, @@ -536,14 +521,16 @@ typedef struct soa_rrstream { dns_difftuple_t *soa_tuple; } soa_rrstream_t; -/* Forward declarations. */ -static void soa_rrstream_destroy(rrstream_t **rsp); +/* + * Forward declarations. + */ +static void +soa_rrstream_destroy(rrstream_t **rsp); + static rrstream_methods_t soa_rrstream_methods; static isc_result_t -soa_rrstream_create(isc_mem_t *mctx, - dns_db_t *db, - dns_dbversion_t *ver, +soa_rrstream_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *ver, rrstream_t **sp) { soa_rrstream_t *s; @@ -582,8 +569,7 @@ soa_rrstream_next(rrstream_t *rs) { } static void -soa_rrstream_current(rrstream_t *rs, - dns_name_t **name, isc_uint32_t *ttl, +soa_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl, dns_rdata_t **rdata) { soa_rrstream_t *s = (soa_rrstream_t *) rs; @@ -600,8 +586,7 @@ soa_rrstream_destroy(rrstream_t **rsp) { isc_mem_put(s->common.mctx, s, sizeof(*s)); } -static rrstream_methods_t soa_rrstream_methods = -{ +static rrstream_methods_t soa_rrstream_methods = { soa_rrstream_first, soa_rrstream_next, soa_rrstream_current, @@ -626,9 +611,15 @@ typedef struct compound_rrstream { isc_result_t result; } compound_rrstream_t; -/* Forward declarations. */ -static void compound_rrstream_destroy(rrstream_t **rsp); -static isc_result_t compound_rrstream_next(rrstream_t *rs); +/* + * Forward declarations. + */ +static void +compound_rrstream_destroy(rrstream_t **rsp); + +static isc_result_t +compound_rrstream_next(rrstream_t *rs); + static rrstream_methods_t compound_rrstream_methods; /* @@ -645,10 +636,8 @@ static rrstream_methods_t compound_rrstream_methods; * when the compound_rrstream_t is destroyed. */ static isc_result_t -compound_rrstream_create(isc_mem_t *mctx, - rrstream_t **soa_stream, - rrstream_t **data_stream, - rrstream_t **sp) +compound_rrstream_create(isc_mem_t *mctx, rrstream_t **soa_stream, + rrstream_t **data_stream, rrstream_t **sp) { compound_rrstream_t *s; @@ -698,9 +687,8 @@ compound_rrstream_next(rrstream_t *rs) { } static void -compound_rrstream_current(rrstream_t *rs, - dns_name_t **name, isc_uint32_t *ttl, - dns_rdata_t **rdata) +compound_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl, + dns_rdata_t **rdata) { compound_rrstream_t *s = (compound_rrstream_t *) rs; rrstream_t *curstream; @@ -719,8 +707,7 @@ compound_rrstream_destroy(rrstream_t **rsp) { isc_mem_put(s->common.mctx, s, sizeof(*s)); } -static rrstream_methods_t compound_rrstream_methods = -{ +static rrstream_methods_t compound_rrstream_methods = { compound_rrstream_first, compound_rrstream_next, compound_rrstream_current, @@ -769,23 +756,35 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, isc_boolean_t many_answers, xfrout_ctx_t **xfrp); -static void sendstream(xfrout_ctx_t *xfr); +static void +sendstream(xfrout_ctx_t *xfr); -static void xfrout_senddone(isc_task_t *task, isc_event_t *event); -static void xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg); -static void xfrout_maybe_destroy(xfrout_ctx_t *xfr); -static void xfrout_ctx_destroy(xfrout_ctx_t **xfrp); -static void xfrout_client_shutdown(void *arg, isc_result_t result); -static void xfrout_log1(ns_client_t *client, dns_name_t *zonename, - int level, const char *fmt, ...); -static void xfrout_log(xfrout_ctx_t *xfr, unsigned int level, - const char *fmt, ...); +static void +xfrout_senddone(isc_task_t *task, isc_event_t *event); + +static void +xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg); + +static void +xfrout_maybe_destroy(xfrout_ctx_t *xfr); + +static void +xfrout_ctx_destroy(xfrout_ctx_t **xfrp); + +static void +xfrout_client_shutdown(void *arg, isc_result_t result); + +static void +xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, + const char *fmt, ...); + +static void +xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...); /**************************************************************************/ void -ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) -{ +ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { isc_result_t result; dns_name_t *question_name; dns_rdataset_t *question_rdataset; @@ -823,8 +822,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) } ns_client_log(client, - DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT, ISC_LOG_DEBUG(6), - "%s request", mnemonic); + DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT, + ISC_LOG_DEBUG(6), "%s request", mnemonic); /* * Apply quota. */ @@ -886,7 +885,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) dns_message_currentname(request, DNS_SECTION_AUTHORITY, &soa_name); - /* Ignore data whose owner name is not the zone apex. */ + /* + * Ignore data whose owner name is not the zone apex. + */ if (! dns_name_equal(soa_name, question_name)) continue; @@ -894,7 +895,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) soa_rdataset != NULL; soa_rdataset = ISC_LIST_NEXT(soa_rdataset, link)) { - /* Ignore non-SOA data. */ + /* + * Ignore non-SOA data. + */ if (soa_rdataset->type != dns_rdatatype_soa) continue; if (soa_rdataset->rdclass != question_class) @@ -918,30 +921,38 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) xfrout_log1(client, question_name, ISC_LOG_DEBUG(6), "%s authority section OK", mnemonic); - /* Decide whether to allow this transfer. */ - CHECK(ns_client_checkacl(client, "zone transfer", - dns_zone_getxfracl(zone), - ISC_TRUE)); + /* + * Decide whether to allow this transfer. + */ + CHECK(ns_client_checkacl(client, "zone transfer", + dns_zone_getxfracl(zone), ISC_TRUE)); - /* AXFR over UDP is not possible. */ + /* + * AXFR over UDP is not possible. + */ if (reqtype == dns_rdatatype_axfr && (client->attributes & NS_CLIENTATTR_TCP) == 0) { FAILC(DNS_R_FORMERR, "attempted AXFR over UDP"); } - /* Look up the requesting server in the peer table. */ + /* + * Look up the requesting server in the peer table. + */ isc_netaddr_fromsockaddr(&na, &client->peeraddr); - (void) dns_peerlist_peerbyaddr(client->view->peers, - &na, &peer); + (void)dns_peerlist_peerbyaddr(client->view->peers, &na, &peer); - /* Decide on the transfer format (one-answer or many-answers). */ + /* + * Decide on the transfer format (one-answer or many-answers). + */ if (peer != NULL) - (void) dns_peer_gettransferformat(peer, &format); + (void)dns_peer_gettransferformat(peer, &format); - /* Get a dynamically allocated copy of the current SOA. */ + /* + * Get a dynamically allocated copy of the current SOA. + */ CHECK(dns_db_createsoatuple(db, ver, mctx, DNS_DIFFOP_EXISTS, ¤t_soa_tuple)); - + if (reqtype == dns_rdatatype_ixfr) { isc_uint32_t begin_serial, current_serial; isc_boolean_t provide_ixfr; @@ -999,7 +1010,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) &data_stream)); } - /* Bracket the the data stream with SOAs. */ + /* + * Bracket the the data stream with SOAs. + */ CHECK(soa_rrstream_create(mctx, db, ver, &soa_stream)); CHECK(compound_rrstream_create(mctx, &soa_stream, &data_stream, &stream)); @@ -1057,7 +1070,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) if (xfr != NULL) { xfrout_fail(xfr, result, "setting up zone transfer"); } else if (result != ISC_R_SUCCESS) { - ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT, + ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT, + NS_LOGMODULE_XFER_OUT, ISC_LOG_DEBUG(3), "zone transfer setup failed"); ns_client_error(client, result); } @@ -1171,8 +1185,7 @@ failure: * _first method of the iterator has been called). */ static void -sendstream(xfrout_ctx_t *xfr) -{ +sendstream(xfrout_ctx_t *xfr) { dns_message_t *msg = NULL; isc_result_t result; isc_region_t used; @@ -1460,8 +1473,7 @@ xfrout_senddone(isc_task_t *task, isc_event_t *event) { } static void -xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg) -{ +xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg) { xfr->shuttingdown = ISC_TRUE; xfrout_log(xfr, ISC_LOG_ERROR, "%s: %s", msg, isc_result_totext(result)); @@ -1485,8 +1497,7 @@ xfrout_maybe_destroy(xfrout_ctx_t *xfr) { } static void -xfrout_client_shutdown(void *arg, isc_result_t result) -{ +xfrout_client_shutdown(void *arg, isc_result_t result) { xfrout_ctx_t *xfr = (xfrout_ctx_t *) arg; xfrout_fail(xfr, result, "aborted"); } @@ -1509,10 +1520,12 @@ xfrout_logv(ns_client_t *client, dns_name_t *zonename, int level, "transfer of '%s': %s", namebuf, msgbuf); } -/* Logging function for use when a xfrout_ctx_t has not yet been created. */ - +/* + * Logging function for use when a xfrout_ctx_t has not yet been created. + */ static void -xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, const char *fmt, ...) +xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, + const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -1520,11 +1533,11 @@ xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, const char *fm va_end(ap); } -/* Logging function for use when there is a xfrout_ctx_t. */ - +/* + * Logging function for use when there is a xfrout_ctx_t. + */ static void -xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...) -{ +xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...) { va_list ap; va_start(ap, fmt); xfrout_logv(xfr->client, xfr->qname, level, fmt, ap); diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 6ae025c898..b86af9f406 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -17,14 +17,9 @@ #include -#include -#include -#include -#include #include -#include -#include +#include #include #include #include @@ -40,9 +35,12 @@ static isc_result_t configure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_aclconfctx_t *aclconfctx, dns_zone_t *zone, - isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **), - isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **), - isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **), + isc_result_t (*getcacl)(dns_c_zone_t *, + dns_c_ipmatchlist_t **), + isc_result_t (*getviewcacl)(dns_c_view_t * + , dns_c_ipmatchlist_t **), + isc_result_t (*getglobalcacl)(dns_c_ctx_t *, + dns_c_ipmatchlist_t **), void (*setzacl)(dns_zone_t *, dns_acl_t *), void (*clearzacl)(dns_zone_t *)) { @@ -195,18 +193,22 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr); + result = dns_c_view_getmaxtransfertimeout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransfertimeout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = MAX_XFER_TIME; dns_zone_setmaxxfrout(zone, maxxfr); result = dns_c_zone_getmaxtransidleout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransferidleout(cview, &maxxfr); + result = dns_c_view_getmaxtransferidleout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransferidleout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = DNS_DEFAULT_IDLEOUT; dns_zone_setidleout(zone, maxxfr); @@ -224,7 +226,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, case dns_c_zone_forward: #ifdef notyet /* - * forward zones are still in a state of flux + * Forward zones are still in a state of flux. */ czone->u.fzone.check_names; /* XXX unused in BIND 8 */ czone->u.fzone.forward; /* XXX*/ @@ -249,8 +251,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, #endif result = configure_zone_acl(czone, cctx, cview, ac, zone, dns_c_zone_getallowquery, - dns_c_view_getallowquery, - dns_c_ctx_getallowquery, + dns_c_view_getallowquery, + dns_c_ctx_getallowquery, dns_zone_setqueryacl, dns_zone_clearqueryacl); if (result != ISC_R_SUCCESS) @@ -281,7 +283,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersource(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersource(cview, &sockaddr); + result = dns_c_view_gettransfersource(cview, + &sockaddr); if (result != ISC_R_SUCCESS) result = dns_c_ctx_gettransfersource(cctx, &sockaddr); if (result != ISC_R_SUCCESS) @@ -290,27 +293,33 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersourcev6(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersourcev6(cview, &sockaddr); + result = dns_c_view_gettransfersourcev6(cview, + &sockaddr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr); + result = dns_c_ctx_gettransfersourcev6(cctx, + &sockaddr); if (result != ISC_R_SUCCESS) sockaddr = sockaddr_any6; dns_zone_setxfrsource6(zone, &sockaddr); result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr); + result = dns_c_view_getmaxtransfertimeout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransfertimeout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = MAX_XFER_TIME; dns_zone_setmaxxfrout(zone, maxxfr); result = dns_c_zone_getmaxtransidleout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransferidleout(cview, &maxxfr); + result = dns_c_view_getmaxtransferidleout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransferidleout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = DNS_DEFAULT_IDLEOUT; dns_zone_setidleout(zone, maxxfr); @@ -395,7 +404,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersource(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersource(cview, &sockaddr); + result = dns_c_view_gettransfersource(cview, + &sockaddr); if (result != ISC_R_SUCCESS) result = dns_c_ctx_gettransfersource(cctx, &sockaddr); if (result != ISC_R_SUCCESS) @@ -404,9 +414,11 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersourcev6(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersourcev6(cview, &sockaddr); + result = dns_c_view_gettransfersourcev6(cview, + &sockaddr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr); + result = dns_c_ctx_gettransfersourcev6(cctx, + &sockaddr); if (result != ISC_R_SUCCESS) sockaddr = sockaddr_any6; dns_zone_setxfrsource6(zone, &sockaddr); @@ -434,8 +446,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, } isc_boolean_t -dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) -{ +dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) { const char *cfilename; const char *zfilename; @@ -455,8 +466,7 @@ dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) } isc_result_t -dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) -{ +dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) { isc_int32_t val; isc_result_t result; diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 04d8c61fa5..7af7e72280 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: rndc.c,v 1.10 2000/04/28 02:07:58 tale Exp $ */ +/* $Id: rndc.c,v 1.11 2000/05/08 14:33:19 tale Exp $ */ /* * Principal Author: DCL @@ -23,15 +23,12 @@ #include -#include #include -#include -#include -#include #include #include #include +#include #include #include diff --git a/bin/tests/adb_test.c b/bin/tests/adb_test.c index 3267b18c19..363f64f780 100644 --- a/bin/tests/adb_test.c +++ b/bin/tests/adb_test.c @@ -17,31 +17,20 @@ #include -#include #include #include -#include #include -#include #include -#include -#include #include -#include #include -#include -#include #include -#include #include #include #include #include -#include #include -#include #include #include @@ -67,20 +56,8 @@ isc_mutex_t client_lock; isc_stdtime_t now; dns_adb_t *adb; -static void check_result(isc_result_t, char *, ...); -isc_result_t ns_rootns_init(void); -void create_managers(void); -static void lookup_callback(isc_task_t *, isc_event_t *); -void create_view(void); -client_t *new_client(void); -void free_client(client_t **); -static inline void CLOCK(void); -static inline void CUNLOCK(void); -void lookup(char *); - static void -check_result(isc_result_t result, char *format, ...) -{ +check_result(isc_result_t result, char *format, ...) { va_list args; if (result == ISC_R_SUCCESS) @@ -93,9 +70,8 @@ check_result(isc_result_t result, char *format, ...) exit(1); } -client_t * -new_client(void) -{ +static client_t * +new_client(void) { client_t *client; client = isc_mempool_get(cmp); @@ -107,9 +83,8 @@ new_client(void) return (client); } -void -free_client(client_t **c) -{ +static void +free_client(client_t **c) { client_t *client; INSIST(c != NULL); @@ -124,20 +99,17 @@ free_client(client_t **c) } static inline void -CLOCK(void) -{ +CLOCK(void) { RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS); } static inline void -CUNLOCK(void) -{ +CUNLOCK(void) { RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS); } static void -lookup_callback(isc_task_t *task, isc_event_t *ev) -{ +lookup_callback(isc_task_t *task, isc_event_t *ev) { client_t *client; client = ev->ev_arg; @@ -159,9 +131,8 @@ lookup_callback(isc_task_t *task, isc_event_t *ev) CUNLOCK(); } -void -create_managers(void) -{ +static void +create_managers(void) { isc_result_t result; taskmgr = NULL; @@ -177,9 +148,8 @@ create_managers(void) check_result(result, "isc_socketmgr_create"); } -void -create_view(void) -{ +static void +create_view(void) { dns_cache_t *cache; isc_result_t result; @@ -219,9 +189,8 @@ create_view(void) dns_view_freeze(view); } -void -lookup(char *target) -{ +static void +lookup(char *target) { dns_name_t name; unsigned char namedata[256]; client_t *client; @@ -264,13 +233,12 @@ lookup(char *target) } int -main(int argc, char **argv) -{ +main(int argc, char **argv) { isc_result_t result; isc_logdestination_t destination; - (void)argc; - (void)argv; + UNUSED(argc); + UNUSED(argv); dns_result_register(); result = isc_app_start(); diff --git a/bin/tests/byaddr_test.c b/bin/tests/byaddr_test.c index 1f65f1a52f..ee66fc999e 100644 --- a/bin/tests/byaddr_test.c +++ b/bin/tests/byaddr_test.c @@ -21,33 +21,21 @@ #include -#include #include -#include #include -#include -#include -#include #include -#include -#include -#include +#include #include -#include #include #include #include #include #include -#include #include -#include -#include #include #include -#include #include static void diff --git a/bin/tests/byname_test.c b/bin/tests/byname_test.c index 4c7450fd0d..8fd8743a5f 100644 --- a/bin/tests/byname_test.c +++ b/bin/tests/byname_test.c @@ -24,39 +24,20 @@ #include -#include #include -#include -#include -#include +#include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include #include #include -#include -#include -#include #include -#include -#include -#include #include +#include +#include static isc_mem_t *mctx = NULL; static dns_view_t *view = NULL; diff --git a/bin/tests/compress_test.c b/bin/tests/compress_test.c index 531cc0d3cb..bc48a038a0 100644 --- a/bin/tests/compress_test.c +++ b/bin/tests/compress_test.c @@ -17,13 +17,11 @@ #include -#include #include -#include #include #include -#include +#include #include #include @@ -32,11 +30,12 @@ unsigned char plain1[] = "\003yyy\003foo"; unsigned char plain2[] = "\003bar\003yyy\003foo"; unsigned char plain3[] = "\003xxx\003bar\003foo"; -unsigned char plain[] = - "\003yyy\003foo\0\003bar\003yyy\003foo\0\003bar\003yyy\003foo\0\003xxx\003bar\003foo"; - -/* result concatenate (plain1, plain2, plain2, plain3) */ +unsigned char plain[] = "\003yyy\003foo\0\003bar\003yyy\003foo\0\003" + "bar\003yyy\003foo\0\003xxx\003bar\003foo"; +/* + * Result concatenate (plain1, plain2, plain2, plain3). + */ unsigned char bit1[] = "\101\010b"; unsigned char bit2[] = "\101\014b\260"; unsigned char bit3[] = "\101\020b\264"; @@ -45,8 +44,9 @@ unsigned char bit[] = "\101\010b\0\101\014b\260\0\101\014b\260\0\101\020b\264"; int raw = 0; int verbose = 0; -void test(unsigned int, dns_name_t *, dns_name_t *, dns_name_t *, - unsigned char *, unsigned int); +void +test(unsigned int, dns_name_t *, dns_name_t *, dns_name_t *, + unsigned char *, unsigned int); int main(int argc, char *argv[]) { diff --git a/bin/tests/db/t_db.c b/bin/tests/db/t_db.c index 13a3bf6afe..347c790afa 100644 --- a/bin/tests/db/t_db.c +++ b/bin/tests/db/t_db.c @@ -18,34 +18,18 @@ #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include -#include -#include -#include +#include #include #include #include #include #include #include -#include -#include -#include -#include -#include -#include #include @@ -97,7 +81,6 @@ t_create(char *db_type, char *origin, char *class, char *cache, } - static int t_dns_db_load(char **av) { @@ -254,12 +237,9 @@ static char *a2 = "dns_db_iscache(db) returns ISC_TRUE."; static int -t_dns_db_zc_x(char *filename, - char *db_type, char *origin, char *class, - isc_boolean_t cache, - isc_boolean_t(*cf)(dns_db_t *), - isc_boolean_t exp_result) { - +t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class, + isc_boolean_t cache, isc_boolean_t(*cf)(dns_db_t *), + isc_boolean_t exp_result) { int result; int len; dns_db_t *db; @@ -651,7 +631,6 @@ static char *a8 = static int t_dns_db_currentversion(char **av) { - char *filename; char *db_type; char *origin; @@ -819,7 +798,8 @@ t_dns_db_currentversion(char **av) { &rdataset, NULL); if ((dns_result != ISC_R_NOTFOUND) && (dns_result != DNS_R_NXDOMAIN)) { - t_info("unexpectedly found %s using current version\n", findname); + t_info("unexpectedly found %s using current version\n", + findname); dns_db_closeversion(db, &cversionp, ISC_FALSE); dns_db_closeversion(db, &nversionp, ISC_FALSE); dns_db_detach(&db); @@ -868,16 +848,15 @@ t8() { int result; t_assert("dns_db_currentversion", 8, T_REQUIRED, a8); - result = t_eval("dns_db_currentversion_data", t_dns_db_currentversion, 7); + result = t_eval("dns_db_currentversion_data", + t_dns_db_currentversion, 7); t_result(result); } - static char *a9 = "A call to dns_db_newversion() opens a new version for " "reading and writing."; - static int t_dns_db_newversion(char **av) { @@ -1132,6 +1111,7 @@ t_dns_db_newversion(char **av) { return(result); } + static void t9() { int result; @@ -1141,7 +1121,6 @@ t9() { t_result(result); } - static char *a10 = "When versionp points to a read-write version and commit is " "ISC_TRUE, a call to dns_db_closeversion(db, versionp, commit) " @@ -1150,7 +1129,6 @@ static char *a10 = static int t_dns_db_closeversion_1(char **av) { - char *filename; char *db_type; char *origin; @@ -1495,11 +1473,11 @@ t10() { int result; t_assert("dns_db_closeversion", 10, T_REQUIRED, a10); - result = t_eval("dns_db_closeversion_1_data", t_dns_db_closeversion_1, 9); + result = t_eval("dns_db_closeversion_1_data", + t_dns_db_closeversion_1, 9); t_result(result); } - static char *a11 = "When versionp points to a read-write version and commit is " "ISC_FALSE, a call to dns_db_closeversion(db, versionp, commit) " @@ -1508,7 +1486,6 @@ static char *a11 = static int t_dns_db_closeversion_2(char **av) { - char *filename; char *db_type; char *origin; @@ -1909,11 +1886,11 @@ t11() { int result; t_assert("dns_db_closeversion", 11, T_REQUIRED, a11); - result = t_eval("dns_db_closeversion_2_data", t_dns_db_closeversion_2, 9); + result = t_eval("dns_db_closeversion_2_data", + t_dns_db_closeversion_2, 9); t_result(result); } - static char *a12 = "A call to dns_db_expirenode() marks as stale all records at node " "which expire at or before 'now'. If 'now' is zero, then the current " @@ -1921,7 +1898,6 @@ static char *a12 = static int t_dns_db_expirenode(char **av) { - char *filename; char *db_type; char *origin; @@ -2088,17 +2064,14 @@ t12() { t_result(result); } - static char *a13 = "If the node name exists, then a call to " "dns_db_findnode(db, name, ISC_FALSE, nodep) initializes nodep " "to point to the node and returns ISC_R_SUCCESS, otherwise " "it returns ISC_R_NOTFOUND."; - static int t_dns_db_findnode_1(char **av) { - char *filename; char *db_type; char *origin; @@ -2247,7 +2220,6 @@ static char *a14 = static int t_dns_db_findnode_2(char **av) { - char *filename; char *db_type; char *origin; @@ -2405,7 +2377,6 @@ t14() { static int t_dns_db_find_x(char **av) { - char *dbfile; char *dbtype; char *dborigin; @@ -2533,9 +2504,10 @@ t_dns_db_find_x(char **av) { &rdataset, NULL); if (dns_result != exp_result) { - t_info("dns_db_find %s %s unexpectedly returned %s, expected %s\n", - findname, findtype, dns_result_totext(dns_result), - dns_result_totext(exp_result)); + t_info("dns_db_find %s %s unexpectedly returned %s, " + "expected %s\n", + findname, findtype, dns_result_totext(dns_result), + dns_result_totext(exp_result)); result = T_FAIL; } else { @@ -2544,7 +2516,8 @@ t_dns_db_find_x(char **av) { if ((dns_result != ISC_R_NOTFOUND) && (dns_result != DNS_R_NXDOMAIN)) { - if ((dns_result != DNS_R_NXRRSET) && (dns_result != DNS_R_ZONECUT)) + if ((dns_result != DNS_R_NXRRSET) && + (dns_result != DNS_R_ZONECUT)) if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); dns_db_detachnode(db, &nodep); @@ -2560,8 +2533,8 @@ t_dns_db_find_x(char **av) { static char *a15 = "A call to dns_db_find(db, name, version, type, options, now, ...) " - "finds the best match for 'name' and 'type' in version 'version' of 'db'."; - + "finds the best match for 'name' and 'type' in version 'version' " + "of 'db'."; static void t15() { @@ -2579,7 +2552,6 @@ static char *a16 = "dns_db_find(db, name, version, type, options, now, ...) " "returns DNS_R_GLUE."; - static void t16() { int result; @@ -2589,12 +2561,10 @@ t16() { t_result(result); } - static char *a17 = "A call to dns_db_find() returns DNS_R_DELEGATION when the data " "requested is beneath a zone cut."; - static void t17() { int result; @@ -2604,12 +2574,10 @@ t17() { t_result(result); } - static char *a18 = "A call to dns_db_find() returns DNS_R_ZONECUT when type is " "dns_rdatatype_any and the desired node is a zone cut."; - static void t18() { int result; @@ -2619,7 +2587,6 @@ t18() { t_result(result); } - static char *a19 = "A call to dns_db_find() returns DNS_R_DNAME when the data " "requested is beneath a DNAME."; @@ -2633,7 +2600,6 @@ t19() { t_result(result); } - static char *a20 = "A call to dns_db_find() returns DNS_R_CNAME when the requested " "rdataset was not found but there is a CNAME at the desired name."; @@ -2673,7 +2639,6 @@ t22() { t_result(result); } - static char *a23 = "When db is a cache database, a call to dns_db_find() " "returns ISC_R_NOTFOUND when the desired name does not exist, " @@ -2701,7 +2666,6 @@ t24() { t_result(result); } - testspec_t T_testlist[] = { { t1, "dns_db_load" }, { t2, "dns_db_iscache" }, @@ -2729,4 +2693,3 @@ testspec_t T_testlist[] = { { t24, "dns_db_find" }, { NULL, NULL } }; - diff --git a/bin/tests/db_test.c b/bin/tests/db_test.c index 6b9e81467a..21a9a6c3a8 100644 --- a/bin/tests/db_test.c +++ b/bin/tests/db_test.c @@ -21,35 +21,21 @@ #include -#include #include -#include -#include -#include #include -#include -#include -#include -#include +#include #include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include #define MAXHOLD 100 #define MAXVERSIONS 100 diff --git a/bin/tests/dispatch_tcp_test.c b/bin/tests/dispatch_tcp_test.c index 763e8639ee..233c011b4d 100644 --- a/bin/tests/dispatch_tcp_test.c +++ b/bin/tests/dispatch_tcp_test.c @@ -17,32 +17,18 @@ #include -#include #include #include -#include - -#include #include -#include -#include #include -#include #include -#include -#include -#include -#include +#include #include #include -#include #include #include -#include -#include -#include #include #include "printmsg.h" diff --git a/bin/tests/dispatch_test.c b/bin/tests/dispatch_test.c index 350ae7df4b..a053bf96ea 100644 --- a/bin/tests/dispatch_test.c +++ b/bin/tests/dispatch_test.c @@ -17,33 +17,18 @@ #include -#include #include #include -#include - -#include #include -#include -#include #include -#include -#include +#include #include -#include -#include -#include -#include #include #include -#include #include #include -#include -#include -#include #include #include "printmsg.h" @@ -62,20 +47,18 @@ isc_taskmgr_t *manager; isc_socketmgr_t *socketmgr; dns_dispatch_t *disp; isc_task_t *t0, *t1, *t2; -clictx_t clients[16]; /* lots of things might want to use this */ +clictx_t clients[16]; /* Lots of things might want to use this. */ unsigned int client_count = 0; isc_mutex_t client_lock; -void got_request(isc_task_t *, isc_event_t *); -void got_response(isc_task_t *, isc_event_t *); -void start_response(clictx_t *, char *, isc_task_t *); -static inline void CHECKRESULT(isc_result_t, char *); -void send_done(isc_task_t *, isc_event_t *); -void hex_dump(isc_buffer_t *); - +/* + * Forward declarations. + */ void -hex_dump(isc_buffer_t *b) -{ +got_response(isc_task_t *, isc_event_t *); + +static void +hex_dump(isc_buffer_t *b) { unsigned int len; isc_region_t r; @@ -92,8 +75,7 @@ hex_dump(isc_buffer_t *b) } static inline void -CHECKRESULT(isc_result_t result, char *msg) -{ +CHECKRESULT(isc_result_t result, char *msg) { if (result != ISC_R_SUCCESS) { printf("%s: %s\n", msg, isc_result_totext(result)); @@ -101,9 +83,8 @@ CHECKRESULT(isc_result_t result, char *msg) } } -void -send_done(isc_task_t *task, isc_event_t *ev_in) -{ +static void +send_done(isc_task_t *task, isc_event_t *ev_in) { isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; clictx_t *cli = (clictx_t *)ev_in->ev_arg; @@ -124,10 +105,8 @@ send_done(isc_task_t *task, isc_event_t *ev_in) isc_app_shutdown(); } - -void -start_response(clictx_t *cli, char *query, isc_task_t *task) -{ +static void +start_response(clictx_t *cli, char *query, isc_task_t *task) { dns_messageid_t id; isc_sockaddr_t from; dns_message_t *msg; @@ -229,8 +208,7 @@ start_response(clictx_t *cli, char *query, isc_task_t *task) } void -got_response(isc_task_t *task, isc_event_t *ev_in) -{ +got_response(isc_task_t *task, isc_event_t *ev_in) { dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in; dns_dispentry_t *resp = ev->ev_sender; dns_message_t *msg; @@ -283,9 +261,8 @@ got_response(isc_task_t *task, isc_event_t *ev_in) isc_app_shutdown(); } -void -got_request(isc_task_t *task, isc_event_t *ev_in) -{ +static void +got_request(isc_task_t *task, isc_event_t *ev_in) { dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in; clictx_t *cli = (clictx_t *)ev_in->ev_arg; dns_message_t *msg; @@ -352,8 +329,7 @@ got_request(isc_task_t *task, isc_event_t *ev_in) } int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { isc_socket_t *s0; isc_sockaddr_t sockaddr; unsigned int i; @@ -372,7 +348,7 @@ main(int argc, char *argv[]) dns_result_register(); /* - * The task manager is independent (other than memory context) + * The task manager is independent (other than memory context). */ manager = NULL; RUNTIME_CHECK(isc_taskmgr_create(mctx, 5, 0, &manager) == @@ -402,7 +378,7 @@ main(int argc, char *argv[]) RUNTIME_CHECK(isc_socket_bind(s0, &sockaddr) == ISC_R_SUCCESS); /* - * Create a dispatch context + * Create a dispatch context. */ disp = NULL; RUNTIME_CHECK(dns_dispatch_create(mctx, s0, t0, 512, 6, 1024, diff --git a/bin/tests/dst/dst_test.c b/bin/tests/dst/dst_test.c index 3ba1e131be..54e6aaed1a 100644 --- a/bin/tests/dst/dst_test.c +++ b/bin/tests/dst/dst_test.c @@ -17,19 +17,13 @@ #include -#include -#include #include -#include #include /* XXX */ -#include -#include -#include +#include #include #include -#include #include diff --git a/bin/tests/dst/t_dst.c b/bin/tests/dst/t_dst.c index 109bd15c53..b1f7610e9f 100644 --- a/bin/tests/dst/t_dst.c +++ b/bin/tests/dst/t_dst.c @@ -17,37 +17,29 @@ #include -#include -#include +#include /* Required for dirent.h */ +#include + #include #include #include #include -#include #include -#include -#include #include /* XXX */ -#include -#include -#include -#include +#include #include -#include +#include +#include #include #include #include -static void t1(void); - -static void t2(void); - /* - * adapted from the original dst_test.c program + * Adapted from the original dst_test.c program. */ static void @@ -81,7 +73,6 @@ cleandir(char *path) { return; } - static void use(dst_key_t *key, isc_result_t exp_result, int *nfails) { @@ -236,8 +227,9 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx, } static void -io(char *name, int id, int alg, int type, isc_mem_t *mctx, isc_result_t exp_result, - int *nfails, int *nprobs) { +io(char *name, int id, int alg, int type, isc_mem_t *mctx, + isc_result_t exp_result, int *nfails, int *nprobs) +{ dst_key_t *key; isc_result_t ret; int rval; @@ -309,7 +301,8 @@ generate(int alg, isc_mem_t *mctx, int size, int *nfails) { ret = dst_key_generate("test.", alg, size, 0, 0, 0, mctx, &key); if (ret != ISC_R_SUCCESS) { - t_info("dst_key_generate(%d) returned: %s\n", alg, dst_result_totext(ret)); + t_info("dst_key_generate(%d) returned: %s\n", alg, + dst_result_totext(ret)); ++*nfails; return; } @@ -367,7 +360,7 @@ static char *a1 = "compute Diffie-Hellman shared secrets, " "and generate random number sequences."; static void -t1() { +t1(void) { isc_mem_t *mctx; int nfails; int nprobs; @@ -381,7 +374,8 @@ t1() { mctx = NULL; isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %d\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %d\n", + isc_result_totext(isc_result)); t_result(T_UNRESOLVED); return; } @@ -429,7 +423,9 @@ t1() { #ifdef NEWSIG -/* write a sig in buf to file at path */ +/* + * Write a sig in buf to file at path. + */ static int sig_tofile(char *path, isc_buffer_t *buf) { int rval; @@ -444,7 +440,8 @@ sig_tofile(char *path, isc_buffer_t *buf) { nprobs = 0; len = buf->used - buf->current; - t_info("buf: current %d used %d len %d\n", buf->current, buf->used, len); + t_info("buf: current %d used %d len %d\n", + buf->current, buf->used, len); fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRWXU|S_IRWXO|S_IRWXG); if (fd < 0) { @@ -500,7 +497,9 @@ sig_tofile(char *path, isc_buffer_t *buf) { #endif /* NEWSIG */ -/* read sig in file at path to buf */ +/* + * Read sig in file at path to buf. + */ static int sig_fromfile(char *path, isc_buffer_t *iscbuf) { int rval; @@ -574,13 +573,12 @@ sig_fromfile(char *path, isc_buffer_t *iscbuf) { return(0); } - static void t2_sigchk(char *datapath, char *sigpath, char *keyname, int id, int alg, int type, isc_mem_t *mctx, char *expected_result, - int *nfails, int *nprobs) { - + int *nfails, int *nprobs) +{ int rval; int len; int fd; @@ -596,7 +594,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname, isc_region_t datareg; isc_region_t sigreg; - /* read data from file in a form usable by dst_verify */ + /* + * Read data from file in a form usable by dst_verify. + */ rval = stat(datapath, &sb); if (rval != 0) { t_info("t2_sigchk: stat (%s) failed %d\n", datapath, errno); @@ -630,7 +630,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname, } while (len); (void) close(fd); - /* read key from file in a form usable by dst_verify */ + /* + * Read key from file in a form usable by dst_verify. + */ isc_result = dst_key_fromfile(keyname, id, alg, type, mctx, &key); if (isc_result != ISC_R_SUCCESS) { t_info("dst_key_fromfile failed %s\n", @@ -690,7 +692,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname, return; } - /* verify that the key signed the data */ + /* + * Verify that the key signed the data. + */ isc_buffer_remainingregion(&sigbuf, &sigreg); exp_res = 0; @@ -713,17 +717,18 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname, } /* - * the astute observer will note that t1() signs then verifies data + * The astute observer will note that t1() signs then verifies data * during the test but that t2() verifies data that has been * signed at some earlier time, possibly with an entire different * version or implementation of the DSA and RSA algorithms */ - static char *a2 = "the dst module provides the capability to " "verify data signed with the RSA and DSA algorithms"; -/* av == datafile, sigpath, keyname, keyid, alg, exp_result */ +/* + * av == datafile, sigpath, keyname, keyid, alg, exp_result. + */ static int t2_vfy(char **av) { char *datapath; @@ -762,7 +767,8 @@ t2_vfy(char **av) { mctx = NULL; isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %d\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %d\n", + isc_result_totext(isc_result)); return(T_UNRESOLVED); } @@ -780,12 +786,12 @@ t2_vfy(char **av) { result = T_FAIL; else if ((nfails == 0) && (nprobs == 0)) result = T_PASS; - return(result); + return(result); } static void -t2() { +t2(void) { int result; t_assert("dst", 2, T_REQUIRED, a2); result = t_eval("dst_2_data", t2_vfy, 6); diff --git a/bin/tests/gxba_test.c b/bin/tests/gxba_test.c index 333069565c..8fc36a1ab4 100644 --- a/bin/tests/gxba_test.c +++ b/bin/tests/gxba_test.c @@ -14,10 +14,9 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +#include #include -#include -#include #include diff --git a/bin/tests/gxbn_test.c b/bin/tests/gxbn_test.c index 0a00410189..db7c422fab 100644 --- a/bin/tests/gxbn_test.c +++ b/bin/tests/gxbn_test.c @@ -15,9 +15,9 @@ * SOFTWARE. */ +#include + #include -#include -#include #include diff --git a/bin/tests/inter_test.c b/bin/tests/inter_test.c index 23a9242ac7..5b917a30fd 100644 --- a/bin/tests/inter_test.c +++ b/bin/tests/inter_test.c @@ -15,12 +15,12 @@ * SOFTWARE. */ +#include + #include -#include #include #include -#include #include int @@ -50,16 +50,19 @@ main(int argc, char **argv) { fprintf(stdout, "%s %d %x\n", ifdata.name, ifdata.af, ifdata.flags); INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6); - res = inet_ntop(ifdata.af, &ifdata.address.type, buf, sizeof buf); + res = inet_ntop(ifdata.af, &ifdata.address.type, buf, + sizeof(buf)); fprintf(stdout, "address = %s\n", res == NULL ? "BAD" : res); INSIST(ifdata.address.family == ifdata.af); - res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf, sizeof buf); + res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf, + sizeof(buf)); fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res); INSIST(ifdata.netmask.family == ifdata.af); if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) { res = inet_ntop(ifdata.af, &ifdata.dstaddress.type, - buf, sizeof buf); - fprintf(stdout, "dstaddress = %s\n", res == NULL ? "BAD" : res); + buf, sizeof(buf)); + fprintf(stdout, "dstaddress = %s\n", + res == NULL ? "BAD" : res); INSIST(ifdata.dstaddress.family == ifdata.af); } diff --git a/bin/tests/keygen.c b/bin/tests/keygen.c index 9ee666eda0..4a78670924 100644 --- a/bin/tests/keygen.c +++ b/bin/tests/keygen.c @@ -15,21 +15,16 @@ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE. */ -/* $Id: keygen.c,v 1.14 2000/05/05 19:55:56 gson Exp $ */ +/* $Id: keygen.c,v 1.15 2000/05/08 14:33:32 tale Exp $ */ #include -#include -#include #include -#include -#include -#include #include -#include #include -#include +#include +#include #include #include @@ -45,17 +40,17 @@ static int verbose; int main(int argc, char **argv) { - char *algname = NULL, *nametype = NULL, *type = NULL; - char *prog, *endp; - dst_key_t *key; - char *name = NULL; - isc_uint16_t flags = 0; - dns_secalg_t alg; - isc_mem_t *mctx = NULL; - int ch, rsa_exp = 0, generator = 0, param = 0; - int protocol = -1, size = -1, signatory = 0; - isc_textregion_t r; - isc_result_t ret; + char *algname = NULL, *nametype = NULL, *type = NULL; + char *prog, *endp; + dst_key_t *key; + char *name = NULL; + isc_uint16_t flags = 0; + dns_secalg_t alg; + isc_mem_t *mctx = NULL; + int ch, rsa_exp = 0, generator = 0, param = 0; + int protocol = -1, size = -1, signatory = 0; + isc_result_t ret; + isc_textregion_t r; RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); @@ -106,10 +101,12 @@ main(int argc, char **argv) { case 'p': protocol = strtol(isc_commandline_argument, &endp, 10); if (*endp != '\0' || protocol < 0 || protocol > 255) - die("-p must be followed by a number [0..255]"); + die("-p must be followed by " + "a number [0..255]"); break; case 's': - signatory = strtol(isc_commandline_argument, &endp, 10); + signatory = strtol(isc_commandline_argument, + &endp, 10); if (*endp != '\0' || signatory < 0 || signatory > 15) die("-s must be followed by a number [0..15]"); break; @@ -284,7 +281,7 @@ die(char *str) { static void usage(char *prog) { printf("Usage:\n"); - printf (" %s [options] name\n\n", prog); + printf(" %s [options] name\n\n", prog); printf("Required options:\n"); printf(" -a algorithm: RSA | RSAMD5 | DH | DSA | HMAC-MD5\n"); printf(" -b key size, in bits:\n"); @@ -300,7 +297,8 @@ usage(char *prog) { printf(" -t type: AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF\n"); printf(" default: AUTHCONF\n"); printf(" -p protocol value\n"); - printf(" default: 2 (email) for User keys, 3 (dnssec) for all others\n"); + printf(" default: 2 (email) for User keys, " + "3 (dnssec) for all others\n"); printf(" -s strength value this key signs DNS records with\n"); printf(" default: 0\n"); printf(" -v verbose level\n"); diff --git a/bin/tests/keysettool.c b/bin/tests/keysettool.c index 5557d34a94..21fdf43d55 100644 --- a/bin/tests/keysettool.c +++ b/bin/tests/keysettool.c @@ -17,41 +17,22 @@ #include -#include #include -#include -#include -#include #include -#include -#include -#include #include -#include -#include +#include #include -#include -#include -#include #include -#include +#include +#include +#include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include -#include - -#include #define BUFSIZE 2048 @@ -69,6 +50,7 @@ static int verbose; static isc_mem_t *mctx = NULL; static keylist_t keylist; + static inline void fatal(char *message) { fprintf(stderr, "%s\n", message); @@ -119,7 +101,8 @@ usage() { fprintf(stderr, "\t-s YYYYMMDDHHMMSS|+offset:\n"); fprintf(stderr, "\t\tSIG start time - absolute|offset (now)\n"); fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n"); - fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n"); + fprintf(stderr, "\t\tSIG end time - " + "absolute|from start|from now (now + 30 days)\n"); fprintf(stderr, "\t-t ttl\n"); fprintf(stderr, "\t-v level:\n"); fprintf(stderr, "\t\tverbose level (0)\n"); @@ -170,14 +153,16 @@ main(int argc, char *argv[]) { startstr = isc_mem_strdup(mctx, isc_commandline_argument); if (startstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'e': endstr = isc_mem_strdup(mctx, isc_commandline_argument); if (endstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 't': @@ -249,7 +234,8 @@ main(int argc, char *argv[]) { isc_buffer_usedregion(&b, &r); tdomain[r.length] = 0; - output = isc_mem_allocate(mctx, strlen(tdomain) + strlen("keyset") + 1); + output = isc_mem_allocate(mctx, + strlen(tdomain) + strlen("keyset") + 1); if (output == NULL) check_result(ISC_R_FAILURE, "isc_mem_allocate()"); strcpy(output, tdomain); @@ -344,7 +330,8 @@ main(int argc, char *argv[]) { check_result(ISC_R_NOMEMORY, "isc_mem_get()"); isc_buffer_init(&b, data, BUFSIZE); result = dns_dnssec_sign(domain, &rdataset, keynode->key, - &starttime, &endtime, mctx, &b, rdata); + &starttime, &endtime, mctx, &b, + rdata); check_result(result, "dst_key_todns()"); ISC_LIST_APPEND(sigrdatalist.rdata, rdata, link); dns_rdataset_init(&sigrdataset); @@ -366,7 +353,8 @@ main(int argc, char *argv[]) { dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL); if (!ISC_LIST_EMPTY(keylist)) - dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, NULL); + dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, + NULL); dns_db_detachnode(db, &node); dns_db_closeversion(db, &version, ISC_TRUE); diff --git a/bin/tests/keysigner.c b/bin/tests/keysigner.c index d93142e113..1d48f19598 100644 --- a/bin/tests/keysigner.c +++ b/bin/tests/keysigner.c @@ -17,40 +17,21 @@ #include -#include #include -#include -#include -#include +#include #include -#include -#include -#include #include -#include -#include #include -#include -#include -#include #include -#include +#include +#include #include #include #include -#include #include -#include #include -#include -#include -#include -#include -#include - -#include #define BUFSIZE 2048 @@ -68,7 +49,6 @@ static int verbose; static isc_mem_t *mctx = NULL; static keylist_t keylist; - static inline void fatal(char *message) { fprintf(stderr, "%s\n", message); diff --git a/bin/tests/lex_test.c b/bin/tests/lex_test.c index 626c01d8ab..f74c811b84 100644 --- a/bin/tests/lex_test.c +++ b/bin/tests/lex_test.c @@ -17,16 +17,9 @@ #include -#include -#include -#include - -#include #include -#include #include #include -#include #include isc_mem_t *mctx; diff --git a/bin/tests/lfsr_test.c b/bin/tests/lfsr_test.c index be3da72c7e..02317a3aac 100644 --- a/bin/tests/lfsr_test.c +++ b/bin/tests/lfsr_test.c @@ -15,18 +15,17 @@ * SOFTWARE. */ +#include + #include -#include -#include #include #include isc_uint32_t state[1024 * 64]; int -main(int argc, char **argv) -{ +main(int argc, char **argv) { isc_lfsr_t lfsr1, lfsr2; int i; isc_uint32_t temp; @@ -46,7 +45,8 @@ main(int argc, char **argv) for (i = 0 ; i < 32 ; i++) { isc_lfsr_generate(&lfsr1, &temp, 4); if (state[i] != temp) - printf("lfsr1: state[%2d] = %08x, but new state is %08x\n", + printf("lfsr1: state[%2d] = %08x, " + "but new state is %08x\n", i, state[i], temp); } @@ -64,7 +64,8 @@ main(int argc, char **argv) isc_lfsr_generate(&lfsr1, &temp, 4); isc_lfsr_skip(&lfsr1, 32); if (state[i] != temp) - printf("lfsr1: state[%2d] = %08x, but new state is %08x\n", + printf("lfsr1: state[%2d] = %08x, " + "but new state is %08x\n", i, state[i], temp); } @@ -82,10 +83,10 @@ main(int argc, char **argv) for (i = 0 ; i < 32 ; i++) { isc_lfsr_generate(&lfsr2, &temp, 4); if (state[i] != temp) - printf("lfsr2: state[%2d] = %08x, but new state is %08x\n", + printf("lfsr2: state[%2d] = %08x, " + "but new state is %08x\n", i, state[i], temp); } - return (0); } diff --git a/bin/tests/log_test.c b/bin/tests/log_test.c index a419cc638d..7658049a99 100644 --- a/bin/tests/log_test.c +++ b/bin/tests/log_test.c @@ -15,22 +15,20 @@ * SOFTWARE. */ -/* $Id: log_test.c,v 1.13 2000/05/03 21:11:26 explorer Exp $ */ +/* $Id: log_test.c,v 1.14 2000/05/08 14:33:37 tale Exp $ */ /* Principal Authors: DCL */ +#include + #include -#include -#include #include #include #include -#include -#include +#include #include -#include #define TEST_FILE "/tmp/test_log" #define SYSLOG_FILE "/var/log/daemon.log" diff --git a/bin/tests/lwres_test.c b/bin/tests/lwres_test.c index a830c8e6fe..6f1d76b0b9 100644 --- a/bin/tests/lwres_test.c +++ b/bin/tests/lwres_test.c @@ -18,27 +18,18 @@ #include #include -#include -#include #include -#include -#include -#include #include #include #include -#include -#include #include -#include #define USE_ISC_MEM static inline void -CHECK(int val, char *msg) -{ +CHECK(int val, char *msg) { if (val != 0) { fprintf(stderr, "%s returned %d\n", msg, val); exit(1); @@ -46,8 +37,7 @@ CHECK(int val, char *msg) } static void -hexdump(char *msg, void *base, size_t len) -{ +hexdump(char *msg, void *base, size_t len) { unsigned char *p; unsigned int cnt; @@ -76,8 +66,7 @@ static char *TESTSTRING = "This is a test. This is only a test. !!!"; static lwres_context_t *ctx; static void -test_noop(void) -{ +test_noop(void) { int ret; lwres_lwpacket_t pkt, pkt2; lwres_nooprequest_t nooprequest, *nooprequest2; @@ -156,8 +145,7 @@ test_noop(void) } static void -test_gabn(char *target) -{ +test_gabn(char *target) { lwres_gabnresponse_t *res; lwres_addr_t *addr; int ret; @@ -201,8 +189,7 @@ test_gabn(char *target) } static void -test_gnba(char *target, lwres_uint32_t af) -{ +test_gnba(char *target, lwres_uint32_t af) { lwres_gnbaresponse_t *res; int ret; unsigned int i; @@ -239,21 +226,18 @@ test_gnba(char *target, lwres_uint32_t af) * Wrappers around our memory management stuff, for the lwres functions. */ static void * -mem_alloc(void *arg, size_t size) -{ +mem_alloc(void *arg, size_t size) { return (isc_mem_get(arg, size)); } static void -mem_free(void *arg, void *mem, size_t size) -{ +mem_free(void *arg, void *mem, size_t size) { isc_mem_put(arg, mem, size); } #endif int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { int ret; #ifdef USE_ISC_MEM isc_mem_t *mem; diff --git a/bin/tests/lwresconf_test.c b/bin/tests/lwresconf_test.c index fbcf2e05d5..241c25c3ff 100644 --- a/bin/tests/lwresconf_test.c +++ b/bin/tests/lwresconf_test.c @@ -17,28 +17,17 @@ #include -#include -#include -#include #include -#include -#include -#include #include -#include #include -#include -#include #include -#include #define USE_ISC_MEM static inline void -CHECK(int val, char *msg) -{ +CHECK(int val, char *msg) { if (val != 0) { fprintf(stderr, "%s returned %d\n", msg, val); exit(1); @@ -50,21 +39,18 @@ CHECK(int val, char *msg) * Wrappers around our memory management stuff, for the lwres functions. */ static void * -mem_alloc(void *arg, size_t size) -{ +mem_alloc(void *arg, size_t size) { return (isc_mem_get(arg, size)); } static void -mem_free(void *arg, void *mem, size_t size) -{ +mem_free(void *arg, void *mem, size_t size) { isc_mem_put(arg, mem, size); } #endif int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { lwres_context_t *ctx; const char *file = "/etc/resolv.conf"; int ret; diff --git a/bin/tests/master/t_master.c b/bin/tests/master/t_master.c index ebf4113d99..aa825ebf17 100644 --- a/bin/tests/master/t_master.c +++ b/bin/tests/master/t_master.c @@ -15,31 +15,29 @@ * SOFTWARE. */ -#include +#include -#include -#include -#include -#include +#include +#include -#include -#include -#include -#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include + +#include #define BUFLEN 255 #define BIGBUFLEN (64 * 1024) static isc_result_t t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset); + static void t1(void); @@ -64,8 +62,7 @@ t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) { } static int -test_master(char *testfile, char *origin, char *class, - isc_result_t exp_result) +test_master(char *testfile, char *origin, char *class, isc_result_t exp_result) { int result; int len; @@ -157,29 +154,29 @@ test_master_x(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace(*p & 0xff)) || (*p == '#')) continue; - /* name of data file, origin, zclass, expected result */ + /* + * Name of data file, origin, zclass, expected result. + */ cnt = t_bustline(p, Tokens); if (cnt == 4) { - result = test_master( - Tokens[0], - Tokens[1], - Tokens[2], - t_dns_result_fromtext(Tokens[3])); - } - else { + result = test_master(Tokens[0], Tokens[1], + Tokens[2], + t_dns_result_fromtext(Tokens[3])); + } else { t_info("bad format in %s at line %d\n", - filename, line); + filename, line); } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); } return(result); @@ -195,8 +192,9 @@ t1() { t_result(result); } -static char *a2 = "dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the " - "masterfile input ends unexpectedly"; +static char *a2 = "dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the " + "masterfile input ends unexpectedly"; + static void t2() { int result; @@ -240,8 +238,8 @@ t5() { t_result(result); } -static char *a6 = "dns_master_loadfile understands KEY RR specifications " - "containing key material"; +static char *a6 = "dns_master_loadfile understands KEY RR specifications " + "containing key material"; static void t6() { @@ -253,8 +251,8 @@ t6() { t_result(result); } -static char *a7 = "dns_master_loadfile understands KEY RR specifications " - "containing no key material"; +static char *a7 = "dns_master_loadfile understands KEY RR specifications " + "containing no key material"; static void t7() { diff --git a/bin/tests/master_test.c b/bin/tests/master_test.c index b49b5d2ea4..db7c4aa073 100644 --- a/bin/tests/master_test.c +++ b/bin/tests/master_test.c @@ -17,20 +17,17 @@ #include -#include #include -#include -#include #include -#include +#include #include +#include #include #include #include #include -#include isc_mem_t *mctx; diff --git a/bin/tests/mem/t_mem.c b/bin/tests/mem/t_mem.c index d779c9e94c..9414766b3a 100644 --- a/bin/tests/mem/t_mem.c +++ b/bin/tests/mem/t_mem.c @@ -17,23 +17,13 @@ #include -#include -#include -#include - -#include -#include #include -#include + #include -static void -t1(void); - /* - * adapted from the original mempool_test.c program + * Adapted from the original mempool_test.c program. */ - isc_mem_t *mctx; #define MP1_FREEMAX 10 @@ -194,7 +184,7 @@ static char *a1 = "the memory module supports the creation of memory contexts " "and the management of memory pools."; static void -t1() { +t1(void) { int rval; int result; diff --git a/bin/tests/mempool_test.c b/bin/tests/mempool_test.c index da56d5ae12..1254331dba 100644 --- a/bin/tests/mempool_test.c +++ b/bin/tests/mempool_test.c @@ -17,22 +17,13 @@ #include -#include -#include -#include - -#include -#include #include -#include -#include #include isc_mem_t *mctx; int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { void *items1[50]; void *items2[50]; void *tmp; @@ -40,9 +31,8 @@ main(int argc, char *argv[]) unsigned int i, j; isc_mutex_t lock; - /* Silence annoying compiler warning. */ - (void)argc; - (void)argv; + UNUSED(argc); + UNUSED(argv); RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); diff --git a/bin/tests/name_test.c b/bin/tests/name_test.c index 6d5ef36b98..5628695516 100644 --- a/bin/tests/name_test.c +++ b/bin/tests/name_test.c @@ -17,21 +17,14 @@ #include -#include -#include #include -#include -#include #include -#include -#include +#include #include -#include -#include -#include #include +#include static void print_wirename(isc_region_t *name) { diff --git a/bin/tests/names/t_names.c b/bin/tests/names/t_names.c index d75740c346..64f489a364 100644 --- a/bin/tests/names/t_names.c +++ b/bin/tests/names/t_names.c @@ -15,24 +15,18 @@ * SOFTWARE. */ -#include +#include -#include -#include -#include -#include -#include -#include +#include +#include -#include -#include +#include +#include +#include -#include -#include -#include -#include +#include -#include +#include #define MAXTOKS 16 #define BUFLEN 256 diff --git a/bin/tests/nconf_test.c b/bin/tests/nconf_test.c index 3955b54163..6f195bbdf9 100644 --- a/bin/tests/nconf_test.c +++ b/bin/tests/nconf_test.c @@ -17,33 +17,23 @@ #include -#include -#include -#include #include -#include +#include #include +#include #include #include #include -#include - -isc_result_t zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, - dns_c_view_t *view, void *uap); -isc_result_t optscbk(dns_c_ctx_t *ctx, void *uap); - - -isc_result_t -zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) -{ +static isc_result_t +zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) { const char *zname; const char *vname; - (void) ctx; - (void) uap; + UNUSED(ctx); + UNUSED(uap); dns_c_zone_getname(zone, &zname); @@ -54,7 +44,7 @@ zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) vname = "no current view"; } #else - (void) view; + UNUSED(view); vname = "foo"; #endif @@ -63,20 +53,20 @@ zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) return (ISC_R_SUCCESS); } - -isc_result_t -optscbk(dns_c_ctx_t *ctx, void *uap) -{ - (void) ctx; - (void) uap; +static isc_result_t +optscbk(dns_c_ctx_t *ctx, void *uap) { + UNUSED(ctx); + UNUSED(uap); fprintf(stderr, "Processing options in callback.\n"); return (ISC_R_SUCCESS); } + extern int dns__yydebug; - -int main (int argc, char **argv) { + +int +main (int argc, char **argv) { dns_c_ctx_t *configctx = NULL; const char *conffile; FILE *outfp; @@ -85,16 +75,14 @@ int main (int argc, char **argv) { isc_log_t *log = NULL; isc_logconfig_t *logcfg = NULL; + callbacks.zonecbk = zonecbk; + callbacks.optscbk = optscbk; + callbacks.zonecbkuap = NULL; + callbacks.optscbkuap = NULL; + #if 1 callbacks.zonecbk = NULL; - callbacks.zonecbkuap = NULL; callbacks.optscbk = NULL; - callbacks.optscbkuap = NULL; -#else - callbacks.zonecbk = zonecbk; - callbacks.zonecbkuap = NULL; - callbacks.optscbk = optscbk; - callbacks.optscbkuap = NULL; #endif if (argc > 1 && strcmp(argv[1],"-d") == 0) { @@ -170,7 +158,3 @@ int main (int argc, char **argv) { return (0); } - - - - diff --git a/bin/tests/ndcconf_test.c b/bin/tests/ndcconf_test.c index 93d6b58c71..9b3cd9f670 100644 --- a/bin/tests/ndcconf_test.c +++ b/bin/tests/ndcconf_test.c @@ -18,13 +18,9 @@ #include #include -#include -#include -#include -#include #include -#include +#include #include #include diff --git a/bin/tests/nxtify.c b/bin/tests/nxtify.c index 714826d3e8..9e62dfbcd2 100644 --- a/bin/tests/nxtify.c +++ b/bin/tests/nxtify.c @@ -17,27 +17,18 @@ #include -#include #include -#include -#include -#include -#include -#include #include +#include -#include -#include -#include #include #include -#include -#include +#include +#include #include #include #include -#include static isc_mem_t *mctx = NULL; diff --git a/bin/tests/omapi_test.c b/bin/tests/omapi_test.c index 09c5e2849f..b4b8f38d33 100644 --- a/bin/tests/omapi_test.c +++ b/bin/tests/omapi_test.c @@ -18,26 +18,18 @@ /* * Test code for OMAPI. */ +#include -#include -#include #include -#include -#include -#include #include #include #include -#include -#include -#include #include +#include #include #include -#include - #include #include diff --git a/bin/tests/printmsg.c b/bin/tests/printmsg.c index a80f23077d..7126e8675a 100644 --- a/bin/tests/printmsg.c +++ b/bin/tests/printmsg.c @@ -17,27 +17,9 @@ #include -#include -#include -#include -#include - -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include "printmsg.h" @@ -81,8 +63,7 @@ static char *rcodetext[] = { }; static isc_result_t -printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name) -{ +printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name) { dns_name_t *name, *print_name; dns_rdataset_t *rdataset; isc_buffer_t target; diff --git a/bin/tests/ratelimiter_test.c b/bin/tests/ratelimiter_test.c index 998eea1b42..c99165ab3f 100644 --- a/bin/tests/ratelimiter_test.c +++ b/bin/tests/ratelimiter_test.c @@ -17,17 +17,9 @@ #include -#include -#include -#include - #include -#include -#include #include #include -#include -#include #include #include #include @@ -65,8 +57,7 @@ schedule_t schedule[] = { isc_timer_t *timers[NEVENTS]; static void -ltick(isc_task_t *task, isc_event_t *event) -{ +ltick(isc_task_t *task, isc_event_t *event) { UNUSED(task); printf("** ltick%s **\n", (event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0 ? @@ -75,8 +66,7 @@ ltick(isc_task_t *task, isc_event_t *event) } static void -utick(isc_task_t *task, isc_event_t *event) -{ +utick(isc_task_t *task, isc_event_t *event) { isc_result_t result; UNUSED(task); event->ev_action = ltick; diff --git a/bin/tests/rbt/t_rbt.c b/bin/tests/rbt/t_rbt.c index e56ddee23a..de4e3d5f1d 100644 --- a/bin/tests/rbt/t_rbt.c +++ b/bin/tests/rbt/t_rbt.c @@ -15,23 +15,18 @@ * SOFTWARE. */ -#include +#include -#include -#include -#include -#include -#include +#include +#include -#include -#include +#include +#include -#include -#include -#include -#include +#include +#include -#include +#include #define BUFLEN 1024 #define DNSNAMELEN 255 @@ -39,20 +34,29 @@ char *progname; char *Tokens[T_MAXTOKS]; -static int t_dns_rbtnodechain_init(char *dbfile, char *findname, +static int +t_dns_rbtnodechain_init(char *dbfile, char *findname, char *firstname, char *firstorigin, char *nextname, char *nextorigin, char *prevname, char *prevorigin, char *lastname, char *lastorigin); -static char *fixedname_totext(dns_fixedname_t *name); -static int fixedname_cmp(dns_fixedname_t *dns_name, char *txtname); -static char *dnsname_totext(dns_name_t *name); -static int t_namechk(isc_result_t dns_result, dns_fixedname_t *dns_name, char *exp_name, - dns_fixedname_t *dns_origin, char *exp_origin, - isc_result_t exp_result); +static char * +fixedname_totext(dns_fixedname_t *name); -/* parts adapted from the original rbt_test.c */ +static int +fixedname_cmp(dns_fixedname_t *dns_name, char *txtname); +static char * +dnsname_totext(dns_name_t *name); + +static int +t_namechk(isc_result_t dns_result, dns_fixedname_t *dns_name, char *exp_name, + dns_fixedname_t *dns_origin, char *exp_origin, + isc_result_t exp_result); + +/* + * Parts adapted from the original rbt_test.c. + */ static int fixedname_cmp(dns_fixedname_t *dns_name, char *txtname) { char *name; @@ -62,8 +66,7 @@ fixedname_cmp(dns_fixedname_t *dns_name, char *txtname) { if ((name == NULL) || (*name == '\0')) return(0); return(1); - } - else { + } else { return(strcmp(name, txtname)); } } @@ -149,8 +152,7 @@ create_name(char *s, isc_mem_t *mctx, dns_name_t **dns_name) { t_info("dns_name_fromtext(%s) failed %s\n", s, dns_result_totext(result)); } - } - else { + } else { ++nfails; t_info("create_name: empty name\n"); } @@ -167,11 +169,11 @@ delete_name(void *data, void *arg) { } -/* adapted from the original rbt_test.c */ - +/* + * Adapted from the original rbt_test.c. + */ static int t1_add(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) { - int nprobs; dns_name_t *dns_name; @@ -182,22 +184,22 @@ t1_add(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) { if (T_debug) t_info("dns_rbt_addname succeeded\n"); *dns_result = dns_rbt_addname(rbt, dns_name, dns_name); - } - else { + } else { t_info("dns_rbt_addname failed %s\n", dns_result_totext(*dns_result)); delete_name(dns_name, mctx); ++nprobs; } - } - else { + } else { ++nprobs; } return(nprobs); } static int -t1_delete(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) { +t1_delete(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, + isc_result_t *dns_result) +{ int nprobs; dns_name_t *dns_name; @@ -205,22 +207,22 @@ t1_delete(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) if (name && dns_result) { *dns_result = create_name(name, mctx, &dns_name); if (*dns_result == ISC_R_SUCCESS) { - *dns_result = dns_rbt_deletename(rbt, dns_name, ISC_FALSE); + *dns_result = dns_rbt_deletename(rbt, dns_name, + ISC_FALSE); delete_name(dns_name, mctx); - } - else { + } else { ++nprobs; } - } - else { + } else { ++nprobs; } return(nprobs); } static int -t1_search(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) { - +t1_search(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, + isc_result_t *dns_result) +{ int nprobs; dns_name_t *dns_searchname; dns_name_t *dns_foundname; @@ -237,21 +239,20 @@ t1_search(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) *dns_result = dns_rbt_findname(rbt, dns_searchname, 0, dns_foundname, &data); delete_name(dns_searchname, mctx); - } - else { + } else { ++nprobs; } - } - else { + } else { ++nprobs; } return(nprobs); } -/* initialize a database from filename */ +/* + * Initialize a database from filename. + */ static int rbt_init(char *filename, dns_rbt_t **rbt, isc_mem_t *mctx) { - int rval; isc_result_t dns_result; char *p; @@ -296,7 +297,9 @@ rbt_init(char *filename, dns_rbt_t **rbt, isc_mem_t *mctx) { } static int -test_rbt_gen(char *filename, char *command, char *testname, isc_result_t exp_result) { +test_rbt_gen(char *filename, char *command, char *testname, + isc_result_t exp_result) +{ int rval; int result; dns_rbt_t *rbt; @@ -329,8 +332,7 @@ test_rbt_gen(char *filename, char *command, char *testname, isc_result_t exp_res /* now try the database command */ if (strcmp(command, "create") == 0) { result = T_PASS; - } - else if (strcmp(command, "add") == 0) { + } else if (strcmp(command, "add") == 0) { dns_result = create_name(testname, mctx, &dns_name); if (dns_result == ISC_R_SUCCESS) { dns_result = dns_rbt_addname(rbt, dns_name, dns_name); @@ -340,71 +342,63 @@ test_rbt_gen(char *filename, char *command, char *testname, isc_result_t exp_res if (dns_result == exp_result) { if (dns_result == ISC_R_SUCCESS) { - rval = t1_search(testname, rbt, mctx, &dns_result); + rval = t1_search(testname, rbt, mctx, + &dns_result); if (rval == 0) { - if (dns_result == ISC_R_SUCCESS) { - result = T_PASS; - } - else { - result = T_FAIL; - } - } - else { + if (dns_result == ISC_R_SUCCESS) { + result = T_PASS; + } else { + result = T_FAIL; + } + } else { t_info("t1_search failed\n"); result = T_UNRESOLVED; } - } - else { + } else { result = T_PASS; } - } - else { - t_info("dns_rbt_addname returned %s, expected %s\n", - dns_result_totext(dns_result), - dns_result_totext(exp_result)); + } else { + t_info("dns_rbt_addname returned %s, " + "expected %s\n", + dns_result_totext(dns_result), + dns_result_totext(exp_result)); result = T_FAIL; } - } - else { + } else { t_info("create_name failed %s\n", dns_result_totext(dns_result)); result = T_UNRESOLVED; } - } - else if ((strcmp(command, "delete") == 0) || - (strcmp(command, "nuke") == 0)) { - + } else if ((strcmp(command, "delete") == 0) || + (strcmp(command, "nuke") == 0)) { rval = t1_delete(testname, rbt, mctx, &dns_result); if (rval == 0) { if (dns_result == exp_result) { - rval = t1_search(testname, rbt, mctx, &dns_result); + rval = t1_search(testname, rbt, mctx, + &dns_result); if (rval == 0) { if (dns_result == ISC_R_SUCCESS) { - t_info("dns_rbt_deletename didn't " - "delete the name"); + t_info("dns_rbt_deletename " + "didn't delete " + "the name"); result = T_FAIL; - } - else { + } else { result = T_PASS; } } - } - else { + } else { t_info("delete returned %s, expected %s\n", dns_result_totext(dns_result), dns_result_totext(exp_result)); result = T_FAIL; } } - } - else if (strcmp(command, "search") == 0) { - + } else if (strcmp(command, "search") == 0) { rval = t1_search(testname, rbt, mctx, &dns_result); if (rval == 0) { if (dns_result == exp_result) { result = T_PASS; - } - else { + } else { t_info("find returned %s, expected %s\n", dns_result_totext(dns_result), dns_result_totext(exp_result)); @@ -420,7 +414,6 @@ test_rbt_gen(char *filename, char *command, char *testname, isc_result_t exp_res static int test_dns_rbt_x(char *filename) { - FILE *fp; char *p; int line; @@ -439,32 +432,33 @@ test_dns_rbt_x(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; - /* name of db file, command, testname, expected result */ + /* + * Name of db file, command, testname, + * expected result. + */ cnt = t_bustline(p, Tokens); if (cnt == 4) { - result = test_rbt_gen( - Tokens[0], - Tokens[1], - Tokens[2], - t_dns_result_fromtext(Tokens[3])); + result = test_rbt_gen(Tokens[0], Tokens[1], + Tokens[2], + t_dns_result_fromtext(Tokens[3])); if (result != T_PASS) ++nfails; - } - else { + } else { t_info("bad format in %s at line %d\n", filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -479,8 +473,8 @@ test_dns_rbt_x(char *filename) { } -static char *a1 = "dns_rbt_create creates a rbt and returns ISC_R_SUCCESS " - "on success"; +static char *a1 = "dns_rbt_create creates a rbt and returns " + "ISC_R_SUCCESS on success"; static void t1() { @@ -491,8 +485,9 @@ t1() { t_result(result); } -static char *a2 = "dns_rbt_addname adds a name to a database and returns " - "ISC_R_SUCCESS on success"; +static char *a2 = "dns_rbt_addname adds a name to a database and " + "returns ISC_R_SUCCESS on success"; + static void t2() { int result; @@ -502,8 +497,8 @@ t2() { t_result(result); } -static char *a3 = "when name already exists, dns_rbt_addname() returns " - "ISC_R_EXISTS"; +static char *a3 = "when name already exists, dns_rbt_addname() " + "returns ISC_R_EXISTS"; static void t3() { @@ -526,8 +521,8 @@ t4() { t_result(result); } -static char *a5 = "when name does not exist, dns_rbt_deletename() returns " - "ISC_R_NOTFOUND"; +static char *a5 = "when name does not exist, dns_rbt_deletename() " + "returns ISC_R_NOTFOUND"; static void t5() { int result; @@ -537,8 +532,8 @@ t5() { t_result(result); } -static char *a6 = "when name exists and exactly matches the search name, " - "dns_rbt_findname() returns ISC_R_SUCCESS"; +static char *a6 = "when name exists and exactly matches the " + "search name dns_rbt_findname() returns ISC_R_SUCCESS"; static void t6() { @@ -612,14 +607,13 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) { } t_info("first name:\t<%s>\n", fixedname_totext(&name)); t_info("first origin:\t<%s>\n", fixedname_totext(&origin)); - } - else { + } else { dns_fixedname_init(&fullname1); - dns_result = dns_name_concatenate(dns_fixedname_name(&name), - dns_name_isabsolute(dns_fixedname_name(&name)) ? - NULL : dns_fixedname_name(&origin), - dns_fixedname_name(&fullname1), - NULL); + dns_result = dns_name_concatenate( + dns_fixedname_name(&name), + dns_name_isabsolute(dns_fixedname_name(&name)) ? + NULL : dns_fixedname_name(&origin), + dns_fixedname_name(&fullname1), NULL); if (dns_result != ISC_R_SUCCESS) { t_info("dns_name_concatenate failed %s\n", dns_result_totext(dns_result)); @@ -627,35 +621,44 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) { break; } - /* expecting origin not to get touched if next doesn't return NEWORIGIN */ + /* + * Expecting origin not to get touched if next + * doesn't return NEWORIGIN. + */ dns_fixedname_init(&name); - dns_result = dns_rbtnodechain_next(chain, dns_fixedname_name(&name), - dns_fixedname_name(&origin)); - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { + dns_result = dns_rbtnodechain_next(chain, + dns_fixedname_name(&name), + dns_fixedname_name(&origin)); + if ((dns_result != ISC_R_SUCCESS) && + (dns_result != DNS_R_NEWORIGIN)) { if (dns_result != ISC_R_NOMORE) { - t_info("dns_rbtnodechain_next failed %s\n", - dns_result_totext(dns_result)); + t_info("dns_rbtnodechain_next " + "failed %s\n", + dns_result_totext(dns_result)); ++nprobs; } break; } t_info("next name:\t<%s>\n", fixedname_totext(&name)); - t_info("next origin:\t<%s>\n", fixedname_totext(&origin)); + t_info("next origin:\t<%s>\n", + fixedname_totext(&origin)); dns_fixedname_init(&fullname2); - dns_result = dns_name_concatenate(dns_fixedname_name(&name), - dns_name_isabsolute(dns_fixedname_name(&name)) ? - NULL : dns_fixedname_name(&origin), - dns_fixedname_name(&fullname2), - NULL); + dns_result = dns_name_concatenate( + dns_fixedname_name(&name), + dns_name_isabsolute(dns_fixedname_name(&name)) ? + NULL : dns_fixedname_name(&origin), + dns_fixedname_name(&fullname2), NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_concatenate failed %s\n", dns_result_totext(dns_result)); + t_info("dns_name_concatenate failed %s\n", + dns_result_totext(dns_result)); ++nprobs; break; } - t_info("comparing\t<%s>\n", fixedname_totext(&fullname1)); + t_info("comparing\t<%s>\n", + fixedname_totext(&fullname1)); t_info("\twith\t<%s>\n", fixedname_totext(&fullname2)); dns_namereln = dns_name_fullcompare( @@ -664,10 +667,10 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) { &order, &nlabels, &nbits); if (order >= 0) { - t_info("unexpected order %s %s %s\n", - dnsname_totext(dns_fixedname_name(&fullname1)), - order == -1 ? "<" : (order == 0 ? "==" : ">"), - dnsname_totext(dns_fixedname_name(&fullname2))); + t_info("unexpected order %s %s %s\n", + dnsname_totext(dns_fixedname_name(&fullname1)), + order == -1 ? "<" : (order == 0 ? "==" : ">"), + dnsname_totext(dns_fixedname_name(&fullname2))); ++nprobs; } } @@ -677,7 +680,9 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) { return(nprobs); } -/* test by exercising the first|last|next|prev funcs in useful ways */ +/* + * Test by exercising the first|last|next|prev funcs in useful ways. + */ static int t_namechk(isc_result_t dns_result, dns_fixedname_t *dns_name, char *exp_name, @@ -743,7 +748,8 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname, mctx = NULL; isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %s\n", + isc_result_totext(isc_result)); return(result); } @@ -772,11 +778,14 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname, &isc_buffer, NULL, ISC_FALSE, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", dns_result_totext(dns_result)); + t_info("dns_name_fromtext failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* set the starting node */ + /* + * Set the starting node. + */ node = NULL; dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), dns_fixedname_name(&dns_foundname), @@ -784,26 +793,32 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname, NULL, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", dns_result_totext(dns_result)); + t_info("dns_rbt_findnode failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* check next */ + /* + * Check next. + */ t_info("checking for next name of %s and new origin of %s\n", - nextname, nextorigin); + nextname, nextorigin); dns_result = dns_rbtnodechain_next(&chain, - dns_fixedname_name(&dns_nextname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_nextname), + dns_fixedname_name(&dns_origin)); - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { + if ((dns_result != ISC_R_SUCCESS) && + (dns_result != DNS_R_NEWORIGIN)) { t_info("dns_rbtnodechain_next unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, nextorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, + nextorigin, DNS_R_NEWORIGIN); - /* set the starting node again */ + /* + * Set the starting node again. + */ node = NULL; dns_fixedname_init(&dns_foundname); dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), @@ -812,55 +827,63 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname, NULL, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("\tdns_rbt_findnode failed %s\n", dns_result_totext(dns_result)); + t_info("\tdns_rbt_findnode failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* check previous */ + /* + * Check previous. + */ t_info("checking for previous name of %s and new origin of %s\n", - prevname, prevorigin); + prevname, prevorigin); dns_fixedname_init(&dns_origin); dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_prevname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_prevname), + dns_fixedname_name(&dns_origin)); - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { + if ((dns_result != ISC_R_SUCCESS) && + (dns_result != DNS_R_NEWORIGIN)) { t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, prevorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, + prevorigin, DNS_R_NEWORIGIN); - - /* check first */ + /* + * Check first. + */ t_info("checking for first name of %s and new origin of %s\n", - firstname, firstorigin); + firstname, firstorigin); dns_result = dns_rbtnodechain_first(&chain, rbt, - dns_fixedname_name(&dns_firstname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_firstname), + dns_fixedname_name(&dns_origin)); if (dns_result != DNS_R_NEWORIGIN) { t_info("dns_rbtnodechain_first unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_firstname, firstname, &dns_origin, firstorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_firstname, firstname, + &dns_origin, firstorigin, DNS_R_NEWORIGIN); - - /* check last */ + /* + * Check last. + */ t_info("checking for last name of %s\n", lastname); dns_result = dns_rbtnodechain_last(&chain, rbt, - dns_fixedname_name(&dns_lastname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_lastname), + dns_fixedname_name(&dns_origin)); if (dns_result != DNS_R_NEWORIGIN) { t_info("dns_rbtnodechain_last unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_lastname, lastname, &dns_origin, lastorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_lastname, lastname, &dns_origin, + lastorigin, DNS_R_NEWORIGIN); - /* check node ordering */ + /* + * Check node ordering. + */ t_info("checking node ordering\n"); nfails += t9_walkchain(&chain, rbt); @@ -876,7 +899,6 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname, static int test_dns_rbtnodechain_init(char *filename) { - FILE *fp; char *p; int line; @@ -902,34 +924,32 @@ test_dns_rbtnodechain_init(char *filename) { cnt = t_bustline(p, Tokens); if (cnt == 10) { result = t_dns_rbtnodechain_init( - Tokens[0], /* dbfile */ - Tokens[1], /* startname */ - Tokens[2], /* nextname */ - Tokens[3], /* nextorigin */ - Tokens[4], /* prevname */ - Tokens[5], /* prevorigin */ - Tokens[6], /* firstname */ - Tokens[7], /* firstorigin */ - Tokens[8], /* lastname */ - Tokens[9]); /* lastorigin */ + Tokens[0], /* dbfile */ + Tokens[1], /* startname */ + Tokens[2], /* nextname */ + Tokens[3], /* nextorigin */ + Tokens[4], /* prevname */ + Tokens[5], /* prevorigin */ + Tokens[6], /* firstname */ + Tokens[7], /* firstorigin */ + Tokens[8], /* lastname */ + Tokens[9]); /* lastorigin */ if (result != T_PASS) { if (result == T_FAIL) ++nfails; else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -957,8 +977,8 @@ static int t_dns_rbtnodechain_first(char *dbfile, char *expected_firstname, char *expected_firstorigin, char *expected_nextname, - char *expected_nextorigin) { - + char *expected_nextorigin) +{ int result; int nfails; dns_rbt_t *rbt; @@ -980,7 +1000,8 @@ t_dns_rbtnodechain_first(char *dbfile, char *expected_firstname, isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %s\n", + isc_result_totext(isc_result)); return(result); } @@ -1038,7 +1059,6 @@ t_dns_rbtnodechain_first(char *dbfile, char *expected_firstname, static int test_dns_rbtnodechain_first(char *filename) { - FILE *fp; char *p; int line; @@ -1057,36 +1077,36 @@ test_dns_rbtnodechain_first(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; cnt = t_bustline(p, Tokens); if (cnt == 5) { result = t_dns_rbtnodechain_first( - Tokens[0], /* dbfile */ - Tokens[1], /* expected firstname */ - Tokens[2], /* expected firstorigin */ - Tokens[3], /* expected nextname */ - Tokens[4]); /* expected nextorigin */ + Tokens[0], /* dbfile */ + Tokens[1], /* firstname */ + Tokens[2], /* firstorigin */ + Tokens[3], /* nextname */ + Tokens[4]); /* nextorigin */ if (result != T_PASS) { if (result == T_FAIL) ++nfails; else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -1101,10 +1121,11 @@ test_dns_rbtnodechain_first(char *filename) { return(result); } -static char *a10 = "a call to dns_rbtnodechain_first(chain, rbt, name, origin) " +static char *a10 = "a call to " + "dns_rbtnodechain_first(chain, rbt, name, origin) " "sets name to point to the root of the tree, " "origin to point to the origin, " - " and returns DNS_R_NEWORIGIN"; + "and returns DNS_R_NEWORIGIN"; static void t10() { @@ -1117,9 +1138,10 @@ t10() { static int t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, - char *expected_lastorigin, - char *expected_prevname, - char *expected_prevorigin) { + char *expected_lastorigin, + char *expected_prevname, + char *expected_prevorigin) +{ int result; int nfails; @@ -1142,7 +1164,8 @@ t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %s\n", + isc_result_totext(isc_result)); return(result); } @@ -1155,29 +1178,32 @@ t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, return(result); } - t_info("testing for last name of %s, origin of %s\n", expected_lastname, expected_lastorigin); + t_info("testing for last name of %s, origin of %s\n", + expected_lastname, expected_lastorigin); dns_result = dns_rbtnodechain_last(&chain, rbt, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_name), + dns_fixedname_name(&dns_origin)); if (dns_result != DNS_R_NEWORIGIN) { t_info("dns_rbtnodechain_last unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails = t_namechk(dns_result, &dns_name, expected_lastname, &dns_origin, expected_lastorigin, - DNS_R_NEWORIGIN); + nfails = t_namechk(dns_result, &dns_name, expected_lastname, + &dns_origin, expected_lastorigin, DNS_R_NEWORIGIN); - t_info("testing for previous name of %s, origin of %s\n", expected_prevname, expected_prevorigin); + t_info("testing for previous name of %s, origin of %s\n", + expected_prevname, expected_prevorigin); dns_fixedname_init(&dns_name); dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_name), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_name), + dns_fixedname_name(&dns_origin)); - if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { + if ((dns_result != ISC_R_SUCCESS) && + (dns_result != DNS_R_NEWORIGIN)) { t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } if (strcasecmp(expected_lastorigin, expected_prevorigin) == 0) expected_result = ISC_R_SUCCESS; @@ -1198,7 +1224,6 @@ t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, static int test_dns_rbtnodechain_last(char *filename) { - FILE *fp; char *p; int line; @@ -1217,36 +1242,36 @@ test_dns_rbtnodechain_last(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; cnt = t_bustline(p, Tokens); if (cnt == 5) { result = t_dns_rbtnodechain_last( - Tokens[0], /* dbfile */ - Tokens[1], /* expected lastname */ - Tokens[2], /* expected lastorigin */ - Tokens[3], /* expected prevname */ - Tokens[4]); /* expected prevorigin */ + Tokens[0], /* dbfile */ + Tokens[1], /* lastname */ + Tokens[2], /* lastorigin */ + Tokens[3], /* prevname */ + Tokens[4]); /* prevorigin */ if (result != T_PASS) { if (result == T_FAIL) ++nfails; else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", - filename, line); + filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -1261,7 +1286,8 @@ test_dns_rbtnodechain_last(char *filename) { return(result); } -static char *a11 = "a call to dns_rbtnodechain_last(chain, rbt, name, origin) " +static char *a11 = "a call to " + "dns_rbtnodechain_last(chain, rbt, name, origin) " "sets name to point to the last node of the megatree, " "origin to the name of the level above it, " "and returns DNS_R_NEWORIGIN"; @@ -1277,7 +1303,8 @@ t11() { static int t_dns_rbtnodechain_next(char *dbfile, char *findname, - char *nextname, char *nextorigin) { + char *nextname, char *nextorigin) +{ int result; int len; @@ -1302,7 +1329,8 @@ t_dns_rbtnodechain_next(char *dbfile, char *findname, mctx = NULL; isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %s\n", + isc_result_totext(isc_result)); return(result); } @@ -1325,14 +1353,17 @@ t_dns_rbtnodechain_next(char *dbfile, char *findname, dns_fixedname_init(&dns_origin); dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname), - &isc_buffer, NULL, ISC_FALSE, NULL); + &isc_buffer, NULL, ISC_FALSE, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", dns_result_totext(dns_result)); + t_info("dns_name_fromtext failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* set the starting node */ + /* + * Set the starting node. + */ node = NULL; dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), dns_fixedname_name(&dns_foundname), @@ -1340,24 +1371,27 @@ t_dns_rbtnodechain_next(char *dbfile, char *findname, NULL, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", dns_result_totext(dns_result)); + t_info("dns_rbt_findnode failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* check next */ + /* + * Check next. + */ t_info("checking for next name of %s and new origin of %s\n", - nextname, nextorigin); + nextname, nextorigin); dns_result = dns_rbtnodechain_next(&chain, - dns_fixedname_name(&dns_nextname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_nextname), + dns_fixedname_name(&dns_origin)); if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { t_info("dns_rbtnodechain_next unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, nextorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_nextname, nextname, &dns_origin, + nextorigin, DNS_R_NEWORIGIN); if (nfails) result = T_FAIL; @@ -1371,7 +1405,6 @@ t_dns_rbtnodechain_next(char *dbfile, char *findname, static int test_dns_rbtnodechain_next(char *filename) { - FILE *fp; char *p; int line; @@ -1390,35 +1423,35 @@ test_dns_rbtnodechain_next(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; cnt = t_bustline(p, Tokens); if (cnt == 4) { result = t_dns_rbtnodechain_next( - Tokens[0], /* dbfile */ - Tokens[1], /* findname */ - Tokens[2], /* expected nextname */ - Tokens[3]); /* expected nextorigin */ + Tokens[0], /* dbfile */ + Tokens[1], /* findname */ + Tokens[2], /* nextname */ + Tokens[3]); /* nextorigin */ if (result != T_PASS) { if (result == T_FAIL) ++nfails; else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", - filename, line); + filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -1435,7 +1468,8 @@ test_dns_rbtnodechain_next(char *filename) { static char *a12 = "a call to dns_rbtnodechain_next(chain, name, origin) " "sets name to point to the next node of the tree " - "and returns ISC_R_SUCCESS or DNS_R_NEWORIGIN on success"; + "and returns ISC_R_SUCCESS or " + "DNS_R_NEWORIGIN on success"; static void @@ -1448,9 +1482,9 @@ t12() { } static int -t_dns_rbtnodechain_prev(char *dbfile, char *findname, - char *prevname, char *prevorigin) { - +t_dns_rbtnodechain_prev(char *dbfile, char *findname, char *prevname, + char *prevorigin) +{ int result; int len; int nfails; @@ -1474,7 +1508,8 @@ t_dns_rbtnodechain_prev(char *dbfile, char *findname, mctx = NULL; isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { - t_info("isc_mem_create failed %s\n", isc_result_totext(isc_result)); + t_info("isc_mem_create failed %s\n", + isc_result_totext(isc_result)); return(result); } @@ -1497,14 +1532,17 @@ t_dns_rbtnodechain_prev(char *dbfile, char *findname, dns_fixedname_init(&dns_origin); dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname), - &isc_buffer, NULL, ISC_FALSE, NULL); + &isc_buffer, NULL, ISC_FALSE, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_name_fromtext failed %s\n", dns_result_totext(dns_result)); + t_info("dns_name_fromtext failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* set the starting node */ + /* + * Set the starting node. + */ node = NULL; dns_result = dns_rbt_findnode(rbt, dns_fixedname_name(&dns_findname), dns_fixedname_name(&dns_foundname), @@ -1512,24 +1550,27 @@ t_dns_rbtnodechain_prev(char *dbfile, char *findname, NULL, NULL); if (dns_result != ISC_R_SUCCESS) { - t_info("dns_rbt_findnode failed %s\n", dns_result_totext(dns_result)); + t_info("dns_rbt_findnode failed %s\n", + dns_result_totext(dns_result)); return(result); } - /* check next */ + /* + * Check next. + */ t_info("checking for next name of %s and new origin of %s\n", - prevname, prevorigin); + prevname, prevorigin); dns_result = dns_rbtnodechain_prev(&chain, - dns_fixedname_name(&dns_prevname), - dns_fixedname_name(&dns_origin)); + dns_fixedname_name(&dns_prevname), + dns_fixedname_name(&dns_origin)); if ((dns_result != ISC_R_SUCCESS) && (dns_result != DNS_R_NEWORIGIN)) { t_info("dns_rbtnodechain_prev unexpectedly returned %s\n", - dns_result_totext(dns_result)); + dns_result_totext(dns_result)); } - nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, prevorigin, - DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_prevname, prevname, &dns_origin, + prevorigin, DNS_R_NEWORIGIN); if (nfails) result = T_FAIL; @@ -1543,7 +1584,6 @@ t_dns_rbtnodechain_prev(char *dbfile, char *findname, static int test_dns_rbtnodechain_prev(char *filename) { - FILE *fp; char *p; int line; @@ -1562,35 +1602,35 @@ test_dns_rbtnodechain_prev(char *filename) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; cnt = t_bustline(p, Tokens); if (cnt == 4) { result = t_dns_rbtnodechain_prev( - Tokens[0], /* dbfile */ - Tokens[1], /* findname */ - Tokens[2], /* expected prevname */ - Tokens[3]); /* expected prevorigin */ + Tokens[0], /* dbfile */ + Tokens[1], /* findname */ + Tokens[2], /* prevname */ + Tokens[3]); /* prevorigin */ if (result != T_PASS) { if (result == T_FAIL) ++nfails; else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -1607,7 +1647,8 @@ test_dns_rbtnodechain_prev(char *filename) { static char *a13 = "a call to dns_rbtnodechain_prev(chain, name, origin) " "sets name to point to the previous node of the tree " - "and returns ISC_R_SUCCESS or DNS_R_NEWORIGIN on success"; + "and returns ISC_R_SUCCESS or " + "DNS_R_NEWORIGIN on success"; static void t13() { diff --git a/bin/tests/rbt_test.c b/bin/tests/rbt_test.c index c1715f68fb..c7a77becb0 100644 --- a/bin/tests/rbt_test.c +++ b/bin/tests/rbt_test.c @@ -16,12 +16,12 @@ */ #include + #include -#include -#include #include -#include +#include +#include #include #include diff --git a/bin/tests/rdata_test.c b/bin/tests/rdata_test.c index d4676ed53d..2f2ffada8b 100644 --- a/bin/tests/rdata_test.c +++ b/bin/tests/rdata_test.c @@ -17,22 +17,20 @@ #include -#include #include -#include -#include #include #include -#include #include +#include +#include #include #include -#include #include #include #include +#include isc_mem_t *mctx; isc_lex_t *lex; diff --git a/bin/tests/rwlock_test.c b/bin/tests/rwlock_test.c index 77f8d572f4..a3c0cba685 100644 --- a/bin/tests/rwlock_test.c +++ b/bin/tests/rwlock_test.c @@ -19,14 +19,11 @@ #include #include -#include #include -#include -#include #include -#include #include +#include #include isc_rwlock_t lock; diff --git a/bin/tests/sdig.c b/bin/tests/sdig.c index 1b516ae5ba..78eae7fa70 100644 --- a/bin/tests/sdig.c +++ b/bin/tests/sdig.c @@ -17,31 +17,18 @@ #include -#include -#include #include -#include extern int h_errno; -#include #include -#include -#include #include -#include #include -#include -#include #include +#include #include - #include -#include -#include -#include -#include #include #include #include @@ -195,7 +182,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { UNUSED(task); /* - * There will be one buffer (since that is what we put on the list) + * There will be one buffer (since that is what we put on the list). */ if (sevent->result == ISC_R_SUCCESS) { b = ISC_LIST_HEAD(sevent->bufferlist); diff --git a/bin/tests/serial_test.c b/bin/tests/serial_test.c index 19fdb15fc9..5b88c5ecf7 100644 --- a/bin/tests/serial_test.c +++ b/bin/tests/serial_test.c @@ -15,8 +15,11 @@ * SOFTWARE. */ +#include + #include #include + #include int @@ -25,7 +28,6 @@ main() { char buf[1024]; char *s, *e; - while (fgets(buf, sizeof buf, stdin) != NULL) { buf[sizeof buf - 1] = '\0'; s = buf; diff --git a/bin/tests/shutdown_test.c b/bin/tests/shutdown_test.c index b08fecf0fc..338a20482b 100644 --- a/bin/tests/shutdown_test.c +++ b/bin/tests/shutdown_test.c @@ -17,24 +17,13 @@ #include -#include #include -#include -#include -#include -#include +#include #include #include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include typedef struct { diff --git a/bin/tests/signer.c b/bin/tests/signer.c index ddb52a55e1..4c7360bd1c 100644 --- a/bin/tests/signer.c +++ b/bin/tests/signer.c @@ -17,23 +17,18 @@ #include -#include #include -#include #include -#include #include -#include +#include #include #include #include #include -#include #include #include -#include #include #include #include @@ -44,10 +39,8 @@ #include #include #include -#include #include -#include #include /*#define USE_ZONESTATUS*/ @@ -377,7 +370,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, setverifies(name, set, key, &oldsigrdata)) { vbprintf(2, - "\tsig by %s/%s/%d retained\n", + "\tsig by %s/%s/%d retained\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid); @@ -402,7 +395,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, setverifies(name, set, key, &oldsigrdata)) { vbprintf(2, - "\tsig by %s/%s/%d retained\n", + "\tsig by %s/%s/%d retained\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid); @@ -412,8 +405,8 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, } else { vbprintf(2, - "\tsig by %s/%s/%d dropped - ", - "%s\n", + "\tsig by %s/%s/%d " + "dropped - %s\n", nametostr(&sig.signer), algtostr(sig.algorithm), sig.keyid, @@ -442,7 +435,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, allocbufferandrdata; result = dns_rdata_fromstruct(trdata, set->rdclass, - dns_rdatatype_sig, + dns_rdatatype_sig, &sig, &b); nowsignedby[sig.algorithm] = ISC_TRUE; ISC_LIST_APPEND(siglist.rdata, trdata, link); @@ -602,8 +595,8 @@ importparentsig(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, goto failure; dns_rdataset_init(&newset); dns_rdataset_init(&sigset); - result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0, - 0, &newset, &sigset); + result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, + 0, 0, &newset, &sigset); if (result != ISC_R_SUCCESS) goto failure; @@ -681,8 +674,8 @@ haschildkey(dns_db_t *db, dns_name_t *name) { goto failure; dns_rdataset_init(&set); dns_rdataset_init(&sigset); - result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0, - 0, &set, &sigset); + result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, + 0, 0, &set, &sigset); if (result != ISC_R_SUCCESS) goto failure; @@ -884,8 +877,9 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, keyrdatalist.type = dns_rdatatype_key; keyrdatalist.covers = 0; keyrdatalist.ttl = rdataset.ttl; - result = dns_rdatalist_tordataset(&keyrdatalist, - &keyset); + result = + dns_rdatalist_tordataset(&keyrdatalist, + &keyset); check_result(result, "dns_rdatalist_tordataset"); dns_db_addrdataset(db, node, version, 0, @@ -1252,7 +1246,8 @@ usage() { fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n"); fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n"); fprintf(stderr, "\t-c ttl:\n"); - fprintf(stderr, "\t\tcycle period - regenerate if < cycle from end ( (end-start)/4 )\n"); + fprintf(stderr, "\t\tcycle period - regenerate " + "if < cycle from end ( (end-start)/4 )\n"); fprintf(stderr, "\t-v level:\n"); fprintf(stderr, "\t\tverbose level (0)\n"); fprintf(stderr, "\t-o origin:\n"); @@ -1261,7 +1256,8 @@ usage() { fprintf(stderr, "\t\tfile the signed zone is written in " \ "(zonefile + .signed)\n"); fprintf(stderr, "\t-a:\n"); - fprintf(stderr, "\t\tverify generated signatures (if currently valid)\n"); + fprintf(stderr, "\t\tverify generated signatures " + "(if currently valid)\n"); fprintf(stderr, "\n"); @@ -1331,21 +1327,23 @@ main(int argc, char *argv[]) { result = isc_mem_create(0, 0, &mctx); check_result(result, "isc_mem_create()"); - while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) != -1) - { + while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) + != -1) { switch (ch) { case 's': startstr = isc_mem_strdup(mctx, isc_commandline_argument); if (startstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'e': endstr = isc_mem_strdup(mctx, isc_commandline_argument); if (endstr == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'c': @@ -1366,14 +1364,16 @@ main(int argc, char *argv[]) { origin = isc_mem_strdup(mctx, isc_commandline_argument); if (origin == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'f': output = isc_mem_strdup(mctx, isc_commandline_argument); if (output == NULL) - check_result(ISC_R_FAILURE, "isc_mem_strdup()"); + check_result(ISC_R_FAILURE, + "isc_mem_strdup()"); break; case 'a': @@ -1439,7 +1439,7 @@ main(int argc, char *argv[]) { if (output == NULL) { output = isc_mem_allocate(mctx, - strlen(file) + strlen(".signed") + 1); + strlen(file) + strlen(".signed") + 1); if (output == NULL) check_result(ISC_R_FAILURE, "isc_mem_allocate()"); sprintf(output, "%s.signed", file); @@ -1546,7 +1546,9 @@ main(int argc, char *argv[]) { signzone(db, version); - /* should we update the SOA serial? */ + /* + * Should we update the SOA serial? + */ dns_db_closeversion(db, &version, ISC_TRUE); dumpzone(zone, output); dns_db_detach(&db); diff --git a/bin/tests/sock_test.c b/bin/tests/sock_test.c index f9c9c28c9a..f577aa0bb2 100644 --- a/bin/tests/sock_test.c +++ b/bin/tests/sock_test.c @@ -17,31 +17,20 @@ #include -#include #include #include -#include -#include -#include #include #include -#include -#include #include #include -#include #include isc_mem_t *mctx; isc_taskmgr_t *manager; -static void my_send(isc_task_t *task, isc_event_t *event); -static void my_recv(isc_task_t *task, isc_event_t *event); - static void -my_shutdown(isc_task_t *task, isc_event_t *event) -{ +my_shutdown(isc_task_t *task, isc_event_t *event) { char *name = event->ev_arg; printf("shutdown %s (%p)\n", name, task); @@ -50,8 +39,31 @@ my_shutdown(isc_task_t *task, isc_event_t *event) } static void -my_recv(isc_task_t *task, isc_event_t *event) -{ +my_send(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock; + isc_socketevent_t *dev; + + sock = event->ev_sender; + dev = (isc_socketevent_t *)event; + + printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, " + "result %d)\n", + (char *)(event->ev_arg), task, sock, + dev->region.base, dev->region.length, + dev->n, dev->result); + + if (dev->result != ISC_R_SUCCESS) { + isc_socket_detach(&sock); + isc_task_shutdown(task); + } + + isc_mem_put(mctx, dev->region.base, dev->region.length); + + isc_event_free(&event); +} + +static void +my_recv(isc_task_t *task, isc_event_t *event) { isc_socket_t *sock; isc_socketevent_t *dev; isc_region_t region; @@ -89,7 +101,7 @@ my_recv(isc_task_t *task, isc_event_t *event) } /* - * Echo the data back + * Echo the data back. */ if (strcmp(event->ev_arg, "so2") != 0) { region = dev->region; @@ -111,39 +123,15 @@ my_recv(isc_task_t *task, isc_event_t *event) } static void -my_send(isc_task_t *task, isc_event_t *event) -{ +my_http_get(isc_task_t *task, isc_event_t *event) { isc_socket_t *sock; isc_socketevent_t *dev; sock = event->ev_sender; dev = (isc_socketevent_t *)event; - printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n", - (char *)(event->ev_arg), task, sock, - dev->region.base, dev->region.length, - dev->n, dev->result); - - if (dev->result != ISC_R_SUCCESS) { - isc_socket_detach(&sock); - isc_task_shutdown(task); - } - - isc_mem_put(mctx, dev->region.base, dev->region.length); - - isc_event_free(&event); -} - -static void -my_http_get(isc_task_t *task, isc_event_t *event) -{ - isc_socket_t *sock; - isc_socketevent_t *dev; - - sock = event->ev_sender; - dev = (isc_socketevent_t *)event; - - printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n", + printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, " + "n %d, result %d)\n", (char *)(event->ev_arg), task, sock, dev->region.base, dev->region.length, dev->n, dev->result); @@ -161,8 +149,7 @@ my_http_get(isc_task_t *task, isc_event_t *event) } static void -my_connect(isc_task_t *task, isc_event_t *event) -{ +my_connect(isc_task_t *task, isc_event_t *event) { isc_socket_t *sock; isc_socket_connev_t *dev; isc_region_t region; @@ -185,10 +172,11 @@ my_connect(isc_task_t *task, isc_event_t *event) * Send a GET string, and set up to receive (and just display) * the result. */ - strcpy(buf, "GET / HTTP/1.1\r\nHost: www.flame.org\r\nConnection: Close\r\n\r\n"); + strcpy(buf, "GET / HTTP/1.1\r\nHost: www.flame.org\r\n" + "Connection: Close\r\n\r\n"); region.base = isc_mem_get(mctx, strlen(buf) + 1); region.length = strlen(buf) + 1; - strcpy((char *)region.base, buf); /* strcpy is safe */ + strcpy((char *)region.base, buf); /* This strcpy is safe. */ isc_socket_send(sock, ®ion, task, my_http_get, event->ev_arg); @@ -196,8 +184,7 @@ my_connect(isc_task_t *task, isc_event_t *event) } static void -my_listen(isc_task_t *task, isc_event_t *event) -{ +my_listen(isc_task_t *task, isc_event_t *event) { char *name = event->ev_arg; isc_socket_newconnev_t *dev; isc_region_t region; @@ -212,9 +199,10 @@ my_listen(isc_task_t *task, isc_event_t *event) if (dev->result == ISC_R_SUCCESS) { /* - * queue another listen on this socket + * Queue another listen on this socket. */ - isc_socket_accept(event->ev_sender, task, my_listen, event->ev_arg); + isc_socket_accept(event->ev_sender, task, my_listen, + event->ev_arg); region.base = isc_mem_get(mctx, 20); region.length = 20; @@ -244,8 +232,7 @@ my_listen(isc_task_t *task, isc_event_t *event) } static void -timeout(isc_task_t *task, isc_event_t *event) -{ +timeout(isc_task_t *task, isc_event_t *event) { isc_socket_t *sock = event->ev_arg; printf("Timeout, canceling IO on socket %p (task %p)\n", sock, task); @@ -256,8 +243,7 @@ timeout(isc_task_t *task, isc_event_t *event) } int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { isc_task_t *t1, *t2; isc_timermgr_t *timgr; isc_time_t expires; @@ -318,7 +304,7 @@ main(int argc, char *argv[]) RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); /* - * open up a listener socket + * Open up a listener socket. */ so1 = NULL; @@ -336,7 +322,7 @@ main(int argc, char *argv[]) RUNTIME_CHECK(isc_socket_listen(so1, 0) == ISC_R_SUCCESS); /* - * queue up the first accept event + * Queue up the first accept event. */ RUNTIME_CHECK(isc_socket_accept(so1, t1, my_listen, "so1") == ISC_R_SUCCESS); @@ -348,7 +334,7 @@ main(int argc, char *argv[]) ISC_R_SUCCESS); /* - * open up a socket that will connect to www.flame.org, port 80. + * Open up a socket that will connect to www.flame.org, port 80. * Why not. :) */ so2 = NULL; @@ -372,7 +358,7 @@ main(int argc, char *argv[]) isc_task_detach(&t2); /* - * wait a short while. + * Wait a short while. */ sleep(10); diff --git a/bin/tests/sockaddr/t_sockaddr.c b/bin/tests/sockaddr/t_sockaddr.c index 76d57078fa..576671d5e2 100644 --- a/bin/tests/sockaddr/t_sockaddr.c +++ b/bin/tests/sockaddr/t_sockaddr.c @@ -17,15 +17,7 @@ #include -#include -#include -#include - -#include -#include -#include #include -#include #include #include diff --git a/bin/tests/sym_test.c b/bin/tests/sym_test.c index 928b24e822..429e03f225 100644 --- a/bin/tests/sym_test.c +++ b/bin/tests/sym_test.c @@ -17,26 +17,18 @@ #include -#include -#include -#include - -#include #include -#include -#include +#include #include #include -#include isc_mem_t *mctx; isc_symtab_t *st; static void -undefine_action(char *key, unsigned int type, isc_symvalue_t value, - void *arg) +undefine_action(char *key, unsigned int type, isc_symvalue_t value, void *arg) { - (void) arg; + UNUSED(arg); INSIST(type == 1); isc_mem_free(mctx, key); diff --git a/bin/tests/task_test.c b/bin/tests/task_test.c index c5a5908fd3..6fc1020589 100644 --- a/bin/tests/task_test.c +++ b/bin/tests/task_test.c @@ -17,18 +17,13 @@ #include -#include #include #include -#include -#include #include #include #include #include -#include -#include #include isc_mem_t *mctx = NULL; diff --git a/bin/tests/tasks/t_tasks.c b/bin/tests/tasks/t_tasks.c index b27d2e0e78..4a615e0921 100644 --- a/bin/tests/tasks/t_tasks.c +++ b/bin/tests/tasks/t_tasks.c @@ -15,21 +15,19 @@ * SOFTWARE. */ -#include +#include -#include -#include -#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include +#include void t1(void); void t2(void); @@ -431,8 +429,7 @@ t2_shutdown(isc_task_t *task, isc_event_t *event) { } static void -t2_callback(isc_task_t *task, isc_event_t *event) -{ +t2_callback(isc_task_t *task, isc_event_t *event) { isc_result_t isc_result; isc_task_t *newtask; @@ -444,9 +441,11 @@ t2_callback(isc_task_t *task, isc_event_t *event) if (event->ev_arg) { - event->ev_arg = (void* ) (((int) event->ev_arg) - 1); + event->ev_arg = (void *)(((int) event->ev_arg) - 1); - /* create a new task and forward the message */ + /* + * Create a new task and forward the message. + */ newtask = NULL; isc_result = isc_task_create(T2_manager, 0, &newtask); if (isc_result != ISC_R_SUCCESS) { @@ -456,7 +455,7 @@ t2_callback(isc_task_t *task, isc_event_t *event) } isc_result = isc_task_onshutdown(newtask, t2_shutdown, - (void *) task); + (void *)task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown failed %d\n", isc_result); @@ -465,16 +464,16 @@ t2_callback(isc_task_t *task, isc_event_t *event) } isc_task_send(newtask, &event); - } - else { - /* time to unwind, shutdown should perc back up */ + } else { + /* + * Time to unwind, shutdown should perc back up. + */ isc_task_destroy(&task); } } static int t_tasks2(void) { - int ntasks; int result; char *p; @@ -535,7 +534,7 @@ t_tasks2(void) { } T2_event = isc_event_allocate(T2_mctx, (void *)1, 1, t2_callback, - (void *) ntasks, sizeof *event); + (void *)ntasks, sizeof *event); if (T2_event == NULL) { t_info("isc_event_allocate failed\n"); return(T_UNRESOLVED); @@ -590,7 +589,6 @@ static int T3_nprobs; static void t3_sde1(isc_task_t *task, isc_event_t *event) { - task = task; if (T3_nevents != T3_NEVENTS) { @@ -599,8 +597,7 @@ t3_sde1(isc_task_t *task, isc_event_t *event) { } if (T3_nsdevents == 1) { ++T3_nsdevents; - } - else { + } else { t_info("Shutdown events not processed in LIFO order\n"); ++T3_nfails; } @@ -618,8 +615,7 @@ t3_sde2(isc_task_t *task, isc_event_t *event) { } if (T3_nsdevents == 0) { ++T3_nsdevents; - } - else { + } else { t_info("Shutdown events not processed in LIFO order\n"); ++T3_nfails; } @@ -628,7 +624,6 @@ t3_sde2(isc_task_t *task, isc_event_t *event) { static void t3_event1(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; task = task; @@ -636,7 +631,7 @@ t3_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_lock(&T3_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T3_nprobs; } while (T3_flag != 1) { @@ -646,7 +641,7 @@ t3_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_unlock(&T3_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T3_nprobs; } isc_event_free(&event); @@ -654,7 +649,6 @@ t3_event1(isc_task_t *task, isc_event_t *event) { static void t3_event2(isc_task_t *task, isc_event_t *event) { - task = task; ++T3_nevents; @@ -663,7 +657,6 @@ t3_event2(isc_task_t *task, isc_event_t *event) { static int t_tasks3() { - int cnt; int result; char *p; @@ -694,14 +687,14 @@ t_tasks3() { isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); return(T_UNRESOLVED); } isc_result = isc_mutex_init(&T3_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -709,7 +702,7 @@ t_tasks3() { isc_result = isc_condition_init(&T3_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -718,7 +711,7 @@ t_tasks3() { isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -726,7 +719,7 @@ t_tasks3() { isc_result = isc_mutex_lock(&T3_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); return(T_UNRESOLVED); @@ -736,26 +729,32 @@ t_tasks3() { isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_unlock(&T3_mx); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } - /* this event causes the task to wait on T3_cv */ + /* + * This event causes the task to wait on T3_cv. + */ event = isc_event_allocate(mctx, sender, event_type, t3_event1, NULL, sizeof(*event)); isc_task_send(task, &event); - /* now we fill up the task's event queue with some events */ + /* + * Now we fill up the task's event queue with some events. + */ for (cnt = 0; cnt < T3_NEVENTS; ++cnt) { event = isc_event_allocate(mctx, sender, event_type, t3_event2, NULL, sizeof(*event)); isc_task_send(task, &event); } - /* now we register two shutdown events */ + /* + * Now we register two shutdown events. + */ isc_result = isc_task_onshutdown(task, t3_sde1, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_send failed %s\n", @@ -780,7 +779,9 @@ t_tasks3() { isc_task_shutdown(task); - /* now we free the task by signaling T3_cv */ + /* + * Now we free the task by signaling T3_cv. + */ T3_flag = 1; isc_result = isc_condition_signal(&T3_cv); if (isc_result != ISC_R_SUCCESS) { @@ -821,9 +822,10 @@ t_tasks3() { return(result); } -static char *a3 = "When isc_task_shutdown() is called, any shutdown events " - "that have been requested via prior isc_task_onshutdown() calls " - "are posted in LIFO order."; +static char *a3 = "When isc_task_shutdown() is called, any shutdown " + "events that have been requested via prior " + "isc_task_onshutdown() calls are posted in " + "LIFO order."; void t3(void) { int result; @@ -841,15 +843,14 @@ static int T4_nfails; static void t4_event1(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; - task = task; + UNUSED(task); isc_result = isc_mutex_lock(&T4_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T4_nprobs; } while (T4_flag != 1) { @@ -859,7 +860,7 @@ t4_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_unlock(&T4_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T4_nprobs; } isc_event_free(&event); @@ -867,10 +868,12 @@ t4_event1(isc_task_t *task, isc_event_t *event) { static void t4_sde(isc_task_t *task, isc_event_t *event) { + UNUSED(task); - task = task; + /* + * No-op. + */ - /* no-op */ isc_event_free(&event); } @@ -887,13 +890,12 @@ t_tasks4() { isc_eventtype_t event_type; isc_event_t *event; - T4_nprobs = 0; T4_nfails = 0; T4_flag = 0; result = T_UNRESOLVED; - sender = (void *) 1; + sender = (void *)1; event_type = 4; workers = 2; @@ -905,14 +907,14 @@ t_tasks4() { isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); return(T_UNRESOLVED); } isc_result = isc_mutex_init(&T4_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -920,7 +922,7 @@ t_tasks4() { isc_result = isc_condition_init(&T4_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T4_mx); isc_mem_destroy(&mctx); return(T_UNRESOLVED); @@ -930,7 +932,7 @@ t_tasks4() { isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T4_mx); isc_condition_destroy(&T4_cv); isc_mem_destroy(&mctx); @@ -940,7 +942,7 @@ t_tasks4() { isc_result = isc_mutex_lock(&T4_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T4_mx); isc_condition_destroy(&T4_cv); isc_taskmgr_destroy(&tmgr); @@ -952,7 +954,7 @@ t_tasks4() { isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T4_mx); isc_condition_destroy(&T4_cv); isc_taskmgr_destroy(&tmgr); @@ -960,7 +962,9 @@ t_tasks4() { return(T_UNRESOLVED); } - /* this event causes the task to wait on T4_cv */ + /* + * This event causes the task to wait on T4_cv. + */ event = isc_event_allocate(mctx, sender, event_type, t4_event1, NULL, sizeof(*event)); isc_task_send(task, &event); @@ -970,11 +974,13 @@ t_tasks4() { isc_result = isc_task_onshutdown(task, t4_sde, NULL); if (isc_result != ISC_R_SHUTTINGDOWN) { t_info("isc_task_onshutdown returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T4_nfails; } - /* release the task */ + /* + * Release the task. + */ T4_flag = 1; isc_result = isc_condition_signal(&T4_cv); @@ -1007,8 +1013,8 @@ t_tasks4() { return(result); } -static char *a4 = "After isc_task_shutdown() has been called, any call to " - "isc_task_onshutdown() will return ISC_R_SHUTTINGDOWN."; +static char *a4 = "After isc_task_shutdown() has been called, any call to " + "isc_task_onshutdown() will return ISC_R_SHUTTINGDOWN."; void t4() { @@ -1028,8 +1034,7 @@ static isc_condition_t T7_cv; static void t7_event1(isc_task_t *task, isc_event_t *event) { - - task = task; + UNUSED(task); ++T7_eflag; @@ -1038,15 +1043,14 @@ t7_event1(isc_task_t *task, isc_event_t *event) { static void t7_sde(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; - task = task; + UNUSED(task); isc_result = isc_mutex_lock(&T7_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T7_nprobs; } @@ -1055,14 +1059,14 @@ t7_sde(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_signal(&T7_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T7_nprobs; } isc_result = isc_mutex_unlock(&T7_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T7_nprobs; } @@ -1091,7 +1095,7 @@ t_tasks7() { T7_eflag = 0; result = T_UNRESOLVED; - sender = (void *) 1; + sender = (void *)1; event_type = 7; workers = 2; @@ -1103,14 +1107,14 @@ t_tasks7() { isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); return(T_UNRESOLVED); } isc_result = isc_mutex_init(&T7_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -1118,7 +1122,7 @@ t_tasks7() { isc_result = isc_condition_init(&T7_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_mem_destroy(&mctx); return(T_UNRESOLVED); @@ -1128,7 +1132,7 @@ t_tasks7() { isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_mem_destroy(&mctx); @@ -1138,7 +1142,7 @@ t_tasks7() { isc_result = isc_mutex_lock(&T7_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_taskmgr_destroy(&tmgr); @@ -1150,7 +1154,7 @@ t_tasks7() { isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_taskmgr_destroy(&tmgr); @@ -1161,7 +1165,7 @@ t_tasks7() { isc_result = isc_task_onshutdown(task, t7_sde, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_task_destroy(&task); @@ -1183,7 +1187,7 @@ t_tasks7() { isc_result = isc_time_nowplusinterval(&now, &interval); if (isc_result != ISC_R_SUCCESS) { t_info("isc_time_nowplusinterval failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_task_destroy(&task); @@ -1195,7 +1199,7 @@ t_tasks7() { isc_result = isc_condition_waituntil(&T7_cv, &T7_mx, &now); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_waituntil returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T7_mx); isc_condition_destroy(&T7_cv); isc_task_destroy(&task); @@ -1208,7 +1212,7 @@ t_tasks7() { isc_result = isc_mutex_unlock(&T7_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T7_nprobs; } @@ -1265,7 +1269,6 @@ static int T10_testrange; static void t10_event1(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; task = task; @@ -1273,7 +1276,7 @@ t10_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_lock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } @@ -1281,7 +1284,7 @@ t10_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_wait(&T10_cv, &T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } } @@ -1289,7 +1292,7 @@ t10_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_unlock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } @@ -1311,10 +1314,11 @@ t10_event2(isc_task_t *task, isc_event_t *event) { if (T_debug) { t_info("Event %p,%d,%d,%s\n", - event->ev_sender, - (int) event->ev_type, - event->ev_tag, - event->ev_attributes & ISC_EVENTATTR_NOPURGE ? "NP" : "P"); + event->ev_sender, + (int)event->ev_type, + event->ev_tag, + event->ev_attributes & ISC_EVENTATTR_NOPURGE ? + "NP" : "P"); } if ((T10_purge_sender == 0) || @@ -1325,8 +1329,7 @@ t10_event2(isc_task_t *task, isc_event_t *event) { if (T10_purge_type_first == event->ev_type) { type_match = 1; } - } - else { + } else { if ((T10_purge_type_first <= event->ev_type) && (event->ev_type <= T10_purge_type_last)) { type_match = 1; @@ -1340,15 +1343,15 @@ t10_event2(isc_task_t *task, isc_event_t *event) { if (sender_match && type_match && tag_match) { if (event->ev_attributes & ISC_EVENTATTR_NOPURGE) { t_info("event %p,%d,%d matched but was not purgable\n", - event->ev_sender, (int) event->ev_type, event->ev_tag); + event->ev_sender, (int)event->ev_type, + event->ev_tag); ++T10_eventcnt; - } - else { + } else { t_info("*** event %p,%d,%d not purged\n", - event->ev_sender, (int) event->ev_type, event->ev_tag); + event->ev_sender, (int)event->ev_type, + event->ev_tag); } - } - else { + } else { ++T10_eventcnt; } isc_event_free(&event); @@ -1357,7 +1360,6 @@ t10_event2(isc_task_t *task, isc_event_t *event) { static void t10_sde(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; task = task; @@ -1365,7 +1367,7 @@ t10_sde(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_lock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } @@ -1374,14 +1376,14 @@ t10_sde(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_signal(&T10_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } isc_result = isc_mutex_unlock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T10_nprobs; } @@ -1389,10 +1391,10 @@ t10_sde(isc_task_t *task, isc_event_t *event) { } static void -t_taskpurge_x( int sender, int type, int tag, - int purge_sender, int purge_type_first, int purge_type_last, void *purge_tag, - int exp_nevents, int *nfails, int *nprobs, int testrange) { - +t_taskpurge_x(int sender, int type, int tag, int purge_sender, + int purge_type_first, int purge_type_last, void *purge_tag, + int exp_nevents, int *nfails, int *nprobs, int testrange) +{ char *p; isc_mem_t *mctx; isc_taskmgr_t *tmgr; @@ -1429,7 +1431,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++*nprobs; return; } @@ -1437,7 +1439,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_mutex_init(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); ++*nprobs; return; @@ -1446,7 +1448,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_condition_init(&T10_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); isc_mutex_destroy(&T10_mx); ++*nprobs; @@ -1457,7 +1459,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); isc_mutex_destroy(&T10_mx); isc_condition_destroy(&T10_cv); @@ -1469,7 +1471,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); isc_mutex_destroy(&T10_mx); @@ -1481,7 +1483,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_task_onshutdown(task, t10_sde, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_task_destroy(&task); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); @@ -1491,38 +1493,39 @@ t_taskpurge_x( int sender, int type, int tag, return; } - /* block the task on T10_cv */ - event = isc_event_allocate( mctx, - (void *) 1, - (isc_eventtype_t) T_CONTROL, - t10_event1, - NULL, - sizeof(*event)); + /* + * Block the task on T10_cv. + */ + event = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)T_CONTROL, + t10_event1, NULL, sizeof(*event)); isc_task_send(task, &event); /* - * fill the task's queue with some messages with varying - * sender, type, tag, and purgable attribute values + * Fill the task's queue with some messages with varying + * sender, type, tag, and purgable attribute values. */ event_cnt = 0; for (sender_cnt = 0; sender_cnt < T10_SENDERCNT; ++sender_cnt) { for (type_cnt = 0; type_cnt < T10_TYPECNT; ++type_cnt) { for (tag_cnt = 0; tag_cnt < T10_TAGCNT; ++tag_cnt) { - eventtab[event_cnt] = isc_event_allocate( - mctx, - (void *) (sender + sender_cnt), - (isc_eventtype_t) (type + type_cnt), - t10_event2, - NULL, - sizeof(*event)); + eventtab[event_cnt] = + isc_event_allocate(mctx, + (void *)(sender + sender_cnt), + (isc_eventtype_t)(type + type_cnt), + t10_event2, NULL, sizeof(*event)); - eventtab[event_cnt]->ev_tag = (void *)((int)tag + tag_cnt); + eventtab[event_cnt]->ev_tag = + (void *)((int)tag + tag_cnt); - /* make all odd message non-purgable */ - if ((sender_cnt % 2) && (type_cnt %2) && (tag_cnt %2)) - eventtab[event_cnt]->ev_attributes |= ISC_EVENTATTR_NOPURGE; + /* + * Make all odd message non-purgable. + */ + if ((sender_cnt % 2) && (type_cnt %2) && + (tag_cnt %2)) + eventtab[event_cnt]->ev_attributes |= + ISC_EVENTATTR_NOPURGE; ++event_cnt; } } @@ -1535,39 +1538,38 @@ t_taskpurge_x( int sender, int type, int tag, t_info("%d events queued\n", cnt); if (testrange == 0) { - /* we're testing isc_task_purge */ - nevents = isc_task_purge(task, - (void *) purge_sender, - (isc_eventtype_t) purge_type_first, + /* + * We're testing isc_task_purge. + */ + nevents = isc_task_purge(task, (void *)purge_sender, + (isc_eventtype_t)purge_type_first, purge_tag); if (nevents != exp_nevents) { t_info("*** isc_task_purge returned %d, expected %d\n", nevents, exp_nevents); ++*nfails; - } - else if (T_debug) + } else if (T_debug) t_info("isc_task_purge returned %d\n", nevents); - } - else { - /* we're testing isc_task_purgerange */ - nevents = isc_task_purgerange(task, - (void *) purge_sender, - (isc_eventtype_t) purge_type_first, - (isc_eventtype_t) purge_type_last, - purge_tag); + } else { + /* + * We're testing isc_task_purgerange. + */ + nevents = isc_task_purgerange(task, (void *)purge_sender, + (isc_eventtype_t)purge_type_first, + (isc_eventtype_t)purge_type_last, + purge_tag); if (nevents != exp_nevents) { - t_info("*** isc_task_purgerange returned %d, expected %d\n", - nevents, exp_nevents); + t_info("*** isc_task_purgerange returned %d, " + "expected %d\n", nevents, exp_nevents); ++*nfails; - } - else if (T_debug) + } else if (T_debug) t_info("isc_task_purgerange returned %d\n", nevents); } isc_result = isc_mutex_lock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_task_destroy(&task); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); @@ -1577,12 +1579,14 @@ t_taskpurge_x( int sender, int type, int tag, return; } - /* unblock the task, allowing event processing */ + /* + * Unblock the task, allowing event processing. + */ T10_startflag = 1; isc_result = isc_condition_signal(&T10_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++*nprobs; } @@ -1591,12 +1595,14 @@ t_taskpurge_x( int sender, int type, int tag, interval.seconds = 5; interval.nanoseconds = 0; - /* wait for shutdown processing to complete */ + /* + * Wait for shutdown processing to complete. + */ while (T10_shutdownflag == 0) { isc_result = isc_time_nowplusinterval(&now, &interval); if (isc_result != ISC_R_SUCCESS) { t_info("isc_time_nowplusinterval failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_task_detach(&task); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); @@ -1609,7 +1615,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_condition_waituntil(&T10_cv, &T10_mx, &now); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_waituntil returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_task_detach(&task); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); @@ -1623,7 +1629,7 @@ t_taskpurge_x( int sender, int type, int tag, isc_result = isc_mutex_unlock(&T10_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++*nprobs; } @@ -1638,7 +1644,7 @@ t_taskpurge_x( int sender, int type, int tag, if ((T10_eventcnt + nevents) != event_cnt) { t_info("*** processed %d, purged %d, total %d\n", - T10_eventcnt, nevents, event_cnt); + T10_eventcnt, nevents, event_cnt); ++*nfails; } } @@ -1650,23 +1656,36 @@ t_tasks10() { T10_nprobs = 0; T10_nfails = 0; - /* try purging on a specific sender */ + /* + * Try purging on a specific sender. + */ t_info("testing purge on 2,4,8 expecting 1\n"); - t_taskpurge_x( 1, 4, 7, 2, 4, 4, (void *) 8, 1, &T10_nfails, &T10_nprobs, 0); + t_taskpurge_x(1, 4, 7, 2, 4, 4, (void *)8, 1, &T10_nfails, + &T10_nprobs, 0); - /* try purging on all senders */ + /* + * Try purging on all senders. + */ t_info("testing purge on 0,4,8 expecting 3\n"); - t_taskpurge_x( 1, 4, 7, 0, 4, 4, (void *) 8, 3, &T10_nfails, &T10_nprobs, 0); + t_taskpurge_x(1, 4, 7, 0, 4, 4, (void *)8, 3, &T10_nfails, + &T10_nprobs, 0); - /* try purging on all senders, specified type, all tags */ + /* + * Try purging on all senders, specified type, all tags. + */ t_info("testing purge on 0,4,0 expecting 15\n"); - t_taskpurge_x( 1, 4, 7, 0, 4, 4, NULL, 15, &T10_nfails, &T10_nprobs, 0); + t_taskpurge_x(1, 4, 7, 0, 4, 4, NULL, 15, &T10_nfails, &T10_nprobs, 0); - /* try purging on a specified tag, no such type */ + /* + * Try purging on a specified tag, no such type. + */ t_info("testing purge on 0,99,8 expecting 0\n"); - t_taskpurge_x( 1, 4, 7, 0, 99, 99, (void *) 8, 0, &T10_nfails, &T10_nprobs, 0); + t_taskpurge_x(1, 4, 7, 0, 99, 99, (void *)8, 0, &T10_nfails, + &T10_nprobs, 0); - /* try purging on specified sender, type, all tags */ + /* + * Try purging on specified sender, type, all tags. + */ t_info("testing purge on 0,5,0 expecting 5\n"); t_taskpurge_x( 1, 4, 7, 3, 5, 5, NULL, 5, &T10_nfails, &T10_nprobs, 0); @@ -1680,10 +1699,10 @@ t_tasks10() { return(result); } -static char *a10 = "A call to isc_task_purge(task, sender, type, tag) purges " - "all events of type 'type' and with tag 'tag' not marked as " - "unpurgable from sender from the task's queue and returns " - "the number of events purged."; +static char *a10 = "A call to isc_task_purge(task, sender, type, tag) " + "purges all events of type 'type' and with tag 'tag' " + "not marked as unpurgable from sender from the task's " + "queue and returns the number of events purged."; void t10(void) { @@ -1702,10 +1721,8 @@ static int T11_eventcnt; static isc_mutex_t T11_mx; static isc_condition_t T11_cv; - static void t11_event1(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; task = task; @@ -1713,7 +1730,7 @@ t11_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_lock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } @@ -1721,7 +1738,7 @@ t11_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_wait(&T11_cv, &T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } } @@ -1729,7 +1746,7 @@ t11_event1(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_unlock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } @@ -1738,8 +1755,8 @@ t11_event1(isc_task_t *task, isc_event_t *event) { static void t11_event2(isc_task_t *task, isc_event_t *event) { + UNUSED(task); - task = task; ++T11_eventcnt; isc_event_free(&event); } @@ -1747,15 +1764,14 @@ t11_event2(isc_task_t *task, isc_event_t *event) { static void t11_sde(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; - task = task; + UNUSED(task); isc_result = isc_mutex_lock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } @@ -1764,14 +1780,14 @@ t11_sde(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_signal(&T11_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } isc_result = isc_mutex_unlock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } @@ -1780,7 +1796,6 @@ t11_sde(isc_task_t *task, isc_event_t *event) { static int t_tasks11(int purgable) { - char *p; isc_mem_t *mctx; isc_taskmgr_t *tmgr; @@ -1808,14 +1823,14 @@ t_tasks11(int purgable) { isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); return(T_UNRESOLVED); } isc_result = isc_mutex_init(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -1823,7 +1838,7 @@ t_tasks11(int purgable) { isc_result = isc_condition_init(&T11_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); isc_mutex_destroy(&T11_mx); return(T_UNRESOLVED); @@ -1833,7 +1848,7 @@ t_tasks11(int purgable) { isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); isc_mutex_destroy(&T11_mx); isc_condition_destroy(&T11_cv); @@ -1844,7 +1859,7 @@ t_tasks11(int purgable) { isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); isc_mutex_destroy(&T11_mx); @@ -1855,7 +1870,7 @@ t_tasks11(int purgable) { isc_result = isc_task_onshutdown(task, t11_sde, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_task_destroy(&task); isc_taskmgr_destroy(&tmgr); isc_mem_destroy(&mctx); @@ -1864,22 +1879,16 @@ t_tasks11(int purgable) { return(T_UNRESOLVED); } - /* block the task on T11_cv */ - event1 = isc_event_allocate( mctx, - (void *) 1, - (isc_eventtype_t) 1, - t11_event1, - NULL, - sizeof(*event1)); + /* + * Block the task on T11_cv. + */ + event1 = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)1, + t11_event1, NULL, sizeof(*event1)); isc_task_send(task, &event1); - event2 = isc_event_allocate( mctx, - (void *) 1, - (isc_eventtype_t) 1, - t11_event2, - NULL, - sizeof(*event2)); + event2 = isc_event_allocate(mctx, (void *)1, (isc_eventtype_t)1, + t11_event2, NULL, sizeof(*event2)); event2_clone = event2; if (purgable) event2->ev_attributes &= ~ISC_EVENTATTR_NOPURGE; @@ -1891,19 +1900,21 @@ t_tasks11(int purgable) { rval = isc_task_purgeevent(task, event2_clone); if (rval != (purgable ? ISC_TRUE : ISC_FALSE)) { t_info("isc_task_purgeevent returned %s, expected %s\n", - (rval ? "ISC_TRUE" : "ISC_FALSE"), - (purgable ? "ISC_TRUE" : "ISC_FALSE")); + (rval ? "ISC_TRUE" : "ISC_FALSE"), + (purgable ? "ISC_TRUE" : "ISC_FALSE")); ++T11_nfails; } isc_result = isc_mutex_lock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } - /* unblock the task, allowing event processing */ + /* + * Unblock the task, allowing event processing. + */ T11_startflag = 1; isc_result = isc_condition_signal(&T11_cv); if (isc_result != ISC_R_SUCCESS) { @@ -1917,19 +1928,21 @@ t_tasks11(int purgable) { interval.seconds = 5; interval.nanoseconds = 0; - /* wait for shutdown processing to complete */ + /* + * Wait for shutdown processing to complete. + */ while (T11_shutdownflag == 0) { isc_result = isc_time_nowplusinterval(&now, &interval); if (isc_result != ISC_R_SUCCESS) { t_info("isc_time_nowplusinterval failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } isc_result = isc_condition_waituntil(&T11_cv, &T11_mx, &now); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_waituntil returned %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } } @@ -1937,7 +1950,7 @@ t_tasks11(int purgable) { isc_result = isc_mutex_unlock(&T11_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T11_nprobs; } @@ -1948,7 +1961,8 @@ t_tasks11(int purgable) { isc_condition_destroy(&T11_cv); if (T11_eventcnt != (purgable ? 0 : 1)) { - t_info("Event was %s purged\n", (purgable ? "not" : "unexpectedly")); + t_info("Event was %s purged\n", + (purgable ? "not" : "unexpectedly")); ++T11_nfails; } @@ -1962,9 +1976,9 @@ t_tasks11(int purgable) { return(result); } -static char *a11 = "When the event is marked as purgable, a call to " - "isc_task_purgeevent(task, event) purges the event 'event' " - "from the task's queue and returns ISC_TRUE."; +static char *a11 = "When the event is marked as purgable, a call to " + "isc_task_purgeevent(task, event) purges the event 'event' " + "from the task's queue and returns ISC_TRUE."; void t11(void) { @@ -1975,8 +1989,9 @@ t11(void) { } static char *a12 = "When the event is not marked as purgable, a call to " - "isc_task_purgeevent(task, event) does not purge the event 'event' " - "from the task's queue and returns ISC_FALSE."; + "isc_task_purgeevent(task, event) does not purge the " + "event 'event' from the task's queue and returns " + "ISC_FALSE."; static int t_tasks12() { @@ -1994,10 +2009,12 @@ t12(void) { static int T13_nfails; static int T13_nprobs; -static char *a13 = "A call to isc_event_purgerange(task, sender, first, last, tag) " - "purges all events not marked unpurgable from sender 'sender' and " - "of type within the range 'first' to 'last' inclusive from " - "the task's event queue and returns the number of tasks purged."; +static char *a13 = "A call to " + "isc_event_purgerange(task, sender, first, last, tag) " + "purges all events not marked unpurgable from " + "sender 'sender' and of type within the range 'first' " + "to 'last' inclusive from the task's event queue and " + "returns the number of tasks purged."; static int t_tasks13() { @@ -2007,52 +2024,75 @@ t_tasks13() { T13_nprobs = 0; /* - * first lets try the same cases we used in t10 + * First let's try the same cases we used in t10. */ - /* try purging on a specific sender */ + /* + * Try purging on a specific sender. + */ t_info("testing purge on 2,4,8 expecting 1\n"); - t_taskpurge_x( 1, 4, 7, 2, 4, 4, (void *) 8, 1, &T13_nfails, &T13_nprobs, 1); - - /* try purging on all senders */ - t_info("testing purge on 0,4,8 expecting 3\n"); - t_taskpurge_x( 1, 4, 7, 0, 4, 4, (void *) 8, 3, &T13_nfails, &T13_nprobs, 1); - - /* try purging on all senders, specified type, all tags */ - t_info("testing purge on 0,4,0 expecting 15\n"); - t_taskpurge_x( 1, 4, 7, 0, 4, 4, NULL, 15, &T13_nfails, &T13_nprobs, 1); - - /* try purging on a specified tag, no such type */ - t_info("testing purge on 0,99,8 expecting 0\n"); - t_taskpurge_x( 1, 4, 7, 0, 99, 99, (void *) 8, 0, &T13_nfails, &T13_nprobs, 1); - - /* try purging on specified sender, type, all tags */ - t_info("testing purge on 3,5,0 expecting 5\n"); - t_taskpurge_x( 1, 4, 7, 3, 5, 5, 0, 5, &T13_nfails, &T13_nprobs, 1); + t_taskpurge_x(1, 4, 7, 2, 4, 4, (void *)8, 1, + &T13_nfails, &T13_nprobs, 1); /* - * now lets try some ranges + * Try purging on all senders. + */ + t_info("testing purge on 0,4,8 expecting 3\n"); + t_taskpurge_x(1, 4, 7, 0, 4, 4, (void *)8, 3, + &T13_nfails, &T13_nprobs, 1); + + /* + * Try purging on all senders, specified type, all tags. + */ + t_info("testing purge on 0,4,0 expecting 15\n"); + t_taskpurge_x(1, 4, 7, 0, 4, 4, NULL, 15, &T13_nfails, &T13_nprobs, 1); + + /* + * Try purging on a specified tag, no such type. + */ + t_info("testing purge on 0,99,8 expecting 0\n"); + t_taskpurge_x(1, 4, 7, 0, 99, 99, (void *)8, 0, + &T13_nfails, &T13_nprobs, 1); + + /* + * Try purging on specified sender, type, all tags. + */ + t_info("testing purge on 3,5,0 expecting 5\n"); + t_taskpurge_x(1, 4, 7, 3, 5, 5, 0, 5, &T13_nfails, &T13_nprobs, 1); + + /* + * Now let's try some ranges. */ t_info("testing purgerange on 2,4-5,8 expecting 2\n"); - t_taskpurge_x( 1, 4, 7, 2, 4, 5, (void *) 8, 1, &T13_nfails, &T13_nprobs, 1); + t_taskpurge_x(1, 4, 7, 2, 4, 5, (void *)8, 1, + &T13_nfails, &T13_nprobs, 1); - /* try purging on all senders */ + /* + * Try purging on all senders. + */ t_info("testing purge on 0,4-5,8 expecting 5\n"); - t_taskpurge_x( 1, 4, 7, 0, 4, 5, (void *) 8, 5, &T13_nfails, &T13_nprobs, 1); + t_taskpurge_x(1, 4, 7, 0, 4, 5, (void *)8, 5, + &T13_nfails, &T13_nprobs, 1); - /* try purging on all senders, specified type, all tags */ + /* + * Try purging on all senders, specified type, all tags. + */ t_info("testing purge on 0,5-6,0 expecting 28\n"); - t_taskpurge_x( 1, 4, 7, 0, 5, 6, NULL, 28, &T13_nfails, &T13_nprobs, 1); + t_taskpurge_x(1, 4, 7, 0, 5, 6, NULL, 28, &T13_nfails, &T13_nprobs, 1); - /* try purging on a specified tag, no such type */ + /* + * Try purging on a specified tag, no such type. + */ t_info("testing purge on 0,99-101,8 expecting 0\n"); - t_taskpurge_x( 1, 4, 7, 0, 99, 101, (void *) 8, 0, &T13_nfails, &T13_nprobs, 1); + t_taskpurge_x(1, 4, 7, 0, 99, 101, (void *)8, 0, + &T13_nfails, &T13_nprobs, 1); - /* try purging on specified sender, type, all tags */ + /* + * Try purging on specified sender, type, all tags. + */ t_info("testing purge on 3,5-6,0 expecting 10\n"); - t_taskpurge_x( 1, 4, 7, 3, 5, 6, NULL, 10, &T13_nfails, &T13_nprobs, 1); - + t_taskpurge_x(1, 4, 7, 3, 5, 6, NULL, 10, &T13_nfails, &T13_nprobs, 1); result = T_UNRESOLVED; @@ -2061,10 +2101,9 @@ t_tasks13() { else if (T13_nfails) result = T_FAIL; - return(result); + return (result); } - void t13(void) { int result; diff --git a/bin/tests/timer_test.c b/bin/tests/timer_test.c index af3798d2e9..7063fdafc3 100644 --- a/bin/tests/timer_test.c +++ b/bin/tests/timer_test.c @@ -17,19 +17,13 @@ #include -#include #include #include -#include -#include -#include #include #include -#include #include #include -#include #include isc_mem_t *mctx1, *mctx2, *mctx3; diff --git a/bin/tests/timers/t_timers.c b/bin/tests/timers/t_timers.c index 3ed3fadf17..4f2cdc54d0 100644 --- a/bin/tests/timers/t_timers.c +++ b/bin/tests/timers/t_timers.c @@ -17,24 +17,14 @@ #include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include #include #include -#include -#include #include #include +#include #include @@ -56,31 +46,32 @@ static int Tx_nanoseconds; static void tx_sde(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; task = task; event = event; - /* signal shutdown processing complete */ + /* + * Signal shutdown processing complete. + */ isc_result = isc_mutex_lock(&Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } isc_result = isc_condition_signal(&Tx_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } isc_result = isc_mutex_unlock(&Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } @@ -89,7 +80,6 @@ tx_sde(isc_task_t *task, isc_event_t *event) { static void tx_te(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; isc_time_t now; isc_time_t base; @@ -128,8 +118,7 @@ tx_te(isc_task_t *task, isc_event_t *event) { ++Tx_nfails; } Tx_lasttime = now; - } - else { + } else { t_info("isc_time_now failed %s\n", isc_result_totext(isc_result)); ++Tx_nprobs; @@ -151,9 +140,9 @@ tx_te(isc_task_t *task, isc_event_t *event) { static void t_timers_x(isc_timertype_t timertype, isc_time_t *expires, - isc_interval_t *interval, - void (*action)(isc_task_t *, isc_event_t *)) { - + isc_interval_t *interval, + void (*action)(isc_task_t *, isc_event_t *)) +{ char *p; isc_mem_t *mctx; isc_taskmgr_t *tmgr; @@ -175,7 +164,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; return; } @@ -183,7 +172,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_mutex_init(&Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); ++Tx_nprobs; return; @@ -192,7 +181,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_condition_init(&Tx_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&Tx_mx); isc_mem_destroy(&mctx); ++Tx_nprobs; @@ -203,7 +192,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&Tx_mx); isc_condition_destroy(&Tx_cv); isc_mem_destroy(&mctx); @@ -215,7 +204,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_timermgr_create(mctx, &timermgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_timermgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&Tx_mx); isc_condition_destroy(&Tx_cv); @@ -227,7 +216,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_mutex_lock(&Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&Tx_mx); @@ -241,7 +230,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_task_create(tmgr, 0, &task); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&Tx_mx); @@ -254,7 +243,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_task_onshutdown(task, tx_sde, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_task_destroy(&task); isc_taskmgr_destroy(&tmgr); @@ -278,14 +267,9 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, } Tx_timer = NULL; - isc_result = isc_timer_create( timermgr, - timertype, - expires, - interval, - task, - action, - (void *) timertype, - &Tx_timer); + isc_result = isc_timer_create(timermgr, timertype, expires, interval, + task, action, (void *)timertype, + &Tx_timer); if (isc_result != ISC_R_SUCCESS) { isc_timermgr_destroy(&timermgr); @@ -298,12 +282,14 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, return; } - /* wait for shutdown processing to complete */ + /* + * Wait for shutdown processing to complete. + */ while (Tx_eventcnt != Tx_nevents) { isc_result = isc_condition_wait(&Tx_cv, &Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_waituntil failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } } @@ -311,7 +297,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires, isc_result = isc_mutex_unlock(&Tx_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } @@ -391,10 +377,9 @@ t2() { isc_interval_set(&interval, 0, 0); t_timers_x(isc_timertype_once, &expires, &interval, tx_te); - } - else { + } else { t_info("isc_time_nowplusinterval failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); } result = T_UNRESOLVED; @@ -409,7 +394,6 @@ t2() { static void t3_te(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; isc_time_t now; isc_time_t base; @@ -437,16 +421,15 @@ t3_te(isc_task_t *task, isc_event_t *event) { ++Tx_nfails; } Tx_lasttime = now; - } - else { + } else { t_info("isc_time_now failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } if (event->ev_type != ISC_TIMEREVENT_IDLE) { t_info("received event type %d, expected type %d\n", - event->ev_type, ISC_TIMEREVENT_IDLE); + event->ev_type, ISC_TIMEREVENT_IDLE); ++Tx_nfails; } @@ -487,7 +470,7 @@ t3() { } else { t_info("isc_time_nowplusinterval failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } @@ -519,7 +502,9 @@ t4_te(isc_task_t *task, isc_event_t *event) { t_info("tick %d\n", Tx_eventcnt); - /* check expired time */ + /* + * Check expired time. + */ isc_result = isc_time_now(&now); if (isc_result == ISC_R_SUCCESS) { @@ -540,14 +525,14 @@ t4_te(isc_task_t *task, isc_event_t *event) { } else { t_info("isc_time_now failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++Tx_nprobs; } if (Tx_eventcnt < 3) { if (event->ev_type != ISC_TIMEREVENT_TICK) { t_info("received event type %d, expected type %d\n", - event->ev_type, ISC_TIMEREVENT_IDLE); + event->ev_type, ISC_TIMEREVENT_IDLE); ++Tx_nfails; } if (Tx_eventcnt == 2) { @@ -567,18 +552,16 @@ t4_te(isc_task_t *task, isc_event_t *event) { isc_result_totext(isc_result)); ++Tx_nfails; } - } - else { + } else { t_info("isc_time_nowplusinterval failed %s\n", isc_result_totext(isc_result)); ++Tx_nprobs; } } - } - else { + } else { if (event->ev_type != ISC_TIMEREVENT_LIFE) { t_info("received event type %d, expected type %d\n", - event->ev_type, ISC_TIMEREVENT_IDLE); + event->ev_type, ISC_TIMEREVENT_IDLE); ++Tx_nfails; } @@ -637,22 +620,21 @@ static isc_task_t *T5_task2; /* * T5_task1 blocks on T5_mx while events accumulate - * in it's queue, until signaled by T5_task2 + * in it's queue, until signaled by T5_task2. */ static void t5_start_event(isc_task_t *task, isc_event_t *event) { - isc_result_t isc_result; - task = task; + UNUSED(task); t_info("t5_start_event\n"); isc_result = isc_mutex_lock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } @@ -663,7 +645,7 @@ t5_start_event(isc_task_t *task, isc_event_t *event) { isc_result = isc_mutex_unlock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } isc_event_free(&event); @@ -681,8 +663,8 @@ t5_tick_event(isc_task_t *task, isc_event_t *event) { t_info("t5_tick_event %d\n", T5_eventcnt); /* - * on the first tick, purge all remaining tick events - * and then shut down the task + * On the first tick, purge all remaining tick events + * and then shut down the task. */ if (T5_eventcnt == 1) { isc_time_settoepoch(&expires); @@ -692,7 +674,7 @@ t5_tick_event(isc_task_t *task, isc_event_t *event) { &interval, ISC_TRUE); if (isc_result != ISC_R_SUCCESS) { t_info("isc_timer_reset failed %d\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nfails; } isc_task_shutdown(task); @@ -708,12 +690,12 @@ t5_once_event(isc_task_t *task, isc_event_t *event) { t_info("t5_once_event\n"); /* - * allow task1 to start processing events + * Allow task1 to start processing events. */ isc_result = isc_mutex_lock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } @@ -722,14 +704,14 @@ t5_once_event(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_broadcast(&T5_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_broadcast failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } isc_result = isc_mutex_unlock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } @@ -742,18 +724,18 @@ t5_shutdown_event(isc_task_t *task, isc_event_t *event) { isc_result_t isc_result; - task = task; - event = event; + UNUSED(task); + UNUSED(event); t_info("t5_shutdown_event\n"); /* - * signal shutdown processing complete + * Signal shutdown processing complete. */ isc_result = isc_mutex_lock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } @@ -762,14 +744,14 @@ t5_shutdown_event(isc_task_t *task, isc_event_t *event) { isc_result = isc_condition_signal(&T5_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_signal failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } isc_result = isc_mutex_unlock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } isc_event_free(&event); @@ -802,14 +784,14 @@ t_timers5() { isc_result = isc_mem_create(0, 0, &mctx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mem_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); return(T_UNRESOLVED); } isc_result = isc_mutex_init(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mem_destroy(&mctx); return(T_UNRESOLVED); } @@ -817,7 +799,7 @@ t_timers5() { isc_result = isc_condition_init(&T5_cv); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_init failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T5_mx); isc_mem_destroy(&mctx); return(T_UNRESOLVED); @@ -827,7 +809,7 @@ t_timers5() { isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_taskmgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_mutex_destroy(&T5_mx); isc_condition_destroy(&T5_cv); isc_mem_destroy(&mctx); @@ -838,7 +820,7 @@ t_timers5() { isc_result = isc_timermgr_create(mctx, &timermgr); if (isc_result != ISC_R_SUCCESS) { t_info("isc_timermgr_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&T5_mx); isc_condition_destroy(&T5_cv); @@ -850,7 +832,7 @@ t_timers5() { isc_result = isc_task_create(tmgr, 0, &T5_task1); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&T5_mx); @@ -862,7 +844,7 @@ t_timers5() { isc_result = isc_task_onshutdown(T5_task1, t5_shutdown_event, NULL); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_onshutdown failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_task_destroy(&T5_task1); isc_taskmgr_destroy(&tmgr); @@ -876,7 +858,7 @@ t_timers5() { isc_result = isc_task_create(tmgr, 0, &T5_task2); if (isc_result != ISC_R_SUCCESS) { t_info("isc_task_create failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_task_destroy(&T5_task1); isc_taskmgr_destroy(&tmgr); @@ -889,7 +871,7 @@ t_timers5() { isc_result = isc_mutex_lock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_lock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); isc_timermgr_destroy(&timermgr); isc_taskmgr_destroy(&tmgr); isc_mutex_destroy(&T5_mx); @@ -906,14 +888,9 @@ t_timers5() { isc_interval_set(&interval, T5_SECONDS, 0); T5_tickertimer = NULL; - isc_result = isc_timer_create( timermgr, - isc_timertype_ticker, - &expires, - &interval, - T5_task1, - t5_tick_event, - NULL, - &T5_tickertimer); + isc_result = isc_timer_create(timermgr, isc_timertype_ticker, + &expires, &interval, T5_task1, + t5_tick_event, NULL, &T5_tickertimer); if (isc_result != ISC_R_SUCCESS) { isc_timermgr_destroy(&timermgr); @@ -965,12 +942,14 @@ t_timers5() { return(T_UNRESOLVED); } - /* wait for shutdown processing to complete */ + /* + * Wait for shutdown processing to complete. + */ while (! T5_shutdownflag) { isc_result = isc_condition_wait(&T5_cv, &T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_condition_waituntil failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } } @@ -978,7 +957,7 @@ t_timers5() { isc_result = isc_mutex_unlock(&T5_mx); if (isc_result != ISC_R_SUCCESS) { t_info("isc_mutex_unlock failed %s\n", - isc_result_totext(isc_result)); + isc_result_totext(isc_result)); ++T5_nprobs; } diff --git a/bin/tests/tkey_test.c b/bin/tests/tkey_test.c index 6b1f6dcd08..dda2e342bd 100644 --- a/bin/tests/tkey_test.c +++ b/bin/tests/tkey_test.c @@ -21,35 +21,24 @@ #include -#include #include -#include -#include +#include +#include #include -#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include diff --git a/bin/tests/wire_test.c b/bin/tests/wire_test.c index 9ab4675c6e..1c3ab60e01 100644 --- a/bin/tests/wire_test.c +++ b/bin/tests/wire_test.c @@ -17,33 +17,18 @@ #include -#include -#include #include -#include -#include -#include -#include -#include +#include +#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include #include "printmsg.h" static inline void -CHECKRESULT(isc_result_t result, char *msg) -{ +CHECKRESULT(isc_result_t result, char *msg) { if (result != ISC_R_SUCCESS) { printf("%s: %s\n", msg, dns_result_totext(result)); diff --git a/bin/tests/zone2_test.c b/bin/tests/zone2_test.c index 15151b2bf4..3df1a92abd 100644 --- a/bin/tests/zone2_test.c +++ b/bin/tests/zone2_test.c @@ -15,25 +15,25 @@ * SOFTWARE. */ -#include -#include -#include - #include +#include +#include + #include -#include -#include #include +#include #include #include #include +#include +#include +#include #include #include #include #include -#include #define ERRRET(result, function) \ do { \ diff --git a/bin/tests/zone_test.c b/bin/tests/zone_test.c index 8e9f547747..42bcc7fbf5 100644 --- a/bin/tests/zone_test.c +++ b/bin/tests/zone_test.c @@ -15,23 +15,25 @@ * SOFTWARE. */ -#include -#include -#include +#include + +#include -#include -#include -#include #include +#include +#include #include +#include +#include #include #include #include -#include +#include #include - +#include #include +#include static int debug = 0; static int quiet = 0; @@ -111,7 +113,7 @@ setup(char *zonename, char *filename, char *classname) { dns_zone_setclass(zone, rdclass); if (zonetype == dns_zone_slave) - dns_zone_addmaster(zone, &addr); + dns_zone_setmasters(zone, &addr, 1); result = dns_zone_load(zone); ERRRET(result, "dns_zone_load"); diff --git a/lib/dns/a6.c b/lib/dns/a6.c index 19b5ec87c8..479f54680d 100644 --- a/lib/dns/a6.c +++ b/lib/dns/a6.c @@ -17,22 +17,15 @@ #include -#include -#include -#include #include -#include #include #include #include #include -#include -#define A6CONTEXT_MAGIC 0x41365858U /* A6XX. */ -#define VALID_A6CONTEXT(ac) ((ac) != NULL && \ - (ac)->magic == A6CONTEXT_MAGIC) - +#define A6CONTEXT_MAGIC 0x41365858U /* A6XX. */ +#define VALID_A6CONTEXT(ac) ISC_MAGIC_VALID(ac, A6CONTEXT_MAGIC) #define MAX_CHAINS 8 #define MAX_DEPTH 16 diff --git a/lib/dns/acl.c b/lib/dns/acl.c index 78be47ada4..882b2c4c97 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -17,28 +17,20 @@ #include -#include - -#include -#include #include -#include +#include #include #include -#include -#include -#include isc_result_t -dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) -{ +dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) { isc_result_t result; dns_acl_t *acl; - /* - * Work around silly limitation of isc_mem_get(). - */ + /* + * Work around silly limitation of isc_mem_get(). + */ if (n == 0) n = 1; @@ -53,7 +45,9 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) acl->length = 0; ISC_LINK_INIT(acl, nextincache); - /* Must set magic early because we use dns_acl_detach() to clean up. */ + /* + * Must set magic early because we use dns_acl_detach() to clean up. + */ acl->magic = DNS_ACL_MAGIC; acl->elements = isc_mem_get(mctx, n * sizeof(dns_aclelement_t)); @@ -72,8 +66,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) } isc_result_t -dns_acl_appendelement(dns_acl_t *acl, dns_aclelement_t *elt) -{ +dns_acl_appendelement(dns_acl_t *acl, dns_aclelement_t *elt) { if (acl->length + 1 > acl->alloc) { /* * Resize the ACL. @@ -104,8 +97,7 @@ dns_acl_appendelement(dns_acl_t *acl, dns_aclelement_t *elt) } static isc_result_t -dns_acl_anyornone(isc_mem_t *mctx, isc_boolean_t neg, dns_acl_t **target) -{ +dns_acl_anyornone(isc_mem_t *mctx, isc_boolean_t neg, dns_acl_t **target) { isc_result_t result; dns_acl_t *acl = NULL; result = dns_acl_create(mctx, 1, &acl); @@ -222,8 +214,7 @@ dns_acl_match(isc_netaddr_t *reqaddr, } void -dns_acl_attach(dns_acl_t *source, dns_acl_t **target) -{ +dns_acl_attach(dns_acl_t *source, dns_acl_t **target) { REQUIRE(DNS_ACL_VALID(source)); INSIST(source->refcount > 0); source->refcount++; @@ -231,8 +222,7 @@ dns_acl_attach(dns_acl_t *source, dns_acl_t **target) } static void -destroy(dns_acl_t *dacl) -{ +destroy(dns_acl_t *dacl) { unsigned int i; for (i = 0; i < dacl->length; i++) { dns_aclelement_t *de = &dacl->elements[i]; @@ -255,8 +245,7 @@ destroy(dns_acl_t *dacl) } void -dns_acl_detach(dns_acl_t **aclp) -{ +dns_acl_detach(dns_acl_t **aclp) { dns_acl_t *acl = *aclp; REQUIRE(DNS_ACL_VALID(acl)); INSIST(acl->refcount > 0); @@ -267,8 +256,7 @@ dns_acl_detach(dns_acl_t **aclp) } isc_boolean_t -dns_aclelement_equal(dns_aclelement_t *ea, dns_aclelement_t *eb) -{ +dns_aclelement_equal(dns_aclelement_t *ea, dns_aclelement_t *eb) { if (ea->type != eb->type) return (ISC_FALSE); switch (ea->type) { @@ -308,8 +296,7 @@ dns_acl_equal(dns_acl_t *a, dns_acl_t *b) { } isc_result_t -dns_aclenv_init(isc_mem_t *mctx, dns_aclenv_t *env) -{ +dns_aclenv_init(isc_mem_t *mctx, dns_aclenv_t *env) { isc_result_t result; env->localhost = NULL; env->localnets = NULL; @@ -327,14 +314,16 @@ dns_aclenv_init(isc_mem_t *mctx, dns_aclenv_t *env) return (result); } -void dns_aclenv_copy(dns_aclenv_t *t, dns_aclenv_t *s) { +void +dns_aclenv_copy(dns_aclenv_t *t, dns_aclenv_t *s) { dns_acl_detach(&t->localhost); dns_acl_attach(s->localhost, &t->localhost); dns_acl_detach(&t->localnets); dns_acl_attach(s->localnets, &t->localnets); } -void dns_aclenv_destroy(dns_aclenv_t *env) { +void +dns_aclenv_destroy(dns_aclenv_t *env) { dns_acl_detach(&env->localhost); dns_acl_detach(&env->localnets); } diff --git a/lib/dns/aclconf.c b/lib/dns/aclconf.c index 5af2117028..082b50eeb6 100644 --- a/lib/dns/aclconf.c +++ b/lib/dns/aclconf.c @@ -17,23 +17,20 @@ #include -#include -#include -#include #include +#include #include #include #include -#include -void dns_aclconfctx_init(dns_aclconfctx_t *ctx) -{ +void +dns_aclconfctx_init(dns_aclconfctx_t *ctx) { ISC_LIST_INIT(ctx->named_acl_cache); } -void dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) -{ +void +dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) { dns_acl_t *dacl, *next; for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache); dacl != NULL; @@ -146,14 +143,16 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml, case dns_c_ipmatch_key: de->type = dns_aclelementtype_keyname; dns_name_init(&de->u.keyname, NULL); - result = convert_keyname(ce->u.key, mctx, &de->u.keyname); + result = convert_keyname(ce->u.key, mctx, + &de->u.keyname); if (result != ISC_R_SUCCESS) goto cleanup; break; case dns_c_ipmatch_indirect: de->type = dns_aclelementtype_nestedacl; - result = dns_acl_fromconfig(ce->u.indirect.list, cctx, - ctx, mctx, &de->u.nestedacl); + result = dns_acl_fromconfig(ce->u.indirect.list, + cctx, ctx, mctx, + &de->u.nestedacl); if (result != ISC_R_SUCCESS) goto cleanup; break; @@ -170,8 +169,9 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml, break; case dns_c_ipmatch_acl: de->type = dns_aclelementtype_nestedacl; - result = convert_named_acl(ce->u.aclname, cctx, - ctx, mctx, &de->u.nestedacl); + result = convert_named_acl(ce->u.aclname, + cctx, ctx, mctx, + &de->u.nestedacl); if (result != ISC_R_SUCCESS) goto cleanup; break; diff --git a/lib/dns/adb.c b/lib/dns/adb.c index a56b366e9e..444f8f53ec 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -33,17 +33,10 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include #include #include @@ -51,15 +44,11 @@ #include #include #include -#include #include -#include #include #include #include #include -#include -#include #define DNS_ADB_MAGIC 0x44616462 /* Dadb. */ #define DNS_ADB_VALID(x) ISC_MAGIC_VALID(x, DNS_ADB_MAGIC) @@ -566,8 +555,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, } static void -import_a6(dns_a6context_t *a6ctx) -{ +import_a6(dns_a6context_t *a6ctx) { dns_adbname_t *name; dns_adb_t *adb; dns_adbnamehook_t *nh; @@ -637,8 +625,7 @@ import_a6(dns_a6context_t *a6ctx) * Requires the name's bucket be locked. */ static void -kill_name(dns_adbname_t **n, isc_eventtype_t ev) -{ +kill_name(dns_adbname_t **n, isc_eventtype_t ev) { dns_adbname_t *name; dns_adb_t *adb; @@ -687,8 +674,7 @@ kill_name(dns_adbname_t **n, isc_eventtype_t ev) * Requires the name's bucket be locked and no entry buckets be locked. */ static void -check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) -{ +check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) { dns_adb_t *adb; INSIST(DNS_ADBNAME_VALID(name)); @@ -732,8 +718,7 @@ check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) * Requires the name's bucket be locked. */ static inline void -link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) -{ +link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) { INSIST(name->lock_bucket == DNS_ADB_INVALIDBUCKET); ISC_LIST_PREPEND(adb->names[bucket], name, plink); @@ -745,8 +730,7 @@ link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) * Requires the name's bucket be locked. */ static inline void -unlink_name(dns_adb_t *adb, dns_adbname_t *name) -{ +unlink_name(dns_adb_t *adb, dns_adbname_t *name) { int bucket; bucket = name->lock_bucket; @@ -764,8 +748,7 @@ unlink_name(dns_adb_t *adb, dns_adbname_t *name) * Requires the entry's bucket be locked. */ static inline void -link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) -{ +link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) { ISC_LIST_PREPEND(adb->entries[bucket], entry, plink); entry->lock_bucket = bucket; adb->entry_refcnt[bucket]++; @@ -775,8 +758,7 @@ link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) * Requires the entry's bucket be locked. */ static inline void -unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) -{ +unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) { int bucket; bucket = entry->lock_bucket; @@ -791,8 +773,7 @@ unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) } static inline void -violate_locking_hierarchy(isc_mutex_t *have, isc_mutex_t *want) -{ +violate_locking_hierarchy(isc_mutex_t *have, isc_mutex_t *want) { if (isc_mutex_trylock(want) != ISC_R_SUCCESS) { UNLOCK(have); LOCK(want); @@ -805,8 +786,7 @@ violate_locking_hierarchy(isc_mutex_t *have, isc_mutex_t *want) * checked after calling this function. */ static void -shutdown_names(dns_adb_t *adb) -{ +shutdown_names(dns_adb_t *adb) { int bucket; dns_adbname_t *name; dns_adbname_t *next_name; @@ -846,8 +826,7 @@ shutdown_names(dns_adb_t *adb) * checked after calling this function. */ static void -shutdown_entries(dns_adb_t *adb) -{ +shutdown_entries(dns_adb_t *adb) { int bucket; dns_adbentry_t *entry; dns_adbentry_t *next_entry; @@ -888,8 +867,7 @@ shutdown_entries(dns_adb_t *adb) * Name bucket must be locked */ static void -cancel_fetches_at_name(dns_adbname_t *name) -{ +cancel_fetches_at_name(dns_adbname_t *name) { dns_adbfetch6_t *fetch6; if (NAME_FETCH_A(name)) @@ -911,8 +889,7 @@ cancel_fetches_at_name(dns_adbname_t *name) * Assumes the name bucket is locked. */ static void -clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) -{ +clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) { dns_adbentry_t *entry; dns_adbnamehook_t *namehook; int addr_bucket; @@ -1034,8 +1011,7 @@ set_target(dns_adb_t *adb, dns_name_t *name, dns_name_t *fname, * Assumes nothing is locked, since this is called by the client. */ static void -event_free(isc_event_t *event) -{ +event_free(isc_event_t *event) { dns_adbfind_t *find; INSIST(event != NULL); @@ -1134,8 +1110,7 @@ clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, } static inline void -check_exit(dns_adb_t *adb) -{ +check_exit(dns_adb_t *adb) { isc_event_t *event; isc_task_t *etask; isc_boolean_t zeroirefcnt; @@ -1179,8 +1154,7 @@ check_exit(dns_adb_t *adb) } static inline void -dec_adb_irefcnt(dns_adb_t *adb) -{ +dec_adb_irefcnt(dns_adb_t *adb) { LOCK(&adb->ilock); INSIST(adb->irefcnt > 0); @@ -1190,8 +1164,7 @@ dec_adb_irefcnt(dns_adb_t *adb) } static inline void -inc_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) -{ +inc_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) { if (lock) LOCK(&adb->lock); @@ -1202,8 +1175,7 @@ inc_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) } static inline void -dec_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) -{ +dec_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) { if (lock) LOCK(&adb->lock); @@ -1218,8 +1190,7 @@ dec_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock) } static inline void -inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) -{ +inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { int bucket; bucket = entry->lock_bucket; @@ -1234,8 +1205,7 @@ inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) } static inline void -dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) -{ +dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { int bucket; isc_boolean_t destroy_entry; @@ -1266,8 +1236,7 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) } static inline dns_adbname_t * -new_adbname(dns_adb_t *adb, dns_name_t *dnsname) -{ +new_adbname(dns_adb_t *adb, dns_name_t *dnsname) { dns_adbname_t *name; name = isc_mempool_get(adb->nmp); @@ -1301,8 +1270,7 @@ new_adbname(dns_adb_t *adb, dns_name_t *dnsname) } static inline void -free_adbname(dns_adb_t *adb, dns_adbname_t **name) -{ +free_adbname(dns_adb_t *adb, dns_adbname_t **name) { dns_adbname_t *n; INSIST(name != NULL && DNS_ADBNAME_VALID(*name)); @@ -1324,8 +1292,7 @@ free_adbname(dns_adb_t *adb, dns_adbname_t **name) } static inline dns_adbnamehook_t * -new_adbnamehook(dns_adb_t *adb, dns_adbentry_t *entry) -{ +new_adbnamehook(dns_adb_t *adb, dns_adbentry_t *entry) { dns_adbnamehook_t *nh; nh = isc_mempool_get(adb->nhmp); @@ -1340,8 +1307,7 @@ new_adbnamehook(dns_adb_t *adb, dns_adbentry_t *entry) } static inline void -free_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook) -{ +free_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook) { dns_adbnamehook_t *nh; INSIST(namehook != NULL && DNS_ADBNAMEHOOK_VALID(*namehook)); @@ -1356,8 +1322,7 @@ free_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook) } static inline dns_adbzoneinfo_t * -new_adbzoneinfo(dns_adb_t *adb, dns_name_t *zone) -{ +new_adbzoneinfo(dns_adb_t *adb, dns_name_t *zone) { dns_adbzoneinfo_t *zi; zi = isc_mempool_get(adb->zimp); @@ -1378,8 +1343,7 @@ new_adbzoneinfo(dns_adb_t *adb, dns_name_t *zone) } static inline void -free_adbzoneinfo(dns_adb_t *adb, dns_adbzoneinfo_t **zoneinfo) -{ +free_adbzoneinfo(dns_adb_t *adb, dns_adbzoneinfo_t **zoneinfo) { dns_adbzoneinfo_t *zi; INSIST(zoneinfo != NULL && DNS_ADBZONEINFO_VALID(*zoneinfo)); @@ -1396,8 +1360,7 @@ free_adbzoneinfo(dns_adb_t *adb, dns_adbzoneinfo_t **zoneinfo) } static inline dns_adbentry_t * -new_adbentry(dns_adb_t *adb) -{ +new_adbentry(dns_adb_t *adb) { dns_adbentry_t *e; isc_uint32_t r; @@ -1422,8 +1385,7 @@ new_adbentry(dns_adb_t *adb) } static inline void -free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) -{ +free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) { dns_adbentry_t *e; dns_adbzoneinfo_t *zi; @@ -1448,8 +1410,7 @@ free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) } static inline dns_adbfind_t * -new_adbfind(dns_adb_t *adb) -{ +new_adbfind(dns_adb_t *adb) { dns_adbfind_t *h; isc_result_t result; @@ -1458,7 +1419,7 @@ new_adbfind(dns_adb_t *adb) return (NULL); /* - * public members + * Public members. */ h->magic = 0; h->adb = adb; @@ -1490,8 +1451,7 @@ new_adbfind(dns_adb_t *adb) } static inline dns_adbfetch_t * -new_adbfetch(dns_adb_t *adb) -{ +new_adbfetch(dns_adb_t *adb) { dns_adbfetch_t *f; f = isc_mempool_get(adb->afmp); @@ -1527,8 +1487,7 @@ new_adbfetch(dns_adb_t *adb) } static inline void -free_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch) -{ +free_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch) { dns_adbfetch_t *f; INSIST(fetch != NULL && DNS_ADBFETCH_VALID(*fetch)); @@ -1609,8 +1568,7 @@ a6missing(dns_a6context_t *a6ctx, dns_name_t *a6name) { } static inline dns_adbfetch6_t * -new_adbfetch6(dns_adb_t *adb, dns_adbname_t *name, dns_a6context_t *a6ctx) -{ +new_adbfetch6(dns_adb_t *adb, dns_adbname_t *name, dns_a6context_t *a6ctx) { dns_adbfetch6_t *f; f = isc_mempool_get(adb->af6mp); @@ -1652,8 +1610,7 @@ new_adbfetch6(dns_adb_t *adb, dns_adbname_t *name, dns_a6context_t *a6ctx) } static inline void -free_adbfetch6(dns_adb_t *adb, dns_adbfetch6_t **fetch) -{ +free_adbfetch6(dns_adb_t *adb, dns_adbfetch6_t **fetch) { dns_adbfetch6_t *f; INSIST(fetch != NULL && DNS_ADBFETCH6_VALID(*fetch)); @@ -1674,8 +1631,7 @@ free_adbfetch6(dns_adb_t *adb, dns_adbfetch6_t **fetch) } static inline void -free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) -{ +free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) { dns_adbfind_t *find; INSIST(findp != NULL && DNS_ADBFIND_VALID(*findp)); @@ -1700,8 +1656,7 @@ free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) * if this function returns a valid pointer. */ static inline dns_adbaddrinfo_t * -new_adbaddrinfo(dns_adb_t *adb, dns_adbentry_t *entry) -{ +new_adbaddrinfo(dns_adb_t *adb, dns_adbentry_t *entry) { dns_adbaddrinfo_t *ai; ai = isc_mempool_get(adb->aimp); @@ -1721,8 +1676,7 @@ new_adbaddrinfo(dns_adb_t *adb, dns_adbentry_t *entry) } static inline void -free_adbaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **ainfo) -{ +free_adbaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **ainfo) { dns_adbaddrinfo_t *ai; INSIST(ainfo != NULL && DNS_ADBADDRINFO_VALID(*ainfo)); @@ -1787,8 +1741,7 @@ find_name_and_lock(dns_adb_t *adb, dns_name_t *name, * the bucket changes. */ static inline dns_adbentry_t * -find_entry_and_lock(dns_adb_t *adb, isc_sockaddr_t *addr, int *bucketp) -{ +find_entry_and_lock(dns_adb_t *adb, isc_sockaddr_t *addr, int *bucketp) { dns_adbentry_t *entry; int bucket; @@ -1941,11 +1894,10 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_name_t *zone, } static void -shutdown_task(isc_task_t *task, isc_event_t *ev) -{ +shutdown_task(isc_task_t *task, isc_event_t *ev) { dns_adb_t *adb; - (void)task; /* not used */ + UNUSED(task); adb = ev->ev_arg; INSIST(DNS_ADB_VALID(adb)); @@ -1967,8 +1919,7 @@ shutdown_task(isc_task_t *task, isc_event_t *ev) * name bucket must be locked; adb may be locked; no other locks held. */ static void -check_expire_name(dns_adbname_t **namep, isc_stdtime_t now) -{ +check_expire_name(dns_adbname_t **namep, isc_stdtime_t now) { dns_adbname_t *name; INSIST(namep != NULL && DNS_ADBNAME_VALID(*namep)); @@ -2027,8 +1978,7 @@ check_expire_entry(dns_adb_t *adb, dns_adbentry_t **entryp, isc_stdtime_t now) * ADB must be locked, and no other locks held. */ static void -cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) -{ +cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) { dns_adbname_t *name; dns_adbname_t *next_name; @@ -2054,8 +2004,7 @@ cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) * ADB must be locked, and no other locks held. */ static void -cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) -{ +cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) { dns_adbentry_t *entry, *next_entry; int freq; @@ -2087,8 +2036,7 @@ cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) } static void -timer_cleanup(isc_task_t *task, isc_event_t *ev) -{ +timer_cleanup(isc_task_t *task, isc_event_t *ev) { dns_adb_t *adb; isc_result_t result; isc_stdtime_t now; @@ -2134,8 +2082,7 @@ timer_cleanup(isc_task_t *task, isc_event_t *ev) } static void -destroy(dns_adb_t *adb) -{ +destroy(dns_adb_t *adb) { adb->magic = 0; /* @@ -2363,8 +2310,7 @@ dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbx) { } void -dns_adb_detach(dns_adb_t **adbx) -{ +dns_adb_detach(dns_adb_t **adbx) { dns_adb_t *adb; REQUIRE(adbx != NULL && DNS_ADB_VALID(*adbx)); @@ -2380,8 +2326,7 @@ dns_adb_detach(dns_adb_t **adbx) } void -dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) -{ +dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) { isc_task_t *clone; isc_event_t *event; isc_boolean_t zeroirefcnt = ISC_FALSE; @@ -2746,8 +2691,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, } void -dns_adb_destroyfind(dns_adbfind_t **findp) -{ +dns_adb_destroyfind(dns_adbfind_t **findp) { dns_adbfind_t *find; dns_adbentry_t *entry; dns_adbaddrinfo_t *ai; @@ -2803,8 +2747,7 @@ dns_adb_destroyfind(dns_adbfind_t **findp) } void -dns_adb_cancelfind(dns_adbfind_t *find) -{ +dns_adb_cancelfind(dns_adbfind_t *find) { isc_event_t *ev; isc_task_t *task; dns_adb_t *adb; @@ -2859,8 +2802,7 @@ dns_adb_cancelfind(dns_adbfind_t *find) } void -dns_adb_dump(dns_adb_t *adb, FILE *f) -{ +dns_adb_dump(dns_adb_t *adb, FILE *f) { REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(f != NULL); @@ -2877,8 +2819,7 @@ dns_adb_dump(dns_adb_t *adb, FILE *f) } static void -dump_adb(dns_adb_t *adb, FILE *f) -{ +dump_adb(dns_adb_t *adb, FILE *f) { int i; isc_sockaddr_t *sa; dns_adbname_t *name; @@ -2996,8 +2937,7 @@ dump_adb(dns_adb_t *adb, FILE *f) } void -dns_adb_dumpfind(dns_adbfind_t *find, FILE *f) -{ +dns_adb_dumpfind(dns_adbfind_t *find, FILE *f) { char tmp[512]; const char *tmpp; dns_adbaddrinfo_t *ai; @@ -3050,8 +2990,7 @@ dns_adb_dumpfind(dns_adbfind_t *find, FILE *f) } static void -print_dns_name(FILE *f, dns_name_t *name) -{ +print_dns_name(FILE *f, dns_name_t *name) { char buf[1024]; isc_buffer_t b; isc_region_t r; @@ -3067,8 +3006,7 @@ print_dns_name(FILE *f, dns_name_t *name) } static void -print_namehook_list(FILE *f, dns_adbname_t *n) -{ +print_namehook_list(FILE *f, dns_adbname_t *n) { dns_adbnamehook_t *nh; nh = ISC_LIST_HEAD(n->v4); @@ -3084,22 +3022,19 @@ print_namehook_list(FILE *f, dns_adbname_t *n) } static inline void -print_fetch(FILE *f, dns_adbfetch_t *ft, char *type) -{ +print_fetch(FILE *f, dns_adbfetch_t *ft, char *type) { fprintf(f, "\t\tFetch(%s): %p -> { nh %p, entry %p, fetch %p }\n", type, ft, ft->namehook, ft->entry, ft->fetch); } static inline void -print_fetch6(FILE *f, dns_adbfetch6_t *ft) -{ +print_fetch6(FILE *f, dns_adbfetch6_t *ft) { fprintf(f, "\t\tFetch(A6): %p -> { nh %p, entry %p, fetch %p }\n", ft, ft->namehook, ft->entry, ft->fetch); } static void -print_fetch_list(FILE *f, dns_adbname_t *n) -{ +print_fetch_list(FILE *f, dns_adbname_t *n) { dns_adbfetch6_t *fetch6; if (NAME_FETCH_A(n)) @@ -3115,8 +3050,7 @@ print_fetch_list(FILE *f, dns_adbname_t *n) } static void -print_find_list(FILE *f, dns_adbname_t *name) -{ +print_find_list(FILE *f, dns_adbname_t *name) { dns_adbfind_t *find; find = ISC_LIST_HEAD(name->finds); @@ -3127,8 +3061,7 @@ print_find_list(FILE *f, dns_adbname_t *name) } static isc_result_t -dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, - dns_rdatatype_t rdtype) +dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype) { isc_result_t result; dns_rdataset_t rdataset; @@ -3231,8 +3164,7 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, } static isc_result_t -dbfind_a6(dns_adbname_t *adbname, isc_stdtime_t now) -{ +dbfind_a6(dns_adbname_t *adbname, isc_stdtime_t now) { isc_result_t result; dns_rdataset_t rdataset; dns_adb_t *adb; @@ -3320,8 +3252,7 @@ dbfind_a6(dns_adbname_t *adbname, isc_stdtime_t now) } static void -fetch_callback(isc_task_t *task, isc_event_t *ev) -{ +fetch_callback(isc_task_t *task, isc_event_t *ev) { dns_fetchevent_t *dev; dns_adbname_t *name; dns_adb_t *adb; @@ -3480,8 +3411,7 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) } static void -fetch_callback_a6(isc_task_t *task, isc_event_t *ev) -{ +fetch_callback_a6(isc_task_t *task, isc_event_t *ev) { dns_fetchevent_t *dev; dns_adbname_t *name; dns_adb_t *adb; @@ -3673,8 +3603,7 @@ fetch_callback_a6(isc_task_t *task, isc_event_t *ev) } static isc_result_t -fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_root) -{ +fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_root) { isc_result_t result; dns_adbfetch_t *fetch; dns_adb_t *adb; @@ -3731,8 +3660,7 @@ fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_root) } static isc_result_t -fetch_name_aaaa(dns_adbname_t *adbname) -{ +fetch_name_aaaa(dns_adbname_t *adbname) { isc_result_t result; dns_adbfetch_t *fetch; dns_adb_t *adb; @@ -3769,8 +3697,7 @@ fetch_name_aaaa(dns_adbname_t *adbname) } static isc_result_t -fetch_name_a6(dns_adbname_t *adbname, isc_boolean_t start_at_root) -{ +fetch_name_a6(dns_adbname_t *adbname, isc_boolean_t start_at_root) { isc_result_t result; dns_adbfetch6_t *fetch; dns_adb_t *adb; @@ -4011,8 +3938,7 @@ dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa, } void -dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) -{ +dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) { dns_adbaddrinfo_t *addr; dns_adbentry_t *entry; int bucket; diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c index 1df6a15674..884dc4243e 100644 --- a/lib/dns/byaddr.c +++ b/lib/dns/byaddr.c @@ -17,23 +17,14 @@ #include -#include -#include - -#include -#include -#include -#include #include -#include +#include #include #include #include #include #include -#include -#include #include #include #include diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 853be219e6..82798f5fd5 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -15,14 +15,14 @@ * SOFTWARE. */ -/* $Id: cache.c,v 1.20 2000/05/02 03:53:51 tale Exp $ */ +/* $Id: cache.c,v 1.21 2000/05/08 14:34:26 tale Exp $ */ #include -#include - -#include +#include +#include #include +#include #include #include @@ -30,12 +30,10 @@ #include #include #include -#include #include -#include -#define CACHE_MAGIC 0x24242424U /* $$$$. */ -#define VALID_CACHE(cache) ((cache) != NULL && (cache)->magic == CACHE_MAGIC) +#define CACHE_MAGIC 0x24242424U /* $$$$. */ +#define VALID_CACHE(cache) ISC_MAGIC_VALID(cache, CACHE_MAGIC) /*** *** Types @@ -53,7 +51,9 @@ typedef enum { cleaner_s_busy /* Currently cleaning. */ } cleaner_state_t; -/* Convenience macros for comprehensive assertion checking. */ +/* + * Convenience macros for comprehensive assertion checking. + */ #define CLEANER_IDLE(c) ((c)->state == cleaner_s_idle && \ (c)->iterator == NULL && \ (c)->resched_event != NULL) @@ -260,9 +260,9 @@ dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp) { #ifdef NOTYET +/* ARGSUSED */ isc_result_t -dns_cache_setfilename(dns_cache_t *cahce, char *filename) /* ARGSUSED */ -{ +dns_cache_setfilename(dns_cache_t *cahce, char *filename) { char *newname = isc_mem_strdup(filename); if (newname == NULL) return (ISC_R_NOMEMORY); @@ -299,12 +299,14 @@ dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) { LOCK(&cache->lock); cache->cleaner.cleaning_interval = t; if (t == 0) { - isc_timer_reset(cache->cleaner.cleaning_timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + isc_timer_reset(cache->cleaner.cleaning_timer, + isc_timertype_inactive, NULL, NULL, ISC_TRUE); } else { isc_interval_t interval; - isc_interval_set(&interval, cache->cleaner.cleaning_interval, 0); - isc_timer_reset(cache->cleaner.cleaning_timer, isc_timertype_ticker, + isc_interval_set(&interval, cache->cleaner.cleaning_interval, + 0); + isc_timer_reset(cache->cleaner.cleaning_timer, + isc_timertype_ticker, NULL, &interval, ISC_FALSE); } UNLOCK(&cache->lock); diff --git a/lib/dns/callbacks.c b/lib/dns/callbacks.c index 8f5483d5b4..737580a382 100644 --- a/lib/dns/callbacks.c +++ b/lib/dns/callbacks.c @@ -15,13 +15,10 @@ * SOFTWARE. */ -/* $Id: callbacks.c,v 1.6 2000/03/17 17:49:37 gson Exp $ */ +/* $Id: callbacks.c,v 1.7 2000/05/08 14:34:27 tale Exp $ */ #include -#include - -#include #include #include @@ -73,9 +70,7 @@ isclog_warn_callback(dns_rdatacallbacks_t *callbacks, char *fmt, ...) { } static void -dns_rdatacallbacks_initcommon(dns_rdatacallbacks_t *callbacks) - -{ +dns_rdatacallbacks_initcommon(dns_rdatacallbacks_t *callbacks) { REQUIRE(callbacks != NULL); callbacks->add = NULL; diff --git a/lib/dns/compress.c b/lib/dns/compress.c index 896f71fb98..f74714a2d2 100644 --- a/lib/dns/compress.c +++ b/lib/dns/compress.c @@ -15,16 +15,14 @@ * SOFTWARE. */ -/* $Id: compress.c,v 1.32 2000/05/04 22:36:24 gson Exp $ */ +/* $Id: compress.c,v 1.33 2000/05/08 14:34:28 tale Exp $ */ #define DNS_NAME_USEINLINE 1 #include -#include -#include -#include -#include +#include +#include #include #include @@ -33,10 +31,10 @@ #include #define CCTX_MAGIC 0x43435458U /* CCTX */ -#define VALID_CCTX(x) ((x) != NULL && (x)->magic == CCTX_MAGIC) +#define VALID_CCTX(x) ISC_MAGIC_VALID(x, CCTX_MAGIC) #define DCTX_MAGIC 0x44435458U /* DCTX */ -#define VALID_DCTX(x) ((x) != NULL && (x)->magic == DCTX_MAGIC) +#define VALID_DCTX(x) ISC_MAGIC_VALID(x, DCTX_MAGIC) static void free_offset(void *offset, void *mctx); diff --git a/lib/dns/config/confacl.c b/lib/dns/config/confacl.c index 43a1930b93..80531dfb6b 100644 --- a/lib/dns/config/confacl.c +++ b/lib/dns/config/confacl.c @@ -15,28 +15,21 @@ * SOFTWARE. */ -/* $Id: confacl.c,v 1.15 2000/04/28 01:10:25 halley Exp $ */ +/* $Id: confacl.c,v 1.16 2000/05/08 14:35:22 tale Exp $ */ #include -#include - -#include -#include +#include #include #include #include -#include - - -static isc_result_t acl_delete(dns_c_acl_t **aclptr); - +static isc_result_t +acl_delete(dns_c_acl_t **aclptr); isc_result_t -dns_c_acltable_new(isc_mem_t *mem, dns_c_acltable_t **newtable) -{ +dns_c_acltable_new(isc_mem_t *mem, dns_c_acltable_t **newtable) { dns_c_acltable_t *table; REQUIRE(mem != NULL); @@ -60,10 +53,8 @@ dns_c_acltable_new(isc_mem_t *mem, dns_c_acltable_t **newtable) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_acltable_delete(dns_c_acltable_t **table) -{ +dns_c_acltable_delete(dns_c_acltable_t **table) { dns_c_acltable_t *acltable; isc_mem_t *mem; @@ -87,10 +78,8 @@ dns_c_acltable_delete(dns_c_acltable_t **table) return (ISC_R_SUCCESS); } - void -dns_c_acltable_print(FILE *fp, int indent, dns_c_acltable_t *table) -{ +dns_c_acltable_print(FILE *fp, int indent, dns_c_acltable_t *table) { dns_c_acl_t *acl; dns_c_acl_t *acltmp; @@ -116,10 +105,8 @@ dns_c_acltable_print(FILE *fp, int indent, dns_c_acltable_t *table) } } - isc_result_t -dns_c_acltable_clear(dns_c_acltable_t *table) -{ +dns_c_acltable_clear(dns_c_acltable_t *table) { dns_c_acl_t *elem; dns_c_acl_t *tmpelem; isc_result_t r; @@ -177,8 +164,7 @@ dns_c_acltable_getacl(dns_c_acltable_t *table, isc_result_t -dns_c_acltable_removeacl(dns_c_acltable_t *table, const char *aclname) -{ +dns_c_acltable_removeacl(dns_c_acltable_t *table, const char *aclname) { dns_c_acl_t *acl; dns_c_acl_t *tmpacl; @@ -244,8 +230,7 @@ dns_c_acl_new(dns_c_acltable_t *table, const char *aclname, void -dns_c_acl_print(FILE *fp, int indent, dns_c_acl_t *acl) -{ +dns_c_acl_print(FILE *fp, int indent, dns_c_acl_t *acl) { REQUIRE(DNS_C_CONFACL_VALID(acl)); dns_c_printtabs(fp, indent); @@ -323,9 +308,7 @@ dns_c_acl_getipmlexpanded(isc_mem_t *mem, dns_c_acl_t *acl, /* XXX this should really be a function in the confip module */ isc_result_t -dns_c_acl_expandacls(dns_c_acltable_t *table, - dns_c_ipmatchlist_t *list) -{ +dns_c_acl_expandacls(dns_c_acltable_t *table, dns_c_ipmatchlist_t *list) { dns_c_ipmatchelement_t *elem; dns_c_ipmatchelement_t *tmpelem; dns_c_acl_t *acl; @@ -380,12 +363,8 @@ dns_c_acl_expandacls(dns_c_acltable_t *table, return (ISC_R_SUCCESS); } - - - static isc_result_t -acl_delete(dns_c_acl_t **aclptr) -{ +acl_delete(dns_c_acl_t **aclptr) { dns_c_acl_t *acl; isc_result_t res; isc_mem_t *mem; diff --git a/lib/dns/config/confcommon.c b/lib/dns/config/confcommon.c index a878135262..1996252e5f 100644 --- a/lib/dns/config/confcommon.c +++ b/lib/dns/config/confcommon.c @@ -15,34 +15,24 @@ * SOFTWARE. */ -/* $Id: confcommon.c,v 1.25 2000/04/28 01:15:50 explorer Exp $ */ +/* $Id: confcommon.c,v 1.26 2000/05/08 14:35:23 tale Exp $ */ #include -#include /* XXXRTH */ - -#include -#include /* XXXRTH */ #include -#include +#include /* XXXRTH */ -#include #include -#include +#include +#include #include +#include #include #include - -/* XXX this next include is needed by */ -#include -#include #include #include #include -#include - - /*** *** TYPES @@ -217,8 +207,7 @@ dns_c_datatype_tostream(FILE *fp, dns_rdatatype_t rtype) { void -dns_c_printtabs(FILE *fp, int count) -{ +dns_c_printtabs(FILE *fp, int count) { while (count > 0) { fputc('\t', fp); @@ -229,8 +218,7 @@ dns_c_printtabs(FILE *fp, int count) isc_result_t -dns_c_string2ordering(char *name, dns_c_ordering_t *ordering) -{ +dns_c_string2ordering(char *name, dns_c_ordering_t *ordering) { unsigned int i; isc_result_t rval = ISC_R_FAILURE; @@ -347,8 +335,7 @@ dns_c_string2category(const char *string, const char * -dns_c_facility2string(int facility, isc_boolean_t printable) -{ +dns_c_facility2string(int facility, isc_boolean_t printable) { int i; const char *rval = NULL; @@ -364,8 +351,7 @@ dns_c_facility2string(int facility, isc_boolean_t printable) isc_result_t -dns_c_string2facility(const char *string, int *result) -{ +dns_c_string2facility(const char *string, int *result) { int i; isc_result_t rval = ISC_R_FAILURE; @@ -481,8 +467,7 @@ dns_c_forward2string(dns_c_forw_t forw, int -dns_c_isanyaddr(isc_sockaddr_t *inaddr) -{ +dns_c_isanyaddr(isc_sockaddr_t *inaddr) { int result = 0; if (inaddr->type.sa.sa_family == AF_INET) { @@ -502,8 +487,7 @@ dns_c_isanyaddr(isc_sockaddr_t *inaddr) void -dns_c_print_ipaddr(FILE *fp, isc_sockaddr_t *inaddr) -{ +dns_c_print_ipaddr(FILE *fp, isc_sockaddr_t *inaddr) { const char *p; char tmpaddrstr[64]; int family = inaddr->type.sa.sa_family; @@ -531,8 +515,7 @@ dns_c_print_ipaddr(FILE *fp, isc_sockaddr_t *inaddr) isc_boolean_t -dns_c_netaddrisanyaddr(isc_netaddr_t *inaddr) -{ +dns_c_netaddrisanyaddr(isc_netaddr_t *inaddr) { isc_boolean_t result = ISC_FALSE; if (inaddr->family == AF_INET) { @@ -553,8 +536,7 @@ dns_c_netaddrisanyaddr(isc_netaddr_t *inaddr) void -dns_c_netaddrprint(FILE *fp, isc_netaddr_t *inaddr) -{ +dns_c_netaddrprint(FILE *fp, isc_netaddr_t *inaddr) { const char *p; char tmpaddrstr[64]; int family = inaddr->family; @@ -583,8 +565,7 @@ dns_c_netaddrprint(FILE *fp, isc_netaddr_t *inaddr) isc_boolean_t -dns_c_need_quote(const char *string) -{ +dns_c_need_quote(const char *string) { isc_boolean_t rval = ISC_FALSE; while (string != NULL && *string != '\0') { @@ -623,8 +604,7 @@ dns_c_peerlist_print(FILE *fp, int indent, void -dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer) -{ +dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer) { isc_boolean_t bval; isc_result_t res; dns_transfer_format_t tval; @@ -687,8 +667,7 @@ dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer) isc_result_t -dns_c_charptoname(isc_mem_t *mem, const char *keyval, dns_name_t **name) -{ +dns_c_charptoname(isc_mem_t *mem, const char *keyval, dns_name_t **name) { dns_name_t newkey; isc_buffer_t *b1 = NULL; isc_buffer_t b2; @@ -727,8 +706,7 @@ dns_c_charptoname(isc_mem_t *mem, const char *keyval, dns_name_t **name) } void -dns_c_ssutable_print(FILE *fp, int indent, dns_ssutable_t *ssutable) -{ +dns_c_ssutable_print(FILE *fp, int indent, dns_ssutable_t *ssutable) { dns_ssurule_t *rule = NULL; dns_ssurule_t *tmprule = NULL; isc_result_t res; @@ -799,15 +777,14 @@ dns_c_ssutable_print(FILE *fp, int indent, dns_ssutable_t *ssutable) isc_result_t -dns_c_checkcategory(const char *name) -{ +dns_c_checkcategory(const char *name) { unsigned int i; REQUIRE (name != NULL); REQUIRE(*name != '\0'); /* - * this function isn't called very often, so no need for fancy + * This function isn't called very often, so no need for fancy * searches. */ for (i = 0 ; category_nametable[i] != NULL ; i++) { diff --git a/lib/dns/config/confctl.c b/lib/dns/config/confctl.c index 389374362c..81a8bf666d 100644 --- a/lib/dns/config/confctl.c +++ b/lib/dns/config/confctl.c @@ -15,24 +15,17 @@ * SOFTWARE. */ -/* $Id: confctl.c,v 1.18 2000/04/28 01:10:28 halley Exp $ */ +/* $Id: confctl.c,v 1.19 2000/05/08 14:35:24 tale Exp $ */ #include -#include - -#include -#include -#include +#include #include #include -#include - isc_result_t -dns_c_ctrllist_new(isc_mem_t *mem, dns_c_ctrllist_t **newlist) -{ +dns_c_ctrllist_new(isc_mem_t *mem, dns_c_ctrllist_t **newlist) { dns_c_ctrllist_t *newl; REQUIRE(mem != NULL); @@ -53,12 +46,9 @@ dns_c_ctrllist_new(isc_mem_t *mem, dns_c_ctrllist_t **newlist) return (ISC_R_SUCCESS); } - - void -dns_c_ctrllist_print(FILE *fp, int indent, dns_c_ctrllist_t *cl) -{ +dns_c_ctrllist_print(FILE *fp, int indent, dns_c_ctrllist_t *cl) { dns_c_ctrl_t *ctl; if (cl == NULL) { @@ -82,11 +72,8 @@ dns_c_ctrllist_print(FILE *fp, int indent, dns_c_ctrllist_t *cl) fprintf(fp, "};\n"); } - - isc_result_t -dns_c_ctrllist_delete(dns_c_ctrllist_t **list) -{ +dns_c_ctrllist_delete(dns_c_ctrllist_t **list) { dns_c_ctrl_t *ctrl; dns_c_ctrl_t *tmpctrl; dns_c_ctrllist_t *clist; @@ -113,7 +100,6 @@ dns_c_ctrllist_delete(dns_c_ctrllist_t **list) return (ISC_R_SUCCESS); } - isc_result_t dns_c_ctrlinet_new(isc_mem_t *mem, dns_c_ctrl_t **control, isc_sockaddr_t addr, in_port_t port, @@ -152,7 +138,6 @@ dns_c_ctrlinet_new(isc_mem_t *mem, dns_c_ctrl_t **control, return (ISC_R_SUCCESS); } - isc_result_t dns_c_ctrlunix_new(isc_mem_t *mem, dns_c_ctrl_t **control, const char *path, int perm, uid_t uid, gid_t gid) @@ -186,10 +171,8 @@ dns_c_ctrlunix_new(isc_mem_t *mem, dns_c_ctrl_t **control, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_ctrl_delete(dns_c_ctrl_t **control) -{ +dns_c_ctrl_delete(dns_c_ctrl_t **control) { isc_result_t res = ISC_R_SUCCESS; isc_result_t rval; isc_mem_t *mem; @@ -207,7 +190,8 @@ dns_c_ctrl_delete(dns_c_ctrl_t **control) switch (ctrl->control_type) { case dns_c_inet_control: if (ctrl->u.inet_v.matchlist != NULL) - res = dns_c_ipmatchlist_detach(&ctrl->u.inet_v.matchlist); + res = dns_c_ipmatchlist_detach(&ctrl-> + u.inet_v.matchlist); else res = ISC_R_SUCCESS; break; @@ -229,10 +213,8 @@ dns_c_ctrl_delete(dns_c_ctrl_t **control) return (res); } - void -dns_c_ctrl_print(FILE *fp, int indent, dns_c_ctrl_t *ctl) -{ +dns_c_ctrl_print(FILE *fp, int indent, dns_c_ctrl_t *ctl) { in_port_t port; dns_c_ipmatchlist_t *iml; diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c index 83adf44007..66f35da7f8 100644 --- a/lib/dns/config/confctx.c +++ b/lib/dns/config/confctx.c @@ -15,21 +15,16 @@ * SOFTWARE. */ -/* $Id: confctx.c,v 1.54 2000/05/03 19:29:35 brister Exp $ */ +/* $Id: confctx.c,v 1.55 2000/05/08 14:35:26 tale Exp $ */ #include -#include /* XXXRTH */ -#include - -#include -#include -#include +#include #include #include -#include #include +#include #include "confpvt.h" diff --git a/lib/dns/config/confip.c b/lib/dns/config/confip.c index 55428a8455..e2fa05b5a5 100644 --- a/lib/dns/config/confip.c +++ b/lib/dns/config/confip.c @@ -15,22 +15,21 @@ * SOFTWARE. */ -/* $Id: confip.c,v 1.23 2000/05/03 19:29:37 brister Exp $ */ +/* $Id: confip.c,v 1.24 2000/05/08 14:35:27 tale Exp $ */ #include -#include -#include -#include -#include +#include +#include #include #include -#include #include -/* Flag for dns_c_ipmatch_element */ +/* + * Flag for dns_c_ipmatch_element. + */ #define DNS_C_IPMATCH_NEGATE 0x01 /* match means deny access */ @@ -38,8 +37,7 @@ static isc_result_t checkmask(isc_sockaddr_t *address, isc_uint32_t bits); static isc_result_t bits2v6mask(struct in6_addr *addr, isc_uint32_t bits); isc_result_t -dns_c_ipmatchelement_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) -{ +dns_c_ipmatchelement_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) { dns_c_ipmatchelement_t *ime ; REQUIRE(result != NULL); @@ -63,10 +61,8 @@ dns_c_ipmatchelement_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) return (ISC_R_SUCCESS); } - isc_boolean_t -dns_c_ipmatchelement_isneg(dns_c_ipmatchelement_t *elem) -{ +dns_c_ipmatchelement_isneg(dns_c_ipmatchelement_t *elem) { REQUIRE(DNS_C_IPMELEM_VALID(elem)); @@ -74,10 +70,8 @@ dns_c_ipmatchelement_isneg(dns_c_ipmatchelement_t *elem) DNS_C_IPMATCH_NEGATE)); } - isc_result_t -dns_c_ipmatchelement_delete(isc_mem_t *mem, dns_c_ipmatchelement_t **ipme) -{ +dns_c_ipmatchelement_delete(isc_mem_t *mem, dns_c_ipmatchelement_t **ipme) { dns_c_ipmatchelement_t *elem; REQUIRE(mem != NULL); @@ -134,7 +128,6 @@ dns_c_ipmatchelement_delete(isc_mem_t *mem, dns_c_ipmatchelement_t **ipme) return (ISC_R_SUCCESS); } - isc_result_t dns_c_ipmatchelement_copy(isc_mem_t *mem, dns_c_ipmatchelement_t **dest, @@ -196,8 +189,6 @@ dns_c_ipmatchelement_copy(isc_mem_t *mem, return (ISC_R_SUCCESS); } - - isc_boolean_t dns_c_ipmatchelement_equal(dns_c_ipmatchelement_t *e1, dns_c_ipmatchelement_t *e2) @@ -241,8 +232,7 @@ dns_c_ipmatchelement_equal(dns_c_ipmatchelement_t *e1, } isc_result_t -dns_c_ipmatchlocalhost_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) -{ +dns_c_ipmatchlocalhost_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) { dns_c_ipmatchelement_t *ime = NULL; isc_result_t res; @@ -261,11 +251,8 @@ dns_c_ipmatchlocalhost_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) return (res); } - isc_result_t -dns_c_ipmatchlocalnets_new(isc_mem_t *mem, - dns_c_ipmatchelement_t **result) -{ +dns_c_ipmatchlocalnets_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) { dns_c_ipmatchelement_t *ime = NULL; isc_result_t res; @@ -284,10 +271,8 @@ dns_c_ipmatchlocalnets_new(isc_mem_t *mem, return (res); } - isc_result_t -dns_c_ipmatchany_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) -{ +dns_c_ipmatchany_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) { dns_c_ipmatchelement_t *ime = NULL; isc_result_t res; @@ -306,7 +291,6 @@ dns_c_ipmatchany_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result) return (res); } - isc_result_t dns_c_ipmatchindirect_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result, @@ -349,7 +333,6 @@ dns_c_ipmatchindirect_new(isc_mem_t *mem, return (res); } - isc_result_t dns_c_ipmatchpattern_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result, @@ -384,7 +367,6 @@ dns_c_ipmatchpattern_new(isc_mem_t *mem, return (ISC_R_SUCCESS); } - isc_result_t dns_c_ipmatchkey_new(isc_mem_t *mem, dns_c_ipmatchelement_t **result, @@ -412,7 +394,6 @@ dns_c_ipmatchkey_new(isc_mem_t *mem, return (ISC_R_SUCCESS); } - isc_result_t dns_c_ipmatch_aclnew(isc_mem_t *mem, dns_c_ipmatchelement_t **result, @@ -441,10 +422,8 @@ dns_c_ipmatch_aclnew(isc_mem_t *mem, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_ipmatch_negate(dns_c_ipmatchelement_t *ipe) -{ +dns_c_ipmatch_negate(dns_c_ipmatchelement_t *ipe) { REQUIRE(DNS_C_IPMELEM_VALID(ipe)); if ((ipe->flags & DNS_C_IPMATCH_NEGATE) == DNS_C_IPMATCH_NEGATE) { @@ -456,10 +435,8 @@ dns_c_ipmatch_negate(dns_c_ipmatchelement_t *ipe) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_ipmatchlist_new(isc_mem_t *mem, dns_c_ipmatchlist_t **ptr) -{ +dns_c_ipmatchlist_new(isc_mem_t *mem, dns_c_ipmatchlist_t **ptr) { dns_c_ipmatchlist_t *newlist; REQUIRE(ptr != NULL); @@ -481,10 +458,8 @@ dns_c_ipmatchlist_new(isc_mem_t *mem, dns_c_ipmatchlist_t **ptr) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_ipmatchlist_detach(dns_c_ipmatchlist_t **ml) -{ +dns_c_ipmatchlist_detach(dns_c_ipmatchlist_t **ml) { dns_c_ipmatchelement_t *ime; dns_c_ipmatchelement_t *iptr; dns_c_ipmatchlist_t *iml; @@ -520,7 +495,6 @@ dns_c_ipmatchlist_detach(dns_c_ipmatchlist_t **ml) return (ISC_R_SUCCESS); } - void dns_c_ipmatchlist_attach(dns_c_ipmatchlist_t *source, dns_c_ipmatchlist_t **target) @@ -534,10 +508,8 @@ dns_c_ipmatchlist_attach(dns_c_ipmatchlist_t *source, *target = source; } - isc_result_t -dns_c_ipmatchlist_empty(dns_c_ipmatchlist_t *ipml) -{ +dns_c_ipmatchlist_empty(dns_c_ipmatchlist_t *ipml) { dns_c_ipmatchelement_t *ime ; dns_c_ipmatchelement_t *imptmp; isc_result_t res = ISC_R_SUCCESS; @@ -557,7 +529,6 @@ dns_c_ipmatchlist_empty(dns_c_ipmatchlist_t *ipml) return (res); } - isc_result_t dns_c_ipmatchlist_copy(isc_mem_t *mem, dns_c_ipmatchlist_t **dest, dns_c_ipmatchlist_t *src) @@ -622,7 +593,6 @@ dns_c_ipmatchlist_equal(dns_c_ipmatchlist_t *l1, dns_c_ipmatchlist_t *l2) { return (ISC_TRUE); } - isc_result_t dns_c_ipmatchlist_append(dns_c_ipmatchlist_t *dest, dns_c_ipmatchlist_t *src, @@ -656,10 +626,8 @@ dns_c_ipmatchlist_append(dns_c_ipmatchlist_t *dest, return (result); } - isc_result_t -dns_c_ipmatchelement_print(FILE *fp, int indent, - dns_c_ipmatchelement_t *ipme) +dns_c_ipmatchelement_print(FILE *fp, int indent, dns_c_ipmatchelement_t *ipme) { int bits; @@ -732,10 +700,8 @@ dns_c_ipmatchelement_print(FILE *fp, int indent, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_ipmatchlist_print(FILE *fp, int indent, dns_c_ipmatchlist_t *ml) -{ +dns_c_ipmatchlist_print(FILE *fp, int indent, dns_c_ipmatchlist_t *ml) { dns_c_ipmatchelement_t *ipme ; REQUIRE(DNS_C_IPMLIST_VALID(ml)); @@ -764,10 +730,8 @@ dns_c_ipmatchlist_print(FILE *fp, int indent, dns_c_ipmatchlist_t *ml) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) -{ +dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) { dns_c_iplist_t *list; size_t bytes; @@ -800,10 +764,8 @@ dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_iplist_detach(dns_c_iplist_t **list) -{ +dns_c_iplist_detach(dns_c_iplist_t **list) { dns_c_iplist_t *l ; REQUIRE(list != NULL); @@ -826,11 +788,8 @@ dns_c_iplist_detach(dns_c_iplist_t **list) return (ISC_R_SUCCESS); } - void -dns_c_iplist_attach(dns_c_iplist_t *source, - dns_c_iplist_t **target) -{ +dns_c_iplist_attach(dns_c_iplist_t *source, dns_c_iplist_t **target) { REQUIRE(DNS_C_IPLIST_VALID(source)); INSIST(source->refcount > 0); @@ -838,11 +797,8 @@ dns_c_iplist_attach(dns_c_iplist_t *source, *target = source; } - - isc_result_t -dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest, dns_c_iplist_t *src) -{ +dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest, dns_c_iplist_t *src) { dns_c_iplist_t *newl; isc_result_t res; isc_uint32_t i; @@ -883,7 +839,6 @@ dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2) { return (ISC_TRUE); } - void dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo, dns_c_iplist_t *list) @@ -937,17 +892,13 @@ dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo, fputc('\n', fp); } - void -dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list) -{ +dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list) { dns_c_iplist_printfully(fp, indent, ISC_FALSE, list); } - isc_result_t -dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) -{ +dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) { isc_uint32_t i; REQUIRE(DNS_C_IPLIST_VALID(list)); @@ -988,10 +939,8 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr) -{ +dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr) { isc_uint32_t i; REQUIRE(DNS_C_IPLIST_VALID(list)); @@ -1014,16 +963,12 @@ dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr) return (ISC_R_SUCCESS); } - - - /* * Check that the address given is a network address with the given number * of high order bits. */ static isc_result_t -checkmask(isc_sockaddr_t *address, isc_uint32_t bits) -{ +checkmask(isc_sockaddr_t *address, isc_uint32_t bits) { if (bits > 0) { if (address->type.sa.sa_family == AF_INET) { isc_uint32_t mask; @@ -1065,16 +1010,13 @@ checkmask(isc_sockaddr_t *address, isc_uint32_t bits) return (ISC_R_SUCCESS); } - - /* * Create a 128 bits mask in network byte order in the the IPv6 address * section of the sockaddr. The bits argument is the number of high bits * that are to be set to 1. */ static isc_result_t -bits2v6mask(struct in6_addr *addr, isc_uint32_t bits) -{ +bits2v6mask(struct in6_addr *addr, isc_uint32_t bits) { int i; isc_uint32_t bitmask[4]; char addrbuff [ sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" + 1 ]; diff --git a/lib/dns/config/confkeys.c b/lib/dns/config/confkeys.c index 1b488cb2fb..c7eb9c4fa5 100644 --- a/lib/dns/config/confkeys.c +++ b/lib/dns/config/confkeys.c @@ -15,18 +15,13 @@ * SOFTWARE. */ -/* $Id: confkeys.c,v 1.20 2000/04/28 01:10:31 halley Exp $ */ +/* $Id: confkeys.c,v 1.21 2000/05/08 14:35:28 tale Exp $ */ #include -#include - -#include -#include #include #include -#include #include #include diff --git a/lib/dns/config/conflog.c b/lib/dns/config/conflog.c index 7f719dd001..bd16cae2c6 100644 --- a/lib/dns/config/conflog.c +++ b/lib/dns/config/conflog.c @@ -15,21 +15,17 @@ * SOFTWARE. */ -/* $Id: conflog.c,v 1.13 2000/04/28 01:10:32 halley Exp $ */ +/* $Id: conflog.c,v 1.14 2000/05/08 14:35:29 tale Exp $ */ #include -#include - -#include -#include +#include +#include #include #include -#include #include - #include "confpvt.h" @@ -47,20 +43,17 @@ #define CHAN_PTIME_BIT 6 #define CHAN_FACILITY_BIT 7 +static void +print_log_facility(FILE *fp, int value); +static void +print_log_severity(FILE *fp, dns_c_logseverity_t severity); -static void print_log_facility(FILE *fp, - int value); -static void print_log_severity(FILE *fp, - dns_c_logseverity_t severity); -static isc_boolean_t logginglist_empty(dns_c_logginglist_t *ll); - - +static isc_boolean_t +logginglist_empty(dns_c_logginglist_t *ll); isc_result_t -dns_c_logginglist_new(isc_mem_t *mem, - dns_c_logginglist_t **list) -{ +dns_c_logginglist_new(isc_mem_t *mem, dns_c_logginglist_t **list) { dns_c_logginglist_t *newl; REQUIRE(list != NULL); @@ -82,8 +75,7 @@ dns_c_logginglist_new(isc_mem_t *mem, isc_result_t -dns_c_logginglist_delete(dns_c_logginglist_t **list) -{ +dns_c_logginglist_delete(dns_c_logginglist_t **list) { dns_c_logginglist_t *l; dns_c_logchan_t *chan, *tmpchan; dns_c_logcat_t *cat, *tmpcat; @@ -175,8 +167,7 @@ dns_c_logginglist_copy(isc_mem_t *mem, static isc_boolean_t -logginglist_empty(dns_c_logginglist_t *ll) -{ +logginglist_empty(dns_c_logginglist_t *ll) { dns_c_logchan_t *logchan; dns_c_logcat_t *logcat; @@ -532,8 +523,7 @@ dns_c_logchan_new(isc_mem_t *mem, const char *name, isc_result_t -dns_c_logchan_delete(dns_c_logchan_t **channel) -{ +dns_c_logchan_delete(dns_c_logchan_t **channel) { dns_c_logchan_t *logc; REQUIRE(channel != NULL); @@ -689,8 +679,7 @@ dns_c_logchan_print(FILE *fp, int indent, dns_c_logchan_t *logchan, isc_result_t -dns_c_logchan_setpath(dns_c_logchan_t *channel, const char *path) -{ +dns_c_logchan_setpath(dns_c_logchan_t *channel, const char *path) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -720,8 +709,7 @@ dns_c_logchan_setpath(dns_c_logchan_t *channel, const char *path) isc_result_t -dns_c_logchan_setversions(dns_c_logchan_t *channel, isc_uint32_t versions) -{ +dns_c_logchan_setversions(dns_c_logchan_t *channel, isc_uint32_t versions) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -744,8 +732,7 @@ dns_c_logchan_setversions(dns_c_logchan_t *channel, isc_uint32_t versions) isc_result_t -dns_c_logchan_setsize(dns_c_logchan_t *channel, isc_uint32_t size) -{ +dns_c_logchan_setsize(dns_c_logchan_t *channel, isc_uint32_t size) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -768,8 +755,7 @@ dns_c_logchan_setsize(dns_c_logchan_t *channel, isc_uint32_t size) isc_result_t -dns_c_logchan_setfacility(dns_c_logchan_t *channel, int facility) -{ +dns_c_logchan_setfacility(dns_c_logchan_t *channel, int facility) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -819,8 +805,7 @@ dns_c_logchan_setseverity(dns_c_logchan_t *channel, isc_result_t -dns_c_logchan_setdebuglevel(dns_c_logchan_t *channel, isc_int32_t level) -{ +dns_c_logchan_setdebuglevel(dns_c_logchan_t *channel, isc_int32_t level) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -840,8 +825,7 @@ dns_c_logchan_setdebuglevel(dns_c_logchan_t *channel, isc_int32_t level) isc_result_t -dns_c_logchan_setprintcat(dns_c_logchan_t *channel, isc_boolean_t newval) -{ +dns_c_logchan_setprintcat(dns_c_logchan_t *channel, isc_boolean_t newval) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -856,8 +840,7 @@ dns_c_logchan_setprintcat(dns_c_logchan_t *channel, isc_boolean_t newval) isc_result_t -dns_c_logchan_setprintsev(dns_c_logchan_t *channel, isc_boolean_t newval) -{ +dns_c_logchan_setprintsev(dns_c_logchan_t *channel, isc_boolean_t newval) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -872,8 +855,7 @@ dns_c_logchan_setprintsev(dns_c_logchan_t *channel, isc_boolean_t newval) isc_result_t -dns_c_logchan_setprinttime(dns_c_logchan_t *channel, isc_boolean_t newval) -{ +dns_c_logchan_setprinttime(dns_c_logchan_t *channel, isc_boolean_t newval) { isc_boolean_t existed; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -887,8 +869,7 @@ dns_c_logchan_setprinttime(dns_c_logchan_t *channel, isc_boolean_t newval) } isc_result_t -dns_c_logchan_setpredef(dns_c_logchan_t *channel, isc_boolean_t newval) -{ +dns_c_logchan_setpredef(dns_c_logchan_t *channel, isc_boolean_t newval) { REQUIRE(DNS_C_LOGCHAN_VALID(channel)); channel->predefined = newval; @@ -901,8 +882,7 @@ dns_c_logchan_setpredef(dns_c_logchan_t *channel, isc_boolean_t newval) isc_result_t -dns_c_logchan_getpath(dns_c_logchan_t *channel, const char **path) -{ +dns_c_logchan_getpath(dns_c_logchan_t *channel, const char **path) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -923,8 +903,7 @@ dns_c_logchan_getpath(dns_c_logchan_t *channel, const char **path) isc_result_t -dns_c_logchan_getversions(dns_c_logchan_t *channel, isc_uint32_t *retval) -{ +dns_c_logchan_getversions(dns_c_logchan_t *channel, isc_uint32_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -945,8 +924,7 @@ dns_c_logchan_getversions(dns_c_logchan_t *channel, isc_uint32_t *retval) isc_result_t -dns_c_logchan_getsize(dns_c_logchan_t *channel, isc_uint32_t *retval) -{ +dns_c_logchan_getsize(dns_c_logchan_t *channel, isc_uint32_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -967,8 +945,7 @@ dns_c_logchan_getsize(dns_c_logchan_t *channel, isc_uint32_t *retval) isc_result_t -dns_c_logchan_getfacility(dns_c_logchan_t *channel, int *retval) -{ +dns_c_logchan_getfacility(dns_c_logchan_t *channel, int *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -1010,8 +987,7 @@ dns_c_logchan_getseverity(dns_c_logchan_t *channel, isc_result_t -dns_c_logchan_getdebuglevel(dns_c_logchan_t *channel, isc_int32_t *retval) -{ +dns_c_logchan_getdebuglevel(dns_c_logchan_t *channel, isc_int32_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -1029,8 +1005,7 @@ dns_c_logchan_getdebuglevel(dns_c_logchan_t *channel, isc_int32_t *retval) isc_result_t -dns_c_logchan_getprintcat(dns_c_logchan_t *channel, isc_boolean_t *retval) -{ +dns_c_logchan_getprintcat(dns_c_logchan_t *channel, isc_boolean_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -1048,8 +1023,7 @@ dns_c_logchan_getprintcat(dns_c_logchan_t *channel, isc_boolean_t *retval) isc_result_t -dns_c_logchan_getprintsev(dns_c_logchan_t *channel, isc_boolean_t *retval) -{ +dns_c_logchan_getprintsev(dns_c_logchan_t *channel, isc_boolean_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -1068,8 +1042,7 @@ dns_c_logchan_getprintsev(dns_c_logchan_t *channel, isc_boolean_t *retval) isc_result_t -dns_c_logchan_getprinttime(dns_c_logchan_t *channel, isc_boolean_t *retval) -{ +dns_c_logchan_getprinttime(dns_c_logchan_t *channel, isc_boolean_t *retval) { isc_result_t res; REQUIRE(DNS_C_LOGCHAN_VALID(channel)); @@ -1087,8 +1060,7 @@ dns_c_logchan_getprinttime(dns_c_logchan_t *channel, isc_boolean_t *retval) isc_result_t -dns_c_logchan_getpredef(dns_c_logchan_t *channel, isc_boolean_t *retval) -{ +dns_c_logchan_getpredef(dns_c_logchan_t *channel, isc_boolean_t *retval) { REQUIRE(DNS_C_LOGCHAN_VALID(channel)); REQUIRE(retval != NULL); @@ -1102,8 +1074,7 @@ dns_c_logchan_getpredef(dns_c_logchan_t *channel, isc_boolean_t *retval) * Logging category */ isc_result_t -dns_c_logcat_new(isc_mem_t *mem, const char *name, dns_c_logcat_t **newlc) -{ +dns_c_logcat_new(isc_mem_t *mem, const char *name, dns_c_logcat_t **newlc) { dns_c_logcat_t *newc; unsigned int i; @@ -1138,8 +1109,7 @@ dns_c_logcat_new(isc_mem_t *mem, const char *name, dns_c_logcat_t **newlc) isc_result_t -dns_c_logcat_delete(dns_c_logcat_t **logcat) -{ +dns_c_logcat_delete(dns_c_logcat_t **logcat) { dns_c_logcat_t *logc; unsigned int i; @@ -1170,8 +1140,7 @@ dns_c_logcat_delete(dns_c_logcat_t **logcat) isc_result_t -dns_c_logcat_copy(isc_mem_t *mem, dns_c_logcat_t **dest, dns_c_logcat_t *src) -{ +dns_c_logcat_copy(isc_mem_t *mem, dns_c_logcat_t **dest, dns_c_logcat_t *src) { unsigned int i; dns_c_logcat_t *newc; isc_result_t res; @@ -1223,8 +1192,7 @@ dns_c_logcat_print(FILE *fp, int indent, dns_c_logcat_t *logcat, isc_result_t -dns_c_logcat_addname(dns_c_logcat_t *logcat, const char *name) -{ +dns_c_logcat_addname(dns_c_logcat_t *logcat, const char *name) { unsigned int i; REQUIRE(DNS_C_LOGCAT_VALID(logcat)); @@ -1268,8 +1236,7 @@ dns_c_logcat_addname(dns_c_logcat_t *logcat, const char *name) isc_result_t -dns_c_logcat_delname(dns_c_logcat_t *logcat, const char *name) -{ +dns_c_logcat_delname(dns_c_logcat_t *logcat, const char *name) { unsigned int i ; isc_result_t res; @@ -1302,8 +1269,7 @@ dns_c_logcat_delname(dns_c_logcat_t *logcat, const char *name) isc_result_t -dns_c_logcat_setpredef(dns_c_logcat_t *logcat,isc_boolean_t newval) -{ +dns_c_logcat_setpredef(dns_c_logcat_t *logcat,isc_boolean_t newval) { REQUIRE(DNS_C_LOGCAT_VALID(logcat)); logcat->predefined = newval; @@ -1313,8 +1279,7 @@ dns_c_logcat_setpredef(dns_c_logcat_t *logcat,isc_boolean_t newval) isc_result_t -dns_c_logcat_getpredef(dns_c_logcat_t *logcat, isc_boolean_t *retval) -{ +dns_c_logcat_getpredef(dns_c_logcat_t *logcat, isc_boolean_t *retval) { REQUIRE(DNS_C_LOGCAT_VALID(logcat)); REQUIRE(retval != NULL); @@ -1330,8 +1295,7 @@ dns_c_logcat_getpredef(dns_c_logcat_t *logcat, isc_boolean_t *retval) static void -print_log_facility(FILE *fp, int value) -{ +print_log_facility(FILE *fp, int value) { REQUIRE(fp != NULL); fputs(dns_c_facility2string(value, ISC_TRUE), fp); @@ -1339,8 +1303,7 @@ print_log_facility(FILE *fp, int value) static void -print_log_severity(FILE *fp, dns_c_logseverity_t severity) -{ +print_log_severity(FILE *fp, dns_c_logseverity_t severity) { REQUIRE(fp != NULL); fputs(dns_c_logseverity2string(severity, ISC_TRUE), fp); diff --git a/lib/dns/config/conflsn.c b/lib/dns/config/conflsn.c index 031ca7e1fd..c078db1116 100644 --- a/lib/dns/config/conflsn.c +++ b/lib/dns/config/conflsn.c @@ -15,23 +15,19 @@ * SOFTWARE. */ -/* $Id: conflsn.c,v 1.12 2000/04/28 01:10:33 halley Exp $ */ +/* $Id: conflsn.c,v 1.13 2000/05/08 14:35:30 tale Exp $ */ #include -#include -#include +#include #include #include -#include #include "confpvt.h" - isc_result_t -dns_c_lstnon_new(isc_mem_t *mem, dns_c_lstnon_t **listen) -{ +dns_c_lstnon_new(isc_mem_t *mem, dns_c_lstnon_t **listen) { dns_c_lstnon_t *ll; isc_result_t result; @@ -57,10 +53,8 @@ dns_c_lstnon_new(isc_mem_t *mem, dns_c_lstnon_t **listen) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_lstnon_delete(dns_c_lstnon_t **listen) -{ +dns_c_lstnon_delete(dns_c_lstnon_t **listen) { dns_c_lstnon_t *lo; isc_result_t r; @@ -83,7 +77,6 @@ dns_c_lstnon_delete(dns_c_lstnon_t **listen) return (r); } - isc_result_t dns_c_lstnon_setiml(dns_c_lstnon_t *listen, dns_c_ipmatchlist_t *iml, isc_boolean_t deepcopy) @@ -113,15 +106,8 @@ dns_c_lstnon_setiml(dns_c_lstnon_t *listen, return (result); } - - - - - - isc_result_t -dns_c_lstnlist_new(isc_mem_t *mem, dns_c_lstnlist_t **llist) -{ +dns_c_lstnlist_new(isc_mem_t *mem, dns_c_lstnlist_t **llist) { dns_c_lstnlist_t *ll; REQUIRE(llist != NULL); @@ -143,10 +129,8 @@ dns_c_lstnlist_new(isc_mem_t *mem, dns_c_lstnlist_t **llist) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_lstnlist_delete(dns_c_lstnlist_t **llist) -{ +dns_c_lstnlist_delete(dns_c_lstnlist_t **llist) { dns_c_lstnlist_t *ll; dns_c_lstnon_t *lo, *lotmp; isc_result_t r; @@ -176,11 +160,8 @@ dns_c_lstnlist_delete(dns_c_lstnlist_t **llist) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_lstnlist_print(FILE *fp, int indent, - dns_c_lstnlist_t *ll) -{ +dns_c_lstnlist_print(FILE *fp, int indent, dns_c_lstnlist_t *ll) { dns_c_lstnon_t *lo; REQUIRE(DNS_C_LISTENLIST_VALID(ll)); @@ -196,10 +177,8 @@ dns_c_lstnlist_print(FILE *fp, int indent, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_lstnon_print(FILE *fp, int indent, dns_c_lstnon_t *lo) -{ +dns_c_lstnon_print(FILE *fp, int indent, dns_c_lstnon_t *lo) { REQUIRE(lo != NULL); REQUIRE(DNS_C_LISTEN_VALID(lo)); diff --git a/lib/dns/config/confndc.c b/lib/dns/config/confndc.c index 7680417b5b..9e81e4d9cb 100644 --- a/lib/dns/config/confndc.c +++ b/lib/dns/config/confndc.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confndc.c,v 1.12 2000/04/28 01:10:35 halley Exp $ */ +/* $Id: confndc.c,v 1.13 2000/05/08 14:35:31 tale Exp $ */ /* ** options { @@ -38,36 +38,21 @@ #include -#include -#include -#include #include -#include -#include -#include -#include +#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include #include #include +#include #include #include #include -#include -#include -#include - -#include - /* Type keys for symtab lookup */ #define KEYWORD_SYM_TYPE 0x1 #define CLASS_SYM_TYPE 0x2 diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y index c7286e1408..1e85943f55 100644 --- a/lib/dns/config/confparser.y +++ b/lib/dns/config/confparser.y @@ -16,46 +16,44 @@ * SOFTWARE. */ -/* $Id: confparser.y,v 1.72 2000/05/06 10:18:46 brister Exp $ */ +/* $Id: confparser.y,v 1.73 2000/05/08 14:35:33 tale Exp $ */ #include -#include -#include -#include #include #include #include -#include -#include - +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include + #include +#include +#include +#include +#include #include +#include +#include +#include +#include #include -#include +#include #include +#include #include #include - -#include -#include +#include #include +#include +#include #include - #include -#include - /* Type keys for symtab lookup */ #define KEYWORD_SYM_TYPE 0x1 diff --git a/lib/dns/config/confresolv.c b/lib/dns/config/confresolv.c index 6bb74cc129..dc31e67b6c 100644 --- a/lib/dns/config/confresolv.c +++ b/lib/dns/config/confresolv.c @@ -15,11 +15,10 @@ * SOFTWARE. */ -/* $Id: confresolv.c,v 1.6 2000/05/02 03:54:05 tale Exp $ */ +/* $Id: confresolv.c,v 1.7 2000/05/08 14:35:34 tale Exp $ */ #include -#include #include #include diff --git a/lib/dns/config/confrrset.c b/lib/dns/config/confrrset.c index 23ef456612..3746892cab 100644 --- a/lib/dns/config/confrrset.c +++ b/lib/dns/config/confrrset.c @@ -15,21 +15,17 @@ * SOFTWARE. */ -/* $Id: confrrset.c,v 1.12 2000/04/28 01:10:37 halley Exp $ */ +/* $Id: confrrset.c,v 1.13 2000/05/08 14:35:35 tale Exp $ */ #include -#include -#include +#include #include #include -#include - isc_result_t -dns_c_rrsolist_clear(dns_c_rrsolist_t *olist) -{ +dns_c_rrsolist_clear(dns_c_rrsolist_t *olist) { dns_c_rrso_t *elem; REQUIRE(DNS_C_RRSOLIST_VALID(olist)); @@ -44,11 +40,8 @@ dns_c_rrsolist_clear(dns_c_rrsolist_t *olist) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_rrsolist_append(dns_c_rrsolist_t *dest, - dns_c_rrsolist_t *src) -{ +dns_c_rrsolist_append(dns_c_rrsolist_t *dest, dns_c_rrsolist_t *src) { dns_c_rrso_t *oldelem; dns_c_rrso_t *newelem; isc_result_t res; @@ -70,10 +63,8 @@ dns_c_rrsolist_append(dns_c_rrsolist_t *dest, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_rrsolist_new(isc_mem_t *mem, dns_c_rrsolist_t **rval) -{ +dns_c_rrsolist_new(isc_mem_t *mem, dns_c_rrsolist_t **rval) { dns_c_rrsolist_t *ro; ro = isc_mem_get(mem, sizeof *ro); @@ -90,7 +81,6 @@ dns_c_rrsolist_new(isc_mem_t *mem, dns_c_rrsolist_t **rval) return (ISC_R_SUCCESS); } - isc_result_t dns_c_rrso_new(isc_mem_t *mem, dns_c_rrso_t **res, dns_rdataclass_t oclass, @@ -129,10 +119,8 @@ dns_c_rrso_new(isc_mem_t *mem, dns_c_rrso_t **res, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_rrsolist_delete(dns_c_rrsolist_t **list) -{ +dns_c_rrsolist_delete(dns_c_rrsolist_t **list) { dns_c_rrso_t *elem, *q; dns_c_rrsolist_t *l; isc_result_t r; @@ -162,10 +150,8 @@ dns_c_rrsolist_delete(dns_c_rrsolist_t **list) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_rrso_delete(dns_c_rrso_t **order) -{ +dns_c_rrso_delete(dns_c_rrso_t **order) { dns_c_rrso_t *oldo; REQUIRE(order != NULL); @@ -184,11 +170,8 @@ dns_c_rrso_delete(dns_c_rrso_t **order) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_rrso_copy(isc_mem_t *mem, dns_c_rrso_t **dest, - dns_c_rrso_t *source) -{ +dns_c_rrso_copy(isc_mem_t *mem, dns_c_rrso_t **dest, dns_c_rrso_t *source) { dns_c_rrso_t *newo; isc_result_t res; @@ -207,7 +190,6 @@ dns_c_rrso_copy(isc_mem_t *mem, dns_c_rrso_t **dest, return (res); } - isc_result_t dns_c_rrsolist_copy(isc_mem_t *mem, dns_c_rrsolist_t **dest, dns_c_rrsolist_t *source) @@ -244,11 +226,8 @@ dns_c_rrsolist_copy(isc_mem_t *mem, dns_c_rrsolist_t **dest, return (ISC_R_SUCCESS); } - void -dns_c_rrsolist_print(FILE *fp, int indent, - dns_c_rrsolist_t *rrlist) -{ +dns_c_rrsolist_print(FILE *fp, int indent, dns_c_rrsolist_t *rrlist) { dns_c_rrso_t *or; REQUIRE(DNS_C_RRSOLIST_VALID(rrlist)); @@ -271,10 +250,8 @@ dns_c_rrsolist_print(FILE *fp, int indent, } - void -dns_c_rrso_print(FILE *fp, int indent, dns_c_rrso_t *order) -{ +dns_c_rrso_print(FILE *fp, int indent, dns_c_rrso_t *order) { REQUIRE(DNS_C_RRSO_VALID(order)); dns_c_printtabs(fp, indent); diff --git a/lib/dns/config/confview.c b/lib/dns/config/confview.c index 455e7dc7db..70c03e4095 100644 --- a/lib/dns/config/confview.c +++ b/lib/dns/config/confview.c @@ -15,29 +15,19 @@ * SOFTWARE. */ -/* $Id: confview.c,v 1.25 2000/05/03 19:29:39 brister Exp $ */ +/* $Id: confview.c,v 1.26 2000/05/08 14:35:36 tale Exp $ */ #include -#include - -#include -#include -#include +#include #include -#include -#include -#include #include -#include #include #include #include "confpvt.h" - - /* ** Due to the repetive nature of the fields in a view ** we have here a collection of macros to used in defining @@ -60,15 +50,12 @@ #define GETSOCKADDR(FUNC, FIELD) GETBYTYPE(isc_sockaddr_t, FUNC, FIELD) #define UNSETSOCKADDR(FUNC, FIELD) UNSETBYTYPE(isc_sockaddr_t, FUNC, FIELD) - - #ifdef PVT_CONCAT #undef PVT_CONCAT #endif #define PVT_CONCAT(x,y) x ## y - /* ** The SET, GET and UNSETBYTYPE macros are all used whene the field in the ** view is a pointer to a fundamental type that requires no special copying, @@ -77,8 +64,7 @@ #define SETBYTYPE(TYPE, FUNCNAME, FIELDNAME) \ isc_result_t \ -PVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, TYPE newval) \ -{ \ +PVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, TYPE newval) { \ isc_boolean_t existed = ISC_FALSE; \ \ REQUIRE(DNS_C_VIEW_VALID(view)); \ @@ -99,8 +85,7 @@ PVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, TYPE newval) \ #define GETBYTYPE(TYPE, FUNCNAME, FIELDNAME) \ isc_result_t \ -PVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, TYPE *retval) \ -{ \ +PVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, TYPE *retval) {\ REQUIRE(DNS_C_VIEW_VALID(view)); \ REQUIRE(retval != NULL); \ \ @@ -114,8 +99,7 @@ PVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, TYPE *retval) \ #define UNSETBYTYPE(TYPE, FUNCNAME, FIELDNAME) \ isc_result_t \ -PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) \ -{ \ +PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) { \ REQUIRE(DNS_C_VIEW_VALID(view)); \ \ if (view->FIELDNAME == NULL) { \ @@ -129,8 +113,6 @@ PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) \ } \ } - - /* ** Now SET, GET and UNSET for dns_c_ipmatchlist_t fields */ @@ -155,8 +137,7 @@ PVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, \ #define UNSETIPMLIST(FUNCNAME, FIELDNAME) \ isc_result_t \ -PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) \ -{ \ +PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) { \ REQUIRE(DNS_C_VIEW_VALID(view)); \ \ if (view->FIELDNAME != NULL) { \ @@ -185,15 +166,9 @@ PVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, \ return (ISC_R_NOTFOUND); \ } \ } - - - - - isc_result_t -dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable) -{ +dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable) { dns_c_viewtable_t *table; REQUIRE(viewtable != NULL); @@ -218,8 +193,7 @@ dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable) isc_result_t -dns_c_viewtable_delete(dns_c_viewtable_t **viewtable) -{ +dns_c_viewtable_delete(dns_c_viewtable_t **viewtable) { dns_c_viewtable_t *table; REQUIRE(viewtable != NULL); @@ -259,8 +233,7 @@ dns_c_viewtable_print(FILE *fp, int indent, void -dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) -{ +dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) { REQUIRE(DNS_C_VIEWTABLE_VALID(viewtable)); REQUIRE(DNS_C_VIEW_VALID(view)); @@ -270,8 +243,7 @@ dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) void -dns_c_viewtable_rmview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) -{ +dns_c_viewtable_rmview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) { REQUIRE(DNS_C_VIEWTABLE_VALID(viewtable)); REQUIRE(DNS_C_VIEW_VALID(view)); @@ -281,8 +253,7 @@ dns_c_viewtable_rmview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) isc_result_t -dns_c_viewtable_clear(dns_c_viewtable_t *table) -{ +dns_c_viewtable_clear(dns_c_viewtable_t *table) { dns_c_view_t *elem; dns_c_view_t *tmpelem; isc_result_t r; @@ -361,8 +332,7 @@ dns_c_viewtable_rmviewbyname(dns_c_viewtable_t *viewtable, isc_result_t -dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) -{ +dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) { dns_c_view_t *elem; isc_boolean_t bbval; isc_int32_t bival; @@ -524,8 +494,7 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass, void -dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) -{ +dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) { dns_severity_t nameseverity; in_port_t port; @@ -713,8 +682,7 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) isc_result_t -dns_c_view_delete(dns_c_view_t **viewptr) -{ +dns_c_view_delete(dns_c_view_t **viewptr) { dns_c_view_t *view; #define FREEIPMLIST(FIELD) \ @@ -803,8 +771,7 @@ dns_c_view_delete(dns_c_view_t **viewptr) isc_boolean_t -dns_c_view_keydefinedp(dns_c_view_t *view, const char *keyname) -{ +dns_c_view_keydefinedp(dns_c_view_t *view, const char *keyname) { dns_c_kdef_t *keyid; isc_result_t res; isc_boolean_t rval = ISC_FALSE; @@ -824,8 +791,7 @@ dns_c_view_keydefinedp(dns_c_view_t *view, const char *keyname) } isc_result_t -dns_c_view_getname(dns_c_view_t *view, const char **retval) -{ +dns_c_view_getname(dns_c_view_t *view, const char **retval) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(retval != NULL); @@ -836,8 +802,7 @@ dns_c_view_getname(dns_c_view_t *view, const char **retval) isc_result_t -dns_c_view_getviewclass(dns_c_view_t *view, dns_rdataclass_t *retval) -{ +dns_c_view_getviewclass(dns_c_view_t *view, dns_rdataclass_t *retval) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(retval != NULL); @@ -854,8 +819,7 @@ dns_c_view_getviewclass(dns_c_view_t *view, dns_rdataclass_t *retval) isc_result_t -dns_c_view_addzone(dns_c_view_t *view, dns_c_zone_t *zone) -{ +dns_c_view_addzone(dns_c_view_t *view, dns_c_zone_t *zone) { isc_result_t res; dns_c_zone_t *attached; @@ -876,8 +840,7 @@ dns_c_view_addzone(dns_c_view_t *view, dns_c_zone_t *zone) isc_result_t -dns_c_view_getzonelist(dns_c_view_t *view, dns_c_zonelist_t **zonelist) -{ +dns_c_view_getzonelist(dns_c_view_t *view, dns_c_zonelist_t **zonelist) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(zonelist != NULL); @@ -892,8 +855,7 @@ dns_c_view_getzonelist(dns_c_view_t *view, dns_c_zonelist_t **zonelist) isc_result_t -dns_c_view_unsetzonelist(dns_c_view_t *view) -{ +dns_c_view_unsetzonelist(dns_c_view_t *view) { REQUIRE(DNS_C_VIEW_VALID(view)); if (view->zonelist == NULL) { @@ -952,8 +914,7 @@ dns_c_view_setforwarders(dns_c_view_t *view, isc_result_t -dns_c_view_unsetforwarders(dns_c_view_t *view) -{ +dns_c_view_unsetforwarders(dns_c_view_t *view) { REQUIRE(DNS_C_VIEW_VALID(view)); if (view->forwarders != NULL) { @@ -1161,8 +1122,7 @@ dns_c_view_unsetchecknames(dns_c_view_t *view, isc_result_t -dns_c_view_getkeydefs(dns_c_view_t *view, dns_c_kdeflist_t **retval) -{ +dns_c_view_getkeydefs(dns_c_view_t *view, dns_c_kdeflist_t **retval) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(retval != NULL); @@ -1177,8 +1137,7 @@ dns_c_view_getkeydefs(dns_c_view_t *view, dns_c_kdeflist_t **retval) isc_result_t -dns_c_view_setkeydefs(dns_c_view_t *view, dns_c_kdeflist_t *newval) -{ +dns_c_view_setkeydefs(dns_c_view_t *view, dns_c_kdeflist_t *newval) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(DNS_C_KDEFLIST_VALID(newval)); @@ -1193,8 +1152,7 @@ dns_c_view_setkeydefs(dns_c_view_t *view, dns_c_kdeflist_t *newval) isc_result_t -dns_c_view_unsetkeydefs(dns_c_view_t *view) -{ +dns_c_view_unsetkeydefs(dns_c_view_t *view) { REQUIRE(DNS_C_VIEW_VALID(view)); if (view->keydefs != NULL) { @@ -1212,8 +1170,7 @@ dns_c_view_unsetkeydefs(dns_c_view_t *view) */ isc_result_t -dns_c_view_getpeerlist(dns_c_view_t *view, dns_peerlist_t **retval) -{ +dns_c_view_getpeerlist(dns_c_view_t *view, dns_peerlist_t **retval) { REQUIRE(DNS_C_VIEW_VALID(view)); REQUIRE(retval != NULL); @@ -1228,8 +1185,7 @@ dns_c_view_getpeerlist(dns_c_view_t *view, dns_peerlist_t **retval) isc_result_t -dns_c_view_unsetpeerlist(dns_c_view_t *view) -{ +dns_c_view_unsetpeerlist(dns_c_view_t *view) { REQUIRE(DNS_C_VIEW_VALID(view)); if (view->peerlist != NULL) { @@ -1242,8 +1198,7 @@ dns_c_view_unsetpeerlist(dns_c_view_t *view) isc_result_t -dns_c_view_setpeerlist(dns_c_view_t *view, dns_peerlist_t *newval) -{ +dns_c_view_setpeerlist(dns_c_view_t *view, dns_peerlist_t *newval) { REQUIRE(DNS_C_VIEW_VALID(view)); if (view->peerlist != NULL) { @@ -1255,10 +1210,6 @@ dns_c_view_setpeerlist(dns_c_view_t *view, dns_peerlist_t *newval) return (ISC_R_SUCCESS); } - - - - GETIPMLIST(allowquery, allowquery) SETIPMLIST(allowquery, allowquery) UNSETIPMLIST(allowquery, allowquery) diff --git a/lib/dns/config/confzone.c b/lib/dns/config/confzone.c index 9819e4da40..b775a3b677 100644 --- a/lib/dns/config/confzone.c +++ b/lib/dns/config/confzone.c @@ -15,15 +15,15 @@ * SOFTWARE. */ -/* $Id: confzone.c,v 1.39 2000/05/06 10:18:47 brister Exp $ */ +/* $Id: confzone.c,v 1.40 2000/05/08 14:35:38 tale Exp $ */ #include -#include +#include +#include #include #include -#include #include #include @@ -130,11 +130,8 @@ static isc_result_t set_ipmatch_list_field(isc_mem_t *mem, static void zone_list_print(zone_print_type zpt, FILE *fp, int indent, dns_c_zonelist_t *list); - - isc_result_t -dns_c_zonelist_new(isc_mem_t *mem, dns_c_zonelist_t **zlist) -{ +dns_c_zonelist_new(isc_mem_t *mem, dns_c_zonelist_t **zlist) { dns_c_zonelist_t *list; REQUIRE(zlist != NULL); @@ -154,10 +151,8 @@ dns_c_zonelist_new(isc_mem_t *mem, dns_c_zonelist_t **zlist) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_zonelist_delete(dns_c_zonelist_t **zlist) -{ +dns_c_zonelist_delete(dns_c_zonelist_t **zlist) { dns_c_zonelist_t *list; dns_c_zonelem_t *zoneelem; dns_c_zonelem_t *tmpelem; @@ -192,8 +187,7 @@ dns_c_zonelist_delete(dns_c_zonelist_t **zlist) } isc_result_t -dns_c_zonelist_checkzones(dns_c_zonelist_t *list) -{ +dns_c_zonelist_checkzones(dns_c_zonelist_t *list) { dns_c_zone_t *zone; dns_c_ipmatchlist_t *ipmlist = NULL; dns_ssutable_t *ssutable = NULL; @@ -235,13 +229,8 @@ dns_c_zonelist_checkzones(dns_c_zonelist_t *list) return (ISC_R_SUCCESS); } - - - isc_result_t -dns_c_zonelist_addzone(dns_c_zonelist_t *zlist, - dns_c_zone_t *zone) -{ +dns_c_zonelist_addzone(dns_c_zonelist_t *zlist, dns_c_zone_t *zone) { dns_c_zonelem_t *zoneelem; REQUIRE(DNS_C_ZONELIST_VALID(zlist)); @@ -260,8 +249,6 @@ dns_c_zonelist_addzone(dns_c_zonelist_t *zlist, return (ISC_R_SUCCESS); } - - isc_result_t dns_c_zonelist_find(dns_c_zonelist_t *zlist, const char *name, @@ -290,11 +277,8 @@ dns_c_zonelist_find(dns_c_zonelist_t *zlist, const char *name, return (zoneelem == NULL ? ISC_R_NOTFOUND : ISC_R_SUCCESS); } - isc_result_t -dns_c_zonelist_rmbyname(dns_c_zonelist_t *zlist, - const char *name) -{ +dns_c_zonelist_rmbyname(dns_c_zonelist_t *zlist, const char *name) { dns_c_zonelem_t *zoneelem; isc_result_t res; @@ -322,11 +306,8 @@ dns_c_zonelist_rmbyname(dns_c_zonelist_t *zlist, return (res); } - isc_result_t -dns_c_zonelist_rmzone(dns_c_zonelist_t *zlist, - dns_c_zone_t *zone) -{ +dns_c_zonelist_rmzone(dns_c_zonelist_t *zlist, dns_c_zone_t *zone) { dns_c_zonelem_t *zoneelem; isc_result_t res; @@ -355,36 +336,26 @@ dns_c_zonelist_rmzone(dns_c_zonelist_t *zlist, return (res); } - void -dns_c_zonelist_print(FILE *fp, int indent, - dns_c_zonelist_t *list) -{ +dns_c_zonelist_print(FILE *fp, int indent, dns_c_zonelist_t *list) { REQUIRE(DNS_C_ZONELIST_VALID(list)); zone_list_print(zones_all, fp, indent, list); } - void -dns_c_zonelist_printpreopts(FILE *fp, int indent, - dns_c_zonelist_t *list) -{ +dns_c_zonelist_printpreopts(FILE *fp, int indent, dns_c_zonelist_t *list) { REQUIRE(DNS_C_ZONELIST_VALID(list)); zone_list_print(zones_preopts, fp, indent, list); } - void -dns_c_zonelist_printpostopts(FILE *fp, int indent, - dns_c_zonelist_t *list) -{ +dns_c_zonelist_printpostopts(FILE *fp, int indent, dns_c_zonelist_t *list) { REQUIRE(DNS_C_ZONELIST_VALID(list)); zone_list_print(zones_postopts, fp, indent, list); } dns_c_zone_t * -dns_c_zonelist_firstzone(dns_c_zonelist_t *list) -{ +dns_c_zonelist_firstzone(dns_c_zonelist_t *list) { dns_c_zonelem_t *zoneelem; REQUIRE(DNS_C_ZONELIST_VALID(list)); @@ -398,11 +369,8 @@ dns_c_zonelist_firstzone(dns_c_zonelist_t *list) } } - dns_c_zone_t * -dns_c_zonelist_nextzone(dns_c_zonelist_t *list, - dns_c_zone_t *zone) -{ +dns_c_zonelist_nextzone(dns_c_zonelist_t *list, dns_c_zone_t *zone) { dns_c_zonelem_t *zoneelem; REQUIRE(DNS_C_ZONELIST_VALID(list)); @@ -427,9 +395,6 @@ dns_c_zonelist_nextzone(dns_c_zonelist_t *list, } } - - - static void zone_list_print(zone_print_type zpt, FILE *fp, int indent, dns_c_zonelist_t *list) @@ -466,7 +431,6 @@ zone_list_print(zone_print_type zpt, FILE *fp, int indent, return; } - /* ************************************************************************ */ /* ******************************** ZONEs ********************************* */ /* ************************************************************************ */ @@ -529,10 +493,8 @@ dns_c_zone_new(isc_mem_t *mem, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_detach(dns_c_zone_t **zone) -{ +dns_c_zone_detach(dns_c_zone_t **zone) { dns_c_zone_t *zoneptr; isc_result_t res = ISC_R_SUCCESS; @@ -552,11 +514,8 @@ dns_c_zone_detach(dns_c_zone_t **zone) return (res); } - void -dns_c_zone_attach(dns_c_zone_t *source, - dns_c_zone_t **target) -{ +dns_c_zone_attach(dns_c_zone_t *source, dns_c_zone_t **target) { REQUIRE(DNS_C_ZONE_VALID(source)); REQUIRE(target != NULL); @@ -564,12 +523,9 @@ dns_c_zone_attach(dns_c_zone_t *source, *target = source; } - - void -dns_c_zone_print(FILE *fp, int indent, dns_c_zone_t *zone) -{ +dns_c_zone_print(FILE *fp, int indent, dns_c_zone_t *zone) { REQUIRE(fp != NULL); REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -624,12 +580,8 @@ dns_c_zone_print(FILE *fp, int indent, dns_c_zone_t *zone) fprintf(fp, "};\n"); } - - - isc_result_t -dns_c_zone_setfile(dns_c_zone_t *zone, const char *newfile) -{ +dns_c_zone_setfile(dns_c_zone_t *zone, const char *newfile) { char **p = NULL; isc_result_t res; @@ -676,11 +628,8 @@ dns_c_zone_setfile(dns_c_zone_t *zone, const char *newfile) return (res); } - isc_result_t -dns_c_zone_setchecknames(dns_c_zone_t *zone, - dns_severity_t severity) -{ +dns_c_zone_setchecknames(dns_c_zone_t *zone, dns_severity_t severity) { dns_severity_t *p = NULL; dns_c_setbits_t *bits = NULL; int bit = 0; @@ -732,8 +681,6 @@ dns_c_zone_setchecknames(dns_c_zone_t *zone, return (res); } - - isc_result_t dns_c_zone_setallowupd(dns_c_zone_t *zone, dns_c_ipmatchlist_t *ipml, @@ -785,8 +732,7 @@ dns_c_zone_setallowupd(dns_c_zone_t *zone, } isc_result_t -dns_c_zone_unsetallowupd(dns_c_zone_t *zone) -{ +dns_c_zone_unsetallowupd(dns_c_zone_t *zone) { dns_c_ipmatchlist_t **p = NULL; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -826,7 +772,6 @@ dns_c_zone_unsetallowupd(dns_c_zone_t *zone) } } - isc_result_t dns_c_zone_setallowupdateforwarding(dns_c_zone_t *zone, dns_c_ipmatchlist_t *ipml, @@ -878,10 +823,8 @@ dns_c_zone_setallowupdateforwarding(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_setssuauth(dns_c_zone_t *zone, dns_ssutable_t *ssu) -{ +dns_c_zone_setssuauth(dns_c_zone_t *zone, dns_ssutable_t *ssu) { dns_ssutable_t **p = NULL; isc_boolean_t existed; @@ -925,7 +868,6 @@ dns_c_zone_setssuauth(dns_c_zone_t *zone, dns_ssutable_t *ssu) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t dns_c_zone_setallowquery(dns_c_zone_t *zone, dns_c_ipmatchlist_t *ipml, @@ -976,7 +918,6 @@ dns_c_zone_setallowquery(dns_c_zone_t *zone, return (res); } - isc_result_t dns_c_zone_setallowtransfer(dns_c_zone_t *zone, dns_c_ipmatchlist_t *ipml, @@ -1028,10 +969,8 @@ dns_c_zone_setallowtransfer(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_setdialup(dns_c_zone_t *zone, isc_boolean_t newval) -{ +dns_c_zone_setdialup(dns_c_zone_t *zone, isc_boolean_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1074,10 +1013,8 @@ dns_c_zone_setdialup(dns_c_zone_t *zone, isc_boolean_t newval) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setnotify(dns_c_zone_t *zone, isc_boolean_t newval) -{ +dns_c_zone_setnotify(dns_c_zone_t *zone, isc_boolean_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1119,11 +1056,8 @@ dns_c_zone_setnotify(dns_c_zone_t *zone, isc_boolean_t newval) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaintixfrbase(dns_c_zone_t *zone, - isc_boolean_t newval) -{ +dns_c_zone_setmaintixfrbase(dns_c_zone_t *zone, isc_boolean_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1168,7 +1102,6 @@ dns_c_zone_setmaintixfrbase(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t dns_c_zone_setalsonotify(dns_c_zone_t *zone, dns_c_iplist_t *newval, @@ -1218,10 +1151,8 @@ dns_c_zone_setalsonotify(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_setixfrbase(dns_c_zone_t *zone, const char *newval) -{ +dns_c_zone_setixfrbase(dns_c_zone_t *zone, const char *newval) { isc_boolean_t existed ; char **p = NULL; @@ -1272,10 +1203,8 @@ dns_c_zone_setixfrbase(dns_c_zone_t *zone, const char *newval) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setixfrtmp(dns_c_zone_t *zone, const char *newval) -{ +dns_c_zone_setixfrtmp(dns_c_zone_t *zone, const char *newval) { isc_boolean_t existed; char **p = NULL; @@ -1326,7 +1255,6 @@ dns_c_zone_setixfrtmp(dns_c_zone_t *zone, const char *newval) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t dns_c_zone_addpubkey(dns_c_zone_t *zone, dns_c_pubkey_t *pubkey, @@ -1380,10 +1308,8 @@ dns_c_zone_addpubkey(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_setmasterport(dns_c_zone_t *zone, in_port_t port) -{ +dns_c_zone_setmasterport(dns_c_zone_t *zone, in_port_t port) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1427,7 +1353,6 @@ dns_c_zone_setmasterport(dns_c_zone_t *zone, in_port_t port) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t dns_c_zone_setmasterips(dns_c_zone_t *zone, dns_c_iplist_t *newval, @@ -1479,11 +1404,8 @@ dns_c_zone_setmasterips(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_settransfersource(dns_c_zone_t *zone, - isc_sockaddr_t newval) -{ +dns_c_zone_settransfersource(dns_c_zone_t *zone, isc_sockaddr_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1528,11 +1450,8 @@ dns_c_zone_settransfersource(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_settransfersourcev6(dns_c_zone_t *zone, - isc_sockaddr_t newval) -{ +dns_c_zone_settransfersourcev6(dns_c_zone_t *zone, isc_sockaddr_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1579,11 +1498,8 @@ dns_c_zone_settransfersourcev6(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaxtranstimein(dns_c_zone_t *zone, - isc_int32_t newval) -{ +dns_c_zone_setmaxtranstimein(dns_c_zone_t *zone, isc_int32_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1630,11 +1546,8 @@ dns_c_zone_setmaxtranstimein(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaxtranstimeout(dns_c_zone_t *zone, - isc_int32_t newval) -{ +dns_c_zone_setmaxtranstimeout(dns_c_zone_t *zone, isc_int32_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1681,11 +1594,8 @@ dns_c_zone_setmaxtranstimeout(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaxtransidlein(dns_c_zone_t *zone, - isc_int32_t newval) -{ +dns_c_zone_setmaxtransidlein(dns_c_zone_t *zone, isc_int32_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1732,11 +1642,8 @@ dns_c_zone_setmaxtransidlein(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaxtransidleout(dns_c_zone_t *zone, - isc_int32_t newval) -{ +dns_c_zone_setmaxtransidleout(dns_c_zone_t *zone, isc_int32_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1783,11 +1690,8 @@ dns_c_zone_setmaxtransidleout(dns_c_zone_t *zone, return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_setmaxixfrlog(dns_c_zone_t *zone, - isc_int32_t newval) -{ +dns_c_zone_setmaxixfrlog(dns_c_zone_t *zone, isc_int32_t newval) { dns_c_setbits_t *bits = NULL; isc_int32_t *p = NULL; int bit = 0; @@ -1840,10 +1744,8 @@ dns_c_zone_setmaxixfrlog(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_setforward(dns_c_zone_t *zone, dns_c_forw_t newval) -{ +dns_c_zone_setforward(dns_c_zone_t *zone, dns_c_forw_t newval) { isc_boolean_t existed = ISC_FALSE; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -1887,7 +1789,6 @@ dns_c_zone_setforward(dns_c_zone_t *zone, dns_c_forw_t newval) return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); } - isc_result_t dns_c_zone_setforwarders(dns_c_zone_t *zone, dns_c_iplist_t *ipl, @@ -1936,10 +1837,8 @@ dns_c_zone_setforwarders(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getname(dns_c_zone_t *zone, const char **retval) -{ +dns_c_zone_getname(dns_c_zone_t *zone, const char **retval) { REQUIRE(DNS_C_ZONE_VALID(zone)); REQUIRE(retval != NULL); @@ -1948,11 +1847,8 @@ dns_c_zone_getname(dns_c_zone_t *zone, const char **retval) return (ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_getinternalname(dns_c_zone_t *zone, - const char **retval) -{ +dns_c_zone_getinternalname(dns_c_zone_t *zone, const char **retval) { REQUIRE(DNS_C_ZONE_VALID(zone)); REQUIRE(retval != NULL); @@ -1961,10 +1857,8 @@ dns_c_zone_getinternalname(dns_c_zone_t *zone, return (ISC_R_SUCCESS); } - isc_result_t -dns_c_zone_getfile(dns_c_zone_t *zone, const char **retval) -{ +dns_c_zone_getfile(dns_c_zone_t *zone, const char **retval) { const char *p = NULL; isc_result_t res; @@ -2005,11 +1899,8 @@ dns_c_zone_getfile(dns_c_zone_t *zone, const char **retval) return (res); } - isc_result_t -dns_c_zone_getchecknames(dns_c_zone_t *zone, - dns_severity_t *retval) -{ +dns_c_zone_getchecknames(dns_c_zone_t *zone, dns_severity_t *retval) { dns_severity_t *p = NULL; dns_c_setbits_t *bits = NULL; int bit = 0; @@ -2060,11 +1951,8 @@ dns_c_zone_getchecknames(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getallowupd(dns_c_zone_t *zone, - dns_c_ipmatchlist_t **retval) -{ +dns_c_zone_getallowupd(dns_c_zone_t *zone, dns_c_ipmatchlist_t **retval) { dns_c_ipmatchlist_t *p = NULL; isc_result_t res; @@ -2108,10 +1996,8 @@ dns_c_zone_getallowupd(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getssuauth(dns_c_zone_t *zone, dns_ssutable_t **retval) -{ +dns_c_zone_getssuauth(dns_c_zone_t *zone, dns_ssutable_t **retval) { dns_ssutable_t *p = NULL; isc_result_t res; @@ -2159,7 +2045,6 @@ dns_c_zone_getssuauth(dns_c_zone_t *zone, dns_ssutable_t **retval) return (res); } - isc_result_t dns_c_zone_getallowupdateforwarding(dns_c_zone_t *zone, dns_c_ipmatchlist_t **retval) @@ -2208,11 +2093,8 @@ dns_c_zone_getallowupdateforwarding(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getallowquery(dns_c_zone_t *zone, - dns_c_ipmatchlist_t **retval) -{ +dns_c_zone_getallowquery(dns_c_zone_t *zone, dns_c_ipmatchlist_t **retval) { dns_c_ipmatchlist_t *p = NULL; isc_result_t res; @@ -2256,11 +2138,8 @@ dns_c_zone_getallowquery(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getallowtransfer(dns_c_zone_t *zone, - dns_c_ipmatchlist_t **retval) -{ +dns_c_zone_getallowtransfer(dns_c_zone_t *zone, dns_c_ipmatchlist_t **retval) { dns_c_ipmatchlist_t *p = NULL; isc_result_t res; @@ -2305,11 +2184,8 @@ dns_c_zone_getallowtransfer(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getdialup(dns_c_zone_t *zone, - isc_boolean_t *retval) -{ +dns_c_zone_getdialup(dns_c_zone_t *zone, isc_boolean_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2359,11 +2235,8 @@ dns_c_zone_getdialup(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getnotify(dns_c_zone_t *zone, - isc_boolean_t *retval) -{ +dns_c_zone_getnotify(dns_c_zone_t *zone, isc_boolean_t *retval) { isc_result_t res; dns_c_setbits_t *bits = NULL; isc_boolean_t val = ISC_FALSE; @@ -2414,11 +2287,8 @@ dns_c_zone_getnotify(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmaintixfrbase(dns_c_zone_t *zone, - isc_boolean_t *retval) -{ +dns_c_zone_getmaintixfrbase(dns_c_zone_t *zone, isc_boolean_t *retval) { isc_result_t res; dns_c_setbits_t *bits = NULL; isc_boolean_t val = ISC_FALSE; @@ -2469,11 +2339,8 @@ dns_c_zone_getmaintixfrbase(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getalsonotify(dns_c_zone_t *zone, - dns_c_iplist_t **retval) -{ +dns_c_zone_getalsonotify(dns_c_zone_t *zone, dns_c_iplist_t **retval) { dns_c_iplist_t *p = NULL; isc_result_t res; @@ -2518,11 +2385,8 @@ dns_c_zone_getalsonotify(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getixfrbase(dns_c_zone_t *zone, - const char **retval) -{ +dns_c_zone_getixfrbase(dns_c_zone_t *zone, const char **retval) { char *p = NULL; isc_result_t res; @@ -2567,10 +2431,8 @@ dns_c_zone_getixfrbase(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getixfrtmp(dns_c_zone_t *zone, const char **retval) -{ +dns_c_zone_getixfrtmp(dns_c_zone_t *zone, const char **retval) { char *p = NULL; isc_result_t res; @@ -2615,11 +2477,8 @@ dns_c_zone_getixfrtmp(dns_c_zone_t *zone, const char **retval) return (res); } - isc_result_t -dns_c_zone_getpubkeylist(dns_c_zone_t *zone, - dns_c_pklist_t **retval) -{ +dns_c_zone_getpubkeylist(dns_c_zone_t *zone, dns_c_pklist_t **retval) { dns_c_pklist_t *p = NULL; isc_result_t res; @@ -2666,11 +2525,8 @@ dns_c_zone_getpubkeylist(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmasterport(dns_c_zone_t *zone, - in_port_t *retval) -{ +dns_c_zone_getmasterport(dns_c_zone_t *zone, in_port_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2721,11 +2577,8 @@ dns_c_zone_getmasterport(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmasterips(dns_c_zone_t *zone, - dns_c_iplist_t **retval) -{ +dns_c_zone_getmasterips(dns_c_zone_t *zone, dns_c_iplist_t **retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2772,11 +2625,8 @@ dns_c_zone_getmasterips(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_gettransfersource(dns_c_zone_t *zone, - isc_sockaddr_t *retval) -{ +dns_c_zone_gettransfersource(dns_c_zone_t *zone, isc_sockaddr_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2830,11 +2680,8 @@ dns_c_zone_gettransfersource(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_gettransfersourcev6(dns_c_zone_t *zone, - isc_sockaddr_t *retval) -{ +dns_c_zone_gettransfersourcev6(dns_c_zone_t *zone, isc_sockaddr_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2888,11 +2735,8 @@ dns_c_zone_gettransfersourcev6(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmaxtranstimein(dns_c_zone_t *zone, - isc_int32_t *retval) -{ +dns_c_zone_getmaxtranstimein(dns_c_zone_t *zone, isc_int32_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -2944,11 +2788,8 @@ dns_c_zone_getmaxtranstimein(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmaxtranstimeout(dns_c_zone_t *zone, - isc_int32_t *retval) -{ +dns_c_zone_getmaxtranstimeout(dns_c_zone_t *zone, isc_int32_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -3000,12 +2841,8 @@ dns_c_zone_getmaxtranstimeout(dns_c_zone_t *zone, return (res); } - - isc_result_t -dns_c_zone_getmaxtransidlein(dns_c_zone_t *zone, - isc_int32_t *retval) -{ +dns_c_zone_getmaxtransidlein(dns_c_zone_t *zone, isc_int32_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -3057,11 +2894,8 @@ dns_c_zone_getmaxtransidlein(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getmaxtransidleout(dns_c_zone_t *zone, - isc_int32_t *retval) -{ +dns_c_zone_getmaxtransidleout(dns_c_zone_t *zone, isc_int32_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -3114,12 +2948,8 @@ dns_c_zone_getmaxtransidleout(dns_c_zone_t *zone, return (res); } - - isc_result_t -dns_c_zone_getmaxixfrlog(dns_c_zone_t *zone, - isc_int32_t *retval) -{ +dns_c_zone_getmaxixfrlog(dns_c_zone_t *zone, isc_int32_t *retval) { isc_result_t res; dns_c_setbits_t *bits = NULL; int bit = 0; @@ -3172,11 +3002,8 @@ dns_c_zone_getmaxixfrlog(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getforward(dns_c_zone_t *zone, - dns_c_forw_t *retval) -{ +dns_c_zone_getforward(dns_c_zone_t *zone, dns_c_forw_t *retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -3229,11 +3056,8 @@ dns_c_zone_getforward(dns_c_zone_t *zone, return (res); } - isc_result_t -dns_c_zone_getforwarders(dns_c_zone_t *zone, - dns_c_iplist_t **retval) -{ +dns_c_zone_getforwarders(dns_c_zone_t *zone, dns_c_iplist_t **retval) { isc_result_t res = ISC_R_SUCCESS; REQUIRE(DNS_C_ZONE_VALID(zone)); @@ -3290,15 +3114,12 @@ dns_c_zone_getforwarders(dns_c_zone_t *zone, return (res); } - /* * Zone privates */ static void -master_zone_print(FILE *fp, int indent, - dns_c_masterzone_t *mzone) -{ +master_zone_print(FILE *fp, int indent, dns_c_masterzone_t *mzone) { REQUIRE(mzone != NULL); if (mzone->file != NULL) { @@ -3421,11 +3242,8 @@ master_zone_print(FILE *fp, int indent, } } - static void -slave_zone_print(FILE *fp, int indent, - dns_c_slavezone_t *szone) -{ +slave_zone_print(FILE *fp, int indent, dns_c_slavezone_t *szone) { REQUIRE(szone != NULL); if (szone->file != NULL) { @@ -3590,10 +3408,8 @@ slave_zone_print(FILE *fp, int indent, } } - static void -stub_zone_print(FILE *fp, int indent, dns_c_stubzone_t *tzone) -{ +stub_zone_print(FILE *fp, int indent, dns_c_stubzone_t *tzone) { REQUIRE(tzone != NULL); if (tzone->file != NULL) { @@ -3716,10 +3532,8 @@ stub_zone_print(FILE *fp, int indent, dns_c_stubzone_t *tzone) } } - static void -hint_zone_print(FILE *fp, int indent, dns_c_hintzone_t *hzone) -{ +hint_zone_print(FILE *fp, int indent, dns_c_hintzone_t *hzone) { REQUIRE(hzone != NULL); if (hzone->file != NULL) { @@ -3740,11 +3554,8 @@ hint_zone_print(FILE *fp, int indent, dns_c_hintzone_t *hzone) } } - static void -forward_zone_print(FILE *fp, int indent, - dns_c_forwardzone_t *fzone) -{ +forward_zone_print(FILE *fp, int indent, dns_c_forwardzone_t *fzone) { REQUIRE(fzone != NULL); if (DNS_C_CHECKBIT(FZ_FORWARD_BIT, &fzone->setflags)) { @@ -3769,10 +3580,8 @@ forward_zone_print(FILE *fp, int indent, } } - static isc_result_t -master_zone_init(dns_c_masterzone_t *mzone) -{ +master_zone_init(dns_c_masterzone_t *mzone) { REQUIRE(mzone != NULL); mzone->file = NULL; @@ -3792,10 +3601,8 @@ master_zone_init(dns_c_masterzone_t *mzone) return (ISC_R_SUCCESS); } - static isc_result_t -slave_zone_init(dns_c_slavezone_t *szone) -{ +slave_zone_init(dns_c_slavezone_t *szone) { REQUIRE(szone != NULL); szone->file = NULL; @@ -3815,10 +3622,8 @@ slave_zone_init(dns_c_slavezone_t *szone) return (ISC_R_SUCCESS); } - static isc_result_t -stub_zone_init(dns_c_stubzone_t *tzone) -{ +stub_zone_init(dns_c_stubzone_t *tzone) { REQUIRE(tzone != NULL); tzone->file = NULL; @@ -3835,10 +3640,8 @@ stub_zone_init(dns_c_stubzone_t *tzone) return (ISC_R_SUCCESS); } - static isc_result_t -hint_zone_init(dns_c_hintzone_t *hzone) -{ +hint_zone_init(dns_c_hintzone_t *hzone) { REQUIRE(hzone != NULL); hzone->file = NULL; @@ -3848,10 +3651,8 @@ hint_zone_init(dns_c_hintzone_t *hzone) return (ISC_R_SUCCESS); } - static isc_result_t -forward_zone_init(dns_c_forwardzone_t *fzone) -{ +forward_zone_init(dns_c_forwardzone_t *fzone) { REQUIRE(fzone != NULL); fzone->forwarders = NULL; @@ -3860,10 +3661,8 @@ forward_zone_init(dns_c_forwardzone_t *fzone) return (ISC_R_SUCCESS); } - static isc_result_t -zone_delete(dns_c_zone_t **zone) -{ +zone_delete(dns_c_zone_t **zone) { dns_c_zone_t *z; isc_result_t res = ISC_R_SUCCESS; @@ -3909,10 +3708,8 @@ zone_delete(dns_c_zone_t **zone) return (res); } - static isc_result_t -master_zone_clear(isc_mem_t *mem, dns_c_masterzone_t *mzone) -{ +master_zone_clear(isc_mem_t *mem, dns_c_masterzone_t *mzone) { REQUIRE(mzone != NULL); if (mzone == NULL) { @@ -3958,10 +3755,8 @@ master_zone_clear(isc_mem_t *mem, dns_c_masterzone_t *mzone) return (ISC_R_SUCCESS); } - static isc_result_t -slave_zone_clear(isc_mem_t *mem, dns_c_slavezone_t *szone) -{ +slave_zone_clear(isc_mem_t *mem, dns_c_slavezone_t *szone) { REQUIRE(szone != NULL); if (szone == NULL) { @@ -4007,11 +3802,8 @@ slave_zone_clear(isc_mem_t *mem, dns_c_slavezone_t *szone) return (ISC_R_SUCCESS); } - - static isc_result_t -stub_zone_clear(isc_mem_t *mem, dns_c_stubzone_t *tzone) -{ +stub_zone_clear(isc_mem_t *mem, dns_c_stubzone_t *tzone) { REQUIRE(tzone != NULL); if (tzone == NULL) { @@ -4046,10 +3838,8 @@ stub_zone_clear(isc_mem_t *mem, dns_c_stubzone_t *tzone) return (ISC_R_SUCCESS); } - static isc_result_t -forward_zone_clear(isc_mem_t *mem, dns_c_forwardzone_t *fzone) -{ +forward_zone_clear(isc_mem_t *mem, dns_c_forwardzone_t *fzone) { REQUIRE(fzone != NULL); if (fzone == NULL) { @@ -4064,10 +3854,8 @@ forward_zone_clear(isc_mem_t *mem, dns_c_forwardzone_t *fzone) return (ISC_R_SUCCESS); } - static isc_result_t -hint_zone_clear(isc_mem_t *mem, dns_c_hintzone_t *hzone) -{ +hint_zone_clear(isc_mem_t *mem, dns_c_hintzone_t *hzone) { REQUIRE(hzone != NULL); if (hzone == NULL) { diff --git a/lib/dns/db.c b/lib/dns/db.c index 983e4ee086..a1e5bb44c1 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -21,14 +21,10 @@ #include -#include -#include - -#include -#include +#include #include -#include +#include #include #include @@ -587,5 +583,6 @@ dns_db_deleterdataset(dns_db_t *db, dns_dbnode_t *node, REQUIRE(((db->attributes & DNS_DBATTR_CACHE) == 0 && version != NULL)|| ((db->attributes & DNS_DBATTR_CACHE) != 0 && version == NULL)); - return ((db->methods->deleterdataset)(db, node, version, type, covers)); + return ((db->methods->deleterdataset)(db, node, version, + type, covers)); } diff --git a/lib/dns/dbiterator.c b/lib/dns/dbiterator.c index 3d590bdb8a..33b7ee5311 100644 --- a/lib/dns/dbiterator.c +++ b/lib/dns/dbiterator.c @@ -17,9 +17,6 @@ #include -#include - -#include #include #include diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c index e40f3a0a6d..1355092524 100644 --- a/lib/dns/dbtable.c +++ b/lib/dns/dbtable.c @@ -16,7 +16,7 @@ */ /* - * $Id: dbtable.c,v 1.17 2000/05/02 03:53:52 tale Exp $ + * $Id: dbtable.c,v 1.18 2000/05/08 14:34:31 tale Exp $ */ /* @@ -25,6 +25,7 @@ #include +#include #include #include diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 585f58d52e..3068212f3c 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -17,30 +17,19 @@ #include -#include -#include #include -#include -#include -#include -#include #include -#include #include -#include -#include +#include #include #include -#include #include #include #include #include -#include #include -#include struct dns_dispentry { unsigned int magic; @@ -135,8 +124,7 @@ static dns_dispentry_t *linear_next(dns_dispatch_t *disp, * The resulting string is guaranteed to be null-terminated. */ static void -sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) -{ +sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) { isc_result_t result; isc_buffer_t buf; @@ -194,8 +182,7 @@ request_log(dns_dispatch_t *disp, dns_dispentry_t *resp, } static void -reseed_lfsr(isc_lfsr_t *lfsr, void *arg) -{ +reseed_lfsr(isc_lfsr_t *lfsr, void *arg) { UNUSED(arg); lfsr->count = (random() & 0x1f) + 32; /* From 32 to 63 states */ @@ -207,8 +194,7 @@ reseed_lfsr(isc_lfsr_t *lfsr, void *arg) * Return an unpredictable message ID. */ static isc_uint32_t -dns_randomid(dns_dispatch_t *disp) -{ +dns_randomid(dns_dispatch_t *disp) { isc_uint32_t id; id = isc_lfsr_generate32(&disp->qid_lfsr1, &disp->qid_lfsr2); @@ -220,8 +206,7 @@ dns_randomid(dns_dispatch_t *disp) * Return a hash of the destination and message id. */ static isc_uint32_t -dns_hash(dns_dispatch_t *disp, isc_sockaddr_t *dest, isc_uint32_t id) -{ +dns_hash(dns_dispatch_t *disp, isc_sockaddr_t *dest, isc_uint32_t id) { unsigned int ret; ret = isc_sockaddr_hash(dest, ISC_TRUE); @@ -239,8 +224,7 @@ static dns_dispatchmethods_t dns_wire_methods = { }; static dns_dispentry_t * -linear_first(dns_dispatch_t *disp) -{ +linear_first(dns_dispatch_t *disp) { dns_dispentry_t *ret; unsigned int bucket; @@ -257,8 +241,7 @@ linear_first(dns_dispatch_t *disp) } static dns_dispentry_t * -linear_next(dns_dispatch_t *disp, dns_dispentry_t *resp) -{ +linear_next(dns_dispatch_t *disp, dns_dispentry_t *resp) { dns_dispentry_t *ret; unsigned int bucket; @@ -281,8 +264,7 @@ linear_next(dns_dispatch_t *disp, dns_dispentry_t *resp) * Called when refcount reaches 0 (and safe to destroy) */ static void -destroy(dns_dispatch_t *disp) -{ +destroy(dns_dispatch_t *disp) { dns_dispatchevent_t *ev; disp->magic = 0; @@ -344,8 +326,7 @@ bucket_search(dns_dispatch_t *disp, isc_sockaddr_t *dest, dns_messageid_t id, } static void -free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len) -{ +free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len) { isc_sockettype_t socktype; INSIST(buf != NULL && len != 0); @@ -371,8 +352,7 @@ free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len) } static void * -allocate_buffer(dns_dispatch_t *disp, unsigned int len) -{ +allocate_buffer(dns_dispatch_t *disp, unsigned int len) { void *temp; INSIST(len > 0); @@ -389,8 +369,7 @@ allocate_buffer(dns_dispatch_t *disp, unsigned int len) } static inline void -free_event(dns_dispatch_t *disp, dns_dispatchevent_t *ev) -{ +free_event(dns_dispatch_t *disp, dns_dispatchevent_t *ev) { if (disp->failsafe_ev == ev) { INSIST(disp->shutdown_out == 1); disp->shutdown_out = 0; @@ -402,8 +381,7 @@ free_event(dns_dispatch_t *disp, dns_dispatchevent_t *ev) } static inline dns_dispatchevent_t * -allocate_event(dns_dispatch_t *disp) -{ +allocate_event(dns_dispatch_t *disp) { dns_dispatchevent_t *ev; ev = isc_mempool_get(disp->epool); @@ -435,8 +413,7 @@ allocate_event(dns_dispatch_t *disp) * restart. */ static void -udp_recv(isc_task_t *task, isc_event_t *ev_in) -{ +udp_recv(isc_task_t *task, isc_event_t *ev_in) { isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; dns_dispatch_t *disp = ev_in->ev_arg; dns_messageid_t id; @@ -619,8 +596,7 @@ udp_recv(isc_task_t *task, isc_event_t *ev_in) * restart. */ static void -tcp_recv(isc_task_t *task, isc_event_t *ev_in) -{ +tcp_recv(isc_task_t *task, isc_event_t *ev_in) { dns_dispatch_t *disp = ev_in->ev_arg; dns_tcpmsg_t *tcpmsg = &disp->tcpmsg; dns_messageid_t id; @@ -788,11 +764,10 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) } /* - * disp must be locked + * disp must be locked. */ static void -startrecv(dns_dispatch_t *disp) -{ +startrecv(dns_dispatch_t *disp) { isc_sockettype_t socktype; isc_result_t res; isc_region_t region; @@ -1027,8 +1002,7 @@ dns_dispatch_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, } void -dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp) -{ +dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp) { REQUIRE(VALID_DISPATCH(disp)); REQUIRE(dispp != NULL && *dispp == NULL); @@ -1039,8 +1013,7 @@ dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp) void -dns_dispatch_detach(dns_dispatch_t **dispp) -{ +dns_dispatch_detach(dns_dispatch_t **dispp) { dns_dispatch_t *disp; isc_boolean_t killit; @@ -1432,8 +1405,7 @@ dns_dispatch_freeevent(dns_dispatch_t *disp, dns_dispentry_t *resp, } static void -do_next_response(dns_dispatch_t *disp, dns_dispentry_t *resp) -{ +do_next_response(dns_dispatch_t *disp, dns_dispentry_t *resp) { dns_dispatchevent_t *ev; INSIST(resp->item_out == ISC_FALSE); @@ -1458,8 +1430,7 @@ do_next_response(dns_dispatch_t *disp, dns_dispentry_t *resp) } static void -do_next_request(dns_dispatch_t *disp, dns_dispentry_t *resp) -{ +do_next_request(dns_dispatch_t *disp, dns_dispentry_t *resp) { dns_dispatchevent_t *ev; INSIST(resp->item_out == ISC_FALSE); @@ -1483,8 +1454,7 @@ do_next_request(dns_dispatch_t *disp, dns_dispentry_t *resp) } static void -do_cancel(dns_dispatch_t *disp, dns_dispentry_t *resp) -{ +do_cancel(dns_dispatch_t *disp, dns_dispentry_t *resp) { dns_dispatchevent_t *ev; if (disp->shutdown_out == 1) @@ -1546,16 +1516,14 @@ do_cancel(dns_dispatch_t *disp, dns_dispentry_t *resp) } isc_socket_t * -dns_dispatch_getsocket(dns_dispatch_t *disp) -{ +dns_dispatch_getsocket(dns_dispatch_t *disp) { REQUIRE(VALID_DISPATCH(disp)); return (disp->socket); } void -dns_dispatch_cancel(dns_dispatch_t *disp) -{ +dns_dispatch_cancel(dns_dispatch_t *disp) { REQUIRE(VALID_DISPATCH(disp)); LOCK(&disp->lock); diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 14a22f6ea2..c76102766e 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -16,7 +16,7 @@ */ /* - * $Id: dnssec.c,v 1.33 2000/05/02 03:53:52 tale Exp $ + * $Id: dnssec.c,v 1.34 2000/05/08 14:34:34 tale Exp $ * Principal Author: Brian Wellington */ @@ -24,28 +24,21 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include #include #include #include #include #include -#include #include #include #include -#include #include #include /* for DNS_TSIG_FUDGE */ -#include #include #define is_response(msg) (msg->flags & DNS_MESSAGEFLAG_QR) @@ -90,12 +83,14 @@ digest_callback(void *arg, isc_region_t *data) { result = dst_sign(DST_SIGMODE_UPDATE, ctx->key, &ctx->context, data, NULL); else - result = dst_verify(DST_SIGMODE_UPDATE, ctx->key, &ctx->context, - data, NULL); + result = dst_verify(DST_SIGMODE_UPDATE, ctx->key, + &ctx->context, data, NULL); return (result); } -/* converts the name of a key into a canonical isc_name_t */ +/* + * Converts the name of a key into a canonical dns_name_t. + */ static isc_result_t keyname_to_name(char *keyname, isc_mem_t *mctx, dns_name_t *name) { isc_buffer_t src, dst; @@ -117,13 +112,17 @@ keyname_to_name(char *keyname, isc_mem_t *mctx, dns_name_t *name) { return (ret); } -/* make qsort happy */ +/* + * Make qsort happy. + */ static int rdata_compare_wrapper(const void *rdata1, const void *rdata2) { return dns_rdata_compare((dns_rdata_t *)rdata1, (dns_rdata_t *)rdata2); } -/* sort the rdataset into an array */ +/* + * Sort the rdataset into an array. + */ static isc_result_t rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx, dns_rdata_t **rdata, int *nrdata) @@ -135,7 +134,9 @@ rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx, ret = dns_rdataset_first(set); if (ret != ISC_R_SUCCESS) return (ret); - /* count the records */ + /* + * Count the records. + */ while (dns_rdataset_next(set) == ISC_R_SUCCESS) n++; @@ -147,12 +148,16 @@ rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx, if (ret != ISC_R_SUCCESS) return (ret); - /* put them in the array */ + /* + * Put them in the array. + */ do { dns_rdataset_current(set, &data[i++]); } while (dns_rdataset_next(set) == ISC_R_SUCCESS); - /* sort the array */ + /* + * Sort the array. + */ qsort(data, n, sizeof(dns_rdata_t), rdata_compare_wrapper); *rdata = data; *nrdata = n; @@ -215,7 +220,9 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, if (*inception >= *expire) return (DNS_R_INVALIDTIME); - /* Is the key allowed to sign data? */ + /* + * Is the key allowed to sign data? + */ flags = dst_key_flags(key); if (flags & DNS_KEYTYPE_NOAUTH) return (DNS_R_KEYUNAUTHORIZED); @@ -256,7 +263,9 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_buffer_usedregion(&b, &r); - /* Digest the SIG rdata */ + /* + * Digest the SIG rdata. + */ r.length -= sig.siglen; ret = dst_sign(DST_SIGMODE_INIT | DST_SIGMODE_UPDATE, key, &ctx, &r, NULL); @@ -266,7 +275,9 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, dns_name_toregion(name, &r); - /* create an envelope for each rdata: */ + /* + * Create an envelope for each rdata: . + */ isc_buffer_init(&envbuf, data, sizeof(data)); memcpy(data, r.base, r.length); isc_buffer_add(&envbuf, r.length); @@ -289,12 +300,16 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_buffer_t lenbuf; isc_region_t lenr; - /* Digest the envelope */ + /* + * Digest the envelope. + */ ret = dst_sign(DST_SIGMODE_UPDATE, key, &ctx, &r, NULL); if (ret != ISC_R_SUCCESS) goto cleanup_array; - /* Digest the length of the rdata */ + /* + * Digest the length of the rdata. + */ isc_buffer_init(&lenbuf, &len, sizeof(len)); INSIST(rdatas[i].length < 65536); isc_buffer_putuint16(&lenbuf, (isc_uint16_t)rdatas[i].length); @@ -303,7 +318,9 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, if (ret != ISC_R_SUCCESS) goto cleanup_array; - /* Digest the rdata */ + /* + * Digest the rdata. + */ ret = dns_rdata_digest(&rdatas[i], digest_callback, &dctx); if (ret != ISC_R_SUCCESS) goto cleanup_array; @@ -365,21 +382,27 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, if (!ignoretime) { isc_stdtime_get(&now); - /* Is SIG temporally valid? */ + /* + * Is SIG temporally valid? + */ if (sig.timesigned > now) return (DNS_R_SIGFUTURE); else if (sig.timeexpire < now) return (DNS_R_SIGEXPIRED); } - /* Is the key allowed to sign data? */ + /* + * Is the key allowed to sign data? + */ flags = dst_key_flags(key); if (flags & DNS_KEYTYPE_NOAUTH) return (DNS_R_KEYUNAUTHORIZED); if ((flags & DNS_KEYFLAG_OWNERMASK) != DNS_KEYOWNER_ZONE) return (DNS_R_KEYUNAUTHORIZED); - /* Digest the SIG rdata (not including the signature) */ + /* + * Digest the SIG rdata (not including the signature). + */ dns_rdata_toregion(sigrdata, &r); r.length -= sig.siglen; RUNTIME_CHECK(r.length >= 20); @@ -387,7 +410,9 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, ret = dst_verify(DST_SIGMODE_INIT | DST_SIGMODE_UPDATE, key, &ctx, &r, NULL); - /* if the name is an expanded wildcard, use the wildcard name */ + /* + * If the name is an expanded wildcard, use the wildcard name. + */ labels = dns_name_depth(name) - 1; if (labels - sig.labels > 0) { dns_fixedname_init(&fnewname); @@ -398,7 +423,9 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, else dns_name_toregion(name, &r); - /* create an envelope for each rdata: */ + /* + * Create an envelope for each rdata: . + */ isc_buffer_init(&envbuf, data, sizeof(data)); if (labels - sig.labels > 0) { isc_buffer_putuint8(&envbuf, 1); @@ -427,18 +454,24 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_buffer_t lenbuf; isc_region_t lenr; - /* Digest the envelope */ + /* + * Digest the envelope. + */ ret = dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &r, NULL); if (ret != ISC_R_SUCCESS) goto cleanup_array; - /* Digest the rdata length */ + /* + * Digest the rdata length. + */ isc_buffer_init(&lenbuf, &len, sizeof(len)); INSIST(rdatas[i].length < 65536); isc_buffer_putuint16(&lenbuf, (isc_uint16_t)rdatas[i].length); isc_buffer_usedregion(&lenbuf, &lenr); - /* Digest the rdata */ + /* + * Digest the rdata. + */ ret = dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &lenr, NULL); if (ret != ISC_R_SUCCESS) goto cleanup_array; @@ -582,13 +615,17 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { RETERR(dst_sign(DST_SIGMODE_UPDATE, key, &ctx, msg->query, NULL)); - /* Digest the header */ + /* + * Digest the header. + */ isc_buffer_init(&headerbuf, header, sizeof(header)); dns_message_renderheader(msg, &headerbuf); isc_buffer_usedregion(&headerbuf, &r); RETERR(dst_sign(DST_SIGMODE_UPDATE, key, &ctx, &r, NULL)); - /* Digest the remainder of the message */ + /* + * Digest the remainder of the message. + */ isc_buffer_usedregion(msg->buffer, &r); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); RETERR(dst_sign(DST_SIGMODE_UPDATE, key, &ctx, &r, NULL)); @@ -708,25 +745,35 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, RETERR(dst_verify(DST_SIGMODE_INIT, key, &ctx, NULL, NULL)); - /* if this is a response, digest the query */ + /* + * If this is a response, digest the query. + */ if (is_response(msg)) RETERR(dst_verify(DST_SIGMODE_UPDATE, key, &ctx, msg->query, NULL)); - /* Extract the header */ + /* + * Extract the header. + */ memcpy(header, source_r.base, DNS_MESSAGE_HEADERLEN); - /* Decrement the additional field counter */ + /* + * Decrement the additional field counter. + */ memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); addcount = htons(ntohs(addcount) - 1); memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); - /* Digest the modified header */ + /* + * Digest the modified header. + */ header_r.base = (unsigned char *) header; header_r.length = DNS_MESSAGE_HEADERLEN; RETERR(dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &header_r, NULL)); - /* Digest all non-SIG(0) records */ + /* + * Digest all non-SIG(0) records. + */ r.base = source_r.base + DNS_MESSAGE_HEADERLEN; r.length = msg->sigstart - DNS_MESSAGE_HEADERLEN; RETERR(dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &r, NULL)); diff --git a/lib/dns/gen-unix.h b/lib/dns/gen-unix.h index da3b90bb9b..40b63deaaa 100644 --- a/lib/dns/gen-unix.h +++ b/lib/dns/gen-unix.h @@ -30,8 +30,9 @@ #ifndef DNS_GEN_UNIX_H #define DNS_GEN_UNIX_H 1 +#include + #include -#include #include #include diff --git a/lib/dns/gen.c b/lib/dns/gen.c index 4fca893998..415f1782e1 100644 --- a/lib/dns/gen.c +++ b/lib/dns/gen.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: gen.c,v 1.44 2000/05/04 22:49:47 explorer Exp $ */ +/* $Id: gen.c,v 1.45 2000/05/08 14:34:36 tale Exp $ */ #include @@ -542,10 +542,17 @@ main(int argc, char **argv) { fprintf(stdout, copyright, year); if (code) { - fputs("\n\n", stdout); + fputs("#ifndef DNS_CODE_H\n", stdout); + fputs("#define DNS_CODE_H 1\n\n", stdout); + + fputs("#include \n", stdout); + fputs("#include \n\n", stdout); + fputs("#include \n\n", stdout); + for (tt = types; tt != NULL ; tt = tt->next) fprintf(stdout, "#include \"%s/%s_%d.c\"\n", tt->dirname, tt->typename, tt->type); + fputs("\n\n", stdout); doswitch("FROMTEXTSWITCH", "fromtext", FROMTEXTARGS, @@ -695,10 +702,12 @@ main(int argc, char **argv) { cc->rdclass, upper(cc->classname), cc->next != NULL ? " \\" : ""); - fputs("\n", stdout); + fputs("#endif /* DNS_CODE_H */\n", stdout); } else if (type_enum) { - fprintf(stdout, "#ifndef TYPEENUM\n"); - fprintf(stdout, "#define TYPEENUM%s\n", + fprintf(stdout, "#ifndef DNS_ENUMTYPE_H\n"); + fprintf(stdout, "#define DNS_ENUMTYPE_H 1\n"); + + fprintf(stdout, "#define DNS_TYPEENUM%s\n", types != NULL ? " \\" : ""); lasttype = 0; @@ -708,10 +717,12 @@ main(int argc, char **argv) { funname(tt->typename, buf1), lasttype = tt->type, tt->next != NULL ? " \\" : ""); - fprintf(stdout, "#endif /* TYPEENUM */\n"); + fprintf(stdout, "#endif /* DNS_ENUMTYPE_H */\n"); } else if (class_enum) { - fprintf(stdout, "#ifndef CLASSENUM\n"); - fprintf(stdout, "#define CLASSENUM%s\n", + fprintf(stdout, "#ifndef DNS_ENUMCLASS_H\n"); + fprintf(stdout, "#define DNS_ENUMCLASS_H 1\n"); + + fprintf(stdout, "#define DNS_CLASSENUM%s\n", classes != NULL ? " \\" : ""); printf("\t dns_rdataclass_reserved0 = 0, \\\n"); @@ -723,7 +734,7 @@ main(int argc, char **argv) { cc->rdclass, cc->next != NULL ? " \\" : ""); } - fprintf(stdout, "#endif /* CLASSENUM */\n"); + fprintf(stdout, "#endif /* DNS_ENUMCLASS_H */\n"); } else if (structs) { if (prefix != NULL) { if ((fd = fopen(prefix,"r")) != NULL) { diff --git a/lib/dns/include/dns/a6.h b/lib/dns/include/dns/a6.h index 5be729f234..3de3e335ee 100644 --- a/lib/dns/include/dns/a6.h +++ b/lib/dns/include/dns/a6.h @@ -19,15 +19,12 @@ #define DNS_A6_H 1 #include -#include #include #include #include #include -ISC_LANG_BEGINDECLS - typedef isc_result_t (*dns_findfunc_t)(void *arg, dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, @@ -59,6 +56,8 @@ struct dns_a6context { isc_bitstring_t bitstring; }; +ISC_LANG_BEGINDECLS + void dns_a6_init(dns_a6context_t *a6ctx, dns_findfunc_t find, dns_rrsetfunc_t rrset, dns_in6addrfunc_t address, dns_a6missingfunc_t missing, void *arg); diff --git a/lib/dns/include/dns/acl.h b/lib/dns/include/dns/acl.h index 5511917a45..ef4c4e47bb 100644 --- a/lib/dns/include/dns/acl.h +++ b/lib/dns/include/dns/acl.h @@ -31,10 +31,11 @@ ***/ #include +#include #include -#include #include +#include /*** *** Types @@ -78,10 +79,9 @@ struct dns_aclenv { dns_acl_t *localnets; }; - #define DNS_ACL_MAGIC 0x4461636c /* Dacl */ -#define DNS_ACL_VALID(a) ((a) != NULL && \ - (a)->magic == DNS_ACL_MAGIC) +#define DNS_ACL_VALID(a) ISC_MAGIC_VALID(a, DNS_ACL_MAGIC) + /*** *** Functions ***/ diff --git a/lib/dns/include/dns/aclconf.h b/lib/dns/include/dns/aclconf.h index 6665d55c84..8df15f65cf 100644 --- a/lib/dns/include/dns/aclconf.h +++ b/lib/dns/include/dns/aclconf.h @@ -20,12 +20,10 @@ #include -#include -#include #include -#include +#include -typedef struct { +typedef struct dns_aclconfctx { ISC_LIST(dns_acl_t) named_acl_cache; } dns_aclconfctx_t; diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 8babd5ceb9..56642d142e 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -72,19 +72,11 @@ *** Imports ***/ -#include - -#include #include -#include #include #include -#include -#include -#include #include -#include #include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/bit.h b/lib/dns/include/dns/bit.h index 1ac41b18ab..df0d56ada7 100644 --- a/lib/dns/include/dns/bit.h +++ b/lib/dns/include/dns/bit.h @@ -18,6 +18,9 @@ #ifndef DNS_BIT_H #define DNS_BIT_H 1 +#include +#include + typedef isc_uint64_t dns_bitset_t; #define DNS_BIT_SET(bit, bitset) \ diff --git a/lib/dns/include/dns/byaddr.h b/lib/dns/include/dns/byaddr.h index d60ea32bb8..9dbb092c8d 100644 --- a/lib/dns/include/dns/byaddr.h +++ b/lib/dns/include/dns/byaddr.h @@ -46,10 +46,8 @@ * Drafts: */ -#include #include #include -#include #include diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h index 146e9f1b82..796517bf34 100644 --- a/lib/dns/include/dns/cache.h +++ b/lib/dns/include/dns/cache.h @@ -49,9 +49,6 @@ ***/ #include -#include -#include -#include #include #include diff --git a/lib/dns/include/dns/callbacks.h b/lib/dns/include/dns/callbacks.h index 7bd858c0a3..05ab469560 100644 --- a/lib/dns/include/dns/callbacks.h +++ b/lib/dns/include/dns/callbacks.h @@ -32,24 +32,33 @@ ISC_LANG_BEGINDECLS *** Types ***/ -typedef struct dns_rdatacallbacks { - /* dns_load_master calls this when it has rdatasets to commit */ +struct dns_rdatacallbacks { + /* + * dns_load_master calls this when it has rdatasets to commit. + */ dns_addrdatasetfunc_t add; - /* dns_load_master / dns_rdata_fromtext call this to issue a error */ + /* + * dns_load_master / dns_rdata_fromtext call this to issue a error. + */ void (*error)(struct dns_rdatacallbacks *, char *, ...); - /* dns_load_master / dns_rdata_fromtext call this to issue a warning */ + /* + * dns_load_master / dns_rdata_fromtext call this to issue a warning. + */ void (*warn)(struct dns_rdatacallbacks *, char *, ...); - /* private data handles for use by the above callback functions */ + /* + * Private data handles for use by the above callback functions. + */ void *add_private; void *error_private; void *warn_private; -} dns_rdatacallbacks_t; +}; /*** *** Initialization ***/ -void dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks); +void +dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks); /* * Initalise 'callbacks'. * 'error' and 'warn' are set to default callbacks that print the @@ -61,7 +70,8 @@ void dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks); * 'callbacks' is a valid dns_rdatacallbacks_t, */ -void dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks); +void +dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks); /* * Like dns_rdatacallbacks_init, but logs to stdio. */ diff --git a/lib/dns/include/dns/compress.h b/lib/dns/include/dns/compress.h index ba05b45445..f320a9ea99 100644 --- a/lib/dns/include/dns/compress.h +++ b/lib/dns/include/dns/compress.h @@ -18,7 +18,6 @@ #ifndef DNS_COMPRESS_H #define DNS_COMPRESS_H 1 -#include #include #include @@ -38,7 +37,6 @@ ISC_LANG_BEGINDECLS */ #define DNS_COMPRESS_ALL 0x03 /* all compression. */ - /* * XXX An API for manipulating these structures will be forthcoming. * Also magic numbers, _init() and _invalidate(), etc. At that time, @@ -63,8 +61,8 @@ struct dns_decompress { isc_boolean_t strict; /* Strict checking */ }; -isc_result_t dns_compress_init(dns_compress_t *cctx, int edns, - isc_mem_t *mctx); +isc_result_t +dns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx); /* * Inialise the compression context structure pointed to by 'cctx'. * diff --git a/lib/dns/include/dns/confacl.h b/lib/dns/include/dns/confacl.h index 7ee672bd95..971542db05 100644 --- a/lib/dns/include/dns/confacl.h +++ b/lib/dns/include/dns/confacl.h @@ -57,8 +57,7 @@ ***/ #include -#include -#include +#include #include @@ -79,9 +78,7 @@ typedef struct dns_c_acl dns_c_acl_t; typedef struct dns_c_acl_table dns_c_acltable_t; - -struct dns_c_acl -{ +struct dns_c_acl { isc_uint32_t magic; dns_c_acltable_t *mytable; @@ -93,9 +90,7 @@ struct dns_c_acl ISC_LINK(dns_c_acl_t) next; }; - -struct dns_c_acl_table -{ +struct dns_c_acl_table { isc_uint32_t magic; isc_mem_t *mem; @@ -103,8 +98,6 @@ struct dns_c_acl_table ISC_LIST(dns_c_acl_t) acl_list; }; - - /*** *** Functions ***/ diff --git a/lib/dns/include/dns/confcommon.h b/lib/dns/include/dns/confcommon.h index 523f20a744..766fb4576d 100644 --- a/lib/dns/include/dns/confcommon.h +++ b/lib/dns/include/dns/confcommon.h @@ -53,18 +53,9 @@ *** Imports ***/ -#include - #include -#include -#include -#include -#include #include -#include -#include -#include #include @@ -79,28 +70,32 @@ #define DNS_C_DEFAULT_STDERR "default_stderr" #define DNS_C_STDERR_PATH " " /* not really a path */ - - -/* The value we use in config files if the user doesn't specify the port or - * in some statements +/* + * The value we use in config files if the user doesn't specify the port or + * in some statements. */ #define DNS_C_DEFAULTPORT 53 /* XXX this should be imported */ - -/* What an 'unlimited' value for a size_spec is stored as internally */ +/* + * What an 'unlimited' value for a size_spec is stored as internally. + */ #define DNS_C_SIZE_SPEC_UNLIM (~((isc_uint32_t) 0x0)) -/* What a 'default' value for a size_spec is stored as internally */ +/* + * What a 'default' value for a size_spec is stored as internally. + */ #define DNS_C_SIZE_SPEC_DEFAULT (DNS_C_SIZE_SPEC_UNLIM - 1) -/* What 'unlimited' is stored as internally for logging file versions */ -#define DNS_C_UNLIM_VERSIONS DNS_C_SIZE_SPEC_UNLIM - -/* The default ordering given to rrset-order statements when the type given - is illegal (so parsing can continue). */ -#define DNS_DEFAULT_ORDERING dns_c_ordering_fixed - +/* + * What 'unlimited' is stored as internally for logging file versions + */ +#define DNS_C_UNLIM_VERSIONS DNS_C_SIZE_SPEC_UNLIM +/* + * The default ordering given to rrset-order statements when the type given + * is illegal (so parsing can continue). + */ +#define DNS_DEFAULT_ORDERING dns_c_ordering_fixed /*** *** Types @@ -250,7 +245,6 @@ typedef struct dns_c_zone_list dns_c_zonelist_t; extern isc_boolean_t debug_mem_print; extern FILE *debug_mem_print_stream; /* NULL means stderr */ - /*** *** Functions ***/ diff --git a/lib/dns/include/dns/confctl.h b/lib/dns/include/dns/confctl.h index 8ded3e5dce..a8199111c8 100644 --- a/lib/dns/include/dns/confctl.h +++ b/lib/dns/include/dns/confctl.h @@ -55,11 +55,8 @@ *** Imports ***/ -#include - #include -#include -#include +#include #include diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h index 6b940f5d9b..b747e8ec22 100644 --- a/lib/dns/include/dns/confctx.h +++ b/lib/dns/include/dns/confctx.h @@ -49,24 +49,16 @@ *** Imports ***/ -#include #include -#include -#include +#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include #include +#include +#include +#include #include +#include #define DNS_C_CONFIG_MAGIC 0x434f4e46U /* CONF */ #define DNS_C_OPTION_MAGIC 0x4f707473U /* Opts */ diff --git a/lib/dns/include/dns/confip.h b/lib/dns/include/dns/confip.h index 5af9e94442..69a23b581f 100644 --- a/lib/dns/include/dns/confip.h +++ b/lib/dns/include/dns/confip.h @@ -51,30 +51,25 @@ *** Imports ***/ -#include - #include -#include #include -#include -#include #include +#include #include +#define DNS_C_IPLIST_MAGIC 0x49706c73 /* Ipls */ +#define DNS_C_IPMDIRECT_MAGIC 0x49506d64 /* IPmd */ +#define DNS_C_IPMINDIRECT_MAGIC 0x69506d69 /* iPmi */ +#define DNS_C_IPMELEM_MAGIC 0x49704d65 /* IpMe */ +#define DNS_C_IPMLIST_MAGIC 0x69706d6c /* ipml */ -#define DNS_C_IPLIST_MAGIC 0x49706c73 /* Ipls */ /* dns_c_iplist */ -#define DNS_C_IPMDIRECT_MAGIC 0x49506d64 /* IPmd */ /* dns_c_ipmatch_direct */ -#define DNS_C_IPMINDIRECT_MAGIC 0x69506d69 /* iPmi */ /* dns_c_ipmatch_indirect */ -#define DNS_C_IPMELEM_MAGIC 0x49704d65 /* IpMe */ /* dns_c_ipmatch_element */ -#define DNS_C_IPMLIST_MAGIC 0x69706d6c /* ipml */ /* dns_c_ipmatchlist */ - -#define DNS_C_IPLIST_VALID(ptr) ISC_MAGIC_VALID(ptr,DNS_C_IPLIST_MAGIC) +#define DNS_C_IPLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPLIST_MAGIC) #define DNS_C_IPDIRECT_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPMDIRECT_MAGIC) #define DNS_C_IPINDIRECT_VALID(ptr) \ - ISC_MAGIC_VALID(ptr, DNS_C_IPMINDIRECT_MAGIC) -#define DNS_C_IPMELEM_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPMELEM_MAGIC) -#define DNS_C_IPMLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPMLIST_MAGIC) + ISC_MAGIC_VALID(ptr, DNS_C_IPMINDIRECT_MAGIC) +#define DNS_C_IPMELEM_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPMELEM_MAGIC) +#define DNS_C_IPMLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_C_IPMLIST_MAGIC) /*** *** Types @@ -88,7 +83,9 @@ typedef struct dns_c_ipmatch_element dns_c_ipmatchelement_t; typedef struct dns_c_ipmatch_list dns_c_ipmatchlist_t; -/* A list of IP addresses (IPv4 or IPv6) */ +/* + * A list of IP addresses (IPv4 or IPv6). + */ struct dns_c_iplist { isc_uint32_t magic; @@ -99,8 +96,6 @@ struct dns_c_iplist { isc_uint32_t nextidx; }; - - struct dns_c_ipmatch_direct { isc_uint32_t magic; @@ -113,12 +108,10 @@ struct dns_c_ipmatch_direct { struct dns_c_ipmatch_indirect { isc_uint32_t magic; - isc_textregion_t refname; /* for acls, mostly. */ + isc_textregion_t refname; /* For acls, mostly. */ dns_c_ipmatchlist_t *list; }; - - struct dns_c_ipmatch_element { isc_uint32_t magic; diff --git a/lib/dns/include/dns/confkeys.h b/lib/dns/include/dns/confkeys.h index 306caef4aa..fc6d4e6612 100644 --- a/lib/dns/include/dns/confkeys.h +++ b/lib/dns/include/dns/confkeys.h @@ -56,6 +56,7 @@ #include #include +#include #include diff --git a/lib/dns/include/dns/conflog.h b/lib/dns/include/dns/conflog.h index 6f3b3b0ae4..126edeed10 100644 --- a/lib/dns/include/dns/conflog.h +++ b/lib/dns/include/dns/conflog.h @@ -55,7 +55,7 @@ ***/ #include -#include +#include #include diff --git a/lib/dns/include/dns/conflsn.h b/lib/dns/include/dns/conflsn.h index 41f57a1c67..f5312754f7 100644 --- a/lib/dns/include/dns/conflsn.h +++ b/lib/dns/include/dns/conflsn.h @@ -56,8 +56,7 @@ ***/ #include -#include -#include +#include #include diff --git a/lib/dns/include/dns/confndc.h b/lib/dns/include/dns/confndc.h index 9b06b2cf9d..1d61f9e156 100644 --- a/lib/dns/include/dns/confndc.h +++ b/lib/dns/include/dns/confndc.h @@ -20,7 +20,6 @@ #include #include -#include #include diff --git a/lib/dns/include/dns/confrrset.h b/lib/dns/include/dns/confrrset.h index ddb79b3f97..cdf0ec7d85 100644 --- a/lib/dns/include/dns/confrrset.h +++ b/lib/dns/include/dns/confrrset.h @@ -44,13 +44,8 @@ *** Imports ***/ -/* XXX these next two are needed by rdatatype.h. It should be fixed to - * include them itself. - */ #include -#include - -#include +#include #include diff --git a/lib/dns/include/dns/confview.h b/lib/dns/include/dns/confview.h index d95390bc87..16eec07dd8 100644 --- a/lib/dns/include/dns/confview.h +++ b/lib/dns/include/dns/confview.h @@ -54,16 +54,8 @@ ***/ #include -#include +#include -#include - -#include -#include -#include -#include -#include -#include #include #include diff --git a/lib/dns/include/dns/confzone.h b/lib/dns/include/dns/confzone.h index 3749fb16db..41ed377fb4 100644 --- a/lib/dns/include/dns/confzone.h +++ b/lib/dns/include/dns/confzone.h @@ -54,11 +54,8 @@ ***/ #include -#include +#include -#include - -#include #include #include diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index 00de7573ee..17a57a54b8 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -53,17 +53,13 @@ ***** Imports *****/ -#include - -#include -#include #include +#include #include #include -#include #include -#include +#include ISC_LANG_BEGINDECLS @@ -144,9 +140,8 @@ typedef struct dns_dbmethods { isc_boolean_t (*issecure)(dns_db_t *db); } dns_dbmethods_t; -#define DNS_DB_MAGIC 0x444E5344U /* DNSD. */ -#define DNS_DB_VALID(db) ((db) != NULL && \ - (db)->magic == DNS_DB_MAGIC) +#define DNS_DB_MAGIC 0x444E5344U /* DNSD. */ +#define DNS_DB_VALID(db) ISC_MAGIC_VALID(db, DNS_DB_MAGIC) /* * This structure is actually just the common prefix of a DNS db diff --git a/lib/dns/include/dns/dbiterator.h b/lib/dns/include/dns/dbiterator.h index ae614f09d5..39c56d440d 100644 --- a/lib/dns/include/dns/dbiterator.h +++ b/lib/dns/include/dns/dbiterator.h @@ -60,9 +60,8 @@ ***** Imports *****/ -#include -#include #include +#include #include @@ -86,9 +85,8 @@ typedef struct dns_dbiteratormethods { dns_name_t *name); } dns_dbiteratormethods_t; -#define DNS_DBITERATOR_MAGIC 0x444E5349U /* DNSI. */ -#define DNS_DBITERATOR_VALID(dbi) ((dbi) != NULL && \ - (dbi)->magic == DNS_DBITERATOR_MAGIC) +#define DNS_DBITERATOR_MAGIC 0x444E5349U /* DNSI. */ +#define DNS_DBITERATOR_VALID(dbi) ISC_MAGIC_VALID(dbi, DNS_DBITERATOR_MAGIC) /* * This structure is actually just the common prefix of a DNS db * implementation's version of a dns_dbiterator_t. diff --git a/lib/dns/include/dns/dbtable.h b/lib/dns/include/dns/dbtable.h index dbc4837cb1..b015774850 100644 --- a/lib/dns/include/dns/dbtable.h +++ b/lib/dns/include/dns/dbtable.h @@ -45,7 +45,6 @@ */ #include -#include #include diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h index fa09121907..a60f321063 100644 --- a/lib/dns/include/dns/dispatch.h +++ b/lib/dns/include/dns/dispatch.h @@ -49,10 +49,9 @@ *** Imports ***/ -#include #include +#include #include -#include #include #include diff --git a/lib/dns/include/dns/dnssec.h b/lib/dns/include/dns/dnssec.h index 7a078f68bc..14eb7f85a9 100644 --- a/lib/dns/include/dns/dnssec.h +++ b/lib/dns/include/dns/dnssec.h @@ -18,10 +18,8 @@ #ifndef DNS_DNSSEC_H #define DNS_DNSSEC_H 1 -#include #include #include -#include #include diff --git a/lib/dns/include/dns/fixedname.h b/lib/dns/include/dns/fixedname.h index 237e5ae78a..55f4fa5e7c 100644 --- a/lib/dns/include/dns/fixedname.h +++ b/lib/dns/include/dns/fixedname.h @@ -52,7 +52,6 @@ #include -#include #include /***** diff --git a/lib/dns/include/dns/journal.h b/lib/dns/include/dns/journal.h index e9a8875459..bde3c083f9 100644 --- a/lib/dns/include/dns/journal.h +++ b/lib/dns/include/dns/journal.h @@ -31,11 +31,11 @@ ***/ #include -#include +#include -#include #include #include +#include /*** *** Types @@ -66,8 +66,7 @@ typedef enum { typedef struct dns_difftuple dns_difftuple_t; #define DNS_DIFFTUPLE_MAGIC 0x44494654U /* DIFT. */ -#define DNS_DIFFTUPLE_VALID(t) ((t) != NULL && \ - (t)->magic == DNS_DIFFTUPLE_MAGIC) +#define DNS_DIFFTUPLE_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFFTUPLE_MAGIC) struct dns_difftuple { unsigned int magic; @@ -88,8 +87,7 @@ struct dns_difftuple { typedef struct dns_diff dns_diff_t; #define DNS_DIFF_MAGIC 0x44494646U /* DIFF. */ -#define DNS_DIFF_VALID(t) ((t) != NULL && \ - (t)->magic == DNS_DIFF_MAGIC) +#define DNS_DIFF_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFF_MAGIC) struct dns_diff { unsigned int magic; diff --git a/lib/dns/include/dns/keytable.h b/lib/dns/include/dns/keytable.h index 1ae12beb74..f0bd9632e4 100644 --- a/lib/dns/include/dns/keytable.h +++ b/lib/dns/include/dns/keytable.h @@ -40,7 +40,6 @@ * No anticipated impact. */ -#include #include #include diff --git a/lib/dns/include/dns/master.h b/lib/dns/include/dns/master.h index de8a001349..78f24873d5 100644 --- a/lib/dns/include/dns/master.h +++ b/lib/dns/include/dns/master.h @@ -22,14 +22,11 @@ *** Imports ***/ +#include + #include -#include -#include #include -#include -#include -#include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/masterdump.h b/lib/dns/include/dns/masterdump.h index 1cee176aa9..455cd6551a 100644 --- a/lib/dns/include/dns/masterdump.h +++ b/lib/dns/include/dns/masterdump.h @@ -25,11 +25,8 @@ #include #include -#include #include -#include -#include /*** *** Types @@ -62,8 +59,8 @@ extern const dns_master_style_t dns_master_style_default; isc_result_t dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, - dns_dbversion_t *version, - const dns_master_style_t *style, FILE *f); + dns_dbversion_t *version, + const dns_master_style_t *style, FILE *f); /* * Dump the database 'db' to the steam 'f' in RFC1035 master * file format, in the style defined by 'style' diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index df8c270c18..6b1692972d 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -23,16 +23,11 @@ ***/ #include -#include -#include #include -#include -#include -#include -#include -#include #include +#include +#include #include diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index afdd709126..1c1d3e6835 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -72,13 +72,14 @@ *** Imports ***/ -#include +#include + +#include #include +#include /* Required for storage size of dns_label_t. */ #include -#include - ISC_LANG_BEGINDECLS /***** diff --git a/lib/dns/include/dns/namedconf.h b/lib/dns/include/dns/namedconf.h index 9ec121c4c5..09a9770b27 100644 --- a/lib/dns/include/dns/namedconf.h +++ b/lib/dns/include/dns/namedconf.h @@ -18,17 +18,17 @@ #ifndef DNS_NAMEDCONF_H #define DNS_NAMEDCONF_H 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ +#include /* Contractual promise. */ #endif /* DNS_NAMEDCONF_H */ diff --git a/lib/dns/include/dns/ncache.h b/lib/dns/include/dns/ncache.h index 3ca0fcc2d2..36a5e32a71 100644 --- a/lib/dns/include/dns/ncache.h +++ b/lib/dns/include/dns/ncache.h @@ -44,9 +44,7 @@ */ #include -#include #include -#include #include diff --git a/lib/dns/include/dns/nxt.h b/lib/dns/include/dns/nxt.h index 4c8152c155..2ba5f7ffcf 100644 --- a/lib/dns/include/dns/nxt.h +++ b/lib/dns/include/dns/nxt.h @@ -20,6 +20,8 @@ #include +#include + #define DNS_NXT_BUFFERSIZE (256 + 16) ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/peer.h b/lib/dns/include/dns/peer.h index 6c2e5a1cff..282f9e1472 100644 --- a/lib/dns/include/dns/peer.h +++ b/lib/dns/include/dns/peer.h @@ -30,17 +30,11 @@ *** Imports ***/ -#include - #include -#include -#include +#include #include #include -#include -#include - #define DNS_PEERLIST_MAGIC 0x7365524c /* seRL */ #define DNS_PEER_MAGIC 0x53457276 /* SErv */ diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index 6bd2527a1e..5e22719d7e 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -19,10 +19,8 @@ #define DNS_RBT_H 1 #include -#include #include -#include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h index 7078b269e9..b01e6a920e 100644 --- a/lib/dns/include/dns/rdata.h +++ b/lib/dns/include/dns/rdata.h @@ -92,12 +92,8 @@ ***/ #include -#include #include -#include -#include -#include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h index f0cab6d14d..fcf934d0ee 100644 --- a/lib/dns/include/dns/rdataset.h +++ b/lib/dns/include/dns/rdataset.h @@ -50,10 +50,8 @@ * None. */ -#include -#include #include -#include +#include #include @@ -70,10 +68,8 @@ typedef struct dns_rdatasetmethods { unsigned int (*count)(dns_rdataset_t *rdataset); } dns_rdatasetmethods_t; -#define DNS_RDATASET_MAGIC 0x444E5352U /* DNSR. */ -#define DNS_RDATASET_VALID(rdataset) ((rdataset) != NULL && \ - (rdataset)->magic == \ - DNS_RDATASET_MAGIC) +#define DNS_RDATASET_MAGIC 0x444E5352U /* DNSR. */ +#define DNS_RDATASET_VALID(set) ISC_MAGIC_VALID(set, DNS_RDATASET_MAGIC) /* * Direct use of this structure by clients is strongly discouraged, except diff --git a/lib/dns/include/dns/rdatasetiter.h b/lib/dns/include/dns/rdatasetiter.h index a1d5341f68..16274ba5cd 100644 --- a/lib/dns/include/dns/rdatasetiter.h +++ b/lib/dns/include/dns/rdatasetiter.h @@ -60,9 +60,8 @@ ***** Imports *****/ -#include -#include #include +#include #include #include @@ -81,10 +80,8 @@ typedef struct dns_rdatasetitermethods { dns_rdataset_t *rdataset); } dns_rdatasetitermethods_t; -#define DNS_RDATASETITER_MAGIC 0x444E5369U /* DNSi. */ -#define DNS_RDATASETITER_VALID(dbi) ((dbi) != NULL && \ - (dbi)->magic == \ - DNS_RDATASETITER_MAGIC) +#define DNS_RDATASETITER_MAGIC 0x444E5369U /* DNSi. */ +#define DNS_RDATASETITER_VALID(i) ISC_MAGIC_VALID(i, DNS_RDATASETITER_MAGIC) /* * This structure is actually just the common prefix of a DNS db diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h index 1ff3d73bfc..cef913e349 100644 --- a/lib/dns/include/dns/rdataslab.h +++ b/lib/dns/include/dns/rdataslab.h @@ -47,7 +47,6 @@ *** Imports ***/ -#include #include #include diff --git a/lib/dns/include/dns/request.h b/lib/dns/include/dns/request.h index bf97c4bad6..51b103b97d 100644 --- a/lib/dns/include/dns/request.h +++ b/lib/dns/include/dns/request.h @@ -39,7 +39,6 @@ * No anticipated impact. */ -#include #include #include @@ -47,14 +46,14 @@ #define DNS_REQUESTOPT_TCP 0x00000001U -ISC_LANG_BEGINDECLS - typedef struct dns_requestevent { ISC_EVENT_COMMON(struct dns_requestevent); isc_result_t result; dns_request_t *request; } dns_requestevent_t; +ISC_LANG_BEGINDECLS + isc_result_t dns_requestmgr_create(isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h index e405ace453..804578d4c0 100644 --- a/lib/dns/include/dns/resolver.h +++ b/lib/dns/include/dns/resolver.h @@ -45,13 +45,10 @@ * Drafts: */ -#include #include -#include #include #include -#include #include ISC_LANG_BEGINDECLS @@ -80,11 +77,11 @@ typedef struct dns_fetchevent { /* * Options that modify how a 'fetch' is done. */ -#define DNS_FETCHOPT_TCP 0x01 /* Use TCP. */ -#define DNS_FETCHOPT_UNSHARED 0x02 /* See below. */ -#define DNS_FETCHOPT_RECURSIVE 0x04 /* Set RD? */ -#define DNS_FETCHOPT_NOEDNS0 0x08 /* Do not use EDNS. */ -#define DNS_FETCHOPT_FORWARDONLY 0x10 /* only use forwarders */ +#define DNS_FETCHOPT_TCP 0x01 /* Use TCP. */ +#define DNS_FETCHOPT_UNSHARED 0x02 /* See below. */ +#define DNS_FETCHOPT_RECURSIVE 0x04 /* Set RD? */ +#define DNS_FETCHOPT_NOEDNS0 0x08 /* Do not use EDNS. */ +#define DNS_FETCHOPT_FORWARDONLY 0x10 /* Only use forwarders. */ /* * XXXRTH Should this API be made semi-private? (I.e. diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h index fe2bc2bc2c..37f0f91990 100644 --- a/lib/dns/include/dns/result.h +++ b/lib/dns/include/dns/result.h @@ -29,7 +29,7 @@ * the ISC result codes, so including this file buys you the ISC_R_ * namespace too. */ -#include +#include /* Contractual promise. */ /* * DNS library result codes diff --git a/lib/dns/include/dns/ssu.h b/lib/dns/include/dns/ssu.h index 9fce445d22..c4c351393a 100644 --- a/lib/dns/include/dns/ssu.h +++ b/lib/dns/include/dns/ssu.h @@ -18,10 +18,7 @@ #ifndef DNS_SSU_H #define DNS_SSU_H 1 -#include #include -#include -#include #include diff --git a/lib/dns/include/dns/tcpmsg.h b/lib/dns/include/dns/tcpmsg.h index 205467a0c5..e253d2a0fe 100644 --- a/lib/dns/include/dns/tcpmsg.h +++ b/lib/dns/include/dns/tcpmsg.h @@ -19,10 +19,10 @@ #define DNS_TCPMSG_H 1 #include -#include +#include #include -typedef struct { +typedef struct dns_tcpmsg { /* private (don't touch!) */ unsigned int magic; isc_uint16_t size; @@ -39,6 +39,8 @@ typedef struct { isc_sockaddr_t address; } dns_tcpmsg_t; +ISC_LANG_BEGINDECLS + void dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg); /* @@ -136,4 +138,6 @@ dns_tcpmsg_invalidate(dns_tcpmsg_t *tcpmsg); * sockets, etc. */ +ISC_LANG_ENDDECLS + #endif /* DNS_TCPMSG_H */ diff --git a/lib/dns/include/dns/time.h b/lib/dns/include/dns/time.h index b9be33ef23..9c3d88fb91 100644 --- a/lib/dns/include/dns/time.h +++ b/lib/dns/include/dns/time.h @@ -22,9 +22,8 @@ *** Imports ***/ -#include -#include #include +#include ISC_LANG_BEGINDECLS @@ -32,27 +31,31 @@ ISC_LANG_BEGINDECLS *** Functions ***/ -isc_result_t dns_time64_fromtext(char *source, isc_int64_t *target); +isc_result_t +dns_time64_fromtext(char *source, isc_int64_t *target); /* * Convert a date and time in YYYYMMDDHHMMSS text format at 'source' * into to a 64-bit count of seconds since Jan 1 1970 0:00 GMT. * Store the count at 'target'. */ -isc_result_t dns_time32_fromtext(char *source, isc_uint32_t *target); +isc_result_t +dns_time32_fromtext(char *source, isc_uint32_t *target); /* * Like dns_time64_fromtext, but returns the second count modulo 2^32 * as per RFC2535. */ -isc_result_t dns_time64_totext(isc_int64_t value, isc_buffer_t *target); +isc_result_t +dns_time64_totext(isc_int64_t value, isc_buffer_t *target); /* * Convert a 64-bit count of seconds since Jan 1 1970 0:00 GMT into * a YYYYMMDDHHMMSS text representation and append it to 'target'. */ -isc_result_t dns_time32_totext(isc_uint32_t value, isc_buffer_t *target); +isc_result_t +dns_time32_totext(isc_uint32_t value, isc_buffer_t *target); /* * Like dns_time64_totext, but for a 32-bit cyclic time value. * Of those dates whose counts of seconds since Jan 1 1970 0:00 GMT diff --git a/lib/dns/include/dns/tkey.h b/lib/dns/include/dns/tkey.h index 3ed6b04c43..bc4e4a8728 100644 --- a/lib/dns/include/dns/tkey.h +++ b/lib/dns/include/dns/tkey.h @@ -18,11 +18,9 @@ #ifndef DNS_TKEY_H #define DNS_TKEY_H 1 -#include #include #include -#include #include diff --git a/lib/dns/include/dns/tkeyconf.h b/lib/dns/include/dns/tkeyconf.h index 165885156c..1c49a7caa8 100644 --- a/lib/dns/include/dns/tkeyconf.h +++ b/lib/dns/include/dns/tkeyconf.h @@ -21,13 +21,13 @@ #include #include -#include #include ISC_LANG_BEGINDECLS isc_result_t -dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, dns_tkey_ctx_t **tctxp); +dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, + dns_tkey_ctx_t **tctxp); /* * Create a TKEY context and configure it, including the default DH key * and default domain, according to 'cfg'. diff --git a/lib/dns/include/dns/tsig.h b/lib/dns/include/dns/tsig.h index 8a99a68fc2..b301ac67a1 100644 --- a/lib/dns/include/dns/tsig.h +++ b/lib/dns/include/dns/tsig.h @@ -18,7 +18,6 @@ #ifndef DNS_TSIG_H #define DNS_TSIG_H 1 -#include #include #include #include @@ -28,14 +27,16 @@ #include -ISC_LANG_BEGINDECLS - -/* Standard algorithm */ +/* + * Standard algorithm. + */ #define DNS_TSIG_HMACMD5 "HMAC-MD5.SIG-ALG.REG.INT." extern dns_name_t *dns_tsig_hmacmd5_name; #define DNS_TSIG_HMACMD5_NAME dns_tsig_hmacmd5_name -/* Default fudge value. */ +/* + * Default fudge value. + */ #define DNS_TSIG_FUDGE 300 struct dns_tsig_keyring { @@ -68,6 +69,8 @@ struct dns_tsigkey { #define dns_tsigkey_identity(tsigkey) \ ((tsigkey)->generated ? ((tsigkey)->creator) : (&((tsigkey)->name))) +ISC_LANG_BEGINDECLS + isc_result_t dns_tsigkey_create(dns_name_t *name, dns_name_t *algorithm, unsigned char *secret, int length, isc_boolean_t generated, diff --git a/lib/dns/include/dns/tsigconf.h b/lib/dns/include/dns/tsigconf.h index c43067f68a..d97c9c94c0 100644 --- a/lib/dns/include/dns/tsigconf.h +++ b/lib/dns/include/dns/tsigconf.h @@ -21,7 +21,6 @@ #include #include -#include #include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/ttl.h b/lib/dns/include/dns/ttl.h index 9cb238c275..c83e10804e 100644 --- a/lib/dns/include/dns/ttl.h +++ b/lib/dns/include/dns/ttl.h @@ -22,8 +22,8 @@ *** Imports ***/ +#include #include -#include ISC_LANG_BEGINDECLS diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index b2686bef82..7c397ff55f 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -4,7 +4,7 @@ * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE @@ -27,85 +27,77 @@ */ #include -#include -#include - -ISC_LANG_BEGINDECLS +typedef struct dns_a6context dns_a6context_t; +typedef struct dns_acl dns_acl_t; +typedef struct dns_aclelement dns_aclelement_t; +typedef struct dns_aclenv dns_aclenv_t; +typedef struct dns_adb dns_adb_t; +typedef struct dns_adbaddrinfo dns_adbaddrinfo_t; +typedef ISC_LIST(dns_adbaddrinfo_t) dns_adbaddrinfolist_t; +typedef struct dns_adbentry dns_adbentry_t; +typedef struct dns_adbfind dns_adbfind_t; +typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t; +typedef struct dns_byaddr dns_byaddr_t; +typedef struct dns_cache dns_cache_t; +typedef isc_uint16_t dns_cert_t; +typedef struct dns_compress dns_compress_t; +typedef struct dns_db dns_db_t; +typedef struct dns_dbiterator dns_dbiterator_t; +typedef void dns_dbload_t; +typedef void dns_dbnode_t; +typedef struct dns_dbtable dns_dbtable_t; +typedef void dns_dbversion_t; +typedef struct dns_decompress dns_decompress_t; +typedef struct dns_dispatch dns_dispatch_t; +typedef struct dns_dispatchevent dns_dispatchevent_t; +typedef struct dns_dispentry dns_dispentry_t; +typedef struct dns_fetch dns_fetch_t; +typedef struct dns_fixedname dns_fixedname_t; +typedef struct dns_forwarders dns_forwarders_t; +typedef isc_uint16_t dns_keyflags_t; +typedef struct dns_keynode dns_keynode_t; +typedef struct dns_keytable dns_keytable_t; +typedef isc_uint16_t dns_keytag_t; +typedef struct dns_message dns_message_t; +typedef isc_uint16_t dns_messageid_t; typedef isc_region_t dns_label_t; typedef struct dns_name dns_name_t; typedef ISC_LIST(dns_name_t) dns_namelist_t; -typedef struct dns_fixedname dns_fixedname_t; -typedef struct dns_db dns_db_t; -typedef void dns_dbnode_t; -typedef void dns_dbload_t; -typedef void dns_dbversion_t; -typedef struct dns_dbiterator dns_dbiterator_t; -typedef unsigned char dns_offsets_t[128]; -typedef struct dns_compress dns_compress_t; -typedef struct dns_decompress dns_decompress_t; -typedef isc_uint8_t dns_secalg_t; -typedef isc_uint8_t dns_secproto_t; -typedef isc_uint16_t dns_keyflags_t; -typedef isc_uint16_t dns_keytag_t; -typedef isc_uint16_t dns_rdataclass_t; -typedef isc_uint16_t dns_rdatatype_t; -typedef isc_uint16_t dns_rcode_t; typedef isc_uint16_t dns_opcode_t; -typedef isc_uint16_t dns_cert_t; -typedef isc_uint32_t dns_ttl_t; +typedef unsigned char dns_offsets_t[128]; +typedef struct dns_peer dns_peer_t; +typedef struct dns_peerlist dns_peerlist_t; +typedef struct dns_rbt dns_rbt_t; +typedef isc_uint16_t dns_rcode_t; typedef struct dns_rdata dns_rdata_t; +typedef struct dns_rdatacallbacks dns_rdatacallbacks_t; +typedef isc_uint16_t dns_rdataclass_t; typedef struct dns_rdatalist dns_rdatalist_t; -typedef struct dns_signature dns_signature_t; typedef struct dns_rdataset dns_rdataset_t; typedef ISC_LIST(dns_rdataset_t) dns_rdatasetlist_t; typedef struct dns_rdatasetiter dns_rdatasetiter_t; -typedef struct dns_dbtable dns_dbtable_t; +typedef isc_uint16_t dns_rdatatype_t; +typedef struct dns_request dns_request_t; +typedef struct dns_requestmgr dns_requestmgr_t; typedef struct dns_resolver dns_resolver_t; -typedef struct dns_fetch dns_fetch_t; -typedef struct dns_adb dns_adb_t; -typedef struct dns_adbentry dns_adbentry_t; -typedef struct dns_adbaddrinfo dns_adbaddrinfo_t; -typedef ISC_LIST(dns_adbaddrinfo_t) dns_adbaddrinfolist_t; -typedef struct dns_adbfind dns_adbfind_t; -typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t; -typedef struct dns_forwarders dns_forwarders_t; -typedef struct dns_message dns_message_t; -typedef isc_uint16_t dns_messageid_t; -typedef isc_uint16_t dns_trust_t; -typedef struct dns_dispatch dns_dispatch_t; -typedef struct dns_dispentry dns_dispentry_t; -typedef struct dns_dispatchevent dns_dispatchevent_t; -typedef struct dns_tsigkey dns_tsigkey_t; -typedef struct dns_tsig_keyring dns_tsig_keyring_t; +typedef isc_uint8_t dns_secalg_t; +typedef isc_uint8_t dns_secproto_t; +typedef struct dns_signature dns_signature_t; +typedef struct dns_ssurule dns_ssurule_t; +typedef struct dns_ssutable dns_ssutable_t; typedef struct dns_tkey_ctx dns_tkey_ctx_t; +typedef isc_uint16_t dns_trust_t; +typedef struct dns_tsig_keyring dns_tsig_keyring_t; +typedef struct dns_tsigkey dns_tsigkey_t; +typedef isc_uint32_t dns_ttl_t; +typedef struct dns_validator dns_validator_t; typedef struct dns_view dns_view_t; typedef ISC_LIST(dns_view_t) dns_viewlist_t; +typedef struct dns_xfrinlist dns_xfrinlist_t; typedef struct dns_zone dns_zone_t; typedef struct dns_zonemgr dns_zonemgr_t; -typedef struct dns_a6context dns_a6context_t; -typedef struct dns_rbt dns_rbt_t; typedef struct dns_zt dns_zt_t; -typedef struct dns_cache dns_cache_t; -typedef struct dns_aclelement dns_aclelement_t; -typedef struct dns_acl dns_acl_t; -typedef struct dns_aclenv dns_aclenv_t; -typedef struct dns_byaddr dns_byaddr_t; -typedef struct dns_ssutable dns_ssutable_t; -typedef struct dns_ssurule dns_ssurule_t; -typedef struct dns_validator dns_validator_t; -typedef struct dns_keytable dns_keytable_t; -typedef struct dns_keynode dns_keynode_t; -typedef struct dns_peer dns_peer_t; -typedef struct dns_peerlist dns_peerlist_t; -typedef struct dns_xfrinlist dns_xfrinlist_t; -typedef struct dns_requestmgr dns_requestmgr_t; -typedef struct dns_request dns_request_t; - -typedef enum { - dns_labeltype_ordinary = 0, - dns_labeltype_bitstring = 1 -} dns_labeltype_t; typedef enum { dns_bitlabel_0 = 0, @@ -113,8 +105,15 @@ typedef enum { } dns_bitlabel_t; typedef enum { - dns_one_answer, dns_many_answers -} dns_transfer_format_t; + dns_fwdpolicy_none = 0, + dns_fwdpolicy_first = 1, + dns_fwdpolicy_only = 2 +} dns_fwdpolicy_t; + +typedef enum { + dns_labeltype_ordinary = 0, + dns_labeltype_bitstring = 1 +} dns_labeltype_t; typedef enum { dns_namereln_none = 0, @@ -125,16 +124,14 @@ typedef enum { } dns_namereln_t; typedef enum { - dns_fwdpolicy_none = 0, - dns_fwdpolicy_first = 1, - dns_fwdpolicy_only = 2 -} dns_fwdpolicy_t; + dns_one_answer, dns_many_answers +} dns_transfer_format_t; #include enum { dns_rdatatype_none = 0, - TYPEENUM + DNS_TYPEENUM dns_rdatatype_ixfr = 251, dns_rdatatype_axfr = 252, dns_rdatatype_mailb = 253, @@ -144,16 +141,18 @@ enum { #include enum { - CLASSENUM + DNS_CLASSENUM dns_rdataclass_ch = 3, dns_rdataclass_none = 254 /* RFC2136 */ }; /* - * rcodes + * rcodes. */ enum { - /* standard rcodes */ + /* + * Standard rcodes. + */ dns_rcode_noerror = 0, dns_rcode_formerr = 1, dns_rcode_servfail = 2, @@ -165,12 +164,14 @@ enum { dns_rcode_nxrrset = 8, dns_rcode_notauth = 9, dns_rcode_notzone = 10, - /* extended rcodes */ + /* + * Extended rcodes. + */ dns_rcode_badvers = 16 }; /* - * TSIG errors + * TSIG errors. */ enum { dns_tsigerror_badsig = 16, @@ -182,7 +183,7 @@ enum { }; /* - * Opcodes + * Opcodes. */ enum { dns_opcode_query = 0, @@ -220,7 +221,6 @@ typedef enum { /* * Functions. */ - typedef isc_result_t (*dns_addrdatasetfunc_t)(void *, dns_name_t *, dns_rdataset_t *); @@ -233,6 +233,4 @@ typedef isc_result_t typedef void (*dns_xfrindone_t)(dns_zone_t *, isc_result_t); -ISC_LANG_ENDDECLS - #endif /* DNS_TYPES_H */ diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index cf6f25a914..5b969b56b1 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -60,8 +60,8 @@ * None. */ #include +#include #include -#include #include #include @@ -116,8 +116,7 @@ struct dns_view { }; #define DNS_VIEW_MAGIC 0x56696577 /* View. */ -#define DNS_VIEW_VALID(view) ((view) != NULL && \ - (view)->magic == DNS_VIEW_MAGIC) +#define DNS_VIEW_VALID(view) ISC_MAGIC_VALID(view, DNS_VIEW_MAGIC) #define DNS_VIEWATTR_RESSHUTDOWN 0x01 #define DNS_VIEWATTR_ADBSHUTDOWN 0x02 diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 87241c6af7..a545c6940e 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -22,15 +22,11 @@ *** Imports ***/ +#include + #include #include -#include -#include -#include -#include -#include -#include #include typedef enum { diff --git a/lib/dns/include/dns/zoneconf.h b/lib/dns/include/dns/zoneconf.h index 064e772a95..d3bf66a91c 100644 --- a/lib/dns/include/dns/zoneconf.h +++ b/lib/dns/include/dns/zoneconf.h @@ -18,19 +18,16 @@ #ifndef DNS_ZONECONF_H #define DNS_ZONECONF_H 1 -#include +#include #include -#include #include -#include -#include -#include -#include -isc_result_t dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, - dns_c_zone_t *czone, dns_aclconfctx_t *ac, - dns_zone_t *zone); +ISC_LANG_BEGINDECLS + +isc_result_t +dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_c_zone_t *czone, + dns_aclconfctx_t *ac, dns_zone_t *zone); /* * Configure or reconfigure a zone according to the named.conf * data in 'cctx' and 'czone'. diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h index 9175425257..b2a8050757 100644 --- a/lib/dns/include/dns/zt.h +++ b/lib/dns/include/dns/zt.h @@ -20,16 +20,14 @@ #include -#include -#include #include -ISC_LANG_BEGINDECLS - #define DNS_ZTFIND_NOEXACT 0x01 -isc_result_t dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, - dns_zt_t **zt); +ISC_LANG_BEGINDECLS + +isc_result_t +dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt); /* * Creates a new zone table. * @@ -41,8 +39,8 @@ isc_result_t dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, * ISC_R_NOMEMORY */ -isc_result_t dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone); - +isc_result_t +dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone); /* * Mounts the zone on the zone table. * @@ -57,8 +55,8 @@ isc_result_t dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone); * ISC_R_NOMEMORY */ -isc_result_t dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone); - +isc_result_t +dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone); /* * Unmount the given zone from the table. * @@ -72,9 +70,9 @@ isc_result_t dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone); * ISC_R_NOMEMORY */ -isc_result_t dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options, - dns_name_t *foundname, dns_zone_t **zone); - +isc_result_t +dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options, + dns_name_t *foundname, dns_zone_t **zone); /* * Find the best match for 'name' in 'zt'. If foundname is non NULL * then the name of the zone found is returned. @@ -96,8 +94,8 @@ isc_result_t dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options, * ISC_R_NOSPACE */ -void dns_zt_detach(dns_zt_t **ztp); - +void +dns_zt_detach(dns_zt_t **ztp); /* * Detach the given zonetable, if the reference count goes to zero the * zonetable will be freed. In either case 'ztp' is set to NULL. @@ -106,8 +104,8 @@ void dns_zt_detach(dns_zt_t **ztp); * '*ztp' to be valid */ -void dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); - +void +dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); /* * Attach 'zt' to '*ztp'. * @@ -116,8 +114,8 @@ void dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); * '*ztp' to be NULL */ -isc_result_t dns_zt_load(dns_zt_t *zt, isc_boolean_t stop); - +isc_result_t +dns_zt_load(dns_zt_t *zt, isc_boolean_t stop); /* * Load all zones in the table. If 'stop' is ISC_TRUE, * stop on the first error and return it. If 'stop' @@ -127,9 +125,8 @@ isc_result_t dns_zt_load(dns_zt_t *zt, isc_boolean_t stop); * 'zt' to be valid */ - -void dns_zt_print(dns_zt_t *zt); - +void +dns_zt_print(dns_zt_t *zt); /* * Print zones in zonetable, address, name and reference count. * @@ -140,7 +137,6 @@ void dns_zt_print(dns_zt_t *zt); isc_result_t dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t (*action)(dns_zone_t *, void *), void *uap); - /* * Apply a given 'action' to all zone zones in the table. * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 70b60e7bcb..22fc6b0211 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -17,33 +17,24 @@ #include -#include +#include #include #include -#include -#include -#include -#include -#include #include -#include -#include -#include +#include #include +#include #include #include #include #include #include -#include -#include #include #include #include #include -#include /* * When true, accept IXFR difference sequences where the @@ -634,8 +625,11 @@ dns_diff_print(dns_diff_t *diff, FILE *file) { result = dns_rdataset_totext(&rds, &t->name, ISC_FALSE, ISC_FALSE, &buf); - /* Get rid of final newline. */ - INSIST(buf.used >= 1 && ((char *) buf.base)[buf.used-1] == '\n'); + /* + * Get rid of final newline. + */ + INSIST(buf.used >= 1 && + ((char *) buf.base)[buf.used-1] == '\n'); buf.used--; if (result == ISC_R_NOSPACE) { @@ -866,26 +860,22 @@ struct dns_journal { }; #define DNS_JOURNAL_MAGIC 0x4a4f5552U /* JOUR. */ -#define DNS_JOURNAL_VALID(t) ((t) != NULL && \ - (t)->magic == DNS_JOURNAL_MAGIC) +#define DNS_JOURNAL_VALID(t) ISC_MAGIC_VALID(t, DNS_JOURNAL_MAGIC) static void -journal_pos_decode(journal_rawpos_t *raw, journal_pos_t *cooked) -{ +journal_pos_decode(journal_rawpos_t *raw, journal_pos_t *cooked) { cooked->serial = decode_uint32(raw->serial); cooked->offset = decode_uint32(raw->offset); } static void -journal_pos_encode(journal_rawpos_t *raw, journal_pos_t *cooked) -{ +journal_pos_encode(journal_rawpos_t *raw, journal_pos_t *cooked) { encode_uint32(cooked->serial, raw->serial); encode_uint32(cooked->offset, raw->offset); } static void -journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) -{ +journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) { INSIST(sizeof(cooked->format) == sizeof(raw->h.format)); memcpy(cooked->format, raw->h.format, sizeof(cooked->format)); journal_pos_decode(&raw->h.begin, &cooked->begin); @@ -894,8 +884,7 @@ journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) } static void -journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) -{ +journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) { INSIST(sizeof(cooked->format) == sizeof(raw->h.format)); memset(raw->pad, 0, sizeof(raw->pad)); memcpy(raw->h.format, cooked->format, sizeof(raw->h.format)); @@ -904,7 +893,6 @@ journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) encode_uint32(cooked->index_size, raw->h.index_size); } - /* Journal file I/O subroutines, with error checking and reporting. */ /* @@ -985,7 +973,9 @@ journal_fsync(dns_journal_t *j) { return (ISC_R_SUCCESS); } -/* Read/write a transaction header at the current file position. */ +/* + * Read/write a transaction header at the current file position. + */ static isc_result_t journal_read_xhdr(dns_journal_t *j, journal_xhdr_t *xhdr) { @@ -1012,7 +1002,9 @@ journal_write_xhdr(dns_journal_t *j, isc_uint32_t size, } -/* Read an RR header at the current file position. */ +/* + * Read an RR header at the current file position. + */ static isc_result_t journal_read_rrhdr(dns_journal_t *j, journal_rrhdr_t *rrhdr) { @@ -1131,7 +1123,9 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, j->fp = fp; - /* Set magic early so that seek/read can succeed. */ + /* + * Set magic early so that seek/read can succeed. + */ j->magic = DNS_JOURNAL_MAGIC; CHECK(journal_seek(j, 0)); @@ -1179,8 +1173,9 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, } j->offset = -1; /* Invalid, must seek explicitly. */ - /* Initialize the iterator. */ - + /* + * Initialize the iterator. + */ dns_name_init(&j->it.name, NULL); dns_rdata_init(&j->it.rdata); @@ -1225,8 +1220,7 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, * rdataset merging it has to do. */ static int -ixfr_order(const void *av, const void *bv) -{ +ixfr_order(const void *av, const void *bv) { dns_difftuple_t * const *ap = av; dns_difftuple_t * const *bp = bv; dns_difftuple_t *a = *ap; @@ -1280,7 +1274,9 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) { if (result != ISC_R_SUCCESS) return (result); - /* Check serial number consistency. */ + /* + * Check serial number consistency. + */ if (xhdr.serial0 != pos->serial) { isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, "%s: journal file corrupt: " @@ -1290,7 +1286,9 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) { return (ISC_R_UNEXPECTED); } - /* Check for offset wraparound. */ + /* + * Check for offset wraparound. + */ if (pos->offset + xhdr.size < pos->offset) { isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, "%s: offset too large", @@ -1303,7 +1301,6 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) { return (ISC_R_SUCCESS); } - /* * If the index of the journal 'j' contains an entry "better" * than '*best_guess', replace '*best_guess' with it. @@ -1338,14 +1335,18 @@ index_add(dns_journal_t *j, journal_pos_t *pos) { unsigned int i; if (j->index == NULL) return; - /* Search for a vacant position. */ + /* + * Search for a vacant position. + */ for (i = 0; i < j->header.index_size; i++) { if (! POS_VALID(j->index[i])) break; } if (i == j->header.index_size) { unsigned int k = 0; - /* Found no vacant position. Make some room. */ + /* + * Found no vacant position. Make some room. + */ for (i = 0; i < j->header.index_size; i += 2) { j->index[k++] = j->index[i]; } @@ -1358,7 +1359,9 @@ index_add(dns_journal_t *j, journal_pos_t *pos) { INSIST(i < j->header.index_size); INSIST(! POS_VALID(j->index[i])); - /* Store the new index entry. */ + /* + * Store the new index entry. + */ j->index[i] = *pos; } @@ -1367,8 +1370,7 @@ index_add(dns_journal_t *j, journal_pos_t *pos) { * ambiguous when a new transaction with number 'serial' is added. */ static void -index_invalidate(dns_journal_t *j, isc_uint32_t serial) -{ +index_invalidate(dns_journal_t *j, isc_uint32_t serial) { unsigned int i; if (j->index == NULL) return; @@ -1513,10 +1515,14 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) { for (t = ISC_LIST_HEAD(diff->tuples); t != NULL; t = ISC_LIST_NEXT(t, link)) { - /* Write the RR header */ + /* + * Write the RR header. + */ isc_buffer_putuint32(&buffer, t->name.length + 10 + t->rdata.length); - /* Write the owner name, RR header, and RR data. */ + /* + * Write the owner name, RR header, and RR data. + */ isc_buffer_putmem(&buffer, t->name.ndata, t->name.length); isc_buffer_putuint16(&buffer, t->rdata.type); isc_buffer_putuint16(&buffer, t->rdata.rdclass); @@ -1532,7 +1538,9 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) { j->x.pos[1].offset += used.length; - /* Write the buffer contents to the journal file. */ + /* + * Write the buffer contents to the journal file. + */ CHECK(journal_write(j, used.base, used.length)); result = ISC_R_SUCCESS; @@ -1553,7 +1561,9 @@ dns_journal_commit(dns_journal_t *j) { REQUIRE(DNS_JOURNAL_VALID(j)); REQUIRE(j->state == JOURNAL_STATE_TRANSACTION); - /* Perform some basic consistency checks. */ + /* + * Perform some basic consistency checks. + */ if (j->x.n_soa != 2) { isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, "malformed transaction: %d SOAs", @@ -1601,16 +1611,22 @@ dns_journal_commit(dns_journal_t *j) { } #endif - /* Commit the transaction data to stable storage. */ + /* + * Commit the transaction data to stable storage. + */ CHECK(journal_fsync(j)); - /* Update the transaction header. */ + /* + * Update the transaction header. + */ CHECK(journal_seek(j, j->x.pos[0].offset)); CHECK(journal_write_xhdr(j, (j->x.pos[1].offset - j->x.pos[0].offset) - sizeof(journal_rawxhdr_t), j->x.pos[0].serial, j->x.pos[1].serial)); - /* Update the journal header. */ + /* + * Update the journal header. + */ if (JOURNAL_EMPTY(&j->header)) { j->header.begin = j->x.pos[0]; } @@ -1619,7 +1635,9 @@ dns_journal_commit(dns_journal_t *j) { CHECK(journal_seek(j, 0)); CHECK(journal_write(j, &rawheader, sizeof(rawheader))); - /* Update the index. Byte swap in-place if necessary. */ + /* + * Update the index. Byte swap in-place if necessary. + */ index_add(j, &j->x.pos[0]); if (j->header.index_size != 0) { unsigned int i; @@ -1631,16 +1649,22 @@ dns_journal_commit(dns_journal_t *j) { sizeof(journal_rawpos_t))); } - /* Commit the header to stable storage. */ + /* + * Commit the header to stable storage. + */ CHECK(journal_fsync(j)); - /* Undo the byte swapping. */ + /* + * Undo the byte swapping. + */ for (i = 0; i < j->header.index_size; i++) { j->index[i].serial = ntohl(j->index[i].serial); j->index[i].offset = ntohl(j->index[i].offset); } - /* We no longer have a transaction open. */ + /* + * We no longer have a transaction open. + */ j->state = JOURNAL_STATE_WRITE; result = ISC_R_SUCCESS; @@ -1717,13 +1741,19 @@ roll_forward(dns_journal_t *j, dns_db_t *db) { isc_buffer_init(&source, NULL, 0); isc_buffer_init(&target, NULL, 0); - /* Create the new database version. */ + /* + * Create the new database version. + */ CHECK(dns_db_newversion(db, &ver)); - /* Get the current database SOA serial number. */ + /* + * Get the current database SOA serial number. + */ CHECK(dns_db_getsoaserial(db, ver, &db_serial)); - /* Locate a journal entry for the current database serial. */ + /* + * Locate a journal entry for the current database serial. + */ CHECK(journal_find(j, db_serial, &pos)); /* * XXX do more drastic things, like marking zone stale, @@ -2005,8 +2035,7 @@ dns_journal_iter_init(dns_journal_t *j, isc_result_t -dns_journal_first_rr(dns_journal_t *j) -{ +dns_journal_first_rr(dns_journal_t *j) { isc_result_t result; /* @@ -2066,7 +2095,9 @@ read_one_rr(dns_journal_t *j) { j->it.xsize = xhdr.size; j->it.xpos = 0; } - /* Read an RR. */ + /* + * Read an RR. + */ result = journal_read_rrhdr(j, &rrhdr); /* * Perform a sanity check on the journal RR size. @@ -2104,7 +2135,9 @@ read_one_rr(dns_journal_t *j) { CHECK(dns_name_fromwire(&j->it.name, &j->it.source, &j->it.dctx, ISC_FALSE, &j->it.target)); - /* Check that the RR header is there, and parse it. */ + /* + * Check that the RR header is there, and parse it. + */ if (isc_buffer_remaininglength(&j->it.source) < 10) FAIL(DNS_R_FORMERR); @@ -2113,7 +2146,9 @@ read_one_rr(dns_journal_t *j) { ttl = isc_buffer_getuint32(&j->it.source); rdlen = isc_buffer_getuint16(&j->it.source); - /* Parse the rdata. */ + /* + * Parse the rdata. + */ isc_buffer_setactive(&j->it.source, rdlen); CHECK(dns_rdata_fromwire(&j->it.rdata, rdclass, rdtype, &j->it.source, &j->it.dctx, @@ -2230,8 +2265,7 @@ get_name_diff(dns_db_t *db, dns_dbversion_t *ver, isc_stdtime_t now, * it is known to be the same for all tuples. */ static int -rdata_order(const void *av, const void *bv) -{ +rdata_order(const void *av, const void *bv) { dns_difftuple_t * const *ap = av; dns_difftuple_t * const *bp = bv; dns_difftuple_t *a = *ap; @@ -2245,8 +2279,7 @@ rdata_order(const void *av, const void *bv) } static isc_result_t -dns_diff_subtract(dns_diff_t diff[2], dns_diff_t *r) -{ +dns_diff_subtract(dns_diff_t diff[2], dns_diff_t *r) { isc_result_t result; dns_difftuple_t *p[2]; int i, t; diff --git a/lib/dns/keytable.c b/lib/dns/keytable.c index 2293ab0d17..430bafbfdc 100644 --- a/lib/dns/keytable.c +++ b/lib/dns/keytable.c @@ -17,22 +17,15 @@ #include -#include -#include - -#include -#include +#include #include #include #include #include -#include #include #include -#include - struct dns_keytable { /* Unlocked. */ unsigned int magic; @@ -315,8 +308,7 @@ dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name, } void -dns_keytable_detachkeynode(dns_keytable_t *keytable, - dns_keynode_t **keynodep) +dns_keytable_detachkeynode(dns_keytable_t *keytable, dns_keynode_t **keynodep) { /* * Give back a keynode found via dns_keytable_findkeynode(). diff --git a/lib/dns/lib.c b/lib/dns/lib.c index 391a41c0c4..cfc5a27897 100644 --- a/lib/dns/lib.c +++ b/lib/dns/lib.c @@ -17,10 +17,7 @@ #include -#include - #include -#include #include #include diff --git a/lib/dns/log.c b/lib/dns/log.c index 9ff513c7d2..2606c993fa 100644 --- a/lib/dns/log.c +++ b/lib/dns/log.c @@ -15,19 +15,15 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.20 2000/05/03 21:11:38 explorer Exp $ */ +/* $Id: log.c,v 1.21 2000/05/08 14:34:41 tale Exp $ */ /* Principal Authors: DCL */ #include -#include -#include -#include #include #include -#include /* * When adding a new category, be sure to add the appropriate @@ -75,8 +71,7 @@ isc_logmodule_t dns_modules[] = { isc_log_t *dns_lctx = NULL; void -dns_log_init(isc_log_t *lctx) -{ +dns_log_init(isc_log_t *lctx) { REQUIRE(lctx != NULL); isc_log_registercategories(lctx, dns_categories); @@ -84,8 +79,7 @@ dns_log_init(isc_log_t *lctx) } void -dns_log_setcontext(isc_log_t *lctx) -{ +dns_log_setcontext(isc_log_t *lctx) { REQUIRE(dns_lctx == NULL); dns_lctx = lctx; diff --git a/lib/dns/master.c b/lib/dns/master.c index 19fc812d63..d1a8626105 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,32 +15,25 @@ * SOFTWARE. */ -/* $Id: master.c,v 1.51 2000/04/28 23:15:24 gson Exp $ */ +/* $Id: master.c,v 1.52 2000/05/08 14:34:42 tale Exp $ */ #include -#include -#include -#include -#include -#include - #include -#include #include -#include -#include #include +#include #include +#include #include -#include -#include +#include +#include +#include #include #include -#include #include -#include +#include #include #include @@ -92,24 +85,29 @@ typedef struct { isc_boolean_t warn_1035; } loadctx_t; -static isc_result_t loadfile(const char *master_file, dns_name_t *top, - dns_name_t *origin, - dns_rdataclass_t zclass, isc_boolean_t age_ttl, - int *soacount, int *nscount, - dns_rdatacallbacks_t *callbacks, - loadctx_t *ctx, - isc_mem_t *mctx); -static isc_result_t commit(dns_rdatacallbacks_t *, isc_lex_t *, - rdatalist_head_t *, dns_name_t *, dns_name_t *); -static isc_boolean_t is_glue(rdatalist_head_t *, dns_name_t *); -static dns_rdatalist_t *grow_rdatalist(int, dns_rdatalist_t *, int, - rdatalist_head_t *, - rdatalist_head_t *, - isc_mem_t *mctx); -static dns_rdata_t *grow_rdata(int, dns_rdata_t *, int, - rdatalist_head_t *, rdatalist_head_t *, - isc_mem_t *); -static isc_boolean_t on_list(dns_rdatalist_t *this, dns_rdata_t *rdata); +static isc_result_t +loadfile(const char *master_file, dns_name_t *top, dns_name_t *origin, + dns_rdataclass_t zclass, isc_boolean_t age_ttl, int *soacount, + int *nscount, dns_rdatacallbacks_t *callbacks, loadctx_t *ctx, + isc_mem_t *mctx); + +static isc_result_t +commit(dns_rdatacallbacks_t *, isc_lex_t *, rdatalist_head_t *, dns_name_t *, + dns_name_t *); + +static isc_boolean_t +is_glue(rdatalist_head_t *, dns_name_t *); + +static dns_rdatalist_t * +grow_rdatalist(int, dns_rdatalist_t *, int, rdatalist_head_t *, + rdatalist_head_t *, isc_mem_t *mctx); + +static dns_rdata_t * +grow_rdata(int, dns_rdata_t *, int, rdatalist_head_t *, rdatalist_head_t *, + isc_mem_t *); + +static isc_boolean_t +on_list(dns_rdatalist_t *this, dns_rdata_t *rdata); #define GETTOKEN(lexer, options, token, eol) \ do { \ @@ -283,7 +281,9 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin, result = DNS_R_NOOWNER; goto cleanup; } - /* Still working on the same name. */ + /* + * Still working on the same name. + */ } else if (token.type == isc_tokentype_string) { /* @@ -303,8 +303,8 @@ load(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin, "$TTL") == 0) { GETTOKEN(lex, 0, &token, ISC_FALSE); result = - dns_ttl_fromtext(&token.value.as_textregion, - &ctx->ttl); + dns_ttl_fromtext(&token.value.as_textregion, + &ctx->ttl); if (result != ISC_R_SUCCESS) goto cleanup; if (ctx->ttl > 0x7fffffffUL) { @@ -1096,7 +1096,9 @@ is_glue(rdatalist_head_t *head, dns_name_t *owner) { isc_region_t region; dns_name_t name; - /* find NS rrset */ + /* + * Find NS rrset. + */ this = ISC_LIST_HEAD(*head); while (this != NULL) { if (this->type == dns_rdatatype_ns) diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index eee0306731..bb3c7481b6 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -17,32 +17,23 @@ #include -#include -#include -#include -#include -#include +#include /* XXX */ -#include -#include -#include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #define RETERR(x) do { \ isc_result_t __r = (x); \ @@ -229,15 +220,16 @@ indent(unsigned int *current, unsigned int to, int tabwidth, } static isc_result_t -totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) -{ +totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) { isc_result_t result; ctx->style = *style; REQUIRE(style->tab_width != 0); dns_fixedname_init(&ctx->origin_fixname); - /* Set up the line break string if needed. */ + /* + * Set up the line break string if needed. + */ if ((ctx->style.flags & DNS_STYLEFLAG_MULTILINE) != 0) { isc_buffer_t buf; isc_region_t r; @@ -322,7 +314,9 @@ rdataset_totext(dns_rdataset_t *rdataset, do { column = 0; - /* Owner name. */ + /* + * Owner name. + */ if (owner_name != NULL && ! ((ctx->style.flags & DNS_STYLEFLAG_OMIT_OWNER) != 0 && !first)) @@ -334,7 +328,9 @@ rdataset_totext(dns_rdataset_t *rdataset, column += target->used - name_start; } - /* TTL. */ + /* + * TTL. + */ if (! ((ctx->style.flags & DNS_STYLEFLAG_OMIT_TTL) != 0 && current_ttl_valid && rdataset->ttl == current_ttl)) @@ -363,7 +359,9 @@ rdataset_totext(dns_rdataset_t *rdataset, } } - /* Class. */ + /* + * Class. + */ if ((ctx->style.flags & DNS_STYLEFLAG_OMIT_CLASS) == 0 || ctx->class_printed == ISC_FALSE) { @@ -377,7 +375,9 @@ rdataset_totext(dns_rdataset_t *rdataset, column += (target->used - class_start); } - /* Type. */ + /* + * Type. + */ { unsigned int type_start; INDENT_TO(type_column); @@ -388,7 +388,9 @@ rdataset_totext(dns_rdataset_t *rdataset, column += (target->used - type_start); } - /* Rdata. */ + /* + * Rdata. + */ { dns_rdata_t rdata; isc_region_t r; @@ -550,7 +552,9 @@ dump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset, REQUIRE(buffer->length > 0); - /* Output a $TTL directive if needed. */ + /* + * Output a $TTL directive if needed. + */ if ((ctx->style.flags & DNS_STYLEFLAG_TTL) != 0) { if (ctx->current_ttl_valid == ISC_FALSE || diff --git a/lib/dns/message.c b/lib/dns/message.c index 6346a37389..2b02332d87 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -21,23 +21,15 @@ #include -#include -#include - -#include -#include -#include +#include #include -#include #include #include #include #include -#include #include #include -#include #include #include #include @@ -123,8 +115,7 @@ msgblock_allocate(isc_mem_t *mctx, unsigned int sizeof_type, * NULL. */ static inline void * -msgblock_internalget(dns_msgblock_t *block, unsigned int sizeof_type) -{ +msgblock_internalget(dns_msgblock_t *block, unsigned int sizeof_type) { void *ptr; if (block == NULL || block->remaining == 0) @@ -140,8 +131,7 @@ msgblock_internalget(dns_msgblock_t *block, unsigned int sizeof_type) } static inline void -msgblock_reset(dns_msgblock_t *block) -{ +msgblock_reset(dns_msgblock_t *block) { block->remaining = block->count; } @@ -149,8 +139,7 @@ msgblock_reset(dns_msgblock_t *block) * Release memory associated with a message block. */ static inline void -msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block, - unsigned int sizeof_type) +msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block, unsigned int sizeof_type) { unsigned int length; @@ -165,8 +154,7 @@ msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block, * uses) */ static inline isc_result_t -newbuffer(dns_message_t *msg, unsigned int size) -{ +newbuffer(dns_message_t *msg, unsigned int size) { isc_result_t result; isc_buffer_t *dynbuf; @@ -180,8 +168,7 @@ newbuffer(dns_message_t *msg, unsigned int size) } static inline isc_buffer_t * -currentbuffer(dns_message_t *msg) -{ +currentbuffer(dns_message_t *msg) { isc_buffer_t *dynbuf; dynbuf = ISC_LIST_TAIL(msg->scratchpad); @@ -191,14 +178,12 @@ currentbuffer(dns_message_t *msg) } static inline void -releaserdata(dns_message_t *msg, dns_rdata_t *rdata) -{ +releaserdata(dns_message_t *msg, dns_rdata_t *rdata) { ISC_LIST_PREPEND(msg->freerdata, rdata, link); } static inline dns_rdata_t * -newrdata(dns_message_t *msg) -{ +newrdata(dns_message_t *msg) { dns_msgblock_t *msgblock; dns_rdata_t *rdata; @@ -225,14 +210,12 @@ newrdata(dns_message_t *msg) } static inline void -releaserdatalist(dns_message_t *msg, dns_rdatalist_t *rdatalist) -{ +releaserdatalist(dns_message_t *msg, dns_rdatalist_t *rdatalist) { ISC_LIST_PREPEND(msg->freerdatalist, rdatalist, link); } static inline dns_rdatalist_t * -newrdatalist(dns_message_t *msg) -{ +newrdatalist(dns_message_t *msg) { dns_msgblock_t *msgblock; dns_rdatalist_t *rdatalist; @@ -260,8 +243,7 @@ newrdatalist(dns_message_t *msg) } static inline void -msginitheader(dns_message_t *m) -{ +msginitheader(dns_message_t *m) { m->id = 0; m->flags = 0; m->rcode = 0; @@ -270,8 +252,7 @@ msginitheader(dns_message_t *m) } static inline void -msginitprivate(dns_message_t *m) -{ +msginitprivate(dns_message_t *m) { unsigned int i; for (i = 0; i < DNS_SECTION_MAX; i++) { @@ -290,8 +271,7 @@ msginitprivate(dns_message_t *m) } static inline void -msginittsig(dns_message_t *m) -{ +msginittsig(dns_message_t *m) { m->tsigstatus = m->querytsigstatus = dns_rcode_noerror; m->tsig = m->querytsig = NULL; m->tsigkey = NULL; @@ -308,8 +288,7 @@ msginittsig(dns_message_t *m) * and when resetting one. */ static inline void -msginit(dns_message_t *m) -{ +msginit(dns_message_t *m) { msginitheader(m); msginitprivate(m); msginittsig(m); @@ -367,8 +346,7 @@ msgresetopt(dns_message_t *msg) } static void -msgresetsigs(dns_message_t *msg) -{ +msgresetsigs(dns_message_t *msg) { if (msg->tsigset != NULL) { INSIST(dns_rdataset_isassociated(msg->tsigset)); INSIST(msg->namepool != NULL); @@ -391,8 +369,7 @@ msgresetsigs(dns_message_t *msg) * both dns_message_reset() and dns_message_parse(). */ static void -msgreset(dns_message_t *msg, isc_boolean_t everything) -{ +msgreset(dns_message_t *msg, isc_boolean_t everything) { dns_msgblock_t *msgblock, *next_msgblock; isc_buffer_t *dynbuf, *next_dynbuf; dns_rdata_t *rdata; @@ -620,8 +597,7 @@ dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp) } void -dns_message_reset(dns_message_t *msg, unsigned int intent) -{ +dns_message_reset(dns_message_t *msg, unsigned int intent) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(intent == DNS_MESSAGE_INTENTPARSE || intent == DNS_MESSAGE_INTENTRENDER); @@ -631,8 +607,7 @@ dns_message_reset(dns_message_t *msg, unsigned int intent) } void -dns_message_destroy(dns_message_t **msgp) -{ +dns_message_destroy(dns_message_t **msgp) { dns_message_t *msg; REQUIRE(msgp != NULL); @@ -1401,7 +1376,8 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (r.length != 0) return (DNS_R_FORMERR); - if (msg->tsigset != NULL || msg->tsigkey != NULL || msg->sig0 != NULL) { + if (msg->tsigset != NULL || msg->tsigkey != NULL || + msg->sig0 != NULL) { msg->saved = isc_mem_get(msg->mctx, sizeof(isc_region_t)); if (msg->saved == NULL) return (ISC_R_NOMEMORY); @@ -1421,8 +1397,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, } isc_result_t -dns_message_renderbegin(dns_message_t *msg, isc_buffer_t *buffer) -{ +dns_message_renderbegin(dns_message_t *msg, isc_buffer_t *buffer) { isc_region_t r; isc_result_t result; @@ -1459,8 +1434,7 @@ dns_message_renderbegin(dns_message_t *msg, isc_buffer_t *buffer) } isc_result_t -dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer) -{ +dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer) { isc_region_t r, rn; REQUIRE(DNS_MESSAGE_VALID(msg)); @@ -1468,7 +1442,7 @@ dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer) REQUIRE(msg->buffer != NULL); /* - * ensure that the new buffer is empty, and has enough space to + * Ensure that the new buffer is empty, and has enough space to * hold the current contents. */ isc_buffer_clear(buffer); @@ -1489,8 +1463,7 @@ dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer) } void -dns_message_renderrelease(dns_message_t *msg, unsigned int space) -{ +dns_message_renderrelease(dns_message_t *msg, unsigned int space) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(msg->buffer != NULL); REQUIRE(space <= msg->reserved); @@ -1499,8 +1472,7 @@ dns_message_renderrelease(dns_message_t *msg, unsigned int space) } isc_result_t -dns_message_renderreserve(dns_message_t *msg, unsigned int space) -{ +dns_message_renderreserve(dns_message_t *msg, unsigned int space) { isc_region_t r; REQUIRE(DNS_MESSAGE_VALID(msg)); @@ -1516,8 +1488,7 @@ dns_message_renderreserve(dns_message_t *msg, unsigned int space) } static inline isc_boolean_t -wrong_priority(dns_rdataset_t *rds, int pass) -{ +wrong_priority(dns_rdataset_t *rds, int pass) { int pass_needed; /* @@ -1589,10 +1560,12 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, while (rdataset != NULL) { next_rdataset = ISC_LIST_NEXT(rdataset, link); - if (rdataset->attributes & DNS_RDATASETATTR_RENDERED) + if ((rdataset->attributes & + DNS_RDATASETATTR_RENDERED) != 0) goto next; - if (((options & DNS_MESSAGERENDER_ORDERED) == 0) + if (((options & DNS_MESSAGERENDER_ORDERED) + == 0) && (sectionid == DNS_SECTION_ADDITIONAL) && wrong_priority(rdataset, pass)) goto next; @@ -1602,27 +1575,28 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, count = 0; result = dns_rdataset_towire(rdataset, name, &msg->cctx, - msg->buffer, &count); + msg->buffer, + &count); total += count; /* - * If out of space, record stats on what we rendered - * so far, and return that status. + * If out of space, record stats on what we + * rendered so far, and return that status. * * XXXMLG Need to change this when * dns_rdataset_towire() can render partial - * sets starting at some arbitary point in the set. - * This will include setting a bit in the - * rdataset to indicate that a partial rendering - * was done, and some state saved somewhere - * (probably in the message struct) + * sets starting at some arbitary point in the + * set. This will include setting a bit in the + * rdataset to indicate that a partial + * rendering was done, and some state saved + * somewhere (probably in the message struct) * to indicate where to continue from. */ if (result != ISC_R_SUCCESS) { INSIST(st.used < 65536); dns_compress_rollback(&msg->cctx, - (isc_uint16_t)st.used); + (isc_uint16_t)st.used); *(msg->buffer) = st; /* rollback */ msg->buffer->length += msg->reserved; msg->counts[sectionid] += total; @@ -1630,15 +1604,16 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, } /* - * If we have rendered pending data, ensure that the - * AD bit is not set. + * If we have rendered pending data, ensure + * that the AD bit is not set. */ if (rdataset->trust == dns_trust_pending && (sectionid == DNS_SECTION_ANSWER || sectionid == DNS_SECTION_AUTHORITY)) msg->flags &= ~DNS_MESSAGEFLAG_AD; - rdataset->attributes |= DNS_RDATASETATTR_RENDERED; + rdataset->attributes |= + DNS_RDATASETATTR_RENDERED; next: rdataset = next_rdataset; @@ -1655,8 +1630,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, } void -dns_message_renderheader(dns_message_t *msg, isc_buffer_t *target) -{ +dns_message_renderheader(dns_message_t *msg, isc_buffer_t *target) { isc_uint16_t tmp; isc_region_t r; @@ -1680,18 +1654,17 @@ dns_message_renderheader(dns_message_t *msg, isc_buffer_t *target) isc_buffer_putuint16(target, tmp); isc_buffer_putuint16(target, - (isc_uint16_t)msg->counts[DNS_SECTION_QUESTION]); + (isc_uint16_t)msg->counts[DNS_SECTION_QUESTION]); isc_buffer_putuint16(target, - (isc_uint16_t)msg->counts[DNS_SECTION_ANSWER]); + (isc_uint16_t)msg->counts[DNS_SECTION_ANSWER]); isc_buffer_putuint16(target, - (isc_uint16_t)msg->counts[DNS_SECTION_AUTHORITY]); + (isc_uint16_t)msg->counts[DNS_SECTION_AUTHORITY]); isc_buffer_putuint16(target, - (isc_uint16_t)msg->counts[DNS_SECTION_ADDITIONAL]); + (isc_uint16_t)msg->counts[DNS_SECTION_ADDITIONAL]); } isc_result_t -dns_message_renderend(dns_message_t *msg) -{ +dns_message_renderend(dns_message_t *msg) { isc_buffer_t tmpbuf; isc_region_t r; int result; @@ -1769,8 +1742,7 @@ dns_message_renderend(dns_message_t *msg) } void -dns_message_renderreset(dns_message_t *msg) -{ +dns_message_renderreset(dns_message_t *msg) { unsigned int i; dns_name_t *name; dns_rdataset_t *rds; @@ -1800,8 +1772,7 @@ dns_message_renderreset(dns_message_t *msg) } isc_result_t -dns_message_firstname(dns_message_t *msg, dns_section_t section) -{ +dns_message_firstname(dns_message_t *msg, dns_section_t section) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(VALID_NAMED_SECTION(section)); @@ -1814,8 +1785,7 @@ dns_message_firstname(dns_message_t *msg, dns_section_t section) } isc_result_t -dns_message_nextname(dns_message_t *msg, dns_section_t section) -{ +dns_message_nextname(dns_message_t *msg, dns_section_t section) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(VALID_NAMED_SECTION(section)); REQUIRE(msg->cursors[section] != NULL); @@ -1939,8 +1909,7 @@ dns_message_addname(dns_message_t *msg, dns_name_t *name, } isc_result_t -dns_message_gettempname(dns_message_t *msg, dns_name_t **item) -{ +dns_message_gettempname(dns_message_t *msg, dns_name_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item == NULL); @@ -1952,8 +1921,7 @@ dns_message_gettempname(dns_message_t *msg, dns_name_t **item) } void -dns_message_puttempname(dns_message_t *msg, dns_name_t **item) -{ +dns_message_puttempname(dns_message_t *msg, dns_name_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item != NULL); @@ -1962,8 +1930,7 @@ dns_message_puttempname(dns_message_t *msg, dns_name_t **item) } isc_result_t -dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) -{ +dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item == NULL); @@ -1975,8 +1942,7 @@ dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) } isc_result_t -dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) -{ +dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item == NULL); @@ -1990,8 +1956,7 @@ dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) } isc_result_t -dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) -{ +dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item == NULL); @@ -2003,8 +1968,7 @@ dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) } void -dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item) -{ +dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item != NULL); @@ -2013,8 +1977,7 @@ dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item) } void -dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) -{ +dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item != NULL); @@ -2024,8 +1987,7 @@ dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) } void -dns_message_puttemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) -{ +dns_message_puttemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(item != NULL && *item != NULL); @@ -2198,8 +2160,7 @@ dns_message_getsig0(dns_message_t *msg) { } void -dns_message_takebuffer(dns_message_t *msg, isc_buffer_t **buffer) -{ +dns_message_takebuffer(dns_message_t *msg, isc_buffer_t **buffer) { REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(buffer != NULL); REQUIRE(ISC_BUFFER_VALID(*buffer)); diff --git a/lib/dns/name.c b/lib/dns/name.c index b7b22816a6..8a870e9db2 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -18,23 +18,18 @@ #include #include -#include -#include -#include -#include #include -#include +#include #include +#include #include -#include #include #include #include -#define VALID_NAME(n) ((n) != NULL && \ - (n)->magic == DNS_NAME_MAGIC) +#define VALID_NAME(n) ISC_MAGIC_VALID(n, DNS_NAME_MAGIC) typedef enum { ft_init = 0, diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c index 8368e2a129..1833900e39 100644 --- a/lib/dns/ncache.c +++ b/lib/dns/ncache.c @@ -17,20 +17,14 @@ #include -#include -#include -#include #include -#include -#include -#include -#include -#include #include +#include +#include #include -#include #include +#include /* * The format of an ncache rdata is a sequence of one or more records of @@ -155,7 +149,8 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, /* * Copy the type to the buffer. */ - isc_buffer_availableregion(&buffer, &r); + isc_buffer_availableregion(&buffer, + &r); if (r.length < 2) return (ISC_R_NOSPACE); isc_buffer_putuint16(&buffer, diff --git a/lib/dns/nxt.c b/lib/dns/nxt.c index 24e0d81910..2fa7d2cbe7 100644 --- a/lib/dns/nxt.c +++ b/lib/dns/nxt.c @@ -17,20 +17,16 @@ #include -#include - +#include #include #include -#include -#include #include #include #include #include #include #include -#include #define check_result(op, msg) \ do { result = (op); \ diff --git a/lib/dns/peer.c b/lib/dns/peer.c index b223f1795e..d14d79fde5 100644 --- a/lib/dns/peer.c +++ b/lib/dns/peer.c @@ -17,19 +17,13 @@ #include -#include /* XXXRTH */ - -#include - -#include -#include -#include +#include +#include #include #include #include #include -#include /* * Bit positions in the dns_peer_t structure flags field diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index a9063d82d7..df94cdc4b6 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -15,21 +15,13 @@ * SOFTWARE. */ -/* $Id: rbt.c,v 1.77 2000/04/28 01:08:52 halley Exp $ */ +/* $Id: rbt.c,v 1.78 2000/05/08 14:34:50 tale Exp $ */ /* Principal Authors: DCL */ #include -#include -#include -#include - -#include -#include -#include #include -#include #include #include @@ -37,16 +29,15 @@ #include #define RBT_MAGIC 0x5242542BU /* RBT+. */ -#define VALID_RBT(rbt) ((rbt) != NULL && (rbt)->magic == RBT_MAGIC) +#define VALID_RBT(rbt) ISC_MAGIC_VALID(rbt, RBT_MAGIC) /* - * XXXDCL could remove all of the chain junk, and replace with - * dns_rbt_firstnode, _previousnode, _nextnode, _lastnode. pretty - * major change to the API. + * XXXDCL Since parent pointers were added in again, I could remove all of the + * chain junk, and replace with dns_rbt_firstnode, _previousnode, _nextnode, + * _lastnode. This would involve pretty major change to the API. */ #define CHAIN_MAGIC 0x302d302dU /* 0-0-. */ -#define VALID_CHAIN(chain) ((chain) != NULL && \ - (chain)->magic == CHAIN_MAGIC) +#define VALID_CHAIN(chain) ISC_MAGIC_VALID(chain, CHAIN_MAGIC) struct dns_rbt { unsigned int magic; diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 37589197b7..84d759994a 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -21,27 +21,21 @@ #include -#include -#include -#include - -#include +#include #include +#include #include #include #include #include -#include #include -#include #include #include #include #include #include #include -#include #ifdef DNS_RBTDB_VERSION64 #include "rbtdb64.h" diff --git a/lib/dns/rbtdb.h b/lib/dns/rbtdb.h index dce8c57aac..989505da5c 100644 --- a/lib/dns/rbtdb.h +++ b/lib/dns/rbtdb.h @@ -18,6 +18,9 @@ #ifndef DNS_RBTDB_H #define DNS_RBTDB_H 1 +#include +#include + /***** ***** Module Info *****/ @@ -26,9 +29,13 @@ * DNS Red-Black Tree DB Implementation */ +ISC_LANG_BEGINDECLS + isc_result_t dns_rbtdb_create(isc_mem_t *mctx, dns_name_t *base, isc_boolean_t is_cache, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], dns_db_t **dbp); +ISC_LANG_ENDDECLS + #endif /* DNS_RBTDB_H */ diff --git a/lib/dns/rbtdb64.h b/lib/dns/rbtdb64.h index 3f336ba8bb..f22cb6102b 100644 --- a/lib/dns/rbtdb64.h +++ b/lib/dns/rbtdb64.h @@ -18,6 +18,8 @@ #ifndef DNS_RBTDB64_H #define DNS_RBTDB64_H 1 +#include + /***** ***** Module Info *****/ @@ -28,9 +30,13 @@ #include +ISC_LANG_BEGINDECLS + isc_result_t dns_rbtdb64_create(isc_mem_t *mctx, dns_name_t *base, isc_boolean_t is_cache, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], dns_db_t **dbp); +ISC_LANG_ENDDECLS + #endif /* DNS_RBTDB64_H */ diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 35a0bad0e0..ec56597f4e 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,35 +15,27 @@ * SOFTWARE. */ -/* $Id: rdata.c,v 1.84 2000/05/05 18:14:59 gson Exp $ */ +/* $Id: rdata.c,v 1.85 2000/05/08 14:34:55 tale Exp $ */ #include -#include -#include -#include -#include - #include -#include #include -#include -#include -#include +#include #include -#include -#include +#include +#include +#include +#include +#include #include #include +#include #include -#include -#include +#include #include #include -#include -#include -#include #include #include @@ -69,7 +61,7 @@ static isc_result_t txt_totext(isc_region_t *source, isc_buffer_t *target); static isc_result_t txt_fromtext(isc_textregion_t *source, isc_buffer_t *target); static isc_result_t txt_fromwire(isc_buffer_t *source, - isc_buffer_t *target); + isc_buffer_t *target); static isc_boolean_t name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target); static unsigned int name_length(dns_name_t *name); @@ -77,12 +69,9 @@ static isc_result_t str_totext(char *source, isc_buffer_t *target); static isc_boolean_t buffer_empty(isc_buffer_t *source); static void buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region); -static isc_result_t uint32_tobuffer(isc_uint32_t, - isc_buffer_t *target); -static isc_result_t uint16_tobuffer(isc_uint32_t, - isc_buffer_t *target); -static isc_result_t uint8_tobuffer(isc_uint32_t value, - isc_buffer_t *target); +static isc_result_t uint32_tobuffer(isc_uint32_t, isc_buffer_t *target); +static isc_result_t uint16_tobuffer(isc_uint32_t, isc_buffer_t *target); +static isc_result_t uint8_tobuffer(isc_uint32_t, isc_buffer_t *target); static isc_result_t name_tobuffer(dns_name_t *name, isc_buffer_t *target); static isc_uint32_t uint32_fromregion(isc_region_t *region); static isc_uint16_t uint16_fromregion(isc_region_t *region); diff --git a/lib/dns/rdata/generic/cname_5.h b/lib/dns/rdata/generic/cname_5.h index 7f6021dee0..9e2f7fe866 100644 --- a/lib/dns/rdata/generic/cname_5.h +++ b/lib/dns/rdata/generic/cname_5.h @@ -15,13 +15,11 @@ * SOFTWARE. */ -/* $Id: cname_5.h,v 1.18 2000/04/29 02:01:35 tale Exp $ */ +/* $Id: cname_5.h,v 1.19 2000/05/08 14:36:45 tale Exp $ */ #ifndef GENERIC_CNAME_5_H #define GENERIC_CNAME_5_H 1 -#include - typedef struct dns_rdata_cname { dns_rdatacommon_t common; isc_mem_t *mctx; diff --git a/lib/dns/rdata/generic/dname_39.h b/lib/dns/rdata/generic/dname_39.h index 09fd6b276c..2dd5e75e82 100644 --- a/lib/dns/rdata/generic/dname_39.h +++ b/lib/dns/rdata/generic/dname_39.h @@ -18,12 +18,10 @@ #ifndef GENERIC_DNAME_39_H #define GENERIC_DNAME_39_H 1 -/* $Id: dname_39.h,v 1.11 2000/04/29 02:01:37 tale Exp $ */ +/* $Id: dname_39.h,v 1.12 2000/05/08 14:36:46 tale Exp $ */ /* draft-ietf-dnsind-dname-02.txt */ -#include - typedef struct dns_rdata_dname { dns_rdatacommon_t common; isc_mem_t *mctx; diff --git a/lib/dns/rdata/generic/mb_7.h b/lib/dns/rdata/generic/mb_7.h index 71b95e2b14..2f7bdbee11 100644 --- a/lib/dns/rdata/generic/mb_7.h +++ b/lib/dns/rdata/generic/mb_7.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MB_7_H #define GENERIC_MB_7_H 1 -/* $Id: mb_7.h,v 1.17 2000/04/29 02:01:40 tale Exp $ */ - -#include +/* $Id: mb_7.h,v 1.18 2000/05/08 14:36:47 tale Exp $ */ typedef struct dns_rdata_mb { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/md_3.h b/lib/dns/rdata/generic/md_3.h index 26786527fc..cd9a0075f4 100644 --- a/lib/dns/rdata/generic/md_3.h +++ b/lib/dns/rdata/generic/md_3.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MD_3_H #define GENERIC_MD_3_H 1 -/* $Id: md_3.h,v 1.18 2000/04/29 02:01:41 tale Exp $ */ - -#include +/* $Id: md_3.h,v 1.19 2000/05/08 14:36:48 tale Exp $ */ typedef struct dns_rdata_md { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/mf_4.h b/lib/dns/rdata/generic/mf_4.h index 32db0172c5..03bdc58134 100644 --- a/lib/dns/rdata/generic/mf_4.h +++ b/lib/dns/rdata/generic/mf_4.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MF_4_H #define GENERIC_MF_4_H 1 -/* $Id: mf_4.h,v 1.16 2000/04/29 02:01:41 tale Exp $ */ - -#include +/* $Id: mf_4.h,v 1.17 2000/05/08 14:36:49 tale Exp $ */ typedef struct dns_rdata_mf { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/mg_8.h b/lib/dns/rdata/generic/mg_8.h index 2ed8eb8a0f..ba26152750 100644 --- a/lib/dns/rdata/generic/mg_8.h +++ b/lib/dns/rdata/generic/mg_8.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MG_8_H #define GENERIC_MG_8_H 1 -/* $Id: mg_8.h,v 1.16 2000/04/29 02:01:43 tale Exp $ */ - -#include +/* $Id: mg_8.h,v 1.17 2000/05/08 14:36:50 tale Exp $ */ typedef struct dns_rdata_mg { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/minfo_14.h b/lib/dns/rdata/generic/minfo_14.h index 1285b602c3..dbaef0dfc3 100644 --- a/lib/dns/rdata/generic/minfo_14.h +++ b/lib/dns/rdata/generic/minfo_14.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MINFO_14_H #define GENERIC_MINFO_14_H 1 -/* $Id: minfo_14.h,v 1.17 2000/04/29 02:01:43 tale Exp $ */ - -#include +/* $Id: minfo_14.h,v 1.18 2000/05/08 14:36:51 tale Exp $ */ typedef struct dns_rdata_minfo { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/mr_9.h b/lib/dns/rdata/generic/mr_9.h index f259db93bd..5fa26bd740 100644 --- a/lib/dns/rdata/generic/mr_9.h +++ b/lib/dns/rdata/generic/mr_9.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MR_9_H #define GENERIC_MR_9_H 1 -/* $Id: mr_9.h,v 1.16 2000/04/29 02:01:44 tale Exp $ */ - -#include +/* $Id: mr_9.h,v 1.17 2000/05/08 14:36:52 tale Exp $ */ typedef struct dns_rdata_mr { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/mx_15.h b/lib/dns/rdata/generic/mx_15.h index a29045b4c1..81f37b58d7 100644 --- a/lib/dns/rdata/generic/mx_15.h +++ b/lib/dns/rdata/generic/mx_15.h @@ -18,9 +18,7 @@ #ifndef GENERIC_MX_15_H #define GENERIC_MX_15_H 1 -/* $Id: mx_15.h,v 1.19 2000/04/29 02:01:44 tale Exp $ */ - -#include +/* $Id: mx_15.h,v 1.20 2000/05/08 14:36:53 tale Exp $ */ typedef struct dns_rdata_mx { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/ptr_12.h b/lib/dns/rdata/generic/ptr_12.h index 1d67b8a9c2..fcfa1ce236 100644 --- a/lib/dns/rdata/generic/ptr_12.h +++ b/lib/dns/rdata/generic/ptr_12.h @@ -18,10 +18,7 @@ #ifndef GENERIC_PTR_12_H #define GENERIC_PTR_12_H 1 -/* $Id: ptr_12.h,v 1.17 2000/04/29 02:01:48 tale Exp $ */ - - -#include +/* $Id: ptr_12.h,v 1.18 2000/05/08 14:36:54 tale Exp $ */ typedef struct dns_rdata_ptr { dns_rdatacommon_t common; diff --git a/lib/dns/rdata/generic/rp_17.h b/lib/dns/rdata/generic/rp_17.h index 4a46c24949..1e5ae59770 100644 --- a/lib/dns/rdata/generic/rp_17.h +++ b/lib/dns/rdata/generic/rp_17.h @@ -18,12 +18,10 @@ #ifndef GENERIC_RP_17_H #define GENERIC_RP_17_H 1 -/* $Id: rp_17.h,v 1.12 2000/04/29 02:01:48 tale Exp $ */ +/* $Id: rp_17.h,v 1.13 2000/05/08 14:36:55 tale Exp $ */ /* RFC 1183 */ -#include - typedef struct dns_rdata_rp { dns_rdatacommon_t common; isc_mem_t *mctx; diff --git a/lib/dns/rdata/generic/rt_21.h b/lib/dns/rdata/generic/rt_21.h index d6cd0a7d53..1516df385f 100644 --- a/lib/dns/rdata/generic/rt_21.h +++ b/lib/dns/rdata/generic/rt_21.h @@ -18,12 +18,10 @@ #ifndef GENERIC_RT_21_H #define GENERIC_RT_21_H 1 -/* $Id: rt_21.h,v 1.12 2000/04/29 02:01:49 tale Exp $ */ +/* $Id: rt_21.h,v 1.13 2000/05/08 14:36:57 tale Exp $ */ /* RFC 1183 */ -#include - typedef struct dns_rdata_rt { dns_rdatacommon_t common; isc_mem_t *mctx; diff --git a/lib/dns/rdata/generic/soa_6.h b/lib/dns/rdata/generic/soa_6.h index 3dbe36ccf9..f96fa63c17 100644 --- a/lib/dns/rdata/generic/soa_6.h +++ b/lib/dns/rdata/generic/soa_6.h @@ -18,9 +18,7 @@ #ifndef GENERIC_SOA_6_H #define GENERIC_SOA_6_H 1 -/* $Id: soa_6.h,v 1.21 2000/04/29 02:01:49 tale Exp $ */ - -#include +/* $Id: soa_6.h,v 1.22 2000/05/08 14:36:58 tale Exp $ */ typedef struct dns_rdata_soa { dns_rdatacommon_t common; diff --git a/lib/dns/rdatalist.c b/lib/dns/rdatalist.c index a77e038948..5442f9eb9a 100644 --- a/lib/dns/rdatalist.c +++ b/lib/dns/rdatalist.c @@ -19,7 +19,6 @@ #include -#include #include #include diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index 0d9573615e..c7ca0cc67d 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -17,17 +17,14 @@ #include -#include #include -#include -#include +#include #include +#include #include #include -#include -#include #include #include @@ -359,7 +356,7 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, do { /* - * copy out the name, type, class, ttl. + * Copy out the name, type, class, ttl. */ dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14); result = dns_name_towire(owner_name, cctx, target); @@ -386,7 +383,7 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, isc_buffer_add(target, 2); /* - * copy out the rdata + * Copy out the rdata */ if (shuffle) rdata = shuffled[i]; diff --git a/lib/dns/rdatasetiter.c b/lib/dns/rdatasetiter.c index 7380fc2388..b042db3e30 100644 --- a/lib/dns/rdatasetiter.c +++ b/lib/dns/rdatasetiter.c @@ -19,7 +19,6 @@ #include -#include #include #include diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index 6e3a40ccec..22f28377a4 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -15,22 +15,16 @@ * SOFTWARE. */ -/* $Id: rdataslab.c,v 1.11 2000/04/28 01:10:16 halley Exp $ */ +/* $Id: rdataslab.c,v 1.12 2000/05/08 14:35:00 tale Exp $ */ #include -#include - +#include #include -#include -#include #include -#include #include #include -#include -#include #include #include diff --git a/lib/dns/request.c b/lib/dns/request.c index 17ac7ff963..d15d60623a 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -17,12 +17,7 @@ #include -#include -#include -#include -#include -#include -#include +#include #include #include #include diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 7d0ca1573f..062761f064 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -17,40 +17,27 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include #include -#include -#include #include -#include -#include #include +#include #include #include +#include #include #include -#include -#include #include #include #include #include +#include +#include #include #include -#include -#include -#include #include #define DNS_RESOLVER_TRACE diff --git a/lib/dns/result.c b/lib/dns/result.c index 34ab6e1dc8..b9fed54671 100644 --- a/lib/dns/result.c +++ b/lib/dns/result.c @@ -17,11 +17,7 @@ #include -#include - -#include #include -#include #include #include diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c index bbf9562ef9..8a824092fd 100644 --- a/lib/dns/rootns.c +++ b/lib/dns/rootns.c @@ -17,15 +17,10 @@ #include -#include -#include - -#include -#include -#include +#include #include -#include +#include #include #include #include diff --git a/lib/dns/sec/dst/bsafe_link.c b/lib/dns/sec/dst/bsafe_link.c index bab993e79e..4677adcfd3 100644 --- a/lib/dns/sec/dst/bsafe_link.c +++ b/lib/dns/sec/dst/bsafe_link.c @@ -1,38 +1,33 @@ -#if defined(BSAFE) || defined(DNSSAFE) - /* * Portions Copyright (c) 1995-1999 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: bsafe_link.c,v 1.15 2000/05/02 03:54:14 tale Exp $ + * $Id: bsafe_link.c,v 1.16 2000/05/08 14:36:59 tale Exp $ */ +#if defined(BSAFE) || defined(DNSSAFE) + #include -#include -#include -#include -#include - -#include -#include -#include -#include +#include +#include #include #include diff --git a/lib/dns/sec/dst/dst_api.c b/lib/dns/sec/dst/dst_api.c index 9eeb781074..9ee6d39b24 100644 --- a/lib/dns/sec/dst/dst_api.c +++ b/lib/dns/sec/dst/dst_api.c @@ -1,44 +1,35 @@ /* * Portions Copyright (c) 1995-1999 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.31 2000/04/28 01:10:42 halley Exp $ + * $Id: dst_api.c,v 1.32 2000/05/08 14:37:00 tale Exp $ */ #include -#include -#include -#include -#include -#include - -#include -#include #include -#include -#include #include #include -#include #include #include -#include +#include #include #include @@ -359,7 +350,9 @@ dst_key_fromfile(const char *name, const isc_uint16_t id, const int alg, if (key == NULL) return (ISC_R_NOMEMORY); - /* Fill in private key and some fields in the general key structure */ + /* + * Fill in private key and some fields in the general key structure. + */ ret = key->func->from_file(key, id, mctx); if (ret != ISC_R_SUCCESS) { dst_key_free(key); @@ -860,7 +853,7 @@ dst_random_get(const unsigned int wanted, isc_buffer_t *target) { * none */ static void -initialize() { +initialize(void) { memset(dst_t_func, 0, sizeof(dst_t_func)); RUNTIME_CHECK(isc_mem_create(0, 0, &dst_memory_pool) == ISC_R_SUCCESS); diff --git a/lib/dns/sec/dst/dst_lib.c b/lib/dns/sec/dst/dst_lib.c index f5e22f39b2..8762ded540 100644 --- a/lib/dns/sec/dst/dst_lib.c +++ b/lib/dns/sec/dst/dst_lib.c @@ -17,15 +17,12 @@ /* * Principal Author: Brian Wellington - * $Id: dst_lib.c,v 1.3 2000/04/28 01:10:43 halley Exp $ + * $Id: dst_lib.c,v 1.4 2000/05/08 14:37:01 tale Exp $ */ #include -#include - #include -#include #include #include diff --git a/lib/dns/sec/dst/dst_parse.c b/lib/dns/sec/dst/dst_parse.c index 01653bf078..859af9dbf2 100644 --- a/lib/dns/sec/dst/dst_parse.c +++ b/lib/dns/sec/dst/dst_parse.c @@ -1,45 +1,36 @@ /* * Portions Copyright (c) 1995-1999 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.11 2000/04/28 01:10:44 halley Exp $ + * $Id: dst_parse.c,v 1.12 2000/05/08 14:37:03 tale Exp $ */ #include -#include -#include -#include -#include -#include - -#include #include -#include #include -#include #include #include -#include +#include #include -#include - /* XXXBEW For chmod. This should be removed. */ #include diff --git a/lib/dns/sec/dst/dst_parse.h b/lib/dns/sec/dst/dst_parse.h index dd32b9cf03..2c7263c8ec 100644 --- a/lib/dns/sec/dst/dst_parse.h +++ b/lib/dns/sec/dst/dst_parse.h @@ -18,10 +18,8 @@ #define DST_DST_PARSE_H 1 #include -#include -#include -ISC_LANG_BEGINDECLS +#include #define MAJOR_VERSION 1 #define MINOR_VERSION 2 @@ -74,14 +72,19 @@ struct dst_private { typedef struct dst_private dst_private_t; -void dst_s_free_private_structure_fields(dst_private_t *priv, - isc_mem_t *mctx); -int dst_s_parse_private_key_file(const char *name, const int alg, - const isc_uint16_t id, dst_private_t *priv, - isc_mem_t *mctx); -int dst_s_write_private_key_file(const char *name, const int alg, - const isc_uint16_t id, - const dst_private_t *priv); +ISC_LANG_BEGINDECLS + +void +dst_s_free_private_structure_fields(dst_private_t *priv, isc_mem_t *mctx); + +int +dst_s_parse_private_key_file(const char *name, const int alg, + const isc_uint16_t id, dst_private_t *priv, + isc_mem_t *mctx); + +int +dst_s_write_private_key_file(const char *name, const int alg, + const isc_uint16_t id, const dst_private_t *priv); ISC_LANG_ENDDECLS diff --git a/lib/dns/sec/dst/dst_result.c b/lib/dns/sec/dst/dst_result.c index b90dd4d6ff..e09997e62a 100644 --- a/lib/dns/sec/dst/dst_result.c +++ b/lib/dns/sec/dst/dst_result.c @@ -17,16 +17,12 @@ /* * Principal Author: Brian Wellington - * $Id: dst_result.c,v 1.7 2000/04/28 01:10:45 halley Exp $ + * $Id: dst_result.c,v 1.8 2000/05/08 14:37:05 tale Exp $ */ #include -#include - -#include #include -#include #include #include diff --git a/lib/dns/sec/dst/dst_support.c b/lib/dns/sec/dst/dst_support.c index a2d42a9dc9..ac1ac7ecd3 100644 --- a/lib/dns/sec/dst/dst_support.c +++ b/lib/dns/sec/dst/dst_support.c @@ -1,32 +1,32 @@ /* * Portions Copyright (c) 1995-1999 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: dst_support.c,v 1.3 1999/11/02 19:52:29 bwelling Exp $ + * $Id: dst_support.c,v 1.4 2000/05/08 14:37:06 tale Exp $ */ #include #include -#include -#include -#include -#include + +#include #include "dst_internal.h" @@ -42,8 +42,7 @@ */ int -dst_s_calculate_bits(const unsigned char *str, const int max_bits) -{ +dst_s_calculate_bits(const unsigned char *str, const int max_bits) { const unsigned char *p = str; unsigned char i, j = 0x80; int bits; @@ -65,8 +64,7 @@ dst_s_calculate_bits(const unsigned char *str, const int max_bits) * N the 16 bit checksum. */ isc_uint16_t -dst_s_id_calc(const unsigned char *key, const int keysize) -{ +dst_s_id_calc(const unsigned char *key, const int keysize) { isc_uint32_t ac; const unsigned char *kp = key; int size = keysize; @@ -110,7 +108,8 @@ dst_s_build_filename(char *filename, const char *name, isc_uint16_t id, return (-1); if (suffix == NULL) return (-1); - if (filename_length < 1 + strlen(name) + 1 + 4 + 6 + 1 + strlen(suffix)) + if (filename_length < + 1 + strlen(name) + 1 + 4 + 6 + 1 + strlen(suffix)) return (-1); my_id = id; if (name[strlen(name) - 1] == '.') diff --git a/lib/dns/sec/dst/hmac_link.c b/lib/dns/sec/dst/hmac_link.c index a986ad04cc..0f769d2acb 100644 --- a/lib/dns/sec/dst/hmac_link.c +++ b/lib/dns/sec/dst/hmac_link.c @@ -1,37 +1,31 @@ /* * Portions Copyright (c) 1995-1998 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: hmac_link.c,v 1.22 2000/05/02 03:54:15 tale Exp $ + * $Id: hmac_link.c,v 1.23 2000/05/08 14:37:07 tale Exp $ */ #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include +#include #include #include diff --git a/lib/dns/sec/dst/include/dst/dst.h b/lib/dns/sec/dst/include/dst/dst.h index 91c12f09a9..b9b728313c 100644 --- a/lib/dns/sec/dst/include/dst/dst.h +++ b/lib/dns/sec/dst/include/dst/dst.h @@ -1,12 +1,8 @@ #ifndef DST_DST_H #define DST_DST_H 1 -#include -#include -#include #include -#include -#include +#include ISC_LANG_BEGINDECLS diff --git a/lib/dns/sec/dst/include/dst/result.h b/lib/dns/sec/dst/include/dst/result.h index 37e13416b2..18968871d7 100644 --- a/lib/dns/sec/dst/include/dst/result.h +++ b/lib/dns/sec/dst/include/dst/result.h @@ -27,7 +27,7 @@ * the ISC result codes, so including this file buys you the ISC_R_ * namespace too. */ -#include +#include /* Contractual promise. */ #define DST_R_UNSUPPORTEDALG (ISC_RESULTCLASS_DST + 0) #define DST_R_UNSUPPORTEDTYPE (ISC_RESULTCLASS_DST + 1) diff --git a/lib/dns/sec/dst/openssl_link.c b/lib/dns/sec/dst/openssl_link.c index a25a3c5610..4576642720 100644 --- a/lib/dns/sec/dst/openssl_link.c +++ b/lib/dns/sec/dst/openssl_link.c @@ -1,39 +1,32 @@ -#if defined(OPENSSL) - /* * Portions Copyright (c) 1995-1998 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: openssl_link.c,v 1.18 2000/05/02 03:54:15 tale Exp $ + * $Id: openssl_link.c,v 1.19 2000/05/08 14:37:08 tale Exp $ */ +#if defined(OPENSSL) #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include +#include #include #include @@ -41,8 +34,6 @@ #include "dst_internal.h" #include "dst_parse.h" -#include -#include #include #include @@ -88,7 +79,7 @@ BN_bn2bin_fixed(BIGNUM *bn, unsigned char *buf, int size); * Sets up function pointers for OpenSSL related functions */ void -dst_s_openssldsa_init() { +dst_s_openssldsa_init(void) { REQUIRE(dst_t_func[DST_ALG_DSA] == NULL); dst_t_func[DST_ALG_DSA] = &openssl_functions; memset(&openssl_functions, 0, sizeof(struct dst_func)); diff --git a/lib/dns/sec/dst/openssldh_link.c b/lib/dns/sec/dst/openssldh_link.c index 585f046b7c..084812af13 100644 --- a/lib/dns/sec/dst/openssldh_link.c +++ b/lib/dns/sec/dst/openssldh_link.c @@ -1,41 +1,34 @@ -#if defined(OPENSSL) - /* * Portions Copyright (c) 1995-1998 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: openssldh_link.c,v 1.11 2000/05/02 03:54:16 tale Exp $ + * $Id: openssldh_link.c,v 1.12 2000/05/08 14:37:09 tale Exp $ */ +#if defined(OPENSSL) + #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include #include @@ -43,40 +36,59 @@ #include "dst_internal.h" #include "dst_parse.h" -#include -#include #include -#define PRIME768 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" +#define PRIME768 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088" \ + "A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25" \ + "F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" -#define PRIME1024 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF" +#define PRIME1024 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E08" \ + "8A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF2" \ + "5F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406" \ + "B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF" static struct dst_func openssldh_functions; -static isc_result_t dst_openssldh_computesecret(const dst_key_t *pub, - const dst_key_t *priv, - isc_buffer_t *secret); -static isc_boolean_t dst_openssldh_compare(const dst_key_t *key1, - const dst_key_t *key2); -static isc_boolean_t dst_openssldh_paramcompare(const dst_key_t *key1, - const dst_key_t *key2); -static isc_result_t dst_openssldh_generate(dst_key_t *key, int generator, - isc_mem_t *mctx); -static isc_boolean_t dst_openssldh_isprivate(const dst_key_t *key); -static void dst_openssldh_destroy(void *key, isc_mem_t *mctx); -static isc_result_t dst_openssldh_to_dns(const dst_key_t *in_key, - isc_buffer_t *data); -static isc_result_t dst_openssldh_from_dns(dst_key_t *key, - isc_buffer_t *data, - isc_mem_t *mctx); -static isc_result_t dst_openssldh_to_file(const dst_key_t *key); -static isc_result_t dst_openssldh_from_file(dst_key_t *key, - const isc_uint16_t id, - isc_mem_t *mctx); +static isc_result_t +dst_openssldh_computesecret(const dst_key_t *pub, const dst_key_t *priv, + isc_buffer_t *secret); -static void uint16_toregion(isc_uint16_t val, isc_region_t *region); -static isc_uint16_t uint16_fromregion(isc_region_t *region); -static void BN_fromhex(BIGNUM *b, const char *str); +static isc_boolean_t +dst_openssldh_compare(const dst_key_t *key1, const dst_key_t *key2); + +static isc_boolean_t +dst_openssldh_paramcompare(const dst_key_t *key1, const dst_key_t *key2); + +static isc_result_t +dst_openssldh_generate(dst_key_t *key, int generator, isc_mem_t *mctx); + +static isc_boolean_t +dst_openssldh_isprivate(const dst_key_t *key); + +static void +dst_openssldh_destroy(void *key, isc_mem_t *mctx); + +static isc_result_t +dst_openssldh_to_dns(const dst_key_t *in_key, isc_buffer_t *data); + +static isc_result_t +dst_openssldh_from_dns(dst_key_t *key, isc_buffer_t *data, isc_mem_t *mctx); + +static isc_result_t +dst_openssldh_to_file(const dst_key_t *key); + +static isc_result_t +dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, + isc_mem_t *mctx); + +static void +uint16_toregion(isc_uint16_t val, isc_region_t *region); + +static isc_uint16_t +uint16_fromregion(isc_region_t *region); + +static void +BN_fromhex(BIGNUM *b, const char *str); static BIGNUM bn2, bn768, bn1024; @@ -85,8 +97,7 @@ static BIGNUM bn2, bn768, bn1024; * Sets up function pointers for OpenSSL related functions */ void -dst_s_openssldh_init() -{ +dst_s_openssldh_init(void) { REQUIRE(dst_t_func[DST_ALG_DH] == NULL); dst_t_func[DST_ALG_DH] = &openssldh_functions; memset(&openssldh_functions, 0, sizeof(struct dst_func)); @@ -419,7 +430,8 @@ dst_openssldh_to_file(const dst_key_t *key) { */ static isc_result_t -dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, isc_mem_t *mctx) { +dst_openssldh_from_file(dst_key_t *key, const isc_uint16_t id, + isc_mem_t *mctx) { dst_private_t priv; isc_result_t ret; isc_buffer_t dns; diff --git a/lib/dns/sec/dst/opensslmd5_link.c b/lib/dns/sec/dst/opensslmd5_link.c index dc7ef7b340..3698364e9b 100644 --- a/lib/dns/sec/dst/opensslmd5_link.c +++ b/lib/dns/sec/dst/opensslmd5_link.c @@ -1,46 +1,37 @@ -#if defined(OPENSSL) - /* * Portions Copyright (c) 1995-1998 by Network Associates, Inc. + * Portions Copyright (C) 1999, 2000 Internet Software Consortium. * - * Permission to use, copy modify, and distribute this software for any + * 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 NETWORK ASSOCIATES - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * NETWORK ASSOCIATES 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 THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND + * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK + * ASSOCIATES 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. */ /* * Principal Author: Brian Wellington - * $Id: opensslmd5_link.c,v 1.6 2000/04/28 01:10:50 halley Exp $ + * $Id: opensslmd5_link.c,v 1.7 2000/05/08 14:37:10 tale Exp $ */ +#if defined(OPENSSL) + #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include #include #include "dst_internal.h" #include "dst_parse.h" -#include -#include #include /* @@ -96,4 +87,4 @@ dst_s_md5(const unsigned int mode, void **context, isc_region_t *data, return (ISC_R_SUCCESS); } -#endif +#endif /* OPENSSL */ diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index ecb023ea89..e4dcdac3b3 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -16,22 +16,14 @@ */ /* - * $Id: ssu.c,v 1.8 2000/04/04 20:10:57 gson Exp $ + * $Id: ssu.c,v 1.9 2000/05/08 14:35:05 tale Exp $ * Principal Author: Brian Wellington */ #include -#include - -#include -#include -#include #include #include -#include -#include -#include #include #include diff --git a/lib/dns/tcpmsg.c b/lib/dns/tcpmsg.c index 2394961a5b..8cab5f0caf 100644 --- a/lib/dns/tcpmsg.c +++ b/lib/dns/tcpmsg.c @@ -17,41 +17,30 @@ #include -#include -#include -#include -#include - -#include -#include -#include #include -#include #include #include #include -#include #include #include #ifdef TCPMSG_DEBUG +#include /* Required for printf. */ #define XDEBUG(x) printf x #else #define XDEBUG(x) #endif -#define TCPMSG_MAGIC 0x5443506d /* TCPm */ - -#define VALID_TCPMSG(foo) ((foo) != NULL && ((foo)->magic == TCPMSG_MAGIC)) +#define TCPMSG_MAGIC 0x5443506d /* TCPm */ +#define VALID_TCPMSG(foo) ISC_MAGIC_VALID(foo, TCPMSG_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) -{ +recv_length(isc_task_t *task, isc_event_t *ev_in) { isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; isc_event_t *dev; dns_tcpmsg_t *tcpmsg = ev_in->ev_arg; @@ -68,7 +57,7 @@ recv_length(isc_task_t *task, isc_event_t *ev_in) } /* - * success + * Success. */ tcpmsg->size = ntohs(tcpmsg->size); if (tcpmsg->size == 0) { @@ -107,8 +96,7 @@ recv_length(isc_task_t *task, isc_event_t *ev_in) } static void -recv_message(isc_task_t *task, isc_event_t *ev_in) -{ +recv_message(isc_task_t *task, isc_event_t *ev_in) { isc_socketevent_t *ev = (isc_socketevent_t *)ev_in; isc_event_t *dev; dns_tcpmsg_t *tcpmsg = ev_in->ev_arg; @@ -137,8 +125,7 @@ recv_message(isc_task_t *task, isc_event_t *ev_in) } void -dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg) -{ +dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg) { REQUIRE(mctx != NULL); REQUIRE(sock != NULL); REQUIRE(tcpmsg != NULL); @@ -147,18 +134,19 @@ dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg) tcpmsg->size = 0; tcpmsg->buffer.base = NULL; tcpmsg->buffer.length = 0; - tcpmsg->maxsize = 65535; /* largest message possible */ + tcpmsg->maxsize = 65535; /* Largest message possible. */ tcpmsg->mctx = mctx; tcpmsg->sock = sock; - tcpmsg->task = NULL; /* none yet */ - tcpmsg->result = ISC_R_UNEXPECTED; /* none yet */ - /* Should probably initialize the event here, but it can wait. */ + tcpmsg->task = NULL; /* None yet. */ + tcpmsg->result = ISC_R_UNEXPECTED; /* None yet. */ + /* + * Should probably initialize the event here, but it can wait. + */ } void -dns_tcpmsg_setmaxsize(dns_tcpmsg_t *tcpmsg, unsigned int maxsize) -{ +dns_tcpmsg_setmaxsize(dns_tcpmsg_t *tcpmsg, unsigned int maxsize) { REQUIRE(VALID_TCPMSG(tcpmsg)); REQUIRE(maxsize < 65536); @@ -205,16 +193,14 @@ dns_tcpmsg_readmessage(dns_tcpmsg_t *tcpmsg, } void -dns_tcpmsg_cancelread(dns_tcpmsg_t *tcpmsg) -{ +dns_tcpmsg_cancelread(dns_tcpmsg_t *tcpmsg) { REQUIRE(VALID_TCPMSG(tcpmsg)); isc_socket_cancel(tcpmsg->sock, NULL, ISC_SOCKCANCEL_RECV); } void -dns_tcpmsg_keepbuffer(dns_tcpmsg_t *tcpmsg, isc_buffer_t *buffer) -{ +dns_tcpmsg_keepbuffer(dns_tcpmsg_t *tcpmsg, isc_buffer_t *buffer) { REQUIRE(VALID_TCPMSG(tcpmsg)); REQUIRE(buffer != NULL); @@ -225,8 +211,7 @@ dns_tcpmsg_keepbuffer(dns_tcpmsg_t *tcpmsg, isc_buffer_t *buffer) #if 0 void -dns_tcpmsg_freebuffer(dns_tcpmsg_t *tcpmsg) -{ +dns_tcpmsg_freebuffer(dns_tcpmsg_t *tcpmsg) { REQUIRE(VALID_TCPMSG(tcpmsg)); if (tcpmsg->buffer.base == NULL) @@ -239,8 +224,7 @@ dns_tcpmsg_freebuffer(dns_tcpmsg_t *tcpmsg) #endif void -dns_tcpmsg_invalidate(dns_tcpmsg_t *tcpmsg) -{ +dns_tcpmsg_invalidate(dns_tcpmsg_t *tcpmsg) { REQUIRE(VALID_TCPMSG(tcpmsg)); tcpmsg->magic = 0; diff --git a/lib/dns/time.c b/lib/dns/time.c index 91cf684501..3abd784db7 100644 --- a/lib/dns/time.c +++ b/lib/dns/time.c @@ -15,18 +15,16 @@ * SOFTWARE. */ -/* $Id: time.c,v 1.10 2000/04/28 01:10:19 halley Exp $ */ +/* $Id: time.c,v 1.11 2000/05/08 14:35:08 tale Exp $ */ #include #include -#include #include -#include +#include #include -#include #include #include @@ -44,7 +42,7 @@ dns_time64_totext(isc_int64_t t, isc_buffer_t *target) { #define is_leap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) #define year_secs(y) ((is_leap(y) ? 366 : 365 ) * 86400) -#define month_secs(m, y) ((days[m] + ((m == 1 && is_leap(y)) ? 1 : 0 )) * 86400) +#define month_secs(m,y) ((days[m] + ((m == 1 && is_leap(y)) ? 1 : 0 )) * 86400) tm.tm_year = 70; while ((secs = year_secs(tm.tm_year + 1900)) <= t) { @@ -96,7 +94,9 @@ dns_time32_totext(isc_uint32_t value, isc_buffer_t *target) { isc_int64_t base; isc_int64_t t; - /* Find the right epoch. */ + /* + * Find the right epoch. + */ start = time(NULL); start -= 0x7fffffff; base = 0; @@ -132,9 +132,11 @@ dns_time64_fromtext(char *source, isc_int64_t *target) { ((month == 2 && is_leap(year)) ? 1 : 0), day); RANGE(0, 23, hour); RANGE(0, 59, minute); - RANGE(0, 60, second); /* leap second */ + RANGE(0, 60, second); /* 60 == leap second. */ - /* Calulate seconds since epoch. */ + /* + * Calulate seconds since epoch. + */ value = second + (60 * minute) + (3600 * hour) + ((day - 1) * 86400); for (i = 0; i < (month - 1) ; i++) value += days[i] * 86400; diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 52806d35df..1f601ced28 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -16,39 +16,26 @@ */ /* - * $Id: tkey.c,v 1.32 2000/05/02 03:53:57 tale Exp $ + * $Id: tkey.c,v 1.33 2000/05/08 14:35:09 tale Exp $ * Principal Author: Brian Wellington */ #include -#include -#include - -#include -#include #include -#include -#include -#include -#include +#include #include #include #include -#include #include #include #include #include -#include #include #include #include -#include -#include - #define TKEY_RANDOM_AMOUNT 16 #define RETERR(x) do { \ @@ -85,7 +72,8 @@ dns_tkeyctx_destroy(dns_tkey_ctx_t **tctx) { dst_key_free((*tctx)->dhkey); if ((*tctx)->domain != NULL) { dns_name_free((*tctx)->domain, (*tctx)->mctx); - isc_mem_put((*tctx)->mctx, (*tctx)->domain, sizeof(dns_name_t)); + isc_mem_put((*tctx)->mctx, (*tctx)->domain, + sizeof(dns_name_t)); } mctx = (*tctx)->mctx; @@ -169,21 +157,27 @@ compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness, isc_buffer_init(&b, digests, sizeof(digests)); isc_buffer_usedregion(shared, &r); - /* MD5 ( query data | DH value ) */ + /* + * MD5 ( query data | DH value ). + */ RETERR(dst_digest(DST_SIGMODE_INIT, DST_DIGEST_MD5, &ctx, NULL, NULL)); RETERR(dst_digest(DST_SIGMODE_UPDATE, DST_DIGEST_MD5, &ctx, queryrandomness, NULL)); RETERR(dst_digest(DST_SIGMODE_UPDATE, DST_DIGEST_MD5, &ctx, &r, NULL)); RETERR(dst_digest(DST_SIGMODE_FINAL, DST_DIGEST_MD5, &ctx, NULL, &b)); - /* MD5 ( server data | DH value ) */ + /* + * MD5 ( server data | DH value ). + */ RETERR(dst_digest(DST_SIGMODE_INIT, DST_DIGEST_MD5, &ctx, NULL, NULL)); RETERR(dst_digest(DST_SIGMODE_UPDATE, DST_DIGEST_MD5, &ctx, serverrandomness, NULL)); RETERR(dst_digest(DST_SIGMODE_UPDATE, DST_DIGEST_MD5, &ctx, &r, NULL)); RETERR(dst_digest(DST_SIGMODE_FINAL, DST_DIGEST_MD5, &ctx, NULL, &b)); - /* XOR ( DH value, MD5-1 | MD5-2) */ + /* + * XOR ( DH value, MD5-1 | MD5-2). + */ isc_buffer_availableregion(secret, &r); isc_buffer_usedregion(shared, &r2); if (r.length < sizeof(digests) || r.length < r2.length) @@ -229,7 +223,9 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, unsigned char *randomdata = NULL, secretdata[256]; isc_stdtime_t now; - /* Look for a DH KEY record that will work with ours */ + /* + * Look for a DH KEY record that will work with ours. + */ result = dns_message_firstname(msg, DNS_SECTION_ADDITIONAL); while (result == ISC_R_SUCCESS) { keyname = NULL; @@ -293,7 +289,9 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, &ournameout)); ourttl = 0; #if 0 - /* Not sure how to do this without a view... */ + /* + * Not sure how to do this without a view... + */ db = NULL; result = dns_dbtable_find(client->view->dbtable, &ourname, 0, &db); if (result == ISC_R_SUCCESS) { @@ -436,17 +434,23 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkey_ctx_t *tctx, REQUIRE(tctx != NULL); REQUIRE(ring != NULL); - /* Need to do this to determine if this should be freed later */ + /* + * Need to do this to determine if this should be freed later. + */ memset(&tkeyin, 0, sizeof(dns_rdata_tkey_t)); - /* Interpret the question section */ + /* + * Interpret the question section. + */ result = dns_message_firstname(msg, DNS_SECTION_QUESTION); INSIST(result == ISC_R_SUCCESS); qname = NULL; dns_message_currentname(msg, DNS_SECTION_QUESTION, &qname); - /* Look for a TKEY record that matches the question */ + /* + * Look for a TKEY record that matches the question. + */ tkeyset = NULL; name = NULL; result = dns_message_findname(msg, DNS_SECTION_ADDITIONAL, qname, @@ -988,9 +992,13 @@ dns_tkey_processdeleteresponse(dns_message_t *qmsg, dns_message_t *rmsg, RETERR(dns_tsigkey_find(&tsigkey, tkeyname, &rtkey.algorithm, ring)); - /* Mark the key as deleted */ + /* + * Mark the key as deleted. + */ dns_tsigkey_setdeleted(tsigkey); - /* Release the reference */ + /* + * Release the reference. + */ dns_tsigkey_free(&tsigkey); failure: diff --git a/lib/dns/tkeyconf.c b/lib/dns/tkeyconf.c index dd1b3fb01e..f662effc48 100644 --- a/lib/dns/tkeyconf.c +++ b/lib/dns/tkeyconf.c @@ -17,13 +17,12 @@ #include -#include -#include +#include +#include -#include -#include #include #include +#include #include #define RETERR(x) do { \ diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index c520a9949b..9bcee5c170 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -16,38 +16,28 @@ */ /* - * $Id: tsig.c,v 1.54 2000/05/02 03:53:58 tale Exp $ + * $Id: tsig.c,v 1.55 2000/05/08 14:35:11 tale Exp $ * Principal Author: Brian Wellington */ #include -#include -#include - -#include -#include +#include #include -#include -#include -#include #include #include #include -#include #include #include #include -#include #include #include -#include #include #define TSIG_MAGIC 0x54534947 /* TSIG */ -#define VALID_TSIG_KEY(x) ((x) != NULL && (x)->magic == TSIG_MAGIC) +#define VALID_TSIG_KEY(x) ISC_MAGIC_VALID(x, TSIG_MAGIC) #define is_response(msg) (msg->flags & DNS_MESSAGEFLAG_QR) @@ -269,7 +259,9 @@ dns_tsig_sign(dns_message_t *msg) { REQUIRE(VALID_TSIG_KEY(msg->tsigkey)); REQUIRE(msg->tsig == NULL); - /* If this is a response, there should be a query tsig */ + /* + * If this is a response, there should be a query tsig. + */ if (is_response(msg) && msg->querytsig == NULL) return (DNS_R_EXPECTEDTSIG); @@ -334,7 +326,9 @@ dns_tsig_sign(dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_algorithm; - /* If this is a response, digest the query signature */ + /* + * If this is a response, digest the query signature. + */ if (is_response(msg)) { isc_buffer_putuint16(&databuf, msg->querytsig->siglen); isc_buffer_availableregion(&databuf, &r); @@ -350,7 +344,9 @@ dns_tsig_sign(dns_message_t *msg) { goto cleanup_algorithm; } - /* Digest the header */ + /* + * Digest the header. + */ isc_buffer_init(&headerbuf, header, sizeof(header)); dns_message_renderheader(msg, &headerbuf); isc_buffer_usedregion(&headerbuf, &r); @@ -358,7 +354,9 @@ dns_tsig_sign(dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_other; - /* Digest the remainder of the message */ + /* + * Digest the remainder of the message. + */ isc_buffer_usedregion(msg->buffer, &r); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); ret = dst_sign(DST_SIGMODE_UPDATE, key->key, &ctx, &r, NULL); @@ -366,7 +364,9 @@ dns_tsig_sign(dns_message_t *msg) { goto cleanup_other; if (msg->tcp_continuation == 0) { - /* Digest the name, class, ttl, alg */ + /* + * Digest the name, class, ttl, alg. + */ dns_name_toregion(&key->name, &r); ret = dst_sign(DST_SIGMODE_UPDATE, key->key, &ctx, &r, NULL); @@ -415,7 +415,9 @@ dns_tsig_sign(dns_message_t *msg) { goto cleanup_other; if (msg->tcp_continuation == 0) { - /* Digest the error and other data length */ + /* + * Digest the error and other data length. + */ isc_buffer_clear(&databuf); isc_buffer_putuint16(&databuf, tsig->error); isc_buffer_putuint16(&databuf, tsig->otherlen); @@ -426,7 +428,9 @@ dns_tsig_sign(dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_other; - /* Digest the error and other data */ + /* + * Digest the error and other data. + */ if (tsig->otherlen > 0) { r.length = tsig->otherlen; r.base = tsig->other; @@ -558,7 +562,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (msg->tcp_continuation) return(dns_tsig_verify_tcp(source, msg)); - /* There should be a TSIG record... */ + /* + * There should be a TSIG record... + */ if (msg->tsigset == NULL) return (DNS_R_EXPECTEDTSIG); @@ -591,7 +597,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (ret != ISC_R_SUCCESS) goto cleanup_emptystruct; - /* Do the key name and algorithm match that of the query? */ + /* + * Do the key name and algorithm match that of the query? + */ if (is_response(msg) && (!dns_name_equal(keyname, &msg->tsigkey->name) || !dns_name_equal(&tsig->algorithm, &msg->querytsig->algorithm))) @@ -600,10 +608,14 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, return (DNS_R_TSIGVERIFYFAILURE); } - /* Get the current time */ + /* + * Get the current time. + */ isc_stdtime_get(&now); - /* Find dns_tsigkey_t based on keyname */ + /* + * Find dns_tsigkey_t based on keyname. + */ if (msg->tsigkey == NULL) { ret = ISC_R_NOTFOUND; if (sring != NULL) @@ -634,7 +646,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, key = tsigkey->key; - /* Is the time ok? */ + /* + * Is the time ok? + */ if (abs(now - tsig->timesigned) > tsig->fudge) { msg->tsigstatus = dns_tsigerror_badtime; return (DNS_R_TSIGVERIFYFAILURE); @@ -666,21 +680,29 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, } } - /* Extract the header */ + /* + * Extract the header. + */ isc_buffer_usedregion(source, &r); memcpy(header, r.base, DNS_MESSAGE_HEADERLEN); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); - /* Decrement the additional field counter */ + /* + * Decrement the additional field counter. + */ memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); addcount = htons(ntohs(addcount) - 1); memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); - /* Put in the original id */ + /* + * Put in the original id. + */ id = htons(tsig->originalid); memcpy(&header[0], &id, 2); - /* Digest the modified header */ + /* + * Digest the modified header. + */ header_r.base = (unsigned char *) header; header_r.length = DNS_MESSAGE_HEADERLEN; ret = dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &header_r, @@ -688,7 +710,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (ret != ISC_R_SUCCESS) goto cleanup_key; - /* Digest all non-TSIG records. */ + /* + * Digest all non-TSIG records. + */ isc_buffer_usedregion(source, &source_r); r.base = source_r.base + DNS_MESSAGE_HEADERLEN; r.length = msg->sigstart - DNS_MESSAGE_HEADERLEN; @@ -696,7 +720,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (ret != ISC_R_SUCCESS) goto cleanup_key; - /* Digest the key name */ + /* + * Digest the key name. + */ dns_name_toregion(&tsigkey->name, &r); ret = dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &r, &sig_r); if (ret != ISC_R_SUCCESS) @@ -710,7 +736,9 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (ret != ISC_R_SUCCESS) goto cleanup_key; - /* Digest the key algorithm */ + /* + * Digest the key algorithm. + */ dns_name_toregion(&tsigkey->algorithm, &r); ret = dst_verify(DST_SIGMODE_UPDATE, key, &ctx, &r, &sig_r); if (ret != ISC_R_SUCCESS) @@ -822,7 +850,9 @@ dns_tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_emptystruct; - /* Do the key name and algorithm match that of the query? */ + /* + * Do the key name and algorithm match that of the query? + */ if (!dns_name_equal(keyname, &msg->tsigkey->name) || !dns_name_equal(&tsig->algorithm, &msg->querytsig->algorithm)) @@ -831,7 +861,9 @@ dns_tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { return (DNS_R_TSIGVERIFYFAILURE); } - /* Is the time ok? */ + /* + * Is the time ok? + */ isc_stdtime_get(&now); if (abs(now - tsig->timesigned) > tsig->fudge) { msg->tsigstatus = dns_tsigerror_badtime; @@ -864,26 +896,34 @@ dns_tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { } } - /* Extract the header */ + /* + * Extract the header. + */ isc_buffer_usedregion(source, &r); memcpy(header, r.base, DNS_MESSAGE_HEADERLEN); isc_region_consume(&r, DNS_MESSAGE_HEADERLEN); - /* Decrement the additional field counter if necessary */ + /* + * Decrement the additional field counter if necessary. + */ if (has_tsig) { memcpy(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); addcount = htons(ntohs(addcount) - 1); memcpy(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); } - /* Put in the original id. */ + /* + * Put in the original id. + */ /* XXX Can TCP transfers be forwarded? How would that work? */ if (tsig != NULL) { id = htons(tsig->originalid); memcpy(&header[0], &id, 2); } - /* Digest the modified header */ + /* + * Digest the modified header. + */ header_r.base = (unsigned char *) header; header_r.length = DNS_MESSAGE_HEADERLEN; ret = dst_verify(DST_SIGMODE_UPDATE, key, &msg->tsigctx, &header_r, @@ -891,7 +931,9 @@ dns_tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_struct; - /* Digest all non-TSIG records. */ + /* + * Digest all non-TSIG records. + */ isc_buffer_usedregion(source, &source_r); r.base = source_r.base + DNS_MESSAGE_HEADERLEN; if (has_tsig) @@ -902,7 +944,9 @@ dns_tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_struct; - /* Digest the time signed and fudge */ + /* + * Digest the time signed and fudge. + */ if (has_tsig) { isc_buffer_init(&databuf, data, sizeof(data)); isc_buffer_putuint16(&databuf, (isc_uint16_t)(tsig->timesigned @@ -971,7 +1015,9 @@ dns_tsigkey_find(dns_tsigkey_t **tsigkey, dns_name_t *name, if (key->inception != key->expire && key->expire < now) { - /* the key has expired */ + /* + * The key has expired. + */ key->deleted = ISC_TRUE; continue; } diff --git a/lib/dns/tsigconf.c b/lib/dns/tsigconf.c index 0340c78ac7..ad175b7a84 100644 --- a/lib/dns/tsigconf.c +++ b/lib/dns/tsigconf.c @@ -18,12 +18,12 @@ #include #include +#include #include -#include +#include +#include -#include -#include -#include +#include #include static isc_result_t @@ -49,7 +49,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring, dns_name_init(&keyname, NULL); dns_name_init(&alg, NULL); - /* Create the key name */ + /* + * Create the key name. + */ isc_buffer_init(&keynamesrc, key->keyid, strlen(key->keyid)); isc_buffer_add(&keynamesrc, strlen(key->keyid)); isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata)); @@ -58,7 +60,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring, if (ret != ISC_R_SUCCESS) goto failure; - /* Create the algorithm */ + /* + * Create the algorithm. + */ if (strcasecmp(key->algorithm, "hmac-md5") == 0) alg = *dns_tsig_hmacmd5_name; else { diff --git a/lib/dns/ttl.c b/lib/dns/ttl.c index e35cdb8858..e976f3f574 100644 --- a/lib/dns/ttl.c +++ b/lib/dns/ttl.c @@ -20,14 +20,11 @@ #include #include #include -#include -#include -#include -#include -#include #include #include +#include +#include #include #include diff --git a/lib/dns/validator.c b/lib/dns/validator.c index 7da3489934..b580a01aa1 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -17,11 +17,8 @@ #include -#include -#include +#include #include -#include -#include #include #include @@ -29,10 +26,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -42,8 +37,6 @@ #include #include -#include - /* * We don't use the SIG RR's _tostruct routine because it copies things. */ @@ -170,7 +163,9 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) { LOCK(&val->lock); result = get_dst_key(val, val->siginfo, rdataset); if (result != ISC_R_SUCCESS) { - /* No matching key */ + /* + * No matching key. + */ validator_done(val, result); UNLOCK(&val->lock); goto free_event; @@ -192,7 +187,9 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) { free_event: dns_resolver_destroyfetch(&val->fetch); - /* free stuff from the event */ + /* + * Free stuff from the event. + */ isc_mem_put(val->view->mctx, devent->rdataset, sizeof(dns_rdataset_t)); isc_mem_put(val->view->mctx, devent->sigrdataset, sizeof(dns_rdataset_t)); @@ -218,7 +215,9 @@ fetch_callback_nullkey(isc_task_t *task, isc_event_t *event) { if (devent->result == ISC_R_SUCCESS) { LOCK(&val->lock); if (!containsnullkey(val, rdataset)) { - /* No null key */ + /* + * No null key. + */ validator_log(val, ISC_LOG_DEBUG(3), "found a keyset, no null key"); result = proveunsecure(val, ISC_TRUE); @@ -234,21 +233,18 @@ fetch_callback_nullkey(isc_task_t *task, isc_event_t *event) { else { dns_name_t *tname; tname = dns_fixedname_name(&devent->foundname); - result = dns_validator_create(val->view, - tname, - dns_rdatatype_key, - rdataset, - sigrdataset, - NULL, - 0, - val->task, - nullkeyvalidated, - val, - &val->keyvalidator); + result = dns_validator_create(val->view, tname, + dns_rdatatype_key, + rdataset, + sigrdataset, NULL, + 0, val->task, + nullkeyvalidated, + val, + &val->keyvalidator); if (result != ISC_R_SUCCESS) validator_done(val, result); /* - * don't free these, since they'll be + * Don't free these, since they'll be * freed in nullkeyvalidated. */ devent->rdataset = NULL; @@ -261,7 +257,9 @@ fetch_callback_nullkey(isc_task_t *task, isc_event_t *event) { devent->result == DNS_R_NXDOMAIN || devent->result == DNS_R_NXRRSET) { - /* No keys */ + /* + * No keys. + */ validator_log(val, ISC_LOG_DEBUG(3), "no keys found"); LOCK(&val->lock); @@ -276,7 +274,9 @@ fetch_callback_nullkey(isc_task_t *task, isc_event_t *event) { dns_resolver_destroyfetch(&val->fetch); - /* free stuff from the event */ + /* + * Free stuff from the event. + */ if (devent->rdataset != NULL) isc_mem_put(val->view->mctx, devent->rdataset, sizeof(dns_rdataset_t)); @@ -304,7 +304,9 @@ keyvalidated(isc_task_t *task, isc_event_t *event) { LOCK(&val->lock); result = get_dst_key(val, val->siginfo, rdataset); if (result != ISC_R_SUCCESS) { - /* No matching key */ + /* + * No matching key. + */ validator_done(val, result); UNLOCK(&val->lock); goto free_event; @@ -325,7 +327,9 @@ keyvalidated(isc_task_t *task, isc_event_t *event) { dns_result_totext(devent->result)); free_event: dns_validator_destroy(&val->keyvalidator); - /* free stuff from the event */ + /* + * free stuff from the event. + */ isc_mem_put(val->view->mctx, devent->rdataset, sizeof(dns_rdataset_t)); isc_mem_put(val->view->mctx, devent->sigrdataset, sizeof(dns_rdataset_t)); @@ -362,7 +366,9 @@ nullkeyvalidated(isc_task_t *task, isc_event_t *event) { dns_validator_destroy(&val->keyvalidator); - /* free stuff from the event */ + /* + * free stuff from the event. + */ isc_mem_put(val->view->mctx, devent->rdataset, sizeof(dns_rdataset_t)); isc_mem_put(val->view->mctx, devent->sigrdataset, sizeof(dns_rdataset_t)); @@ -671,7 +677,9 @@ validate(dns_validator_t *val, isc_boolean_t resume) { event = val->event; if (resume) { - /* We alraedy have a sigrdataset. */ + /* + * We alraedy have a sigrdataset. + */ result = ISC_R_SUCCESS; } else { result = dns_rdataset_first(event->sigrdataset); @@ -829,10 +837,11 @@ nxtvalidate(dns_validator_t *val, isc_boolean_t resume) { result = dns_rdataset_first(sigset); INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&sigrdata); - dns_rdataset_current(sigset, &sigrdata); - val->siginfo = isc_mem_get( - val->view->mctx, - sizeof *val->siginfo); + dns_rdataset_current(sigset, + &sigrdata); + val->siginfo = + isc_mem_get(val->view->mctx, + sizeof(*val->siginfo)); if (val->siginfo == NULL) return (ISC_R_NOMEMORY); rdata_to_siginfo(&sigrdata, @@ -989,15 +998,14 @@ proveunsecure(dns_validator_t *val, isc_boolean_t resume) { dns_rdataset_init(frdataset); dns_rdataset_init(fsigrdataset); result = dns_resolver_createfetch(val->view->resolver, - tname, - dns_rdatatype_key, - NULL, NULL, NULL, 0, - val->event->ev_sender, - fetch_callback_nullkey, - val, - frdataset, - fsigrdataset, - &val->fetch); + tname, + dns_rdatatype_key, + NULL, NULL, NULL, 0, + val->event->ev_sender, + fetch_callback_nullkey, + val, frdataset, + fsigrdataset, + &val->fetch); if (result != ISC_R_SUCCESS) return (result); return (DNS_R_WAIT); @@ -1047,7 +1055,9 @@ validator_start(isc_task_t *task, isc_event_t *event) { */ result = nxtvalidate(val, ISC_FALSE); } else { - /* This shouldn't happen */ + /* + * This shouldn't happen. + */ result = ISC_R_FAILURE; /* Keep compiler happy. */ INSIST(0); } diff --git a/lib/dns/view.c b/lib/dns/view.c index 880885d4ab..c85fe177e5 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -17,28 +17,21 @@ #include -#include - -#include +#include #include #include #include #include #include -#include #include -#include #include #include -#include #include #include #include #include #include -#include -#include #include #include @@ -137,7 +130,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, goto cleanup_trustedkeys; view->peers = NULL; - /* Initialize configuration data with default values. */ + /* + * Initialize configuration data with default values. + */ view->recursion = ISC_TRUE; view->auth_nxdomain = ISC_FALSE; /* Was true in BIND 8 */ view->transfer_format = dns_one_answer; diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 5313fb1709..1a7953dfe4 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,48 +15,30 @@ * SOFTWARE. */ -/* $Id: xfrin.c,v 1.65 2000/04/27 00:02:07 tale Exp $ */ +/* $Id: xfrin.c,v 1.66 2000/05/08 14:35:17 tale Exp $ */ #include -#include -#include -#include -#include -#include - -#include - -#include -#include #include -#include -#include -#include #include +#include +#include #include #include -#include #include -#include #include #include #include -#include #include -#include #include #include -#include #include #include #include -#include #include #include #include -#include /* * Incoming AXFR and IXFR. @@ -339,7 +321,9 @@ ixfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op, return (result); } -/* Apply a set of IXFR changes to the database. */ +/* + * Apply a set of IXFR changes to the database. + */ static isc_result_t ixfr_apply(dns_xfrin_ctx_t *xfr) { isc_result_t result; @@ -388,7 +372,8 @@ xfr_rr(dns_xfrin_ctx_t *xfr, switch (xfr->state) { case XFRST_SOAQUERY: xfr->end_serial = dns_soa_getserial(rdata); - if (!DNS_SERIAL_GT(xfr->end_serial, xfr->ixfr.request_serial)) { + if (!DNS_SERIAL_GT(xfr->end_serial, + xfr->ixfr.request_serial)) { xfrin_log(xfr, ISC_LOG_DEBUG(3), "requested serial %u, " "master has %u, not updating", @@ -400,7 +385,7 @@ xfr_rr(dns_xfrin_ctx_t *xfr, case XFRST_GOTSOA: /* - * skip other records in the answer section + * Skip other records in the answer section. */ break; @@ -976,7 +961,9 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) { CHECK(render(msg, &xfr->qbuffer)); - /* Save the query TSIG and don't let message_destroy free it */ + /* + * Save the query TSIG and don't let message_destroy free it. + */ xfr->lasttsig = msg->tsig; msg->tsig = NULL; @@ -1004,8 +991,7 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) { /* XXX there should be library support for sending DNS TCP messages */ static void -xfrin_sendlen_done(isc_task_t *task, isc_event_t *event) -{ +xfrin_sendlen_done(isc_task_t *task, isc_event_t *event) { isc_socketevent_t *sev = (isc_socketevent_t *) event; dns_xfrin_ctx_t *xfr = (dns_xfrin_ctx_t *) event->ev_arg; isc_result_t evresult = sev->result; @@ -1039,8 +1025,7 @@ xfrin_sendlen_done(isc_task_t *task, isc_event_t *event) static void -xfrin_send_done(isc_task_t *task, isc_event_t *event) -{ +xfrin_send_done(isc_task_t *task, isc_event_t *event) { isc_socketevent_t *sev = (isc_socketevent_t *) event; dns_xfrin_ctx_t *xfr = (dns_xfrin_ctx_t *) event->ev_arg; isc_result_t result; @@ -1158,20 +1143,28 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { goto failure; if (msg->tsig != NULL) { - /* Reset the counter */ + /* + * Reset the counter. + */ xfr->sincetsig = 0; - /* Free the last tsig, if there is one */ + /* + * Free the last tsig, if there is one. + */ if (xfr->lasttsig != NULL) { dns_rdata_freestruct(xfr->lasttsig); isc_mem_put(xfr->mctx, xfr->lasttsig, sizeof(*xfr->lasttsig)); } - /* Update the last tsig pointer */ + /* + * Update the last tsig pointer. + */ xfr->lasttsig = msg->tsig; - /* Reset msg->tsig so it doesn't get freed */ + /* + * Reset msg->tsig so it doesn't get freed. + */ msg->tsig = NULL; } else if (msg->tsigkey != NULL) { xfr->sincetsig++; @@ -1183,13 +1176,19 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { } } - /* Update the number of messages received */ + /* + * Update the number of messages received. + */ xfr->nmsg++; - /* Reset msg->querytsig so it doesn't get freed */ + /* + * Reset msg->querytsig so it doesn't get freed. + */ msg->querytsig = NULL; - /* Copy the context back */ + /* + * Copy the context back. + */ xfr->tsigctx = msg->tsigctx; dns_message_destroy(&msg); @@ -1213,7 +1212,9 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { xfr->shuttingdown = ISC_TRUE; maybe_free(xfr); } else { - /* Read the next message. */ + /* + * Read the next message. + */ CHECK(dns_tcpmsg_readmessage(&xfr->tcpmsg, xfr->task, xfrin_recv_done, xfr)); xfr->recvs++; @@ -1238,7 +1239,9 @@ xfrin_timeout(isc_task_t *task, isc_event_t *event) { UNUSED(task); isc_event_free(&event); - /* This will log "giving up: timeout". */ + /* + * This will log "giving up: timeout". + */ xfrin_fail(xfr, ISC_R_TIMEDOUT, "giving up"); } @@ -1329,7 +1332,9 @@ xfrin_logv(int level, dns_name_t *zonename, isc_sockaddr_t *masteraddr, masterbuf.base, msgmem); } -/* Logging function for use when a xfrin_ctx_t has not yet been created. */ +/* + * Logging function for use when a xfrin_ctx_t has not yet been created. + */ static void xfrin_log1(int level, dns_name_t *zonename, isc_sockaddr_t *masteraddr, @@ -1341,7 +1346,9 @@ xfrin_log1(int level, dns_name_t *zonename, isc_sockaddr_t *masteraddr, va_end(ap); } -/* Logging function for use when there is a xfrin_ctx_t. */ +/* + * Logging function for use when there is a xfrin_ctx_t. + */ static void xfrin_log(dns_xfrin_ctx_t *xfr, unsigned int level, const char *fmt, ...) @@ -1352,11 +1359,13 @@ xfrin_log(dns_xfrin_ctx_t *xfr, unsigned int level, const char *fmt, ...) va_end(ap); } -isc_result_t dns_xfrinlist_init(dns_xfrinlist_t *list) { +isc_result_t +dns_xfrinlist_init(dns_xfrinlist_t *list) { ISC_LIST_INIT(list->transfers); return (isc_mutex_init(&list->lock)); } -void dns_xfrinlist_destroy(dns_xfrinlist_t *list) { +void +dns_xfrinlist_destroy(dns_xfrinlist_t *list) { isc_mutex_destroy(&list->lock); } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index d8a1855b1c..1624129fe0 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,20 +15,15 @@ * SOFTWARE. */ -/* $Id: zone.c,v 1.105 2000/05/02 03:54:01 tale Exp $ */ +/* $Id: zone.c,v 1.106 2000/05/08 14:35:18 tale Exp $ */ #include -#include -#include - #include -#include #include -#include #include -#include #include +#include #include #include #include @@ -36,26 +31,20 @@ #include #include #include -#include -#include #include #include #include -#include #include #include #include -#include #include -#include -#include +#include #include #include #include #include #include #include -#include /* XXX remove once config changes are in place */ #define dns_zone_uptodate(x) zone_log(x, me, ISC_LOG_INFO, "dns_zone_uptodate") @@ -402,8 +391,9 @@ zone_free(dns_zone_t *zone) { UNLOCK(&zone->lock); - /* managed objects */ - /* order is important */ + /* + * Managed objects. Order is important. + */ if (DNS_ZONE_FLAG(zone, DNS_ZONE_F_REFRESH)) cancel_refresh(zone); if (zone->timer != NULL) @@ -472,7 +462,9 @@ dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass) { REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(rdclass != dns_rdataclass_none); - /* test and set */ + /* + * Test and set. + */ LOCK(&zone->lock); REQUIRE(zone->rdclass == dns_rdataclass_none || zone->rdclass == rdclass); @@ -496,7 +488,9 @@ dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type) { REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(type != dns_zone_none); - /* test and set */ + /* + * Test and set. + */ LOCK(&zone->lock); REQUIRE(zone->type == dns_zone_none || zone->type == type); zone->type = type; @@ -519,12 +513,14 @@ dns_zone_setdbtype(dns_zone_t *zone, char *db_type) { return (result); } -void dns_zone_setview(dns_zone_t *zone, dns_view_t *view) { +void +dns_zone_setview(dns_zone_t *zone, dns_view_t *view) { zone->view = view; } -dns_view_t *dns_zone_getview(dns_zone_t *zone) { +dns_view_t * +dns_zone_getview(dns_zone_t *zone) { return (zone->view); } @@ -602,8 +598,8 @@ dns_zone_setjournal(dns_zone_t *zone, const char *journal) { char * dns_zone_getjournal(dns_zone_t *zone) { - REQUIRE(DNS_ZONE_VALID(zone)); + return (zone->journal); } diff --git a/lib/dns/zoneconf.c b/lib/dns/zoneconf.c index 6ae025c898..b86af9f406 100644 --- a/lib/dns/zoneconf.c +++ b/lib/dns/zoneconf.c @@ -17,14 +17,9 @@ #include -#include -#include -#include -#include #include -#include -#include +#include #include #include #include @@ -40,9 +35,12 @@ static isc_result_t configure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_aclconfctx_t *aclconfctx, dns_zone_t *zone, - isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **), - isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **), - isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **), + isc_result_t (*getcacl)(dns_c_zone_t *, + dns_c_ipmatchlist_t **), + isc_result_t (*getviewcacl)(dns_c_view_t * + , dns_c_ipmatchlist_t **), + isc_result_t (*getglobalcacl)(dns_c_ctx_t *, + dns_c_ipmatchlist_t **), void (*setzacl)(dns_zone_t *, dns_acl_t *), void (*clearzacl)(dns_zone_t *)) { @@ -195,18 +193,22 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr); + result = dns_c_view_getmaxtransfertimeout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransfertimeout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = MAX_XFER_TIME; dns_zone_setmaxxfrout(zone, maxxfr); result = dns_c_zone_getmaxtransidleout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransferidleout(cview, &maxxfr); + result = dns_c_view_getmaxtransferidleout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransferidleout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = DNS_DEFAULT_IDLEOUT; dns_zone_setidleout(zone, maxxfr); @@ -224,7 +226,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, case dns_c_zone_forward: #ifdef notyet /* - * forward zones are still in a state of flux + * Forward zones are still in a state of flux. */ czone->u.fzone.check_names; /* XXX unused in BIND 8 */ czone->u.fzone.forward; /* XXX*/ @@ -249,8 +251,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, #endif result = configure_zone_acl(czone, cctx, cview, ac, zone, dns_c_zone_getallowquery, - dns_c_view_getallowquery, - dns_c_ctx_getallowquery, + dns_c_view_getallowquery, + dns_c_ctx_getallowquery, dns_zone_setqueryacl, dns_zone_clearqueryacl); if (result != ISC_R_SUCCESS) @@ -281,7 +283,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersource(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersource(cview, &sockaddr); + result = dns_c_view_gettransfersource(cview, + &sockaddr); if (result != ISC_R_SUCCESS) result = dns_c_ctx_gettransfersource(cctx, &sockaddr); if (result != ISC_R_SUCCESS) @@ -290,27 +293,33 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersourcev6(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersourcev6(cview, &sockaddr); + result = dns_c_view_gettransfersourcev6(cview, + &sockaddr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr); + result = dns_c_ctx_gettransfersourcev6(cctx, + &sockaddr); if (result != ISC_R_SUCCESS) sockaddr = sockaddr_any6; dns_zone_setxfrsource6(zone, &sockaddr); result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr); + result = dns_c_view_getmaxtransfertimeout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransfertimeout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = MAX_XFER_TIME; dns_zone_setmaxxfrout(zone, maxxfr); result = dns_c_zone_getmaxtransidleout(czone, &maxxfr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_getmaxtransferidleout(cview, &maxxfr); + result = dns_c_view_getmaxtransferidleout(cview, + &maxxfr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr); + result = dns_c_ctx_getmaxtransferidleout(cctx, + &maxxfr); if (result != ISC_R_SUCCESS) maxxfr = DNS_DEFAULT_IDLEOUT; dns_zone_setidleout(zone, maxxfr); @@ -395,7 +404,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersource(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersource(cview, &sockaddr); + result = dns_c_view_gettransfersource(cview, + &sockaddr); if (result != ISC_R_SUCCESS) result = dns_c_ctx_gettransfersource(cctx, &sockaddr); if (result != ISC_R_SUCCESS) @@ -404,9 +414,11 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, result = dns_c_zone_gettransfersourcev6(czone, &sockaddr); if (result != ISC_R_SUCCESS && cview != NULL) - result = dns_c_view_gettransfersourcev6(cview, &sockaddr); + result = dns_c_view_gettransfersourcev6(cview, + &sockaddr); if (result != ISC_R_SUCCESS) - result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr); + result = dns_c_ctx_gettransfersourcev6(cctx, + &sockaddr); if (result != ISC_R_SUCCESS) sockaddr = sockaddr_any6; dns_zone_setxfrsource6(zone, &sockaddr); @@ -434,8 +446,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, } isc_boolean_t -dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) -{ +dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) { const char *cfilename; const char *zfilename; @@ -455,8 +466,7 @@ dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) } isc_result_t -dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) -{ +dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) { isc_int32_t val; isc_result_t result; diff --git a/lib/dns/zt.c b/lib/dns/zt.c index b67614f811..ce9aaa7271 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -40,8 +40,11 @@ struct dns_zt { #define ZTMAGIC 0x5a54626cU /* ZTbl */ #define VALID_ZT(zt) ISC_MAGIC_VALID(zt, ZTMAGIC) -static void auto_detach(void *, void *); -static isc_result_t load(dns_zone_t *zone, void *uap); +static void +auto_detach(void *, void *); + +static isc_result_t +load(dns_zone_t *zone, void *uap); isc_result_t dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **ztp) { @@ -286,7 +289,7 @@ static void auto_detach(void *data, void *arg) { dns_zone_t *zone = data; - (void)arg; + UNUSED(arg); dns_zone_detach(&zone); } diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c index ff70219aa8..abd11d4aa9 100644 --- a/lib/isc/assertions.c +++ b/lib/isc/assertions.c @@ -17,10 +17,8 @@ #include -#include #include #include -#include #include diff --git a/lib/isc/base64.c b/lib/isc/base64.c index ed743c95bb..42af82dad3 100644 --- a/lib/isc/base64.c +++ b/lib/isc/base64.c @@ -15,22 +15,14 @@ * SOFTWARE. */ -/* $Id: base64.c,v 1.11 2000/04/28 01:04:36 halley Exp $ */ +/* $Id: base64.c,v 1.12 2000/05/08 14:37:15 tale Exp $ */ #include -#include -#include -#include -#include - #include #include #include -#include -#include -#include -#include +#include #include #define RETERR(x) do { \ @@ -40,7 +32,8 @@ } while (0) -/* These static functions are also present in lib/dns/rdata.c. I'm not +/* + * These static functions are also present in lib/dns/rdata.c. I'm not * sure where they should go. -- bwelling */ static isc_result_t str_totext(char *source, isc_buffer_t *target); diff --git a/lib/isc/bitstring.c b/lib/isc/bitstring.c index ce37fa2ab8..ab9f8be76b 100644 --- a/lib/isc/bitstring.c +++ b/lib/isc/bitstring.c @@ -19,8 +19,6 @@ #include -#include -#include #include #include diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c index 177a0f049a..ba84b30290 100644 --- a/lib/isc/buffer.c +++ b/lib/isc/buffer.c @@ -17,13 +17,10 @@ #include -#include - -#include #include #include #include -#include +#include #include void diff --git a/lib/isc/bufferlist.c b/lib/isc/bufferlist.c index e24927403e..cbac4500b3 100644 --- a/lib/isc/bufferlist.c +++ b/lib/isc/bufferlist.c @@ -19,10 +19,8 @@ #include -#include #include #include -#include #include unsigned int diff --git a/lib/isc/commandline.c b/lib/isc/commandline.c index c34663a30d..4c0163179f 100644 --- a/lib/isc/commandline.c +++ b/lib/isc/commandline.c @@ -48,7 +48,7 @@ * SUCH DAMAGE. */ -/* $Id: commandline.c,v 1.5 2000/04/28 02:08:11 tale Exp $ */ +/* $Id: commandline.c,v 1.6 2000/05/08 14:37:20 tale Exp $ */ /* * This file was adapted from the NetBSD project's source tree, RCS ID: @@ -66,11 +66,9 @@ #include #include -#include -#include -#include #include +#include #include int isc_commandline_index = 1; /* Index into parent argv vector. */ diff --git a/lib/isc/error.c b/lib/isc/error.c index b72818e1cd..da210f39bc 100644 --- a/lib/isc/error.c +++ b/lib/isc/error.c @@ -19,12 +19,14 @@ #include #include -#include #include -static void default_unexpected_callback(char *, int, char *, va_list); -static void default_fatal_callback(char *, int, char *, va_list); +static void +default_unexpected_callback(char *, int, char *, va_list); + +static void +default_fatal_callback(char *, int, char *, va_list); static isc_errorcallback_t unexpected_callback = default_unexpected_callback; static isc_errorcallback_t fatal_callback = default_fatal_callback; diff --git a/lib/isc/event.c b/lib/isc/event.c index 2cae2631e9..8be9d64c35 100644 --- a/lib/isc/event.c +++ b/lib/isc/event.c @@ -21,7 +21,6 @@ #include -#include #include #include #include diff --git a/lib/isc/heap.c b/lib/isc/heap.c index d5ccc9d704..cc36218234 100644 --- a/lib/isc/heap.c +++ b/lib/isc/heap.c @@ -27,13 +27,8 @@ #include -#include -#include - -#include #include #include -#include #include /* diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index c01a25071a..a67e0b815f 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -103,6 +103,7 @@ ***/ #include +#include #include /* @@ -119,9 +120,7 @@ ISC_LANG_BEGINDECLS *** Magic numbers ***/ #define ISC_BUFFER_MAGIC 0x42756621U /* Buf!. */ - -#define ISC_BUFFER_VALID(b) ((b) != NULL && \ - (b)->magic == ISC_BUFFER_MAGIC) +#define ISC_BUFFER_VALID(b) ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC) /* * The following macros MUST be used only on valid buffers. It is the diff --git a/lib/isc/include/isc/quota.h b/lib/isc/include/isc/quota.h index 640c538273..10089521dd 100644 --- a/lib/isc/include/isc/quota.h +++ b/lib/isc/include/isc/quota.h @@ -38,7 +38,7 @@ #include #include -#include +#include /***** ***** Types. @@ -46,8 +46,6 @@ ISC_LANG_BEGINDECLS -typedef struct isc_quota isc_quota_t; - struct isc_quota { isc_mutex_t lock; /* Locked by lock. */ diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index a54440798b..35e0ead7cb 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -58,6 +58,7 @@ typedef struct isc_mempool isc_mempool_t; typedef struct isc_msgcat isc_msgcat_t; typedef struct isc_ondestroy isc_ondestroy_t; typedef struct isc_netaddr isc_netaddr_t; +typedef struct isc_quota isc_quota_t; typedef struct isc_random isc_random_t; typedef struct isc_ratelimiter isc_ratelimiter_t; typedef struct isc_region isc_region_t; diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index c429ee0354..7ac2b89eed 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -57,12 +57,12 @@ #ifdef ISC_UTIL_TRACEON #define ISC_UTIL_TRACE(a) a -#include +#include /* Required for fprintf/stderr when tracing. */ #else #define ISC_UTIL_TRACE(a) #endif -#include /* for ISC_R_SUCCESS */ +#include /* Contractual promise. */ #define LOCK(lp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "LOCKING %p %s %d\n", (lp), __FILE__, __LINE__)); \ @@ -111,7 +111,7 @@ /* * List Macros. */ -#include +#include /* Contractual promise. */ #define LIST(type) ISC_LIST(type) #define INIT_LIST(type) ISC_LIST_INIT(type) @@ -134,7 +134,7 @@ /* * Assertions */ -#include +#include /* Contractual promise. */ #define REQUIRE(e) ISC_REQUIRE(e) #define ENSURE(e) ISC_ENSURE(e) @@ -144,7 +144,7 @@ /* * Errors */ -#include +#include /* Contractual promise. */ #define UNEXPECTED_ERROR isc_error_unexpected #define FATAL_ERROR isc_error_fatal diff --git a/lib/isc/lex.c b/lib/isc/lex.c index 62df06d355..b002521058 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -18,19 +18,12 @@ #include #include -#include -#include #include -#include - -#include -#include #include -#include #include #include -#include +#include #include typedef struct inputsource { diff --git a/lib/isc/lib.c b/lib/isc/lib.c index 59f4a06329..b076a2a6b8 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -19,10 +19,8 @@ #include #include -#include #include -#include #include #include diff --git a/lib/isc/log.c b/lib/isc/log.c index 8bcb3b1d82..f46cc333d6 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.29 2000/05/03 21:09:33 explorer Exp $ */ +/* $Id: log.c,v 1.30 2000/05/08 14:37:26 tale Exp $ */ /* Principal Authors: DCL */ @@ -23,20 +23,15 @@ #include #include -#include -#include #include + #include -#include -#include #include -#include -#include #include #include -#include #include +#include #include #include @@ -811,8 +806,7 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, } void -isc_log_setcontext(isc_log_t *lctx) -{ +isc_log_setcontext(isc_log_t *lctx) { REQUIRE(isc_lctx == NULL); isc_lctx = lctx; diff --git a/lib/isc/mem.c b/lib/isc/mem.c index d7c2d833f4..326e6373ed 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -20,15 +20,12 @@ #include #include #include -#include #include -#include -#include #include #include -#include +#include #ifndef ISC_SINGLETHREADED #include diff --git a/lib/isc/mutexblock.c b/lib/isc/mutexblock.c index a84c7e42aa..47ff91b843 100644 --- a/lib/isc/mutexblock.c +++ b/lib/isc/mutexblock.c @@ -17,9 +17,7 @@ #include -#include #include -#include isc_result_t isc_mutexblock_init(isc_mutex_t *block, unsigned int count) { diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index 35bb0d64ff..51f01167fd 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -17,15 +17,10 @@ #include -#include -#include -#include -#include -#include #include #include -#include +#include #include isc_boolean_t diff --git a/lib/isc/nls/msgcat.c b/lib/isc/nls/msgcat.c index 0ae2b90b53..77e868541d 100644 --- a/lib/isc/nls/msgcat.c +++ b/lib/isc/nls/msgcat.c @@ -22,14 +22,12 @@ #include #include -#include -#include #include #include #ifdef HAVE_CATGETS -#include +#include /* Required for nl_catd. */ #endif /* diff --git a/lib/isc/ondestroy.c b/lib/isc/ondestroy.c index bfa2f9da24..16d464c118 100644 --- a/lib/isc/ondestroy.c +++ b/lib/isc/ondestroy.c @@ -19,15 +19,14 @@ #include -#include #include +#include #include -#include #include #include #define ONDESTROY_MAGIC 0x44655374 /* DeSt */ -#define VALID_ONDESTROY(s) (s != NULL && (s->magic == ONDESTROY_MAGIC)) +#define VALID_ONDESTROY(s) ISC_MAGIC_VALID(s, ONDESTROY_MAGIC) void isc_ondestroy_init(isc_ondestroy_t *ondest) { diff --git a/lib/isc/pthreads/condition.c b/lib/isc/pthreads/condition.c index 4ae2b5ea56..fd51ee1f8b 100644 --- a/lib/isc/pthreads/condition.c +++ b/lib/isc/pthreads/condition.c @@ -18,10 +18,9 @@ #include #include -#include #include -#include +#include #include #include diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c index 23bfc8f1ed..5941300b05 100644 --- a/lib/isc/pthreads/thread.c +++ b/lib/isc/pthreads/thread.c @@ -17,11 +17,7 @@ #include -#include - -#include #include -#include #ifndef THREAD_MINSTACKSIZE #define THREAD_MINSTACKSIZE (64 * 1024) diff --git a/lib/isc/quota.c b/lib/isc/quota.c index 460eec4c8c..5586502554 100644 --- a/lib/isc/quota.c +++ b/lib/isc/quota.c @@ -14,8 +14,8 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +#include -#include #include #include diff --git a/lib/isc/random.c b/lib/isc/random.c index 044003a5d7..a403e26f6e 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -18,12 +18,11 @@ #include #include -#include -#include #include #include #include +#include #include static isc_once_t once = ISC_ONCE_INIT; diff --git a/lib/isc/ratelimiter.c b/lib/isc/ratelimiter.c index 9cbbb5e5f2..e95692e004 100644 --- a/lib/isc/ratelimiter.c +++ b/lib/isc/ratelimiter.c @@ -17,10 +17,7 @@ #include -#include -#include #include -#include #include #include #include diff --git a/lib/isc/result.c b/lib/isc/result.c index d20c4630c7..da190ee117 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -17,17 +17,13 @@ #include -#include #include -#include -#include -#include -#include +#include +#include #include #include -#include -#include +#include #include typedef struct resulttable { diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index aa4fd81e2c..e08e44639b 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -17,16 +17,16 @@ #include -#include - +#include #include #include -#define RWLOCK_MAGIC 0x52574C6BU /* RWLk. */ -#define VALID_RWLOCK(rwl) ((rwl) != NULL && \ - (rwl)->magic == RWLOCK_MAGIC) +#define RWLOCK_MAGIC 0x52574C6BU /* RWLk. */ +#define VALID_RWLOCK(rwl) ISC_MAGIC_VALID(rwl, RWLOCK_MAGIC) #ifdef ISC_RWLOCK_TRACE +#include /* Required for fprintf/stderr. */ + static void print_lock(char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { fprintf(stderr, @@ -40,8 +40,7 @@ print_lock(char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { #endif isc_result_t -isc_rwlock_init(isc_rwlock_t *rwl, - unsigned int read_quota, +isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota, unsigned int write_quota) { isc_result_t result; @@ -213,8 +212,8 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { void isc_rwlock_destroy(isc_rwlock_t *rwl) { - REQUIRE(VALID_RWLOCK(rwl)); + LOCK(&rwl->lock); REQUIRE(rwl->active == 0 && rwl->readers_waiting == 0 && diff --git a/lib/isc/serial.c b/lib/isc/serial.c index e66a275cc6..141a316aa6 100644 --- a/lib/isc/serial.c +++ b/lib/isc/serial.c @@ -15,7 +15,8 @@ * SOFTWARE. */ - /* $Id: serial.c,v 1.3 2000/02/03 23:08:27 halley Exp $ */ +/* $Id: serial.c,v 1.4 2000/05/08 14:37:37 tale Exp $ */ +#include #include diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 762dfda6d7..54b5bda148 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -17,18 +17,13 @@ #include -#include -#include -#include #include -#include #include -#include #include #include #include -#include +#include #include isc_boolean_t diff --git a/lib/isc/symtab.c b/lib/isc/symtab.c index aa2b09097f..6897a3bf1d 100644 --- a/lib/isc/symtab.c +++ b/lib/isc/symtab.c @@ -18,12 +18,9 @@ #include #include -#include -#include -#include #include -#include +#include #include #include diff --git a/lib/isc/task.c b/lib/isc/task.c index f2c8a4c8fb..00fac42bec 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -26,15 +26,10 @@ #include -#include - -#include -#include #include -#include #include #include -#include +#include #include #include #include diff --git a/lib/isc/taskpool.c b/lib/isc/taskpool.c index 743237555d..bba1ef7528 100644 --- a/lib/isc/taskpool.c +++ b/lib/isc/taskpool.c @@ -17,12 +17,8 @@ #include -#include -#include -#include #include #include -#include #include /*** diff --git a/lib/isc/timer.c b/lib/isc/timer.c index c8f16e745f..5ae88555a3 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -17,13 +17,9 @@ #include -#include -#include - #include #include #include -#include #include #include #include @@ -551,7 +547,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) { } static isc_threadresult_t -#ifdef _WIN32 +#ifdef _WIN32 /* XXXDCL */ WINAPI #endif run(void *uap) { diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 19388bf8b0..b4495a1f20 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include @@ -64,13 +64,13 @@ static pthread_t main_thread; #ifndef HAVE_SIGWAIT static void exit_action(int arg) { - (void)arg; + UNUSED(arg); want_shutdown = ISC_TRUE; } static void reload_action(int arg) { - (void)arg; + UNUSED(arg); want_reload = ISC_TRUE; } #endif diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c index 000e712943..14dfd1cf77 100644 --- a/lib/isc/unix/dir.c +++ b/lib/isc/unix/dir.c @@ -15,18 +15,17 @@ * SOFTWARE. */ -/* $Id: dir.c,v 1.8 2000/04/28 01:04:53 halley Exp $ */ +/* $Id: dir.c,v 1.9 2000/05/08 14:37:54 tale Exp $ */ /* Principal Authors: DCL */ -#include -#include +#include + #include #include #include -#include -#include +#include #include #define ISC_DIR_MAGIC 0x4449522aU /* DIR*. */ diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 487df42f99..c5a5d704b2 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -18,24 +18,20 @@ #include #include -#include -#include -#include #include #include -#include #include -#include +#include #include #include /* * XXXDCL As the API for accessing file statistics undoubtedly gets expanded, * it might be good to provide a mechanism that allows for the results - * of a previous stat() to be used again without having to do another stat. - * Such as perl's mechanism of using "_" in place of a file name to indicate + * of a previous stat() to be used again without having to do another stat, + * such as perl's mechanism of using "_" in place of a file name to indicate * that the results of the last stat should be used. But then you get into * annoying MP issues. BTW, Win32 has stat(). */ diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c index aba22db69d..c51f2638c0 100644 --- a/lib/isc/unix/ifiter_sysctl.c +++ b/lib/isc/unix/ifiter_sysctl.c @@ -62,8 +62,7 @@ static int mib[6] = { }; isc_result_t -isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) -{ +isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { isc_interfaceiter_t *iter; isc_result_t result; size_t bufsize; @@ -79,7 +78,9 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) iter->mctx = mctx; iter->buf = 0; - /* Determine the amount of memory needed. */ + /* + * Determine the amount of memory needed. + */ bufsize = 0; if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) { UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -205,7 +206,9 @@ internal_current(isc_interfaceiter_t *iter) { + ROUNDUP(sa->sa_len)); #else #ifdef sgi - /* Do as the contributed SGI code does. */ + /* + * Do as the contributed SGI code does. + */ sa = (struct sockaddr *)((char*)(sa) + ROUNDUP(_FAKE_SA_LEN_DST(sa))); #else @@ -265,7 +268,9 @@ internal_next(isc_interfaceiter_t *iter) { static void internal_destroy(isc_interfaceiter_t *iter) { - iter = iter; /* Unused. */ - /* Do nothing. */ + UNUSED(iter); /* Unused. */ + /* + * Do nothing. + */ } diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 2ee2a36091..d9784314ab 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -69,12 +69,12 @@ #include #include -#include +#include /* Contractual promise. */ -#include -#include +#include /* Contractual promise. */ +#include /* Contractual promise. */ #ifdef ISC_PLATFORM_HAVENETINET6IN6H -#include +#include /* Contractual promise. */ #endif #include @@ -88,7 +88,7 @@ #endif #ifndef ISC_PLATFORM_HAVEIPV6 -#include +#include /* Contractual promise. */ #endif #ifndef ISC_PLATFORM_HAVEIN6PKTINFO @@ -153,17 +153,20 @@ isc_net_probeipv6(void); */ #ifdef ISC_PLATFORM_NEEDNTOP -const char *isc_net_ntop(int af, const void *src, char *dst, size_t size); +const char * +isc_net_ntop(int af, const void *src, char *dst, size_t size); #define inet_ntop isc_net_ntop #endif #ifdef ISC_PLATFORM_NEEDPTON -int isc_net_pton(int af, const char *src, void *dst); +int +isc_net_pton(int af, const char *src, void *dst); #define inet_pton isc_net_pton #endif #ifdef ISC_PLATFORM_NEEDATON -int isc_net_aton(const char *cp, struct in_addr *addr); +int +isc_net_aton(const char *cp, struct in_addr *addr); #define inet_aton isc_net_aton #endif diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index d95a15222c..770c20eade 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -20,20 +20,18 @@ #include #include #ifdef HAVE_SYS_SOCKIO_H -#include +#include /* Required for ifiter_ioctl.c. */ #endif #include #include #include -#include #include -#include -#include #include #include #include +#include #include #include #include diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index ccecadb0c5..c5d5406170 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -18,13 +18,11 @@ #include #include -#include #include -#include -#include #include #include +#include #include #if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d0267b8529..0b91f0d64f 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -30,11 +30,9 @@ #include #include -#include #include #include #include -#include #include #include #include diff --git a/lib/isc/unix/stdtime.c b/lib/isc/unix/stdtime.c index d27d668652..a5c687180e 100644 --- a/lib/isc/unix/stdtime.c +++ b/lib/isc/unix/stdtime.c @@ -17,23 +17,13 @@ #include -#include #include -#include -#include -#include -#include -#include - -#include -#include #include #include void -isc_stdtime_get(isc_stdtime_t *t) -{ +isc_stdtime_get(isc_stdtime_t *t) { struct timeval tv; /* diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index edc5bea809..03d4750306 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -17,17 +17,10 @@ #include -#include -#include - -#include -#include -#include -#include #include +#include -#include -#include +#include #include #include diff --git a/lib/lwres/context.c b/lib/lwres/context.c index cce57eb69a..5ddf9db782 100644 --- a/lib/lwres/context.c +++ b/lib/lwres/context.c @@ -17,7 +17,6 @@ #include -#include #include #include #include @@ -29,9 +28,7 @@ #include -#include #include -#include #include "context_p.h" #include "assert_p.h" @@ -87,8 +84,7 @@ lwres_context_create(lwres_context_t **contextp, void *arg, } void -lwres_context_destroy(lwres_context_t **contextp) -{ +lwres_context_destroy(lwres_context_t **contextp) { lwres_context_t *ctx; REQUIRE(contextp != NULL && *contextp != NULL); @@ -105,24 +101,21 @@ lwres_context_destroy(lwres_context_t **contextp) } lwres_uint32_t -lwres_context_nextserial(lwres_context_t *ctx) -{ +lwres_context_nextserial(lwres_context_t *ctx) { REQUIRE(ctx != NULL); return (ctx->serial++); } void -lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) -{ +lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) { REQUIRE(ctx != NULL); ctx->serial = serial; } void -lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) -{ +lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) { REQUIRE(mem != NULL); REQUIRE(len != 0); @@ -130,16 +123,14 @@ lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) } void * -lwres_context_allocmem(lwres_context_t *ctx, size_t len) -{ +lwres_context_allocmem(lwres_context_t *ctx, size_t len) { REQUIRE(len != 0); return (CTXMALLOC(len)); } static void * -lwres_malloc(void *arg, size_t len) -{ +lwres_malloc(void *arg, size_t len) { void *mem; (void)arg; @@ -154,8 +145,7 @@ lwres_malloc(void *arg, size_t len) } static void -lwres_free(void *arg, void *mem, size_t len) -{ +lwres_free(void *arg, void *mem, size_t len) { (void)arg; memset(mem, 0xa9, len); @@ -163,8 +153,7 @@ lwres_free(void *arg, void *mem, size_t len) } static lwres_result_t -context_connect(lwres_context_t *ctx) -{ +context_connect(lwres_context_t *ctx) { int s; int ret; struct sockaddr_in localhost; diff --git a/lib/lwres/gethost.c b/lib/lwres/gethost.c index 08778e8113..91c6e4e7d5 100644 --- a/lib/lwres/gethost.c +++ b/lib/lwres/gethost.c @@ -20,8 +20,6 @@ #include #include -#include -#include #include #include @@ -86,7 +84,9 @@ lwres_sethostent(int stayopen) { void lwres_endhostent(void) { - /* empty */ + /* + * Empty. + */ } struct hostent * @@ -139,12 +139,16 @@ lwres_gethostent_r(struct hostent *resbuf, char *buf, int buflen, int *error) { void lwres_sethostent_r(int stayopen) { (void)stayopen; - /* empty */ + /* + * Empty. + */ } void lwres_endhostent_r(void) { - /* empty */ + /* + * Empty. + */ } static int @@ -154,7 +158,9 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { int i, n; int nptr, len; - /* Find out the amount of space required to store the answer. */ + /* + * Find out the amount of space required to store the answer. + */ nptr = 2; /* NULL ptrs */ len = (char *)LWRES_ALIGN(buf) - buf; for (i = 0; he->h_addr_list[i]; i++, nptr++) { @@ -170,14 +176,18 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { return (-1); } - /* copy address size and type */ + /* + * Copy address size and type. + */ hptr->h_addrtype = he->h_addrtype; n = hptr->h_length = he->h_length; ptr = (char **)LWRES_ALIGN(buf); cp = (char *)LWRES_ALIGN(buf) + nptr * sizeof(char *); - /* copy address list */ + /* + * Copy address list. + */ hptr->h_addr_list = ptr; for (i = 0; he->h_addr_list[i]; i++ , ptr++) { memcpy(cp, he->h_addr_list[i], n); @@ -188,13 +198,17 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { hptr->h_addr_list[i] = NULL; ptr++; - /* copy official name */ + /* + * Copy official name. + */ n = strlen(he->h_name) + 1; strcpy(cp, he->h_name); hptr->h_name = cp; cp += n; - /* copy aliases */ + /* + * Copy aliases. + */ hptr->h_aliases = ptr; for (i = 0 ; he->h_aliases[i]; i++) { n = strlen(he->h_aliases[i]) + 1; diff --git a/lib/lwres/include/lwres/lwbuffer.h b/lib/lwres/include/lwres/lwbuffer.h index c5f1eae15c..35041bf998 100644 --- a/lib/lwres/include/lwres/lwbuffer.h +++ b/lib/lwres/include/lwres/lwbuffer.h @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef LWRES_BUFFER_H -#define LWRES_BUFFER_H 1 +#ifndef LWRES_LWBUFFER_H +#define LWRES_LWBUFFER_H 1 /***** ***** Module Info @@ -397,4 +397,4 @@ lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base, LWRES_LANG_ENDDECLS -#endif /* LWRES_BUFFER_H */ +#endif /* LWRES_LWBUFFER_H */ diff --git a/lib/omapi/auth.c b/lib/omapi/auth.c index c6dc9ba4d6..75db9fdbb5 100644 --- a/lib/omapi/auth.c +++ b/lib/omapi/auth.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: auth.c,v 1.5 2000/05/02 03:54:17 tale Exp $ */ +/* $Id: auth.c,v 1.6 2000/05/08 14:38:08 tale Exp $ */ /* Principal Author: DCL */ @@ -36,13 +36,11 @@ #include -#include -#include /* NULL */ -#include /* memset */ - -#include -#include +#include +#include #include +#include +#include #include diff --git a/lib/omapi/connection.c b/lib/omapi/connection.c index 483e069c41..0bc788a868 100644 --- a/lib/omapi/connection.c +++ b/lib/omapi/connection.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: connection.c,v 1.24 2000/05/03 18:25:52 gson Exp $ */ +/* $Id: connection.c,v 1.25 2000/05/08 14:38:09 tale Exp $ */ /* Principal Author: DCL */ @@ -25,16 +25,14 @@ #include -#include -#include /* NULL */ -#include /* memset */ - -#include +#include #include -#include #include +#include +#include #include +#include /* * Swiped from bin/tests/sdig.c. diff --git a/lib/omapi/data.c b/lib/omapi/data.c index f015a8bfc3..11c2b96262 100644 --- a/lib/omapi/data.c +++ b/lib/omapi/data.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: data.c,v 1.11 2000/04/28 02:08:16 tale Exp $ */ +/* $Id: data.c,v 1.12 2000/05/08 14:38:10 tale Exp $ */ /* Principal Author: Ted Lemon */ @@ -25,11 +25,10 @@ #include -#include /* abort() */ -#include /* memset */ -#include -#include +#include +#include +#include #include diff --git a/lib/omapi/generic.c b/lib/omapi/generic.c index 165bdaffa8..03c117546b 100644 --- a/lib/omapi/generic.c +++ b/lib/omapi/generic.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: generic.c,v 1.12 2000/04/28 02:08:16 tale Exp $ */ +/* $Id: generic.c,v 1.13 2000/05/08 14:38:11 tale Exp $ */ /* Principal Author: Ted Lemon */ @@ -25,10 +25,9 @@ #include -#include /* NULL */ -#include /* memset */ - -#include +#include +#include +#include #include diff --git a/lib/omapi/handle.c b/lib/omapi/handle.c index b65cd80ba3..5ecb62c064 100644 --- a/lib/omapi/handle.c +++ b/lib/omapi/handle.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: handle.c,v 1.10 2000/04/28 02:08:17 tale Exp $ */ +/* $Id: handle.c,v 1.11 2000/05/08 14:38:13 tale Exp $ */ /* Principal Author: Ted Lemon */ @@ -25,12 +25,10 @@ #include -#include /* NULL */ -#include /* memset */ - -#include -#include +#include #include +#include +#include #include diff --git a/lib/omapi/include/omapi/compatibility.h b/lib/omapi/include/omapi/compatibility.h index c8145eb8d7..ea8bab5dbf 100644 --- a/lib/omapi/include/omapi/compatibility.h +++ b/lib/omapi/include/omapi/compatibility.h @@ -15,6 +15,11 @@ * SOFTWARE. */ +#ifndef OMAPI_COMPATIBILITY_H +#define OMAPI_COMPATIBILITY_H 1 + +#include + /***** ***** Macro definitions for partial compatability with Ted Lemon's original ***** design of OMAPI for DCHP. The intent is that with by using this header @@ -82,3 +87,5 @@ #define omapi_connection_put_string omapi_connection_putstring #define omapi_connection_put_handle omapi_connection_puthandle #define omapi_connection_write_typed_data omapi_connection_putdata + +#endif /* OMAPI_COMPATIBILITY_H */ diff --git a/lib/omapi/include/omapi/omapi.h b/lib/omapi/include/omapi/omapi.h index 823b68b525..fa9ac3dbe7 100644 --- a/lib/omapi/include/omapi/omapi.h +++ b/lib/omapi/include/omapi/omapi.h @@ -19,18 +19,14 @@ * Definitions for the object management API and protocol. */ -#ifndef _OMAPI_OMAPI_H_ -#define _OMAPI_OMAPI_H_ +#ifndef OMAPI_OMAPI_H +#define OMAPI_OMAPI_H 1 #include #include +#include #include -#include -#include -#include -#include -#include #include @@ -367,4 +363,4 @@ omapi_value_getregion(omapi_value_t *value, isc_region_t *region); ISC_LANG_ENDDECLS -#endif /* _OMAPI_OMAPI_H_ */ +#endif /* OMAPI_OMAPI_H */ diff --git a/lib/omapi/include/omapi/private.h b/lib/omapi/include/omapi/private.h index 779d230e93..3d65e4d906 100644 --- a/lib/omapi/include/omapi/private.h +++ b/lib/omapi/include/omapi/private.h @@ -20,24 +20,15 @@ *****/ #ifndef OMAPI_PRIVATE_H -#define OMAPI_PRIVATE_H +#define OMAPI_PRIVATE_H 1 #include #include -#include -#include -#include #include -#include -#include -#include #include #include -#include - -ISC_LANG_BEGINDECLS #define OMAPI_BUFFER_SIZE 4096 @@ -294,7 +285,7 @@ extern isc_socketmgr_t *omapi_socketmgr; #define PASS_CHECK(object, function) \ (object->inner != NULL && object->inner->type->function != NULL) - +ISC_LANG_BEGINDECLS /* * Private library functions defined in auth.c. @@ -414,4 +405,4 @@ send_update(omapi_object_t *protocol, unsigned int response_id, ISC_LANG_ENDDECLS -#endif /* OMAPIP_PRIVATE_H */ +#endif /* OMAPI_PRIVATE_H */ diff --git a/lib/omapi/include/omapi/result.h b/lib/omapi/include/omapi/result.h index 3c73562aaa..359e46a21e 100644 --- a/lib/omapi/include/omapi/result.h +++ b/lib/omapi/include/omapi/result.h @@ -16,10 +16,10 @@ */ #ifndef OMAPI_RESULT_H -#define DNS_RESULT_H 1 +#define OMAPI_RESULT_H 1 #include -#include +#include /* Contractual promise. */ #include ISC_LANG_BEGINDECLS @@ -33,9 +33,12 @@ ISC_LANG_BEGINDECLS #define OMAPI_R_NRESULTS 6 /* Number of results */ -char * omapi_result_totext(isc_result_t); -void omapi_result_register(void); +char * +omapi_result_totext(isc_result_t); + +void +omapi_result_register(void); ISC_LANG_ENDDECLS -#endif /* DNS_RESULT_H */ +#endif /* OMAPI_RESULT_H */ diff --git a/lib/omapi/include/omapi/types.h b/lib/omapi/include/omapi/types.h index 52658172de..87fe9c9952 100644 --- a/lib/omapi/include/omapi/types.h +++ b/lib/omapi/include/omapi/types.h @@ -15,12 +15,8 @@ * SOFTWARE. */ -#ifndef _OMAPI_TYPES_H_ -#define _OMAPI_TYPES_H_ - -#include - -ISC_LANG_BEGINDECLS +#ifndef OMAPI_TYPES_H +#define OMAPI_TYPES_H 1 /***** ***** Type definitions. @@ -45,6 +41,4 @@ typedef enum { omapi_datatype_object } omapi_datatype_t; -ISC_LANG_ENDDECLS - -#endif /* _OMAPI_OMAPIP_H_ */ +#endif /* OMAPI_TYPES_H */ diff --git a/lib/omapi/lib.c b/lib/omapi/lib.c index ace0ba693c..618a45af02 100644 --- a/lib/omapi/lib.c +++ b/lib/omapi/lib.c @@ -15,16 +15,14 @@ * SOFTWARE. */ -/* $Id: lib.c,v 1.9 2000/04/28 02:08:17 tale Exp $ */ +/* $Id: lib.c,v 1.10 2000/05/08 14:38:14 tale Exp $ */ #include -#include - -#include -#include -#include #include +#include +#include +#include #include #include diff --git a/lib/omapi/listener.c b/lib/omapi/listener.c index 1358a0ad37..5cc510996a 100644 --- a/lib/omapi/listener.c +++ b/lib/omapi/listener.c @@ -22,12 +22,13 @@ #include #include /* NULL and abort() */ -#include /* memset */ -#include +#include #include -#include #include +#include +#include +#include #include diff --git a/lib/omapi/message.c b/lib/omapi/message.c index a45f0d6d60..68ed23da2b 100644 --- a/lib/omapi/message.c +++ b/lib/omapi/message.c @@ -21,13 +21,14 @@ #include -#include /* NULL */ -#include /* memset */ +#include -#include -#include +#include +#include +#include #include +#include omapi_message_t *registered_messages; diff --git a/lib/omapi/object.c b/lib/omapi/object.c index 3b580e60e6..47ec1801a1 100644 --- a/lib/omapi/object.c +++ b/lib/omapi/object.c @@ -15,16 +15,17 @@ * SOFTWARE. */ -/* $Id: object.c,v 1.15 2000/04/28 02:08:19 tale Exp $ */ +/* $Id: object.c,v 1.16 2000/05/08 14:38:17 tale Exp $ */ /* Principal Author: Ted Lemon */ #include -#include /* memset */ +#include +#include +#include +#include -#include -#include #include diff --git a/lib/omapi/protocol.c b/lib/omapi/protocol.c index fc71d1c064..6ddaa3b4f4 100644 --- a/lib/omapi/protocol.c +++ b/lib/omapi/protocol.c @@ -23,13 +23,16 @@ #include /* NULL */ #include /* random */ -#include /* memset */ +#include +#include +#include #include #include #include +#include /* * OMAPI protocol header, version 1.00 diff --git a/lib/omapi/result.c b/lib/omapi/result.c index 453e87c4c8..72ee23e1a9 100644 --- a/lib/omapi/result.c +++ b/lib/omapi/result.c @@ -15,13 +15,10 @@ * SOFTWARE. */ -/* $Id: result.c,v 1.6 2000/04/28 01:12:23 halley Exp $ */ +/* $Id: result.c,v 1.7 2000/05/08 14:38:20 tale Exp $ */ +#include -#include - -#include #include -#include #include #include diff --git a/lib/omapi/string.c b/lib/omapi/string.c index 0b5231ce8a..11f51c4eb0 100644 --- a/lib/omapi/string.c +++ b/lib/omapi/string.c @@ -15,16 +15,15 @@ * SOFTWARE. */ -/* $Id: string.c,v 1.5 2000/04/28 02:08:20 tale Exp $ */ +/* $Id: string.c,v 1.6 2000/05/08 14:38:21 tale Exp $ */ /* Principal Author: Ted Lemon */ #include -#include /* memset */ - -#include -#include +#include +#include +#include #include diff --git a/lib/omapi/value.c b/lib/omapi/value.c index da9cffbe96..d45a4a307c 100644 --- a/lib/omapi/value.c +++ b/lib/omapi/value.c @@ -15,16 +15,15 @@ * SOFTWARE. */ -/* $Id: value.c,v 1.5 2000/04/28 02:08:20 tale Exp $ */ +/* $Id: value.c,v 1.6 2000/05/08 14:38:22 tale Exp $ */ /* Principal Author: Ted Lemon */ #include -#include /* memset */ - -#include -#include +#include +#include +#include #include diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c index 8a6f51be61..fc80b5ff2b 100644 --- a/lib/tests/t_api.c +++ b/lib/tests/t_api.c @@ -15,34 +15,36 @@ * SOFTWARE. */ -#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include -#include "include/tests/t_api.h" +#include +#include +#include + +#include "include/tests/t_api.h" static char *Usage = "\t-a : run all tests\n" - "\t-b : chdir to dir before running tests" - "\t-c : use specified config file\n" - "\t-d : set debug level to debug_level\n" - "\t-h : print test info\n" - "\t-u : print usage info\n" - "\t-n : run specified test name\n" - "\t-t : run specified test number\n" - "\t-x : don't execute tests in a subproc\n" - "\t-q : use 'timeout' as the timeout value\n"; + "\t-b : chdir to dir before running tests" + "\t-c : use specified config file\n" + "\t-d : set debug level to debug_level\n" + "\t-h : print test info\n" + "\t-u : print usage info\n" + "\t-n : run specified test name\n" + "\t-t : run specified test number\n" + "\t-x : don't execute tests in a subproc\n" + "\t-q : use 'timeout' as the timeout value\n"; /* * -a --> run all tests * -b dir --> chdir to dir before running tests @@ -89,30 +91,35 @@ t_sighandler(int sig) { } int -main(int argc, char **argv) -{ - +main(int argc, char **argv) { int c; int tnum; int subprocs; pid_t deadpid; int status; int len; - int first; + isc_boolean_t first; testspec_t *pts; struct sigaction sa; - first = 1; + first = ISC_TRUE; subprocs = 1; T_timeout = T_TCTOUT; - /* -a option is now default */ + /* + * -a option is now default. + */ memset(T_tvec, 0xffff, sizeof(T_tvec)); - /* parse args */ - while ((c = isc_commandline_parse(argc, argv, ":at:c:d:n:huxq:b:")) != -1) { + /* + * Parse args. + */ + while ((c = isc_commandline_parse(argc, argv, ":at:c:d:n:huxq:b:")) + != -1) { if (c == 'a') { - /* flag all tests to be run */ + /* + * Flag all tests to be run. + */ memset(T_tvec, 0xffff, sizeof(T_tvec)); } else if (c == 'b') { @@ -123,14 +130,16 @@ main(int argc, char **argv) if ((tnum > 0) && (tnum < T_MAXTESTS)) { if (first) { /* - * turn off effect of -a default + * Turn off effect of -a default * and allow multiple -t and -n - * options + * options. */ memset(T_tvec, 0, sizeof(T_tvec)); - first = 0; + first = ISC_FALSE; } - /* flag test tnum to be run */ + /* + * Flag test tnum to be run. + */ tnum -= 1; T_tvec[tnum / 8] |= (0x01 << (tnum % 8)); } @@ -148,8 +157,9 @@ main(int argc, char **argv) if (! strcmp(pts->func_name, isc_commandline_argument)) { if (first) { - memset(T_tvec, 0, sizeof(T_tvec)); - first = 0; + memset(T_tvec, 0, + sizeof(T_tvec)); + first = ISC_FALSE; } T_tvec[tnum/8] |= (0x01 << (tnum%8)); break; @@ -189,17 +199,23 @@ main(int argc, char **argv) } } - /* set cwd */ + /* + * Set cwd. + */ if (T_dir != NULL) (void) chdir(T_dir); - /* we don't want buffered output */ + /* + * We don't want buffered output. + */ - (void) setbuf(stdout, NULL); - (void) setbuf(stderr, NULL); + (void)setbuf(stdout, NULL); + (void)setbuf(stderr, NULL); - /* setup signals */ + /* + * Setup signals. + */ sa.sa_flags = 0; sigfillset(&sa.sa_mask); @@ -217,14 +233,18 @@ main(int argc, char **argv) (void)sigaction(SIGINT, &sa, NULL); (void)sigaction(SIGALRM, &sa, NULL); - /* output start stanza to journal */ + /* + * Output start stanza to journal. + */ sprintf(T_buf, "%s:", argv[0]); len = strlen(T_buf); (void) t_getdate(T_buf + len, T_BIGBUF - len); t_putinfo("S", T_buf); - /* setup the test environment using the config file */ + /* + * Setup the test environment using the config file. + */ if (T_config == NULL) T_config = T_DEFAULT_CONFIG; @@ -233,7 +253,9 @@ main(int argc, char **argv) if (T_debug) t_dumpconf(T_config); - /* now invoke all the test cases */ + /* + * Now invoke all the test cases. + */ tnum = 0; pts = &T_testlist[0]; @@ -244,8 +266,7 @@ main(int argc, char **argv) if (T_pid == 0) { (*pts->pfv)(); exit(0); - } - else if (T_pid > 0) { + } else if (T_pid > 0) { T_int = 0; sa.sa_handler = t_sighandler; @@ -254,31 +275,38 @@ main(int argc, char **argv) deadpid = (pid_t) -1; while (deadpid != T_pid) { - deadpid = waitpid(T_pid, &status, 0); - if (deadpid == T_pid) { - if (WIFSIGNALED(status)) { - if (WTERMSIG(status) == SIGTERM) - t_info("the test case timed out\n"); - else - t_info("the test case caused exception %d\n", WTERMSIG(status)); - t_result(T_UNRESOLVED); - } - } - else if ((deadpid == -1) && (errno == EINTR) && T_int) { - kill(T_pid, SIGTERM); - T_int = 0; - } - else if ((deadpid == -1) && - ((errno == ECHILD) || (errno == ESRCH))) - break; + deadpid = + waitpid(T_pid, &status, 0); + if (deadpid == T_pid) { + if (WIFSIGNALED(status)) { + if (WTERMSIG(status) == + SIGTERM) + t_info( + "the test case timed out\n"); + else + t_info( + "the test case caused exception %d\n", + WTERMSIG(status)); + t_result(T_UNRESOLVED); + } + } else if ((deadpid == -1) && + (errno == EINTR) && + T_int) { + kill(T_pid, SIGTERM); + T_int = 0; + } + else if ((deadpid == -1) && + ((errno == ECHILD) || + (errno == ESRCH))) + break; } alarm(0); sa.sa_handler = SIG_IGN; (void)sigaction(SIGALRM, &sa, NULL); - } - else { - t_info("fork failed, errno == %d\n", errno); + } else { + t_info("fork failed, errno == %d\n", + errno); t_result(T_UNRESOLVED); } } @@ -299,27 +327,26 @@ main(int argc, char **argv) } void -t_assert(const char *component, int anum, int class, - const char *what, ...) -{ +t_assert(const char *component, int anum, int class, const char *what, ...) { int n; va_list args; - (void) printf ("T:%s:%d:%s\n", component, anum, class == T_REQUIRED ? - "A" : "C"); + (void)printf("T:%s:%d:%s\n", component, anum, class == T_REQUIRED ? + "A" : "C"); - /* format text to a buffer */ + /* + * Format text to a buffer. + */ va_start(args, what); n = vsprintf(T_buf, what, args); va_end(args); - (void) t_putinfo("A", T_buf); - (void) printf("\n"); + (void)t_putinfo("A", T_buf); + (void)printf("\n"); } void -t_info(const char *format, ...) -{ +t_info(const char *format, ...) { va_list args; va_start(args, format); @@ -329,9 +356,7 @@ t_info(const char *format, ...) } void -t_result(int result) -{ - +t_result(int result) { char *p; switch (result) { @@ -358,8 +383,7 @@ t_result(int result) } char * -t_getenv(const char *name) -{ +t_getenv(const char *name) { char *n; char **p; size_t len; @@ -385,15 +409,14 @@ t_getenv(const char *name) /* * - * read in the config file at path, initializing T_env + * Read in the config file at path, initializing T_env. * * note: no format checking for now ... * */ static int -t_initconf(char *path) -{ +t_initconf(char *path) { int n; int rval; @@ -411,28 +434,29 @@ t_initconf(char *path) if (*p == NULL) break; if ((**p == '#') || (strchr(*p, '=') == NULL)) { - /* skip comments and other junk */ - (void) free(*p); + /* + * Skip comments and other junk. + */ + (void)free(*p); continue; } ++p; ++n; } - (void) fclose(fp); + (void)fclose(fp); rval = 0; } - return(rval); + return (rval); } /* * - * dump T_env to stdout + * Dump T_env to stdout. * */ static int -t_dumpconf(char *path) -{ +t_dumpconf(char *path) { int rval; char **p; FILE *fp; @@ -453,21 +477,19 @@ t_dumpconf(char *path) /* * - * read a newline or EOF terminated string from fp - * on success: + * Read a newline or EOF terminated string from fp. + * On success: * return a malloc'd buf containing the string with * the newline converted to a '\0'. - * on error: - * return NULL + * On error: + * return NULL. * - * caller is responsible for freeing buf + * Caller is responsible for freeing buf. * */ char * -t_fgetbs(FILE *fp) -{ - +t_fgetbs(FILE *fp) { int c; size_t n; size_t size; @@ -489,7 +511,8 @@ t_fgetbs(FILE *fp) ++n; if ( n >= size ) { size += T_BUFSIZ; - buf = (char *) realloc(buf, size * sizeof(char)); + buf = (char *)realloc(buf, + size * sizeof(char)); if (buf == NULL) break; p = buf + n; @@ -497,8 +520,7 @@ t_fgetbs(FILE *fp) } *p = '\0'; return(((c == EOF) && (n == 0)) ? NULL : buf); - } - else { + } else { fprintf(stderr, "malloc failed %d", errno); return(NULL); } @@ -506,25 +528,25 @@ t_fgetbs(FILE *fp) /* * - * put info to log, using key - * for now, just dump it out. - * later format into pretty lines + * Put info to log, using key. + * For now, just dump it out. + * Later format into pretty lines. * */ static int -t_putinfo(const char *key, const char *info) -{ +t_putinfo(const char *key, const char *info) { int rval; - /* for now */ + /* + * For now. + */ rval = printf("%s:%s", key, info); return(rval); } static char * -t_getdate(char *buf, size_t buflen) -{ +t_getdate(char *buf, size_t buflen) { size_t n; time_t t; struct tm *p; @@ -535,8 +557,9 @@ t_getdate(char *buf, size_t buflen) return(n != 0 ? buf : NULL); } -/* some generally used utilities */ - +/* + * Some generally used utilities. + */ struct dns_errormap { isc_result_t result; char *text; @@ -680,8 +703,6 @@ printusage() { int t_eval(char *filename, int (*func)(char **), int nargs) { - - FILE *fp; char *p; int line; @@ -701,7 +722,9 @@ t_eval(char *filename, int (*func)(char **), int nargs) { ++line; - /* skip comment lines */ + /* + * Skip comment lines. + */ if ((isspace((int)*p)) || (*p == '#')) continue; @@ -714,18 +737,16 @@ t_eval(char *filename, int (*func)(char **), int nargs) { else ++nprobs; } - } - else { + } else { t_info("bad format in %s at line %d\n", filename, line); ++nprobs; } - (void) free(p); + (void)free(p); } - (void) fclose(fp); - } - else { + (void)fclose(fp); + } else { t_info("Missing datafile %s\n", filename); ++nprobs; } @@ -737,6 +758,5 @@ t_eval(char *filename, int (*func)(char **), int nargs) { else if (nfails) result = T_FAIL; - return(result); + return (result); } -