本文整理汇总了C++中ISC_LIST_UNLINK函数的典型用法代码示例。如果您正苦于以下问题:C++ ISC_LIST_UNLINK函数的具体用法?C++ ISC_LIST_UNLINK怎么用?C++ ISC_LIST_UNLINK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISC_LIST_UNLINK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: irs_resconf_destroy
void
irs_resconf_destroy(irs_resconf_t **confp) {
irs_resconf_t *conf;
isc_sockaddr_t *address;
irs_resconf_search_t *searchentry;
int i;
REQUIRE(confp != NULL);
conf = *confp;
REQUIRE(IRS_RESCONF_VALID(conf));
while ((searchentry = ISC_LIST_HEAD(conf->searchlist)) != NULL) {
ISC_LIST_UNLINK(conf->searchlist, searchentry, link);
isc_mem_put(conf->mctx, searchentry, sizeof(*searchentry));
}
while ((address = ISC_LIST_HEAD(conf->nameservers)) != NULL) {
ISC_LIST_UNLINK(conf->nameservers, address, link);
isc_mem_put(conf->mctx, address, sizeof(*address));
}
if (conf->domainname != NULL)
isc_mem_free(conf->mctx, conf->domainname);
for (i = 0; i < RESCONFMAXSEARCH; i++) {
if (conf->search[i] != NULL)
isc_mem_free(conf->mctx, conf->search[i]);
}
isc_mem_put(conf->mctx, conf, sizeof(*conf));
*confp = NULL;
}
示例2: key_collision
isc_boolean_t
key_collision(isc_uint16_t id, dns_name_t *name, const char *dir,
dns_secalg_t alg, isc_mem_t *mctx, isc_boolean_t *exact)
{
isc_result_t result;
isc_boolean_t conflict = ISC_FALSE;
dns_dnsseckeylist_t matchkeys;
dns_dnsseckey_t *key = NULL;
isc_uint16_t oldid, diff;
isc_uint16_t bits = DNS_KEYFLAG_REVOKE; /* flag bits to look for */
if (exact != NULL)
*exact = ISC_FALSE;
ISC_LIST_INIT(matchkeys);
result = dns_dnssec_findmatchingkeys(name, dir, mctx, &matchkeys);
if (result == ISC_R_NOTFOUND)
return (ISC_FALSE);
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
key = ISC_LIST_HEAD(matchkeys);
if (dst_key_alg(key->key) != alg)
goto next;
oldid = dst_key_id(key->key);
diff = (oldid > id) ? (oldid - id) : (id - oldid);
if ((diff & ~bits) == 0) {
conflict = ISC_TRUE;
if (diff != 0) {
if (verbose > 1)
fprintf(stderr, "Key ID %d could "
"collide with %d\n",
id, oldid);
} else {
if (exact != NULL)
*exact = ISC_TRUE;
if (verbose > 1)
fprintf(stderr, "Key ID %d exists\n",
id);
}
}
next:
ISC_LIST_UNLINK(matchkeys, key, link);
dns_dnsseckey_destroy(mctx, &key);
}
/* Finish freeing the list */
while (!ISC_LIST_EMPTY(matchkeys)) {
key = ISC_LIST_HEAD(matchkeys);
ISC_LIST_UNLINK(matchkeys, key, link);
dns_dnsseckey_destroy(mctx, &key);
}
return (conflict);
}
示例3: dns_db_updatenotify_unregister
isc_result_t
dns_db_updatenotify_unregister(dns_db_t *db,
dns_dbupdate_callback_t fn,
void *fn_arg)
{
dns_dbonupdatelistener_t *listener;
REQUIRE(db != NULL);
for (listener = ISC_LIST_HEAD(db->update_listeners);
listener != NULL;
listener = ISC_LIST_NEXT(listener, link))
{
if ((listener->onupdate == fn) &&
(listener->onupdate_arg == fn_arg))
{
ISC_LIST_UNLINK(db->update_listeners, listener, link);
isc_mem_put(db->mctx, listener,
sizeof(dns_dbonupdatelistener_t));
return (ISC_R_SUCCESS);
}
}
return (ISC_R_NOTFOUND);
}
示例4: cfg_aclconfctx_detach
void
cfg_aclconfctx_detach(cfg_aclconfctx_t **actxp) {
cfg_aclconfctx_t *actx;
dns_acl_t *dacl, *next;
unsigned int refs;
REQUIRE(actxp != NULL && *actxp != NULL);
actx = *actxp;
isc_refcount_decrement(&actx->references, &refs);
if (refs == 0) {
for (dacl = ISC_LIST_HEAD(actx->named_acl_cache);
dacl != NULL;
dacl = next)
{
next = ISC_LIST_NEXT(dacl, nextincache);
ISC_LIST_UNLINK(actx->named_acl_cache, dacl,
nextincache);
dns_acl_detach(&dacl);
}
isc_mem_putanddetach(&actx->mctx, actx, sizeof(*actx));
}
*actxp = NULL;
}
示例5: lookup_callback
static void
lookup_callback(isc_task_t *task, isc_event_t *ev) {
client_t *client;
client = ev->ev_arg;
INSIST(client->find == ev->ev_sender);
printf("NAME %s:\n\tTask %p got event %p type %08x from %p, client %p\n\terr4: %s err6: %s\n",
client->target,
task, ev, ev->ev_type, client->find, client,
isc_result_totext(client->find->result_v4),
isc_result_totext(client->find->result_v6));
isc_event_free(&ev);
ev = NULL;
CLOCK();
dns_adb_dumpfind(client->find, stderr);
dns_adb_destroyfind(&client->find);
ISC_LIST_UNLINK(clients, client, link);
free_client(&client);
CUNLOCK();
}
示例6: add_rdata_to_list
static isc_result_t
add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
isc_uint32_t ttl, dns_namelist_t *namelist)
{
isc_result_t result;
isc_region_t r, newr;
dns_rdata_t *newrdata = NULL;
dns_name_t *newname = NULL;
dns_rdatalist_t *newlist = NULL;
dns_rdataset_t *newset = NULL;
isc_buffer_t *tmprdatabuf = NULL;
RETERR(dns_message_gettemprdata(msg, &newrdata));
dns_rdata_toregion(rdata, &r);
RETERR(isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length));
isc_buffer_availableregion(tmprdatabuf, &newr);
memcpy(newr.base, r.base, r.length);
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
dns_message_takebuffer(msg, &tmprdatabuf);
RETERR(dns_message_gettempname(msg, &newname));
dns_name_init(newname, NULL);
RETERR(dns_name_dup(name, msg->mctx, newname));
RETERR(dns_message_gettemprdatalist(msg, &newlist));
newlist->rdclass = newrdata->rdclass;
newlist->type = newrdata->type;
newlist->covers = 0;
newlist->ttl = ttl;
ISC_LIST_INIT(newlist->rdata);
ISC_LIST_APPEND(newlist->rdata, newrdata, link);
RETERR(dns_message_gettemprdataset(msg, &newset));
dns_rdataset_init(newset);
RETERR(dns_rdatalist_tordataset(newlist, newset));
ISC_LIST_INIT(newname->list);
ISC_LIST_APPEND(newname->list, newset, link);
ISC_LIST_APPEND(*namelist, newname, link);
return (ISC_R_SUCCESS);
failure:
if (newrdata != NULL) {
if (ISC_LINK_LINKED(newrdata, link))
ISC_LIST_UNLINK(newlist->rdata, newrdata, link);
dns_message_puttemprdata(msg, &newrdata);
}
if (newname != NULL)
dns_message_puttempname(msg, &newname);
if (newset != NULL) {
dns_rdataset_disassociate(newset);
dns_message_puttemprdataset(msg, &newset);
}
if (newlist != NULL)
dns_message_puttemprdatalist(msg, &newlist);
return (result);
}
示例7: dns_diff_sort
/*
* XXX uses qsort(); a merge sort would be more natural for lists,
* and perhaps safer wrt thread stack overflow.
*/
isc_result_t
dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) {
unsigned int length = 0;
unsigned int i;
dns_difftuple_t **v;
dns_difftuple_t *p;
REQUIRE(DNS_DIFF_VALID(diff));
for (p = ISC_LIST_HEAD(diff->tuples);
p != NULL;
p = ISC_LIST_NEXT(p, link))
length++;
if (length == 0)
return (ISC_R_SUCCESS);
v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *));
if (v == NULL)
return (ISC_R_NOMEMORY);
for (i = 0; i < length; i++) {
p = ISC_LIST_HEAD(diff->tuples);
v[i] = p;
ISC_LIST_UNLINK(diff->tuples, p, link);
}
INSIST(ISC_LIST_HEAD(diff->tuples) == NULL);
qsort(v, length, sizeof(v[0]), compare);
for (i = 0; i < length; i++) {
ISC_LIST_APPEND(diff->tuples, v[i], link);
}
isc_mem_put(diff->mctx, v, length * sizeof(dns_difftuple_t *));
return (ISC_R_SUCCESS);
}
示例8: destroy
static inline void
destroy(dns_ssutable_t *table) {
isc_mem_t *mctx;
REQUIRE(VALID_SSUTABLE(table));
mctx = table->mctx;
while (!ISC_LIST_EMPTY(table->rules)) {
dns_ssurule_t *rule = ISC_LIST_HEAD(table->rules);
if (rule->identity != NULL) {
dns_name_free(rule->identity, mctx);
isc_mem_put(mctx, rule->identity, sizeof(dns_name_t));
}
if (rule->name != NULL) {
dns_name_free(rule->name, mctx);
isc_mem_put(mctx, rule->name, sizeof(dns_name_t));
}
if (rule->types != NULL)
isc_mem_put(mctx, rule->types,
rule->ntypes * sizeof(dns_rdatatype_t));
ISC_LIST_UNLINK(table->rules, rule, link);
rule->magic = 0;
isc_mem_put(mctx, rule, sizeof(dns_ssurule_t));
}
DESTROYLOCK(&table->lock);
table->magic = 0;
isc_mem_putanddetach(&table->mctx, table, sizeof(dns_ssutable_t));
}
示例9: isc_ratelimiter_shutdown
void isc_ratelimiter_shutdown (isc_ratelimiter_t * rl)
{
isc_event_t *ev;
isc_task_t *task;
LOCK (&rl->lock);
rl->state = isc_ratelimiter_shuttingdown;
(void) isc_timer_reset (rl->timer, isc_timertype_inactive, NULL, NULL, ISC_FALSE);
while ((ev = ISC_LIST_HEAD (rl->pending)) != NULL)
{
ISC_LIST_UNLINK (rl->pending, ev, ev_link);
ev->ev_attributes |= ISC_EVENTATTR_CANCELED;
task = ev->ev_sender;
isc_task_send (task, &ev);
}
isc_timer_detach (&rl->timer);
/*
* Send an event to our task. The delivery of this event
* indicates that no more timer events will be delivered.
*/
ev = &rl->shutdownevent;
isc_task_send (rl->task, &ev);
UNLOCK (&rl->lock);
}
示例10: ns_lwsearchlist_detach
void
ns_lwsearchlist_detach(ns_lwsearchlist_t **listp) {
ns_lwsearchlist_t *list;
isc_mem_t *mctx;
REQUIRE(listp != NULL);
list = *listp;
REQUIRE(VALID_LWSEARCHLIST(list));
LOCK(&list->lock);
INSIST(list->refs > 0);
list->refs--;
UNLOCK(&list->lock);
*listp = NULL;
if (list->refs != 0)
return;
mctx = list->mctx;
while (!ISC_LIST_EMPTY(list->names)) {
dns_name_t *name = ISC_LIST_HEAD(list->names);
ISC_LIST_UNLINK(list->names, name, link);
dns_name_free(name, list->mctx);
isc_mem_put(list->mctx, name, sizeof(dns_name_t));
}
list->magic = 0;
isc_mem_put(mctx, list, sizeof(ns_lwsearchlist_t));
isc_mem_detach(&mctx);
}
示例11: shutdown_listener
static void
shutdown_listener(controllistener_t *listener) {
controlconnection_t *conn;
controlconnection_t *next;
if (!listener->exiting) {
char socktext[ISC_SOCKADDR_FORMATSIZE];
ISC_LIST_UNLINK(listener->controls->listeners, listener, link);
isc_sockaddr_format(&listener->address, socktext,
sizeof(socktext));
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
"stopping command channel on %s", socktext);
if (listener->type == isc_sockettype_unix)
isc_socket_cleanunix(&listener->address, ISC_TRUE);
listener->exiting = ISC_TRUE;
}
for (conn = ISC_LIST_HEAD(listener->connections);
conn != NULL;
conn = next)
{
next = ISC_LIST_NEXT(conn, link);
maybe_free_connection(conn);
}
if (listener->listening)
isc_socket_cancel(listener->sock, listener->task,
ISC_SOCKCANCEL_ACCEPT);
maybe_free_listener(listener);
}
示例12: do_one_tuple
/*%
* Update a single RR in version 'ver' of 'db' and log the
* update in 'diff'.
*
* Ensures:
* \li '*tuple' == NULL. Either the tuple is freed, or its
* ownership has been transferred to the diff.
*/
static isc_result_t
do_one_tuple(dns_difftuple_t **tuple, dns_db_t *db, dns_dbversion_t *ver,
dns_diff_t *diff)
{
dns_diff_t temp_diff;
isc_result_t result;
/*
* Create a singleton diff.
*/
dns_diff_init(diff->mctx, &temp_diff);
temp_diff.resign = diff->resign;
ISC_LIST_APPEND(temp_diff.tuples, *tuple, link);
/*
* Apply it to the database.
*/
result = dns_diff_apply(&temp_diff, db, ver);
ISC_LIST_UNLINK(temp_diff.tuples, *tuple, link);
if (result != ISC_R_SUCCESS) {
dns_difftuple_free(tuple);
return (result);
}
/*
* Merge it into the current pending journal entry.
*/
dns_diff_appendminimal(diff, tuple);
/*
* Do not clear temp_diff.
*/
return (ISC_R_SUCCESS);
}
示例13: configure_listener
static isc_result_t
configure_listener(isc_sockaddr_t *address, ns_lwresd_t *lwresd,
isc_mem_t *mctx, ns_lwreslistenerlist_t *newlisteners)
{
ns_lwreslistener_t *listener, *oldlistener = NULL;
char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_result_t result;
(void)find_listener(address, &oldlistener);
listener = NULL;
result = listener_create(mctx, lwresd, &listener);
if (result != ISC_R_SUCCESS) {
isc_sockaddr_format(address, socktext, sizeof(socktext));
isc_log_write(ns_g_lctx, ISC_LOGCATEGORY_GENERAL,
NS_LOGMODULE_LWRESD, ISC_LOG_WARNING,
"lwres failed to configure %s: %s",
socktext, isc_result_totext(result));
return (result);
}
/*
* If there's already a listener, don't rebind the socket.
*/
if (oldlistener == NULL) {
result = listener_bind(listener, address);
if (result != ISC_R_SUCCESS) {
ns_lwreslistener_detach(&listener);
return (ISC_R_SUCCESS);
}
} else
listener_copysock(oldlistener, listener);
result = listener_startclients(listener);
if (result != ISC_R_SUCCESS) {
isc_sockaddr_format(address, socktext, sizeof(socktext));
isc_log_write(ns_g_lctx, ISC_LOGCATEGORY_GENERAL,
NS_LOGMODULE_LWRESD, ISC_LOG_WARNING,
"lwres: failed to start %s: %s", socktext,
isc_result_totext(result));
ns_lwreslistener_detach(&listener);
return (ISC_R_SUCCESS);
}
if (oldlistener != NULL) {
/*
* Remove the old listener from the old list and shut it down.
*/
ISC_LIST_UNLINK(listeners, oldlistener, link);
listener_shutdown(oldlistener);
ns_lwreslistener_detach(&oldlistener);
} else {
isc_sockaddr_format(address, socktext, sizeof(socktext));
isc_log_write(ns_g_lctx, ISC_LOGCATEGORY_GENERAL,
NS_LOGMODULE_LWRESD, ISC_LOG_NOTICE,
"lwres listening on %s", socktext);
}
ISC_LIST_APPEND(*newlisteners, listener, link);
return (result);
}
示例14: free_namelist
static void
free_namelist(dns_message_t *msg, dns_namelist_t *namelist) {
dns_name_t *name;
dns_rdataset_t *set;
while (!ISC_LIST_EMPTY(*namelist)) {
name = ISC_LIST_HEAD(*namelist);
ISC_LIST_UNLINK(*namelist, name, link);
while (!ISC_LIST_EMPTY(name->list)) {
set = ISC_LIST_HEAD(name->list);
ISC_LIST_UNLINK(name->list, set, link);
dns_message_puttemprdataset(msg, &set);
}
dns_message_puttempname(msg, &name);
}
}
示例15: pk11_finalize
isc_result_t
pk11_finalize(void) {
pk11_token_t *token, *next;
isc_result_t ret;
ret = free_all_sessions();
(void) pkcs_C_Finalize(NULL_PTR);
token = ISC_LIST_HEAD(tokens);
while (token != NULL) {
next = ISC_LIST_NEXT(token, link);
ISC_LIST_UNLINK(tokens, token, link);
if (token == rand_token)
rand_token = NULL;
if (token == best_rsa_token)
best_rsa_token = NULL;
if (token == best_dsa_token)
best_dsa_token = NULL;
if (token == best_dh_token)
best_dh_token = NULL;
if (token == digest_token)
digest_token = NULL;
if (token == best_ec_token)
best_ec_token = NULL;
if (token == best_gost_token)
best_gost_token = NULL;
if (token == aes_token)
aes_token = NULL;
pk11_mem_put(token, sizeof(*token));
token = next;
}
if (pk11_mctx != NULL)
isc_mem_detach(&pk11_mctx);
initialized = ISC_FALSE;
return (ret);
}