bind - Upgraded vendor branch to 9.5.2-P1
[dragonfly.git] / contrib / bind-9.5.2 / lib / dns / include / dns / zone.h
1 /*
2  * Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2003  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or 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: zone.h,v 1.153.56.8 2009/07/11 04:28:14 marka Exp $ */
19
20 #ifndef DNS_ZONE_H
21 #define DNS_ZONE_H 1
22
23 /*! \file dns/zone.h */
24
25 /***
26  ***    Imports
27  ***/
28
29 #include <stdio.h>
30
31 #include <isc/formatcheck.h>
32 #include <isc/lang.h>
33 #include <isc/rwlock.h>
34
35 #include <dns/masterdump.h>
36 #include <dns/types.h>
37
38 typedef enum {
39         dns_zone_none,
40         dns_zone_master,
41         dns_zone_slave,
42         dns_zone_stub
43 } dns_zonetype_t;
44
45 #define DNS_ZONEOPT_SERVERS       0x00000001U   /*%< perform server checks */
46 #define DNS_ZONEOPT_PARENTS       0x00000002U   /*%< perform parent checks */
47 #define DNS_ZONEOPT_CHILDREN      0x00000004U   /*%< perform child checks */
48 #define DNS_ZONEOPT_NOTIFY        0x00000008U   /*%< perform NOTIFY */
49 #define DNS_ZONEOPT_MANYERRORS    0x00000010U   /*%< return many errors on load */
50 #define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U   /*%< calculate differences */
51 #define DNS_ZONEOPT_NOMERGE       0x00000040U   /*%< don't merge journal */
52 #define DNS_ZONEOPT_CHECKNS       0x00000080U   /*%< check if NS's are addresses */
53 #define DNS_ZONEOPT_FATALNS       0x00000100U   /*%< DNS_ZONEOPT_CHECKNS is fatal */
54 #define DNS_ZONEOPT_MULTIMASTER   0x00000200U   /*%< this zone has multiple masters */
55 #define DNS_ZONEOPT_USEALTXFRSRC  0x00000400U   /*%< use alternate transfer sources */
56 #define DNS_ZONEOPT_CHECKNAMES    0x00000800U   /*%< check-names */
57 #define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U  /*%< fatal check-name failures */
58 #define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U   /*%< check for internal wildcards */
59 #define DNS_ZONEOPT_CHECKMX       0x00004000U   /*%< check-mx */
60 #define DNS_ZONEOPT_CHECKMXFAIL   0x00008000U   /*%< fatal check-mx failures */
61 #define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U  /*%< perform integrity checks */
62 #define DNS_ZONEOPT_CHECKSIBLING  0x00020000U   /*%< perform sibling glue checks */
63 #define DNS_ZONEOPT_NOCHECKNS     0x00040000U   /*%< disable IN NS address checks */
64 #define DNS_ZONEOPT_WARNMXCNAME   0x00080000U   /*%< warn on MX CNAME check */
65 #define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U   /*%< ignore MX CNAME check */
66 #define DNS_ZONEOPT_WARNSRVCNAME  0x00200000U   /*%< warn on SRV CNAME check */
67 #define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U  /*%< ignore SRV CNAME check */
68 #define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U  /*%< check dnskey KSK flag */
69 #define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U   /*%< try tcp refresh on udp failure */
70 #define DNS_ZONEOPT_NOTIFYTOSOA   0x02000000U   /*%< Notify the SOA MNAME */
71
72 #ifndef NOMINUM_PUBLIC
73 /*
74  * Nominum specific options build down.
75  */
76 #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U   /* forward notify to master */
77 #endif /* NOMINUM_PUBLIC */
78
79 #ifndef DNS_ZONE_MINREFRESH
80 #define DNS_ZONE_MINREFRESH                 300 /*%< 5 minutes */
81 #endif
82 #ifndef DNS_ZONE_MAXREFRESH
83 #define DNS_ZONE_MAXREFRESH             2419200 /*%< 4 weeks */
84 #endif
85 #ifndef DNS_ZONE_DEFAULTREFRESH
86 #define DNS_ZONE_DEFAULTREFRESH            3600 /*%< 1 hour */
87 #endif
88 #ifndef DNS_ZONE_MINRETRY
89 #define DNS_ZONE_MINRETRY                   300 /*%< 5 minutes */
90 #endif
91 #ifndef DNS_ZONE_MAXRETRY
92 #define DNS_ZONE_MAXRETRY               1209600 /*%< 2 weeks */
93 #endif
94 #ifndef DNS_ZONE_DEFAULTRETRY
95 #define DNS_ZONE_DEFAULTRETRY                60 /*%< 1 minute, subject to
96                                                    exponential backoff */
97 #endif
98
99 #define DNS_ZONESTATE_XFERRUNNING       1
100 #define DNS_ZONESTATE_XFERDEFERRED      2
101 #define DNS_ZONESTATE_SOAQUERY          3
102 #define DNS_ZONESTATE_ANY               4
103
104 ISC_LANG_BEGINDECLS
105
106 /***
107  ***    Functions
108  ***/
109
110 isc_result_t
111 dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
112 /*%<
113  *      Creates a new empty zone and attach '*zonep' to it.
114  *
115  * Requires:
116  *\li   'zonep' to point to a NULL pointer.
117  *\li   'mctx' to be a valid memory context.
118  *
119  * Ensures:
120  *\li   '*zonep' refers to a valid zone.
121  *
122  * Returns:
123  *\li   #ISC_R_SUCCESS
124  *\li   #ISC_R_NOMEMORY
125  *\li   #ISC_R_UNEXPECTED
126  */
127
128 void
129 dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);
130 /*%<
131  *      Sets the class of a zone.  This operation can only be performed
132  *      once on a zone.
133  *
134  * Require:
135  *\li   'zone' to be a valid zone.
136  *\li   dns_zone_setclass() not to have been called since the zone was
137  *      created.
138  *\li   'rdclass' != dns_rdataclass_none.
139  */
140
141 dns_rdataclass_t
142 dns_zone_getclass(dns_zone_t *zone);
143 /*%<
144  *      Returns the current zone class.
145  *
146  * Requires:
147  *\li   'zone' to be a valid zone.
148  */
149
150 isc_uint32_t
151 dns_zone_getserial(dns_zone_t *zone);
152 /*%<
153  *      Returns the current serial number of the zone.
154  *
155  * Requires:
156  *\li   'zone' to be a valid zone.
157  */
158
159 void
160 dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);
161 /*%<
162  *      Sets the zone type. This operation can only be performed once on
163  *      a zone.
164  *
165  * Requires:
166  *\li   'zone' to be a valid zone.
167  *\li   dns_zone_settype() not to have been called since the zone was
168  *      created.
169  *\li   'type' != dns_zone_none
170  */
171
172 void
173 dns_zone_setview(dns_zone_t *zone, dns_view_t *view);
174 /*%<
175  *      Associate the zone with a view.
176  *
177  * Require:
178  *\li   'zone' to be a valid zone.
179  */
180
181 dns_view_t *
182 dns_zone_getview(dns_zone_t *zone);
183 /*%<
184  *      Returns the zone's associated view.
185  *
186  * Requires:
187  *\li   'zone' to be a valid zone.
188  */
189
190 isc_result_t
191 dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin);
192 /*%<
193  *      Sets the zones origin to 'origin'.
194  *
195  * Require:
196  *\li   'zone' to be a valid zone.
197  *\li   'origin' to be non NULL.
198  *
199  * Returns:
200  *\li   #ISC_R_SUCCESS
201  *\li   #ISC_R_NOMEMORY
202  */
203
204 dns_name_t *
205 dns_zone_getorigin(dns_zone_t *zone);
206 /*%<
207  *      Returns the value of the origin.
208  *
209  * Require:
210  *\li   'zone' to be a valid zone.
211  */
212
213 isc_result_t
214 dns_zone_setfile(dns_zone_t *zone, const char *file);
215
216 isc_result_t
217 dns_zone_setfile2(dns_zone_t *zone, const char *file,
218                   dns_masterformat_t format);
219 /*%<
220  *    Sets the name of the master file in the format of 'format' from which
221  *    the zone loads its database to 'file'.
222  *
223  *    For zones that have no associated master file, 'file' will be NULL.
224  *
225  *      For zones with persistent databases, the file name
226  *      setting is ignored.
227  *
228  *    dns_zone_setfile() is a backward-compatible form of
229  *    dns_zone_setfile2(), which always specifies the
230  *    dns_masterformat_text (RFC1035) format.
231  *
232  * Require:
233  *\li   'zone' to be a valid zone.
234  *
235  * Returns:
236  *\li   #ISC_R_NOMEMORY
237  *\li   #ISC_R_SUCCESS
238  */
239
240 const char *
241 dns_zone_getfile(dns_zone_t *zone);
242 /*%<
243  *      Gets the name of the zone's master file, if any.
244  *
245  * Requires:
246  *\li   'zone' to be valid initialised zone.
247  *
248  * Returns:
249  *\li   Pointer to null-terminated file name, or NULL.
250  */
251
252 isc_result_t
253 dns_zone_load(dns_zone_t *zone);
254
255 isc_result_t
256 dns_zone_loadnew(dns_zone_t *zone);
257
258 isc_result_t
259 dns_zone_loadandthaw(dns_zone_t *zone);
260 /*%<
261  *      Cause the database to be loaded from its backing store.
262  *      Confirm that the minimum requirements for the zone type are
263  *      met, otherwise DNS_R_BADZONE is returned.
264  *
265  *      dns_zone_loadnew() only loads zones that are not yet loaded.
266  *      dns_zone_load() also loads zones that are already loaded and
267  *      and whose master file has changed since the last load.
268  *      dns_zone_loadandthaw() is similar to dns_zone_load() but will
269  *      also re-enable DNS UPDATEs when the load completes.
270  *
271  * Require:
272  *\li   'zone' to be a valid zone.
273  *
274  * Returns:
275  *\li   #ISC_R_UNEXPECTED
276  *\li   #ISC_R_SUCCESS
277  *\li   DNS_R_CONTINUE    Incremental load has been queued.
278  *\li   DNS_R_UPTODATE    The zone has already been loaded based on
279  *                        file system timestamps.
280  *\li   DNS_R_BADZONE
281  *\li   Any result value from dns_db_load().
282  */
283
284 void
285 dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
286 /*%<
287  *      Attach '*target' to 'source' incrementing its external
288  *      reference count.
289  *
290  * Require:
291  *\li   'zone' to be a valid zone.
292  *\li   'target' to be non NULL and '*target' to be NULL.
293  */
294
295 void
296 dns_zone_detach(dns_zone_t **zonep);
297 /*%<
298  *      Detach from a zone decrementing its external reference count.
299  *      If this was the last external reference to the zone it will be
300  *      shut down and eventually freed.
301  *
302  * Require:
303  *\li   'zonep' to point to a valid zone.
304  */
305
306 void
307 dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
308 /*%<
309  *      Attach '*target' to 'source' incrementing its internal
310  *      reference count.  This is intended for use by operations
311  *      such as zone transfers that need to prevent the zone
312  *      object from being freed but not from shutting down.
313  *
314  * Require:
315  *\li   The caller is running in the context of the zone's task.
316  *\li   'zone' to be a valid zone.
317  *\li   'target' to be non NULL and '*target' to be NULL.
318  */
319
320 void
321 dns_zone_idetach(dns_zone_t **zonep);
322 /*%<
323  *      Detach from a zone decrementing its internal reference count.
324  *      If there are no more internal or external references to the
325  *      zone, it will be freed.
326  *
327  * Require:
328  *\li   The caller is running in the context of the zone's task.
329  *\li   'zonep' to point to a valid zone.
330  */
331
332 void
333 dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value);
334 /*%<
335  *      Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE')
336  *      zone flags.  Valid flag bits are DNS_ZONE_F_*.
337  *
338  * Requires
339  *\li   'zone' to be a valid zone.
340  */
341
342 isc_result_t
343 dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
344 /*%<
345  *      Attach '*dbp' to the database to if it exists otherwise
346  *      return DNS_R_NOTLOADED.
347  *
348  * Require:
349  *\li   'zone' to be a valid zone.
350  *\li   'dbp' to be != NULL && '*dbp' == NULL.
351  *
352  * Returns:
353  *\li   #ISC_R_SUCCESS
354  *\li   DNS_R_NOTLOADED
355  */
356
357 isc_result_t
358 dns_zone_setdbtype(dns_zone_t *zone,
359                    unsigned int dbargc, const char * const *dbargv);
360 /*%<
361  *      Sets the database type to dbargv[0] and database arguments
362  *      to subsequent dbargv elements.
363  *      'db_type' is not checked to see if it is a valid database type.
364  *
365  * Require:
366  *\li   'zone' to be a valid zone.
367  *\li   'database' to be non NULL.
368  *\li   'dbargc' to be >= 1
369  *\li   'dbargv' to point to dbargc NULL-terminated strings
370  *
371  * Returns:
372  *\li   #ISC_R_NOMEMORY
373  *\li   #ISC_R_SUCCESS
374  */
375
376 isc_result_t
377 dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx);
378 /*%<
379  *      Returns the current dbtype.  isc_mem_free() should be used
380  *      to free 'argv' after use.
381  *
382  * Require:
383  *\li   'zone' to be a valid zone.
384  *\li   'argv' to be non NULL and *argv to be NULL.
385  *\li   'mctx' to be valid.
386  *
387  * Returns:
388  *\li   #ISC_R_NOMEMORY
389  *\li   #ISC_R_SUCCESS
390  */
391
392 void
393 dns_zone_markdirty(dns_zone_t *zone);
394 /*%<
395  *      Mark a zone as 'dirty'.
396  *
397  * Require:
398  *\li   'zone' to be a valid zone.
399  */
400
401 void
402 dns_zone_expire(dns_zone_t *zone);
403 /*%<
404  *      Mark the zone as expired.  If the zone requires dumping cause it to
405  *      be initiated.  Set the refresh and retry intervals to there default
406  *      values and unload the zone.
407  *
408  * Require
409  *\li   'zone' to be a valid zone.
410  */
411
412 void
413 dns_zone_refresh(dns_zone_t *zone);
414 /*%<
415  *      Initiate zone up to date checks.  The zone must already be being
416  *      managed.
417  *
418  * Require
419  *\li   'zone' to be a valid zone.
420  */
421
422 isc_result_t
423 dns_zone_flush(dns_zone_t *zone);
424 /*%<
425  *      Write the zone to database if there are uncommitted changes.
426  *
427  * Require:
428  *\li   'zone' to be a valid zone.
429  */
430
431 isc_result_t
432 dns_zone_dump(dns_zone_t *zone);
433 /*%<
434  *      Write the zone to database.
435  *
436  * Require:
437  *\li   'zone' to be a valid zone.
438  */
439
440 isc_result_t
441 dns_zone_dumptostream(dns_zone_t *zone, FILE *fd);
442
443 isc_result_t
444 dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format,
445                        const dns_master_style_t *style);
446 /*%<
447  *    Write the zone to stream 'fd' in the specified 'format'.
448  *    If the 'format' is dns_masterformat_text (RFC1035), 'style' also
449  *    specifies the file style (e.g., &dns_master_style_default).
450  *
451  *    dns_zone_dumptostream() is a backward-compatible form of
452  *    dns_zone_dumptostream2(), which always uses the dns_masterformat_text
453  *    format and the dns_master_style_default style.
454  *
455  *    Note that dns_zone_dumptostream2() is the most flexible form.  It
456  *    can also provide the functionality of dns_zone_fulldumptostream().
457  *
458  * Require:
459  *\li   'zone' to be a valid zone.
460  *\li   'fd' to be a stream open for writing.
461  */
462
463 isc_result_t
464 dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd);
465 /*%<
466  *      The same as dns_zone_dumptostream, but dumps the zone with
467  *      different dump settings (dns_master_style_full).
468  *
469  * Require:
470  *\li   'zone' to be a valid zone.
471  *\li   'fd' to be a stream open for writing.
472  */
473
474 void
475 dns_zone_maintenance(dns_zone_t *zone);
476 /*%<
477  *      Perform regular maintenance on the zone.  This is called as a
478  *      result of a zone being managed.
479  *
480  * Require
481  *\li   'zone' to be a valid zone.
482  */
483
484 isc_result_t
485 dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters,
486                     isc_uint32_t count);
487 isc_result_t
488 dns_zone_setmasterswithkeys(dns_zone_t *zone,
489                             const isc_sockaddr_t *masters,
490                             dns_name_t **keynames,
491                             isc_uint32_t count);
492 /*%<
493  *      Set the list of master servers for the zone.
494  *
495  * Require:
496  *\li   'zone' to be a valid zone.
497  *\li   'masters' array of isc_sockaddr_t with port set or NULL.
498  *\li   'count' the number of masters.
499  *\li      'keynames' array of dns_name_t's for tsig keys or NULL.
500  *
501  *  \li    dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
502  *      passing NULL in the keynames field.
503  *
504  * \li  If 'masters' is NULL then 'count' must be zero.
505  *
506  * Returns:
507  *\li   #ISC_R_SUCCESS
508  *\li   #ISC_R_NOMEMORY
509  *\li      Any result dns_name_dup() can return, if keynames!=NULL
510  */
511
512 isc_result_t
513 dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify,
514                        isc_uint32_t count);
515 /*%<
516  *      Set the list of additional servers to be notified when
517  *      a zone changes.  To clear the list use 'count = 0'.
518  *
519  * Require:
520  *\li   'zone' to be a valid zone.
521  *\li   'notify' to be non-NULL if count != 0.
522  *\li   'count' to be the number of notifiees.
523  *
524  * Returns:
525  *\li   #ISC_R_SUCCESS
526  *\li   #ISC_R_NOMEMORY
527  */
528
529 void
530 dns_zone_unload(dns_zone_t *zone);
531 /*%<
532  *      detach the database from the zone structure.
533  *
534  * Require:
535  *\li   'zone' to be a valid zone.
536  */
537
538 void
539 dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value);
540 /*%<
541  *      Set given options on ('value' == ISC_TRUE) or off ('value' ==
542  *      #ISC_FALSE).
543  *
544  * Require:
545  *\li   'zone' to be a valid zone.
546  */
547
548 unsigned int
549 dns_zone_getoptions(dns_zone_t *zone);
550 /*%<
551  *      Returns the current zone options.
552  *
553  * Require:
554  *\li   'zone' to be a valid zone.
555  */
556
557 void
558 dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val);
559 /*%<
560  *      Set the minimum refresh time.
561  *
562  * Requires:
563  *\li   'zone' is valid.
564  *\li   val > 0.
565  */
566
567 void
568 dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val);
569 /*%<
570  *      Set the maximum refresh time.
571  *
572  * Requires:
573  *\li   'zone' is valid.
574  *\li   val > 0.
575  */
576
577 void
578 dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val);
579 /*%<
580  *      Set the minimum retry time.
581  *
582  * Requires:
583  *\li   'zone' is valid.
584  *\li   val > 0.
585  */
586
587 void
588 dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
589 /*%<
590  *      Set the maximum retry time.
591  *
592  * Requires:
593  *\li   'zone' is valid.
594  *      val > 0.
595  */
596
597 isc_result_t
598 dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
599 isc_result_t
600 dns_zone_setaltxfrsource4(dns_zone_t *zone,
601                           const isc_sockaddr_t *xfrsource);
602 /*%<
603  *      Set the source address to be used in IPv4 zone transfers.
604  *
605  * Require:
606  *\li   'zone' to be a valid zone.
607  *\li   'xfrsource' to contain the address.
608  *
609  * Returns:
610  *\li   #ISC_R_SUCCESS
611  */
612
613 isc_sockaddr_t *
614 dns_zone_getxfrsource4(dns_zone_t *zone);
615 isc_sockaddr_t *
616 dns_zone_getaltxfrsource4(dns_zone_t *zone);
617 /*%<
618  *      Returns the source address set by a previous dns_zone_setxfrsource4
619  *      call, or the default of inaddr_any, port 0.
620  *
621  * Require:
622  *\li   'zone' to be a valid zone.
623  */
624
625 isc_result_t
626 dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
627 isc_result_t
628 dns_zone_setaltxfrsource6(dns_zone_t *zone,
629                           const isc_sockaddr_t *xfrsource);
630 /*%<
631  *      Set the source address to be used in IPv6 zone transfers.
632  *
633  * Require:
634  *\li   'zone' to be a valid zone.
635  *\li   'xfrsource' to contain the address.
636  *
637  * Returns:
638  *\li   #ISC_R_SUCCESS
639  */
640
641 isc_sockaddr_t *
642 dns_zone_getxfrsource6(dns_zone_t *zone);
643 isc_sockaddr_t *
644 dns_zone_getaltxfrsource6(dns_zone_t *zone);
645 /*%<
646  *      Returns the source address set by a previous dns_zone_setxfrsource6
647  *      call, or the default of in6addr_any, port 0.
648  *
649  * Require:
650  *\li   'zone' to be a valid zone.
651  */
652
653 isc_result_t
654 dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
655 /*%<
656  *      Set the source address to be used with IPv4 NOTIFY messages.
657  *
658  * Require:
659  *\li   'zone' to be a valid zone.
660  *\li   'notifysrc' to contain the address.
661  *
662  * Returns:
663  *\li   #ISC_R_SUCCESS
664  */
665
666 isc_sockaddr_t *
667 dns_zone_getnotifysrc4(dns_zone_t *zone);
668 /*%<
669  *      Returns the source address set by a previous dns_zone_setnotifysrc4
670  *      call, or the default of inaddr_any, port 0.
671  *
672  * Require:
673  *\li   'zone' to be a valid zone.
674  */
675
676 isc_result_t
677 dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
678 /*%<
679  *      Set the source address to be used with IPv6 NOTIFY messages.
680  *
681  * Require:
682  *\li   'zone' to be a valid zone.
683  *\li   'notifysrc' to contain the address.
684  *
685  * Returns:
686  *\li   #ISC_R_SUCCESS
687  */
688
689 isc_sockaddr_t *
690 dns_zone_getnotifysrc6(dns_zone_t *zone);
691 /*%<
692  *      Returns the source address set by a previous dns_zone_setnotifysrc6
693  *      call, or the default of in6addr_any, port 0.
694  *
695  * Require:
696  *\li   'zone' to be a valid zone.
697  */
698
699 void
700 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl);
701 /*%<
702  *      Sets the notify acl list for the zone.
703  *
704  * Require:
705  *\li   'zone' to be a valid zone.
706  *\li   'acl' to be a valid acl.
707  */
708
709 void
710 dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl);
711 /*%<
712  *      Sets the query acl list for the zone.
713  *
714  * Require:
715  *\li   'zone' to be a valid zone.
716  *\li   'acl' to be a valid acl.
717  */
718
719 void
720 dns_zone_setqueryonacl(dns_zone_t *zone, dns_acl_t *acl);
721 /*%<
722  *      Sets the query-on acl list for the zone.
723  *
724  * Require:
725  *\li   'zone' to be a valid zone.
726  *\li   'acl' to be a valid acl.
727  */
728
729 void
730 dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl);
731 /*%<
732  *      Sets the update acl list for the zone.
733  *
734  * Require:
735  *\li   'zone' to be a valid zone.
736  *\li   'acl' to be valid acl.
737  */
738
739 void
740 dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl);
741 /*%<
742  *      Sets the forward unsigned updates acl list for the zone.
743  *
744  * Require:
745  *\li   'zone' to be a valid zone.
746  *\li   'acl' to be valid acl.
747  */
748
749 void
750 dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl);
751 /*%<
752  *      Sets the transfer acl list for the zone.
753  *
754  * Require:
755  *\li   'zone' to be a valid zone.
756  *\li   'acl' to be valid acl.
757  */
758
759 dns_acl_t *
760 dns_zone_getnotifyacl(dns_zone_t *zone);
761 /*%<
762  *      Returns the current notify acl or NULL.
763  *
764  * Require:
765  *\li   'zone' to be a valid zone.
766  *
767  * Returns:
768  *\li   acl a pointer to the acl.
769  *\li   NULL
770  */
771
772 dns_acl_t *
773 dns_zone_getqueryacl(dns_zone_t *zone);
774 /*%<
775  *      Returns the current query acl or NULL.
776  *
777  * Require:
778  *\li   'zone' to be a valid zone.
779  *
780  * Returns:
781  *\li   acl a pointer to the acl.
782  *\li   NULL
783  */
784
785 dns_acl_t *
786 dns_zone_getqueryonacl(dns_zone_t *zone);
787 /*%<
788  *      Returns the current query-on acl or NULL.
789  *
790  * Require:
791  *\li   'zone' to be a valid zone.
792  *
793  * Returns:
794  *\li   acl a pointer to the acl.
795  *\li   NULL
796  */
797
798 dns_acl_t *
799 dns_zone_getupdateacl(dns_zone_t *zone);
800 /*%<
801  *      Returns the current update acl or NULL.
802  *
803  * Require:
804  *\li   'zone' to be a valid zone.
805  *
806  * Returns:
807  *\li   acl a pointer to the acl.
808  *\li   NULL
809  */
810
811 dns_acl_t *
812 dns_zone_getforwardacl(dns_zone_t *zone);
813 /*%<
814  *      Returns the current forward unsigned updates acl or NULL.
815  *
816  * Require:
817  *\li   'zone' to be a valid zone.
818  *
819  * Returns:
820  *\li   acl a pointer to the acl.
821  *\li   NULL
822  */
823
824 dns_acl_t *
825 dns_zone_getxfracl(dns_zone_t *zone);
826 /*%<
827  *      Returns the current transfer acl or NULL.
828  *
829  * Require:
830  *\li   'zone' to be a valid zone.
831  *
832  * Returns:
833  *\li   acl a pointer to the acl.
834  *\li   NULL
835  */
836
837 void
838 dns_zone_clearupdateacl(dns_zone_t *zone);
839 /*%<
840  *      Clear the current update acl.
841  *
842  * Require:
843  *\li   'zone' to be a valid zone.
844  */
845
846 void
847 dns_zone_clearforwardacl(dns_zone_t *zone);
848 /*%<
849  *      Clear the current forward unsigned updates acl.
850  *
851  * Require:
852  *\li   'zone' to be a valid zone.
853  */
854
855 void
856 dns_zone_clearnotifyacl(dns_zone_t *zone);
857 /*%<
858  *      Clear the current notify acl.
859  *
860  * Require:
861  *\li   'zone' to be a valid zone.
862  */
863
864 void
865 dns_zone_clearqueryacl(dns_zone_t *zone);
866 /*%<
867  *      Clear the current query acl.
868  *
869  * Require:
870  *\li   'zone' to be a valid zone.
871  */
872
873 void
874 dns_zone_clearqueryonacl(dns_zone_t *zone);
875 /*%<
876  *      Clear the current query-on acl.
877  *
878  * Require:
879  *\li   'zone' to be a valid zone.
880  */
881
882 void
883 dns_zone_clearxfracl(dns_zone_t *zone);
884 /*%<
885  *      Clear the current transfer acl.
886  *
887  * Require:
888  *\li   'zone' to be a valid zone.
889  */
890
891 isc_boolean_t
892 dns_zone_getupdatedisabled(dns_zone_t *zone);
893 /*%<
894  * Return update disabled.
895  */
896
897 void
898 dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state);
899 /*%<
900  * Set update disabled.
901  */
902
903 isc_boolean_t
904 dns_zone_getzeronosoattl(dns_zone_t *zone);
905 /*%<
906  * Return zero-no-soa-ttl status.
907  */
908
909 void
910 dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state);
911 /*%<
912  * Set zero-no-soa-ttl status.
913  */
914
915 void
916 dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity);
917 /*%<
918  *      Set the severity of name checking when loading a zone.
919  *
920  * Require:
921  * \li     'zone' to be a valid zone.
922  */
923
924 dns_severity_t
925 dns_zone_getchecknames(dns_zone_t *zone);
926 /*%<
927  *      Return the current severity of name checking.
928  *
929  * Require:
930  *\li   'zone' to be a valid zone.
931  */
932
933 void
934 dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size);
935 /*%<
936  *      Sets the journal size for the zone.
937  *
938  * Requires:
939  *\li   'zone' to be a valid zone.
940  */
941
942 isc_int32_t
943 dns_zone_getjournalsize(dns_zone_t *zone);
944 /*%<
945  *      Return the journal size as set with a previous call to
946  *      dns_zone_setjournalsize().
947  *
948  * Requires:
949  *\li   'zone' to be a valid zone.
950  */
951
952 isc_result_t
953 dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
954                        dns_message_t *msg);
955 /*%<
956  *      Tell the zone that it has received a NOTIFY message from another
957  *      server.  This may cause some zone maintenance activity to occur.
958  *
959  * Requires:
960  *\li   'zone' to be a valid zone.
961  *\li   '*from' to contain the address of the server from which 'msg'
962  *              was received.
963  *\li   'msg' a message with opcode NOTIFY and qr clear.
964  *
965  * Returns:
966  *\li   DNS_R_REFUSED
967  *\li   DNS_R_NOTIMP
968  *\li   DNS_R_FORMERR
969  *\li   DNS_R_SUCCESS
970  */
971
972 void
973 dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin);
974 /*%<
975  * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR)
976  * of this zone will use before being aborted.
977  *
978  * Requires:
979  * \li  'zone' to be valid initialised zone.
980  */
981
982 isc_uint32_t
983 dns_zone_getmaxxfrin(dns_zone_t *zone);
984 /*%<
985  * Returns the maximum transfer time for this zone.  This will be
986  * either the value set by the last call to dns_zone_setmaxxfrin() or
987  * the default value of 1 hour.
988  *
989  * Requires:
990  *\li   'zone' to be valid initialised zone.
991  */
992
993 void
994 dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout);
995 /*%<
996  * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR)
997  * of this zone will use before being aborted.
998  *
999  * Requires:
1000  * \li  'zone' to be valid initialised zone.
1001  */
1002
1003 isc_uint32_t
1004 dns_zone_getmaxxfrout(dns_zone_t *zone);
1005 /*%<
1006  * Returns the maximum transfer time for this zone.  This will be
1007  * either the value set by the last call to dns_zone_setmaxxfrout() or
1008  * the default value of 1 hour.
1009  *
1010  * Requires:
1011  *\li   'zone' to be valid initialised zone.
1012  */
1013
1014 isc_result_t
1015 dns_zone_setjournal(dns_zone_t *zone, const char *journal);
1016 /*%<
1017  * Sets the filename used for journaling updates / IXFR transfers.
1018  * The default journal name is set by dns_zone_setfile() to be
1019  * "file.jnl".  If 'journal' is NULL, the zone will have no
1020  * journal name.
1021  *
1022  * Requires:
1023  *\li   'zone' to be a valid zone.
1024  *
1025  * Returns:
1026  *\li   #ISC_R_SUCCESS
1027  *\li   #ISC_R_NOMEMORY
1028  */
1029
1030 char *
1031 dns_zone_getjournal(dns_zone_t *zone);
1032 /*%<
1033  * Returns the journal name associated with this zone.
1034  * If no journal has been set this will be NULL.
1035  *
1036  * Requires:
1037  *\li   'zone' to be valid initialised zone.
1038  */
1039
1040 dns_zonetype_t
1041 dns_zone_gettype(dns_zone_t *zone);
1042 /*%<
1043  * Returns the type of the zone (master/slave/etc.)
1044  *
1045  * Requires:
1046  *\li   'zone' to be valid initialised zone.
1047  */
1048
1049 void
1050 dns_zone_settask(dns_zone_t *zone, isc_task_t *task);
1051 /*%<
1052  * Give a zone a task to work with.  Any current task will be detached.
1053  *
1054  * Requires:
1055  *\li   'zone' to be valid.
1056  *\li   'task' to be valid.
1057  */
1058
1059 void
1060 dns_zone_gettask(dns_zone_t *zone, isc_task_t **target);
1061 /*%<
1062  * Attach '*target' to the zone's task.
1063  *
1064  * Requires:
1065  *\li   'zone' to be valid initialised zone.
1066  *\li   'zone' to have a task.
1067  *\li   'target' to be != NULL && '*target' == NULL.
1068  */
1069
1070 void
1071 dns_zone_notify(dns_zone_t *zone);
1072 /*%<
1073  * Generate notify events for this zone.
1074  *
1075  * Requires:
1076  *\li   'zone' to be a valid zone.
1077  */
1078
1079 isc_result_t
1080 dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump);
1081 /*%<
1082  * Replace the database of "zone" with a new database "db".
1083  *
1084  * If "dump" is ISC_TRUE, then the new zone contents are dumped
1085  * into to the zone's master file for persistence.  When replacing
1086  * a zone database by one just loaded from a master file, set
1087  * "dump" to ISC_FALSE to avoid a redundant redump of the data just
1088  * loaded.  Otherwise, it should be set to ISC_TRUE.
1089  *
1090  * If the "diff-on-reload" option is enabled in the configuration file,
1091  * the differences between the old and the new database are added to the
1092  * journal file, and the master file dump is postponed.
1093  *
1094  * Requires:
1095  * \li  'zone' to be a valid zone.
1096  *
1097  * Returns:
1098  * \li  DNS_R_SUCCESS
1099  * \li  DNS_R_BADZONE   zone failed basic consistency checks:
1100  *                      * a single SOA must exist
1101  *                      * some NS records must exist.
1102  *      Others
1103  */
1104
1105 isc_uint32_t
1106 dns_zone_getidlein(dns_zone_t *zone);
1107 /*%<
1108  * Requires:
1109  * \li  'zone' to be a valid zone.
1110  *
1111  * Returns:
1112  * \li  number of seconds of idle time before we abort the transfer in.
1113  */
1114
1115 void
1116 dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein);
1117 /*%<
1118  * \li  Set the idle timeout for transfer the.
1119  * \li  Zero set the default value, 1 hour.
1120  *
1121  * Requires:
1122  * \li  'zone' to be a valid zone.
1123  */
1124
1125 isc_uint32_t
1126 dns_zone_getidleout(dns_zone_t *zone);
1127 /*%<
1128  *
1129  * Requires:
1130  * \li  'zone' to be a valid zone.
1131  *
1132  * Returns:
1133  * \li  number of seconds of idle time before we abort a transfer out.
1134  */
1135
1136 void
1137 dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout);
1138 /*%<
1139  * \li  Set the idle timeout for transfers out.
1140  * \li  Zero set the default value, 1 hour.
1141  *
1142  * Requires:
1143  * \li  'zone' to be a valid zone.
1144  */
1145
1146 void
1147 dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table);
1148 /*%<
1149  * Get the simple-secure-update policy table.
1150  *
1151  * Requires:
1152  * \li  'zone' to be a valid zone.
1153  */
1154
1155 void
1156 dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table);
1157 /*%<
1158  * Set / clear the simple-secure-update policy table.
1159  *
1160  * Requires:
1161  * \li  'zone' to be a valid zone.
1162  */
1163
1164 isc_mem_t *
1165 dns_zone_getmctx(dns_zone_t *zone);
1166 /*%<
1167  * Get the memory context of a zone.
1168  *
1169  * Requires:
1170  * \li  'zone' to be a valid zone.
1171  */
1172
1173 dns_zonemgr_t *
1174 dns_zone_getmgr(dns_zone_t *zone);
1175 /*%<
1176  *      If 'zone' is managed return the zone manager otherwise NULL.
1177  *
1178  * Requires:
1179  * \li  'zone' to be a valid zone.
1180  */
1181
1182 void
1183 dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval);
1184 /*%<
1185  * Set the zone's SIG validity interval.  This is the length of time
1186  * for which DNSSEC signatures created as a result of dynamic updates
1187  * to secure zones will remain valid, in seconds.
1188  *
1189  * Requires:
1190  * \li  'zone' to be a valid zone.
1191  */
1192
1193 isc_uint32_t
1194 dns_zone_getsigvalidityinterval(dns_zone_t *zone);
1195 /*%<
1196  * Get the zone's SIG validity interval.
1197  *
1198  * Requires:
1199  * \li  'zone' to be a valid zone.
1200  */
1201
1202 void
1203 dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
1204 /*%<
1205  * Sets zone notify method to "notifytype"
1206  */
1207
1208 isc_result_t
1209 dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
1210                        dns_updatecallback_t callback, void *callback_arg);
1211 /*%<
1212  * Forward 'msg' to each master in turn until we get an answer or we
1213  * have exhausted the list of masters. 'callback' will be called with
1214  * ISC_R_SUCCESS if we get an answer and the returned message will be
1215  * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code
1216  * will be passed and answer_message will be NULL.  The callback function
1217  * is responsible for destroying 'answer_message'.
1218  *              (callback)(callback_arg, result, answer_message);
1219  *
1220  * Require:
1221  *\li   'zone' to be valid
1222  *\li   'msg' to be valid.
1223  *\li   'callback' to be non NULL.
1224  * Returns:
1225  *\li   #ISC_R_SUCCESS if the message has been forwarded,
1226  *\li   #ISC_R_NOMEMORY
1227  *\li   Others
1228  */
1229
1230 isc_result_t
1231 dns_zone_next(dns_zone_t *zone, dns_zone_t **next);
1232 /*%<
1233  * Find the next zone in the list of managed zones.
1234  *
1235  * Requires:
1236  *\li   'zone' to be valid
1237  *\li   The zone manager for the indicated zone MUST be locked
1238  *      by the caller.  This is not checked.
1239  *\li   'next' be non-NULL, and '*next' be NULL.
1240  *
1241  * Ensures:
1242  *\li   'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1243  *      (result ISC_R_NOMORE).
1244  */
1245
1246
1247
1248 isc_result_t
1249 dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first);
1250 /*%<
1251  * Find the first zone in the list of managed zones.
1252  *
1253  * Requires:
1254  *\li   'zonemgr' to be valid
1255  *\li   The zone manager for the indicated zone MUST be locked
1256  *      by the caller.  This is not checked.
1257  *\li   'first' be non-NULL, and '*first' be NULL
1258  *
1259  * Ensures:
1260  *\li   'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1261  *      (result ISC_R_NOMORE).
1262  */
1263
1264 isc_result_t
1265 dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory);
1266 /*%<
1267  *      Sets the name of the directory where private keys used for
1268  *      online signing of dynamic zones are found.
1269  *
1270  * Require:
1271  *\li   'zone' to be a valid zone.
1272  *
1273  * Returns:
1274  *\li   #ISC_R_NOMEMORY
1275  *\li   #ISC_R_SUCCESS
1276  */
1277
1278 const char *
1279 dns_zone_getkeydirectory(dns_zone_t *zone);
1280 /*%<
1281  *      Gets the name of the directory where private keys used for
1282  *      online signing of dynamic zones are found.
1283  *
1284  * Requires:
1285  *\li   'zone' to be valid initialised zone.
1286  *
1287  * Returns:
1288  *      Pointer to null-terminated file name, or NULL.
1289  */
1290
1291
1292 isc_result_t
1293 dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
1294                    isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
1295                    dns_zonemgr_t **zmgrp);
1296 /*%<
1297  * Create a zone manager.
1298  *
1299  * Requires:
1300  *\li   'mctx' to be a valid memory context.
1301  *\li   'taskmgr' to be a valid task manager.
1302  *\li   'timermgr' to be a valid timer manager.
1303  *\li   'zmgrp' to point to a NULL pointer.
1304  */
1305
1306 isc_result_t
1307 dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1308 /*%<
1309  *      Bring the zone under control of a zone manager.
1310  *
1311  * Require:
1312  *\li   'zmgr' to be a valid zone manager.
1313  *\li   'zone' to be a valid zone.
1314  */
1315
1316 isc_result_t
1317 dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr);
1318 /*%<
1319  * Force zone maintenance of all zones managed by 'zmgr' at its
1320  * earliest convenience.
1321  */
1322
1323 void
1324 dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr);
1325 /*%<
1326  * Attempt to start any stalled zone transfers.
1327  */
1328
1329 void
1330 dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
1331 /*%<
1332  *      Shut down the zone manager.
1333  *
1334  * Requires:
1335  *\li   'zmgr' to be a valid zone manager.
1336  */
1337
1338 void
1339 dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target);
1340 /*%<
1341  *      Attach '*target' to 'source' incrementing its external
1342  *      reference count.
1343  *
1344  * Require:
1345  *\li   'zone' to be a valid zone.
1346  *\li   'target' to be non NULL and '*target' to be NULL.
1347  */
1348
1349 void
1350 dns_zonemgr_detach(dns_zonemgr_t **zmgrp);
1351 /*%<
1352  *       Detach from a zone manager.
1353  *
1354  * Requires:
1355  *\li   '*zmgrp' is a valid, non-NULL zone manager pointer.
1356  *
1357  * Ensures:
1358  *\li   '*zmgrp' is NULL.
1359  */
1360
1361 void
1362 dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1363 /*%<
1364  *      Release 'zone' from the managed by 'zmgr'.  'zmgr' is implicitly
1365  *      detached from 'zone'.
1366  *
1367  * Requires:
1368  *\li   'zmgr' to be a valid zone manager.
1369  *\li   'zone' to be a valid zone.
1370  *\li   'zmgr' == 'zone->zmgr'
1371  *
1372  * Ensures:
1373  *\li   'zone->zmgr' == NULL;
1374  */
1375
1376 void
1377 dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value);
1378 /*%<
1379  *      Set the maximum number of simultaneous transfers in allowed by
1380  *      the zone manager.
1381  *
1382  * Requires:
1383  *\li   'zmgr' to be a valid zone manager.
1384  */
1385
1386 isc_uint32_t
1387 dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr);
1388 /*%<
1389  *      Return the maximum number of simultaneous transfers in allowed.
1390  *
1391  * Requires:
1392  *\li   'zmgr' to be a valid zone manager.
1393  */
1394
1395 void
1396 dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value);
1397 /*%<
1398  *      Set the number of zone transfers allowed per nameserver.
1399  *
1400  * Requires:
1401  *\li   'zmgr' to be a valid zone manager
1402  */
1403
1404 isc_uint32_t
1405 dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr);
1406 /*%<
1407  *      Return the number of transfers allowed per nameserver.
1408  *
1409  * Requires:
1410  *\li   'zmgr' to be a valid zone manager.
1411  */
1412
1413 void
1414 dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit);
1415 /*%<
1416  *      Set the number of simultaneous file descriptors available for
1417  *      reading and writing masterfiles.
1418  *
1419  * Requires:
1420  *\li   'zmgr' to be a valid zone manager.
1421  *\li   'iolimit' to be positive.
1422  */
1423
1424 isc_uint32_t
1425 dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr);
1426 /*%<
1427  *      Get the number of simultaneous file descriptors available for
1428  *      reading and writing masterfiles.
1429  *
1430  * Requires:
1431  *\li   'zmgr' to be a valid zone manager.
1432  */
1433
1434 void
1435 dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value);
1436 /*%<
1437  *      Set the number of SOA queries sent per second.
1438  *
1439  * Requires:
1440  *\li   'zmgr' to be a valid zone manager
1441  */
1442
1443 unsigned int
1444 dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr);
1445 /*%<
1446  *      Return the number of SOA queries sent per second.
1447  *
1448  * Requires:
1449  *\li   'zmgr' to be a valid zone manager.
1450  */
1451
1452 unsigned int
1453 dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state);
1454 /*%<
1455  *      Returns the number of zones in the specified state.
1456  *
1457  * Requires:
1458  *\li   'zmgr' to be a valid zone manager.
1459  *\li   'state' to be a valid DNS_ZONESTATE_ constant.
1460  */
1461
1462 void
1463 dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote,
1464                            isc_sockaddr_t *local, isc_time_t *now);
1465 /*%<
1466  *      Add the pair of addresses to the unreachable cache.
1467  *
1468  * Requires:
1469  *\li   'zmgr' to be a valid zone manager.
1470  *\li   'remote' to be a valid sockaddr.
1471  *\li   'local' to be a valid sockaddr.
1472  */
1473
1474 void
1475 dns_zone_forcereload(dns_zone_t *zone);
1476 /*%<
1477  *      Force a reload of specified zone.
1478  *
1479  * Requires:
1480  *\li      'zone' to be a valid zone.
1481  */
1482
1483 isc_boolean_t
1484 dns_zone_isforced(dns_zone_t *zone);
1485 /*%<
1486  *      Check if the zone is waiting a forced reload.
1487  *
1488  * Requires:
1489  * \li     'zone' to be a valid zone.
1490  */
1491
1492 isc_result_t
1493 dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on);
1494 /*%<
1495  * This function is obsoleted by dns_zone_setrequeststats().
1496  */
1497
1498 isc_uint64_t *
1499 dns_zone_getstatscounters(dns_zone_t *zone);
1500 /*%<
1501  * This function is obsoleted by dns_zone_getrequeststats().
1502  */
1503
1504 void
1505 dns_zone_setstats(dns_zone_t *zone, isc_stats_t *stats);
1506 /*%<
1507  * Set a general zone-maintenance statistics set 'stats' for 'zone'.  This
1508  * function is expected to be called only on zone creation (when necessary).
1509  * Once installed, it cannot be removed or replaced.  Also, there is no
1510  * interface to get the installed stats from the zone; the caller must keep the
1511  * stats to reference (e.g. dump) it later.
1512  *
1513  * Requires:
1514  * \li  'zone' to be a valid zone and does not have a statistics set already
1515  *      installed.
1516  *
1517  *\li   stats is a valid statistics supporting zone statistics counters
1518  *      (see dns/stats.h).
1519  */
1520
1521 void
1522 dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats);
1523 /*%<
1524  * Set an additional statistics set to zone.  It is attached in the zone
1525  * but is not counted in the zone module; only the caller updates the counters.
1526  *
1527  * Requires:
1528  * \li  'zone' to be a valid zone.
1529  *
1530  *\li   stats is a valid statistics.
1531  */
1532
1533 isc_stats_t *
1534 dns_zone_getrequeststats(dns_zone_t *zone);
1535 /*%<
1536  * Get the additional statistics for zone, if one is installed.
1537  *
1538  * Requires:
1539  * \li  'zone' to be a valid zone.
1540  *
1541  * Returns:
1542  * \li  when available, a pointer to the statistics set installed in zone;
1543  *      otherwise NULL.
1544  */
1545
1546 void
1547 dns_zone_dialup(dns_zone_t *zone);
1548 /*%<
1549  * Perform dialup-time maintenance on 'zone'.
1550  */
1551
1552 void
1553 dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup);
1554 /*%<
1555  * Set the dialup type of 'zone' to 'dialup'.
1556  *
1557  * Requires:
1558  * \li  'zone' to be valid initialised zone.
1559  *\li   'dialup' to be a valid dialup type.
1560  */
1561
1562 void
1563 dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
1564         ISC_FORMAT_PRINTF(3, 4);
1565 /*%<
1566  * Log the message 'msg...' at 'level', including text that identifies
1567  * the message as applying to 'zone'.
1568  */
1569
1570 void
1571 dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
1572               const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
1573 /*%<
1574  * Log the message 'msg...' at 'level', including text that identifies
1575  * the message as applying to 'zone'.
1576  */
1577
1578 void
1579 dns_zone_name(dns_zone_t *zone, char *buf, size_t len);
1580 /*%<
1581  * Return the name of the zone with class and view.
1582  *
1583  * Requires:
1584  *\li   'zone' to be valid.
1585  *\li   'buf' to be non NULL.
1586  */
1587
1588 isc_result_t
1589 dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata);
1590 /*
1591  * Check if this record meets the check-names policy.
1592  *
1593  * Requires:
1594  *      'zone' to be valid.
1595  *      'name' to be valid.
1596  *      'rdata' to be valid.
1597  *
1598  * Returns:
1599  *      DNS_R_SUCCESS           passed checks.
1600  *      DNS_R_BADOWNERNAME      failed ownername checks.
1601  *      DNS_R_BADNAME           failed rdata checks.
1602  */
1603
1604 void
1605 dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache);
1606 /*
1607  *      Associate the zone with an additional cache.
1608  *
1609  * Require:
1610  *      'zone' to be a valid zone.
1611  *      'acache' to be a non NULL pointer.
1612  *
1613  * Ensures:
1614  *      'zone' will have a reference to 'acache'
1615  */
1616
1617 void
1618 dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx);
1619 /*
1620  *      Set the post load integrity callback function 'checkmx'.
1621  *      'checkmx' will be called if the MX is not within the zone.
1622  *
1623  * Require:
1624  *      'zone' to be a valid zone.
1625  */
1626
1627 void
1628 dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv);
1629 /*
1630  *      Set the post load integrity callback function 'checksrv'.
1631  *      'checksrv' will be called if the SRV TARGET is not within the zone.
1632  *
1633  * Require:
1634  *      'zone' to be a valid zone.
1635  */
1636
1637 void
1638 dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns);
1639 /*
1640  *      Set the post load integrity callback function 'checkmx'.
1641  *      'checkmx' will be called if the MX is not within the zone.
1642  *
1643  * Require:
1644  *      'zone' to be a valid zone.
1645  */
1646
1647 void
1648 dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay);
1649 /*
1650  * Set the minimum delay between sets of notify messages.
1651  *
1652  * Requires:
1653  *      'zone' to be valid.
1654  */
1655
1656 isc_uint32_t
1657 dns_zone_getnotifydelay(dns_zone_t *zone);
1658 /*
1659  * Get the minimum delay between sets of notify messages.
1660  *
1661  * Requires:
1662  *      'zone' to be valid.
1663  */
1664
1665 void
1666 dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg);
1667 /*
1668  * Set the isself callback function and argument.
1669  *
1670  * isc_boolean_t
1671  * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr,
1672  *        isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg);
1673  *
1674  * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to
1675  * 'destaddr' with optional key 'mykey' for class 'rdclass' would be
1676  * delivered to 'myview'.
1677  */
1678
1679 ISC_LANG_ENDDECLS
1680
1681 #endif /* DNS_ZONE_H */