Debian Codegraph @

common/ptask.h

raw
1 /*
2 * Cisco router simulation platform.
3 * Copyright (c) 2005,2006 Christophe Fillot ([email protected])
4 *
5 * Periodic tasks centralization.
6 */
7
8 #ifndef __PTASK_H__
9 #define __PTASK_H__
10
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 #include <sys/un.h>
14 #include "utils.h"
15
16 /* ptask identifier */
17 typedef m_int64_t ptask_id_t;
18
19 /* periodic task callback prototype */
20 typedef int (*ptask_callback)(void *object,void *arg);
21
22 /* periodic task definition */
23 typedef struct ptask ptask_t;
24 struct ptask {
25 ptask_id_t id;
26 ptask_t *next;
27 ptask_callback cbk;
28 void *object,*arg;
29 };
30
31 extern u_int ptask_sleep_time;
32
33 /* Add a new task */
34 ptask_id_t ptask_add(ptask_callback cbk,void *object,void *arg);
35
36 /* Remove a task */
37 int ptask_remove(ptask_id_t id);
38
39 /* Initialize ptask module */
40 int ptask_init(u_int sleep_time);
41
42 #endif