2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2014, Digium, Inc.
6 * Alexandr Dubovikov <alexandr.dubovikov@sipcapture.org>
7 * Matt Jordan <mjordan@digium.com>
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.
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.
22 * \brief Routines for integration with Homer using HEPv3
24 * \author Alexandr Dubovikov <alexandr.dubovikov@sipcapture.org>
25 * \author Matt Jordan <mjordan@digium.com>
29 #ifndef _ASTERISK_RES_HEPV3_H
30 #define _ASTERISK_RES_HEPV3_H
32 #if defined(__cplusplus) || defined(c_plusplus)
36 #include "asterisk/netsock2.h"
38 /*! \brief HEPv3 Packet Capture Types */
39 enum hepv3_capture_type {
40 HEPV3_CAPTURE_TYPE_SIP = 0x01,
41 HEPV3_CAPTURE_TYPE_H323 = 0x02,
42 HEPV3_CAPTURE_TYPE_SDP = 0x03,
43 HEPV3_CAPTURE_TYPE_RTP = 0x04,
44 HEPV3_CAPTURE_TYPE_RTCP = 0x05,
45 HEPV3_CAPTURE_TYPE_MGCP = 0x06,
46 HEPV3_CAPTURE_TYPE_MEGACO = 0x07,
47 HEPV3_CAPTURE_TYPE_M2UA = 0x08,
48 HEPV3_CAPTURE_TYPE_M3UA = 0x09,
49 HEPV3_CAPTURE_TYPE_IAX = 0x10,
52 /*! \brief HEPv3 Capture Info */
53 struct hepv3_capture_info {
54 /*! The source address of the packet */
55 struct ast_sockaddr src_addr;
56 /*! The destination address of the packet */
57 struct ast_sockaddr dst_addr;
58 /*! The time the packet was captured */
59 struct timeval capture_time;
60 /*! The actual payload */
62 /*! Some UUID for the packet */
64 /*! The \ref hepv3_capture_type packet type captured */
65 enum hepv3_capture_type capture_type;
66 /*! The size of the payload */
68 /*! If non-zero, the payload accompanying this capture info will be compressed */
69 unsigned int zipped:1;
73 * \brief Create a \ref hepv3_capture_info object
75 * This returned object is an ao2 reference counted object.
77 * Any attribute in the returned \ref hepv3_capture_info that is a
78 * pointer should point to something that is allocated on the heap,
79 * as it will be free'd when the \ref hepv3_capture_info object is
82 * \param payload The payload to send to the HEP capture node
83 * \param len Length of \ref payload
85 * \retval A \ref hepv3_capture_info ref counted object on success
86 * \retval NULL on error
88 struct hepv3_capture_info *hepv3_create_capture_info(const void *payload, size_t len);
91 * \brief Send a generic packet capture to HEPv3
93 * \param capture_info Information describing the packet. This
94 * should be a reference counted object, created via
95 * \ref hepv3_create_capture_info.
97 * Once this function is called, it assumes ownership of the
98 * \ref capture_info object and steals the reference of the
99 * object. Regardless of success or failure, the calling function
100 * should assumed that this function will own the object.
102 * \retval 0 on success
103 * \retval -1 on error
105 int hepv3_send_packet(struct hepv3_capture_info *capture_info);
107 #if defined(__cplusplus) || defined(c_plusplus)
111 #endif /* _ASTERISK_RES_HEPV3_H */