Data Structures | |
struct | websocket |
Macros | |
#define | WEBSOCKET_MAX_URLLEN WEBSOCKET_CONF_MAX_URLLEN |
Typedefs | |
typedef void(* | websocket_callback )(struct websocket *s, websocket_result result, uint8_t *data, uint16_t datalen) |
Enumerations | |
enum | { WEBSOCKET_STATE_CLOSED = 0, WEBSOCKET_STATE_DNS_REQUEST_SENT = 1, WEBSOCKET_STATE_HTTP_REQUEST_SENT = 2, WEBSOCKET_STATE_WAITING_FOR_HEADER = 3, WEBSOCKET_STATE_RECEIVING_HEADER = 4, WEBSOCKET_STATE_HEADER_RECEIVED = 5, WEBSOCKET_STATE_RECEIVING_DATA = 6 } |
enum | websocket_result { WEBSOCKET_ERR = 0, WEBSOCKET_OK = 1, WEBSOCKET_IN_PROGRESS = 2, WEBSOCKET_HOSTNAME_NOT_FOUND = 3, WEBSOCKET_CONNECTED = 4, WEBSOCKET_DATA = 5, WEBSOCKET_RESET = 6, WEBSOCKET_TIMEDOUT = 7, WEBSOCKET_CLOSED = 8, WEBSOCKET_PINGED = 9, WEBSOCKET_DATA_RECEIVED = 10, WEBSOCKET_PONG_RECEIVED = 11 } |
Functions | |
void | websocket_close (struct websocket *s) |
void | websocket_init (void) |
websocket_result | websocket_open (struct websocket *s, const char *url, const char *subprotocol, websocket_callback c) |
int | websocket_ping (struct websocket *s) |
int | websocket_send (struct websocket *s, const uint8_t *data, uint16_t datalen) |
int | websocket_send_str (struct websocket *s, const char *strptr) |
#define WEBSOCKET_MAX_URLLEN WEBSOCKET_CONF_MAX_URLLEN |
Referenced by websocket_open().
typedef void(* websocket_callback)(struct websocket *s, websocket_result result, uint8_t *data, uint16_t datalen) |
anonymous enum |
enum websocket_result |
void websocket_close | ( | struct websocket * | s | ) |
References websocket::s, websocket::state, WEBSOCKET_CLOSED, and websocket_http_client_close().
Referenced by receive_header_byte(), and websocket_open().
void websocket_init | ( | void | ) |
References inited, list_init(), NULL, and process_start().
Referenced by websocket_open().
websocket_result websocket_open | ( | struct websocket * | s, |
const char * | url, | ||
const char * | subprotocol, | ||
websocket_callback | c | ||
) |
References c, websocket::callback, inited, list_add(), NULL, PRINTF, PROCESS_CONTEXT_BEGIN, PROCESS_CONTEXT_END, ret, start_get(), websocket::state, strncpy(), websocket::subprotocol, websocket::url, websocket_close(), WEBSOCKET_CONF_MAX_SUBPROTOLEN, WEBSOCKET_ERR, websocket_init(), WEBSOCKET_MAX_URLLEN, and WEBSOCKET_STATE_CLOSED.
int websocket_ping | ( | struct websocket * | s | ) |
int websocket_send | ( | struct websocket * | s, |
const uint8_t * | data, | ||
uint16_t | datalen | ||
) |
References send_data, and WEBSOCKET_OPCODE_BIN.
int websocket_send_str | ( | struct websocket * | s, |
const char * | strptr | ||
) |
References send_data, and WEBSOCKET_OPCODE_TEXT.