Lines Matching refs:rctx
265 client_resfind(resctx_t *rctx, dns_fetchevent_t *event);
671 resctx_t *rctx = event->ev_arg;
675 REQUIRE(RCTX_VALID(rctx));
676 REQUIRE(rctx->task == task);
679 client_resfind(rctx, fevent);
683 start_fetch(resctx_t *rctx) {
688 * The caller must be holding the rctx's lock.
691 REQUIRE(rctx->fetch == NULL);
693 if (!rctx->want_cdflag) {
696 if (!rctx->want_validation) {
699 if (rctx->want_tcp) {
704 rctx->view->resolver, dns_fixedname_name(&rctx->name),
705 rctx->type, NULL, NULL, NULL, NULL, 0, fopts, 0, NULL,
706 rctx->task, fetch_done, rctx, rctx->rdataset, rctx->sigrdataset,
707 &rctx->fetch);
713 view_find(resctx_t *rctx, dns_db_t **dbp, dns_dbnode_t **nodep,
716 dns_name_t *name = dns_fixedname_name(&rctx->name);
719 if (rctx->type == dns_rdatatype_rrsig) {
722 type = rctx->type;
725 result = dns_view_find(rctx->view, name, type, 0, 0, false, false, dbp,
726 nodep, foundname, rctx->rdataset,
727 rctx->sigrdataset);
733 client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
749 REQUIRE(RCTX_VALID(rctx));
751 LOCK(&rctx->lock);
753 mctx = rctx->view->mctx;
755 name = dns_fixedname_name(&rctx->name);
763 rctx->restarts++;
766 if (event == NULL && !rctx->canceled) {
768 INSIST(!dns_rdataset_isassociated(rctx->rdataset));
769 INSIST(rctx->sigrdataset == NULL ||
770 !dns_rdataset_isassociated(rctx->sigrdataset));
771 result = view_find(rctx, &db, &node, fname);
784 result = start_fetch(rctx);
786 putrdataset(mctx, &rctx->rdataset);
787 if (rctx->sigrdataset != NULL) {
789 &rctx->sigrdataset);
797 INSIST(event->fetch == rctx->fetch);
798 dns_resolver_destroyfetch(&rctx->fetch);
804 INSIST(event->rdataset == rctx->rdataset);
805 INSIST(event->sigrdataset == rctx->sigrdataset);
811 if (rctx->canceled) {
818 dns_name_t *aname = dns_fixedname_name(&rctx->name);
837 trdataset = rctx->rdataset;
838 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
839 rctx->rdataset = NULL;
840 if (rctx->sigrdataset != NULL) {
842 rctx->sigrdataset, link);
843 rctx->sigrdataset = NULL;
845 ISC_LIST_APPEND(rctx->namelist, ansname, link);
870 trdataset = rctx->rdataset;
871 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
872 rctx->rdataset = NULL;
873 if (rctx->sigrdataset != NULL) {
875 rctx->sigrdataset, link);
876 rctx->sigrdataset = NULL;
878 ISC_LIST_APPEND(rctx->namelist, ansname, link);
915 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
916 ISC_LIST_APPEND(rctx->namelist, ansname, link);
918 rctx->rdataset = NULL;
920 if (rctx->sigrdataset != NULL) {
921 putrdataset(mctx, &rctx->sigrdataset);
926 if (rctx->rdataset != NULL) {
927 putrdataset(mctx, &rctx->rdataset);
929 if (rctx->sigrdataset != NULL) {
930 putrdataset(mctx, &rctx->sigrdataset);
936 if (rctx->type == dns_rdatatype_any) {
950 rctx->rdataset);
951 if (rctx->rdataset->type != 0) {
953 rctx->rdataset, link);
955 rctx->rdataset = NULL;
962 rctx->rdataset);
967 rctx->rdataset == NULL)
970 &rctx->rdataset);
978 if (rctx->rdataset != NULL) {
979 putrdataset(mctx, &rctx->rdataset);
981 if (rctx->sigrdataset != NULL) {
982 putrdataset(mctx, &rctx->sigrdataset);
993 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1008 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
1009 rctx->rdataset = NULL;
1010 if (rctx->sigrdataset != NULL) {
1012 rctx->sigrdataset, link);
1013 rctx->sigrdataset = NULL;
1015 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1049 if (want_restart && rctx->restarts == MAX_RESTARTS) {
1059 INSIST(rctx->rdataset == NULL &&
1060 rctx->sigrdataset == NULL);
1062 result = getrdataset(mctx, &rctx->rdataset);
1063 if (result == ISC_R_SUCCESS && rctx->want_dnssec) {
1064 result = getrdataset(mctx, &rctx->sigrdataset);
1066 putrdataset(mctx, &rctx->rdataset);
1080 while ((name = ISC_LIST_HEAD(rctx->namelist)) != NULL) {
1081 ISC_LIST_UNLINK(rctx->namelist, name, link);
1082 ISC_LIST_APPEND(rctx->event->answerlist, name, link);
1085 rctx->event->result = result;
1086 rctx->event->vresult = vresult;
1087 task = rctx->event->ev_sender;
1088 rctx->event->ev_sender = rctx;
1089 isc_task_sendanddetach(&task, ISC_EVENT_PTR(&rctx->event));
1092 UNLOCK(&rctx->lock);
1241 resctx_t *rctx = NULL;
1278 rctx = isc_mem_get(mctx, sizeof(*rctx));
1279 isc_mutex_init(&rctx->lock);
1285 rctx->rdataset = rdataset;
1293 rctx->sigrdataset = sigrdataset;
1295 dns_fixedname_init(&rctx->name);
1296 dns_name_copynf(name, dns_fixedname_name(&rctx->name));
1298 rctx->client = client;
1299 ISC_LINK_INIT(rctx, link);
1300 rctx->canceled = false;
1301 rctx->task = client->task;
1302 rctx->type = type;
1303 rctx->view = view;
1304 rctx->restarts = 0;
1305 rctx->fetch = NULL;
1306 rctx->want_dnssec = want_dnssec;
1307 rctx->want_validation = want_validation;
1308 rctx->want_cdflag = want_cdflag;
1309 rctx->want_tcp = want_tcp;
1310 ISC_LIST_INIT(rctx->namelist);
1311 rctx->event = event;
1313 rctx->magic = RCTX_MAGIC;
1317 ISC_LIST_APPEND(client->resctxs, rctx, link);
1320 *transp = (dns_clientrestrans_t *)rctx;
1321 client_resfind(rctx, NULL);
1332 isc_mutex_destroy(&rctx->lock);
1333 isc_mem_put(mctx, rctx, sizeof(*rctx));
1343 resctx_t *rctx;
1346 rctx = (resctx_t *)trans;
1347 REQUIRE(RCTX_VALID(rctx));
1349 LOCK(&rctx->lock);
1351 if (!rctx->canceled) {
1352 rctx->canceled = true;
1353 rctx->fetch != NULL) {
1354 dns_resolver_cancelfetch(rctx->fetch);
1358 UNLOCK(&rctx->lock);
1382 resctx_t *rctx;
1387 rctx = (resctx_t *)*transp;
1389 REQUIRE(RCTX_VALID(rctx));
1390 REQUIRE(rctx->fetch == NULL);
1391 REQUIRE(rctx->event == NULL);
1392 client = rctx->client;
1396 dns_view_detach(&rctx->view);
1402 LOCK(&rctx->lock);
1403 UNLOCK(&rctx->lock);
1407 INSIST(ISC_LINK_LINKED(rctx, link));
1408 ISC_LIST_UNLINK(client->resctxs, rctx, link);
1412 INSIST(ISC_LIST_EMPTY(rctx->namelist));
1414 isc_mutex_destroy(&rctx->lock);
1415 rctx->magic = 0;
1417 isc_mem_put(mctx, rctx, sizeof(*rctx));