VITA 49: add an explicit option to activate Ettus UHD header workaround

Bug: 14641
Change-Id: Ie3259a831c3736f8879b1e87f3dff31d6d036b40
Reviewed-on: https://code.wireshark.org/review/27249
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Pascal Quantin 2018-05-02 10:57:07 +02:00 committed by Anders Broman
parent 5cc6cd3ae6
commit ff2c8ef00f
1 changed files with 12 additions and 1 deletions

View File

@ -16,12 +16,15 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
void proto_register_vrt(void);
void proto_reg_handoff_vrt(void);
#define VITA_49_PORT 4991
static gboolean vrt_use_ettus_uhd_header_format = FALSE;
static int proto_vrt = -1;
/* fields */
@ -156,7 +159,7 @@ static int dissect_vrt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
col_clear(pinfo->cinfo,COL_INFO);
/* HACK to support UHD's weird header offset on data packets. */
if (tvb_get_guint8(tvb, 0) == 0)
if (vrt_use_ettus_uhd_header_format && tvb_get_guint8(tvb, 0) == 0)
offset += 4;
/* get packet type */
@ -327,6 +330,8 @@ static void dissect_cid(tvbuff_t *tvb, proto_tree *tree, int offset)
void
proto_register_vrt(void)
{
module_t *vrt_module;
static hf_register_info hf[] = {
{ &hf_vrt_header,
{ "VRT header", "vrt.hdr",
@ -625,6 +630,12 @@ proto_register_vrt(void)
proto_register_field_array(proto_vrt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
vrt_module = prefs_register_protocol(proto_vrt, NULL);
prefs_register_bool_preference(vrt_module, "ettus_uhd_header_format",
"Use Ettus UHD header format",
"Activate workaround for weird Ettus UHD header offset on data packets",
&vrt_use_ettus_uhd_header_format);
}
void