![]() |
libgpac
Documentation of the core library of GPAC
|
#include <gpac/tools.h>
#include <gpac/thread.h>
#include <gpac/list.h>
#include <gpac/bitstream.h>
#include <gpac/network.h>
#include <gpac/download.h>
#include <gpac/base_coding.h>
Data Structures | |
struct | RMT_WS |
Handle to the main instance. More... | |
struct | RMT_ServerCtx |
structure representing the http server More... | |
struct | RMT_ClientCtx |
structure representing a websocket client More... | |
Enumerations | |
enum | { RMT_WEBSOCKET_CONTINUATION = 0 , RMT_WEBSOCKET_TEXT = 1 , RMT_WEBSOCKET_BINARY = 2 , RMT_WEBSOCKET_CLOSE = 8 , RMT_WEBSOCKET_PING = 9 , RMT_WEBSOCKET_PONG = 10 } |
Functions | |
GF_DownloadSession * | gf_dm_sess_new_server (GF_DownloadManager *dm, GF_Socket *server, void *ssl_ctx, gf_dm_user_io user_io, void *usr_cbk, Bool async, GF_Err *e) |
void | gf_dm_sess_set_header (GF_DownloadSession *sess, const char *name, const char *value) |
GF_Err | gf_dm_sess_send_reply (GF_DownloadSession *sess, u32 reply_code, const char *response_body, u32 body_len, Bool no_body) |
void | gf_dm_sess_clear_headers (GF_DownloadSession *sess) |
GF_Err | dm_sess_write (GF_DownloadSession *session, const u8 *buffer, u32 size) |
GF_Err | gf_dm_read_data (GF_DownloadSession *sess, char *data, u32 data_size, u32 *out_read) |
void | httpout_format_date (u64 time, char szDate[200], Bool for_listing) |
GF_EXPORT const char * | gf_rmt_get_peer_address (RMT_ClientCtx *client) |
GF_EXPORT void * | gf_rmt_client_get_on_data_task (RMT_ClientCtx *client) |
gets the userdata associated with the client on data callback if defined More... | |
GF_EXPORT void | gf_rmt_set_on_new_client_cbk (void *task, rmt_on_new_client_cbk cbk) |
GF_EXPORT void * | gf_rmt_get_on_new_client_task () |
gets the userdata associated with the new client callback if defined More... | |
GF_EXPORT void | gf_rmt_client_set_on_del_cbk (RMT_ClientCtx *client, void *task, rmt_client_on_del_cbk cbk) |
GF_EXPORT void * | gf_rmt_client_get_on_del_task (RMT_ClientCtx *client) |
gets the userdata associated with the client on deleted callback if defined More... | |
void | rmt_clientctx_del (RMT_ClientCtx *client) |
void | rmt_serverctx_reset (RMT_ServerCtx *ctx) |
void | rmt_close_client (RMT_ClientCtx *client) |
GF_Err | rmt_send_reply (GF_DownloadSession *http_sess, int responseCode, char *response_body, char *content_type) |
static void | rmt_on_http_session_data (void *usr_cbk, GF_NETIO_Parameter *parameter) |
GF_Err | rmt_create_server (RMT_ServerCtx *ctx) |
GF_EXPORT void | gf_rmt_client_set_on_data_cbk (RMT_ClientCtx *client, void *task, rmt_client_on_data_cbk cbk) |
GF_Err | rmt_server_handle_new_client (RMT_ServerCtx *ctx) |
GF_Err | rmt_client_send_payload (RMT_ClientCtx *client, const u8 *payload, u64 size, Bool is_binary) |
GF_Err | rmt_client_handle_ws_payload (RMT_ClientCtx *client, u8 *payload, u64 size, Bool is_binary) |
GF_Err | rmt_client_handle_ws_frame (RMT_ClientCtx *client, GF_BitStream *bs) |
GF_Err | rmt_client_handle_event (RMT_ClientCtx *client) |
GF_Err | rmt_client_send_ping (RMT_ClientCtx *client) |
GF_EXPORT GF_Err | gf_rmt_client_send_to_ws (RMT_ClientCtx *client, const char *msg, u64 size, Bool is_binary) |
Bool | rmt_client_should_close (RMT_ClientCtx *client) |
GF_Err | rmt_server_wait_for_event (RMT_ServerCtx *ctx) |
static u32 | rmt_ws_thread_main (void *par) |
RMT_Settings * | gf_rmt_get_settings () |
gets the current rmtws settings (creates the structure if necessary) More... | |
void | rmt_ws_del (RMT_WS *rmt) |
deletes the main instance More... | |
RMT_WS * | rmt_ws_new () |
creates the main instance More... | |
Variables | |
static RMT_Settings | g_Settings |
static Bool | g_SettingsInitialized = GF_FALSE |
static const char | websocket_guid [] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
static char | RMT_WEBSOCKET_PING_MSG [2] = { 0x89, 0x00 } |
struct RMT_WS |
Handle to the main instance.
Data Fields | ||
---|---|---|
GF_Thread * | thread | |
Bool | should_stop |
struct __rmt_serverctx |
struct __rmt_clientctx |
structure representing a websocket client
Data Fields | ||
---|---|---|
GF_Socket * | client_sock | |
RMT_ServerCtx * | ctx | |
GF_DownloadSession * | http_sess | |
char | peer_address[GF_MAX_IP_NAME_LEN+16] | |
char | buffer[1024] | |
Bool | is_ws | |
u64 | last_active_time | |
u64 | last_ping_time | |
Bool | should_close | |
rmt_client_on_data_cbk | on_data_cbk | |
void * | on_data_cbk_task | |
rmt_client_on_del_cbk | on_del_cbk | |
void * | on_del_cbk_task |
anonymous enum |
GF_DownloadSession* gf_dm_sess_new_server | ( | GF_DownloadManager * | dm, |
GF_Socket * | server, | ||
void * | ssl_ctx, | ||
gf_dm_user_io | user_io, | ||
void * | usr_cbk, | ||
Bool | async, | ||
GF_Err * | e | ||
) |
void gf_dm_sess_set_header | ( | GF_DownloadSession * | sess, |
const char * | name, | ||
const char * | value | ||
) |
GF_Err gf_dm_sess_send_reply | ( | GF_DownloadSession * | sess, |
u32 | reply_code, | ||
const char * | response_body, | ||
u32 | body_len, | ||
Bool | no_body | ||
) |
void gf_dm_sess_clear_headers | ( | GF_DownloadSession * | sess | ) |
GF_EXPORT const char* gf_rmt_get_peer_address | ( | RMT_ClientCtx * | client | ) |
gets a string representing the client in the format ip:port
GF_EXPORT void* gf_rmt_client_get_on_data_task | ( | RMT_ClientCtx * | client | ) |
gets the userdata associated with the client on data callback if defined
GF_EXPORT void gf_rmt_set_on_new_client_cbk | ( | void * | task, |
rmt_on_new_client_cbk | cbk | ||
) |
sets the callback called when new clients connect to the sever
task | user data stored and passed back to the callback |
cbk | the callback of type rmt_on_new_client_cbk |
GF_EXPORT void* gf_rmt_get_on_new_client_task | ( | ) |
gets the userdata associated with the new client callback if defined
GF_EXPORT 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
client | the client for which we are setting the callback |
task | user data stored and passed back to the callback |
cbk | the callback of type rmt_client_on_del_cbk |
GF_EXPORT void* gf_rmt_client_get_on_del_task | ( | RMT_ClientCtx * | client | ) |
gets the userdata associated with the client on deleted callback if defined
void rmt_clientctx_del | ( | RMT_ClientCtx * | client | ) |
void rmt_serverctx_reset | ( | RMT_ServerCtx * | ctx | ) |
void rmt_close_client | ( | RMT_ClientCtx * | client | ) |
GF_Err rmt_send_reply | ( | GF_DownloadSession * | http_sess, |
int | responseCode, | ||
char * | response_body, | ||
char * | content_type | ||
) |
|
static |
GF_Err rmt_create_server | ( | RMT_ServerCtx * | ctx | ) |
GF_EXPORT 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
client | the client for which we are setting the callback |
task | user data stored and passed back to the callback |
cbk | the callback of type rmt_client_on_data_cbk |
GF_Err rmt_server_handle_new_client | ( | RMT_ServerCtx * | ctx | ) |
GF_Err rmt_client_send_payload | ( | RMT_ClientCtx * | client, |
const u8 * | payload, | ||
u64 | size, | ||
Bool | is_binary | ||
) |
GF_Err rmt_client_handle_ws_payload | ( | RMT_ClientCtx * | client, |
u8 * | payload, | ||
u64 | size, | ||
Bool | is_binary | ||
) |
GF_Err rmt_client_handle_ws_frame | ( | RMT_ClientCtx * | client, |
GF_BitStream * | bs | ||
) |
GF_Err rmt_client_handle_event | ( | RMT_ClientCtx * | client | ) |
GF_Err rmt_client_send_ping | ( | RMT_ClientCtx * | client | ) |
GF_EXPORT 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
client | the client object |
msg | a buffer containing the data to send |
size | the size of the data to send |
is_binary | false if we're sending a utf8 string, true otherwise |
Bool rmt_client_should_close | ( | RMT_ClientCtx * | client | ) |
GF_Err rmt_server_wait_for_event | ( | RMT_ServerCtx * | ctx | ) |
|
static |
RMT_Settings* gf_rmt_get_settings | ( | ) |
gets the current rmtws settings (creates the structure if necessary)
void rmt_ws_del | ( | RMT_WS * | rmt | ) |
deletes the main instance
RMT_WS* rmt_ws_new | ( | ) |
creates the main instance
|
static |
|
static |
|
static |