This file contains functions to assist the iterator module. More...
#include "util/rbtree.h"Data Structures | |
| struct | iter_forwards |
| Iterator forward zones structure. More... | |
| struct | iter_forward_zone |
| Iterator forward servers for a particular zone. More... | |
Functions | |
| struct iter_forwards * | forwards_create (void) |
| Create forwards. | |
| void | forwards_delete (struct iter_forwards *fwd) |
| Delete forwards. | |
| int | forwards_apply_cfg (struct iter_forwards *fwd, struct config_file *cfg) |
| Process forwards config. | |
| struct delegpt * | forwards_lookup (struct iter_forwards *fwd, uint8_t *qname, uint16_t qclass) |
| Find forward zone information For this qname/qclass find forward zone information, returns delegation point with server names and addresses, or NULL if no forwarding is needed. | |
| struct delegpt * | forwards_lookup_root (struct iter_forwards *fwd, uint16_t qclass) |
| Same as forwards_lookup, but for the root only. | |
| int | forwards_next_root (struct iter_forwards *fwd, uint16_t *qclass) |
| Find next root item in forwards lookup tree. | |
| size_t | forwards_get_mem (struct iter_forwards *fwd) |
| Get memory in use by forward storage. | |
| int | fwd_cmp (const void *k1, const void *k2) |
| compare two fwd entries | |
| int | forwards_add_zone (struct iter_forwards *fwd, uint16_t c, struct delegpt *dp) |
| Add zone to forward structure. | |
| void | forwards_delete_zone (struct iter_forwards *fwd, uint16_t c, uint8_t *nm) |
| Remove zone from forward structure. | |
This file contains functions to assist the iterator module.
Keep track of forward zones, and read those from config.
| struct iter_forwards* forwards_create | ( | void | ) | [read] |
Create forwards.
References iter_forwards::region, regional_create(), and forwards_delete().
Referenced by worker_init(), libworker_setup(), and check_fwd().
| void forwards_delete | ( | struct iter_forwards * | fwd | ) |
Delete forwards.
| fwd,: | to delete. |
References regional_destroy(), iter_forwards::region, and iter_forwards::tree.
Referenced by worker_delete(), forwards_create(), libworker_delete(), libworker_setup(), and check_fwd().
| int forwards_apply_cfg | ( | struct iter_forwards * | fwd, |
| struct config_file * | cfg | ||
| ) |
Process forwards config.
| fwd,: | where to store. |
| cfg,: | config options. |
References iter_forwards::tree, regional_free_all(), iter_forwards::region, rbtree_create(), fwd_cmp(), read_forwards(), make_stub_holes(), and fwd_init_parents().
Referenced by do_forward(), worker_init(), libworker_setup(), and check_fwd().
| struct delegpt* forwards_lookup | ( | struct iter_forwards * | fwd, |
| uint8_t * | qname, | ||
| uint16_t | qclass | ||
| ) | [read] |
Find forward zone information For this qname/qclass find forward zone information, returns delegation point with server names and addresses, or NULL if no forwarding is needed.
| fwd,: | forward storage. |
| qname,: | The qname of the query. |
| qclass,: | The qclass of the query. |
References iter_forward_zone::node, rbnode_t::key, iter_forward_zone::dclass, iter_forward_zone::name, iter_forward_zone::namelabs, dname_count_size_labels(), iter_forward_zone::namelen, rbtree_find_less_equal(), iter_forwards::tree, dname_lab_cmp(), iter_forward_zone::parent, and iter_forward_zone::dp.
Referenced by print_deleg_lookup(), print_root_fwds(), forwards_lookup_root(), and forward_request().
| struct delegpt* forwards_lookup_root | ( | struct iter_forwards * | fwd, |
| uint16_t | qclass | ||
| ) | [read] |
Same as forwards_lookup, but for the root only.
| fwd,: | forward storage. |
| qclass,: | The qclass of the query. |
References forwards_lookup().
Referenced by processInitRequest().
| int forwards_next_root | ( | struct iter_forwards * | fwd, |
| uint16_t * | qclass | ||
| ) |
Find next root item in forwards lookup tree.
| fwd,: | the forward storage |
| qclass,: | class to look at next, or higher. |
References rbtree_first(), iter_forwards::tree, RBTREE_NULL, dname_is_root(), iter_forward_zone::name, iter_forward_zone::dclass, forwards_next_root(), iter_forward_zone::node, rbnode_t::key, iter_forward_zone::namelen, iter_forward_zone::namelabs, rbtree_find_less_equal(), and rbtree_next().
Referenced by forwards_next_root(), and iter_get_next_root().
| size_t forwards_get_mem | ( | struct iter_forwards * | fwd | ) |
Get memory in use by forward storage.
| fwd,: | forward storage. |
References iter_forwards::tree, regional_get_mem(), and iter_forwards::region.
Referenced by worker_mem_report().
| int forwards_add_zone | ( | struct iter_forwards * | fwd, |
| uint16_t | c, | ||
| struct delegpt * | dp | ||
| ) |
Add zone to forward structure.
For external use since it recalcs the tree parents.
| fwd,: | the forward data structure |
| c,: | class of zone |
| dp,: | delegation point with name and target nameservers for new forward zone. This delegation point and all its data must be malloced in the fwd->region. (then it is freed when the fwd is deleted). |
References forwards_insert(), and fwd_init_parents().
Referenced by do_forward().
| void forwards_delete_zone | ( | struct iter_forwards * | fwd, |
| uint16_t | c, | ||
| uint8_t * | nm | ||
| ) |
Remove zone from forward structure.
For external use since it recalcs the tree parents. Does not actually release any memory, the region is unchanged.
| fwd,: | the forward data structure |
| c,: | class of zone |
| nm,: | name of zone (in uncompressed wireformat). |
References iter_forward_zone::node, rbnode_t::key, iter_forward_zone::dclass, iter_forward_zone::name, iter_forward_zone::namelabs, dname_count_size_labels(), iter_forward_zone::namelen, rbtree_search(), iter_forwards::tree, rbtree_delete(), and fwd_init_parents().
Referenced by do_forward().