A few more .h file docs.
This commit is contained in:
		| @@ -8,19 +8,67 @@ | ||||
|  | ||||
| #include <stddef.h> | ||||
|  | ||||
| /** A handle to a UNIX-style pipe. */ | ||||
| typedef struct uv_pipe_s uv_pipe_t; | ||||
|  | ||||
| /** A packet stream instance. */ | ||||
| typedef struct _tf_packetstream_t tf_packetstream_t; | ||||
|  | ||||
| /** | ||||
| ** A function called when a packet is received. | ||||
| ** @param packet_type The type of the packet as specified by the sender. | ||||
| ** @param begin The beginning of the data. | ||||
| ** @param length The length of the data. | ||||
| ** @param user_data User data. | ||||
| */ | ||||
| typedef void(tf_packetstream_onreceive_t)(int packet_type, const char* begin, size_t length, void* user_data); | ||||
|  | ||||
| /** | ||||
| ** Create a packet stream. | ||||
| ** @return The packet stream. | ||||
| */ | ||||
| tf_packetstream_t* tf_packetstream_create(); | ||||
|  | ||||
| /** | ||||
| ** Destroy a packet stream. | ||||
| ** @param stream The packet stream. | ||||
| */ | ||||
| void tf_packetstream_destroy(tf_packetstream_t* stream); | ||||
|  | ||||
| /** | ||||
| ** Start a packet stream receiving. | ||||
| ** @param stream The packet stream. | ||||
| */ | ||||
| void tf_packetstream_start(tf_packetstream_t* stream); | ||||
|  | ||||
| /** | ||||
| ** Send a discrete packet over a packet stream. | ||||
| ** @param stream The packet stream. | ||||
| ** @param packet_type The type of the packet. | ||||
| ** @param begin The start of the packet data. | ||||
| ** @param length The length of the packet data. | ||||
| */ | ||||
| void tf_packetstream_send(tf_packetstream_t* stream, int packet_type, const char* begin, size_t length); | ||||
|  | ||||
| /** | ||||
| ** Register the callback to be called when a message is received. | ||||
| ** @param stream The packet stream. | ||||
| ** @param callback The callback function. | ||||
| ** @param user_data User data to pass to the callback. | ||||
| */ | ||||
| void tf_packetstream_set_on_receive(tf_packetstream_t* stream, tf_packetstream_onreceive_t* callback, void* user_data); | ||||
|  | ||||
| /** | ||||
| ** Close a packet stream. | ||||
| ** @param stream The packet stream. | ||||
| */ | ||||
| void tf_packetstream_close(tf_packetstream_t* stream); | ||||
|  | ||||
| /** | ||||
| ** Get the internal pipe object from a packet stream. | ||||
| ** @param stream The packet stream. | ||||
| ** @return The pipe. | ||||
| */ | ||||
| uv_pipe_t* tf_packetstream_get_pipe(tf_packetstream_t* stream); | ||||
|  | ||||
| /** @} */ | ||||
|   | ||||
| @@ -9,10 +9,29 @@ | ||||
|  | ||||
| #include "quickjs.h" | ||||
|  | ||||
| /** A task. */ | ||||
| typedef struct _tf_task_t tf_task_t; | ||||
| /** A handle to a remote task. */ | ||||
| typedef struct _tf_taskstub_t tf_taskstub_t; | ||||
|  | ||||
| /** | ||||
| ** Store JS data in a binary blob. | ||||
| ** @param task The calling task. | ||||
| ** @param to The handle to the task to which the data will be sent. | ||||
| ** @param[out] out_buffer Populated with the stored data. | ||||
| ** @param[out] out_size Populated with the size of out_data. | ||||
| ** @param value The JS value to store. | ||||
| */ | ||||
| void tf_serialize_store(tf_task_t* task, tf_taskstub_t* to, void** out_buffer, size_t* out_size, JSValue value); | ||||
|  | ||||
| /** | ||||
| ** Retrieve JS data from a binary blob. | ||||
| ** @param task The calling task. | ||||
| ** @param from The handle to the task from which the data was received. | ||||
| ** @param buffer The data. | ||||
| ** @param size The size of the data. | ||||
| ** @return The received JS data. | ||||
| */ | ||||
| JSValue tf_serialize_load(tf_task_t* task, tf_taskstub_t* from, const char* buffer, size_t size); | ||||
|  | ||||
| /** @} */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user