diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-05 08:48:37 -0400 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-09-06 07:44:46 +0000 |
commit | ceef7eba755cbecf670653360f72d864949dac49 (patch) | |
tree | 2cc48ebd17a4e7dc714f1b00af21f4f92546c948 /epan/dissectors/packet-pcep.c | |
parent | f1ad9eb212a6f4c5e1b6b1963bccf5f3a4900293 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: I8ea59205cfe6fab643d8fe01b75ce91532004fd9
Reviewed-on: https://code.wireshark.org/review/4004
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-pcep.c')
-rw-r--r-- | epan/dissectors/packet-pcep.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c index 0448a7d3dc..0e9cd97201 100644 --- a/epan/dissectors/packet-pcep.c +++ b/epan/dissectors/packet-pcep.c @@ -286,6 +286,7 @@ static gint hf_PCEPF_NOTI_VAL1 = -1; static gint hf_PCEPF_NOTI_VAL2 = -1; static gint hf_PCEPF_OBJ_PCEP_ERROR = -1; static gint hf_PCEPF_ERROR_TYPE = -1; +static gint hf_PCEPF_ERROR_VALUE = -1; static gint hf_PCEPF_OBJ_LOAD_BALANCING = -1; static gint hf_PCEPF_OBJ_CLOSE = -1; static gint hf_PCEPF_OBJ_PATH_KEY = -1; @@ -1812,6 +1813,7 @@ dissect_pcep_error_obj(proto_tree *pcep_object_tree, packet_info *pinfo, tvbuff_ { guint8 error_type; guint8 error_value; + proto_item* type_item; const gchar *err_str = "Unassigned"; if (obj_length < OBJ_HDR_LEN+ERROR_OBJ_MIN_LEN) { @@ -1827,7 +1829,7 @@ dissect_pcep_error_obj(proto_tree *pcep_object_tree, packet_info *pinfo, tvbuff_ error_type = tvb_get_guint8(tvb, offset2+2); error_value = tvb_get_guint8(tvb, offset2+3); - proto_tree_add_item(pcep_object_tree, hf_PCEPF_ERROR_TYPE, tvb, offset2+2, 1, ENC_NA); + type_item = proto_tree_add_item(pcep_object_tree, hf_PCEPF_ERROR_TYPE, tvb, offset2+2, 1, ENC_NA); switch (error_type) { case ESTABLISH_FAILURE: @@ -1877,9 +1879,9 @@ dissect_pcep_error_obj(proto_tree *pcep_object_tree, packet_info *pinfo, tvbuff_ err_str = val_to_str_const(error_value, pcep_error_value_18_vals, "Unknown"); break; default: - proto_tree_add_text(pcep_object_tree, tvb, offset2+2, 1, "Error-Type: %u Non defined Error-Value", error_type); + proto_item_append_text(type_item, " (%u Non defined Error-Value)", error_type); } - proto_tree_add_text(pcep_object_tree, tvb, offset2+3, 1, "Error-Value: %s (%u)", err_str, error_value); + proto_tree_add_uint_format_value(pcep_object_tree, hf_PCEPF_ERROR_VALUE, tvb, offset2+3, 1, error_value, "%s (%u)", err_str, error_value); /*it's suppose that obj_length is a valid date. The object can have optional TLV(s)*/ offset2 += ERROR_OBJ_MIN_LEN; @@ -2859,6 +2861,11 @@ proto_register_pcep(void) FT_UINT8, BASE_DEC | BASE_EXT_STRING, &pcep_error_types_obj_vals_ext, 0x0, NULL, HFILL } }, + { &hf_PCEPF_ERROR_VALUE, + { "Error-Value", "pcep.error.value", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_PCEPF_OBJ_LOAD_BALANCING, { "LOAD BALANCING object", "pcep.obj.loadbalancing", FT_NONE, BASE_NONE, NULL, 0x0, |