sdlz.c File Reference

#include <config.h>
#include <string.h>
#include <isc/buffer.h>
#include <isc/lex.h>
#include <isc/log.h>
#include <isc/rwlock.h>
#include <isc/util.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/print.h>
#include <isc/region.h>
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dlz.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/master.h>
#include <dns/sdlz.h>
#include <dns/types.h>
#include "rdatalist_p.h"

Go to the source code of this file.

Data Structures

struct  dns_sdlzimplementation
struct  dns_sdlz_db
struct  dns_sdlzlookup
struct  dns_sdlzallnodes
struct  sdlz_rdatasetiter

Defines

#define SDLZDB_MAGIC   ISC_MAGIC('D', 'L', 'Z', 'S')
#define VALID_SDLZDB(sdlzdb)
#define SDLZLOOKUP_MAGIC   ISC_MAGIC('D','L','Z','L')
#define VALID_SDLZLOOKUP(sdlzl)   ISC_MAGIC_VALID(sdlzl, SDLZLOOKUP_MAGIC)
#define VALID_SDLZNODE(sdlzn)   VALID_SDLZLOOKUP(sdlzn)
#define SDLZ_DEFAULT_REFRESH   (60 * 60 * 8)
#define SDLZ_DEFAULT_RETRY   (60 * 60 * 2)
#define SDLZ_DEFAULT_EXPIRE   (60 * 60 * 24 * 7)
#define SDLZ_DEFAULT_MINIMUM   (60 * 60 * 24)
#define SDLZ_DEFAULT_TTL   (60 * 60 * 24)
#define MAYBE_LOCK(imp)
#define MAYBE_UNLOCK(imp)

Typedefs

typedef struct dns_sdlzlookup dns_sdlznode_t
typedef dns_sdlzallnodes_t sdlz_dbiterator_t
typedef struct sdlz_rdatasetiter sdlz_rdatasetiter_t

Functions

static isc_result_t getnodedata (dns_db_t *db, dns_name_t *name, isc_boolean_t create, unsigned int options, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
static void list_tordataset (dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node, dns_rdataset_t *rdataset)
static void detachnode (dns_db_t *db, dns_dbnode_t **targetp)
static void dbiterator_destroy (dns_dbiterator_t **iteratorp)
static isc_result_t dbiterator_first (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_last (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_seek (dns_dbiterator_t *iterator, dns_name_t *name)
static isc_result_t dbiterator_prev (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_next (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_current (dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name)
static isc_result_t dbiterator_pause (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_origin (dns_dbiterator_t *iterator, dns_name_t *name)
static void sdlz_log (int level, const char *fmt,...)
static void dns_sdlz_tolower (char *str)
 Converts the input string to lowercase, in place.
static unsigned int initial_size (const char *data)
static void rdatasetiter_destroy (dns_rdatasetiter_t **iteratorp)
static isc_result_t rdatasetiter_first (dns_rdatasetiter_t *iterator)
static isc_result_t rdatasetiter_next (dns_rdatasetiter_t *iterator)
static void rdatasetiter_current (dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset)
static void attach (dns_db_t *source, dns_db_t **targetp)
static void destroy (dns_sdlz_db_t *sdlz)
static void detach (dns_db_t **dbp)
static isc_result_t beginload (dns_db_t *db, dns_rdatacallbacks_t *callbacks)
static isc_result_t endload (dns_db_t *db, dns_rdatacallbacks_t *callbacks)
static isc_result_t dump (dns_db_t *db, dns_dbversion_t *version, const char *filename, dns_masterformat_t masterformat)
static void currentversion (dns_db_t *db, dns_dbversion_t **versionp)
static isc_result_t newversion (dns_db_t *db, dns_dbversion_t **versionp)
static void attachversion (dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp)
static void closeversion (dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit)
static isc_result_t createnode (dns_sdlz_db_t *sdlz, dns_sdlznode_t **nodep)
static void destroynode (dns_sdlznode_t *node)
static isc_result_t findnodeext (dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
static isc_result_t findnode (dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep)
static isc_result_t findzonecut (dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static void attachnode (dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp)
static isc_result_t expirenode (dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now)
static void printnode (dns_db_t *db, dns_dbnode_t *node, FILE *out)
static isc_result_t createiterator (dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
static isc_result_t findrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t findext (dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t find (dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t allrdatasets (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdatasetiter_t **iteratorp)
static isc_result_t modrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, unsigned int options, dns_sdlzmodrdataset_t mod_function)
static isc_result_t addrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *addedrdataset)
static isc_result_t subtractrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset)
static isc_result_t deleterdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers)
static isc_boolean_t issecure (dns_db_t *db)
static unsigned int nodecount (dns_db_t *db)
static isc_boolean_t ispersistent (dns_db_t *db)
static void overmem (dns_db_t *db, isc_boolean_t over)
static void settask (dns_db_t *db, isc_task_t *task)
static isc_result_t getoriginnode (dns_db_t *db, dns_dbnode_t **nodep)
static void disassociate (dns_rdataset_t *rdataset)
static void rdataset_clone (dns_rdataset_t *source, dns_rdataset_t *target)
static isc_result_t dns_sdlzcreateDBP (isc_mem_t *mctx, void *driverarg, void *dbdata, dns_name_t *name, dns_rdataclass_t rdclass, dns_db_t **dbp)
 Build a 'bind' database driver structure to be returned by either the find zone or the allow zone transfer method. This method is only available in this source file, it is not made available anywhere else.
static isc_result_t dns_sdlzallowzonexfr (void *driverarg, void *dbdata, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_name_t *name, isc_sockaddr_t *clientaddr, dns_db_t **dbp)
static isc_result_t dns_sdlzcreate (isc_mem_t *mctx, const char *dlzname, unsigned int argc, char *argv[], void *driverarg, void **dbdata)
static void dns_sdlzdestroy (void *driverdata, void **dbdata)
static isc_result_t dns_sdlzfindzone (void *driverarg, void *dbdata, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_name_t *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_db_t **dbp)
static isc_result_t dns_sdlzconfigure (void *driverarg, void *dbdata, dns_view_t *view, dns_dlzdb_t *dlzdb)
static isc_boolean_t dns_sdlzssumatch (dns_name_t *signer, dns_name_t *name, isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key, void *driverarg, void *dbdata)
isc_result_t dns_sdlz_putrr (dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, const char *data)
isc_result_t dns_sdlz_putnamedrr (dns_sdlzallnodes_t *allnodes, const char *name, const char *type, dns_ttl_t ttl, const char *data)
isc_result_t dns_sdlz_putsoa (dns_sdlzlookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial)
isc_result_t dns_sdlzregister (const char *drivername, const dns_sdlzmethods_t *methods, void *driverarg, unsigned int flags, isc_mem_t *mctx, dns_sdlzimplementation_t **sdlzimp)
 Register a dynamically loadable zones (dlz) driver for the database type 'drivername', implemented by the functions in '*methods'.
void dns_sdlzunregister (dns_sdlzimplementation_t **sdlzimp)
 Removes the sdlz driver from the list of registered sdlz drivers. There must be no active sdlz drivers of this type when this function is called.
isc_result_t dns_sdlz_setdb (dns_dlzdb_t *dlzdatabase, dns_rdataclass_t rdclass, dns_name_t *name, dns_db_t **dbp)

Variables

static dns_dbiteratormethods_t dbiterator_methods
static dns_rdatasetitermethods_t rdatasetiter_methods
static dns_dbmethods_t sdlzdb_methods
static dns_rdatasetmethods_t rdataset_methods
static dns_dlzmethods_t sdlzmethods


Detailed Description

Definition in file sdlz.c.


Define Documentation

#define SDLZDB_MAGIC   ISC_MAGIC('D', 'L', 'Z', 'S')

Definition at line 146 of file sdlz.c.

Referenced by dns_sdlzcreateDBP().

#define VALID_SDLZDB ( sdlzdb   ) 

Value:

((sdlzdb) != NULL && \
                                 (sdlzdb)->common.impmagic == SDLZDB_MAGIC)

Definition at line 153 of file sdlz.c.

Referenced by addrdataset(), allrdatasets(), attach(), attachnode(), attachversion(), closeversion(), createiterator(), currentversion(), deleterdataset(), detach(), detachnode(), findext(), getnodedata(), getoriginnode(), modrdataset(), newversion(), and subtractrdataset().

#define SDLZLOOKUP_MAGIC   ISC_MAGIC('D','L','Z','L')

Definition at line 156 of file sdlz.c.

Referenced by createnode().

#define VALID_SDLZLOOKUP ( sdlzl   )     ISC_MAGIC_VALID(sdlzl, SDLZLOOKUP_MAGIC)

Definition at line 157 of file sdlz.c.

Referenced by dns_sdlz_putrr().

#define VALID_SDLZNODE ( sdlzn   )     VALID_SDLZLOOKUP(sdlzn)

Definition at line 158 of file sdlz.c.

Referenced by findrdataset().

#define SDLZ_DEFAULT_REFRESH   (60 * 60 * 8)

Definition at line 161 of file sdlz.c.

Referenced by dns_sdlz_putsoa().

#define SDLZ_DEFAULT_RETRY   (60 * 60 * 2)

Definition at line 162 of file sdlz.c.

Referenced by dns_sdlz_putsoa().

#define SDLZ_DEFAULT_EXPIRE   (60 * 60 * 24 * 7)

Definition at line 163 of file sdlz.c.

Referenced by dns_sdlz_putsoa().

#define SDLZ_DEFAULT_MINIMUM   (60 * 60 * 24)

Definition at line 164 of file sdlz.c.

Referenced by dns_sdlz_putsoa().

#define SDLZ_DEFAULT_TTL   (60 * 60 * 24)

Definition at line 167 of file sdlz.c.

Referenced by dns_sdlz_putsoa().

#define MAYBE_LOCK ( imp   ) 

Value:

do { \
                unsigned int flags = imp->flags; \
                if ((flags & DNS_SDLZFLAG_THREADSAFE) == 0) \
                        LOCK(&imp->driverlock); \
        } while (0)

Definition at line 173 of file sdlz.c.

#define MAYBE_UNLOCK ( imp   ) 

Value:

do { \
                unsigned int flags = imp->flags; \
                if ((flags & DNS_SDLZFLAG_THREADSAFE) == 0) \
                        UNLOCK(&imp->driverlock); \
        } while (0)

Definition at line 180 of file sdlz.c.


Typedef Documentation

typedef struct dns_sdlzlookup dns_sdlznode_t

Definition at line 129 of file sdlz.c.

typedef dns_sdlzallnodes_t sdlz_dbiterator_t

Definition at line 138 of file sdlz.c.

typedef struct sdlz_rdatasetiter sdlz_rdatasetiter_t


Function Documentation

static isc_result_t getnodedata ( dns_db_t db,
dns_name_t name,
isc_boolean_t  create,
unsigned int  options,
dns_clientinfomethods_t methods,
dns_clientinfo_t clientinfo,
dns_dbnode_t **  nodep 
) [static]

Definition at line 544 of file sdlz.c.

References dns_sdlzmethods::authority, dns_sdlz_db::common, createnode(), dns_sdlz_db::dbdata, destroynode(), dns_sdlz_db::dlzimp, DNS_DBFIND_NOWILD, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_countlabels(), dns_name_dup(), dns_name_equal(), dns_name_getlabelsequence(), dns_name_init(), DNS_NAME_MAXTEXT, dns_name_totext(), dns_sdlz_tolower(), DNS_SDLZFLAG_RELATIVEOWNER, dns_wildcardname, dns_sdlzimplementation::driverarg, fixed, dns_sdlzimplementation::flags, isc_buffer_init, isc_buffer_putuint8, ISC_FALSE, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOTFOUND, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_TRUE, dns_sdlzmethods::lookup, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, dns_sdlzimplementation::methods, dns_sdlzmethods::newversion, dns_db::origin, REQUIRE, dns_sdlzlookup::sdlz, VALID_SDLZDB, and wild.

Referenced by findext(), findnode(), findnodeext(), and getoriginnode().

static void list_tordataset ( dns_rdatalist_t rdatalist,
dns_db_t db,
dns_dbnode_t node,
dns_rdataset_t rdataset 
) [static]

Definition at line 1491 of file sdlz.c.

References dns_db_attachnode(), dns_rdatalist_tordataset(), ISC_R_SUCCESS, dns_rdataset::methods, dns_rdataset::private5, and RUNTIME_CHECK.

static void detachnode ( dns_db_t db,
dns_dbnode_t **  targetp 
) [static]

Definition at line 753 of file sdlz.c.

References destroynode(), INSIST, ISC_FALSE, ISC_TRUE, LOCK, REQUIRE, dns_sdlzlookup::sdlz, UNLOCK, UNUSED, and VALID_SDLZDB.

static void dbiterator_destroy ( dns_dbiterator_t **  iteratorp  )  [static]

Definition at line 1344 of file sdlz.c.

References dns_sdlz_db::common, dns_sdlzallnodes::common, dns_dbiterator::db, destroynode(), dns_db_detach(), ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, dns_db::mctx, and dns_sdlzlookup::sdlz.

static isc_result_t dbiterator_first ( dns_dbiterator_t iterator  )  [static]

Definition at line 1362 of file sdlz.c.

References ISC_LIST_HEAD, ISC_R_NOMORE, and ISC_R_SUCCESS.

static isc_result_t dbiterator_last ( dns_dbiterator_t iterator  )  [static]

Definition at line 1373 of file sdlz.c.

References ISC_LIST_TAIL, ISC_R_NOMORE, and ISC_R_SUCCESS.

static isc_result_t dbiterator_seek ( dns_dbiterator_t iterator,
dns_name_t name 
) [static]

Definition at line 1384 of file sdlz.c.

References dns_name_equal(), ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOTFOUND, and ISC_R_SUCCESS.

static isc_result_t dbiterator_prev ( dns_dbiterator_t iterator  )  [static]

Definition at line 1397 of file sdlz.c.

References ISC_LIST_PREV, ISC_R_NOMORE, and ISC_R_SUCCESS.

static isc_result_t dbiterator_next ( dns_dbiterator_t iterator  )  [static]

Definition at line 1408 of file sdlz.c.

References ISC_LIST_NEXT, ISC_R_NOMORE, and ISC_R_SUCCESS.

static isc_result_t dbiterator_current ( dns_dbiterator_t iterator,
dns_dbnode_t **  nodep,
dns_name_t name 
) [static]

Definition at line 1419 of file sdlz.c.

References attachnode(), dns_dbiterator::db, dns_name_copy(), and ISC_R_SUCCESS.

static isc_result_t dbiterator_pause ( dns_dbiterator_t iterator  )  [static]

Definition at line 1431 of file sdlz.c.

References ISC_R_SUCCESS, and UNUSED.

static isc_result_t dbiterator_origin ( dns_dbiterator_t iterator,
dns_name_t name 
) [static]

Definition at line 1437 of file sdlz.c.

References dns_name_copy(), dns_rootname, and UNUSED.

static void sdlz_log ( int  level,
const char *  fmt,
  ... 
) [static]

Definition at line 237 of file sdlz.c.

References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG, and isc_log_vwrite().

Referenced by closeversion(), dns_sdlzcreate(), dns_sdlzdestroy(), dns_sdlzregister(), dns_sdlzunregister(), getoriginnode(), and newversion().

static void dns_sdlz_tolower ( char *  str  )  [static]

Converts the input string to lowercase, in place.

Definition at line 248 of file sdlz.c.

Referenced by createiterator(), dns_sdlzallowzonexfr(), dns_sdlzfindzone(), and getnodedata().

static unsigned int initial_size ( const char *  data  )  [inline, static]

Definition at line 259 of file sdlz.c.

static void rdatasetiter_destroy ( dns_rdatasetiter_t **  iteratorp  )  [static]

Definition at line 270 of file sdlz.c.

References sdlz_rdatasetiter::common, dns_rdatasetiter::db, detachnode(), isc_mem_put, dns_db::mctx, and dns_rdatasetiter::node.

static isc_result_t rdatasetiter_first ( dns_rdatasetiter_t iterator  )  [static]

Definition at line 281 of file sdlz.c.

References sdlz_rdatasetiter::current, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_R_NOMORE, ISC_R_SUCCESS, and dns_rdatasetiter::node.

static isc_result_t rdatasetiter_next ( dns_rdatasetiter_t iterator  )  [static]

Definition at line 292 of file sdlz.c.

References sdlz_rdatasetiter::current, ISC_LIST_NEXT, ISC_R_NOMORE, and ISC_R_SUCCESS.

static void rdatasetiter_current ( dns_rdatasetiter_t iterator,
dns_rdataset_t rdataset 
) [static]

Definition at line 303 of file sdlz.c.

References sdlz_rdatasetiter::current, dns_rdatasetiter::db, list_tordataset(), and dns_rdatasetiter::node.

static void attach ( dns_db_t source,
dns_db_t **  targetp 
) [static]

Definition at line 323 of file sdlz.c.

References LOCK, dns_sdlz_db::refcnt_lock, dns_sdlz_db::references, REQUIRE, dns_sdlzlookup::sdlz, UNLOCK, and VALID_SDLZDB.

static void destroy ( dns_sdlz_db_t sdlz  )  [static]

Definition at line 337 of file sdlz.c.

References dns_sdlz_db::common, dns_name_free(), dns_db::impmagic, isc_mem_detach(), isc_mem_put, isc_mutex_destroy, dns_db::magic, dns_db::mctx, mctx, dns_db::origin, and dns_sdlz_db::refcnt_lock.

static void detach ( dns_db_t **  dbp  )  [static]

Definition at line 353 of file sdlz.c.

References destroy(), ISC_FALSE, ISC_TRUE, LOCK, dns_sdlz_db::refcnt_lock, dns_sdlz_db::references, REQUIRE, dns_sdlzlookup::sdlz, UNLOCK, and VALID_SDLZDB.

static isc_result_t beginload ( dns_db_t db,
dns_rdatacallbacks_t callbacks 
) [static]

Definition at line 372 of file sdlz.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

static isc_result_t endload ( dns_db_t db,
dns_rdatacallbacks_t callbacks 
) [static]

Definition at line 379 of file sdlz.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

static isc_result_t dump ( dns_db_t db,
dns_dbversion_t version,
const char *  filename,
dns_masterformat_t  masterformat 
) [static]

Definition at line 386 of file sdlz.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

static void currentversion ( dns_db_t db,
dns_dbversion_t **  versionp 
) [static]

Definition at line 397 of file sdlz.c.

References dns_sdlz_db::dummy_version, REQUIRE, dns_sdlzlookup::sdlz, and VALID_SDLZDB.

static isc_result_t newversion ( dns_db_t db,
dns_dbversion_t **  versionp 
) [static]

Definition at line 407 of file sdlz.c.

References dns_sdlz_db::common, dns_sdlz_db::dbdata, dns_sdlz_db::dlzimp, dns_name_format(), DNS_NAME_MAXTEXT, dns_sdlzimplementation::driverarg, dns_sdlz_db::future_version, ISC_LOG_ERROR, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_result_totext(), dns_sdlzimplementation::methods, dns_sdlzmethods::newversion, dns_db::origin, origin, REQUIRE, dns_sdlzlookup::sdlz, sdlz_log(), and VALID_SDLZDB.

static void attachversion ( dns_db_t db,
dns_dbversion_t source,
dns_dbversion_t **  targetp 
) [static]

Definition at line 434 of file sdlz.c.

References dns_sdlz_db::dummy_version, REQUIRE, dns_sdlzlookup::sdlz, and VALID_SDLZDB.

static void closeversion ( dns_db_t db,
dns_dbversion_t **  versionp,
isc_boolean_t  commit 
) [static]

Definition at line 445 of file sdlz.c.

References dns_sdlzmethods::closeversion, dns_sdlz_db::common, dns_sdlz_db::dbdata, dns_sdlz_db::dlzimp, dns_name_format(), DNS_NAME_MAXTEXT, dns_sdlzimplementation::driverarg, dns_sdlz_db::dummy_version, dns_sdlz_db::future_version, ISC_LOG_ERROR, dns_sdlzimplementation::methods, dns_db::origin, origin, REQUIRE, dns_sdlzlookup::sdlz, sdlz_log(), and VALID_SDLZDB.

static isc_result_t createnode ( dns_sdlz_db_t sdlz,
dns_sdlznode_t **  nodep 
) [static]

Definition at line 473 of file sdlz.c.

References attach(), dns_sdlz_db::common, dns_rdatacallbacks_init(), ISC_LINK_INIT, ISC_LIST_INIT, isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_result_totext(), dns_sdlzlookup::magic, dns_db::mctx, dns_sdlzlookup::sdlz, SDLZLOOKUP_MAGIC, and UNEXPECTED_ERROR.

static void destroynode ( dns_sdlznode_t node  )  [static]

Definition at line 504 of file sdlz.c.

References dns_sdlz_db::common, DESTROYLOCK, detach(), dns_name_free(), isc_buffer_free(), ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, dns_sdlzlookup::magic, dns_db::mctx, mctx, and dns_sdlzlookup::sdlz.

static isc_result_t findnodeext ( dns_db_t db,
dns_name_t name,
isc_boolean_t  create,
dns_clientinfomethods_t methods,
dns_clientinfo_t clientinfo,
dns_dbnode_t **  nodep 
) [static]

Definition at line 703 of file sdlz.c.

References getnodedata().

static isc_result_t findnode ( dns_db_t db,
dns_name_t name,
isc_boolean_t  create,
dns_dbnode_t **  nodep 
) [static]

Definition at line 711 of file sdlz.c.

References getnodedata().

static isc_result_t findzonecut ( dns_db_t db,
dns_name_t name,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 718 of file sdlz.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

static void attachnode ( dns_db_t db,
dns_dbnode_t source,
dns_dbnode_t **  targetp 
) [static]

Definition at line 735 of file sdlz.c.

References INSIST, LOCK, REQUIRE, dns_sdlzlookup::sdlz, UNLOCK, UNUSED, and VALID_SDLZDB.

static isc_result_t expirenode ( dns_db_t db,
dns_dbnode_t node,
isc_stdtime_t  now 
) [static]

Definition at line 779 of file sdlz.c.

References INSIST, ISC_R_UNEXPECTED, and UNUSED.

static void printnode ( dns_db_t db,
dns_dbnode_t node,
FILE *  out 
) [static]

Definition at line 788 of file sdlz.c.

References UNUSED.

static isc_result_t createiterator ( dns_db_t db,
unsigned int  options,
dns_dbiterator_t **  iteratorp 
) [static]

Definition at line 796 of file sdlz.c.

References dns_sdlzmethods::allnodes, dns_sdlzallnodes::common, dns_sdlz_db::common, dns_dbiterator::db, dns_sdlz_db::dbdata, dbiterator_destroy(), dns_sdlz_db::dlzimp, dns_db_attach(), DNS_DB_NONSEC3, DNS_DB_NSEC3ONLY, DNS_DB_RELATIVENAMES, DNS_DBITERATOR_MAGIC, DNS_NAME_MAXTEXT, dns_name_totext(), dns_sdlz_tolower(), dns_sdlzimplementation::driverarg, isc_buffer_init, isc_buffer_putuint8, ISC_LIST_INIT, ISC_LIST_PREPEND, ISC_LIST_UNLINK, isc_mem_get, ISC_R_NOMEMORY, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_TF, ISC_TRUE, dns_dbiterator::magic, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, dns_dbiterator::methods, dns_sdlzimplementation::methods, dns_db::origin, dns_dbiterator::relative_names, REQUIRE, dns_sdlzlookup::sdlz, and VALID_SDLZDB.

static isc_result_t findrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdatatype_t  type,
dns_rdatatype_t  covers,
isc_stdtime_t  now,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 857 of file sdlz.c.

References ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOTFOUND, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, list_tordataset(), REQUIRE, dns_rdatalist::type, UNUSED, and VALID_SDLZNODE.

static isc_result_t findext ( dns_db_t db,
dns_name_t name,
dns_dbversion_t version,
dns_rdatatype_t  type,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_clientinfomethods_t methods,
dns_clientinfo_t clientinfo,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 891 of file sdlz.c.

References destroynode(), detachnode(), DNS_DBFIND_GLUEOK, DNS_DBFIND_NOZONECUT, dns_fixedname_init, dns_fixedname_name, dns_name_copy(), dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_issubdomain(), DNS_R_BADDB, DNS_R_CNAME, DNS_R_DELEGATION, DNS_R_DNAME, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_ZONECUT, dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_sdlz_db::dummy_version, findrdataset(), dns_sdlz_db::future_version, getnodedata(), ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_db::origin, REQUIRE, dns_sdlzlookup::sdlz, search(), UNUSED, and VALID_SDLZDB.

static isc_result_t find ( dns_db_t db,
dns_name_t name,
dns_dbversion_t version,
dns_rdatatype_t  type,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 1061 of file sdlz.c.

References findext().

static isc_result_t allrdatasets ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
isc_stdtime_t  now,
dns_rdatasetiter_t **  iteratorp 
) [static]

Definition at line 1071 of file sdlz.c.

References attachnode(), sdlz_rdatasetiter::common, dns_rdatasetiter::db, DNS_RDATASETITER_MAGIC, dns_sdlz_db::dummy_version, dns_sdlz_db::future_version, isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_rdatasetiter::magic, dns_db::mctx, dns_rdatasetiter::methods, dns_rdatasetiter::node, dns_rdatasetiter::now, REQUIRE, dns_sdlzlookup::sdlz, UNUSED, VALID_SDLZDB, and dns_rdatasetiter::version.

static isc_result_t modrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdataset_t rdataset,
unsigned int  options,
dns_sdlzmodrdataset_t  mod_function 
) [static]

Definition at line 1104 of file sdlz.c.

References buffer, cleanup(), dns_sdlz_db::common, dns_sdlz_db::dbdata, dns_sdlz_db::dlzimp, dns_master_rdatasettotext(), dns_master_stylecreate(), dns_master_styledestroy(), dns_name_format(), DNS_NAME_MAXTEXT, dns_sdlzimplementation::driverarg, isc_buffer_allocate(), isc_buffer_base, isc_buffer_free(), isc_buffer_usedlength, ISC_R_BADADDRESSFORM, ISC_R_NOMEMORY, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, mctx, REQUIRE, dns_sdlzlookup::sdlz, style, UNUSED, and VALID_SDLZDB.

Referenced by addrdataset(), and subtractrdataset().

static isc_result_t addrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
isc_stdtime_t  now,
dns_rdataset_t rdataset,
unsigned int  options,
dns_rdataset_t addedrdataset 
) [static]

Definition at line 1169 of file sdlz.c.

References dns_sdlzmethods::addrdataset, dns_sdlz_db::dlzimp, ISC_R_NOTIMPLEMENTED, dns_sdlzimplementation::methods, modrdataset(), REQUIRE, dns_sdlzlookup::sdlz, UNUSED, and VALID_SDLZDB.

static isc_result_t subtractrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdataset_t rdataset,
unsigned int  options,
dns_rdataset_t newrdataset 
) [static]

Definition at line 1190 of file sdlz.c.

References dns_sdlz_db::dlzimp, ISC_R_NOTIMPLEMENTED, dns_sdlzimplementation::methods, modrdataset(), REQUIRE, dns_sdlzlookup::sdlz, dns_sdlzmethods::subtractrdataset, UNUSED, and VALID_SDLZDB.

static isc_result_t deleterdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdatatype_t  type,
dns_rdatatype_t  covers 
) [static]

Definition at line 1210 of file sdlz.c.

References dns_sdlz_db::dbdata, dns_sdlzmethods::delrdataset, dns_sdlz_db::dlzimp, dns_name_format(), DNS_NAME_MAXTEXT, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, dns_sdlzimplementation::driverarg, ISC_R_NOTIMPLEMENTED, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, REQUIRE, dns_sdlzlookup::sdlz, UNUSED, and VALID_SDLZDB.

static isc_boolean_t issecure ( dns_db_t db  )  [static]

Definition at line 1240 of file sdlz.c.

References ISC_FALSE, and UNUSED.

static unsigned int nodecount ( dns_db_t db  )  [static]

Definition at line 1247 of file sdlz.c.

References UNUSED.

static isc_boolean_t ispersistent ( dns_db_t db  )  [static]

Definition at line 1254 of file sdlz.c.

References ISC_TRUE, and UNUSED.

static void overmem ( dns_db_t db,
isc_boolean_t  over 
) [static]

Definition at line 1260 of file sdlz.c.

References UNUSED.

static void settask ( dns_db_t db,
isc_task_t task 
) [static]

Definition at line 1266 of file sdlz.c.

References UNUSED.

static isc_result_t getoriginnode ( dns_db_t db,
dns_dbnode_t **  nodep 
) [static]

Definition at line 1276 of file sdlz.c.

References dns_sdlz_db::common, dns_sdlz_db::dlzimp, getnodedata(), ISC_FALSE, ISC_LOG_ERROR, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_result_totext(), dns_sdlzimplementation::methods, dns_sdlzmethods::newversion, dns_db::origin, REQUIRE, dns_sdlzlookup::sdlz, sdlz_log(), and VALID_SDLZDB.

static void disassociate ( dns_rdataset_t rdataset  )  [static]

Definition at line 1448 of file sdlz.c.

References detachnode(), isc__rdatalist_disassociate(), dns_rdataset::private5, and dns_sdlzlookup::sdlz.

static void rdataset_clone ( dns_rdataset_t source,
dns_rdataset_t target 
) [static]

Definition at line 1458 of file sdlz.c.

References attachnode(), isc__rdatalist_clone(), dns_rdataset::private5, and dns_sdlzlookup::sdlz.

static isc_result_t dns_sdlzcreateDBP ( isc_mem_t mctx,
void *  driverarg,
void *  dbdata,
dns_name_t name,
dns_rdataclass_t  rdclass,
dns_db_t **  dbp 
) [static]

Build a 'bind' database driver structure to be returned by either the find zone or the allow zone transfer method. This method is only available in this source file, it is not made available anywhere else.

Definition at line 1522 of file sdlz.c.

References dns_db::attributes, dns_sdlz_db::common, dns_sdlz_db::dbdata, dns_sdlz_db::dlzimp, DNS_DB_MAGIC, dns_name_dupwithoffsets(), dns_name_free(), dns_name_init(), dns_db::impmagic, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_db::magic, dns_db::mctx, dns_db::methods, dns_db::origin, dns_db::rdclass, dns_sdlz_db::refcnt_lock, dns_sdlz_db::references, REQUIRE, and SDLZDB_MAGIC.

Referenced by dns_sdlz_setdb(), dns_sdlzallowzonexfr(), and dns_sdlzfindzone().

static isc_result_t dns_sdlzallowzonexfr ( void *  driverarg,
void *  dbdata,
isc_mem_t mctx,
dns_rdataclass_t  rdclass,
dns_name_t name,
isc_sockaddr_t clientaddr,
dns_db_t **  dbp 
) [static]

Definition at line 1583 of file sdlz.c.

References dns_sdlzmethods::allowzonexfr, DNS_NAME_MAXTEXT, dns_name_totext(), dns_sdlz_tolower(), dns_sdlzcreateDBP(), dns_sdlzimplementation::driverarg, isc_buffer_init, isc_buffer_putuint8, isc_netaddr_fromsockaddr(), isc_netaddr_totext(), ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_TRUE, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, and REQUIRE.

static isc_result_t dns_sdlzcreate ( isc_mem_t mctx,
const char *  dlzname,
unsigned int  argc,
char *  argv[],
void *  driverarg,
void **  dbdata 
) [static]

Definition at line 1645 of file sdlz.c.

References dns_sdlzmethods::create, dns_sdlzimplementation::driverarg, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_R_NOTFOUND, ISC_R_SUCCESS, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, REQUIRE, sdlz_log(), and UNUSED.

static void dns_sdlzdestroy ( void *  driverdata,
void **  dbdata 
) [static]

Definition at line 1683 of file sdlz.c.

References dns_sdlzmethods::destroy, dns_sdlzimplementation::driverarg, ISC_LOG_DEBUG, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, and sdlz_log().

static isc_result_t dns_sdlzfindzone ( void *  driverarg,
void *  dbdata,
isc_mem_t mctx,
dns_rdataclass_t  rdclass,
dns_name_t name,
dns_clientinfomethods_t methods,
dns_clientinfo_t clientinfo,
dns_db_t **  dbp 
) [static]

Definition at line 1700 of file sdlz.c.

References DNS_NAME_MAXTEXT, dns_name_totext(), dns_sdlz_tolower(), dns_sdlzcreateDBP(), dns_sdlzimplementation::driverarg, dns_sdlzmethods::findzone, isc_buffer_init, isc_buffer_putuint8, ISC_R_SUCCESS, ISC_TRUE, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, and REQUIRE.

static isc_result_t dns_sdlzconfigure ( void *  driverarg,
void *  dbdata,
dns_view_t view,
dns_dlzdb_t dlzdb 
) [static]

Definition at line 1749 of file sdlz.c.

References dns_sdlzmethods::configure, dns_sdlzimplementation::driverarg, ISC_R_SUCCESS, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, and REQUIRE.

static isc_boolean_t dns_sdlzssumatch ( dns_name_t signer,
dns_name_t name,
isc_netaddr_t tcpaddr,
dns_rdatatype_t  type,
const dst_key_t key,
void *  driverarg,
void *  dbdata 
) [static]

Definition at line 1773 of file sdlz.c.

References isc_region::base, dns_name_format(), DNS_NAME_FORMATSIZE, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, dns_sdlzimplementation::driverarg, dst_key_format(), DST_KEY_FORMATSIZE, dst_key_tkeytoken(), isc_buffer_region, ISC_FALSE, isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, isc_region::length, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdlzimplementation::methods, REQUIRE, and dns_sdlzmethods::ssumatch.

isc_result_t dns_sdlz_putrr ( dns_sdlzlookup_t lookup,
const char *  type,
dns_ttl_t  ttl,
const char *  data 
)

Definition at line 1846 of file sdlz.c.

References isc_consttextregion::base, dns_sdlz_db::common, dns_sdlz_db::dlzimp, dns_rdata_fromtext(), dns_rdata_init(), dns_rdatalist_init(), dns_rdatatype_fromtext(), dns_rootname, DNS_SDLZFLAG_RELATIVERDATA, dns_sdlzimplementation::flags, initial_size(), isc_buffer_add, isc_buffer_allocate(), isc_buffer_constinit, isc_buffer_free(), ISC_FALSE, isc_lex_create(), isc_lex_destroy(), isc_lex_openbuffer(), ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_consttextregion::length, dns_db::mctx, mctx, dns_db::origin, origin, r, dns_db::rdclass, dns_rdatalist::rdclass, REQUIRE, dns_sdlzlookup::sdlz, dns_rdatalist::ttl, dns_rdatalist::type, and VALID_SDLZLOOKUP.

isc_result_t dns_sdlz_putnamedrr ( dns_sdlzallnodes_t allnodes,
const char *  name,
const char *  type,
dns_ttl_t  ttl,
const char *  data 
)

Definition at line 1966 of file sdlz.c.

References dns_sdlz_db::common, dns_sdlzallnodes::common, createnode(), dns_dbiterator::db, destroynode(), dns_sdlz_db::dlzimp, dns_fixedname_init, dns_fixedname_name, dns_name_countlabels(), dns_name_dup(), dns_name_equal(), dns_name_fromtext(), dns_name_getlabelsequence(), dns_name_init(), dns_rootname, dns_sdlz_putrr, DNS_SDLZFLAG_RELATIVERDATA, dns_sdlzimplementation::flags, isc_buffer_add, isc_buffer_constinit, ISC_LIST_HEAD, ISC_LIST_PREPEND, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_db::mctx, mctx, dns_db::origin, origin, dns_dbiterator::relative_names, and dns_sdlzlookup::sdlz.

isc_result_t dns_sdlz_putsoa ( dns_sdlzlookup_t lookup,
const char *  mname,
const char *  rname,
isc_uint32_t  serial 
)

Definition at line 2025 of file sdlz.c.

References DNS_NAME_MAXTEXT, dns_sdlz_putrr, ISC_R_NOSPACE, REQUIRE, SDLZ_DEFAULT_EXPIRE, SDLZ_DEFAULT_MINIMUM, SDLZ_DEFAULT_REFRESH, SDLZ_DEFAULT_RETRY, SDLZ_DEFAULT_TTL, and str.

isc_result_t dns_sdlzregister ( const char *  drivername,
const dns_sdlzmethods_t methods,
void *  driverarg,
unsigned int  flags,
isc_mem_t mctx,
dns_sdlzimplementation_t **  sdlzimp 
)

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

sdlzimp must point to a NULL dns_sdlzimplementation_t pointer. That is, sdlzimp != NULL && *sdlzimp == NULL. It will be assigned a value that will later be used to identify the driver when deregistering it.

Definition at line 2044 of file sdlz.c.

References DESTROYLOCK, dns_sdlzimplementation::dlz_imp, dns_dlzregister(), DNS_SDLZFLAG_RELATIVEOWNER, DNS_SDLZFLAG_RELATIVERDATA, DNS_SDLZFLAG_THREADSAFE, dns_sdlzimplementation::driverarg, dns_sdlzimplementation::driverlock, dns_sdlzmethods::findzone, dns_sdlzimplementation::flags, ISC_LOG_DEBUG, isc_mem_attach(), isc_mem_detach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_result_totext(), dns_sdlzmethods::lookup, dns_sdlzimplementation::mctx, dns_sdlzimplementation::methods, REQUIRE, sdlz_log(), and UNEXPECTED_ERROR.

void dns_sdlzunregister ( dns_sdlzimplementation_t **  sdlzimp  ) 

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

Definition at line 2134 of file sdlz.c.

References DESTROYLOCK, dns_sdlzimplementation::dlz_imp, dns_dlzunregister(), dns_sdlzimplementation::driverlock, ISC_LOG_DEBUG, isc_mem_detach(), isc_mem_put, dns_sdlzimplementation::mctx, mctx, REQUIRE, and sdlz_log().

isc_result_t dns_sdlz_setdb ( dns_dlzdb_t dlzdatabase,
dns_rdataclass_t  rdclass,
dns_name_t name,
dns_db_t **  dbp 
)

Definition at line 2168 of file sdlz.c.

References dns_dlzdb::dbdata, dns_sdlzcreateDBP(), dns_dlzimplementation::driverarg, dns_dlzdb::implementation, and dns_dlzdb::mctx.


Variable Documentation

dns_dbiteratormethods_t dbiterator_methods [static]

Initial value:

Definition at line 217 of file sdlz.c.

dns_rdatasetitermethods_t rdatasetiter_methods [static]

Initial value:

Definition at line 310 of file sdlz.c.

dns_dbmethods_t sdlzdb_methods [static]

Definition at line 1292 of file sdlz.c.

dns_rdatasetmethods_t rdataset_methods [static]

Initial value:

Definition at line 1469 of file sdlz.c.

dns_dlzmethods_t sdlzmethods [static]

Initial value:

Definition at line 1832 of file sdlz.c.


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