|
Electroneum
|

Go to the source code of this file.
Classes | |
| struct | tube |
| struct | tube_res_list |
Typedefs | |
| typedef void | tube_callback_type(struct tube *, uint8_t *, size_t, int, void *) |
Functions | |
| struct tube * | tube_create (void) |
| void | tube_delete (struct tube *tube) |
| int | tube_write_msg (struct tube *tube, uint8_t *buf, uint32_t len, int nonblock) |
| int | tube_read_msg (struct tube *tube, uint8_t **buf, uint32_t *len, int nonblock) |
| void | tube_close_read (struct tube *tube) |
| void | tube_close_write (struct tube *tube) |
| int | tube_poll (struct tube *tube) |
| int | tube_wait (struct tube *tube) |
| int | tube_read_fd (struct tube *tube) |
| int | tube_setup_bg_listen (struct tube *tube, struct comm_base *base, tube_callback_type *cb, void *arg) |
| void | tube_remove_bg_listen (struct tube *tube) |
| int | tube_setup_bg_write (struct tube *tube, struct comm_base *base) |
| void | tube_remove_bg_write (struct tube *tube) |
| int | tube_queue_item (struct tube *tube, uint8_t *msg, size_t len) |
| int | tube_handle_listen (struct comm_point *c, void *arg, int error, struct comm_reply *reply_info) |
| int | tube_handle_write (struct comm_point *c, void *arg, int error, struct comm_reply *reply_info) |
| void | tube_handle_signal (int fd, short events, void *arg) |
This file contains pipe service functions.
Definition in file tube.h.
| void tube_close_read | ( | struct tube * | tube | ) |
Close read part of the pipe. The tube can no longer be read from.
| tube | tube to operate on. |
| void tube_close_write | ( | struct tube * | tube | ) |
Close write part of the pipe. The tube can no longer be written to.
| tube | tube to operate on. |
| struct tube* tube_create | ( | void | ) |
Create a pipe
| void tube_delete | ( | struct tube * | tube | ) |
Delete and destroy a pipe
| tube | to delete |
| int tube_handle_listen | ( | struct comm_point * | c, |
| void * | arg, | ||
| int | error, | ||
| struct comm_reply * | reply_info | ||
| ) |
for fptr wlist, callback function
| void tube_handle_signal | ( | int | fd, |
| short | events, | ||
| void * | arg | ||
| ) |
for fptr wlist, winsock signal event callback function
| int tube_handle_write | ( | struct comm_point * | c, |
| void * | arg, | ||
| int | error, | ||
| struct comm_reply * | reply_info | ||
| ) |
for fptr wlist, callback function
| int tube_poll | ( | struct tube * | tube | ) |
See if data is ready for reading on the tube without blocking.
| tube | tube to check for readable items |
Append data item to background list of writes. Mallocs a list entry behind the scenes. Not locked behind the scenes, call from one thread or lock on outside.
| tube | what tube to queue on. |
| msg | memory message to send. Is free()d after use. Put at the end of the to-send queue. |
| len | length of item. |
| int tube_read_fd | ( | struct tube * | tube | ) |
Get FD that is readable when new information arrives.
| tube |
Read length bytes followed by message.
| tube | The tube to read on. If that tube is a pipe, its read fd is used as the socket to read on. Is nonblocking. Set to blocking by the function, and back to non-blocking at exit of function. |
| buf | the message, malloced. |
| len | length of message, returned. |
| nonblock | if set to true, the first read is nonblocking. If the first read fails the function returns -1. If set false, the first read is blocking. |
| void tube_remove_bg_listen | ( | struct tube * | tube | ) |
Remove bg listen setup from event base.
| tube | what tube to cleanup |
| void tube_remove_bg_write | ( | struct tube * | tube | ) |
Remove bg write setup from event base.
| tube | what tube to cleanup |
| int tube_setup_bg_listen | ( | struct tube * | tube, |
| struct comm_base * | base, | ||
| tube_callback_type * | cb, | ||
| void * | arg | ||
| ) |
Start listening for information over the pipe. Background registration of a read listener, callback when read completed. Do not mix with tube_read_msg style direct reads from the pipe.
| tube | tube to listen on |
| base | what base to register event callback. |
| cb | callback routine. |
| arg | user argument for callback routine. |
Start background write handler for the pipe. Do not mix with tube_write_msg style direct writes to the pipe.
| tube | tube to write on |
| base | what base to register event handler on. |
| int tube_wait | ( | struct tube * | tube | ) |
Wait for data to be ready for reading on the tube. is blocking. No timeout.
| tube | the tube to wait on. |
Write length bytes followed by message.
| tube | the tube to write on. If that tube is a pipe, its write fd is used as the socket to write on. Is nonblocking. Set to blocking by the function, and back to non-blocking at exit of function. |
| buf | the message. |
| len | length of message. |
| nonblock | if set to true, the first write is nonblocking. If the first write fails the function returns -1. If set false, the first write is blocking. |