0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2001, 2003-2005, 2007-2009, 2011-2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Private Types
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Supported DB Implementations Registry
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * Built in database implementations are registered here.
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic ISC_LIST(dns_dbimplementation_t) implementations;
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington RUNTIME_CHECK(isc_rwlock_init(&implock, 0, 0) == ISC_R_SUCCESS);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington ISC_LIST_APPEND(implementations, &rbtimp, link);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington ISC_LIST_APPEND(implementations, &rbt64imp, link);
e672951ed28b2e9cc7a19c3d7fa4a258382f981cAutomatic Updater for (imp = ISC_LIST_HEAD(implementations);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Basic DB Methods
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_db_create(isc_mem_t *mctx, const char *db_type, dns_name_t *origin,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Create a new database using implementation 'db_type'.
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = ((impinfo->create)(mctx, origin, type,
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson "unsupported database type '%s'", db_type);
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_attach(dns_db_t *source, dns_db_t **targetp) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Attach *targetp to source.
2d63e8f8d2a8ef70e404182caf5b0d95dbcf2027Andreas Gustafsson REQUIRE(targetp != NULL && *targetp == NULL);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Detach *dbp from its database.
d549c3734869b48e740c64e80890bcb6f3ce672cJames Bristerdns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp)
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister return (isc_ondestroy_register(&db->ondest, task, eventp));
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Does 'db' have cache semantics?
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Does 'db' have zone semantics?
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews if ((db->attributes & (DNS_DBATTR_CACHE|DNS_DBATTR_STUB)) == 0)
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews * Does 'db' have stub semantics?
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews * Is 'db' secure or partially secure?
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley * Is 'db' secure?
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington * Is 'db' persistent?
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * The origin of the database.
48481c9b6e19501457bcbc2995555412f352b99fBob Halley * The class of the database.
7829fad4093f2c1985b1efb7cea00287ff015d2bckbdns_db_beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley * Begin loading 'db'.
7829fad4093f2c1985b1efb7cea00287ff015d2bckbdns_db_endload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley * Finish loading 'db'.
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki for (listener = ISC_LIST_HEAD(db->update_listeners);
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki listener->onupdate(db, listener->onupdate_arg);
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt return (dns_db_load3(db, filename, dns_masterformat_text, 0));
e174044290953a2499f574e35cc9c22ba126a303Mark Andrewsdns_db_load2(dns_db_t *db, const char *filename, dns_masterformat_t format) {
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntdns_db_load3(dns_db_t *db, const char *filename, dns_masterformat_t format,
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Load master file 'filename' into 'db'.
e174044290953a2499f574e35cc9c22ba126a303Mark Andrews result = dns_master_loadfile2(filename, &db->origin, &db->origin,
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley * We always call dns_db_endload(), but we only want to return its
27ffc5a69779c3c7224580a89aa2bf0a3ff8c16dBob Halley * result if dns_master_loadfile() succeeded. If dns_master_loadfile()
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley * failed, we want to return the result code it gave us.
86529bb6979dbe3ffd7bc2df078fac21cb339953Mark Andrews (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE))
7829fad4093f2c1985b1efb7cea00287ff015d2bckbdns_db_serialize(dns_db_t *db, dns_dbversion_t *version, FILE *file) {
bad8294771671374e811afac79a20cc6927e3e2fBob Halleydns_db_dump(dns_db_t *db, dns_dbversion_t *version, const char *filename) {
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews return ((db->methods->dump)(db, version, filename,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdns_db_dump2(dns_db_t *db, dns_dbversion_t *version, const char *filename,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Dump 'db' into master file 'filename' in the 'masterformat' format.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * XXXJT: is it okay to modify the interface to the existing "dump"
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews return ((db->methods->dump)(db, version, filename, masterformat));
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Version Methods
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Open the current version for reading.
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_newversion(dns_db_t *db, dns_dbversion_t **versionp) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Open a new version for reading and writing.
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley return ((db->methods->newversion)(db, versionp));
b8862d5130b88e7b1a257997d7909f769716d51cBob Halleydns_db_attachversion(dns_db_t *db, dns_dbversion_t *source,
b8862d5130b88e7b1a257997d7909f769716d51cBob Halley * Attach '*targetp' to 'source'.
b8862d5130b88e7b1a257997d7909f769716d51cBob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
b8862d5130b88e7b1a257997d7909f769716d51cBob Halley (db->methods->attachversion)(db, source, targetp);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleydns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp,
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Close version '*versionp'.
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley (db->methods->closeversion)(db, versionp, commit);
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki for (listener = ISC_LIST_HEAD(db->update_listeners);
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki listener->onupdate(db, listener->onupdate_arg);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Node Methods
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Find the node with name 'name'.
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findnode)(db, name, create, nodep));
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findnodeext)(db, name, create,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt isc_boolean_t create, dns_clientinfomethods_t *methods,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt * Find the node with name 'name', passing 'arg' to the database
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt * implementation.
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findnodeext)(db, name, create,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findnode)(db, name, create, nodep));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdns_db_findnsec3node(dns_db_t *db, dns_name_t *name,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Find the node with name 'name'.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return ((db->methods->findnsec3node)(db, name, create, nodep));
ced5499494f8afba75c056eb2f3933de24a5f360Bob Halleydns_db_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
63e6086ef99eca768a4cd69871038181251905bbBob Halley dns_rdatatype_t type, unsigned int options, isc_stdtime_t now,
732e0731dec1922747bb3b3147cf2c3d16b22eaaBob Halley dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
e7e2e948e37a0eeb93b0d4f2390f38ed2d9dcd82Bob Halley * Find the best match for 'name' and 'type' in version 'version'
e7e2e948e37a0eeb93b0d4f2390f38ed2d9dcd82Bob Halley REQUIRE(nodep == NULL || (nodep != NULL && *nodep == NULL));
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->find)(db, name, version, type,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findext)(db, name, version, type,
793814f80703afdd69b59ade91e63efa81ae4178Evan Huntdns_db_findext(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt dns_rdatatype_t type, unsigned int options, isc_stdtime_t now,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt * Find the best match for 'name' and 'type' in version 'version'
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt * of 'db', passing in 'arg'.
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt REQUIRE(nodep == NULL || (nodep != NULL && *nodep == NULL));
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findext)(db, name, version, type,
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->find)(db, name, version, type,
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halleydns_db_findzonecut(dns_db_t *db, dns_name_t *name,
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halley dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halley * Find the deepest known zonecut which encloses 'name' in 'db'.
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) != 0);
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halley REQUIRE(nodep == NULL || (nodep != NULL && *nodep == NULL));
9acbfdb6a2f70d84107ccd99b24a2e523a48259bBob Halley return ((db->methods->findzonecut)(db, name, options, now, nodep,
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Attach *targetp to source.
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_detachnode(dns_db_t *db, dns_dbnode_t **nodep) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Detach *nodep from its node.
a56f5ada432128085e4a06815328023ee0c9610dMark Andrewsdns_db_transfernode(dns_db_t *db, dns_dbnode_t **sourcep,
a56f5ada432128085e4a06815328023ee0c9610dMark Andrews * This doesn't check the implementation magic. If we find that
a56f5ada432128085e4a06815328023ee0c9610dMark Andrews * we need such checks in future then this will be done in the
e672951ed28b2e9cc7a19c3d7fa4a258382f981cAutomatic Updater (db->methods->transfernode)(db, sourcep, targetp);
6e8ec359a45b7e991d7bcc97ed8547eac725a506Bob Halleydns_db_expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) {
6e8ec359a45b7e991d7bcc97ed8547eac725a506Bob Halley * Mark as stale all records at 'node' which expire at or before 'now'.
6e8ec359a45b7e991d7bcc97ed8547eac725a506Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) != 0);
6e8ec359a45b7e991d7bcc97ed8547eac725a506Bob Halley return ((db->methods->expirenode)(db, node, now));
097c31fdea44383b7ce95345a66489040ad5e333Bob Halleydns_db_printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out) {
097c31fdea44383b7ce95345a66489040ad5e333Bob Halley * Print a textual representation of the contents of the node to
8c65ae482a50bed3184026301c6f99f32a683dbfBob Halley *** DB Iterator Creation
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdns_db_createiterator(dns_db_t *db, unsigned int flags,
8c65ae482a50bed3184026301c6f99f32a683dbfBob Halley * Create an iterator for version 'version' of 'db'.
8c65ae482a50bed3184026301c6f99f32a683dbfBob Halley REQUIRE(iteratorp != NULL && *iteratorp == NULL);
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (db->methods->createiterator(db, flags, iteratorp));
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley *** Rdataset Methods
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
b77f76be2d114ad1abecf7e6e6c1414a4ade44c1David Lawrence REQUIRE(! dns_rdataset_isassociated(rdataset));
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews REQUIRE(covers == 0 || type == dns_rdatatype_rrsig);
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt return ((db->methods->findrdataset)(db, node, version, type,
efe6d8f0665b466052910e8efd4b031dc048f196Bob Halleydns_db_allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
63e6086ef99eca768a4cd69871038181251905bbBob Halley isc_stdtime_t now, dns_rdatasetiter_t **iteratorp)
efe6d8f0665b466052910e8efd4b031dc048f196Bob Halley * Make '*iteratorp' an rdataset iteratator for all rdatasets at
efe6d8f0665b466052910e8efd4b031dc048f196Bob Halley * 'node' in version 'version' of 'db'.
efe6d8f0665b466052910e8efd4b031dc048f196Bob Halley REQUIRE(iteratorp != NULL && *iteratorp == NULL);
63e6086ef99eca768a4cd69871038181251905bbBob Halley return ((db->methods->allrdatasets)(db, node, version, now,
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
64e829fffb8d95e7507079767ef68327b4a7b4caBob Halley unsigned int options, dns_rdataset_t *addedrdataset)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Add 'rdataset' to 'node' in version 'version' of 'db'.
5c6d49484bf5600e3c2bcb3165e168bd058d167bBob Halley REQUIRE(((db->attributes & DNS_DBATTR_CACHE) == 0 && version != NULL)||
64e829fffb8d95e7507079767ef68327b4a7b4caBob Halley version == NULL && (options & DNS_DBADD_MERGE) == 0));
b77f76be2d114ad1abecf7e6e6c1414a4ade44c1David Lawrence REQUIRE(dns_rdataset_isassociated(rdataset));
b77f76be2d114ad1abecf7e6e6c1414a4ade44c1David Lawrence ! dns_rdataset_isassociated(addedrdataset)));
7f705ac9a20e82264113e561a515d54dde5bcea3Bob Halley return ((db->methods->addrdataset)(db, node, version, now, rdataset,
a7e185ff3f7db73e282bf53b9f84a95ff8f8cb27Bob Halleydns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node,
a7e185ff3f7db73e282bf53b9f84a95ff8f8cb27Bob Halley dns_dbversion_t *version, dns_rdataset_t *rdataset,
f8abaa0fae7f75d9601c10b6a4af8dd907494d45Mark Andrews unsigned int options, dns_rdataset_t *newrdataset)
a7e185ff3f7db73e282bf53b9f84a95ff8f8cb27Bob Halley * Remove any rdata in 'rdataset' from 'node' in version 'version' of
b687c057fbd8b88738300a5038538e589677fe18Bob Halley REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0 && version != NULL);
b77f76be2d114ad1abecf7e6e6c1414a4ade44c1David Lawrence REQUIRE(dns_rdataset_isassociated(rdataset));
a7e185ff3f7db73e282bf53b9f84a95ff8f8cb27Bob Halley return ((db->methods->subtractrdataset)(db, node, version, rdataset,
1ccbfca64ae86ace521053773001cb995352f96fBob Halleydns_db_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
6cac2e0f7a1ab207a64127bef11bb93404523c15Brian Wellington dns_dbversion_t *version, dns_rdatatype_t type,
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * Make it so that no rdataset of type 'type' exists at 'node' in
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley * version version 'version' of 'db'.
a3e2ec2dfec1a8171eaf584bb957b80c04de1e0bBob Halley REQUIRE(((db->attributes & DNS_DBATTR_CACHE) == 0 && version != NULL)||
a3e2ec2dfec1a8171eaf584bb957b80c04de1e0bBob Halley ((db->attributes & DNS_DBATTR_CACHE) != 0 && version == NULL));
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence return ((db->methods->deleterdataset)(db, node, version,
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrewsdns_db_overmem(dns_db_t *db, isc_boolean_t overmem) {
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graffdns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, isc_uint32_t *serialp)
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews REQUIRE(dns_db_iszone(db) || dns_db_isstub(db));
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff result = dns_db_findnode(db, dns_db_origin(db), ISC_FALSE, &node);
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff result = dns_db_findrdataset(db, node, ver, dns_rdatatype_soa, 0,
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff isc_buffer_init(&buffer, rdata.data, rdata.length);
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff isc_buffer_forward(&buffer, rdata.length - 20);
a03848252fa85734ca75beae3d0b01bb503c0a8bMark Andrewsdns_db_settask(dns_db_t *db, isc_task_t *task) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtondns_db_register(const char *name, dns_dbcreatefunc_t create, void *driverarg,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington isc_mem_t *mctx, dns_dbimplementation_t **dbimp)
a1014b72b0340a071f4c59c153b02c538bfd6b9fBrian Wellington RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington imp = isc_mem_get(mctx, sizeof(dns_dbimplementation_t));
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington ISC_LIST_APPEND(implementations, imp, link);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtondns_db_unregister(dns_dbimplementation_t **dbimp) {
a1014b72b0340a071f4c59c153b02c538bfd6b9fBrian Wellington RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington ISC_LIST_UNLINK(implementations, imp, link);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington isc_mem_put(mctx, imp, sizeof(dns_dbimplementation_t));
982e072a5000bfc072aee8b34f64112cf54369a5Mark Andrewsdns_db_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) {
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 REQUIRE(nodep != NULL && *nodep == NULL);
982e072a5000bfc072aee8b34f64112cf54369a5Mark Andrews return ((db->methods->getoriginnode)(db, nodep));
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Huntdns_db_setcachestats(dns_db_t *db, isc_stats_t *stats) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdns_db_getnsec3parameters(dns_db_t *db, dns_dbversion_t *version,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return ((db->methods->getnsec3parameters)(db, version, hash,
744c1db6352c4c3f11c8538e4a2a57c8b0e0d570Mark Andrewsdns_db_getsize(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records,
744c1db6352c4c3f11c8538e4a2a57c8b0e0d570Mark Andrews return ((db->methods->getsize)(db, version, records, bytes));
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrewsdns_db_setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset,
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews return ((db->methods->setsigningtime)(db, rdataset, resign));
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrewsdns_db_getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, dns_name_t *name)
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews return ((db->methods->getsigningtime)(db, rdataset, name));
28479307225582ad0b2e11441d85fcf5169551d0Mark Andrewsdns_db_resigned(dns_db_t *db, dns_rdataset_t *rdataset,
2391def77980f6107b2c5bdd8b74e225b604b3baMark Andrews (db->methods->resigned)(db, rdataset, version);
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt * Attach a database to policy zone databases.
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt * This should only happen when the caller has already ensured that
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt * it is dealing with a database that understands response policy zones.
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntdns_db_rpz_attach(dns_db_t *db, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num) {
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt * Finish loading a response policy zone.
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki * Attach a notify-on-update function the database
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki listener = isc_mem_get(db->mctx, sizeof(dns_dbonupdatelistener_t));
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki ISC_LIST_APPEND(db->update_listeners, listener, link);
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki for (listener = ISC_LIST_HEAD(db->update_listeners);
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki ISC_LIST_UNLINK(db->update_listeners, listener, link);
b4bbf494183e4158b417d9200297ff0764af2f9dMark Andrewsdns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) {
b4bbf494183e4158b417d9200297ff0764af2f9dMark Andrews return ((db->methods->nodefullname)(db, node, name));