dnssectool.h revision 1.4 1 /* $NetBSD: dnssectool.h,v 1.4 2020/05/24 19:46:11 christos Exp $ */
2
3 /*
4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * See the COPYRIGHT file distributed with this work for additional
11 * information regarding copyright ownership.
12 */
13
14 #ifndef DNSSECTOOL_H
15 #define DNSSECTOOL_H 1
16
17 #include <inttypes.h>
18 #include <stdbool.h>
19
20 #include <isc/log.h>
21 #include <isc/platform.h>
22 #include <isc/stdtime.h>
23
24 #include <dns/rdatastruct.h>
25
26 #include <dst/dst.h>
27
28 /*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
29 */
30 extern int verbose;
31 extern bool quiet;
32
33 /*! program name, statically initialized in each program */
34 extern const char *program;
35
36 /*!
37 * List of DS digest types used by dnssec-cds and dnssec-dsfromkey,
38 * defined in dnssectool.c. Filled in by add_dtype() from -a
39 * arguments, sorted (so that DS records are in a canonical order) and
40 * terminated by a zero. The size of the array is an arbitrary limit
41 * which should be greater than the number of known digest types.
42 */
43 extern uint8_t dtype[8];
44
45 typedef void(fatalcallback_t)(void);
46
47 ISC_PLATFORM_NORETURN_PRE void
48 fatal(const char *format, ...)
49 ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
50
51 void
52 setfatalcallback(fatalcallback_t *callback);
53
54 void
55 check_result(isc_result_t result, const char *message);
56
57 void
58 vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
59
60 ISC_PLATFORM_NORETURN_PRE void
61 version(const char *program) ISC_PLATFORM_NORETURN_POST;
62
63 void
64 sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
65 #define SIG_FORMATSIZE \
66 (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
67
68 void
69 setup_logging(isc_mem_t *mctx, isc_log_t **logp);
70
71 void
72 cleanup_logging(isc_log_t **logp);
73
74 dns_ttl_t
75 strtottl(const char *str);
76
77 dst_key_state_t
78 strtokeystate(const char *str);
79
80 isc_stdtime_t
81 strtotime(const char *str, int64_t now, int64_t base, bool *setp);
82
83 dns_rdataclass_t
84 strtoclass(const char *str);
85
86 unsigned int
87 strtodsdigest(const char *str);
88
89 void
90 add_dtype(unsigned int dt);
91
92 isc_result_t
93 try_dir(const char *dirname);
94
95 void
96 check_keyversion(dst_key_t *key, char *keystr);
97
98 void
99 set_keyversion(dst_key_t *key);
100
101 bool
102 key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
103 isc_mem_t *mctx, bool *exact);
104
105 bool
106 isoptarg(const char *arg, char **argv, void (*usage)(void));
107
108 #ifdef _WIN32
109 void
110 InitSockets(void);
111 void
112 DestroySockets(void);
113 #endif /* ifdef _WIN32 */
114
115 #endif /* DNSSEC_DNSSECTOOL_H */
116