mx_15.c revision e27a69f8bd9538e08f775265167ba6cc5f47c587
4a73cf8ee07ae396be20231ac252a24830f3c801Bob Halley * Copyright (C) 1998, 1999 Internet Software Consortium.
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 * 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 /* $Id: mx_15.c,v 1.20 1999/08/31 22:05:54 halley Exp $ */
910df98b0efcbe8380b952887f4071051cc39a25Michael Grafffromtext_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type,
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
e45d323a2a0f4ca08d4b139546e60a5fa7bd3f0cMichael Graff RETERR(uint16_tobuffer(token.value.as_ulong, target));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff buffer_fromregion(&buffer, &token.value.as_region,
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff origin = (origin != NULL) ? origin : dns_rootname;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Grafftotext_mx(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff unsigned short num;
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff sub = name_prefix(&name, tctx->origin, &prefix);
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff return(dns_name_totext(&prefix, sub, target));
910df98b0efcbe8380b952887f4071051cc39a25Michael Grafffromwire_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type,
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
910df98b0efcbe8380b952887f4071051cc39a25Michael Graff dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_fromwire(&name, source, dctx, downcase, target));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Grafftowire_mx(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_ALL);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_towire(&name, cctx, target));
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline int
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graffcompare_mx(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graff result = memcmp(rdata1->data, rdata2->data, 2);
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Graff return (dns_name_rdatacompare(&name1, &name2));
efc8a09e19dfcfafa92fd2ad113073a4f5295e9bMichael Grafffromstruct_mx(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Grafftostruct_mx(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffstatic inline void
970cccf46e0f949a1a9edbcd8302dd2a112b43c2Michael Graffadditionaldata_mx(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graffdigest_mx(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff#endif /* RDATA_GENERIC_MX_15_C */