Loading...
Searching...
No Matches
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.
void(*const | relay_rtp )(janus_plugin_session *handle, janus_plugin_rtp *packet)
| Callback to relay RTP packets to a peer.
void(*const | relay_rtcp )(janus_plugin_session *handle, janus_plugin_rtcp *packet)
| Callback to relay RTCP messages to a peer.
void(*const | relay_data )(janus_plugin_session *handle, janus_plugin_data *packet)
| Callback to relay SCTP/DataChannel messages to a peer.
void(*const | send_pli )(janus_plugin_session *handle)
| Helper to ask for a keyframe via a RTCP PLI to all video streams.
void(*const | send_pli_stream )(janus_plugin_session *handle, int mindex)
| Helper to ask for a keyframe via a RTCP PLI to a specific video stream.
void(*const | send_remb )(janus_plugin_session *handle, guint32 bitrate)
| Helper to ask for a keyframe via a RTCP PLI.
void(*const | close_pc )(janus_plugin_session *handle)
| Callback to ask the core to close a WebRTC PeerConnection.
void(*const | end_session )(janus_plugin_session *handle)
| Callback to ask the core to get rid of a plugin/gateway session.
gboolean(*const | events_is_enabled )(void)
| Callback to check whether the event handlers mechanism is enabled.
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.
gboolean(*const | auth_is_signed )(void)
| Method to check whether the core is using signed tokens.
gboolean(*const | auth_is_signature_valid )(janus_plugin *plugin, const char *token)
| Method to check whether a signed token is valid.
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.

## Detailed Description

Callbacks to contact the Janus core.

## Field Documentation

## auth_is_signature_valid

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] | token | The token to validate

Returns
  TRUE if the signature is valid and not expired, FALSE otherwise

## auth_is_signed

gboolean(*const janus_callbacks::auth_is_signed) (void)

Method to check whether the core is using signed tokens.

Returns
  TRUE if signed tokens are in use, FALSE otherwise

## auth_signature_contains

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] | token | The token to validate
  [in] | desc | The descriptor to search for

Returns
  TRUE if the token is valid, not expired and contains the descriptor, FALSE otherwise

## close_pc

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, but only if a PeerConnection had been created or was in the process of being negotiated (SDP exchanged)

Parameters

  [in] | handle | The plugin/gateway session that the PeerConnection is related to

## end_session

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] | handle | The plugin/gateway session to get rid of

## events_is_enabled

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)

## notify_event

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] | plugin | The plugin originating the event
  [in] | handle | The plugin/gateway session originating the event, if any
  [in] | event | The event to notify as a Jansson json_t object

## push_event

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] | handle | The plugin/gateway session used for this peer
  [in] | plugin | The plugin instance that is sending the message/event
  [in] | transaction | The transaction identifier this message refers to
  [in] | message | The json_t object containing the JSON message
  [in] | jsep | The json_t object containing the JSEP type, the SDP attached to the message/event, if any (offer/answer), and whether this is an update

## relay_data

void(*const janus_callbacks::relay_data) (janus_plugin_session *handle, janus_plugin_data *packet)

Callback to relay SCTP/DataChannel messages to a peer.

Note
  The protocol is only used for the first message sent on a new data channel, as it will be used to create it; it will be ignored for following messages on the same label, so you can set NULL after that

Parameters

  [in] | handle | The plugin/gateway session that will be used for this peer
  [in] | packet | The message data and related info

## relay_rtcp

void(*const janus_callbacks::relay_rtcp) (janus_plugin_session *handle, janus_plugin_rtcp *packet)

Callback to relay RTCP messages to a peer.

Parameters

  [in] | handle | The plugin/gateway session that will be used for this peer
  [in] | packet | The RTCP packet and related data

## relay_rtp

void(*const janus_callbacks::relay_rtp) (janus_plugin_session *handle, janus_plugin_rtp *packet)

Callback to relay RTP packets to a peer.

Parameters

  [in] | handle | The plugin/gateway session used for this peer
  [in] | packet | The RTP packet and related data

## send_pli

void(*const janus_callbacks::send_pli) (janus_plugin_session *handle)

Helper to ask for a keyframe via a RTCP PLI to all video streams.

Note
  This is a shortcut, as it is also possible to do the same by crafting an RTCP PLI message manually, and passing it to the core via relay_rtcp

Parameters

  [in] | handle | The plugin/gateway session that will be used for this peer

## send_pli_stream

void(*const janus_callbacks::send_pli_stream) (janus_plugin_session *handle, int mindex)

Helper to ask for a keyframe via a RTCP PLI to a specific video stream.

Note
  This is a shortcut, as it is also possible to do the same by crafting an RTCP PLI message manually, and passing it to the core via relay_rtcp

Parameters

  [in] | handle | The plugin/gateway session that will be used for this peer
  [in] | mindex | Index of the stream to send the PLI to (relative to the SDP; passing -1 will send it to the first video stream in the SDP)

## send_remb

void(*const janus_callbacks::send_remb) (janus_plugin_session *handle, guint32 bitrate)

Helper to ask for a keyframe via a RTCP PLI.

Note
  This is a shortcut, as it is also possible to do the same by crafting an RTCP REMB message manually, and passing it to the core via relay_rtcp

Parameters

  [in] | handle | The plugin/gateway session that will be used for this peer
  [in] | bitrate | The bitrate value to send in the REMB message

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

- plugin.h