afsdb_18.c revision f31f0b63cbe841720f154c570bcdede9d79e64b8
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
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 * 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
e419f613d8591885df608cb73065921be07dd12eBob Halley/* $Id: afsdb_18.c,v 1.18 2000/03/18 00:19:24 explorer Exp $ */
9695ae1c24b168996e3a267855dc754971ccb32cBob Halley/* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */
e419f613d8591885df608cb73065921be07dd12eBob Halley/* RFC 1183 */
9695ae1c24b168996e3a267855dc754971ccb32cBob Halleyfromtext_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
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 /* hostname */
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington buffer_fromregion(&buffer, &token.value.as_region,
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington origin = (origin != NULL) ? origin : dns_rootname;
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtontotext_afsdb(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
e419f613d8591885df608cb73065921be07dd12eBob Halley unsigned int num;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleyfromwire_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley return (dns_name_fromwire(&name, source, dctx, downcase, target));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleytowire_afsdb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington dns_compress_setmethods(cctx, DNS_COMPRESS_ALL);
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington return (dns_name_towire(&name, cctx, target));
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtonstatic inline int
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtoncompare_afsdb(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington REQUIRE(rdata1->rdclass == rdata2->rdclass);
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington result = memcmp(rdata1->data, rdata2->data, 2);
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington return (dns_name_rdatacompare(&name1, &name2));
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtonfromstruct_afsdb(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellingtontostruct_afsdb(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafssonstatic inline void
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleyadditionaldata_afsdb(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleydigest_afsdb(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley#endif /* RDATA_GENERIC_AFSDB_18_C */