Fork me on GitHub
transport.h
Go to the documentation of this file.
1 
82 #ifndef _JANUS_TRANSPORT_H
83 #define _JANUS_TRANSPORT_H
84 
85 #include <stdlib.h>
86 #include <stdint.h>
87 #include <stdio.h>
88 #include <string.h>
89 #include <ctype.h>
90 #include <unistd.h>
91 #include <inttypes.h>
92 
93 #include <glib.h>
94 #include <jansson.h>
95 
96 #include "refcount.h"
97 
98 
100 #define JANUS_TRANSPORT_API_VERSION 7
101 
116 #define JANUS_TRANSPORT_INIT(...) { \
117  .init = NULL, \
118  .destroy = NULL, \
119  .get_api_compatibility = NULL, \
120  .get_version = NULL, \
121  .get_version_string = NULL, \
122  .get_description = NULL, \
123  .get_name = NULL, \
124  .get_author = NULL, \
125  .get_package = NULL, \
126  .is_janus_api_enabled = NULL, \
127  .is_admin_api_enabled = NULL, \
128  .send_message = NULL, \
129  .session_created = NULL, \
130  .session_over = NULL, \
131  .session_claimed = NULL, \
132  ## __VA_ARGS__ }
133 
134 
141 
142 
146  void *transport_p;
148  void (*p_free)(void *);
151  volatile gint destroyed;
156 };
171 
172 
179  int (* const init)(janus_transport_callbacks *callback, const char *config_path);
181  void (* const destroy)(void);
182 
186  int (* const get_api_compatibility)(void);
188  int (* const get_version)(void);
190  const char *(* const get_version_string)(void);
192  const char *(* const get_description)(void);
194  const char *(* const get_name)(void);
196  const char *(* const get_author)(void);
198  const char *(* const get_package)(void);
199 
201  gboolean (* const is_janus_api_enabled)(void);
203  gboolean (* const is_admin_api_enabled)(void);
204 
214  int (* const send_message)(janus_transport_session *transport, void *request_id, gboolean admin, json_t *message);
219  void (* const session_created)(janus_transport_session *transport, guint64 session_id);
226  void (* const session_over)(janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed);
231  void (* const session_claimed)(janus_transport_session *transport, guint64 session_id);
232 
233 };
234 
243  void (* const incoming_request)(janus_transport *plugin, janus_transport_session *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error);
253  void (* const transport_gone)(janus_transport *plugin, janus_transport_session *transport);
257  gboolean (* const is_api_secret_needed)(janus_transport *plugin);
265  gboolean (* const is_api_secret_valid)(janus_transport *plugin, const char *apisecret);
268  gboolean (* const is_auth_token_needed)(janus_transport *plugin);
276  gboolean (* const is_auth_token_valid)(janus_transport *plugin, const char *token);
277 
280  gboolean (* const events_is_enabled)(void);
285  void (* const notify_event)(janus_transport *plugin, void *transport, json_t *event);
286 };
287 
289 typedef janus_transport* create_t(void);
290 
291 #endif
volatile gint destroyed
Whether this mapping has been destroyed definitely or not: if so, the transport shouldn&#39;t make use of...
Definition: transport.h:151
const char *(*const get_version_string)(void)
Informative method to request the string version of the transport plugin.
Definition: transport.h:190
janus_transport * create_t(void)
The hook that transport plugins need to implement to be created from the Janus core.
Definition: transport.h:289
Reference counter mechanism.
struct json_t json_t
Definition: plugin.h:223
void(* p_free)(void *)
Pointer to the transport-provided function, if needed, that will be used to free the opaque transport...
Definition: transport.h:148
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:61
void * transport_p
Opaque pointer to the transport session.
Definition: transport.h:146
const char *(*const get_name)(void)
Informative method to request the name of the transport plugin.
Definition: transport.h:194
Definition: refcount.h:78
const char *(*const get_package)(void)
Informative method to request the package name of the transport plugin (what will be used in web appl...
Definition: transport.h:198
const char *(*const get_description)(void)
Informative method to request a description of the transport plugin.
Definition: transport.h:192
The transport plugin session and callbacks interface.
Definition: transport.h:174
janus_transport_session * janus_transport_session_create(void *transport_p, void(*p_free)(void *))
Helper to create a janus_transport_session instance.
Definition: transport.c:24
Callbacks to contact the Janus core.
Definition: transport.h:236
Transport-Gateway session mapping.
Definition: transport.h:144
janus_mutex mutex
Mutex to protect changes to transport_p.
Definition: transport.h:153
janus_refcount ref
Reference counter for this instance.
Definition: transport.h:155
const char *(*const get_author)(void)
Informative method to request the author of the transport plugin.
Definition: transport.h:196
void janus_transport_session_destroy(janus_transport_session *session)
Helper to mark a janus_transport_session instance as destroyed.
Definition: transport.c:36