#include <isc/lang.h>
#include <dns/types.h>
Go to the source code of this file.
Defines | |
#define | DNS_ZT_H 1 |
#define | DNS_ZTFIND_NOEXACT 0x01 |
Typedefs | |
typedef isc_result_t(* | dns_zt_zoneloaded_t )(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) |
Method prototype: when a zone finishes loading, the zt object can be informed via a callback function with this signature. | |
Functions | |
isc_result_t | dns_zt_create (isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt) |
Creates a new zone table. | |
isc_result_t | dns_zt_mount (dns_zt_t *zt, dns_zone_t *zone) |
Mounts the zone on the zone table. | |
isc_result_t | dns_zt_unmount (dns_zt_t *zt, dns_zone_t *zone) |
Unmount the given zone from the table. | |
isc_result_t | dns_zt_find (dns_zt_t *zt, dns_name_t *name, unsigned int options, dns_name_t *foundname, dns_zone_t **zone) |
Find the best match for 'name' in 'zt'. If foundname is non NULL then the name of the zone found is returned. | |
void | dns_zt_detach (dns_zt_t **ztp) |
Detach the given zonetable, if the reference count goes to zero the zonetable will be freed. In either case 'ztp' is set to NULL. | |
void | dns_zt_flushanddetach (dns_zt_t **ztp) |
Detach the given zonetable, if the reference count goes to zero the zonetable will be flushed and then freed. In either case 'ztp' is set to NULL. | |
void | dns_zt_attach (dns_zt_t *zt, dns_zt_t **ztp) |
Attach 'zt' to '*ztp'. | |
isc_result_t | dns_zt_load (dns_zt_t *zt, isc_boolean_t stop) |
isc_result_t | dns_zt_loadnew (dns_zt_t *zt, isc_boolean_t stop) |
isc_result_t | dns_zt_asyncload (dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg) |
Load all zones in the table. If 'stop' is ISC_TRUE, stop on the first error and return it. If 'stop' is ISC_FALSE, ignore errors. | |
isc_result_t | dns_zt_freezezones (dns_zt_t *zt, isc_boolean_t freeze) |
Freeze/thaw updates to master zones. Any pending updates will be flushed. Zones will be reloaded on thaw. | |
isc_result_t | dns_zt_apply (dns_zt_t *zt, isc_boolean_t stop, isc_result_t(*action)(dns_zone_t *, void *), void *uap) |
isc_result_t | dns_zt_apply2 (dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, isc_result_t(*action)(dns_zone_t *, void *), void *uap) |
Apply a given 'action' to all zone zones in the table. If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if 'action' does not return ISC_R_SUCCESS. | |
isc_boolean_t | dns_zt_loadspending (dns_zt_t *zt) |
Returns ISC_TRUE if and only if there are zones still waiting to be loaded in zone table 'zt'. | |
Variables | |
ISC_LANG_BEGINDECLS typedef isc_result_t(* | dns_zt_allloaded_t )(void *arg) |
Method prototype: when all pending zone loads are complete, the zone table can inform the caller via a callback function with this signature. |
Definition in file zt.h.
#define DNS_ZTFIND_NOEXACT 0x01 |
Definition at line 29 of file zt.h.
Referenced by dns_view_findzonecut2(), dns_zt_find(), and query_getzonedb().
typedef isc_result_t(* dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) |
isc_result_t dns_zt_create | ( | isc_mem_t * | mctx, | |
dns_rdataclass_t | rdclass, | |||
dns_zt_t ** | zt | |||
) |
Creates a new zone table.
Requires:
Definition at line 77 of file zt.c.
References auto_detach(), dns_rbt_create(), dns_rbt_destroy(), dns_zt::flush, ISC_FALSE, isc_mem_attach(), isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlock_init(), dns_zt::loaddone, dns_zt::loaddone_arg, dns_zt::loads_pending, dns_zt::magic, dns_zt::mctx, dns_zt::rdclass, dns_zt::references, REQUIRE, dns_zt::rwlock, dns_zt::table, and ZTMAGIC.
Referenced by dns_view_create(), and dns_view_createzonetable().
isc_result_t dns_zt_mount | ( | dns_zt_t * | zt, | |
dns_zone_t * | zone | |||
) |
Mounts the zone on the zone table.
Requires:
Definition at line 119 of file zt.c.
References dns_rbt_addname(), dns_zone_attach(), dns_zone_getorigin(), dummy, ISC_R_SUCCESS, isc_rwlocktype_write, name, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, dns_zt::table, and VALID_ZT.
Referenced by dns_view_addzone().
isc_result_t dns_zt_unmount | ( | dns_zt_t * | zt, | |
dns_zone_t * | zone | |||
) |
Unmount the given zone from the table.
Requires: 'zt' to be valid
Definition at line 140 of file zt.c.
References dns_rbt_deletename(), dns_zone_getorigin(), ISC_FALSE, isc_rwlocktype_write, name, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, dns_zt::table, and VALID_ZT.
Referenced by do_addzone(), do_modzone(), and ns_server_delzone().
isc_result_t dns_zt_find | ( | dns_zt_t * | zt, | |
dns_name_t * | name, | |||
unsigned int | options, | |||
dns_name_t * | foundname, | |||
dns_zone_t ** | zone | |||
) |
Find the best match for 'name' in 'zt'. If foundname is non NULL then the name of the zone found is returned.
Notes:
Definition at line 158 of file zt.c.
References DNS_R_PARTIALMATCH, dns_rbt_findname(), DNS_RBTFIND_NOEXACT, dns_zone_attach(), DNS_ZTFIND_NOEXACT, dummy, ISC_R_SUCCESS, isc_rwlocktype_read, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, dns_zt::table, and VALID_ZT.
Referenced by dns_view_find2(), dns_view_findzone(), dns_view_findzonecut2(), dns_viewlist_findzone(), do_addzone(), do_modzone(), ns_notify_start(), ns_update_start(), ns_xfr_start(), query_getzonedb(), and zone_from_args().
void dns_zt_detach | ( | dns_zt_t ** | ztp | ) |
Detach the given zonetable, if the reference count goes to zero the zonetable will be freed. In either case 'ztp' is set to NULL.
Requires:
Definition at line 247 of file zt.c.
References ISC_FALSE, and zt_flushanddetach().
Referenced by dns_view_create(), and view_flushanddetach().
void dns_zt_flushanddetach | ( | dns_zt_t ** | ztp | ) |
Detach the given zonetable, if the reference count goes to zero the zonetable will be flushed and then freed. In either case 'ztp' is set to NULL.
Requires:
Definition at line 242 of file zt.c.
References ISC_TRUE, and zt_flushanddetach().
Referenced by view_flushanddetach().
Attach 'zt' to '*ztp'.
Requires:
Definition at line 183 of file zt.c.
References INSIST, isc_rwlocktype_write, dns_zt::references, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, and VALID_ZT.
isc_result_t dns_zt_load | ( | dns_zt_t * | zt, | |
isc_boolean_t | stop | |||
) |
Definition at line 252 of file zt.c.
References dns_zt_apply(), isc_rwlocktype_read, load(), REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, and VALID_ZT.
Referenced by dns_view_load().
isc_result_t dns_zt_loadnew | ( | dns_zt_t * | zt, | |
isc_boolean_t | stop | |||
) |
Definition at line 328 of file zt.c.
References dns_zt_apply(), isc_rwlocktype_read, loadnew(), REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, and VALID_ZT.
Referenced by dns_view_loadnew().
isc_result_t dns_zt_asyncload | ( | dns_zt_t * | zt, | |
dns_zt_allloaded_t | alldone, | |||
void * | arg | |||
) |
Load all zones in the table. If 'stop' is ISC_TRUE, stop on the first error and return it. If 'stop' is ISC_FALSE, ignore errors.
dns_zt_loadnew() only loads zones that are not yet loaded. dns_zt_load() also loads zones that are already loaded and and whose master file has changed since the last load. dns_zt_asyncload() loads zones asynchronously; when all zones in the zone table have finished loaded (or failed due to errors), the caller is informed by calling 'alldone' with an argument of 'arg'.
Requires:
Definition at line 276 of file zt.c.
References asyncload(), dns_zt_apply2(), doneloading(), INSIST, ISC_FALSE, isc_rwlocktype_write, dns_zt::loaddone, dns_zt::loaddone_arg, dns_zt::loads_pending, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, and VALID_ZT.
Referenced by dns_view_asyncload(), and start_zt_asyncload().
isc_result_t dns_zt_freezezones | ( | dns_zt_t * | zt, | |
isc_boolean_t | freeze | |||
) |
Freeze/thaw updates to master zones. Any pending updates will be flushed. Zones will be reloaded on thaw.
Definition at line 352 of file zt.c.
References dns_zt_apply2(), freezezones(), ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, REQUIRE, dns_zt::rwlock, RWLOCK, RWUNLOCK, and VALID_ZT.
Referenced by dns_view_freezezones().
isc_result_t dns_zt_apply | ( | dns_zt_t * | zt, | |
isc_boolean_t | stop, | |||
isc_result_t(*)(dns_zone_t *, void *) | action, | |||
void * | uap | |||
) |
Definition at line 433 of file zt.c.
References dns_zt_apply2().
Referenced by add_view_tolist(), ATF_TC_BODY(), dns_view_dialup(), dns_zt_load(), dns_zt_loadnew(), load_configuration(), ns_server_sync(), and zt_destroy().
isc_result_t dns_zt_apply2 | ( | dns_zt_t * | zt, | |
isc_boolean_t | stop, | |||
isc_result_t * | sub, | |||
isc_result_t(*)(dns_zone_t *, void *) | action, | |||
void * | uap | |||
) |
Apply a given 'action' to all zone zones in the table. If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if 'action' does not return ISC_R_SUCCESS.
Requires:
Definition at line 440 of file zt.c.
References cleanup(), dns_rbtnode::data, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_first(), dns_rbtnodechain_init(), dns_rbtnodechain_invalidate(), dns_rbtnodechain_next(), ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_zt::mctx, REQUIRE, dns_zt::table, VALID_ZT, and zone.
Referenced by dns_zt_apply(), dns_zt_asyncload(), and dns_zt_freezezones().
isc_boolean_t dns_zt_loadspending | ( | dns_zt_t * | zt | ) |
Returns ISC_TRUE if and only if there are zones still waiting to be loaded in zone table 'zt'.
Requires:
ISC_LANG_BEGINDECLS typedef isc_result_t(* dns_zt_allloaded_t)(void *arg) |
Method prototype: when all pending zone loads are complete, the zone table can inform the caller via a callback function with this signature.
Referenced by doneloading().