Fork me on GitHub
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
ice.h File Reference

ICE/STUN/TURN processing (headers) More...

#include <glib.h>
#include <agent.h>
#include "dtls.h"
#include "sctp.h"
#include "utils.h"
#include "plugins/plugin.h"
Include dependency graph for ice.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  janus_ice_stats
 Janus media statistics. More...
struct  janus_ice_stats_item
 Janus media statistics: received packet info. More...
struct  janus_seq_info
 A helper struct for determining when to send NACKs. More...
struct  janus_ice_handle
 Janus ICE handle. More...
struct  janus_ice_stream
 Janus ICE stream. More...
struct  janus_ice_component
 Janus ICE component. More...
struct  janus_ice_queued_packet
 Janus enqueued (S)RTP/(S)RTCP packet to send. More...

Macros

#define JANUS_ICE_HANDLE_WEBRTC_PROCESSING_OFFER   (1 << 0)
#define JANUS_ICE_HANDLE_WEBRTC_START   (1 << 1)
#define JANUS_ICE_HANDLE_WEBRTC_READY   (1 << 2)
#define JANUS_ICE_HANDLE_WEBRTC_STOP   (1 << 3)
#define JANUS_ICE_HANDLE_WEBRTC_ALERT   (1 << 4)
#define JANUS_ICE_HANDLE_WEBRTC_BUNDLE   (1 << 5)
#define JANUS_ICE_HANDLE_WEBRTC_RTCPMUX   (1 << 6)
#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE   (1 << 7)
#define JANUS_ICE_HANDLE_WEBRTC_ALL_TRICKLES   (1 << 8)
#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE_SYNCED   (1 << 9)
#define JANUS_ICE_HANDLE_WEBRTC_DATA_CHANNELS   (1 << 10)
#define JANUS_ICE_HANDLE_WEBRTC_PLAN_B   (1 << 11)
#define JANUS_ICE_HANDLE_WEBRTC_CLEANING   (1 << 12)
#define JANUS_ICE_HANDLE_WEBRTC_HAS_AUDIO   (1 << 13)
#define JANUS_ICE_HANDLE_WEBRTC_HAS_VIDEO   (1 << 14)
#define LAST_SEQS_MAX_LEN   160
#define JANUS_ICE_PACKET_AUDIO   0
#define JANUS_ICE_PACKET_VIDEO   1
#define JANUS_ICE_PACKET_DATA   2

Typedefs

typedef struct janus_ice_handle janus_ice_handle
 Janus ICE handle/session.
typedef struct janus_ice_stream janus_ice_stream
 Janus ICE stream.
typedef struct janus_ice_component janus_ice_component
 Janus ICE component.
typedef struct
janus_ice_queued_packet 
janus_ice_queued_packet
 Janus enqueued (S)RTP/(S)RTCP packet to send.
typedef struct janus_ice_stats janus_ice_stats
 Janus media statistics.
typedef struct janus_ice_stats_item janus_ice_stats_item
 Janus media statistics: received packet info.
typedef struct janus_seq_info seq_info_t
 A helper struct for determining when to send NACKs.

Enumerations

enum  { SEQ_MISSING, SEQ_NACKED, SEQ_GIVEUP, SEQ_RECVED }

Functions

void janus_ice_init (gboolean ice_lite, gboolean ice_tcp, gboolean ipv6, uint16_t rtp_min_port, uint16_t rtp_max_port)
 ICE stuff initialization.
void janus_ice_deinit (void)
 ICE stuff de-initialization.
int janus_ice_set_stun_server (gchar *stun_server, uint16_t stun_port)
 Method to force Janus to use a STUN server when gathering candidates.
int janus_ice_set_turn_server (gchar *turn_server, uint16_t turn_port, gchar *turn_type, gchar *turn_user, gchar *turn_pwd)
 Method to force Janus to use a TURN server when gathering candidates.
int janus_ice_set_turn_rest_api (gchar *api_server, gchar *api_key)
 Method to force Janus to contact a TURN REST API server to get a TURN service to use when gathering candidates. The TURN REST API takes precedence over any static credential passed via janus_ice_set_turn_server.
char * janus_ice_get_stun_server (void)
 Method to get the STUN server IP address.
uint16_t janus_ice_get_stun_port (void)
 Method to get the STUN server port.
char * janus_ice_get_turn_server (void)
 Method to get the TURN server IP address.
uint16_t janus_ice_get_turn_port (void)
 Method to get the TURN server port.
char * janus_ice_get_turn_rest_api (void)
 Method to get the specified TURN REST API backend, if any.
void janus_ice_ignore_interface (const char *ip)
 Method to add an interface/IP to the ignore list for ICE (that is, don't gather candidates)
gboolean janus_ice_is_ignored (const char *ip)
 Method to check whether an interface/IP is currently in the ignore list for ICE (that is, won't have candidates)
gboolean janus_ice_is_ice_lite_enabled (void)
 Method to check whether ICE Lite mode is enabled or not (still WIP)
gboolean janus_ice_is_ice_tcp_enabled (void)
 Method to check whether ICE-TCP support is enabled/supported or not (still WIP)
gboolean janus_ice_is_ipv6_enabled (void)
 Method to check whether IPv6 candidates are enabled/supported or not (still WIP)
gboolean janus_ice_is_bundle_forced (void)
 Method to check whether BUNDLE support is forced or not.
void janus_ice_force_bundle (gboolean forced)
 Method to set the BUNDLE support mode (true means mandatory, false means optional)
gboolean janus_ice_is_rtcpmux_forced (void)
 Method to check whether rtcp-mux support is forced or not.
void janus_ice_force_rtcpmux (gboolean forced)
 Method to set the rtcp-mux support mode (true means mandatory, false means optional)
void janus_set_max_nack_queue (uint mnq)
 Method to modify the max NACK value (i.e., the number of packets per handle to store for retransmissions)
uint janus_get_max_nack_queue (void)
 Method to get the current max NACK value (i.e., the number of packets per handle to store for retransmissions)
gboolean janus_ice_is_ice_debugging_enabled (void)
 Method to check whether libnice debugging has been enabled (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html)
void janus_ice_debugging_enable (void)
 Method to enable libnice debugging (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html)
void janus_ice_debugging_disable (void)
 Method to disable libnice debugging (the default)
const gchar * janus_get_ice_state_name (gint state)
 Helper method to get a string representation of a libnice ICE state.
void janus_ice_stats_reset (janus_ice_stats *stats)
 Quick helper method to reset stats.
void janus_ice_notify_hangup (janus_ice_handle *handle, const char *reason)
 Quick helper method to notify a WebRTC hangup through the Janus API.
gboolean janus_plugin_session_is_alive (janus_plugin_session *plugin_session)
 Quick helper method to check if a plugin session associated with a Janus handle is still valid.
Janus ICE handle methods
janus_ice_handlejanus_ice_handle_create (void *gateway_session)
 Method to create a new Janus ICE handle.
janus_ice_handlejanus_ice_handle_find (void *gateway_session, guint64 handle_id)
 Method to find an existing Janus ICE handle from its ID.
gint janus_ice_handle_attach_plugin (void *gateway_session, guint64 handle_id, janus_plugin *plugin)
 Method to attach a Janus ICE handle to a plugin.
gint janus_ice_handle_destroy (void *gateway_session, guint64 handle_id)
 Method to destroy a Janus ICE handle.
void janus_ice_free (janus_ice_handle *handle)
 Method to actually free the resources allocated by a Janus ICE handle.
void janus_ice_webrtc_hangup (janus_ice_handle *handle)
 Method to only hangup (e.g., DTLS alert) the WebRTC PeerConnection allocated by a Janus ICE handle.
void janus_ice_webrtc_free (janus_ice_handle *handle)
 Method to only free the WebRTC related resources allocated by a Janus ICE handle.
void janus_ice_stream_free (GHashTable *container, janus_ice_stream *stream)
 Method to only free resources related to a specific ICE stream allocated by a Janus ICE handle.
void janus_ice_component_free (GHashTable *container, janus_ice_component *component)
 Method to only free resources related to a specific ICE component allocated by a Janus ICE handle.
Janus ICE handle callbacks
void janus_ice_cb_candidate_gathering_done (NiceAgent *agent, guint stream_id, gpointer ice)
 libnice callback to notify when candidates have been gathered for an ICE agent
void janus_ice_cb_component_state_changed (NiceAgent *agent, guint stream_id, guint component_id, guint state, gpointer ice)
 libnice callback to notify when the state of a component changes for an ICE agent
void janus_ice_cb_new_selected_pair (NiceAgent *agent, guint stream_id, guint component_id, gchar *local, gchar *remote, gpointer ice)
 libnice callback to notify when a pair of candidates has been selected for an ICE agent
void janus_ice_cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer ice)
 libnice callback to notify when data has been received by an ICE agent
void janus_ice_relay_rtp (janus_ice_handle *handle, int video, char *buf, int len)
 Gateway RTP callback, called when a plugin has an RTP packet to send to a peer.
void janus_ice_relay_rtcp (janus_ice_handle *handle, int video, char *buf, int len)
 Gateway RTCP callback, called when a plugin has an RTCP message to send to a peer.
void janus_ice_relay_data (janus_ice_handle *handle, char *buf, int len)
 Gateway SCTP/DataChannel callback, called when a plugin has data to send to a peer.
void janus_ice_incoming_data (janus_ice_handle *handle, char *buffer, int length)
 Plugin SCTP/DataChannel callback, called by the SCTP stack when when there's data for a plugin.
Janus ICE handle helpers
void * janus_ice_thread (void *data)
 Janus ICE handle thread.
void * janus_ice_send_thread (void *data)
 Janus ICE thread for sending outgoing packets.
int janus_ice_setup_local (janus_ice_handle *handle, int offer, int audio, int video, int data, int bundle, int rtcpmux, int trickle)
 Method to locally set up the ICE candidates (initialization and gathering)
void janus_ice_candidates_to_sdp (janus_ice_handle *handle, char *sdp, guint stream_id, guint component_id)
 Method to add local candidates to the gateway SDP.
void janus_ice_setup_remote_candidates (janus_ice_handle *handle, guint stream_id, guint component_id)
 Method to handle remote candidates and start the connectivity checks.
void janus_ice_dtls_handshake_done (janus_ice_handle *handle, janus_ice_component *component)
 Callback to be notified when the DTLS handshake for a specific component has been completed.

Detailed Description

ICE/STUN/TURN processing (headers)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation (based on libnice) of the ICE process. The code handles the whole ICE process, from the gathering of candidates to the final setup of a virtual channel RTP and RTCP can be transported on. Incoming RTP and RTCP packets from peers are relayed to the associated plugins by means of the incoming_rtp and incoming_rtcp callbacks. Packets to be sent to peers are relayed by peers invoking the relay_rtp and relay_rtcp gateway callbacks instead.

Protocols

Macro Definition Documentation

#define JANUS_ICE_HANDLE_WEBRTC_ALERT   (1 << 4)
#define JANUS_ICE_HANDLE_WEBRTC_ALL_TRICKLES   (1 << 8)
#define JANUS_ICE_HANDLE_WEBRTC_BUNDLE   (1 << 5)
#define JANUS_ICE_HANDLE_WEBRTC_CLEANING   (1 << 12)
#define JANUS_ICE_HANDLE_WEBRTC_DATA_CHANNELS   (1 << 10)
#define JANUS_ICE_HANDLE_WEBRTC_HAS_AUDIO   (1 << 13)
#define JANUS_ICE_HANDLE_WEBRTC_HAS_VIDEO   (1 << 14)
#define JANUS_ICE_HANDLE_WEBRTC_PLAN_B   (1 << 11)
#define JANUS_ICE_HANDLE_WEBRTC_PROCESSING_OFFER   (1 << 0)
#define JANUS_ICE_HANDLE_WEBRTC_READY   (1 << 2)
#define JANUS_ICE_HANDLE_WEBRTC_RTCPMUX   (1 << 6)
#define JANUS_ICE_HANDLE_WEBRTC_START   (1 << 1)
#define JANUS_ICE_HANDLE_WEBRTC_STOP   (1 << 3)
#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE   (1 << 7)
#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE_SYNCED   (1 << 9)
#define JANUS_ICE_PACKET_AUDIO   0
#define JANUS_ICE_PACKET_DATA   2
#define JANUS_ICE_PACKET_VIDEO   1
#define LAST_SEQS_MAX_LEN   160

Typedef Documentation

Janus ICE component.

Janus ICE handle/session.

Janus enqueued (S)RTP/(S)RTCP packet to send.

Janus media statistics.

Note
To improve with more stuff

Janus media statistics: received packet info.

Note
To improve with more stuff

Janus ICE stream.

typedef struct janus_seq_info seq_info_t

A helper struct for determining when to send NACKs.

Enumeration Type Documentation

anonymous enum
Enumerator:
SEQ_MISSING 
SEQ_NACKED 
SEQ_GIVEUP 
SEQ_RECVED 

Function Documentation

const gchar* janus_get_ice_state_name ( gint  state)

Helper method to get a string representation of a libnice ICE state.

Parameters
[in]stateThe libnice ICE state
Returns
A string representation of the libnice ICE state
uint janus_get_max_nack_queue ( void  )

Method to get the current max NACK value (i.e., the number of packets per handle to store for retransmissions)

Returns
The current max NACK value
void janus_ice_candidates_to_sdp ( janus_ice_handle handle,
char *  sdp,
guint  stream_id,
guint  component_id 
)

Method to add local candidates to the gateway SDP.

Parameters
[in]handleThe Janus ICE handle this method refers to
[in,out]sdpThe handle description the gateway is preparing
[in]stream_idThe stream ID of the candidate to add to the SDP
[in]component_idThe component ID of the candidate to add to the SDP
void janus_ice_cb_candidate_gathering_done ( NiceAgent *  agent,
guint  stream_id,
gpointer  ice 
)

libnice callback to notify when candidates have been gathered for an ICE agent

Parameters
[in]agentThe libnice agent for which the callback applies
[in]stream_idThe stream ID for which the callback applies
[in]iceOpaque pointer to the Janus ICE handle associated with the libnice ICE agent
void janus_ice_cb_component_state_changed ( NiceAgent *  agent,
guint  stream_id,
guint  component_id,
guint  state,
gpointer  ice 
)

libnice callback to notify when the state of a component changes for an ICE agent

Parameters
[in]agentThe libnice agent for which the callback applies
[in]stream_idThe stream ID for which the callback applies
[in]component_idThe component ID for which the callback applies
[in]stateNew ICE state of the component
[in]iceOpaque pointer to the Janus ICE handle associated with the libnice ICE agent
void janus_ice_cb_new_selected_pair ( NiceAgent *  agent,
guint  stream_id,
guint  component_id,
gchar *  local,
gchar *  remote,
gpointer  ice 
)

libnice callback to notify when a pair of candidates has been selected for an ICE agent

Parameters
[in]agentThe libnice agent for which the callback applies
[in]stream_idThe stream ID for which the callback applies
[in]component_idThe component ID for which the callback applies
[in]localLocal candidate (or foundation)
[in]remoteRemote candidate (or foundation)
[in]iceOpaque pointer to the Janus ICE handle associated with the libnice ICE agent
void janus_ice_cb_nice_recv ( NiceAgent *  agent,
guint  stream_id,
guint  component_id,
guint  len,
gchar *  buf,
gpointer  ice 
)

libnice callback to notify when data has been received by an ICE agent

Parameters
[in]agentThe libnice agent for which the callback applies
[in]stream_idThe stream ID for which the callback applies
[in]component_idThe component ID for which the callback applies
[in]lenLength of the data buffer
[in]bufData buffer
[in]iceOpaque pointer to the Janus ICE handle associated with the libnice ICE agent
void janus_ice_component_free ( GHashTable *  container,
janus_ice_component component 
)

Method to only free resources related to a specific ICE component allocated by a Janus ICE handle.

Parameters
[in]containerThe map containing the list of all components for the stream
[in]componentThe Janus ICE component instance to free
void janus_ice_debugging_disable ( void  )

Method to disable libnice debugging (the default)

void janus_ice_debugging_enable ( void  )
void janus_ice_deinit ( void  )

ICE stuff de-initialization.

void janus_ice_dtls_handshake_done ( janus_ice_handle handle,
janus_ice_component component 
)

Callback to be notified when the DTLS handshake for a specific component has been completed.

This method also decides when to notify attached plugins about the availability of a reliable PeerConnection

Parameters
[in]handleThe Janus ICE handle this callback refers to
[in]componentThe Janus ICE component that is now ready to be used
void janus_ice_force_bundle ( gboolean  forced)

Method to set the BUNDLE support mode (true means mandatory, false means optional)

Parameters
forcedwhether BUNDLE support must be forced or not (default is false)
void janus_ice_force_rtcpmux ( gboolean  forced)

Method to set the rtcp-mux support mode (true means mandatory, false means optional)

Parameters
forcedwhether rtcp-mux support must be forced or not (default is false)
void janus_ice_free ( janus_ice_handle handle)

Method to actually free the resources allocated by a Janus ICE handle.

Parameters
[in]handleThe Janus ICE handle instance to free
uint16_t janus_ice_get_stun_port ( void  )

Method to get the STUN server port.

Returns
The currently used STUN server port, if available, or 0 if not
char* janus_ice_get_stun_server ( void  )

Method to get the STUN server IP address.

Returns
The currently used STUN server IP address, if available, or NULL if not
uint16_t janus_ice_get_turn_port ( void  )

Method to get the TURN server port.

Returns
The currently used TURN server port, if available, or 0 if not
char* janus_ice_get_turn_rest_api ( void  )

Method to get the specified TURN REST API backend, if any.

Returns
The currently specified TURN REST API backend, if available, or NULL if not
char* janus_ice_get_turn_server ( void  )

Method to get the TURN server IP address.

Returns
The currently used TURN server IP address, if available, or NULL if not
gint janus_ice_handle_attach_plugin ( void *  gateway_session,
guint64  handle_id,
janus_plugin plugin 
)

Method to attach a Janus ICE handle to a plugin.

This method is very important, as it allows plugins to send/receive media (RTP/RTCP) to/from a WebRTC peer.

Parameters
[in]gateway_sessionThe gateway/peer session this ICE handle belongs to
[in]handle_idThe Janus ICE handle ID
[in]pluginThe plugin the ICE handle needs to be attached to
Returns
0 in case of success, a negative integer otherwise
janus_ice_handle* janus_ice_handle_create ( void *  gateway_session)

Method to create a new Janus ICE handle.

Parameters
[in]gateway_sessionThe gateway/peer session this ICE handle will belong to
Returns
The created Janus ICE handle if successful, NULL otherwise
gint janus_ice_handle_destroy ( void *  gateway_session,
guint64  handle_id 
)

Method to destroy a Janus ICE handle.

Parameters
[in]gateway_sessionThe gateway/peer session this ICE handle belongs to
[in]handle_idThe Janus ICE handle ID to destroy
Returns
0 in case of success, a negative integer otherwise
janus_ice_handle* janus_ice_handle_find ( void *  gateway_session,
guint64  handle_id 
)

Method to find an existing Janus ICE handle from its ID.

Parameters
[in]gateway_sessionThe gateway/peer session this ICE handle belongs to
[in]handle_idThe Janus ICE handle ID
Returns
The created Janus ICE handle if successful, NULL otherwise
void janus_ice_ignore_interface ( const char *  ip)

Method to add an interface/IP to the ignore list for ICE (that is, don't gather candidates)

Note
This method is especially useful to speed up the ICE gathering process on the gateway: in fact, if you know in advance an interface is not going to be used (e.g., one of those created by VMware), adding it to the ignore list will prevent libnice from gathering a candidate for it.
Parameters
[in]ipInterface/IP to ignore (e.g., 192.168.244.1 or eth1)
void janus_ice_incoming_data ( janus_ice_handle handle,
char *  buffer,
int  length 
)

Plugin SCTP/DataChannel callback, called by the SCTP stack when when there's data for a plugin.

Parameters
[in]handleThe Janus ICE handle associated with the peer
[in]bufferThe message data (buffer)
[in]lengthThe buffer lenght
void janus_ice_init ( gboolean  ice_lite,
gboolean  ice_tcp,
gboolean  ipv6,
uint16_t  rtp_min_port,
uint16_t  rtp_max_port 
)

ICE stuff initialization.

Parameters
[in]ice_liteWhether the ICE Lite mode should be enabled or not
[in]ice_tcpWhether ICE-TCP support should be enabled or not (only libnice >= 0.1.8, currently broken)
[in]ipv6Whether IPv6 candidates must be negotiated or not
[in]rtp_min_portMinimum port to use for RTP/RTCP, if a range is to be used
[in]rtp_max_portMaximum port to use for RTP/RTCP, if a range is to be used
Note
The RTP/RTCP port range configuration may be just a placeholder: for instance, libnice supports this since 0.1.0, but the 0.1.3 on Fedora fails when linking with an undefined reference to nice_agent_set_port_range so this is checked by the install.sh script in advance.
gboolean janus_ice_is_bundle_forced ( void  )

Method to check whether BUNDLE support is forced or not.

Returns
true if BUNDLE is mandatory, false otherwise
gboolean janus_ice_is_ice_debugging_enabled ( void  )

Method to check whether libnice debugging has been enabled (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html)

Returns
True if libnice debugging is enabled, FALSE otherwise
gboolean janus_ice_is_ice_lite_enabled ( void  )

Method to check whether ICE Lite mode is enabled or not (still WIP)

Returns
true if ICE-TCP support is enabled/supported, false otherwise
gboolean janus_ice_is_ice_tcp_enabled ( void  )

Method to check whether ICE-TCP support is enabled/supported or not (still WIP)

Returns
true if ICE-TCP support is enabled/supported, false otherwise
gboolean janus_ice_is_ignored ( const char *  ip)

Method to check whether an interface/IP is currently in the ignore list for ICE (that is, won't have candidates)

Parameters
[in]ipInterface/IP to check (e.g., 192.168.244.1 or eth1)
Returns
true if the interface/IP is in the ignore list, false otherwise
gboolean janus_ice_is_ipv6_enabled ( void  )

Method to check whether IPv6 candidates are enabled/supported or not (still WIP)

Returns
true if IPv6 candidates are enabled/supported, false otherwise
gboolean janus_ice_is_rtcpmux_forced ( void  )

Method to check whether rtcp-mux support is forced or not.

Returns
true if rtcp-mux is mandatory, false otherwise
void janus_ice_notify_hangup ( janus_ice_handle handle,
const char *  reason 
)

Quick helper method to notify a WebRTC hangup through the Janus API.

Parameters
handleThe janus_ice_handle instance this event refers to
reasonA description of why this happened
void janus_ice_relay_data ( janus_ice_handle handle,
char *  buf,
int  len 
)

Gateway SCTP/DataChannel callback, called when a plugin has data to send to a peer.

Parameters
[in]handleThe Janus ICE handle associated with the peer
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void janus_ice_relay_rtcp ( janus_ice_handle handle,
int  video,
char *  buf,
int  len 
)

Gateway RTCP callback, called when a plugin has an RTCP message to send to a peer.

Parameters
[in]handleThe Janus ICE handle associated with the peer
[in]videoWhether this is related to an audio or a video stream
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void janus_ice_relay_rtp ( janus_ice_handle handle,
int  video,
char *  buf,
int  len 
)

Gateway RTP callback, called when a plugin has an RTP packet to send to a peer.

Parameters
[in]handleThe Janus ICE handle associated with the peer
[in]videoWhether this is an audio or a video frame
[in]bufThe packet data (buffer)
[in]lenThe buffer lenght
void* janus_ice_send_thread ( void *  data)

Janus ICE thread for sending outgoing packets.

int janus_ice_set_stun_server ( gchar *  stun_server,
uint16_t  stun_port 
)

Method to force Janus to use a STUN server when gathering candidates.

Parameters
[in]stun_serverSTUN server address to use
[in]stun_portSTUN port to use
Returns
0 in case of success, a negative integer on errors
int janus_ice_set_turn_rest_api ( gchar *  api_server,
gchar *  api_key 
)

Method to force Janus to contact a TURN REST API server to get a TURN service to use when gathering candidates. The TURN REST API takes precedence over any static credential passed via janus_ice_set_turn_server.

Note
Requires libcurl to be available, and a working TURN REST API backend (see turnrest.h)
Parameters
[in]api_serverTURN REST API backend (NULL to disable the API)
[in]api_keyAPI key to use, if required
Returns
0 in case of success, a negative integer on errors
int janus_ice_set_turn_server ( gchar *  turn_server,
uint16_t  turn_port,
gchar *  turn_type,
gchar *  turn_user,
gchar *  turn_pwd 
)

Method to force Janus to use a TURN server when gathering candidates.

Parameters
[in]turn_serverTURN server address to use
[in]turn_portTURN port to use
[in]turn_typeRelay type (udp, tcp or tls)
[in]turn_userTURN username, if needed
[in]turn_pwdTURN password, if needed
Returns
0 in case of success, a negative integer on errors
int janus_ice_setup_local ( janus_ice_handle handle,
int  offer,
int  audio,
int  video,
int  data,
int  bundle,
int  rtcpmux,
int  trickle 
)

Method to locally set up the ICE candidates (initialization and gathering)

Parameters
[in]handleThe Janus ICE handle this method refers to
[in]offerWhether this is for an OFFER or an ANSWER
[in]audioWhether audio is enabled
[in]videoWhether video is enabled
[in]dataWhether SCTP data channels are enabled
[in]bundleWhether BUNDLE is supported or not
[in]rtcpmuxWhether rtcp-mux is supported or not
[in]trickleWhether ICE trickling is supported or not
Returns
0 in case of success, a negative integer otherwise
void janus_ice_setup_remote_candidates ( janus_ice_handle handle,
guint  stream_id,
guint  component_id 
)

Method to handle remote candidates and start the connectivity checks.

Parameters
[in]handleThe Janus ICE handle this method refers to
[in]stream_idThe stream ID of the candidate to add to the SDP
[in]component_idThe component ID of the candidate to add to the SDP
void janus_ice_stats_reset ( janus_ice_stats stats)

Quick helper method to reset stats.

Parameters
statsThe janus_ice_stats instance to reset
void janus_ice_stream_free ( GHashTable *  container,
janus_ice_stream stream 
)

Method to only free resources related to a specific ICE stream allocated by a Janus ICE handle.

Parameters
[in]containerThe map containing the list of all streams for the handle
[in]streamThe Janus ICE stream instance to free
void* janus_ice_thread ( void *  data)

Janus ICE handle thread.

void janus_ice_webrtc_free ( janus_ice_handle handle)

Method to only free the WebRTC related resources allocated by a Janus ICE handle.

Parameters
[in]handleThe Janus ICE handle instance managing the WebRTC resources to free
void janus_ice_webrtc_hangup ( janus_ice_handle handle)

Method to only hangup (e.g., DTLS alert) the WebRTC PeerConnection allocated by a Janus ICE handle.

Parameters
[in]handleThe Janus ICE handle instance managing the WebRTC PeerConnection to hangup
gboolean janus_plugin_session_is_alive ( janus_plugin_session plugin_session)

Quick helper method to check if a plugin session associated with a Janus handle is still valid.

Parameters
plugin_sessionThe janus_plugin_session instance to validate
Returns
true if the plugin session is valid, false otherwise
void janus_set_max_nack_queue ( uint  mnq)

Method to modify the max NACK value (i.e., the number of packets per handle to store for retransmissions)

Parameters
[in]mnqThe new max NACK value