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