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