libgpac
Documentation of the core library of GPAC
Loading...
Searching...
No Matches
rmt_ws.h File Reference

Data Structures

struct  RMT_Settings
 Struture to fill in to modify default settings. More...
 

Typedefs

typedef void(* rmt_on_new_client_cbk) (void *task, void *new_client)
 
typedef void(* rmt_client_on_data_cbk) (void *task, const u8 *payload, u64 size, Bool is_binary)
 
typedef void(* rmt_client_on_del_cbk) (void *task)
 

Enumerations

enum  RMT_Callback_type { RMT_CALLBACK_NONE =0x12 , RMT_CALLBACK_JS , RMT_CALLBACK_NODE }
 

Functions

RMT_WSrmt_ws_new ()
 creates the main instance
 
void rmt_ws_run (RMT_WS *)
 starts the server thread
 
void rmt_ws_del (RMT_WS *rmt_ws)
 deletes the main instance
 
RMT_Settingsgf_rmt_get_settings (RMT_WS *)
 gets the current rmtws settings (creates the structure if necessary)
 
void gf_rmt_set_on_new_client_cbk (RMT_WS *rmt, void *task, rmt_on_new_client_cbk cbk)
 
void * gf_rmt_get_on_new_client_task (RMT_WS *)
 gets the userdata associated with the new client callback if defined
 
const char * gf_rmt_get_peer_address (RMT_ClientCtx *client)
 
GF_Err gf_rmt_client_send_to_ws (RMT_ClientCtx *client, const char *msg, u64 size, Bool is_binary)
 
void gf_rmt_client_set_on_data_cbk (RMT_ClientCtx *client, void *task, rmt_client_on_data_cbk cbk)
 
void * gf_rmt_client_get_on_data_task (RMT_ClientCtx *client)
 gets the userdata associated with the client on data callback if defined
 
void gf_rmt_client_set_on_del_cbk (RMT_ClientCtx *client, void *task, rmt_client_on_del_cbk cbk)
 
void * gf_rmt_client_get_on_del_task (RMT_ClientCtx *client)
 gets the userdata associated with the client on deleted callback if defined
 
RMT_WSgf_rmt_client_get_rmt (RMT_ClientCtx *client)
 gets the ws server handler associated with a client
 

Data Structure Documentation

◆ RMT_Settings

struct RMT_Settings

Struture to fill in to modify default settings.

Data Fields
u16 port Which port to listen for incoming connections on.
u32 timeout_secs inactivity timeout before closing connections
u32 ping_secs time between websocket ping requests (0 to disable)
Bool limit_connections_to_localhost Only allow connections on localhost?
u32 msSleepBetweenServerUpdates How long to sleep between server updates.
rmt_on_new_client_cbk on_new_client_cbk function to call when a new websocket connection is accepted
void * on_new_client_cbk_task context for on_new_client_cbk
const char * cert server certificate and private key to use for ssl websocket (null to disable wss)
const char * pkey

Typedef Documentation

◆ rmt_on_new_client_cbk

typedef void(* rmt_on_new_client_cbk) (void *task, void *new_client)

type for callbacks called when a new client connects

Parameters
taskuser data sent back to the callback
new_clienta structure representing the client (of type RMT_ClientCtx)

◆ rmt_client_on_data_cbk

typedef void(* rmt_client_on_data_cbk) (void *task, const u8 *payload, u64 size, Bool is_binary)

type for callbacks called when a client receives data on the websocket

Parameters
taskuser data passed back to the callback
payloada buffer containing the data received
sizethe size of the data received
is_binaryfalse the data is a utf8 string, true otherwise

◆ rmt_client_on_del_cbk

typedef void(* rmt_client_on_del_cbk) (void *task)

type for callbacks called when a client is deleted (e.g. on disconnects)

Parameters
taskuser data passed back to the callback

Enumeration Type Documentation

◆ RMT_Callback_type

Enumerator
RMT_CALLBACK_NONE 
RMT_CALLBACK_JS 
RMT_CALLBACK_NODE 

Function Documentation

◆ rmt_ws_new()

RMT_WS * rmt_ws_new ( )

creates the main instance

+ Here is the caller graph for this function:

◆ rmt_ws_run()

void rmt_ws_run ( RMT_WS rmt)

starts the server thread

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rmt_ws_del()

void rmt_ws_del ( RMT_WS rmt_ws)

deletes the main instance

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_rmt_get_settings()

RMT_Settings * gf_rmt_get_settings ( RMT_WS rmt)

gets the current rmtws settings (creates the structure if necessary)

+ Here is the caller graph for this function:

◆ gf_rmt_set_on_new_client_cbk()

void gf_rmt_set_on_new_client_cbk ( RMT_WS rmt,
void *  task,
rmt_on_new_client_cbk  cbk 
)

sets the callback called when new clients connect to the sever

Parameters
rmtthe structure representing the server handler
taskuser data stored and passed back to the callback
cbkthe callback of type rmt_on_new_client_cbk
+ Here is the call graph for this function:

◆ gf_rmt_get_on_new_client_task()

void * gf_rmt_get_on_new_client_task ( RMT_WS rmt)

gets the userdata associated with the new client callback if defined

◆ gf_rmt_get_peer_address()

const char * gf_rmt_get_peer_address ( RMT_ClientCtx *  client)

gets a string representing the client in the format ip:port

Parameters
clientthe client object
Returns
a "ip:port" string of the given client

◆ gf_rmt_client_send_to_ws()

GF_Err gf_rmt_client_send_to_ws ( RMT_ClientCtx *  client,
const char *  msg,
u64  size,
Bool  is_binary 
)

sends data to a client on the websocket

Parameters
clientthe client object
msga buffer containing the data to send
sizethe size of the data to send
is_binaryfalse if we're sending a utf8 string, true otherwise
+ Here is the call graph for this function:

◆ gf_rmt_client_set_on_data_cbk()

void gf_rmt_client_set_on_data_cbk ( RMT_ClientCtx *  client,
void *  task,
rmt_client_on_data_cbk  cbk 
)

sets the callback called when a client receives data

Parameters
clientthe client for which we are setting the callback
taskuser data stored and passed back to the callback
cbkthe callback of type rmt_client_on_data_cbk

◆ gf_rmt_client_get_on_data_task()

void * gf_rmt_client_get_on_data_task ( RMT_ClientCtx *  client)

gets the userdata associated with the client on data callback if defined

◆ gf_rmt_client_set_on_del_cbk()

void gf_rmt_client_set_on_del_cbk ( RMT_ClientCtx *  client,
void *  task,
rmt_client_on_del_cbk  cbk 
)

sets the callback called when a client is deleted

Parameters
clientthe client for which we are setting the callback
taskuser data stored and passed back to the callback
cbkthe callback of type rmt_client_on_del_cbk

◆ gf_rmt_client_get_on_del_task()

void * gf_rmt_client_get_on_del_task ( RMT_ClientCtx *  client)

gets the userdata associated with the client on deleted callback if defined

◆ gf_rmt_client_get_rmt()

RMT_WS * gf_rmt_client_get_rmt ( RMT_ClientCtx *  client)

gets the ws server handler associated with a client