]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - contrib/bind9/bin/named/include/named/server.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / contrib / bind9 / bin / named / include / named / server.h
1 /*
2  * Copyright (C) 2004-2006  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2003  Internet Software Consortium.
4  *
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.
8  *
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.
16  */
17
18 /* $Id: server.h,v 1.73.18.8 2006/03/09 23:46:20 marka Exp $ */
19
20 #ifndef NAMED_SERVER_H
21 #define NAMED_SERVER_H 1
22
23 /*! \file */
24
25 #include <isc/log.h>
26 #include <isc/sockaddr.h>
27 #include <isc/magic.h>
28 #include <isc/types.h>
29 #include <isc/quota.h>
30
31 #include <dns/types.h>
32 #include <dns/acl.h>
33
34 #include <named/types.h>
35
36 #define NS_EVENTCLASS           ISC_EVENTCLASS(0x4E43)
37 #define NS_EVENT_RELOAD         (NS_EVENTCLASS + 0)
38 #define NS_EVENT_CLIENTCONTROL  (NS_EVENTCLASS + 1)
39
40 /*%
41  * Name server state.  Better here than in lots of separate global variables.
42  */
43 struct ns_server {
44         unsigned int            magic;
45         isc_mem_t *             mctx;
46
47         isc_task_t *            task;
48
49         /* Configurable data. */
50         isc_quota_t             xfroutquota;
51         isc_quota_t             tcpquota;
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 */
64
65         /*%
66          * Current ACL environment.  This defines the
67          * current values of the localhost and localnets
68          * ACLs.
69          */
70         dns_aclenv_t            aclenv;
71
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;
79
80         isc_timer_t *           interface_timer;
81         isc_timer_t *           heartbeat_timer;
82         isc_timer_t *           pps_timer;
83
84         isc_uint32_t            interface_interval;
85         isc_uint32_t            heartbeat_interval;
86
87         isc_mutex_t             reload_event_lock;
88         isc_event_t *           reload_event;
89
90         isc_boolean_t           flushonshutdown;
91         isc_boolean_t           log_queries;    /*%< For BIND 8 compatibility */
92
93         isc_uint64_t *          querystats;     /*%< Query statistics counters */
94
95         ns_controls_t *         controls;       /*%< Control channels */
96         unsigned int            dispatchgen;
97         ns_dispatchlist_t       dispatches;
98
99         dns_acache_t            *acache;
100 };
101
102 #define NS_SERVER_MAGIC                 ISC_MAGIC('S','V','E','R')
103 #define NS_SERVER_VALID(s)              ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
104
105 void
106 ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
107 /*%<
108  * Create a server object with default settings.
109  * This function either succeeds or causes the program to exit
110  * with a fatal error.
111  */
112
113 void
114 ns_server_destroy(ns_server_t **serverp);
115 /*%<
116  * Destroy a server object, freeing its memory.
117  */
118
119 void
120 ns_server_reloadwanted(ns_server_t *server);
121 /*%<
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
125  * is ignored.
126  */
127
128 void
129 ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
130 /*%<
131  * Inform the server that the zones should be flushed to disk on shutdown.
132  */
133
134 isc_result_t
135 ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text);
136 /*%<
137  * Act on a "reload" command from the command channel.
138  */
139
140 isc_result_t
141 ns_server_reconfigcommand(ns_server_t *server, char *args);
142 /*%<
143  * Act on a "reconfig" command from the command channel.
144  */
145
146 isc_result_t
147 ns_server_notifycommand(ns_server_t *server, char *args, isc_buffer_t *text);
148 /*%<
149  * Act on a "notify" command from the command channel.
150  */
151
152 isc_result_t
153 ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text);
154 /*%<
155  * Act on a "refresh" command from the command channel.
156  */
157
158 isc_result_t
159 ns_server_retransfercommand(ns_server_t *server, char *args);
160 /*%<
161  * Act on a "retransfer" command from the command channel.
162  */
163
164 isc_result_t
165 ns_server_togglequerylog(ns_server_t *server);
166 /*%<
167  * Toggle logging of queries, as in BIND 8.
168  */
169
170 /*%
171  * Dump the current statistics to the statistics file.
172  */
173 isc_result_t
174 ns_server_dumpstats(ns_server_t *server);
175
176 /*%
177  * Dump the current cache to the dump file.
178  */
179 isc_result_t
180 ns_server_dumpdb(ns_server_t *server, char *args);
181
182 /*%
183  * Change or increment the server debug level.
184  */
185 isc_result_t
186 ns_server_setdebuglevel(ns_server_t *server, char *args);
187
188 /*%
189  * Flush the server's cache(s)
190  */
191 isc_result_t
192 ns_server_flushcache(ns_server_t *server, char *args);
193
194 /*%
195  * Flush a particular name from the server's cache(s)
196  */
197 isc_result_t
198 ns_server_flushname(ns_server_t *server, char *args);
199
200 /*%
201  * Report the server's status.
202  */
203 isc_result_t
204 ns_server_status(ns_server_t *server, isc_buffer_t *text);
205
206 /*%
207  * Enable or disable updates for a zone.
208  */
209 isc_result_t
210 ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args);
211
212 /*%
213  * Dump the current recursive queries.
214  */
215 isc_result_t
216 ns_server_dumprecursing(ns_server_t *server);
217
218 /*%
219  * Maintain a list of dispatches that require reserved ports.
220  */
221 void
222 ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr);
223
224 /*%
225  * Enable or disable dnssec validation.
226  */
227 isc_result_t
228 ns_server_validation(ns_server_t *server, char *args);
229
230 #endif /* NAMED_SERVER_H */