OpenDNSSEC-enforcer  2.0.4
Data Structures | Typedefs | Enumerations | Functions
task.h File Reference
#include "config.h"
#include "status.h"
#include "db/db_connection.h"
#include <ldns/ldns.h>

Go to the source code of this file.

Data Structures

struct  task_struct
 

Typedefs

typedef enum task_id_enum task_id
 
typedef struct task_struct task_type
 
typedef task_type *(* how_type) (task_type *task)
 

Enumerations

enum  task_id_enum {
  TASK_NONE = 0, TASK_SIGNCONF, TASK_READ, TASK_NSECIFY,
  TASK_SIGN, TASK_AUDIT, TASK_WRITE, TASK_DYNAMIC_FIRST = 1000
}
 

Functions

task_id task_register (const char *short_name, const char *long_name, how_type how)
 
task_typetask_create (task_id what_id, time_t when, const char *who, const char *what, void *context, how_type clean_context)
 
void task_cleanup (task_type *task)
 
int task_compare (const void *a, const void *b)
 
int task_compare_name (const void *a, const void *b)
 
char * task2str (task_type *task, char *buftask)
 
const char * task_what2str (int taskid)
 
const char * task_who2str (const char *who)
 
void task_log (task_type *task)
 
task_typetask_perform (task_type *task)
 
bool task_id_from_long_name (const char *long_name, task_id *pwhat)
 

Typedef Documentation

◆ how_type

typedef task_type*(* how_type) (task_type *task)

Definition at line 74 of file task.h.

◆ task_id

typedef enum task_id_enum task_id

Definition at line 53 of file task.h.

◆ task_type

typedef struct task_struct task_type

Task.

Definition at line 58 of file task.h.

Enumeration Type Documentation

◆ task_id_enum

Tasks.

Enumerator
TASK_NONE 
TASK_SIGNCONF 
TASK_READ 
TASK_NSECIFY 
TASK_SIGN 
TASK_AUDIT 
TASK_WRITE 
TASK_DYNAMIC_FIRST 

Definition at line 41 of file task.h.

Function Documentation

◆ task2str()

char* task2str ( task_type task,
char *  buftask 
)

Convert task to string.

Parameters
[in]tasktask
[out]bufferto store string-based task in
Returns
string-format task

Convert task to string.

Definition at line 254 of file task.c.

References task_struct::flush, task_what2str(), task_who2str(), task_struct::what, task_struct::when, and task_struct::who.

◆ task_cleanup()

void task_cleanup ( task_type task)

Clean up task.

Parameters
[in]tasktask

Clean up task.

Definition at line 147 of file task.c.

References task_struct::clean_context, task_struct::context, task_struct::dname, and task_struct::who.

Referenced by schedule_purge(), and task_perform().

◆ task_compare()

int task_compare ( const void *  a,
const void *  b 
)

Compare tasks.

Parameters
[in]aone task
[in]banother task
Returns
int -1, 0 or 1

Compare tasks.

Definition at line 170 of file task.c.

References task_struct::dname, task_struct::flush, and task_struct::when.

◆ task_compare_name()

int task_compare_name ( const void *  a,
const void *  b 
)

Compare tasks by name.

Parameters
[in]aone task
[in]banother task
Returns
int -1, 0 or 1

Compare tasks by name

Definition at line 195 of file task.c.

References task_struct::dname.

◆ task_create()

task_type* task_create ( task_id  what_id,
time_t  when,
const char *  who,
const char *  what,
void *  context,
how_type  clean_context 
)

Create a new task.

Parameters
[in]whattask identifier
[in]whenscheduled time
[in]whocontext name e.g. a dns name like "example.com"
[in]contextpointer to context
Returns
task_type* created task

Create a new task.

Definition at line 110 of file task.c.

References ods_log_error().

◆ task_id_from_long_name()

bool task_id_from_long_name ( const char *  long_name,
task_id pwhat 
)

Definition at line 53 of file task.c.

Referenced by flush_enforce_task(), and flush_resalt_task().

◆ task_log()

void task_log ( task_type task)

Log task.

Parameters
[in]tasktask

◆ task_perform()

task_type* task_perform ( task_type task)

Actually perform the task.

Parameters
[in]tasktask
Returns
task_type * task to be scheduled next, usually same as performed task.

Perform task.

Definition at line 292 of file task.c.

References task_struct::how, and task_cleanup().

◆ task_register()

task_id task_register ( const char *  short_name,
const char *  long_name,
how_type  how 
)

Register a task type with a task name and a named how function. This registry is used when restoring a task from a backup.

Parameters
[in]short_nameshort name for what the task does
[in]long_nameunique name identifying the how function
[in]howthe function that performs the task
Returns
task_id dynamically allocated for this how to perform function

Definition at line 82 of file task.c.

Referenced by hsm_key_factory_schedule_generate_all(), hsm_key_factory_schedule_generate_policy(), keystate_ds_retract_task(), keystate_ds_submit_task(), policy_resalt_task(), and signconf_task().

◆ task_what2str()

const char* task_what2str ( int  what)

String-format of who.

Parameters
[in]whattask identifier
Returns
const char* string-format of what

String-format of what.

Definition at line 212 of file task.c.

References TASK_AUDIT, TASK_NONE, TASK_NSECIFY, TASK_READ, TASK_SIGN, TASK_SIGNCONF, and TASK_WRITE.

Referenced by task2str().

◆ task_who2str()

const char* task_who2str ( const char *  who)

String-format of who.

Parameters
[in]whattask owner
Returns
const char* string-format of who

String-format of who.

Definition at line 240 of file task.c.

Referenced by task2str().