smimea_53.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley/*
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley *
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * This Source Code Form is subject to the terms of the Mozilla Public
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * License, v. 2.0. If a copy of the MPL was not distributed with this
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley */
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#ifndef RDATA_GENERIC_SMIMEA_53_C
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define RDATA_GENERIC_SMIMEA_53_C
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define RRTYPE_SMIMEA_ATTRIBUTES 0
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleyfromtext_smimea(ARGS_FROMTEXT) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (generic_fromtext_tlsa(rdclass, type, lexer, origin, options,
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley target, callbacks));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
364a82f7c25b62967678027043425201a5e5171aBob Halleystatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleytotext_smimea(ARGS_TOTEXT) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (generic_totext_tlsa(rdata, tctx, target));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleyfromwire_smimea(ARGS_FROMWIRE) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (generic_fromwire_tlsa(rdclass, type, source, dctx, options,
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley target));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleytowire_smimea(ARGS_TOWIRE) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley isc_region_t sr;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata->length != 0);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley UNUSED(cctx);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_toregion(rdata, &sr);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (mem_tobuffer(target, sr.base, sr.length));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline int
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleycompare_smimea(ARGS_COMPARE) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley isc_region_t r1;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley isc_region_t r2;
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata1->type == rdata2->type);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata1->rdclass == rdata2->rdclass);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata1->type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata1->length != 0);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata2->length != 0);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_toregion(rdata1, &r1);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_toregion(rdata2, &r2);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (isc_region_compare(&r1, &r2));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrencestatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleyfromstruct_smimea(ARGS_FROMSTRUCT) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (generic_fromstruct_tlsa(rdclass, type, source, target));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_result_t
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleytostruct_smimea(ARGS_TOSTRUCT) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_txt_t *txt = target;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(target != NULL);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley txt->common.rdclass = rdata->rdclass;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley txt->common.rdtype = rdata->type;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley ISC_LINK_INIT(&txt->common, link);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return (generic_tostruct_tlsa(rdata, target, mctx));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline void
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleyfreestruct_smimea(ARGS_FREESTRUCT) {
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_txt_t *txt = source;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(source != NULL);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(txt->common.rdtype == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley generic_freestruct_tlsa(source);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_result_t
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halleyadditionaldata_smimea(ARGS_ADDLDATA) {
55254a46f91419b92eee0d20dfb958e8dd52526cBob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
55254a46f91419b92eee0d20dfb958e8dd52526cBob Halley
55254a46f91419b92eee0d20dfb958e8dd52526cBob Halley UNUSED(rdata);
55254a46f91419b92eee0d20dfb958e8dd52526cBob Halley UNUSED(add);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley UNUSED(arg);
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley return (ISC_R_SUCCESS);
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley}
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halleystatic inline isc_result_t
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halleydigest_smimea(ARGS_DIGEST) {
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley isc_region_t r;
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley dns_rdata_toregion(rdata, &r);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley return ((digest)(arg, &r));
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley}
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halleystatic inline isc_boolean_t
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halleycheckowner_smimea(ARGS_CHECKOWNER) {
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley REQUIRE(type == dns_rdatatype_smimea);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley UNUSED(name);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley UNUSED(type);
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley UNUSED(rdclass);
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halley UNUSED(wildcard);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley return (ISC_TRUE);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley}
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halleystatic inline isc_boolean_t
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halleychecknames_smimea(ARGS_CHECKNAMES) {
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley REQUIRE(rdata->type == dns_rdatatype_smimea);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley UNUSED(rdata);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley UNUSED(owner);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley UNUSED(bad);
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halley return (ISC_TRUE);
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halley}
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halleystatic inline int
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halleycasecompare_smimea(ARGS_COMPARE) {
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley return (compare_smimea(rdata1, rdata2));
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley}
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley#endif /* RDATA_GENERIC_SMIMEA_53_C */
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley