| libonion
    | 
Websocket data type, as returned by onion_websocket_new. More...
#include <types.h>
| Public Types | |
| enum | onion_websocket_opcode_e | 
| Types of fragments that websockets support.  More... | |
| typedef onion_connection_status(* | onion_websocket_callback_t )(void *privdata, onion_websocket *ws, ssize_t data_ready_length) | 
| Prototype for websocket callbacks. | |
| Public Member Functions | |
| onion_websocket * | onion_websocket_new (onion_request *req, onion_response *res) | 
| Creates a websocket connection from the given request to the response. | |
| void | onion_websocket_free (onion_websocket *ws) | 
| Frees the websocket. | |
| int | onion_websocket_write (onion_websocket *ws, const char *buffer, size_t _len) | 
| Writes a fragment to the websocket. | |
| int | onion_websocket_read (onion_websocket *ws, char *buffer, size_t len) | 
| Reads some data from the websocket. | |
| int | onion_websocket_vprintf (onion_websocket *ws, const char *fmt, va_list args) | 
| Uses vprintf-style writing to the websocket. | |
| int | onion_websocket_printf (onion_websocket *ws, const char *fmt,...) | 
| Uses printf-style writing to the websocket. | |
| void | onion_websocket_set_callback (onion_websocket *ws, onion_websocket_callback_t cb) | 
| Sets the next callback to call if more data is available. | |
| void | onion_websocket_set_userdata (onion_websocket *ws, void *userdata, void(*free_userdata)(void *)) | 
| Sets the userdata to use for this websocket connection. | |
| onion_connection_status | onion_websocket_call (onion_websocket *ws) | 
| Used internally when new data is ready on the websocket file descriptor. | |
| Data Fields | |
| onion_request * | req | 
| onion_websocket_callback_t | callback | 
| Associated request. | |
| void * | user_data | 
| Callback to call, if any, when new data is available. | |
| void(* | free_user_data )(void *) | 
| int64_t | data_left | 
| char | mask [4] | 
| int8_t | mask_pos | 
| int8_t | flags | 
| onion_websocket_opcode | opcode:4 | 
| Defined at websocket.c. | |
Websocket data type, as returned by onion_websocket_new.
FIXME: Some websocket description on how to use.
Ping requests (client->server) are handled internally. pong answers are not (server->client).
When a ping request is received, callback may be called with length=0, and no data waiting to be read.
| onion_websocket_callback_t onion_websocket_t::callback | 
Associated request.
Referenced by onion_websocket_call(), onion_websocket_free(), onion_websocket_new(), onion_websocket_read(), and onion_websocket_set_callback().
| int64_t onion_websocket_t::data_left | 
Referenced by onion_websocket_call(), onion_websocket_new(), and onion_websocket_read().
| int8_t onion_websocket_t::flags | 
Referenced by onion_websocket_new(), and onion_websocket_read().
| void(* onion_websocket_t::free_user_data)(void *) | 
Referenced by onion_websocket_free(), onion_websocket_new(), and onion_websocket_set_userdata().
| char onion_websocket_t::mask[4] | 
Referenced by onion_websocket_read().
| int8_t onion_websocket_t::mask_pos | 
Referenced by onion_websocket_read().
| onion_websocket_opcode onion_websocket_t::opcode | 
Defined at websocket.c.
Referenced by onion_websocket_get_opcode(), onion_websocket_new(), onion_websocket_set_opcode(), and onion_websocket_write().
| onion_request* onion_websocket_t::req | 
| void* onion_websocket_t::user_data | 
Callback to call, if any, when new data is available.
Referenced by onion_websocket_call(), onion_websocket_free(), onion_websocket_new(), and onion_websocket_set_userdata().
 1.8.1.2
 1.8.1.2