19 #define LDNS_SYNTAX_DATALEN 16
20 #define LDNS_TTL_DATALEN 21
21 #define LDNS_RRLIST_INIT 8
23 #define _IS_WHITESPACE(chr) \
24 ( NULL != strchr( LDNS_PARSE_NO_NL, chr) )
26 #define _BUFFER_IS_AT_WHITESPACE(rd_buf) \
27 _IS_WHITESPACE(*(ldns_buffer_current(rd_buf)))
119 ldns_rr_new_frm_str_internal(
ldns_rr **newrr,
const char *str,
120 uint32_t default_ttl,
const ldns_rdf *origin,
140 const char *delimiters;
144 int was_unknown_rr_format = 0;
157 uint16_t hex_data_size;
158 char *hex_data_str = NULL;
159 uint16_t cur_hex_data_size;
161 uint8_t *hex_data = NULL;
174 rr_buf->
_data = NULL;
177 rd_buf->
_data = NULL;
179 if (!
new || !owner || !ttl || !clas || !rdata ||
180 !rr_buf || !rd_buf || !rd || !xtok) {
201 if (strlen(ttl) > 0 && !isdigit((
int) ttl[0])) {
203 if (default_ttl == 0) {
206 ttl_val = default_ttl;
209 *explicit_ttl =
false;
222 type_sz = strlen(ttl) + 1;
231 *explicit_ttl =
true;
245 type_sz = strlen(clas) + 1;
275 if (strncmp(owner,
"@", 1) == 0) {
278 }
else if (prev && *prev) {
294 if (strlen(owner) == 0) {
357 for (done =
false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) {
373 default : delimiters =
"\n\t ";
376 if (ldns_rdf_type_maybe_quoted(
379 ldns_buffer_remaining(rd_buf) > 0){
382 while (ldns_buffer_remaining(rd_buf) > 0 &&
384 ldns_buffer_skip(rd_buf, 1);
387 if (ldns_buffer_remaining(rd_buf) > 0 &&
388 *(ldns_buffer_current(rd_buf)) ==
'\"') {
390 ldns_buffer_skip(rd_buf, 1);
406 while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf)
410 ldns_buffer_skip(rd_buf, 1);
413 pre_data_pos = ldns_buffer_position(rd_buf);
425 rd_strlen = strlen(rd);
428 if (strncmp(rd,
"\\#", 2) == 0 && !quoted &&
431 was_unknown_rr_format = 1;
435 ldns_buffer_set_position(rd_buf, pre_data_pos);
436 delimiters =
"\n\t ";
447 hex_data_size = (uint16_t) atoi(rd);
454 cur_hex_data_size = 0;
455 while(cur_hex_data_size < 2 * hex_data_size) {
462 rd_strlen = strlen(rd);
463 if ((
size_t)cur_hex_data_size + rd_strlen >
464 2 * (
size_t)hex_data_size) {
468 strlcpy(hex_data_str + cur_hex_data_size, rd,
471 cur_hex_data_size += rd_strlen;
473 hex_data_str[cur_hex_data_size] =
'\0';
485 ldns_write_uint16(hex_data, hex_data_size);
487 hex_data + 2, hex_data_str);
489 hex_data_size + 2, &hex_pos);
507 }
else if(rd_strlen > 0 || quoted) {
517 if (r_cnt == r_max - 1) {
521 (void) strncat(rd, xtok,
548 (void) strncat(rd,
" ",
551 (void) strncat(rd, xtok,
561 (void) strncat(rd,
" ",
564 (void) strncat(rd, xtok,
599 }
else if (r && rd_strlen >= 1
627 if (ldns_buffer_remaining(rd_buf) > 0) {
634 if (!question && desc && !was_unknown_rr_format &&
652 if (rd_buf && rd_buf->
_data) {
657 if (rr_buf && rr_buf->
_data) {
677 uint32_t default_ttl,
const ldns_rdf *origin,
680 return ldns_rr_new_frm_str_internal(newrr,
693 return ldns_rr_new_frm_str_internal(newrr,
704 ldns_strip_ws(
char *line)
708 for (s = line; *s && isspace((
unsigned char)*s); s++)
711 for (e = strchr(s, 0); e > s+2 && isspace((
unsigned char)e[-1]) && e[-2] !=
'\\'; e--)
727 int *line_nr,
bool *explicit_ttl)
749 if (strncmp(line,
"$ORIGIN", 7) == 0 && isspace((
unsigned char)line[7])) {
755 ldns_strip_ws(line + 8));
763 }
else if (strncmp(line,
"$TTL", 4) == 0 && isspace((
unsigned char)line[4])) {
766 ldns_strip_ws(line + 5), &endptr);
769 }
else if (strncmp(line,
"$INCLUDE", 8) == 0) {
771 }
else if (!*ldns_strip_ws(line)) {
775 if (origin && *origin) {
776 s = ldns_rr_new_frm_str_internal(&rr, (
const char*)line,
777 ttl, *origin, prev,
false, explicit_ttl);
779 s = ldns_rr_new_frm_str_internal(&rr, (
const char*)line,
780 ttl, NULL, prev,
false, explicit_ttl);
800 prev, line_nr, NULL);
846 if (position < rd_count) {
985 assert(count <= rr_list->_rr_capacity);
993 return rr_list->
_rrs[nr];
1003 if(!rr_list)
return NULL;
1006 rr_list->
_rrs = NULL;
1052 for(i = 0; i < r_rr_count; i++) {
1085 for(i = 0; i < l_rr_count; i++) {
1090 for(i = 0; i < r_rr_count; i++) {
1141 if(rr_count+1 > cap) {
1151 rr_list->
_rrs = rrs;
1185 if (rr_count == 0) {
1304 if (rr_count == 0) {
1330 for(i = 0; i < rr_count; i++) {
1461 qsort_schwartz_rr_compare(
const void *a,
const void *b)
1472 ldns_rr *canonical_a, *canonical_b;
1527 if(!sortables)
return;
1528 for (i = 0; i < item_count; i++) {
1546 qsort_schwartz_rr_compare);
1547 for (i = 0; i < item_count; i++) {
1565 assert(rr1 != NULL);
1566 assert(rr2 != NULL);
1590 if (offset > rr1_len || offset > rr2_len) {
1591 if (rr1_len == rr2_len) {
1594 return ((
int) rr2_len - (
int) rr1_len);
1602 size_t rr1_len, rr2_len, min_len, i, offset;
1604 rr1_len = ldns_buffer_capacity(rr1_buf);
1605 rr2_len = ldns_buffer_capacity(rr2_buf);
1610 while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) {
1611 offset += *ldns_buffer_at(rr1_buf, offset) + 1;
1616 min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len;
1618 for(i = offset; i < min_len; i++) {
1619 if (*ldns_buffer_at(rr1_buf,i) < *ldns_buffer_at(rr2_buf,i)) {
1621 }
else if (*ldns_buffer_at(rr1_buf,i) > *ldns_buffer_at(rr2_buf,i)) {
1627 if (rr1_len < rr2_len) {
1629 }
else if (rr1_len > rr2_len) {
1641 size_t rr1_len, rr2_len;
1683 ldns_rr_compare_ds_dnskey(
ldns_rr *ds,
1687 bool result =
false;
1690 if (!dnskey || !ds ||
1722 result = ldns_rr_compare_ds_dnskey(rr1, rr2);
1725 result = ldns_rr_compare_ds_dnskey(rr2, rr1);
1742 assert(rrl1 != NULL);
1743 assert(rrl2 != NULL);
1968 #ifdef RRTYPE_OPENPGPKEY
1980 #ifdef RRTYPE_SVCB_HTTPS
2075 #ifdef RRTYPE_AMTRELAY
2227 #ifdef RRTYPE_OPENPGPKEY
2237 #ifdef RRTYPE_SVCB_HTTPS
2485 #ifdef RRTYPE_AMTRELAY
2509 #define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \
2510 (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
2554 ldns_rdf_bitmap_known_rr_types_set(
ldns_rdf** rdf,
int value)
2558 uint16_t windows[256]
2567 uint8_t* data = NULL;
2570 assert(rdf != NULL);
2574 for (d=rdata_field_descriptors; d < rdata_field_descriptors_end; d++) {
2575 window = d->
_type >> 8;
2576 subtype = d->
_type & 0xff;
2577 if (windows[window] < subtype) {
2578 windows[window] = subtype;
2585 for (i = 0; i < 256; i++) {
2587 sz += windows[i] / 8 + 3;
2597 memset(data, value, sz);
2598 for (i = 0; i < 256; i++) {
2600 *dptr++ = (uint8_t)i;
2601 *dptr++ = (uint8_t)(windows[i] / 8 + 1);
2619 return ldns_rdf_bitmap_known_rr_types_set(rdf, 0);
2625 return ldns_rdf_bitmap_known_rr_types_set(rdf, 255);
2636 return &rdata_field_descriptors[type];
2642 if (rdata_field_descriptors[i]._type == type) {
2643 return &rdata_field_descriptors[i];
2646 return &rdata_field_descriptors[0];
2679 assert(descriptor != NULL);
2680 assert(index < descriptor->_maximum
2682 if (index < descriptor->_maximum) {
2693 const char *desc_name;
2697 if (strlen(name) > 4 && strncasecmp(name,
"TYPE", 4) == 0) {
2698 return atoi(name + 4);
2703 desc = &rdata_field_descriptors[i];
2704 desc_name = desc->
_name;
2706 strlen(name) == strlen(desc_name) &&
2707 strncasecmp(name, desc_name, strlen(desc_name)) == 0) {
2714 if (strlen(name) == 4 && strncasecmp(name,
"IXFR", 4) == 0) {
2716 }
else if (strlen(name) == 4 && strncasecmp(name,
"AXFR", 4) == 0) {
2718 }
else if (strlen(name) == 5 && strncasecmp(name,
"MAILB", 5) == 0) {
2720 }
else if (strlen(name) == 5 && strncasecmp(name,
"MAILA", 5) == 0) {
2722 }
else if (strlen(name) == 3 && strncasecmp(name,
"ANY", 3) == 0) {
2735 if (strlen(name) > 5 && strncasecmp(name,
"CLASS", 5) == 0) {
2736 return atoi(name + 5);
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
ldns_buffer * ldns_buffer_new(size_t capacity)
creates a new buffer with the specified capacity.
void ldns_buffer_new_frm_data(ldns_buffer *buffer, const void *data, size_t size)
creates a buffer with the specified data.
size_t strlcpy(char *dst, const char *src, size_t siz)
bool ldns_dname_str_absolute(const char *dname_str)
Checks whether the given dname string is absolute (i.e.
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.
void ldns_dname2canonical(const ldns_rdf *rd)
Put a dname into canonical fmt - ie.
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
ldns_status ldns_dname_cat(ldns_rdf *rd1, const ldns_rdf *rd2)
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified)
ldns_rdf * ldns_dname_new_frm_str(const char *str)
creates a new dname rdf from a string.
ldns_rr * ldns_key_rr2ds(const ldns_rr *key, ldns_hash h)
returns a new DS rr that represents the given key rr.
@ LDNS_STATUS_SYNTAX_SUPERFLUOUS_TEXT_ERR
@ LDNS_STATUS_SYNTAX_DNAME_ERR
@ LDNS_STATUS_SYNTAX_RDATA_ERR
@ LDNS_STATUS_SYNTAX_TYPE_ERR
@ LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR
@ LDNS_STATUS_SYNTAX_EMPTY
@ LDNS_STATUS_SYNTAX_CLASS_ERR
@ LDNS_STATUS_SYNTAX_INCLUDE
@ LDNS_STATUS_SYNTAX_TTL_ERR
@ LDNS_STATUS_SYNTAX_ORIGIN
enum ldns_enum_status ldns_status
ldns_lookup_table ldns_rr_classes[]
rr types
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...
ldns_status ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section)
Copies the rr data to the buffer in wire format.
enum ldns_enum_hash ldns_hash
Including this file will include all ldns files, and define some lookup tables.
#define LDNS_MAX_PACKETLEN
@ LDNS_SECTION_ANY
bogus section, if not interested
ldns_status ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed, const char *delim, int *line_nr)
returns a token/char from the stream f.
ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit)
returns a token/char from the buffer b.
#define LDNS_PARSE_SKIP_SPACE
uint32_t ldns_str2period(const char *nptr, const char **endptr)
converts a ttl value (like 5d2h) to a long.
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd)
returns the type of the rdf.
void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type)
sets the size of the rdf.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
ldns_rdf * ldns_rdf_new(ldns_rdf_type type, size_t size, void *data)
allocates a new rdf structure and fills it.
uint16_t ldns_rdf2native_int16(const ldns_rdf *rd)
returns the native uint16_t representation from the rdf.
ldns_rdf * ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str)
creates a new rdf from a string.
uint8_t ldns_rdf2native_int8(const ldns_rdf *rd)
returns the native uint8_t representation from the rdf.
size_t ldns_rdf_size(const ldns_rdf *rd)
returns the size of the rdf.
uint8_t * ldns_rdf_data(const ldns_rdf *rd)
returns the data of the rdf.
int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2)
compares two rdf's on their wire formats.
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
@ LDNS_RDF_TYPE_INT32
32 bits
@ LDNS_RDF_TYPE_TAG
A non-zero sequence of US-ASCII letters and numbers in lower case.
@ LDNS_RDF_TYPE_NSAP
NSAP.
@ LDNS_RDF_TYPE_HIP
Represents the Public Key Algorithm, HIT and Public Key fields for the HIP RR types.
@ LDNS_RDF_TYPE_NSEC3_NEXT_OWNER
nsec3 base32 string (with length byte on wire
@ LDNS_RDF_TYPE_CERT_ALG
certificate algorithm
@ LDNS_RDF_TYPE_EUI48
6 * 8 bit hex numbers separated by dashes.
@ LDNS_RDF_TYPE_EUI64
8 * 8 bit hex numbers separated by dashes.
@ LDNS_RDF_TYPE_PERIOD
period
@ LDNS_RDF_TYPE_B64
b64 string
@ LDNS_RDF_TYPE_AAAA
AAAA record.
@ LDNS_RDF_TYPE_UNKNOWN
unknown types
@ LDNS_RDF_TYPE_WKS
well known services
@ LDNS_RDF_TYPE_DNAME
domain name
@ LDNS_RDF_TYPE_TIME
time (32 bits)
@ LDNS_RDF_TYPE_SVCPARAMS
draft-ietf-dnsop-svcb-https
@ LDNS_RDF_TYPE_NSEC
nsec type codes
@ LDNS_RDF_TYPE_NSEC3_SALT
nsec3 hash salt
@ LDNS_RDF_TYPE_APL
apl data
@ LDNS_RDF_TYPE_A
A record.
@ LDNS_RDF_TYPE_LONG_STR
A <character-string> encoding of the value field as specified [RFC1035], Section 5....
@ LDNS_RDF_TYPE_LOC
location data
@ LDNS_RDF_TYPE_INT16_DATA
variable length any type rdata where the length is specified by the first 2 bytes
@ LDNS_RDF_TYPE_ILNP64
4 shorts represented as 4 * 16 bit hex numbers separated by colons.
@ LDNS_RDF_TYPE_ATMA
ATMA.
@ LDNS_RDF_TYPE_HEX
hex string
@ LDNS_RDF_TYPE_INT8
8 bits
@ LDNS_RDF_TYPE_MATCHING_TYPE
@ LDNS_RDF_TYPE_IPSECKEY
IPSECKEY.
@ LDNS_RDF_TYPE_CERTIFICATE_USAGE
Since RFC7218 TLSA records can be given with mnemonics, hence these rdata field types.
@ LDNS_RDF_TYPE_STR
txt string
@ LDNS_RDF_TYPE_INT16
16 bits
@ LDNS_RDF_TYPE_ALG
a key algorithm
@ LDNS_RDF_TYPE_AMTRELAY
draft-ietf-mboned-driad-amt-discovery
@ LDNS_RDF_TYPE_TSIGTIME
tsig time 48 bits
@ LDNS_RDF_TYPE_TYPE
a RR type
enum ldns_enum_rdf_type ldns_rdf_type
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
ldns_rr * ldns_rr_list_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrlist.
ldns_rr_class ldns_get_rr_class_by_name(const char *name)
retrieves a class by looking up its name.
ldns_status ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, uint32_t default_ttl, const ldns_rdf *origin, ldns_rdf **prev)
creates an rr from a string.
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
ldns_status _ldns_rr_new_frm_fp_l_internal(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr, bool *explicit_ttl)
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).
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
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.
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.
void ldns_rr_list_deep_free(ldns_rr_list *rr_list)
frees an rr_list structure and all rrs contained therein.
const ldns_rr_descriptor * ldns_rr_descript(uint16_t type)
returns the resource record descriptor for the given rr type.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_rr * ldns_rr_set_pop_rr(ldns_rr_list *rr_list)
pops the last rr from an rrset.
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner)
sets the owner in the rr structure.
#define _BUFFER_IS_AT_WHITESPACE(rd_buf)
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.
#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
computes the number of rdata fields
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...
ldns_rr * ldns_rr_new_frm_type(ldns_rr_type t)
creates a new rr structure, based on the given type.
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.
void ldns_rr_list_sort(ldns_rr_list *unsorted)
sorts an rr_list (canonical wire format).
#define _IS_WHITESPACE(chr)
void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type)
sets the type in the rr.
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.
void ldns_rr2canonical(ldns_rr *rr)
converts each dname in a rr to its canonical form.
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
uint8_t ldns_rr_label_count(const ldns_rr *rr)
counts the number of labels of the ownername.
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_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.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
#define LDNS_SYNTAX_DATALEN
int ldns_rr_compare_wire(const ldns_buffer *rr1_buf, const ldns_buffer *rr2_buf)
compares the wireformat of two rrs, contained in the given buffers.
void ldns_rr_set_question(ldns_rr *rr, bool question)
sets the question flag in the rr structure.
void ldns_rr_list2canonical(const ldns_rr_list *rr_list)
converts each dname in each rr in a rr_list to its canonical form.
bool ldns_is_rrset(const ldns_rr_list *rr_list)
checks if an rr_list is a rrset.
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl)
sets the ttl in the rr structure.
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,...
bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to 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.
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.
int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs, up to the rdata.
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
ldns_rr_list * ldns_rr_list_cat_clone(const ldns_rr_list *left, const ldns_rr_list *right)
concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying).
bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, const 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_is_question(const ldns_rr *rr)
returns the question flag of an rr structure.
void ldns_rr_set_rd_count(ldns_rr *rr, size_t count)
sets the rd_count in the rr.
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_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class)
sets the class in the rr.
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_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_rr_list * ldns_rr_list_subtype_by_rdf(const ldns_rr_list *l, const ldns_rdf *r, size_t pos)
Return the rr_list which matches the rdf at position field.
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.
int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2)
compares two rr lists.
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs.
bool ldns_rr_list_cat(ldns_rr_list *left, const ldns_rr_list *right)
concatenates two ldns_rr_lists together.
bool ldns_rr_compare_ds(const ldns_rr *orr1, const ldns_rr *orr2)
returns true of the given rr's are equal.
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.
ldns_rr * ldns_rr_clone(const ldns_rr *rr)
clones a rr and all its data
ldns_rr_list * ldns_rr_list_clone(const ldns_rr_list *rrlist)
clones an rrlist.
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.
ldns_status ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str, const ldns_rdf *origin, ldns_rdf **prev)
creates an rr for the question section from a string, i.e.
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
ldns_rr * ldns_rr_new(void)
creates a new rr structure.
size_t ldns_rr_uncompressed_size(const ldns_rr *r)
calculates the uncompressed size of an RR.
ldns_rdf * ldns_rr_pop_rdf(ldns_rr *rr)
removes a rd_field member, it will be popped from the last position.
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_rr_type ldns_get_rr_type_by_name(const char *name)
retrieves a rrtype by looking up its name.
#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON
@ LDNS_RR_COMPRESS
compression is allowed
enum ldns_enum_rr_type ldns_rr_type
#define LDNS_RR_OVERHEAD
The bytes TTL, CLASS and length use up in an rr.
@ LDNS_RR_TYPE_MF
a mail forwarder (Obsolete - use MX)
@ LDNS_RR_TYPE_CERT
RFC2538.
@ LDNS_RR_TYPE_RP
RFC1183.
@ LDNS_RR_TYPE_KX
RFC2230.
@ LDNS_RR_TYPE_OPT
OPT record RFC 6891.
@ LDNS_RR_TYPE_RRSIG
DNSSEC.
@ LDNS_RR_TYPE_SINK
dnsind-kitchen-sink-02.txt
@ LDNS_RR_TYPE_A
a host address
@ LDNS_RR_TYPE_ISDN
RFC1183.
@ LDNS_RR_TYPE_MINFO
mailbox or mail list information
@ LDNS_RR_TYPE_GPOS
RFC1712.
@ LDNS_RR_TYPE_SOA
marks the start of a zone of authority
@ LDNS_RR_TYPE_SSHFP
SSH Key Fingerprint.
@ LDNS_RR_TYPE_X25
RFC1183.
@ LDNS_RR_TYPE_WKS
a well known service description
@ LDNS_RR_TYPE_PX
RFC2163.
@ LDNS_RR_TYPE_RT
RFC1183.
@ LDNS_RR_TYPE_DNAME
RFC2672.
@ LDNS_RR_TYPE_OPENPGPKEY
@ LDNS_RR_TYPE_AMTRELAY
draft-ietf-mboned-driad-amt-discovery
@ LDNS_RR_TYPE_DS
RFC4034, RFC3658.
@ LDNS_RR_TYPE_KEY
2535typecode
@ LDNS_RR_TYPE_NULL
a null RR (EXPERIMENTAL)
@ LDNS_RR_TYPE_NSEC3PARAM
@ LDNS_RR_TYPE_RKEY
draft-reid-dnsext-rkey
@ LDNS_RR_TYPE_NXT
2535typecode
@ LDNS_RR_TYPE_SIG
2535typecode
@ LDNS_RR_TYPE_CNAME
the canonical name for an alias
@ LDNS_RR_TYPE_TA
DNSSEC Trust Authorities.
@ LDNS_RR_TYPE_LOC
LOC record RFC1876.
@ LDNS_RR_TYPE_TXT
text strings
@ LDNS_RR_TYPE_PTR
a domain name pointer
@ LDNS_RR_TYPE_AAAA
ipv6 address
@ LDNS_RR_TYPE_MD
a mail destination (Obsolete - use MX)
@ LDNS_RR_TYPE_A6
RFC2874.
@ LDNS_RR_TYPE_NS
an authoritative name server
@ LDNS_RR_TYPE_MR
a mail rename domain name (EXPERIMENTAL)
@ LDNS_RR_TYPE_MB
a mailbox domain name (EXPERIMENTAL)
@ LDNS_RR_TYPE_NINFO
draft-reid-dnsext-zs
@ LDNS_RR_TYPE_TALINK
draft-ietf-dnsop-trust-history
@ LDNS_RR_TYPE_ATMA
http://www.jhsoft.com/rfc/af-saa-0069.000.rtf
@ LDNS_RR_TYPE_HINFO
host information
@ LDNS_RR_TYPE_EID
draft-ietf-nimrod-dns-01.txt
@ LDNS_RR_TYPE_AFSDB
RFC1183.
@ LDNS_RR_TYPE_NSAP
RFC1706.
@ LDNS_RR_TYPE_NAPTR
RFC2915.
@ LDNS_RR_TYPE_SRV
SRV record RFC2782.
@ LDNS_RR_TYPE_IPSECKEY
IPsec Key.
@ LDNS_RR_TYPE_APL
RFC3123.
@ LDNS_RR_TYPE_MX
mail exchange
@ LDNS_RR_TYPE_NIMLOC
draft-ietf-nimrod-dns-01.txt
@ LDNS_RR_TYPE_MG
a mail group member (EXPERIMENTAL)
@ LDNS_RR_TYPE_NSAP_PTR
RFC1348.
enum ldns_enum_rr_class ldns_rr_class
#define LDNS_MAX_DOMAINLEN
Maximum length of a complete dname.
@ LDNS_RR_CLASS_IN
the Internet
Structure to do a Schwartzian-like transformation, for instance when sorting.
void * transformed_object
implementation of buffers to ease operations
uint8_t * _data
The data contained in the buffer.
A general purpose lookup table.
Resource record data field.
Contains all information about resource record types.
uint8_t _maximum
Maximum number of rdata fields in the RRs of this type.
const char * _name
Textual name of the RR type.
ldns_rdf_type _variable
Special rdf types.
ldns_rr_type _type
Type of the RR that is described here.
uint8_t _minimum
Minimum number of rdata fields in the RRs of this type.
const ldns_rdf_type * _wireformat
Wireformat specification for the rr, i.e.
List or Set of Resource Records.
bool _rr_question
question rr [it would be nicer if thous is after _rd_count] ABI change: Fix this in next major releas...
ldns_rr_type _rr_type
the type of the RR.
ldns_rdf * _owner
Owner name, uncompressed.
ldns_rdf ** _rdata_fields
The array of rdata's.
uint32_t _ttl
Time to live
ldns_rr_class _rr_class
Class of the resource record.
size_t _rd_count
Number of data fields.
int ldns_hexstring_to_data(uint8_t *data, const char *str)
Converts a hex string to binary data.
ldns_lookup_table * ldns_lookup_by_name(ldns_lookup_table *table, const char *name)
#define INLINE
splint static inline workaround
#define LDNS_MALLOC(type)
Memory management macros.
#define LDNS_XMALLOC(type, count)
#define LDNS_XREALLOC(ptr, type, count)
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...