Loading...
Searching...
No Matches
eventhandler.h
Go to the documentation of this file.
#ifndef JANUS_EVENTHANDLER_H
#define JANUS_EVENTHANDLER_H
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <inttypes.h>
#include <glib.h>
#include <jansson.h>
#include "../utils.h"
#define JANUS_EVENTHANDLER_API_VERSION 3
#define JANUS_EVENT_TYPE_NONE (0)
#define JANUS_EVENT_TYPE_SESSION (1 << 0)
#define JANUS_EVENT_TYPE_HANDLE (1 << 1)
#define JANUS_EVENT_TYPE_EXTERNAL (1 << 2)
#define JANUS_EVENT_TYPE_JSEP (1 << 3)
#define JANUS_EVENT_TYPE_WEBRTC (1 << 4)
#define JANUS_EVENT_TYPE_MEDIA (1 << 5)
#define JANUS_EVENT_TYPE_PLUGIN (1 << 6)
#define JANUS_EVENT_TYPE_TRANSPORT (1 << 7)
#define JANUS_EVENT_TYPE_CORE (1 << 8)
/* TODO Others? */
#define JANUS_EVENT_TYPE_ALL (0xffffffff)
#define JANUS_EVENT_SUBTYPE_NONE 0
#define JANUS_EVENT_SUBTYPE_CORE_STARTUP 1
#define JANUS_EVENT_SUBTYPE_CORE_SHUTDOWN 2
#define JANUS_EVENT_SUBTYPE_WEBRTC_ICE 1
#define JANUS_EVENT_SUBTYPE_WEBRTC_LCAND 2
#define JANUS_EVENT_SUBTYPE_WEBRTC_RCAND 3
#define JANUS_EVENT_SUBTYPE_WEBRTC_PAIR 4
#define JANUS_EVENT_SUBTYPE_WEBRTC_DTLS 5
#define JANUS_EVENT_SUBTYPE_WEBRTC_STATE 6
#define JANUS_EVENT_SUBTYPE_MEDIA_STATE 1
#define JANUS_EVENT_SUBTYPE_MEDIA_SLOWLINK 2
#define JANUS_EVENT_SUBTYPE_MEDIA_STATS 3
#define JANUS_EVENTHANDLER_INIT(...) { \
.init = NULL, \
.destroy = NULL, \
.get_api_compatibility = NULL, \
.get_version = NULL, \
.get_version_string = NULL, \
.get_description = NULL, \
.get_name = NULL, \
.get_author = NULL, \
.get_package = NULL, \
.incoming_event = NULL, \
.events_mask = JANUS_EVENT_TYPE_NONE, \
## __VA_ARGS__ }
typedef struct janus_eventhandler janus_eventhandler;
struct janus_eventhandler {
int (* const init)(const char *config_path);
void (* const destroy)(void);
int (* const get_api_compatibility)(void);
int (* const get_version)(void);
const char *(* const get_version_string)(void);
const char *(* const get_description)(void);
const char *(* const get_name)(void);
const char *(* const get_author)(void);
const char *(* const get_package)(void);
void (* const incoming_event)(json_t *event);
json_t *(* const handle_request)(json_t *request);
janus_flags events_mask;
};
typedef janus_eventhandler* create_e(void);
#endif
create_e
janus_eventhandler * create_e(void)
The hook that event handler plugins need to implement to be created from the Janus core.
Definition eventhandler.h:278
json_t
struct json_t json_t
Definition plugin.h:236
janus_eventhandler
The event handler plugin session and callbacks interface.
Definition eventhandler.h:214
janus_eventhandler::get_version_string
const char *(*const get_version_string)(void)
Informative method to request the string version of the event handler plugin.
Definition eventhandler.h:229
janus_eventhandler::events_mask
janus_flags events_mask
Mask of events this handler is interested in, as a janus_flags object.
Definition eventhandler.h:274
janus_eventhandler::get_description
const char *(*const get_description)(void)
Informative method to request a description of the event handler plugin.
Definition eventhandler.h:231
janus_eventhandler::get_package
const char *(*const get_package)(void)
Informative method to request the package name of the event handler plugin (what will be used in web ...
Definition eventhandler.h:237
janus_eventhandler::init
int(*const init)(const char *config_path)
Event handler plugin initialization/constructor.
Definition eventhandler.h:218
janus_eventhandler::get_name
const char *(*const get_name)(void)
Informative method to request the name of the event handler plugin.
Definition eventhandler.h:233
janus_eventhandler::incoming_event
void(*const incoming_event)(json_t *event)
Method to notify the event handler plugin that a new event is available.
Definition eventhandler.h:258
janus_eventhandler::get_api_compatibility
int(*const get_api_compatibility)(void)
Informative method to request the API version this event handler plugin was compiled against.
Definition eventhandler.h:225
janus_eventhandler::get_version
int(*const get_version)(void)
Informative method to request the numeric version of the event handler plugin.
Definition eventhandler.h:227
janus_eventhandler::get_author
const char *(*const get_author)(void)
Informative method to request the author of the event handler plugin.
Definition eventhandler.h:235
janus_eventhandler::handle_request
json_t *(*const handle_request)(json_t *request)
Method to send a request to this specific event handler plugin.
Definition eventhandler.h:271
janus_eventhandler::destroy
void(*const destroy)(void)
Event handler plugin deinitialization/destructor.
Definition eventhandler.h:220
janus_flags
gsize janus_flags
Janus flags container.
Definition utils.h:155