Lines Matching refs:client

25 #include <dns/client.h>
69 * DNS client object
122 dns_client_t *client;
150 dns_client_t *client;
168 dns_client_t *client;
185 dns_client_t *client;
200 dns_client_t *client;
216 dns_client_t *client;
407 /* client has its own reference to mctx, so we can detach it here */
444 dns_client_t *client;
457 client = isc_mem_get(mctx, sizeof(*client));
458 if (client == NULL)
461 result = isc_mutex_init(&client->lock);
463 isc_mem_put(mctx, client, sizeof(*client));
467 client->actx = actx;
468 client->taskmgr = taskmgr;
469 client->socketmgr = socketmgr;
470 client->timermgr = timermgr;
472 client->task = NULL;
473 result = isc_task_create(client->taskmgr, 0, &client->task);
480 client->dispatchmgr = dispatchmgr;
486 client->dispatchv4 = NULL;
492 client->dispatchv4 = dispatchv4;
495 client->dispatchv6 = NULL;
501 client->dispatchv6 = dispatchv6;
516 ISC_LIST_INIT(client->viewlist);
517 ISC_LIST_APPEND(client->viewlist, view, link);
521 ISC_LIST_INIT(client->resctxs);
522 ISC_LIST_INIT(client->reqctxs);
523 ISC_LIST_INIT(client->updatectxs);
525 client->mctx = NULL;
526 isc_mem_attach(mctx, &client->mctx);
528 client->update_timeout = DEF_UPDATE_TIMEOUT;
529 client->update_udptimeout = DEF_UPDATE_UDPTIMEOUT;
530 client->update_udpretries = DEF_UPDATE_UDPRETRIES;
531 client->find_timeout = DEF_FIND_TIMEOUT;
532 client->find_udpretries = DEF_FIND_UDPRETRIES;
533 client->attributes = 0;
535 client->references = 1;
536 client->magic = DNS_CLIENT_MAGIC;
538 *clientp = client;
549 if (client->task != NULL)
550 isc_task_detach(&client->task);
551 isc_mem_put(mctx, client, sizeof(*client));
558 dns_client_t *client = *clientp;
561 while ((view = ISC_LIST_HEAD(client->viewlist)) != NULL) {
562 ISC_LIST_UNLINK(client->viewlist, view, link);
566 if (client->dispatchv4 != NULL)
567 dns_dispatch_detach(&client->dispatchv4);
568 if (client->dispatchv6 != NULL)
569 dns_dispatch_detach(&client->dispatchv6);
571 dns_dispatchmgr_destroy(&client->dispatchmgr);
573 isc_task_detach(&client->task);
576 * If the client has created its own running environments,
579 if ((client->attributes & DNS_CLIENTATTR_OWNCTX) != 0) {
580 isc_taskmgr_destroy(&client->taskmgr);
581 isc_timermgr_destroy(&client->timermgr);
582 isc_socketmgr_destroy(&client->socketmgr);
584 isc_app_ctxfinish(client->actx);
585 isc_appctx_destroy(&client->actx);
588 DESTROYLOCK(&client->lock);
589 client->magic = 0;
591 isc_mem_putanddetach(&client->mctx, client, sizeof(*client));
598 dns_client_t *client;
602 client = *clientp;
603 REQUIRE(DNS_CLIENT_VALID(client));
605 LOCK(&client->lock);
606 client->references--;
607 if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
608 ISC_LIST_EMPTY(client->reqctxs) &&
609 ISC_LIST_EMPTY(client->updatectxs)) {
612 UNLOCK(&client->lock);
615 destroyclient(&client);
621 dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
627 REQUIRE(DNS_CLIENT_VALID(client));
633 LOCK(&client->lock);
634 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
637 UNLOCK(&client->lock);
640 UNLOCK(&client->lock);
651 dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
657 REQUIRE(DNS_CLIENT_VALID(client));
662 LOCK(&client->lock);
663 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
666 UNLOCK(&client->lock);
669 UNLOCK(&client->lock);
679 dns_client_setdlv(dns_client_t *client, dns_rdataclass_t rdclass,
686 REQUIRE(DNS_CLIENT_VALID(client));
688 LOCK(&client->lock);
689 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
691 UNLOCK(&client->lock);
1213 result = isc_app_ctxonrun(resarg->actx, resarg->client->mctx,
1224 isc_mem_put(resarg->client->mctx, resarg, sizeof(*resarg));
1229 dns_client_resolve(dns_client_t *client, dns_name_t *name,
1237 REQUIRE(DNS_CLIENT_VALID(client));
1240 if ((client->attributes & DNS_CLIENTATTR_OWNCTX) == 0 &&
1243 * If the client is run under application's control, we need
1249 actx = client->actx;
1251 resarg = isc_mem_get(client->mctx, sizeof(*resarg));
1257 isc_mem_put(client->mctx, resarg, sizeof(*resarg));
1262 resarg->client = client;
1267 result = dns_client_startresolve(client, name, rdclass, type, options,
1268 client->task, resolve_done, resarg,
1272 isc_mem_put(client->mctx, resarg, sizeof(*resarg));
1308 isc_mem_put(client->mctx, resarg, sizeof(*resarg));
1315 dns_client_startresolve(dns_client_t *client, dns_name_t *name,
1330 REQUIRE(DNS_CLIENT_VALID(client));
1333 LOCK(&client->lock);
1334 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
1336 UNLOCK(&client->lock);
1340 mctx = client->mctx;
1393 rctx->client = client;
1396 rctx->task = client->task;
1410 LOCK(&client->lock);
1411 ISC_LIST_APPEND(client->resctxs, rctx, link);
1412 UNLOCK(&client->lock);
1421 putrdataset(client->mctx, &rdataset);
1423 putrdataset(client->mctx, &sigrdataset);
1456 dns_client_freeresanswer(dns_client_t *client, dns_namelist_t *namelist) {
1460 REQUIRE(DNS_CLIENT_VALID(client));
1467 putrdataset(client->mctx, &rdataset);
1469 dns_name_free(name, client->mctx);
1470 isc_mem_put(client->mctx, name, sizeof(*name));
1478 dns_client_t *client;
1486 client = rctx->client;
1487 REQUIRE(DNS_CLIENT_VALID(client));
1489 mctx = client->mctx;
1499 LOCK(&client->lock);
1502 ISC_LIST_UNLINK(client->resctxs, rctx, link);
1504 if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
1505 ISC_LIST_EMPTY(client->reqctxs) &&
1506 ISC_LIST_EMPTY(client->updatectxs))
1509 UNLOCK(&client->lock);
1519 destroyclient(&client);
1525 dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
1533 REQUIRE(DNS_CLIENT_VALID(client));
1535 LOCK(&client->lock);
1536 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
1538 UNLOCK(&client->lock);
1546 result = dst_key_fromdns(keyname, rdclass, keydatabuf, client->mctx,
1632 isc_mem_put(reqarg->client->mctx, reqarg, sizeof(*reqarg));
1637 dns_client_request(dns_client_t *client, dns_message_t *qmessage,
1647 REQUIRE(DNS_CLIENT_VALID(client));
1651 if ((client->attributes & DNS_CLIENTATTR_OWNCTX) == 0 &&
1654 * If the client is run under application's control, we need
1660 actx = client->actx;
1662 reqarg = isc_mem_get(client->mctx, sizeof(*reqarg));
1668 isc_mem_put(client->mctx, reqarg, sizeof(*reqarg));
1673 reqarg->client = client;
1677 result = dns_client_startrequest(client, qmessage, rmessage, server,
1680 client->task, localrequest_done,
1684 isc_mem_put(client->mctx, reqarg, sizeof(*reqarg));
1712 isc_mem_put(client->mctx, reqarg, sizeof(*reqarg));
1719 dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
1735 REQUIRE(DNS_CLIENT_VALID(client));
1746 LOCK(&client->lock);
1747 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
1749 UNLOCK(&client->lock);
1760 isc_event_allocate(client->mctx, tclone,
1768 ctx = isc_mem_get(client->mctx, sizeof(*ctx));
1774 isc_mem_put(client->mctx, ctx, sizeof(*ctx));
1781 ctx->client = client;
1793 LOCK(&client->lock);
1794 ISC_LIST_APPEND(client->reqctxs, ctx, link);
1795 UNLOCK(&client->lock);
1801 client->task, request_done, ctx,
1811 LOCK(&client->lock);
1812 ISC_LIST_UNLINK(client->reqctxs, ctx, link);
1813 UNLOCK(&client->lock);
1815 isc_mem_put(client->mctx, ctx, sizeof(*ctx));
1848 dns_client_t *client;
1854 client = ctx->client;
1855 REQUIRE(DNS_CLIENT_VALID(client));
1860 mctx = client->mctx;
1862 LOCK(&client->lock);
1865 ISC_LIST_UNLINK(client->reqctxs, ctx, link);
1867 if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
1868 ISC_LIST_EMPTY(client->reqctxs) &&
1869 ISC_LIST_EMPTY(client->updatectxs)) {
1873 UNLOCK(&client->lock);
1881 destroyclient(&client);
1947 dns_client_t *client;
1956 client = uctx->client;
1957 REQUIRE(DNS_CLIENT_VALID(client));
1963 result = dns_message_create(client->mctx, DNS_MESSAGE_INTENTPARSE,
1999 timeout = client->update_timeout / uctx->nservers;
2012 client->update_udptimeout,
2013 client->update_udpretries,
2014 client->task,
2035 dns_client_t *client = uctx->client;
2060 timeout = client->update_timeout / uctx->nservers;
2070 client->update_udptimeout,
2071 client->update_udpretries,
2072 client->task, update_done, uctx,
2136 sa = isc_mem_get(uctx->client->mctx,
2179 dns_client_freeresanswer(uctx->client, &rev->answerlist);
2239 result = dns_client_startresolve(uctx->client, &primary,
2243 uctx->client->task,
2248 result = dns_client_startresolve(uctx->client,
2253 uctx->client->task,
2271 dns_client_t *client;
2294 client = uctx->client;
2306 result = dns_message_create(uctx->client->mctx,
2325 client->find_timeout * 20,
2326 client->find_timeout, 3,
2327 uctx->client->task,
2430 client->find_timeout *
2432 client->find_timeout,
2433 3, client->task,
2462 result = dns_message_create(uctx->client->mctx,
2488 uctx->client->find_timeout * 20,
2489 uctx->client->find_timeout, 3,
2490 uctx->client->task, receive_soa, uctx,
2561 result = dns_client_startresolve(uctx->client, &uctx->soaqname,
2565 uctx->client->task,
2572 dns_client_freeresanswer(uctx->client, &rev->answerlist);
2690 isc_mem_put(uarg->client->mctx, uarg, sizeof(*uarg));
2695 dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
2704 REQUIRE(DNS_CLIENT_VALID(client));
2706 if ((client->attributes & DNS_CLIENTATTR_OWNCTX) == 0 &&
2709 * If the client is run under application's control, we need
2715 actx = client->actx;
2717 uarg = isc_mem_get(client->mctx, sizeof(*uarg));
2723 isc_mem_put(client->mctx, uarg, sizeof(*uarg));
2728 uarg->client = client;
2733 result = dns_client_startupdate(client, rdclass, zonename,
2735 tsec, options, client->task,
2740 isc_mem_put(client->mctx, uarg, sizeof(*uarg));
2769 isc_mem_put(client->mctx, uarg, sizeof(*uarg));
2800 result = dns_client_startresolve(uctx->client, &uctx->soaqname,
2803 uctx->client->task,
2818 dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
2837 REQUIRE(DNS_CLIENT_VALID(client));
2848 LOCK(&client->lock);
2849 result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
2851 UNLOCK(&client->lock);
2861 uctx = isc_mem_get(client->mctx, sizeof(*uctx));
2870 isc_mem_put(client->mctx, uctx, sizeof(*uctx));
2876 uctx->client = client;
2903 isc_event_allocate(client->mctx, tclone, DNS_EVENT_UPDATEDONE,
2915 sa = isc_mem_get(client->mctx, sizeof(*sa));
2929 result = dns_message_create(client->mctx, DNS_MESSAGE_INTENTRENDER,
2939 result = copy_name(client->mctx, uctx->updatemsg,
2951 result = copy_name(client->mctx, uctx->updatemsg, name,
2971 LOCK(&client->lock);
2972 ISC_LIST_APPEND(client->updatectxs, uctx, link);
2973 UNLOCK(&client->lock);
2976 result = isc_app_ctxonrun(client->actx, client->mctx, client->task,
2980 event = isc_event_allocate(client->mctx, dns_client_startupdate,
2995 LOCK(&client->lock);
2996 ISC_LIST_UNLINK(client->updatectxs, uctx, link);
2997 UNLOCK(&client->lock);
3003 isc_mem_put(client->mctx, sa, sizeof(*sa));
3012 isc_mem_put(client->mctx, uctx, sizeof(*uctx));
3047 dns_client_t *client;
3054 client = uctx->client;
3055 REQUIRE(DNS_CLIENT_VALID(client));
3061 mctx = client->mctx;
3068 LOCK(&client->lock);
3071 ISC_LIST_UNLINK(client->updatectxs, uctx, link);
3073 if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
3074 ISC_LIST_EMPTY(client->reqctxs) &&
3075 ISC_LIST_EMPTY(client->updatectxs))
3078 UNLOCK(&client->lock);
3086 destroyclient(&client);
3092 dns_client_mctx(dns_client_t *client) {
3094 REQUIRE(DNS_CLIENT_VALID(client));
3095 return (client->mctx);