1/*	$NetBSD: dnstest.h,v 1.1.1.1.4.2 2012/12/15 05:40:03 riz Exp $	*/
2
3/*
4 * Copyright (C) 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/* Id */
20
21/*! \file */
22
23#include <config.h>
24
25#include <isc/buffer.h>
26#include <isc/entropy.h>
27#include <isc/hash.h>
28#include <isc/log.h>
29#include <isc/mem.h>
30#include <isc/string.h>
31#include <isc/task.h>
32#include <isc/timer.h>
33#include <isc/util.h>
34
35#include <dns/result.h>
36#include <dns/zone.h>
37
38#define CHECK(r) \
39	do { \
40		result = (r); \
41		if (result != ISC_R_SUCCESS) \
42			goto cleanup; \
43	} while (/*CONSTCOND*/0)
44
45extern isc_mem_t *mctx;
46extern isc_entropy_t *ectx;
47extern isc_log_t *lctx;
48extern isc_taskmgr_t *taskmgr;
49extern isc_task_t *maintask;
50extern isc_timermgr_t *timermgr;
51extern isc_socketmgr_t *socketmgr;
52extern dns_zonemgr_t *zonemgr;
53extern isc_boolean_t app_running;
54extern int ncpus;
55
56isc_result_t
57dns_test_begin(FILE *logfile, isc_boolean_t create_managers);
58
59void
60dns_test_end(void);
61
62isc_result_t
63dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
64				  isc_boolean_t keepview);
65
66isc_result_t
67dns_test_setupzonemgr(void);
68
69isc_result_t
70dns_test_managezone(dns_zone_t *zone);
71
72void
73dns_test_releasezone(dns_zone_t *zone);
74
75void
76dns_test_closezonemgr(void);
77
78void
79dns_test_nap(isc_uint32_t usec);
80
81isc_result_t
82dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
83		const char *testfile);
84