sdb.c File Reference

#include <config.h>
#include <string.h>
#include <isc/buffer.h>
#include <isc/lex.h>
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/util.h>
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/dbiterator.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/sdb.h>
#include <dns/types.h>
#include "rdatalist_p.h"

Go to the source code of this file.

Data Structures

struct  dns_sdbimplementation
struct  dns_sdb
struct  dns_sdblookup
struct  dns_sdballnodes
struct  sdb_rdatasetiter

Defines

#define SDB_MAGIC   ISC_MAGIC('S', 'D', 'B', '-')
#define VALID_SDB(sdb)
 Note that "impmagic" is not the first four bytes of the struct, so ISC_MAGIC_VALID cannot be used.
#define SDBLOOKUP_MAGIC   ISC_MAGIC('S','D','B','L')
#define VALID_SDBLOOKUP(sdbl)   ISC_MAGIC_VALID(sdbl, SDBLOOKUP_MAGIC)
#define VALID_SDBNODE(sdbn)   VALID_SDBLOOKUP(sdbn)
#define SDB_DEFAULT_REFRESH   (60 * 60 * 8)
#define SDB_DEFAULT_RETRY   (60 * 60 * 2)
#define SDB_DEFAULT_EXPIRE   (60 * 60 * 24 * 7)
#define SDB_DEFAULT_MINIMUM   (60 * 60 * 24)
#define SDB_DEFAULT_TTL   (60 * 60 * 24)
#define MAYBE_LOCK(sdb)
#define MAYBE_UNLOCK(sdb)

Typedefs

typedef struct dns_sdblookup dns_sdbnode_t
typedef dns_sdballnodes_t sdb_dbiterator_t
typedef struct sdb_rdatasetiter sdb_rdatasetiter_t

Functions

static isc_result_t dns_sdb_create (isc_mem_t *mctx, dns_name_t *origin, dns_dbtype_t type, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], void *driverarg, dns_db_t **dbp)
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 createnode (dns_sdb_t *sdb, dns_sdbnode_t **nodep)
static void destroynode (dns_sdbnode_t *node)
static void detachnode (dns_db_t *db, dns_dbnode_t **targetp)
static void list_tordataset (dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node, dns_rdataset_t *rdataset)
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 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)
isc_result_t dns_sdb_register (const char *drivername, const dns_sdbmethods_t *methods, void *driverdata, unsigned int flags, isc_mem_t *mctx, dns_sdbimplementation_t **sdbimp)
 Register a simple database driver for the database type 'drivername', implemented by the functions in '*methods'.
void dns_sdb_unregister (dns_sdbimplementation_t **sdbimp)
 Removes the simple database driver from the list of registered database types. There must be no active databases of this type when this function is called.
static unsigned int initial_size (unsigned int len)
isc_result_t dns_sdb_putrdata (dns_sdblookup_t *lookup, dns_rdatatype_t typeval, dns_ttl_t ttl, const unsigned char *rdatap, unsigned int rdlen)
 Add a single resource record to the lookup structure to be returned in the query response. dns_sdb_putrr() takes the resource record in master file text format as a null-terminated string, and dns_sdb_putrdata() takes the raw RDATA in uncompressed wire format.
isc_result_t dns_sdb_putrr (dns_sdblookup_t *lookup, const char *type, dns_ttl_t ttl, const char *data)
 See dns_sdb_putradata().
static isc_result_t getnode (dns_sdballnodes_t *allnodes, const char *name, dns_sdbnode_t **nodep)
isc_result_t dns_sdb_putnamedrr (dns_sdballnodes_t *allnodes, const char *name, const char *type, dns_ttl_t ttl, const char *data)
 See dns_sdb_putnamerdata().
isc_result_t dns_sdb_putnamedrdata (dns_sdballnodes_t *allnodes, const char *name, dns_rdatatype_t type, dns_ttl_t ttl, const void *rdata, unsigned int rdlen)
 Add a single resource record to the allnodes structure to be included in a zone transfer response, in text or wire format as above.
isc_result_t dns_sdb_putsoa (dns_sdblookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial)
 This function may optionally be called from the 'authority' callback to simplify construction of the SOA record for 'zone'. It will provide a SOA listing 'mname' as as the master server and 'rname' as the responsible person mailbox. It is the responsibility of the driver to increment the serial number between responses if necessary. All other SOA fields will have reasonable default values.
static void attach (dns_db_t *source, dns_db_t **targetp)
static void destroy (dns_sdb_t *sdb)
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 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 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 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 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 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 void disassociate (dns_rdataset_t *rdataset)
static void rdataset_clone (dns_rdataset_t *source, dns_rdataset_t *target)

Variables

static int dummy
static dns_dbiteratormethods_t dbiterator_methods
static dns_rdatasetitermethods_t rdatasetiter_methods
static dns_dbmethods_t sdb_methods
static dns_rdatasetmethods_t methods


Detailed Description

Definition in file sdb.c.


Define Documentation

#define SDB_MAGIC   ISC_MAGIC('S', 'D', 'B', '-')

Definition at line 102 of file sdb.c.

Referenced by dns_sdb_create().

#define VALID_SDB ( sdb   ) 

Value:

((sdb) != NULL && \
                                 (sdb)->common.impmagic == SDB_MAGIC)
Note that "impmagic" is not the first four bytes of the struct, so ISC_MAGIC_VALID cannot be used.

Definition at line 108 of file sdb.c.

Referenced by attach(), attachnode(), createiterator(), detach(), detachnode(), findext(), and findnodeext().

#define SDBLOOKUP_MAGIC   ISC_MAGIC('S','D','B','L')

Definition at line 111 of file sdb.c.

Referenced by createnode().

#define VALID_SDBLOOKUP ( sdbl   )     ISC_MAGIC_VALID(sdbl, SDBLOOKUP_MAGIC)

Definition at line 112 of file sdb.c.

Referenced by dns_sdb_putrr().

#define VALID_SDBNODE ( sdbn   )     VALID_SDBLOOKUP(sdbn)

Definition at line 113 of file sdb.c.

Referenced by findrdataset().

#define SDB_DEFAULT_REFRESH   (60 * 60 * 8)

Definition at line 116 of file sdb.c.

Referenced by dns_sdb_putsoa().

#define SDB_DEFAULT_RETRY   (60 * 60 * 2)

Definition at line 117 of file sdb.c.

Referenced by dns_sdb_putsoa().

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

Definition at line 118 of file sdb.c.

Referenced by dns_sdb_putsoa().

#define SDB_DEFAULT_MINIMUM   (60 * 60 * 24)

Definition at line 119 of file sdb.c.

Referenced by dns_sdb_putsoa().

#define SDB_DEFAULT_TTL   (60 * 60 * 24)

Definition at line 122 of file sdb.c.

Referenced by dns_sdb_putsoa().

#define MAYBE_LOCK ( sdb   ) 

Value:

do {                                                            \
                unsigned int flags = sdb->implementation->flags;        \
                if ((flags & DNS_SDBFLAG_THREADSAFE) == 0)              \
                        LOCK(&sdb->implementation->driverlock);         \
        } while (0)

Definition at line 128 of file sdb.c.

Referenced by createiterator(), deleterdataset(), destroy(), dns_sdb_create(), dns_sdlzallowzonexfr(), dns_sdlzconfigure(), dns_sdlzcreate(), dns_sdlzdestroy(), dns_sdlzfindzone(), dns_sdlzssumatch(), findnodeext(), getnodedata(), and modrdataset().

#define MAYBE_UNLOCK ( sdb   ) 

Value:

do {                                                            \
                unsigned int flags = sdb->implementation->flags;        \
                if ((flags & DNS_SDBFLAG_THREADSAFE) == 0)              \
                        UNLOCK(&sdb->implementation->driverlock);       \
        } while (0)

Definition at line 135 of file sdb.c.

Referenced by createiterator(), deleterdataset(), destroy(), dns_sdb_create(), dns_sdlzallowzonexfr(), dns_sdlzconfigure(), dns_sdlzcreate(), dns_sdlzdestroy(), dns_sdlzfindzone(), dns_sdlzssumatch(), findnodeext(), getnodedata(), and modrdataset().


Typedef Documentation

typedef struct dns_sdblookup dns_sdbnode_t

Definition at line 86 of file sdb.c.

typedef dns_sdballnodes_t sdb_dbiterator_t

Definition at line 95 of file sdb.c.

typedef struct sdb_rdatasetiter sdb_rdatasetiter_t


Function Documentation

static isc_result_t dns_sdb_create ( isc_mem_t mctx,
dns_name_t origin,
dns_dbtype_t  type,
dns_rdataclass_t  rdclass,
unsigned int  argc,
char *  argv[],
void *  driverarg,
dns_db_t **  dbp 
) [static]

Definition at line 1305 of file sdb.c.

References dns_db::attributes, dns_sdb::common, dns_sdbmethods::create, dns_sdb::dbdata, DNS_DB_MAGIC, dns_dbtype_zone, dns_name_dupwithoffsets(), dns_name_free(), dns_name_init(), DNS_NAME_MAXTEXT, dns_name_totext(), dns_sdbimplementation::driverdata, dns_sdb::implementation, dns_db::impmagic, isc_buffer_init, isc_buffer_putuint8, isc_mem_attach(), isc_mem_detach(), isc_mem_free, isc_mem_get, isc_mem_put, isc_mem_strdup, isc_mutex_destroy, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_TRUE, dns_sdb::lock, dns_db::magic, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, dns_sdbimplementation::methods, dns_db::methods, dns_db::origin, dns_db::rdclass, dns_sdb::references, REQUIRE, dns_sdblookup::sdb, SDB_MAGIC, and dns_sdb::zone.

Referenced by dns_sdb_register().

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 1120 of file sdb.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_SDBNODE.

Referenced by ATF_TC_BODY(), ATF_TP_ADD_TCS(), and findext().

static isc_result_t createnode ( dns_sdb_t sdb,
dns_sdbnode_t **  nodep 
) [static]

Definition at line 662 of file sdb.c.

References attach(), dns_sdb::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, dns_sdblookup::magic, dns_db::mctx, dns_sdblookup::sdb, and SDBLOOKUP_MAGIC.

Referenced by dns_sdlz_putnamedrr(), findnodeext(), getnode(), and getnodedata().

static void destroynode ( dns_sdbnode_t node  )  [static]

Definition at line 690 of file sdb.c.

References dns_sdb::common, DESTROYLOCK, detach(), dns_name_free(), isc_buffer_free(), ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, dns_sdblookup::magic, dns_db::mctx, mctx, and dns_sdblookup::sdb.

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

Definition at line 1029 of file sdb.c.

References destroynode(), INSIST, ISC_FALSE, ISC_TRUE, LOCK, REQUIRE, dns_sdblookup::sdb, UNLOCK, UNUSED, and VALID_SDB.

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

Definition at line 1437 of file sdb.c.

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

Referenced by findrdataset(), and rdatasetiter_current().

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

Definition at line 1460 of file sdb.c.

References dns_sdb::common, dns_sdballnodes::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_sdblookup::sdb.

static isc_result_t dbiterator_first ( dns_dbiterator_t iterator  )  [static]

Definition at line 1478 of file sdb.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 1489 of file sdb.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 1500 of file sdb.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 1513 of file sdb.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 1524 of file sdb.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 1535 of file sdb.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 1547 of file sdb.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 1553 of file sdb.c.

References dns_name_copy(), dns_rootname, and UNUSED.

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

Definition at line 1563 of file sdb.c.

References sdb_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 1572 of file sdb.c.

References sdb_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 1583 of file sdb.c.

References sdb_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 1594 of file sdb.c.

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

isc_result_t dns_sdb_register ( const char *  drivername,
const dns_sdbmethods_t methods,
void *  driverdata,
unsigned int  flags,
isc_mem_t mctx,
dns_sdbimplementation_t **  sdbimp 
)

Register a simple database driver for the database type 'drivername', implemented by the functions in '*methods'.

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

The name server will perform lookups in the database by calling the function 'lookup', passing it a printable zone name 'zone', a printable domain name 'name', and a copy of the argument 'dbdata' that was potentially returned by the create function. The 'dns_sdblookup_t' argument to 'lookup' and 'authority' is an opaque pointer to be passed to ns_sdb_putrr().

The lookup function returns the lookup results to the name server by calling ns_sdb_putrr() once for each record found. On success, the return value of the lookup function should be ISC_R_SUCCESS. If the domain name 'name' does not exist, the lookup function should ISC_R_NOTFOUND. Any other return value is treated as an error.

Lookups at the zone apex will cause the server to also call the function 'authority' (if non-NULL), which must provide an SOA record and NS records for the zone by calling ns_sdb_putrr() once for each of these records. The 'authority' function may be NULL if invoking the 'lookup' function on the zone apex will return SOA and NS records.

The allnodes function, if non-NULL, fills in an opaque structure to be used by a database iterator. This allows the zone to be transferred. This may use a considerable amount of memory for large zones, and the zone transfer may not be fully RFC1035 compliant if the zone is frequently changed.

The create function will be called for each zone configured into the name server using this database type. It can be used to create a "database object" containing zone specific data, which can make use of the database arguments specified in the name server configuration.

The destroy function will be called to free the database object when its zone is destroyed.

The create and destroy functions may be NULL.

If flags includes DNS_SDBFLAG_RELATIVEOWNER, the lookup and authority functions will be called with relative names rather than absolute names. The string "@" represents the zone apex in this case.

If flags includes DNS_SDBFLAG_RELATIVERDATA, the rdata strings may include relative names. Otherwise, all names in the rdata string must be absolute. Be aware that if relative names are allowed, any absolute names must contain a trailing dot.

If flags includes DNS_SDBFLAG_THREADSAFE, the driver must be able to handle multiple lookups in parallel. Otherwise, calls into the driver are serialized.

Definition at line 210 of file sdb.c.

References dns_sdbimplementation::dbimp, DESTROYLOCK, dns_db_register(), dns_sdb_create(), DNS_SDBFLAG_DNS64, DNS_SDBFLAG_RELATIVEOWNER, DNS_SDBFLAG_RELATIVERDATA, DNS_SDBFLAG_THREADSAFE, dns_sdbimplementation::driverdata, dns_sdbimplementation::driverlock, dns_sdbimplementation::flags, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_sdbmethods::lookup, dns_sdbmethods::lookup2, dns_sdbimplementation::mctx, dns_sdbimplementation::methods, and REQUIRE.

Referenced by ns_builtin_init().

void dns_sdb_unregister ( dns_sdbimplementation_t **  sdbimp  ) 

Removes the simple database driver from the list of registered database types. There must be no active databases of this type when this function is called.

Definition at line 256 of file sdb.c.

References dns_sdbimplementation::dbimp, DESTROYLOCK, dns_db_unregister(), dns_sdbimplementation::driverlock, isc_mem_detach(), isc_mem_put, dns_sdbimplementation::mctx, mctx, and REQUIRE.

Referenced by ns_builtin_deinit().

static unsigned int initial_size ( unsigned int  len  )  [inline, static]

Definition at line 274 of file sdb.c.

Referenced by dns_sdb_putrr(), and dns_sdlz_putrr().

isc_result_t dns_sdb_putrdata ( dns_sdblookup_t lookup,
dns_rdatatype_t  typeval,
dns_ttl_t  ttl,
const unsigned char *  rdatap,
unsigned int  rdlen 
)

Add a single resource record to the lookup structure to be returned in the query response. dns_sdb_putrr() takes the resource record in master file text format as a null-terminated string, and dns_sdb_putrdata() takes the raw RDATA in uncompressed wire format.

Definition at line 284 of file sdb.c.

References isc_region::base, dns_sdb::common, DE_CONST, DNS_R_BADTTL, dns_rdata_fromregion(), dns_rdata_init(), dns_rdatalist_init(), isc_buffer_allocate(), isc_buffer_copyregion(), isc_buffer_usedregion, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_region::length, dns_db::mctx, mctx, dns_db::rdclass, dns_rdatalist::rdclass, dns_sdblookup::sdb, dns_rdatalist::ttl, and dns_rdatalist::type.

Referenced by dns64_cname(), dns_sdb_putnamedrdata(), dns_sdb_putrr(), and put_txt().

isc_result_t dns_sdb_putrr ( dns_sdblookup_t lookup,
const char *  type,
dns_ttl_t  ttl,
const char *  data 
)

See dns_sdb_putradata().

Definition at line 342 of file sdb.c.

References isc_textregion::base, dns_sdb::common, DE_CONST, dns_rdata_fromtext(), dns_rdatatype_fromtext(), dns_rootname, dns_sdb_putrdata(), DNS_SDBFLAG_RELATIVERDATA, dns_sdbimplementation::flags, dns_sdb::implementation, initial_size(), isc_buffer_add, isc_buffer_base, isc_buffer_constinit, isc_buffer_init, isc_buffer_usedlength, isc_lex_create(), isc_lex_destroy(), isc_lex_openbuffer(), isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_textregion::length, dns_db::mctx, mctx, dns_db::origin, origin, r, dns_db::rdclass, REQUIRE, dns_sdblookup::sdb, and VALID_SDBLOOKUP.

Referenced by builtin_authority(), dns_sdb_putnamedrr(), and dns_sdb_putsoa().

static isc_result_t getnode ( dns_sdballnodes_t allnodes,
const char *  name,
dns_sdbnode_t **  nodep 
) [static]

Definition at line 432 of file sdb.c.

References dns_sdb::common, dns_sdballnodes::common, createnode(), dns_dbiterator::db, destroynode(), 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_SDBFLAG_RELATIVERDATA, dns_sdb::implementation, 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_sdblookup::sdb.

Referenced by dns_sdb_putnamedrdata(), and dns_sdb_putnamedrr().

isc_result_t dns_sdb_putnamedrr ( dns_sdballnodes_t allnodes,
const char *  name,
const char *  type,
dns_ttl_t  ttl,
const char *  data 
)

See dns_sdb_putnamerdata().

Definition at line 490 of file sdb.c.

References dns_sdb_putrr(), getnode(), and ISC_R_SUCCESS.

isc_result_t dns_sdb_putnamedrdata ( dns_sdballnodes_t allnodes,
const char *  name,
dns_rdatatype_t  type,
dns_ttl_t  ttl,
const void *  rdata,
unsigned int  rdlen 
)

Add a single resource record to the allnodes structure to be included in a zone transfer response, in text or wire format as above.

Definition at line 502 of file sdb.c.

References dns_sdb_putrdata(), getnode(), and ISC_R_SUCCESS.

isc_result_t dns_sdb_putsoa ( dns_sdblookup_t lookup,
const char *  mname,
const char *  rname,
isc_uint32_t  serial 
)

This function may optionally be called from the 'authority' callback to simplify construction of the SOA record for 'zone'. It will provide a SOA listing 'mname' as as the master server and 'rname' as the responsible person mailbox. It is the responsibility of the driver to increment the serial number between responses if necessary. All other SOA fields will have reasonable default values.

Definition at line 515 of file sdb.c.

References DNS_NAME_MAXTEXT, dns_sdb_putrr(), ISC_R_NOSPACE, REQUIRE, SDB_DEFAULT_EXPIRE, SDB_DEFAULT_MINIMUM, SDB_DEFAULT_REFRESH, SDB_DEFAULT_RETRY, SDB_DEFAULT_TTL, and str.

Referenced by builtin_authority().

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

Definition at line 538 of file sdb.c.

References dns_sdb::lock, LOCK, dns_sdb::references, REQUIRE, dns_sdblookup::sdb, UNLOCK, and VALID_SDB.

static void destroy ( dns_sdb_t sdb  )  [static]

Definition at line 552 of file sdb.c.

References dns_sdb::common, dns_sdb::dbdata, dns_sdbmethods::destroy, DESTROYLOCK, dns_name_free(), dns_sdbimplementation::driverdata, dns_sdb::implementation, dns_db::impmagic, isc_mem_detach(), isc_mem_free, isc_mem_put, dns_sdb::lock, dns_db::magic, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, mctx, dns_sdbimplementation::methods, dns_db::origin, and dns_sdb::zone.

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

Definition at line 578 of file sdb.c.

References destroy(), ISC_FALSE, ISC_TRUE, dns_sdb::lock, LOCK, dns_sdb::references, REQUIRE, dns_sdblookup::sdb, UNLOCK, and VALID_SDB.

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

Definition at line 597 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

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

Definition at line 604 of file sdb.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 611 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

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

Definition at line 621 of file sdb.c.

References REQUIRE, and UNUSED.

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

Definition at line 631 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

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

Definition at line 639 of file sdb.c.

References REQUIRE, and UNUSED.

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

Definition at line 651 of file sdb.c.

References ISC_FALSE, REQUIRE, and UNUSED.

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 728 of file sdb.c.

References dns_sdbmethods::authority, dns_sdb::common, createnode(), dns_sdb::dbdata, destroynode(), dns_name_countlabels(), dns_name_equal(), dns_name_getlabelsequence(), dns_name_init(), DNS_NAME_MAXTEXT, dns_name_totext(), DNS_SDBFLAG_RELATIVEOWNER, dns_sdbimplementation::flags, dns_sdb::implementation, isc_buffer_init, isc_buffer_putuint8, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, dns_sdbmethods::lookup, dns_sdbmethods::lookup2, MAYBE_LOCK, MAYBE_UNLOCK, dns_sdbimplementation::methods, dns_db::origin, REQUIRE, dns_sdblookup::sdb, UNUSED, VALID_SDB, and dns_sdb::zone.

Referenced by findext().

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 816 of file sdb.c.

References destroynode(), detachnode(), DNS_DBFIND_GLUEOK, 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_SDBFLAG_DNS64, findnodeext(), findrdataset(), dns_sdbimplementation::flags, dns_sdb::implementation, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_db::origin, REQUIRE, dns_sdblookup::sdb, UNUSED, and VALID_SDB.

Referenced by find().

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 994 of file sdb.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 1011 of file sdb.c.

References INSIST, LOCK, REQUIRE, dns_sdblookup::sdb, UNLOCK, UNUSED, and VALID_SDB.

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

Definition at line 1055 of file sdb.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 1064 of file sdb.c.

References UNUSED.

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

Definition at line 1072 of file sdb.c.

References dns_sdbmethods::allnodes, dns_sdballnodes::common, dns_sdb::common, dns_dbiterator::db, dns_sdb::dbdata, dbiterator_destroy(), dns_db_attach(), DNS_DB_NONSEC3, DNS_DB_NSEC3ONLY, DNS_DB_RELATIVENAMES, DNS_DBITERATOR_MAGIC, dns_sdb::implementation, ISC_LIST_INIT, ISC_LIST_PREPEND, ISC_LIST_UNLINK, isc_mem_get, ISC_R_NOMEMORY, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_TF, dns_dbiterator::magic, MAYBE_LOCK, MAYBE_UNLOCK, dns_db::mctx, dns_dbiterator::methods, dns_sdbimplementation::methods, dns_dbiterator::relative_names, REQUIRE, dns_sdblookup::sdb, VALID_SDB, and dns_sdb::zone.

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 1154 of file sdb.c.

References attachnode(), sdb_rdatasetiter::common, dns_rdatasetiter::db, DNS_RDATASETITER_MAGIC, 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, UNUSED, and dns_rdatasetiter::version.

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 1182 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

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 1198 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

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 1213 of file sdb.c.

References ISC_R_NOTIMPLEMENTED, and UNUSED.

static isc_boolean_t issecure ( dns_db_t db  )  [static]

Definition at line 1226 of file sdb.c.

References ISC_FALSE, and UNUSED.

static unsigned int nodecount ( dns_db_t db  )  [static]

Definition at line 1233 of file sdb.c.

References UNUSED.

static isc_boolean_t ispersistent ( dns_db_t db  )  [static]

Definition at line 1240 of file sdb.c.

References ISC_TRUE, and UNUSED.

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

Definition at line 1246 of file sdb.c.

References UNUSED.

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

Definition at line 1252 of file sdb.c.

References UNUSED.

static void disassociate ( dns_rdataset_t rdataset  )  [static]

Definition at line 1394 of file sdb.c.

References detachnode(), isc__rdatalist_disassociate(), dns_rdataset::private5, and dns_sdblookup::sdb.

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

Definition at line 1404 of file sdb.c.

References attachnode(), isc__rdatalist_clone(), dns_rdataset::private5, and dns_sdblookup::sdb.


Variable Documentation

int dummy [static]

Definition at line 143 of file sdb.c.

Referenced by dns_zt_find(), dns_zt_mount(), generate(), load_raw(), ns_client_send(), query_prefetch(), queue_soa_query(), soa_query(), zone_dump(), zone_send_securedb(), and zone_send_secureserial().

dns_dbiteratormethods_t dbiterator_methods [static]

Initial value:

Definition at line 181 of file sdb.c.

dns_rdatasetitermethods_t rdatasetiter_methods [static]

Initial value:

Definition at line 199 of file sdb.c.

dns_dbmethods_t sdb_methods [static]

Definition at line 1258 of file sdb.c.

dns_rdatasetmethods_t methods [static]

Initial value:

Definition at line 1415 of file sdb.c.


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