Asterisk - The Open Source Telephony Project  18.5.0
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 <[email protected]>
7  * Matt Jordan <[email protected]>
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 <[email protected]>
25  * \author Matt Jordan <[email protected]>
26  *
27  */
28 
29 #ifndef _ASTERISK_RES_HEPV3_H
30 #define _ASTERISK_RES_HEPV3_H
31 
32 #if defined(__cplusplus) || defined(c_plusplus)
33 extern "C" {
34 #endif
35 
36 #include "asterisk/netsock2.h"
37 
38 /*! \brief HEPv3 Packet Capture Types */
50 };
51 
55 };
56 
57 /*! \brief HEPv3 Capture Info */
59  /*! The source address of the packet */
61  /*! The destination address of the packet */
63  /*! The time the packet was captured */
64  struct timeval capture_time;
65  /*! The actual payload */
66  void *payload;
67  /*! Some UUID for the packet */
68  char *uuid;
69  /*! The \ref hepv3_capture_type packet type captured */
71  /*! The size of the payload */
72  size_t len;
73  /*! If non-zero, the payload accompanying this capture info will be compressed */
74  unsigned int zipped:1;
75  /*! The IPPROTO_* protocol where we captured the packet */
77 };
78 
79 /*!
80  * \brief Create a \ref hepv3_capture_info object
81  *
82  * This returned object is an ao2 reference counted object.
83  *
84  * Any attribute in the returned \ref hepv3_capture_info that is a
85  * pointer should point to something that is allocated on the heap,
86  * as it will be free'd when the \ref hepv3_capture_info object is
87  * reclaimed.
88  *
89  * \param payload The payload to send to the HEP capture node
90  * \param len Length of \ref payload
91  *
92  * \retval A \ref hepv3_capture_info ref counted object on success
93  * \retval NULL on error
94  */
95 struct hepv3_capture_info *hepv3_create_capture_info(const void *payload, size_t len);
96 
97 /*!
98  * \brief Send a generic packet capture to HEPv3
99  *
100  * \param capture_info Information describing the packet. This
101  * should be a reference counted object, created via
102  * \ref hepv3_create_capture_info.
103  *
104  * Once this function is called, it assumes ownership of the
105  * \ref capture_info object and steals the reference of the
106  * object. Regardless of success or failure, the calling function
107  * should assumed that this function will own the object.
108  *
109  * \retval 0 on success
110  * \retval -1 on error
111  */
112 int hepv3_send_packet(struct hepv3_capture_info *capture_info);
113 
114 /*!
115  * \brief Get the preferred UUID type
116  *
117  * \since 13.10.0
118  *
119  * \retval The type of UUID the packet should use
120  */
122 
123 /*!
124  * \brief Return whether or not we're currently loaded and active
125  *
126  * \retval 0 The module is not loaded
127  * \retval 1 The module is loaded
128  */
129 int hepv3_is_loaded(void);
130 
131 #if defined(__cplusplus) || defined(c_plusplus)
132 }
133 #endif
134 
135 #endif /* _ASTERISK_RES_HEPV3_H */
struct ast_sockaddr src_addr
Definition: res_hep.h:60
enum hepv3_capture_type capture_type
Definition: res_hep.h:70
struct ast_sockaddr dst_addr
Definition: res_hep.h:62
hepv3_capture_type
HEPv3 Packet Capture Types.
Definition: res_hep.h:39
Socket address structure.
Definition: netsock2.h:97
unsigned int zipped
Definition: res_hep.h:74
HEPv3 Capture Info.
Definition: res_hep.h:58
Network socket handling.
struct hepv3_capture_info * hepv3_create_capture_info(const void *payload, size_t len)
Create a hepv3_capture_info object.
Definition: res_hep.c:428
enum hep_uuid_type hepv3_get_uuid_type(void)
Get the preferred UUID type.
Definition: res_hep.c:409
hep_uuid_type
Definition: res_hep.h:52
int hepv3_is_loaded(void)
Return whether or not we&#39;re currently loaded and active.
Definition: res_hep.c:421
struct timeval capture_time
Definition: res_hep.h:64
int hepv3_send_packet(struct hepv3_capture_info *capture_info)
Send a generic packet capture to HEPv3.
Definition: res_hep.c:581
void * payload
Definition: res_hep.h:66