#include "config.h"
#include "iterator/iter_hints.h"
#include "iterator/iter_delegpt.h"
#include "util/log.h"
#include "util/config_file.h"
#include "util/net_help.h"
#include "util/data/dname.h"
#include "sldns/rrdef.h"
#include "sldns/str2wire.h"
#include "sldns/wire2str.h"
Functions | |
struct iter_hints * | hints_create (void) |
Create hints. More... | |
static void | hints_stub_free (struct iter_hints_stub *s) |
static void | delhintnode (rbnode_type *n, void *ATTR_UNUSED(arg)) |
static void | hints_del_tree (struct iter_hints *hints) |
void | hints_delete (struct iter_hints *hints) |
Delete hints. More... | |
static int | ah (struct delegpt *dp, const char *sv, const char *ip) |
add hint to delegation hints | |
static struct delegpt * | compile_time_root_prime (int do_ip4, int do_ip6) |
obtain compiletime provided root hints | |
static int | hints_insert (struct iter_hints *hints, uint16_t c, struct delegpt *dp, int noprime) |
insert new hint info into hint structure | |
static struct delegpt * | read_stubs_name (struct config_stub *s) |
set stub name | |
static int | read_stubs_host (struct config_stub *s, struct delegpt *dp) |
set stub host names | |
static int | read_stubs_addr (struct config_stub *s, struct delegpt *dp) |
set stub server addresses | |
static int | read_stubs (struct iter_hints *hints, struct config_file *cfg) |
read stubs config | |
static int | read_root_hints (struct iter_hints *hints, char *fname) |
read root hints from file | |
static int | read_root_hints_list (struct iter_hints *hints, struct config_file *cfg) |
read root hints list | |
int | hints_apply_cfg (struct iter_hints *hints, struct config_file *cfg) |
Process hints config. More... | |
struct delegpt * | hints_lookup_root (struct iter_hints *hints, uint16_t qclass) |
Find root hints for the given class. More... | |
struct iter_hints_stub * | hints_lookup_stub (struct iter_hints *hints, uint8_t *qname, uint16_t qclass, struct delegpt *cache_dp) |
Given a qname/qclass combination, and the delegation point from the cache for this qname/qclass, determine if this combination indicates that a stub hint exists and must be primed. More... | |
int | hints_next_root (struct iter_hints *hints, uint16_t *qclass) |
Find next root hints (to cycle through all root hints). More... | |
size_t | hints_get_mem (struct iter_hints *hints) |
Get memory in use by hints. More... | |
int | hints_add_stub (struct iter_hints *hints, uint16_t c, struct delegpt *dp, int noprime) |
Add stub to hints structure. More... | |
void | hints_delete_stub (struct iter_hints *hints, uint16_t c, uint8_t *nm) |
Remove stub from hints structure. More... | |
This file contains functions to assist the iterator module. Keep track of stub and root hints, and read those from config.
struct iter_hints* hints_create | ( | void | ) |
Create hints.
Referenced by check_hints(), and libworker_setup().
void hints_delete | ( | struct iter_hints * | hints | ) |
Delete hints.
hints | to delete. |
Referenced by libworker_delete_env(), libworker_setup(), and worker_delete().
int hints_apply_cfg | ( | struct iter_hints * | hints, |
struct config_file * | cfg | ||
) |
Process hints config.
Sets default values for root hints if no config.
hints | where to store. |
cfg | config options. |
Referenced by check_hints(), and libworker_setup().
struct delegpt* hints_lookup_root | ( | struct iter_hints * | hints, |
uint16_t | qclass | ||
) |
Find root hints for the given class.
hints | hint storage. |
qclass | class for which root hints are requested. host order. |
References iter_hints_stub::dp, name_tree_find(), and iter_hints::tree.
Referenced by prime_root().
struct iter_hints_stub* hints_lookup_stub | ( | struct iter_hints * | hints, |
uint8_t * | qname, | ||
uint16_t | qclass, | ||
struct delegpt * | dp | ||
) |
Given a qname/qclass combination, and the delegation point from the cache for this qname/qclass, determine if this combination indicates that a stub hint exists and must be primed.
hints | hint storage. |
qname | The qname that generated the delegation point. |
qclass | The qclass that generated the delegation point. |
dp | The cache generated delegation point. |
References dname_count_size_labels(), dname_strict_subdomain(), iter_hints_stub::dp, delegpt::name, name_tree_lookup(), delegpt::namelabs, iter_hints_stub::noprime, query_dname_compare(), and iter_hints::tree.
Referenced by iter_stub_fwd_no_cache(), and prime_stub().
int hints_next_root | ( | struct iter_hints * | hints, |
uint16_t * | qclass | ||
) |
Find next root hints (to cycle through all root hints).
hints | hint storage |
qclass | class for which root hints are sought. 0 means give the first available root hints class. x means, give class x or a higher class if any. returns the found class in this variable. |
References name_tree_next_root(), and iter_hints::tree.
Referenced by iter_get_next_root().
size_t hints_get_mem | ( | struct iter_hints * | hints | ) |
Get memory in use by hints.
hints | hint storage. |
References delegpt_get_mem(), iter_hints_stub::dp, RBTREE_FOR, and iter_hints::tree.
int hints_add_stub | ( | struct iter_hints * | hints, |
uint16_t | c, | ||
struct delegpt * | dp, | ||
int | noprime | ||
) |
Add stub to hints structure.
For external use since it recalcs the tree parents.
hints | the hints data structure |
c | class of zone |
dp | delegation point with name and target nameservers for new hints stub. malloced. |
noprime | set noprime option to true or false on new hint stub. |
References iter_hints_stub::dp, delegpt::name, name_tree_find(), delegpt::namelabs, delegpt::namelen, iter_hints_stub::node, rbtree_delete(), and iter_hints::tree.
void hints_delete_stub | ( | struct iter_hints * | hints, |
uint16_t | c, | ||
uint8_t * | nm | ||
) |
Remove stub from hints structure.
For external use since it recalcs the tree parents.
hints | the hints data structure |
c | class of stub zone |
nm | name of stub zone (in uncompressed wireformat). |
References dname_count_size_labels(), name_tree_find(), iter_hints_stub::node, rbtree_delete(), and iter_hints::tree.