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