OpenDNSSEC-enforcer  2.0.4
Data Structures | Typedefs | Functions
engine.h File Reference
#include "config.h"
#include "daemon/cfg.h"
#include "daemon/cmdhandler.h"
#include "daemon/worker.h"
#include "scheduler/task.h"
#include "db/db_configuration.h"
#include "db/db_connection.h"
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  engine_struct
 

Typedefs

typedef struct engine_struct engine_type
 
typedef void(* start_cb_t) (engine_type *engine)
 

Functions

db_connection_tget_database_connection (db_configuration_list_t *dbcfg_list)
 
ods_status engine_setup (engine_type *engine)
 
void engine_teardown (engine_type *engine)
 
void engine_init (engine_type *engine, int daemonize)
 
int engine_run (engine_type *engine, start_cb_t start, int single_run)
 
void engine_stop (engine_type *engine)
 
void engine_wakeup_workers (engine_type *engine)
 
void engine_stop_workers (engine_type *engine)
 
void engine_start_workers (engine_type *engine)
 
engine_typeengine_alloc (void)
 
void engine_dealloc (engine_type *engine)
 

Typedef Documentation

◆ engine_type

typedef struct engine_struct engine_type

The engine. Engine stuff.

Definition at line 50 of file engine.h.

◆ start_cb_t

typedef void(* start_cb_t) (engine_type *engine)

Definition at line 104 of file engine.h.

Function Documentation

◆ engine_alloc()

engine_type* engine_alloc ( void  )

◆ engine_dealloc()

void engine_dealloc ( engine_type engine)

◆ engine_init()

void engine_init ( engine_type engine,
int  daemonize 
)

◆ engine_run()

int engine_run ( engine_type engine,
start_cb_t  start,
int  single_run 
)

Run the engine after setting it up using engine_setup. When this function returns the runloop has finished and the engine is ready to stop.

Parameters
[in]enginethe engine returned from engine_start
[in]single_runrun once
Returns
0 if terminated normally, 1 on unrecoverable error.

Run engine, run!.

Definition at line 609 of file engine.c.

References ods_log_info().

◆ engine_setup()

ods_status engine_setup ( engine_type engine)

Setup the engine started by engine_create

Parameters
[in]enginethe engine returned from engine_start
[in]commandsNULL terminated list of command functions for the engine that the command handler can run.
[in]helpNULL terminated list of help functions that print help for the command to a socket.

Set up engine and return the setup status.

Definition at line 443 of file engine.c.

References ods_log_debug().

◆ engine_start_workers()

void engine_start_workers ( engine_type engine)

start all workers.

Parameters
[in]engineengine

Definition at line 214 of file engine.c.

References engine_struct::config, and ods_log_debug().

◆ engine_stop()

void engine_stop ( engine_type engine)

Stop the engine after engine_runloop returns.

Parameters
[in]engineengine

◆ engine_stop_workers()

void engine_stop_workers ( engine_type engine)

signal all workers to stop. Blocks until all workers are joined.

Parameters
[in]engineengine

Definition at line 230 of file engine.c.

References engine_struct::config, and ods_log_debug().

◆ engine_teardown()

void engine_teardown ( engine_type engine)

◆ engine_wakeup_workers()

void engine_wakeup_workers ( engine_type engine)

Wake up workers.

Parameters
[in]engineengine

Wake up all workers.

Definition at line 255 of file engine.c.

References ods_log_debug().

◆ get_database_connection()

db_connection_t* get_database_connection ( db_configuration_list_t dbcfg_list)

Try to open a connection to the database.

Parameters
dbcfg_list,databaseconfiguration list
Returns
connection on success, NULL on failure.

Definition at line 263 of file engine.c.

References db_connection_connect(), db_connection_free(), db_connection_new(), db_connection_set_configuration_list(), db_connection_setup(), and ods_log_crit().