aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-06-20 20:51:42 +0000
committerGerald Combs <gerald@wireshark.org>2011-06-20 20:51:42 +0000
commit93f81a78cd75bbb073011c09324cbf6db956fc95 (patch)
treee25b336edc337647c96c96f77049b51289dc1c25 /epan/dissectors
parent85b7c95cf631ec7594e88600b709365d1b14c038 (diff)
From Jon Ellch via bug 5175:
Please see the attached patch which updates the ppi-geolocation support to v2.0 of the specification. This iteration adds a new tag (sensor) and removes support for velocity/acceleration from the vector tag. Most of the changes center on the Vector tag. Everything that takes place elsewhere is cosmetic. I ran this iteration through fuzz-test and check-APIs just like last time. From me: Replace tvb_get_ephemeral_string with tvb_format_text. Move dissector registration to the bottom of each file. svn path=/trunk/; revision=37733
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-ppi-antenna.c448
-rw-r--r--epan/dissectors/packet-ppi-gps.c518
-rw-r--r--epan/dissectors/packet-ppi-sensor.c565
-rw-r--r--epan/dissectors/packet-ppi-vector.c1008
-rw-r--r--epan/dissectors/packet-ppi.c16
6 files changed, 1513 insertions, 1043 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index d0c8fa0215..50d207a1dd 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -778,6 +778,7 @@ DISSECTOR_SRC = \
packet-ppi-geolocation-common.c \
packet-ppi-gps.c \
packet-ppi-vector.c \
+ packet-ppi-sensor.c \
packet-ppp.c \
packet-pppoe.c \
packet-pptp.c \
diff --git a/epan/dissectors/packet-ppi-antenna.c b/epan/dissectors/packet-ppi-antenna.c
index 6473983c2c..94ce407607 100644
--- a/epan/dissectors/packet-ppi-antenna.c
+++ b/epan/dissectors/packet-ppi-antenna.c
@@ -54,6 +54,9 @@ enum ppi_antenna_type {
PPI_ANTENNA_APPDATA = 30, /* 60-byte app-id specific data*/
PPI_ANTENNA_EXT = 31 /* Indicates n extended bitmap follows */
};
+#define PPI_ANTENNA_MAXTAGLEN 187 /* increase as fields are added */
+
+
@@ -110,199 +113,6 @@ static gint ett_ppi_antennaflags= -1;
static void
dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-void
-proto_register_ppi_antenna(void) {
- /* The following array initializes those header fields declared above to the values displayed */
- static hf_register_info hf[] = {
- { &hf_ppi_antenna_version,
- { "Header revision", "ppi_antenna.version",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Version of ppi_antenna header format", HFILL } },
- { &hf_ppi_antenna_pad,
- { "Header pad", "ppi_antenna.pad",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Padding", HFILL } },
- { &hf_ppi_antenna_length,
- { "Header length", "ppi_antenna.length",
- FT_UINT16, BASE_DEC, NULL, 0x0,
- "Length of header including version, pad, length and data fields", HFILL } },
- /* This setups the "Antenna flags" hex dropydown thing */
- { &hf_ppi_antenna_flags,
- { "Antenna flags", "ppi_antenna.antenna_flags",
- FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating polarity, etc", HFILL } },
- { &hf_ppi_antenna_present,
- { "Present", "ppi_antenna.present",
- FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating which fields are present", HFILL } },
-
- /* This first set is for the base_tag_header.it_present bitfield */
-#define PPI_ANTENNA_MASK_FLAGS 0x00000001 /* 0 */
-#define PPI_ANTENNA_MASK_GAINDB 0x00000002 /* 1 */
-#define PPI_ANTENNA_MASK_HORIZBW 0x00000004 /* 2 */
-#define PPI_ANTENNA_MASK_VERTBW 0x00000008 /* 3 */
-#define PPI_ANTENNA_MASK_PGAIN 0x00000020 /* 5 */
-#define PPI_ANTENNA_MASK_BEAMID 0x00000040 /* 6 */
-#define PPI_ANTENNA_MASK_RES7 0x00000080 /* 7 */
-#define PPI_ANTENNA_MASK_SERIALNUM 0x04000000 /* 26 */
-#define PPI_ANTENNA_MASK_MODELSTR 0x08000000 /* 27 */
-#define PPI_ANTENNA_MASK_DESCSTR 0x10000000 /* 28 */
-#define PPI_ANTENNA_MASK_APPID 0x20000000 /* 29 */
-#define PPI_ANTENNA_MASK_APPDATA 0x40000000 /* 30 */
-#define PPI_ANTENNA_MASK_EXT 0x80000000 /* 31 */
-
- /*This second set is for the AntennaFlags bitfield. */
-#define PPI_ANTENNAFLAGS_MASK_MIMO 0x00000001 /* 0 */
-#define PPI_ANTENNAFLAGS_MASK_HPOL 0x00000002 /* 1 */
-#define PPI_ANTENNAFLAGS_MASK_VPOL 0x00000004 /* 2 */
-#define PPI_ANTENNAFLAGS_MASK_CPOL_L 0x00000008 /* 3 */
-#define PPI_ANTENNAFLAGS_MASK_CPOL_R 0x00000010 /* 4 */
-#define PPI_ANTENNAFLAGS_MASK_STEER_ELEC 0x00010000 /* 16 */
-#define PPI_ANTENNAFLAGS_MASK_STEER_MECH 0x00020000 /* 17 */
-
-
- /* Boolean 'present' flags */
- { &hf_ppi_antenna_present_flags,
- { "flags", "ppi_antenna.present.flags",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_FLAGS,
- "Specifies if the flags bitfield is present", HFILL } },
- { &hf_ppi_antenna_present_gaindb,
- { "gaindb", "ppi_antenna.present.gaindb",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_GAINDB,
- "Specifies if the antenna gain field is present", HFILL } },
- { &hf_ppi_antenna_present_horizbw,
- { "horizbw", "ppi_antenna.present.horizbw",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_HORIZBW,
- "Specifies if the horizontal beamwidth field is present", HFILL } },
- { &hf_ppi_antenna_present_vertbw,
- { "vertbw", "ppi_antenna.present.vertbw",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_VERTBW,
- "Specifies if the vertical beamwidth field is present", HFILL } },
- { &hf_ppi_antenna_present_pgain,
- { "pgain", "ppi_antenna.present.pgain",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_PGAIN,
- "Specifies if the precision gain field is present", HFILL } },
- { &hf_ppi_antenna_present_beamid,
- { "beamid", "ppi_antenna.present.beamid",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_BEAMID,
- "Specifies if the BeamID field is present", HFILL } },
- { &hf_ppi_antenna_present_serialnum,
- { "serialnum", "ppi_antenna.present.serialnum",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_SERIALNUM,
- "Specifies if the serial num is present", HFILL } },
- { &hf_ppi_antenna_present_modelname,
- { "modelname", "ppi_antenna.present.modelname",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_MODELSTR,
- "Specifies if the model name is present", HFILL } },
- { &hf_ppi_antenna_present_descstr,
- { "Description", "ppi_antenna.present.descr",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_DESCSTR,
- "Specifies if the description string is present", HFILL } },
-
- { &hf_ppi_antenna_present_appspecific_num,
- { "appid", "ppi_antenna.present.appid",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_APPID,
- "Specifies if the application specific field id is present", HFILL } },
-
- { &hf_ppi_antenna_present_appspecific_data,
- { "appdata", "ppi_antenna.present.appdata",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_APPDATA,
- "Specifies if the application specific data field is present", HFILL } },
-
- { &hf_ppi_antenna_present_ext,
- { "ext", "ppi_antenna.present.ext",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_EXT,
- "Specifies if there are any extensions to the header present", HFILL } },
-
- /*Here we switch to the antennflags bits*/
- /* Boolean AntennaFlags' flags */
- { &hf_ppi_antennaflags_mimo,
- { "mimo", "ppi_antenna.antennaflags.mimo",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_MIMO,
- "Antena is part of MIMO system", HFILL } },
- { &hf_ppi_antennaflags_horizpol,
- { "horizontally polarized", "ppi_antenna.antennaflags.horizpol",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_HPOL,
- "Specifies if the antenna is horizontally polarized", HFILL } },
-
- { &hf_ppi_antennaflags_vertpol,
- { "vertically polarized", "ppi_antenna.antennaflags.vertpol",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_VPOL,
- "Specifies if the antenna is vertically polarized", HFILL } },
-
- { &hf_ppi_antennaflags_circpol_l,
- { "circularly polarized left", "ppi_antenna.antennaflags.circpol_l",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_CPOL_L,
- "Specifies if the antenna is circularly polarized, left handed", HFILL } },
-
- { &hf_ppi_antennaflags_circpol_r,
- { "circularly polarized right", "ppi_antenna.antennaflags.circpol_r",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_CPOL_R,
- "Specifies if the antenna is circularly polarized, right handed", HFILL } },
-
- { &hf_ppi_antennaflags_steer_elec,
- { "electrically steerable", "ppi_antenna.antennaflags.steer_elec",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_STEER_ELEC,
- "Specifies if the antenna is electrically steerable", HFILL } },
-
- { &hf_ppi_antennaflags_steer_mech,
- { "mechanically steerable", "ppi_antenna.antennaflags.steer_mech",
- FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_STEER_MECH,
- "Specifies if the antenna is mechanically steerable", HFILL } },
-
- /* Now we get to the actual data fields */
- { &hf_ppi_antenna_gaindb,
- { "Gain (dBi)", "ppi_antenna.gaindb",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Gain of antenna (dBi)", HFILL } },
- { &hf_ppi_antenna_horizbw,
- { "HorizBw", "ppi_antenna.horizbw",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Horizontal beamwidth", HFILL } },
- { &hf_ppi_antenna_vertbw,
- { "VertBw", "ppi_antenna.vertbw",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Vertical beamwidth", HFILL } },
- { &hf_ppi_antenna_pgain,
- { "Precision Gain (dBi)", "ppi_antenna.pgain",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Precision Gain", HFILL } },
- { &hf_ppi_antenna_beamid,
- { "BeamID", "ppi_antenna.beamid",
- FT_UINT16, BASE_HEX, NULL, 0x0,
- "Beam ID", HFILL } },
-
- { &hf_ppi_antenna_serialnum,
- { "SerialNumber", "ppi_antenna.serialnum",
- FT_STRING, BASE_NONE, NULL, 0x0,
- "Serial number", HFILL } } ,
- { &hf_ppi_antenna_modelname,
- { "ModelName", "ppi_antenna.modelname",
- FT_STRING, BASE_NONE, NULL, 0x0,
- "Model name", HFILL } } ,
- { &hf_ppi_antenna_descstr,
- { "Description", "ppi_antenna.descr",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL } } ,
- { &hf_ppi_antenna_appspecific_num,
- { "Application Specific id", "ppi_antenna.appid",
- FT_UINT32, BASE_HEX, NULL, 0x0,
- "Application-specific identifier", HFILL } },
- { &hf_ppi_antenna_appspecific_data,
- { "Application specific data", "ppi_antenna.appdata",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- "Application-specific data", HFILL } },
- };
- static gint *ett[] = {
- &ett_ppi_antenna,
- &ett_ppi_antenna_present,
- &ett_ppi_antennaflags
- };
-
- proto_ppi_antenna = proto_register_protocol("PPI antenna decoder", "PPI antenna Decoder", "ppi_antenna");
- proto_register_field_array(proto_ppi_antenna, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
- register_dissector("ppi_antenna", dissect_ppi_antenna, proto_ppi_antenna);
-
-}
void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
/* The fixed values up front */
guint32 version;
@@ -314,6 +124,7 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *antennaflags_tree = NULL;
proto_tree *pt, *my_pt;
proto_item *ti = NULL;
+ proto_item *antenna_line = NULL;
/* bits */
@@ -325,24 +136,30 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
guint32 t_hbw, t_vbw, t_pgain, t_appspecific_num; /* temporary conversions */
gdouble horizbw, vertbw, pgain;
guint32 flags;
-
+ gchar *curr_str;
int offset = 0;
/* Clear out stuff in the info column */
if (check_col(pinfo->cinfo,COL_INFO)) {
col_clear(pinfo->cinfo,COL_INFO);
}
+ /* pull out the first three fields of the BASE-GEOTAG-HEADER */
version = tvb_get_guint8(tvb, offset);
length = tvb_get_letohs(tvb, offset+2);
present = tvb_get_letohl(tvb, offset+4);
+
+ /* Setup basic column info */
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Antenna info v%u, Length %u",
version, length);
- /* Dissect the packet */
+
+ /* Create the basic dissection tree*/
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_ppi_antenna,
- tvb, 0, length, "PPI Antenna Header v%u, Length %u", version, length);
+ tvb, 0, length, "Antenna: ");
+ antenna_line = ti; /* save this for later, we will fill it in with more detail */
+
ppi_antenna_tree= proto_item_add_subtree(ti, ett_ppi_antenna);
proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_version,
tvb, offset, 1, version);
@@ -351,20 +168,34 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
ti = proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_length,
tvb, offset + 2, 2, length);
}
+ /* We support v1 and v2 of Antenna tags (identical) */
+ if (! (version == 1 || version == 2) ) {
+ if (tree)
+ proto_item_append_text(ti, "invalid version (got %d, expected 1 or 2)", version);
+ return;
+ }
+
length_remaining = length;
- /*
- * FIXME: This only works if there is exactly 1 it_present
- * field in the header
- */
+ /* minimum length check, should atleast be a fixed-size geotagging-base header*/
if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {
/*
- * Radiotap header is shorter than the fixed-length portion
+ * Base-geotag-header (Radiotap lookalike) is shorter than the fixed-length portion
* plus one "present" bitset.
*/
if (tree)
- proto_item_append_text(ti, " (bogus - minimum length is 8)");
+ proto_item_append_text(ti, " (invalid - minimum length is 8)");
return;
}
+
+
+ /* perform max length sanity checking */
+ if (length > PPI_ANTENNA_MAXTAGLEN ) {
+ if (tree)
+ proto_item_append_text(ti, "Invalid PPI-Antenna length (got %d, %d max\n)", length, PPI_ANTENNA_MAXTAGLEN);
+ return;
+ }
+
+
/* Subtree for the "present flags" bitfield. */
if (tree) {
pt = proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_present, tvb, offset + 4, 4, present);
@@ -420,6 +251,8 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
gaindb= tvb_get_guint8(tvb, offset);
if (tree) {
proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_gaindb, tvb, offset, 1, gaindb);
+ proto_item_append_text(antenna_line, " Gain: %d", gaindb);
+
}
offset+=1;
length_remaining-=1;
@@ -431,6 +264,7 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
horizbw = fixed3_6_to_gdouble(t_hbw);
if (tree) {
proto_tree_add_double(ppi_antenna_tree, hf_ppi_antenna_horizbw, tvb, offset, 4, horizbw);
+ proto_item_append_text(antenna_line, " HorizBw: %f", horizbw);
}
offset+=4;
length_remaining-=4;
@@ -470,7 +304,9 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
case PPI_ANTENNA_SERIALNUM:
if (length_remaining < 32)
break;
- proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_serialnum, tvb, offset, 32, ENC_NA);;
+ if (tree) {
+ proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_serialnum, tvb, offset, 32, ENC_NA);
+ }
offset+=32;
length_remaining-=32;
break;
@@ -478,14 +314,24 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
case PPI_ANTENNA_MODELSTR:
if (length_remaining < 32)
break;
- proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_modelname, tvb, offset, 32, ENC_NA);
+ if (tree) {
+ /* proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_modelname, tvb, offset, 32, ENC_NA); */
+ curr_str = tvb_format_text(tvb, offset, 32);
+ proto_tree_add_string(ppi_antenna_tree, hf_ppi_antenna_modelname, tvb, offset, 32, curr_str);
+ proto_item_append_text(antenna_line, " (%s)", curr_str);
+ }
offset+=32;
length_remaining-=32;
break;
case PPI_ANTENNA_DESCSTR:
if (length_remaining < 32)
break;
- proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_descstr, tvb, offset, 32, ENC_NA);
+ if (tree) {
+ /*proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_descstr, tvb, offset, 32, ENC_NA);*/
+ curr_str = tvb_format_text(tvb, offset, 32);
+ proto_tree_add_string(ppi_antenna_tree, hf_ppi_antenna_descstr, tvb, offset, 32, curr_str);
+ proto_item_append_text(antenna_line, " (%s)", curr_str);
+ }
offset+=32;
length_remaining-=32;
break;
@@ -522,4 +368,196 @@ void dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
+void
+proto_register_ppi_antenna(void) {
+ /* The following array initializes those header fields declared above to the values displayed */
+ static hf_register_info hf[] = {
+ { &hf_ppi_antenna_version,
+ { "Header revision", "ppi_antenna.version",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Version of ppi_antenna header format", HFILL } },
+ { &hf_ppi_antenna_pad,
+ { "Header pad", "ppi_antenna.pad",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Padding", HFILL } },
+ { &hf_ppi_antenna_length,
+ { "Header length", "ppi_antenna.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Length of header including version, pad, length and data fields", HFILL } },
+ /* This setups the "Antenna flags" hex dropydown thing */
+ { &hf_ppi_antenna_flags,
+ { "Antenna flags", "ppi_antenna.antenna_flags",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating polarity, etc", HFILL } },
+ { &hf_ppi_antenna_present,
+ { "Present", "ppi_antenna.present",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating which fields are present", HFILL } },
+
+ /* This first set is for the base_tag_header.it_present bitfield */
+#define PPI_ANTENNA_MASK_FLAGS 0x00000001 /* 0 */
+#define PPI_ANTENNA_MASK_GAINDB 0x00000002 /* 1 */
+#define PPI_ANTENNA_MASK_HORIZBW 0x00000004 /* 2 */
+#define PPI_ANTENNA_MASK_VERTBW 0x00000008 /* 3 */
+#define PPI_ANTENNA_MASK_PGAIN 0x00000010 /* 4 */
+#define PPI_ANTENNA_MASK_BEAMID 0x00000020 /* 5 */
+#define PPI_ANTENNA_MASK_RES7 0x00000080 /* 7 */
+#define PPI_ANTENNA_MASK_SERIALNUM 0x04000000 /* 26 */
+#define PPI_ANTENNA_MASK_MODELSTR 0x08000000 /* 27 */
+#define PPI_ANTENNA_MASK_DESCSTR 0x10000000 /* 28 */
+#define PPI_ANTENNA_MASK_APPID 0x20000000 /* 29 */
+#define PPI_ANTENNA_MASK_APPDATA 0x40000000 /* 30 */
+#define PPI_ANTENNA_MASK_EXT 0x80000000 /* 31 */
+
+ /*This second set is for the AntennaFlags bitfield. */
+#define PPI_ANTENNAFLAGS_MASK_MIMO 0x00000001 /* 0 */
+#define PPI_ANTENNAFLAGS_MASK_HPOL 0x00000002 /* 1 */
+#define PPI_ANTENNAFLAGS_MASK_VPOL 0x00000004 /* 2 */
+#define PPI_ANTENNAFLAGS_MASK_CPOL_L 0x00000008 /* 3 */
+#define PPI_ANTENNAFLAGS_MASK_CPOL_R 0x00000010 /* 4 */
+#define PPI_ANTENNAFLAGS_MASK_STEER_ELEC 0x00010000 /* 16 */
+#define PPI_ANTENNAFLAGS_MASK_STEER_MECH 0x00020000 /* 17 */
+
+
+ /* Boolean 'present' flags */
+ { &hf_ppi_antenna_present_flags,
+ { "flags", "ppi_antenna.present.flags",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_FLAGS,
+ "Specifies if the flags bitfield is present", HFILL } },
+ { &hf_ppi_antenna_present_gaindb,
+ { "gaindb", "ppi_antenna.present.gaindb",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_GAINDB,
+ "Specifies if the antenna gain field is present", HFILL } },
+ { &hf_ppi_antenna_present_horizbw,
+ { "horizbw", "ppi_antenna.present.horizbw",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_HORIZBW,
+ "Specifies if the horizontal beamwidth field is present", HFILL } },
+ { &hf_ppi_antenna_present_vertbw,
+ { "vertbw", "ppi_antenna.present.vertbw",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_VERTBW,
+ "Specifies if the vertical beamwidth field is present", HFILL } },
+ { &hf_ppi_antenna_present_pgain,
+ { "pgain", "ppi_antenna.present.pgain",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_PGAIN,
+ "Specifies if the precision gain field is present", HFILL } },
+ { &hf_ppi_antenna_present_beamid,
+ { "beamid", "ppi_antenna.present.beamid",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_BEAMID,
+ "Specifies if the BeamID field is present", HFILL } },
+ { &hf_ppi_antenna_present_serialnum,
+ { "serialnum", "ppi_antenna.present.serialnum",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_SERIALNUM,
+ "Specifies if the serial num is present", HFILL } },
+ { &hf_ppi_antenna_present_modelname,
+ { "modelname", "ppi_antenna.present.modelname",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_MODELSTR,
+ "Specifies if the model name is present", HFILL } },
+ { &hf_ppi_antenna_present_descstr,
+ { "Description", "ppi_antenna.present.descr",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_DESCSTR,
+ "Specifies if the description string is present", HFILL } },
+
+ { &hf_ppi_antenna_present_appspecific_num,
+ { "appid", "ppi_antenna.present.appid",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_APPID,
+ "Specifies if the application specific field id is present", HFILL } },
+
+ { &hf_ppi_antenna_present_appspecific_data,
+ { "appdata", "ppi_antenna.present.appdata",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_APPDATA,
+ "Specifies if the application specific data field is present", HFILL } },
+
+ { &hf_ppi_antenna_present_ext,
+ { "ext", "ppi_antenna.present.ext",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNA_MASK_EXT,
+ "Specifies if there are any extensions to the header present", HFILL } },
+
+ /*Here we switch to the antennflags bits*/
+ /* Boolean AntennaFlags' flags */
+ { &hf_ppi_antennaflags_mimo,
+ { "mimo", "ppi_antenna.antennaflags.mimo",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_MIMO,
+ "Antena is part of MIMO system", HFILL } },
+ { &hf_ppi_antennaflags_horizpol,
+ { "horizontally polarized", "ppi_antenna.antennaflags.horizpol",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_HPOL,
+ "Specifies if the antenna is horizontally polarized", HFILL } },
+
+ { &hf_ppi_antennaflags_vertpol,
+ { "vertically polarized", "ppi_antenna.antennaflags.vertpol",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_VPOL,
+ "Specifies if the antenna is vertically polarized", HFILL } },
+ { &hf_ppi_antennaflags_circpol_l,
+ { "circularly polarized left", "ppi_antenna.antennaflags.circpol_l",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_CPOL_L,
+ "Specifies if the antenna is circularly polarized, left handed", HFILL } },
+
+ { &hf_ppi_antennaflags_circpol_r,
+ { "circularly polarized right", "ppi_antenna.antennaflags.circpol_r",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_CPOL_R,
+ "Specifies if the antenna is circularly polarized, right handed", HFILL } },
+
+ { &hf_ppi_antennaflags_steer_elec,
+ { "electrically steerable", "ppi_antenna.antennaflags.steer_elec",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_STEER_ELEC,
+ "Specifies if the antenna is electrically steerable", HFILL } },
+
+ { &hf_ppi_antennaflags_steer_mech,
+ { "mechanically steerable", "ppi_antenna.antennaflags.steer_mech",
+ FT_BOOLEAN, 32, NULL, PPI_ANTENNAFLAGS_MASK_STEER_MECH,
+ "Specifies if the antenna is mechanically steerable", HFILL } },
+
+ /* Now we get to the actual data fields */
+ { &hf_ppi_antenna_gaindb,
+ { "Gain (dBi)", "ppi_antenna.gaindb",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Gain of antenna (dBi)", HFILL } },
+ { &hf_ppi_antenna_horizbw,
+ { "HorizBw", "ppi_antenna.horizbw",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Horizontal beamwidth", HFILL } },
+ { &hf_ppi_antenna_vertbw,
+ { "VertBw", "ppi_antenna.vertbw",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Vertical beamwidth", HFILL } },
+ { &hf_ppi_antenna_pgain,
+ { "Precision Gain (dBi)", "ppi_antenna.pgain",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Precision Gain", HFILL } },
+ { &hf_ppi_antenna_beamid,
+ { "BeamID", "ppi_antenna.beamid",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ "Beam ID", HFILL } },
+
+ { &hf_ppi_antenna_serialnum,
+ { "SerialNumber", "ppi_antenna.serialnum",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ "Serial number", HFILL } } ,
+ { &hf_ppi_antenna_modelname,
+ { "ModelName", "ppi_antenna.modelname",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ "Model name", HFILL } } ,
+ { &hf_ppi_antenna_descstr,
+ { "Description", "ppi_antenna.descr",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL } } ,
+ { &hf_ppi_antenna_appspecific_num,
+ { "Application Specific id", "ppi_antenna.appid",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Application-specific identifier", HFILL } },
+ { &hf_ppi_antenna_appspecific_data,
+ { "Application specific data", "ppi_antenna.appdata",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ "Application-specific data", HFILL } },
+ };
+ static gint *ett[] = {
+ &ett_ppi_antenna,
+ &ett_ppi_antenna_present,
+ &ett_ppi_antennaflags
+ };
+
+ proto_ppi_antenna = proto_register_protocol("PPI antenna decoder", "PPI antenna Decoder", "ppi_antenna");
+ proto_register_field_array(proto_ppi_antenna, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("ppi_antenna", dissect_ppi_antenna, proto_ppi_antenna);
+
+}
diff --git a/epan/dissectors/packet-ppi-gps.c b/epan/dissectors/packet-ppi-gps.c
index a01fc7fb3a..829f857924 100644
--- a/epan/dissectors/packet-ppi-gps.c
+++ b/epan/dissectors/packet-ppi-gps.c
@@ -36,6 +36,7 @@
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/dissectors/packet-ppi-geolocation-common.h>
+
enum ppi_geotagging_type {
PPI_GEOTAG_GPSFLAGS = 0,
PPI_GEOTAG_LAT = 1,
@@ -52,7 +53,24 @@ enum ppi_geotagging_type {
PPI_GEOTAG_APPDATA = 30,
PPI_GEOTAG_EXT = 31
};
-#define PPI_GPS_MAXTAGLEN 148 /* This increases as fields above are added */
+#define PPI_GPS_MAXTAGLEN 144 /* increase as fields are added */
+
+#define PPI_GPS_MASK_GPSFLAGS 0x00000001
+#define PPI_GPS_MASK_LAT 0x00000002
+#define PPI_GPS_MASK_LON 0x00000004
+#define PPI_GPS_MASK_ALT 0x00000008
+#define PPI_GPS_MASK_ALT_G 0x00000010
+
+#define PPI_GPS_MASK_GPSTIME 0x00000020
+#define PPI_GPS_MASK_FRACTIME 0x00000040
+#define PPI_GPS_MASK_EPH 0x00000080
+#define PPI_GPS_MASK_EPV 0x00000100
+#define PPI_GPS_MASK_EPT 0x00000200
+
+#define PPI_GPS_MASK_DESCRSTR 0x10000000
+#define PPI_GPS_MASK_APPID 0x20000000
+#define PPI_GPS_MASK_APPDATA 0x40000000
+#define PPI_GPS_MASK_EXT 0x80000000
/* protocol */
@@ -72,7 +90,7 @@ static int hf_ppi_gps_fractime = -1;
static int hf_ppi_gps_eph = -1;
static int hf_ppi_gps_epv = -1;
static int hf_ppi_gps_ept = -1;
-static int hf_ppi_gps_descr = -1;
+static int hf_ppi_gps_descstr = -1;
static int hf_ppi_gps_appspecific_num = -1; /* 4-byte tag no */
static int hf_ppi_gps_appspecific_data = -1; /* 60 byte arbitrary data */
/* "Present" flags, tese represent decoded-bits in the gui */
@@ -110,232 +128,6 @@ static gint ett_ppi_gps_gpsflags_flags= -1;
static void
dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-void
-proto_register_ppi_gps(void) {
- /* The following array initializes those header fields declared above to the values displayed */
- static hf_register_info hf[] = {
- { &hf_ppi_gps_version,
- { "Header revision", "ppi_gps.version",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Version of ppi_gps header format", HFILL } },
- { &hf_ppi_gps_pad,
- { "Header pad", "ppi_gps.pad",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Padding", HFILL } },
- { &hf_ppi_gps_length,
- { "Header length", "ppi_gps.length",
- FT_UINT16, BASE_DEC, NULL, 0x0,
- "Length of header including version, pad, length and data fields", HFILL } },
- { &hf_ppi_gps_present, /* these flag fields are composed of a uint32 on the display */
- { "Present", "ppi_gps.present",
- FT_UINT32, BASE_HEX, NULL, 0x0,
- "Bitmask indicating which fields are present", HFILL } },
-
-#define PPI_GPS_MASK_GPSFLAGS 0x00000001
-#define PPI_GPS_MASK_LAT 0x00000002
-#define PPI_GPS_MASK_LON 0x00000004
-#define PPI_GPS_MASK_ALT 0x00000008
-#define PPI_GPS_MASK_ALT_G 0x00000010
-
-#define PPI_GPS_MASK_GPSTIME 0x00000020
-#define PPI_GPS_MASK_FRACTIME 0x00000040
-#define PPI_GPS_MASK_EPH 0x00000080
-#define PPI_GPS_MASK_EPV 0x00000100
-#define PPI_GPS_MASK_EPT 0x00000200
-
-#define PPI_GPS_MASK_DESCRSTR 0x10000000
-#define PPI_GPS_MASK_APPID 0x20000000
-#define PPI_GPS_MASK_APPDATA 0x40000000
-#define PPI_GPS_MASK_EXT 0x80000000
-
- /* Boolean 'present' flags */
- { &hf_ppi_gps_present_gpsflags_flags, /* followed by a lot of booleans */
- { "GPSFlags", "ppi_gps.present.gpsflagss",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_GPSFLAGS,
- "32-bit bitmask indicating type of GPS fix (GPS/INS/software/etc)", HFILL } },
- { &hf_ppi_gps_present_lat,
- { "Lat", "ppi_gps.present.lat",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_LAT,
- "Specifies if the latitude field is present", HFILL } },
-
- { &hf_ppi_gps_present_lon,
- { "Lon", "ppi_gps.present.lon",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_LON,
- "Specifies if the longitude field is present", HFILL } },
-
- { &hf_ppi_gps_present_alt,
- { "Alt", "ppi_gps.present.alt",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_ALT,
- "Specifies if the altitude field is present", HFILL } },
-
- { &hf_ppi_gps_present_alt_gnd,
- { "Alt-gnd", "ppi_gps.present.alt_gnd",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_ALT_G,
- "Specifies if the altitude-g field is present", HFILL } },
-
- { &hf_ppi_gps_present_gpstime,
- { "GPStime", "ppi_gps.present.gpstime",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_GPSTIME,
- "Specifies if the GPS time field is present", HFILL } },
-
-
- { &hf_ppi_gps_present_fractime,
- { "fractime", "ppi_gps.present.fractime",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_FRACTIME,
- "Specifies if the fractional time field is present", HFILL } },
-
-
- { &hf_ppi_gps_present_eph,
- { "error_h", "ppi_gps.present.eph",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPH,
- "Specifies if the horizontal error field is present (eph)", HFILL } },
-
- { &hf_ppi_gps_present_epv,
- { "error_v", "ppi_gps.present.epv",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPV,
- "Specifies if the vertical error field present (epv)", HFILL } },
-
-
- { &hf_ppi_gps_present_ept,
- { "error_t", "ppi_gps.present.ept",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPT,
- "Specifies if the estimed time error field is present (ept)", HFILL } },
-
- { &hf_ppi_gps_present_descr,
- { "Description", "ppi_gps.present.descr",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_DESCRSTR,
- "Specifies if the (ASCII) description is present", HFILL } },
-
- { &hf_ppi_gps_present_appspecific_num,
- { "AppId", "ppi_gps.present.appid",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_APPID,
- "Specifies if the application specific field id is present", HFILL } },
-
- { &hf_ppi_gps_present_appspecific_data,
- { "AppData", "ppi_gps.present.appdata",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_APPDATA,
- "Specifies if the application specific data field is present", HFILL } },
-
- { &hf_ppi_gps_present_ext,
- { "Ext", "ppi_gps.present.ext",
- FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EXT,
- "Specifies if there are any extensions to the header present", HFILL } },
-
- /* ---Now we get to the actual data fields--- */
-
- { &hf_ppi_gps_gpsflags_flags,
- { "GPSFlags", "ppi_gps.gpsflags",
- FT_UINT32, BASE_HEX, NULL, 0x0,
- "Bitmask indicating GPS/INS/manual fix", HFILL } },
- { &hf_ppi_gps_lat,
- { "Latitude", "ppi_gps.lat",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Latitude packet was received at", HFILL } },
- { &hf_ppi_gps_lon,
- { "Longitude", "ppi_gps.lon",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Longitude packet was received at", HFILL } },
- { &hf_ppi_gps_alt,
- { "Altitude", "ppi_gps.alt",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Altitude packet was received at", HFILL } },
- { &hf_ppi_gps_alt_gnd,
- { "Altitude_gnd", "ppi_gps.alt_gnd",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Altitude packet was received at (relative to ground)", HFILL } },
- { &hf_ppi_gps_gpstime,
- { "GPSTimestamp", "ppi_gps.gpstime",
- FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
- "GPSTimestamp packet was received at", HFILL } },
- { &hf_ppi_gps_fractime,
- { "fractional Timestamp", "ppi_gps.fractime",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "fractional GPSTimestamp packet was received at", HFILL } },
- { &hf_ppi_gps_eph,
- { "Horizontal Error (m)", "ppi_gps.eph",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Horizontal margin of error (meters)", HFILL } },
- { &hf_ppi_gps_epv,
- { "Vertical Error (m)", "ppi_gps.epv",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Vertical margin of error (meters)", HFILL } },
- { &hf_ppi_gps_ept,
- { "Time Error (s)", "ppi_gps.ept",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Time margin of error (secs)", HFILL } },
- { &hf_ppi_gps_descr,
- { "Description", "ppi_gps.descr",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL } },
- { &hf_ppi_gps_appspecific_num,
- { "Application Specific id", "ppi_gps.appid",
- FT_UINT32, BASE_HEX, NULL, 0x0,
- "Application-specific identifier", HFILL } },
- { &hf_ppi_gps_appspecific_data,
- { "Application specific data", "ppi_gps.appdata",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL } },
-
- /* --- moving on to the 'FixType' flags --- */
-#define PPI_GPS_GPSFLAGS_FLAG0_NOFIX 0x00000001
-#define PPI_GPS_GPSFLAGS_FLAG1_GPS 0x00000002
-#define PPI_GPS_GPSFLAGS_FLAG2_DIFFGPS 0x00000004
-#define PPI_GPS_GPSFLAGS_FLAG3_PPS 0x00000008
-#define PPI_GPS_GPSFLAGS_FLAG4_RTK 0x00000010
-#define PPI_GPS_GPSFLAGS_FLAG5_FLOATRTK 0x00000020
-#define PPI_GPS_GPSFLAGS_FLAG6_DEAD_RECK 0x00000040
-#define PPI_GPS_GPSFLAGS_FLAG7_MANUAL 0x00000080
-#define PPI_GPS_GPSFLAGS_FLAG8_SIM 0x00000100
- { &hf_ppi_gps_gpsflags_flag0_nofix, /* no fix available */
- { "No fix available", "ppi_gps.gpsflagss.nofix",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG0_NOFIX,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag1_gpsfix, /* GPSfix available */
- { "GPS provided fix", "ppi_gps.gpsflagss.gps",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG1_GPS,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag2_diffgps, /* Differential GPS fix available */
- { "Differential GPS provided fix", "ppi_gps.gpsflagss.diffgps",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG2_DIFFGPS,
- "DGPS provided fix", HFILL } },
- { &hf_ppi_gps_gpsflags_flag3_PPS, /* PPS fix */
- { "PPS fix", "ppi_gps.gpsflagss.pps",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG3_PPS,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag4_RTK, /* RTK fix*/
- { "RTK fix", "ppi_gps.gpsflagss.rtk",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG4_RTK,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag5_floatRTK, /*float RTK */
- { "floatRTK fix", "ppi_gps.gpsflagss.frtk",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG5_FLOATRTK,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag6_dead_reck, /*dead reckoning */
- { "dead reckoning fix", "ppi_gps.gpsflagss.dead_reck",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG6_DEAD_RECK,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag7_manual, /* manual */
- { "manual fix", "ppi_gps.gpsflagss.manual",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG7_MANUAL,
- NULL, HFILL } },
- { &hf_ppi_gps_gpsflags_flag8_sim, /* simulation */
- { "simulated fix", "ppi_gps.gpsflagss.simulation",
- FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG8_SIM,
- NULL, HFILL } },
-
- };
- static gint *ett[] = {
- &ett_ppi_gps,
- &ett_ppi_gps_present,
- &ett_ppi_gps_gpsflags_flags
- };
-
- proto_ppi_gps = proto_register_protocol("PPI Geotagging GPS tag decoder", "PPI GPS Decoder", "ppi_gps");
- proto_register_field_array(proto_ppi_gps, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
- register_dissector("ppi_gps", dissect_ppi_gps, proto_ppi_gps);
-
-}
void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
/* These are locals used for processing the current tvb */
guint length;
@@ -347,6 +139,7 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree *my_pt, *gpsflags_flags_tree = NULL; /* used for DeviceType bitmask stuff */
proto_item *ti = NULL;
+ proto_item *gps_line = NULL;
/* bits */
@@ -358,6 +151,8 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
nstime_t gps_timestamp;
int gps_time_size, already_processed_fractime; /* we use this internally to track if this is a 4 or 8 byte wide timestamp */
gdouble eph, epv, ept;
+ gchar *curr_str;
+
/* these are temporary intermediate values, used in the individual cases below */
guint32 t_lat, t_lon, t_alt, t_alt_gnd;
@@ -374,47 +169,47 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
length = tvb_get_letohs(tvb, offset+2);
present = tvb_get_letohl(tvb, offset+4);
+ /* Setup basic column info */
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_GPS Capture v%u, Length %u", version, length);
- /* Dissect the packet */
+ /* Create the basic dissection tree*/
if (tree) {
- ti = proto_tree_add_protocol_format(tree, proto_ppi_gps,
- tvb, 0, length, "PPI GPS Header v%u, Length %u", version, length);
+ ti = proto_tree_add_protocol_format(tree, proto_ppi_gps, tvb, 0, length, "GPS:");
+ gps_line = ti; /*we will make this more useful if we hit lon/lat later */
ppi_gps_tree= proto_item_add_subtree(ti, ett_ppi_gps);
proto_tree_add_uint(ppi_gps_tree, hf_ppi_gps_version, tvb, offset, 1, version);
proto_tree_add_item(ppi_gps_tree, hf_ppi_gps_pad, tvb, offset + 1, 1, FALSE);
ti = proto_tree_add_uint(ppi_gps_tree, hf_ppi_gps_length, tvb, offset + 2, 2, length);
}
- /* basic length sanity checking */
- if (length > PPI_GPS_MAXTAGLEN ) {
+
+ /* We support v1 and v2 of GPS tags (identical) */
+ if (! (version == 1 || version == 2) ) {
if (tree)
- proto_item_append_text(ti, "Invalid PPI-GPS length (got %d, %d max\n)", length, PPI_GPS_MAXTAGLEN);
+ proto_item_append_text(ti, "invalid version (got %d, expected 1 or 2)", version);
return;
}
- /* no minimum length check, technically zero is valid */
/* initialize the length of the actual tag contents */
length_remaining = length;
- if (version != 1) {
- if (tree)
- proto_item_append_text(ti, "invalid version (got %d, expected 1)", version);
- return;
- }
-
- /*
- * This only works if there is exactly 1 present
- * field in the header. This is not a problem as there are currently no extended bitmasks defined.
- */
+ /* minimum length check, should atleast be a fixed-size geotagging-base header*/
if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {
/*
* Base-geotag-header (Radiotap lookalike) is shorter than the fixed-length portion
* plus one "present" bitset.
*/
if (tree)
- proto_item_append_text(ti, " (bogus - minimum length is 8)");
+ proto_item_append_text(ti, " (invalid - minimum length is 8)");
+ return;
+ }
+
+ /* perform tag-specific max length sanity checking */
+ if (length > PPI_GPS_MAXTAGLEN ) {
+ if (tree)
+ proto_item_append_text(ti, "Invalid PPI-GPS length (got %d, %d max\n)", length, PPI_GPS_MAXTAGLEN);
return;
}
+
/* Subtree for the "present flags" bitfield. */
if (tree) {
pt = proto_tree_add_uint(ppi_gps_tree, hf_ppi_gps_present, tvb, offset + 4, 4, present);
@@ -474,7 +269,10 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
t_lat = tvb_get_letohl(tvb, offset);
lat = fixed3_7_to_gdouble(t_lat);
if (tree)
+ {
proto_tree_add_double(ppi_gps_tree, hf_ppi_gps_lat, tvb, offset, 4, lat);
+ proto_item_append_text(gps_line, " Lat:%f ", lat);
+ }
offset+=4;
length_remaining-=4;
break;
@@ -484,7 +282,10 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
t_lon = tvb_get_letohl(tvb, offset);
lon = fixed3_7_to_gdouble(t_lon);
if (tree)
+ {
proto_tree_add_double(ppi_gps_tree, hf_ppi_gps_lon, tvb, offset, 4, lon);
+ proto_item_append_text(gps_line, " Lon:%f ", lon);
+ }
offset+=4;
length_remaining-=4;
break;
@@ -494,7 +295,10 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
t_alt = tvb_get_letohl(tvb, offset);
alt = fixed6_4_to_gdouble(t_alt);
if (tree)
+ {
proto_tree_add_double(ppi_gps_tree, hf_ppi_gps_alt, tvb, offset, 4, alt);
+ proto_item_append_text(gps_line, " Alt:%f ", alt);
+ }
offset+=4;
length_remaining-=4;
break;
@@ -504,7 +308,10 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
t_alt_gnd = tvb_get_letohl(tvb, offset);
alt_gnd = fixed6_4_to_gdouble(t_alt_gnd);
if (tree)
+ {
proto_tree_add_double(ppi_gps_tree, hf_ppi_gps_alt_gnd, tvb, offset, 4, alt_gnd);
+ proto_item_append_text(gps_line, " Alt_g:%f ", alt_gnd);
+ }
offset+=4;
length_remaining-=4;
break;
@@ -570,7 +377,12 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (length_remaining < 32)
break;
if (tree)
- proto_tree_add_item(ppi_gps_tree, hf_ppi_gps_descr, tvb, offset, 32, FALSE);
+ {
+ /* proto_tree_add_item(ppi_gps_tree, hf_ppi_gps_descstr, tvb, offset, 32, FALSE); */
+ curr_str = tvb_format_text(tvb, offset, 32); /* need to append_text this */
+ proto_tree_add_string(ppi_gps_tree, hf_ppi_gps_descstr, tvb, offset, 32, curr_str);
+ proto_item_append_text(gps_line, " (%s)", curr_str);
+ }
offset+=32;
length_remaining-=32;
break;
@@ -609,6 +421,215 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
+void
+proto_register_ppi_gps(void) {
+ /* The following array initializes those header fields declared above to the values displayed */
+ static hf_register_info hf[] = {
+ { &hf_ppi_gps_version,
+ { "Header revision", "ppi_gps.version",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Version of ppi_gps header format", HFILL } },
+ { &hf_ppi_gps_pad,
+ { "Header pad", "ppi_gps.pad",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Padding", HFILL } },
+ { &hf_ppi_gps_length,
+ { "Header length", "ppi_gps.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Length of header including version, pad, length and data fields", HFILL } },
+ { &hf_ppi_gps_present, /* these flag fields are composed of a uint32 on the display */
+ { "Present", "ppi_gps.present",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Bitmask indicating which fields are present", HFILL } },
+
+ /* Boolean 'present' flags */
+ { &hf_ppi_gps_present_gpsflags_flags, /* followed by a lot of booleans */
+ { "GPSFlags", "ppi_gps.present.gpsflagss",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_GPSFLAGS,
+ "32-bit bitmask indicating type of GPS fix (GPS/INS/software/etc)", HFILL } },
+ { &hf_ppi_gps_present_lat,
+ { "Lat", "ppi_gps.present.lat",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_LAT,
+ "Specifies if the latitude field is present", HFILL } },
+
+ { &hf_ppi_gps_present_lon,
+ { "Lon", "ppi_gps.present.lon",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_LON,
+ "Specifies if the longitude field is present", HFILL } },
+
+ { &hf_ppi_gps_present_alt,
+ { "Alt", "ppi_gps.present.alt",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_ALT,
+ "Specifies if the altitude field is present", HFILL } },
+
+ { &hf_ppi_gps_present_alt_gnd,
+ { "Alt-gnd", "ppi_gps.present.alt_gnd",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_ALT_G,
+ "Specifies if the altitude-g field is present", HFILL } },
+
+ { &hf_ppi_gps_present_gpstime,
+ { "GPStime", "ppi_gps.present.gpstime",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_GPSTIME,
+ "Specifies if the GPS time field is present", HFILL } },
+
+
+ { &hf_ppi_gps_present_fractime,
+ { "fractime", "ppi_gps.present.fractime",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_FRACTIME,
+ "Specifies if the fractional time field is present", HFILL } },
+
+
+ { &hf_ppi_gps_present_eph,
+ { "error_h", "ppi_gps.present.eph",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPH,
+ "Specifies if the horizontal error field is present (eph)", HFILL } },
+
+ { &hf_ppi_gps_present_epv,
+ { "error_v", "ppi_gps.present.epv",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPV,
+ "Specifies if the vertical error field present (epv)", HFILL } },
+
+
+ { &hf_ppi_gps_present_ept,
+ { "error_t", "ppi_gps.present.ept",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EPT,
+ "Specifies if the estimed time error field is present (ept)", HFILL } },
+
+ { &hf_ppi_gps_present_descr,
+ { "Description", "ppi_gps.present.descr",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_DESCRSTR,
+ "Specifies if the (ASCII) description is present", HFILL } },
+
+ { &hf_ppi_gps_present_appspecific_num,
+ { "AppId", "ppi_gps.present.appid",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_APPID,
+ "Specifies if the application specific field id is present", HFILL } },
+
+ { &hf_ppi_gps_present_appspecific_data,
+ { "AppData", "ppi_gps.present.appdata",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_APPDATA,
+ "Specifies if the application specific data field is present", HFILL } },
+
+ { &hf_ppi_gps_present_ext,
+ { "Ext", "ppi_gps.present.ext",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_MASK_EXT,
+ "Specifies if there are any extensions to the header present", HFILL } },
+
+ /* ---Now we get to the actual data fields--- */
+
+ { &hf_ppi_gps_gpsflags_flags,
+ { "GPSFlags", "ppi_gps.gpsflags",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Bitmask indicating GPS/INS/manual fix", HFILL } },
+ { &hf_ppi_gps_lat,
+ { "Latitude", "ppi_gps.lat",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Latitude packet was received at", HFILL } },
+ { &hf_ppi_gps_lon,
+ { "Longitude", "ppi_gps.lon",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Longitude packet was received at", HFILL } },
+ { &hf_ppi_gps_alt,
+ { "Altitude", "ppi_gps.alt",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Altitude packet was received at", HFILL } },
+ { &hf_ppi_gps_alt_gnd,
+ { "Altitude_gnd", "ppi_gps.alt_gnd",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Altitude packet was received at (relative to ground)", HFILL } },
+ { &hf_ppi_gps_gpstime,
+ { "GPSTimestamp", "ppi_gps.gpstime",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
+ "GPSTimestamp packet was received at", HFILL } },
+ { &hf_ppi_gps_fractime,
+ { "fractional Timestamp", "ppi_gps.fractime",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "fractional GPSTimestamp packet was received at", HFILL } },
+ { &hf_ppi_gps_eph,
+ { "Horizontal Error (m)", "ppi_gps.eph",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Horizontal margin of error (meters)", HFILL } },
+ { &hf_ppi_gps_epv,
+ { "Vertical Error (m)", "ppi_gps.epv",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Vertical margin of error (meters)", HFILL } },
+ { &hf_ppi_gps_ept,
+ { "Time Error (s)", "ppi_gps.ept",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Time margin of error (secs)", HFILL } },
+ { &hf_ppi_gps_descstr,
+ { "Description", "ppi_gps.descr",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL } },
+ { &hf_ppi_gps_appspecific_num,
+ { "Application Specific id", "ppi_gps.appid",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Application-specific identifier", HFILL } },
+ { &hf_ppi_gps_appspecific_data,
+ { "Application specific data", "ppi_gps.appdata",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL } },
+
+ /* --- moving on to the 'FixType' flags --- */
+#define PPI_GPS_GPSFLAGS_FLAG0_NOFIX 0x00000001
+#define PPI_GPS_GPSFLAGS_FLAG1_GPS 0x00000002
+#define PPI_GPS_GPSFLAGS_FLAG2_DIFFGPS 0x00000004
+#define PPI_GPS_GPSFLAGS_FLAG3_PPS 0x00000008
+#define PPI_GPS_GPSFLAGS_FLAG4_RTK 0x00000010
+#define PPI_GPS_GPSFLAGS_FLAG5_FLOATRTK 0x00000020
+#define PPI_GPS_GPSFLAGS_FLAG6_DEAD_RECK 0x00000040
+#define PPI_GPS_GPSFLAGS_FLAG7_MANUAL 0x00000080
+#define PPI_GPS_GPSFLAGS_FLAG8_SIM 0x00000100
+ { &hf_ppi_gps_gpsflags_flag0_nofix, /* no fix available */
+ { "No fix available", "ppi_gps.gpsflagss.nofix",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG0_NOFIX,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag1_gpsfix, /* GPSfix available */
+ { "GPS provided fix", "ppi_gps.gpsflagss.gps",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG1_GPS,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag2_diffgps, /* Differential GPS fix available */
+ { "Differential GPS provided fix", "ppi_gps.gpsflagss.diffgps",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG2_DIFFGPS,
+ "DGPS provided fix", HFILL } },
+ { &hf_ppi_gps_gpsflags_flag3_PPS, /* PPS fix */
+ { "PPS fix", "ppi_gps.gpsflagss.pps",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG3_PPS,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag4_RTK, /* RTK fix*/
+ { "RTK fix", "ppi_gps.gpsflagss.rtk",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG4_RTK,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag5_floatRTK, /*float RTK */
+ { "floatRTK fix", "ppi_gps.gpsflagss.frtk",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG5_FLOATRTK,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag6_dead_reck, /*dead reckoning */
+ { "dead reckoning fix", "ppi_gps.gpsflagss.dead_reck",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG6_DEAD_RECK,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag7_manual, /* manual */
+ { "manual fix", "ppi_gps.gpsflagss.manual",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG7_MANUAL,
+ NULL, HFILL } },
+ { &hf_ppi_gps_gpsflags_flag8_sim, /* simulation */
+ { "simulated fix", "ppi_gps.gpsflagss.simulation",
+ FT_BOOLEAN, 32, NULL, PPI_GPS_GPSFLAGS_FLAG8_SIM,
+ NULL, HFILL } },
+
+ };
+ static gint *ett[] = {
+ &ett_ppi_gps,
+ &ett_ppi_gps_present,
+ &ett_ppi_gps_gpsflags_flags
+ };
+
+ proto_ppi_gps = proto_register_protocol("PPI Geotagging GPS tag decoder", "PPI GPS Decoder", "ppi_gps");
+ proto_register_field_array(proto_ppi_gps, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("ppi_gps", dissect_ppi_gps, proto_ppi_gps);
+}
+
/*
* Editor modelines
*
@@ -621,6 +642,3 @@ void dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
* ex: set shiftwidth=4 tabstop=8 expandtab
* :indentSize=4:tabSize=8:noTabs=true:
*/
-
-
-
diff --git a/epan/dissectors/packet-ppi-sensor.c b/epan/dissectors/packet-ppi-sensor.c
new file mode 100644
index 0000000000..b94e8c1fa9
--- /dev/null
+++ b/epan/dissectors/packet-ppi-sensor.c
@@ -0,0 +1,565 @@
+/* packet-ppi-sensor.c
+ * Routines for PPI-GEOLOCATION-SENSOR dissection
+ * Copyright 2010, Harris Corp, jellch@harris.com
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * Copied from packet-ppi-antenna.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <string.h>
+
+#include <epan/packet.h>
+#include <epan/ptvcursor.h>
+#include <epan/prefs.h>
+#include <epan/reassemble.h>
+#include <epan/dissectors/packet-ppi-geolocation-common.h>
+
+enum ppi_sensor_type {
+ PPI_SENSOR_SENSORTYPE = 0, /* Velocity, Acceleration, etc */
+ PPI_SENSOR_SCALEFACTOR = 1, /* 10^scalefactor applied to all values */
+ PPI_SENSOR_VAL_X = 2, /* X-dimension reading */
+ PPI_SENSOR_VAL_Y = 3, /* Y-dimension reading */
+ PPI_SENSOR_VAL_Z = 4, /* Z-dimension reading */
+ PPI_SENSOR_VAL_T = 5, /* Total reading */
+ PPI_SENSOR_VAL_E = 6, /* Error reading */
+ PPI_SENSOR_DESCSTR = 28, /*32 bytes, fixed length, null terminated description of what the sensor is for */
+ PPI_SENSOR_APPID = 29, /*4-byte identifier*/
+ PPI_SENSOR_APPDATA = 30, /* 60-byte app-id specific data*/
+ PPI_SENSOR_EXT = 31 /* Indicates n extended bitmap follows */
+};
+#define PPI_SENSOR_MAXTAGLEN 127 /* Increase as fields are added */
+
+
+/*Sensor types */
+#define SENSOR_RESERVED0 0
+/*The values of these sensors corresponds to the order of their derivatives. double geek win */
+#define SENSOR_VELOCITY 1
+#define SENSOR_ACCELERATION 2
+#define SENSOR_JERK 3
+#define SENSOR_ROTATION 100
+#define SENSOR_MAGNETIC 101
+#define SENSOR_TEMPERATURE 1000
+#define SENSOR_BAROMETER 1001
+#define SENSOR_HUMIDITY 1002
+#define SENSOR_TDOA_CLOCK 2000
+#define SENSOR_PHASE 2001
+
+static const value_string sensor_type_str[] = {
+ { SENSOR_RESERVED0, "Reserved" },
+ { SENSOR_VELOCITY, "Velocity"},
+ { SENSOR_ACCELERATION, "Acceleration"},
+ { SENSOR_JERK, "Jerk"},
+ { SENSOR_ROTATION, "Rotation"},
+ { SENSOR_MAGNETIC, "Magnetic"},
+ { SENSOR_TEMPERATURE, "Temperature"},
+ { SENSOR_BAROMETER, "Barometer"},
+ { SENSOR_HUMIDITY, "Humidity"},
+ { SENSOR_TDOA_CLOCK, "TDOA_Clock"},
+ { SENSOR_PHASE, "Phase"},
+ { 0, NULL}
+ };
+
+static const value_string sensor_unit_str[] = {
+ { SENSOR_RESERVED0, "Reserved" },
+ { SENSOR_VELOCITY, "Meters/sec"},
+ { SENSOR_ACCELERATION, "Meters/sec/sec"},
+ { SENSOR_JERK, "Meters/sec/sec/sec"},
+ { SENSOR_ROTATION, "Degrees/sec"},
+ { SENSOR_MAGNETIC, "Tesla"},
+ { SENSOR_TEMPERATURE, "Degrees Celsius"},
+ { SENSOR_BAROMETER, "Pascal"},
+ { SENSOR_HUMIDITY, "Humidity"},
+ { SENSOR_TDOA_CLOCK, "Seconds"},
+ { SENSOR_PHASE, "Degrees"},
+ { 0, NULL}
+ };
+
+/* protocol */
+static int proto_ppi_sensor = -1;
+
+static int hf_ppi_sensor_version = -1;
+static int hf_ppi_sensor_pad = -1;
+static int hf_ppi_sensor_length = -1;
+static int hf_ppi_sensor_present = -1;
+static int hf_ppi_sensor_sensortype = -1;
+static int hf_ppi_sensor_scalefactor = -1;
+static int hf_ppi_sensor_val_x = -1;
+static int hf_ppi_sensor_val_y= -1;
+static int hf_ppi_sensor_val_z= -1;
+static int hf_ppi_sensor_val_t= -1;
+static int hf_ppi_sensor_val_e = -1;
+static int hf_ppi_sensor_descstr = -1;
+static int hf_ppi_sensor_appspecific_num = -1; /* 4-byte tag no */
+static int hf_ppi_sensor_appspecific_data = -1; /* 60 byte arbitrary data */
+
+
+/* "Present" flags */
+/* These represent decoded-bits in the gui */
+static int hf_ppi_sensor_present_sensortype = -1;
+static int hf_ppi_sensor_present_scalefactor = -1;
+static int hf_ppi_sensor_present_val_x= -1;
+static int hf_ppi_sensor_present_val_y= -1;
+static int hf_ppi_sensor_present_val_z= -1;
+static int hf_ppi_sensor_present_val_t= -1;
+static int hf_ppi_sensor_present_val_e = -1;
+static int hf_ppi_sensor_present_descstr = -1;
+static int hf_ppi_sensor_present_appspecific_num = -1;
+static int hf_ppi_sensor_present_appspecific_data = -1;
+static int hf_ppi_sensor_present_ext = -1;
+
+
+/* These represent arrow-dropdownthings in the gui */
+static gint ett_ppi_sensor = -1;
+static gint ett_ppi_sensor_present = -1;
+
+
+static void
+dissect_ppi_sensor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
+/* used with ScaleFactor */
+gdouble base_10_expt(int power)
+{
+ gint64 ret = 1;
+ int provide_frac = 0;
+
+ if (power == 0) /* likely*/
+ return 1;
+
+ /* if negative, negate when we return*/
+ if (power < 0)
+ {
+ power *= -1;
+ provide_frac = 1;
+ }
+ while (power > 0)
+ {
+ ret = ret * 10;
+ power--;
+ }
+ if (! provide_frac)
+ return ret;
+ else
+ return (1.0/ret);
+}
+void dissect_ppi_sensor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+ /* The fixed values up front */
+ guint32 version;
+ guint length;
+ guint length_remaining;
+
+ proto_tree *ppi_sensor_tree = NULL;
+ proto_tree *present_tree = NULL;
+ proto_tree *pt, *my_pt;
+ proto_item *ti = NULL;
+ proto_item *sensor_line = NULL;
+ /* sensor type in english */
+ const gchar *type_str = "Uknown sensor";
+ const gchar *unit_str = "Unknown unit";
+
+ /* bits*/
+ int bit;
+ guint32 present, next_present;
+ int offset = 0;
+ /* values actually read out, for displaying */
+ guint16 sensortype =0;
+ gchar scalefactor = 0;
+ gdouble c_val=0; /*curr val */
+ guint32 val_t=0; /*temp curr val*/
+ guint32 t_appspecific_num; /* temporary conversions */
+
+ gdouble curr_native_val; /* this will have scaling_factor applied. displayed in sensor line */
+ gchar* curr_str;
+
+
+
+ /* Clear out stuff in the info column */
+ if (check_col(pinfo->cinfo,COL_INFO)) {
+ col_clear(pinfo->cinfo,COL_INFO);
+ }
+ /* pull out the first three fields of the BASE-GEOTAG-HEADER */
+ version = tvb_get_guint8(tvb, offset);
+ length = tvb_get_letohs(tvb, offset+2);
+ present = tvb_get_letohl(tvb, offset+4);
+
+ /* Setup basic column info */
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Sensor info v%u, Length %u ",
+ version, length);
+
+ /* Create the basic dissection tree*/
+ if (tree) {
+ ti = proto_tree_add_protocol_format(tree, proto_ppi_sensor,
+ tvb, 0, length, "PPI Sensor Header v%u, Length %u", version, length);
+ sensor_line = ti; /* we will almost definitely overwrite this in the field processing below */
+
+ /*Add in the fixed ppi-geotagging-header fields: ver, pad, len */
+ ppi_sensor_tree= proto_item_add_subtree(ti, ett_ppi_sensor);
+ proto_tree_add_uint(ppi_sensor_tree, hf_ppi_sensor_version,
+ tvb, offset, 1, version);
+ proto_tree_add_item(ppi_sensor_tree, hf_ppi_sensor_pad,
+ tvb, offset + 1, 1, FALSE);
+ ti = proto_tree_add_uint(ppi_sensor_tree, hf_ppi_sensor_length,
+ tvb, offset + 2, 2, length);
+ /*fixed ppi-geotagging-header fields finished, move onto the fields marked present*/
+ }
+
+ /* We support v1 and v2 of Sensor tags (identical) */
+ if (! (version == 1 || version == 2) ) {
+ if (tree)
+ proto_item_append_text(ti, "invalid version (got %d, expected 1 or 2)", version);
+ return;
+ }
+
+ length_remaining = length;
+ /* minimum length check, should atleast be a fixed-size geotagging-base header*/
+ if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {
+ /*
+ * Base-geotag-header (Radiotap lookalike) is shorter than the fixed-length portion
+ * plus one "present" bitset.
+ */
+ if (tree)
+ proto_item_append_text(ti, " (invalid - minimum length is 8)");
+ return;
+ }
+
+ /* perform max length sanity checking */
+ if (length > PPI_SENSOR_MAXTAGLEN ) {
+ if (tree)
+ proto_item_append_text(ti, "Invalid PPI-Sensor length (got %d, %d max\n)", length, PPI_SENSOR_MAXTAGLEN);
+ return;
+ }
+
+
+ /* Subtree for the "present flags" bitfield. */
+ if (tree) {
+ pt = proto_tree_add_uint(ppi_sensor_tree, hf_ppi_sensor_present, tvb, offset + 4, 4, present);
+ present_tree = proto_item_add_subtree(pt, ett_ppi_sensor_present); /* this represents the present bitmask field */
+
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_sensortype, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_scalefactor, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_val_x, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_val_y, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_val_z, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_val_t, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_val_e, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_descstr, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_appspecific_num, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_appspecific_data, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_sensor_present_ext, tvb, 4, 4, TRUE);
+ }
+ offset += PPI_GEOBASE_MIN_HEADER_LEN;
+ length_remaining -= PPI_GEOBASE_MIN_HEADER_LEN;
+
+ /* Now all of the fixed length, fixed location stuff is over. Loop over the bits */
+ for (; present; present = next_present) {
+ /* clear the least significant bit that is set */
+ next_present = present & (present - 1);
+ /* extract the least significant bit that is set */
+ bit = BITNO_32(present ^ next_present);
+ switch (bit) {
+ case PPI_SENSOR_SENSORTYPE:
+ if (length_remaining < 2)
+ break;
+ sensortype= tvb_get_letohs(tvb, offset);
+ type_str = val_to_str_const (sensortype, sensor_type_str, "Unknown Sensor type");
+ unit_str = val_to_str_const (sensortype, sensor_unit_str, "Unknown Unit");
+
+ if (tree) {
+ my_pt = proto_tree_add_uint(ppi_sensor_tree, hf_ppi_sensor_sensortype, tvb, offset , 2, sensortype);
+ proto_item_append_text (my_pt, " %s", type_str);
+ proto_item_set_text(sensor_line, "Sensor: %s", type_str);
+ }
+ offset+=2;
+ length_remaining-=2;
+ break;
+ case PPI_SENSOR_SCALEFACTOR:
+ if (length_remaining < 1)
+ break;
+ scalefactor = (gchar) tvb_get_guint8(tvb, offset);
+ if (tree) {
+
+ proto_tree_add_int(ppi_sensor_tree, hf_ppi_sensor_scalefactor, tvb, offset, 1, scalefactor);
+ }
+ offset+=1;
+ length_remaining-=1;
+ break;
+ case PPI_SENSOR_VAL_X:
+ if (length_remaining < 4)
+ break;
+ val_t = tvb_get_letohl(tvb, offset);
+ c_val = fixed6_4_to_gdouble(val_t);
+ if (tree) {
+ my_pt = proto_tree_add_double(ppi_sensor_tree, hf_ppi_sensor_val_x, tvb, offset, 4, c_val);
+ proto_item_append_text (my_pt, " %s", unit_str);
+ curr_native_val = c_val * base_10_expt(scalefactor); /* this will almost always be eqaul to the original val */
+ proto_item_set_text(sensor_line, "Sensor: %s %f %s", type_str, curr_native_val, unit_str);
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+ case PPI_SENSOR_VAL_Y:
+ if (length_remaining < 4)
+ break;
+ val_t = tvb_get_letohl(tvb, offset);
+ c_val = fixed6_4_to_gdouble(val_t);
+ if (tree) {
+ my_pt = proto_tree_add_double(ppi_sensor_tree, hf_ppi_sensor_val_y, tvb, offset, 4, c_val);
+ proto_item_append_text (my_pt, " %s", unit_str);
+ curr_native_val = c_val * base_10_expt(scalefactor); /* this will almost always be eqaul to the original val */
+ proto_item_set_text(sensor_line, "Sensor: %s %f %s", type_str, curr_native_val, unit_str);
+
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+ case PPI_SENSOR_VAL_Z:
+ if (length_remaining < 4)
+ break;
+ val_t = tvb_get_letohl(tvb, offset);
+ c_val = fixed6_4_to_gdouble(val_t);
+ if (tree) {
+ my_pt = proto_tree_add_double(ppi_sensor_tree, hf_ppi_sensor_val_z, tvb, offset, 4, c_val);
+ proto_item_append_text (my_pt, " %s", unit_str);
+ curr_native_val = c_val * base_10_expt(scalefactor); /* this will almost always be eqaul to the original val */
+ proto_item_set_text(sensor_line, "Sensor: %s %f %s", type_str, curr_native_val, unit_str);
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+ case PPI_SENSOR_VAL_T:
+ if (length_remaining < 4)
+ break;
+ val_t = tvb_get_letohl(tvb, offset);
+ c_val = fixed6_4_to_gdouble(val_t);
+ if (tree) {
+ my_pt = proto_tree_add_double(ppi_sensor_tree, hf_ppi_sensor_val_t, tvb, offset, 4, c_val);
+ proto_item_append_text (my_pt, " %s", unit_str);
+ curr_native_val = c_val * base_10_expt(scalefactor); /* this will almost always be eqaul to the original val */
+ proto_item_set_text(sensor_line, "Sensor: %s %f %s", type_str, curr_native_val, unit_str);
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+ case PPI_SENSOR_VAL_E:
+ if (length_remaining < 4)
+ break;
+ val_t = tvb_get_letohl(tvb, offset);
+ c_val = fixed6_4_to_gdouble(val_t);
+ if (tree) {
+ my_pt = proto_tree_add_double(ppi_sensor_tree, hf_ppi_sensor_val_e, tvb, offset, 4, c_val);
+ proto_item_append_text (my_pt, " %s", unit_str);
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+
+ case PPI_SENSOR_DESCSTR:
+ if (length_remaining < 32)
+ break;
+ if (tree)
+ {
+ /* proto_tree_add_item(ppi_vector_tree, hf_ppi_vector_descstr, tvb, offset, 32, ENC_NA); */
+ curr_str = tvb_format_text(tvb, offset, 32);
+ proto_tree_add_string(ppi_sensor_tree, hf_ppi_sensor_descstr, tvb, offset, 32, curr_str);
+ proto_item_append_text(sensor_line, " (%s)", curr_str);
+ }
+ offset+=32;
+ length_remaining-=32;
+ break;
+ case PPI_SENSOR_APPID:
+ if (length_remaining < 4)
+ break;
+ t_appspecific_num = tvb_get_letohl(tvb, offset); /* application specific parsers may switch on this later */
+ if (tree) {
+ proto_tree_add_uint(ppi_sensor_tree, hf_ppi_sensor_appspecific_num, tvb, offset, 4, t_appspecific_num);
+ }
+ offset+=4;
+ length_remaining-=4;
+ break;
+ case PPI_SENSOR_APPDATA:
+ if (length_remaining < 60)
+ break;
+ if (tree) {
+ proto_tree_add_item(ppi_sensor_tree, hf_ppi_sensor_appspecific_data, tvb, offset, 60, FALSE);
+ }
+ offset+=60;
+ length_remaining-=60;
+ break;
+ default:
+ /*
+ * This indicates a field whose size we do not
+ * know, so we cannot proceed.
+ */
+ proto_tree_add_text(ppi_sensor_tree, tvb, offset, 0, "Error: PPI-SENSOR: unknown bit (%d) set in present field.\n", bit);
+ next_present = 0;
+ continue;
+ }
+
+ };
+ return;
+}
+
+void
+proto_register_ppi_sensor(void) {
+ /* The following array initializes those header fields declared above to the values displayed */
+ static hf_register_info hf[] = {
+ { &hf_ppi_sensor_version,
+ { "Header revision", "ppi_sensor.version",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Version of ppi_sensor header format", HFILL } },
+ { &hf_ppi_sensor_pad,
+ { "Header pad", "ppi_sensor.pad",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Padding", HFILL } },
+ { &hf_ppi_sensor_length,
+ { "Header length", "ppi_sensor.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Length of header including version, pad, length and data fields", HFILL } },
+ { &hf_ppi_sensor_present,
+ { "Present", "ppi_sensor.present",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating which fields are present", HFILL } },
+
+ /* This first set is for the base_tag_header.it_present bitfield */
+#define PPI_SENSOR_MASK_SENSORTYPE 0x00000001 /* 0 */
+#define PPI_SENSOR_MASK_SCALEFACTOR 0x00000002 /* 1 */
+#define PPI_SENSOR_MASK_VAL_X 0x00000004 /* 2 */
+#define PPI_SENSOR_MASK_VAL_Y 0x00000008 /* 3 */
+#define PPI_SENSOR_MASK_VAL_Z 0x00000010 /* 4 */
+#define PPI_SENSOR_MASK_VAL_T 0x00000020 /* 5 */
+#define PPI_SENSOR_MASK_VAL_E 0x00000040 /* 6 */
+#define PPI_SENSOR_MASK_SERIALNUM 0x04000000 /* 26 */
+#define PPI_SENSOR_MASK_MODELSTR 0x08000000 /* 27 */
+#define PPI_SENSOR_MASK_DESCSTR 0x10000000 /* 28 */
+#define PPI_SENSOR_MASK_APPID 0x20000000 /* 29 */
+#define PPI_SENSOR_MASK_APPDATA 0x40000000 /* 30 */
+#define PPI_SENSOR_MASK_EXT 0x80000000 /* 31 */
+
+ /* Boolean 'present' flags */
+ { &hf_ppi_sensor_present_sensortype,
+ { "sensortype", "ppi_sensor.present.sensortype",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_SENSORTYPE,
+ "Specifies if the sensor type field is present", HFILL } },
+ { &hf_ppi_sensor_present_scalefactor,
+ { "scalefactor", "ppi_sensor.present.scalefactor",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_SCALEFACTOR,
+ "Specifies if the sensor scale factor field is present", HFILL } },
+
+ { &hf_ppi_sensor_present_val_x,
+ { "val_x", "ppi_sensor.present.val_x",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_VAL_X,
+ "Specifies if the sensor val_x field is present", HFILL } },
+ { &hf_ppi_sensor_present_val_y,
+ { "val_y", "ppi_sensor.present.val_y",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_VAL_Y,
+ "Specifies if the sensor val_y field is present", HFILL } },
+ { &hf_ppi_sensor_present_val_z,
+ { "val_z", "ppi_sensor.present.val_z",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_VAL_Z,
+ "Specifies if the BeamID field is present", HFILL } },
+
+ { &hf_ppi_sensor_present_val_t,
+ { "val_t", "ppi_sensor.present.val_t",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_VAL_T,
+ "Specifies if the val_t field is present", HFILL } },
+ { &hf_ppi_sensor_present_val_e,
+ { "val_e", "ppi_sensor.present.val_e",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_VAL_E,
+ "Specifies if the val_e field is present", HFILL } },
+
+ { &hf_ppi_sensor_present_descstr,
+ { "Description", "ppi_sensor.present.descr",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_DESCSTR,
+ "Specifies if the description string is present", HFILL } },
+ { &hf_ppi_sensor_present_appspecific_num,
+ { "appid", "ppi_sensor.present.appid",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_APPID,
+ "Specifies if the application specific field id is present", HFILL } },
+ { &hf_ppi_sensor_present_appspecific_data,
+ { "appdata", "ppi_sensor.present.appdata",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_APPDATA,
+ "Specifies if the application specific data field is present", HFILL } },
+ { &hf_ppi_sensor_present_ext,
+ { "ext", "ppi_sensor.present.ext",
+ FT_BOOLEAN, 32, NULL, PPI_SENSOR_MASK_EXT,
+ "Specifies if there are any extensions to the header present", HFILL } },
+
+
+ /* Now we get to the actual data fields */
+ { &hf_ppi_sensor_sensortype,
+ { "SensorType", "ppi_sensor.sensortype",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Type of sensor", HFILL } },
+ { &hf_ppi_sensor_scalefactor,
+ { "ScaleFactor", "ppi_sensor.scalefactor",
+ FT_INT8, BASE_DEC, NULL, 0x0,
+ "Scaling factor", HFILL } },
+ { &hf_ppi_sensor_val_x,
+ { "Val_X", "ppi_sensor.val_x",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Value in X-dimesion", HFILL } },
+ { &hf_ppi_sensor_val_y,
+ { "Val_Y", "ppi_sensor.val_y",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Value in Y-dimension", HFILL } },
+ { &hf_ppi_sensor_val_z,
+ { "Val_Z", "ppi_sensor.val_z",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Value in Z-dimension", HFILL } },
+ { &hf_ppi_sensor_val_t,
+ { "Val_T", "ppi_sensor.val_t",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Value total (dimensionless)", HFILL } },
+ { &hf_ppi_sensor_val_e,
+ { "Val_E", "ppi_sensor.val_e",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Margin of error", HFILL } },
+
+
+ { &hf_ppi_sensor_descstr,
+ { "Description", "ppi_sensor.descr",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL } } ,
+ { &hf_ppi_sensor_appspecific_num,
+ { "Application Specific id", "ppi_sensor.appid",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Application-specific identifier", HFILL } },
+ { &hf_ppi_sensor_appspecific_data,
+ { "Application specific data", "ppi_sensor.appdata",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ "Application-specific data", HFILL } },
+ };
+ static gint *ett[] = {
+ &ett_ppi_sensor,
+ &ett_ppi_sensor_present,
+ };
+
+ proto_ppi_sensor = proto_register_protocol("PPI sensor decoder", "PPI sensor Decoder", "ppi_sensor");
+ proto_register_field_array(proto_ppi_sensor, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("ppi_sensor", dissect_ppi_sensor, proto_ppi_sensor);
+
+}
diff --git a/epan/dissectors/packet-ppi-vector.c b/epan/dissectors/packet-ppi-vector.c
index bb7466e6e8..f17b71eb0b 100644
--- a/epan/dissectors/packet-ppi-vector.c
+++ b/epan/dissectors/packet-ppi-vector.c
@@ -44,27 +44,66 @@ enum ppi_vector_type {
PPI_VECTOR_ROTX = 2,
PPI_VECTOR_ROTY = 3,
PPI_VECTOR_ROTZ = 4,
- PPI_VECTOR_OFF_R = 5,
- PPI_VECTOR_OFF_F = 6,
- PPI_VECTOR_OFF_U = 7,
- PPI_VECTOR_VEL_R = 8,
- PPI_VECTOR_VEL_F = 9,
- PPI_VECTOR_VEL_U = 10,
- PPI_VECTOR_VEL_T = 11,
- PPI_VECTOR_ACC_R = 12,
- PPI_VECTOR_ACC_F = 13,
- PPI_VECTOR_ACC_U = 14,
- PPI_VECTOR_ACC_T = 15,
+ PPI_VECTOR_OFF_X = 5,
+ PPI_VECTOR_OFF_Y = 6,
+ PPI_VECTOR_OFF_Z = 7,
+
PPI_VECTOR_ERR_ROT = 16,
PPI_VECTOR_ERR_OFF = 17,
- PPI_VECTOR_ERR_VEL = 18,
- PPI_VECTOR_ERR_ACC = 19,
PPI_VECTOR_DESCSTR = 28,
PPI_VECTOR_APPID = 29,
PPI_VECTOR_APPDATA = 30,
PPI_VECTOR_EXT = 31
};
+#define PPI_VECTOR_MAXTAGLEN 144 /* increase as fields are added */
+
+/* There are currently eight vector characteristics.
+ * These are purely descriptive (no mathematical importance)
+ */
+#define PPI_VECTOR_VCHARS_ANTENNA 0x00000001
+#define PPI_VECTOR_VCHARS_DIR_OF_TRAVEL 0x00000002
+#define PPI_VECTOR_VCHARS_FRONT_OF_VEH 0x00000004
+#define PPI_VECTOR_VCHARS_AOA 0x00000008
+#define PPI_VECTOR_VCHARS_TRANSMITTER_POS 0x00000010
+
+#define PPI_VECTOR_VCHARS_GPS_DERIVED 0x00000100
+#define PPI_VECTOR_VCHARS_INS_DERIVED 0x00000200
+#define PPI_VECTOR_VCHARS_COMPASS_DERIVED 0x00000400
+#define PPI_VECTOR_VCHARS_ACCELEROMETER_DERIVED 0x00000800
+#define PPI_VECTOR_VCHARS_HUMAN_DERIVED 0x00001000
+
+#define PPI_VECTOR_MASK_VFLAGS 0x00000001
+#define PPI_VECTOR_MASK_VCHARS 0x00000002
+#define PPI_VECTOR_MASK_ROTX 0x00000004
+#define PPI_VECTOR_MASK_ROTY 0x00000008
+#define PPI_VECTOR_MASK_ROTZ 0x00000010
+#define PPI_VECTOR_MASK_OFF_X 0x00000020
+#define PPI_VECTOR_MASK_OFF_Y 0x00000040
+#define PPI_VECTOR_MASK_OFF_Z 0x00000080
+
+#define PPI_VECTOR_MASK_ERR_ROT 0x00010000
+#define PPI_VECTOR_MASK_ERR_OFF 0x00020000
+
+#define PPI_VECTOR_MASK_DESCSTR 0x10000000 /* 28 */
+#define PPI_VECTOR_MASK_APPID 0x20000000 /* 29 */
+#define PPI_VECTOR_MASK_APPDATA 0x40000000 /* 30 */
+#define PPI_VECTOR_MASK_EXT 0x80000000 /* 31 */
+
+/* There are currently only three vector flags.
+ * These control the units/interpreration of a vector
+ */
+#define PPI_VECTOR_VFLAGS_DEFINES_FORWARD 0x00000001
+#define PPI_VECTOR_VFLAGS_RELATIVE_TO 0x00000006 /* 2 bits */
+
+/* Values for the two-bit RelativeTo subfield of vflags */
+static const value_string relativeto_string[] = {
+{ 0x00, "Forward"},
+{ 0x01, "Earth"},
+{ 0x02, "Current"},
+{ 0x03, "Reserved"},
+{ 0x00, NULL}
+};
/* protocol */
@@ -80,22 +119,12 @@ static int hf_ppi_vector_vchars = -1;
static int hf_ppi_vector_rot_x = -1;
static int hf_ppi_vector_rot_y = -1;
static int hf_ppi_vector_rot_z = -1;
-static int hf_ppi_vector_off_r = -1;
-static int hf_ppi_vector_off_f = -1;
-static int hf_ppi_vector_off_u = -1;
-static int hf_ppi_vector_vel_r = -1;
-static int hf_ppi_vector_vel_f = -1;
-static int hf_ppi_vector_vel_u = -1;
-static int hf_ppi_vector_vel_t = -1;
-static int hf_ppi_vector_acc_r = -1;
-static int hf_ppi_vector_acc_f = -1;
-static int hf_ppi_vector_acc_u = -1;
-static int hf_ppi_vector_acc_t = -1;
+static int hf_ppi_vector_off_x = -1;
+static int hf_ppi_vector_off_y = -1;
+static int hf_ppi_vector_off_z = -1;
static int hf_ppi_vector_err_rot= -1;
static int hf_ppi_vector_err_off= -1;
-static int hf_ppi_vector_err_vel= -1;
-static int hf_ppi_vector_err_acc= -1;
static int hf_ppi_vector_descstr= -1;
static int hf_ppi_vector_appspecific_num = -1;
static int hf_ppi_vector_appspecific_data = -1;
@@ -106,33 +135,22 @@ static int hf_ppi_vector_present_vchars = -1;
static int hf_ppi_vector_present_val_x = -1;
static int hf_ppi_vector_present_val_y = -1;
static int hf_ppi_vector_present_val_z = -1;
-static int hf_ppi_vector_present_off_r = -1;
-static int hf_ppi_vector_present_off_f = -1;
-static int hf_ppi_vector_present_off_u = -1;
-static int hf_ppi_vector_present_vel_r = -1;
-static int hf_ppi_vector_present_vel_f = -1;
-static int hf_ppi_vector_present_vel_u = -1;
-static int hf_ppi_vector_present_vel_t = -1;
-static int hf_ppi_vector_present_acc_r = -1;
-static int hf_ppi_vector_present_acc_f = -1;
-static int hf_ppi_vector_present_acc_u = -1;
-static int hf_ppi_vector_present_acc_t = -1;
+static int hf_ppi_vector_present_off_x = -1;
+static int hf_ppi_vector_present_off_y = -1;
+static int hf_ppi_vector_present_off_z = -1;
static int hf_ppi_vector_present_err_rot = -1;
static int hf_ppi_vector_present_err_off = -1;
-static int hf_ppi_vector_present_err_vel = -1;
-static int hf_ppi_vector_present_err_acc = -1;
static int hf_ppi_vector_present_descstr= -1;
static int hf_ppi_vector_presenappsecific_num = -1;
static int hf_ppi_vector_present_appspecific_data = -1;
static int hf_ppi_vector_present_ext = -1;
/* VectorFlags bits */
-/* There are currently only three vector flags.
+/* There are currently only three bits and two fields defined in vector flags.
* These control the units/interpreration of a vector
*/
-static int hf_ppi_vector_vflags_defines_forward = -1;
-static int hf_ppi_vector_vflags_rots_absolute = -1; /* different ways to display the same bit, hi or low */
-static int hf_ppi_vector_vflags_offsets_from_gps = -1; /* these are different ways to display the same bit, hi or low */
+static int hf_ppi_vector_vflags_defines_forward = -1; /* bit 0 */
+static int hf_ppi_vector_vflags_relative_to= -1; /* bits 1 and 2 */
/* There are currently eight vector characteristics.
* These are purely descriptive (no mathematical importance)
@@ -140,6 +158,8 @@ static int hf_ppi_vector_vflags_offsets_from_gps = -1; /* these are different wa
static int hf_ppi_vector_vchars_antenna = -1;
static int hf_ppi_vector_vchars_dir_of_travel = -1;
static int hf_ppi_vector_vchars_front_of_veh = -1;
+static int hf_ppi_vector_vchars_angle_of_arrival= -1;
+static int hf_ppi_vector_vchars_transmitter_pos= -1;
static int hf_ppi_vector_vchars_gps_derived = -1;
static int hf_ppi_vector_vchars_ins_derived = -1;
@@ -155,358 +175,22 @@ static gint ett_ppi_vectorchars= -1;
static void dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
+/* We want to abbreviate this field into a single line. Does so without any string maniuplation */
void
-proto_register_ppi_vector(void)
+annotate_vector_chars(guint32 chars, proto_tree *my_pt)
{
- /* The following array initializes those header fields declared above to the values displayed */
- static hf_register_info hf[] = {
- { &hf_ppi_vector_version,
- { "Header revision", "ppi_vector.version",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Version of ppi_vector header format", HFILL } },
- { &hf_ppi_vector_pad,
- { "Header pad", "ppi_vector.pad",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- "Padding", HFILL } },
- { &hf_ppi_vector_length,
- { "Header length", "ppi_vector.length",
- FT_UINT16, BASE_DEC, NULL, 0x0,
- "Length of header including version, pad, length and data fields", HFILL } },
- { &hf_ppi_vector_present,
- { "Present", "ppi_vector.present",
- FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating which fields are present", HFILL } },
-
-#define PPI_VECTOR_MASK_VFLAGS 0x00000001
-#define PPI_VECTOR_MASK_VCHARS 0x00000002
-#define PPI_VECTOR_MASK_ROTX 0x00000004
-#define PPI_VECTOR_MASK_ROTY 0x00000008
-#define PPI_VECTOR_MASK_ROTZ 0x00000010
-#define PPI_VECTOR_MASK_OFF_R 0x00000020
-#define PPI_VECTOR_MASK_OFF_F 0x00000040
-#define PPI_VECTOR_MASK_OFF_U 0x00000080
-#define PPI_VECTOR_MASK_VEL_R 0x00000100
-#define PPI_VECTOR_MASK_VEL_F 0x00000200
-#define PPI_VECTOR_MASK_VEL_U 0x00000400
-#define PPI_VECTOR_MASK_VEL_T 0x00000800
-#define PPI_VECTOR_MASK_ACC_R 0x00001000
-#define PPI_VECTOR_MASK_ACC_F 0x00002000
-#define PPI_VECTOR_MASK_ACC_U 0x00004000
-#define PPI_VECTOR_MASK_ACC_T 0x00008000
-
-#define PPI_VECTOR_MASK_ERR_ROT 0x00010000
-#define PPI_VECTOR_MASK_ERR_OFF 0x00020000
-#define PPI_VECTOR_MASK_ERR_VEL 0x00040000
-#define PPI_VECTOR_MASK_ERR_ACC 0x00080000
-
-#define PPI_VECTOR_MASK_DESCSTR 0x10000000 /* 28 */
-#define PPI_VECTOR_MASK_APPID 0x20000000 /* 29 */
-#define PPI_VECTOR_MASK_APPDATA 0x40000000 /* 30 */
-#define PPI_VECTOR_MASK_EXT 0x80000000 /* 31 */
-
- /* Boolean 'present' flags */
- { &hf_ppi_vector_present_vflags,
- { "Vector flags", "ppi_vector.present.flags",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VFLAGS,
- "Specifies if the Vector flags bitfield is present", HFILL } },
-
- { &hf_ppi_vector_present_vchars,
- { "Vector chararacteristics", "ppi_vector.present.chars",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VCHARS,
- "Specifies if the Vector chars bitfield is present", HFILL } },
-
- { &hf_ppi_vector_present_val_x,
- { "Pitch", "ppi_vector.present.pitch",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTX,
- "Specifies if the rotate-x field (pitch) is present", HFILL } },
-
- { &hf_ppi_vector_present_val_y,
- { "Roll", "ppi_vector.present.roll",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTY,
- "Specifies if the rotate-y field (roll) is present", HFILL } },
-
- { &hf_ppi_vector_present_val_z,
- { "Heading", "ppi_vector.present.heading",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTZ,
- "Specifies if the rotate-z field (heading) is present", HFILL } },
-
-
- { &hf_ppi_vector_present_off_r,
- { "Offset_R", "ppi_vector.present.off_r",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_R,
- "Specifies if the offset-right field is present", HFILL } },
-
- { &hf_ppi_vector_present_off_f,
- { "Offset_F", "ppi_vector.present.off_f",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_F,
- "Specifies if the offset-forward field is present", HFILL } },
-
- { &hf_ppi_vector_present_off_u,
- { "Offset_U", "ppi_vector.present.off_u",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_U,
- "Specifies if the offset-up field is present", HFILL } },
-
- { &hf_ppi_vector_present_vel_r,
- { "Velocity_R", "ppi_vector.present.vel_r",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VEL_R,
- "Specifies if the velocity-right field is present", HFILL } },
-
- { &hf_ppi_vector_present_vel_f,
- { "Velocity_F", "ppi_vector.present.vel_f",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VEL_F,
- "Specifies if the velocity-forward field is present", HFILL } },
-
- { &hf_ppi_vector_present_vel_u,
- { "Velocity_U", "ppi_vector.present.vel_u",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VEL_U,
- "Specifies if the velocity-up field is present", HFILL } },
- { &hf_ppi_vector_present_vel_t,
- { "Velocity_T", "ppi_vector.present.vel_t",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VEL_T,
- "Specifies if the total velocity field is present", HFILL } },
-
- { &hf_ppi_vector_present_acc_r,
- { "Acceleration_R", "ppi_vector.present.acc_r",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ACC_R,
- "Specifies if the accel-right field is present", HFILL } },
-
- { &hf_ppi_vector_present_acc_f,
- { "Acceleration_F", "ppi_vector.present.acc_f",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ACC_F,
- "Specifies if the accel-forward field is present", HFILL } },
-
- { &hf_ppi_vector_present_acc_u,
- { "Acceleration_U", "ppi_vector.present.acc_u",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ACC_U,
- "Specifies if the accel-up field is present", HFILL } },
- { &hf_ppi_vector_present_acc_t,
- { "Acceleration_T", "ppi_vector.present.acc_t",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ACC_T,
- "Specifies if the total acceleration field is present", HFILL } },
-
- { &hf_ppi_vector_present_err_rot,
- { "err_rot", "ppi_vector.present.err_rot",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_ROT,
- "Specifies if the rotation error field is present", HFILL } },
-
- { &hf_ppi_vector_present_err_off,
- { "err_off", "ppi_vector.present.err_off",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_OFF,
- "Specifies if the offset error field is present", HFILL } },
-
- { &hf_ppi_vector_present_err_vel,
- { "err_vel", "ppi_vector.present.err_vel",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_VEL,
- "Specifies if the velocity error field is present", HFILL } },
-
- { &hf_ppi_vector_present_err_acc,
- { "err_acc", "ppi_vector.present.err_acc",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_ACC,
- "Specifies if the acceleration error field is present", HFILL } },
-
- { &hf_ppi_vector_present_descstr,
- { "descstr", "ppi_vector.present.descstr",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_DESCSTR,
- "Specifies if the acceleration error field is present", HFILL } },
-
- { &hf_ppi_vector_presenappsecific_num,
- { "appid", "ppi_vector.present.appid",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_APPID,
- "Specifies if the application specific field id is present", HFILL } },
-
- { &hf_ppi_vector_present_appspecific_data,
- { "appdata", "ppi_vector.present.appdata",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_APPDATA,
- "Specifies if the application specific data field is present", HFILL } },
-
- { &hf_ppi_vector_present_ext,
- { "Ext", "ppi_vector.present.ext",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_EXT,
- "Specifies if there are any extensions to the header present", HFILL } },
-
- /* Now we get to the actual data fields */
- /* This setups the "Vector fflags" hex dropydown thing */
- { &hf_ppi_vector_vflags,
- { "Vector flags", "ppi_vector.vector_flags",
- FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating coordinate sys, among others, etc", HFILL } },
- { &hf_ppi_vector_vchars,
- { "Vector chars", "ppi_vector.vector_chars",
- FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating if vector tracks antenna, vehicle, motion, etc", HFILL } },
- { &hf_ppi_vector_rot_x,
- { "Pitch", "ppi_vector.pitch",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Pitch (Rotation x) packet was received at", HFILL } },
- { &hf_ppi_vector_rot_y,
- { "Roll", "ppi_vector.roll",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Roll (Rotation y) packet was received at", HFILL } },
- { &hf_ppi_vector_rot_z,
- { "Heading", "ppi_vector.heading",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Heading (Rotation z) packet was received at", HFILL } },
- { &hf_ppi_vector_off_r,
- { "Off-r", "ppi_vector.off_r",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Offset right", HFILL } },
- { &hf_ppi_vector_off_f,
- { "Off-f", "ppi_vector.off_f",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Offation forward", HFILL } },
- { &hf_ppi_vector_off_u,
- { "Off-u", "ppi_vector.off_u",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Offset up", HFILL } },
- { &hf_ppi_vector_vel_r,
- { "Vel-r", "ppi_vector.vel_r",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Velocity-right", HFILL } },
- { &hf_ppi_vector_vel_f,
- { "Vel-f", "ppi_vector.vel_f",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Velocity-forward", HFILL } },
- { &hf_ppi_vector_vel_u,
- { "Vel-u", "ppi_vector.vel_u",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Velocity-up", HFILL } },
- { &hf_ppi_vector_vel_t,
- { "Vel-t", "ppi_vector.vel_t",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Velocity-Total", HFILL } },
-
- { &hf_ppi_vector_acc_r,
- { "Accel-r", "ppi_vector.acc_r",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Acceleration-right", HFILL } },
- { &hf_ppi_vector_acc_f,
- { "Accel-f", "ppi_vector.acc_f",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Acceleration-forward", HFILL } },
- { &hf_ppi_vector_acc_u,
- { "Accel-u", "ppi_vector.acc_u",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Acceleration-up", HFILL } },
- { &hf_ppi_vector_acc_t,
- { "Accel-t", "ppi_vector.acc_t",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Acceleration-Total", HFILL } },
-
- { &hf_ppi_vector_err_rot,
- { "Err-Rot", "ppi_vector.err_rot",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Rotation margin of error", HFILL } },
- { &hf_ppi_vector_err_off,
- { "Err-Off", "ppi_vector.err_off",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Offset margin of error", HFILL } },
- { &hf_ppi_vector_err_vel,
- { "Err-Vel", "ppi_vector.err_vel",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Velocity margin of error", HFILL } },
- { &hf_ppi_vector_err_acc,
- { "Err-Accel", "ppi_vector.err_acc",
- FT_DOUBLE, BASE_NONE, NULL, 0x0,
- "Acceleration margin of error", HFILL } },
-
- { &hf_ppi_vector_descstr,
- { "Description", "ppi_vector.descr",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL } } ,
- { &hf_ppi_vector_appspecific_num,
- { "Application Specific id", "ppi_vector.appid",
- FT_UINT32, BASE_HEX, NULL, 0x0,
- "Application-specific identifier", HFILL } },
- { &hf_ppi_vector_appspecific_data,
- { "Application specific data", "ppi_vector.appdata",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- "Application-specific data", HFILL } },
-
- /* There are currently only three vector flags.
- * These control the units/interpreration of a vector
- */
-#define PPI_VECTOR_VFLAGS_DEFINES_FORWARD 0x00000001
-#define PPI_VECTOR_VFLAGS_ROTS_ABSOLUTE 0x00000002
-#define PPI_VECTOR_VFLAGS_OFFSETS_FROM_GPS 0x00000004
- /* Boolean vector flags */
- { &hf_ppi_vector_vflags_defines_forward,
- { "Defines forward", "ppi_vector.vflags.forward",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VFLAGS_DEFINES_FORWARD,
- "Current vector indicates forward frame of reference", HFILL } },
- { &hf_ppi_vector_vflags_rots_absolute,
- { "Absolute (E/N/U) rotations", "ppi_vector.vflags.abs_rots",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VFLAGS_ROTS_ABSOLUTE,
- "Rotations are in East/North/Up coord. sys", HFILL } },
- { &hf_ppi_vector_vflags_offsets_from_gps,
- { "Offsets from prev GPS TAG", "ppi_vector.vflags.offsets_from_gps",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VFLAGS_OFFSETS_FROM_GPS,
- "Offsets fied rel. to Curr_Gps", HFILL } },
-
- /* There are currently eight vector characteristics.
- * These are purely descriptive (no mathematical importance)
- */
-#define PPI_VECTOR_VCHARS_ANTENNA 0x00000001
-#define PPI_VECTOR_VCHARS_DIR_OF_TRAVEL 0x00000002
-#define PPI_VECTOR_VCHARS_FRONT_OF_VEH 0x00000004
-
-#define PPI_VECTOR_VCHARS_GPS_DERIVED 0x00000100
-#define PPI_VECTOR_VCHARS_INS_DERIVED 0x00000200
-#define PPI_VECTOR_VCHARS_COMPASS_DERIVED 0x00000400
-#define PPI_VECTOR_VCHARS_ACCELEROMETER_DERIVED 0x00000800
-#define PPI_VECTOR_VCHARS_HUMAN_DERIVED 0x00001000
- /* Boolean vector chars */
- { &hf_ppi_vector_vchars_antenna,
- { "Antenna", "ppi_vector.chars.antenna",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_ANTENNA,
- "Vector represents: Antenna", HFILL } },
-
- { &hf_ppi_vector_vchars_dir_of_travel,
- { "Dir of travel", "ppi_vector.chars.dir_of_travel",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_DIR_OF_TRAVEL,
- "Vector represents: Direction of travel", HFILL } },
-
- { &hf_ppi_vector_vchars_front_of_veh,
- { "Front of vehicle", "ppi_vector.chars.front_of_veh",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_FRONT_OF_VEH,
- "Vector represents: Front of vehicle", HFILL } },
-
- { &hf_ppi_vector_vchars_gps_derived,
- { "GPS Derived", "ppi_vector.vflags.gps_derived",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_GPS_DERIVED,
- "Vector derived from: gps", HFILL } },
-
- { &hf_ppi_vector_vchars_ins_derived,
- { "INS Derived", "ppi_vector.vflags.ins_derived",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_INS_DERIVED,
- "Vector derived from: inertial nav system", HFILL } },
-
- { &hf_ppi_vector_vchars_compass_derived,
- { "Compass derived", "ppi_vector.vflags.compass_derived",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_COMPASS_DERIVED,
- "Vector derived from: compass", HFILL } },
-
- { &hf_ppi_vector_vchars_accelerometer_derived,
- { "Accelerometer derived", "ppi_vector.vflags.accelerometer_derived",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_ACCELEROMETER_DERIVED,
- "Vector derived from: accelerometer", HFILL } },
-
- { &hf_ppi_vector_vchars_human_derived,
- { "Human derived", "ppi_vector.vflags.human_derived",
- FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_HUMAN_DERIVED,
- "Vector derived from: human", HFILL } },
-
- };
- static gint *ett[] = {
- &ett_ppi_vector,
- &ett_ppi_vector_present,
- &ett_ppi_vectorflags,
- &ett_ppi_vectorchars
- };
-
- proto_ppi_vector = proto_register_protocol("PPI vector decoder", "PPI vector Decoder", "ppi_vector");
- proto_register_field_array(proto_ppi_vector, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
- register_dissector("ppi_vector", dissect_ppi_vector, proto_ppi_vector);
-
+ if (chars & PPI_VECTOR_VCHARS_ANTENNA)
+ proto_item_append_text(my_pt, " (Antenna)");
+ if (chars & PPI_VECTOR_VCHARS_DIR_OF_TRAVEL)
+ proto_item_append_text(my_pt, " (DOT)");
+ if (chars & PPI_VECTOR_VCHARS_FRONT_OF_VEH)
+ proto_item_append_text(my_pt, " (Front_of_veh)");
+ if (chars & PPI_VECTOR_VCHARS_AOA)
+ proto_item_append_text(my_pt, " (AOA)");
+ if (chars & PPI_VECTOR_VCHARS_TRANSMITTER_POS)
+ proto_item_append_text(my_pt, " (TRANSMITTER_POS)");
}
-
void
dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
@@ -515,44 +199,50 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *vectorchars_tree = NULL;
proto_tree *my_pt, *pt, *present_tree = NULL;
proto_item *ti = NULL;
+ proto_item *vector_line = NULL;
guint length_remaining;
int offset = 0;
-
-
/* bits */
int bit;
guint32 present, next_present;
/* values actually read out, for displaying */
guint32 version;
guint length;
+ gchar *curr_str;
+
+ /* these are used to specially handle RelativeTo: */
+ guint32 relativeto_int;
+ const gchar *relativeto_str= "RelativeTo: Forward"; /* default if vflags is not present*/
+
+ /* normal fields*/
+ guint32 flags=0, chars=0;
gdouble rot_x, rot_y, rot_z;
- gdouble off_r, off_f, off_u;
- gdouble vel_r, vel_f, vel_u, vel_t;
- gdouble acc_r, acc_f, acc_u, acc_t = 0;
- gdouble err_rot, err_off, err_vel, err_acc;
+ gdouble off_x, off_y, off_z;
+ gdouble err_rot, err_off;
guint32 appsecific_num; /* appdata parser should add a subtree based on this value */
- guint32 flags=0, chars=0;
/* temporary, conversion values */
guint32 t_val;
-
/* Clear out stuff in the info column */
if (check_col(pinfo->cinfo,COL_INFO)) {
col_clear(pinfo->cinfo,COL_INFO);
}
+ /* pull out the first three fields of the BASE-GEOTAG-HEADER */
version = tvb_get_guint8(tvb, offset);
length = tvb_get_letohs(tvb, offset+2);
present = tvb_get_letohl(tvb, offset+4);
+
+ /* Setup basic column info */
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_Vector Capture v%u, Length %u",
version, length);
- /* Dissect the packet */
+ /* Create the basic dissection tree*/
if (tree) {
- ti = proto_tree_add_protocol_format(tree, proto_ppi_vector,
- tvb, 0, length, "PPI Vector Header v%u, Length %u", version, length);
+ ti = proto_tree_add_protocol_format(tree, proto_ppi_vector, tvb, 0, length, "Vector:");
+ vector_line = ti; /*save this for later, we will replace it with something more useful*/
ppi_vector_tree= proto_item_add_subtree(ti, ett_ppi_vector);
proto_tree_add_uint(ppi_vector_tree, hf_ppi_vector_version,
tvb, offset, 1, version);
@@ -561,12 +251,35 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_uint(ppi_vector_tree, hf_ppi_vector_length,
tvb, offset + 2, 2, length);
}
+
+ /*We only support v2 of vectors (v1 deprecated) */
+ if (! (version == 2) ) {
+ if (tree)
+ proto_item_append_text(ti, "invalid version (got %d, expected 2)", version);
+ return;
+ }
+
+ /* initialize remaining length */
length_remaining = length;
+ /* minimum length check, should atleast be a fixed-size geotagging-base header*/
+ if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {
+ /*
+ * Base-geotag-header (Radiotap lookalike) is shorter than the fixed-length portion
+ * plus one "present" bitset.
+ */
+ if (tree)
+ proto_item_append_text(ti, " (invalid - minimum length is 8)");
+ return;
+ }
+
+ /* perform max length sanity checking */
+ if (length > PPI_VECTOR_MAXTAGLEN ) {
+ if (tree)
+ proto_item_append_text(ti, "Invalid PPI-Vector length (got %d, %d max\n)", length, PPI_VECTOR_MAXTAGLEN);
+ return;
+ }
+
- /*
- * FIXME: This only works if there is exactly 1 it_present
- * field in the header
- */
if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {
/*
* Radiotap header is shorter than the fixed-length portion
@@ -587,21 +300,11 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(present_tree, hf_ppi_vector_present_val_x, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_val_y, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_val_z, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_off_r, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_off_f, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_off_u, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_vel_r, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_vel_f, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_vel_u, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_vel_t, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_acc_r, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_acc_f, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_acc_u, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_acc_t, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_vector_present_off_x, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_vector_present_off_y, tvb, 4, 4, TRUE);
+ proto_tree_add_item(present_tree, hf_ppi_vector_present_off_z, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_err_rot, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_err_off, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_err_vel, tvb, 4, 4, TRUE);
- proto_tree_add_item(present_tree, hf_ppi_vector_present_err_acc, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_descstr, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_presenappsecific_num, tvb, 4, 4, TRUE);
proto_tree_add_item(present_tree, hf_ppi_vector_present_appspecific_data, tvb, 4, 4, TRUE);
@@ -610,6 +313,44 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += PPI_GEOBASE_MIN_HEADER_LEN;
length_remaining -= PPI_GEOBASE_MIN_HEADER_LEN;
+ /* Before we process any fields, we check what this vector is RelativeTo. */
+ /* We do this so this up front so that it displays prominently in the summary line */
+ /* Another reason to do this up here is that vflags may not be present (in which case it defaults to 0) */
+ /* It also saves us from repeating this logic in any of the individual fields */
+ if ( (present & PPI_VECTOR_MASK_VFLAGS) && length_remaining >= 4)
+ {
+ /*vflags is the first field, */
+ flags = tvb_get_letohl(tvb, offset);
+ relativeto_int = (flags & (PPI_VECTOR_VFLAGS_RELATIVE_TO)); /* mask out all other bits */
+ relativeto_int = relativeto_int >> 1; /*scoot over 1 bit to align with the type string */
+ relativeto_str = val_to_str_const (relativeto_int, relativeto_string, "Reserved"); /*re-use that type string up top */
+ /* We will append this text to the vector line once all the other fields have processed */
+
+ /* this is important enough to put in vector line */
+ if (flags & PPI_VECTOR_VFLAGS_DEFINES_FORWARD)
+ proto_item_append_text(vector_line, " (Forward)");
+
+ /* Intentionally dont upset offset, length_remaining. This is taken care of in the normal vflags parser below*/
+ }
+ else /* No vflags means vlfags defaults to zero. RelativeTo: Forward */
+ {
+ relativeto_str = " RelativeTo: Forward";
+ }
+ /*
+ * vchars is another field that we want to pre-process simillar to vflags and for the same reasons.
+ * we perform seperate length checks depending on if vector_flags is present (which would precede vector_chars)
+ */
+ if ( ( (present & PPI_VECTOR_MASK_VFLAGS)) && (present & PPI_VECTOR_MASK_VCHARS) && length_remaining >= 8)
+ chars = tvb_get_letohl(tvb, offset + 4);
+ else if ( (!(present & PPI_VECTOR_MASK_VFLAGS)) && (present & PPI_VECTOR_MASK_VCHARS) && length_remaining >= 4)
+ chars = tvb_get_letohl(tvb, offset );
+
+ if (chars)
+ {
+ /* Mark the most interesting characteristics on the vector dropdown line */
+ annotate_vector_chars(chars, vector_line);
+ /* Intentionally dont update offset, length_remaining. This is taken care of in the normal vchars parser below*/
+ }
/* Now all of the fixed length, fixed location stuff is over. Loop over the bits */
for (; present; present = next_present) {
@@ -621,14 +362,18 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case PPI_VECTOR_VFLAGS:
if (length_remaining < 4)
break;
- flags = tvb_get_letohl(tvb, offset);
+ /* flags = tvb_get_letohl(tvb, offset); */ /* Usually we read this in, but vflags is a special case handled above */
if (tree) {
my_pt = proto_tree_add_uint(ppi_vector_tree, hf_ppi_vector_vflags, tvb, offset , 4, flags);
vectorflags_tree= proto_item_add_subtree(my_pt, ett_ppi_vectorflags);
proto_tree_add_item(vectorflags_tree, hf_ppi_vector_vflags_defines_forward, tvb, offset, 4, TRUE);
- proto_tree_add_item(vectorflags_tree, hf_ppi_vector_vflags_rots_absolute, tvb, offset, 4, TRUE);
- proto_tree_add_item(vectorflags_tree, hf_ppi_vector_vflags_offsets_from_gps, tvb, offset, 4, TRUE);
+ proto_tree_add_item(vectorflags_tree, hf_ppi_vector_vflags_relative_to, tvb, offset, 4, TRUE);
+
+ if (flags & PPI_VECTOR_VFLAGS_DEFINES_FORWARD)
+ proto_item_append_text(vectorflags_tree, " (Forward)");
+
+ proto_item_append_text (vectorflags_tree, " RelativeTo: %s", relativeto_str);
}
offset+=4;
length_remaining-=4;
@@ -636,7 +381,7 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case PPI_VECTOR_VCHARS:
if (length_remaining < 4)
break;
- chars = tvb_get_letohl(tvb, offset);
+ /* chars = tvb_get_letohl(tvb, offset); */ /*Usually we read this in, but vchars specially handled above */
if (tree) {
my_pt = proto_tree_add_uint(ppi_vector_tree, hf_ppi_vector_vchars, tvb, offset , 4, chars);
vectorchars_tree= proto_item_add_subtree(my_pt, ett_ppi_vectorchars);
@@ -644,11 +389,15 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_antenna, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_dir_of_travel, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_front_of_veh, tvb, offset, 4, TRUE);
+ proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_angle_of_arrival, tvb, offset, 4, TRUE);
+ proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_transmitter_pos, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_gps_derived, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_ins_derived, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_compass_derived, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_accelerometer_derived, tvb, offset, 4, TRUE);
proto_tree_add_item(vectorchars_tree, hf_ppi_vector_vchars_human_derived, tvb, offset, 4, TRUE);
+
+ annotate_vector_chars(chars, my_pt);
}
offset+=4;
length_remaining-=4;
@@ -660,10 +409,8 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rot_x = fixed3_6_to_gdouble(t_val);
if (tree) {
ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_rot_x, tvb, offset, 4, rot_x);
- if (flags & PPI_VECTOR_VFLAGS_ROTS_ABSOLUTE)
- proto_item_append_text(ti, " Degrees (Absolute)");
- else
- proto_item_append_text(ti, " Degrees (Rel to forward)");
+ proto_item_append_text(ti, " Degrees RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Pitch:%3f ", rot_x);
}
offset+=4;
length_remaining-=4;
@@ -675,10 +422,8 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rot_y = fixed3_6_to_gdouble(t_val);
if (tree) {
ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_rot_y, tvb, offset, 4, rot_y);
- if (flags & PPI_VECTOR_VFLAGS_ROTS_ABSOLUTE)
- proto_item_append_text(ti, " Degrees (Absolute)");
- else
- proto_item_append_text(ti, " Degrees (Rel to forward)");
+ proto_item_append_text(ti, " Degrees RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Roll:%3f ", rot_y);
}
offset+=4;
length_remaining-=4;
@@ -690,151 +435,47 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rot_z = fixed3_6_to_gdouble(t_val);
if (tree) {
ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_rot_z, tvb, offset, 4, rot_z);
- if (flags & PPI_VECTOR_VFLAGS_ROTS_ABSOLUTE)
- proto_item_append_text(ti, " Degrees (Absolute) ");
- else
- proto_item_append_text(ti, " Degrees (Rel to forward)");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_OFF_R:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- off_r = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_r, tvb, offset, 4, off_r);
- if (flags & PPI_VECTOR_VFLAGS_OFFSETS_FROM_GPS)
- proto_item_append_text(ti, " m from Curr_GPS");
- else
- proto_item_append_text(ti, " m from Curr_Pos");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_OFF_F:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- off_f = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_f, tvb, offset, 4, off_f);
- if (flags & PPI_VECTOR_VFLAGS_OFFSETS_FROM_GPS)
- proto_item_append_text(ti, " m from Curr_GPS");
- else
- proto_item_append_text(ti, " m from Curr_Pos");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_OFF_U:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- off_u = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_u, tvb, offset, 4, off_u);
- if (flags & PPI_VECTOR_VFLAGS_OFFSETS_FROM_GPS)
- proto_item_append_text(ti, " m from Curr_GPS");
- else
- proto_item_append_text(ti, " m from Curr_Pos");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_VEL_R:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- vel_r = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_r, tvb, offset, 4, vel_r);
- proto_item_append_text(ti, " m/s");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_VEL_F:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- vel_f = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_f, tvb, offset, 4, vel_f);
- proto_item_append_text(ti, " m/s");
+ proto_item_append_text(ti, " Degrees RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Heading:%3f ", rot_z);
}
offset+=4;
length_remaining-=4;
break;
- case PPI_VECTOR_VEL_U:
+ case PPI_VECTOR_OFF_X:
if (length_remaining < 4)
break;
t_val = tvb_get_letohl(tvb, offset);
- vel_u = fixed6_4_to_gdouble(t_val);
+ off_x = fixed6_4_to_gdouble(t_val);
if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_u, tvb, offset, 4, vel_u);
- proto_item_append_text(ti, " m/s");
+ ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_x, tvb, offset, 4, off_x);
+ proto_item_append_text(ti, " Meters RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Off-X:%3f ", off_x);
}
offset+=4;
length_remaining-=4;
break;
- case PPI_VECTOR_VEL_T:
+ case PPI_VECTOR_OFF_Y:
if (length_remaining < 4)
break;
t_val = tvb_get_letohl(tvb, offset);
- vel_t = fixed6_4_to_gdouble(t_val);
+ off_y = fixed6_4_to_gdouble(t_val);
if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_vel_t, tvb, offset, 4, vel_t);
- proto_item_append_text(ti, " m/s");
+ ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_y, tvb, offset, 4, off_y);
+ proto_item_append_text(ti, " Meters RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Off-Y:%3f ", off_y);
}
offset+=4;
length_remaining-=4;
break;
- case PPI_VECTOR_ACC_R:
+ case PPI_VECTOR_OFF_Z:
if (length_remaining < 4)
break;
t_val = tvb_get_letohl(tvb, offset);
- acc_r = fixed6_4_to_gdouble(t_val);
+ off_z = fixed6_4_to_gdouble(t_val);
if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_r, tvb, offset, 4, acc_r);
- proto_item_append_text(ti, " (m/s)/s");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_ACC_F:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- acc_f = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_f, tvb, offset, 4, acc_f);
- proto_item_append_text(ti, " (m/s)/s");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_ACC_U:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- acc_u = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_u, tvb, offset, 4, acc_u);
- proto_item_append_text(ti, " (m/s)/s");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_ACC_T:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- acc_t = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_acc_t, tvb, offset, 4, acc_t);
- proto_item_append_text(ti, " (m/s)/s");
+ ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_off_z, tvb, offset, 4, off_z);
+ proto_item_append_text(ti, " Meters RelativeTo: %s", relativeto_str);
+ proto_item_append_text(vector_line, " Off-Z:%3f ", off_z);
}
offset+=4;
length_remaining-=4;
@@ -846,7 +487,7 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
err_rot = fixed3_6_to_gdouble(t_val);
if (tree) {
ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_rot, tvb, offset, 4, err_rot);
- proto_item_append_text(ti, " degrees");
+ proto_item_append_text(ti, " Degrees");
}
offset+=4;
length_remaining-=4;
@@ -858,39 +499,22 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
err_off = fixed6_4_to_gdouble(t_val);
if (tree) {
ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_off, tvb, offset, 4, err_off);
- proto_item_append_text(ti, " meters");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_ERR_VEL:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- err_vel = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_vel, tvb, offset, 4, err_vel);
- proto_item_append_text(ti, "m/s");
- }
- offset+=4;
- length_remaining-=4;
- break;
- case PPI_VECTOR_ERR_ACC:
- if (length_remaining < 4)
- break;
- t_val = tvb_get_letohl(tvb, offset);
- err_acc = fixed6_4_to_gdouble(t_val);
- if (tree) {
- ti = proto_tree_add_double(ppi_vector_tree, hf_ppi_vector_err_acc, tvb, offset, 4, err_acc);
- proto_item_append_text(ti, " (m/s)/s");
+ proto_item_append_text(ti, " Meters");
}
offset+=4;
length_remaining-=4;
break;
+
case PPI_VECTOR_DESCSTR:
if (length_remaining < 32)
break;
- proto_tree_add_item(ppi_vector_tree, hf_ppi_vector_descstr, tvb, offset, 32, ENC_NA);
+ if (tree)
+ {
+ /* proto_tree_add_item(ppi_vector_tree, hf_ppi_vector_descstr, tvb, offset, 32, ENC_NA); */
+ curr_str = tvb_format_text(tvb, offset, 32); /* need to append_text this */
+ proto_tree_add_string(ppi_vector_tree, hf_ppi_vector_descstr, tvb, offset, 32, curr_str);
+ proto_item_append_text(vector_line, " (%s)", curr_str);
+ }
offset+=32;
length_remaining-=32;
break;
@@ -925,7 +549,231 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
};
+ /* Append the RelativeTo string we computed up top */
+ proto_item_append_text (vector_line, " RelativeTo: %s", relativeto_str);
return;
}
+void
+proto_register_ppi_vector(void)
+{
+ /* The following array initializes those header fields declared above to the values displayed */
+ static hf_register_info hf[] = {
+ { &hf_ppi_vector_version,
+ { "Header revision", "ppi_vector.version",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Version of ppi_vector header format", HFILL } },
+ { &hf_ppi_vector_pad,
+ { "Header pad", "ppi_vector.pad",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Padding", HFILL } },
+ { &hf_ppi_vector_length,
+ { "Header length", "ppi_vector.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Length of header including version, pad, length and data fields", HFILL } },
+ { &hf_ppi_vector_present,
+ { "Present", "ppi_vector.present",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating which fields are present", HFILL } },
+
+ /* Boolean 'present' flags */
+ { &hf_ppi_vector_present_vflags,
+ { "Vector flags", "ppi_vector.present.flags",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VFLAGS,
+ "Specifies if the Vector flags bitfield is present", HFILL } },
+
+ { &hf_ppi_vector_present_vchars,
+ { "Vector chararacteristics", "ppi_vector.present.chars",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_VCHARS,
+ "Specifies if the Vector chars bitfield is present", HFILL } },
+
+ { &hf_ppi_vector_present_val_x,
+ { "Pitch", "ppi_vector.present.pitch",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTX,
+ "Specifies if the rotate-x field (pitch) is present", HFILL } },
+
+ { &hf_ppi_vector_present_val_y,
+ { "Roll", "ppi_vector.present.roll",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTY,
+ "Specifies if the rotate-y field (roll) is present", HFILL } },
+
+ { &hf_ppi_vector_present_val_z,
+ { "Heading", "ppi_vector.present.heading",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ROTZ,
+ "Specifies if the rotate-z field (heading) is present", HFILL } },
+
+
+ { &hf_ppi_vector_present_off_x,
+ { "Offset_R", "ppi_vector.present.off_x",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_X,
+ "Specifies if the offset-x (right/east) field is present", HFILL } },
+
+ { &hf_ppi_vector_present_off_y,
+ { "Offset_F", "ppi_vector.present.off_y",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_Y,
+ "Specifies if the offset-y (forward/north) field is present", HFILL } },
+ { &hf_ppi_vector_present_off_z,
+ { "Offset_U", "ppi_vector.present.off_z",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_OFF_Z,
+ "Specifies if the offset-z (up) field is present", HFILL } },
+
+
+ { &hf_ppi_vector_present_err_rot,
+ { "err_rot", "ppi_vector.present.err_rot",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_ROT,
+ "Specifies if the rotation error field is present", HFILL } },
+
+ { &hf_ppi_vector_present_err_off,
+ { "err_off", "ppi_vector.present.err_off",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_ERR_OFF,
+ "Specifies if the offset error field is present", HFILL } },
+
+
+ { &hf_ppi_vector_present_descstr,
+ { "descstr", "ppi_vector.present.descstr",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_DESCSTR,
+ "Specifies if the acceleration error field is present", HFILL } },
+
+ { &hf_ppi_vector_presenappsecific_num,
+ { "appid", "ppi_vector.present.appid",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_APPID,
+ "Specifies if the application specific field id is present", HFILL } },
+
+ { &hf_ppi_vector_present_appspecific_data,
+ { "appdata", "ppi_vector.present.appdata",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_APPDATA,
+ "Specifies if the application specific data field is present", HFILL } },
+
+ { &hf_ppi_vector_present_ext,
+ { "Ext", "ppi_vector.present.ext",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_MASK_EXT,
+ "Specifies if there are any extensions to the header present", HFILL } },
+
+ /* Now we get to the actual data fields */
+ /* This setups the "Vector fflags" hex dropydown thing */
+ { &hf_ppi_vector_vflags,
+ { "Vector flags", "ppi_vector.vector_flags",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating coordinate sys, among others, etc", HFILL } },
+ { &hf_ppi_vector_vchars,
+ { "Vector chars", "ppi_vector.vector_chars",
+ FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask indicating if vector tracks antenna, vehicle, motion, etc", HFILL } },
+ { &hf_ppi_vector_rot_x,
+ { "Pitch ", "ppi_vector.pitch", /*extra spaces intentional. casuses field values to align*/
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Pitch (Rotation x) packet was received at", HFILL } },
+ { &hf_ppi_vector_rot_y,
+ { "Roll ", "ppi_vector.roll", /*extra spaces intentional. casuses field values to align*/
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Roll (Rotation y) packet was received at", HFILL } },
+ { &hf_ppi_vector_rot_z,
+ { "Heading ", "ppi_vector.heading", /*extra spaces intentional. casuses field values to align*/
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Heading (Rotation z) packet was received at", HFILL } },
+ { &hf_ppi_vector_off_x,
+ { "Off-x", "ppi_vector.off_x",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Offset-x (right/east)", HFILL } },
+ { &hf_ppi_vector_off_y,
+ { "Off-y", "ppi_vector.off_y",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Offset-y (forward/north)", HFILL } },
+ { &hf_ppi_vector_off_z,
+ { "Off-z", "ppi_vector.off_z",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Offset-z (up)", HFILL } },
+ { &hf_ppi_vector_err_rot,
+ { "Err-Rot", "ppi_vector.err_rot",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Rotation margin of error", HFILL } },
+ { &hf_ppi_vector_err_off,
+ { "Err-Off", "ppi_vector.err_off",
+ FT_DOUBLE, BASE_NONE, NULL, 0x0,
+ "Offset margin of error", HFILL } },
+
+ { &hf_ppi_vector_descstr,
+ { "Description", "ppi_vector.descr",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL } } ,
+ { &hf_ppi_vector_appspecific_num,
+ { "Application Specific id", "ppi_vector.appid",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ "Application-specific identifier", HFILL } },
+ { &hf_ppi_vector_appspecific_data,
+ { "Application specific data", "ppi_vector.appdata",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ "Application-specific data", HFILL } },
+
+ /* Boolean vector flags */
+ { &hf_ppi_vector_vflags_defines_forward,
+ { "Defines forward", "ppi_vector.vflags.forward",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VFLAGS_DEFINES_FORWARD,
+ "Current vector indicates forward frame of reference", HFILL } },
+ { &hf_ppi_vector_vflags_relative_to,
+ { "RelativeTo", "ppi_vector.vflags.relative_to", FT_UINT32, BASE_HEX, VALS(&relativeto_string), PPI_VECTOR_VFLAGS_RELATIVE_TO,
+ "Reference frame vectors are RelativeTo:", HFILL } },
+
+ /* Boolean vector chars */
+ { &hf_ppi_vector_vchars_antenna,
+ { "Antenna", "ppi_vector.chars.antenna",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_ANTENNA,
+ "Vector represents: Antenna", HFILL } },
+
+ { &hf_ppi_vector_vchars_dir_of_travel,
+ { "Dir of travel", "ppi_vector.chars.dir_of_travel",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_DIR_OF_TRAVEL,
+ "Vector represents: Direction of travel", HFILL } },
+
+ { &hf_ppi_vector_vchars_front_of_veh,
+ { "Front of vehicle", "ppi_vector.chars.front_of_veh",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_FRONT_OF_VEH,
+ "Vector represents: Front of vehicle", HFILL } },
+
+ { &hf_ppi_vector_vchars_angle_of_arrival,
+ { "Angle of arrival", "ppi_vector.chars.angle_of_arr",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_AOA,
+ "Vector represents: Angle of Arrival", HFILL } },
+
+ { &hf_ppi_vector_vchars_transmitter_pos,
+ { "Transmitter Position", "ppi_vector.chars.transmitter_pos",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_TRANSMITTER_POS,
+ "Vector position represents computed transmitter location", HFILL } },
+
+ { &hf_ppi_vector_vchars_gps_derived,
+ { "GPS Derived", "ppi_vector.vflags.gps_derived",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_GPS_DERIVED,
+ "Vector derived from: gps", HFILL } },
+
+ { &hf_ppi_vector_vchars_ins_derived,
+ { "INS Derived", "ppi_vector.vflags.ins_derived",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_INS_DERIVED,
+ "Vector derived from: inertial nav system", HFILL } },
+
+ { &hf_ppi_vector_vchars_compass_derived,
+ { "Compass derived", "ppi_vector.vflags.compass_derived",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_COMPASS_DERIVED,
+ "Vector derived from: compass", HFILL } },
+
+ { &hf_ppi_vector_vchars_accelerometer_derived,
+ { "Accelerometer derived", "ppi_vector.vflags.accelerometer_derived",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_ACCELEROMETER_DERIVED,
+ "Vector derived from: accelerometer", HFILL } },
+
+ { &hf_ppi_vector_vchars_human_derived,
+ { "Human derived", "ppi_vector.vflags.human_derived",
+ FT_BOOLEAN, 32, NULL, PPI_VECTOR_VCHARS_HUMAN_DERIVED,
+ "Vector derived from: human", HFILL } },
+
+ };
+ static gint *ett[] = {
+ &ett_ppi_vector,
+ &ett_ppi_vector_present,
+ &ett_ppi_vectorflags,
+ &ett_ppi_vectorchars
+ };
+
+ proto_ppi_vector = proto_register_protocol("PPI vector decoder", "PPI vector Decoder", "ppi_vector");
+ proto_register_field_array(proto_ppi_vector, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("ppi_vector", dissect_ppi_vector, proto_ppi_vector);
+
+}
diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c
index 6da3feb88f..b10e1a7232 100644
--- a/epan/dissectors/packet-ppi.c
+++ b/epan/dissectors/packet-ppi.c
@@ -180,7 +180,7 @@ typedef enum {
MOHAMED_THAGA_PRIVATE = 30001,
PPI_GPS_INFO = 30002, /* 30002 - 30005 described in PPI-GEOLOCATION specifcation */
PPI_VECTOR_INFO = 30003, /* currently available in draft from. jellch@harris.com */
- PPI_HARRIS_TEST0 = 30004, /* 30004 is used for testing geolocation tag enhancements */
+ PPI_SENSOR_INFO = 30004,
PPI_ANTENNA_INFO = 30005,
CACE_PRIVATE = 0xCACE
/* All others RESERVED. Contact the WinPcap team for an assignment */
@@ -320,7 +320,7 @@ static gint ett_8023_extension_errors = -1;
static dissector_handle_t data_handle;
static dissector_handle_t ieee80211_ht_handle;
-static dissector_handle_t ppi_gps_handle, ppi_vector_handle, ppi_harris_test_handle, ppi_antenna_handle;
+static dissector_handle_t ppi_gps_handle, ppi_vector_handle, ppi_sensor_handle, ppi_antenna_handle;
static const true_false_string tfs_ppi_head_flag_alignment = { "32-bit aligned", "Not aligned" };
@@ -343,7 +343,7 @@ static const value_string vs_ppi_field_type[] = {
{MOHAMED_THAGA_PRIVATE, "Mohamed Thaga (private)"},
{PPI_GPS_INFO, "GPS Tagging"},
{PPI_VECTOR_INFO, "Vector Tagging"},
- {PPI_HARRIS_TEST0, "Harris geolocation-tag development"},
+ {PPI_SENSOR_INFO, "Sensor tagging"},
{PPI_ANTENNA_INFO, "Antenna Tagging"},
{CACE_PRIVATE, "CACE Technologies (private)"},
{0, NULL}
@@ -855,17 +855,17 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(ppi_vector_handle, next_tvb, pinfo, ppi_tree);
}
break;
- case PPI_HARRIS_TEST0:
- if (ppi_harris_test_handle == NULL)
+ case PPI_SENSOR_INFO:
+ if (ppi_sensor_handle == NULL)
{
proto_tree_add_text(ppi_tree, tvb, offset, data_len,
"%s (%u bytes)", val_to_str(data_type, (value_string *)&vs_ppi_field_type, "HARRIS: "), data_len);
}
else /* we found a suitable dissector */
{
- /* skip over the ppi_fieldheader, and pass it off to the dedicated ANTENNA_ORIENTATION dissetor */
+ /* skip over the ppi_fieldheader, and pass it off to the dedicated SENSOR dissetor */
next_tvb = tvb_new_subset(tvb, offset + 4, data_len - 4 , -1);
- call_dissector(ppi_harris_test_handle, next_tvb, pinfo, ppi_tree);
+ call_dissector(ppi_sensor_handle, next_tvb, pinfo, ppi_tree);
}
break;
case PPI_ANTENNA_INFO:
@@ -1361,7 +1361,7 @@ proto_reg_handoff_ppi(void)
ieee80211_ht_handle = find_dissector("wlan_ht");
ppi_gps_handle = find_dissector("ppi_gps");
ppi_vector_handle = find_dissector("ppi_vector");
- ppi_harris_test_handle = find_dissector("ppi_harris_test");
+ ppi_sensor_handle = find_dissector("ppi_sensor");
ppi_antenna_handle = find_dissector("ppi_antenna");
dissector_add_uint("wtap_encap", WTAP_ENCAP_PPI, ppi_handle);