Loading...
Searching...
No Matches
events.c File Reference
Core

Event handler notifications. More...

`#include <stdarg.h>`
`#include "events.h"`
`#include "utils.h"`
Include dependency graph for events.c:

## Data Structures

struct | janus_event_types

## Functions

void * | janus_events_thread (void *data)
int | janus_events_init (gboolean enabled, char *server_name, GHashTable *handlers)
| Initialize the event handlers broadcaster.
void | janus_events_deinit (void)
| De-initialize the event handlers broadcaster.
gboolean | janus_events_is_enabled (void)
| Quick method to check whether event handlers are enabled at all or not.
void | janus_events_notify_handlers (int type, int subtype, guint64 session_id,...)
| Notify an event to all interested handlers.
void | janus_events_edit_events_mask (const char *list, janus_flags *target)
| Helper method to change the mask of events a handler is interested in.
const char * | janus_events_type_to_label (int type)
| Helper method to stringify an event type to its label.
const char * | janus_events_type_to_name (int type)
| Helper method to stringify an event type to its prettified name.

## Detailed Description

Event handler notifications.

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

Copyright
  GNU General Public License v3

Event handler plugins can receive events from the Janus core and other plugins, in order to handle them somehow. This methods provide helpers to notify events to such handlers.

Core

## Function Documentation

## janus_events_deinit()

void janus_events_deinit | ( | void |  | ) |

De-initialize the event handlers broadcaster.

## janus_events_edit_events_mask()

void janus_events_edit_events_mask | ( | const char * | list,
|  | janus_flags * | target )

Helper method to change the mask of events a handler is interested in.

Note
  Every time this is called, the mask is resetted, which means that to unsubscribe from a single event you have to pass an updated list

Parameters

  [in] | list | A comma separated string of event types to subscribe to
  [out] | target | The mask to update

## janus_events_init()

int janus_events_init | ( | gboolean | enabled,
|  | char * | server_name,
|  | GHashTable * | handlers )

Initialize the event handlers broadcaster.

Parameters

  [in] | enabled | Whether broadcasting events should be supported at all
  [in] | server_name | The name of this server, to be added to all events
  [in] | handlers | Map of all registered event handlers

Returns
  0 on success, a negative integer otherwise

## janus_events_is_enabled()

gboolean janus_events_is_enabled | ( | void |  | ) |

Quick method to check whether event handlers are enabled at all or not.

Returns
  TRUE if they're enabled, FALSE if not

## janus_events_notify_handlers()

void janus_events_notify_handlers | ( | int | type,
|  | int | subtype,
|  | guint64 | session_id,
|  |  | ... )

Notify an event to all interested handlers.

Note
  According to the type of event to notify, different arguments may be required and used in order to prepare the actual object to pass to handlers.

Parameters

  [in] | type | Type of the event to notify
  [in] | subtype | Subtype of the event to notify, where applicable (0 if not)
  [in] | session_id | Janus session identifier this event refers to

## janus_events_thread()

void * janus_events_thread | ( | void * | data | ) |

## janus_events_type_to_label()

const char * janus_events_type_to_label | ( | int | type | ) |

Helper method to stringify an event type to its label.

Parameters

  [in] | type | The event type

Returns
  The event type label, if found, or NULL otherwise

## janus_events_type_to_name()

const char * janus_events_type_to_name | ( | int | type | ) |

Helper method to stringify an event type to its prettified name.

Parameters

  [in] | type | The event type

Returns
  The prettified name of the event type, if found, or NULL otherwise