Tizen RT Libs&Environment  v1.0 D5
websocket.h File Reference

websocket header to support WS/WSS server and client. More...

#include <stdint.h>
#include <netinet/in.h>
#include <apps/netutils/wslay/wslay.h>
#include <tinyara/wqueue.h>
#include "tls/config.h"
#include "tls/entropy.h"
#include "tls/ctr_drbg.h"
#include "tls/certs.h"
#include "tls/x509.h"
#include "tls/ssl.h"
#include "tls/net.h"
#include "tls/error.h"
#include "tls/debug.h"
#include "tls/ssl_cache.h"
Include dependency graph for websocket.h:

Go to the source code of this file.

Data Structures

struct  websocket_t
 structure to manage websocket client/server More...
 
struct  websocket_info_t
 data structure to use in callbacks. More...
 

Macros

#define WEBSOCKET_DEBUG_PRINT
 
#define WEBSOCKET_DEBUG   ndbg
 
#define WS_GUID   "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
 Websocket GUID defined by RFC 6455. More...
 
#define WEBSOCKET_STACKSIZE   (1024 * 10)
 The maximum stack size of websocket. More...
 
#define WEBSOCKET_PRI   100
 The priority of websocket. More...
 
#define WEBSOCKET_SCHED_POLICY   SCHED_RR
 The schedule policy of websocket.. More...
 
#define WEBSOCKET_WQ   LPWORK
 Websocket timer workqueue. More...
 
#define WEBSOCKET_CLIENT_KEY_LEN   (24)
 Websocket http handshake key buffer size. More...
 
#define WEBSOCKET_ACCEPT_KEY_LEN   (29)
 Websocket http handshake key buffer size. More...
 
#define WEBSOCKET_HANDSHAKE_HEADER_SIZE   (2048)
 Websocket http handshake buffer size. More...
 
#define WEBSOCKET_SERVERNAME   "localhost"
 Set host name for servername TLS extension. More...
 
#define WEBSOCKET_SOCK_RCV_TIMEOUT   (5 * 1000)
 Websocket socket input timeout value, msec. More...
 
#define WEBSOCKET_SERVER_CHECK_INTERVAL   (500)
 Websocket accept server select() timeout value, msec. More...
 
#define WEBSOCKET_SERVER_TIMEOUT   (3 * 60 * 1000)
 Websocket accept server select() timeout limit, msec. More...
 
#define WEBSOCKET_HANDLER_TIMEOUT   (300)
 Websocket event handler select() timeout value, msec. More...
 
#define WEBSOCKET_MAX_PING_IGNORE   (3)
 Ping message limits without pong. More...
 
#define WEBSOCKET_PING_INTERVAL   (20 * 100)
 Websocket ping message interval, MSEC_PER_TICK. More...
 
#define WEBSOCKET_MAX_LENGTH_QUEUE   (100 * 1024)
 The maximum amount of websocket messages to be stored in queue. More...
 
#define WEBSOCKET_MAX_NUMBER_QUEUE   (20)
 The maximum amount of websocket messages to be stored in queue. More...
 
#define WEBSOCKET_MAX_CLIENT   (3)
 The maximum amount of client to accept from server. More...
 
#define websocket_context_ptr   wslay_event_context_ptr
 Websocket context pointer wrapper. More...
 
#define websocket_cb_t   struct wslay_event_callbacks
 Websocket structure wrapper to carry call back pointers. More...
 
#define websocket_frame_t   struct wslay_event_msg
 Websocket structure wrapper to send a frame. More...
 
#define websocket_fragmented_frame_t   struct wslay_event_fragmented_msg
 Websocket structure wrapper to send a fragmented frame. More...
 
#define websocket_on_msg_arg   struct wslay_event_on_msg_recv_arg
 Websocket structure wrapper to receive a message. More...
 
#define websocket_recv_start_arg   struct wslay_event_on_frame_recv_start_arg
 Websocket structure wrapper to receive a raw frame. More...
 
#define websocket_recv_chunk_arg   struct wslay_event_on_frame_recv_chunk_arg
 Websocket structure wrapper to receive a chunked frame. More...
 
#define WEBSOCKET_CHECK_NOT_CTRL_FRAME(x)   (!(((x) >> 3) & 1))
 a macro that checks the websocket frame is not a control frame. More...
 
#define WEBSOCKET_CHECK_TEXT_FRAME(x)   (((uint8_t)(x)) == ((uint8_t)(WEBSOCKET_TEXT_FRAME)))
 a macro that checks the websocket frame is a text frame. More...
 
#define WEBSOCKET_CHECK_BINARY_FRAME(x)   (((uint8_t)(x)) == ((uint8_t)(WEBSOCKET_BINARY_FRAME)))
 a macro that checks the websocket frame is a binary frame. More...
 
#define WEBSOCKET_CHECK_CTRL_CLOSE(x)   (((uint8_t)(x)) == ((uint8_t)(WEBSOCKET_CONNECTION_CLOSE)))
 a macro that checks the websocket frame is a close frame. More...
 
#define WEBSOCKET_CHECK_CTRL_PING(x)   (((uint8_t)(x)) == ((uint8_t)(WEBSOCKET_PING)))
 a macro that checks the websocket frame is a ping frame. More...
 
#define WEBSOCKET_CHECK_CTRL_PONG(x)   (((uint8_t)(x)) == ((uint8_t)(WEBSOCKET_PONG)))
 a macro that checks the websocket frame is a pong frame. More...
 
#define EXTERN   extern
 

Enumerations

Functions

void websocket_create_accept_key (unsigned char *dst, size_t dlen, const unsigned char *src, size_t slen)
 websocket_create_accept_key More...
 
int websocket_count_table (void)
 websocket_count_table() returns amount of working websocket server. More...
 
websocket_twebsocket_find_table (void)
 websocket_find_table() returns websocket_t * to manage websocket server. More...
 
websocket_return_t websocket_client_open (websocket_t *client, char *addr, char *port, char *path)
 websocket_client_open() initiates websocket client ready to send and receive websocket message. More...
 
websocket_return_t websocket_server_open (websocket_t *server)
 websocket_server_open() initiates websocket server. More...
 
websocket_return_t websocket_server_init (websocket_t *server)
 websocket_server_init More...
 
void websocket_register_cb (websocket_t *websocket, websocket_cb_t *cb)
 websocket_register_cb() changes a websocket callback structure in a websocket context. More...
 
websocket_return_t websocket_queue_msg (websocket_t *websocket, websocket_frame_t *tx_frame)
 
websocket_return_t websocket_queue_ping (websocket_t *websocket)
 websocket_queue_ping() is used to send a websocket ping message. More...
 
websocket_return_t websocket_queue_close (websocket_t *websocket, const char *close_message)
 websocket_queue_close() closes the websocket. More...
 
void websocket_update_state (websocket_t *websocket, int state)
 websocket_update_state() changes websocket state. More...
 
void websocket_set_error (websocket_t *websocket, int val)
 websocket_set_error() sets an error number to websocket context. More...
 

Detailed Description

websocket header to support WS/WSS server and client.

Definition in file websocket.h.