OpenDNSSEC-enforcer 2.1.13
Data Structures | Typedefs | Functions
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  )

Create engine.

Definition at line 79 of file engine.c.

◆ engine_dealloc()

void engine_dealloc ( engine_type engine)

Definition at line 97 of file engine.c.

◆ engine_init()

void engine_init ( engine_type engine,
int  daemonize 
)

Definition at line 612 of file engine.c.

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

◆ engine_setup()

ods_status engine_setup ( void  )

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.

◆ engine_start_workers()

void engine_start_workers ( engine_type engine)

start all workers.

Parameters
[in]engineengine

Definition at line 174 of file engine.c.

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

◆ engine_teardown()

void engine_teardown ( engine_type engine)

Clean up engine.

Parameters
[in]engineengine

Clean up engine.

Definition at line 584 of file engine.c.

◆ engine_wakeup_workers()

void engine_wakeup_workers ( engine_type engine)

Wake up workers.

Parameters
[in]engineengine

Wake up all workers.

Definition at line 218 of file engine.c.

◆ get_database_connection()

db_connection_t * get_database_connection ( engine_type engine)

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.