3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews */
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews/* http://www.watson.org/~weiler/INI1999-19.pdf */
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews#ifndef RDATA_GENERIC_TA_32768_C
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews#define RDATA_GENERIC_TA_32768_C
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews#define RRTYPE_TA_ATTRIBUTES 0
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsfromtext_ta(ARGS_FROMTEXT) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews target, callbacks));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewstotext_ta(ARGS_TOTEXT) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (generic_totext_ds(rdata, tctx, target));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsfromwire_ta(ARGS_FROMWIRE) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (generic_fromwire_ds(rdclass, type, source, dctx, options,
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews target));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewstowire_ta(ARGS_TOWIRE) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews isc_region_t sr;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->length != 0);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(cctx);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_toregion(rdata, &sr);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (mem_tobuffer(target, sr.base, sr.length));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline int
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewscompare_ta(ARGS_COMPARE) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews isc_region_t r1;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews isc_region_t r2;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata1->type == rdata2->type);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata1->rdclass == rdata2->rdclass);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata1->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata1->length != 0);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata2->length != 0);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_toregion(rdata1, &r1);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_toregion(rdata2, &r2);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (isc_region_compare(&r1, &r2));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsfromstruct_ta(ARGS_FROMSTRUCT) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (generic_fromstruct_ds(rdclass, type, source, target));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewstostruct_ta(ARGS_TOSTRUCT) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_ds_t *ds = target;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews /*
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews * Checked by generic_tostruct_ds().
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews */
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews ds->common.rdclass = rdata->rdclass;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews ds->common.rdtype = rdata->type;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews ISC_LINK_INIT(&ds->common, link);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (generic_tostruct_ds(rdata, target, mctx));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline void
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsfreestruct_ta(ARGS_FREESTRUCT) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_ta_t *ds = source;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(ds != NULL);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(ds->common.rdtype == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews if (ds->mctx == NULL)
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews if (ds->digest != NULL)
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews isc_mem_free(ds->mctx, ds->digest);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews ds->mctx = NULL;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsadditionaldata_ta(ARGS_ADDLDATA) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(rdata);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(add);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(arg);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (ISC_R_SUCCESS);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_result_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsdigest_ta(ARGS_DIGEST) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews isc_region_t r;
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews dns_rdata_toregion(rdata, &r);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return ((digest)(arg, &r));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_boolean_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewscheckowner_ta(ARGS_CHECKOWNER) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(name);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(type);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(rdclass);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(wildcard);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (ISC_TRUE);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline isc_boolean_t
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewschecknames_ta(ARGS_CHECKNAMES) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews REQUIRE(rdata->type == dns_rdatatype_ta);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(rdata);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(owner);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews UNUSED(bad);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (ISC_TRUE);
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewsstatic inline int
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrewscasecompare_ta(ARGS_COMPARE) {
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews return (compare_ta(rdata1, rdata2));
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews}
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews
3dd63ba00f91f4d54ba45ba1831375950758c0a7Mark Andrews#endif /* RDATA_GENERIC_TA_32768_C */