Asterisk - The Open Source Telephony Project GIT-master-a358458
Data Structures | Enumerations | Functions
res_hep.h File Reference

Routines for integration with Homer using HEPv3. More...

#include "asterisk/netsock2.h"
Include dependency graph for res_hep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hepv3_capture_info
 HEPv3 Capture Info. More...
 

Enumerations

enum  hep_uuid_type { HEP_UUID_TYPE_CALL_ID = 0 , HEP_UUID_TYPE_CHANNEL }
 
enum  hepv3_capture_type {
  HEPV3_CAPTURE_TYPE_SIP = 0x01 , HEPV3_CAPTURE_TYPE_H323 = 0x02 , HEPV3_CAPTURE_TYPE_SDP = 0x03 , HEPV3_CAPTURE_TYPE_RTP = 0x04 ,
  HEPV3_CAPTURE_TYPE_RTCP = 0x05 , HEPV3_CAPTURE_TYPE_MEGACO = 0x07 , HEPV3_CAPTURE_TYPE_M2UA = 0x08 , HEPV3_CAPTURE_TYPE_M3UA = 0x09 ,
  HEPV3_CAPTURE_TYPE_IAX = 0x10
}
 HEPv3 Packet Capture Types. More...
 

Functions

struct hepv3_capture_infohepv3_create_capture_info (const void *payload, size_t len)
 Create a hepv3_capture_info object. More...
 
enum hep_uuid_type hepv3_get_uuid_type (void)
 Get the preferred UUID type. More...
 
int hepv3_is_loaded (void)
 Return whether or not we're currently loaded and active. More...
 
int hepv3_send_packet (struct hepv3_capture_info *capture_info)
 Send a generic packet capture to HEPv3. More...
 

Detailed Description

Routines for integration with Homer using HEPv3.

Author
Alexandr Dubovikov alexa.nosp@m.ndr..nosp@m.dubov.nosp@m.ikov.nosp@m.@sipc.nosp@m.aptu.nosp@m.re.or.nosp@m.g
Matt Jordan mjord.nosp@m.an@d.nosp@m.igium.nosp@m..com

Definition in file res_hep.h.

Enumeration Type Documentation

◆ hep_uuid_type

Enumerator
HEP_UUID_TYPE_CALL_ID 
HEP_UUID_TYPE_CHANNEL 

Definition at line 51 of file res_hep.h.

51 {
54};
@ HEP_UUID_TYPE_CHANNEL
Definition: res_hep.h:53
@ HEP_UUID_TYPE_CALL_ID
Definition: res_hep.h:52

◆ hepv3_capture_type

HEPv3 Packet Capture Types.

Enumerator
HEPV3_CAPTURE_TYPE_SIP 
HEPV3_CAPTURE_TYPE_H323 
HEPV3_CAPTURE_TYPE_SDP 
HEPV3_CAPTURE_TYPE_RTP 
HEPV3_CAPTURE_TYPE_RTCP 
HEPV3_CAPTURE_TYPE_MEGACO 
HEPV3_CAPTURE_TYPE_M2UA 
HEPV3_CAPTURE_TYPE_M3UA 
HEPV3_CAPTURE_TYPE_IAX 

Definition at line 39 of file res_hep.h.

39 {
49};
@ HEPV3_CAPTURE_TYPE_H323
Definition: res_hep.h:41
@ HEPV3_CAPTURE_TYPE_SIP
Definition: res_hep.h:40
@ HEPV3_CAPTURE_TYPE_RTP
Definition: res_hep.h:43
@ HEPV3_CAPTURE_TYPE_IAX
Definition: res_hep.h:48
@ HEPV3_CAPTURE_TYPE_SDP
Definition: res_hep.h:42
@ HEPV3_CAPTURE_TYPE_RTCP
Definition: res_hep.h:44
@ HEPV3_CAPTURE_TYPE_MEGACO
Definition: res_hep.h:45
@ HEPV3_CAPTURE_TYPE_M2UA
Definition: res_hep.h:46
@ HEPV3_CAPTURE_TYPE_M3UA
Definition: res_hep.h:47

Function Documentation

◆ hepv3_create_capture_info()

struct hepv3_capture_info * hepv3_create_capture_info ( const void *  payload,
size_t  len 
)

Create a hepv3_capture_info object.

This returned object is an ao2 reference counted object.

Any attribute in the returned hepv3_capture_info that is a pointer should point to something that is allocated on the heap, as it will be free'd when the hepv3_capture_info object is reclaimed.

Parameters
payloadThe payload to send to the HEP capture node
lenLength of payload
Returns
A hepv3_capture_info ref counted object on success
Return values
NULLon error

Definition at line 435 of file res_hep.c.

436{
437 struct hepv3_capture_info *info;
438
440 if (!info) {
441 return NULL;
442 }
443
444 info->payload = ast_malloc(len);
445 if (!info->payload) {
446 ao2_ref(info, -1);
447 return NULL;
448 }
449 memcpy(info->payload, payload, len);
450 info->len = len;
451
452 /* Set a reasonable default */
453 info->protocol_id = IPPROTO_UDP;
454
455 return info;
456}
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:191
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:409
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
def info(msg)
static void capture_info_dtor(void *obj)
Destructor for a hepv3_capture_info object.
Definition: res_hep.c:408
#define NULL
Definition: resample.c:96
HEPv3 Capture Info.
Definition: res_hep.h:57
void * payload
Definition: res_hep.h:65

References ao2_alloc, ao2_ref, ast_malloc, capture_info_dtor(), sip_to_pjsip::info(), len(), NULL, and hepv3_capture_info::payload.

Referenced by logging_on_rx_msg(), logging_on_tx_msg(), and rtcp_message_handler().

◆ hepv3_get_uuid_type()

enum hep_uuid_type hepv3_get_uuid_type ( void  )

Get the preferred UUID type.

Since
13.10.0
Returns
The type of UUID the packet should use

Definition at line 416 of file res_hep.c.

417{
419
420 if (!config) {
421 /* Well, that's unfortunate. Return something. */
423 }
424
425 return config->general->uuid_type;
426}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
static const char config[]
Definition: chan_ooh323.c:111
The configuration settings for this module.
Definition: cdr.c:264
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References ao2_cleanup, ao2_global_obj_ref, config, HEP_UUID_TYPE_CALL_ID, and RAII_VAR.

Referenced by assign_uuid().

◆ hepv3_is_loaded()

int hepv3_is_loaded ( void  )

Return whether or not we're currently loaded and active.

Return values
0The module is not loaded
1The module is loaded

Definition at line 428 of file res_hep.c.

429{
431
432 return config && config->general->enabled;
433}

References ao2_cleanup, ao2_global_obj_ref, config, and RAII_VAR.

Referenced by load_module().

◆ hepv3_send_packet()

int hepv3_send_packet ( struct hepv3_capture_info capture_info)

Send a generic packet capture to HEPv3.

Parameters
capture_infoInformation describing the packet. This should be a reference counted object, created via hepv3_create_capture_info.

Once this function is called, it assumes ownership of the capture_info object and steals the reference of the object. Regardless of success or failure, the calling function should assumed that this function will own the object.

Return values
0on success
-1on error

Definition at line 600 of file res_hep.c.

601{
603 int res;
604
605 if (!config || !config->general->enabled) {
606 ao2_ref(capture_info, -1);
607 return 0;
608 }
609
611 if (res == -1) {
612 ao2_ref(capture_info, -1);
613 }
614
615 return res;
616}
static int hep_queue_cb(void *data)
Callback function for the hep_queue_tp taskprocessor.
Definition: res_hep.c:459
static struct ast_taskprocessor * hep_queue_tp
Definition: res_hep.c:285
int ast_taskprocessor_push(struct ast_taskprocessor *tps, int(*task_exe)(void *datap), void *datap) attribute_warn_unused_result
Push a task into the specified taskprocessor queue and signal the taskprocessor thread.

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_taskprocessor_push(), config, hep_queue_cb(), hep_queue_tp, and RAII_VAR.

Referenced by logging_on_rx_msg(), logging_on_tx_msg(), and rtcp_message_handler().