Home | History | Annotate | Line # | Download | only in dnssec
dnssectool.h revision 1.6
      1 /*	$NetBSD: dnssectool.h,v 1.6 2022/09/23 12:15:21 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 #ifndef DNSSECTOOL_H
     17 #define DNSSECTOOL_H 1
     18 
     19 #include <inttypes.h>
     20 #include <stdbool.h>
     21 
     22 #include <isc/log.h>
     23 #include <isc/platform.h>
     24 #include <isc/stdtime.h>
     25 
     26 #include <dns/rdatastruct.h>
     27 
     28 #include <dst/dst.h>
     29 
     30 /*! verbosity: set by -v and -q option in each program, defined in dnssectool.c
     31  */
     32 extern int verbose;
     33 extern bool quiet;
     34 
     35 /*! program name, statically initialized in each program */
     36 extern const char *program;
     37 
     38 /*!
     39  * List of DS digest types used by dnssec-cds and dnssec-dsfromkey,
     40  * defined in dnssectool.c. Filled in by add_dtype() from -a
     41  * arguments, sorted (so that DS records are in a canonical order) and
     42  * terminated by a zero. The size of the array is an arbitrary limit
     43  * which should be greater than the number of known digest types.
     44  */
     45 extern uint8_t dtype[8];
     46 
     47 typedef void(fatalcallback_t)(void);
     48 
     49 #ifndef CPPCHECK
     50 ISC_PLATFORM_NORETURN_PRE void
     51 fatal(const char *format, ...)
     52 	ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
     53 #else /* CPPCHECK */
     54 #define fatal(...) exit(1)
     55 #endif
     56 
     57 void
     58 setfatalcallback(fatalcallback_t *callback);
     59 
     60 void
     61 check_result(isc_result_t result, const char *message);
     62 
     63 void
     64 vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
     65 
     66 ISC_PLATFORM_NORETURN_PRE void
     67 version(const char *program) ISC_PLATFORM_NORETURN_POST;
     68 
     69 void
     70 sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
     71 #define SIG_FORMATSIZE \
     72 	(DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535"))
     73 
     74 void
     75 setup_logging(isc_mem_t *mctx, isc_log_t **logp);
     76 
     77 void
     78 cleanup_logging(isc_log_t **logp);
     79 
     80 dns_ttl_t
     81 strtottl(const char *str);
     82 
     83 dst_key_state_t
     84 strtokeystate(const char *str);
     85 
     86 isc_stdtime_t
     87 strtotime(const char *str, int64_t now, int64_t base, bool *setp);
     88 
     89 dns_rdataclass_t
     90 strtoclass(const char *str);
     91 
     92 unsigned int
     93 strtodsdigest(const char *str);
     94 
     95 void
     96 add_dtype(unsigned int dt);
     97 
     98 isc_result_t
     99 try_dir(const char *dirname);
    100 
    101 void
    102 check_keyversion(dst_key_t *key, char *keystr);
    103 
    104 void
    105 set_keyversion(dst_key_t *key);
    106 
    107 bool
    108 key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
    109 	      isc_mem_t *mctx, bool *exact);
    110 
    111 bool
    112 isoptarg(const char *arg, char **argv, void (*usage)(void));
    113 
    114 #ifdef _WIN32
    115 void
    116 InitSockets(void);
    117 void
    118 DestroySockets(void);
    119 #endif /* ifdef _WIN32 */
    120 
    121 #endif /* DNSSEC_DNSSECTOOL_H */
    122