1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24: #ifndef BUS_EXPIRE_LIST_H
25: #define BUS_EXPIRE_LIST_H
26:
27: #include <dbus/dbus.h>
28: #include <dbus/dbus-list.h>
29: #include <dbus/dbus-mainloop.h>
30:
31: typedef struct BusExpireList BusExpireList;
32: typedef struct BusExpireItem BusExpireItem;
33:
34: typedef dbus_bool_t (* BusExpireFunc) (BusExpireList *list,
35: DBusList *link,
36: void *data);
37:
38: struct BusExpireList
39: {
40: DBusList *items;
41: DBusTimeout *timeout;
42: DBusLoop *loop;
43: BusExpireFunc expire_func;
44: void *data;
45: int expire_after;
46: };
47:
48:
49: struct BusExpireItem
50: {
51: long added_tv_sec;
52: long added_tv_usec;
53: };
54:
55: BusExpireList* bus_expire_list_new (DBusLoop *loop,
56: int expire_after,
57: BusExpireFunc expire_func,
58: void *data);
59: void bus_expire_list_free (BusExpireList *list);
60:
61: #define ELAPSED_MILLISECONDS_SINCE(orig_tv_sec, orig_tv_usec, \
62: now_tv_sec, now_tv_usec) \
63: (((double) (now_tv_sec) - (double) (orig_tv_sec)) * 1000.0 + \
64: ((double) (now_tv_usec) - (double) (orig_tv_usec)) / 1000.0)
65:
66: void bus_expire_timeout_set_interval (DBusTimeout *timeout,
67: int next_interval);
68:
69: #endif