1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * SPDX-License-Identifier: MPL-2.0
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 #ifndef NAMED_CONTROL_H
15 #define NAMED_CONTROL_H 1
16 
17 /*! \file
18  * \brief
19  * The name server command channel.
20  */
21 
22 #include <stdbool.h>
23 
24 #include <isccfg/aclconf.h>
25 
26 #include <isccc/types.h>
27 #include <named/types.h>
28 
29 #define NAMED_CONTROL_PORT 953
30 
31 #define NAMED_COMMAND_STOP	   "stop"
32 #define NAMED_COMMAND_HALT	   "halt"
33 #define NAMED_COMMAND_RELOAD	   "reload"
34 #define NAMED_COMMAND_RECONFIG	   "reconfig"
35 #define NAMED_COMMAND_REFRESH	   "refresh"
36 #define NAMED_COMMAND_RETRANSFER   "retransfer"
37 #define NAMED_COMMAND_DUMPSTATS	   "stats"
38 #define NAMED_COMMAND_QUERYLOG	   "querylog"
39 #define NAMED_COMMAND_DUMPDB	   "dumpdb"
40 #define NAMED_COMMAND_SECROOTS	   "secroots"
41 #define NAMED_COMMAND_TRACE	   "trace"
42 #define NAMED_COMMAND_NOTRACE	   "notrace"
43 #define NAMED_COMMAND_FLUSH	   "flush"
44 #define NAMED_COMMAND_FLUSHNAME	   "flushname"
45 #define NAMED_COMMAND_FLUSHTREE	   "flushtree"
46 #define NAMED_COMMAND_STATUS	   "status"
47 #define NAMED_COMMAND_TSIGLIST	   "tsig-list"
48 #define NAMED_COMMAND_TSIGDELETE   "tsig-delete"
49 #define NAMED_COMMAND_FREEZE	   "freeze"
50 #define NAMED_COMMAND_UNFREEZE	   "unfreeze"
51 #define NAMED_COMMAND_THAW	   "thaw"
52 #define NAMED_COMMAND_TIMERPOKE	   "timerpoke"
53 #define NAMED_COMMAND_RECURSING	   "recursing"
54 #define NAMED_COMMAND_NULL	   "null"
55 #define NAMED_COMMAND_NOTIFY	   "notify"
56 #define NAMED_COMMAND_VALIDATION   "validation"
57 #define NAMED_COMMAND_SCAN	   "scan"
58 #define NAMED_COMMAND_SIGN	   "sign"
59 #define NAMED_COMMAND_LOADKEYS	   "loadkeys"
60 #define NAMED_COMMAND_ADDZONE	   "addzone"
61 #define NAMED_COMMAND_MODZONE	   "modzone"
62 #define NAMED_COMMAND_DELZONE	   "delzone"
63 #define NAMED_COMMAND_SHOWZONE	   "showzone"
64 #define NAMED_COMMAND_SYNC	   "sync"
65 #define NAMED_COMMAND_SIGNING	   "signing"
66 #define NAMED_COMMAND_DNSSEC	   "dnssec"
67 #define NAMED_COMMAND_ZONESTATUS   "zonestatus"
68 #define NAMED_COMMAND_NTA	   "nta"
69 #define NAMED_COMMAND_TESTGEN	   "testgen"
70 #define NAMED_COMMAND_MKEYS	   "managed-keys"
71 #define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
72 #define NAMED_COMMAND_DNSTAP	   "dnstap"
73 #define NAMED_COMMAND_TCPTIMEOUTS  "tcp-timeouts"
74 #define NAMED_COMMAND_SERVESTALE   "serve-stale"
75 
76 isc_result_t
77 named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
78 /*%<
79  * Create an initial, empty set of command channels for 'server'.
80  */
81 
82 void
83 named_controls_destroy(named_controls_t **ctrlsp);
84 /*%<
85  * Destroy a set of command channels.
86  *
87  * Requires:
88  *	Shutdown of the channels has completed.
89  */
90 
91 isc_result_t
92 named_controls_configure(named_controls_t *controls, const cfg_obj_t *config,
93 			 cfg_aclconfctx_t *aclconfctx);
94 /*%<
95  * Configure zero or more command channels into 'controls'
96  * as defined in the configuration parse tree 'config'.
97  * The channels will evaluate ACLs in the context of
98  * 'aclconfctx'.
99  */
100 
101 void
102 named_controls_shutdown(named_controls_t *controls);
103 /*%<
104  * Initiate shutdown of all the command channels in 'controls'.
105  */
106 
107 isc_result_t
108 named_control_docommand(isccc_sexpr_t *message, bool readonly,
109 			isc_buffer_t **text);
110 
111 #endif /* NAMED_CONTROL_H */
112