]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libcharon/plugins/certexpire/certexpire_cron.h
0d6623d7fd4f4d93ba3bb30cac14b88c54e0dd94
[thirdparty/strongswan.git] / src / libcharon / plugins / certexpire / certexpire_cron.h
1 /*
2 * Copyright (C) 2011 Martin Willi
3 * Copyright (C) 2011 revosec AG
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup certexpire_cron certexpire_cron
18 * @{ @ingroup certexpire
19 */
20
21 #ifndef CERTEXPIRE_CRON_H_
22 #define CERTEXPIRE_CRON_H_
23
24 typedef struct certexpire_cron_t certexpire_cron_t;
25
26 /**
27 * Callback function invoked by cron.
28 *
29 * @param data user specified callback data
30 */
31 typedef void (*certexpire_cron_job_t)(void *data);
32
33 /**
34 * Cron style job scheduling.
35 */
36 struct certexpire_cron_t {
37
38 /**
39 * Destroy a certexpire_cron_t.
40 *
41 * It currently is not possible to savely cancel a cron job. Make sure
42 * any scheduled jobs have been canceled before cleaning up.
43 */
44 void (*destroy)(certexpire_cron_t *this);
45 };
46
47 /**
48 * Create a certexpire_cron instance.
49 *
50 * The cron string takes numeric arguments only, but supports ranges (1-5)
51 * and selections (1,3,5), or a combination, space separated:
52 * minute hour day month weekday
53 * minute, 0-59
54 * hour, 0-23
55 * day, 1-31
56 * month, 1-12
57 * weekday, 0-7 (0 == 7 == sunday)
58 * man crontab(5) for details.
59 *
60 * @param cron cron style scheduling string
61 * @param job callback function to invoke
62 * @param data user data to pass to job
63 */
64 certexpire_cron_t *certexpire_cron_create(char *cron, certexpire_cron_job_t job,
65 void *data);
66
67 #endif /** CERTEXPIRE_CRON_H_ @}*/