Lines Matching refs:hints

2  * iterator/iter_hints.c - iterative resolver module stub and root hints.
40 * Keep track of stub and root hints, and read those from config.
56 struct iter_hints* hints = (struct iter_hints*)calloc(1,
58 if(!hints)
60 lock_rw_init(&hints->lock);
61 lock_protect(&hints->lock, &hints->tree, sizeof(hints->tree));
62 return hints;
78 static void hints_del_tree(struct iter_hints* hints)
80 traverse_postorder(&hints->tree, &delhintnode, NULL);
84 hints_delete(struct iter_hints* hints)
86 if(!hints)
88 lock_rw_destroy(&hints->lock);
89 hints_del_tree(hints);
90 free(hints);
93 /** add hint to delegation hints */
116 /** obtain compiletime provided root hints */
171 hints_insert(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
182 if(!name_tree_insert(&hints->tree, &node->node, dp->name, dp->namelen,
186 log_err("second hints for zone %s ignored.", buf);
280 read_stubs(struct iter_hints* hints, struct config_file* cfg)
302 if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, !s->isprime))
308 /** read root hints from file */
310 read_root_hints(struct iter_hints* hints, char* fname)
320 log_err("could not read root hints %s: %s",
326 log_err("out of memory reading root hints");
330 verbose(VERB_QUERY, "Reading root hints from %s", fname);
340 log_err("reading root hints %s %d:%d: %s", fname,
351 log_err("out of memory reading root hints");
375 log_err("out of memory reading root hints");
392 log_err("out of memory reading root hints");
399 log_warn("root hints %s:%d skipping type %s",
405 log_warn("root hints %s: no NS content", fname);
410 if(!hints_insert(hints, c, dp, 0)) {
421 /** read root hints list */
423 read_root_hints_list(struct iter_hints* hints, struct config_file* cfg)
434 if(!read_root_hints(hints, f))
442 hints_apply_cfg(struct iter_hints* hints, struct config_file* cfg)
445 lock_rw_wrlock(&hints->lock);
446 hints_del_tree(hints);
447 name_tree_init(&hints->tree);
449 /* read root hints */
450 if(!read_root_hints_list(hints, cfg)) {
451 lock_rw_unlock(&hints->lock);
455 /* read stub hints */
456 if(!read_stubs(hints, cfg)) {
457 lock_rw_unlock(&hints->lock);
461 /* use fallback compiletime root hints */
462 if(!hints_find_root(hints, LDNS_RR_CLASS_IN, nolock)) {
465 verbose(VERB_ALGO, "no config, using builtin root hints.");
467 lock_rw_unlock(&hints->lock);
470 if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, 0)) {
471 lock_rw_unlock(&hints->lock);
476 name_tree_init_parents(&hints->tree);
477 lock_rw_unlock(&hints->lock);
482 hints_find(struct iter_hints* hints, uint8_t* qname, uint16_t qclass,
490 if(!nolock) { lock_rw_rdlock(&hints->lock); }
491 stub = (struct iter_hints_stub*)name_tree_find(&hints->tree,
494 if(!has_dp && !nolock) { lock_rw_unlock(&hints->lock); }
499 hints_find_root(struct iter_hints* hints, uint16_t qclass, int nolock)
502 return hints_find(hints, &rootlab, qclass, nolock);
506 hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
516 if(!nolock) { lock_rw_rdlock(&hints->lock); }
517 r = (struct iter_hints_stub*)name_tree_lookup(&hints->tree, qname,
520 if(!nolock) { lock_rw_unlock(&hints->lock); }
528 if(!nolock) { lock_rw_unlock(&hints->lock); }
545 if(!nolock) { lock_rw_unlock(&hints->lock); }
549 int hints_next_root(struct iter_hints* hints, uint16_t* qclass, int nolock)
553 if(!nolock) { lock_rw_rdlock(&hints->lock); }
554 ret = name_tree_next_root(&hints->tree, qclass);
555 if(!nolock) { lock_rw_unlock(&hints->lock); }
560 hints_get_mem(struct iter_hints* hints)
564 if(!hints) return 0;
565 lock_rw_rdlock(&hints->lock);
566 s = sizeof(*hints);
567 RBTREE_FOR(p, struct iter_hints_stub*, &hints->tree) {
570 lock_rw_unlock(&hints->lock);
575 hints_add_stub(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
580 if(!nolock) { lock_rw_wrlock(&hints->lock); }
581 if((z=(struct iter_hints_stub*)name_tree_find(&hints->tree,
583 (void)rbtree_delete(&hints->tree, &z->node);
586 if(!hints_insert(hints, c, dp, noprime)) {
587 if(!nolock) { lock_rw_unlock(&hints->lock); }
590 name_tree_init_parents(&hints->tree);
591 if(!nolock) { lock_rw_unlock(&hints->lock); }
596 hints_delete_stub(struct iter_hints* hints, uint16_t c, uint8_t* nm,
603 if(!nolock) { lock_rw_wrlock(&hints->lock); }
604 if(!(z=(struct iter_hints_stub*)name_tree_find(&hints->tree,
606 if(!nolock) { lock_rw_unlock(&hints->lock); }
609 (void)rbtree_delete(&hints->tree, &z->node);
611 name_tree_init_parents(&hints->tree);
612 if(!nolock) { lock_rw_unlock(&hints->lock); }