Electroneum
module_env Struct Reference

#include <module.h>

Collaboration diagram for module_env:

Public Attributes

struct config_filecfg
 
struct slabhashmsg_cache
 
struct rrset_cacherrset_cache
 
struct infra_cacheinfra_cache
 
struct key_cachekey_cache
 
struct outbound_entry *(* send_query )(struct query_info *qinfo, uint16_t flags, int dnssec, int want_dnssec, int nocaps, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, int ssl_upstream, char *tls_auth_name, struct module_qstate *q)
 
void(* detach_subs )(struct module_qstate *qstate)
 
int(* attach_sub )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t qflags, int prime, int valrec, struct module_qstate **newq)
 
int(* add_sub )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t qflags, int prime, int valrec, struct module_qstate **newq, struct mesh_state **sub)
 
void(* kill_sub )(struct module_qstate *newq)
 
int(* detect_cycle )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t flags, int prime, int valrec)
 
struct regionalscratch
 
struct sldns_bufferscratch_buffer
 
struct workerworker
 
struct comm_baseworker_base
 
struct outside_networkoutnet
 
struct mesh_areamesh
 
struct alloc_cachealloc
 
struct ub_randstate * rnd
 
time_t * now
 
struct timeval * now_tv
 
int need_to_validate
 
struct val_anchorsanchors
 
struct val_neg_cacheneg_cache
 
struct comm_timerprobe_timer
 
struct auth_zonesauth_zones
 
struct iter_forwardsfwds
 
struct iter_hintshints
 
void * modinfo [MAX_MODULE]
 
struct inplace_cbinplace_cb_lists [inplace_cb_types_total]
 
struct edns_known_optionedns_known_options
 
size_t edns_known_options_num
 
int unique_mesh
 

Detailed Description

Module environment. Services and data provided to the module.

Definition at line 307 of file module.h.

Member Data Documentation

◆ add_sub

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

Add detached query. Creates it if it does not exist already. Does not make super/sub references. Performs a cycle detection - for double check - and fails if there is one. 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. o added subquery, created if it did not exist already.

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.
valrecif it is a validation recursion query (lookup of key, DS).
newqIf the new subquery needs initialisation, it is returned, otherwise NULL is returned.
subThe added mesh state, created if it did not exist already.
Returns
: false on error, true if success (and init may be needed).

Definition at line 416 of file module.h.

◆ alloc

struct alloc_cache* module_env::alloc

allocation service

Definition at line 460 of file module.h.

◆ anchors

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.

Definition at line 474 of file module.h.

◆ attach_sub

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).

Definition at line 386 of file module.h.

◆ auth_zones

struct auth_zones* module_env::auth_zones

auth zones

Definition at line 481 of file module.h.

◆ cfg

struct config_file* module_env::cfg

config file with config options

Definition at line 310 of file module.h.

◆ detach_subs

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.

Definition at line 362 of file module.h.

◆ detect_cycle

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.

Definition at line 443 of file module.h.

◆ edns_known_options

struct edns_known_option* module_env::edns_known_options

Shared array of known edns options (size MAX_KNOWN_EDNS_OPTS). Filled by edns literate modules during init.

Definition at line 503 of file module.h.

◆ edns_known_options_num

size_t module_env::edns_known_options_num

Definition at line 505 of file module.h.

◆ fwds

struct iter_forwards* module_env::fwds

Mapping of forwarding zones to targets. iterator forwarder information. per-thread, created by worker

Definition at line 484 of file module.h.

◆ hints

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.

Definition at line 492 of file module.h.

◆ infra_cache

struct infra_cache* module_env::infra_cache

shared infrastructure cache (edns, lameness)

Definition at line 316 of file module.h.

◆ inplace_cb_lists

struct inplace_cb* module_env::inplace_cb_lists[inplace_cb_types_total]

Definition at line 497 of file module.h.

◆ key_cache

struct key_cache* module_env::key_cache

shared key cache

Definition at line 318 of file module.h.

◆ kill_sub

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 freshly created sub.

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

Definition at line 428 of file module.h.

◆ mesh

struct mesh_area* module_env::mesh

mesh area with query state dependencies

Definition at line 458 of file module.h.

◆ modinfo

void* module_env::modinfo[MAX_MODULE]

module specific data. indexed by module id.

Definition at line 494 of file module.h.

◆ msg_cache

struct slabhash* module_env::msg_cache

shared message cache

Definition at line 312 of file module.h.

◆ need_to_validate

int module_env::need_to_validate

is validation required for messages, controls client-facing validation status (AD bits) and servfails

Definition at line 469 of file module.h.

◆ neg_cache

struct val_neg_cache* module_env::neg_cache

negative cache, configured by the validator. if not NULL, contains NSEC record lookup trees.

Definition at line 477 of file module.h.

◆ now

time_t* module_env::now

time in seconds, converted to integer

Definition at line 464 of file module.h.

◆ now_tv

struct timeval* module_env::now_tv

time in microseconds. Relatively recent.

Definition at line 466 of file module.h.

◆ outnet

struct outside_network* module_env::outnet

the outside network

Definition at line 456 of file module.h.

◆ probe_timer

struct comm_timer* module_env::probe_timer

the 5011-probe timer (if any)

Definition at line 479 of file module.h.

◆ rnd

struct ub_randstate* module_env::rnd

random table to generate random numbers

Definition at line 462 of file module.h.

◆ rrset_cache

struct rrset_cache* module_env::rrset_cache

shared rrset cache

Definition at line 314 of file module.h.

◆ scratch

struct regional* module_env::scratch

region for temporary usage. May be cleared after operate() call.

Definition at line 448 of file module.h.

◆ scratch_buffer

struct sldns_buffer* module_env::scratch_buffer

buffer for temporary usage. May be cleared after operate() call.

Definition at line 450 of file module.h.

◆ send_query

struct outbound_entry*(* module_env::send_query) (struct query_info *qinfo, uint16_t flags, int dnssec, int want_dnssec, int nocaps, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, int ssl_upstream, char *tls_auth_name, 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
qinfoquery info.
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.
ssl_upstreamuse SSL for upstream queries.
tls_auth_nameif ssl_upstream, use this name with TLS authentication.
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).

Definition at line 349 of file module.h.

◆ unique_mesh

int module_env::unique_mesh

Definition at line 508 of file module.h.

◆ worker

struct worker* module_env::worker

internal data for daemon - worker thread.

Definition at line 452 of file module.h.

◆ worker_base

struct comm_base* module_env::worker_base

the worker event base

Definition at line 454 of file module.h.


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