Module environment. More...
#include <module.h>
Data Fields | |
struct config_file * | cfg |
config file with config options | |
struct slabhash * | msg_cache |
shared message cache | |
struct rrset_cache * | rrset_cache |
shared rrset cache | |
struct infra_cache * | infra_cache |
shared infrastructure cache (edns, lameness) | |
struct key_cache * | key_cache |
shared key cache | |
int(* | send_packet )(ldns_buffer *pkt, struct sockaddr_storage *addr, socklen_t addrlen, int timeout, struct module_qstate *q, int use_tcp) |
Direct access to the network, this packet gets sent to destination. | |
struct outbound_entry *(* | send_query )(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec, struct sockaddr_storage *addr, socklen_t addrlen, struct module_qstate *q) |
Send serviced DNS query to server. | |
void(* | detach_subs )(struct module_qstate *qstate) |
Detach-subqueries. | |
int(* | attach_sub )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t qflags, int prime, struct module_qstate **newq) |
Attach subquery. | |
void(* | kill_sub )(struct module_qstate *newq) |
Kill newly attached sub. | |
int(* | detect_cycle )(struct module_qstate *qstate, struct query_info *qinfo, uint16_t flags, int prime) |
Detect if adding a dependency for qstate on name,type,class will create a dependency cycle. | |
struct regional * | scratch |
region for temporary usage. | |
ldns_buffer * | scratch_buffer |
buffer for temporary usage. | |
struct worker * | worker |
internal data for daemon - worker thread. | |
struct mesh_area * | mesh |
mesh area with query state dependencies | |
struct alloc_cache * | alloc |
allocation service | |
struct ub_randstate * | rnd |
random table to generate random numbers | |
uint32_t * | now |
time in seconds, converted to integer | |
struct timeval * | now_tv |
time in microseconds. | |
int | need_to_validate |
is validation required for messages, controls client-facing validation status (AD bits) and servfails | |
struct val_anchors * | anchors |
trusted key storage; these are the configured keys, if not NULL, otherwise configured by validator. | |
struct val_neg_cache * | neg_cache |
negative cache, configured by the validator. | |
struct comm_timer * | probe_timer |
the 5011-probe timer (if any) | |
struct iter_forwards * | fwds |
Mapping of forwarding zones to targets. | |
void * | modinfo [MAX_MODULE] |
module specific data. |
Module environment.
Services and data provided to the module.
int(* module_env::send_packet)(ldns_buffer *pkt, struct sockaddr_storage *addr, socklen_t addrlen, int timeout, struct module_qstate *q, int use_tcp) |
Direct access to the network, this packet gets sent to destination.
Send DNS query to server. operate() should return with wait_reply. Later on a callback will cause operate() to be called with event timeout or reply. Replied packet is then in the query buffer.
pkt,: | packet to send. | |
addr,: | where to. | |
addrlen,: | length of addr. | |
timeout,: | seconds to wait until timeout. | |
q,: | wich query state to reactivate upon return. | |
use_tcp,: | set to true to send over TCP. 0 for UDP. |
Referenced by libworker_setup(), and worker_init().
struct outbound_entry*(* module_env::send_query)(uint8_t *qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec, struct sockaddr_storage *addr, socklen_t addrlen, struct module_qstate *q) [read] |
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.
qname,: | query name. (host order) | |
qnamelen,: | length in bytes of qname, including trailing 0. | |
qtype,: | query type. (host order) | |
qclass,: | query class. (host order) | |
flags,: | host order flags word, with opcode and CD bit. | |
dnssec,: | if 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. | |
addr,: | where to. | |
addrlen,: | length of addr. | |
q,: | wich query state to reactivate upon return. |
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.
qstate,: | used 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, 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.
qstate,: | the state to find mesh state, and that wants to receive the results from the new subquery. | |
qinfo,: | what to query for (copied). | |
qflags,: | what flags to use (RD, CD flag or not). | |
prime,: | if it is a (stub) priming query. | |
newq,: | If the new subquery needs initialisation, it is returned, otherwise NULL is returned. |
Referenced by generate_request(), generate_sub_request(), 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.
newq,: | the 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) |
Detect if adding a dependency for qstate on name,type,class will create a dependency cycle.
qstate,: | given mesh querystate. | |
qinfo,: | query info for dependency. | |
flags,: | query flags of dependency, RD/CD flags. | |
prime,: | if dependency is a priming query or not. |
Referenced by causes_cycle(), generate_sub_request(), libworker_setup(), and worker_init().
struct regional* module_env::scratch |
region for temporary usage.
May be cleared after operate() call.
Referenced by autr_probe_timer(), check_mod(), createResponse(), dnskey_verify_rrset(), dnskeyset_verify_rrset(), dnskeyset_verify_rrset_sig(), ds_digest_match_dnskey(), dstest_file(), find_covering_nsec3(), find_matching_nsec3(), handle_newq(), libworker_delete(), libworker_fg(), libworker_fillup_fg(), libworker_setup(), mesh_do_callback(), mesh_run(), mesh_send_reply(), nsec3_do_prove_nameerror(), nsec3_do_prove_nodata(), probe_anchor(), process_response(), processInitRequest(), val_verify_rrset(), verifytest_file(), and worker_init().
ldns_buffer* module_env::scratch_buffer |
buffer for temporary usage.
May be cleared after operate() call.
Referenced by check_contains_revoked(), check_mod(), dnskey_verify_rrset(), dnskeyset_verify_rrset_sig(), do_data_add(), do_list_local_data(), ds_create_dnskey_digest(), dstest_file(), find_covering_nsec3(), find_matching_nsec3(), libworker_delete(), libworker_setup(), load_cache(), load_msg_cache(), load_rrset_cache(), print_id(), probe_anchor(), processInitRequest(), update_events(), val_find_DS(), verifytest_file(), worker_delete(), and worker_init().
struct worker* module_env::worker |
internal data for daemon - worker thread.
Referenced by daemon_setup_modules(), libworker_handle_reply(), libworker_handle_service_reply(), libworker_send_packet(), libworker_send_query(), libworker_setup(), ub_ctx_create(), worker_handle_reply(), worker_handle_service_reply(), worker_init(), worker_send_packet(), and worker_send_query().
struct timeval* module_env::now_tv |
time in microseconds.
Relatively recent.
Referenced by get_mesh_age(), libworker_setup(), mesh_make_new_space(), mesh_send_reply(), mesh_state_add_reply(), print_uptime(), and worker_init().
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(), 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(), val_get_mem(), and worker_init().
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 |
Mapping of forwarding zones to targets.
iterator forwarder information. per-thread, created by worker
Referenced by do_forward(), do_list_forwards(), forward_request(), libworker_delete(), libworker_setup(), print_deleg_lookup(), processCollectClass(), processInitRequest(), worker_delete(), and worker_init().
void* module_env::modinfo[MAX_MODULE] |
module specific data.
indexed by module id.
Referenced by do_list_stubs(), ds_response_to_ke(), get_rrset_bogus(), iter_deinit(), iter_get_mem(), iter_init(), iter_operate(), primeResponseToKE(), print_deleg_lookup(), process_dlv_response(), process_dnskey_response(), process_prime_response(), processCollectClass(), pythonmod_deinit(), pythonmod_get_mem(), pythonmod_inform_super(), pythonmod_init(), pythonmod_operate(), val_deinit(), val_get_mem(), val_init(), and val_operate().