aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bfcp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
committerBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
commit1b17369504e600fbddc53c67d634039ba37ac6b7 (patch)
tree3bf66240055157786e65245a2966939bf0d571c7 /epan/dissectors/packet-bfcp.c
parent5b53b81835a64b5219236922c7c91e7d9c3c1efb (diff)
Fix: code under 'if(tree)' (in)directly calls sub-dissector/col_...()/expert...() fcns
svn path=/trunk/; revision=43226
Diffstat (limited to 'epan/dissectors/packet-bfcp.c')
-rw-r--r--epan/dissectors/packet-bfcp.c111
1 files changed, 56 insertions, 55 deletions
diff --git a/epan/dissectors/packet-bfcp.c b/epan/dissectors/packet-bfcp.c
index e256254fff..16886ec0c0 100644
--- a/epan/dissectors/packet-bfcp.c
+++ b/epan/dissectors/packet-bfcp.c
@@ -129,6 +129,9 @@ static gboolean dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
guint8 primitive;
const gchar *str;
gint bfcp_payload_length;
+ gint read_attr = 0;
+ proto_tree *bfcp_tree = NULL;
+
/* Size of smallest BFCP packet: 12 octets */
if (tvb_length(tvb) < 12)
@@ -158,77 +161,75 @@ static gboolean dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
col_add_str(pinfo->cinfo, COL_INFO, str);
if (tree) {
- gint read_attr = 0;
- proto_item *ti;
- proto_tree *bfcp_tree;
-
+ proto_item *ti;
ti = proto_tree_add_item(tree, proto_bfcp, tvb, 0, -1, ENC_NA);
bfcp_tree = proto_item_add_subtree(ti, ett_bfcp);
/* Add items to BFCP tree */
proto_tree_add_item(bfcp_tree, hf_bfcp_transaction_initiator, tvb,
- BFCP_OFFSET_TRANSACTION_INITIATOR, 1, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_TRANSACTION_INITIATOR, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(bfcp_tree, hf_bfcp_primitive, tvb,
- BFCP_OFFSET_PRIMITIVE, 1, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_PRIMITIVE, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(bfcp_tree, hf_bfcp_payload_length, tvb,
- BFCP_OFFSET_PAYLOAD_LENGTH, 2, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_PAYLOAD_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(bfcp_tree, hf_bfcp_conference_id, tvb,
- BFCP_OFFSET_CONFERENCE_ID, 4, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_CONFERENCE_ID, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(bfcp_tree, hf_bfcp_transaction_id, tvb,
- BFCP_OFFSET_TRANSACTION_ID, 2, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_TRANSACTION_ID, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(bfcp_tree, hf_bfcp_user_id, tvb,
- BFCP_OFFSET_USER_ID, 2, ENC_BIG_ENDIAN);
+ BFCP_OFFSET_USER_ID, 2, ENC_BIG_ENDIAN);
+ }
- bfcp_payload_length = tvb_get_ntohs(tvb,
- BFCP_OFFSET_PAYLOAD_LENGTH) * 4;
+ bfcp_payload_length = tvb_get_ntohs(tvb,
+ BFCP_OFFSET_PAYLOAD_LENGTH) * 4;
- while ((tvb_reported_length_remaining(tvb, BFCP_OFFSET_PAYLOAD + read_attr) >= 2) &&
- ((bfcp_payload_length - read_attr) >= 2))
+ while ((tvb_reported_length_remaining(tvb, BFCP_OFFSET_PAYLOAD + read_attr) >= 2) &&
+ ((bfcp_payload_length - read_attr) >= 2))
+ {
+ proto_item *ti;
+ gint read = 0;
+ gint length;
+ guint8 first_byte;
+ guint8 attribute_type;
+
+ first_byte = tvb_get_guint8(tvb, BFCP_OFFSET_PAYLOAD + read_attr);
+
+ /* Padding so continue to next attribute */
+ if (first_byte == 0)
{
- gint read = 0;
- gint length;
- guint8 first_byte;
- guint8 attribute_type;
-
- first_byte = tvb_get_guint8(tvb, BFCP_OFFSET_PAYLOAD + read_attr);
-
- /* Padding so continue to next attribute */
- if (first_byte == 0)
- {
- read_attr++;
- continue;
- }
-
- proto_tree_add_item(bfcp_tree, hf_bfcp_attribute_types, tvb,
- BFCP_OFFSET_PAYLOAD + read_attr,1, ENC_BIG_ENDIAN);
- attribute_type = (first_byte & 0xFE) >> 1;
- read++;
+ read_attr++;
+ continue;
+ }
- ti = proto_tree_add_item(bfcp_tree, hf_bfcp_attribute_length, tvb,
- BFCP_OFFSET_PAYLOAD + read_attr + read,1, ENC_BIG_ENDIAN);
- length = tvb_get_guint8(tvb, BFCP_OFFSET_PAYLOAD + read_attr + read);
- read++;
+ proto_tree_add_item(bfcp_tree, hf_bfcp_attribute_types, tvb,
+ BFCP_OFFSET_PAYLOAD + read_attr,1, ENC_BIG_ENDIAN);
+ attribute_type = (first_byte & 0xFE) >> 1;
+ read++;
+
+ ti = proto_tree_add_item(bfcp_tree, hf_bfcp_attribute_length, tvb,
+ BFCP_OFFSET_PAYLOAD + read_attr + read,1, ENC_BIG_ENDIAN);
+ length = tvb_get_guint8(tvb, BFCP_OFFSET_PAYLOAD + read_attr + read);
+ read++;
- /* If RequestStatus then show what type of status it is... */
- if (attribute_type == 5)
- {
- proto_tree_add_item(bfcp_tree, hf_bfcp_request_status, tvb,
- BFCP_OFFSET_PAYLOAD + read_attr + read,1, ENC_BIG_ENDIAN);
- read++;
- }
- if (length >= read)
- {
- proto_tree_add_item(bfcp_tree, hf_bfcp_payload, tvb,
- BFCP_OFFSET_PAYLOAD + read_attr + read, length-read, ENC_NA);
- }
- else
- {
- expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
- "Attribute length is too small (%d bytes)", length);
- break;
- }
- read_attr = read_attr + length;
+ /* If RequestStatus then show what type of status it is... */
+ if (attribute_type == 5)
+ {
+ proto_tree_add_item(bfcp_tree, hf_bfcp_request_status, tvb,
+ BFCP_OFFSET_PAYLOAD + read_attr + read,1, ENC_BIG_ENDIAN);
+ read++;
+ }
+ if (length >= read)
+ {
+ proto_tree_add_item(bfcp_tree, hf_bfcp_payload, tvb,
+ BFCP_OFFSET_PAYLOAD + read_attr + read, length-read, ENC_NA);
+ }
+ else
+ {
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Attribute length is too small (%d bytes)", length);
+ break;
}
+ read_attr = read_attr + length;
}
return TRUE;
}