Home | History | Annotate | Line # | Download | only in named
      1 /*	$NetBSD: control.h,v 1.10 2025/05/21 14:47:36 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 #pragma once
     17 
     18 /*! \file
     19  * \brief
     20  * The name server command channel.
     21  */
     22 
     23 #include <stdbool.h>
     24 
     25 #include <isccc/types.h>
     26 
     27 #include <isccfg/aclconf.h>
     28 
     29 #include <named/types.h>
     30 
     31 #define NAMED_CONTROL_PORT 953
     32 
     33 #define NAMED_COMMAND_ADDZONE	   "addzone"
     34 #define NAMED_COMMAND_DELZONE	   "delzone"
     35 #define NAMED_COMMAND_DNSSEC	   "dnssec"
     36 #define NAMED_COMMAND_DNSTAP	   "dnstap"
     37 #define NAMED_COMMAND_DNSTAPREOPEN "dnstap-reopen"
     38 #define NAMED_COMMAND_DUMPDB	   "dumpdb"
     39 #define NAMED_COMMAND_DUMPSTATS	   "stats"
     40 #define NAMED_COMMAND_FETCHLIMIT   "fetchlimit"
     41 #define NAMED_COMMAND_FLUSH	   "flush"
     42 #define NAMED_COMMAND_FLUSHNAME	   "flushname"
     43 #define NAMED_COMMAND_FLUSHTREE	   "flushtree"
     44 #define NAMED_COMMAND_FREEZE	   "freeze"
     45 #define NAMED_COMMAND_HALT	   "halt"
     46 #define NAMED_COMMAND_LOADKEYS	   "loadkeys"
     47 #define NAMED_COMMAND_MEMPROF	   "memprof"
     48 #define NAMED_COMMAND_MKEYS	   "managed-keys"
     49 #define NAMED_COMMAND_MODZONE	   "modzone"
     50 #define NAMED_COMMAND_NOTIFY	   "notify"
     51 #define NAMED_COMMAND_NOTRACE	   "notrace"
     52 #define NAMED_COMMAND_NTA	   "nta"
     53 #define NAMED_COMMAND_NULL	   "null"
     54 #define NAMED_COMMAND_QUERYLOG	   "querylog"
     55 #define NAMED_COMMAND_RECONFIG	   "reconfig"
     56 #define NAMED_COMMAND_RECURSING	   "recursing"
     57 #define NAMED_COMMAND_REFRESH	   "refresh"
     58 #define NAMED_COMMAND_RELOAD	   "reload"
     59 #define NAMED_COMMAND_RESETSTATS   "reset-stats"
     60 #define NAMED_COMMAND_RESPONSELOG  "responselog"
     61 #define NAMED_COMMAND_RETRANSFER   "retransfer"
     62 #define NAMED_COMMAND_SCAN	   "scan"
     63 #define NAMED_COMMAND_SECROOTS	   "secroots"
     64 #define NAMED_COMMAND_SERVESTALE   "serve-stale"
     65 #define NAMED_COMMAND_SHOWZONE	   "showzone"
     66 #define NAMED_COMMAND_SIGN	   "sign"
     67 #define NAMED_COMMAND_SIGNING	   "signing"
     68 #define NAMED_COMMAND_SKR	   "skr"
     69 #define NAMED_COMMAND_STATUS	   "status"
     70 #define NAMED_COMMAND_STOP	   "stop"
     71 #define NAMED_COMMAND_SYNC	   "sync"
     72 #define NAMED_COMMAND_TCPTIMEOUTS  "tcp-timeouts"
     73 #define NAMED_COMMAND_TESTGEN	   "testgen"
     74 #define NAMED_COMMAND_THAW	   "thaw"
     75 #define NAMED_COMMAND_TRACE	   "trace"
     76 #define NAMED_COMMAND_UNFREEZE	   "unfreeze"
     77 #define NAMED_COMMAND_VALIDATION   "validation"
     78 #define NAMED_COMMAND_ZONESTATUS   "zonestatus"
     79 
     80 isc_result_t
     81 named_controls_create(named_server_t *server, named_controls_t **ctrlsp);
     82 /*%<
     83  * Create an initial, empty set of command channels for 'server'.
     84  */
     85 
     86 void
     87 named_controls_destroy(named_controls_t **ctrlsp);
     88 /*%<
     89  * Destroy a set of command channels.
     90  *
     91  * Requires:
     92  *	Shutdown of the channels has completed.
     93  */
     94 
     95 isc_result_t
     96 named_controls_configure(named_controls_t *controls, const cfg_obj_t *config,
     97 			 cfg_aclconfctx_t *aclconfctx);
     98 /*%<
     99  * Configure zero or more command channels into 'controls'
    100  * as defined in the configuration parse tree 'config'.
    101  * The channels will evaluate ACLs in the context of
    102  * 'aclconfctx'.
    103  */
    104 
    105 void
    106 named_controls_shutdown(named_controls_t *controls);
    107 /*%<
    108  * Initiate shutdown of all the command channels in 'controls'.
    109  */
    110 
    111 isc_result_t
    112 named_control_docommand(isccc_sexpr_t *message, bool readonly,
    113 			isc_buffer_t **text);
    114