xref: /minix/external/bsd/bind/dist/lib/dns/tests/dnstest.h (revision fb9c64b2)
1 /*	$NetBSD: dnstest.h,v 1.3 2014/12/10 04:37:59 christos 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 
45 extern isc_mem_t *mctx;
46 extern isc_entropy_t *ectx;
47 extern isc_log_t *lctx;
48 extern isc_taskmgr_t *taskmgr;
49 extern isc_task_t *maintask;
50 extern isc_timermgr_t *timermgr;
51 extern isc_socketmgr_t *socketmgr;
52 extern dns_zonemgr_t *zonemgr;
53 extern isc_boolean_t app_running;
54 extern int ncpus;
55 
56 isc_result_t
57 dns_test_begin(FILE *logfile, isc_boolean_t create_managers);
58 
59 void
60 dns_test_end(void);
61 
62 isc_result_t
63 dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
64 				  isc_boolean_t keepview);
65 
66 isc_result_t
67 dns_test_setupzonemgr(void);
68 
69 isc_result_t
70 dns_test_managezone(dns_zone_t *zone);
71 
72 void
73 dns_test_releasezone(dns_zone_t *zone);
74 
75 void
76 dns_test_closezonemgr(void);
77 
78 void
79 dns_test_nap(isc_uint32_t usec);
80 
81 isc_result_t
82 dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
83 		const char *testfile);
84