Lines Matching refs:rctx

248 static void client_resfind(resctx_t *rctx, dns_fetchevent_t *event);
754 resctx_t *rctx = event->ev_arg;
758 REQUIRE(RCTX_VALID(rctx));
759 REQUIRE(rctx->task == task);
762 client_resfind(rctx, fevent);
766 start_fetch(resctx_t *rctx) {
771 * The caller must be holding the rctx's lock.
774 REQUIRE(rctx->fetch == NULL);
776 if (!rctx->want_cdflag)
778 if (!rctx->want_validation)
780 if (rctx->want_tcp)
783 result = dns_resolver_createfetch(rctx->view->resolver,
784 dns_fixedname_name(&rctx->name),
785 rctx->type,
787 rctx->task, fetch_done, rctx,
788 rctx->rdataset,
789 rctx->sigrdataset,
790 &rctx->fetch);
796 view_find(resctx_t *rctx, dns_db_t **dbp, dns_dbnode_t **nodep,
800 dns_name_t *name = dns_fixedname_name(&rctx->name);
803 if (rctx->type == dns_rdatatype_rrsig)
806 type = rctx->type;
808 result = dns_view_find(rctx->view, name, type, 0, 0, ISC_FALSE,
809 dbp, nodep, foundname, rctx->rdataset,
810 rctx->sigrdataset);
816 client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
832 REQUIRE(RCTX_VALID(rctx));
834 LOCK(&rctx->lock);
836 mctx = rctx->view->mctx;
838 name = dns_fixedname_name(&rctx->name);
846 rctx->restarts++;
849 if (event == NULL && !rctx->canceled) {
852 INSIST(!dns_rdataset_isassociated(rctx->rdataset));
853 INSIST(rctx->sigrdataset == NULL ||
854 !dns_rdataset_isassociated(rctx->sigrdataset));
855 result = view_find(rctx, &db, &node, fname);
867 result = start_fetch(rctx);
869 putrdataset(mctx, &rctx->rdataset);
870 if (rctx->sigrdataset != NULL)
872 &rctx->sigrdataset);
879 INSIST(event->fetch == rctx->fetch);
880 dns_resolver_destroyfetch(&rctx->fetch);
886 INSIST(event->rdataset == rctx->rdataset);
887 INSIST(event->sigrdataset == rctx->sigrdataset);
893 if (rctx->canceled)
906 aname = dns_fixedname_name(&rctx->name);
928 trdataset = rctx->rdataset;
929 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
930 rctx->rdataset = NULL;
931 if (rctx->sigrdataset != NULL) {
933 rctx->sigrdataset, link);
934 rctx->sigrdataset = NULL;
936 ISC_LIST_APPEND(rctx->namelist, ansname, link);
962 trdataset = rctx->rdataset;
963 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
964 rctx->rdataset = NULL;
965 if (rctx->sigrdataset != NULL) {
967 rctx->sigrdataset, link);
968 rctx->sigrdataset = NULL;
970 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1007 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
1008 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1010 rctx->rdataset = NULL;
1012 if (rctx->sigrdataset != NULL)
1013 putrdataset(mctx, &rctx->sigrdataset);
1017 if (rctx->rdataset != NULL)
1018 putrdataset(mctx, &rctx->rdataset);
1019 if (rctx->sigrdataset != NULL)
1020 putrdataset(mctx, &rctx->sigrdataset);
1025 if (rctx->type == dns_rdatatype_any) {
1039 rctx->rdataset);
1040 if (rctx->rdataset->type != 0) {
1042 rctx->rdataset,
1045 rctx->rdataset = NULL;
1052 rctx->rdataset);
1057 rctx->rdataset == NULL) {
1059 &rctx->rdataset);
1076 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1090 ISC_LIST_APPEND(ansname->list, rctx->rdataset, link);
1091 rctx->rdataset = NULL;
1092 if (rctx->sigrdataset != NULL) {
1094 rctx->sigrdataset, link);
1095 rctx->sigrdataset = NULL;
1097 ISC_LIST_APPEND(rctx->namelist, ansname, link);
1127 if (want_restart && rctx->restarts == MAX_RESTARTS) {
1137 INSIST(rctx->rdataset == NULL &&
1138 rctx->sigrdataset == NULL);
1140 result = getrdataset(mctx, &rctx->rdataset);
1141 if (result == ISC_R_SUCCESS && rctx->want_dnssec) {
1142 result = getrdataset(mctx, &rctx->sigrdataset);
1144 putrdataset(mctx, &rctx->rdataset);
1158 while ((name = ISC_LIST_HEAD(rctx->namelist)) != NULL) {
1159 ISC_LIST_UNLINK(rctx->namelist, name, link);
1160 ISC_LIST_APPEND(rctx->event->answerlist, name, link);
1163 rctx->event->result = result;
1164 rctx->event->vresult = vresult;
1165 task = rctx->event->ev_sender;
1166 rctx->event->ev_sender = rctx;
1167 isc_task_sendanddetach(&task, ISC_EVENT_PTR(&rctx->event));
1170 UNLOCK(&rctx->lock);
1323 resctx_t *rctx = NULL;
1363 rctx = isc_mem_get(mctx, sizeof(*rctx));
1364 if (rctx == NULL)
1367 result = isc_mutex_init(&rctx->lock);
1369 isc_mem_put(mctx, rctx, sizeof(*rctx));
1370 rctx = NULL;
1379 rctx->rdataset = rdataset;
1386 rctx->sigrdataset = sigrdataset;
1388 dns_fixedname_init(&rctx->name);
1389 result = dns_name_copy(name, dns_fixedname_name(&rctx->name), NULL);
1393 rctx->client = client;
1394 ISC_LINK_INIT(rctx, link);
1395 rctx->canceled = ISC_FALSE;
1396 rctx->task = client->task;
1397 rctx->type = type;
1398 rctx->view = view;
1399 rctx->restarts = 0;
1400 rctx->fetch = NULL;
1401 rctx->want_dnssec = want_dnssec;
1402 rctx->want_validation = want_validation;
1403 rctx->want_cdflag = want_cdflag;
1404 rctx->want_tcp = want_tcp;
1405 ISC_LIST_INIT(rctx->namelist);
1406 rctx->event = event;
1408 rctx->magic = RCTX_MAGIC;
1411 ISC_LIST_APPEND(client->resctxs, rctx, link);
1414 *transp = (dns_clientrestrans_t *)rctx;
1415 client_resfind(rctx, NULL);
1424 if (rctx != NULL) {
1425 DESTROYLOCK(&rctx->lock);
1426 isc_mem_put(mctx, rctx, sizeof(*rctx));
1438 resctx_t *rctx;
1441 rctx = (resctx_t *)trans;
1442 REQUIRE(RCTX_VALID(rctx));
1444 LOCK(&rctx->lock);
1446 if (!rctx->canceled) {
1447 rctx->canceled = ISC_TRUE;
1448 if (rctx->fetch != NULL)
1449 dns_resolver_cancelfetch(rctx->fetch);
1452 UNLOCK(&rctx->lock);
1476 resctx_t *rctx;
1482 rctx = (resctx_t *)*transp;
1483 REQUIRE(RCTX_VALID(rctx));
1484 REQUIRE(rctx->fetch == NULL);
1485 REQUIRE(rctx->event == NULL);
1486 client = rctx->client;
1490 dns_view_detach(&rctx->view);
1496 LOCK(&rctx->lock);
1497 UNLOCK(&rctx->lock);
1501 INSIST(ISC_LINK_LINKED(rctx, link));
1502 ISC_LIST_UNLINK(client->resctxs, rctx, link);
1511 INSIST(ISC_LIST_EMPTY(rctx->namelist));
1513 DESTROYLOCK(&rctx->lock);
1514 rctx->magic = 0;
1516 isc_mem_put(mctx, rctx, sizeof(*rctx));