Asterisk - The Open Source Telephony Project GIT-master-7e7a603
res_hep.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2014, Digium, Inc.
5 *
6 * Alexandr Dubovikov <alexandr.dubovikov@sipcapture.org>
7 * Matt Jordan <mjordan@digium.com>
8 *
9 * See http://www.asterisk.org for more information about
10 * the Asterisk project. Please do not directly contact
11 * any of the maintainers of this project for assistance;
12 * the project provides a web site, mailing lists and IRC
13 * channels for your use.
14 *
15 * This program is free software, distributed under the terms of
16 * the GNU General Public License Version 2. See the LICENSE file
17 * at the top of the source tree.
18 */
19
20/*!
21 * \file
22 * \brief Routines for integration with Homer using HEPv3
23 *
24 * \author Alexandr Dubovikov <alexandr.dubovikov@sipcapture.org>
25 * \author Matt Jordan <mjordan@digium.com>
26 *
27 */
28
29#ifndef _ASTERISK_RES_HEPV3_H
30#define _ASTERISK_RES_HEPV3_H
31
32#if defined(__cplusplus) || defined(c_plusplus)
33extern "C" {
34#endif
35
36#include "asterisk/netsock2.h"
37
38/*! \brief HEPv3 Packet Capture Types */
49};
50
54};
55
56/*! \brief HEPv3 Capture Info */
58 /*! The source address of the packet */
60 /*! The destination address of the packet */
62 /*! The time the packet was captured */
63 struct timeval capture_time;
64 /*! The actual payload */
65 void *payload;
66 /*! Some UUID for the packet */
67 char *uuid;
68 /*! The \ref hepv3_capture_type packet type captured */
70 /*! The size of the payload */
71 size_t len;
72 /*! If non-zero, the payload accompanying this capture info will be compressed */
73 unsigned int zipped:1;
74 /*! The IPPROTO_* protocol where we captured the packet */
76};
77
78/*!
79 * \brief Create a \ref hepv3_capture_info object
80 *
81 * This returned object is an ao2 reference counted object.
82 *
83 * Any attribute in the returned \ref hepv3_capture_info that is a
84 * pointer should point to something that is allocated on the heap,
85 * as it will be free'd when the \ref hepv3_capture_info object is
86 * reclaimed.
87 *
88 * \param payload The payload to send to the HEP capture node
89 * \param len Length of \p payload
90 *
91 * \return A \ref hepv3_capture_info ref counted object on success
92 * \retval NULL on error
93 */
94struct hepv3_capture_info *hepv3_create_capture_info(const void *payload, size_t len);
95
96/*!
97 * \brief Send a generic packet capture to HEPv3
98 *
99 * \param capture_info Information describing the packet. This
100 * should be a reference counted object, created via
101 * \ref hepv3_create_capture_info.
102 *
103 * Once this function is called, it assumes ownership of the
104 * \p capture_info object and steals the reference of the
105 * object. Regardless of success or failure, the calling function
106 * should assumed that this function will own the object.
107 *
108 * \retval 0 on success
109 * \retval -1 on error
110 */
111int hepv3_send_packet(struct hepv3_capture_info *capture_info);
112
113/*!
114 * \brief Get the preferred UUID type
115 *
116 * \since 13.10.0
117 *
118 * \return The type of UUID the packet should use
119 */
121
122/*!
123 * \brief Return whether or not we're currently loaded and active
124 *
125 * \retval 0 The module is not loaded
126 * \retval 1 The module is loaded
127 */
128int hepv3_is_loaded(void);
129
130#if defined(__cplusplus) || defined(c_plusplus)
131}
132#endif
133
134#endif /* _ASTERISK_RES_HEPV3_H */
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Network socket handling.
enum hep_uuid_type hepv3_get_uuid_type(void)
Get the preferred UUID type.
Definition: res_hep.c:416
int hepv3_is_loaded(void)
Return whether or not we're currently loaded and active.
Definition: res_hep.c:428
hep_uuid_type
Definition: res_hep.h:51
@ HEP_UUID_TYPE_CHANNEL
Definition: res_hep.h:53
@ HEP_UUID_TYPE_CALL_ID
Definition: res_hep.h:52
struct hepv3_capture_info * hepv3_create_capture_info(const void *payload, size_t len)
Create a hepv3_capture_info object.
Definition: res_hep.c:435
hepv3_capture_type
HEPv3 Packet Capture Types.
Definition: res_hep.h:39
@ 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
int hepv3_send_packet(struct hepv3_capture_info *capture_info)
Send a generic packet capture to HEPv3.
Definition: res_hep.c:600
Socket address structure.
Definition: netsock2.h:97
HEPv3 Capture Info.
Definition: res_hep.h:57
void * payload
Definition: res_hep.h:65
struct timeval capture_time
Definition: res_hep.h:63
struct ast_sockaddr src_addr
Definition: res_hep.h:59
enum hepv3_capture_type capture_type
Definition: res_hep.h:69
struct ast_sockaddr dst_addr
Definition: res_hep.h:61
unsigned int zipped
Definition: res_hep.h:73