Loading...
Searching...
No Matches
janus_http.c File Reference
Transports

Janus RESTs transport plugin. More...

`#include "transport.h"`
`#include <arpa/inet.h>`
`#include <ifaddrs.h>`
`#include <net/if.h>`
`#include <sys/socket.h>`
`#include <sys/types.h>`
`#include <netdb.h>`
`#include <microhttpd.h>`
`#include "../debug.h"`
`#include "../apierror.h"`
`#include "../config.h"`
`#include "../mutex.h"`
`#include "../ip-utils.h"`
`#include "../utils.h"`
Include dependency graph for janus_http.c:

## Data Structures

struct | janus_http_msg
struct | janus_http_session
struct | janus_http_request_timeout

## Macros

#define | JANUS_HTTP_VERSION 2
#define | JANUS_HTTP_VERSION_STRING "0.0.2"
#define | JANUS_HTTP_DESCRIPTION "This transport plugin adds REST (HTTP/HTTPS) support to the Janus API via libmicrohttpd."
#define | JANUS_HTTP_NAME "JANUS REST (HTTP/HTTPS) transport plugin"
#define | JANUS_HTTP_AUTHOR "Meetecho s.r.l."
#define | JANUS_HTTP_PACKAGE "janus.transport.http"
#define | DEFAULT_CONNECTION_LIMIT (FD_SETSIZE-4)
#define | JANUS_HTTP_ERROR_INVALID_REQUEST 411
#define | JANUS_HTTP_ERROR_MISSING_ELEMENT 412
#define | JANUS_HTTP_ERROR_INVALID_ELEMENT 413
#define | JANUS_HTTP_ERROR_UNKNOWN_ERROR 499

## Typedefs

typedef int | MHD_Result
typedef struct janus_http_msg | janus_http_msg
typedef struct janus_http_session | janus_http_session
typedef struct janus_http_request_timeout | janus_http_request_timeout

## Functions

janus_transport * | create (void)
int | janus_http_init (janus_transport_callbacks *callback, const char *config_path)
void | janus_http_destroy (void)
int | janus_http_get_api_compatibility (void)
int | janus_http_get_version (void)
const char * | janus_http_get_version_string (void)
const char * | janus_http_get_description (void)
const char * | janus_http_get_name (void)
const char * | janus_http_get_author (void)
const char * | janus_http_get_package (void)
gboolean | janus_http_is_janus_api_enabled (void)
gboolean | janus_http_is_admin_api_enabled (void)
int | janus_http_send_message (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
void | janus_http_session_created (janus_transport_session *transport, guint64 session_id)
void | janus_http_session_over (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
void | janus_http_session_claimed (janus_transport_session *transport, guint64 session_id)
json_t * | janus_http_query_transport (json_t *request)

## Detailed Description

Janus RESTs transport plugin.

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

Copyright
  GNU General Public License v3

This is an implementation of a RESTs transport for the Janus API, using the libmicrohttpd library (http://www.gnu.org/software/libmicrohttpd/). This module allows browsers to make use of HTTP to talk to the Janus core. Since a Janus instance may be deployed on a different domain than the web server hosting the web applications using it, the plugin automatically handles OPTIONS request to comply with the CORS specification. POST requests can be used to ask for the management of a session with the server, to attach to a plugin, to send messages to the plugin itself and so on. GET requests instead are used for getting events associated to a Janus session (and as such to all its plugin handles and the events plugins push in the session itself), using a long poll approach. A JavaScript library (janus.js) implements all of this on the client side automatically.

Note
  There's a well known bug in libmicrohttpd that may cause it to spike to 100% of the CPU when using HTTPS on some distributions. In case you're interested in HTTPS support, it's better to just rely on HTTP in Janus, and put a frontend like Apache HTTPD or nginx to take care of securing the traffic. More details are available in Deploying Janus.

transports

## Macro Definition Documentation

## DEFAULT_CONNECTION_LIMIT

#define DEFAULT_CONNECTION_LIMIT (FD_SETSIZE-4)

## JANUS_HTTP_AUTHOR

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

## JANUS_HTTP_DESCRIPTION

#define JANUS_HTTP_DESCRIPTION "This transport plugin adds REST (HTTP/HTTPS) support to the Janus API via libmicrohttpd."

## JANUS_HTTP_ERROR_INVALID_ELEMENT

#define JANUS_HTTP_ERROR_INVALID_ELEMENT 413

## JANUS_HTTP_ERROR_INVALID_REQUEST

#define JANUS_HTTP_ERROR_INVALID_REQUEST 411

## JANUS_HTTP_ERROR_MISSING_ELEMENT

#define JANUS_HTTP_ERROR_MISSING_ELEMENT 412

## JANUS_HTTP_ERROR_UNKNOWN_ERROR

#define JANUS_HTTP_ERROR_UNKNOWN_ERROR 499

## JANUS_HTTP_NAME

#define JANUS_HTTP_NAME "JANUS REST (HTTP/HTTPS) transport plugin"

## JANUS_HTTP_PACKAGE

#define JANUS_HTTP_PACKAGE "janus.transport.http"

## JANUS_HTTP_VERSION

#define JANUS_HTTP_VERSION 2

## JANUS_HTTP_VERSION_STRING

#define JANUS_HTTP_VERSION_STRING "0.0.2"

## Typedef Documentation

## janus_http_msg

typedef struct janus_http_msg janus_http_msg

## janus_http_request_timeout

typedef struct janus_http_request_timeout janus_http_request_timeout

## janus_http_session

typedef struct janus_http_session janus_http_session

## MHD_Result

typedef int MHD_Result

## Function Documentation

## create()

janus_transport * create | ( | void |  | ) |

## janus_http_destroy()

void janus_http_destroy | ( | void |  | ) |

## janus_http_get_api_compatibility()

int janus_http_get_api_compatibility | ( | void |  | ) |

## janus_http_get_author()

const char * janus_http_get_author | ( | void |  | ) |

## janus_http_get_description()

const char * janus_http_get_description | ( | void |  | ) |

## janus_http_get_name()

const char * janus_http_get_name | ( | void |  | ) |

## janus_http_get_package()

const char * janus_http_get_package | ( | void |  | ) |

## janus_http_get_version()

int janus_http_get_version | ( | void |  | ) |

## janus_http_get_version_string()

const char * janus_http_get_version_string | ( | void |  | ) |

## janus_http_init()

int janus_http_init | ( | janus_transport_callbacks * | callback,
|  | const char * | config_path )

## janus_http_is_admin_api_enabled()

gboolean janus_http_is_admin_api_enabled | ( | void |  | ) |

## janus_http_is_janus_api_enabled()

gboolean janus_http_is_janus_api_enabled | ( | void |  | ) |

## janus_http_query_transport()

json_t * janus_http_query_transport | ( | json_t * | request | ) |

## janus_http_send_message()

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

## janus_http_session_claimed()

void janus_http_session_claimed | ( | janus_transport_session * | transport,
|  | guint64 | session_id )

## janus_http_session_created()

void janus_http_session_created | ( | janus_transport_session * | transport,
|  | guint64 | session_id )

## janus_http_session_over()

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