3 * access functions for ldns_rr -
4 * a Net::DNS like library for C
5 * LibDNS Team @ NLnet Labs
7 * (c) NLnet Labs, 2004-2006
8 * See the file LICENSE for the license
10 #include <ldns/config.h>
12 #include <ldns/ldns.h>
19 #define LDNS_SYNTAX_DATALEN 16
20 #define LDNS_TTL_DATALEN 21
21 #define LDNS_RRLIST_INIT 8
27 rr
= LDNS_MALLOC(ldns_rr
);
32 ldns_rr_set_owner(rr
, NULL
);
33 ldns_rr_set_question(rr
, false);
34 ldns_rr_set_rd_count(rr
, 0);
35 rr
->_rdata_fields
= NULL
;
36 ldns_rr_set_class(rr
, LDNS_RR_CLASS_IN
);
37 ldns_rr_set_ttl(rr
, LDNS_DEFAULT_TTL
);
42 ldns_rr_new_frm_type(ldns_rr_type t
)
45 const ldns_rr_descriptor
*desc
;
48 rr
= LDNS_MALLOC(ldns_rr
);
53 desc
= ldns_rr_descript(t
);
55 rr
->_rdata_fields
= LDNS_XMALLOC(ldns_rdf
*, ldns_rr_descriptor_minimum(desc
));
56 if(!rr
->_rdata_fields
) {
60 for (i
= 0; i
< ldns_rr_descriptor_minimum(desc
); i
++) {
61 rr
->_rdata_fields
[i
] = NULL
;
64 ldns_rr_set_owner(rr
, NULL
);
65 ldns_rr_set_question(rr
, false);
66 /* set the count to minimum */
67 ldns_rr_set_rd_count(rr
, ldns_rr_descriptor_minimum(desc
));
68 ldns_rr_set_class(rr
, LDNS_RR_CLASS_IN
);
69 ldns_rr_set_ttl(rr
, LDNS_DEFAULT_TTL
);
70 ldns_rr_set_type(rr
, t
);
75 ldns_rr_free(ldns_rr
*rr
)
79 if (ldns_rr_owner(rr
)) {
80 ldns_rdf_deep_free(ldns_rr_owner(rr
));
82 for (i
= 0; i
< ldns_rr_rd_count(rr
); i
++) {
83 ldns_rdf_deep_free(ldns_rr_rdf(rr
, i
));
85 LDNS_FREE(rr
->_rdata_fields
);
91 * trailing spaces are allowed
92 * leading spaces are not allowed
93 * allow ttl to be optional
94 * class is optional too
95 * if ttl is missing, and default_ttl is 0, use DEF_TTL
96 * allow ttl to be written as 1d3h
97 * So the RR should look like. e.g.
98 * miek.nl. 3600 IN MX 10 elektron.atoom.net
100 * miek.nl. 1h IN MX 10 elektron.atoom.net
102 * miek.nl. IN MX 10 elektron.atoom.net
105 ldns_rr_new_frm_str_internal(ldns_rr
**newrr
, const char *str
,
106 uint32_t default_ttl
, ldns_rdf
*origin
,
107 ldns_rdf
**prev
, bool question
)
110 const ldns_rr_descriptor
*desc
;
111 ldns_rr_type rr_type
;
112 ldns_buffer
*rr_buf
= NULL
;
113 ldns_buffer
*rd_buf
= NULL
;
117 ldns_rr_class clas_val
;
124 const char *delimiters
;
126 ldns_rdf
*owner_dname
;
128 int was_unknown_rr_format
= 0;
129 ldns_status status
= LDNS_STATUS_OK
;
131 /* used for types with unknown number of rdatas */
143 owner
= LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN
+ 1);
144 ttl
= LDNS_XMALLOC(char, LDNS_TTL_DATALEN
);
145 clas
= LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN
);
146 rdata
= LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN
+ 1);
147 rr_buf
= LDNS_MALLOC(ldns_buffer
);
148 rd_buf
= LDNS_MALLOC(ldns_buffer
);
149 rd
= LDNS_XMALLOC(char, LDNS_MAX_RDFLEN
);
150 b64
= LDNS_XMALLOC(char, LDNS_MAX_RDFLEN
);
151 if (!new || !owner
|| !ttl
|| !clas
|| !rdata
|| !rr_buf
|| !rd_buf
|| !rd
|| !b64
) {
152 status
= LDNS_STATUS_MEM_ERR
;
157 ldns_buffer_new_frm_data(rr_buf
, (char*)str
, strlen(str
));
159 /* split the rr in its parts -1 signals trouble */
160 if (ldns_bget_token(rr_buf
, owner
, "\t\n ", LDNS_MAX_DOMAINLEN
) == -1) {
161 status
= LDNS_STATUS_SYNTAX_ERR
;
162 ldns_buffer_free(rr_buf
);
166 if (ldns_bget_token(rr_buf
, ttl
, "\t\n ", LDNS_TTL_DATALEN
) == -1) {
167 status
= LDNS_STATUS_SYNTAX_TTL_ERR
;
168 ldns_buffer_free(rr_buf
);
171 ttl_val
= (uint32_t) ldns_str2period(ttl
, &endptr
);
173 if (strlen(ttl
) > 0 && !isdigit((int) ttl
[0])) {
174 /* ah, it's not there or something */
175 if (default_ttl
== 0) {
176 ttl_val
= LDNS_DEFAULT_TTL
;
178 ttl_val
= default_ttl
;
180 /* we not ASSUMING the TTL is missing and that
181 * the rest of the RR is still there. That is
183 * so ttl value we read is actually the class
185 clas_val
= ldns_get_rr_class_by_name(ttl
);
186 /* class can be left out too, assume IN, current
190 clas_val
= LDNS_RR_CLASS_IN
;
191 type
= LDNS_XMALLOC(char, strlen(ttl
) + 1);
193 status
= LDNS_STATUS_MEM_ERR
;
194 ldns_buffer_free(rr_buf
);
197 strncpy(type
, ttl
, strlen(ttl
) + 1);
200 if (ldns_bget_token(rr_buf
, clas
, "\t\n ", LDNS_SYNTAX_DATALEN
) == -1) {
201 status
= LDNS_STATUS_SYNTAX_CLASS_ERR
;
202 ldns_buffer_free(rr_buf
);
205 clas_val
= ldns_get_rr_class_by_name(clas
);
206 /* class can be left out too, assume IN, current
210 clas_val
= LDNS_RR_CLASS_IN
;
211 type
= LDNS_XMALLOC(char, strlen(clas
) + 1);
213 status
= LDNS_STATUS_MEM_ERR
;
214 ldns_buffer_free(rr_buf
);
217 strncpy(type
, clas
, strlen(clas
) + 1);
220 /* the rest should still be waiting for us */
223 type
= LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN
);
225 status
= LDNS_STATUS_MEM_ERR
;
226 ldns_buffer_free(rr_buf
);
229 if (ldns_bget_token(rr_buf
, type
, "\t\n ", LDNS_SYNTAX_DATALEN
) == -1) {
230 status
= LDNS_STATUS_SYNTAX_TYPE_ERR
;
231 ldns_buffer_free(rr_buf
);
236 if (ldns_bget_token(rr_buf
, rdata
, "\0", LDNS_MAX_PACKETLEN
) == -1) {
237 /* apparently we are done, and it's only a question RR
238 * so do not set status and go to ldnserror here
242 ldns_buffer_new_frm_data(rd_buf
, rdata
, strlen(rdata
));
244 if (strlen(owner
) <= 1 && strncmp(owner
, "@", 1) == 0) {
246 ldns_rr_set_owner(new, ldns_rdf_clone(origin
));
247 } else if (prev
&& *prev
) {
248 ldns_rr_set_owner(new, ldns_rdf_clone(*prev
));
250 /* default to root */
251 ldns_rr_set_owner(new, ldns_dname_new_frm_str("."));
254 /* @ also overrides prev */
256 ldns_rdf_deep_free(*prev
);
257 *prev
= ldns_rdf_clone(ldns_rr_owner(new));
259 status
= LDNS_STATUS_MEM_ERR
;
260 ldns_buffer_free(rr_buf
);
265 if (strlen(owner
) == 0) {
266 /* no ownername was given, try prev, if that fails
267 * origin, else default to root */
269 ldns_rr_set_owner(new, ldns_rdf_clone(*prev
));
271 ldns_rr_set_owner(new, ldns_rdf_clone(origin
));
273 ldns_rr_set_owner(new, ldns_dname_new_frm_str("."));
275 if(!ldns_rr_owner(new)) {
276 status
= LDNS_STATUS_MEM_ERR
;
277 ldns_buffer_free(rr_buf
);
281 owner_dname
= ldns_dname_new_frm_str(owner
);
283 status
= LDNS_STATUS_SYNTAX_ERR
;
284 ldns_buffer_free(rr_buf
);
288 ldns_rr_set_owner(new, owner_dname
);
289 if (!ldns_dname_str_absolute(owner
) && origin
) {
290 if(ldns_dname_cat(ldns_rr_owner(new),
291 origin
) != LDNS_STATUS_OK
) {
292 status
= LDNS_STATUS_SYNTAX_ERR
;
293 ldns_buffer_free(rr_buf
);
298 ldns_rdf_deep_free(*prev
);
299 *prev
= ldns_rdf_clone(ldns_rr_owner(new));
301 status
= LDNS_STATUS_MEM_ERR
;
302 ldns_buffer_free(rr_buf
);
311 ldns_rr_set_question(new, question
);
313 ldns_rr_set_ttl(new, ttl_val
);
317 ldns_rr_set_class(new, clas_val
);
321 rr_type
= ldns_get_rr_type_by_name(type
);
325 desc
= ldns_rr_descript((uint16_t)rr_type
);
326 ldns_rr_set_type(new, rr_type
);
328 /* only the rdata remains */
329 r_max
= ldns_rr_descriptor_maximum(desc
);
330 r_min
= ldns_rr_descriptor_minimum(desc
);
336 /* depending on the rr_type we need to extract
337 * the rdata differently, e.g. NSEC/NSEC3 */
342 for (r_cnt
= 0; !done
&& r_cnt
< r_max
; r_cnt
++) {
344 /* if type = B64, the field may contain spaces */
345 if (ldns_rr_descriptor_field_type(desc
,
346 r_cnt
) == LDNS_RDF_TYPE_B64
||
347 ldns_rr_descriptor_field_type(desc
,
348 r_cnt
) == LDNS_RDF_TYPE_HEX
||
349 ldns_rr_descriptor_field_type(desc
,
350 r_cnt
) == LDNS_RDF_TYPE_LOC
||
351 ldns_rr_descriptor_field_type(desc
,
352 r_cnt
) == LDNS_RDF_TYPE_WKS
||
353 ldns_rr_descriptor_field_type(desc
,
354 r_cnt
) == LDNS_RDF_TYPE_IPSECKEY
||
355 ldns_rr_descriptor_field_type(desc
,
356 r_cnt
) == LDNS_RDF_TYPE_NSEC
) {
359 delimiters
= "\n\t ";
362 if (ldns_rr_descriptor_field_type(desc
,
363 r_cnt
) == LDNS_RDF_TYPE_STR
&&
364 ldns_buffer_remaining(rd_buf
) > 0) {
366 while (*(ldns_buffer_current(rd_buf
)) == ' ') {
367 ldns_buffer_skip(rd_buf
, 1);
370 if (*(ldns_buffer_current(rd_buf
)) == '\"') {
372 ldns_buffer_skip(rd_buf
, 1);
377 /* because number of fields can be variable, we can't
378 rely on _maximum() only */
380 while (ldns_buffer_position(rd_buf
) < ldns_buffer_limit(rd_buf
) &&
381 *(ldns_buffer_current(rd_buf
)) == ' ' && !quoted
383 ldns_buffer_skip(rd_buf
, 1);
386 pre_data_pos
= ldns_buffer_position(rd_buf
);
387 if ((c
= ldns_bget_token(rd_buf
, rd
, delimiters
,
388 LDNS_MAX_RDFLEN
)) != -1) {
389 /* hmmz, rfc3597 specifies that any type can be represented with
390 * \# method, which can contain spaces...
391 * it does specify size though...
393 rd_strlen
= strlen(rd
);
395 /* unknown RR data */
396 if (strncmp(rd
, "\\#", 2) == 0 && !quoted
&& (rd_strlen
== 2 || rd
[2]==' ')) {
397 uint16_t hex_data_size
;
399 uint16_t cur_hex_data_size
;
401 was_unknown_rr_format
= 1;
402 /* go back to before \# and skip it while setting delimiters better */
403 ldns_buffer_set_position(rd_buf
, pre_data_pos
);
404 delimiters
= "\n\t ";
405 (void)ldns_bget_token(rd_buf
, rd
, delimiters
, LDNS_MAX_RDFLEN
);
406 /* read rdata octet length */
407 c
= ldns_bget_token(rd_buf
, rd
, delimiters
, LDNS_MAX_RDFLEN
);
409 /* something goes very wrong here */
412 ldns_buffer_free(rd_buf
);
413 ldns_buffer_free(rr_buf
);
416 return LDNS_STATUS_SYNTAX_RDATA_ERR
;
418 hex_data_size
= (uint16_t) atoi(rd
);
419 /* copy the hex chars into hex str (which is 2 chars per byte) */
420 hex_data_str
= LDNS_XMALLOC(char, 2 * hex_data_size
+ 1);
425 ldns_buffer_free(rd_buf
);
426 ldns_buffer_free(rr_buf
);
429 return LDNS_STATUS_SYNTAX_RDATA_ERR
;
431 cur_hex_data_size
= 0;
432 while(cur_hex_data_size
< 2 * hex_data_size
) {
433 c
= ldns_bget_token(rd_buf
, rd
, delimiters
, LDNS_MAX_RDFLEN
);
435 rd_strlen
= strlen(rd
);
437 if (c
== -1 || (size_t)cur_hex_data_size
+ rd_strlen
> 2 * (size_t)hex_data_size
) {
438 LDNS_FREE(hex_data_str
);
441 ldns_buffer_free(rd_buf
);
442 ldns_buffer_free(rr_buf
);
445 return LDNS_STATUS_SYNTAX_RDATA_ERR
;
447 strncpy(hex_data_str
+ cur_hex_data_size
, rd
, rd_strlen
);
448 cur_hex_data_size
+= rd_strlen
;
450 hex_data_str
[cur_hex_data_size
] = '\0';
452 /* correct the rdf type */
453 /* if *we* know the type, interpret it as wireformat */
456 uint8_t *hex_data
= LDNS_XMALLOC(uint8_t, hex_data_size
+ 2);
459 LDNS_FREE(hex_data_str
);
462 ldns_buffer_free(rd_buf
);
463 ldns_buffer_free(rr_buf
);
466 return LDNS_STATUS_MEM_ERR
;
468 ldns_write_uint16(hex_data
, hex_data_size
);
469 ldns_hexstring_to_data(hex_data
+ 2, hex_data_str
);
470 s
= ldns_wire2rdf(new, hex_data
,
471 hex_data_size
+2, &hex_pos
);
472 if(s
!= LDNS_STATUS_OK
) {
473 LDNS_FREE(hex_data_str
);
476 ldns_buffer_free(rd_buf
);
477 ldns_buffer_free(rr_buf
);
485 r
= ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX
, hex_data_str
);
487 LDNS_FREE(hex_data_str
);
490 ldns_buffer_free(rd_buf
);
491 ldns_buffer_free(rr_buf
);
494 return LDNS_STATUS_MEM_ERR
;
496 ldns_rdf_set_type(r
, LDNS_RDF_TYPE_UNKNOWN
);
497 if(!ldns_rr_push_rdf(new, r
)) {
498 LDNS_FREE(hex_data_str
);
501 ldns_buffer_free(rd_buf
);
502 ldns_buffer_free(rr_buf
);
505 return LDNS_STATUS_MEM_ERR
;
508 LDNS_FREE(hex_data_str
);
511 switch(ldns_rr_descriptor_field_type(desc
, r_cnt
)) {
512 case LDNS_RDF_TYPE_HEX
:
513 case LDNS_RDF_TYPE_B64
:
514 /* can have spaces, and will always be the last
515 * record of the rrdata. Read in the rest */
516 if ((c
= ldns_bget_token(rd_buf
,
526 r
= ldns_rdf_new_frm_str(
527 ldns_rr_descriptor_field_type(desc
, r_cnt
),
530 case LDNS_RDF_TYPE_DNAME
:
531 r
= ldns_rdf_new_frm_str(
532 ldns_rr_descriptor_field_type(desc
, r_cnt
),
535 /* check if the origin should be used or concatenated */
536 if (r
&& ldns_rdf_size(r
) > 1 && ldns_rdf_data(r
)[0] == 1
537 && ldns_rdf_data(r
)[1] == '@') {
538 ldns_rdf_deep_free(r
);
540 r
= ldns_rdf_clone(origin
);
542 /* if this is the SOA, use its own owner name */
543 if (rr_type
== LDNS_RR_TYPE_SOA
) {
544 r
= ldns_rdf_clone(ldns_rr_owner(new));
546 r
= ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME
, ".");
549 } else if (r
&& rd_strlen
>= 1 && !ldns_dname_str_absolute(rd
) && origin
) {
550 if (ldns_dname_cat(r
, origin
) != LDNS_STATUS_OK
) {
553 ldns_buffer_free(rd_buf
);
554 ldns_buffer_free(rr_buf
);
557 return LDNS_STATUS_ERR
;
562 r
= ldns_rdf_new_frm_str(
563 ldns_rr_descriptor_field_type(desc
, r_cnt
),
568 ldns_rr_push_rdf(new, r
);
572 ldns_buffer_free(rd_buf
);
573 ldns_buffer_free(rr_buf
);
576 return LDNS_STATUS_SYNTAX_RDATA_ERR
;
580 if (ldns_buffer_available(rd_buf
, 1)) {
581 ldns_buffer_skip(rd_buf
, 1);
593 ldns_buffer_free(rd_buf
);
594 ldns_buffer_free(rr_buf
);
597 if (!question
&& desc
&& !was_unknown_rr_format
&& ldns_rr_rd_count(new) < r_min
) {
599 return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR
;
605 /* Maybe the caller just wanted to see if it would parse? */
608 return LDNS_STATUS_OK
;
624 ldns_rr_new_frm_str(ldns_rr
**newrr
, const char *str
,
625 uint32_t default_ttl
, ldns_rdf
*origin
,
628 return ldns_rr_new_frm_str_internal(newrr
,
637 ldns_rr_new_question_frm_str(ldns_rr
**newrr
, const char *str
,
638 ldns_rdf
*origin
, ldns_rdf
**prev
)
640 return ldns_rr_new_frm_str_internal(newrr
,
649 ldns_rr_new_frm_fp(ldns_rr
**newrr
, FILE *fp
, uint32_t *ttl
, ldns_rdf
**origin
, ldns_rdf
**prev
)
651 return ldns_rr_new_frm_fp_l(newrr
, fp
, ttl
, origin
, prev
, NULL
);
655 ldns_rr_new_frm_fp_l(ldns_rr
**newrr
, FILE *fp
, uint32_t *default_ttl
, ldns_rdf
**origin
, ldns_rdf
**prev
, int *line_nr
)
658 const char *endptr
; /* unused */
672 line
= LDNS_XMALLOC(char, LDNS_MAX_LINELEN
+ 1);
674 return LDNS_STATUS_MEM_ERR
;
677 /* read an entire line in from the file */
678 if ((size
= ldns_fget_token_l(fp
, line
, LDNS_PARSE_SKIP_SPACE
, LDNS_MAX_LINELEN
, line_nr
)) == -1) {
680 /* if last line was empty, we are now at feof, which is not
681 * always a parse error (happens when for instance last line
684 return LDNS_STATUS_SYNTAX_ERR
;
687 /* we can have the situation, where we've read ok, but still got
688 * no bytes to play with, in this case size is 0
692 return LDNS_STATUS_SYNTAX_EMPTY
;
695 if (strncmp(line
, "$ORIGIN", 7) == 0 && isspace(line
[7])) {
697 ldns_rdf_deep_free(*origin
);
701 while (isspace(line
[offset
])) {
704 tmp
= ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME
, line
+ offset
);
706 /* could not parse what next to $ORIGIN */
708 return LDNS_STATUS_SYNTAX_DNAME_ERR
;
711 s
= LDNS_STATUS_SYNTAX_ORIGIN
;
712 } else if (strncmp(line
, "$TTL", 4) == 0 && isspace(line
[4])) {
714 while (isspace(line
[offset
])) {
718 *default_ttl
= ldns_str2period(line
+ offset
, &endptr
);
720 s
= LDNS_STATUS_SYNTAX_TTL
;
721 } else if (strncmp(line
, "$INCLUDE", 8) == 0) {
722 s
= LDNS_STATUS_SYNTAX_INCLUDE
;
724 if (origin
&& *origin
) {
725 s
= ldns_rr_new_frm_str(&rr
, (const char*) line
, ttl
, *origin
, prev
);
727 s
= ldns_rr_new_frm_str(&rr
, (const char*) line
, ttl
, NULL
, prev
);
731 if (s
== LDNS_STATUS_OK
) {
735 /* Just testing if it would parse? */
743 ldns_rr_set_owner(ldns_rr
*rr
, ldns_rdf
*owner
)
749 ldns_rr_set_question(ldns_rr
*rr
, bool question
)
751 rr
->_rr_question
= question
;
755 ldns_rr_set_ttl(ldns_rr
*rr
, uint32_t ttl
)
761 ldns_rr_set_rd_count(ldns_rr
*rr
, size_t count
)
763 rr
->_rd_count
= count
;
767 ldns_rr_set_type(ldns_rr
*rr
, ldns_rr_type rr_type
)
769 rr
->_rr_type
= rr_type
;
773 ldns_rr_set_class(ldns_rr
*rr
, ldns_rr_class rr_class
)
775 rr
->_rr_class
= rr_class
;
779 ldns_rr_set_rdf(ldns_rr
*rr
, const ldns_rdf
*f
, size_t position
)
784 rd_count
= ldns_rr_rd_count(rr
);
785 if (position
< rd_count
) {
786 /* dicard the old one */
787 pop
= rr
->_rdata_fields
[position
];
788 rr
->_rdata_fields
[position
] = (ldns_rdf
*)f
;
796 ldns_rr_push_rdf(ldns_rr
*rr
, const ldns_rdf
*f
)
799 ldns_rdf
**rdata_fields
;
801 rd_count
= ldns_rr_rd_count(rr
);
804 rdata_fields
= LDNS_XREALLOC(
805 rr
->_rdata_fields
, ldns_rdf
*, rd_count
+ 1);
810 /* add the new member */
811 rr
->_rdata_fields
= rdata_fields
;
812 rr
->_rdata_fields
[rd_count
] = (ldns_rdf
*)f
;
814 ldns_rr_set_rd_count(rr
, rd_count
+ 1);
819 ldns_rr_pop_rdf(ldns_rr
*rr
)
825 rd_count
= ldns_rr_rd_count(rr
);
831 pop
= rr
->_rdata_fields
[rd_count
- 1];
833 /* try to shrink the array */
835 newrd
= LDNS_XREALLOC(
836 rr
->_rdata_fields
, ldns_rdf
*, rd_count
- 1);
838 rr
->_rdata_fields
= newrd
;
840 LDNS_FREE(rr
->_rdata_fields
);
843 ldns_rr_set_rd_count(rr
, rd_count
- 1);
848 ldns_rr_rdf(const ldns_rr
*rr
, size_t nr
)
850 if (rr
&& nr
< ldns_rr_rd_count(rr
)) {
851 return rr
->_rdata_fields
[nr
];
858 ldns_rr_owner(const ldns_rr
*rr
)
864 ldns_rr_is_question(const ldns_rr
*rr
)
866 return rr
->_rr_question
;
870 ldns_rr_ttl(const ldns_rr
*rr
)
876 ldns_rr_rd_count(const ldns_rr
*rr
)
878 return rr
->_rd_count
;
882 ldns_rr_get_type(const ldns_rr
*rr
)
888 ldns_rr_get_class(const ldns_rr
*rr
)
890 return rr
->_rr_class
;
896 ldns_rr_list_rr_count(const ldns_rr_list
*rr_list
)
899 return rr_list
->_rr_count
;
906 ldns_rr_list_set_rr(ldns_rr_list
*rr_list
, const ldns_rr
*r
, size_t count
)
910 if (count
> ldns_rr_list_rr_count(rr_list
)) {
914 old
= ldns_rr_list_rr(rr_list
, count
);
916 /* overwrite old's pointer */
917 rr_list
->_rrs
[count
] = (ldns_rr
*)r
;
922 ldns_rr_list_set_rr_count(ldns_rr_list
*rr_list
, size_t count
)
924 assert(count
<= rr_list
->_rr_capacity
);
925 rr_list
->_rr_count
= count
;
929 ldns_rr_list_rr(const ldns_rr_list
*rr_list
, size_t nr
)
931 if (nr
< ldns_rr_list_rr_count(rr_list
)) {
932 return rr_list
->_rrs
[nr
];
941 ldns_rr_list
*rr_list
= LDNS_MALLOC(ldns_rr_list
);
942 if(!rr_list
) return NULL
;
943 rr_list
->_rr_count
= 0;
944 rr_list
->_rr_capacity
= 0;
945 rr_list
->_rrs
= NULL
;
950 ldns_rr_list_free(ldns_rr_list
*rr_list
)
953 LDNS_FREE(rr_list
->_rrs
);
959 ldns_rr_list_deep_free(ldns_rr_list
*rr_list
)
964 for (i
=0; i
< ldns_rr_list_rr_count(rr_list
); i
++) {
965 ldns_rr_free(ldns_rr_list_rr(rr_list
, i
));
967 LDNS_FREE(rr_list
->_rrs
);
973 /* add right to left. So we modify *left! */
975 ldns_rr_list_cat(ldns_rr_list
*left
, ldns_rr_list
*right
)
985 r_rr_count
= ldns_rr_list_rr_count(right
);
990 /* push right to left */
991 for(i
= 0; i
< r_rr_count
; i
++) {
992 ldns_rr_list_push_rr(left
, ldns_rr_list_rr(right
, i
));
998 ldns_rr_list_cat_clone(ldns_rr_list
*left
, ldns_rr_list
*right
)
1006 l_rr_count
= ldns_rr_list_rr_count(left
);
1008 return ldns_rr_list_clone(right
);
1012 r_rr_count
= ldns_rr_list_rr_count(right
);
1017 cat
= ldns_rr_list_new();
1024 for(i
= 0; i
< l_rr_count
; i
++) {
1025 ldns_rr_list_push_rr(cat
,
1026 ldns_rr_clone(ldns_rr_list_rr(left
, i
)));
1029 for(i
= 0; i
< r_rr_count
; i
++) {
1030 ldns_rr_list_push_rr(cat
,
1031 ldns_rr_clone(ldns_rr_list_rr(right
, i
)));
1037 ldns_rr_list_subtype_by_rdf(ldns_rr_list
*l
, ldns_rdf
*r
, size_t pos
)
1040 ldns_rr_list
*subtyped
;
1043 subtyped
= ldns_rr_list_new();
1045 for(i
= 0; i
< ldns_rr_list_rr_count(l
); i
++) {
1046 list_rdf
= ldns_rr_rdf(
1047 ldns_rr_list_rr(l
, i
),
1050 /* pos is too large or any other error */
1051 ldns_rr_list_deep_free(subtyped
);
1055 if (ldns_rdf_compare(list_rdf
, r
) == 0) {
1057 ldns_rr_list_push_rr(subtyped
,
1058 ldns_rr_clone(ldns_rr_list_rr(l
, i
)));
1062 if (ldns_rr_list_rr_count(subtyped
) > 0) {
1065 ldns_rr_list_free(subtyped
);
1071 ldns_rr_list_push_rr(ldns_rr_list
*rr_list
, const ldns_rr
*rr
)
1076 rr_count
= ldns_rr_list_rr_count(rr_list
);
1077 cap
= rr_list
->_rr_capacity
;
1079 /* grow the array */
1080 if(rr_count
+1 > cap
) {
1084 cap
= LDNS_RRLIST_INIT
; /* initial list size */
1086 rrs
= LDNS_XREALLOC(rr_list
->_rrs
, ldns_rr
*, cap
);
1090 rr_list
->_rrs
= rrs
;
1091 rr_list
->_rr_capacity
= cap
;
1094 /* add the new member */
1095 rr_list
->_rrs
[rr_count
] = (ldns_rr
*)rr
;
1097 ldns_rr_list_set_rr_count(rr_list
, rr_count
+ 1);
1102 ldns_rr_list_push_rr_list(ldns_rr_list
*rr_list
, const ldns_rr_list
*push_list
)
1106 for(i
= 0; i
< ldns_rr_list_rr_count(push_list
); i
++) {
1107 if (!ldns_rr_list_push_rr(rr_list
,
1108 ldns_rr_list_rr(push_list
, i
))) {
1116 ldns_rr_list_pop_rr(ldns_rr_list
*rr_list
)
1122 rr_count
= ldns_rr_list_rr_count(rr_list
);
1124 if (rr_count
== 0) {
1128 cap
= rr_list
->_rr_capacity
;
1129 pop
= ldns_rr_list_rr(rr_list
, rr_count
- 1);
1131 /* shrink the array */
1132 if(cap
> LDNS_RRLIST_INIT
&& rr_count
-1 <= cap
/2) {
1135 a
= LDNS_XREALLOC(rr_list
->_rrs
, ldns_rr
*, cap
);
1138 rr_list
->_rr_capacity
= cap
;
1142 ldns_rr_list_set_rr_count(rr_list
, rr_count
- 1);
1148 ldns_rr_list_pop_rr_list(ldns_rr_list
*rr_list
, size_t howmany
)
1150 /* pop a number of rr's and put them in a rr_list */
1151 ldns_rr_list
*popped
;
1155 popped
= ldns_rr_list_new();
1163 (p
= ldns_rr_list_pop_rr(rr_list
)) != NULL
) {
1164 ldns_rr_list_push_rr(popped
, p
);
1168 if (i
== howmany
) { /* so i <= 0 */
1169 ldns_rr_list_free(popped
);
1178 ldns_rr_list_contains_rr(const ldns_rr_list
*rr_list
, ldns_rr
*rr
)
1182 if (!rr_list
|| !rr
|| ldns_rr_list_rr_count(rr_list
) == 0) {
1186 for (i
= 0; i
< ldns_rr_list_rr_count(rr_list
); i
++) {
1187 if (rr
== ldns_rr_list_rr(rr_list
, i
)) {
1189 } else if (ldns_rr_compare(rr
, ldns_rr_list_rr(rr_list
, i
)) == 0) {
1197 ldns_is_rrset(ldns_rr_list
*rr_list
)
1205 if (!rr_list
|| ldns_rr_list_rr_count(rr_list
) == 0) {
1209 tmp
= ldns_rr_list_rr(rr_list
, 0);
1211 t
= ldns_rr_get_type(tmp
);
1212 c
= ldns_rr_get_class(tmp
);
1213 o
= ldns_rr_owner(tmp
);
1215 /* compare these with the rest of the rr_list, start with 1 */
1216 for (i
= 1; i
< ldns_rr_list_rr_count(rr_list
); i
++) {
1217 tmp
= ldns_rr_list_rr(rr_list
, i
);
1218 if (t
!= ldns_rr_get_type(tmp
)) {
1221 if (c
!= ldns_rr_get_class(tmp
)) {
1224 if (ldns_rdf_compare(o
, ldns_rr_owner(tmp
)) != 0) {
1232 ldns_rr_set_push_rr(ldns_rr_list
*rr_list
, ldns_rr
*rr
)
1240 rr_count
= ldns_rr_list_rr_count(rr_list
);
1242 if (rr_count
== 0) {
1243 /* nothing there, so checking it is
1245 return ldns_rr_list_push_rr(rr_list
, rr
);
1247 /* check with the final rr in the rr_list */
1248 last
= ldns_rr_list_rr(rr_list
, rr_count
- 1);
1250 if (ldns_rr_get_class(last
) != ldns_rr_get_class(rr
)) {
1253 if (ldns_rr_get_type(last
) != ldns_rr_get_type(rr
)) {
1256 /* only check if not equal to RRSIG */
1257 if (ldns_rr_get_type(rr
) != LDNS_RR_TYPE_RRSIG
) {
1258 if (ldns_rr_ttl(last
) != ldns_rr_ttl(rr
)) {
1262 if (ldns_rdf_compare(ldns_rr_owner(last
),
1263 ldns_rr_owner(rr
)) != 0) {
1266 /* ok, still alive - check if the rr already
1267 * exists - if so, dont' add it */
1268 for(i
= 0; i
< rr_count
; i
++) {
1270 ldns_rr_list_rr(rr_list
, i
), rr
) == 0) {
1274 /* it's safe, push it */
1275 return ldns_rr_list_push_rr(rr_list
, rr
);
1280 ldns_rr_set_pop_rr(ldns_rr_list
*rr_list
)
1282 return ldns_rr_list_pop_rr(rr_list
);
1286 ldns_rr_list_pop_rrset(ldns_rr_list
*rr_list
)
1288 ldns_rr_list
*rrset
;
1289 ldns_rr
*last_rr
= NULL
;
1296 rrset
= ldns_rr_list_new();
1298 last_rr
= ldns_rr_list_pop_rr(rr_list
);
1300 ldns_rr_list_free(rrset
);
1303 ldns_rr_list_push_rr(rrset
, last_rr
);
1307 if (ldns_rr_list_rr_count(rr_list
) > 0) {
1308 next_rr
= ldns_rr_list_rr(rr_list
, ldns_rr_list_rr_count(rr_list
) - 1);
1315 ldns_rdf_compare(ldns_rr_owner(next_rr
),
1316 ldns_rr_owner(last_rr
)) == 0
1318 ldns_rr_get_type(next_rr
) == ldns_rr_get_type(last_rr
)
1320 ldns_rr_get_class(next_rr
) == ldns_rr_get_class(last_rr
)
1322 ldns_rr_list_push_rr(rrset
, ldns_rr_list_pop_rr(rr_list
));
1323 if (ldns_rr_list_rr_count(rr_list
) > 0) {
1325 next_rr
= ldns_rr_list_rr(rr_list
, ldns_rr_list_rr_count(rr_list
) - 1);
1338 ldns_rr_clone(const ldns_rr
*rr
)
1347 new_rr
= ldns_rr_new();
1351 if (ldns_rr_owner(rr
)) {
1352 ldns_rr_set_owner(new_rr
, ldns_rdf_clone(ldns_rr_owner(rr
)));
1354 ldns_rr_set_ttl(new_rr
, ldns_rr_ttl(rr
));
1355 ldns_rr_set_type(new_rr
, ldns_rr_get_type(rr
));
1356 ldns_rr_set_class(new_rr
, ldns_rr_get_class(rr
));
1357 ldns_rr_set_question(new_rr
, ldns_rr_is_question(rr
));
1359 for (i
= 0; i
< ldns_rr_rd_count(rr
); i
++) {
1360 if (ldns_rr_rdf(rr
,i
)) {
1361 ldns_rr_push_rdf(new_rr
, ldns_rdf_clone(ldns_rr_rdf(rr
, i
)));
1369 ldns_rr_list_clone(const ldns_rr_list
*rrlist
)
1372 ldns_rr_list
*new_list
;
1379 new_list
= ldns_rr_list_new();
1383 for (i
= 0; i
< ldns_rr_list_rr_count(rrlist
); i
++) {
1385 ldns_rr_list_rr(rrlist
, i
)
1388 /* huh, failure in cloning */
1389 ldns_rr_list_deep_free(new_list
);
1392 ldns_rr_list_push_rr(new_list
, r
);
1399 qsort_rr_compare(const void *a
, const void *b
)
1401 const ldns_rr
*rr1
= * (const ldns_rr
**) a
;
1402 const ldns_rr
*rr2
= * (const ldns_rr
**) b
;
1404 if (rr1
== NULL
&& rr2
== NULL
) {
1413 return ldns_rr_compare(rr1
, rr2
);
1417 qsort_schwartz_rr_compare(const void *a
, const void *b
)
1421 ldns_buffer
*rr1_buf
, *rr2_buf
;
1422 struct ldns_schwartzian_compare_struct
*sa
= *(struct ldns_schwartzian_compare_struct
**) a
;
1423 struct ldns_schwartzian_compare_struct
*sb
= *(struct ldns_schwartzian_compare_struct
**) b
;
1424 /* if we are doing 2wire, we need to do lowercasing on the dname (and maybe on the rdata)
1425 * this must be done for comparison only, so we need to have a temp var for both buffers,
1426 * which is only used when the transformed object value isn't there yet
1428 ldns_rr
*canonical_a
, *canonical_b
;
1430 rr1
= (ldns_rr
*) sa
->original_object
;
1431 rr2
= (ldns_rr
*) sb
->original_object
;
1433 result
= ldns_rr_compare_no_rdata(rr1
, rr2
);
1436 if (!sa
->transformed_object
) {
1437 canonical_a
= ldns_rr_clone(sa
->original_object
);
1438 ldns_rr2canonical(canonical_a
);
1439 sa
->transformed_object
= ldns_buffer_new(ldns_rr_uncompressed_size(canonical_a
));
1440 if (ldns_rr2buffer_wire(sa
->transformed_object
, canonical_a
, LDNS_SECTION_ANY
) != LDNS_STATUS_OK
) {
1441 ldns_buffer_free((ldns_buffer
*)sa
->transformed_object
);
1442 sa
->transformed_object
= NULL
;
1443 ldns_rr_free(canonical_a
);
1446 ldns_rr_free(canonical_a
);
1448 if (!sb
->transformed_object
) {
1449 canonical_b
= ldns_rr_clone(sb
->original_object
);
1450 ldns_rr2canonical(canonical_b
);
1451 sb
->transformed_object
= ldns_buffer_new(ldns_rr_uncompressed_size(canonical_b
));
1452 if (ldns_rr2buffer_wire(sb
->transformed_object
, canonical_b
, LDNS_SECTION_ANY
) != LDNS_STATUS_OK
) {
1453 ldns_buffer_free((ldns_buffer
*)sa
->transformed_object
);
1454 ldns_buffer_free((ldns_buffer
*)sb
->transformed_object
);
1455 sa
->transformed_object
= NULL
;
1456 sb
->transformed_object
= NULL
;
1457 ldns_rr_free(canonical_b
);
1460 ldns_rr_free(canonical_b
);
1462 rr1_buf
= (ldns_buffer
*) sa
->transformed_object
;
1463 rr2_buf
= (ldns_buffer
*) sb
->transformed_object
;
1465 result
= ldns_rr_compare_wire(rr1_buf
, rr2_buf
);
1472 ldns_rr_list_sort(ldns_rr_list
*unsorted
)
1474 struct ldns_schwartzian_compare_struct
**sortables
;
1479 item_count
= ldns_rr_list_rr_count(unsorted
);
1481 sortables
= LDNS_XMALLOC(struct ldns_schwartzian_compare_struct
*,
1483 if(!sortables
) return; /* no way to return error */
1484 for (i
= 0; i
< item_count
; i
++) {
1485 sortables
[i
] = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct
, 1);
1487 /* free the allocated parts */
1490 LDNS_FREE(sortables
[i
]);
1492 /* no way to return error */
1493 LDNS_FREE(sortables
);
1496 sortables
[i
]->original_object
= ldns_rr_list_rr(unsorted
, i
);
1497 sortables
[i
]->transformed_object
= NULL
;
1501 sizeof(struct ldns_schwartzian_compare_struct
*),
1502 qsort_schwartz_rr_compare
);
1503 for (i
= 0; i
< item_count
; i
++) {
1504 unsorted
->_rrs
[i
] = sortables
[i
]->original_object
;
1505 if (sortables
[i
]->transformed_object
) {
1506 ldns_buffer_free(sortables
[i
]->transformed_object
);
1508 LDNS_FREE(sortables
[i
]);
1510 LDNS_FREE(sortables
);
1515 ldns_rr_compare_no_rdata(const ldns_rr
*rr1
, const ldns_rr
*rr2
)
1521 assert(rr1
!= NULL
);
1522 assert(rr2
!= NULL
);
1524 rr1_len
= ldns_rr_uncompressed_size(rr1
);
1525 rr2_len
= ldns_rr_uncompressed_size(rr2
);
1527 if (ldns_dname_compare(ldns_rr_owner(rr1
), ldns_rr_owner(rr2
)) < 0) {
1529 } else if (ldns_dname_compare(ldns_rr_owner(rr1
), ldns_rr_owner(rr2
)) > 0) {
1533 /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */
1534 if (ldns_rr_get_class(rr1
) != ldns_rr_get_class(rr2
)) {
1535 return ldns_rr_get_class(rr1
) - ldns_rr_get_class(rr2
);
1538 /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */
1539 if (ldns_rr_get_type(rr1
) != ldns_rr_get_type(rr2
)) {
1540 return ldns_rr_get_type(rr1
) - ldns_rr_get_type(rr2
);
1543 /* offset is the owername length + ttl + type + class + rdlen == start of wire format rdata */
1544 offset
= ldns_rdf_size(ldns_rr_owner(rr1
)) + 4 + 2 + 2 + 2;
1545 /* if either record doesn't have any RDATA... */
1546 if (offset
> rr1_len
|| offset
> rr2_len
) {
1547 if (rr1_len
== rr2_len
) {
1550 return ((int) rr2_len
- (int) rr1_len
);
1556 int ldns_rr_compare_wire(ldns_buffer
*rr1_buf
, ldns_buffer
*rr2_buf
)
1558 size_t rr1_len
, rr2_len
, min_len
, i
, offset
;
1560 rr1_len
= ldns_buffer_capacity(rr1_buf
);
1561 rr2_len
= ldns_buffer_capacity(rr2_buf
);
1563 /* jump past dname (checked in earlier part)
1564 * and especially past TTL */
1566 while (offset
< rr1_len
&& *ldns_buffer_at(rr1_buf
, offset
) != 0) {
1567 offset
+= *ldns_buffer_at(rr1_buf
, offset
) + 1;
1569 /* jump to rdata section (PAST the rdata length field, otherwise
1570 rrs with different lengths might be sorted erroneously */
1572 min_len
= (rr1_len
< rr2_len
) ? rr1_len
: rr2_len
;
1573 /* Compare RRs RDATA byte for byte. */
1574 for(i
= offset
; i
< min_len
; i
++) {
1575 if (*ldns_buffer_at(rr1_buf
,i
) < *ldns_buffer_at(rr2_buf
,i
)) {
1577 } else if (*ldns_buffer_at(rr1_buf
,i
) > *ldns_buffer_at(rr2_buf
,i
)) {
1582 /* If both RDATAs are the same up to min_len, then the shorter one sorts first. */
1583 if (rr1_len
< rr2_len
) {
1585 } else if (rr1_len
> rr2_len
) {
1588 /* The RDATAs are equal. */
1594 ldns_rr_compare(const ldns_rr
*rr1
, const ldns_rr
*rr2
)
1597 size_t rr1_len
, rr2_len
;
1599 ldns_buffer
*rr1_buf
;
1600 ldns_buffer
*rr2_buf
;
1602 result
= ldns_rr_compare_no_rdata(rr1
, rr2
);
1604 rr1_len
= ldns_rr_uncompressed_size(rr1
);
1605 rr2_len
= ldns_rr_uncompressed_size(rr2
);
1607 rr1_buf
= ldns_buffer_new(rr1_len
);
1608 rr2_buf
= ldns_buffer_new(rr2_len
);
1610 if (ldns_rr2buffer_wire_canonical(rr1_buf
,
1613 != LDNS_STATUS_OK
) {
1614 ldns_buffer_free(rr1_buf
);
1615 ldns_buffer_free(rr2_buf
);
1618 if (ldns_rr2buffer_wire_canonical(rr2_buf
,
1621 != LDNS_STATUS_OK
) {
1622 ldns_buffer_free(rr1_buf
);
1623 ldns_buffer_free(rr2_buf
);
1627 result
= ldns_rr_compare_wire(rr1_buf
, rr2_buf
);
1629 ldns_buffer_free(rr1_buf
);
1630 ldns_buffer_free(rr2_buf
);
1636 /* convert dnskey to a ds with the given algorithm,
1637 * then compare the result with the given ds */
1639 ldns_rr_compare_ds_dnskey(ldns_rr
*ds
,
1643 bool result
= false;
1646 if (!dnskey
|| !ds
||
1647 ldns_rr_get_type(ds
) != LDNS_RR_TYPE_DS
||
1648 ldns_rr_get_type(dnskey
) != LDNS_RR_TYPE_DNSKEY
) {
1652 if (ldns_rr_rdf(ds
, 2) == NULL
) {
1655 algo
= ldns_rdf2native_int8(ldns_rr_rdf(ds
, 2));
1657 ds_gen
= ldns_key_rr2ds(dnskey
, algo
);
1659 result
= ldns_rr_compare(ds
, ds_gen
) == 0;
1660 ldns_rr_free(ds_gen
);
1666 ldns_rr_compare_ds(const ldns_rr
*orr1
, const ldns_rr
*orr2
)
1669 ldns_rr
*rr1
= ldns_rr_clone(orr1
);
1670 ldns_rr
*rr2
= ldns_rr_clone(orr2
);
1672 /* set ttls to zero */
1673 ldns_rr_set_ttl(rr1
, 0);
1674 ldns_rr_set_ttl(rr2
, 0);
1676 if (ldns_rr_get_type(rr1
) == LDNS_RR_TYPE_DS
&&
1677 ldns_rr_get_type(rr2
) == LDNS_RR_TYPE_DNSKEY
) {
1678 result
= ldns_rr_compare_ds_dnskey(rr1
, rr2
);
1679 } else if (ldns_rr_get_type(rr1
) == LDNS_RR_TYPE_DNSKEY
&&
1680 ldns_rr_get_type(rr2
) == LDNS_RR_TYPE_DS
) {
1681 result
= ldns_rr_compare_ds_dnskey(rr2
, rr1
);
1683 result
= (ldns_rr_compare(rr1
, rr2
) == 0);
1693 ldns_rr_list_compare(const ldns_rr_list
*rrl1
, const ldns_rr_list
*rrl2
)
1698 assert(rrl1
!= NULL
);
1699 assert(rrl2
!= NULL
);
1701 for (i
= 0; i
< ldns_rr_list_rr_count(rrl1
) && i
< ldns_rr_list_rr_count(rrl2
); i
++) {
1702 rr_cmp
= ldns_rr_compare(ldns_rr_list_rr(rrl1
, i
), ldns_rr_list_rr(rrl2
, i
));
1708 if (i
== ldns_rr_list_rr_count(rrl1
) &&
1709 i
!= ldns_rr_list_rr_count(rrl2
)) {
1711 } else if (i
== ldns_rr_list_rr_count(rrl2
) &&
1712 i
!= ldns_rr_list_rr_count(rrl1
)) {
1720 ldns_rr_uncompressed_size(const ldns_rr
*r
)
1726 /* add all the rdf sizes */
1727 for(i
= 0; i
< ldns_rr_rd_count(r
); i
++) {
1728 rrsize
+= ldns_rdf_size(ldns_rr_rdf(r
, i
));
1731 rrsize
+= ldns_rdf_size(ldns_rr_owner(r
));
1732 rrsize
+= LDNS_RR_OVERHEAD
;
1737 ldns_rr2canonical(ldns_rr
*rr
)
1745 ldns_dname2canonical(ldns_rr_owner(rr
));
1748 * lowercase the rdata dnames if the rr type is one
1749 * of the list in chapter 7 of RFC3597
1750 * Also added RRSIG, because a "Signer's Name" should be canonicalized
1751 * too. See dnssec-bis-updates-16. We can add it to this list because
1752 * the "Signer's Name" is the only dname type rdata field in a RRSIG.
1754 switch(ldns_rr_get_type(rr
)) {
1755 case LDNS_RR_TYPE_NS
:
1756 case LDNS_RR_TYPE_MD
:
1757 case LDNS_RR_TYPE_MF
:
1758 case LDNS_RR_TYPE_CNAME
:
1759 case LDNS_RR_TYPE_SOA
:
1760 case LDNS_RR_TYPE_MB
:
1761 case LDNS_RR_TYPE_MG
:
1762 case LDNS_RR_TYPE_MR
:
1763 case LDNS_RR_TYPE_PTR
:
1764 case LDNS_RR_TYPE_MINFO
:
1765 case LDNS_RR_TYPE_MX
:
1766 case LDNS_RR_TYPE_RP
:
1767 case LDNS_RR_TYPE_AFSDB
:
1768 case LDNS_RR_TYPE_RT
:
1769 case LDNS_RR_TYPE_SIG
:
1770 case LDNS_RR_TYPE_PX
:
1771 case LDNS_RR_TYPE_NXT
:
1772 case LDNS_RR_TYPE_NAPTR
:
1773 case LDNS_RR_TYPE_KX
:
1774 case LDNS_RR_TYPE_SRV
:
1775 case LDNS_RR_TYPE_DNAME
:
1776 case LDNS_RR_TYPE_A6
:
1777 case LDNS_RR_TYPE_RRSIG
:
1778 for (i
= 0; i
< ldns_rr_rd_count(rr
); i
++) {
1779 ldns_dname2canonical(ldns_rr_rdf(rr
, i
));
1789 ldns_rr_list2canonical(ldns_rr_list
*rr_list
)
1792 for (i
= 0; i
< ldns_rr_list_rr_count(rr_list
); i
++) {
1793 ldns_rr2canonical(ldns_rr_list_rr(rr_list
, i
));
1798 ldns_rr_label_count(ldns_rr
*rr
)
1803 return ldns_dname_label_count(
1808 static const ldns_rdf_type type_0_wireformat
[] = { LDNS_RDF_TYPE_UNKNOWN
};
1809 static const ldns_rdf_type type_a_wireformat
[] = { LDNS_RDF_TYPE_A
};
1810 static const ldns_rdf_type type_ns_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1811 static const ldns_rdf_type type_md_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1812 static const ldns_rdf_type type_mf_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1813 static const ldns_rdf_type type_cname_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1814 static const ldns_rdf_type type_soa_wireformat
[] = {
1815 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_INT32
,
1816 LDNS_RDF_TYPE_PERIOD
, LDNS_RDF_TYPE_PERIOD
, LDNS_RDF_TYPE_PERIOD
,
1817 LDNS_RDF_TYPE_PERIOD
1819 static const ldns_rdf_type type_mb_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1820 static const ldns_rdf_type type_mg_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1821 static const ldns_rdf_type type_mr_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1822 static const ldns_rdf_type type_wks_wireformat
[] = {
1823 LDNS_RDF_TYPE_A
, LDNS_RDF_TYPE_WKS
1825 static const ldns_rdf_type type_ptr_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1826 static const ldns_rdf_type type_hinfo_wireformat
[] = {
1827 LDNS_RDF_TYPE_STR
, LDNS_RDF_TYPE_STR
1829 static const ldns_rdf_type type_minfo_wireformat
[] = {
1830 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_DNAME
1832 static const ldns_rdf_type type_mx_wireformat
[] = {
1833 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
1835 static const ldns_rdf_type type_rp_wireformat
[] = {
1836 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_DNAME
1838 static const ldns_rdf_type type_afsdb_wireformat
[] = {
1839 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
1841 static const ldns_rdf_type type_x25_wireformat
[] = { LDNS_RDF_TYPE_STR
};
1842 static const ldns_rdf_type type_isdn_wireformat
[] = {
1843 LDNS_RDF_TYPE_STR
, LDNS_RDF_TYPE_STR
1845 static const ldns_rdf_type type_rt_wireformat
[] = {
1846 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
1848 static const ldns_rdf_type type_nsap_wireformat
[] = {
1851 static const ldns_rdf_type type_nsap_ptr_wireformat
[] = {
1854 static const ldns_rdf_type type_sig_wireformat
[] = {
1855 LDNS_RDF_TYPE_TYPE
, LDNS_RDF_TYPE_ALG
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT32
,
1856 LDNS_RDF_TYPE_TIME
, LDNS_RDF_TYPE_TIME
, LDNS_RDF_TYPE_INT16
,
1857 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_B64
1859 static const ldns_rdf_type type_key_wireformat
[] = {
1860 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_B64
1862 static const ldns_rdf_type type_px_wireformat
[] = {
1863 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_DNAME
1865 static const ldns_rdf_type type_gpos_wireformat
[] = {
1870 static const ldns_rdf_type type_aaaa_wireformat
[] = { LDNS_RDF_TYPE_AAAA
};
1871 static const ldns_rdf_type type_loc_wireformat
[] = { LDNS_RDF_TYPE_LOC
};
1872 static const ldns_rdf_type type_nxt_wireformat
[] = {
1873 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_UNKNOWN
1875 static const ldns_rdf_type type_eid_wireformat
[] = {
1878 static const ldns_rdf_type type_nimloc_wireformat
[] = {
1881 static const ldns_rdf_type type_srv_wireformat
[] = {
1882 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
1884 static const ldns_rdf_type type_atma_wireformat
[] = {
1887 static const ldns_rdf_type type_naptr_wireformat
[] = {
1888 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_STR
, LDNS_RDF_TYPE_STR
, LDNS_RDF_TYPE_STR
, LDNS_RDF_TYPE_DNAME
1890 static const ldns_rdf_type type_kx_wireformat
[] = {
1891 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
1893 static const ldns_rdf_type type_cert_wireformat
[] = {
1894 LDNS_RDF_TYPE_CERT_ALG
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_ALG
, LDNS_RDF_TYPE_B64
1896 static const ldns_rdf_type type_a6_wireformat
[] = { LDNS_RDF_TYPE_UNKNOWN
};
1897 static const ldns_rdf_type type_dname_wireformat
[] = { LDNS_RDF_TYPE_DNAME
};
1898 static const ldns_rdf_type type_sink_wireformat
[] = { LDNS_RDF_TYPE_INT8
,
1899 LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_B64
1901 static const ldns_rdf_type type_apl_wireformat
[] = {
1904 static const ldns_rdf_type type_ds_wireformat
[] = {
1905 LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_ALG
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_HEX
1907 static const ldns_rdf_type type_sshfp_wireformat
[] = {
1908 LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_HEX
1910 static const ldns_rdf_type type_ipseckey_wireformat
[] = {
1911 LDNS_RDF_TYPE_IPSECKEY
1913 static const ldns_rdf_type type_rrsig_wireformat
[] = {
1914 LDNS_RDF_TYPE_TYPE
, LDNS_RDF_TYPE_ALG
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT32
,
1915 LDNS_RDF_TYPE_TIME
, LDNS_RDF_TYPE_TIME
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_B64
1917 static const ldns_rdf_type type_nsec_wireformat
[] = {
1918 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_NSEC
1920 static const ldns_rdf_type type_dhcid_wireformat
[] = {
1923 static const ldns_rdf_type type_talink_wireformat
[] = {
1924 LDNS_RDF_TYPE_DNAME
, LDNS_RDF_TYPE_DNAME
1926 /* nsec3 is some vars, followed by same type of data of nsec */
1927 static const ldns_rdf_type type_nsec3_wireformat
[] = {
1928 /* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/
1929 LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT8
, LDNS_RDF_TYPE_INT16
, LDNS_RDF_TYPE_NSEC3_SALT
, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER
, LDNS_RDF_TYPE_NSEC
1932 static const ldns_rdf_type type_nsec3param_wireformat
[] = {
1933 /* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/
1936 LDNS_RDF_TYPE_INT16
,
1937 LDNS_RDF_TYPE_NSEC3_SALT
1940 static const ldns_rdf_type type_dnskey_wireformat
[] = {
1941 LDNS_RDF_TYPE_INT16
,
1946 static const ldns_rdf_type type_tsig_wireformat
[] = {
1947 LDNS_RDF_TYPE_DNAME
,
1948 LDNS_RDF_TYPE_TSIGTIME
,
1949 LDNS_RDF_TYPE_INT16
,
1950 LDNS_RDF_TYPE_INT16_DATA
,
1951 LDNS_RDF_TYPE_INT16
,
1952 LDNS_RDF_TYPE_INT16
,
1953 LDNS_RDF_TYPE_INT16_DATA
1955 static const ldns_rdf_type type_tlsa_wireformat
[] = {
1964 /* All RR's defined in 1035 are well known and can thus
1965 * be compressed. See RFC3597. These RR's are:
1966 * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT
1968 static ldns_rr_descriptor rdata_field_descriptors
[] = {
1970 { 0, NULL
, 0, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
1972 {LDNS_RR_TYPE_A
, "A", 1, 1, type_a_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
1974 {LDNS_RR_TYPE_NS
, "NS", 1, 1, type_ns_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1976 {LDNS_RR_TYPE_MD
, "MD", 1, 1, type_md_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1978 {LDNS_RR_TYPE_MF
, "MF", 1, 1, type_mf_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1980 {LDNS_RR_TYPE_CNAME
, "CNAME", 1, 1, type_cname_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1982 {LDNS_RR_TYPE_SOA
, "SOA", 7, 7, type_soa_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 2 },
1984 {LDNS_RR_TYPE_MB
, "MB", 1, 1, type_mb_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1986 {LDNS_RR_TYPE_MG
, "MG", 1, 1, type_mg_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1988 {LDNS_RR_TYPE_MR
, "MR", 1, 1, type_mr_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1990 {LDNS_RR_TYPE_NULL
, "NULL", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
1992 {LDNS_RR_TYPE_WKS
, "WKS", 2, 2, type_wks_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
1994 {LDNS_RR_TYPE_PTR
, "PTR", 1, 1, type_ptr_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
1996 {LDNS_RR_TYPE_HINFO
, "HINFO", 2, 2, type_hinfo_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
1998 {LDNS_RR_TYPE_MINFO
, "MINFO", 2, 2, type_minfo_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 2 },
2000 {LDNS_RR_TYPE_MX
, "MX", 2, 2, type_mx_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_COMPRESS
, 1 },
2002 {LDNS_RR_TYPE_TXT
, "TXT", 1, 0, NULL
, LDNS_RDF_TYPE_STR
, LDNS_RR_NO_COMPRESS
, 0 },
2004 {LDNS_RR_TYPE_RP
, "RP", 2, 2, type_rp_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 2 },
2006 {LDNS_RR_TYPE_AFSDB
, "AFSDB", 2, 2, type_afsdb_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2008 {LDNS_RR_TYPE_X25
, "X25", 1, 1, type_x25_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2010 {LDNS_RR_TYPE_ISDN
, "ISDN", 1, 2, type_isdn_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2012 {LDNS_RR_TYPE_RT
, "RT", 2, 2, type_rt_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2014 {LDNS_RR_TYPE_NSAP
, "NSAP", 1, 1, type_nsap_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2016 {LDNS_RR_TYPE_NSAP_PTR
, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2018 {LDNS_RR_TYPE_SIG
, "SIG", 9, 9, type_sig_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2020 {LDNS_RR_TYPE_KEY
, "KEY", 4, 4, type_key_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2022 {LDNS_RR_TYPE_PX
, "PX", 3, 3, type_px_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 2 },
2024 {LDNS_RR_TYPE_GPOS
, "GPOS", 1, 1, type_gpos_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2026 {LDNS_RR_TYPE_AAAA
, "AAAA", 1, 1, type_aaaa_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2028 {LDNS_RR_TYPE_LOC
, "LOC", 1, 1, type_loc_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2030 {LDNS_RR_TYPE_NXT
, "NXT", 2, 2, type_nxt_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2032 {LDNS_RR_TYPE_EID
, "EID", 1, 1, type_eid_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2034 {LDNS_RR_TYPE_NIMLOC
, "NIMLOC", 1, 1, type_nimloc_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2036 {LDNS_RR_TYPE_SRV
, "SRV", 4, 4, type_srv_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2038 {LDNS_RR_TYPE_ATMA
, "ATMA", 1, 1, type_atma_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2040 {LDNS_RR_TYPE_NAPTR
, "NAPTR", 6, 6, type_naptr_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2042 {LDNS_RR_TYPE_KX
, "KX", 2, 2, type_kx_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2044 {LDNS_RR_TYPE_CERT
, "CERT", 4, 4, type_cert_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2046 {LDNS_RR_TYPE_A6
, "A6", 1, 1, type_a6_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2048 {LDNS_RR_TYPE_DNAME
, "DNAME", 1, 1, type_dname_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2050 {LDNS_RR_TYPE_SINK
, "SINK", 1, 1, type_sink_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2052 {LDNS_RR_TYPE_OPT
, "OPT", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2054 {LDNS_RR_TYPE_APL
, "APL", 0, 0, type_apl_wireformat
, LDNS_RDF_TYPE_APL
, LDNS_RR_NO_COMPRESS
, 0 },
2056 {LDNS_RR_TYPE_DS
, "DS", 4, 4, type_ds_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2058 {LDNS_RR_TYPE_SSHFP
, "SSHFP", 3, 3, type_sshfp_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2060 {LDNS_RR_TYPE_IPSECKEY
, "IPSECKEY", 1, 1, type_ipseckey_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2062 {LDNS_RR_TYPE_RRSIG
, "RRSIG", 9, 9, type_rrsig_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 1 },
2064 {LDNS_RR_TYPE_NSEC
, "NSEC", 1, 2, type_nsec_wireformat
, LDNS_RDF_TYPE_NSEC
, LDNS_RR_NO_COMPRESS
, 1 },
2066 {LDNS_RR_TYPE_DNSKEY
, "DNSKEY", 4, 4, type_dnskey_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2068 {LDNS_RR_TYPE_DHCID
, "DHCID", 1, 1, type_dhcid_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2070 {LDNS_RR_TYPE_NSEC3
, "NSEC3", 5, 6, type_nsec3_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2072 {LDNS_RR_TYPE_NSEC3PARAM
, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2074 {LDNS_RR_TYPE_TLSA
, "TLSA", 4, 4, type_tlsa_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2076 {LDNS_RR_TYPE_NULL
, "TYPE53", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2077 {LDNS_RR_TYPE_NULL
, "TYPE54", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2078 {LDNS_RR_TYPE_NULL
, "TYPE55", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2079 {LDNS_RR_TYPE_NULL
, "TYPE56", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2080 {LDNS_RR_TYPE_NULL
, "TYPE57", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2082 {LDNS_RR_TYPE_TALINK
, "TALINK", 2, 2, type_talink_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 2 },
2083 {LDNS_RR_TYPE_NULL
, "TYPE59", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2084 {LDNS_RR_TYPE_NULL
, "TYPE60", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2085 {LDNS_RR_TYPE_NULL
, "TYPE61", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2086 {LDNS_RR_TYPE_NULL
, "TYPE62", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2087 {LDNS_RR_TYPE_NULL
, "TYPE63", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2088 {LDNS_RR_TYPE_NULL
, "TYPE64", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2089 {LDNS_RR_TYPE_NULL
, "TYPE65", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2090 {LDNS_RR_TYPE_NULL
, "TYPE66", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2091 {LDNS_RR_TYPE_NULL
, "TYPE67", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2092 {LDNS_RR_TYPE_NULL
, "TYPE68", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2093 {LDNS_RR_TYPE_NULL
, "TYPE69", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2094 {LDNS_RR_TYPE_NULL
, "TYPE70", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2095 {LDNS_RR_TYPE_NULL
, "TYPE71", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2096 {LDNS_RR_TYPE_NULL
, "TYPE72", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2097 {LDNS_RR_TYPE_NULL
, "TYPE73", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2098 {LDNS_RR_TYPE_NULL
, "TYPE74", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2099 {LDNS_RR_TYPE_NULL
, "TYPE75", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2100 {LDNS_RR_TYPE_NULL
, "TYPE76", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2101 {LDNS_RR_TYPE_NULL
, "TYPE77", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2102 {LDNS_RR_TYPE_NULL
, "TYPE78", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2103 {LDNS_RR_TYPE_NULL
, "TYPE79", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2104 {LDNS_RR_TYPE_NULL
, "TYPE80", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2105 {LDNS_RR_TYPE_NULL
, "TYPE81", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2106 {LDNS_RR_TYPE_NULL
, "TYPE82", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2107 {LDNS_RR_TYPE_NULL
, "TYPE83", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2108 {LDNS_RR_TYPE_NULL
, "TYPE84", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2109 {LDNS_RR_TYPE_NULL
, "TYPE85", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2110 {LDNS_RR_TYPE_NULL
, "TYPE86", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2111 {LDNS_RR_TYPE_NULL
, "TYPE87", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2112 {LDNS_RR_TYPE_NULL
, "TYPE88", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2113 {LDNS_RR_TYPE_NULL
, "TYPE89", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2114 {LDNS_RR_TYPE_NULL
, "TYPE90", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2115 {LDNS_RR_TYPE_NULL
, "TYPE91", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2116 {LDNS_RR_TYPE_NULL
, "TYPE92", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2117 {LDNS_RR_TYPE_NULL
, "TYPE93", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2118 {LDNS_RR_TYPE_NULL
, "TYPE94", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2119 {LDNS_RR_TYPE_NULL
, "TYPE95", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2120 {LDNS_RR_TYPE_NULL
, "TYPE96", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2121 {LDNS_RR_TYPE_NULL
, "TYPE97", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2122 {LDNS_RR_TYPE_NULL
, "TYPE98", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2123 {LDNS_RR_TYPE_SPF
, "SPF", 1, 0, NULL
, LDNS_RDF_TYPE_STR
, LDNS_RR_NO_COMPRESS
, 0 },
2124 {LDNS_RR_TYPE_NULL
, "TYPE100", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2125 {LDNS_RR_TYPE_NULL
, "TYPE101", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2126 {LDNS_RR_TYPE_NULL
, "TYPE102", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2127 {LDNS_RR_TYPE_NULL
, "TYPE103", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2128 {LDNS_RR_TYPE_NULL
, "TYPE104", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2129 {LDNS_RR_TYPE_NULL
, "TYPE105", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2130 {LDNS_RR_TYPE_NULL
, "TYPE106", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2131 {LDNS_RR_TYPE_NULL
, "TYPE107", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2132 {LDNS_RR_TYPE_NULL
, "TYPE108", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2133 {LDNS_RR_TYPE_NULL
, "TYPE109", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2134 {LDNS_RR_TYPE_NULL
, "TYPE110", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2135 {LDNS_RR_TYPE_NULL
, "TYPE111", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2136 {LDNS_RR_TYPE_NULL
, "TYPE112", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2137 {LDNS_RR_TYPE_NULL
, "TYPE113", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2138 {LDNS_RR_TYPE_NULL
, "TYPE114", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2139 {LDNS_RR_TYPE_NULL
, "TYPE115", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2140 {LDNS_RR_TYPE_NULL
, "TYPE116", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2141 {LDNS_RR_TYPE_NULL
, "TYPE117", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2142 {LDNS_RR_TYPE_NULL
, "TYPE118", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2143 {LDNS_RR_TYPE_NULL
, "TYPE119", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2144 {LDNS_RR_TYPE_NULL
, "TYPE120", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2145 {LDNS_RR_TYPE_NULL
, "TYPE121", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2146 {LDNS_RR_TYPE_NULL
, "TYPE122", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2147 {LDNS_RR_TYPE_NULL
, "TYPE123", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2148 {LDNS_RR_TYPE_NULL
, "TYPE124", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2149 {LDNS_RR_TYPE_NULL
, "TYPE125", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2150 {LDNS_RR_TYPE_NULL
, "TYPE126", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2151 {LDNS_RR_TYPE_NULL
, "TYPE127", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2152 {LDNS_RR_TYPE_NULL
, "TYPE128", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2153 {LDNS_RR_TYPE_NULL
, "TYPE129", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2154 {LDNS_RR_TYPE_NULL
, "TYPE130", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2155 {LDNS_RR_TYPE_NULL
, "TYPE131", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2156 {LDNS_RR_TYPE_NULL
, "TYPE132", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2157 {LDNS_RR_TYPE_NULL
, "TYPE133", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2158 {LDNS_RR_TYPE_NULL
, "TYPE134", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2159 {LDNS_RR_TYPE_NULL
, "TYPE135", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2160 {LDNS_RR_TYPE_NULL
, "TYPE136", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2161 {LDNS_RR_TYPE_NULL
, "TYPE137", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2162 {LDNS_RR_TYPE_NULL
, "TYPE138", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2163 {LDNS_RR_TYPE_NULL
, "TYPE139", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2164 {LDNS_RR_TYPE_NULL
, "TYPE140", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2165 {LDNS_RR_TYPE_NULL
, "TYPE141", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2166 {LDNS_RR_TYPE_NULL
, "TYPE142", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2167 {LDNS_RR_TYPE_NULL
, "TYPE143", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2168 {LDNS_RR_TYPE_NULL
, "TYPE144", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2169 {LDNS_RR_TYPE_NULL
, "TYPE145", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2170 {LDNS_RR_TYPE_NULL
, "TYPE146", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2171 {LDNS_RR_TYPE_NULL
, "TYPE147", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2172 {LDNS_RR_TYPE_NULL
, "TYPE148", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2173 {LDNS_RR_TYPE_NULL
, "TYPE149", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2174 {LDNS_RR_TYPE_NULL
, "TYPE150", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2175 {LDNS_RR_TYPE_NULL
, "TYPE151", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2176 {LDNS_RR_TYPE_NULL
, "TYPE152", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2177 {LDNS_RR_TYPE_NULL
, "TYPE153", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2178 {LDNS_RR_TYPE_NULL
, "TYPE154", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2179 {LDNS_RR_TYPE_NULL
, "TYPE155", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2180 {LDNS_RR_TYPE_NULL
, "TYPE156", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2181 {LDNS_RR_TYPE_NULL
, "TYPE157", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2182 {LDNS_RR_TYPE_NULL
, "TYPE158", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2183 {LDNS_RR_TYPE_NULL
, "TYPE159", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2184 {LDNS_RR_TYPE_NULL
, "TYPE160", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2185 {LDNS_RR_TYPE_NULL
, "TYPE161", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2186 {LDNS_RR_TYPE_NULL
, "TYPE162", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2187 {LDNS_RR_TYPE_NULL
, "TYPE163", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2188 {LDNS_RR_TYPE_NULL
, "TYPE164", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2189 {LDNS_RR_TYPE_NULL
, "TYPE165", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2190 {LDNS_RR_TYPE_NULL
, "TYPE166", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2191 {LDNS_RR_TYPE_NULL
, "TYPE167", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2192 {LDNS_RR_TYPE_NULL
, "TYPE168", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2193 {LDNS_RR_TYPE_NULL
, "TYPE169", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2194 {LDNS_RR_TYPE_NULL
, "TYPE170", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2195 {LDNS_RR_TYPE_NULL
, "TYPE171", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2196 {LDNS_RR_TYPE_NULL
, "TYPE172", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2197 {LDNS_RR_TYPE_NULL
, "TYPE173", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2198 {LDNS_RR_TYPE_NULL
, "TYPE174", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2199 {LDNS_RR_TYPE_NULL
, "TYPE175", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2200 {LDNS_RR_TYPE_NULL
, "TYPE176", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2201 {LDNS_RR_TYPE_NULL
, "TYPE177", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2202 {LDNS_RR_TYPE_NULL
, "TYPE178", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2203 {LDNS_RR_TYPE_NULL
, "TYPE179", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2204 {LDNS_RR_TYPE_NULL
, "TYPE180", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2205 {LDNS_RR_TYPE_NULL
, "TYPE181", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2206 {LDNS_RR_TYPE_NULL
, "TYPE182", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2207 {LDNS_RR_TYPE_NULL
, "TYPE183", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2208 {LDNS_RR_TYPE_NULL
, "TYPE184", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2209 {LDNS_RR_TYPE_NULL
, "TYPE185", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2210 {LDNS_RR_TYPE_NULL
, "TYPE186", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2211 {LDNS_RR_TYPE_NULL
, "TYPE187", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2212 {LDNS_RR_TYPE_NULL
, "TYPE188", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2213 {LDNS_RR_TYPE_NULL
, "TYPE189", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2214 {LDNS_RR_TYPE_NULL
, "TYPE190", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2215 {LDNS_RR_TYPE_NULL
, "TYPE191", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2216 {LDNS_RR_TYPE_NULL
, "TYPE192", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2217 {LDNS_RR_TYPE_NULL
, "TYPE193", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2218 {LDNS_RR_TYPE_NULL
, "TYPE194", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2219 {LDNS_RR_TYPE_NULL
, "TYPE195", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2220 {LDNS_RR_TYPE_NULL
, "TYPE196", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2221 {LDNS_RR_TYPE_NULL
, "TYPE197", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2222 {LDNS_RR_TYPE_NULL
, "TYPE198", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2223 {LDNS_RR_TYPE_NULL
, "TYPE199", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2224 {LDNS_RR_TYPE_NULL
, "TYPE200", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2225 {LDNS_RR_TYPE_NULL
, "TYPE201", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2226 {LDNS_RR_TYPE_NULL
, "TYPE202", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2227 {LDNS_RR_TYPE_NULL
, "TYPE203", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2228 {LDNS_RR_TYPE_NULL
, "TYPE204", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2229 {LDNS_RR_TYPE_NULL
, "TYPE205", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2230 {LDNS_RR_TYPE_NULL
, "TYPE206", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2231 {LDNS_RR_TYPE_NULL
, "TYPE207", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2232 {LDNS_RR_TYPE_NULL
, "TYPE208", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2233 {LDNS_RR_TYPE_NULL
, "TYPE209", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2234 {LDNS_RR_TYPE_NULL
, "TYPE210", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2235 {LDNS_RR_TYPE_NULL
, "TYPE211", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2236 {LDNS_RR_TYPE_NULL
, "TYPE212", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2237 {LDNS_RR_TYPE_NULL
, "TYPE213", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2238 {LDNS_RR_TYPE_NULL
, "TYPE214", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2239 {LDNS_RR_TYPE_NULL
, "TYPE215", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2240 {LDNS_RR_TYPE_NULL
, "TYPE216", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2241 {LDNS_RR_TYPE_NULL
, "TYPE217", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2242 {LDNS_RR_TYPE_NULL
, "TYPE218", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2243 {LDNS_RR_TYPE_NULL
, "TYPE219", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2244 {LDNS_RR_TYPE_NULL
, "TYPE220", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2245 {LDNS_RR_TYPE_NULL
, "TYPE221", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2246 {LDNS_RR_TYPE_NULL
, "TYPE222", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2247 {LDNS_RR_TYPE_NULL
, "TYPE223", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2248 {LDNS_RR_TYPE_NULL
, "TYPE224", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2249 {LDNS_RR_TYPE_NULL
, "TYPE225", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2250 {LDNS_RR_TYPE_NULL
, "TYPE226", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2251 {LDNS_RR_TYPE_NULL
, "TYPE227", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2252 {LDNS_RR_TYPE_NULL
, "TYPE228", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2253 {LDNS_RR_TYPE_NULL
, "TYPE229", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2254 {LDNS_RR_TYPE_NULL
, "TYPE230", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2255 {LDNS_RR_TYPE_NULL
, "TYPE231", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2256 {LDNS_RR_TYPE_NULL
, "TYPE232", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2257 {LDNS_RR_TYPE_NULL
, "TYPE233", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2258 {LDNS_RR_TYPE_NULL
, "TYPE234", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2259 {LDNS_RR_TYPE_NULL
, "TYPE235", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2260 {LDNS_RR_TYPE_NULL
, "TYPE236", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2261 {LDNS_RR_TYPE_NULL
, "TYPE237", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2262 {LDNS_RR_TYPE_NULL
, "TYPE238", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2263 {LDNS_RR_TYPE_NULL
, "TYPE239", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2264 {LDNS_RR_TYPE_NULL
, "TYPE240", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2265 {LDNS_RR_TYPE_NULL
, "TYPE241", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2266 {LDNS_RR_TYPE_NULL
, "TYPE242", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2267 {LDNS_RR_TYPE_NULL
, "TYPE243", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2268 {LDNS_RR_TYPE_NULL
, "TYPE244", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2269 {LDNS_RR_TYPE_NULL
, "TYPE245", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2270 {LDNS_RR_TYPE_NULL
, "TYPE246", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2271 {LDNS_RR_TYPE_NULL
, "TYPE247", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2272 {LDNS_RR_TYPE_NULL
, "TYPE248", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2273 {LDNS_RR_TYPE_NULL
, "TYPE249", 1, 1, type_0_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2274 /* LDNS_RDF_TYPE_INT16_DATA essentially takes two fields (length and data) and
2275 * makes them into one. So, while in rfc 2845 is specified that a TSIG may have
2276 * 8 or 9 rdata fields, by this implementation, the min/max are 7 each.
2278 {LDNS_RR_TYPE_TSIG
, "TSIG", 7, 7, type_tsig_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 },
2279 /* split in array, no longer contiguous */
2280 {LDNS_RR_TYPE_DLV
, "DLV", 4, 4, type_ds_wireformat
, LDNS_RDF_TYPE_NONE
, LDNS_RR_NO_COMPRESS
, 0 }
2285 * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
2286 * computes the number of rdata fields
2288 #define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \
2289 (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
2291 const ldns_rr_descriptor
*
2292 ldns_rr_descript(uint16_t type
)
2295 if (type
<= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON
) {
2296 return &rdata_field_descriptors
[type
];
2298 /* because not all array index equals type code */
2299 for (i
= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON
;
2300 i
< LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
;
2302 if (rdata_field_descriptors
[i
]._type
== type
) {
2303 return &rdata_field_descriptors
[i
];
2306 return &rdata_field_descriptors
[0];
2311 ldns_rr_descriptor_minimum(const ldns_rr_descriptor
*descriptor
)
2314 return descriptor
->_minimum
;
2321 ldns_rr_descriptor_maximum(const ldns_rr_descriptor
*descriptor
)
2324 if (descriptor
->_variable
!= LDNS_RDF_TYPE_NONE
) {
2325 /* Should really be SIZE_MAX... bad FreeBSD. */
2328 return descriptor
->_maximum
;
2336 ldns_rr_descriptor_field_type(const ldns_rr_descriptor
*descriptor
,
2339 assert(descriptor
!= NULL
);
2340 assert(index
< descriptor
->_maximum
2341 || descriptor
->_variable
!= LDNS_RDF_TYPE_NONE
);
2342 if (index
< descriptor
->_maximum
) {
2343 return descriptor
->_wireformat
[index
];
2345 return descriptor
->_variable
;
2350 ldns_get_rr_type_by_name(const char *name
)
2353 const char *desc_name
;
2354 const ldns_rr_descriptor
*desc
;
2356 /* TYPEXX representation */
2357 if (strlen(name
) > 4 && strncasecmp(name
, "TYPE", 4) == 0) {
2358 return atoi(name
+ 4);
2362 for (i
= 0; i
< (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
; i
++) {
2363 desc
= &rdata_field_descriptors
[i
];
2364 desc_name
= desc
->_name
;
2366 strlen(name
) == strlen(desc_name
) &&
2367 strncasecmp(name
, desc_name
, strlen(desc_name
)) == 0) {
2368 /* because not all array index equals type code */
2373 /* special cases for query types */
2374 if (strlen(name
) == 4 && strncasecmp(name
, "IXFR", 4) == 0) {
2376 } else if (strlen(name
) == 4 && strncasecmp(name
, "AXFR", 4) == 0) {
2378 } else if (strlen(name
) == 5 && strncasecmp(name
, "MAILB", 5) == 0) {
2380 } else if (strlen(name
) == 5 && strncasecmp(name
, "MAILA", 5) == 0) {
2382 } else if (strlen(name
) == 3 && strncasecmp(name
, "ANY", 3) == 0) {
2390 ldns_get_rr_class_by_name(const char *name
)
2392 ldns_lookup_table
*lt
;
2394 /* CLASSXX representation */
2395 if (strlen(name
) > 5 && strncasecmp(name
, "CLASS", 5) == 0) {
2396 return atoi(name
+ 5);
2400 lt
= ldns_lookup_by_name(ldns_rr_classes
, name
);
2410 ldns_rdf2rr_type(const ldns_rdf
*rd
)
2418 if (ldns_rdf_get_type(rd
) != LDNS_RDF_TYPE_TYPE
) {
2422 r
= (ldns_rr_type
) ldns_rdf2native_int16(rd
);
2427 ldns_rr_list_type(const ldns_rr_list
*rr_list
)
2429 if (rr_list
&& ldns_rr_list_rr_count(rr_list
) > 0) {
2430 return ldns_rr_get_type(ldns_rr_list_rr(rr_list
, 0));
2437 ldns_rr_list_owner(const ldns_rr_list
*rr_list
)
2439 if (rr_list
&& ldns_rr_list_rr_count(rr_list
) > 0) {
2440 return ldns_rr_owner(ldns_rr_list_rr(rr_list
, 0));