ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
io.h
Go to the documentation of this file.
1 /*
2  *
3  * BlueZ - Bluetooth protocol stack for Linux
4  *
5  * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
6  *
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 #include <stdbool.h>
25 #include <sys/uio.h>
26 
27 typedef void (*io_destroy_func_t)(void *data);
28 
29 struct io;
30 
31 struct io *io_new(int fd);
32 void io_destroy(struct io *io);
33 
34 int io_get_fd(struct io *io);
35 bool io_set_close_on_destroy(struct io *io, bool do_close);
36 
37 ssize_t io_send(struct io *io, const struct iovec *iov, int iovcnt);
38 bool io_shutdown(struct io *io);
39 
40 typedef bool (*io_callback_func_t)(struct io *io, void *user_data);
41 
42 bool io_set_read_handler(struct io *io, io_callback_func_t callback,
43  void *user_data, io_destroy_func_t destroy);
44 bool io_set_write_handler(struct io *io, io_callback_func_t callback,
45  void *user_data, io_destroy_func_t destroy);
46 bool io_set_disconnect_handler(struct io *io, io_callback_func_t callback,
47  void *user_data, io_destroy_func_t destroy);
data structure to manage io
Definition: io-mainloop.c:49
void io_destroy(struct io *io)
Definition: io-mainloop.c:226
struct io * io_new(int fd)
Definition: io-mainloop.c:197
bool io_set_disconnect_handler(struct io *io, io_callback_func_t callback, void *user_data, io_destroy_func_t destroy)
Definition: io-mainloop.c:356
void(* io_destroy_func_t)(void *data)
Definition: io.h:27
bool io_set_write_handler(struct io *io, io_callback_func_t callback, void *user_data, io_destroy_func_t destroy)
Definition: io-mainloop.c:317
bool io_set_read_handler(struct io *io, io_callback_func_t callback, void *user_data, io_destroy_func_t destroy)
Definition: io-mainloop.c:278
bool io_set_close_on_destroy(struct io *io, bool do_close)
Definition: io-mainloop.c:260
int io_get_fd(struct io *io)
Definition: io-mainloop.c:246
bool io_shutdown(struct io *io)
Definition: io-mainloop.c:417
bool(* io_callback_func_t)(struct io *io, void *user_data)
Definition: io.h:40
int fd
Definition: io-mainloop.c:51
ssize_t io_send(struct io *io, const struct iovec *iov, int iovcnt)
Definition: io-mainloop.c:395