Janus core. More...
#include <dlfcn.h>
#include <dirent.h>
#include <net/if.h>
#include <netdb.h>
#include <signal.h>
#include <getopt.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <poll.h>
#include "janus.h"
#include "version.h"
#include "cmdline.h"
#include "config.h"
#include "apierror.h"
#include "log.h"
#include "debug.h"
#include "ip-utils.h"
#include "rtcp.h"
#include "auth.h"
#include "record.h"
#include "events.h"
Macros | |
#define | JANUS_NAME "Janus WebRTC Gateway" |
#define | JANUS_AUTHOR "Meetecho s.r.l." |
#define | JANUS_VERSION 24 |
#define | JANUS_VERSION_STRING "0.2.4" |
#define | JANUS_SERVER_NAME "MyJanusInstance" |
#define | SHLIB_EXT ".so" |
#define | DEFAULT_SESSION_TIMEOUT 60 |
Functions | |
json_t * | janus_admin_stream_summary (janus_ice_stream *stream) |
json_t * | janus_admin_component_summary (janus_ice_component *component) |
gchar * | janus_get_local_ip (void) |
Helper method to return the local IP address (autodetected by default) More... | |
gchar * | janus_get_public_ip (void) |
Helper method to return the IP address to use in the SDP (autodetected by default) More... | |
void | janus_set_public_ip (const char *ip) |
Helper method to overwrite the IP address to use in the SDP. More... | |
gint | janus_is_stopping (void) |
Helper method to check whether the gateway is being shut down. More... | |
janus_session * | janus_session_create (guint64 session_id) |
Method to create a new Janus Gateway-Client session. More... | |
janus_session * | janus_session_find (guint64 session_id) |
Method to find an existing Janus Gateway-Client session from its ID. More... | |
janus_session * | janus_session_find_destroyed (guint64 session_id) |
Method to find an existing Janus Gateway-Client session scheduled to be destroyed from its ID. More... | |
void | janus_session_notify_event (guint64 session_id, json_t *event) |
Method to add an event to notify to the queue of notifications for this session. More... | |
gint | janus_session_destroy (guint64 session_id) |
Method to destroy a Janus Gateway-Client session. More... | |
void | janus_session_free (janus_session *session) |
Method to actually free the resources allocated by a Janus Gateway-Client session. More... | |
janus_request * | janus_request_new (janus_transport *transport, void *instance, void *request_id, gboolean admin, json_t *message) |
Helper to allocate a janus_request instance. More... | |
void | janus_request_destroy (janus_request *request) |
Helper to destroy a janus_request instance. More... | |
int | janus_process_incoming_request (janus_request *request) |
Helper to process an incoming request, no matter where it comes from. More... | |
int | janus_process_incoming_admin_request (janus_request *request) |
Helper to process an incoming admin/monitor request, no matter where it comes from. More... | |
int | janus_process_success (janus_request *request, json_t *payload) |
Method to return a successful Janus response message (JSON) to the browser. More... | |
int | janus_process_error (janus_request *request, uint64_t session_id, const char *transaction, gint error, const char *format,...) |
void | janus_transport_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_transportso_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_eventhandler_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_eventhandlerso_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_plugin_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_pluginso_close (gpointer key, gpointer value, gpointer user_data) |
janus_plugin * | janus_plugin_find (const gchar *package) |
Method to return a registered plugin instance out of its package name. More... | |
gint | main (int argc, char *argv[]) |
Variables | |
int | janus_log_level = LOG_INFO |
gboolean | janus_log_timestamps = FALSE |
gboolean | janus_log_colors = FALSE |
int | lock_debug = 0 |
Transport plugin callback interface | |
These are the callbacks implemented by the gateway core, as part of the janus_transport_callbacks interface. Everything the transport plugins send the gateway is handled here. | |
GThreadPool * | tasks = NULL |
void | janus_transport_incoming_request (janus_transport *plugin, void *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error) |
void | janus_transport_gone (janus_transport *plugin, void *transport) |
gboolean | janus_transport_is_api_secret_needed (janus_transport *plugin) |
gboolean | janus_transport_is_api_secret_valid (janus_transport *plugin, const char *apisecret) |
gboolean | janus_transport_is_auth_token_needed (janus_transport *plugin) |
gboolean | janus_transport_is_auth_token_valid (janus_transport *plugin, const char *token) |
void | janus_transport_notify_event (janus_transport *plugin, void *transport, json_t *event) |
void | janus_transport_task (gpointer data, gpointer user_data) |
Plugin callback interface | |
These are the callbacks implemented by the gateway core, as part of the janus_callbacks interface. Everything the plugins send the gateway is handled here. | |
int | janus_plugin_push_event (janus_plugin_session *plugin_session, janus_plugin *plugin, const char *transaction, json_t *message, json_t *jsep) |
json_t * | janus_plugin_handle_sdp (janus_plugin_session *plugin_session, janus_plugin *plugin, const char *sdp_type, const char *sdp) |
void | janus_plugin_relay_rtp (janus_plugin_session *plugin_session, int video, char *buf, int len) |
void | janus_plugin_relay_rtcp (janus_plugin_session *plugin_session, int video, char *buf, int len) |
void | janus_plugin_relay_data (janus_plugin_session *plugin_session, char *buf, int len) |
void | janus_plugin_close_pc (janus_plugin_session *plugin_session) |
void | janus_plugin_end_session (janus_plugin_session *plugin_session) |
void | janus_plugin_notify_event (janus_plugin *plugin, janus_plugin_session *plugin_session, json_t *event) |
Janus core.
Implementation of the gateway core. This code takes care of the gateway initialization (command line/configuration) and setup, and makes use of the available transport plugins (by default HTTP, WebSockets, RabbitMQ, if compiled) and Janus protocol (a JSON-based protocol) to interact with the applications, whether they're web based or not. The core also takes care of bridging peers and plugins accordingly, in terms of both messaging and real-time media transfer via WebRTC.
#define DEFAULT_SESSION_TIMEOUT 60 |
#define JANUS_AUTHOR "Meetecho s.r.l." |
#define JANUS_NAME "Janus WebRTC Gateway" |
#define JANUS_SERVER_NAME "MyJanusInstance" |
#define JANUS_VERSION 24 |
#define JANUS_VERSION_STRING "0.2.4" |
#define SHLIB_EXT ".so" |
json_t * janus_admin_component_summary | ( | janus_ice_component * | component | ) |
json_t * janus_admin_stream_summary | ( | janus_ice_stream * | stream | ) |
void janus_eventhandler_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
void janus_eventhandlerso_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
gchar* janus_get_local_ip | ( | void | ) |
Helper method to return the local IP address (autodetected by default)
gchar* janus_get_public_ip | ( | void | ) |
Helper method to return the IP address to use in the SDP (autodetected by default)
gint janus_is_stopping | ( | void | ) |
Helper method to check whether the gateway is being shut down.
void janus_plugin_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
void janus_plugin_close_pc | ( | janus_plugin_session * | plugin_session | ) |
void janus_plugin_end_session | ( | janus_plugin_session * | plugin_session | ) |
janus_plugin* janus_plugin_find | ( | const gchar * | package | ) |
Method to return a registered plugin instance out of its package name.
[in] | package | The unique package name of the plugin |
json_t * janus_plugin_handle_sdp | ( | janus_plugin_session * | plugin_session, |
janus_plugin * | plugin, | ||
const char * | sdp_type, | ||
const char * | sdp | ||
) |
void janus_plugin_notify_event | ( | janus_plugin * | plugin, |
janus_plugin_session * | plugin_session, | ||
json_t * | event | ||
) |
int janus_plugin_push_event | ( | janus_plugin_session * | plugin_session, |
janus_plugin * | plugin, | ||
const char * | transaction, | ||
json_t * | message, | ||
json_t * | jsep | ||
) |
void janus_plugin_relay_data | ( | janus_plugin_session * | plugin_session, |
char * | buf, | ||
int | len | ||
) |
void janus_plugin_relay_rtcp | ( | janus_plugin_session * | plugin_session, |
int | video, | ||
char * | buf, | ||
int | len | ||
) |
void janus_plugin_relay_rtp | ( | janus_plugin_session * | plugin_session, |
int | video, | ||
char * | buf, | ||
int | len | ||
) |
void janus_pluginso_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
int janus_process_error | ( | janus_request * | request, |
uint64_t | session_id, | ||
const char * | transaction, | ||
gint | error, | ||
const char * | format, | ||
... | |||
) |
int janus_process_incoming_admin_request | ( | janus_request * | request | ) |
Helper to process an incoming admin/monitor request, no matter where it comes from.
[in] | request | The request instance and its source |
int janus_process_incoming_request | ( | janus_request * | request | ) |
Helper to process an incoming request, no matter where it comes from.
[in] | request | The JSON request |
int janus_process_success | ( | janus_request * | request, |
json_t * | payload | ||
) |
Method to return a successful Janus response message (JSON) to the browser.
[in] | request | The request instance and its source |
[in] | payload | The payload to return as a JSON object |
void janus_request_destroy | ( | janus_request * | request | ) |
Helper to destroy a janus_request instance.
[in] | request | The janus_request instance to destroy |
janus_request* janus_request_new | ( | janus_transport * | transport, |
void * | instance, | ||
void * | request_id, | ||
gboolean | admin, | ||
json_t * | message | ||
) |
Helper to allocate a janus_request instance.
[in] | transport | Pointer to the transport |
[in] | instance | Opaque pointer to the transport-provided instance |
[in] | request_id | Opaque pointer to the request ID, if available |
[in] | admin | Whether this is a Janus API or Admin API request |
[in] | message | Opaque pointer to the original request, if available |
janus_session* janus_session_create | ( | guint64 | session_id | ) |
Method to create a new Janus Gateway-Client session.
[in] | session_id | The desired Janus Gateway-Client session ID, or 0 if it needs to be generated randomly |
gint janus_session_destroy | ( | guint64 | session_id | ) |
Method to destroy a Janus Gateway-Client session.
[in] | session_id | The Janus Gateway-Client session ID to destroy |
janus_session* janus_session_find | ( | guint64 | session_id | ) |
Method to find an existing Janus Gateway-Client session from its ID.
[in] | session_id | The Janus Gateway-Client session ID |
janus_session* janus_session_find_destroyed | ( | guint64 | session_id | ) |
Method to find an existing Janus Gateway-Client session scheduled to be destroyed from its ID.
[in] | session_id | The Janus Gateway-Client session ID |
void janus_session_free | ( | janus_session * | session | ) |
Method to actually free the resources allocated by a Janus Gateway-Client session.
[in] | session | The Janus Gateway-Client session instance to free |
void janus_session_notify_event | ( | guint64 | session_id, |
json_t * | event | ||
) |
Method to add an event to notify to the queue of notifications for this session.
[in] | session_id | The Janus Gateway-Client session ID |
[in] | event | The event to notify as a Jansson JSON object |
void janus_set_public_ip | ( | const char * | ip | ) |
Helper method to overwrite the IP address to use in the SDP.
void janus_transport_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
void janus_transport_gone | ( | janus_transport * | plugin, |
void * | transport | ||
) |
void janus_transport_incoming_request | ( | janus_transport * | plugin, |
void * | transport, | ||
void * | request_id, | ||
gboolean | admin, | ||
json_t * | message, | ||
json_error_t * | error | ||
) |
gboolean janus_transport_is_api_secret_needed | ( | janus_transport * | plugin | ) |
gboolean janus_transport_is_api_secret_valid | ( | janus_transport * | plugin, |
const char * | apisecret | ||
) |
gboolean janus_transport_is_auth_token_needed | ( | janus_transport * | plugin | ) |
gboolean janus_transport_is_auth_token_valid | ( | janus_transport * | plugin, |
const char * | token | ||
) |
void janus_transport_notify_event | ( | janus_transport * | plugin, |
void * | transport, | ||
json_t * | event | ||
) |
void janus_transport_task | ( | gpointer | data, |
gpointer | user_data | ||
) |
void janus_transportso_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
gint main | ( | int | argc, |
char * | argv[] | ||
) |
gboolean janus_log_colors = FALSE |
int janus_log_level = LOG_INFO |
gboolean janus_log_timestamps = FALSE |
int lock_debug = 0 |
GThreadPool* tasks = NULL |