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

Janus MQTTEventHandler plugin. More...

#include "eventhandler.h"
#include <MQTTAsync.h>
#include "../debug.h"
#include "../config.h"
#include "../utils.h"
#include "../events.h"
Include dependency graph for janus_mqttevh.c:

Data Structures

struct  janus_mqttevh_context
 

Macros

#define JANUS_MQTTEVH_VERSION   1
 
#define JANUS_MQTTEVH_VERSION_STRING   "0.1.0"
 
#define JANUS_MQTTEVH_DESCRIPTION   "An MQTT event handler plugin for Janus."
 
#define JANUS_MQTTEVH_NAME   "JANUS MQTTEventHandler plugin"
 
#define JANUS_MQTTEVH_AUTHOR   "Olle E. Johansson, Edvina AB"
 
#define JANUS_MQTTEVH_PACKAGE   "janus.eventhandler.mqttevh"
 
#define JANUS_MQTTEVH_DEFAULT_ADDPLUGIN   1
 
#define JANUS_MQTTEVH_DEFAULT_ADDEVENT   1
 
#define JANUS_MQTTEVH_DEFAULT_KEEPALIVE   30
 
#define JANUS_MQTTEVH_DEFAULT_CLEANSESSION   0 /* Off */
 
#define JANUS_MQTTEVH_DEFAULT_MAX_INFLIGHT   10
 
#define JANUS_MQTTEVH_DEFAULT_MAX_BUFFERED   100
 
#define JANUS_MQTTEVH_DEFAULT_TIMEOUT   30
 
#define JANUS_MQTTEVH_DEFAULT_DISCONNECT_TIMEOUT   100
 
#define JANUS_MQTTEVH_DEFAULT_QOS   0
 
#define JANUS_MQTTEVH_DEFAULT_RETAIN   0
 
#define JANUS_MQTTEVH_DEFAULT_CONNECT_STATUS   "{\"event\": \"connected\", \"eventhandler\": \""JANUS_MQTTEVH_PACKAGE"\"}"
 
#define JANUS_MQTTEVH_DEFAULT_DISCONNECT_STATUS   "{\"event\": \"disconnected\"}"
 
#define JANUS_MQTTEVH_DEFAULT_WILL_RETAIN   1
 
#define JANUS_MQTTEVH_DEFAULT_WILL_QOS   0
 
#define JANUS_MQTTEVH_DEFAULT_BASETOPIC   "/janus/events"
 
#define JANUS_MQTTEVH_DEFAULT_MQTTURL   "tcp://localhost:1883"
 
#define JANUS_MQTTEVH_DEFAULT_JSON_FORMAT   JSON_INDENT(3) | JSON_PRESERVE_ORDER
 
#define JANUS_MQTTEVH_DEFAULT_TLS_ENABLE   FALSE
 
#define JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_PEER   FALSE
 
#define JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_HOST   FALSE
 
#define JANUS_MQTTEVH_VERSION_3_1   "3.1"
 
#define JANUS_MQTTEVH_VERSION_3_1_1   "3.1.1"
 
#define JANUS_MQTTEVH_VERSION_5   "5"
 
#define JANUS_MQTTEVH_VERSION_DEFAULT   JANUS_MQTTEVH_VERSION_3_1_1
 
#define JANUS_MQTTEVH_ERROR_INVALID_REQUEST   411
 
#define JANUS_MQTTEVH_ERROR_MISSING_ELEMENT   412
 
#define JANUS_MQTTEVH_ERROR_INVALID_ELEMENT   413
 
#define JANUS_MQTTEVH_ERROR_UNKNOWN_ERROR   499
 
#define JANUS_MQTTEVH_STATUS_TOPIC   "status"
 

Typedefs

typedef struct janus_mqttevh_context janus_mqttevh_context
 

Functions

janus_eventhandlercreate (void)
 
json_tjanus_mqttevh_handle_request (json_t *request)
 
int janus_mqttevh_client_get_response_code (MQTTAsync_failureData *response)
 
int janus_mqttevh_client_publish_message_wrap (void *context, const char *topic, int retain, char *payload)
 

Detailed Description

Janus MQTTEventHandler plugin.

Author
Olle E. Johansson oej@e.nosp@m.dvin.nosp@m.a.net

This is an MQTT event handler plugin for Janus. It is a refactoring of the original effort contributed by Olle E. Johansson (see https://github.com/meetecho/janus-gateway/pull/1185), which was based on the MQTT transport by Andrei Nesterov and the RabbitMQ event plugin by Piter Konstantinov.

Event handlers documentation

Macro Definition Documentation

◆ JANUS_MQTTEVH_AUTHOR

#define JANUS_MQTTEVH_AUTHOR   "Olle E. Johansson, Edvina AB"

◆ JANUS_MQTTEVH_DEFAULT_ADDEVENT

#define JANUS_MQTTEVH_DEFAULT_ADDEVENT   1

◆ JANUS_MQTTEVH_DEFAULT_ADDPLUGIN

#define JANUS_MQTTEVH_DEFAULT_ADDPLUGIN   1

◆ JANUS_MQTTEVH_DEFAULT_BASETOPIC

#define JANUS_MQTTEVH_DEFAULT_BASETOPIC   "/janus/events"

◆ JANUS_MQTTEVH_DEFAULT_CLEANSESSION

#define JANUS_MQTTEVH_DEFAULT_CLEANSESSION   0 /* Off */

◆ JANUS_MQTTEVH_DEFAULT_CONNECT_STATUS

#define JANUS_MQTTEVH_DEFAULT_CONNECT_STATUS   "{\"event\": \"connected\", \"eventhandler\": \""JANUS_MQTTEVH_PACKAGE"\"}"

◆ JANUS_MQTTEVH_DEFAULT_DISCONNECT_STATUS

#define JANUS_MQTTEVH_DEFAULT_DISCONNECT_STATUS   "{\"event\": \"disconnected\"}"

◆ JANUS_MQTTEVH_DEFAULT_DISCONNECT_TIMEOUT

#define JANUS_MQTTEVH_DEFAULT_DISCONNECT_TIMEOUT   100

◆ JANUS_MQTTEVH_DEFAULT_JSON_FORMAT

#define JANUS_MQTTEVH_DEFAULT_JSON_FORMAT   JSON_INDENT(3) | JSON_PRESERVE_ORDER

◆ JANUS_MQTTEVH_DEFAULT_KEEPALIVE

#define JANUS_MQTTEVH_DEFAULT_KEEPALIVE   30

◆ JANUS_MQTTEVH_DEFAULT_MAX_BUFFERED

#define JANUS_MQTTEVH_DEFAULT_MAX_BUFFERED   100

◆ JANUS_MQTTEVH_DEFAULT_MAX_INFLIGHT

#define JANUS_MQTTEVH_DEFAULT_MAX_INFLIGHT   10

◆ JANUS_MQTTEVH_DEFAULT_MQTTURL

#define JANUS_MQTTEVH_DEFAULT_MQTTURL   "tcp://localhost:1883"

◆ JANUS_MQTTEVH_DEFAULT_QOS

#define JANUS_MQTTEVH_DEFAULT_QOS   0

◆ JANUS_MQTTEVH_DEFAULT_RETAIN

#define JANUS_MQTTEVH_DEFAULT_RETAIN   0

◆ JANUS_MQTTEVH_DEFAULT_TIMEOUT

#define JANUS_MQTTEVH_DEFAULT_TIMEOUT   30

◆ JANUS_MQTTEVH_DEFAULT_TLS_ENABLE

#define JANUS_MQTTEVH_DEFAULT_TLS_ENABLE   FALSE

◆ JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_HOST

#define JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_HOST   FALSE

◆ JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_PEER

#define JANUS_MQTTEVH_DEFAULT_TLS_VERIFY_PEER   FALSE

◆ JANUS_MQTTEVH_DEFAULT_WILL_QOS

#define JANUS_MQTTEVH_DEFAULT_WILL_QOS   0

◆ JANUS_MQTTEVH_DEFAULT_WILL_RETAIN

#define JANUS_MQTTEVH_DEFAULT_WILL_RETAIN   1

◆ JANUS_MQTTEVH_DESCRIPTION

#define JANUS_MQTTEVH_DESCRIPTION   "An MQTT event handler plugin for Janus."

◆ JANUS_MQTTEVH_ERROR_INVALID_ELEMENT

#define JANUS_MQTTEVH_ERROR_INVALID_ELEMENT   413

◆ JANUS_MQTTEVH_ERROR_INVALID_REQUEST

#define JANUS_MQTTEVH_ERROR_INVALID_REQUEST   411

◆ JANUS_MQTTEVH_ERROR_MISSING_ELEMENT

#define JANUS_MQTTEVH_ERROR_MISSING_ELEMENT   412

◆ JANUS_MQTTEVH_ERROR_UNKNOWN_ERROR

#define JANUS_MQTTEVH_ERROR_UNKNOWN_ERROR   499

◆ JANUS_MQTTEVH_NAME

#define JANUS_MQTTEVH_NAME   "JANUS MQTTEventHandler plugin"

◆ JANUS_MQTTEVH_PACKAGE

#define JANUS_MQTTEVH_PACKAGE   "janus.eventhandler.mqttevh"

◆ JANUS_MQTTEVH_STATUS_TOPIC

#define JANUS_MQTTEVH_STATUS_TOPIC   "status"

◆ JANUS_MQTTEVH_VERSION

#define JANUS_MQTTEVH_VERSION   1

◆ JANUS_MQTTEVH_VERSION_3_1

#define JANUS_MQTTEVH_VERSION_3_1   "3.1"

◆ JANUS_MQTTEVH_VERSION_3_1_1

#define JANUS_MQTTEVH_VERSION_3_1_1   "3.1.1"

◆ JANUS_MQTTEVH_VERSION_5

#define JANUS_MQTTEVH_VERSION_5   "5"

◆ JANUS_MQTTEVH_VERSION_DEFAULT

#define JANUS_MQTTEVH_VERSION_DEFAULT   JANUS_MQTTEVH_VERSION_3_1_1

◆ JANUS_MQTTEVH_VERSION_STRING

#define JANUS_MQTTEVH_VERSION_STRING   "0.1.0"

Typedef Documentation

◆ janus_mqttevh_context

Function Documentation

◆ create()

janus_eventhandler * create ( void  )

◆ janus_mqttevh_client_get_response_code()

int janus_mqttevh_client_get_response_code ( MQTTAsync_failureData *  response)

◆ janus_mqttevh_client_publish_message_wrap()

int janus_mqttevh_client_publish_message_wrap ( void *  context,
const char *  topic,
int  retain,
char *  payload 
)

◆ janus_mqttevh_handle_request()

json_t * janus_mqttevh_handle_request ( json_t request)