1 /*	$NetBSD: dnssectool.h,v 1.7 2015/07/08 17:28:55 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004, 2007-2012, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: dnssectool.h,v 1.33 2011/10/20 23:46:51 tbox Exp  */
21 
22 #ifndef DNSSECTOOL_H
23 #define DNSSECTOOL_H 1
24 
25 #include <isc/log.h>
26 #include <isc/stdtime.h>
27 #include <dns/rdatastruct.h>
28 #include <dst/dst.h>
29 
30 #define check_dns_dbiterator_current(result) \
31 	check_result((result == DNS_R_NEWORIGIN) ? ISC_R_SUCCESS : result, \
32 		     "dns_dbiterator_current()")
33 
34 
35 typedef void (fatalcallback_t)(void);
36 
37 ISC_PLATFORM_NORETURN_PRE void
38 fatal(const char *format, ...)
39 ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
40 
41 void
42 setfatalcallback(fatalcallback_t *callback);
43 
44 void
45 check_result(isc_result_t result, const char *message);
46 
47 void
48 vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
49 
50 void
51 version(const char *program);
52 
53 void
54 type_format(const dns_rdatatype_t type, char *cp, unsigned int size);
55 #define TYPE_FORMATSIZE 20
56 
57 void
58 sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
59 #define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
60 
61 void
62 setup_logging(isc_mem_t *mctx, isc_log_t **logp);
63 
64 void
65 cleanup_logging(isc_log_t **logp);
66 
67 void
68 setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx);
69 
70 void
71 cleanup_entropy(isc_entropy_t **ectx);
72 
73 dns_ttl_t strtottl(const char *str);
74 
75 isc_stdtime_t
76 strtotime(const char *str, isc_int64_t now, isc_int64_t base,
77 	  isc_boolean_t *setp);
78 
79 dns_rdataclass_t
80 strtoclass(const char *str);
81 
82 isc_result_t
83 try_dir(const char *dirname);
84 
85 void
86 check_keyversion(dst_key_t *key, char *keystr);
87 
88 void
89 set_keyversion(dst_key_t *key);
90 
91 isc_boolean_t
92 key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
93 	      isc_mem_t *mctx, isc_boolean_t *exact);
94 
95 isc_boolean_t
96 is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
97 		      dns_name_t *name, dns_dbnode_t *node, isc_uint32_t *ttlp);
98 
99 void
100 verifyzone(dns_db_t *db, dns_dbversion_t *ver,
101 		   dns_name_t *origin, isc_mem_t *mctx,
102 		   isc_boolean_t ignore_kskflag, isc_boolean_t keyset_kskonly);
103 #endif /* DNSSEC_DNSSECTOOL_H */
104