2 * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: rdata.c,v 1.196.128.2 2008/12/12 23:46:38 tbox Exp $ */
25 #include <isc/base64.h>
29 #include <isc/parseint.h>
30 #include <isc/print.h>
31 #include <isc/string.h>
32 #include <isc/stdlib.h>
35 #include <dns/callbacks.h>
37 #include <dns/compress.h>
38 #include <dns/enumtype.h>
39 #include <dns/keyflags.h>
40 #include <dns/keyvalues.h>
41 #include <dns/rcode.h>
42 #include <dns/rdata.h>
43 #include <dns/rdataclass.h>
44 #include <dns/rdatastruct.h>
45 #include <dns/rdatatype.h>
46 #include <dns/result.h>
47 #include <dns/secalg.h>
48 #include <dns/secproto.h>
54 isc_result_t _r = (x); \
55 if (_r != ISC_R_SUCCESS) \
61 isc_result_t _r = (x); \
62 if (_r != ISC_R_SUCCESS) { \
63 isc_lex_ungettoken(lexer, &token); \
68 #define DNS_AS_STR(t) ((t).value.as_textregion.base)
70 #define ARGS_FROMTEXT int rdclass, dns_rdatatype_t type, \
71 isc_lex_t *lexer, dns_name_t *origin, \
72 unsigned int options, isc_buffer_t *target, \
73 dns_rdatacallbacks_t *callbacks
75 #define ARGS_TOTEXT dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, \
78 #define ARGS_FROMWIRE int rdclass, dns_rdatatype_t type, \
79 isc_buffer_t *source, dns_decompress_t *dctx, \
80 unsigned int options, isc_buffer_t *target
82 #define ARGS_TOWIRE dns_rdata_t *rdata, dns_compress_t *cctx, \
85 #define ARGS_COMPARE const dns_rdata_t *rdata1, const dns_rdata_t *rdata2
87 #define ARGS_FROMSTRUCT int rdclass, dns_rdatatype_t type, \
88 void *source, isc_buffer_t *target
90 #define ARGS_TOSTRUCT dns_rdata_t *rdata, void *target, isc_mem_t *mctx
92 #define ARGS_FREESTRUCT void *source
94 #define ARGS_ADDLDATA dns_rdata_t *rdata, dns_additionaldatafunc_t add, \
97 #define ARGS_DIGEST dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg
99 #define ARGS_CHECKOWNER dns_name_t *name, dns_rdataclass_t rdclass, \
100 dns_rdatatype_t type, isc_boolean_t wildcard
102 #define ARGS_CHECKNAMES dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad
106 * Context structure for the totext_ functions.
107 * Contains formatting options for rdata-to-text
110 typedef struct dns_rdata_textctx
{
111 dns_name_t
*origin
; /*%< Current origin, or NULL. */
112 unsigned int flags
; /*%< DNS_STYLEFLAG_* */
113 unsigned int width
; /*%< Width of rdata column. */
114 const char *linebreak
; /*%< Line break string. */
115 } dns_rdata_textctx_t
;
118 txt_totext(isc_region_t
*source
, isc_buffer_t
*target
);
121 txt_fromtext(isc_textregion_t
*source
, isc_buffer_t
*target
);
124 txt_fromwire(isc_buffer_t
*source
, isc_buffer_t
*target
);
127 name_prefix(dns_name_t
*name
, dns_name_t
*origin
, dns_name_t
*target
);
130 name_length(dns_name_t
*name
);
133 str_totext(const char *source
, isc_buffer_t
*target
);
136 inet_totext(int af
, isc_region_t
*src
, isc_buffer_t
*target
);
139 buffer_empty(isc_buffer_t
*source
);
142 buffer_fromregion(isc_buffer_t
*buffer
, isc_region_t
*region
);
145 uint32_tobuffer(isc_uint32_t
, isc_buffer_t
*target
);
148 uint16_tobuffer(isc_uint32_t
, isc_buffer_t
*target
);
151 uint8_tobuffer(isc_uint32_t
, isc_buffer_t
*target
);
154 name_tobuffer(dns_name_t
*name
, isc_buffer_t
*target
);
157 uint32_fromregion(isc_region_t
*region
);
160 uint16_fromregion(isc_region_t
*region
);
163 uint8_fromregion(isc_region_t
*region
);
166 mem_tobuffer(isc_buffer_t
*target
, void *base
, unsigned int length
);
169 hexvalue(char value
);
172 decvalue(char value
);
175 btoa_totext(unsigned char *inbuf
, int inbuflen
, isc_buffer_t
*target
);
178 atob_tobuffer(isc_lex_t
*lexer
, isc_buffer_t
*target
);
181 default_fromtext_callback(dns_rdatacallbacks_t
*callbacks
, const char *, ...)
182 ISC_FORMAT_PRINTF(2, 3);
185 fromtext_error(void (*callback
)(dns_rdatacallbacks_t
*, const char *, ...),
186 dns_rdatacallbacks_t
*callbacks
, const char *name
,
187 unsigned long line
, isc_token_t
*token
, isc_result_t result
);
190 fromtext_warneof(isc_lex_t
*lexer
, dns_rdatacallbacks_t
*callbacks
);
193 rdata_totext(dns_rdata_t
*rdata
, dns_rdata_textctx_t
*tctx
,
194 isc_buffer_t
*target
);
197 warn_badname(dns_name_t
*name
, isc_lex_t
*lexer
,
198 dns_rdatacallbacks_t
*callbacks
);
201 warn_badmx(isc_token_t
*token
, isc_lex_t
*lexer
,
202 dns_rdatacallbacks_t
*callbacks
);
205 getquad(const void *src
, struct in_addr
*dst
,
206 isc_lex_t
*lexer
, dns_rdatacallbacks_t
*callbacks
)
211 result
= inet_aton(src
, dst
);
212 if (result
== 1 && callbacks
!= NULL
&&
213 inet_pton(AF_INET
, src
, &tmp
) != 1) {
214 const char *name
= isc_lex_getsourcename(lexer
);
217 (*callbacks
->warn
)(callbacks
, "%s:%lu: \"%s\" "
218 "is not a decimal dotted quad", name
,
219 isc_lex_getsourceline(lexer
), src
);
224 static inline isc_result_t
225 name_duporclone(dns_name_t
*source
, isc_mem_t
*mctx
, dns_name_t
*target
) {
228 return (dns_name_dup(source
, mctx
, target
));
229 dns_name_clone(source
, target
);
230 return (ISC_R_SUCCESS
);
234 mem_maybedup(isc_mem_t
*mctx
, void *source
, size_t length
) {
239 new = isc_mem_allocate(mctx
, length
);
241 memcpy(new, source
, length
);
246 static const char hexdigits
[] = "0123456789abcdef";
247 static const char decdigits
[] = "0123456789";
252 #define RESERVED 0x0002
259 dns_rdata_init(dns_rdata_t
*rdata
) {
261 REQUIRE(rdata
!= NULL
);
268 ISC_LINK_INIT(rdata
, link
);
269 /* ISC_LIST_INIT(rdata->list); */
273 #define DNS_RDATA_INITIALIZED(rdata) \
274 ((rdata)->data == NULL && (rdata)->length == 0 && \
275 (rdata)->rdclass == 0 && (rdata)->type == 0 && (rdata)->flags == 0 && \
276 !ISC_LINK_LINKED((rdata), link))
278 #ifdef ISC_LIST_CHECKINIT
279 #define DNS_RDATA_INITIALIZED(rdata) \
280 (!ISC_LINK_LINKED((rdata), link))
282 #define DNS_RDATA_INITIALIZED(rdata) ISC_TRUE
285 #define DNS_RDATA_VALIDFLAGS(rdata) \
286 (((rdata)->flags & ~DNS_RDATA_UPDATE) == 0)
289 dns_rdata_reset(dns_rdata_t
*rdata
) {
291 REQUIRE(rdata
!= NULL
);
293 REQUIRE(!ISC_LINK_LINKED(rdata
, link
));
294 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
308 dns_rdata_clone(const dns_rdata_t
*src
, dns_rdata_t
*target
) {
310 REQUIRE(src
!= NULL
);
311 REQUIRE(target
!= NULL
);
313 REQUIRE(DNS_RDATA_INITIALIZED(target
));
315 REQUIRE(DNS_RDATA_VALIDFLAGS(src
));
316 REQUIRE(DNS_RDATA_VALIDFLAGS(target
));
318 target
->data
= src
->data
;
319 target
->length
= src
->length
;
320 target
->rdclass
= src
->rdclass
;
321 target
->type
= src
->type
;
322 target
->flags
= src
->flags
;
331 dns_rdata_compare(const dns_rdata_t
*rdata1
, const dns_rdata_t
*rdata2
) {
333 isc_boolean_t use_default
= ISC_FALSE
;
335 REQUIRE(rdata1
!= NULL
);
336 REQUIRE(rdata2
!= NULL
);
337 REQUIRE(rdata1
->data
!= NULL
);
338 REQUIRE(rdata2
->data
!= NULL
);
339 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1
));
340 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2
));
342 if (rdata1
->rdclass
!= rdata2
->rdclass
)
343 return (rdata1
->rdclass
< rdata2
->rdclass
? -1 : 1);
345 if (rdata1
->type
!= rdata2
->type
)
346 return (rdata1
->type
< rdata2
->type
? -1 : 1);
354 dns_rdata_toregion(rdata1
, &r1
);
355 dns_rdata_toregion(rdata2
, &r2
);
356 result
= isc_region_compare(&r1
, &r2
);
366 dns_rdata_fromregion(dns_rdata_t
*rdata
, dns_rdataclass_t rdclass
,
367 dns_rdatatype_t type
, isc_region_t
*r
)
370 REQUIRE(rdata
!= NULL
);
371 REQUIRE(DNS_RDATA_INITIALIZED(rdata
));
374 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
376 rdata
->data
= r
->base
;
377 rdata
->length
= r
->length
;
378 rdata
->rdclass
= rdclass
;
384 dns_rdata_toregion(const dns_rdata_t
*rdata
, isc_region_t
*r
) {
386 REQUIRE(rdata
!= NULL
);
388 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
390 r
->base
= rdata
->data
;
391 r
->length
= rdata
->length
;
395 dns_rdata_fromwire(dns_rdata_t
*rdata
, dns_rdataclass_t rdclass
,
396 dns_rdatatype_t type
, isc_buffer_t
*source
,
397 dns_decompress_t
*dctx
, unsigned int options
,
398 isc_buffer_t
*target
)
400 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
404 isc_boolean_t use_default
= ISC_FALSE
;
405 isc_uint32_t activelength
;
407 REQUIRE(dctx
!= NULL
);
409 REQUIRE(DNS_RDATA_INITIALIZED(rdata
));
410 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
414 return (DNS_R_FORMERR
);
419 activelength
= isc_buffer_activelength(source
);
420 INSIST(activelength
< 65536);
425 if (activelength
> isc_buffer_availablelength(target
))
426 result
= ISC_R_NOSPACE
;
428 isc_buffer_putmem(target
, isc_buffer_current(source
),
430 isc_buffer_forward(source
, activelength
);
431 result
= ISC_R_SUCCESS
;
436 * We should have consumed all of our buffer.
438 if (result
== ISC_R_SUCCESS
&& !buffer_empty(source
))
439 result
= DNS_R_EXTRADATA
;
441 if (rdata
!= NULL
&& result
== ISC_R_SUCCESS
) {
442 region
.base
= isc_buffer_used(&st
);
443 region
.length
= isc_buffer_usedlength(target
) -
444 isc_buffer_usedlength(&st
);
445 dns_rdata_fromregion(rdata
, rdclass
, type
, ®ion
);
448 if (result
!= ISC_R_SUCCESS
) {
456 dns_rdata_towire(dns_rdata_t
*rdata
, dns_compress_t
*cctx
,
457 isc_buffer_t
*target
)
459 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
460 isc_boolean_t use_default
= ISC_FALSE
;
464 REQUIRE(rdata
!= NULL
);
465 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
468 * Some DynDNS meta-RRs have empty rdata.
470 if ((rdata
->flags
& DNS_RDATA_UPDATE
) != 0) {
471 INSIST(rdata
->length
== 0);
472 return (ISC_R_SUCCESS
);
480 isc_buffer_availableregion(target
, &tr
);
481 if (tr
.length
< rdata
->length
)
482 return (ISC_R_NOSPACE
);
483 memcpy(tr
.base
, rdata
->data
, rdata
->length
);
484 isc_buffer_add(target
, rdata
->length
);
485 return (ISC_R_SUCCESS
);
487 if (result
!= ISC_R_SUCCESS
) {
489 INSIST(target
->used
< 65536);
490 dns_compress_rollback(cctx
, (isc_uint16_t
)target
->used
);
496 * If the binary data in 'src' is valid uncompressed wire format
497 * rdata of class 'rdclass' and type 'type', return ISC_R_SUCCESS
498 * and copy the validated rdata to 'dest'. Otherwise return an error.
501 rdata_validate(isc_buffer_t
*src
, isc_buffer_t
*dest
, dns_rdataclass_t rdclass
,
502 dns_rdatatype_t type
)
504 dns_decompress_t dctx
;
505 dns_rdata_t rdata
= DNS_RDATA_INIT
;
508 dns_decompress_init(&dctx
, -1, DNS_DECOMPRESS_NONE
);
509 isc_buffer_setactive(src
, isc_buffer_usedlength(src
));
510 result
= dns_rdata_fromwire(&rdata
, rdclass
, type
, src
,
512 dns_decompress_invalidate(&dctx
);
518 unknown_fromtext(dns_rdataclass_t rdclass
, dns_rdatatype_t type
,
519 isc_lex_t
*lexer
, isc_mem_t
*mctx
, isc_buffer_t
*target
)
522 isc_buffer_t
*buf
= NULL
;
525 if (type
== 0 || dns_rdatatype_ismeta(type
))
526 return (DNS_R_METATYPE
);
528 result
= isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_number
,
530 if (result
== ISC_R_SUCCESS
&& token
.value
.as_ulong
> 65535U)
531 return (ISC_R_RANGE
);
532 result
= isc_buffer_allocate(mctx
, &buf
, token
.value
.as_ulong
);
533 if (result
!= ISC_R_SUCCESS
)
536 result
= isc_hex_tobuffer(lexer
, buf
,
537 (unsigned int)token
.value
.as_ulong
);
538 if (result
!= ISC_R_SUCCESS
)
540 if (isc_buffer_usedlength(buf
) != token
.value
.as_ulong
) {
541 result
= ISC_R_UNEXPECTEDEND
;
545 if (dns_rdatatype_isknown(type
)) {
546 result
= rdata_validate(buf
, target
, rdclass
, type
);
549 isc_buffer_usedregion(buf
, &r
);
550 result
= isc_buffer_copyregion(target
, &r
);
552 if (result
!= ISC_R_SUCCESS
)
555 isc_buffer_free(&buf
);
556 return (ISC_R_SUCCESS
);
559 isc_buffer_free(&buf
);
564 dns_rdata_fromtext(dns_rdata_t
*rdata
, dns_rdataclass_t rdclass
,
565 dns_rdatatype_t type
, isc_lex_t
*lexer
,
566 dns_name_t
*origin
, unsigned int options
, isc_mem_t
*mctx
,
567 isc_buffer_t
*target
, dns_rdatacallbacks_t
*callbacks
)
569 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
573 unsigned int lexoptions
= ISC_LEXOPT_EOL
| ISC_LEXOPT_EOF
|
574 ISC_LEXOPT_DNSMULTILINE
| ISC_LEXOPT_ESCAPE
;
577 void (*callback
)(dns_rdatacallbacks_t
*, const char *, ...);
578 isc_result_t tresult
;
580 REQUIRE(origin
== NULL
|| dns_name_isabsolute(origin
) == ISC_TRUE
);
582 REQUIRE(DNS_RDATA_INITIALIZED(rdata
));
583 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
585 if (callbacks
!= NULL
) {
586 REQUIRE(callbacks
->warn
!= NULL
);
587 REQUIRE(callbacks
->error
!= NULL
);
592 if (callbacks
!= NULL
)
593 callback
= callbacks
->error
;
595 callback
= default_fromtext_callback
;
597 result
= isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_qstring
,
599 if (result
!= ISC_R_SUCCESS
) {
600 name
= isc_lex_getsourcename(lexer
);
601 line
= isc_lex_getsourceline(lexer
);
602 fromtext_error(callback
, callbacks
, name
, line
,
607 if (strcmp(DNS_AS_STR(token
), "\\#") == 0)
608 result
= unknown_fromtext(rdclass
, type
, lexer
, mctx
, target
);
610 isc_lex_ungettoken(lexer
, &token
);
616 * Consume to end of line / file.
617 * If not at end of line initially set error code.
618 * Call callback via fromtext_error once if there was an error.
621 name
= isc_lex_getsourcename(lexer
);
622 line
= isc_lex_getsourceline(lexer
);
623 tresult
= isc_lex_gettoken(lexer
, lexoptions
, &token
);
624 if (tresult
!= ISC_R_SUCCESS
) {
625 if (result
== ISC_R_SUCCESS
)
627 if (callback
!= NULL
)
628 fromtext_error(callback
, callbacks
, name
,
631 } else if (token
.type
!= isc_tokentype_eol
&&
632 token
.type
!= isc_tokentype_eof
) {
633 if (result
== ISC_R_SUCCESS
)
634 result
= DNS_R_EXTRATOKEN
;
635 if (callback
!= NULL
) {
636 fromtext_error(callback
, callbacks
, name
,
637 line
, &token
, result
);
640 } else if (result
!= ISC_R_SUCCESS
&& callback
!= NULL
) {
641 fromtext_error(callback
, callbacks
, name
, line
,
645 if (token
.type
== isc_tokentype_eof
)
646 fromtext_warneof(lexer
, callbacks
);
651 if (rdata
!= NULL
&& result
== ISC_R_SUCCESS
) {
652 region
.base
= isc_buffer_used(&st
);
653 region
.length
= isc_buffer_usedlength(target
) -
654 isc_buffer_usedlength(&st
);
655 dns_rdata_fromregion(rdata
, rdclass
, type
, ®ion
);
657 if (result
!= ISC_R_SUCCESS
) {
664 rdata_totext(dns_rdata_t
*rdata
, dns_rdata_textctx_t
*tctx
,
665 isc_buffer_t
*target
)
667 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
668 isc_boolean_t use_default
= ISC_FALSE
;
669 char buf
[sizeof("65535")];
672 REQUIRE(rdata
!= NULL
);
673 REQUIRE(tctx
->origin
== NULL
||
674 dns_name_isabsolute(tctx
->origin
) == ISC_TRUE
);
677 * Some DynDNS meta-RRs have empty rdata.
679 if ((rdata
->flags
& DNS_RDATA_UPDATE
) != 0) {
680 INSIST(rdata
->length
== 0);
681 return (ISC_R_SUCCESS
);
687 strlcpy(buf
, "\\# ", sizeof(buf
));
688 result
= str_totext(buf
, target
);
689 dns_rdata_toregion(rdata
, &sr
);
690 INSIST(sr
.length
< 65536);
691 snprintf(buf
, sizeof(buf
), "%u", sr
.length
);
692 result
= str_totext(buf
, target
);
693 if (sr
.length
!= 0 && result
== ISC_R_SUCCESS
) {
694 if ((tctx
->flags
& DNS_STYLEFLAG_MULTILINE
) != 0)
695 result
= str_totext(" ( ", target
);
697 result
= str_totext(" ", target
);
698 if (result
== ISC_R_SUCCESS
)
699 result
= isc_hex_totext(&sr
, tctx
->width
- 2,
702 if (result
== ISC_R_SUCCESS
&&
703 (tctx
->flags
& DNS_STYLEFLAG_MULTILINE
) != 0)
704 result
= str_totext(" )", target
);
712 dns_rdata_totext(dns_rdata_t
*rdata
, dns_name_t
*origin
, isc_buffer_t
*target
)
714 dns_rdata_textctx_t tctx
;
716 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
719 * Set up formatting options for single-line output.
721 tctx
.origin
= origin
;
724 tctx
.linebreak
= " ";
725 return (rdata_totext(rdata
, &tctx
, target
));
729 dns_rdata_tofmttext(dns_rdata_t
*rdata
, dns_name_t
*origin
,
730 unsigned int flags
, unsigned int width
,
731 const char *linebreak
, isc_buffer_t
*target
)
733 dns_rdata_textctx_t tctx
;
735 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
738 * Set up formatting options for formatted output.
740 tctx
.origin
= origin
;
742 if ((flags
& DNS_STYLEFLAG_MULTILINE
) != 0) {
744 tctx
.linebreak
= linebreak
;
746 tctx
.width
= 60; /* Used for hex word length only. */
747 tctx
.linebreak
= " ";
749 return (rdata_totext(rdata
, &tctx
, target
));
753 dns_rdata_fromstruct(dns_rdata_t
*rdata
, dns_rdataclass_t rdclass
,
754 dns_rdatatype_t type
, void *source
,
755 isc_buffer_t
*target
)
757 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
760 isc_boolean_t use_default
= ISC_FALSE
;
762 REQUIRE(source
!= NULL
);
764 REQUIRE(DNS_RDATA_INITIALIZED(rdata
));
765 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
775 if (rdata
!= NULL
&& result
== ISC_R_SUCCESS
) {
776 region
.base
= isc_buffer_used(&st
);
777 region
.length
= isc_buffer_usedlength(target
) -
778 isc_buffer_usedlength(&st
);
779 dns_rdata_fromregion(rdata
, rdclass
, type
, ®ion
);
781 if (result
!= ISC_R_SUCCESS
)
787 dns_rdata_tostruct(dns_rdata_t
*rdata
, void *target
, isc_mem_t
*mctx
) {
788 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
789 isc_boolean_t use_default
= ISC_FALSE
;
791 REQUIRE(rdata
!= NULL
);
792 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
803 dns_rdata_freestruct(void *source
) {
804 dns_rdatacommon_t
*common
= source
;
805 REQUIRE(source
!= NULL
);
811 dns_rdata_additionaldata(dns_rdata_t
*rdata
, dns_additionaldatafunc_t add
,
814 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
815 isc_boolean_t use_default
= ISC_FALSE
;
818 * Call 'add' for each name and type from 'rdata' which is subject to
819 * additional section processing.
822 REQUIRE(rdata
!= NULL
);
823 REQUIRE(add
!= NULL
);
824 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
828 /* No additional processing for unknown types */
830 result
= ISC_R_SUCCESS
;
836 dns_rdata_digest(dns_rdata_t
*rdata
, dns_digestfunc_t digest
, void *arg
) {
837 isc_result_t result
= ISC_R_NOTIMPLEMENTED
;
838 isc_boolean_t use_default
= ISC_FALSE
;
842 * Send 'rdata' in DNSSEC canonical form to 'digest'.
845 REQUIRE(rdata
!= NULL
);
846 REQUIRE(digest
!= NULL
);
847 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata
));
852 dns_rdata_toregion(rdata
, &r
);
853 result
= (digest
)(arg
, &r
);
860 dns_rdata_checkowner(dns_name_t
*name
, dns_rdataclass_t rdclass
,
861 dns_rdatatype_t type
, isc_boolean_t wildcard
)
863 isc_boolean_t result
;
870 dns_rdata_checknames(dns_rdata_t
*rdata
, dns_name_t
*owner
, dns_name_t
*bad
)
872 isc_boolean_t result
;
879 dns_rdatatype_attributes(dns_rdatatype_t type
)
881 RDATATYPE_ATTRIBUTE_SW
882 if (type
>= (dns_rdatatype_t
)128 && type
< (dns_rdatatype_t
)255)
883 return (DNS_RDATATYPEATTR_UNKNOWN
| DNS_RDATATYPEATTR_META
);
884 return (DNS_RDATATYPEATTR_UNKNOWN
);
888 dns_rdatatype_fromtext(dns_rdatatype_t
*typep
, isc_textregion_t
*source
) {
896 return (DNS_R_UNKNOWN
);
898 a
= tolower((unsigned char)source
->base
[0]);
899 b
= tolower((unsigned char)source
->base
[n
- 1]);
901 hash
= ((a
+ n
) * b
) % 256;
904 * This switch block is inlined via \#define, and will use "return"
905 * to return a result to the caller if it is a valid (known)
908 RDATATYPE_FROMTEXT_SW(hash
, source
->base
, n
, typep
);
910 if (source
->length
> 4 && source
->length
< (4 + sizeof("65000")) &&
911 strncasecmp("type", source
->base
, 4) == 0) {
912 char buf
[sizeof("65000")];
916 strncpy(buf
, source
->base
+ 4, source
->length
- 4);
917 buf
[source
->length
- 4] = '\0';
918 val
= strtoul(buf
, &endp
, 10);
919 if (*endp
== '\0' && val
<= 0xffff) {
920 *typep
= (dns_rdatatype_t
)val
;
921 return (ISC_R_SUCCESS
);
925 return (DNS_R_UNKNOWN
);
929 dns_rdatatype_totext(dns_rdatatype_t type
, isc_buffer_t
*target
) {
930 char buf
[sizeof("TYPE65535")];
933 snprintf(buf
, sizeof(buf
), "TYPE%u", type
);
934 return (str_totext(buf
, target
));
938 dns_rdatatype_format(dns_rdatatype_t rdtype
,
939 char *array
, unsigned int size
)
944 isc_buffer_init(&buf
, array
, size
);
945 result
= dns_rdatatype_totext(rdtype
, &buf
);
949 if (result
== ISC_R_SUCCESS
) {
950 if (isc_buffer_availablelength(&buf
) >= 1)
951 isc_buffer_putuint8(&buf
, 0);
953 result
= ISC_R_NOSPACE
;
955 if (result
!= ISC_R_SUCCESS
) {
956 snprintf(array
, size
, "<unknown>");
957 array
[size
- 1] = '\0';
966 name_length(dns_name_t
*name
) {
967 return (name
->length
);
971 txt_totext(isc_region_t
*source
, isc_buffer_t
*target
) {
978 isc_buffer_availableregion(target
, ®ion
);
980 tp
= (char *)region
.base
;
985 REQUIRE(n
+ 1 <= source
->length
);
988 return (ISC_R_NOSPACE
);
992 if (*sp
< 0x20 || *sp
>= 0x7f) {
994 return (ISC_R_NOSPACE
);
996 *tp
++ = 0x30 + ((*sp
/ 100) % 10);
997 *tp
++ = 0x30 + ((*sp
/ 10) % 10);
998 *tp
++ = 0x30 + (*sp
% 10);
1003 /* double quote, semi-colon, backslash */
1004 if (*sp
== 0x22 || *sp
== 0x3b || *sp
== 0x5c) {
1006 return (ISC_R_NOSPACE
);
1011 return (ISC_R_NOSPACE
);
1016 return (ISC_R_NOSPACE
);
1019 isc_buffer_add(target
, tp
- (char *)region
.base
);
1020 isc_region_consume(source
, *source
->base
+ 1);
1021 return (ISC_R_SUCCESS
);
1025 txt_fromtext(isc_textregion_t
*source
, isc_buffer_t
*target
) {
1026 isc_region_t tregion
;
1027 isc_boolean_t escape
;
1028 unsigned int n
, nrem
;
1034 isc_buffer_availableregion(target
, &tregion
);
1038 nrem
= tregion
.length
;
1041 return (ISC_R_NOSPACE
);
1048 * Maximum text string length.
1054 if (escape
&& (d
= decvalue((char)c
)) != -1) {
1057 return (DNS_R_SYNTAX
);
1059 if ((d
= decvalue(*s
++)) != -1)
1062 return (DNS_R_SYNTAX
);
1064 return (DNS_R_SYNTAX
);
1066 if ((d
= decvalue(*s
++)) != -1)
1069 return (DNS_R_SYNTAX
);
1071 return (DNS_R_SYNTAX
);
1072 } else if (!escape
&& c
== '\\') {
1078 return (ISC_R_NOSPACE
);
1083 return (DNS_R_SYNTAX
);
1084 *tregion
.base
= t
- tregion
.base
- 1;
1085 isc_buffer_add(target
, *tregion
.base
+ 1);
1086 return (ISC_R_SUCCESS
);
1090 txt_fromwire(isc_buffer_t
*source
, isc_buffer_t
*target
) {
1092 isc_region_t sregion
;
1093 isc_region_t tregion
;
1095 isc_buffer_activeregion(source
, &sregion
);
1096 if (sregion
.length
== 0)
1097 return(ISC_R_UNEXPECTEDEND
);
1098 n
= *sregion
.base
+ 1;
1099 if (n
> sregion
.length
)
1100 return (ISC_R_UNEXPECTEDEND
);
1102 isc_buffer_availableregion(target
, &tregion
);
1103 if (n
> tregion
.length
)
1104 return (ISC_R_NOSPACE
);
1106 memcpy(tregion
.base
, sregion
.base
, n
);
1107 isc_buffer_forward(source
, n
);
1108 isc_buffer_add(target
, n
);
1109 return (ISC_R_SUCCESS
);
1112 static isc_boolean_t
1113 name_prefix(dns_name_t
*name
, dns_name_t
*origin
, dns_name_t
*target
) {
1119 if (dns_name_compare(origin
, dns_rootname
) == 0)
1122 if (!dns_name_issubdomain(name
, origin
))
1125 l1
= dns_name_countlabels(name
);
1126 l2
= dns_name_countlabels(origin
);
1131 dns_name_getlabelsequence(name
, 0, l1
- l2
, target
);
1140 str_totext(const char *source
, isc_buffer_t
*target
) {
1142 isc_region_t region
;
1144 isc_buffer_availableregion(target
, ®ion
);
1147 if (l
> region
.length
)
1148 return (ISC_R_NOSPACE
);
1150 memcpy(region
.base
, source
, l
);
1151 isc_buffer_add(target
, l
);
1152 return (ISC_R_SUCCESS
);
1156 inet_totext(int af
, isc_region_t
*src
, isc_buffer_t
*target
) {
1159 /* Note - inet_ntop doesn't do size checking on its input. */
1160 if (inet_ntop(af
, src
->base
, tmpbuf
, sizeof(tmpbuf
)) == NULL
)
1161 return (ISC_R_NOSPACE
);
1162 if (strlen(tmpbuf
) > isc_buffer_availablelength(target
))
1163 return (ISC_R_NOSPACE
);
1164 isc_buffer_putstr(target
, tmpbuf
);
1165 return (ISC_R_SUCCESS
);
1168 static isc_boolean_t
1169 buffer_empty(isc_buffer_t
*source
) {
1170 return((source
->current
== source
->active
) ? ISC_TRUE
: ISC_FALSE
);
1174 buffer_fromregion(isc_buffer_t
*buffer
, isc_region_t
*region
) {
1175 isc_buffer_init(buffer
, region
->base
, region
->length
);
1176 isc_buffer_add(buffer
, region
->length
);
1177 isc_buffer_setactive(buffer
, region
->length
);
1181 uint32_tobuffer(isc_uint32_t value
, isc_buffer_t
*target
) {
1182 isc_region_t region
;
1184 isc_buffer_availableregion(target
, ®ion
);
1185 if (region
.length
< 4)
1186 return (ISC_R_NOSPACE
);
1187 isc_buffer_putuint32(target
, value
);
1188 return (ISC_R_SUCCESS
);
1192 uint16_tobuffer(isc_uint32_t value
, isc_buffer_t
*target
) {
1193 isc_region_t region
;
1196 return (ISC_R_RANGE
);
1197 isc_buffer_availableregion(target
, ®ion
);
1198 if (region
.length
< 2)
1199 return (ISC_R_NOSPACE
);
1200 isc_buffer_putuint16(target
, (isc_uint16_t
)value
);
1201 return (ISC_R_SUCCESS
);
1205 uint8_tobuffer(isc_uint32_t value
, isc_buffer_t
*target
) {
1206 isc_region_t region
;
1209 return (ISC_R_RANGE
);
1210 isc_buffer_availableregion(target
, ®ion
);
1211 if (region
.length
< 1)
1212 return (ISC_R_NOSPACE
);
1213 isc_buffer_putuint8(target
, (isc_uint8_t
)value
);
1214 return (ISC_R_SUCCESS
);
1218 name_tobuffer(dns_name_t
*name
, isc_buffer_t
*target
) {
1220 dns_name_toregion(name
, &r
);
1221 return (isc_buffer_copyregion(target
, &r
));
1225 uint32_fromregion(isc_region_t
*region
) {
1228 REQUIRE(region
->length
>= 4);
1229 value
= region
->base
[0] << 24;
1230 value
|= region
->base
[1] << 16;
1231 value
|= region
->base
[2] << 8;
1232 value
|= region
->base
[3];
1237 uint16_fromregion(isc_region_t
*region
) {
1239 REQUIRE(region
->length
>= 2);
1241 return ((region
->base
[0] << 8) | region
->base
[1]);
1245 uint8_fromregion(isc_region_t
*region
) {
1247 REQUIRE(region
->length
>= 1);
1249 return (region
->base
[0]);
1253 mem_tobuffer(isc_buffer_t
*target
, void *base
, unsigned int length
) {
1256 isc_buffer_availableregion(target
, &tr
);
1257 if (length
> tr
.length
)
1258 return (ISC_R_NOSPACE
);
1259 memcpy(tr
.base
, base
, length
);
1260 isc_buffer_add(target
, length
);
1261 return (ISC_R_SUCCESS
);
1265 hexvalue(char value
) {
1269 c
= (unsigned char)value
;
1275 if ((s
= strchr(hexdigits
, c
)) == NULL
)
1277 return (s
- hexdigits
);
1281 decvalue(char value
) {
1285 * isascii() is valid for full range of int values, no need to
1288 if (!isascii(value
))
1290 if ((s
= strchr(decdigits
, value
)) == NULL
)
1292 return (s
- decdigits
);
1295 static const char atob_digits
[86] =
1296 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" \
1297 "abcdefghijklmnopqrstu";
1299 * Subroutines to convert between 8 bit binary bytes and printable ASCII.
1300 * Computes the number of bytes, and three kinds of simple checksums.
1301 * Incoming bytes are collected into 32-bit words, then printed in base 85:
1302 * exp(85,5) > exp(2,32)
1303 * The ASCII characters used are between '!' and 'u';
1304 * 'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
1306 * Originally by Paul Rutter (philabs!per) and Joe Orost (petsd!joe) for
1307 * the atob/btoa programs, released with the compress program, in mod.sources.
1308 * Modified by Mike Schwartz 8/19/86 for use in BIND.
1309 * Modified to be re-entrant 3/2/99.
1321 #define Ceor state->Ceor
1322 #define Csum state->Csum
1323 #define Crot state->Crot
1324 #define word state->word
1325 #define bcount state->bcount
1327 #define times85(x) ((((((x<<2)+x)<<2)+x)<<2)+x)
1329 static isc_result_t
byte_atob(int c
, isc_buffer_t
*target
,
1330 struct state
*state
);
1331 static isc_result_t
putbyte(int c
, isc_buffer_t
*, struct state
*state
);
1332 static isc_result_t
byte_btoa(int c
, isc_buffer_t
*, struct state
*state
);
1335 * Decode ASCII-encoded byte c into binary representation and
1336 * place into *bufp, advancing bufp.
1339 byte_atob(int c
, isc_buffer_t
*target
, struct state
*state
) {
1343 return(DNS_R_SYNTAX
);
1345 RETERR(putbyte(0, target
, state
));
1346 RETERR(putbyte(0, target
, state
));
1347 RETERR(putbyte(0, target
, state
));
1348 RETERR(putbyte(0, target
, state
));
1350 } else if ((s
= strchr(atob_digits
, c
)) != NULL
) {
1352 word
= s
- atob_digits
;
1354 } else if (bcount
< 4) {
1355 word
= times85(word
);
1356 word
+= s
- atob_digits
;
1359 word
= times85(word
);
1360 word
+= s
- atob_digits
;
1361 RETERR(putbyte((word
>> 24) & 0xff, target
, state
));
1362 RETERR(putbyte((word
>> 16) & 0xff, target
, state
));
1363 RETERR(putbyte((word
>> 8) & 0xff, target
, state
));
1364 RETERR(putbyte(word
& 0xff, target
, state
));
1369 return(DNS_R_SYNTAX
);
1370 return(ISC_R_SUCCESS
);
1374 * Compute checksum info and place c into target.
1377 putbyte(int c
, isc_buffer_t
*target
, struct state
*state
) {
1383 if ((Crot
& 0x80000000)) {
1390 isc_buffer_availableregion(target
, &tr
);
1392 return (ISC_R_NOSPACE
);
1394 isc_buffer_add(target
, 1);
1395 return (ISC_R_SUCCESS
);
1399 * Read the ASCII-encoded data from inbuf, of length inbuflen, and convert
1400 * it into T_UNSPEC (binary data) in outbuf, not to exceed outbuflen bytes;
1401 * outbuflen must be divisible by 4. (Note: this is because outbuf is filled
1402 * in 4 bytes at a time. If the actual data doesn't end on an even 4-byte
1403 * boundary, there will be no problem...it will be padded with 0 bytes, and
1404 * numbytes will indicate the correct number of bytes. The main point is
1405 * that since the buffer is filled in 4 bytes at a time, even if there is
1406 * not a full 4 bytes of data at the end, there has to be room to 0-pad the
1407 * data, so the buffer must be of size divisible by 4). Place the number of
1408 * output bytes in numbytes, and return a failure/success status.
1412 atob_tobuffer(isc_lex_t
*lexer
, isc_buffer_t
*target
) {
1413 long oeor
, osum
, orot
;
1414 struct state statebuf
, *state
= &statebuf
;
1419 Ceor
= Csum
= Crot
= word
= bcount
= 0;
1421 RETERR(isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_string
,
1423 while (token
.value
.as_textregion
.length
!= 0) {
1424 if ((c
= token
.value
.as_textregion
.base
[0]) == 'x') {
1427 RETERR(byte_atob(c
, target
, state
));
1428 isc_textregion_consume(&token
.value
.as_textregion
, 1);
1434 RETERR(isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_number
,
1436 if ((token
.value
.as_ulong
% 4) != 0U)
1437 isc_buffer_subtract(target
, 4 - (token
.value
.as_ulong
% 4));
1442 RETERR(isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_string
,
1444 oeor
= strtol(DNS_AS_STR(token
), &e
, 16);
1446 return (DNS_R_SYNTAX
);
1451 RETERR(isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_string
,
1453 osum
= strtol(DNS_AS_STR(token
), &e
, 16);
1455 return (DNS_R_SYNTAX
);
1460 RETERR(isc_lex_getmastertoken(lexer
, &token
, isc_tokentype_string
,
1462 orot
= strtol(DNS_AS_STR(token
), &e
, 16);
1464 return (DNS_R_SYNTAX
);
1466 if ((oeor
!= Ceor
) || (osum
!= Csum
) || (orot
!= Crot
))
1467 return(DNS_R_BADCKSUM
);
1468 return (ISC_R_SUCCESS
);
1472 * Encode binary byte c into ASCII representation and place into *bufp,
1476 byte_btoa(int c
, isc_buffer_t
*target
, struct state
*state
) {
1479 isc_buffer_availableregion(target
, &tr
);
1483 if ((Crot
& 0x80000000)) {
1496 return (ISC_R_NOSPACE
);
1498 isc_buffer_add(target
, 1);
1500 register int tmp
= 0;
1501 register isc_int32_t tmpword
= word
;
1505 * Because some don't support u_long.
1508 tmpword
-= (isc_int32_t
)(85 * 85 * 85 * 85 * 32);
1512 tmpword
-= (isc_int32_t
)(85 * 85 * 85 * 85 * 32);
1515 return (ISC_R_NOSPACE
);
1516 tr
.base
[0] = atob_digits
[(tmpword
/
1517 (isc_int32_t
)(85 * 85 * 85 * 85))
1519 tmpword
%= (isc_int32_t
)(85 * 85 * 85 * 85);
1520 tr
.base
[1] = atob_digits
[tmpword
/ (85 * 85 * 85)];
1521 tmpword
%= (85 * 85 * 85);
1522 tr
.base
[2] = atob_digits
[tmpword
/ (85 * 85)];
1523 tmpword
%= (85 * 85);
1524 tr
.base
[3] = atob_digits
[tmpword
/ 85];
1526 tr
.base
[4] = atob_digits
[tmpword
];
1527 isc_buffer_add(target
, 5);
1533 return (ISC_R_SUCCESS
);
1538 * Encode the binary data from inbuf, of length inbuflen, into a
1539 * target. Return success/failure status
1542 btoa_totext(unsigned char *inbuf
, int inbuflen
, isc_buffer_t
*target
) {
1544 struct state statebuf
, *state
= &statebuf
;
1545 char buf
[sizeof("x 2000000000 ffffffff ffffffff ffffffff")];
1547 Ceor
= Csum
= Crot
= word
= bcount
= 0;
1548 for (inc
= 0; inc
< inbuflen
; inbuf
++, inc
++)
1549 RETERR(byte_btoa(*inbuf
, target
, state
));
1552 RETERR(byte_btoa(0, target
, state
));
1555 * Put byte count and checksum information at end of buffer,
1558 snprintf(buf
, sizeof(buf
), "x %d %x %x %x", inbuflen
, Ceor
, Csum
, Crot
);
1559 return (str_totext(buf
, target
));
1564 default_fromtext_callback(dns_rdatacallbacks_t
*callbacks
, const char *fmt
,
1572 vfprintf(stderr
, fmt
, ap
);
1574 fprintf(stderr
, "\n");
1578 fromtext_warneof(isc_lex_t
*lexer
, dns_rdatacallbacks_t
*callbacks
) {
1579 if (isc_lex_isfile(lexer
) && callbacks
!= NULL
) {
1580 const char *name
= isc_lex_getsourcename(lexer
);
1583 (*callbacks
->warn
)(callbacks
,
1584 "%s:%lu: file does not end with newline",
1585 name
, isc_lex_getsourceline(lexer
));
1590 warn_badmx(isc_token_t
*token
, isc_lex_t
*lexer
,
1591 dns_rdatacallbacks_t
*callbacks
)
1596 if (lexer
!= NULL
) {
1597 file
= isc_lex_getsourcename(lexer
);
1598 line
= isc_lex_getsourceline(lexer
);
1599 (*callbacks
->warn
)(callbacks
, "%s:%u: warning: '%s': %s",
1600 file
, line
, DNS_AS_STR(*token
),
1601 dns_result_totext(DNS_R_MXISADDRESS
));
1606 warn_badname(dns_name_t
*name
, isc_lex_t
*lexer
,
1607 dns_rdatacallbacks_t
*callbacks
)
1611 char namebuf
[DNS_NAME_FORMATSIZE
];
1613 if (lexer
!= NULL
) {
1614 file
= isc_lex_getsourcename(lexer
);
1615 line
= isc_lex_getsourceline(lexer
);
1616 dns_name_format(name
, namebuf
, sizeof(namebuf
));
1617 (*callbacks
->warn
)(callbacks
, "%s:%u: warning: %s: %s",
1618 file
, line
, namebuf
,
1619 dns_result_totext(DNS_R_BADNAME
));
1624 fromtext_error(void (*callback
)(dns_rdatacallbacks_t
*, const char *, ...),
1625 dns_rdatacallbacks_t
*callbacks
, const char *name
,
1626 unsigned long line
, isc_token_t
*token
, isc_result_t result
)
1631 if (token
!= NULL
) {
1632 switch (token
->type
) {
1633 case isc_tokentype_eol
:
1634 (*callback
)(callbacks
, "%s: %s:%lu: near eol: %s",
1635 "dns_rdata_fromtext", name
, line
,
1636 dns_result_totext(result
));
1638 case isc_tokentype_eof
:
1639 (*callback
)(callbacks
, "%s: %s:%lu: near eof: %s",
1640 "dns_rdata_fromtext", name
, line
,
1641 dns_result_totext(result
));
1643 case isc_tokentype_number
:
1644 (*callback
)(callbacks
, "%s: %s:%lu: near %lu: %s",
1645 "dns_rdata_fromtext", name
, line
,
1646 token
->value
.as_ulong
,
1647 dns_result_totext(result
));
1649 case isc_tokentype_string
:
1650 case isc_tokentype_qstring
:
1651 (*callback
)(callbacks
, "%s: %s:%lu: near '%s': %s",
1652 "dns_rdata_fromtext", name
, line
,
1654 dns_result_totext(result
));
1657 (*callback
)(callbacks
, "%s: %s:%lu: %s",
1658 "dns_rdata_fromtext", name
, line
,
1659 dns_result_totext(result
));
1663 (*callback
)(callbacks
, "dns_rdata_fromtext: %s:%lu: %s",
1664 name
, line
, dns_result_totext(result
));
1669 dns_rdata_covers(dns_rdata_t
*rdata
) {
1670 if (rdata
->type
== 46)
1671 return (covers_rrsig(rdata
));
1672 return (covers_sig(rdata
));
1676 dns_rdatatype_ismeta(dns_rdatatype_t type
) {
1677 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_META
) != 0)
1683 dns_rdatatype_issingleton(dns_rdatatype_t type
) {
1684 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_SINGLETON
)
1691 dns_rdatatype_notquestion(dns_rdatatype_t type
) {
1692 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_NOTQUESTION
)
1699 dns_rdatatype_questiononly(dns_rdatatype_t type
) {
1700 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_QUESTIONONLY
)
1707 dns_rdatatype_atparent(dns_rdatatype_t type
) {
1708 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_ATPARENT
) != 0)
1714 dns_rdataclass_ismeta(dns_rdataclass_t rdclass
) {
1716 if (rdclass
== dns_rdataclass_reserved0
1717 || rdclass
== dns_rdataclass_none
1718 || rdclass
== dns_rdataclass_any
)
1721 return (ISC_FALSE
); /* Assume it is not a meta class. */
1725 dns_rdatatype_isdnssec(dns_rdatatype_t type
) {
1726 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_DNSSEC
) != 0)
1732 dns_rdatatype_iszonecutauth(dns_rdatatype_t type
) {
1733 if ((dns_rdatatype_attributes(type
)
1734 & (DNS_RDATATYPEATTR_DNSSEC
| DNS_RDATATYPEATTR_ZONECUTAUTH
))
1741 dns_rdatatype_isknown(dns_rdatatype_t type
) {
1742 if ((dns_rdatatype_attributes(type
) & DNS_RDATATYPEATTR_UNKNOWN
)