ble_gatt_client
|
#include <stdbool.h>
#include <sys/uio.h>
Go to the source code of this file.
Typedefs | |
typedef void(* | io_destroy_func_t )(void *data) |
typedef bool(* | io_callback_func_t )(struct io *io, void *user_data) |
Functions | |
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) |
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) |
void io_destroy | ( | struct io * | io | ) |
remove the fd from the 'mainloop' and reset all io call back, unref the io data structure
io | pointer to the io data structure |
Definition at line 226 of file io-mainloop.c.
References io::disconnect_callback, io::fd, io_unref(), mainloop_remove_fd(), io::read_callback, and io::write_callback.
Referenced by bt_att_free(), and disconnect_cb().
int io_get_fd | ( | struct io * | io | ) |
return the fd (file descriptor, can be a socket) attached to the io data structure
io | pointer to io data structure |
Definition at line 246 of file io-mainloop.c.
References io::fd.
struct io* io_new | ( | int | fd | ) |
create a new io data structure
fd | file descriptor (includes socket) |
Definition at line 197 of file io-mainloop.c.
References io::close_on_destroy, io::events, io::fd, io_callback(), io_cleanup(), io_ref(), mainloop_add_fd(), and new0.
Referenced by bt_att_new().
ssize_t io_send | ( | struct io * | io, |
const struct iovec * | iov, | ||
int | iovcnt | ||
) |
send data to the underlying socket (actual write)
io | io structure which describe the underlying socket and its context |
iov | pointer to pdu, pdu length structure |
iovcnt | number of pdu to send (iov is an array) |
Definition at line 395 of file io-mainloop.c.
References io::fd.
Referenced by can_write_data().
bool io_set_close_on_destroy | ( | struct io * | io, |
bool | do_close | ||
) |
io | |
do_close |
Definition at line 260 of file io-mainloop.c.
References io::close_on_destroy.
Referenced by bt_att_set_close_on_unref().
bool io_set_disconnect_handler | ( | struct io * | io, |
io_callback_func_t | callback, | ||
void * | user_data, | ||
io_destroy_func_t | destroy | ||
) |
io | |
callback | |
user_data | |
destroy |
Definition at line 356 of file io-mainloop.c.
References io::disconnect_callback, io::disconnect_data, io::disconnect_destroy, io::events, io::fd, and mainloop_modify_fd().
Referenced by bt_att_new().
bool io_set_read_handler | ( | struct io * | io, |
io_callback_func_t | callback, | ||
void * | user_data, | ||
io_destroy_func_t | destroy | ||
) |
io | |
callback | |
user_data | |
destroy |
Definition at line 278 of file io-mainloop.c.
References io::events, io::fd, mainloop_modify_fd(), io::read_callback, io::read_data, and io::read_destroy.
Referenced by bt_att_new().
bool io_set_write_handler | ( | struct io * | io, |
io_callback_func_t | callback, | ||
void * | user_data, | ||
io_destroy_func_t | destroy | ||
) |
io | |
callback | |
user_data | |
destroy |
Definition at line 317 of file io-mainloop.c.
References io::events, io::fd, mainloop_modify_fd(), io::write_callback, io::write_data, and io::write_destroy.
Referenced by wakeup_writer().
bool io_shutdown | ( | struct io * | io | ) |
io |
Definition at line 417 of file io-mainloop.c.
References io::fd.
Referenced by can_read_data(), handle_conf(), handle_rsp(), and timeout_cb().