further MOBIKE stuff:
[strongswan.git] / src / charon / processing / scheduler.h
1 /**
2 * @file scheduler.h
3 *
4 * @brief Interface of scheduler_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005-2007 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 */
23
24 #ifndef SCHEDULER_H_
25 #define SCHEDULER_H_
26
27 typedef struct scheduler_t scheduler_t;
28
29 #include <library.h>
30 #include <processing/jobs/job.h>
31
32 /**
33 * @brief The scheduler queues and executes timed events.
34 *
35 * The scheduler stores timed events and passes them to the processor.
36 *
37 * @b Constructors:
38 * - scheduler_create()
39 *
40 * @ingroup processing
41 */
42 struct scheduler_t {
43
44 /**
45 * @brief Adds a event to the queue, using a relative time offset.
46 *
47 * Schedules a job for execution using a relative time offset.
48 *
49 * @param this calling object
50 * @param job job to schedule
51 * @param time relative to to schedule job (in ms)
52 */
53 void (*schedule_job) (scheduler_t *this, job_t *job, u_int32_t time);
54
55 /**
56 * @brief Returns number of jobs scheduled.
57 *
58 * @param this calling object
59 * @return number of scheduled jobs
60 */
61 u_int (*get_job_load) (scheduler_t *this);
62
63 /**
64 * @brief Destroys a scheduler object.
65 *
66 * @param this calling object
67 */
68 void (*destroy) (scheduler_t *this);
69 };
70
71 /**
72 * @brief Create a scheduler.
73 *
74 * @return scheduler_t object
75 *
76 * @ingroup processing
77 */
78 scheduler_t *scheduler_create(void);
79
80 #endif /*SCHEDULER_H_*/
81