Fork me on GitHub
eventhandler.h
Go to the documentation of this file.
1 
86 #ifndef JANUS_EVENTHANDLER_H
87 #define JANUS_EVENTHANDLER_H
88 
89 #include <stdlib.h>
90 #include <stdint.h>
91 #include <stdio.h>
92 #include <string.h>
93 #include <ctype.h>
94 #include <unistd.h>
95 #include <inttypes.h>
96 
97 #include <glib.h>
98 #include <jansson.h>
99 
100 #include "../utils.h"
101 
102 
104 #define JANUS_EVENTHANDLER_API_VERSION 3
105 
127 
129 #define JANUS_EVENT_TYPE_NONE (0)
130 
131 #define JANUS_EVENT_TYPE_SESSION (1 << 0)
132 
133 #define JANUS_EVENT_TYPE_HANDLE (1 << 1)
134 
135 #define JANUS_EVENT_TYPE_EXTERNAL (1 << 2)
136 
137 #define JANUS_EVENT_TYPE_JSEP (1 << 3)
138 
139 #define JANUS_EVENT_TYPE_WEBRTC (1 << 4)
140 
141 #define JANUS_EVENT_TYPE_MEDIA (1 << 5)
142 
143 #define JANUS_EVENT_TYPE_PLUGIN (1 << 6)
144 
145 #define JANUS_EVENT_TYPE_TRANSPORT (1 << 7)
146 
147 #define JANUS_EVENT_TYPE_CORE (1 << 8)
148  /* TODO Others? */
150 #define JANUS_EVENT_TYPE_ALL (0xffffffff)
151 
167 
169 #define JANUS_EVENT_SUBTYPE_NONE 0
170 
171 #define JANUS_EVENT_SUBTYPE_CORE_STARTUP 1
172 
173 #define JANUS_EVENT_SUBTYPE_CORE_SHUTDOWN 2
174 
175 #define JANUS_EVENT_SUBTYPE_WEBRTC_ICE 1
176 
177 #define JANUS_EVENT_SUBTYPE_WEBRTC_LCAND 2
178 
179 #define JANUS_EVENT_SUBTYPE_WEBRTC_RCAND 3
180 
181 #define JANUS_EVENT_SUBTYPE_WEBRTC_PAIR 4
182 
183 #define JANUS_EVENT_SUBTYPE_WEBRTC_DTLS 5
184 
185 #define JANUS_EVENT_SUBTYPE_WEBRTC_STATE 6
186 
187 #define JANUS_EVENT_SUBTYPE_MEDIA_STATE 1
188 
189 #define JANUS_EVENT_SUBTYPE_MEDIA_SLOWLINK 2
190 
191 #define JANUS_EVENT_SUBTYPE_MEDIA_STATS 3
192 
194 #define JANUS_EVENTHANDLER_INIT(...) { \
195  .init = NULL, \
196  .destroy = NULL, \
197  .get_api_compatibility = NULL, \
198  .get_version = NULL, \
199  .get_version_string = NULL, \
200  .get_description = NULL, \
201  .get_name = NULL, \
202  .get_author = NULL, \
203  .get_package = NULL, \
204  .incoming_event = NULL, \
205  .events_mask = JANUS_EVENT_TYPE_NONE, \
206  ## __VA_ARGS__ }
207 
208 
211 
212 
218  int (* const init)(const char *config_path);
220  void (* const destroy)(void);
221 
225  int (* const get_api_compatibility)(void);
227  int (* const get_version)(void);
229  const char *(* const get_version_string)(void);
231  const char *(* const get_description)(void);
233  const char *(* const get_name)(void);
235  const char *(* const get_author)(void);
237  const char *(* const get_package)(void);
238 
258  void (* const incoming_event)(json_t *event);
259 
271  json_t *(* const handle_request)(json_t *request);
272 
275 };
276 
279 
280 #endif
void(*const destroy)(void)
Event handler plugin deinitialization/destructor.
Definition: eventhandler.h:220
gsize janus_flags
Janus flags container.
Definition: utils.h:110
struct json_t json_t
Definition: plugin.h:236
janus_flags events_mask
Mask of events this handler is interested in, as a janus_flags object.
Definition: eventhandler.h:274
int(*const get_version)(void)
Informative method to request the numeric version of the event handler plugin.
Definition: eventhandler.h:227
const char *(*const get_version_string)(void)
Informative method to request the string version of the event handler plugin.
Definition: eventhandler.h:229
json_t *(*const handle_request)(json_t *request)
Method to send a request to this specific event handler plugin.
Definition: eventhandler.h:271
void(*const incoming_event)(json_t *event)
Method to notify the event handler plugin that a new event is available.
Definition: eventhandler.h:258
The event handler plugin session and callbacks interface.
Definition: eventhandler.h:214
const char *(*const get_name)(void)
Informative method to request the name of the event handler plugin.
Definition: eventhandler.h:233
int(*const init)(const char *config_path)
Event handler plugin initialization/constructor.
Definition: eventhandler.h:218
const char *(*const get_description)(void)
Informative method to request a description of the event handler plugin.
Definition: eventhandler.h:231
int(*const get_api_compatibility)(void)
Informative method to request the API version this event handler plugin was compiled against...
Definition: eventhandler.h:225
const char *(*const get_author)(void)
Informative method to request the author of the event handler plugin.
Definition: eventhandler.h:235
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 * create_e(void)
The hook that event handler plugins need to implement to be created from the Janus core...
Definition: eventhandler.h:278