OpenDNSSEC-signer 1.2.1
Data Structures | Typedefs | Enumerations | Functions

/build/buildd-opendnssec_1.2.1.dfsg-1-ia64-j6OroR/opendnssec-1.2.1.dfsg/signer/src/scheduler/task.h File Reference

#include "config.h"
#include "scheduler/locks.h"
#include <stdio.h>
#include <time.h>
#include <ldns/ldns.h>
Include dependency graph for task.h:

Go to the source code of this file.

Data Structures

struct  task_struct
struct  tasklist_struct

Typedefs

typedef enum task_id_enum task_id
typedef struct task_struct task_type
typedef struct tasklist_struct tasklist_type

Enumerations

enum  task_id_enum {
  TASK_NONE = 0, TASK_READ, TASK_ADDKEYS, TASK_UPDATE,
  TASK_NSECIFY, TASK_SIGN, TASK_AUDIT, TASK_WRITE
}

Functions

task_typetask_create (int what, time_t when, const char *who, struct zone_struct *zone)
task_typetask_recover_from_backup (const char *filename, struct zone_struct *zone)
void task_backup (task_type *task)
void task_cleanup (task_type *task)
int task_compare (const void *a, const void *b)
char * task2str (task_type *task, char *buftask)
void task_print (FILE *out, task_type *task)
tasklist_typetasklist_create (void)
void tasklist_cleanup (tasklist_type *list)
void tasklist_flush (tasklist_type *list, task_id what)
task_typetasklist_schedule_task (tasklist_type *list, task_type *task, int log)
task_typetasklist_delete_task (tasklist_type *list, task_type *task)
task_typetasklist_pop_task (tasklist_type *list)
task_typetasklist_first_task (tasklist_type *list)
void tasklist_print (FILE *out, tasklist_type *list)

Typedef Documentation

typedef enum task_id_enum task_id

Definition at line 64 of file task.h.

typedef struct task_struct task_type

Task.

Definition at line 69 of file task.h.

Task list.

Definition at line 83 of file task.h.


Enumeration Type Documentation

Enumerator:
TASK_NONE 
TASK_READ 
TASK_ADDKEYS 
TASK_UPDATE 
TASK_NSECIFY 
TASK_SIGN 
TASK_AUDIT 
TASK_WRITE 

Definition at line 54 of file task.h.


Function Documentation

char* task2str ( task_type task,
char *  buftask 
)

Convert task to string.

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

Convert task to string.

Definition at line 253 of file task.c.

References task_struct::flush, se_calloc(), se_log_assert, time_now(), task_struct::what, task_struct::when, and task_struct::who.

void task_backup ( task_type task)

Backup task.

Parameters:
[in]tasktask

Backup task.

Definition at line 130 of file task.c.

References task_struct::backoff, task_struct::flush, se_build_path(), se_fclose(), se_fopen(), se_free(), se_log_warning(), task_struct::what, task_struct::when, and task_struct::who.

Referenced by worker_start().

void task_cleanup ( task_type task)

Clean up task.

Parameters:
[in]tasktask

Clean up task.

Definition at line 169 of file task.c.

References task_struct::dname, se_free(), se_log_warning(), and task_struct::who.

Referenced by tasklist_cleanup(), tasklist_schedule_task(), worker_start(), and zonelist_update().

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 192 of file task.c.

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

Referenced by tasklist_create().

task_type* task_create ( int  what,
time_t  when,
const char *  who,
struct zone_struct zone 
)

Create a new task.

Parameters:
[in]whattask identifier
[in]whenscheduled time
[in]whozone name
[in]zonepointer to zone structure
Returns:
task_type* created task

Create a new task.

Definition at line 56 of file task.c.

References task_struct::backoff, task_struct::dname, task_struct::flush, se_log_assert, se_malloc(), se_strdup(), zone_struct::task, task_struct::what, task_struct::when, task_struct::who, and task_struct::zone.

Referenced by task_recover_from_backup(), zone_recover_from_backup(), and zone_update_signconf().

void task_print ( FILE *  out,
task_type task 
)

Print task.

Parameters:
[in]outfile descriptor
[in]tasktask

Print task.

Definition at line 292 of file task.c.

References task_struct::flush, se_log_assert, time_now(), task_struct::what, task_struct::when, and task_struct::who.

Referenced by tasklist_print().

task_type* task_recover_from_backup ( const char *  filename,
struct zone_struct zone 
)

Recover a task from backup.

Parameters:
[in]filenamewhere the task backup is stored
[in]zonepointer to zone structure
Returns:
task_type* created task

Recover a task from backup.

Definition at line 80 of file task.c.

References task_struct::backoff, backup_read_check_str(), backup_read_int(), backup_read_str(), backup_read_time_t(), task_struct::flush, se_fclose(), se_fopen(), se_free(), se_log_assert, se_log_debug(), se_log_error(), and task_create().

Referenced by zone_recover_from_backup().

void tasklist_cleanup ( tasklist_type list)

Cleanup task list.

Parameters:
list[in]tasklist to be cleaned up

Clean up task list.

Definition at line 368 of file task.c.

References lock_basic_destroy, se_free(), se_log_debug(), se_log_warning(), se_rbnode_free(), task_cleanup(), tasklist_struct::tasklist_lock, and tasklist_struct::tasks.

Referenced by engine_cleanup().

tasklist_type* tasklist_create ( void  )

New task list. number of possible tasks

Returns:
tasklist_type* created tasklist

New task list.

Definition at line 348 of file task.c.

References tasklist_struct::loading, lock_basic_init, lock_basic_lock, lock_basic_unlock, se_log_debug(), se_malloc(), task_compare(), tasklist_struct::tasklist_lock, and tasklist_struct::tasks.

task_type* tasklist_delete_task ( tasklist_type list,
task_type task 
)

Delete task from task list.

Parameters:
[in]listtask list
[in]tasktask to delete
Returns:
task_type* deleted task

Delete task from task list.

Definition at line 511 of file task.c.

References se_free(), se_log_assert, se_log_debug(), se_log_error(), se_log_warning(), and tasklist_struct::tasks.

Referenced by tasklist_pop_task(), zone_update_signconf(), and zonelist_update().

task_type* tasklist_first_task ( tasklist_type list)

First task from task list.

Parameters:
[in]listtask list
Returns:
task_type* first task

First task from task list.

Definition at line 576 of file task.c.

References se_log_assert, and tasklist_struct::tasks.

Referenced by worker_start().

void tasklist_flush ( tasklist_type list,
task_id  what 
)

Flush task list.

Parameters:
list[in]tasklist to be flushed
list[in]what if not TASK_NONE, change the what to do

Flush task list.

Definition at line 484 of file task.c.

References task_struct::flush, se_log_assert, se_log_debug(), TASK_NONE, tasklist_struct::tasks, and task_struct::what.

task_type* tasklist_pop_task ( tasklist_type list)

Pop task from task list.

Parameters:
[in]listtask list
Returns:
task_type* popped task

Pop task from task list.

Definition at line 542 of file task.c.

References task_struct::flush, se_log_assert, se_log_debug(), tasklist_delete_task(), tasklist_struct::tasks, time_now(), task_struct::when, and task_struct::who.

Referenced by worker_start().

void tasklist_print ( FILE *  out,
tasklist_type list 
)

Print task list.

Parameters:
[in]outfile descriptor
[in]listtask list

Print task list.

Definition at line 599 of file task.c.

References se_log_assert, task_print(), and tasklist_struct::tasks.

task_type* tasklist_schedule_task ( tasklist_type list,
task_type task,
int  log 
)

Schedule a task.

Parameters:
[in]listtask list
[in]tasktask to schedule
[in]loglog new task
Returns:
task_type* scheduled task

Schedule a task.

Definition at line 435 of file task.c.

References zone_struct::in_progress, se_free(), se_log_assert, se_log_debug(), se_log_error(), task_cleanup(), tasklist_struct::tasks, task_struct::what, task_struct::who, and task_struct::zone.

Referenced by worker_start(), zone_recover_from_backup(), and zone_update_signconf().