dlz.c File Reference

#include <config.h>
#include <dns/db.h>
#include <dns/dlz.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/master.h>
#include <dns/ssu.h>
#include <dns/zone.h>
#include <isc/buffer.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/rwlock.h>
#include <isc/string.h>
#include <isc/util.h>

Go to the source code of this file.

Functions

static ISC_LIST (dns_dlzimplementation_t)
static dns_dlzimplementation_tdlz_impfind (const char *name)
 Searches the dlz_implementations list for a driver matching name.
isc_result_t dns_dlzallowzonexfr (dns_view_t *view, dns_name_t *name, isc_sockaddr_t *clientaddr, dns_db_t **dbp)
 This method is called when the DNS server is performing a zone transfer query. It will call the DLZ driver's allow zone transfer method.
isc_result_t dns_dlzcreate (isc_mem_t *mctx, const char *dlzname, const char *drivername, unsigned int argc, char *argv[], dns_dlzdb_t **dbp)
 This method is called when the DNS server is starting up and creating drivers for use later. It will search the DLZ driver list for 'drivername' and return a DLZ driver via dbp if a match is found. If the DLZ driver supplies a create method, this function will call it.
void dns_dlzdestroy (dns_dlzdb_t **dbp)
 This method is called when the DNS server is shutting down and no longer needs the driver. If the DLZ driver supplies a destroy methods, this function will call it.
isc_result_t dns_dlzregister (const char *drivername, const dns_dlzmethods_t *methods, void *driverarg, isc_mem_t *mctx, dns_dlzimplementation_t **dlzimp)
 Registers a DLZ driver. This basically just adds the dlz driver to the list of available drivers in the dlz_implementations list.
static isc_result_t dns_dlzstrtoargvsub (isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp, unsigned int n)
 Helper function for dns_dlzstrtoargv(). Pardon the gratuitous recursion.
isc_result_t dns_dlzstrtoargv (isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp)
 Tokenize the string "s" into whitespace-separated words, return the number of words in '*argcp' and an array of pointers to the words in '*argvp'. The caller must free the array using isc_mem_put(). The string is modified in-place.
void dns_dlzunregister (dns_dlzimplementation_t **dlzimp)
 Unregisters a DLZ driver. This basically just removes the dlz driver from the list of available drivers in the dlz_implementations list.
isc_result_t dns_dlz_writeablezone (dns_view_t *view, dns_dlzdb_t *dlzdb, const char *zone_name)
isc_result_t dns_dlzconfigure (dns_view_t *view, dns_dlzdb_t *dlzdb, dlzconfigure_callback_t callback)
 Configure a DLZ driver. This is optional, and if supplied gives the backend an opportunity to configure parameters related to DLZ.
isc_boolean_t dns_dlz_ssumatch (dns_dlzdb_t *dlzdatabase, dns_name_t *signer, dns_name_t *name, isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key)
 call a DLZ drivers ssumatch method, if supplied. Otherwise return ISC_FALSE


Detailed Description

Definition in file dlz.c.


Function Documentation

static ISC_LIST ( dns_dlzimplementation_t   )  [static]

Definition at line 84 of file dlz.c.

References ISC_LIST_INIT, ISC_R_SUCCESS, isc_rwlock_init(), and RUNTIME_CHECK.

static dns_dlzimplementation_t* dlz_impfind ( const char *  name  )  [inline, static]

Searches the dlz_implementations list for a driver matching name.

Definition at line 98 of file dlz.c.

References ISC_LIST_HEAD, ISC_LIST_NEXT, and dns_dlzimplementation::name.

Referenced by dns_dlzcreate(), and dns_dlzregister().

isc_result_t dns_dlzallowzonexfr ( dns_view_t view,
dns_name_t name,
isc_sockaddr_t clientaddr,
dns_db_t **  dbp 
)

This method is called when the DNS server is performing a zone transfer query. It will call the DLZ driver's allow zone transfer method.

Definition at line 114 of file dlz.c.

References dns_dlzmethods::allowzonexfr, dns_dlzdb::dbdata, dns_view::dlz_searched, DNS_DLZ_VALID, dns_dlzimplementation::driverarg, dns_dlzdb::implementation, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOPERM, ISC_R_NOTFOUND, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, dns_dlzdb::mctx, dns_dlzimplementation::methods, dns_view::rdclass, and REQUIRE.

Referenced by ns_xfr_start().

isc_result_t dns_dlzcreate ( isc_mem_t mctx,
const char *  dlzname,
const char *  drivername,
unsigned int  argc,
char *  argv[],
dns_dlzdb_t **  dbp 
)

This method is called when the DNS server is starting up and creating drivers for use later. It will search the DLZ driver list for 'drivername' and return a DLZ driver via dbp if a match is found. If the DLZ driver supplies a create method, this function will call it.

Definition at line 156 of file dlz.c.

References dns_dlzmethods::create, dns_dlzdb::dbdata, dlz_impfind(), dns_dlzdb::dlzname, DNS_DLZ_MAGIC, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, dns_dlzimplementation::driverarg, dns_dlzdb::implementation, ISC_LINK_INIT, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_LOG_INFO, isc_log_write(), isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mem_strdup, isc_once_do, ISC_R_NOMEMORY, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, dns_dlzdb::magic, dns_dlzdb::mctx, dns_dlzimplementation::methods, once, REQUIRE, RUNTIME_CHECK, RWLOCK, and RWUNLOCK.

Referenced by configure_view().

void dns_dlzdestroy ( dns_dlzdb_t **  dbp  ) 

This method is called when the DNS server is shutting down and no longer needs the driver. If the DLZ driver supplies a destroy methods, this function will call it.

Definition at line 242 of file dlz.c.

References destroy(), DNS_DLZ_VALID, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, dns_ssutable_detach(), ISC_LOG_DEBUG, isc_log_write(), isc_mem_detach(), isc_mem_free, isc_mem_put, mctx, and REQUIRE.

Referenced by destroy().

isc_result_t dns_dlzregister ( const char *  drivername,
const dns_dlzmethods_t methods,
void *  driverarg,
isc_mem_t mctx,
dns_dlzimplementation_t **  dlzimp 
)

Registers a DLZ driver. This basically just adds the dlz driver to the list of available drivers in the dlz_implementations list.

Register a dynamically loadable zones (DLZ) driver for the database type 'drivername', implemented by the functions in '*methods'.

Definition at line 280 of file dlz.c.

References dns_dlzmethods::create, dns_dlzmethods::destroy, dlz_impfind(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, dns_dlzimplementation::driverarg, dns_dlzmethods::findzone, ISC_LINK_INIT, ISC_LIST_APPEND, ISC_LOG_DEBUG, isc_log_write(), isc_mem_attach(), isc_mem_get, isc_once_do, ISC_R_EXISTS, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, dns_dlzimplementation::mctx, dns_dlzimplementation::methods, dns_dlzimplementation::name, once, REQUIRE, RUNTIME_CHECK, RWLOCK, and RWUNLOCK.

Referenced by dns_sdlzregister().

static isc_result_t dns_dlzstrtoargvsub ( isc_mem_t mctx,
char *  s,
unsigned int *  argcp,
char ***  argvp,
unsigned int  n 
) [static]

Helper function for dns_dlzstrtoargv(). Pardon the gratuitous recursion.

Definition at line 369 of file dlz.c.

References isc_mem_get, ISC_R_NOMEMORY, and ISC_R_SUCCESS.

Referenced by dns_dlzstrtoargv().

isc_result_t dns_dlzstrtoargv ( isc_mem_t mctx,
char *  s,
unsigned int *  argcp,
char ***  argvp 
)

Tokenize the string "s" into whitespace-separated words, return the number of words in '*argcp' and an array of pointers to the words in '*argvp'. The caller must free the array using isc_mem_put(). The string is modified in-place.

This method is called when the name server is starting up to parse the DLZ driver command line from named.conf. Basically it splits up a string into and argc / argv. The primary difference of this method is items between braces { } are considered only 1 word. for example the command line "this is { one grouped phrase } and this isn't" would be parsed into:.

Definition at line 433 of file dlz.c.

References dns_dlzstrtoargvsub().

Referenced by configure_view().

void dns_dlzunregister ( dns_dlzimplementation_t **  dlzimp  ) 

Unregisters a DLZ driver. This basically just removes the dlz driver from the list of available drivers in the dlz_implementations list.

Removes the dlz driver from the list of registered dlz drivers. There must be no active dlz drivers of this type when this function is called.

Definition at line 444 of file dlz.c.

References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, ISC_LIST_UNLINK, ISC_LOG_DEBUG, isc_log_write(), isc_mem_detach(), isc_mem_put, isc_once_do, ISC_R_SUCCESS, isc_rwlocktype_write, dns_dlzimplementation::mctx, mctx, once, REQUIRE, RUNTIME_CHECK, RWLOCK, and RWUNLOCK.

Referenced by dns_sdlzunregister().

isc_result_t dns_dlz_writeablezone ( dns_view_t view,
dns_dlzdb_t dlzdb,
const char *  zone_name 
)

Definition at line 494 of file dlz.c.

References buffer, cleanup(), dns_dlzdb::configure_callback, dns_dlzdb::dlzname, DNS_DLZ_VALID, dns_fixedname_init, dns_fixedname_name, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, dns_name_fromtext(), dns_rootname, dns_ssutable_createdlz(), dns_view_addzone(), dns_view_findzone(), dns_zone_create(), dns_zone_detach(), dns_zone_setadded(), dns_zone_setorigin(), dns_zone_setssutable(), dns_zone_setview(), INSIST, isc_buffer_add, isc_buffer_constinit, ISC_LOG_WARNING, isc_log_write(), ISC_R_EXISTS, ISC_R_SUCCESS, ISC_TRUE, dns_dlzdb::mctx, dns_view::mctx, origin, REQUIRE, dns_dlzdb::search, dns_dlzdb::ssutable, and zone.

isc_result_t dns_dlzconfigure ( dns_view_t view,
dns_dlzdb_t dlzdb,
dlzconfigure_callback_t  callback 
)

Configure a DLZ driver. This is optional, and if supplied gives the backend an opportunity to configure parameters related to DLZ.

call a DLZ drivers configure method, if supplied

Definition at line 574 of file dlz.c.

References dns_dlzmethods::configure, dns_dlzdb::configure_callback, dns_dlzdb::dbdata, DNS_DLZ_VALID, dns_dlzimplementation::driverarg, dns_dlzdb::implementation, ISC_R_SUCCESS, dns_dlzimplementation::methods, and REQUIRE.

Referenced by configure_view().

isc_boolean_t dns_dlz_ssumatch ( dns_dlzdb_t dlzdatabase,
dns_name_t signer,
dns_name_t name,
isc_netaddr_t tcpaddr,
dns_rdatatype_t  type,
const dst_key_t key 
)

call a DLZ drivers ssumatch method, if supplied. Otherwise return ISC_FALSE

Definition at line 596 of file dlz.c.

References dns_dlzdb::dbdata, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, dns_dlzimplementation::driverarg, dns_dlzdb::implementation, ISC_FALSE, ISC_LOG_INFO, isc_log_write(), dns_dlzimplementation::methods, r, REQUIRE, and dns_dlzmethods::ssumatch.

Referenced by dns_ssutable_checkrules().


Generated on Tue Apr 28 17:41:08 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha