aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ccsds.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-01 10:08:57 -0400
committerMichael Mann <mmann78@netscape.net>2014-08-03 16:30:10 +0000
commit5db1352526e71727091ff0e1c0e97821eec4e4cb (patch)
tree01f836967616b7ae8b2840c488b500c7ff13d55c /epan/dissectors/packet-ccsds.c
parent3fa5625ea074908d5617111a7edfcf6d95e6108a (diff)
Eliminate proto_tree_add_text from some dissectors.
Change-Id: I398e9cf4f6882e76644aa758e12c39a39159e95f Reviewed-on: https://code.wireshark.org/review/3319 Petri-Dish: Michael Mann <mmann78@netscape.net> Petri-Dish: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ccsds.c')
-rw-r--r--epan/dissectors/packet-ccsds.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c
index daf27d4f3a..109bd224fa 100644
--- a/epan/dissectors/packet-ccsds.c
+++ b/epan/dissectors/packet-ccsds.c
@@ -78,6 +78,8 @@ static int hf_ccsds_format_version_id = -1;
static int hf_ccsds_extended_format_id = -1;
/* static int hf_ccsds_spare3 = -1; */
static int hf_ccsds_frame_id = -1;
+static int hf_ccsds_embedded_time = -1;
+static int hf_ccsds_user_data = -1;
/* ccsds checkword (checksum) */
static int hf_ccsds_checkword = -1;
@@ -91,6 +93,7 @@ static gint ett_ccsds_secondary_header = -1;
static gint ett_ccsds_checkword = -1;
static expert_field ei_ccsds_length_error = EI_INIT;
+static expert_field ei_ccsds_checkword = EI_INIT;
/* Dissectot table */
static dissector_table_t ccsds_dissector_table;
@@ -314,7 +317,7 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint reported_length;
guint8 checkword_flag = 0;
gint counter = 0;
- proto_item *item;
+ proto_item *item, *checkword_item;
proto_tree *checkword_tree;
guint16 checkword_field = 0;
guint16 checkword_sum = 0;
@@ -384,10 +387,10 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
++offset;
time_string = embedded_time_to_string ( coarse_time, fine_time );
- proto_tree_add_text(secondary_header_tree, tvb, offset-5, 5, "%s = Embedded Time", time_string);
+ proto_tree_add_string(secondary_header_tree, hf_ccsds_embedded_time, tvb, offset-5, 5, time_string);
proto_tree_add_item(secondary_header_tree, hf_ccsds_timeid, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(secondary_header_tree, hf_ccsds_checkword_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
+ checkword_item = proto_tree_add_item(secondary_header_tree, hf_ccsds_checkword_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
/* Global Preference: how to handle checkword flag */
switch (global_dissect_checkword) {
@@ -448,10 +451,10 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (reported_length < ccsds_length || ccsds_length < CCSDS_PRIMARY_HEADER_LENGTH + CCSDS_SECONDARY_HEADER_LENGTH) {
/* Label CCSDS payload 'User Data' */
if (length > offset)
- proto_tree_add_text(ccsds_tree, tvb, offset, length-offset, "User Data");
+ proto_tree_add_item(ccsds_tree, hf_ccsds_user_data, tvb, offset, length-offset, ENC_NA);
offset += length-offset;
if (checkword_flag == 1)
- proto_tree_add_text(ccsds_tree, tvb, offset, 0, "Packet does not contain a Checkword");
+ expert_add_info(pinfo, checkword_item, &ei_ccsds_checkword);
}
/* Handle checkword according to CCSDS preference setting. */
else {
@@ -459,7 +462,7 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Look for a subdissector for the CCSDS payload */
if (!dissector_try_uint(ccsds_dissector_table, first_word&HDR_APID, next_tvb, pinfo, tree)) {
/* If no subdissector is found, label the CCSDS payload as 'User Data' */
- proto_tree_add_text(ccsds_tree, tvb, offset, length-offset-2*checkword_flag, "User Data");
+ proto_tree_add_item(ccsds_tree, hf_ccsds_user_data, tvb, offset, length-offset-2*checkword_flag, ENC_NA);
}
offset += length-offset-2*checkword_flag;
@@ -640,6 +643,16 @@ proto_register_ccsds(void)
FT_UINT8, BASE_DEC, NULL, 0xff,
NULL, HFILL }
},
+ { &hf_ccsds_embedded_time,
+ { "Embedded Time", "ccsds.embedded_time",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_ccsds_user_data,
+ { "User Data", "ccsds.user_data",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
{ &hf_ccsds_checkword,
{ "CCSDS checkword", "ccsds.checkword",
FT_UINT16, BASE_HEX, NULL, 0x0,
@@ -667,6 +680,7 @@ proto_register_ccsds(void)
static ei_register_info ei[] = {
{ &ei_ccsds_length_error, { "ccsds.length.error", PI_MALFORMED, PI_ERROR, "Length field value is greater than the packet seen on the wire", EXPFILL }},
+ { &ei_ccsds_checkword, { "ccsds.no_checkword", PI_PROTOCOL, PI_WARN, "Packet does not contain a Checkword", EXPFILL }},
};
/* Define the CCSDS preferences module */