Lines Matching refs:doh
215 static int doh_done(struct Curl_easy *doh, CURLcode result) in doh_done() argument
219 data = Curl_multi_get_handle(doh->multi, doh->set.dohfor_mid); in doh_done()
221 DEBUGF(infof(doh, "doh_done: xfer for mid=%" FMT_OFF_T in doh_done()
222 " not found", doh->set.dohfor_mid)); in doh_done()
226 struct doh_probes *dohp = data->req.doh; in doh_done()
229 infof(doh, "a DoH request is completed, %u to go", dohp->pending); in doh_done()
231 infof(doh, "DoH request %s", curl_easy_strerror(result)); in doh_done()
243 result = curl_easy_setopt((CURL *)doh, x, y); \
256 struct Curl_easy *doh = NULL; in doh_run_probe() local
275 result = Curl_open(&doh); in doh_run_probe()
281 doh->state.internal = TRUE; in doh_run_probe()
283 doh->state.feat = &Curl_doh_trc; in doh_run_probe()
375 (void)curl_easy_setopt(doh, CURLOPT_SSL_OPTIONS, mask); in doh_run_probe()
378 doh->set.fmultidone = doh_done; in doh_run_probe()
379 doh->set.dohfor_mid = data->mid; /* for which transfer this is done */ in doh_run_probe()
385 DEBUGASSERT(!doh->set.private_data); in doh_run_probe()
387 if(curl_multi_add_handle(multi, doh)) in doh_run_probe()
390 p->easy_mid = doh->mid; in doh_run_probe()
394 Curl_close(&doh); in doh_run_probe()
423 DEBUGASSERT(!data->req.doh); in Curl_doh()
427 dohp = data->req.doh = calloc(1, sizeof(struct doh_probes)); in Curl_doh()
435 conn->bits.doh = TRUE; in Curl_doh()
502 static DOHcode doh_skipqname(const unsigned char *doh, size_t dohlen, in doh_skipqname() argument
509 length = doh[*indexp]; in doh_skipqname()
526 static unsigned short doh_get16bit(const unsigned char *doh, in doh_get16bit() argument
529 return (unsigned short)((doh[index] << 8) | doh[index + 1]); in doh_get16bit()
532 static unsigned int doh_get32bit(const unsigned char *doh, unsigned int index) in doh_get32bit() argument
536 doh += index; in doh_get32bit()
541 return ((unsigned)doh[0] << 24) | ((unsigned)doh[1] << 16) | in doh_get32bit()
542 ((unsigned)doh[2] << 8) | doh[3]; in doh_get32bit()
545 static void doh_store_a(const unsigned char *doh, int index, in doh_store_a() argument
552 memcpy(&a->ip.v4, &doh[index], 4); in doh_store_a()
557 static void doh_store_aaaa(const unsigned char *doh, int index, in doh_store_aaaa() argument
564 memcpy(&a->ip.v6, &doh[index], 16); in doh_store_aaaa()
570 static DOHcode doh_store_https(const unsigned char *doh, int index, in doh_store_https() argument
576 h->val = Curl_memdup(&doh[index], len); in doh_store_https()
586 static DOHcode doh_store_cname(const unsigned char *doh, size_t dohlen, in doh_store_cname() argument
600 length = doh[index]; in doh_store_cname()
608 newpos = (length & 0x3f) << 8 | doh[index + 1]; in doh_store_cname()
625 if(Curl_dyn_addn(c, &doh[index], length)) in doh_store_cname()
636 static DOHcode doh_rdata(const unsigned char *doh, in doh_rdata() argument
654 doh_store_a(doh, index, d); in doh_rdata()
659 doh_store_aaaa(doh, index, d); in doh_rdata()
663 rc = doh_store_https(doh, index, d, rdlength); in doh_rdata()
669 rc = doh_store_cname(doh, dohlen, (unsigned int)index, d); in doh_rdata()
693 UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, in doh_resp_decode() argument
710 if(!doh || doh[0] || doh[1]) in doh_resp_decode()
712 rcode = doh[3] & 0x0f; in doh_resp_decode()
716 qdcount = doh_get16bit(doh, 4); in doh_resp_decode()
718 rc = doh_skipqname(doh, dohlen, &index); in doh_resp_decode()
727 ancount = doh_get16bit(doh, 6); in doh_resp_decode()
732 rc = doh_skipqname(doh, dohlen, &index); in doh_resp_decode()
739 type = doh_get16bit(doh, index); in doh_resp_decode()
749 class = doh_get16bit(doh, index); in doh_resp_decode()
757 ttl = doh_get32bit(doh, index); in doh_resp_decode()
765 rdlength = doh_get16bit(doh, index); in doh_resp_decode()
770 rc = doh_rdata(doh, dohlen, rdlength, type, (int)index, d); in doh_resp_decode()
777 nscount = doh_get16bit(doh, 8); in doh_resp_decode()
779 rc = doh_skipqname(doh, dohlen, &index); in doh_resp_decode()
791 rdlength = doh_get16bit(doh, index); in doh_resp_decode()
799 arcount = doh_get16bit(doh, 10); in doh_resp_decode()
801 rc = doh_skipqname(doh, dohlen, &index); in doh_resp_decode()
813 rdlength = doh_get16bit(doh, index); in doh_resp_decode()
1298 struct doh_probes *dohp = data->req.doh; in Curl_doh_is_resolved()
1404 struct doh_probes *doh = data->req.doh; in Curl_doh_close() local
1405 if(doh && data->multi) { in Curl_doh_close()
1410 mid = doh->probe[slot].easy_mid; in Curl_doh_close()
1413 doh->probe[slot].easy_mid = -1; in Curl_doh_close()
1421 doh->probe[slot].easy_mid)); in Curl_doh_close()
1433 struct doh_probes *doh = data->req.doh; in Curl_doh_cleanup() local
1434 if(doh) { in Curl_doh_cleanup()
1436 curl_slist_free_all(doh->req_hds); in Curl_doh_cleanup()
1437 data->req.doh->req_hds = NULL; in Curl_doh_cleanup()
1438 Curl_safefree(data->req.doh); in Curl_doh_cleanup()