worker.h File Reference

This file declares the methods any worker has to implement. More...

Functions

struct outbound_entrylibworker_send_query (struct query_info *qinfo, uint16_t flags, int dnssec, int want_dnssec, int nocaps, int check_ratelimit, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, int tcp_upstream, int ssl_upstream, char *tls_auth_name, struct module_qstate *q, int *was_ratelimited)
 Worker service routine to send serviced queries to authoritative servers. More...
 
int libworker_handle_service_reply (struct comm_point *c, void *arg, int error, struct comm_reply *reply_info)
 process incoming serviced query replies from the network
 
void libworker_handle_control_cmd (struct tube *tube, uint8_t *msg, size_t len, int err, void *arg)
 handle control command coming into server
 
void libworker_fg_done_cb (void *arg, int rcode, sldns_buffer *buf, enum sec_status s, char *why_bogus, int was_ratelimited)
 mesh callback with fg results
 
void libworker_bg_done_cb (void *arg, int rcode, sldns_buffer *buf, enum sec_status s, char *why_bogus, int was_ratelimited)
 mesh callback with bg results
 
void libworker_event_done_cb (void *arg, int rcode, struct sldns_buffer *buf, enum sec_status s, char *why_bogus, int was_ratelimited)
 mesh callback with event results
 
void worker_sighandler (int sig, void *arg)
 Worker signal handler function. More...
 
struct outbound_entryworker_send_query (struct query_info *qinfo, uint16_t flags, int dnssec, int want_dnssec, int nocaps, int check_ratelimit, struct sockaddr_storage *addr, socklen_t addrlen, uint8_t *zone, size_t zonelen, int tcp_upstream, int ssl_upstream, char *tls_auth_name, struct module_qstate *q, int *was_ratelimited)
 Worker service routine to send serviced queries to authoritative servers. More...
 
void worker_handle_control_cmd (struct tube *tube, uint8_t *msg, size_t len, int error, void *arg)
 process control messages from the main thread. More...
 
int worker_handle_request (struct comm_point *c, void *arg, int error, struct comm_reply *repinfo)
 handles callbacks from listening event interface
 
int worker_handle_service_reply (struct comm_point *c, void *arg, int error, struct comm_reply *reply_info)
 process incoming serviced query replies from the network
 
void worker_alloc_cleanup (void *arg)
 cleanup the cache to remove all rrset IDs from it, arg is worker
 
void worker_stat_timer_cb (void *arg)
 statistics timer callback handler
 
void worker_probe_timer_cb (void *arg)
 probe timer callback handler
 
void worker_start_accept (void *arg)
 start accept callback handler
 
void worker_stop_accept (void *arg)
 stop accept callback handler
 
int remote_accept_callback (struct comm_point *, void *, int, struct comm_reply *)
 handle remote control accept callbacks
 
int remote_control_callback (struct comm_point *, void *, int, struct comm_reply *)
 handle remote control data callbacks
 
void remote_get_opt_ssl (char *line, void *arg)
 routine to printout option values over SSL
 

Detailed Description

This file declares the methods any worker has to implement.

Function Documentation

◆ libworker_send_query()

struct outbound_entry* libworker_send_query ( struct query_info qinfo,
uint16_t  flags,
int  dnssec,
int  want_dnssec,
int  nocaps,
int  check_ratelimit,
struct sockaddr_storage *  addr,
socklen_t  addrlen,
uint8_t *  zone,
size_t  zonelen,
int  tcp_upstream,
int  ssl_upstream,
char *  tls_auth_name,
struct module_qstate q,
int *  was_ratelimited 
)

Worker service routine to send serviced queries to authoritative servers.

Parameters
qinfoquery info.
flagshost order flags word, with opcode and CD bit.
dnssecif set, EDNS record will have DO bit set.
want_dnssecsignatures needed.
nocapsignore capsforid(if in config), do not perturb qname.
check_ratelimitif set, will check ratelimit before sending out.
addrwhere to.
addrlenlength of addr.
zonedelegation point name.
zonelenlength of zone name wireformat dname.
tcp_upstreamuse TCP for upstream queries.
ssl_upstreamuse SSL for upstream queries.
tls_auth_nameif ssl_upstream, use this name with TLS authentication.
qwhich query state to reactivate upon return.
was_ratelimitedit will signal back if the query failed to pass the ratelimit check.
Returns
: false on failure (memory or socket related). no query was sent.

References libworker::back, module_qstate::env, libworker_handle_service_reply(), outnet_serviced_query(), module_qstate::region, regional_alloc(), outside_network::udp_buff, and module_env::worker.

◆ worker_sighandler()

void worker_sighandler ( int  sig,
void *  arg 
)

Worker signal handler function.

User argument is the worker itself.

Parameters
sigsignal number.
argthe worker (main worker) that handles signals.

References worker::base, comm_base_exit(), and worker::need_to_exit.

Referenced by fptr_whitelist_comm_signal(), and signal_handling_playback().

◆ worker_send_query()

struct outbound_entry* worker_send_query ( struct query_info qinfo,
uint16_t  flags,
int  dnssec,
int  want_dnssec,
int  nocaps,
int  check_ratelimit,
struct sockaddr_storage *  addr,
socklen_t  addrlen,
uint8_t *  zone,
size_t  zonelen,
int  tcp_upstream,
int  ssl_upstream,
char *  tls_auth_name,
struct module_qstate q,
int *  was_ratelimited 
)

Worker service routine to send serviced queries to authoritative servers.

Parameters
qinfoquery info.
flagshost order flags word, with opcode and CD bit.
dnssecif set, EDNS record will have DO bit set.
want_dnssecsignatures needed.
nocapsignore capsforid(if in config), do not perturb qname.
check_ratelimitif set, will check ratelimit before sending out.
addrwhere to.
addrlenlength of addr.
zonewireformat dname of the zone.
zonelenlength of zone name.
tcp_upstreamuse TCP for upstream queries.
ssl_upstreamuse SSL for upstream queries.
tls_auth_nameif ssl_upstream, use this name with TLS authentication.
qwhich query state to reactivate upon return.
was_ratelimitedit will signal back if the query failed to pass the ratelimit check.
Returns
: false on failure (memory or socket related). no query was sent.

References worker::back, module_qstate::env, outnet_serviced_query(), outbound_entry::qsent, outbound_entry::qstate, module_qstate::region, regional_alloc(), outside_network::udp_buff, module_env::worker, and worker_handle_service_reply().

Referenced by fptr_whitelist_modenv_send_query().

◆ worker_handle_control_cmd()

void worker_handle_control_cmd ( struct tube tube,
uint8_t *  msg,
size_t  len,
int  error,
void *  arg 
)

process control messages from the main thread.

Frees the control command message.

Parameters
tubetube control message came on.
msgmessage contents. Is freed.
lenlength of message.
errorif error (NETEVENT_*) happened.
arguser argument

Referenced by fptr_whitelist_tube_listen().