Electroneum
Loading...
Searching...
No Matches
worker.h
Go to the documentation of this file.
1/*
2 * daemon/worker.h - worker that handles a pending list of requests.
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
42
43#ifndef DAEMON_WORKER_H
44#define DAEMON_WORKER_H
45
46#include "libunbound/worker.h"
47#include "util/netevent.h"
48#include "util/locks.h"
49#include "util/alloc.h"
50#include "util/data/msgreply.h"
51#include "util/data/msgparse.h"
52#include "daemon/stats.h"
53#include "util/module.h"
54#include "dnstap/dnstap.h"
55struct listen_dnsport;
56struct outside_network;
57struct config_file;
58struct daemon;
59struct listen_port;
60struct ub_randstate;
61struct regional;
62struct tube;
63struct daemon_remote;
64struct query_info;
65
77
82struct worker {
86 struct daemon* daemon;
90 struct tube* cmd;
92 struct comm_base* base;
98 int* ports;
110 unsigned int err_limit_count;
111
113 struct ub_randstate* rndstate;
122
125
126#ifdef USE_DNSTAP
128 struct dt_env dtenv;
129#endif
130};
131
141struct worker* worker_create(struct daemon* daemon, int id, int* ports, int n);
142
152int worker_init(struct worker* worker, struct config_file *cfg,
153 struct listen_port* ports, int do_sigs);
154
159
164
171
177
178#endif /* DAEMON_WORKER_H */
void worker_send_cmd(struct worker *worker, enum worker_commands cmd)
worker_commands
Definition worker.h:67
@ 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
void worker_work(struct worker *worker)
void worker_stats_clear(struct worker *worker)
int worker_init(struct worker *worker, struct config_file *cfg, struct listen_port *ports, int do_sigs)
void worker_delete(struct worker *worker)
struct worker * worker_create(struct daemon *daemon, int id, int *ports, int n)
pid_t ub_thread_type
Definition locks.h:283
Definition tube.h:63
struct tube * cmd
Definition worker.h:90
int numports
Definition worker.h:100
struct module_env env
Definition worker.h:124
int * ports
Definition worker.h:98
ub_thread_type thr_id
Definition worker.h:88
struct comm_signal * comsig
Definition worker.h:102
struct regional * scratchpad
Definition worker.h:121
unsigned int err_limit_count
Definition worker.h:110
struct comm_timer * stat_timer
Definition worker.h:106
struct ub_server_stats stats
Definition worker.h:119
struct comm_point * cmd_com
Definition worker.h:104
struct listen_dnsport * front
Definition worker.h:94
int thread_num
Definition worker.h:84
time_t err_limit_time
Definition worker.h:108
struct outside_network * back
Definition worker.h:96
struct daemon * daemon
Definition worker.h:86
int need_to_exit
Definition worker.h:115
struct alloc_cache alloc
Definition worker.h:117
struct comm_base * base
Definition worker.h:92
struct ub_randstate * rndstate
Definition worker.h:113