dnstest.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*! \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());
if (debug_mem_record)
&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;
}
}
isc_stdio_close(f);
return (result);
}