ptr_12.c revision 373ce67419680a398ba3dc51a14a486caaf0afb0
f3064bfd1b75f7408cff6dbdb864ad62390307d3Mark Andrews * Copyright (C) 1998, 1999, 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * purpose with or without fee is hereby granted, provided that the above
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * 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
3d711f2f75cb9a9ddcbf1fca9b2de192e75340e6Mark Andrews/* $Id: ptr_12.c,v 1.27 2000/05/22 12:37:53 marka Exp $ */
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer/* Reviewed: Thu Mar 16 14:05:12 PST 2000 by explorer */
242bba8991b030b7764f0bdca3922d75c34ea51eAndreas Gustafssonfromtext_ptr(dns_rdataclass_t rdclass, dns_rdatatype_t type,
c9defbf4b968e8a61f391246431ac63d0d6a39abMichael Sawyer isc_boolean_t downcase, isc_buffer_t *target)
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyer RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
55bf97a1b4b7f78b669b1179df1422cb9789c484Michael Sawyer buffer_fromregion(&buffer, &token.value.as_region);
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyer origin = (origin != NULL) ? origin : dns_rootname;
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
0e0e575ec135a983a53c501cf48734b823361ab4Brian Wellingtontotext_ptr(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer sub = name_prefix(&name, tctx->origin, &prefix);
da5d1cf1b1aa29ae53a0427be49291b04bd60549Mark Andrews return (dns_name_totext(&prefix, sub, target));
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerfromwire_ptr(dns_rdataclass_t rdclass, dns_rdatatype_t type,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer isc_buffer_t *source, dns_decompress_t *dctx,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer isc_boolean_t downcase, isc_buffer_t *target)
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer return (dns_name_fromwire(&name, source, dctx, downcase, target));
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyertowire_ptr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer return (dns_name_towire(&name, cctx, target));
e32394a2ac3466a2235f79ee32c247a11be42a8dAndreas Gustafssonstatic inline int
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyercompare_ptr(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
9a762177e6a0aff3ea5c00f87568c8ae3cd0e6c7Andreas Gustafsson return (dns_name_rdatacompare(&name1, &name2));
b266f8fc42702debc6bd89365273223fa89cd8ddBrian Wellingtonfromstruct_ptr(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
b266f8fc42702debc6bd89365273223fa89cd8ddBrian Wellington return (isc_buffer_copyregion(target, ®ion));
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyertostruct_ptr(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
e56101fa6876c876d9957c23784b6493cdb05e09Brian Wellington RETERR(name_duporclone(&name, mctx, &ptr->ptr));
e56101fa6876c876d9957c23784b6493cdb05e09Brian Wellingtonstatic inline void
1ae75c1024eb0475c2be352b8707772e16332ad0Mark Andrewsadditionaldata_ptr(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
e56101fa6876c876d9957c23784b6493cdb05e09Brian Wellingtondigest_ptr(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
e56101fa6876c876d9957c23784b6493cdb05e09Brian Wellington return (dns_name_digest(&name, digest, arg));
e56101fa6876c876d9957c23784b6493cdb05e09Brian Wellington#endif /* RDATA_GENERIC_PTR_12_C */