data->sub_xfer_done = doh_probe_done;
/* create IPv4 DoH request */
- result = doh_probe_run(data, DNS_TYPE_A,
+ result = doh_probe_run(data, CURL_DNS_TYPE_A,
hostname, data->set.str[STRING_DOH],
data->multi,
&dohp->probe_resp[DOH_SLOT_IPV4].probe_mid);
#ifdef USE_IPV6
if((ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
/* create IPv6 DoH request */
- result = doh_probe_run(data, DNS_TYPE_AAAA,
+ result = doh_probe_run(data, CURL_DNS_TYPE_AAAA,
hostname, data->set.str[STRING_DOH],
data->multi,
&dohp->probe_resp[DOH_SLOT_IPV6].probe_mid);
if(!qname)
goto error;
}
- result = doh_probe_run(data, DNS_TYPE_HTTPS,
+ result = doh_probe_run(data, CURL_DNS_TYPE_HTTPS,
qname ? qname : hostname, data->set.str[STRING_DOH],
data->multi,
&dohp->probe_resp[DOH_SLOT_HTTPS_RR].probe_mid);
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
struct dohaddr *a = &d->addr[d->numaddr];
- a->type = DNS_TYPE_A;
+ a->type = CURL_DNS_TYPE_A;
memcpy(&a->ip.v4, &doh[index], 4);
d->numaddr++;
}
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
struct dohaddr *a = &d->addr[d->numaddr];
- a->type = DNS_TYPE_AAAA;
+ a->type = CURL_DNS_TYPE_AAAA;
memcpy(&a->ip.v6, &doh[index], 16);
d->numaddr++;
}
DOHcode rc;
switch(type) {
- case DNS_TYPE_A:
+ case CURL_DNS_TYPE_A:
if(rdlength != 4)
return DOH_DNS_RDATA_LEN;
doh_store_a(doh, index, d);
break;
- case DNS_TYPE_AAAA:
+ case CURL_DNS_TYPE_AAAA:
if(rdlength != 16)
return DOH_DNS_RDATA_LEN;
doh_store_aaaa(doh, index, d);
break;
#ifdef USE_HTTPSRR
- case DNS_TYPE_HTTPS:
+ case CURL_DNS_TYPE_HTTPS:
rc = doh_store_https(doh, index, d, rdlength);
if(rc)
return rc;
break;
#endif
- case DNS_TYPE_CNAME:
+ case CURL_DNS_TYPE_CNAME:
rc = doh_store_cname(doh, dohlen, (unsigned int)index, d);
if(rc)
return rc;
break;
- case DNS_TYPE_DNAME:
+ case CURL_DNS_TYPE_DNAME:
/* explicit for clarity; just skip; rely on synthesized CNAME */
break;
default:
return DOH_DNS_OUT_OF_RANGE;
type = doh_get16bit(doh, index);
- if((type != DNS_TYPE_CNAME) /* may be synthesized from DNAME */
- && (type != DNS_TYPE_DNAME) /* if present, accept and ignore */
+ if((type != CURL_DNS_TYPE_CNAME) /* may be synthesized from DNAME */
+ && (type != CURL_DNS_TYPE_DNAME) /* if present, accept and ignore */
&& (type != dnstype))
/* Not the same type as was asked for nor CNAME nor DNAME */
return DOH_DNS_UNEXPECTED_TYPE;
return DOH_DNS_MALFORMAT; /* something is wrong */
#ifdef USE_HTTTPS
- if((type != DNS_TYPE_NS) && !d->numcname && !d->numaddr && !d->numhttps_rrs)
+ if((type != CURL_DNS_TYPE_NS) && !d->numcname && !d->numaddr &&
+ !d->numhttps_rrs)
#else
- if((type != DNS_TYPE_NS) && !d->numcname && !d->numaddr)
+ if((type != CURL_DNS_TYPE_NS) && !d->numcname && !d->numaddr)
#endif
/* nothing stored! */
return DOH_NO_CONTENT;
infof(data, "[DoH] TTL: %u seconds", d->ttl);
for(i = 0; i < d->numaddr; i++) {
const struct dohaddr *a = &d->addr[i];
- if(a->type == DNS_TYPE_A) {
+ if(a->type == CURL_DNS_TYPE_A) {
infof(data, "[DoH] A: %u.%u.%u.%u",
a->ip.v4[0], a->ip.v4[1],
a->ip.v4[2], a->ip.v4[3]);
}
- else if(a->type == DNS_TYPE_AAAA) {
+ else if(a->type == CURL_DNS_TYPE_AAAA) {
int j;
char buffer[128] = "[DoH] AAAA: ";
size_t len = strlen(buffer);
for(i = 0; i < de->numaddr; i++) {
size_t ss_size;
CURL_SA_FAMILY_T addrtype;
- if(de->addr[i].type == DNS_TYPE_AAAA) {
+ if(de->addr[i].type == CURL_DNS_TYPE_AAAA) {
#ifndef USE_IPV6
/* we cannot handle IPv6 addresses */
continue;
static const char *doh_type2name(DNStype dnstype)
{
switch(dnstype) {
- case DNS_TYPE_A:
+ case CURL_DNS_TYPE_A:
return "A";
- case DNS_TYPE_AAAA:
+ case CURL_DNS_TYPE_AAAA:
return "AAAA";
#ifdef USE_HTTPSRR
- case DNS_TYPE_HTTPS:
+ case CURL_DNS_TYPE_HTTPS:
return "HTTPS";
#endif
default:
};
static const struct dohrequest req[] = {
- {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
- {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
+ {"test.host.name", CURL_DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
+ {"test.host.name", CURL_DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
{"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
".host.name",
- DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
+ CURL_DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
};
struct dohresp {
static const char full49[] = DNS_FOO_EXAMPLE_COM;
static const struct dohresp resp[] = {
- {"\x00\x00", 2, DNS_TYPE_A, DOH_TOO_SMALL_BUFFER, NULL },
+ {"\x00\x00", 2, CURL_DNS_TYPE_A, DOH_TOO_SMALL_BUFFER, NULL },
{"\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01", 12,
- DNS_TYPE_A, DOH_DNS_BAD_ID, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_BAD_ID, NULL },
{"\x00\x00\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01", 12,
- DNS_TYPE_A, DOH_DNS_BAD_RCODE, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_BAD_RCODE, NULL },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f", 16,
- DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f\x00", 17,
- DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f\x00"
"\x00\x01\x00\x01", 21,
- DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f\x00"
"\x00\x01\x00\x01"
"\x04", 18,
- DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
+ CURL_DNS_TYPE_A, DOH_DNS_OUT_OF_RANGE, NULL },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x04\x63\x75\x72"
"\x6c\x04\x63\x75\x72\x6c\x00\x00\x05\x00\x01\xc0\x0c\x00\x05\x00"
"\x01\x00\x00\x00\x37\x00\x11\x08\x61\x6e\x79\x77\x68\x65\x72\x65"
"\x06\x72\x65\x61\x6c\x6c\x79\x00", 56,
- DNS_TYPE_A, DOH_OK, "anywhere.really "},
+ CURL_DNS_TYPE_A, DOH_OK, "anywhere.really "},
- {DNS_FOO_EXAMPLE_COM, 49, DNS_TYPE_A, DOH_OK, "127.0.0.1 "},
+ {DNS_FOO_EXAMPLE_COM, 49, CURL_DNS_TYPE_A, DOH_OK, "127.0.0.1 "},
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x04\x61\x61\x61"
"\x61\x07\x65\x78\x61\x6d\x70\x6c\x65\x03\x63\x6f\x6d\x00\x00\x1c"
"\x00\x01\xc0\x0c\x00\x1c\x00\x01\x00\x00\x00\x37\x00\x10\x20\x20"
"\x20\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20", 62,
- DNS_TYPE_AAAA, DOH_OK,
+ CURL_DNS_TYPE_AAAA, DOH_OK,
"2020:2020:0000:0000:0000:0000:0000:2020 " },
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x04\x63\x75\x72"
"\x6c\x04\x63\x75\x72\x6c\x00\x00\x05\x00\x01\xc0\x0c\x00\x05\x00"
"\x01\x00\x00\x00\x37\x00"
"\x07\x03\x61\x6e\x79\xc0\x27\x00", 46,
- DNS_TYPE_A, DOH_DNS_LABEL_LOOP, NULL},
+ CURL_DNS_TYPE_A, DOH_DNS_LABEL_LOOP, NULL},
/* packet with NSCOUNT == 1 */
{"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x01\x00\x00\x04\x61\x61\x61"
"\00\x04\x01\x01\x01\x01", /* RDDATA */
62 + 30,
- DNS_TYPE_AAAA, DOH_OK,
+ CURL_DNS_TYPE_AAAA, DOH_OK,
"2020:2020:0000:0000:0000:0000:0000:2020 " },
/* packet with ARCOUNT == 1 */
"\00\x04\x01\x01\x01\x01", /* RDDATA */
62 + 30,
- DNS_TYPE_AAAA, DOH_OK,
+ CURL_DNS_TYPE_AAAA, DOH_OK,
"2020:2020:0000:0000:0000:0000:0000:2020 " },
};
size_t o;
struct dohaddr *a;
a = &d.addr[u];
- if(resp[i].type == DNS_TYPE_A) {
+ if(resp[i].type == CURL_DNS_TYPE_A) {
p = &a->ip.v4[0];
curl_msnprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
o = strlen(ptr);
struct dohentry d;
DOHcode rc;
memset(&d, 0, sizeof(d));
- rc = doh_resp_decode((const unsigned char *)full49, i, DNS_TYPE_A, &d);
+ rc = doh_resp_decode((const unsigned char *)full49, i, CURL_DNS_TYPE_A,
+ &d);
if(!rc) {
/* none of them should work */
curl_mfprintf(stderr, "%zu: %d\n", i, rc);
DOHcode rc;
memset(&d, 0, sizeof(d));
rc = doh_resp_decode((const unsigned char *)&full49[i], sizeof(full49)-i-1,
- DNS_TYPE_A, &d);
+ CURL_DNS_TYPE_A, &d);
if(!rc) {
/* none of them should work */
curl_mfprintf(stderr, "2 %zu: %d\n", i, rc);
struct dohaddr *a;
memset(&d, 0, sizeof(d));
rc = doh_resp_decode((const unsigned char *)full49, sizeof(full49)-1,
- DNS_TYPE_A, &d);
+ CURL_DNS_TYPE_A, &d);
fail_if(d.numaddr != 1, "missing address");
a = &d.addr[0];
p = &a->ip.v4[0];