OpenDNSSEC-signer  1.3.14
task.h
Go to the documentation of this file.
1 /*
2  * $Id: task.h 4550 2011-03-11 11:42:01Z 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,
50 };
51 typedef enum task_id_enum task_id;
52 
56 typedef struct task_struct task_type;
57 struct task_struct {
62  time_t when;
63  time_t backoff;
64  int flush;
65  const char* who;
66  ldns_rdf* dname;
67  void* zone;
68 };
69 
79 task_type* task_create(task_id what, time_t when, const char* who, void* zone);
80 
88 task_type* task_recover_from_backup(const char* filename, void* zone);
89 
96 void task_backup(FILE* fd, task_type* task);
97 
103 void task_cleanup(task_type* task);
104 
112 int task_compare(const void* a, const void* b);
113 
121 char* task2str(task_type* task, char* buftask);
122 
129 const char* task_what2str(int taskid);
130 
136 const char* task_who2str(const char* who);
137 
144 void task_print(FILE* out, task_type* task);
145 
151 void task_log(task_type* task);
152 
153 #endif /* SCHEDULER_TASK_H */