3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
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.
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.
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
26 typedef void (*io_destroy_func_t)(void *data);
30 struct io *io_new(int fd);
31 void io_destroy(struct io *io);
33 int io_get_fd(struct io *io);
34 bool io_set_close_on_destroy(struct io *io, bool do_close);
36 bool io_shutdown(struct io *io);
38 typedef bool (*io_callback_func_t)(struct io *io, void *user_data);
40 bool io_set_read_handler(struct io *io, io_callback_func_t callback,
41 void *user_data, io_destroy_func_t destroy);
42 bool io_set_write_handler(struct io *io, io_callback_func_t callback,
43 void *user_data, io_destroy_func_t destroy);
44 bool io_set_disconnect_handler(struct io *io, io_callback_func_t callback,
45 void *user_data, io_destroy_func_t destroy);