mx_15.c revision e27a69f8bd9538e08f775265167ba6cc5f47c587
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff/*
4a73cf8ee07ae396be20231ac252a24830f3c801Bob Halley * Copyright (C) 1998, 1999 Internet Software Consortium.
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff *
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * Permission to use, copy, modify, and distribute this software for any
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * purpose with or without fee is hereby granted, provided that the above
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * copyright notice and this permission notice appear in all copies.
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff *
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff * SOFTWARE.
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff */
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff /* $Id: mx_15.c,v 1.20 1999/08/31 22:05:54 halley Exp $ */
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff#ifndef RDATA_GENERIC_MX_15_C
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff#define RDATA_GENERIC_MX_15_C
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graffstatic inline dns_result_t
910df98b0efcbe8380b952887f4071051cc39a25Michael Grafffromtext_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type,
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff isc_lex_t *lexer, dns_name_t *origin,
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff isc_boolean_t downcase, isc_buffer_t *target)
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff{
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff isc_token_t token;
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff dns_name_t name;
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff isc_buffer_t buffer;
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff REQUIRE(type == 15);
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff rdclass = rdclass; /*unused*/
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
e45d323a2a0f4ca08d4b139546e60a5fa7bd3f0cMichael Graff RETERR(uint16_tobuffer(token.value.as_ulong, target));
fd15c8e32ed0c1cfd3ed737858a81966e7fbaeacAndreas Gustafsson
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_init(&name, NULL);
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff buffer_fromregion(&buffer, &token.value.as_region,
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff ISC_BUFFERTYPE_TEXT);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff origin = (origin != NULL) ? origin : dns_rootname;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff}
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline dns_result_t
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Grafftotext_mx(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff isc_buffer_t *target)
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff{
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff isc_region_t region;
3ac63b472022ff92691d1fe69ac715a729671965Michael Graff dns_name_t name;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_t prefix;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_boolean_t sub;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff char buf[sizeof "64000"];
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff unsigned short num;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff REQUIRE(rdata->type == 15);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_init(&name, NULL);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_init(&prefix, NULL);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_rdata_toregion(rdata, &region);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff num = uint16_fromregion(&region);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_consume(&region, 2);
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff sprintf(buf, "%u", num);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff RETERR(str_totext(buf, target));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff RETERR(str_totext(" ", target));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_fromregion(&name, &region);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff sub = name_prefix(&name, tctx->origin, &prefix);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return(dns_name_totext(&prefix, sub, target));
fc4fe6e5e61dbc916707ab2e071ffd22aef9de7fMichael Graff}
fc4fe6e5e61dbc916707ab2e071ffd22aef9de7fMichael Graff
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graffstatic inline dns_result_t
910df98b0efcbe8380b952887f4071051cc39a25Michael Grafffromwire_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type,
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_buffer_t *source, dns_decompress_t *dctx,
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff isc_boolean_t downcase, isc_buffer_t *target)
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff{
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff dns_name_t name;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_t sregion;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_t tregion;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff REQUIRE(type == 15);
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff rdclass = rdclass; /* unused */
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff else
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_init(&name, NULL);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_active(source, &sregion);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_available(target, &tregion);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff if (tregion.length < 2)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (DNS_R_NOSPACE);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff if (sregion.length < 2)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (DNS_R_UNEXPECTEDEND);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff memcpy(tregion.base, sregion.base, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_forward(source, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_add(target, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_fromwire(&name, source, dctx, downcase, target));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff}
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graffstatic inline dns_result_t
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Grafftowire_mx(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_t name;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_t region;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_t tr;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff REQUIRE(rdata->type == 15);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff if (dns_compress_getedns(cctx) >= 1)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_ALL);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff else
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_available(target, &tr);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_rdata_toregion(rdata, &region);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff if (tr.length < 2)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (DNS_R_NOSPACE);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff memcpy(tr.base, region.base, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_consume(&region, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_add(target, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_init(&name, NULL);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_fromregion(&name, &region);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_towire(&name, cctx, target));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff}
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline int
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graffcompare_mx(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_t name1;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_t name2;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_t region1;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_t region2;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff int result;
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff REQUIRE(rdata1->type == rdata2->type);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff REQUIRE(rdata1->rdclass == rdata2->rdclass);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff REQUIRE(rdata1->type == 15);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff result = memcmp(rdata1->data, rdata2->data, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff if (result != 0)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (result < 0 ? -1 : 1);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_init(&name1, NULL);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_init(&name2, NULL);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_rdata_toregion(rdata1, &region1);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_rdata_toregion(rdata2, &region2);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_consume(&region1, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_region_consume(&region2, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_fromregion(&name1, &region1);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_name_fromregion(&name2, &region2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_rdatacompare(&name1, &name2));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff}
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graffstatic inline dns_result_t
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Grafffromstruct_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff isc_buffer_t *target)
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff{
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff REQUIRE(type == 15);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff rdclass = rdclass; /*unused*/
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff source = source;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff target = target;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return (DNS_R_NOTIMPLEMENTED);
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff}
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline dns_result_t
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Grafftostruct_mx(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff REQUIRE(rdata->type == 15);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff target = target;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff mctx = mctx;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return (DNS_R_NOTIMPLEMENTED);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff}
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline void
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Grafffreestruct_mx(void *source) {
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff REQUIRE(source != NULL);
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff REQUIRE(ISC_FALSE); /*XXX*/
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff}
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline dns_result_t
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffadditionaldata_mx(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff void *arg)
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff{
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_t name;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_t region;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff REQUIRE(rdata->type == 15);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_init(&name, NULL);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_rdata_toregion(rdata, &region);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_consume(&region, 2);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff dns_name_fromregion(&name, &region);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff return ((add)(arg, &name, dns_rdatatype_a));
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff}
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graffstatic inline dns_result_t
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graffdigest_mx(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff isc_region_t r1, r2;
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff isc_result_t result;
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff dns_name_t name;
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff REQUIRE(rdata->type == 15);
897c9ddb4d745b2bfecf98b17e5487bb6656299aMichael Graff
897c9ddb4d745b2bfecf98b17e5487bb6656299aMichael Graff dns_rdata_toregion(rdata, &r1);
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff r2 = r1;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff isc_region_consume(&r2, 2);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff r1.length = 2;
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff result = (digest)(arg, &r1);
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff if (result != ISC_R_SUCCESS)
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff return (result);
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff dns_name_init(&name, NULL);
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff dns_name_fromregion(&name, &r2);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return (dns_name_digest(&name, digest, arg));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff}
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff#endif /* RDATA_GENERIC_MX_15_C */
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff