OpenDNSSEC-enforcer 2.1.13
engine.h File Reference
#include "config.h"
#include <signal.h>
#include "daemon/cfg.h"
#include "cmdhandler.h"
#include "scheduler/task.h"
#include "scheduler/schedule.h"
#include "db/db_configuration.h"
#include "db/db_connection.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 (engine_type *engine)
ods_status engine_setup (void)
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.

Definition at line 38 of file engine.h.

◆ start_cb_t

typedef void(* start_cb_t) (engine_type *engine)

Definition at line 98 of file engine.h.

Function Documentation

◆ engine_alloc()

engine_type * engine_alloc ( void )
extern

Create engine.

Definition at line 79 of file engine.c.

Referenced by main().

◆ engine_dealloc()

void engine_dealloc ( engine_type * engine)
extern

Definition at line 97 of file engine.c.

References db_configuration_list_free(), and hsm_key_factory_deinit().

Referenced by main().

◆ engine_init()

void engine_init ( engine_type * engine,
int daemonize )
extern

Definition at line 612 of file engine.c.

Referenced by main().

◆ engine_run()

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

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 643 of file engine.c.

References engine_start_workers(), and engine_stop_workers().

Referenced by main().

◆ engine_setup()

ods_status engine_setup ( void )
extern

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 432 of file engine.c.

References db_connection_free(), enforcercommands, and get_database_connection().

Referenced by main().

◆ engine_start_workers()

void engine_start_workers ( engine_type * engine)
extern

start all workers.

Parameters
[in]engineengine

Definition at line 174 of file engine.c.

References get_database_connection().

Referenced by engine_run().

◆ engine_stop()

void engine_stop ( engine_type * engine)
extern

Stop the engine after engine_runloop returns.

Parameters
[in]engineengine

◆ engine_stop_workers()

void engine_stop_workers ( engine_type * engine)
extern

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

Parameters
[in]engineengine

Definition at line 193 of file engine.c.

References db_connection_free(), and engine_wakeup_workers().

Referenced by engine_run().

◆ engine_teardown()

void engine_teardown ( engine_type * engine)
extern

Clean up engine.

Parameters
[in]engineengine

Clean up engine.

Definition at line 584 of file engine.c.

Referenced by main().

◆ engine_wakeup_workers()

void engine_wakeup_workers ( engine_type * engine)
extern

Wake up workers.

Parameters
[in]engineengine

Wake up all workers.

Definition at line 218 of file engine.c.

Referenced by engine_stop_workers().

◆ get_database_connection()

db_connection_t * get_database_connection ( engine_type * engine)
extern

Try to open a connection to the database.

Parameters
engine,theengine containing database configuration
Returns
connection on success, NULL on failure.

Definition at line 226 of file engine.c.

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

Referenced by autostart(), engine_setup(), and engine_start_workers().