Fork me on GitHub
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
janus_rabbitmq.c File Reference

Janus RabbitMQ transport plugin. More...

#include "transport.h"
#include <amqp.h>
#include <amqp_framing.h>
#include <amqp_tcp_socket.h>
#include <amqp_ssl_socket.h>
#include "../debug.h"
#include "../apierror.h"
#include "../config.h"
#include "../mutex.h"
#include "../utils.h"
Include dependency graph for janus_rabbitmq.c:

Data Structures

struct  janus_rabbitmq_client
 
struct  janus_rabbitmq_response
 

Macros

#define JANUS_RABBITMQ_VERSION   1
 
#define JANUS_RABBITMQ_VERSION_STRING   "0.0.1"
 
#define JANUS_RABBITMQ_DESCRIPTION   "This transport plugin adds RabbitMQ support to the Janus API via rabbitmq-c."
 
#define JANUS_RABBITMQ_NAME   "JANUS RabbitMQ transport plugin"
 
#define JANUS_RABBITMQ_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_RABBITMQ_PACKAGE   "janus.transport.rabbitmq"
 
#define JANUS_RABBITMQ_EXCHANGE_TYPE   "fanout"
 
#define JANUS_RABBITMQ_ERROR_INVALID_REQUEST   411
 
#define JANUS_RABBITMQ_ERROR_MISSING_ELEMENT   412
 
#define JANUS_RABBITMQ_ERROR_INVALID_ELEMENT   413
 
#define JANUS_RABBITMQ_ERROR_UNKNOWN_ERROR   499
 

Typedefs

typedef struct janus_rabbitmq_client janus_rabbitmq_client
 
typedef struct janus_rabbitmq_response janus_rabbitmq_response
 

Functions

janus_transportcreate (void)
 
int janus_rabbitmq_init (janus_transport_callbacks *callback, const char *config_path)
 
void janus_rabbitmq_destroy (void)
 
int janus_rabbitmq_get_api_compatibility (void)
 
int janus_rabbitmq_get_version (void)
 
const char * janus_rabbitmq_get_version_string (void)
 
const char * janus_rabbitmq_get_description (void)
 
const char * janus_rabbitmq_get_name (void)
 
const char * janus_rabbitmq_get_author (void)
 
const char * janus_rabbitmq_get_package (void)
 
gboolean janus_rabbitmq_is_janus_api_enabled (void)
 
gboolean janus_rabbitmq_is_admin_api_enabled (void)
 
int janus_rabbitmq_send_message (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
 
void janus_rabbitmq_session_created (janus_transport_session *transport, guint64 session_id)
 
void janus_rabbitmq_session_over (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
 
void janus_rabbitmq_session_claimed (janus_transport_session *transport, guint64 session_id)
 
json_tjanus_rabbitmq_query_transport (json_t *request)
 
void * janus_rmq_in_thread (void *data)
 
void * janus_rmq_out_thread (void *data)
 

Variables

amqp_boolean_t queue_durable = 0
 
amqp_boolean_t queue_exclusive = 0
 
amqp_boolean_t queue_autodelete = 0
 
amqp_boolean_t queue_durable_admin = 0
 
amqp_boolean_t queue_exclusive_admin = 0
 
amqp_boolean_t queue_autodelete_admin = 0
 

Detailed Description

Janus RabbitMQ transport plugin.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

This is an implementation of a RabbitMQ transport for the Janus API, using the rabbitmq-c library (https://github.com/alanxz/rabbitmq-c). This means that this module adds support for RabbitMQ based messaging as an alternative "transport" for API requests, responses and notifications. This is only useful when you're wrapping Janus requests in your server application, and handling the communication with clients your own way. At the moment, only a single "application" can be handled at the same time, meaning that Janus won't implement multiple queues to handle multiple concurrent "application servers" taking advantage of its features. Support for this is planned, though (e.g., through some kind of negotiation to create queues on the fly). Right now, you can only configure the address of the RabbitMQ server 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 RabbitMQ 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 RabbitMQ, 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

◆ JANUS_RABBITMQ_AUTHOR

#define JANUS_RABBITMQ_AUTHOR   "Meetecho s.r.l."

◆ JANUS_RABBITMQ_DESCRIPTION

#define JANUS_RABBITMQ_DESCRIPTION   "This transport plugin adds RabbitMQ support to the Janus API via rabbitmq-c."

◆ JANUS_RABBITMQ_ERROR_INVALID_ELEMENT

#define JANUS_RABBITMQ_ERROR_INVALID_ELEMENT   413

◆ JANUS_RABBITMQ_ERROR_INVALID_REQUEST

#define JANUS_RABBITMQ_ERROR_INVALID_REQUEST   411

◆ JANUS_RABBITMQ_ERROR_MISSING_ELEMENT

#define JANUS_RABBITMQ_ERROR_MISSING_ELEMENT   412

◆ JANUS_RABBITMQ_ERROR_UNKNOWN_ERROR

#define JANUS_RABBITMQ_ERROR_UNKNOWN_ERROR   499

◆ JANUS_RABBITMQ_EXCHANGE_TYPE

#define JANUS_RABBITMQ_EXCHANGE_TYPE   "fanout"

◆ JANUS_RABBITMQ_NAME

#define JANUS_RABBITMQ_NAME   "JANUS RabbitMQ transport plugin"

◆ JANUS_RABBITMQ_PACKAGE

#define JANUS_RABBITMQ_PACKAGE   "janus.transport.rabbitmq"

◆ JANUS_RABBITMQ_VERSION

#define JANUS_RABBITMQ_VERSION   1

◆ JANUS_RABBITMQ_VERSION_STRING

#define JANUS_RABBITMQ_VERSION_STRING   "0.0.1"

Typedef Documentation

◆ janus_rabbitmq_client

typedef struct janus_rabbitmq_client janus_rabbitmq_client

◆ janus_rabbitmq_response

typedef struct janus_rabbitmq_response janus_rabbitmq_response

Function Documentation

◆ create()

janus_transport * create ( void )

◆ janus_rabbitmq_destroy()

void janus_rabbitmq_destroy ( void )

◆ janus_rabbitmq_get_api_compatibility()

int janus_rabbitmq_get_api_compatibility ( void )

◆ janus_rabbitmq_get_author()

const char * janus_rabbitmq_get_author ( void )

◆ janus_rabbitmq_get_description()

const char * janus_rabbitmq_get_description ( void )

◆ janus_rabbitmq_get_name()

const char * janus_rabbitmq_get_name ( void )

◆ janus_rabbitmq_get_package()

const char * janus_rabbitmq_get_package ( void )

◆ janus_rabbitmq_get_version()

int janus_rabbitmq_get_version ( void )

◆ janus_rabbitmq_get_version_string()

const char * janus_rabbitmq_get_version_string ( void )

◆ janus_rabbitmq_init()

int janus_rabbitmq_init ( janus_transport_callbacks * callback,
const char * config_path )

◆ janus_rabbitmq_is_admin_api_enabled()

gboolean janus_rabbitmq_is_admin_api_enabled ( void )

◆ janus_rabbitmq_is_janus_api_enabled()

gboolean janus_rabbitmq_is_janus_api_enabled ( void )

◆ janus_rabbitmq_query_transport()

json_t * janus_rabbitmq_query_transport ( json_t * request)

◆ janus_rabbitmq_send_message()

int janus_rabbitmq_send_message ( janus_transport_session * transport,
void * request_id,
gboolean admin,
json_t * message )

◆ janus_rabbitmq_session_claimed()

void janus_rabbitmq_session_claimed ( janus_transport_session * transport,
guint64 session_id )

◆ janus_rabbitmq_session_created()

void janus_rabbitmq_session_created ( janus_transport_session * transport,
guint64 session_id )

◆ janus_rabbitmq_session_over()

void janus_rabbitmq_session_over ( janus_transport_session * transport,
guint64 session_id,
gboolean timeout,
gboolean claimed )

◆ janus_rmq_in_thread()

void * janus_rmq_in_thread ( void * data)

◆ janus_rmq_out_thread()

void * janus_rmq_out_thread ( void * data)

Variable Documentation

◆ queue_autodelete

amqp_boolean_t queue_autodelete = 0

◆ queue_autodelete_admin

amqp_boolean_t queue_autodelete_admin = 0

◆ queue_durable

amqp_boolean_t queue_durable = 0

◆ queue_durable_admin

amqp_boolean_t queue_durable_admin = 0

◆ queue_exclusive

amqp_boolean_t queue_exclusive = 0

◆ queue_exclusive_admin

amqp_boolean_t queue_exclusive_admin = 0