adb_test.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
60988462e5d6db53205851d056e3482a29239be9Evan Hunt * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
60988462e5d6db53205851d056e3482a29239be9Evan Hunt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
e27d55e3ee06b6edcf625b8920a5c809da7f0b98Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
60988462e5d6db53205851d056e3482a29239be9Evan Hunt * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews/* $Id: adb_test.c,v 1.61 2001/01/09 21:40:48 bwelling Exp $ */
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrewscheck_result(isc_result_t result, const char *format, ...) {
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews fprintf(stderr, ": %s\n", isc_result_totext(result));
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrewsstatic inline void
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrewsstatic inline void
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
e27d55e3ee06b6edcf625b8920a5c809da7f0b98Mark Andrewslookup_callback(isc_task_t *task, isc_event_t *ev) {
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews printf("NAME %s:\n\tTask %p got event %p type %08x from %p, client %p\n\terr4: %s err6: %s\n",
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = isc_taskmgr_create(mctx, 5, 0, &taskmgr);
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = isc_socketmgr_create(mctx, &socketmgr);
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki result = dns_dispatchmgr_create(mctx, NULL, &dispatchmgr);
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki check_result(result, "dns_dispatchmgr_create");
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = dns_view_create(mctx, dns_rdataclass_in, "_default", &view);
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews unsigned int attrs;
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP;
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = dns_rootns_create(mctx, dns_rdataclass_in, NULL, &rootdb);
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews unsigned int options;
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki isc_buffer_init(&namebuf, namedata, sizeof(namedata));
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = dns_name_fromtext(&name, &t, dns_rootname, ISC_FALSE,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews check_result(result, "dns_name_fromtext %s", target);
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews result = dns_name_dup(&name, mctx, &client->name);
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews check_result(result, "dns_name_dup %s", target);
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecicki result = dns_adb_createfind(adb, t2, lookup_callback, client,
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews if ((client->find->options & DNS_ADBFIND_WANTEVENT) != 0) {
2cd8fa3ef9b168429dcf76603e7b95c58317dd28Mark Andrews target, isc_result_totext(client->find->result_v4),
ea8278253210df030a24f0c89342b43fe279a127Mark Andrews check_result(result, "isc_mutex_init(&client_lock)");
== ISC_R_SUCCESS);
create_view();
CLOCK();
CUNLOCK();
CLOCK();
CUNLOCK();
isc_app_run();