|
78 | 78 | <configOption name="capture_id" default="0">
|
79 | 79 | <synopsis>The ID for this capture agent.</synopsis>
|
80 | 80 | </configOption>
|
| 81 | + <configOption name="capture_name" default=""> |
| 82 | + <synopsis>The name for this capture agent.</synopsis> |
| 83 | + </configOption> |
81 | 84 | </configObject>
|
82 | 85 | </configFile>
|
83 | 86 | </configInfo>
|
@@ -155,6 +158,9 @@ enum hepv3_chunk_types {
|
155 | 158 |
|
156 | 159 | /*! THE UUID FOR THIS PACKET */
|
157 | 160 | CHUNK_TYPE_UUID = 0X0011,
|
| 161 | + |
| 162 | + /*! THE CAPTURE AGENT NAME */ |
| 163 | + CHUNK_TYPE_CAPTURE_AGENT_NAME = 0X0013, |
158 | 164 | };
|
159 | 165 |
|
160 | 166 | #define INITIALIZE_GENERIC_HEP_IDS(hep_chunk, type) do { \
|
@@ -240,6 +246,7 @@ struct hepv3_global_config {
|
240 | 246 | AST_DECLARE_STRING_FIELDS(
|
241 | 247 | AST_STRING_FIELD(capture_address); /*!< Address to send to */
|
242 | 248 | AST_STRING_FIELD(capture_password); /*!< Password for Homer server */
|
| 249 | + AST_STRING_FIELD(capture_name); /*!< Capture name for this agent */ |
243 | 250 | );
|
244 | 251 | };
|
245 | 252 |
|
@@ -458,7 +465,7 @@ static int hep_queue_cb(void *data)
|
458 | 465 | unsigned int packet_len = 0, sock_buffer_len;
|
459 | 466 | struct hep_chunk_ip4 ipv4_src, ipv4_dst;
|
460 | 467 | struct hep_chunk_ip6 ipv6_src, ipv6_dst;
|
461 |
| - struct hep_chunk auth_key, payload, uuid; |
| 468 | + struct hep_chunk auth_key, payload, uuid, capturename; |
462 | 469 | void *sock_buffer;
|
463 | 470 | int res;
|
464 | 471 |
|
@@ -512,6 +519,10 @@ static int hep_queue_cb(void *data)
|
512 | 519 | INITIALIZE_GENERIC_HEP_IDS_VAR(&auth_key, CHUNK_TYPE_AUTH_KEY, strlen(config->general->capture_password));
|
513 | 520 | packet_len += (sizeof(auth_key) + strlen(config->general->capture_password));
|
514 | 521 | }
|
| 522 | + if (!ast_strlen_zero(config->general->capture_name)) { |
| 523 | + INITIALIZE_GENERIC_HEP_IDS_VAR(&capturename, CHUNK_TYPE_CAPTURE_AGENT_NAME, strlen(config->general->capture_name)); |
| 524 | + packet_len += (sizeof(capturename) + strlen(config->general->capture_name)); |
| 525 | + } |
515 | 526 | INITIALIZE_GENERIC_HEP_IDS_VAR(&uuid, CHUNK_TYPE_UUID, strlen(capture_info->uuid));
|
516 | 527 | packet_len += (sizeof(uuid) + strlen(capture_info->uuid));
|
517 | 528 | INITIALIZE_GENERIC_HEP_IDS_VAR(&payload,
|
@@ -556,6 +567,14 @@ static int hep_queue_cb(void *data)
|
556 | 567 | memcpy(sock_buffer + sock_buffer_len, capture_info->uuid, strlen(capture_info->uuid));
|
557 | 568 | sock_buffer_len += strlen(capture_info->uuid);
|
558 | 569 |
|
| 570 | + /* Capture Agent Name */ |
| 571 | + if (!ast_strlen_zero(config->general->capture_name)) { |
| 572 | + memcpy(sock_buffer + sock_buffer_len, &capturename, sizeof(capturename)); |
| 573 | + sock_buffer_len += sizeof(capturename); |
| 574 | + memcpy(sock_buffer + sock_buffer_len, config->general->capture_name, strlen(config->general->capture_name)); |
| 575 | + sock_buffer_len += strlen(config->general->capture_name); |
| 576 | + } |
| 577 | + |
559 | 578 | /* Packet! */
|
560 | 579 | memcpy(sock_buffer + sock_buffer_len, &payload, sizeof(payload));
|
561 | 580 | sock_buffer_len += sizeof(payload);
|
@@ -681,6 +700,7 @@ static int load_module(void)
|
681 | 700 | aco_option_register(&cfg_info, "capture_address", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct hepv3_global_config, capture_address));
|
682 | 701 | aco_option_register(&cfg_info, "capture_password", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_password));
|
683 | 702 | aco_option_register(&cfg_info, "capture_id", ACO_EXACT, global_options, "0", OPT_UINT_T, 0, STRFLDSET(struct hepv3_global_config, capture_id));
|
| 703 | + aco_option_register(&cfg_info, "capture_name", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_name)); |
684 | 704 | aco_option_register_custom(&cfg_info, "uuid_type", ACO_EXACT, global_options, "call-id", uuid_type_handler, 0);
|
685 | 705 |
|
686 | 706 | if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
|
|
0 commit comments