<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19573">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_hep: Add support for named capture agents.<br><br>Adds support for the capture agent name field<br>of the Homer protocol to Asterisk by allowing<br>users to specify a name that will be sent to<br>the HEP server.<br><br>ASTERISK-30322 #close<br><br>Change-Id: I6136583017f9dd08daeb8be02f60fb8df4639a2b<br>---<br>A doc/CHANGES-staging/res_hep.txt<br>M res/res_hep.c<br>2 files changed, 42 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/19573/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/CHANGES-staging/res_hep.txt b/doc/CHANGES-staging/res_hep.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..fb386a1</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/res_hep.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: Add support for named capture agent.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A name for the capture agent can now be specified</span><br><span style="color: hsl(120, 100%, 40%);">+using the capture_name option which, if specified,</span><br><span style="color: hsl(120, 100%, 40%);">+will be sent to the HEP server.</span><br><span>diff --git a/res/res_hep.c b/res/res_hep.c</span><br><span>index 3241801..36f7e43 100644</span><br><span>--- a/res/res_hep.c</span><br><span>+++ b/res/res_hep.c</span><br><span>@@ -78,6 +78,9 @@</span><br><span> <configOption name="capture_id" default="0"></span><br><span> <synopsis>The ID for this capture agent.</synopsis></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="capture_name" default=""></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>The name for this capture agent.</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ </configOption></span><br><span> </configObject></span><br><span> </configFile></span><br><span> </configInfo></span><br><span>@@ -155,6 +158,9 @@</span><br><span> </span><br><span> /*! THE UUID FOR THIS PACKET */</span><br><span> CHUNK_TYPE_UUID = 0X0011,</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! THE CAPTURE AGENT NAME */</span><br><span style="color: hsl(120, 100%, 40%);">+ CHUNK_TYPE_CAPTURE_AGENT_NAME = 0X0013,</span><br><span> };</span><br><span> </span><br><span> #define INITIALIZE_GENERIC_HEP_IDS(hep_chunk, type) do { \</span><br><span>@@ -240,6 +246,7 @@</span><br><span> AST_DECLARE_STRING_FIELDS(</span><br><span> AST_STRING_FIELD(capture_address); /*!< Address to send to */</span><br><span> AST_STRING_FIELD(capture_password); /*!< Password for Homer server */</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_STRING_FIELD(capture_name); /*!< Capture name for this agent */</span><br><span> );</span><br><span> };</span><br><span> </span><br><span>@@ -458,7 +465,7 @@</span><br><span> unsigned int packet_len = 0, sock_buffer_len;</span><br><span> struct hep_chunk_ip4 ipv4_src, ipv4_dst;</span><br><span> struct hep_chunk_ip6 ipv6_src, ipv6_dst;</span><br><span style="color: hsl(0, 100%, 40%);">- struct hep_chunk auth_key, payload, uuid;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct hep_chunk auth_key, payload, uuid, capturename;</span><br><span> void *sock_buffer;</span><br><span> int res;</span><br><span> </span><br><span>@@ -512,6 +519,10 @@</span><br><span> INITIALIZE_GENERIC_HEP_IDS_VAR(&auth_key, CHUNK_TYPE_AUTH_KEY, strlen(config->general->capture_password));</span><br><span> packet_len += (sizeof(auth_key) + strlen(config->general->capture_password));</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(config->general->capture_name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ INITIALIZE_GENERIC_HEP_IDS_VAR(&capturename, CHUNK_TYPE_CAPTURE_AGENT_NAME, strlen(config->general->capture_name));</span><br><span style="color: hsl(120, 100%, 40%);">+ packet_len += (sizeof(capturename) + strlen(config->general->capture_name));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> INITIALIZE_GENERIC_HEP_IDS_VAR(&uuid, CHUNK_TYPE_UUID, strlen(capture_info->uuid));</span><br><span> packet_len += (sizeof(uuid) + strlen(capture_info->uuid));</span><br><span> INITIALIZE_GENERIC_HEP_IDS_VAR(&payload,</span><br><span>@@ -556,6 +567,14 @@</span><br><span> memcpy(sock_buffer + sock_buffer_len, capture_info->uuid, strlen(capture_info->uuid));</span><br><span> sock_buffer_len += strlen(capture_info->uuid);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Capture Agent Name */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(config->general->capture_name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ memcpy(sock_buffer + sock_buffer_len, &capturename, sizeof(capturename));</span><br><span style="color: hsl(120, 100%, 40%);">+ sock_buffer_len += sizeof(capturename);</span><br><span style="color: hsl(120, 100%, 40%);">+ memcpy(sock_buffer + sock_buffer_len, config->general->capture_name, strlen(config->general->capture_name));</span><br><span style="color: hsl(120, 100%, 40%);">+ sock_buffer_len += strlen(config->general->capture_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Packet! */</span><br><span> memcpy(sock_buffer + sock_buffer_len, &payload, sizeof(payload));</span><br><span> sock_buffer_len += sizeof(payload);</span><br><span>@@ -681,6 +700,7 @@</span><br><span> aco_option_register(&cfg_info, "capture_address", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct hepv3_global_config, capture_address));</span><br><span> aco_option_register(&cfg_info, "capture_password", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_password));</span><br><span> aco_option_register(&cfg_info, "capture_id", ACO_EXACT, global_options, "0", OPT_UINT_T, 0, STRFLDSET(struct hepv3_global_config, capture_id));</span><br><span style="color: hsl(120, 100%, 40%);">+ aco_option_register(&cfg_info, "capture_name", ACO_EXACT, global_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct hepv3_global_config, capture_name));</span><br><span> aco_option_register_custom(&cfg_info, "uuid_type", ACO_EXACT, global_options, "call-id", uuid_type_handler, 0);</span><br><span> </span><br><span> if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19573">change 19573</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19573"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6136583017f9dd08daeb8be02f60fb8df4639a2b </div>
<div style="display:none"> Gerrit-Change-Number: 19573 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>