dnstest.c revision 61d789916f2815392028e676b66729d1156a3bc8
/*
* Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <dns/fixedname.h>
#include "dnstest.h"
int ncpus;
/*
*/
static isc_logcategory_t categories[] = {
{ "", 0 },
{ "client", 0 },
{ "network", 0 },
{ "update", 0 },
{ "queries", 0 },
{ "unmatched", 0 },
{ "update-security", 0 },
{ "query-errors", 0 },
{ NULL, 0 }
};
static void
cleanup_managers(void) {
if (app_running)
}
static isc_result_t
create_managers(void) {
#ifdef ISC_PLATFORM_USETHREADS
ncpus = isc_os_ncpus();
#else
ncpus = 1;
#endif
return (ISC_R_SUCCESS);
return (result);
}
if (start_managers)
CHECK(isc_app_start());
&destination, 0));
}
if (start_managers)
CHECK(create_managers());
/*
* atf-run changes us to a /tmp directory, so tests
* that access test data files must first chdir to the proper
* location.
*/
return (ISC_R_SUCCESS);
dns_test_end();
return (result);
}
void
dns_test_end(void) {
if (dst_active) {
}
if (hash_active) {
}
}
/*
* Create a view.
*/
return (ISC_R_SUCCESS);
return (result);
}
/*
* Create a zone with origin 'name', return a pointer to the zone object in
* 'zonep'. If 'view' is set, add the zone to that view; otherwise, create
* a new view for the purpose.
*
* If the created view is going to be needed by the caller subsequently,
* then 'keepview' should be set to true; this will prevent the view
* from being detached. In this case, the caller is responsible for
* detaching the view.
*/
{
else if (!keepview)
if (!keepview)
return (ISC_R_SUCCESS);
return (result);
}
dns_test_setupzonemgr(void) {
&zonemgr);
return (result);
}
if (result != ISC_R_SUCCESS)
return (result);
return (result);
}
void
}
void
dns_test_closezonemgr(void) {
}
/*
* Sleep for 'usec' microseconds.
*/
void
#ifdef HAVE_NANOSLEEP
#else
/*
* No fractional-second sleep function is available, so we
* round up to the nearest second and sleep instead
*/
#endif
}
const char *testfile)
{
if (result != ISC_R_SUCCESS)
return(result);
if (result != ISC_R_SUCCESS)
return (result);
return (result);
}
static int
fromhex(char c) {
if (c >= '0' && c <= '9')
return (c - '0');
else if (c >= 'a' && c <= 'f')
return (c - 'a' + 10);
else if (c >= 'A' && c <= 'F')
return (c - 'A' + 10);
printf("bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
}
{
unsigned char *bp;
char s[BUFSIZ];
int n;
if (result != ISC_R_SUCCESS)
return (result);
rp = s;
wp = s;
len = 0;
while (*rp != '\0') {
if (*rp == '#')
break;
len++;
}
rp++;
}
if (len == 0U)
continue;
if (len % 2 != 0U)
rp = s;
for (i = 0; i < len; i += 2) {
n *= 16;
*bp++ = n;
}
}
if (f != NULL)
isc_stdio_close(f);
return (result);
}