xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/irs/include/irs/dnsconf.h (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1 /*	$NetBSD: dnsconf.h,v 1.1 2024/02/18 20:57:47 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 IRS_DNSCONF_H
17 #define IRS_DNSCONF_H 1
18 
19 /*! \file
20  *
21  * \brief
22  * The IRS dnsconf module parses an "advanced" configuration file related to
23  * the DNS library, such as trust anchors for DNSSEC validation, and creates
24  * the corresponding configuration objects for the DNS library modules.
25  *
26  * Notes:
27  * This module is very experimental and the configuration syntax or library
28  * interfaces may change in future versions.  Currently, only static
29  * key configuration is supported; "trusted-keys" and "trust-anchors"/
30  * "managed-keys" statements will be parsed exactly as they are in
31  * named.conf, except that "trust-anchors" and "managed-keys" entries will
32  * be treated as if they were configured with "static-key", even if they
33  * were actually configured with "initial-key".
34  */
35 
36 #include <irs/types.h>
37 
38 /*%
39  * A compound structure storing DNS key information mainly for DNSSEC
40  * validation.  A dns_key_t object will be created using the 'keyname' and
41  * 'keydatabuf' members with the dst_key_fromdns() function.
42  */
43 typedef struct irs_dnsconf_dnskey {
44 	dns_name_t   *keyname;
45 	isc_buffer_t *keydatabuf;
46 	ISC_LINK(struct irs_dnsconf_dnskey) link;
47 } irs_dnsconf_dnskey_t;
48 
49 typedef ISC_LIST(irs_dnsconf_dnskey_t) irs_dnsconf_dnskeylist_t;
50 
51 ISC_LANG_BEGINDECLS
52 
53 isc_result_t
54 irs_dnsconf_load(isc_mem_t *mctx, const char *filename, irs_dnsconf_t **confp);
55 /*%<
56  * Load the "advanced" DNS configuration file 'filename' in the "dns.conf"
57  * format, and create a new irs_dnsconf_t object from the configuration.
58  *
59  * Requires:
60  *
61  *\li	'mctx' is a valid memory context.
62  *
63  *\li	'filename' != NULL
64  *
65  *\li	'confp' != NULL && '*confp' == NULL
66  */
67 
68 void
69 irs_dnsconf_destroy(irs_dnsconf_t **confp);
70 /*%<
71  * Destroy the dnsconf object.
72  *
73  * Requires:
74  *
75  *\li	'*confp' is a valid dnsconf object.
76  *
77  * Ensures:
78  *
79  *\li	*confp == NULL
80  */
81 
82 irs_dnsconf_dnskeylist_t *
83 irs_dnsconf_gettrustedkeys(irs_dnsconf_t *conf);
84 /*%<
85  * Return a list of key information stored in 'conf'.
86  *
87  * Requires:
88  *
89  *\li	'conf' is a valid dnsconf object.
90  */
91 
92 ISC_LANG_ENDDECLS
93 
94 #endif /* IRS_DNSCONF_H */
95