14 if(!new_rrs)
return NULL;
37 ldns_dnssec_rrs_free_internal(rrs, 0);
43 ldns_dnssec_rrs_free_internal(rrs, 1);
72 new_rrs->
rr = rrs->
rr;
86 fprintf(out,
"; <void>");
109 if(!new_rrsets)
return NULL;
111 new_rrsets->
type = 0;
122 ldns_dnssec_rrs_free_internal(rrsets->
rrs, deep);
125 ldns_dnssec_rrsets_free_internal(rrsets->
next, deep);
128 ldns_dnssec_rrs_free_internal(rrsets->
signatures, deep);
137 ldns_dnssec_rrsets_free_internal(rrsets, 0);
143 ldns_dnssec_rrsets_free_internal(rrsets, 1);
184 new_rrsets->
rrs->
rr = rr;
189 new_rrsets->
type = rr_type;
201 if (!rrsets || !rr) {
215 rrsets->
rrs->
rr = rr;
216 rrsets->
type = rr_type;
220 rrsets->
type = rr_type;
230 rrsets->
next = new_rrsets;
236 new_rrsets->
rrs = rrsets->
rrs;
242 rrsets->
rrs->
rr = rr;
249 rrsets->
type = rr_type;
250 rrsets->
next = new_rrsets;
265 rrsets->
rrs->
rr = rr;
281 fprintf(out,
"; <void>\n");
294 if (follow && rrsets->
next) {
296 rrsets->
next, follow, show_soa);
308 rrsets, follow, show_soa);
375 ldns_dnssec_rrsets_free_internal(name->
rrsets, deep);
377 if (name->
nsec && deep) {
395 ldns_dnssec_name_free_internal(name, 0);
401 ldns_dnssec_name_free_internal(name, 1);
426 if (rrset && dname) {
472 bool hashed_name =
false;
537 if (result->
type == type) {
540 result = result->
next;
553 if (!zone || !dname) {
574 name->
rrsets,
true, show_soa);
576 fprintf(out,
";; Empty nonterminal: ");
588 fprintf(out,
"; <void>\n");
617 if(!zone)
return NULL;
637 #define FASTER_DNSSEC_ZONE_NEW_FRM_FP 1
659 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
664 uint32_t my_ttl = ttl;
667 if (!newzone || !todo_nsec3s || !todo_nsec3_rrsigs )
goto error;
674 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
694 if (rr_is_rrsig_covering(cur_rr,
753 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
900 cur_node->
data = cur_name;
908 fprintf(stderr,
"error adding rr: ");
914 zone->
soa = cur_name;
952 fprintf(out,
";; Zone: ");
955 fprintf(out,
"\n;\n");
988 uint16_t
i, cur_label_count, next_label_count;
989 uint16_t soa_label_count = 0;
1015 if (! cur_node->
data || ! next_node->
data) {
1030 for (i = 1; i < next_label_count - soa_label_count; i++) {
1031 lpos = (
int)cur_label_count - (
int)next_label_count + (
int)i;
1049 if (!new_name->
name) {
1059 new_node->
key = new_name->
name;
1060 new_node->
data = new_name;
1071 cur_node = next_node;
ldns_rr_list * ldns_rr_list_new()
creates a new rr_list structure.
void ldns_dnssec_name_node_free(ldns_rbnode_t *node, void *arg)
void ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs)
Frees the list of rrs, and the individual ldns_rr records contained in the list.
ldns_rr * ldns_zone_soa(const ldns_zone *z)
Return the soa record of a zone.
ldns_dnssec_zone * ldns_dnssec_zone_new()
Creates a new dnssec_zone structure.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
void ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone)
Frees the given zone structure, and its rbtree of dnssec_names Individual ldns_rr RRs within those na...
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
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_dnssec_zone_new_frm_fp_l(ldns_dnssec_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)), int *line_nr)
void ldns_dnssec_rrsets_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_rrsets *rrsets, bool follow)
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...
ldns_rbnode_t * ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data)
Insert data into the tree.
ldns_rr * ldns_dnssec_name_nsec(ldns_dnssec_name *rrset)
enum ldns_enum_rr_class ldns_rr_class
bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
List or Set of Resource Records.
signed char name_alloced
Usually, the name is a pointer to the owner name of the first rr for this name, but sometimes there i...
bool ldns_dnssec_name_is_glue(ldns_dnssec_name *name)
Returns if dnssec_name structure is marked as glue.
ldns_dnssec_rrsets * rrsets
The rrsets for this name.
ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)), int *line_nr)
#define LDNS_CALLOC(type, count)
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
void ldns_dnssec_zone_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_zone *zone)
Prints the complete zone to the given file descriptor.
ldns_rdf * ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name)
Calculates the hashed name using the parameters of the given NSEC3 RR.
ldns_dnssec_name * ldns_dnssec_name_new()
Create a new data structure for a dnssec name.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
void ldns_dnssec_name_set_nsec(ldns_dnssec_name *rrset, ldns_rr *nsec)
Sets the NSEC(3) RR of the given dnssec_name structure.
ldns_rbnode_t * ldns_dnssec_zone_find_nsec3_original(ldns_dnssec_zone *zone, ldns_rr *rr)
Structure containing a dnssec zone.
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
ldns_rr_type ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets)
Returns the rr type of the rrset (that is head of the given list)
ldns_status ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, ldns_rr_type type)
Sets the RR type of the rrset (that is head of the given list)
const ldns_output_format * ldns_output_format_default
The default output format record.
#define INLINE
splint static inline workaround
const void * data
pointer to data
ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, ldns_rr *rr)
Inserts the given rr at the right place in the current dnssec_name No checking is done whether the na...
ldns_rbtree_t * names
tree of ldns_dnssec_names
Including this file will include all ldns files, and define some lookup tables.
marks the start of a zone of authority
void ldns_dnssec_name_free(ldns_dnssec_name *name)
Frees the name structure and its rrs and rrsets.
ldns_dnssec_rrsets * ldns_dnssec_rrsets_new()
Creates a new list (entry) of RRsets.
void ldns_dnssec_name_set_name(ldns_dnssec_name *rrset, ldns_rdf *dname)
Sets the domain name of the given dnssec_name structure.
ldns_rdf * ldns_dname_clone_from(const ldns_rdf *d, uint16_t n)
Clones the given dname from the nth label on.
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_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_rr *rr)
Prints the data in the resource record to the given file stream (in presentation format) ...
ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
Adds the given RR to the zone.
void ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_rbtree_t *tree, bool print_soa)
The rbnode_t struct definition.
void ldns_dnssec_name_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_name *name)
Prints the RRs in the dnssec name structure to the given file descriptor.
ldns_rbtree_t * ldns_rbtree_create(int(*cmpf)(const void *, const void *))
Create new tree (malloced) with given key compare function.
bool ldns_dnssec_zone_is_nsec3_optout(ldns_dnssec_zone *zone)
If a NSEC3PARAM is available in the apex, walks the zone and returns true on the first optout nsec3...
signed char is_glue
Unlike what the name is_glue suggests, this field is set to true by ldns_dnssec_zone_mark_glue() or l...
void ldns_dnssec_rrs_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_rrs *rrs)
Prints the given rrs to the file descriptor.
void ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa)
ldns_dnssec_rrs * signatures
int ldns_dname_compare_v(const void *a, const void *b)
void ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets)
Frees the list of rrsets and their rrs, and the ldns_rr records in the sets.
bool ldns_nsec3_optout(const ldns_rr *nsec3_rr)
Returns true if the opt-out flag has been set in the given NSEC3 RR.
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs.
ldns_rbnode_t * ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key)
Find key in tree.
definition for tree struct
void ldns_rdf_print(FILE *output, const ldns_rdf *rdf)
Prints the data in the rdata field to the given file stream (in presentation format) ...
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
ldns_rdf * ldns_rr_rrsig_typecovered(const ldns_rr *r)
returns the type covered of a LDNS_RR_TYPE_RRSIG rr
ldns_status ldns_dnssec_zone_new_frm_fp(ldns_dnssec_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)))
ldns_dnssec_name * soa
points to the name containing the SOA RR
void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs)
Prints the given rrs to the file descriptor.
enum ldns_enum_status ldns_status
#define LDNS_MALLOC(type)
Memory management macros.
ldns_dnssec_rrsets * ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, ldns_rr_type type)
Find the RRset with the given type in within this name structure.
ldns_dnssec_rrs * ldns_dnssec_rrs_new()
Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs.
ldns_rdf * hashed_name
pointer to store the hashed name (only used when in an NSEC3 zone
void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name)
Prints the RRs in the dnssec name structure to the given file descriptor.
void ldns_dnssec_zone_free(ldns_dnssec_zone *zone)
Frees the given zone structure, and its rbtree of dnssec_names Individual ldns_rr RRs within those na...
void ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs)
Frees the list of rrs, but not the individual ldns_rr records contained in the list.
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_print(FILE *output, const ldns_rr *rr)
Prints the data in the resource record to the given file stream (in presentation format) ...
void ldns_dnssec_rrsets_print_soa(FILE *out, ldns_dnssec_rrsets *rrsets, bool follow, bool show_soa)
void ldns_dnssec_rrsets_print_soa_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_rrsets *rrsets, bool follow, bool show_soa)
void ldns_dnssec_rrsets_print(FILE *out, ldns_dnssec_rrsets *rrsets, bool follow)
#define LDNS_RBTREE_NULL
The nullpointer, points to empty node.
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z)
Get a list of a zone's content.
ldns_dnssec_name * ldns_dnssec_name_new_frm_rr(ldns_rr *rr)
Create a new data structure for a dnssec name for the given RR.
const void * key
pointer to sorting key
void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone)
Prints the complete zone to the given file descriptor.
ldns_status ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr)
Add an ldns_rr to the corresponding RRset in the given list of RRsets.
Resource record data field.
void ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets)
Frees the list of rrsets and their rrs, but not the ldns_rr records in the sets.
ldns_dnssec_rrsets * next
void ldns_dnssec_name_node_deep_free(ldns_rbnode_t *node, void *arg)
void ldns_traverse_postorder(ldns_rbtree_t *tree, void(*func)(ldns_rbnode_t *, void *), void *arg)
Call function for all elements in the redblack tree, such that leaf elements are called before parent...
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
enum ldns_enum_rr_type ldns_rr_type
#define LDNS_COMMENT_LAYOUT
Print mark up.
void ldns_dnssec_name_deep_free(ldns_dnssec_name *name)
Frees the name structure and its rrs and rrsets.
ldns_rbnode_t * ldns_rbtree_first(ldns_rbtree_t *rbtree)
Returns first (smallest) node in the tree.
void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa)
ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos)
look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label...
ldns_dnssec_rrsets * ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, ldns_rdf *dname, ldns_rr_type type)
Find the RRset with the given name and type in the zone.
void ldns_zone_free(ldns_zone *zone)
Frees the allocated memory for the zone, and the rr_list structure in it.
ldns_dnssec_rrs * nsec_signatures
signatures for the NSEC record
ldns_rbnode_t * ldns_rbtree_next(ldns_rbnode_t *node)
Returns next larger node in the tree.
ldns_rdf * ldns_dnssec_name_name(ldns_dnssec_name *name)
Returns the domain name of the given dnssec_name structure.
ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
Adds explicit dnssec_name structures for the empty nonterminals in this zone.
int ldns_dnssec_name_cmp(const void *a, const void *b)
Compares the domain names of the two arguments in their canonical ordening.
ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
Adds an RR to the list of RRs.
void ldns_dnssec_name_print_soa_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_name *name, bool show_soa)
ldns_dnssec_rrsets * ldns_dnssec_rrsets_new_frm_rr(ldns_rr *rr)
ldns_rr * nsec
NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3)
ldns_rdf * name
pointer to a dname containing the name.