Fork me on GitHub
plugin.h
Go to the documentation of this file.
1 
146 #ifndef _JANUS_PLUGIN_H
147 #define _JANUS_PLUGIN_H
148 
149 #include <stdlib.h>
150 #include <stdint.h>
151 #include <stdio.h>
152 #include <string.h>
153 #include <ctype.h>
154 #include <unistd.h>
155 #include <inttypes.h>
156 
157 #include <glib.h>
158 
168 #define JANUS_PLUGIN_API_VERSION 8
169 
186 #define JANUS_PLUGIN_INIT(...) { \
187  .init = NULL, \
188  .destroy = NULL, \
189  .get_api_compatibility = NULL, \
190  .get_version = NULL, \
191  .get_version_string = NULL, \
192  .get_description = NULL, \
193  .get_name = NULL, \
194  .get_author = NULL, \
195  .get_package = NULL, \
196  .create_session = NULL, \
197  .handle_message = NULL, \
198  .setup_media = NULL, \
199  .incoming_rtp = NULL, \
200  .incoming_rtcp = NULL, \
201  .incoming_data = NULL, \
202  .slow_link = NULL, \
203  .hangup_media = NULL, \
204  .destroy_session = NULL, \
205  .query_session = NULL, \
206  ## __VA_ARGS__ }
207 
208 
212 typedef struct janus_plugin janus_plugin;
217 
218 /* Use forward declaration to avoid including jansson.h */
219 typedef struct json_t json_t;
220 
229  int stopped:1;
230 };
231 
233 struct janus_plugin {
238  int (* const init)(janus_callbacks *callback, const char *config_path);
240  void (* const destroy)(void);
241 
248  int (* const get_api_compatibility)(void);
250  int (* const get_version)(void);
252  const char *(* const get_version_string)(void);
254  const char *(* const get_description)(void);
256  const char *(* const get_name)(void);
258  const char *(* const get_author)(void);
260  const char *(* const get_package)(void);
261 
265  void (* const create_session)(janus_plugin_session *handle, int *error);
273  struct janus_plugin_result * (* const handle_message)(janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep);
276  void (* const setup_media)(janus_plugin_session *handle);
282  void (* const incoming_rtp)(janus_plugin_session *handle, int video, char *buf, int len);
288  void (* const incoming_rtcp)(janus_plugin_session *handle, int video, char *buf, int len);
296  void (* const incoming_data)(janus_plugin_session *handle, char *buf, int len);
313  void (* const slow_link)(janus_plugin_session *handle, int uplink, int video);
316  void (* const hangup_media)(janus_plugin_session *handle);
320  void (* const destroy_session)(janus_plugin_session *handle, int *error);
327 
328 };
329 
341  int (* const push_event)(janus_plugin_session *handle, janus_plugin *plugin, const char *transaction, json_t *message, json_t *jsep);
342 
348  void (* const relay_rtp)(janus_plugin_session *handle, int video, char *buf, int len);
354  void (* const relay_rtcp)(janus_plugin_session *handle, int video, char *buf, int len);
359  void (* const relay_data)(janus_plugin_session *handle, char *buf, int len);
360 
365  void (* const close_pc)(janus_plugin_session *handle);
370  void (* const end_session)(janus_plugin_session *handle);
371 
374  gboolean (* const events_is_enabled)(void);
380  void (* const notify_event)(janus_plugin *plugin, janus_plugin_session *handle, json_t *event);
381 
382 };
383 
385 typedef janus_plugin* create_p(void);
386 
387 
406 
416 
420  janus_plugin_result_type type;
427  const char *text;
436 };
437 
443 janus_plugin_result *janus_plugin_result_new(janus_plugin_result_type type, const char *text, json_t *content);
444 
450 
451 
452 #endif
The request was correctly handled and a response is provided (synchronous)
Definition: plugin.h:412
json_t *(*const query_session)(janus_plugin_session *handle)
Method to get plugin-specific info of a session/handle.
Definition: plugin.h:326
struct json_t json_t
Definition: plugin.h:219
void * gateway_handle
Opaque pointer to the gateway session.
Definition: plugin.h:224
const char *(*const get_author)(void)
Informative method to request the author of the plugin.
Definition: plugin.h:258
const char *(*const get_version_string)(void)
Informative method to request the string version of the plugin.
Definition: plugin.h:252
const char *(*const get_name)(void)
Informative method to request the name of the plugin.
Definition: plugin.h:256
void janus_plugin_result_destroy(janus_plugin_result *result)
Helper to quickly destroy a janus_plugin_result instance.
Definition: plugin.c:34
Janus plugin result.
Definition: plugin.h:418
janus_plugin_result_type
Result types.
Definition: plugin.h:408
const char *(*const get_package)(void)
Informative method to request the package name of the plugin (what will be used in web applications t...
Definition: plugin.h:260
The request was correctly handled and notifications will follow with more info (asynchronous) ...
Definition: plugin.h:414
The plugin session and callbacks interface.
Definition: plugin.h:233
int stopped
Whether this mapping has been stopped definitely or not: if so, the plugin shouldn&#39;t make use of it a...
Definition: plugin.h:229
const char *(*const get_description)(void)
Informative method to request a description of the plugin.
Definition: plugin.h:254
json_t * content
Result content.
Definition: plugin.h:435
A severe error happened (not an application level error)
Definition: plugin.h:410
janus_plugin * create_p(void)
The hook that plugins need to implement to be created from the gateway.
Definition: plugin.h:385
Callbacks to contact the gateway.
Definition: plugin.h:331
janus_plugin_result * janus_plugin_result_new(janus_plugin_result_type type, const char *text, json_t *content)
Helper to quickly create a janus_plugin_result instance.
Definition: plugin.c:19
void * plugin_handle
Opaque pointer to the plugin session.
Definition: plugin.h:226
Plugin-Gateway session mapping.
Definition: plugin.h:222
const char * text
Text associated with this plugin result.
Definition: plugin.h:427
janus_plugin_result_type type
Result type.
Definition: plugin.h:420