Fork me on GitHub
Macros | Typedefs | Enumerations | Functions
janus_gelfevh.c File Reference

Janus GelfEventHandler plugin. More...

#include "eventhandler.h"
#include <math.h>
#include "../debug.h"
#include "../config.h"
#include "../mutex.h"
#include "../utils.h"
#include "../events.h"
#include <netdb.h>
#include <errno.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "../ip-utils.h"
Include dependency graph for janus_gelfevh.c:

Macros

#define JANUS_GELFEVH_VERSION   1
 
#define JANUS_GELFEVH_VERSION_STRING   "0.0.1"
 
#define JANUS_GELFEVH_DESCRIPTION   "This is event handler plugin for Janus, which forwards events via TCP/UDP to GELF server."
 
#define JANUS_GELFEVH_NAME   "JANUS GelfEventHandler plugin"
 
#define JANUS_GELFEVH_AUTHOR   "Mirko Brankovic <mirkobrankovic@gmail.com>"
 
#define JANUS_GELFEVH_PACKAGE   "janus.eventhandler.gelfevh"
 
#define MAX_GELF_CHUNKS   128
 
#define JANUS_GELFEVH_ERROR_INVALID_REQUEST   411
 
#define JANUS_GELFEVH_ERROR_MISSING_ELEMENT   412
 
#define JANUS_GELFEVH_ERROR_INVALID_ELEMENT   413
 
#define JANUS_GELFEVH_ERROR_UNKNOWN_ERROR   499
 

Typedefs

typedef enum janus_gelfevh_socket_type janus_gelfevh_socket_type
 

Enumerations

enum  janus_gelfevh_socket_type { JANUS_GELFEVH_SOCKET_TYPE_TCP = 1 , JANUS_GELFEVH_SOCKET_TYPE_UDP = 2 }
 

Functions

janus_eventhandlercreate (void)
 
int janus_gelfevh_init (const char *config_path)
 
void janus_gelfevh_destroy (void)
 
int janus_gelfevh_get_api_compatibility (void)
 
int janus_gelfevh_get_version (void)
 
const char * janus_gelfevh_get_version_string (void)
 
const char * janus_gelfevh_get_description (void)
 
const char * janus_gelfevh_get_name (void)
 
const char * janus_gelfevh_get_author (void)
 
const char * janus_gelfevh_get_package (void)
 
void janus_gelfevh_incoming_event (json_t *event)
 
json_tjanus_gelfevh_handle_request (json_t *request)
 

Detailed Description

Janus GelfEventHandler plugin.

Author
Mirko Brankovic mirko.nosp@m.bran.nosp@m.kovic.nosp@m.@gma.nosp@m.il.co.nosp@m.m

This is a GELF event handler plugin for Janus, which is supposed to send json events to GELF (Graylog logger https://docs.graylog.org/en/3.2/pages/gelf.html). Necessary headers are prepended. For sending, you can use TCP which is not recommended in case there will be a lot of messages. There is also UDP support, but you need to limit the payload size with max_message_len and remember to leave room for 12 bytes for special headers. UDP messages will be chunked automatically. There is also compression available for UDP protocol, to save network bandwidth while using a bit more CPU. This is not available for TCP due to GELF limitations

Event handlers documentation

Macro Definition Documentation

◆ JANUS_GELFEVH_AUTHOR

#define JANUS_GELFEVH_AUTHOR   "Mirko Brankovic <mirkobrankovic@gmail.com>"

◆ JANUS_GELFEVH_DESCRIPTION

#define JANUS_GELFEVH_DESCRIPTION   "This is event handler plugin for Janus, which forwards events via TCP/UDP to GELF server."

◆ JANUS_GELFEVH_ERROR_INVALID_ELEMENT

#define JANUS_GELFEVH_ERROR_INVALID_ELEMENT   413

◆ JANUS_GELFEVH_ERROR_INVALID_REQUEST

#define JANUS_GELFEVH_ERROR_INVALID_REQUEST   411

◆ JANUS_GELFEVH_ERROR_MISSING_ELEMENT

#define JANUS_GELFEVH_ERROR_MISSING_ELEMENT   412

◆ JANUS_GELFEVH_ERROR_UNKNOWN_ERROR

#define JANUS_GELFEVH_ERROR_UNKNOWN_ERROR   499

◆ JANUS_GELFEVH_NAME

#define JANUS_GELFEVH_NAME   "JANUS GelfEventHandler plugin"

◆ JANUS_GELFEVH_PACKAGE

#define JANUS_GELFEVH_PACKAGE   "janus.eventhandler.gelfevh"

◆ JANUS_GELFEVH_VERSION

#define JANUS_GELFEVH_VERSION   1

◆ JANUS_GELFEVH_VERSION_STRING

#define JANUS_GELFEVH_VERSION_STRING   "0.0.1"

◆ MAX_GELF_CHUNKS

#define MAX_GELF_CHUNKS   128

Typedef Documentation

◆ janus_gelfevh_socket_type

Enumeration Type Documentation

◆ janus_gelfevh_socket_type

Enumerator
JANUS_GELFEVH_SOCKET_TYPE_TCP 
JANUS_GELFEVH_SOCKET_TYPE_UDP 

Function Documentation

◆ create()

janus_eventhandler* create ( void  )

◆ janus_gelfevh_destroy()

void janus_gelfevh_destroy ( void  )

◆ janus_gelfevh_get_api_compatibility()

int janus_gelfevh_get_api_compatibility ( void  )

◆ janus_gelfevh_get_author()

const char * janus_gelfevh_get_author ( void  )

◆ janus_gelfevh_get_description()

const char * janus_gelfevh_get_description ( void  )

◆ janus_gelfevh_get_name()

const char * janus_gelfevh_get_name ( void  )

◆ janus_gelfevh_get_package()

const char * janus_gelfevh_get_package ( void  )

◆ janus_gelfevh_get_version()

int janus_gelfevh_get_version ( void  )

◆ janus_gelfevh_get_version_string()

const char * janus_gelfevh_get_version_string ( void  )

◆ janus_gelfevh_handle_request()

json_t * janus_gelfevh_handle_request ( json_t request)

◆ janus_gelfevh_incoming_event()

void janus_gelfevh_incoming_event ( json_t event)

◆ janus_gelfevh_init()

int janus_gelfevh_init ( const char *  config_path)