unbound 0.1
daemon.h File Reference

The daemon consists of global settings and a number of workers. More...

#include "util/locks.h"
#include "util/alloc.h"
#include "services/modstack.h"
#include "dnstap/dnstap_config.h"
#include "dnscrypt/dnscrypt_config.h"

Data Structures

struct  daemon
 Structure holding worker list. More...
 

Functions

struct daemondaemon_init (void)
 Initialize daemon structure.
 
int daemon_open_shared_ports (struct daemon *daemon)
 Open shared listening ports (if needed).
 
int daemon_privileged (struct daemon *daemon)
 Do daemon setup that needs privileges like opening privileged ports or opening device files.
 
void daemon_fork (struct daemon *daemon)
 Fork workers and start service.
 
void daemon_cleanup (struct daemon *daemon)
 Close off the worker thread information.
 
void daemon_delete (struct daemon *daemon)
 Delete workers, close listening ports.
 
void daemon_apply_cfg (struct daemon *daemon, struct config_file *cfg)
 Apply config settings.
 
int setup_acl_for_ports (struct acl_list *list, struct listen_port *port_list)
 Setup acl list to have entries for the port list.
 

Detailed Description

The daemon consists of global settings and a number of workers.

Function Documentation

◆ daemon_init()

◆ daemon_open_shared_ports()

◆ daemon_privileged()

int daemon_privileged ( struct daemon * daemon)

Do daemon setup that needs privileges like opening privileged ports or opening device files.

The cfg member pointer must have been set for the daemon.

Parameters
daemonthe daemon.
Returns
: false on error.

References module_env::alloc, daemon::cfg, module_env::cfg, daemon::env, daemon::mods, modstack_call_startup(), config_file::module_conf, daemon::superalloc, and module_env::worker.

Referenced by perform_setup(), and service_init().

◆ daemon_fork()

◆ daemon_cleanup()

◆ daemon_delete()

◆ daemon_apply_cfg()

◆ setup_acl_for_ports()

int setup_acl_for_ports ( struct acl_list * list,
struct listen_port * port_list )

Setup acl list to have entries for the port list.

Parameters
listthe acl interface
port_listlist of open ports, or none.
Returns
false on failure

References unbound_socket::acl, acl_interface_insert(), acl_refuse, unbound_socket::addr, unbound_socket::addrlen, listen_port::next, and listen_port::socket.

Referenced by ct_acl_interface_setup_ports(), and daemon_open_shared_ports().