Fork me on GitHub
Data Fields
janus_transport Struct Reference

The transport plugin session and callbacks interface. More...

#include <transport.h>

Data Fields

int(*const init )(janus_transport_callbacks *callback, const char *config_path)
 Transport plugin initialization/constructor. More...
 
void(*const destroy )(void)
 Transport plugin deinitialization/destructor. More...
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this transport plugin was compiled against. More...
 
int(*const get_version )(void)
 Informative method to request the numeric version of the transport plugin. More...
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the transport plugin. More...
 
const char *(*const get_description )(void)
 Informative method to request a description of the transport plugin. More...
 
const char *(*const get_name )(void)
 Informative method to request the name of the transport plugin. More...
 
const char *(*const get_author )(void)
 Informative method to request the author of the transport plugin. More...
 
const char *(*const get_package )(void)
 Informative method to request the package name of the transport plugin (what will be used in web applications to refer to it) More...
 
gboolean(*const is_janus_api_enabled )(void)
 Informative method to check whether any Janus API support is currently enabled in this transport. More...
 
gboolean(*const is_admin_api_enabled )(void)
 Informative method to check whether any Admin API support is currently enabled in this transport. More...
 
int(*const send_message )(janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
 Method to send a message to a client over a transport session. More...
 
void(*const session_created )(janus_transport_session *transport, guint64 session_id)
 Method to notify the transport plugin that a new session has been created from this transport. More...
 
void(*const session_over )(janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
 Method to notify the transport plugin that a session it originated timed out. More...
 
void(*const session_claimed )(janus_transport_session *transport, guint64 session_id)
 Method to notify the transport plugin that a session it owned was claimed by another transport. More...
 
json_t *(*const query_transport )(json_t *request)
 Method to send a management request to this specific transport plugin. More...
 

Detailed Description

The transport plugin session and callbacks interface.

Field Documentation

◆ destroy

void(* const janus_transport::destroy) (void)

Transport plugin deinitialization/destructor.

◆ get_api_compatibility

int(* const janus_transport::get_api_compatibility) (void)

Informative method to request the API version this transport plugin was compiled against.

Note
All transport plugins MUST implement this method and return JANUS_TRANSPORT_API_VERSION to make this work, or they will be rejected by the core.

◆ get_author

const char*(* const janus_transport::get_author) (void)

Informative method to request the author of the transport plugin.

◆ get_description

const char*(* const janus_transport::get_description) (void)

Informative method to request a description of the transport plugin.

◆ get_name

const char*(* const janus_transport::get_name) (void)

Informative method to request the name of the transport plugin.

◆ get_package

const char*(* const janus_transport::get_package) (void)

Informative method to request the package name of the transport plugin (what will be used in web applications to refer to it)

◆ get_version

int(* const janus_transport::get_version) (void)

Informative method to request the numeric version of the transport plugin.

◆ get_version_string

const char*(* const janus_transport::get_version_string) (void)

Informative method to request the string version of the transport plugin.

◆ init

int(* const janus_transport::init) (janus_transport_callbacks *callback, const char *config_path)

Transport plugin initialization/constructor.

Parameters
[in]callbackThe callback instance the transport plugin can use to contact the Janus core
[in]config_pathPath of the folder where the configuration for this transport plugin can be found
Returns
0 in case of success, a negative integer in case of error

◆ is_admin_api_enabled

gboolean(* const janus_transport::is_admin_api_enabled) (void)

Informative method to check whether any Admin API support is currently enabled in this transport.

◆ is_janus_api_enabled

gboolean(* const janus_transport::is_janus_api_enabled) (void)

Informative method to check whether any Janus API support is currently enabled in this transport.

◆ query_transport

json_t*(* const janus_transport::query_transport) (json_t *request)

Method to send a management request to this specific transport plugin.

The method takes a Jansson json_t, that contains all the info related to the request. This object will come from an Admin API request, and is meant to represent a synchronous request. Since each transport plugin can have its own bells and whistles, there's no constraint on what this object should contain, which is entirely handler specific. A json_t object needs to be returned as a response, which will be sent in response to the Admin API call. This can be useful to tweak settings in real-time, or to probe the internals of the transport plugin for monitoring purposes.

Parameters
[in]requestJansson object containing the request
Returns
A Jansson object containing the response for the client

◆ send_message

int(* const janus_transport::send_message) (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)

Method to send a message to a client over a transport session.

Note
It's the transport plugin's responsibility to free the message. Besides, a successful return does not necessarily mean the message has been actually sent, but only that it has been accepted by the transport plugim
Parameters
[in]transportPointer to the transport session instance
[in]request_idWill be not-NULL in case this is a response to a previous request
[in]adminWhether this is an admin API or a Janus API message
[in]messageThe message data as a Jansson json_t object
Returns
0 on success, a negative integer otherwise

◆ session_claimed

void(* const janus_transport::session_claimed) (janus_transport_session *transport, guint64 session_id)

Method to notify the transport plugin that a session it owned was claimed by another transport.

Note
A transport plugin should close the connection as a result of such an event
Parameters
[in]transportPointer to the new transport session instance that has claimed the session
[in]session_idThe session ID that was claimed (if the transport cares)

◆ session_created

void(* const janus_transport::session_created) (janus_transport_session *transport, guint64 session_id)

Method to notify the transport plugin that a new session has been created from this transport.

Note
A transport plugin may decide to close the connection as a result of such an event
Parameters
[in]transportPointer to the transport session instance
[in]session_idThe session ID that was created (if the transport cares)

◆ session_over

void(* const janus_transport::session_over) (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)

Method to notify the transport plugin that a session it originated timed out.

Note
A transport plugin may decide to close the connection as a result of such an event
Parameters
[in]transportPointer to the transport session instance
[in]session_idThe session ID that was closed (if the transport cares)
[in]timeoutWhether the cause for the session closure is a timeout (this may interest transport plugins more)
[in]claimedWhether the cause for the session closure is due to someone claiming the session

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