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
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
;
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
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)
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.
109 ns_server_destroy(ns_server_t
**serverp
);
111 * Destroy a server object, freeing its memory.
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
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.
130 ns_server_reloadcommand(ns_server_t
*server
, char *args
, isc_buffer_t
*text
);
132 * Act on a "reload" command from the command channel.
136 ns_server_reconfigcommand(ns_server_t
*server
, char *args
);
138 * Act on a "reconfig" command from the command channel.
142 ns_server_refreshcommand(ns_server_t
*server
, char *args
, isc_buffer_t
*text
);
144 * Act on a "refresh" command from the command channel.
148 ns_server_retransfercommand(ns_server_t
*server
, char *args
);
150 * Act on a "retransfer" command from the command channel.
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.
163 ns_server_dumpstats(ns_server_t
*server
);
166 * Dump the current cache to the dump file.
169 ns_server_dumpdb(ns_server_t
*server
, char *args
);
172 * Change or increment the server debug level.
175 ns_server_setdebuglevel(ns_server_t
*server
, char *args
);
178 * Flush the server's cache(s)
181 ns_server_flushcache(ns_server_t
*server
, char *args
);
184 * Flush a particular name from the server's cache(s)
187 ns_server_flushname(ns_server_t
*server
, char *args
);
190 * Report the server's status.
193 ns_server_status(ns_server_t
*server
, isc_buffer_t
*text
);
196 * Enable or disable updates for a zone.
199 ns_server_freeze(ns_server_t
*server
, isc_boolean_t freeze
, char *args
);
202 * Dump the current recursive queries.
205 ns_server_dumprecursing(ns_server_t
*server
);
208 * Maintain a list of dispatches that require reserved ports.
211 ns_add_reserved_dispatch(ns_server_t
*server
, const isc_sockaddr_t
*addr
);
213 #endif /* NAMED_SERVER_H */