main.c revision edcd1247ad7e81bb8b430e610d9718f64c70f05d
a134177ed9f82189504191d90f3ed9e97c2b47cbTinderbox User * Copyright (C) 2000 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark 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.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
00b872e4f76587584a2359e9001e9cf08b195ccfMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * The goal number of clients we can handle will be NTASKS * NRECVS.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#define NTASKS 20 /* tasks to create to handle lwres queries */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#define NTHREADS 1 /* # threads to create in thread manager */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Array of client managers. Each of these will have a task associated
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsunsigned int ntasks; /* number of tasks actually created */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews result = dns_view_create(mctx, dns_rdataclass_in, "_default", &view);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in,
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * XXXMLG hardwired number of tasks.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews result = dns_view_createresolver(view, taskmgr, 16, sockmgr,
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews result = dns_rootns_create(mctx, dns_rdataclass_in, NULL, &rootdb);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * If we have forwarders, set them here.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_resolver_setforwarders(view->resolver, &forwarders);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_resolver_setfwdpolicy(view->resolver, dns_fwdpolicy_only);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Wrappers around our memory management stuff, for the lwres functions.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic void *
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews lwresult = lwres_context_create(&lwctx, mem, mem_alloc, mem_free);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews lwresult = lwres_conf_parse("/etc/resolv.conf", &lwc);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Run through the list of nameservers, and set them to be our
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * forwarders.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews memcpy(&ina.s_addr, lwc.nameservers[i].address, 4);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews memcpy(&ina6.s6_addr, lwc.nameservers[i].address, 16);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews unsigned int i, j;
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * Set up logging.
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman result = isc_log_createchannel(lcfg, "_default",
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews result = isc_log_usechannel(lcfg, "_default", NULL, NULL);
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrews * Set the initial debug level.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Create a task manager.
* Read resolv.conf to get our forwarders.
&sock);
for (i = 0 ; i < NTASKS ; i++) {
0, LWRD_SHUTDOWN,
INSIST(i > 0);
for (i = 0 ; i < NRECVS ; i++) {
for (j = 0 ; j < ntasks ; j++)
INSIST(i > 0);
for (j = 0 ; j < ntasks ; j++) {
isc_app_run();
for (j = 0 ; j < ntasks ; j++) {