2 * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2003 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.73.18.8 2006/03/09 23:46:20 marka Exp $ */
20 #ifndef NAMED_SERVER_H
21 #define NAMED_SERVER_H 1
26 #include <isc/sockaddr.h>
27 #include <isc/magic.h>
28 #include <isc/types.h>
29 #include <isc/quota.h>
31 #include <dns/types.h>
34 #include <named/types.h>
36 #define NS_EVENTCLASS ISC_EVENTCLASS(0x4E43)
37 #define NS_EVENT_RELOAD (NS_EVENTCLASS + 0)
38 #define NS_EVENT_CLIENTCONTROL (NS_EVENTCLASS + 1)
41 * Name server state. Better here than in lots of separate global variables.
49 /* Configurable data. */
50 isc_quota_t xfroutquota;
52 isc_quota_t recursionquota;
53 dns_acl_t *blackholeacl;
54 char * statsfile; /*%< Statistics file name */
55 char * dumpfile; /*%< Dump file name */
56 char * recfile; /*%< Recursive file name */
57 isc_boolean_t version_set; /*%< User has set version */
58 char * version; /*%< User-specified version */
59 isc_boolean_t hostname_set; /*%< User has set hostname */
60 char * hostname; /*%< User-specified hostname */
61 /*% Use hostname for server id */
62 isc_boolean_t server_usehostname;
63 char * server_id; /*%< User-specified server id */
66 * Current ACL environment. This defines the
67 * current values of the localhost and localnets
72 /* Server data structures. */
73 dns_loadmgr_t * loadmgr;
74 dns_zonemgr_t * zonemgr;
75 dns_viewlist_t viewlist;
76 ns_interfacemgr_t * interfacemgr;
77 dns_db_t * in_roothints;
78 dns_tkeyctx_t * tkeyctx;
80 isc_timer_t * interface_timer;
81 isc_timer_t * heartbeat_timer;
82 isc_timer_t * pps_timer;
84 isc_uint32_t interface_interval;
85 isc_uint32_t heartbeat_interval;
87 isc_mutex_t reload_event_lock;
88 isc_event_t * reload_event;
90 isc_boolean_t flushonshutdown;
91 isc_boolean_t log_queries; /*%< For BIND 8 compatibility */
93 isc_uint64_t * querystats; /*%< Query statistics counters */
95 ns_controls_t * controls; /*%< Control channels */
96 unsigned int dispatchgen;
97 ns_dispatchlist_t dispatches;
102 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
103 #define NS_SERVER_VALID(s) ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
106 ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
108 * Create a server object with default settings.
109 * This function either succeeds or causes the program to exit
110 * with a fatal error.
114 ns_server_destroy(ns_server_t **serverp);
116 * Destroy a server object, freeing its memory.
120 ns_server_reloadwanted(ns_server_t *server);
122 * Inform a server that a reload is wanted. This function
123 * may be called asynchronously, from outside the server's task.
124 * If a reload is already scheduled or in progress, the call
129 ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
131 * Inform the server that the zones should be flushed to disk on shutdown.
135 ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text);
137 * Act on a "reload" command from the command channel.
141 ns_server_reconfigcommand(ns_server_t *server, char *args);
143 * Act on a "reconfig" command from the command channel.
147 ns_server_notifycommand(ns_server_t *server, char *args, isc_buffer_t *text);
149 * Act on a "notify" command from the command channel.
153 ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text);
155 * Act on a "refresh" command from the command channel.
159 ns_server_retransfercommand(ns_server_t *server, char *args);
161 * Act on a "retransfer" command from the command channel.
165 ns_server_togglequerylog(ns_server_t *server);
167 * Toggle logging of queries, as in BIND 8.
171 * Dump the current statistics to the statistics file.
174 ns_server_dumpstats(ns_server_t *server);
177 * Dump the current cache to the dump file.
180 ns_server_dumpdb(ns_server_t *server, char *args);
183 * Change or increment the server debug level.
186 ns_server_setdebuglevel(ns_server_t *server, char *args);
189 * Flush the server's cache(s)
192 ns_server_flushcache(ns_server_t *server, char *args);
195 * Flush a particular name from the server's cache(s)
198 ns_server_flushname(ns_server_t *server, char *args);
201 * Report the server's status.
204 ns_server_status(ns_server_t *server, isc_buffer_t *text);
207 * Enable or disable updates for a zone.
210 ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args);
213 * Dump the current recursive queries.
216 ns_server_dumprecursing(ns_server_t *server);
219 * Maintain a list of dispatches that require reserved ports.
222 ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr);
225 * Enable or disable dnssec validation.
228 ns_server_validation(ns_server_t *server, char *args);
230 #endif /* NAMED_SERVER_H */