diff options
author | root <root@no.no.james.local> | 2015-09-01 10:10:22 +0100 |
---|---|---|
committer | root <root@no.no.james.local> | 2015-09-01 10:10:22 +0100 |
commit | 7e25356deec3369773e3949fe7336d84c10834c0 (patch) | |
tree | 19b4f4b2d1c56d4c33e30965dcb3405fb2aefc82 /bluez/io.h | |
parent | 475922ce345bb0443cf4fdef00efa86676a1bf62 (diff) | |
download | nrfdfu-7e25356deec3369773e3949fe7336d84c10834c0.tar.gz nrfdfu-7e25356deec3369773e3949fe7336d84c10834c0.tar.bz2 nrfdfu-7e25356deec3369773e3949fe7336d84c10834c0.zip |
fish
Diffstat (limited to 'bluez/io.h')
-rw-r--r-- | bluez/io.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bluez/io.h b/bluez/io.h new file mode 100644 index 0000000..8bc1111 --- /dev/null +++ b/bluez/io.h @@ -0,0 +1,47 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2012-2014 Intel Corporation. All rights reserved. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <stdbool.h> +#include <sys/uio.h> + +typedef void (*io_destroy_func_t)(void *data); + +struct io; + +struct io *io_new(int fd); +void io_destroy(struct io *io); + +int io_get_fd(struct io *io); +bool io_set_close_on_destroy(struct io *io, bool do_close); + +ssize_t io_send(struct io *io, const struct iovec *iov, int iovcnt); +bool io_shutdown(struct io *io); + +typedef bool (*io_callback_func_t)(struct io *io, void *user_data); + +bool io_set_read_handler(struct io *io, io_callback_func_t callback, + void *user_data, io_destroy_func_t destroy); +bool io_set_write_handler(struct io *io, io_callback_func_t callback, + void *user_data, io_destroy_func_t destroy); +bool io_set_disconnect_handler(struct io *io, io_callback_func_t callback, + void *user_data, io_destroy_func_t destroy); |