minfo_14.c revision 9281e7aa775026dc47c01745fdcc438645146877
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer/*
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer * Copyright (C) 1998, 1999, 2000 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews *
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * purpose with or without fee is hereby granted, provided that the above
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * copyright notice and this permission notice appear in all copies.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews *
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * SOFTWARE.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews */
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews
1d32b1df372d6be6bac6450739b9e5ea23819995Evan Hunt/* $Id: minfo_14.c,v 1.27 2000/05/05 05:49:55 marka Exp $ */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer/* reviewed: Wed Mar 15 17:45:32 PST 2000 by brister */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#ifndef RDATA_GENERIC_MINFO_14_C
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#define RDATA_GENERIC_MINFO_14_C
8aee18709f238406719768b8a6b843a15c5075f8Mark Andrews
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#define RRTYPE_MINFO_ATTRIBUTES (0)
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Huntstatic inline isc_result_t
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Huntfromtext_minfo(dns_rdataclass_t rdclass, dns_rdatatype_t type,
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt isc_lex_t *lexer, dns_name_t *origin,
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt isc_boolean_t downcase, isc_buffer_t *target)
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt{
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt isc_token_t token;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt dns_name_t name;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt isc_buffer_t buffer;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt int i;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt REQUIRE(type == 14);
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt UNUSED(rdclass);
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt for (i = 0; i < 2 ; i++) {
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt RETERR(gettoken(lexer, &token, isc_tokentype_string,
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt ISC_FALSE));
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence dns_name_init(&name, NULL);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer buffer_fromregion(&buffer, &token.value.as_region);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer origin = (origin != NULL) ? origin : dns_rootname;
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer RETERR(dns_name_fromtext(&name, &buffer, origin,
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence downcase, target));
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer }
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt return (ISC_R_SUCCESS);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer}
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyerstatic inline isc_result_t
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyertotext_minfo(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer isc_buffer_t *target)
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence{
fdebae839745f79a7550aeb49d15a930523ec483David Lawrence isc_region_t region;
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt dns_name_t rmail;
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson dns_name_t email;
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson dns_name_t prefix;
1d32b1df372d6be6bac6450739b9e5ea23819995Evan Hunt isc_boolean_t sub;
1d32b1df372d6be6bac6450739b9e5ea23819995Evan Hunt
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson REQUIRE(rdata->type == 14);
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_init(&rmail, NULL);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_init(&email, NULL);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer dns_name_init(&prefix, NULL);
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer dns_rdata_toregion(rdata, &region);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer dns_name_fromregion(&rmail, &region);
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence isc_region_consume(&region, rmail.length);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
2de413d956c9f065958aaeebf5cd3a420e55939cMichael Sawyer dns_name_fromregion(&email, &region);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer isc_region_consume(&region, email.length);
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer sub = name_prefix(&rmail, tctx->origin, &prefix);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer RETERR(dns_name_totext(&prefix, sub, target));
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt RETERR(str_totext(" ", target));
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt sub = name_prefix(&email, tctx->origin, &prefix);
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt return (dns_name_totext(&prefix, sub, target));
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt}
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Huntstatic inline isc_result_t
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Huntfromwire_minfo(dns_rdataclass_t rdclass, dns_rdatatype_t type,
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt isc_buffer_t *source, dns_decompress_t *dctx,
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt isc_boolean_t downcase, isc_buffer_t *target)
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt{
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt dns_name_t rmail;
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt dns_name_t email;
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt REQUIRE(type == 14);
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt UNUSED(rdclass);
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt dns_name_init(&rmail, NULL);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_init(&email, NULL);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt RETERR(dns_name_fromwire(&rmail, source, dctx, downcase, target));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt return (dns_name_fromwire(&email, source, dctx, downcase, target));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt}
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Huntstatic inline isc_result_t
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunttowire_minfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt{
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt isc_region_t region;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_t rmail;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_t email;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt REQUIRE(rdata->type == 14);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_init(&rmail, NULL);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_init(&email, NULL);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_rdata_toregion(rdata, &region);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_fromregion(&rmail, &region);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt isc_region_consume(&region, name_length(&rmail));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt RETERR(dns_name_towire(&rmail, cctx, target));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_fromregion(&rmail, &region);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt isc_region_consume(&region, rmail.length);
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt return (dns_name_towire(&rmail, cctx, target));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt}
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Huntstatic inline int
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Huntcompare_minfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt{
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt isc_region_t region1;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt isc_region_t region2;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_t name1;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_name_t name2;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt int order;
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt REQUIRE(rdata1->type == rdata2->type);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt REQUIRE(rdata1->rdclass == rdata2->rdclass);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt REQUIRE(rdata1->type == 14);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt dns_name_init(&name1, NULL);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt dns_name_init(&name2, NULL);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt dns_rdata_toregion(rdata1, &region1);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_rdata_toregion(rdata2, &region2);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_fromregion(&name1, &region1);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_fromregion(&name2, &region2);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt order = dns_name_rdatacompare(&name1, &name2);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if (order != 0)
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt return (order);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_region_consume(&region1, name_length(&name1));
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_region_consume(&region2, name_length(&name2));
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_init(&name1, NULL);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_init(&name2, NULL);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_fromregion(&name1, &region1);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_fromregion(&name2, &region2);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
2a6d60615cf07b164533dbb6bb1dce84ed2d037dEvan Hunt order = dns_name_rdatacompare(&name1, &name2);
2a6d60615cf07b164533dbb6bb1dce84ed2d037dEvan Hunt return (order);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt}
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Huntstatic inline isc_result_t
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Huntfromstruct_minfo(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_buffer_t *target)
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt{
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt REQUIRE(type == 14);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt UNUSED(rdclass);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt UNUSED(source);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt UNUSED(target);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt return (ISC_R_NOTIMPLEMENTED);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt}
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Huntstatic inline isc_result_t
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunttostruct_minfo(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt{
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_region_t region;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_result_t result;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_rdata_minfo_t *minfo = target;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_t name;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt REQUIRE(rdata->type == 14);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt REQUIRE(target != NULL);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt minfo->common.rdclass = rdata->rdclass;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt minfo->common.rdtype = rdata->type;
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt ISC_LINK_INIT(&minfo->common, link);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_init(&name, NULL);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_rdata_toregion(rdata, &region);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_fromregion(&name, &region);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_name_init(&minfo->rmailbox, NULL);
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt RETERR(name_duporclone(&name, mctx, &minfo->rmailbox));
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt isc_region_consume(&region, name_length(&name));
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt dns_name_fromregion(&name, &region);
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt dns_name_init(&minfo->emailbox, NULL);
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt result = name_duporclone(&name, mctx, &minfo->emailbox);
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt if (result != ISC_R_SUCCESS)
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt goto cleanup;
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt minfo->mctx = mctx;
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt return (ISC_R_SUCCESS);
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt
cba23be7ba724b527f6a60c14caaeca9502fbc79Evan Hunt cleanup:
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews if (mctx != NULL)
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews dns_name_free(&minfo->rmailbox, mctx);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews return (ISC_R_NOMEMORY);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews}
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrewsstatic inline void
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrewsfreestruct_minfo(void *source)
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews{
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews dns_rdata_minfo_t *minfo = source;
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews REQUIRE(source != NULL);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews REQUIRE(minfo->common.rdtype == 14);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews if (minfo->mctx == NULL)
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews return;
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews dns_name_free(&minfo->rmailbox, minfo->mctx);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews dns_name_free(&minfo->emailbox, minfo->mctx);
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews minfo->mctx = NULL;
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews}
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyerstatic inline isc_result_t
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyeradditionaldata_minfo(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer void *arg)
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer{
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer REQUIRE(rdata->type == 14);
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer UNUSED(rdata);
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer UNUSED(add);
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer UNUSED(arg);
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer return (ISC_R_SUCCESS);
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer}
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyerstatic inline isc_result_t
2de413d956c9f065958aaeebf5cd3a420e55939cMichael Sawyerdigest_minfo(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer{
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer isc_region_t r;
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer dns_name_t name;
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer isc_result_t result;
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson REQUIRE(rdata->type == 14);
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson dns_rdata_toregion(rdata, &r);
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson dns_name_init(&name, NULL);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson dns_name_fromregion(&name, &r);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson result = dns_name_digest(&name, digest, arg);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson if (result != ISC_R_SUCCESS)
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson return (result);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson isc_region_consume(&r, name_length(&name));
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson dns_name_init(&name, NULL);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson dns_name_fromregion(&name, &r);
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson return (dns_name_digest(&name, digest, arg));
0759eb6a0dab024873df528b0ffad804ea31615dMichael Sawyer}
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer#endif /* RDATA_GENERIC_MINFO_14_C */
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer