本文整理汇总了C++中dns_db_detach函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_db_detach函数的具体用法?C++ dns_db_detach怎么用?C++ dns_db_detach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dns_db_detach函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: levent_destroy
static void
levent_destroy(isc_event_t *event) {
dns_lookupevent_t *levent;
isc_mem_t *mctx;
REQUIRE(event->ev_type == DNS_EVENT_LOOKUPDONE);
mctx = event->ev_destroy_arg;
levent = (dns_lookupevent_t *)event;
if (levent->name != NULL) {
if (dns_name_dynamic(levent->name))
dns_name_free(levent->name, mctx);
isc_mem_put(mctx, levent->name, sizeof(dns_name_t));
}
if (levent->rdataset != NULL) {
dns_rdataset_disassociate(levent->rdataset);
isc_mem_put(mctx, levent->rdataset, sizeof(dns_rdataset_t));
}
if (levent->sigrdataset != NULL) {
dns_rdataset_disassociate(levent->sigrdataset);
isc_mem_put(mctx, levent->sigrdataset, sizeof(dns_rdataset_t));
}
if (levent->node != NULL)
dns_db_detachnode(levent->db, &levent->node);
if (levent->db != NULL)
dns_db_detach(&levent->db);
isc_mem_put(mctx, event, event->ev_size);
}
示例2: test_seek_nx
/*
* seek_emty: walk database starting at an empty nonterminal node
* (should fail)
*/
static void test_seek_nx(const atf_tc_t *tc) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbiterator_t *iter = NULL;
dns_name_t *seekname;
dns_fixedname_t f1;
UNUSED(tc);
dns_fixedname_init(&f1);
seekname = dns_fixedname_name(&f1);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-filename"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_createiterator(db, 0, &iter);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = make_name("nonexistent." TEST_ORIGIN, seekname);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_dbiterator_seek(iter, seekname);
ATF_CHECK_EQ(result, ISC_R_NOTFOUND);
dns_dbiterator_destroy(&iter);
dns_db_detach(&db);
dns_test_end();
}
示例3: ATF_TC_BODY
ATF_TC_BODY(getoriginnode, tc) {
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
isc_mem_t *mymctx = NULL;
isc_result_t result;
result = isc_mem_create(0, 0, &mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_hash_create(mymctx, NULL, 256);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_getoriginnode(db, &node);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
dns_db_detachnode(db, &node);
result = dns_db_getoriginnode(db, &node);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
dns_db_detachnode(db, &node);
dns_db_detach(&db);
isc_mem_detach(&mymctx);
}
示例4: xfrout_ctx_destroy
static void
xfrout_ctx_destroy(xfrout_ctx_t **xfrp) {
xfrout_ctx_t *xfr = *xfrp;
INSIST(xfr->sends == 0);
xfr->client->shutdown = NULL;
xfr->client->shutdown_arg = NULL;
if (xfr->stream != NULL)
xfr->stream->methods->destroy(&xfr->stream);
if (xfr->buf.base != NULL)
isc_mem_put(xfr->mctx, xfr->buf.base, xfr->buf.length);
if (xfr->txmem != NULL)
isc_mem_put(xfr->mctx, xfr->txmem, xfr->txmemlen);
if (xfr->lasttsig != NULL)
isc_buffer_free(&xfr->lasttsig);
if (xfr->quota != NULL)
isc_quota_detach(&xfr->quota);
if (xfr->ver != NULL)
dns_db_closeversion(xfr->db, &xfr->ver, ISC_FALSE);
if (xfr->zone != NULL)
dns_zone_detach(&xfr->zone);
if (xfr->db != NULL)
dns_db_detach(&xfr->db);
ns_client_detach(&xfr->client);
isc_mem_put(xfr->mctx, xfr, sizeof(*xfr));
*xfrp = NULL;
}
示例5: free_ldapdb
/* !!! Verify that internal RBTDB cannot leak somehow. */
static void ATTR_NONNULLS
free_ldapdb(ldapdb_t *ldapdb)
{
#ifdef RBTDB_DEBUG
isc_result_t result;
dns_dbversion_t *version = NULL;
dns_name_t *zone_name = dns_db_origin(&ldapdb->common);
ld_string_t *file_name = NULL;
CHECK(zr_get_zone_path(ldapdb->common.mctx,
ldap_instance_getsettings_local(ldapdb->ldap_inst),
zone_name, "ldapdb.dump", &file_name));
dns_db_currentversion(ldapdb->rbtdb, &version);
log_info("dump to '%s' started", str_buf(file_name));
result = dns_db_dump2(ldapdb->rbtdb, version, str_buf(file_name),
dns_masterformat_text);
log_info("dump to '%s' finished: %s", str_buf(file_name),
isc_result_totext(result));
dns_db_closeversion(ldapdb->rbtdb, &version, ISC_FALSE);
cleanup:
if (result != ISC_R_SUCCESS) {
log_error_r("dump to '%s' failed",
(file_name && str_buf(file_name)) ?
str_buf(file_name) : "<NULL>");
}
str_destroy(&file_name);
#endif
dns_db_detach(&ldapdb->rbtdb);
dns_name_free(&ldapdb->common.origin, ldapdb->common.mctx);
RUNTIME_CHECK(isc_mutex_destroy(&ldapdb->newversion_lock)
== ISC_R_SUCCESS);
isc_mem_putanddetach(&ldapdb->common.mctx, ldapdb, sizeof(*ldapdb));
}
示例6: dbdetach
static void
dbdetach(void *data, void *arg) {
dns_db_t *db = data;
UNUSED(arg);
dns_db_detach(&db);
}
示例7: free_sampledb
static void
free_sampledb(sampledb_t *sampledb) {
REQUIRE(VALID_SAMPLEDB(sampledb));
dns_db_detach(&sampledb->rbtdb);
dns_name_free(&sampledb->common.origin, sampledb->common.mctx);
isc_mem_putanddetach(&sampledb->common.mctx, sampledb, sizeof(*sampledb));
}
示例8: dns_dbtable_removedefault
void
dns_dbtable_removedefault(dns_dbtable_t *dbtable) {
REQUIRE(VALID_DBTABLE(dbtable));
RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
dns_db_detach(&dbtable->default_db);
RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
}
示例9: close_db
static void
close_db() {
if (v1 != NULL) {
dns_db_closeversion(db1, &v1, ISC_FALSE);
ATF_REQUIRE_EQ(v1, NULL);
}
if (db1 != NULL) {
dns_db_detach(&db1);
ATF_REQUIRE_EQ(db1, NULL);
}
if (v2 != NULL) {
dns_db_closeversion(db2, &v2, ISC_FALSE);
ATF_REQUIRE_EQ(v2, NULL);
}
if (db2 != NULL) {
dns_db_detach(&db2);
ATF_REQUIRE_EQ(db2, NULL);
}
}
示例10: test_seek
/* seek: walk database starting at a particular node */
static void test_seek(const atf_tc_t *tc) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbiterator_t *iter = NULL;
dns_dbnode_t *node = NULL;
dns_name_t *name, *seekname;
dns_fixedname_t f1, f2;
int i = 0;
UNUSED(tc);
dns_fixedname_init(&f1);
name = dns_fixedname_name(&f1);
dns_fixedname_init(&f2);
seekname = dns_fixedname_name(&f2);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-filename"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_createiterator(db, 0, &iter);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = make_name("c." TEST_ORIGIN, seekname);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_dbiterator_seek(iter, seekname);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
while (result == ISC_R_SUCCESS) {
result = dns_dbiterator_current(iter, &node, name);
if (result == DNS_R_NEWORIGIN)
result = ISC_R_SUCCESS;
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
dns_db_detachnode(db, &node);
result = dns_dbiterator_next(iter);
i++;
}
ATF_CHECK_EQ(i, atoi(atf_tc_get_md_var(tc, "X-nodes")));
dns_dbiterator_destroy(&iter);
dns_db_detach(&db);
dns_test_end();
}
示例11: iteration_test
static void
iteration_test(const char* file, unsigned int expected) {
isc_result_t result;
dns_db_t *db = NULL;
unsigned int iterations;
result = dns_test_loaddb(&db, dns_dbtype_zone, "test", file);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_nsec3_maxiterations(db, NULL, mctx, &iterations);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_CHECK_EQ(iterations, expected);
dns_db_detach(&db);
}
示例12: unload_all
static void
unload_all(void) {
dbinfo *dbi, *dbi_next;
for (dbi = ISC_LIST_HEAD(dbs); dbi != NULL; dbi = dbi_next) {
dbi_next = ISC_LIST_NEXT(dbi, link);
if (dns_db_iszone(dbi->db))
dns_dbtable_remove(dbtable, dbi->db);
else {
INSIST(dbi == cache_dbi);
dns_dbtable_removedefault(dbtable);
cache_dbi = NULL;
}
dns_db_detach(&dbi->db);
ISC_LIST_UNLINK(dbs, dbi, link);
isc_mem_put(mctx, dbi, sizeof(*dbi));
}
}
示例13: ns_zone_configure_writeable_dlz
/*
* Set up a DLZ zone as writeable
*/
isc_result_t
ns_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
dns_rdataclass_t rdclass, dns_name_t *name)
{
dns_db_t *db = NULL;
isc_time_t now;
isc_result_t result;
TIME_NOW(&now);
dns_zone_settype(zone, dns_zone_dlz);
result = dns_sdlz_setdb(dlzdatabase, rdclass, name, &db);
if (result != ISC_R_SUCCESS)
return result;
result = dns_zone_dlzpostload(zone, db);
dns_db_detach(&db);
return result;
}
示例14: loadset
static isc_result_t
loadset(const char *filename, dns_rdataset_t *rdataset) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbnode_t *node = NULL;
char setname[DNS_NAME_FORMATSIZE];
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS)
fatal("can't create database");
if (strcmp(filename, "-") == 0) {
db_load_from_stream(db, stdin);
filename = "input";
} else {
result = dns_db_load(db, filename);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("can't load %s: %s", filename,
isc_result_totext(result));
}
result = dns_db_findnode(db, name, ISC_FALSE, &node);
if (result != ISC_R_SUCCESS)
fatal("can't find %s node in %s", setname, filename);
result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey,
0, 0, rdataset, NULL);
if (result == ISC_R_NOTFOUND)
fatal("no DNSKEY RR for %s in %s", setname, filename);
else if (result != ISC_R_SUCCESS)
fatal("dns_db_findrdataset");
if (node != NULL)
dns_db_detachnode(db, &node);
if (db != NULL)
dns_db_detach(&db);
return (result);
}
示例15: test_create
/* create: make sure we can create a dbiterator */
static void
test_create(const atf_tc_t *tc) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbiterator_t *iter = NULL;
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-filename"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_createiterator(db, 0, &iter);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
dns_dbiterator_destroy(&iter);
dns_db_detach(&db);
dns_test_end();
}