本文整理汇总了C++中dns_db_detach函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_db_detach函数的具体用法?C++ dns_db_detach怎么用?C++ dns_db_detach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dns_db_detach函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:28,代码来源:lookup.c
示例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();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:36,代码来源:dbiterator_test.c
示例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);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:27,代码来源:db_test.c
示例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;
}
开发者ID:ystk,项目名称:debian-bind9,代码行数:32,代码来源:xfrout.c
示例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));
}
开发者ID:pspacek,项目名称:bind-dyndb-ldap,代码行数:35,代码来源:ldap_driver.c
示例6: dbdetach
static void
dbdetach(void *data, void *arg) {
dns_db_t *db = data;
UNUSED(arg);
dns_db_detach(&db);
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:8,代码来源:dbtable.c
示例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));
}
开发者ID:pecharmin,项目名称:bind9,代码行数:8,代码来源:db.c
示例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);
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:10,代码来源:dbtable.c
示例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);
}
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:20,代码来源:dbversion_test.c
示例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();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:49,代码来源:dbiterator_test.c
示例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);
}
开发者ID:crossbuild,项目名称:bind,代码行数:16,代码来源:nsec3_test.c
示例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));
}
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:18,代码来源:db_test.c
示例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;
}
开发者ID:ElRevo,项目名称:xia-core,代码行数:21,代码来源:zoneconf.c
示例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);
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:42,代码来源:dnssec-dsfromkey.c
示例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();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:21,代码来源:dbiterator_test.c
示例16: test_reverse
/* reverse: walk database backwards */
static void test_reverse(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;
dns_fixedname_t f;
int i = 0;
UNUSED(tc);
dns_fixedname_init(&f);
name = dns_fixedname_name(&f);
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);
for (result = dns_dbiterator_last(iter);
result == ISC_R_SUCCESS;
result = dns_dbiterator_prev(iter)) {
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);
i++;
}
ATF_CHECK_EQ(i, 12);
dns_dbiterator_destroy(&iter);
dns_db_detach(&db);
dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:42,代码来源:dbiterator_test.c
示例17: dbtable_free
static inline void
dbtable_free(dns_dbtable_t *dbtable) {
/*
* Caller must ensure that it is safe to call.
*/
RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
if (dbtable->default_db != NULL)
dns_db_detach(&dbtable->default_db);
dns_rbt_destroy(&dbtable->rbt);
RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
isc_rwlock_destroy(&dbtable->tree_lock);
dbtable->magic = 0;
isc_mem_putanddetach(&dbtable->mctx, dbtable, sizeof(*dbtable));
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:21,代码来源:dbtable.c
示例18: xfrout_ctx_destroy
static void
xfrout_ctx_destroy(xfrout_ctx_t **xfrp) {
xfrout_ctx_t *xfr = *xfrp;
ns_client_t *client = NULL;
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);
/*
* We want to detch the client after we have released the memory
* context as ns_client_detach checks the memory reference count.
*/
ns_client_attach(xfr->client, &client);
ns_client_detach(&xfr->client);
isc_mem_putanddetach(&xfr->mctx, xfr, sizeof(*xfr));
ns_client_detach(&client);
*xfrp = NULL;
}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:38,代码来源:xfrout.c
示例19: configure_hint
static isc_result_t
configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
isc_result_t result;
dns_db_t *db = NULL;
dns_rdataclass_t rdclass;
isc_textregion_t r;
if (zfile == NULL)
return (ISC_R_FAILURE);
DE_CONST(zclass, r.base);
r.length = strlen(zclass);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_rootns_create(mctx, rdclass, zfile, &db);
if (result != ISC_R_SUCCESS)
return (result);
dns_db_detach(&db);
return (ISC_R_SUCCESS);
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:23,代码来源:named-checkconf.c
示例20: create_view
static void
create_view(void) {
dns_cache_t *cache;
isc_result_t result;
/*
* View.
*/
view = NULL;
result = dns_view_create(mctx, dns_rdataclass_in, "_default", &view);
check_result(result, "dns_view_create");
/*
* Cache.
*/
cache = NULL;
result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in,
"rbt", 0, NULL, &cache);
check_result(result, "dns_cache_create");
dns_view_setcache(view, cache);
dns_cache_detach(&cache);
{
unsigned int attrs;
isc_sockaddr_t any4, any6;
dns_dispatch_t *disp4 = NULL;
dns_dispatch_t *disp6 = NULL;
isc_sockaddr_any(&any4);
isc_sockaddr_any6(&any6);
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
taskmgr, &any4,
512, 6, 1024, 17, 19,
attrs, attrs, &disp4)
== ISC_R_SUCCESS);
INSIST(disp4 != NULL);
attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP;
RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
taskmgr, &any6,
512, 6, 1024, 17, 19,
attrs, attrs, &disp6)
== ISC_R_SUCCESS);
INSIST(disp6 != NULL);
RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1,
socketmgr,
timermgr, 0,
dispatchmgr,
disp4, disp6) ==
ISC_R_SUCCESS);
}
rootdb = NULL;
result = dns_rootns_create(mctx, dns_rdataclass_in, NULL, &rootdb);
check_result(result, "dns_rootns_create()");
dns_view_sethints(view, rootdb);
dns_db_detach(&rootdb);
dns_view_freeze(view);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:63,代码来源:adb_test.c
注:本文中的dns_db_detach函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论