2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: server.h,v 1.58.2.3 2004/03/09 06:09:23 marka Exp $ */
20 #ifndef NAMED_SERVER_H
21 #define NAMED_SERVER_H 1
24 #include <isc/sockaddr.h>
25 #include <isc/magic.h>
26 #include <isc/types.h>
27 #include <isc/quota.h>
29 #include <dns/types.h>
32 #include <named/types.h>
34 #define NS_EVENTCLASS ISC_EVENTCLASS(0x4E43)
35 #define NS_EVENT_RELOAD (NS_EVENTCLASS + 0)
36 #define NS_EVENT_CLIENTCONTROL (NS_EVENTCLASS + 1)
39 * Name server state. Better here than in lots of separate global variables.
47 /* Configurable data. */
48 isc_quota_t xfroutquota;
50 isc_quota_t recursionquota;
51 dns_acl_t *blackholeacl;
54 * Current ACL environment. This defines the
55 * current values of the localhost and localnets
60 /* Server data structures. */
61 dns_loadmgr_t * loadmgr;
62 dns_zonemgr_t * zonemgr;
63 dns_viewlist_t viewlist;
64 ns_interfacemgr_t * interfacemgr;
65 dns_db_t * in_roothints;
66 dns_tkeyctx_t * tkeyctx;
68 isc_timer_t * interface_timer;
69 isc_timer_t * heartbeat_timer;
70 isc_uint32_t interface_interval;
71 isc_uint32_t heartbeat_interval;
73 isc_mutex_t reload_event_lock;
74 isc_event_t * reload_event;
76 isc_boolean_t flushonshutdown;
77 isc_boolean_t log_queries; /* For BIND 8 compatibility */
79 char * statsfile; /* Statistics file name */
80 isc_uint64_t * querystats; /* Query statistics counters */
82 char * dumpfile; /* Dump file name */
84 ns_controls_t * controls; /* Control channels */
85 unsigned int dispatchgen;
86 ns_dispatchlist_t dispatches;
90 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
91 #define NS_SERVER_VALID(s) ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
94 ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
96 * Create a server object with default settings.
97 * This function either succeeds or causes the program to exit
102 ns_server_destroy(ns_server_t **serverp);
104 * Destroy a server object, freeing its memory.
108 ns_server_reloadwanted(ns_server_t *server);
110 * Inform a server that a reload is wanted. This function
111 * may be called asynchronously, from outside the server's task.
112 * If a reload is already scheduled or in progress, the call
117 ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
119 * Inform the server that the zones should be flushed to disk on shutdown.
123 ns_server_reloadcommand(ns_server_t *server, char *args);
125 * Act on a "reload" command from the command channel.
129 ns_server_reconfigcommand(ns_server_t *server, char *args);
131 * Act on a "reconfig" command from the command channel.
135 ns_server_refreshcommand(ns_server_t *server, char *args);
137 * Act on a "refresh" command from the command channel.
141 ns_server_togglequerylog(ns_server_t *server);
143 * Toggle logging of queries, as in BIND 8.
147 * Dump the current statistics to the statistics file.
150 ns_server_dumpstats(ns_server_t *server);
153 * Dump the current cache to the dump file.
156 ns_server_dumpdb(ns_server_t *server);
159 * Change or increment the server debug level.
162 ns_server_setdebuglevel(ns_server_t *server, char *args);
165 * Flush the server's cache(s)
168 ns_server_flushcache(ns_server_t *server, char *args);
171 * Report the server's status.
174 ns_server_status(ns_server_t *server, isc_buffer_t *text);
177 * Maintain a list of dispatches that require reserved ports.
180 ns_add_reserved_dispatch(ns_server_t *server, isc_sockaddr_t *addr);
182 #endif /* NAMED_SERVER_H */