aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2016-07-05 22:01:52 -0400
committerMichael Mann <mmann78@netscape.net>2016-07-07 10:50:54 +0000
commit166cedefbeb230a2f22106740fe34b34fc410d4c (patch)
tree942a8c699e8bb206df2c1f596bdf5279bfac09bf
parentfb74b16a14c86740fa8d4ca3eb9e00d603b68f8c (diff)
APRS: register the storm fields.
There's been a comment here since 2012 about them being unregistered. Put in some registrations based on a feeble understanding of the specification (these are all strings, add them as such); that should be close enough and is much better than the (dissector) assertion we'd get otherwise. Don't bother putting those hf's in a global structure and passing around the structure: the hf's are global anyway--just reference them directly. Add a link to the specification while we're here. Change-Id: Ia7b17e92a996a1a8eb4a4489eff9fca042190a32 Reviewed-on: https://code.wireshark.org/review/16318 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-aprs.c96
1 files changed, 57 insertions, 39 deletions
diff --git a/epan/dissectors/packet-aprs.c b/epan/dissectors/packet-aprs.c
index b06d06c539..a6573b7fc3 100644
--- a/epan/dissectors/packet-aprs.c
+++ b/epan/dissectors/packet-aprs.c
@@ -1,5 +1,4 @@
/* packet-aprs.c
- *
* Routines for Amateur Packet Radio protocol dissection
* Copyright 2007,2008,2009,2010,2012 R.W. Stearn <richard@rns-stearn.demon.co.uk>
*
@@ -27,6 +26,7 @@
*
* Information was drawn from:
* http://www.aprs.org/
+ * Specification: http://www.aprs.org/doc/APRS101.PDF
*
* Inspiration on how to build the dissector drawn from
* packet-sdlc.c
@@ -355,31 +355,6 @@ static const mic_e_items_s mic_e_items_gbl = {
&hf_aprs_mic_e_status /* FT_STRING */
};
-typedef struct {
- int *hf_aprs_storm_dir;
- int *hf_aprs_storm_spd;
- int *hf_aprs_storm_type;
- int *hf_aprs_storm_sws;
- int *hf_aprs_storm_pwg;
- int *hf_aprs_storm_cp;
- int *hf_aprs_storm_rhw;
- int *hf_aprs_storm_rtsw;
- int *hf_aprs_storm_rwg;
-} storm_items_s;
-
-/*** XXX: hf[] entries for the following are missing ***/
-static const storm_items_s storm_items_gbl = {
- &hf_aprs_storm_dir,
- &hf_aprs_storm_spd,
- &hf_aprs_storm_type,
- &hf_aprs_storm_sws,
- &hf_aprs_storm_pwg,
- &hf_aprs_storm_cp,
- &hf_aprs_storm_rhw,
- &hf_aprs_storm_rtsw,
- &hf_aprs_storm_rwg
-};
-
/* MIC-E destination field code table */
typedef struct
{
@@ -839,8 +814,7 @@ dissect_aprs_storm( tvbuff_t *tvb,
int offset,
proto_tree *parent_tree,
int hf_aprs_storm_idx,
- gint ett_aprs_storm_idx,
- const storm_items_s *storm_items
+ gint ett_aprs_storm_idx
)
{
proto_tree *storm_tree;
@@ -849,24 +823,24 @@ dissect_aprs_storm( tvbuff_t *tvb,
tc = proto_tree_add_item( parent_tree, hf_aprs_storm_idx, tvb, offset, -1, ENC_ASCII|ENC_NA );
storm_tree = proto_item_add_subtree( tc, ett_aprs_storm_idx );
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_dir, tvb, offset, 3, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_dir, tvb, offset, 3, ENC_ASCII|ENC_NA );
offset += 3;
offset += 1;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_spd, tvb, offset, 3, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_spd, tvb, offset, 3, ENC_ASCII|ENC_NA );
offset += 3;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_type, tvb, offset, 3, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_type, tvb, offset, 3, ENC_ASCII|ENC_NA );
offset += 3;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_sws, tvb, offset, 4, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_sws, tvb, offset, 4, ENC_ASCII|ENC_NA );
offset += 4;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_pwg, tvb, offset, 4, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_pwg, tvb, offset, 4, ENC_ASCII|ENC_NA );
offset += 4;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_cp, tvb, offset, 5, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_cp, tvb, offset, 5, ENC_ASCII|ENC_NA );
offset += 5;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_rhw, tvb, offset, 4, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_rhw, tvb, offset, 4, ENC_ASCII|ENC_NA );
offset += 4;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_rtsw, tvb, offset, 4, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_rtsw, tvb, offset, 4, ENC_ASCII|ENC_NA );
offset += 4;
- proto_tree_add_item( storm_tree, *storm_items->hf_aprs_storm_rwg, tvb, offset, 4, ENC_BIG_ENDIAN );
+ proto_tree_add_item( storm_tree, hf_aprs_storm_rwg, tvb, offset, 4, ENC_ASCII|ENC_NA );
offset += 4;
return offset;
@@ -1273,8 +1247,7 @@ aprs_position( proto_tree *aprs_tree, tvbuff_t *tvb, int offset, gboolean with_m
offset,
aprs_tree,
hf_aprs_storm,
- ett_aprs_storm,
- &storm_items_gbl
+ ett_aprs_storm
);
return offset;
@@ -1941,6 +1914,51 @@ proto_register_aprs( void )
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
+ { &hf_aprs_storm_dir,
+ { "Direction", "aprs.storm.direction",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_spd,
+ { "Speed (knots)", "aprs.storm.speed",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_type,
+ { "Type", "aprs.storm.type",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_sws,
+ { "Sustained wind speed (knots)", "aprs.storm.sws",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_pwg,
+ { "Peak wind gusts (knots)", "aprs.storm.pwg",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_cp,
+ { "Central pressure (millibars/hPascal)", "aprs.storm.central_pressure",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_rhw,
+ { "Radius Hurricane Winds (nautical miles)", "aprs.storm.radius_hurricane_winds",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_rtsw,
+ { "Radius Tropical Storm Winds (nautical miles)", "aprs.storm.radius_tropical_storms_winds",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_aprs_storm_rwg,
+ { "Radius Whole Gale (nautical miles)", "aprs.storm.radius_whole_gale",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ }
};
/* Setup protocol subtree array */