]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
make adb_test and byname_test compile and run
authorMark Andrews <marka@isc.org>
Thu, 23 Jun 2005 23:49:35 +0000 (23:49 +0000)
committerMark Andrews <marka@isc.org>
Thu, 23 Jun 2005 23:49:35 +0000 (23:49 +0000)
bin/tests/adb_test.c
bin/tests/byname_test.c

index 34aab2f8767ea8a360216832408749a5e1bf79a3..6d3eb171773e933e1677c8855e0237a0338b32ff 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: adb_test.c,v 1.65 2005/04/29 00:22:37 marka Exp $ */
+/* $Id: adb_test.c,v 1.66 2005/06/23 23:49:35 marka Exp $ */
 
 /*! \file */
 
 
 #include <isc/app.h>
 #include <isc/buffer.h>
+#include <isc/entropy.h>
+#include <isc/hash.h>
+#include <isc/socket.h>
 #include <isc/task.h>
 #include <isc/timer.h>
-#include <isc/socket.h>
 #include <isc/util.h>
 
 #include <dns/adb.h>
@@ -48,21 +50,22 @@ struct client {
        dns_adbfind_t          *find;
 };
 
-isc_mem_t *mctx;
-isc_mempool_t *cmp;
-isc_log_t *lctx;
-isc_logconfig_t *lcfg;
-isc_taskmgr_t *taskmgr;
-isc_socketmgr_t *socketmgr;
-isc_timermgr_t *timermgr;
-dns_dispatchmgr_t *dispatchmgr;
-isc_task_t *t1, *t2;
-dns_view_t *view;
-dns_db_t *rootdb;
-ISC_LIST(client_t) clients;
-isc_mutex_t client_lock;
-isc_stdtime_t now;
-dns_adb_t *adb;
+static isc_mem_t *mctx = NULL;
+static isc_entropy_t *ectx = NULL;
+static isc_mempool_t *cmp;
+static isc_log_t *lctx;
+static isc_logconfig_t *lcfg;
+static isc_taskmgr_t *taskmgr;
+static isc_socketmgr_t *socketmgr;
+static isc_timermgr_t *timermgr;
+static dns_dispatchmgr_t *dispatchmgr;
+static isc_task_t *t1, *t2;
+static dns_view_t *view;
+static dns_db_t *rootdb;
+static ISC_LIST(client_t) clients;
+static isc_mutex_t client_lock;
+static isc_stdtime_t now;
+static dns_adb_t *adb;
 
 static void
 check_result(isc_result_t result, const char *format, ...)
@@ -260,7 +263,7 @@ lookup(const char *target) {
        options |= DNS_ADBFIND_HINTOK;
        options |= DNS_ADBFIND_GLUEOK;
        result = dns_adb_createfind(adb, t2, lookup_callback, client,
-                                   &client->name, dns_rootname, options,
+                                   &client->name, dns_rootname, 0, options,
                                    now, NULL, view->dstport, &client->find);
 #if 0
        check_result(result, "dns_adb_createfind()");
@@ -301,7 +304,6 @@ main(int argc, char **argv) {
        /*
         * EVERYTHING needs a memory context.
         */
-       mctx = NULL;
        RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
 
        cmp = NULL;
@@ -309,6 +311,11 @@ main(int argc, char **argv) {
                      == ISC_R_SUCCESS);
        isc_mempool_setname(cmp, "adb test clients");
 
+       result = isc_entropy_create(mctx, &ectx);
+       check_result(result, "isc_entropy_create()");
+       result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
+       check_result(result, "isc_hash_create()");
+
        result = isc_log_create(mctx, &lctx, &lcfg);
        check_result(result, "isc_log_create()");
        isc_log_setcontext(lctx);
@@ -416,6 +423,9 @@ main(int argc, char **argv) {
 
        isc_log_destroy(&lctx);
 
+       isc_hash_destroy();
+       isc_entropy_detach(&ectx);
+
        isc_mempool_destroy(&cmp);
        isc_mem_stats(mctx, stdout);
        isc_mem_destroy(&mctx);
index be93ac58bff939e5bb72ddcff2c3d620864aea93..863b25a3d3d81011d706f50c2f2dececbdcb6b9c 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: byname_test.c,v 1.28 2005/04/29 00:22:37 marka Exp $ */
+/* $Id: byname_test.c,v 1.29 2005/06/23 23:49:35 marka Exp $ */
 
 /*! \file
  * \author
@@ -29,6 +29,8 @@
 
 #include <isc/app.h>
 #include <isc/commandline.h>
+#include <isc/entropy.h>
+#include <isc/hash.h>
 #include <isc/netaddr.h>
 #include <isc/task.h>
 #include <isc/timer.h>
@@ -44,6 +46,7 @@
 #include <dns/result.h>
 
 static isc_mem_t *mctx = NULL;
+static isc_entropy_t *ectx = NULL;
 static isc_taskmgr_t *taskmgr;
 static dns_view_t *view = NULL;
 static dns_adbfind_t *find = NULL;
@@ -122,7 +125,7 @@ do_find(isc_boolean_t want_event) {
        dns_fixedname_init(&target);
        result = dns_adb_createfind(view->adb, task, adb_callback, NULL,
                                    dns_fixedname_name(&name),
-                                   dns_rootname, options, 0,
+                                   dns_rootname, 0, options, 0,
                                    dns_fixedname_name(&target), 0,
                                    &find);
        if (result == ISC_R_SUCCESS) {
@@ -212,6 +215,10 @@ main(int argc, char *argv[]) {
        mctx = NULL;
        RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
 
+       RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
+       RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)
+                     == ISC_R_SUCCESS);
+
        while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) {
                switch (ch) {
                case 'd':
@@ -356,6 +363,9 @@ main(int argc, char *argv[]) {
 
        isc_log_destroy(&lctx);
 
+       isc_hash_destroy();
+       isc_entropy_detach(&ectx);
+
        if (verbose)
                isc_mem_stats(mctx, stdout);
        isc_mem_destroy(&mctx);