Data Fields
module_env Struct Reference

Module environment. More...

#include <module.h>

Data Fields

struct config_filecfg
 config file with config options
 
struct slabhashmsg_cache
 shared message cache
 
struct rrset_cacherrset_cache
 shared rrset cache
 
struct infra_cacheinfra_cache
 shared infrastructure cache (edns, lameness)
 
struct key_cachekey_cache
 shared key cache
 
struct outbound_entry *(* send_query )(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec, int want_dnssec, int nocaps, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, struct module_qstate *q)
 Send serviced DNS query to server. More...
 
void(* detach_subs )(struct module_qstate *qstate)
 Detach-subqueries. More...
 
int(* attach_sub )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t qflags, int prime, int valrec, struct module_qstate **newq)
 Attach subquery. More...
 
void(* kill_sub )(struct module_qstate *newq)
 Kill newly attached sub. More...
 
int(* detect_cycle )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t flags, int prime, int valrec)
 Detect if adding a dependency for qstate on name,type,class will create a dependency cycle. More...
 
struct regionalscratch
 region for temporary usage. More...
 
struct sldns_bufferscratch_buffer
 buffer for temporary usage. More...
 
struct workerworker
 internal data for daemon - worker thread. More...
 
struct mesh_areamesh
 mesh area with query state dependencies
 
struct alloc_cachealloc
 allocation service
 
struct ub_randstate * rnd
 random table to generate random numbers
 
time_t * now
 time in seconds, converted to integer
 
struct timeval * now_tv
 time in microseconds. More...
 
int need_to_validate
 is validation required for messages, controls client-facing validation status (AD bits) and servfails
 
struct val_anchorsanchors
 trusted key storage; these are the configured keys, if not NULL, otherwise configured by validator. More...
 
struct val_neg_cacheneg_cache
 negative cache, configured by the validator. More...
 
struct comm_timerprobe_timer
 the 5011-probe timer (if any)
 
struct iter_forwardsfwds
 Mapping of forwarding zones to targets. More...
 
struct iter_hintshints
 iterator forwarder information. More...
 
void * modinfo [MAX_MODULE]
 module specific data. More...
 

Detailed Description

Module environment.

Services and data provided to the module.

Field Documentation

struct outbound_entry*(* module_env::send_query)(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec, int want_dnssec, int nocaps, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, struct module_qstate *q)

Send serviced DNS query to server.

UDP/TCP and EDNS is handled. operate() should return with wait_reply. Later on a callback will cause operate() to be called with event timeout or reply. The time until a timeout is calculated from roundtrip timing, several UDP retries are attempted.

Parameters
qnamequery name. (host order)
qnamelenlength in bytes of qname, including trailing 0.
qtypequery type. (host order)
qclassquery class. (host order)
flagshost order flags word, with opcode and CD bit.
dnssecif set, EDNS record will have bits set. If EDNS_DO bit is set, DO bit is set in EDNS records. If BIT_CD is set, CD bit is set in queries with EDNS records.
want_dnssecif set, the validator wants DNSSEC. Without EDNS, the answer is likely to be useless for this domain.
nocapsdo not use caps_for_id, use the qname as given. (ignored if caps_for_id is disabled).
addrwhere to.
addrlenlength of addr.
zonedelegation point name.
zonelenlength of zone name.
qwich query state to reactivate upon return.
Returns
: false on failure (memory or socket related). no query was sent. Or returns an outbound entry with qsent and qstate set. This outbound_entry will be used on later module invocations that involve this query (timeout, error or reply).

Referenced by libworker_setup(), processQueryTargets(), and worker_init().

void(* module_env::detach_subs)(struct module_qstate *qstate)

Detach-subqueries.

Remove all sub-query references from this query state. Keeps super-references of those sub-queries correct. Updates stat items in mesh_area structure.

Parameters
qstateused to find mesh state.

Referenced by libworker_setup(), processInitRequest3(), processQueryResponse(), and worker_init().

int(* module_env::attach_sub)(struct module_qstate *qstate, struct query_info *qinfo, uint16_t qflags, int prime, int valrec, struct module_qstate **newq)

Attach subquery.

Creates it if it does not exist already. Keeps sub and super references correct. Updates stat items in mesh_area structure. Pass if it is priming query or not. return: o if error (malloc) happened. o need to initialise the new state (module init; it is a new state). so that the next run of the query with this module is successful. o no init needed, attachment successful.

Parameters
qstatethe state to find mesh state, and that wants to receive the results from the new subquery.
qinfowhat to query for (copied).
qflagswhat flags to use (RD, CD flag or not).
primeif it is a (stub) priming query.
valrecvalidation lookup recursion, does not need validation
newqIf the new subquery needs initialisation, it is returned, otherwise NULL is returned.
Returns
: false on error, true if success (and init may be needed).

Referenced by generate_request(), generate_sub_request(), handle_ipv6_ptr(), libworker_setup(), and worker_init().

void(* module_env::kill_sub)(struct module_qstate *newq)

Kill newly attached sub.

If attach_sub returns newq for initialisation, but that fails, then this routine will cleanup and delete the fresly created sub.

Parameters
newqthe new subquery that is no longer needed. It is removed.

Referenced by generate_ns_check(), generate_sub_request(), libworker_setup(), prime_root(), prime_stub(), and worker_init().

int(* module_env::detect_cycle)(struct module_qstate *qstate, struct query_info *qinfo, uint16_t flags, int prime, int valrec)

Detect if adding a dependency for qstate on name,type,class will create a dependency cycle.

Parameters
qstategiven mesh querystate.
qinfoquery info for dependency.
flagsquery flags of dependency, RD/CD flags.
primeif dependency is a priming query or not.
valrecvalidation lookup recursion, does not need validation
Returns
true if the name,type,class exists and the given qstate mesh exists as a dependency of that name. Thus if qstate becomes dependent on name,type,class then a cycle is created.

Referenced by causes_cycle(), libworker_setup(), and worker_init().

struct regional* module_env::scratch
struct sldns_buffer* module_env::scratch_buffer
struct worker* module_env::worker
struct timeval* module_env::now_tv
struct val_anchors* module_env::anchors

trusted key storage; these are the configured keys, if not NULL, otherwise configured by validator.

These are the trust anchors, and are not primed and ready for validation, but on the bright side, they are read only memory, thus no locks and fast.

Referenced by autr_tp_remove(), do_forward_add(), do_forward_remove(), do_insecure_add(), do_insecure_remove(), do_list_forwards(), do_list_stubs(), do_stub_add(), do_stub_remove(), iter_indicates_dnssec(), process_dlv_response(), process_prime_response(), processDLVLookup(), processFinished(), processInit(), reset_worker_timer(), set_next_probe(), todo_probe(), val_apply_cfg(), val_deinit(), val_dlv_init(), worker_init(), and worker_mem_report().

struct val_neg_cache* module_env::neg_cache

negative cache, configured by the validator.

if not NULL, contains NSEC record lookup trees.

Referenced by processInitRequest(), processQueryResponse(), val_apply_cfg(), and val_find_DS().

struct iter_forwards* module_env::fwds
struct iter_hints* module_env::hints

iterator forwarder information.

per-thread, created by worker. The hints – these aren't stored in the cache because they don't expire. The hints are always used to "prime" the cache. Note that both root hints and stub zone "hints" are stored in this data structure.

Referenced by can_have_last_resort(), do_list_stubs(), do_stub_add(), do_stub_remove(), libworker_delete_env(), libworker_setup(), prime_root(), prime_stub(), processCollectClass(), processInitRequest(), processLastResort(), worker_delete(), worker_init(), and worker_mem_report().

void* module_env::modinfo[MAX_MODULE]

The documentation for this struct was generated from the following file: