 |
ldns
1.7.0
|
Go to the documentation of this file.
14 if(!new_rrs)
return NULL;
37 ldns_dnssec_rrs_free_internal(rrs, 0);
43 ldns_dnssec_rrs_free_internal(rrs, 1);
70 new_rrs->
rr = rrs->
rr;
85 fprintf(out,
"; <void>");
108 if(!new_rrsets)
return NULL;
109 new_rrsets->
rrs = NULL;
110 new_rrsets->
type = 0;
112 new_rrsets->
next = NULL;
121 ldns_dnssec_rrs_free_internal(rrsets->
rrs, deep);
124 ldns_dnssec_rrsets_free_internal(rrsets->
next, deep);
127 ldns_dnssec_rrs_free_internal(rrsets->
signatures, deep);
136 ldns_dnssec_rrsets_free_internal(rrsets, 0);
142 ldns_dnssec_rrsets_free_internal(rrsets, 1);
167 ldns_dnssec_rrsets_new_frm_rr(
ldns_rr *rr)
183 new_rrsets->
rrs->
rr = rr;
188 new_rrsets->
type = rr_type;
200 if (!rrsets || !rr) {
214 rrsets->
rrs->
rr = rr;
215 rrsets->
type = rr_type;
219 rrsets->
type = rr_type;
228 new_rrsets = ldns_dnssec_rrsets_new_frm_rr(rr);
229 rrsets->
next = new_rrsets;
235 new_rrsets->
rrs = rrsets->
rrs;
241 rrsets->
rrs->
rr = rr;
248 rrsets->
type = rr_type;
249 rrsets->
next = new_rrsets;
264 rrsets->
rrs->
rr = rr;
280 fprintf(out,
"; <void>\n");
293 if (follow && rrsets->
next) {
294 ldns_dnssec_rrsets_print_soa_fmt(out, fmt,
295 rrsets->
next, follow, show_soa);
306 ldns_dnssec_rrsets_print_soa_fmt(out, fmt, rrsets, follow,
true);
364 ldns_dnssec_rrsets_free_internal(name->
rrsets, deep);
366 if (name->
nsec && deep) {
384 ldns_dnssec_name_free_internal(name, 0);
390 ldns_dnssec_name_free_internal(name, 1);
415 if (rrset && dname) {
498 if (result->
type == type) {
501 result = result->
next;
514 if (!zone || !dname || !zone->
names) {
534 ldns_dnssec_rrsets_print_soa_fmt(out, fmt,
535 name->
rrsets,
true, show_soa);
537 fprintf(out,
";; Empty nonterminal: ");
549 fprintf(out,
"; <void>\n");
558 ldns_dnssec_name_print_soa_fmt(out, fmt, name,
true);
572 if(!zone)
return NULL;
594 #define FASTER_DNSSEC_ZONE_NEW_FRM_FP 1
597 ldns_dnssec_zone_add_empty_nonterminals_nsec3(
601 ldns_todo_nsec3_ents_node_free(
ldns_rbnode_t *node,
void *arg) {
636 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
639 uint32_t my_ttl = ttl;
644 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
649 if (!newzone || !todo_nsec3s || !todo_nsec3_rrsigs ) {
664 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
686 if (rr_is_rrsig_covering(cur_rr,
727 new_node->
data = cur_rr;
736 if (todo_nsec3_ents.
count > 0)
737 (void) ldns_dnssec_zone_add_empty_nonterminals_nsec3(
738 newzone, &todo_nsec3_ents);
752 #ifdef FASTER_DNSSEC_ZONE_NEW_FRM_FP
759 ldns_todo_nsec3_ents_node_free, NULL);
789 ldns_dnssec_name_node_deep_free(
ldns_rbnode_t *node,
void *arg) {
802 ldns_dnssec_name_node_free,
817 ldns_dnssec_name_node_deep_free,
836 ldns_hashed_names_node_free(
ldns_rbnode_t *node,
void *arg) {
842 ldns_dnssec_zone_hashed_names_from_nsec3(
848 assert(zone != NULL);
849 assert(nsec3rr != NULL);
853 ldns_hashed_names_node_free, NULL);
870 ldns_dnssec_name_make_hashed_name(zone, current_name, nsec3rr);
881 assert(name != NULL);
886 ldns_dnssec_zone_hashed_names_from_nsec3(zone, nsec3rr);
888 }
else if (! nsec3rr) {
897 new_node->
data = name;
912 if (hashed_name == NULL) {
917 ldns_dnssec_zone_hashed_names_from_nsec3(zone, rr);
950 cur_node = ldns_dnssec_zone_find_nsec3_original(zone, rr);
967 cur_node->
data = cur_name;
969 ldns_dnssec_name_make_hashed_name(zone, cur_name, NULL);
975 zone->
soa = cur_name;
991 ldns_dnssec_name_print_soa_fmt(out, fmt, name, print_soa);
1012 fprintf(out,
";; Zone: ");
1015 fprintf(out,
"\n;\n");
1023 fprintf(out,
";\n");
1028 zone->
names,
false);
1040 ldns_dnssec_zone_add_empty_nonterminals_nsec3(
1049 uint16_t i, cur_label_count, next_label_count;
1050 uint16_t soa_label_count = 0;
1076 if (! cur_node->
data || ! next_node->
data) {
1091 for (i = 1; i < next_label_count - soa_label_count; i++) {
1092 lpos = (int)cur_label_count - (
int)next_label_count + (int)i;
1114 if (!(ent_hashed_name =
1131 new_name->
name = ent_name;
1132 if (!new_name->
name) {
1142 new_node->
key = new_name->
name;
1143 new_node->
data = new_name;
1145 ldns_dnssec_name_make_hashed_name(
1146 zone, new_name, NULL);
1159 cur_node = next_node;
1170 return ldns_dnssec_zone_add_empty_nonterminals_nsec3(zone, NULL);
@ LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL
List or Set of Resource Records.
enum ldns_enum_rr_class ldns_rr_class
ldns_rr * nsec
NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3)
definition for tree struct
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.
ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)), int *line_nr)
ldns_dnssec_zone * ldns_dnssec_zone_new(void)
Creates a new dnssec_zone structure.
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.
bool ldns_dnssec_name_is_glue(const ldns_dnssec_name *name)
Returns if dnssec_name structure is marked as glue.
ldns_rr * _nsec3params
points to the first added NSEC3 rr whose parameters will be assumed for all subsequent NSEC3 rr's and...
#define LDNS_COMMENT_LAYOUT
Print mark up.
ldns_rdf * ldns_dname_clone_from(const ldns_rdf *d, uint16_t n)
Clones the given dname from the nth label on.
@ LDNS_STATUS_SYNTAX_ORIGIN
bool ldns_dnssec_zone_is_nsec3_optout(const ldns_dnssec_zone *zone)
If a NSEC3PARAM is available in the apex, walks the zone and returns true on the first optout nsec3.
ldns_rbtree_t * ldns_rbtree_create(int(*cmpf)(const void *, const void *))
Create new tree (malloced) with given key compare function.
ldns_dnssec_name * ldns_dnssec_name_new(void)
Create a new data structure for a dnssec name.
ldns_rr_type ldns_dnssec_rrsets_type(const ldns_dnssec_rrsets *rrsets)
Returns the rr type of the rrset (that is head of the given list)
ldns_dnssec_rrs * ldns_dnssec_rrs_new(void)
Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs.
ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
Adds the given RR to the zone.
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_status ldns_dnssec_zone_new_frm_fp(ldns_dnssec_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)))
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.
void ldns_dnssec_zone_names_print(FILE *out, const ldns_rbtree_t *tree, bool print_soa)
void ldns_dnssec_name_print(FILE *out, const ldns_dnssec_name *name)
Prints the RRs in the dnssec name structure to the given file descriptor.
ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
Adds an RR to the list of RRs.
bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
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.
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.
ldns_dnssec_rrsets * ldns_dnssec_rrsets_new(void)
Creates a new list (entry) of RRsets.
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z)
Get a list of a zone's content.
const void * key
pointer to sorting key
ldns_rbnode_t * ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key)
Find key in tree.
@ LDNS_STATUS_SYNTAX_INCLUDE
@ LDNS_RR_TYPE_NSEC3PARAM
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
compares two rrs.
void ldns_dnssec_rrsets_print(FILE *out, const ldns_dnssec_rrsets *rrsets, bool follow)
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_dnssec_rrsets * rrsets
The rrsets for this name.
ldns_dnssec_rrs * nsec_signatures
signatures for the NSEC record
ldns_rdf * name
pointer to a dname containing the name.
@ LDNS_STATUS_SYNTAX_EMPTY
Structure containing a dnssec zone.
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.
ldns_status ldns_dnssec_zone_new_frm_fp_l(ldns_dnssec_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c __attribute__((unused)), int *line_nr)
ldns_dnssec_rrs * signatures
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...
const ldns_output_format * ldns_output_format_default
The default output format record.
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.
#define LDNS_CALLOC(type, count)
void ldns_dnssec_rrs_print_fmt(FILE *out, const ldns_output_format *fmt, const ldns_dnssec_rrs *rrs)
Prints the given rrs to the file descriptor.
void ldns_dnssec_rrs_print(FILE *out, const ldns_dnssec_rrs *rrs)
Prints the given rrs to the file descriptor.
enum ldns_enum_rr_type ldns_rr_type
ldns_rdf * ldns_dnssec_name_name(const ldns_dnssec_name *name)
Returns the domain name of the given dnssec_name structure.
ldns_rdf * hashed_name
pointer to store the hashed name (only used when in an NSEC3 zone
@ LDNS_RR_TYPE_SOA
marks the start of a zone of authority
void ldns_dnssec_name_deep_free(ldns_dnssec_name *name)
Frees the name structure and its rrs and rrsets.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
#define LDNS_MALLOC(type)
Memory management macros.
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_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
Adds explicit dnssec_name structures for the empty nonterminals in this zone.
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...
enum ldns_enum_status ldns_status
bool ldns_nsec3_optout(const ldns_rr *nsec3_rr)
Returns true if the opt-out flag has been set in the given NSEC3 RR.
ldns_rbtree_t * names
tree of ldns_dnssec_names
#define INLINE
splint static inline workaround
ldns_rr * ldns_zone_soa(const ldns_zone *z)
Return the soa record of a zone.
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_name_free(ldns_dnssec_name *name)
Frees the name structure and its rrs and rrsets.
Resource record data field.
size_t count
The number of the nodes in the tree.
void ldns_dnssec_name_set_name(ldns_dnssec_name *rrset, ldns_rdf *dname)
Sets the domain name of the given dnssec_name structure.
int ldns_dname_compare_v(const void *a, const void *b)
Given in dnssec_zone.c, also used in dnssec_sign.c:w.
int ldns_dnssec_name_cmp(const void *a, const void *b)
Compares the domain names of the two arguments in their canonical ordening.
void ldns_dnssec_zone_names_print_fmt(FILE *out, const ldns_output_format *fmt, const ldns_rbtree_t *tree, bool print_soa)
void ldns_zone_free(ldns_zone *zone)
Frees the allocated memory for the zone, and the rr_list structure in it.
void ldns_dnssec_rrsets_print_fmt(FILE *out, const ldns_output_format *fmt, const ldns_dnssec_rrsets *rrsets, bool follow)
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_rdf * ldns_rr_rrsig_typecovered(const ldns_rr *r)
returns the type covered of a LDNS_RR_TYPE_RRSIG rr
@ LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
ldns_rbtree_t * hashed_names
tree of ldns_dnssec_names by nsec3 hashes (when applicible)
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...
ldns_rr_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_dnssec_rrsets * next
@ LDNS_RR_TYPE_RRSIG
DNSSEC.
void ldns_rbtree_init(ldns_rbtree_t *rbtree, int(*cmpf)(const void *, const void *))
Init a new tree (malloced by caller) with given key compare function.
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.
const void * data
pointer to data
ldns_dnssec_rrsets * ldns_dnssec_zone_find_rrset(const ldns_dnssec_zone *zone, const ldns_rdf *dname, ldns_rr_type type)
Find the RRset with the given name and type in the zone.
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...
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_dnssec_rrsets * ldns_dnssec_name_find_rrset(const ldns_dnssec_name *name, ldns_rr_type type)
Find the RRset with the given type in within this name structure.
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_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
#define LDNS_RBTREE_NULL
The nullpointer, points to empty node.
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
ldns_rbnode_t * ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data)
Insert data into the tree.
void ldns_dnssec_zone_print(FILE *out, const ldns_dnssec_zone *zone)
Prints the complete zone to the given file descriptor.
The rbnode_t struct definition.
void ldns_dnssec_name_print_fmt(FILE *out, const ldns_output_format *fmt, const ldns_dnssec_name *name)
Prints the RRs in the dnssec name structure to the given file descriptor.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
ldns_dnssec_name * soa
points to the name containing the SOA RR
ldns_rbnode_t * ldns_rbtree_next(ldns_rbnode_t *node)
Returns next larger node in the tree.
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)
ldns_rbnode_t * ldns_rbtree_first(const ldns_rbtree_t *rbtree)
Returns first (smallest) node in the tree.
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_dnssec_zone_print_fmt(FILE *out, const ldns_output_format *fmt, const 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, const ldns_rdf *name)
Calculates the hashed name using the parameters of the given NSEC3 RR.
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.