Primitive helper for sending packets of known size across a pipe.
◆ tf_packetstream_on_close_t
typedef void() tf_packetstream_on_close_t(void *user_data) |
A function called when a packetstream reads EOF.
- Parameters
-
◆ tf_packetstream_onreceive_t
typedef void() tf_packetstream_onreceive_t(int packet_type, const char *begin, size_t length, void *user_data) |
A function called when a packet is received.
- Parameters
-
packet_type | The type of the packet as specified by the sender. |
begin | The beginning of the data. |
length | The length of the data. |
user_data | User data. |
◆ tf_packetstream_t
A packet stream instance.
◆ uv_pipe_t
A handle to a UNIX-style pipe.
◆ tf_packetstream_close()
Close a packet stream.
- Parameters
-
◆ tf_packetstream_create()
Create a packet stream.
- Returns
- The packet stream.
◆ tf_packetstream_destroy()
Destroy a packet stream.
- Parameters
-
◆ tf_packetstream_get_pipe()
Get the internal pipe object from a packet stream.
- Parameters
-
- Returns
- The pipe.
◆ tf_packetstream_send()
void tf_packetstream_send |
( |
tf_packetstream_t * |
stream, |
|
|
int |
packet_type, |
|
|
const char * |
begin, |
|
|
size_t |
length |
|
) |
| |
Send a discrete packet over a packet stream.
- Parameters
-
stream | The packet stream. |
packet_type | The type of the packet. |
begin | The start of the packet data. |
length | The length of the packet data. |
◆ tf_packetstream_set_on_close()
Register a callback for when a stream reads EOF.
- Parameters
-
stream | The packet stream. |
callback | The callback. |
user_data | User data to pass to the callback. |
◆ tf_packetstream_set_on_receive()
Register the callback to be called when a message is received.
- Parameters
-
stream | The packet stream. |
callback | The callback function. |
user_data | User data to pass to the callback. |
◆ tf_packetstream_start()
Start a packet stream receiving.
- Parameters
-