Initialize Tizen 2.3
[framework/connectivity/bluez.git] / mobile / monitor / mainloop.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2011-2012  Intel Corporation
6  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #include <signal.h>
26 #include <sys/epoll.h>
27
28 typedef void (*mainloop_destroy_func) (void *user_data);
29
30 typedef void (*mainloop_event_func) (int fd, uint32_t events, void *user_data);
31 typedef void (*mainloop_timeout_func) (int id, void *user_data);
32 typedef void (*mainloop_signal_func) (int signum, void *user_data);
33
34 void mainloop_init(void);
35 void mainloop_quit(void);
36 int mainloop_run(void);
37
38 int mainloop_add_fd(int fd, uint32_t events, mainloop_event_func callback,
39                                 void *user_data, mainloop_destroy_func destroy);
40 int mainloop_modify_fd(int fd, uint32_t events);
41 int mainloop_remove_fd(int fd);
42
43 int mainloop_add_timeout(unsigned int seconds, mainloop_timeout_func callback,
44                                 void *user_data, mainloop_destroy_func destroy);
45 int mainloop_modify_timeout(int fd, unsigned int seconds);
46 int mainloop_remove_timeout(int id);
47
48 int mainloop_set_signal(sigset_t *mask, mainloop_signal_func callback,
49                                 void *user_data, mainloop_destroy_func destroy);