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 <fcntl.h>
#include <poll.h>
#include "janus.h"
#include "version.h"
#include "cmdline.h"
#include "config.h"
#include "apierror.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 Server" |
#define | JANUS_AUTHOR "Meetecho s.r.l." |
#define | JANUS_SERVER_NAME "MyJanusInstance" |
#define | SHLIB_EXT ".so" |
#define | DEFAULT_SESSION_TIMEOUT 60 |
#define | DEFAULT_RECLAIM_SESSION_TIMEOUT 0 |
#define | DEFAULT_CANDIDATES_TIMEOUT 45 |
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... | |
guint | janus_get_public_ip_count (void) |
Helper method to return the number of public IP addresses (if configured for 1-1 NAT) More... | |
gchar * | janus_get_public_ip (guint index) |
Helper method to return a given public IP address to use in the SDP (if multiple are configured for 1-1 NAT) More... | |
void | janus_add_public_ip (const gchar *ip) |
gboolean | janus_has_public_ipv4_ip (void) |
Helper method to check if we have at least one manually passed public IPv4 address (for 1-1 NAT management) More... | |
gboolean | janus_has_public_ipv6_ip (void) |
Helper method to check if we have at least one manually passed public IPv6 address (for 1-1 NAT management) More... | |
gint | janus_is_stopping (void) |
Helper method to check whether the server is being shut down. More... | |
gboolean | janus_is_webrtc_encryption_enabled (void) |
Helper method to check whether WebRTC encryption is (as it should) enabled. More... | |
janus_session * | janus_session_create (guint64 session_id) |
Method to create a new Janus Core-Client session. More... | |
janus_session * | janus_session_find (guint64 session_id) |
Method to find an existing Janus Core-Client session from its ID. More... | |
void | janus_session_notify_event (janus_session *session, json_t *event) |
Method to add an event to notify to the queue of notifications for this session. More... | |
gint | janus_session_destroy (janus_session *session) |
Method to destroy a Janus Core-Client session. More... | |
janus_ice_handle * | janus_session_handles_find (janus_session *session, guint64 handle_id) |
Method to find an existing Janus ICE handle from its ID. More... | |
void | janus_session_handles_insert (janus_session *session, janus_ice_handle *handle) |
Method to insert a Janus ICE handle in a session. More... | |
gint | janus_session_handles_remove (janus_session *session, janus_ice_handle *handle) |
Method to remove a Janus ICE handle from a session. More... | |
void | janus_session_handles_clear (janus_session *session) |
Method to remove all Janus ICE handles from a session. More... | |
json_t * | janus_session_handles_list_json (janus_session *session) |
Method to list the IDs of all Janus ICE handles of a session as JSON. More... | |
janus_request * | janus_request_new (janus_transport *transport, janus_transport_session *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_logger_close (gpointer key, gpointer value, gpointer user_data) |
void | janus_loggerso_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 | |
gboolean | public_ips_ipv4 = FALSE |
gboolean | public_ips_ipv6 = FALSE |
int | janus_log_level = LOG_INFO |
gboolean | janus_log_timestamps = FALSE |
gboolean | janus_log_colors = FALSE |
char * | janus_log_global_prefix = NULL |
int | lock_debug = 0 |
int | refcount_debug = 0 |
Transport plugin callback interface | |
These are the callbacks implemented by the Janus core, as part of the janus_transport_callbacks interface. Everything the transport plugins send the core is handled here. | |
void | janus_transport_incoming_request (janus_transport *plugin, janus_transport_session *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error) |
void | janus_transport_gone (janus_transport *plugin, janus_transport_session *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 Janus core, as part of the janus_callbacks interface. Everything the plugins send the core 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, gboolean restart) |
void | janus_plugin_relay_rtp (janus_plugin_session *plugin_session, janus_plugin_rtp *packet) |
void | janus_plugin_relay_rtcp (janus_plugin_session *plugin_session, janus_plugin_rtcp *packet) |
void | janus_plugin_relay_data (janus_plugin_session *plugin_session, janus_plugin_data *message) |
void | janus_plugin_send_pli (janus_plugin_session *plugin_session) |
void | janus_plugin_send_remb (janus_plugin_session *plugin_session, uint32_t bitrate) |
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) |
gboolean | janus_plugin_auth_is_signature_valid (janus_plugin *plugin, const char *token) |
gboolean | janus_plugin_auth_signature_contains (janus_plugin *plugin, const char *token, const char *desc) |
Janus core.
#define DEFAULT_CANDIDATES_TIMEOUT 45 |
#define DEFAULT_RECLAIM_SESSION_TIMEOUT 0 |
#define DEFAULT_SESSION_TIMEOUT 60 |
#define JANUS_AUTHOR "Meetecho s.r.l." |
#define JANUS_NAME "Janus WebRTC Server" |
#define JANUS_SERVER_NAME "MyJanusInstance" |
#define SHLIB_EXT ".so" |
void janus_add_public_ip | ( | const gchar * | ip | ) |
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 | ( | guint | index | ) |
Helper method to return a given public IP address to use in the SDP (if multiple are configured for 1-1 NAT)
guint janus_get_public_ip_count | ( | void | ) |
Helper method to return the number of public IP addresses (if configured for 1-1 NAT)
gboolean janus_has_public_ipv4_ip | ( | void | ) |
Helper method to check if we have at least one manually passed public IPv4 address (for 1-1 NAT management)
gboolean janus_has_public_ipv6_ip | ( | void | ) |
Helper method to check if we have at least one manually passed public IPv6 address (for 1-1 NAT management)
gint janus_is_stopping | ( | void | ) |
Helper method to check whether the server is being shut down.
gboolean janus_is_webrtc_encryption_enabled | ( | void | ) |
Helper method to check whether WebRTC encryption is (as it should) enabled.
–disable-webrtc-encryption
, and you should NEVER use it otherwise (it would simply not work with regular WebRTC endpoints). void janus_logger_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
void janus_loggerso_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
gboolean janus_plugin_auth_is_signature_valid | ( | janus_plugin * | plugin, |
const char * | token | ||
) |
gboolean janus_plugin_auth_signature_contains | ( | janus_plugin * | plugin, |
const char * | token, | ||
const char * | desc | ||
) |
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, | ||
gboolean | restart | ||
) |
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, |
janus_plugin_data * | message | ||
) |
void janus_plugin_relay_rtcp | ( | janus_plugin_session * | plugin_session, |
janus_plugin_rtcp * | packet | ||
) |
void janus_plugin_relay_rtp | ( | janus_plugin_session * | plugin_session, |
janus_plugin_rtp * | packet | ||
) |
void janus_plugin_send_pli | ( | janus_plugin_session * | plugin_session | ) |
void janus_plugin_send_remb | ( | janus_plugin_session * | plugin_session, |
uint32_t | bitrate | ||
) |
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, |
janus_transport_session * | instance, | ||
void * | request_id, | ||
gboolean | admin, | ||
json_t * | message | ||
) |
Helper to allocate a janus_request instance.
[in] | transport | Pointer to the transport |
[in] | instance | Pointer to the transport-provided session 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 Core-Client session.
[in] | session_id | The desired Janus Core-Client session ID, or 0 if it needs to be generated randomly |
gint janus_session_destroy | ( | janus_session * | session | ) |
Method to destroy a Janus Core-Client session.
[in] | session | The Janus Core-Client session to destroy |
janus_session* janus_session_find | ( | guint64 | session_id | ) |
Method to find an existing Janus Core-Client session from its ID.
[in] | session_id | The Janus Core-Client session ID |
void janus_session_handles_clear | ( | janus_session * | session | ) |
Method to remove all Janus ICE handles from a session.
[in] | session | The Janus Core-Client session |
janus_ice_handle* janus_session_handles_find | ( | janus_session * | session, |
guint64 | handle_id | ||
) |
Method to find an existing Janus ICE handle from its ID.
[in] | session | The Janus Core-Client session this ICE handle belongs to |
[in] | handle_id | The Janus ICE handle ID |
void janus_session_handles_insert | ( | janus_session * | session, |
janus_ice_handle * | handle | ||
) |
Method to insert a Janus ICE handle in a session.
[in] | session | The Janus Core-Client session |
[in] | handle | The Janus ICE handle |
json_t* janus_session_handles_list_json | ( | janus_session * | session | ) |
Method to list the IDs of all Janus ICE handles of a session as JSON.
[in] | session | The Janus Core-Client session |
gint janus_session_handles_remove | ( | janus_session * | session, |
janus_ice_handle * | handle | ||
) |
Method to remove a Janus ICE handle from a session.
[in] | session | The Janus Core-Client session |
[in] | handle | The Janus ICE handle |
void janus_session_notify_event | ( | janus_session * | session, |
json_t * | event | ||
) |
Method to add an event to notify to the queue of notifications for this session.
[in] | session | The Janus Core-Client session this notification is related to |
[in] | event | The event to notify as a Jansson JSON object |
void janus_transport_close | ( | gpointer | key, |
gpointer | value, | ||
gpointer | user_data | ||
) |
void janus_transport_gone | ( | janus_transport * | plugin, |
janus_transport_session * | transport | ||
) |
void janus_transport_incoming_request | ( | janus_transport * | plugin, |
janus_transport_session * | 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 |
char* janus_log_global_prefix = NULL |
int janus_log_level = LOG_INFO |
gboolean janus_log_timestamps = FALSE |
int lock_debug = 0 |
gboolean public_ips_ipv4 = FALSE |
gboolean public_ips_ipv6 = FALSE |
int refcount_debug = 0 |