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