OpenDNSSEC-signer  1.4.3
task.h
Go to the documentation of this file.
1 /*
2  * $Id: task.h 6181 2012-02-21 14:12:17Z matthijs $
3  *
4  * Copyright (c) 2009 NLNet Labs. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #ifndef SCHEDULER_TASK_H
35 #define SCHEDULER_TASK_H
36 
37 #include "config.h"
38 #include "shared/allocator.h"
39 
40 #include <ldns/ldns.h>
41 
43  TASK_NONE = 0,
44  TASK_SIGNCONF, /* ods-signer update */
45  TASK_READ, /* ods-signer sign */
47  TASK_SIGN, /* ods-signer flush */
49 };
50 typedef enum task_id_enum task_id;
51 
55 typedef struct task_struct task_type;
56 struct task_struct {
61  time_t when;
62  time_t halted_when;
63  time_t backoff;
64  int flush;
65  void* zone;
66 };
67 
76 task_type* task_create(task_id what, time_t when, void* zone);
77 
84 void task_backup(FILE* fd, task_type* task);
85 
93 int task_compare(const void* a, const void* b);
94 
102 char* task2str(task_type* task, char* buftask);
103 
110 const char* task_what2str(task_id what);
111 
117 const char* task_who2str(task_type* task);
118 
125 void task_print(FILE* out, task_type* task);
126 
132 void task_log(task_type* task);
133 
139 void task_cleanup(task_type* task);
140 
141 #endif /* SCHEDULER_TASK_H */
Definition: task.h:43
time_t when
Definition: task.h:61
task_id interrupt
Definition: task.h:59
int flush
Definition: task.h:64
time_t backoff
Definition: task.h:63
Definition: task.h:47
void * zone
Definition: task.h:65
enum task_id_enum task_id
Definition: task.h:50
const char * task_what2str(task_id what)
Definition: task.c:148
allocator_type * allocator
Definition: task.h:57
Definition: task.h:45
time_t halted_when
Definition: task.h:62
const char * task_who2str(task_type *task)
Definition: task.c:178
task_id halted
Definition: task.h:60
task_id_enum
Definition: task.h:42
void task_backup(FILE *fd, task_type *task)
Definition: task.c:89
void task_cleanup(task_type *task)
Definition: task.c:277
task_id what
Definition: task.h:58
void task_log(task_type *task)
Definition: task.c:255
int task_compare(const void *a, const void *b)
Definition: task.c:114
char * task2str(task_type *task, char *buftask)
Definition: task.c:196
void task_print(FILE *out, task_type *task)
Definition: task.c:233
task_type * task_create(task_id what, time_t when, void *zone)
Definition: task.c:50