afsdb_18.c revision c661868379d709416c773f6d53b5cec69c88e00f
2bdfb330af70122f9ca5aae2556a112a3010e9efMark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
cd82aa8fa32698240ecd6634f11e3052ca7a2448Michael Graff * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id: afsdb_18.c,v 1.26 2000/05/12 12:59:22 marka Exp $ */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */
cd82aa8fa32698240ecd6634f11e3052ca7a2448Michael Graff/* RFC 1183 */
cd82aa8fa32698240ecd6634f11e3052ca7a2448Michael Grafffromtext_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews /* subtype */
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews RETERR(uint16_tobuffer(token.value.as_ulong, target));
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews /* hostname */
65085946d4f92481699678e276e3ced04bcfdafbMark Andrews RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
65085946d4f92481699678e276e3ced04bcfdafbMark Andrews buffer_fromregion(&buffer, &token.value.as_region);
65085946d4f92481699678e276e3ced04bcfdafbMark Andrews origin = (origin != NULL) ? origin : dns_rootname;
65085946d4f92481699678e276e3ced04bcfdafbMark Andrews return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
65085946d4f92481699678e276e3ced04bcfdafbMark Andrewstotext_afsdb(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews unsigned int num;
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews sub = name_prefix(&name, tctx->origin, &prefix);
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews return (dns_name_totext(&prefix, sub, target));
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrewsfromwire_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews return (dns_name_fromwire(&name, source, dctx, downcase, target));
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrewstowire_afsdb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
cd82aa8fa32698240ecd6634f11e3052ca7a2448Michael Graffstatic inline int
65085946d4f92481699678e276e3ced04bcfdafbMark Andrewscompare_afsdb(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
cd82aa8fa32698240ecd6634f11e3052ca7a2448Michael Graff result = memcmp(rdata1->data, rdata2->data, 2);
c1ee8bb4ba3e9ab1463403ed685729631de406b1Mark Andrews return (dns_name_rdatacompare(&name1, &name2));
88b9c12a3cbafc3bebedf50a731bec9ce2f99a13Brian Wellingtonfromstruct_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
88b9c12a3cbafc3bebedf50a731bec9ce2f99a13Brian Wellingtontostruct_afsdb(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
88b9c12a3cbafc3bebedf50a731bec9ce2f99a13Brian Wellington afsdb->subtype = uint16_fromregion(®ion);
383665e42ad838046472e847b16c4e0d3f1aaf76Bob Halley RETERR(name_duporclone(&name, mctx, &afsdb->server));
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrewsstatic inline void
65085946d4f92481699678e276e3ced04bcfdafbMark Andrewsadditionaldata_afsdb(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
c1ee8bb4ba3e9ab1463403ed685729631de406b1Mark Andrewsdigest_afsdb(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
88b9c12a3cbafc3bebedf50a731bec9ce2f99a13Brian Wellington#endif /* RDATA_GENERIC_AFSDB_18_C */