Import bind-9.3.4
[dragonfly.git] / contrib / bind-9.3 / bin / named / include / named / server.h
blob37526c0bef69a426c251336dbc9cb4cec44601fb
1 /*
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.58.2.1.10.13 2006/03/02 00:37:20 marka Exp $ */
20 #ifndef NAMED_SERVER_H
21 #define NAMED_SERVER_H 1
23 #include <isc/log.h>
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>
30 #include <dns/acl.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.
41 struct ns_server {
42 unsigned int magic;
43 isc_mem_t * mctx;
45 isc_task_t * task;
47 /* Configurable data. */
48 isc_quota_t xfroutquota;
49 isc_quota_t tcpquota;
50 isc_quota_t recursionquota;
51 dns_acl_t *blackholeacl;
52 char * statsfile; /* Statistics file name */
53 char * dumpfile; /* Dump file name */
54 char * recfile; /* Recursive file name */
55 isc_boolean_t version_set; /* User has set version */
56 char * version; /* User-specified version */
57 isc_boolean_t hostname_set; /* User has set hostname */
58 char * hostname; /* User-specified hostname */
59 /* Use hostname for server id */
60 isc_boolean_t server_usehostname;
61 char * server_id; /* User-specified server id */
64 * Current ACL environment. This defines the
65 * current values of the localhost and localnets
66 * ACLs.
68 dns_aclenv_t aclenv;
70 /* Server data structures. */
71 dns_loadmgr_t * loadmgr;
72 dns_zonemgr_t * zonemgr;
73 dns_viewlist_t viewlist;
74 ns_interfacemgr_t * interfacemgr;
75 dns_db_t * in_roothints;
76 dns_tkeyctx_t * tkeyctx;
78 isc_timer_t * interface_timer;
79 isc_timer_t * heartbeat_timer;
80 isc_uint32_t interface_interval;
81 isc_uint32_t heartbeat_interval;
83 isc_mutex_t reload_event_lock;
84 isc_event_t * reload_event;
86 isc_boolean_t flushonshutdown;
87 isc_boolean_t log_queries; /* For BIND 8 compatibility */
89 isc_uint64_t * querystats; /* Query statistics counters */
91 ns_controls_t * controls; /* Control channels */
92 unsigned int dispatchgen;
93 ns_dispatchlist_t dispatches;
97 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
98 #define NS_SERVER_VALID(s) ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
100 void
101 ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
103 * Create a server object with default settings.
104 * This function either succeeds or causes the program to exit
105 * with a fatal error.
108 void
109 ns_server_destroy(ns_server_t **serverp);
111 * Destroy a server object, freeing its memory.
114 void
115 ns_server_reloadwanted(ns_server_t *server);
117 * Inform a server that a reload is wanted. This function
118 * may be called asynchronously, from outside the server's task.
119 * If a reload is already scheduled or in progress, the call
120 * is ignored.
123 void
124 ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
126 * Inform the server that the zones should be flushed to disk on shutdown.
129 isc_result_t
130 ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text);
132 * Act on a "reload" command from the command channel.
135 isc_result_t
136 ns_server_reconfigcommand(ns_server_t *server, char *args);
138 * Act on a "reconfig" command from the command channel.
141 isc_result_t
142 ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text);
144 * Act on a "refresh" command from the command channel.
147 isc_result_t
148 ns_server_retransfercommand(ns_server_t *server, char *args);
150 * Act on a "retransfer" command from the command channel.
153 isc_result_t
154 ns_server_togglequerylog(ns_server_t *server);
156 * Toggle logging of queries, as in BIND 8.
160 * Dump the current statistics to the statistics file.
162 isc_result_t
163 ns_server_dumpstats(ns_server_t *server);
166 * Dump the current cache to the dump file.
168 isc_result_t
169 ns_server_dumpdb(ns_server_t *server, char *args);
172 * Change or increment the server debug level.
174 isc_result_t
175 ns_server_setdebuglevel(ns_server_t *server, char *args);
178 * Flush the server's cache(s)
180 isc_result_t
181 ns_server_flushcache(ns_server_t *server, char *args);
184 * Flush a particular name from the server's cache(s)
186 isc_result_t
187 ns_server_flushname(ns_server_t *server, char *args);
190 * Report the server's status.
192 isc_result_t
193 ns_server_status(ns_server_t *server, isc_buffer_t *text);
196 * Enable or disable updates for a zone.
198 isc_result_t
199 ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args);
202 * Dump the current recursive queries.
204 isc_result_t
205 ns_server_dumprecursing(ns_server_t *server);
208 * Maintain a list of dispatches that require reserved ports.
210 void
211 ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr);
213 #endif /* NAMED_SERVER_H */