From 562c8905607f4e8ccbcefee2da84fff9f7c5c6cb Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Fri, 28 Sep 2012 19:50:49 +0000 Subject: Cleanup: packet-mpls.c: - refactor dissect_pw_ach(); - create/uer value_string_ext as appropriate; - use call_dissector() rather than direct dissector call in one cse; all: - use 'LABEL' prefix for a set of rather generic enum identifiers; - fix some cases of calling expert...() or sub-dissectors under 'if(tree)'; - reformat some hf[] entries; - do some whitespace changes. svn path=/trunk/; revision=45195 --- epan/dissectors/packet-pw-satop.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'epan/dissectors/packet-pw-satop.c') diff --git a/epan/dissectors/packet-pw-satop.c b/epan/dissectors/packet-pw-satop.c index c594dd0ece..3042675367 100644 --- a/epan/dissectors/packet-pw-satop.c +++ b/epan/dissectors/packet-pw-satop.c @@ -69,10 +69,11 @@ void dissect_pw_satop(tvbuff_t * tvb_original ,pwc_demux_type_t demux) { const int encaps_size = 4; /*RTP header in encapsulation is not supported yet*/ - gint packet_size; - gint payload_size; - gint padding_size; + gint packet_size; + gint payload_size; + gint padding_size; pwc_packet_properties_t properties; + enum { PAY_NO_IDEA = 0 ,PAY_LIKE_E1 @@ -89,14 +90,11 @@ void dissect_pw_satop(tvbuff_t * tvb_original */ if (packet_size < 4) /* 4 is smallest size which may be sensible (for PWACH dissector) */ { - if (tree) - { - proto_item *item; - item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "PW packet size (%d) is too small to carry sensible information" - ,(int)packet_size); - } + proto_item *item; + item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA); + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, + "PW packet size (%d) is too small to carry sensible information" + ,(int)packet_size); col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet is too small"); return; @@ -145,7 +143,7 @@ void dissect_pw_satop(tvbuff_t * tvb_original * * We will use RFC4553's definition here. */ - int cw_len; + int cw_len; gint payload_size_from_packet; cw_len = tvb_get_guint8(tvb_original, 1) & 0x3f; @@ -221,10 +219,7 @@ void dissect_pw_satop(tvbuff_t * tvb_original } /* fill up columns*/ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - { - col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); - } + col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); @@ -249,7 +244,6 @@ void dissect_pw_satop(tvbuff_t * tvb_original } - if (tree) { proto_item* item; item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA); @@ -456,6 +450,6 @@ void proto_reg_handoff_pw_satop(void) { data_handle = find_dissector("data"); pw_padding_handle = find_dissector("pw_padding"); - dissector_add_uint("mpls.label", LABEL_INVALID, find_dissector("pw_satop_mpls")); + dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, find_dissector("pw_satop_mpls")); dissector_add_handle("udp.port", find_dissector("pw_satop_udp")); /* for Decode-As */ } -- cgit v1.2.3