2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

add new functions to classify rdata types

- dns_rdatatype_ismulti() returns true if a given type can have
  multiple answers: ANY, RRSIG, or SIG.
- dns_rdatatype_issig() returns true for a signature: RRSIG or SIG.
- dns_rdatatype_isaddr() returns true for an address: A or AAAA.
- dns_rdatatype_isalias() returns true for an alias: CNAME or DNAME.
This commit is contained in:
Evan Hunt
2025-03-04 15:51:49 -08:00
parent 3b0b658a52
commit 1c51d44d82
2 changed files with 46 additions and 0 deletions

View File

@@ -2461,6 +2461,27 @@ dns_rdatatype_isknown(dns_rdatatype_t type) {
return false;
}
bool
dns_rdatatype_ismulti(dns_rdatatype_t type) {
return type == dns_rdatatype_any || type == dns_rdatatype_rrsig ||
type == dns_rdatatype_sig;
}
bool
dns_rdatatype_issig(dns_rdatatype_t type) {
return type == dns_rdatatype_rrsig || type == dns_rdatatype_sig;
}
bool
dns_rdatatype_isaddr(dns_rdatatype_t type) {
return type == dns_rdatatype_a || type == dns_rdatatype_aaaa;
}
bool
dns_rdatatype_isalias(dns_rdatatype_t type) {
return type == dns_rdatatype_cname || type == dns_rdatatype_dname;
}
void
dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type) {
REQUIRE(rdata != NULL);