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