Fork me on GitHub
Loading...
Searching...
No Matches
Data Fields
janus_eventhandler Struct Reference

The event handler plugin session and callbacks interface. More...

#include <eventhandler.h>

Data Fields

int(*const init )(const char *config_path)
 Event handler plugin initialization/constructor.
 
void(*const destroy )(void)
 Event handler plugin deinitialization/destructor.
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this event handler plugin was compiled against.
 
int(*const get_version )(void)
 Informative method to request the numeric version of the event handler plugin.
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the event handler plugin.
 
const char *(*const get_description )(void)
 Informative method to request a description of the event handler plugin.
 
const char *(*const get_name )(void)
 Informative method to request the name of the event handler plugin.
 
const char *(*const get_author )(void)
 Informative method to request the author of the event handler plugin.
 
const char *(*const get_package )(void)
 Informative method to request the package name of the event handler plugin (what will be used in web applications to refer to it)
 
void(*const incoming_event )(json_t *event)
 Method to notify the event handler plugin that a new event is available.
 
json_t *(*const handle_request )(json_t *request)
 Method to send a request to this specific event handler plugin.
 
janus_flags events_mask
 Mask of events this handler is interested in, as a janus_flags object.
 

Detailed Description

The event handler plugin session and callbacks interface.

Field Documentation

◆ destroy

void(*const janus_eventhandler::destroy) (void)

Event handler plugin deinitialization/destructor.

◆ events_mask

janus_flags janus_eventhandler::events_mask

Mask of events this handler is interested in, as a janus_flags object.

◆ get_api_compatibility

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

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

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

◆ get_author

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

Informative method to request the author of the event handler plugin.

◆ get_description

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

Informative method to request a description of the event handler plugin.

◆ get_name

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

Informative method to request the name of the event handler plugin.

◆ get_package

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

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

◆ get_version

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

Informative method to request the numeric version of the event handler plugin.

◆ get_version_string

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

Informative method to request the string version of the event handler plugin.

◆ handle_request

json_t *(*const janus_eventhandler::handle_request) (json_t *request)

Method to send a request to this specific event handler 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 handler 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 handler plugin for monitoring purposes.

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

◆ incoming_event

void(*const janus_eventhandler::incoming_event) (json_t *event)

Method to notify the event handler plugin that a new event is available.

All events are notified as a Jansson json_t object, and the syntax of the associated JSON document is as follows:

{
        "type" : <numeric event type identifier>,
        "timestamp" : <monotonic time of when the event was generated>,
        "session_id" : <unique session identifier>,
        "handle_id" : <unique handle identifier, if provided/available>,
        "event" : {
                <event body, custom depending on event type>
        }
}
 * 
Note
Do NOT handle the event directly in this method. Janus sends events from its working threads, and so you'd most likely end up slowing it down. Just take note of it and handle it somewhere else. It's your responsibility to json_decref the event object once you're done with it: a failure to do so will result in memory leaks.
Parameters
[in]eventJansson object containing the event details

◆ init

int(*const janus_eventhandler::init) (const char *config_path)

Event handler plugin initialization/constructor.

Parameters
[in]config_pathPath of the folder where the configuration for this event handler plugin can be found
Returns
0 in case of success, a negative integer in case of error

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