naptr_35.c revision 2f072c2982861ec2e86e97f8a3ed199fe45c1f70
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * Copyright (C) 1999 Internet Software Consortium.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * Permission to use, copy, modify, and distribute this software for any
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * purpose with or without fee is hereby granted, provided that the above
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * copyright notice and this permission notice appear in all copies.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * SOFTWARE.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* $Id: naptr_35.c,v 1.13 1999/09/15 23:03:35 explorer Exp $ */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* RFC 2168 */
14ea4bb737263733ad80a36b4f73f681c30a6b45sdstatic inline dns_result_t
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfromtext_in_naptr(dns_rdataclass_t rdclass, dns_rdatatype_t type,
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* priority */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh RETERR(uint16_tobuffer(token.value.as_ulong, target));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* weight */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* flags */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RETERR(txt_fromtext(&token.value.as_textregion, target));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* service */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RETERR(txt_fromtext(&token.value.as_textregion, target));
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* regexp */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh RETERR(txt_fromtext(&token.value.as_textregion, target));
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* replacement */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
14ea4bb737263733ad80a36b4f73f681c30a6b45sd return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
14ea4bb737263733ad80a36b4f73f681c30a6b45sdstatic inline dns_result_t
dd566498928f08e7c9a79797a40db893c6a4b9fbvntotext_in_naptr(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
dd566498928f08e7c9a79797a40db893c6a4b9fbvn unsigned short num;
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* priority */
6876da76f91687fee15a706830b990a2c0d55157Trang Do /* weight */
6876da76f91687fee15a706830b990a2c0d55157Trang Do /* flags */
6876da76f91687fee15a706830b990a2c0d55157Trang Do /* service */
6876da76f91687fee15a706830b990a2c0d55157Trang Do /* regexp */
6876da76f91687fee15a706830b990a2c0d55157Trang Do /* replacement */
6876da76f91687fee15a706830b990a2c0d55157Trang Dofromwire_in_naptr(dns_rdataclass_t rdclass, dns_rdatatype_t type,
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* priority, weight */
1557e65f9d0c6fde875d807c12fc03ea20f50280vn /* flags */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* service */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* regexp */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* replacement */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd return (dns_name_fromwire(&name, source, dctx, downcase, target));
14ea4bb737263733ad80a36b4f73f681c30a6b45sdstatic inline dns_result_t
dd566498928f08e7c9a79797a40db893c6a4b9fbvntowire_in_naptr(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* priority, weight */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* flags */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* service */
1557e65f9d0c6fde875d807c12fc03ea20f50280vn /* regexp */
1557e65f9d0c6fde875d807c12fc03ea20f50280vn /* replacement */
1557e65f9d0c6fde875d807c12fc03ea20f50280vnstatic inline int
1557e65f9d0c6fde875d807c12fc03ea20f50280vncompare_in_naptr(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* priority, weight */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh /* flags */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh result = memcmp(region1.base, region2.base, region1.base[0] + 1);
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh /* service */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh result = memcmp(region1.base, region2.base, region1.base[0] + 1);
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh /* regexp */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh result = memcmp(region1.base, region2.base, region1.base[0] + 1);
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephh /* replacement */
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephhfromstruct_in_naptr(dns_rdataclass_t rdclass, dns_rdatatype_t type,
dd566498928f08e7c9a79797a40db893c6a4b9fbvntostruct_in_naptr(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
ef8846857fcf954444cdc77e72249afef48377d2rbstatic inline void
13faa91230bde46da937bf33010b9accc5bdeb59sdadditionaldata_in_naptr(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
13faa91230bde46da937bf33010b9accc5bdeb59sd * We do not currently do type SRV additional data section
13faa91230bde46da937bf33010b9accc5bdeb59sd * processing for terminal NAPTRs.
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic inline dns_result_t
dd566498928f08e7c9a79797a40db893c6a4b9fbvndigest_in_naptr(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
dd566498928f08e7c9a79797a40db893c6a4b9fbvn unsigned int length, n;
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* priority, weight */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* flags */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* service */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* regexp */
ef8846857fcf954444cdc77e72249afef48377d2rb * Digest the RR up to the replacement name.
dd566498928f08e7c9a79797a40db893c6a4b9fbvn /* replacement */
dd566498928f08e7c9a79797a40db893c6a4b9fbvn#endif /* RDATA_IN_1_NAPTR_35_C */