afsdb_18.c revision f31f0b63cbe841720f154c570bcdede9d79e64b8
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley/*
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley *
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Permission to use, copy, modify, and distribute this software for any
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * purpose with or without fee is hereby granted, provided that the above
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * copyright notice and this permission notice appear in all copies.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley *
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * SOFTWARE.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley */
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halley/* $Id: afsdb_18.c,v 1.18 2000/03/18 00:19:24 explorer Exp $ */
e419f613d8591885df608cb73065921be07dd12eBob Halley
9695ae1c24b168996e3a267855dc754971ccb32cBob Halley/* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halley/* RFC 1183 */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halley#ifndef RDATA_GENERIC_AFSDB_18_C
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley#define RDATA_GENERIC_AFSDB_18_C
e419f613d8591885df608cb73065921be07dd12eBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halleystatic inline isc_result_t
9695ae1c24b168996e3a267855dc754971ccb32cBob Halleyfromtext_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley isc_lex_t *lexer, dns_name_t *origin,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_boolean_t downcase, isc_buffer_t *target)
1c776a2909632bc755f3fddd3b53addd792ab4d0Brian Wellington{
e419f613d8591885df608cb73065921be07dd12eBob Halley isc_token_t token;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_t buffer;
e419f613d8591885df608cb73065921be07dd12eBob Halley dns_name_t name;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley UNUSED(rdclass);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
e419f613d8591885df608cb73065921be07dd12eBob Halley REQUIRE(type == 18);
e419f613d8591885df608cb73065921be07dd12eBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley /* subtype */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington RETERR(uint16_tobuffer(token.value.as_ulong, target));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington /* hostname */
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_init(&name, NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington buffer_fromregion(&buffer, &token.value.as_region,
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington ISC_BUFFERTYPE_TEXT);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington origin = (origin != NULL) ? origin : dns_rootname;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington}
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtonstatic inline isc_result_t
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtontotext_afsdb(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_buffer_t *target)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington{
e419f613d8591885df608cb73065921be07dd12eBob Halley dns_name_t name;
e419f613d8591885df608cb73065921be07dd12eBob Halley dns_name_t prefix;
e419f613d8591885df608cb73065921be07dd12eBob Halley isc_region_t region;
e419f613d8591885df608cb73065921be07dd12eBob Halley char buf[sizeof "64000 "];
e419f613d8591885df608cb73065921be07dd12eBob Halley isc_boolean_t sub;
e419f613d8591885df608cb73065921be07dd12eBob Halley unsigned int num;
e419f613d8591885df608cb73065921be07dd12eBob Halley
e419f613d8591885df608cb73065921be07dd12eBob Halley REQUIRE(rdata->type == 18);
e419f613d8591885df608cb73065921be07dd12eBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_init(&name, NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_init(&prefix, NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_rdata_toregion(rdata, &region);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley num = uint16_fromregion(&region);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_consume(&region, 2);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington sprintf(buf, "%u ", num);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington RETERR(str_totext(buf, target));
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington dns_name_fromregion(&name, &region);
e419f613d8591885df608cb73065921be07dd12eBob Halley sub = name_prefix(&name, tctx->origin, &prefix);
e419f613d8591885df608cb73065921be07dd12eBob Halley return (dns_name_totext(&prefix, sub, target));
e419f613d8591885df608cb73065921be07dd12eBob Halley}
e419f613d8591885df608cb73065921be07dd12eBob Halley
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halleystatic inline isc_result_t
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleyfromwire_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_t *source, dns_decompress_t *dctx,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_boolean_t downcase, isc_buffer_t *target)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington{
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_t name;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_t sr;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_t tr;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley UNUSED(rdclass);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(type == 18);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley else
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_init(&name, NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_active(source, &sr);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_available(target, &tr);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (tr.length < 2)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (DNS_R_NOSPACE);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (sr.length < 2)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (DNS_R_UNEXPECTEDEND);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley memcpy(tr.base, sr.base, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_forward(source, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_buffer_add(target, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (dns_name_fromwire(&name, source, dctx, downcase, target));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley}
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleystatic inline isc_result_t
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleytowire_afsdb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley{
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_t tr;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_t sr;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_t name;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(rdata->type == 18);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (dns_compress_getedns(cctx) >= 1)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_compress_setmethods(cctx, DNS_COMPRESS_ALL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley else
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_buffer_available(target, &tr);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_rdata_toregion(rdata, &sr);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (tr.length < 2)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (DNS_R_NOSPACE);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley memcpy(tr.base, sr.base, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_consume(&sr, 2);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_buffer_add(target, 2);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_init(&name, NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_fromregion(&name, &sr);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (dns_name_towire(&name, cctx, target));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington}
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtonstatic inline int
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtoncompare_afsdb(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington{
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington int result;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_t name1;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_name_t name2;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_t region1;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_t region2;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(rdata1->type == rdata2->type);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(rdata1->rdclass == rdata2->rdclass);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington REQUIRE(rdata1->type == 18);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington result = memcmp(rdata1->data, rdata2->data, 2);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington if (result != 0)
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington return (result < 0 ? -1 : 1);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington dns_name_init(&name1, NULL);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington dns_name_init(&name2, NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_rdata_toregion(rdata1, &region1);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_rdata_toregion(rdata2, &region2);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington isc_region_consume(&region1, 2);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington isc_region_consume(&region2, 2);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington dns_name_fromregion(&name1, &region1);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington dns_name_fromregion(&name2, &region2);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington return (dns_name_rdatacompare(&name1, &name2));
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington}
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtonstatic inline isc_result_t
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtonfromstruct_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington isc_buffer_t *target)
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington{
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington UNUSED(rdclass);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington UNUSED(source);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington UNUSED(target);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington REQUIRE(type == 18);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington return (DNS_R_NOTIMPLEMENTED);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington}
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtonstatic inline isc_result_t
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtontostruct_afsdb(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington{
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington UNUSED(target);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington UNUSED(mctx);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington REQUIRE(rdata->type == 18);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(target != NULL);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (DNS_R_NOTIMPLEMENTED);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington}
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafssonstatic inline void
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafssonfreestruct_afsdb(void *source)
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson{
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson dns_rdata_afsdb_t *afsdb = source;
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson REQUIRE(source != NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(afsdb->common.rdtype == 18);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(ISC_FALSE);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley}
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleystatic inline isc_result_t
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleyadditionaldata_afsdb(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley void *arg)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley{
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_t name;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_t region;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(rdata->type == 18);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_init(&name, NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_rdata_toregion(rdata, &region);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_consume(&region, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_fromregion(&name, &region);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return ((add)(arg, &name, dns_rdatatype_a));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley}
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleystatic inline isc_result_t
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleydigest_afsdb(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley{
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_t r1, r2;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_result_t result;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_t name;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley REQUIRE(rdata->type == 18);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_rdata_toregion(rdata, &r1);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley r2 = r1;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley isc_region_consume(&r2, 2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley r1.length = 2;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley RETERR((digest)(arg, &r1));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_init(&name, NULL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_name_fromregion(&name, &r2);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (dns_name_digest(&name, digest, arg));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley}
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley#endif /* RDATA_GENERIC_AFSDB_18_C */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley