Typedefs | Functions
ws_connection.h File Reference

WebSocket server-side connection. More...

Typedefs

typedef struct vtm_ws_con vtm_ws_con
 

Functions

VTM_API int vtm_ws_con_send_msg (vtm_ws_con *con, enum vtm_ws_msg_type type, const void *data, size_t len)
 
VTM_API int vtm_ws_con_get_remote_info (vtm_ws_con *con, char *buf, size_t len, unsigned int *port)
 

Function Documentation

VTM_API int vtm_ws_con_send_msg ( vtm_ws_con *  con,
enum vtm_ws_msg_type  type,
const void *  data,
size_t  len 
)

Sends a message to the peer.

Parameters
conthe connection where the message should be sent over
typethe type of the WebSocket message
datapointer to message payload
lenlength of payload in bytes
Returns
VTM_OK if the transmission was successfully started
VTM_E_IO_UNKNOWN or VTM_ERROR if an error occcured
VTM_API int vtm_ws_con_get_remote_info ( vtm_ws_con *  con,
char *  buf,
size_t  len,
unsigned int *  port 
)

Retrieves the source ip address and used port of a client connection.

Parameters
conthe connection whose remote address should be retrieved
[out]bufthe buffer where the ip address string representation is stored
lenthe length of the buffer in bytes
[out]portthe used port number
Returns
VTM_OK if the address was successfully retrieved
VTM_E_IO_UNKNOWN or VTM_ERROR if an error occcured