server.h 21.1 KB
Newer Older
Bob Halley's avatar
add  
Bob Halley committed
1
/*
2
 * Copyright (C) 1999-2017  Internet Systems Consortium, Inc. ("ISC")
3
 *
4 5 6
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
Bob Halley's avatar
add  
Bob Halley committed
7 8
 */

9 10
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
Bob Halley's avatar
add  
Bob Halley committed
11

12 13
/*! \file */

Bob Halley's avatar
Bob Halley committed
14
#include <isc/log.h>
15
#include <isc/magic.h>
16
#include <isc/quota.h>
17 18 19
#include <isc/sockaddr.h>
#include <isc/types.h>
#include <isc/xml.h>
Bob Halley's avatar
add  
Bob Halley committed
20

21
#include <dns/acl.h>
Evan Hunt's avatar
Evan Hunt committed
22
#include <dns/dnstap.h>
23
#include <dns/types.h>
24

25
#include <named/types.h>
26

27 28
#define NS_EVENTCLASS		ISC_EVENTCLASS(0x4E43)
#define NS_EVENT_RELOAD		(NS_EVENTCLASS + 0)
29
#define NS_EVENT_CLIENTCONTROL	(NS_EVENTCLASS + 1)
30
#define NS_EVENT_DELZONE	(NS_EVENTCLASS + 2)
31

32
/*%
33 34 35
 * Name server state.  Better here than in lots of separate global variables.
 */
struct ns_server {
36
	unsigned int		magic;
37 38
	isc_mem_t *		mctx;

39
	isc_task_t *		task;
40

41
	/* Configurable data. */
42 43 44
	isc_quota_t		xfroutquota;
	isc_quota_t		tcpquota;
	isc_quota_t		recursionquota;
Evan Hunt's avatar
Evan Hunt committed
45

46
	dns_acl_t		*blackholeacl;
47
	dns_acl_t		*keepresporder;
48 49
	char *			statsfile;	/*%< Statistics file name */
	char *			dumpfile;	/*%< Dump file name */
50
	char *			secrootsfile;	/*%< Secroots file name */
51
	char *			bindkeysfile;	/*%< bind.keys file name */
52 53 54 55 56 57
	char *			recfile;	/*%< Recursive file name */
	isc_boolean_t		version_set;	/*%< User has set version */
	char *			version;	/*%< User-specified version */
	isc_boolean_t		hostname_set;	/*%< User has set hostname */
	char *			hostname;	/*%< User-specified hostname */
	/*% Use hostname for server id */
58
	isc_boolean_t		server_usehostname;
59
	char *			server_id;	/*%< User-specified server id */
60

Automatic Updater's avatar
Automatic Updater committed
61
	/*%
62 63 64 65
	 * Current ACL environment.  This defines the
	 * current values of the localhost and localnets
	 * ACLs.
	 */
66 67
	dns_aclenv_t		aclenv;

68
	/* Server data structures. */
69
	dns_loadmgr_t *		loadmgr;
70
	dns_zonemgr_t *		zonemgr;
71
	dns_viewlist_t		viewlist;
72
	ns_interfacemgr_t *	interfacemgr;
73
	dns_db_t *		in_roothints;
74
	dns_tkeyctx_t *		tkeyctx;
75

76
	isc_timer_t *		interface_timer;
Mark Andrews's avatar
Mark Andrews committed
77
	isc_timer_t *		heartbeat_timer;
78
	isc_timer_t *		pps_timer;
79
	isc_timer_t *		tat_timer;
80

81 82
	isc_uint32_t		interface_interval;
	isc_uint32_t		heartbeat_interval;
83

84 85
	isc_mutex_t		reload_event_lock;
	isc_event_t *		reload_event;
86 87

	isc_boolean_t		flushonshutdown;
88
	isc_boolean_t		log_queries;	/*%< For BIND 8 compatibility */
Michael Sawyer's avatar
Michael Sawyer committed
89

90
	ns_cachelist_t		cachelist;	/*%< Possibly shared caches */
91 92 93 94 95 96
	isc_stats_t *		nsstats;	/*%< Server stats */
	dns_stats_t *		rcvquerystats;	/*% Incoming query stats */
	dns_stats_t *		opcodestats;	/*%< Incoming message stats */
	isc_stats_t *		zonestats;	/*% Zone management stats */
	isc_stats_t  *		resolverstats;	/*% Resolver stats */
	isc_stats_t *		sockstats;	/*%< Socket stats */
97 98 99 100 101 102 103 104 105
	isc_stats_t *		udpinstats4;	/*%< Traffic size: UDPv4 in */
	isc_stats_t *		udpoutstats4;	/*%< Traffic size: UDPv4 out */
	isc_stats_t *		udpinstats6;	/*%< Traffic size: UDPv6 in */
	isc_stats_t *		udpoutstats6;	/*%< Traffic size: UDPv6 out */
	isc_stats_t *		tcpinstats4;	/*%< Traffic size: TCPv4 in */
	isc_stats_t *		tcpoutstats4;	/*%< Traffic size: TCPv4 out */
	isc_stats_t *		tcpinstats6;	/*%< Traffic size: TCPv6 in */
	isc_stats_t *		tcpoutstats6;	/*%< Traffic size: TCPv6 out */
	dns_stats_t *		rcodestats;	/*%< Sent Response code stats */
106

107
	ns_controls_t *		controls;	/*%< Control channels */
108 109
	unsigned int		dispatchgen;
	ns_dispatchlist_t	dispatches;
110

111
	ns_statschannellist_t	statschannels;
112

113 114 115 116 117
	dns_tsigkey_t		*sessionkey;
	char			*session_keyfile;
	dns_name_t		*session_keyname;
	unsigned int		session_keyalg;
	isc_uint16_t		session_keybits;
118
	isc_boolean_t		interface_auto;
119 120
	unsigned char		secret[32];	/*%< Server Cookie Secret */
	ns_cookiealg_t		cookiealg;
121

Evan Hunt's avatar
Evan Hunt committed
122 123
	dns_dtenv_t		*dtenv;		/*%< Dnstap environment */

124
	char *			lockfile;
125 126

	isc_uint16_t		transfer_tcp_message_size;
127 128
};

129 130
#define NS_SERVER_MAGIC			ISC_MAGIC('S','V','E','R')
#define NS_SERVER_VALID(s)		ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
131

132
/*%
133
 * Server statistics counters.  Used as isc_statscounter_t values.
134 135 136 137 138 139 140 141 142
 */
enum {
	dns_nsstatscounter_requestv4 = 0,
	dns_nsstatscounter_requestv6 = 1,
	dns_nsstatscounter_edns0in = 2,
	dns_nsstatscounter_badednsver = 3,
	dns_nsstatscounter_tsigin = 4,
	dns_nsstatscounter_sig0in = 5,
	dns_nsstatscounter_invalidsig = 6,
143
	dns_nsstatscounter_requesttcp = 7,
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

	dns_nsstatscounter_authrej = 8,
	dns_nsstatscounter_recurserej = 9,
	dns_nsstatscounter_xfrrej = 10,
	dns_nsstatscounter_updaterej = 11,

	dns_nsstatscounter_response = 12,
	dns_nsstatscounter_truncatedresp = 13,
	dns_nsstatscounter_edns0out = 14,
	dns_nsstatscounter_tsigout = 15,
	dns_nsstatscounter_sig0out = 16,

	dns_nsstatscounter_success = 17,
	dns_nsstatscounter_authans = 18,
	dns_nsstatscounter_nonauthans = 19,
	dns_nsstatscounter_referral = 20,
	dns_nsstatscounter_nxrrset = 21,
	dns_nsstatscounter_servfail = 22,
	dns_nsstatscounter_formerr = 23,
	dns_nsstatscounter_nxdomain = 24,
	dns_nsstatscounter_recursion = 25,
	dns_nsstatscounter_duplicate = 26,
	dns_nsstatscounter_dropped = 27,
	dns_nsstatscounter_failure = 28,

	dns_nsstatscounter_xfrdone = 29,

	dns_nsstatscounter_updatereqfwd = 30,
	dns_nsstatscounter_updaterespfwd = 31,
	dns_nsstatscounter_updatefwdfail = 32,
	dns_nsstatscounter_updatedone = 33,
	dns_nsstatscounter_updatefail = 34,
	dns_nsstatscounter_updatebadprereq = 35,

178
	dns_nsstatscounter_recursclients = 36,
179

180 181
	dns_nsstatscounter_dns64 = 37,

Evan Hunt's avatar
Evan Hunt committed
182 183 184
	dns_nsstatscounter_ratedropped = 38,
	dns_nsstatscounter_rateslipped = 39,

185 186
	dns_nsstatscounter_rpz_rewrites = 40,

187 188 189
	dns_nsstatscounter_udp = 41,
	dns_nsstatscounter_tcp = 42,

190 191 192
	dns_nsstatscounter_nsidopt = 43,
	dns_nsstatscounter_expireopt = 44,
	dns_nsstatscounter_otheropt = 45,
Evan Hunt's avatar
Evan Hunt committed
193
	dns_nsstatscounter_ecsopt = 46,
194 195
	dns_nsstatscounter_padopt = 47,
	dns_nsstatscounter_keepaliveopt = 48,
196

197 198
	dns_nsstatscounter_nxdomainredirect = 49,
	dns_nsstatscounter_nxdomainredirect_rlookup = 50,
199

200 201 202 203 204 205 206
	dns_nsstatscounter_cookiein = 51,
	dns_nsstatscounter_cookiebadsize = 52,
	dns_nsstatscounter_cookiebadtime = 53,
	dns_nsstatscounter_cookienomatch = 54,
	dns_nsstatscounter_cookiematch = 55,
	dns_nsstatscounter_cookienew = 56,
	dns_nsstatscounter_badcookie = 57,
207

208
	dns_nsstatscounter_max = 58
209 210
};

Evan Hunt's avatar
Evan Hunt committed
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
/*%
 * Traffic size statistics counters. Used as isc_statscounter_t values.
 */
enum {
	dns_sizecounter_in_0 = 0,
	dns_sizecounter_in_16 = 1,
	dns_sizecounter_in_32 = 2,
	dns_sizecounter_in_48 = 3,
	dns_sizecounter_in_64 = 4,
	dns_sizecounter_in_80 = 5,
	dns_sizecounter_in_96 = 6,
	dns_sizecounter_in_112 = 7,
	dns_sizecounter_in_128 = 8,
	dns_sizecounter_in_144 = 9,
	dns_sizecounter_in_160 = 10,
	dns_sizecounter_in_176 = 11,
	dns_sizecounter_in_192 = 12,
	dns_sizecounter_in_208 = 13,
	dns_sizecounter_in_224 = 14,
	dns_sizecounter_in_240 = 15,
	dns_sizecounter_in_256 = 16,
	dns_sizecounter_in_272 = 17,
	dns_sizecounter_in_288 = 18,

	dns_sizecounter_in_max = 19,
};

enum {
	dns_sizecounter_out_0 = 0,
	dns_sizecounter_out_16 = 1,
	dns_sizecounter_out_32 = 2,
	dns_sizecounter_out_48 = 3,
	dns_sizecounter_out_64 = 4,
	dns_sizecounter_out_80 = 5,
	dns_sizecounter_out_96 = 6,
	dns_sizecounter_out_112 = 7,
	dns_sizecounter_out_128 = 8,
	dns_sizecounter_out_144 = 9,
	dns_sizecounter_out_160 = 10,
	dns_sizecounter_out_176 = 11,
	dns_sizecounter_out_192 = 12,
	dns_sizecounter_out_208 = 13,
	dns_sizecounter_out_224 = 14,
	dns_sizecounter_out_240 = 15,
	dns_sizecounter_out_256 = 16,
	dns_sizecounter_out_272 = 17,
	dns_sizecounter_out_288 = 18,
	dns_sizecounter_out_304 = 19,
	dns_sizecounter_out_320 = 20,
	dns_sizecounter_out_336 = 21,
	dns_sizecounter_out_352 = 22,
	dns_sizecounter_out_368 = 23,
	dns_sizecounter_out_384 = 24,
	dns_sizecounter_out_400 = 25,
	dns_sizecounter_out_416 = 26,
	dns_sizecounter_out_432 = 27,
	dns_sizecounter_out_448 = 28,
	dns_sizecounter_out_464 = 29,
	dns_sizecounter_out_480 = 30,
	dns_sizecounter_out_496 = 31,
	dns_sizecounter_out_512 = 32,
	dns_sizecounter_out_528 = 33,
	dns_sizecounter_out_544 = 34,
	dns_sizecounter_out_560 = 35,
	dns_sizecounter_out_576 = 36,
	dns_sizecounter_out_592 = 37,
	dns_sizecounter_out_608 = 38,
	dns_sizecounter_out_624 = 39,
	dns_sizecounter_out_640 = 40,
	dns_sizecounter_out_656 = 41,
	dns_sizecounter_out_672 = 42,
	dns_sizecounter_out_688 = 43,
	dns_sizecounter_out_704 = 44,
	dns_sizecounter_out_720 = 45,
	dns_sizecounter_out_736 = 46,
	dns_sizecounter_out_752 = 47,
	dns_sizecounter_out_768 = 48,
	dns_sizecounter_out_784 = 49,
	dns_sizecounter_out_800 = 50,
	dns_sizecounter_out_816 = 51,
	dns_sizecounter_out_832 = 52,
	dns_sizecounter_out_848 = 53,
	dns_sizecounter_out_864 = 54,
	dns_sizecounter_out_880 = 55,
	dns_sizecounter_out_896 = 56,
	dns_sizecounter_out_912 = 57,
	dns_sizecounter_out_928 = 58,
	dns_sizecounter_out_944 = 59,
	dns_sizecounter_out_960 = 60,
	dns_sizecounter_out_976 = 61,
	dns_sizecounter_out_992 = 62,
	dns_sizecounter_out_1008 = 63,
	dns_sizecounter_out_1024 = 64,
	dns_sizecounter_out_1040 = 65,
	dns_sizecounter_out_1056 = 66,
	dns_sizecounter_out_1072 = 67,
	dns_sizecounter_out_1088 = 68,
	dns_sizecounter_out_1104 = 69,
	dns_sizecounter_out_1120 = 70,
	dns_sizecounter_out_1136 = 71,
	dns_sizecounter_out_1152 = 72,
	dns_sizecounter_out_1168 = 73,
	dns_sizecounter_out_1184 = 74,
	dns_sizecounter_out_1200 = 75,
	dns_sizecounter_out_1216 = 76,
	dns_sizecounter_out_1232 = 77,
	dns_sizecounter_out_1248 = 78,
	dns_sizecounter_out_1264 = 79,
	dns_sizecounter_out_1280 = 80,
	dns_sizecounter_out_1296 = 81,
	dns_sizecounter_out_1312 = 82,
	dns_sizecounter_out_1328 = 83,
	dns_sizecounter_out_1344 = 84,
	dns_sizecounter_out_1360 = 85,
	dns_sizecounter_out_1376 = 86,
	dns_sizecounter_out_1392 = 87,
	dns_sizecounter_out_1408 = 88,
	dns_sizecounter_out_1424 = 89,
	dns_sizecounter_out_1440 = 90,
	dns_sizecounter_out_1456 = 91,
	dns_sizecounter_out_1472 = 92,
	dns_sizecounter_out_1488 = 93,
	dns_sizecounter_out_1504 = 94,
	dns_sizecounter_out_1520 = 95,
	dns_sizecounter_out_1536 = 96,
	dns_sizecounter_out_1552 = 97,
	dns_sizecounter_out_1568 = 98,
	dns_sizecounter_out_1584 = 99,
	dns_sizecounter_out_1600 = 100,
	dns_sizecounter_out_1616 = 101,
	dns_sizecounter_out_1632 = 102,
	dns_sizecounter_out_1648 = 103,
	dns_sizecounter_out_1664 = 104,
	dns_sizecounter_out_1680 = 105,
	dns_sizecounter_out_1696 = 106,
	dns_sizecounter_out_1712 = 107,
	dns_sizecounter_out_1728 = 108,
	dns_sizecounter_out_1744 = 109,
	dns_sizecounter_out_1760 = 110,
	dns_sizecounter_out_1776 = 111,
	dns_sizecounter_out_1792 = 112,
	dns_sizecounter_out_1808 = 113,
	dns_sizecounter_out_1824 = 114,
	dns_sizecounter_out_1840 = 115,
	dns_sizecounter_out_1856 = 116,
	dns_sizecounter_out_1872 = 117,
	dns_sizecounter_out_1888 = 118,
	dns_sizecounter_out_1904 = 119,
	dns_sizecounter_out_1920 = 120,
	dns_sizecounter_out_1936 = 121,
	dns_sizecounter_out_1952 = 122,
	dns_sizecounter_out_1968 = 123,
	dns_sizecounter_out_1984 = 124,
	dns_sizecounter_out_2000 = 125,
	dns_sizecounter_out_2016 = 126,
	dns_sizecounter_out_2032 = 127,
	dns_sizecounter_out_2048 = 128,
	dns_sizecounter_out_2064 = 129,
	dns_sizecounter_out_2080 = 130,
	dns_sizecounter_out_2096 = 131,
	dns_sizecounter_out_2112 = 132,
	dns_sizecounter_out_2128 = 133,
	dns_sizecounter_out_2144 = 134,
	dns_sizecounter_out_2160 = 135,
	dns_sizecounter_out_2176 = 136,
	dns_sizecounter_out_2192 = 137,
	dns_sizecounter_out_2208 = 138,
	dns_sizecounter_out_2224 = 139,
	dns_sizecounter_out_2240 = 140,
	dns_sizecounter_out_2256 = 141,
	dns_sizecounter_out_2272 = 142,
	dns_sizecounter_out_2288 = 143,
	dns_sizecounter_out_2304 = 144,
	dns_sizecounter_out_2320 = 145,
	dns_sizecounter_out_2336 = 146,
	dns_sizecounter_out_2352 = 147,
	dns_sizecounter_out_2368 = 148,
	dns_sizecounter_out_2384 = 149,
	dns_sizecounter_out_2400 = 150,
	dns_sizecounter_out_2416 = 151,
	dns_sizecounter_out_2432 = 152,
	dns_sizecounter_out_2448 = 153,
	dns_sizecounter_out_2464 = 154,
	dns_sizecounter_out_2480 = 155,
	dns_sizecounter_out_2496 = 156,
	dns_sizecounter_out_2512 = 157,
	dns_sizecounter_out_2528 = 158,
	dns_sizecounter_out_2544 = 159,
	dns_sizecounter_out_2560 = 160,
	dns_sizecounter_out_2576 = 161,
	dns_sizecounter_out_2592 = 162,
	dns_sizecounter_out_2608 = 163,
	dns_sizecounter_out_2624 = 164,
	dns_sizecounter_out_2640 = 165,
	dns_sizecounter_out_2656 = 166,
	dns_sizecounter_out_2672 = 167,
	dns_sizecounter_out_2688 = 168,
	dns_sizecounter_out_2704 = 169,
	dns_sizecounter_out_2720 = 170,
	dns_sizecounter_out_2736 = 171,
	dns_sizecounter_out_2752 = 172,
	dns_sizecounter_out_2768 = 173,
	dns_sizecounter_out_2784 = 174,
	dns_sizecounter_out_2800 = 175,
	dns_sizecounter_out_2816 = 176,
	dns_sizecounter_out_2832 = 177,
	dns_sizecounter_out_2848 = 178,
	dns_sizecounter_out_2864 = 179,
	dns_sizecounter_out_2880 = 180,
	dns_sizecounter_out_2896 = 181,
	dns_sizecounter_out_2912 = 182,
	dns_sizecounter_out_2928 = 183,
	dns_sizecounter_out_2944 = 184,
	dns_sizecounter_out_2960 = 185,
	dns_sizecounter_out_2976 = 186,
	dns_sizecounter_out_2992 = 187,
	dns_sizecounter_out_3008 = 188,
	dns_sizecounter_out_3024 = 189,
	dns_sizecounter_out_3040 = 190,
	dns_sizecounter_out_3056 = 191,
	dns_sizecounter_out_3072 = 192,
	dns_sizecounter_out_3088 = 193,
	dns_sizecounter_out_3104 = 194,
	dns_sizecounter_out_3120 = 195,
	dns_sizecounter_out_3136 = 196,
	dns_sizecounter_out_3152 = 197,
	dns_sizecounter_out_3168 = 198,
	dns_sizecounter_out_3184 = 199,
	dns_sizecounter_out_3200 = 200,
	dns_sizecounter_out_3216 = 201,
	dns_sizecounter_out_3232 = 202,
	dns_sizecounter_out_3248 = 203,
	dns_sizecounter_out_3264 = 204,
	dns_sizecounter_out_3280 = 205,
	dns_sizecounter_out_3296 = 206,
	dns_sizecounter_out_3312 = 207,
	dns_sizecounter_out_3328 = 208,
	dns_sizecounter_out_3344 = 209,
	dns_sizecounter_out_3360 = 210,
	dns_sizecounter_out_3376 = 211,
	dns_sizecounter_out_3392 = 212,
	dns_sizecounter_out_3408 = 213,
	dns_sizecounter_out_3424 = 214,
	dns_sizecounter_out_3440 = 215,
	dns_sizecounter_out_3456 = 216,
	dns_sizecounter_out_3472 = 217,
	dns_sizecounter_out_3488 = 218,
	dns_sizecounter_out_3504 = 219,
	dns_sizecounter_out_3520 = 220,
	dns_sizecounter_out_3536 = 221,
	dns_sizecounter_out_3552 = 222,
	dns_sizecounter_out_3568 = 223,
	dns_sizecounter_out_3584 = 224,
	dns_sizecounter_out_3600 = 225,
	dns_sizecounter_out_3616 = 226,
	dns_sizecounter_out_3632 = 227,
	dns_sizecounter_out_3648 = 228,
	dns_sizecounter_out_3664 = 229,
	dns_sizecounter_out_3680 = 230,
	dns_sizecounter_out_3696 = 231,
	dns_sizecounter_out_3712 = 232,
	dns_sizecounter_out_3728 = 233,
	dns_sizecounter_out_3744 = 234,
	dns_sizecounter_out_3760 = 235,
	dns_sizecounter_out_3776 = 236,
	dns_sizecounter_out_3792 = 237,
	dns_sizecounter_out_3808 = 238,
	dns_sizecounter_out_3824 = 239,
	dns_sizecounter_out_3840 = 240,
	dns_sizecounter_out_3856 = 241,
	dns_sizecounter_out_3872 = 242,
	dns_sizecounter_out_3888 = 243,
	dns_sizecounter_out_3904 = 244,
	dns_sizecounter_out_3920 = 245,
	dns_sizecounter_out_3936 = 246,
	dns_sizecounter_out_3952 = 247,
	dns_sizecounter_out_3968 = 248,
	dns_sizecounter_out_3984 = 249,
	dns_sizecounter_out_4000 = 250,
	dns_sizecounter_out_4016 = 251,
	dns_sizecounter_out_4032 = 252,
	dns_sizecounter_out_4048 = 253,
	dns_sizecounter_out_4064 = 254,
	dns_sizecounter_out_4080 = 255,
	dns_sizecounter_out_4096 = 256,

	dns_sizecounter_out_max = 257
};

500
void
501
ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
502
/*%<
503
 * Create a server object with default settings.
504 505
 * This function either succeeds or causes the program to exit
 * with a fatal error.
506 507 508 509
 */

void
ns_server_destroy(ns_server_t **serverp);
510
/*%<
511 512
 * Destroy a server object, freeing its memory.
 */
Bob Halley's avatar
Bob Halley committed
513 514

void
515
ns_server_reloadwanted(ns_server_t *server);
516
/*%<
517 518 519 520 521
 * Inform a server that a reload is wanted.  This function
 * may be called asynchronously, from outside the server's task.
 * If a reload is already scheduled or in progress, the call
 * is ignored.
 */
Bob Halley's avatar
add  
Bob Halley committed
522

523 524 525 526
void
ns_server_scan_interfaces(ns_server_t *server);
/*%<
 * Trigger a interface scan.
527
 * Must only be called when running under server->task.
528 529
 */

530
void
531
ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
532
/*%<
533 534
 * Inform the server that the zones should be flushed to disk on shutdown.
 */
535

536
isc_result_t
537 538
ns_server_reloadcommand(ns_server_t *server, isc_lex_t *lex,
			isc_buffer_t **text);
539
/*%<
540 541
 * Act on a "reload" command from the command channel.
 */
542

543
isc_result_t
544
ns_server_reconfigcommand(ns_server_t *server);
545
/*%<
546 547 548
 * Act on a "reconfig" command from the command channel.
 */

549
isc_result_t
550 551
ns_server_notifycommand(ns_server_t *server, isc_lex_t *lex,
			isc_buffer_t **text);
552
/*%<
553 554 555
 * Act on a "notify" command from the command channel.
 */

556
isc_result_t
557 558
ns_server_refreshcommand(ns_server_t *server, isc_lex_t *lex,
			 isc_buffer_t **text);
559
/*%<
560 561
 * Act on a "refresh" command from the command channel.
 */
562

563
isc_result_t
564
ns_server_retransfercommand(ns_server_t *server, isc_lex_t *lex,
565
			    isc_buffer_t **text);
566
/*%<
567 568 569
 * Act on a "retransfer" command from the command channel.
 */

570
isc_result_t
571
ns_server_togglequerylog(ns_server_t *server, isc_lex_t *lex);
572
/*%<
573 574
 * Enable/disable logging of queries.  (Takes "yes" or "no" argument,
 * but can also be used as a toggle for backward comptibility.)
575 576
 */

577 578 579 580 581 582 583 584 585 586 587 588
/*%
 * Save the current NTAs for all views to files.
 */
isc_result_t
ns_server_saventa(ns_server_t *server);

/*%
 * Load NTAs for all views from files.
 */
isc_result_t
ns_server_loadnta(ns_server_t *server);

589
/*%
590
 * Dump the current statistics to the statistics file.
591
 */
592 593 594
isc_result_t
ns_server_dumpstats(ns_server_t *server);

595
/*%
596 597 598
 * Dump the current cache to the dump file.
 */
isc_result_t
599
ns_server_dumpdb(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
600

601 602 603 604
/*%
 * Dump the current security roots to the secroots file.
 */
isc_result_t
605 606
ns_server_dumpsecroots(ns_server_t *server, isc_lex_t *lex,
		       isc_buffer_t **text);
607

608
/*%
609 610 611
 * Change or increment the server debug level.
 */
isc_result_t
612
ns_server_setdebuglevel(ns_server_t *server, isc_lex_t *lex);
613

614
/*%
615 616 617
 * Flush the server's cache(s)
 */
isc_result_t
618
ns_server_flushcache(ns_server_t *server, isc_lex_t *lex);
619

620
/*%
621 622 623
 * Flush a particular name from the server's cache.  If 'tree' is false,
 * also flush the name from the ADB and badcache.  If 'tree' is true, also
 * flush all the names under the specified name.
624 625
 */
isc_result_t
626 627
ns_server_flushnode(ns_server_t *server, isc_lex_t *lex,
		    isc_boolean_t tree);
628

629
/*%
630 631 632
 * Report the server's status.
 */
isc_result_t
633
ns_server_status(ns_server_t *server, isc_buffer_t **text);
634

635 636 637 638
/*%
 * Report a list of dynamic and static tsig keys, per view.
 */
isc_result_t
639
ns_server_tsiglist(ns_server_t *server, isc_buffer_t **text);
640 641 642 643 644

/*%
 * Delete a specific key (with optional view).
 */
isc_result_t
645 646
ns_server_tsigdelete(ns_server_t *server, isc_lex_t *lex,
		     isc_buffer_t **text);
647

648
/*%
649 650 651
 * Enable or disable updates for a zone.
 */
isc_result_t
652 653
ns_server_freeze(ns_server_t *server, isc_boolean_t freeze,
		 isc_lex_t *lex, isc_buffer_t **text);
654

655 656 657 658
/*%
 * Dump zone updates to disk, optionally removing the journal file
 */
isc_result_t
659
ns_server_sync(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
660

661
/*%
Automatic Updater's avatar
Automatic Updater committed
662
 * Update a zone's DNSKEY set from the key repository.  If
663 664 665 666
 * the command that triggered the call to this function was "sign",
 * then force a full signing of the zone.  If it was "loadkeys",
 * then don't sign the zone; any needed changes to signatures can
 * take place incrementally.
667 668
 */
isc_result_t
669
ns_server_rekey(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
670

671
/*%
672 673 674 675 676
 * Dump the current recursive queries.
 */
isc_result_t
ns_server_dumprecursing(ns_server_t *server);

677
/*%
678 679 680
 * Maintain a list of dispatches that require reserved ports.
 */
void
681
ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr);
682

683 684 685 686
/*%
 * Enable or disable dnssec validation.
 */
isc_result_t
687
ns_server_validation(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
688

689
/*%
Evan Hunt's avatar
Evan Hunt committed
690
 * Add a zone to a running process, or modify an existing zone
691 692
 */
isc_result_t
693
ns_server_changezone(ns_server_t *server, char *command, isc_buffer_t **text);
694 695 696 697 698

/*%
 * Deletes a zone from a running process
 */
isc_result_t
699
ns_server_delzone(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
700 701 702 703 704

/*%
 * Show current configuration for a given zone
 */
isc_result_t
705
ns_server_showzone(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
706

707
/*%
708
 * Lists the status of the signing records for a given zone.
709 710
 */
isc_result_t
711
ns_server_signing(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
712 713 714 715 716 717

/*%
 * Lists status information for a given zone (e.g., name, type, files,
 * load time, expiry, etc).
 */
isc_result_t
718
ns_server_zonestatus(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
Evan Hunt's avatar
Evan Hunt committed
719 720

/*%
721
 * Adds/updates a Negative Trust Anchor (NTA) for a specified name and
Evan Hunt's avatar
Evan Hunt committed
722 723 724
 * duration, in a particular view if specified, or in all views.
 */
isc_result_t
725 726
ns_server_nta(ns_server_t *server, isc_lex_t *lex, isc_boolean_t readonly,
	      isc_buffer_t **text);
727 728 729 730 731 732

/*%
 * Generates a test sequence that is only for use in system tests. The
 * argument is the size of required output in bytes.
 */
isc_result_t
733
ns_server_testgen(isc_lex_t *lex, isc_buffer_t **text);
Evan Hunt's avatar
Evan Hunt committed
734 735 736 737 738

/*%
 * Force fefresh or print status for managed keys zones.
 */
isc_result_t
739
ns_server_mkeys(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
Evan Hunt's avatar
Evan Hunt committed
740

741 742 743 744
/*%
 * Close and reopen DNSTAP output file.
 */
isc_result_t
Evan Hunt's avatar
Evan Hunt committed
745
ns_server_dnstap(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text);
746

747 748 749 750 751 752
/*%
 * Display or update tcp-{initial,idle,keepalive,advertised}-timeout options.
 */
isc_result_t
ns_server_tcptimeouts(isc_lex_t *lex, isc_buffer_t **text);

753
#endif /* NAMED_SERVER_H */