1/*	$NetBSD: dnsconf.c,v 1.6 2024/02/21 22:52:44 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/*! \file */
17
18#include <isccfg/cfg.h>
19#include <isccfg/grammar.h>
20
21/*%
22 * A trusted key, as used in the "trusted-keys" statement.
23 */
24static cfg_tuplefielddef_t trustedkey_fields[] = {
25	{ "name", &cfg_type_astring, 0 },
26	{ "flags", &cfg_type_uint32, 0 },
27	{ "protocol", &cfg_type_uint32, 0 },
28	{ "algorithm", &cfg_type_uint32, 0 },
29	{ "key", &cfg_type_qstring, 0 },
30	{ NULL, NULL, 0 }
31};
32
33static cfg_type_t cfg_type_trustedkey = { "trustedkey",	   cfg_parse_tuple,
34					  cfg_print_tuple, cfg_doc_tuple,
35					  &cfg_rep_tuple,  trustedkey_fields };
36
37static cfg_type_t cfg_type_trustedkeys = { "trusted-keys",
38					   cfg_parse_bracketed_list,
39					   cfg_print_bracketed_list,
40					   cfg_doc_bracketed_list,
41					   &cfg_rep_list,
42					   &cfg_type_trustedkey };
43
44/*%
45 * Clauses that can be found within the top level of the dns.conf
46 * file only.
47 */
48static cfg_clausedef_t dnsconf_clauses[] = {
49	{ "trusted-keys", &cfg_type_trustedkeys, CFG_CLAUSEFLAG_MULTI },
50	{ NULL, NULL, 0 }
51};
52
53/*% The top-level dns.conf syntax. */
54
55static cfg_clausedef_t *dnsconf_clausesets[] = { dnsconf_clauses, NULL };
56
57cfg_type_t cfg_type_dnsconf = { "dnsconf",	   cfg_parse_mapbody,
58				cfg_print_mapbody, cfg_doc_mapbody,
59				&cfg_rep_map,	   dnsconf_clausesets };
60