19 #define LDNS_SYNTAX_DATALEN 16
20 #define LDNS_TTL_DATALEN 21
21 #define LDNS_RRLIST_INIT 8
113 ldns_rr_new_frm_str_internal(
ldns_rr **newrr,
const char *str,
114 uint32_t default_ttl,
ldns_rdf *origin,
132 const char *delimiters;
136 int was_unknown_rr_format = 0;
149 uint16_t hex_data_size;
150 char *hex_data_str = NULL;
151 uint16_t cur_hex_data_size;
153 uint8_t *hex_data = NULL;
166 rr_buf->
_data = NULL;
169 rd_buf->
_data = NULL;
171 if (!
new || !owner || !ttl || !clas || !rdata ||
172 !rr_buf || !rd_buf || !rd || !xtok) {
193 if (strlen(ttl) > 0 && !isdigit((
int) ttl[0])) {
195 if (default_ttl == 0) {
198 ttl_val = default_ttl;
215 strncpy(type, ttl, strlen(ttl) + 1);
234 strncpy(type, clas, strlen(clas) + 1);
259 if (strlen(owner) <= 1 && strncmp(owner,
"@", 1) == 0) {
262 }
else if (prev && *prev) {
278 if (strlen(owner) == 0) {
341 for (done =
false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) {
354 default : delimiters =
"\n\t ";
357 if (ldns_rdf_type_maybe_quoted(
360 ldns_buffer_remaining(rd_buf) > 0){
363 while (*(ldns_buffer_current(rd_buf)) ==
' ') {
364 ldns_buffer_skip(rd_buf, 1);
367 if (*(ldns_buffer_current(rd_buf)) ==
'\"') {
369 ldns_buffer_skip(rd_buf, 1);
379 while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf)
380 && *(ldns_buffer_current(rd_buf)) ==
' '
383 ldns_buffer_skip(rd_buf, 1);
386 pre_data_pos = ldns_buffer_position(rd_buf);
397 rd_strlen = strlen(rd);
400 if (strncmp(rd,
"\\#", 2) == 0 && !quoted &&
401 (rd_strlen == 2 || rd[2]==
' ')) {
403 was_unknown_rr_format = 1;
407 ldns_buffer_set_position(rd_buf, pre_data_pos);
408 delimiters =
"\n\t ";
419 hex_data_size = (uint16_t) atoi(rd);
426 cur_hex_data_size = 0;
427 while(cur_hex_data_size < 2 * hex_data_size) {
431 rd_strlen = strlen(rd);
434 (
size_t)cur_hex_data_size + rd_strlen >
435 2 * (
size_t)hex_data_size) {
440 strncpy(hex_data_str + cur_hex_data_size, rd,
443 cur_hex_data_size += rd_strlen;
445 hex_data_str[cur_hex_data_size] =
'\0';
457 ldns_write_uint16(hex_data, hex_data_size);
459 hex_data + 2, hex_data_str);
461 hex_data_size + 2, &hex_pos);
489 if (r_cnt == r_max - 1) {
493 (void) strncat(rd, xtok,
520 (void) strncat(rd,
" ",
523 (void) strncat(rd, xtok,
533 (void) strncat(rd,
" ",
536 (void) strncat(rd, xtok,
571 }
else if (r && rd_strlen >= 1 && origin &&
593 if (ldns_buffer_available(rd_buf, 1)) {
594 ldns_buffer_skip(rd_buf, 1);
607 if (!question && desc && !was_unknown_rr_format &&
625 if (rd_buf && rd_buf->
_data) {
630 if (rr_buf && rr_buf->
_data) {
650 uint32_t default_ttl,
ldns_rdf *origin,
653 return ldns_rr_new_frm_str_internal(newrr,
665 return ldns_rr_new_frm_str_internal(newrr,
720 if (strncmp(line,
"$ORIGIN", 7) == 0 && isspace(line[7])) {
726 while (isspace(line[offset])) {
737 }
else if (strncmp(line,
"$TTL", 4) == 0 && isspace(line[4])) {
739 while (isspace(line[offset])) {
746 }
else if (strncmp(line,
"$INCLUDE", 8) == 0) {
749 if (origin && *origin) {
810 if (position < rd_count) {
949 assert(count <= rr_list->_rr_capacity);
957 return rr_list->
_rrs[nr];
967 if(!rr_list)
return NULL;
970 rr_list->
_rrs = NULL;
1016 for(i = 0; i < r_rr_count; i++) {
1049 for(i = 0; i < l_rr_count; i++) {
1054 for(i = 0; i < r_rr_count; i++) {
1105 if(rr_count+1 > cap) {
1115 rr_list->
_rrs = rrs;
1149 if (rr_count == 0) {
1267 if (rr_count == 0) {
1293 for(i = 0; i < rr_count; i++) {
1424 qsort_schwartz_rr_compare(
const void *a,
const void *b)
1435 ldns_rr *canonical_a, *canonical_b;
1490 if(!sortables)
return;
1491 for (i = 0; i < item_count; i++) {
1509 qsort_schwartz_rr_compare);
1510 for (i = 0; i < item_count; i++) {
1528 assert(rr1 != NULL);
1529 assert(rr2 != NULL);
1553 if (offset > rr1_len || offset > rr2_len) {
1554 if (rr1_len == rr2_len) {
1557 return ((
int) rr2_len - (
int) rr1_len);
1565 size_t rr1_len, rr2_len, min_len, i, offset;
1567 rr1_len = ldns_buffer_capacity(rr1_buf);
1568 rr2_len = ldns_buffer_capacity(rr2_buf);
1573 while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) {
1574 offset += *ldns_buffer_at(rr1_buf, offset) + 1;
1579 min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len;
1581 for(i = offset; i < min_len; i++) {
1582 if (*ldns_buffer_at(rr1_buf,i) < *ldns_buffer_at(rr2_buf,i)) {
1584 }
else if (*ldns_buffer_at(rr1_buf,i) > *ldns_buffer_at(rr2_buf,i)) {
1590 if (rr1_len < rr2_len) {
1592 }
else if (rr1_len > rr2_len) {
1604 size_t rr1_len, rr2_len;
1646 ldns_rr_compare_ds_dnskey(
ldns_rr *ds,
1650 bool result =
false;
1653 if (!dnskey || !ds ||
1685 result = ldns_rr_compare_ds_dnskey(rr1, rr2);
1688 result = ldns_rr_compare_ds_dnskey(rr2, rr1);
1705 assert(rrl1 != NULL);
1706 assert(rrl2 != NULL);
1824 LDNS_RDF_TYPE_PERIOD
1967 LDNS_RDF_TYPE_INT16_DATA
2412 #define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \
2413 (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
2457 ldns_rdf_bitmap_known_rr_types_set(
ldns_rdf** rdf,
int value)
2461 uint16_t windows[256]
2470 uint8_t* data = NULL;
2473 assert(rdf != NULL);
2477 for (d=rdata_field_descriptors; d < rdata_field_descriptors_end; d++) {
2478 window = d->
_type >> 8;
2479 subtype = d->
_type & 0xff;
2480 if (windows[window] < subtype) {
2481 windows[window] = subtype;
2488 for (i = 0; i < 256; i++) {
2490 sz += windows[i] / 8 + 3;
2497 memset(data, value, sz);
2501 for (i = 0; i < 256; i++) {
2503 *dptr++ = (uint8_t)i;
2504 *dptr++ = (uint8_t)(windows[i] / 8 + 1);
2522 return ldns_rdf_bitmap_known_rr_types_set(rdf, 0);
2528 return ldns_rdf_bitmap_known_rr_types_set(rdf, 255);
2539 return &rdata_field_descriptors[type];
2545 if (rdata_field_descriptors[i]._type == type) {
2546 return &rdata_field_descriptors[i];
2549 return &rdata_field_descriptors[0];
2582 assert(descriptor != NULL);
2583 assert(index < descriptor->_maximum
2585 if (index < descriptor->_maximum) {
2596 const char *desc_name;
2600 if (strlen(name) > 4 && strncasecmp(name,
"TYPE", 4) == 0) {
2601 return atoi(name + 4);
2606 desc = &rdata_field_descriptors[i];
2607 desc_name = desc->
_name;
2609 strlen(name) == strlen(desc_name) &&
2610 strncasecmp(name, desc_name, strlen(desc_name)) == 0) {
2617 if (strlen(name) == 4 && strncasecmp(name,
"IXFR", 4) == 0) {
2619 }
else if (strlen(name) == 4 && strncasecmp(name,
"AXFR", 4) == 0) {
2621 }
else if (strlen(name) == 5 && strncasecmp(name,
"MAILB", 5) == 0) {
2623 }
else if (strlen(name) == 5 && strncasecmp(name,
"MAILA", 5) == 0) {
2625 }
else if (strlen(name) == 3 && strncasecmp(name,
"ANY", 3) == 0) {
2638 if (strlen(name) > 5 && strncasecmp(name,
"CLASS", 5) == 0) {
2639 return atoi(name + 5);
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
_Bool ldns_dname_str_absolute(const char *dname_str)
Checks whether the given dname string is absolute (i.e.
implementation of buffers to ease operations
mailbox or mail list information
ldns_rdf * ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position)
sets a rdf member, it will be set on the position given.
ldns_rr * ldns_rr_clone(const ldns_rr *rr)
clones a rr and all its data
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
void ldns_rr_set_rd_count(ldns_rr *rr, size_t count)
sets the rd_count in the rr.
void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type)
sets the type in the rr.
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
void ldns_rr2canonical(ldns_rr *rr)
converts each dname in a rr to its canonical form.
the canonical name for an alias
ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd)
convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual LDNS_RR_TYPE.
int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2)
Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6...
enum ldns_enum_rr_class ldns_rr_class
List or Set of Resource Records.
uint8_t ldns_rdf2native_int8(const ldns_rdf *rd)
returns the native uint8_t representation from the rdf.
#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
computes the number of rdata fields
ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, size_t index)
returns the rdf type for the given rdata field number of the rr type for the given descriptor...
#define LDNS_XMALLOC(type, count)
size_t ldns_rdf_size(const ldns_rdf *rd)
returns the size of the rdf.
enum ldns_enum_hash ldns_hash
void ldns_rr_list_deep_free(ldns_rr_list *rr_list)
frees an rr_list structure and all rrs contained therein.
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
ldns_rr_class _rr_class
Class of the resource record.
ldns_rr_list * ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos)
Return the rr_list which matches the rdf at position field.
ldns_rr * ldns_rr_new_frm_type(ldns_rr_type t)
creates a new rr structure, based on the given type.
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
http://www.jhsoft.com/rfc/af-saa-0069.000.rtf
void ldns_dname2canonical(const ldns_rdf *rd)
Put a dname into canonical fmt - ie.
uint8_t _maximum
Maximum number of rdata fields in the RRs of this type.
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
#define LDNS_MAX_PACKETLEN
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_lookup_table ldns_rr_classes[]
rr types
ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit)
returns a token/char from the buffer b.
ldns_rr_type ldns_get_rr_type_by_name(const char *name)
retrieves a rrtype by looking up its name.
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
size_t ldns_rr_uncompressed_size(const ldns_rr *r)
calculates the uncompressed size of an RR.
#define LDNS_XREALLOC(ptr, type, count)
const ldns_rr_descriptor * ldns_rr_descript(uint16_t type)
returns the resource record descriptor for the given rr type.
A non-zero sequence of US-ASCII letters and numbers in lower case.
draft-barwood-dnsop-ds-publis
A encoding of the value field as specified [RFC1035], Section 5.1., encoded as remaining rdata.
#define INLINE
splint static inline workaround
a mailbox domain name (EXPERIMENTAL)
size_t _rd_count
Number of data fields.
ldns_status ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, uint32_t default_ttl, ldns_rdf *origin, ldns_rdf **prev)
creates an rr from a string.
Including this file will include all ldns files, and define some lookup tables.
ldns_rdf * ldns_dname_new_frm_str(const char *str)
creates a new dname rdf from a string.
marks the start of a zone of authority
uint8_t * ldns_rdf_data(const ldns_rdf *rd)
returns the data of the rdf.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class)
sets the class in the rr.
enum ldns_enum_rdf_type ldns_rdf_type
void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type)
sets the size of the rdf.
_Bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr)
returns true if the given rr is one of the rrs in the list, or if it is equal to one ...
_Bool ldns_rr_compare_ds(const ldns_rr *orr1, const ldns_rr *orr2)
returns true of the given rr's are equal.
ldns_rdf_type _variable
Special rdf types.
_Bool ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr)
pushes an rr to an rrset (which really are rr_list's).
#define LDNS_MAX_DOMAINLEN
Maximum length of a complete dname.
bogus section, if not interested
_Bool ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list)
pushes an rr_list to an rrlist.
ldns_rr * ldns_rr_list_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrlist.
variable length any type rdata where the length is specified by the first 2 bytes ...
_Bool ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f)
sets rd_field member, it will be placed in the next available spot.
uint16_t ldns_rdf2native_int16(const ldns_rdf *rd)
returns the native uint16_t representation from the rdf.
Structure to do a Schwartzian-like transformation, for instance when sorting.
ldns_rr_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_rdf * ldns_rr_pop_rdf(ldns_rr *rr)
removes a rd_field member, it will be popped from the last position.
ldns_rr * ldns_rr_set_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrset.
ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rr *rr, int section)
Copies the rr data to the buffer in wire format, in canonical format according to RFC3597 (every dnam...
size_t ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor)
returns the maximum number of rdata fields of the rr type this descriptor describes.
a well known service description
ldns_rdf * ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str)
creates a new rdf from a string.
ldns_status ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2)
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified)
dnsind-kitchen-sink-02.txt
ldns_status ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section)
Copies the rr data to the buffer in wire format.
Contains all information about resource record types.
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs.
void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count)
sets the number of rr's in an rr_list.
#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON
ldns_rr_list * ldns_rr_list_clone(const ldns_rr_list *rrlist)
clones an rrlist.
ldns_rr_list * ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t howmany)
pops an rr_list of size s from an rrlist.
ldns_rdf * ldns_rr_list_owner(const ldns_rr_list *rr_list)
Returns the owner domain name rdf of the first element of the RR If there are no elements present...
ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
returns a token/char from the stream F.
ldns_rr_list * ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right)
concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying)...
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd)
returns the type of the rdf.
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner)
sets the owner in the rr structure.
ldns_rr * ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count)
set a rr on a specific index in a ldns_rr_list
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
DNSSEC Trust Authorities.
ldns_rr_list * ldns_rr_list_pop_rrset(ldns_rr_list *rr_list)
pops the first rrset from the list, the list must be sorted, so that all rr's from each rrset are nex...
uint32_t ldns_str2period(const char *nptr, const char **endptr)
converts a ttl value (like 5d2h) to a long.
int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs, up to the rdata.
draft-ietf-nimrod-dns-01.txt
nsec3 base32 string (with length byte on wire
a mail group member (EXPERIMENTAL)
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl)
sets the ttl in the rr structure.
enum ldns_enum_status ldns_status
a mail destination (Obsolete - use MX)
#define LDNS_MALLOC(type)
Memory management macros.
ldns_buffer * ldns_buffer_new(size_t capacity)
creates a new buffer with the specified capacity.
ldns_rdf * ldns_rdf_new(ldns_rdf_type type, size_t size, void *data)
allocates a new rdf structure and fills it.
A general purpose lookup table.
#define LDNS_PARSE_SKIP_SPACE
ldns_status ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr)
creates a new rr from a file containing a string.
_Bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
_Bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right)
concatenates two ldns_rr_lists together.
4 shorts represented as 4 * 16 bit hex numbers separated by colons.
ldns_rdf * _owner
Owner name, uncompressed.
size_t ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor)
returns the minimum number of rdata fields of the rr type this descriptor describes.
int ldns_hexstring_to_data(uint8_t *data, const char *str)
Converts a hex string to binary data.
uint8_t _minimum
Minimum number of rdata fields in the RRs of this type.
a mail rename domain name (EXPERIMENTAL)
uint32_t _ttl
Time to live.
Resource record data field.
ldns_lookup_table * ldns_lookup_by_name(ldns_lookup_table *table, const char *name)
Represents the Public Key Algorithm, HIT and Public Key fields for the HIP RR types.
uint8_t ldns_rr_label_count(ldns_rr *rr)
counts the number of labels of the ownername.
ldns_rr_class ldns_get_rr_class_by_name(const char *name)
retrieves a class by looking up its name.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
ldns_rr * ldns_rr_new(void)
creates a new rr structure.
ldns_status ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str, ldns_rdf *origin, ldns_rdf **prev)
creates an rr for the question section from a string, i.e.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
void * transformed_object
enum ldns_enum_rr_type ldns_rr_type
const char * _name
Textual name of the RR type.
an authoritative name server
ldns_rdf ** _rdata_fields
The array of rdata's.
void ldns_rr_set_question(ldns_rr *rr, _Bool question)
signed char _rr_question
question rr [it would be nicer if thous is after _rd_count] ABI change: Fix this in next major releas...
void ldns_rr_list2canonical(ldns_rr_list *rr_list)
converts each dname in each rr in a rr_list to its canonical form.
int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2)
compares two rr listss.
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
ldns_rr_type ldns_rr_list_type(const ldns_rr_list *rr_list)
Returns the type of the first element of the RR If there are no elements present, 0 is returned...
uint8_t * _data
The data contained in the buffer.
#define LDNS_SYNTAX_DATALEN
_Bool ldns_rr_is_question(const ldns_rr *rr)
returns the question flag of an rr structure.
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
draft-ietf-dnsop-trust-history
ldns_status ldns_rdf_bitmap_known_rr_types_space(ldns_rdf **rdf)
Create a rr type bitmap rdf providing enough space to set all known (to ldns) rr types.
void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size)
creates a buffer with the specified data.
#define LDNS_RR_OVERHEAD
The bytes TTL, CLASS and length use up in an rr.
8 * 8 bit hex numbers separated by dashes.
ldns_rr_type _rr_type
the type of the RR.
6 * 8 bit hex numbers separated by dashes.
_Bool ldns_is_rrset(ldns_rr_list *rr_list)
checks if an rr_list is a rrset.
void ldns_rr_list_sort(ldns_rr_list *unsorted)
sorts an rr_list (canonical wire format).
draft-ietf-nimrod-dns-01.txt
int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2)
compares two rdf's on their wire formats.
ldns_status ldns_rdf_bitmap_known_rr_types(ldns_rdf **rdf)
Create a rr type bitmap rdf with at least all known (to ldns) rr types set.
ldns_status ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev)
creates a new rr from a file containing a string.
a mail forwarder (Obsolete - use MX)
ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos)
converts the data on the uint8_t bytearray (in wire format) to DNS rdata fields, and adds them to the...
int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf)
compares the wireformat of two rrs, contained in the given buffers.
ldns_rr_type _type
Type of the RR that is described here.
const ldns_rdf_type * _wireformat
Wireformat specification for the rr, i.e.
ldns_rr * ldns_key_rr2ds(const ldns_rr *key, ldns_hash h)
returns a new DS rr that represents the given key rr.