unbound: libunbound/worker.h File Reference

unbound 0.1

Functions
worker.h File Reference

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

`#include "sldns/sbuffer.h"`
`#include "util/data/packed_rrset.h"`

## Functions
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.
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.
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.
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.
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

  qinfo | query info.
  flags | host order flags word, with opcode and CD bit.
  dnssec | if set, EDNS record will have DO bit set.
  want_dnssec | signatures needed.
  nocaps | ignore capsforid(if in config), do not perturb qname.
  check_ratelimit | if set, will check ratelimit before sending out.
  addr | where to.
  addrlen | length of addr.
  zone | delegation point name.
  zonelen | length of zone name wireformat dname.
  tcp_upstream | use TCP for upstream queries.
  ssl_upstream | use SSL for upstream queries.
  tls_auth_name | if ssl_upstream, use this name with TLS authentication.
  q | which query state to reactivate upon return.
  was_ratelimited | it 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, outnet_serviced_query(), outbound_entry::qsent, outbound_entry::qstate, 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

  sig | signal number.
  arg | the worker (main worker) that handles signals.

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

Referenced by fptr_whitelist_comm_signal(), signal_handling_playback(), and worker_init().

## ◆ 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

  qinfo | query info.
  flags | host order flags word, with opcode and CD bit.
  dnssec | if set, EDNS record will have DO bit set.
  want_dnssec | signatures needed.
  nocaps | ignore capsforid(if in config), do not perturb qname.
  check_ratelimit | if set, will check ratelimit before sending out.
  addr | where to.
  addrlen | length of addr.
  zone | wireformat dname of the zone.
  zonelen | length of zone name.
  tcp_upstream | use TCP for upstream queries.
  ssl_upstream | use SSL for upstream queries.
  tls_auth_name | if ssl_upstream, use this name with TLS authentication.
  q | which query state to reactivate upon return.
  was_ratelimited | it 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(), and worker_init().

## ◆ 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

  tube | tube control message came on.
  msg | message contents. Is freed.
  len | length of message.
  error | if error (NETEVENT_*) happened.
  arg | user argument

References error().