source: ogServer-Git/sources/schedule.h @ 6c7d827

Last change on this file since 6c7d827 was 6c7d827, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

#942 ignore stale schedules on start

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[83b242c]1#ifndef _OG_SCHEDULE_H_
2#define _OG_SCHEDULE_H_
3
4#include <stdint.h>
[6c7d827]5#include <stdbool.h>
[83b242c]6#include "dbi.h"
7#include "list.h"
8#include <ev.h>
9
10struct og_schedule_time {
11        uint32_t        years;
12        uint32_t        months;
13        uint32_t        weeks;
14        uint32_t        week_days;
15        uint32_t        days;
16        uint32_t        hours;
17        uint32_t        am_pm;
18        uint32_t        minutes;
[6c7d827]19        bool            on_start;
[83b242c]20};
21
[63c4ea5]22enum og_schedule_type {
23        OG_SCHEDULE_TASK,
[894d833]24        OG_SCHEDULE_COMMAND,
[63c4ea5]25};
26
[83b242c]27struct og_schedule {
28        struct list_head        list;
29        struct ev_timer         timer;
30        time_t                  seconds;
31        unsigned int            task_id;
32        unsigned int            schedule_id;
[63c4ea5]33        enum og_schedule_type   type;
[83b242c]34};
35
36void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
[63c4ea5]37                        enum og_schedule_type type,
[83b242c]38                        struct og_schedule_time *time);
39void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id,
40                        unsigned int task_id, struct og_schedule_time *time);
41void og_schedule_delete(struct ev_loop *loop, uint32_t schedule_id);
42void og_schedule_next(struct ev_loop *loop);
43void og_schedule_refresh(struct ev_loop *loop);
[894d833]44void og_schedule_run(unsigned int task_id, unsigned int schedule_id,
45                     enum og_schedule_type type);
[83b242c]46
47#endif
Note: See TracBrowser for help on using the repository browser.