Home | History | Annotate | Line # | Download | only in dnssec
dnssectool.h revision 1.7
      1 /*	$NetBSD: dnssectool.h,v 1.7 2024/02/21 22:51:03 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  *
      6  * SPDX-License-Identifier: MPL-2.0
      7  *
      8  * This Source Code Form is subject to the terms of the Mozilla Public
      9  * License, v. 2.0. If a copy of the MPL was not distributed with this
     10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
     11  *
     12  * See the COPYRIGHT file distributed with this work for additional
     13  * information regarding copyright ownership.
     14  */
     15 
     16 #pragma once
     17 
     18 #include <inttypes.h>
     19 #include <stdbool.h>
     20 
     21 #include <isc/attributes.h>
     22 #include <isc/log.h>
     23 #include <isc/stdtime.h>
     24 
     25 #include <dns/rdatastruct.h>
     26 
     27 #include <dst/dst.h>
     28 
     29 /*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
     30  */
     31 extern int verbose;
     32 extern bool quiet;
     33 
     34 /*! program name, statically initialized in each program */
     35 extern const char *program;
     36 
     37 /*!
     38  * List of DS digest types used by dnssec-cds and dnssec-dsfromkey,
     39  * defined in dnssectool.c. Filled in by add_dtype() from -a
     40  * arguments, sorted (so that DS records are in a canonical order) and
     41  * terminated by a zero. The size of the array is an arbitrary limit
     42  * which should be greater than the number of known digest types.
     43  */
     44 extern uint8_t dtype[8];
     45 
     46 typedef void(fatalcallback_t)(void);
     47 
     48 noreturn void
     49 fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
     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 noreturn void
     61 version(const char *program);
     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