Electroneum
daemon.h
Go to the documentation of this file.
1 /*
2  * daemon/daemon.h - collection of workers that handles 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 #ifndef DAEMON_H
43 #define DAEMON_H
44 
45 #include "util/locks.h"
46 #include "util/alloc.h"
47 #include "services/modstack.h"
48 struct config_file;
49 struct worker;
50 struct listen_port;
51 struct slabhash;
52 struct module_env;
53 struct rrset_cache;
54 struct acl_list;
55 struct local_zones;
56 struct views;
57 struct ub_randstate;
58 struct daemon_remote;
59 struct respip_set;
60 struct shm_main_info;
61 
62 #include "dnstap/dnstap_config.h"
63 #ifdef USE_DNSTAP
64 struct dt_env;
65 #endif
66 
67 #include "dnscrypt/dnscrypt_config.h"
68 #ifdef USE_DNSCRYPT
69 struct dnsc_env;
70 #endif
71 
76 struct daemon {
78  struct config_file* cfg;
80  char* chroot;
82  char* pidfile;
87  struct listen_port** ports;
89  size_t num_ports;
91  int reuseport;
93  int rc_port;
97  struct daemon_remote* rc;
101  int num;
103  struct worker** workers;
107  struct ub_randstate* rand;
111  struct module_env* env;
115  struct acl_list* acl;
119  struct timeval time_last_stat;
121  struct timeval time_boot;
123  struct views* views;
124 #ifdef USE_DNSTAP
125 
126  struct dt_env* dtenv;
127 #endif
133 #ifdef USE_DNSCRYPT
134 
135  struct dnsc_env* dnscenv;
136 #endif
137 };
138 
143 struct daemon* daemon_init(void);
144 
152 
158 void daemon_fork(struct daemon* daemon);
159 
165 void daemon_cleanup(struct daemon* daemon);
166 
171 void daemon_delete(struct daemon* daemon);
172 
178 void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg);
179 
180 #endif /* DAEMON_H */
struct views * views
Definition: daemon.h:123
Definition: daemon.h:76
int rc_port
Definition: daemon.h:93
struct respip_set * respip_set
Definition: daemon.h:130
struct module_env * env
Definition: daemon.h:111
char * pidfile
Definition: daemon.h:82
Definition: view.h:56
char * chroot
Definition: daemon.h:80
struct ub_randstate * rand
Definition: daemon.h:107
void * connect_sslctx
Definition: daemon.h:99
struct daemon * daemon_init(void)
struct listen_port * rc_ports
Definition: daemon.h:95
void daemon_delete(struct daemon *daemon)
void daemon_apply_cfg(struct daemon *daemon, struct config_file *cfg)
struct acl_list * acl
Definition: daemon.h:115
void * listen_sslctx
Definition: daemon.h:99
struct timeval time_boot
Definition: daemon.h:121
struct shm_main_info * shm_info
Definition: daemon.h:128
int use_response_ip
Definition: daemon.h:132
struct module_stack mods
Definition: daemon.h:113
struct daemon_remote * rc
Definition: daemon.h:97
struct worker ** workers
Definition: daemon.h:103
struct alloc_cache superalloc
Definition: daemon.h:109
int reuseport
Definition: daemon.h:91
void daemon_cleanup(struct daemon *daemon)
int need_to_exit
Definition: daemon.h:105
struct listen_port ** ports
Definition: daemon.h:87
int listening_port
Definition: daemon.h:84
struct local_zones * local_zones
Definition: daemon.h:117
size_t num_ports
Definition: daemon.h:89
Definition: worker.h:82
struct config_file * cfg
Definition: daemon.h:78
int num
Definition: daemon.h:101
struct timeval time_last_stat
Definition: daemon.h:119
void daemon_fork(struct daemon *daemon)
int daemon_open_shared_ports(struct daemon *daemon)