Commit 99ff8f28 authored by Mark Andrews's avatar Mark Andrews
Browse files

Merge branch '2597-make-calling-generic-rdata-methods-consistent' into 'main'

Resolve "Make calling generic rdata methods consistent"

Closes #2597

See merge request isc-projects/bind9!4834
parents 19b69e9a a88d3963
......@@ -82,38 +82,62 @@
const dns_name_t *origin, unsigned int options, \
isc_buffer_t *target, dns_rdatacallbacks_t *callbacks
#define CALL_FROMTEXT rdclass, type, lexer, origin, options, target, callbacks
#define ARGS_TOTEXT \
dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target
#define CALL_TOTEXT rdata, tctx, target
#define ARGS_FROMWIRE \
int rdclass, dns_rdatatype_t type, isc_buffer_t *source, \
dns_decompress_t *dctx, unsigned int options, \
isc_buffer_t *target
#define CALL_FROMWIRE rdclass, type, source, dctx, options, target
#define ARGS_TOWIRE \
dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target
#define CALL_TOWIRE rdata, cctx, target
#define ARGS_COMPARE const dns_rdata_t *rdata1, const dns_rdata_t *rdata2
#define CALL_COMPARE rdata1, rdata2
#define ARGS_FROMSTRUCT \
int rdclass, dns_rdatatype_t type, void *source, isc_buffer_t *target
#define CALL_FROMSTRUCT rdclass, type, source, target
#define ARGS_TOSTRUCT const dns_rdata_t *rdata, void *target, isc_mem_t *mctx
#define CALL_TOSTRUCT rdata, target, mctx
#define ARGS_FREESTRUCT void *source
#define CALL_FREESTRUCT source
#define ARGS_ADDLDATA \
dns_rdata_t *rdata, dns_additionaldatafunc_t add, void *arg
#define CALL_ADDLDATA rdata, add, arg
#define ARGS_DIGEST dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg
#define CALL_DIGEST rdata, digest, arg
#define ARGS_CHECKOWNER \
const dns_name_t *name, dns_rdataclass_t rdclass, \
dns_rdatatype_t type, bool wildcard
#define CALL_CHECKOWNER name, rdclass, type, wildcard
#define ARGS_CHECKNAMES \
dns_rdata_t *rdata, const dns_name_t *owner, dns_name_t *bad
#define CALL_CHECKNAMES rdata, owner, bad
/*%
* Context structure for the totext_ functions.
* Contains formatting options for rdata-to-text
......
......@@ -18,36 +18,22 @@ static inline isc_result_t
fromtext_avc(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_avc);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
return (generic_fromtext_txt(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_txt(CALL_FROMTEXT));
}
static inline isc_result_t
totext_avc(ARGS_TOTEXT) {
UNUSED(tctx);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_avc);
return (generic_totext_txt(rdata, tctx, target));
return (generic_totext_txt(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_avc(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_avc);
UNUSED(type);
UNUSED(dctx);
UNUSED(rdclass);
UNUSED(options);
return (generic_fromwire_txt(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_txt(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -77,7 +63,7 @@ static inline isc_result_t
fromstruct_avc(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_avc);
return (generic_fromstruct_txt(rdclass, type, source, target));
return (generic_fromstruct_txt(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -91,7 +77,7 @@ tostruct_avc(ARGS_TOSTRUCT) {
avc->common.rdtype = rdata->type;
ISC_LINK_INIT(&avc->common, link);
return (generic_tostruct_txt(rdata, target, mctx));
return (generic_tostruct_txt(CALL_TOSTRUCT));
}
static inline void
......
......@@ -22,8 +22,7 @@ static inline isc_result_t
fromtext_cdnskey(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_cdnskey);
return (generic_fromtext_key(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_key(CALL_FROMTEXT));
}
static inline isc_result_t
......@@ -31,15 +30,14 @@ totext_cdnskey(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
return (generic_totext_key(rdata, tctx, target));
return (generic_totext_key(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_cdnskey(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_cdnskey);
return (generic_fromwire_key(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_key(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -77,7 +75,7 @@ static inline isc_result_t
fromstruct_cdnskey(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_cdnskey);
return (generic_fromstruct_key(rdclass, type, source, target));
return (generic_fromstruct_key(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -92,7 +90,7 @@ tostruct_cdnskey(ARGS_TOSTRUCT) {
dnskey->common.rdtype = rdata->type;
ISC_LINK_INIT(&dnskey->common, link);
return (generic_tostruct_key(rdata, target, mctx));
return (generic_tostruct_key(CALL_TOSTRUCT));
}
static inline void
......
......@@ -22,23 +22,22 @@ static inline isc_result_t
fromtext_cds(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_cds);
return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_ds(CALL_FROMTEXT));
}
static inline isc_result_t
totext_cds(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_cds);
return (generic_totext_ds(rdata, tctx, target));
return (generic_totext_ds(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_cds(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_cds);
return (generic_fromwire_ds(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_ds(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -74,7 +73,7 @@ static inline isc_result_t
fromstruct_cds(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_cds);
return (generic_fromstruct_ds(rdclass, type, source, target));
return (generic_fromstruct_ds(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -92,7 +91,7 @@ tostruct_cds(ARGS_TOSTRUCT) {
cds->common.rdtype = rdata->type;
ISC_LINK_INIT(&cds->common, link);
return (generic_tostruct_ds(rdata, target, mctx));
return (generic_tostruct_ds(CALL_TOSTRUCT));
}
static inline void
......
......@@ -22,23 +22,22 @@ static inline isc_result_t
fromtext_dlv(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_dlv);
return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_ds(CALL_FROMTEXT));
}
static inline isc_result_t
totext_dlv(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_dlv);
return (generic_totext_ds(rdata, tctx, target));
return (generic_totext_ds(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_dlv(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_dlv);
return (generic_fromwire_ds(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_ds(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -74,7 +73,7 @@ static inline isc_result_t
fromstruct_dlv(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_dlv);
return (generic_fromstruct_ds(rdclass, type, source, target));
return (generic_fromstruct_ds(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -88,7 +87,7 @@ tostruct_dlv(ARGS_TOSTRUCT) {
dlv->common.rdtype = rdata->type;
ISC_LINK_INIT(&dlv->common, link);
return (generic_tostruct_ds(rdata, target, mctx));
return (generic_tostruct_ds(CALL_TOSTRUCT));
}
static inline void
......
......@@ -22,8 +22,7 @@ static inline isc_result_t
fromtext_dnskey(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_dnskey);
return (generic_fromtext_key(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_key(CALL_FROMTEXT));
}
static inline isc_result_t
......@@ -31,15 +30,14 @@ totext_dnskey(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_dnskey);
return (generic_totext_key(rdata, tctx, target));
return (generic_totext_key(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_dnskey(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_dnskey);
return (generic_fromwire_key(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_key(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -78,7 +76,7 @@ static inline isc_result_t
fromstruct_dnskey(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_dnskey);
return (generic_fromstruct_key(rdclass, type, source, target));
return (generic_fromstruct_key(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -93,7 +91,7 @@ tostruct_dnskey(ARGS_TOSTRUCT) {
dnskey->common.rdtype = rdata->type;
ISC_LINK_INIT(&dnskey->common, link);
return (generic_tostruct_key(rdata, target, mctx));
return (generic_tostruct_key(CALL_TOSTRUCT));
}
static inline void
......
......@@ -84,8 +84,7 @@ static inline isc_result_t
fromtext_ds(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_ds(CALL_FROMTEXT));
}
static inline isc_result_t
......@@ -149,9 +148,10 @@ generic_totext_ds(ARGS_TOTEXT) {
static inline isc_result_t
totext_ds(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_ds);
return (generic_totext_ds(rdata, tctx, target));
return (generic_totext_ds(CALL_TOTEXT));
}
static inline isc_result_t
......@@ -200,8 +200,7 @@ static inline isc_result_t
fromwire_ds(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromwire_ds(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_ds(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -267,7 +266,7 @@ static inline isc_result_t
fromstruct_ds(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromstruct_ds(rdclass, type, source, target));
return (generic_fromstruct_ds(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -311,7 +310,7 @@ tostruct_ds(ARGS_TOSTRUCT) {
ds->common.rdtype = rdata->type;
ISC_LINK_INIT(&ds->common, link);
return (generic_tostruct_ds(rdata, target, mctx));
return (generic_tostruct_ds(CALL_TOSTRUCT));
}
static inline void
......
......@@ -236,8 +236,7 @@ static inline isc_result_t
fromtext_key(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_key);
return (generic_fromtext_key(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_key(CALL_FROMTEXT));
}
static inline isc_result_t
......@@ -245,15 +244,14 @@ totext_key(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_key);
return (generic_totext_key(rdata, tctx, target));
return (generic_totext_key(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_key(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_key);
return (generic_fromwire_key(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_key(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -383,7 +381,7 @@ static inline isc_result_t
fromstruct_key(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_key);
return (generic_fromstruct_key(rdclass, type, source, target));
return (generic_fromstruct_key(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -398,7 +396,7 @@ tostruct_key(ARGS_TOSTRUCT) {
key->common.rdtype = rdata->type;
ISC_LINK_INIT(&key->common, link);
return (generic_tostruct_key(rdata, target, mctx));
return (generic_tostruct_key(CALL_TOSTRUCT));
}
static inline void
......
......@@ -18,36 +18,22 @@ static inline isc_result_t
fromtext_ninfo(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_ninfo);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
return (generic_fromtext_txt(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_txt(CALL_FROMTEXT));
}
static inline isc_result_t
totext_ninfo(ARGS_TOTEXT) {
UNUSED(tctx);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_ninfo);
return (generic_totext_txt(rdata, tctx, target));
return (generic_totext_txt(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_ninfo(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_ninfo);
UNUSED(type);
UNUSED(dctx);
UNUSED(rdclass);
UNUSED(options);
return (generic_fromwire_txt(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_txt(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -77,7 +63,7 @@ static inline isc_result_t
fromstruct_ninfo(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_ninfo);
return (generic_fromstruct_txt(rdclass, type, source, target));
return (generic_fromstruct_txt(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -91,7 +77,7 @@ tostruct_ninfo(ARGS_TOSTRUCT) {
ninfo->common.rdtype = rdata->type;
ISC_LINK_INIT(&ninfo->common, link);
return (generic_tostruct_txt(rdata, target, mctx));
return (generic_tostruct_txt(CALL_TOSTRUCT));
}
static inline void
......
......@@ -18,8 +18,7 @@ static inline isc_result_t
fromtext_rkey(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_rkey);
return (generic_fromtext_key(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_key(CALL_FROMTEXT));
}
static inline isc_result_t
......@@ -27,15 +26,14 @@ totext_rkey(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_rkey);
return (generic_totext_key(rdata, tctx, target));
return (generic_totext_key(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_rkey(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_rkey);
return (generic_fromwire_key(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_key(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -74,7 +72,7 @@ static inline isc_result_t
fromstruct_rkey(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_rkey);
return (generic_fromstruct_key(rdclass, type, source, target));
return (generic_fromstruct_key(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -89,7 +87,7 @@ tostruct_rkey(ARGS_TOSTRUCT) {
rkey->common.rdtype = rdata->type;
ISC_LINK_INIT(&rkey->common, link);
return (generic_tostruct_key(rdata, target, mctx));
return (generic_tostruct_key(CALL_TOSTRUCT));
}
static inline void
......
......@@ -18,23 +18,22 @@ static inline isc_result_t
fromtext_smimea(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_smimea);
return (generic_fromtext_tlsa(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_tlsa(CALL_FROMTEXT));
}
static inline isc_result_t
totext_smimea(ARGS_TOTEXT) {
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_smimea);
return (generic_totext_tlsa(rdata, tctx, target));
return (generic_totext_tlsa(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_smimea(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_smimea);
return (generic_fromwire_tlsa(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_tlsa(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -70,7 +69,7 @@ static inline isc_result_t
fromstruct_smimea(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_smimea);
return (generic_fromstruct_tlsa(rdclass, type, source, target));
return (generic_fromstruct_tlsa(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -85,7 +84,7 @@ tostruct_smimea(ARGS_TOSTRUCT) {
smimea->common.rdtype = rdata->type;
ISC_LINK_INIT(&smimea->common, link);
return (generic_tostruct_tlsa(rdata, target, mctx));
return (generic_tostruct_tlsa(CALL_TOSTRUCT));
}
static inline void
......
......@@ -18,36 +18,22 @@ static inline isc_result_t
fromtext_spf(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_spf);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
return (generic_fromtext_txt(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_txt(CALL_FROMTEXT));
}
static inline isc_result_t
totext_spf(ARGS_TOTEXT) {
UNUSED(tctx);
REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_spf);
return (generic_totext_txt(rdata, tctx, target));
return (generic_totext_txt(CALL_TOTEXT));
}
static inline isc_result_t
fromwire_spf(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_spf);
UNUSED(type);
UNUSED(dctx);
UNUSED(rdclass);
UNUSED(options);
return (generic_fromwire_txt(rdclass, type, source, dctx, options,
target));
return (generic_fromwire_txt(CALL_FROMWIRE));
}
static inline isc_result_t
......@@ -77,7 +63,7 @@ static inline isc_result_t
fromstruct_spf(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_spf);
return (generic_fromstruct_txt(rdclass, type, source, target));
return (generic_fromstruct_txt(CALL_FROMSTRUCT));
}
static inline isc_result_t
......@@ -92,7 +78,7 @@ tostruct_spf(ARGS_TOSTRUCT) {
spf->common.rdtype = rdata->type;
ISC_LINK_INIT(&spf->common, link);
return (generic_tostruct_txt(rdata, target, mctx));
return (generic_tostruct_txt(CALL_TOSTRUCT));
}
static inline void
......
......@@ -20,23 +20,21 @@ static inline isc_result_t
fromtext_ta(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_ta);
return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
target, callbacks));
return (generic_fromtext_ds(CALL_FROMTEXT));
}
static inline isc_result_t
totext_ta(ARGS_TOTEXT) {
REQUIRE(rdata->type == dns_rdatatype_ta);
return (generic_totext_ds(rdata, tctx, target));
return (generic_totext_ds(CALL_TOTEXT));
}