Fork me on GitHub
Data Structures | Macros | Typedefs | Functions
janus_mqtt.c File Reference

Janus MQTT transport plugin. More...

#include "transport.h"
#include <MQTTAsync.h>
#include "../debug.h"
#include "../config.h"
#include "../utils.h"
Include dependency graph for janus_mqtt.c:

Data Structures

struct  janus_mqtt_context
 

Macros

#define JANUS_MQTT_VERSION   1
 
#define JANUS_MQTT_VERSION_STRING   "0.0.1"
 
#define JANUS_MQTT_DESCRIPTION   "This transport plugin adds MQTT support to the Janus API via Paho client library."
 
#define JANUS_MQTT_NAME   "JANUS MQTT transport plugin"
 
#define JANUS_MQTT_AUTHOR   "Andrei Nesterov <ae.nesterov@gmail.com>"
 
#define JANUS_MQTT_PACKAGE   "janus.transport.mqtt"
 

Typedefs

typedef struct janus_mqtt_context janus_mqtt_context
 

Functions

janus_transportcreate (void)
 
int janus_mqtt_init (janus_transport_callbacks *callback, const char *config_path)
 
void janus_mqtt_destroy (void)
 
int janus_mqtt_get_api_compatibility (void)
 
int janus_mqtt_get_version (void)
 
const char * janus_mqtt_get_version_string (void)
 
const char * janus_mqtt_get_description (void)
 
const char * janus_mqtt_get_name (void)
 
const char * janus_mqtt_get_author (void)
 
const char * janus_mqtt_get_package (void)
 
gboolean janus_mqtt_is_janus_api_enabled (void)
 
gboolean janus_mqtt_is_admin_api_enabled (void)
 
int janus_mqtt_send_message (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
 
void janus_mqtt_session_created (janus_transport_session *transport, guint64 session_id)
 
void janus_mqtt_session_over (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
 
void janus_mqtt_session_claimed (janus_transport_session *transport, guint64 session_id)
 
void janus_mqtt_client_connection_lost (void *context, char *cause)
 
int janus_mqtt_client_message_arrived (void *context, char *topicName, int topicLen, MQTTAsync_message *message)
 
void janus_mqtt_client_delivery_complete (void *context, MQTTAsync_token token)
 
int janus_mqtt_client_connect (janus_mqtt_context *ctx)
 
void janus_mqtt_client_connect_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_connect_failure (void *context, MQTTAsync_failureData *response)
 
int janus_mqtt_client_reconnect (janus_mqtt_context *ctx)
 
void janus_mqtt_client_reconnect_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_reconnect_failure (void *context, MQTTAsync_failureData *response)
 
int janus_mqtt_client_disconnect (janus_mqtt_context *ctx)
 
void janus_mqtt_client_disconnect_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_disconnect_failure (void *context, MQTTAsync_failureData *response)
 
int janus_mqtt_client_subscribe (janus_mqtt_context *ctx, gboolean admin)
 
void janus_mqtt_client_subscribe_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_subscribe_failure (void *context, MQTTAsync_failureData *response)
 
void janus_mqtt_client_admin_subscribe_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_admin_subscribe_failure (void *context, MQTTAsync_failureData *response)
 
int janus_mqtt_client_publish_message (janus_mqtt_context *ctx, char *payload, gboolean admin)
 
void janus_mqtt_client_publish_janus_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_publish_janus_failure (void *context, MQTTAsync_failureData *response)
 
void janus_mqtt_client_publish_admin_success (void *context, MQTTAsync_successData *response)
 
void janus_mqtt_client_publish_admin_failure (void *context, MQTTAsync_failureData *response)
 
void janus_mqtt_client_destroy_context (janus_mqtt_context **ctx)
 

Detailed Description

Janus MQTT transport plugin.

Author
Andrei Nesterov ae.ne.nosp@m.ster.nosp@m.ov@gm.nosp@m.ail..nosp@m.com

This is an implementation of a MQTT transport for the Janus API, using the Eclipse Paho C Client library (https://eclipse.org/paho/clients/c). This means that this module adds support for MQTT based messaging as an alternative "transport" for API requests, responses and notifications. This is only useful when you're handling the communication with clients your own way. Right now, you can only configure the address of the MQTT broker to use, and the queues to make use of to receive (to-janus) and send (from-janus) messages from/to an external application. As with WebSockets, considering that requests wouldn't include a path to address some mandatory information, these requests addressed to Janus should include as part of their payload, when needed, additional pieces of information like session_id and handle_id. That is, where you'd send a Janus request related to a specific session to the /janus/ <session> path, with MQTT you'd have to send the same request with an additional session_id field in the JSON payload.

Note
When you create a session using MQTT, a subscription to the events related to it is done automatically through the outgoing queue, so no need for an explicit request as the GET in the plain HTTP API.

transports

Macro Definition Documentation

#define JANUS_MQTT_AUTHOR   "Andrei Nesterov <ae.nesterov@gmail.com>"
#define JANUS_MQTT_DESCRIPTION   "This transport plugin adds MQTT support to the Janus API via Paho client library."
#define JANUS_MQTT_NAME   "JANUS MQTT transport plugin"
#define JANUS_MQTT_PACKAGE   "janus.transport.mqtt"
#define JANUS_MQTT_VERSION   1
#define JANUS_MQTT_VERSION_STRING   "0.0.1"

Typedef Documentation

Function Documentation

janus_transport* create ( void  )
void janus_mqtt_client_admin_subscribe_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_admin_subscribe_success ( void *  context,
MQTTAsync_successData *  response 
)
int janus_mqtt_client_connect ( janus_mqtt_context ctx)
void janus_mqtt_client_connect_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_connect_success ( void *  context,
MQTTAsync_successData *  response 
)
void janus_mqtt_client_connection_lost ( void *  context,
char *  cause 
)
void janus_mqtt_client_delivery_complete ( void *  context,
MQTTAsync_token  token 
)
void janus_mqtt_client_destroy_context ( janus_mqtt_context **  ctx)
int janus_mqtt_client_disconnect ( janus_mqtt_context ctx)
void janus_mqtt_client_disconnect_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_disconnect_success ( void *  context,
MQTTAsync_successData *  response 
)
int janus_mqtt_client_message_arrived ( void *  context,
char *  topicName,
int  topicLen,
MQTTAsync_message *  message 
)
void janus_mqtt_client_publish_admin_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_publish_admin_success ( void *  context,
MQTTAsync_successData *  response 
)
void janus_mqtt_client_publish_janus_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_publish_janus_success ( void *  context,
MQTTAsync_successData *  response 
)
int janus_mqtt_client_publish_message ( janus_mqtt_context ctx,
char *  payload,
gboolean  admin 
)
int janus_mqtt_client_reconnect ( janus_mqtt_context ctx)
void janus_mqtt_client_reconnect_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_reconnect_success ( void *  context,
MQTTAsync_successData *  response 
)
int janus_mqtt_client_subscribe ( janus_mqtt_context ctx,
gboolean  admin 
)
void janus_mqtt_client_subscribe_failure ( void *  context,
MQTTAsync_failureData *  response 
)
void janus_mqtt_client_subscribe_success ( void *  context,
MQTTAsync_successData *  response 
)
void janus_mqtt_destroy ( void  )
int janus_mqtt_get_api_compatibility ( void  )
const char * janus_mqtt_get_author ( void  )
const char * janus_mqtt_get_description ( void  )
const char * janus_mqtt_get_name ( void  )
const char * janus_mqtt_get_package ( void  )
int janus_mqtt_get_version ( void  )
const char * janus_mqtt_get_version_string ( void  )
int janus_mqtt_init ( janus_transport_callbacks callback,
const char *  config_path 
)
gboolean janus_mqtt_is_admin_api_enabled ( void  )
gboolean janus_mqtt_is_janus_api_enabled ( void  )
int janus_mqtt_send_message ( janus_transport_session transport,
void *  request_id,
gboolean  admin,
json_t message 
)
void janus_mqtt_session_claimed ( janus_transport_session transport,
guint64  session_id 
)
void janus_mqtt_session_created ( janus_transport_session transport,
guint64  session_id 
)
void janus_mqtt_session_over ( janus_transport_session transport,
guint64  session_id,
gboolean  timeout,
gboolean  claimed 
)