#ifndef RDATA_GENERIC_TLSA_52_C
#define RDATA_GENERIC_TLSA_52_C
static inline isc_result_t
generic_totext_tlsa(ARGS_TOTEXT) {
isc_region_t sr;
char buf[sizeof("64000 ")];
unsigned int n;
REQUIRE(rdata->length != 0);
UNUSED(tctx);
dns_rdata_toregion(rdata, &sr);
n = uint8_fromregion(&sr);
isc_region_consume(&sr, 1);
snprintf(buf, sizeof(buf), "%u ", n);
RETERR(isc_str_tobuffer(buf, target));
n = uint8_fromregion(&sr);
isc_region_consume(&sr, 1);
snprintf(buf, sizeof(buf), "%u ", n);
RETERR(isc_str_tobuffer(buf, target));
n = uint8_fromregion(&sr);
isc_region_consume(&sr, 1);
snprintf(buf, sizeof(buf), "%u", n);
RETERR(isc_str_tobuffer(buf, target));
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
RETERR(isc_str_tobuffer(" (", target));
RETERR(isc_str_tobuffer(tctx->linebreak, target));
if (tctx->width == 0)
RETERR(isc_hex_totext(&sr, 0, "", target));
else
RETERR(isc_hex_totext(&sr, tctx->width - 2,
tctx->linebreak, target));
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
RETERR(isc_str_tobuffer(" )", target));
return (ISC_R_SUCCESS);
}
static inline isc_result_t
generic_fromwire_tlsa(ARGS_FROMWIRE) {
isc_region_t sr;
UNUSED(type);
UNUSED(rdclass);
UNUSED(dctx);
UNUSED(options);
isc_buffer_activeregion(source, &sr);
if (sr.length < 3)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_forward(source, sr.length);
return (isc_mem_tobuffer(target, sr.base, sr.length));
}
static inline isc_result_t
totext_tlsa(ARGS_TOTEXT) {
REQUIRE(rdata->type == dns_rdatatype_tlsa);
return (generic_totext_tlsa(rdata, tctx, target));
}
static inline isc_result_t
fromwire_tlsa(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_tlsa);
return (generic_fromwire_tlsa(rdclass, type, source, dctx, options,
target));
}
static inline isc_result_t
towire_tlsa(ARGS_TOWIRE) {
isc_region_t sr;
REQUIRE(rdata->type == dns_rdatatype_tlsa);
REQUIRE(rdata->length != 0);
UNUSED(cctx);
dns_rdata_toregion(rdata, &sr);
return (isc_mem_tobuffer(target, sr.base, sr.length));
}
#endif