Fork me on GitHub
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
transport.h
Go to the documentation of this file.
1 
81 #ifndef _JANUS_TRANSPORT_H
82 #define _JANUS_TRANSPORT_H
83 
84 #include <stdlib.h>
85 #include <stdint.h>
86 #include <stdio.h>
87 #include <string.h>
88 #include <ctype.h>
89 #include <unistd.h>
90 #include <inttypes.h>
91 
92 #include <glib.h>
93 #include <jansson.h>
94 
95 
97 #define JANUS_TRANSPORT_API_VERSION 6
98 
113 #define JANUS_TRANSPORT_INIT(...) { \
114  .init = NULL, \
115  .destroy = NULL, \
116  .get_api_compatibility = NULL, \
117  .get_version = NULL, \
118  .get_version_string = NULL, \
119  .get_description = NULL, \
120  .get_name = NULL, \
121  .get_author = NULL, \
122  .get_package = NULL, \
123  .is_janus_api_enabled = NULL, \
124  .is_admin_api_enabled = NULL, \
125  .send_message = NULL, \
126  .session_created = NULL, \
127  .session_over = NULL, \
128  ## __VA_ARGS__ }
129 
130 
135 
136 
143  int (* const init)(janus_transport_callbacks *callback, const char *config_path);
145  void (* const destroy)(void);
146 
150  int (* const get_api_compatibility)(void);
152  int (* const get_version)(void);
154  const char *(* const get_version_string)(void);
156  const char *(* const get_description)(void);
158  const char *(* const get_name)(void);
160  const char *(* const get_author)(void);
162  const char *(* const get_package)(void);
163 
165  gboolean (* const is_janus_api_enabled)(void);
167  gboolean (* const is_admin_api_enabled)(void);
168 
178  int (* const send_message)(void *transport, void *request_id, gboolean admin, json_t *message);
183  void (* const session_created)(void *transport, guint64 session_id);
189  void (* const session_over)(void *transport, guint64 session_id, gboolean timeout);
190 
191 };
192 
201  void (* const incoming_request)(janus_transport *plugin, void *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error);
211  void (* const transport_gone)(janus_transport *plugin, void *transport);
215  gboolean (* const is_api_secret_needed)(janus_transport *plugin);
223  gboolean (* const is_api_secret_valid)(janus_transport *plugin, const char *apisecret);
226  gboolean (* const is_auth_token_needed)(janus_transport *plugin);
234  gboolean (* const is_auth_token_valid)(janus_transport *plugin, const char *token);
235 
238  gboolean (* const events_is_enabled)(void);
243  void (* const notify_event)(janus_transport *plugin, void *transport, json_t *event);
244 };
245 
247 typedef janus_transport* create_t(void);
248 
249 #endif
janus_transport * create_t(void)
The hook that transport plugins need to implement to be created from the gateway. ...
Definition: transport.h:247
int(*const init)(janus_transport_callbacks *callback, const char *config_path)
Transport plugin initialization/constructor.
Definition: transport.h:143
struct json_t json_t
Definition: plugin.h:220
void(*const transport_gone)(janus_transport *plugin, void *transport)
Callback to notify an existing transport instance went away.
Definition: transport.h:211
int(*const send_message)(void *transport, void *request_id, gboolean admin, json_t *message)
Method to send a message to a client over a transport session.
Definition: transport.h:178
void(*const destroy)(void)
Transport plugin deinitialization/destructor.
Definition: transport.h:145
const char *(*const get_name)(void)
Informative method to request the name of the transport plugin.
Definition: transport.h:158
const char *(*const get_description)(void)
Informative method to request a description of the transport plugin.
Definition: transport.h:156
gboolean(*const is_api_secret_needed)(janus_transport *plugin)
Callback to check with the core if an API secret must be provided.
Definition: transport.h:215
void(*const incoming_request)(janus_transport *plugin, void *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error)
Callback to notify a new incoming request.
Definition: transport.h:201
gboolean(*const is_janus_api_enabled)(void)
Informative method to check whether any Janus API support is currently enabled in this transport...
Definition: transport.h:165
const char *(*const get_author)(void)
Informative method to request the author of the transport plugin.
Definition: transport.h:160
gboolean(*const is_admin_api_enabled)(void)
Informative method to check whether any Admin API support is currently enabled in this transport...
Definition: transport.h:167
gboolean(*const is_api_secret_valid)(janus_transport *plugin, const char *apisecret)
Callback to check with the core if a provided API secret is valid.
Definition: transport.h:223
const char *(*const get_version_string)(void)
Informative method to request the string version of the transport plugin.
Definition: transport.h:154
The transport plugin session and callbacks interface.
Definition: transport.h:138
gboolean(*const is_auth_token_needed)(janus_transport *plugin)
Callback to check with the core if an authentication token is needed.
Definition: transport.h:226
Callbacks to contact the gateway.
Definition: transport.h:194
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:162
int(*const get_version)(void)
Informative method to request the numeric version of the transport plugin.
Definition: transport.h:152
void(*const notify_event)(janus_transport *plugin, void *transport, json_t *event)
Callback to notify an event to the registered and subscribed event handlers.
Definition: transport.h:243
int(*const get_api_compatibility)(void)
Informative method to request the API version this transport plugin was compiled against.
Definition: transport.h:150
gboolean(*const is_auth_token_valid)(janus_transport *plugin, const char *token)
Callback to check with the core if a provided authentication token is valid.
Definition: transport.h:234
void(*const session_created)(void *transport, guint64 session_id)
Method to notify the transport plugin that a new session has been created from this transport...
Definition: transport.h:183
void(*const session_over)(void *transport, guint64 session_id, gboolean timeout)
Method to notify the transport plugin that a session it originated timed out.
Definition: transport.h:189
gboolean(*const events_is_enabled)(void)
Callback to check whether the event handlers mechanism is enabled.
Definition: transport.h:238