Fork me on GitHub
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
janus_callbacks Struct Reference

Callbacks to contact the Janus core. More...

#include <plugin.h>

Data Fields

int(*const push_event )(janus_plugin_session *handle, janus_plugin *plugin, const char *transaction, json_t *message, json_t *jsep)
 Callback to push events/messages to a peer. More...
 
void(*const relay_rtp )(janus_plugin_session *handle, int mindex, gboolean video, char *buf, int len)
 Callback to relay RTP packets to a peer. More...
 
void(*const relay_rtcp )(janus_plugin_session *handle, int mindex, gboolean video, char *buf, int len)
 Callback to relay RTCP messages to a peer. More...
 
void(*const relay_data )(janus_plugin_session *handle, char *label, char *buf, int len)
 Callback to relay SCTP/DataChannel messages to a peer. More...
 
void(*const close_pc )(janus_plugin_session *handle)
 Callback to ask the core to close a WebRTC PeerConnection. More...
 
void(*const end_session )(janus_plugin_session *handle)
 Callback to ask the core to get rid of a plugin/gateway session. More...
 
gboolean(*const events_is_enabled )(void)
 Callback to check whether the event handlers mechanism is enabled. More...
 
void(*const notify_event )(janus_plugin *plugin, janus_plugin_session *handle, json_t *event)
 Callback to notify an event to the registered and subscribed event handlers. More...
 
gboolean(*const auth_is_signature_valid )(janus_plugin *plugin, const char *token)
 Method to check whether a signed token is valid. More...
 
gboolean(*const auth_signature_contains )(janus_plugin *plugin, const char *token, const char *descriptor)
 Method to verify a signed token grants access to a descriptor. More...
 

Detailed Description

Callbacks to contact the Janus core.

Field Documentation

gboolean(* const janus_callbacks::auth_is_signature_valid)(janus_plugin *plugin, const char *token)

Method to check whether a signed token is valid.

Note
accepts only tokens with the plugin identifier as realm
Parameters
[in]tokenThe token to validate
Returns
TRUE if the signature is valid and not expired, FALSE otherwise
gboolean(* const janus_callbacks::auth_signature_contains)(janus_plugin *plugin, const char *token, const char *descriptor)

Method to verify a signed token grants access to a descriptor.

Note
accepts only tokens with the plugin identifier as realm
Parameters
[in]tokenThe token to validate
[in]descThe descriptor to search for
Returns
TRUE if the token is valid, not expired and contains the descriptor, FALSE otherwise
void(* const janus_callbacks::close_pc)(janus_plugin_session *handle)

Callback to ask the core to close a WebRTC PeerConnection.

Note
A call to this method will result in the core invoking the hangup_media callback on this plugin when done
Parameters
[in]handleThe plugin/gateway session that the PeerConnection is related to
void(* const janus_callbacks::end_session)(janus_plugin_session *handle)

Callback to ask the core to get rid of a plugin/gateway session.

Note
A call to this method will result in the core invoking the destroy_session callback on this plugin when done
Parameters
[in]handleThe plugin/gateway session to get rid of
gboolean(* const janus_callbacks::events_is_enabled)(void)

Callback to check whether the event handlers mechanism is enabled.

Returns
TRUE if it is, FALSE if it isn't (which means notify_event should NOT be called)
void(* const janus_callbacks::notify_event)(janus_plugin *plugin, janus_plugin_session *handle, json_t *event)

Callback to notify an event to the registered and subscribed event handlers.

Note
Don't unref the event object, the core will do that for you
Parameters
[in]pluginThe plugin originating the event
[in]handleThe plugin/gateway session originating the event, if any
[in]eventThe event to notify as a Jansson json_t object
int(* const janus_callbacks::push_event)(janus_plugin_session *handle, janus_plugin *plugin, const char *transaction, json_t *message, json_t *jsep)

Callback to push events/messages to a peer.

Note
The Janus core increases the references to both the message and jsep json_t objects. This means that you'll have to decrease your own reference yourself with a json_decref after calling push_event.
Parameters
[in]handleThe plugin/gateway session used for this peer
[in]pluginThe plugin instance that is sending the message/event
[in]transactionThe transaction identifier this message refers to
[in]messageThe json_t object containing the JSON message
[in]jsepThe json_t object containing the JSEP type, the SDP attached to the message/event, if any (offer/answer), and whether this is an update
void(* const janus_callbacks::relay_data)(janus_plugin_session *handle, char *label, char *buf, int len)

Callback to relay SCTP/DataChannel messages to a peer.

Note
Notice that no mindex is needed here, as there can only be a single data channel stream.
Parameters
[in]handleThe plugin/gateway session that will be used for this peer
[in]labelThe label of the data channel to use
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void(* const janus_callbacks::relay_rtcp)(janus_plugin_session *handle, int mindex, gboolean video, char *buf, int len)

Callback to relay RTCP messages to a peer.

Parameters
[in]handleThe plugin/gateway session that will be used for this peer
[in]mindexIndex of the target stream (relative to the SDP), -1 for the first audio/video stream
[in]videoWhether this is related to an audio or a video stream
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void(* const janus_callbacks::relay_rtp)(janus_plugin_session *handle, int mindex, gboolean video, char *buf, int len)

Callback to relay RTP packets to a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]mindexIndex of the target stream (relative to the SDP), -1 for the first audio/video stream
[in]videoWhether this is an audio or a video frame
[in]bufThe packet data (buffer)
[in]lenThe buffer lenght

The documentation for this struct was generated from the following file: