Fork me on GitHub
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. More...
 
void(*const destroy )(void)
 Event handler plugin deinitialization/destructor. More...
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this event handler plugin was compiled against. More...
 
int(*const get_version )(void)
 Informative method to request the numeric version of the event handler plugin. More...
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the event handler plugin. More...
 
const char *(*const get_description )(void)
 Informative method to request a description of the event handler plugin. More...
 
const char *(*const get_name )(void)
 Informative method to request the name of the event handler plugin. More...
 
const char *(*const get_author )(void)
 Informative method to request the author of the event handler plugin. More...
 
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) More...
 
void(*const incoming_event )(json_t *event)
 Method to notify the event handler plugin that a new event is available. More...
 
janus_flags events_mask
 Mask of events this handler is interested in, as a janus_flags object. More...
 

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.

◆ 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: