summaryrefslogtreecommitdiff
path: root/navit/event.h
blob: 1aa10cc4f18cfc0d8531e480c38cf91f5d2594d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 * Navit, a modular navigation system.
 * Copyright (C) 2005-2008 Navit Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifdef __cplusplus
extern "C" {
#endif

struct event_idle;
struct event_timeout;
struct event_watch;
struct callback;
struct callback_list;
struct file;

enum event_watch_cond {
	event_watch_cond_read=1,
	event_watch_cond_write,
	event_watch_cond_except,
};

struct event_methods {
	void (*main_loop_run)(void);
	void (*main_loop_quit)(void);
	struct event_watch *(*add_watch)(int fd, enum event_watch_cond cond, struct callback *cb);
	void (*remove_watch)(struct event_watch *ev);
	struct event_timeout *(*add_timeout)(int timeout, int multi, struct callback *cb);
	void (*remove_timeout)(struct event_timeout *ev);
	struct event_idle *(*add_idle)(int priority, struct callback *cb);
	void (*remove_idle)(struct event_idle *ev);
	void (*call_callback)(struct callback_list *cb);
};


/* prototypes */
enum event_watch_cond;
struct callback;
struct callback_list;
struct event_idle;
struct event_timeout;
struct event_watch;
void event_main_loop_run(void);
void event_main_loop_quit(void);
int event_main_loop_has_quit(void);
struct event_watch *event_add_watch(int fd, enum event_watch_cond cond, struct callback *cb);
void event_remove_watch(struct event_watch *ev);
struct event_timeout *event_add_timeout(int timeout, int multi, struct callback *cb);
void event_remove_timeout(struct event_timeout *ev);
struct event_idle *event_add_idle(int priority, struct callback *cb);
void event_remove_idle(struct event_idle *ev);
void event_call_callback(struct callback_list *cb);
char const *event_system(void);
int event_request_system(const char *system, const char *requestor);
/* end of prototypes */
#ifdef __cplusplus
}
#endif