ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
mainloop.h
Go to the documentation of this file.
1 /*
2  *
3  * BlueZ - Bluetooth protocol stack for Linux
4  *
5  * Copyright (C) 2011-2014 Intel Corporation
6  * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library 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 GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; 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 void mainloop_exit_success(void);
37 void mainloop_exit_failure(void);
38 int mainloop_run(void);
39 
40 int mainloop_add_fd(int fd, uint32_t events, mainloop_event_func callback,
42 int mainloop_modify_fd(int fd, uint32_t events);
43 int mainloop_remove_fd(int fd);
44 
47 int mainloop_modify_timeout(int fd, unsigned int msec);
48 int mainloop_remove_timeout(int id);
49 
mainloop_signal_func callback
Definition: mainloop.c:89
int mainloop_remove_fd(int fd)
Definition: mainloop.c:322
void(* mainloop_timeout_func)(int id, void *user_data)
Definition: mainloop.h:31
int mainloop_add_timeout(unsigned int msec, mainloop_timeout_func callback, void *user_data, mainloop_destroy_func destroy)
Definition: mainloop.c:388
int mainloop_modify_fd(int fd, uint32_t events)
Definition: mainloop.c:296
void mainloop_exit_success(void)
Definition: mainloop.c:125
void(* mainloop_event_func)(int fd, uint32_t events, void *user_data)
Definition: mainloop.h:30
int mainloop_remove_timeout(int id)
Definition: mainloop.c:442
void mainloop_exit_failure(void)
Definition: mainloop.c:135
void(* mainloop_signal_func)(int signum, void *user_data)
Definition: mainloop.h:32
sigset_t mask
Definition: mainloop.c:88
void * user_data
Definition: mainloop.c:91
int mainloop_set_signal(sigset_t *mask, mainloop_signal_func callback, void *user_data, mainloop_destroy_func destroy)
Definition: mainloop.c:457
mainloop_destroy_func destroy
Definition: mainloop.c:90
int mainloop_add_fd(int fd, uint32_t events, mainloop_event_func callback, void *user_data, mainloop_destroy_func destroy)
Definition: mainloop.c:252
int mainloop_run(void)
Definition: mainloop.c:174
void mainloop_init(void)
Definition: mainloop.c:101
int mainloop_modify_timeout(int fd, unsigned int msec)
Definition: mainloop.c:429
void(* mainloop_destroy_func)(void *user_data)
Definition: mainloop.h:28
void mainloop_quit(void)
Definition: mainloop.c:116