Electroneum
Loading...
Searching...
No Matches
worker.h File Reference
#include "libunbound/worker.h"
#include "util/netevent.h"
#include "util/locks.h"
#include "util/alloc.h"
#include "util/data/msgreply.h"
#include "util/data/msgparse.h"
#include "daemon/stats.h"
#include "util/module.h"
#include "dnstap/dnstap.h"
Include dependency graph for worker.h:

Go to the source code of this file.

Classes

struct  worker

Enumerations

enum  worker_commands { worker_cmd_quit , worker_cmd_stats , worker_cmd_stats_noreset , worker_cmd_remote }

Functions

struct workerworker_create (struct daemon *daemon, int id, int *ports, int n)
int worker_init (struct worker *worker, struct config_file *cfg, struct listen_port *ports, int do_sigs)
void worker_work (struct worker *worker)
void worker_delete (struct worker *worker)
void worker_send_cmd (struct worker *worker, enum worker_commands cmd)
void worker_stats_clear (struct worker *worker)

Detailed Description

This file describes the worker structure that holds a list of pending requests and handles them.

Definition in file worker.h.

Enumeration Type Documentation

◆ worker_commands

worker commands

Enumerator
worker_cmd_quit 

make the worker quit

worker_cmd_stats 

obtain statistics

worker_cmd_stats_noreset 

obtain statistics without statsclear

worker_cmd_remote 

execute remote control command

Definition at line 67 of file worker.h.

67 {
76};
@ worker_cmd_quit
Definition worker.h:69
@ worker_cmd_remote
Definition worker.h:75
@ worker_cmd_stats
Definition worker.h:71
@ worker_cmd_stats_noreset
Definition worker.h:73

Function Documentation

◆ worker_create()

struct worker * worker_create ( struct daemon * daemon,
int id,
int * ports,
int n )

Create the worker structure. Bare bones version, zeroed struct, with backpointers only. Use worker_init on it later.

Parameters
daemonthe daemon that this worker thread is part of.
idthe thread number from 0.. numthreads-1.
portsthe ports it is allowed to use, array.
nthe number of ports.
Returns
: the new worker or NULL on alloc failure.

◆ worker_delete()

void worker_delete ( struct worker * worker)

Delete worker.

◆ worker_init()

int worker_init ( struct worker * worker,
struct config_file * cfg,
struct listen_port * ports,
int do_sigs )

Initialize worker. Allocates event base, listens to ports

Parameters
workerworker to initialize, created with worker_create.
cfgconfiguration settings.
portslist of shared query ports.
do_sigsif true, worker installs signal handlers.
Returns
: false on error.

◆ worker_send_cmd()

void worker_send_cmd ( struct worker * worker,
enum worker_commands cmd )

Send a command to a worker. Uses blocking writes.

Parameters
workerworker to send command to.
cmdcommand to send.

◆ worker_stats_clear()

void worker_stats_clear ( struct worker * worker)

Init worker stats - includes server_stats_init, outside network and mesh.

Parameters
workerthe worker to init

◆ worker_work()

void worker_work ( struct worker * worker)

Make worker work.