Asterisk - The Open Source Telephony Project
21.4.1
|
Routines for integration with Homer using HEPv3. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
#include "asterisk/config_options.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/res_hep.h"
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip6.h>
Go to the source code of this file.
Data Structures | |
struct | hep_chunk |
struct | hep_chunk_ip4 |
struct | hep_chunk_ip6 |
struct | hep_chunk_uint16 |
struct | hep_chunk_uint32 |
struct | hep_chunk_uint8 |
struct | hep_ctrl |
struct | hep_generic |
struct | hepv3_global_config |
Global configuration for the module. More... | |
struct | hepv3_runtime_data |
Run-time data derived from hepv3_global_config. More... | |
struct | module_config |
The configuration settings for this module. More... | |
Macros | |
#define | ASTERISK_VENDOR_ID 0x0004 |
#define | GENERIC_VENDOR_ID 0x0000 |
#define | INITIALIZE_GENERIC_HEP_CHUNK(hep_item, type) |
#define | INITIALIZE_GENERIC_HEP_CHUNK_DATA(hep_item, type, value) |
#define | INITIALIZE_GENERIC_HEP_IDS(hep_chunk, type) |
#define | INITIALIZE_GENERIC_HEP_IDS_VAR(hep_chunk, type, len) |
Enumerations | |
enum | hepv3_chunk_types { CHUNK_TYPE_IP_PROTOCOL_FAMILY = 0X0001, CHUNK_TYPE_IP_PROTOCOL_ID = 0X0002, CHUNK_TYPE_IPV4_SRC_ADDR = 0X0003, CHUNK_TYPE_IPV4_DST_ADDR = 0X0004, CHUNK_TYPE_IPV6_SRC_ADDR = 0X0005, CHUNK_TYPE_IPV6_DST_ADDR = 0X0006, CHUNK_TYPE_SRC_PORT = 0X0007, CHUNK_TYPE_DST_PORT = 0X0008, CHUNK_TYPE_TIMESTAMP_SEC = 0X0009, CHUNK_TYPE_TIMESTAMP_USEC = 0X000A, CHUNK_TYPE_PROTOCOL_TYPE = 0X000B, CHUNK_TYPE_CAPTURE_AGENT_ID = 0X000C, CHUNK_TYPE_KEEP_ALIVE_TIMER = 0X000D, CHUNK_TYPE_AUTH_KEY = 0X000E, CHUNK_TYPE_PAYLOAD = 0X000F, CHUNK_TYPE_PAYLOAD_ZIP = 0X0010, CHUNK_TYPE_UUID = 0X0011, CHUNK_TYPE_CAPTURE_AGENT_NAME = 0X0013 } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static | AO2_GLOBAL_OBJ_STATIC (global_config) |
The module configuration container. | |
static | AO2_GLOBAL_OBJ_STATIC (global_data) |
Current module data. | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | capture_info_dtor (void *obj) |
Destructor for a hepv3_capture_info object. | |
CONFIG_INFO_STANDARD (cfg_info, global_config, module_config_alloc,.files=ACO_FILES(&hepv3_conf),.pre_apply_config=hepv3_config_pre_apply,.post_apply_config=hepv3_config_post_apply,) | |
Register information about the configs being processed by this module. | |
static int | hep_queue_cb (void *data) |
Callback function for the hep_queue_tp taskprocessor. | |
static void * | hepv3_config_alloc (void) |
HEPv3 configuration object allocation. | |
static void | hepv3_config_dtor (void *obj) |
static void | hepv3_config_post_apply (void) |
Post-apply callback for the config framework. More... | |
static int | hepv3_config_pre_apply (void) |
Pre-apply callback for the config framework. More... | |
struct hepv3_capture_info * | hepv3_create_capture_info (const void *payload, size_t len) |
Create a hepv3_capture_info object. More... | |
static struct hepv3_runtime_data * | hepv3_data_alloc (struct hepv3_global_config *config) |
Allocate the HEPv3 run-time data. | |
static void | hepv3_data_dtor (void *obj) |
HEPv3 run-time data destructor. | |
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... | |
static int | load_module (void) |
Load the module. | |
static void * | module_config_alloc (void) |
Module config constructor. | |
static void | module_config_dtor (void *obj) |
Configuration object destructor. | |
static int | reload_module (void) |
Reload the module. | |
static int | unload_module (void) |
Unload the module. | |
static int | uuid_type_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Handler for the uuid_type attribute. | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "HEPv3 API" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_APP_DEPEND, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct aco_type | global_option |
struct aco_type * | global_options [] = ACO_TYPES(&global_option) |
static struct ast_taskprocessor * | hep_queue_tp |
struct aco_file | hepv3_conf |
Routines for integration with Homer using HEPv3.
Definition in file res_hep.c.
#define ASTERISK_VENDOR_ID 0x0004 |
#define GENERIC_VENDOR_ID 0x0000 |
#define INITIALIZE_GENERIC_HEP_CHUNK | ( | hep_item, | |
type | |||
) |
#define INITIALIZE_GENERIC_HEP_CHUNK_DATA | ( | hep_item, | |
type, | |||
value | |||
) |
#define INITIALIZE_GENERIC_HEP_IDS | ( | hep_chunk, | |
type | |||
) |
#define INITIALIZE_GENERIC_HEP_IDS_VAR | ( | hep_chunk, | |
type, | |||
len | |||
) |
enum hepv3_chunk_types |
Chunk types from the HEPv3 Spec
Definition at line 109 of file res_hep.c.
|
static |
Post-apply callback for the config framework.
This will create the run-time information from the supplied configuration.
Definition at line 646 of file res_hep.c.
References ao2_global_obj_ref, ao2_global_obj_replace_unref, ao2_ref, hepv3_data_alloc(), and RAII_VAR.
|
static |
Pre-apply callback for the config framework.
This validates that required fields exist and are populated.
Definition at line 623 of file res_hep.c.
References aco_pending_config(), and module_config::general.
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.
payload | The payload to send to the HEP capture node |
len | Length of payload |
NULL | on error |
Definition at line 435 of file res_hep.c.
References ao2_ref, ast_malloc, capture_info_dtor(), hepv3_capture_info::len, hepv3_capture_info::payload, and hepv3_capture_info::protocol_id.
enum hep_uuid_type hepv3_get_uuid_type | ( | void | ) |
Get the preferred UUID type.
Definition at line 416 of file res_hep.c.
References ao2_global_obj_ref, and RAII_VAR.
int hepv3_is_loaded | ( | void | ) |
Return whether or not we're currently loaded and active.
0 | The module is not loaded |
1 | The module is loaded |
Definition at line 428 of file res_hep.c.
References ao2_global_obj_ref, and RAII_VAR.
int hepv3_send_packet | ( | struct hepv3_capture_info * | capture_info | ) |
Send a generic packet capture to HEPv3.
capture_info | Information 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.
0 | on success |
-1 | on error |
Definition at line 600 of file res_hep.c.
References ao2_global_obj_ref, ao2_ref, ast_taskprocessor_push(), hep_queue_cb(), and RAII_VAR.
struct aco_file hepv3_conf |