aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2008-06-23 13:02:50 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2008-06-23 13:02:50 +0000
commit4aa522855d1d165b8573a36429ad869fa31a49cc (patch)
tree788d07c5244c60fe22bd681ce85df9e6c88e19cd
parentd2036aca8a926a32f409b3410afbf5bb10281d8d (diff)
Make sure info column is set correctly when tree == NULL.
Fixes but 2561. svn path=/trunk/; revision=25530
-rw-r--r--plugins/wimaxasncp/packet-wimaxasncp.c166
1 files changed, 79 insertions, 87 deletions
diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c
index afe42e5fcc..22387d5d57 100644
--- a/plugins/wimaxasncp/packet-wimaxasncp.c
+++ b/plugins/wimaxasncp/packet-wimaxasncp.c
@@ -1863,41 +1863,38 @@ static guint dissect_wimaxasncp_backend(
dbit_show = FALSE;
ui16 = tvb_get_ntohs(tvb, offset);
- if (tree)
+ if (show_transaction_id_d_bit)
{
- if (show_transaction_id_d_bit)
- {
- const guint16 mask = 0x7fff;
-
- if (ui16 & 0x8000)
- {
- proto_tree_add_uint_format(
- tree, hf_wimaxasncp_transaction_id,
- tvb, offset, 2, ui16,
- "Transaction ID: D + 0x%04x (0x%04x)", mask & ui16, ui16);
+ const guint16 mask = 0x7fff;
- tid = ui16 & mask;
- dbit_show = TRUE;
- }
- else
- {
- proto_tree_add_uint_format(
- tree, hf_wimaxasncp_transaction_id,
- tvb, offset, 2, ui16,
- "Transaction ID: 0x%04x", ui16);
+ if (ui16 & 0x8000)
+ {
+ proto_tree_add_uint_format(
+ tree, hf_wimaxasncp_transaction_id,
+ tvb, offset, 2, ui16,
+ "Transaction ID: D + 0x%04x (0x%04x)", mask & ui16, ui16);
- tid = ui16;
- }
+ tid = ui16 & mask;
+ dbit_show = TRUE;
}
else
{
- proto_tree_add_uint(
+ proto_tree_add_uint_format(
tree, hf_wimaxasncp_transaction_id,
- tvb, offset, 2, ui16);
+ tvb, offset, 2, ui16,
+ "Transaction ID: 0x%04x", ui16);
tid = ui16;
}
}
+ else
+ {
+ proto_tree_add_uint(
+ tree, hf_wimaxasncp_transaction_id,
+ tvb, offset, 2, ui16);
+
+ tid = ui16;
+ }
offset += 2;
@@ -1973,8 +1970,13 @@ dissect_wimaxasncp(
guint8 ui8;
guint8 function_type;
+ proto_item *function_type_item;
guint16 length;
+ const gchar *message_name;
+ const wimaxasncp_func_msg_t *p = NULL;
+ gsize i;
+
/* ------------------------------------------------------------------------
* First, we do some heuristics to check if the packet cannot be our
* protocol.
@@ -2133,24 +2135,20 @@ dissect_wimaxasncp(
function_type = tvb_get_guint8(tvb, offset);
- if (tree)
- {
- proto_item *function_type_item;
- function_type_item = proto_tree_add_item(
- wimaxasncp_tree, hf_wimaxasncp_function_type,
- tvb, offset, 1, FALSE);
+ function_type_item = proto_tree_add_item(
+ wimaxasncp_tree, hf_wimaxasncp_function_type,
+ tvb, offset, 1, FALSE);
- /* Add expert item if not matched */
- if (strcmp(val_to_str(function_type,
- wimaxasncp_function_type_vals,
- unknown),
- unknown) == 0)
- {
- expert_add_info_format(pinfo, function_type_item,
- PI_UNDECODED, PI_WARN,
- "Unknown function type (%u)",
- function_type);
- }
+ /* Add expert item if not matched */
+ if (strcmp(val_to_str(function_type,
+ wimaxasncp_function_type_vals,
+ unknown),
+ unknown) == 0)
+ {
+ expert_add_info_format(pinfo, function_type_item,
+ PI_UNDECODED, PI_WARN,
+ "Unknown function type (%u)",
+ function_type);
}
offset += 1;
@@ -2162,65 +2160,59 @@ dissect_wimaxasncp(
ui8 = tvb_get_guint8(tvb, offset);
- if (tree)
- {
- const gchar *message_name;
- const wimaxasncp_func_msg_t *p = NULL;
- gsize i;
- /* --------------------------------------------------------------------
- * OP ID
- * --------------------------------------------------------------------
- */
+ /* --------------------------------------------------------------------
+ * OP ID
+ * --------------------------------------------------------------------
+ */
- item = proto_tree_add_uint_format(
- wimaxasncp_tree, hf_wimaxasncp_op_id,
- tvb, offset, 1, ui8,
- "OP ID: %s", val_to_str(ui8 >> 5, wimaxasncp_op_id_vals, unknown));
+ item = proto_tree_add_uint_format(
+ wimaxasncp_tree, hf_wimaxasncp_op_id,
+ tvb, offset, 1, ui8,
+ "OP ID: %s", val_to_str(ui8 >> 5, wimaxasncp_op_id_vals, unknown));
- proto_item_append_text(
- item, " (%s)", decode_numeric_bitfield(ui8, 0xe0, 8, "%u"));
+ proto_item_append_text(
+ item, " (%s)", decode_numeric_bitfield(ui8, 0xe0, 8, "%u"));
- /* use the function type to find the message vals */
- for (i = 0; i < array_length(wimaxasncp_func_to_msg_vals_map); ++i)
- {
- p = &wimaxasncp_func_to_msg_vals_map[i];
+ /* use the function type to find the message vals */
+ for (i = 0; i < array_length(wimaxasncp_func_to_msg_vals_map); ++i)
+ {
+ p = &wimaxasncp_func_to_msg_vals_map[i];
- if (function_type == p->function_type)
- {
- break;
- }
+ if (function_type == p->function_type)
+ {
+ break;
}
+ }
- /* --------------------------------------------------------------------
- * message type
- * --------------------------------------------------------------------
- */
+ /* --------------------------------------------------------------------
+ * message type
+ * --------------------------------------------------------------------
+ */
- message_name = p ? val_to_str(0x1f & ui8, p->vals, unknown) : unknown;
+ message_name = p ? val_to_str(0x1f & ui8, p->vals, unknown) : unknown;
- item = proto_tree_add_uint_format(
- wimaxasncp_tree, hf_wimaxasncp_op_id,
- tvb, offset, 1, ui8,
- "Message Type: %s", message_name);
+ item = proto_tree_add_uint_format(
+ wimaxasncp_tree, hf_wimaxasncp_op_id,
+ tvb, offset, 1, ui8,
+ "Message Type: %s", message_name);
- proto_item_append_text(
- item, " (%s)", decode_numeric_bitfield(ui8, 0x1f, 8, "%u"));
+ proto_item_append_text(
+ item, " (%s)", decode_numeric_bitfield(ui8, 0x1f, 8, "%u"));
- /* Add expert item if not matched */
- if (strcmp(message_name, unknown) == 0)
- {
- expert_add_info_format(pinfo, item,
- PI_UNDECODED, PI_WARN,
- "Unknown message op (%u)",
- 0x1f & ui8);
- }
+ /* Add expert item if not matched */
+ if (strcmp(message_name, unknown) == 0)
+ {
+ expert_add_info_format(pinfo, item,
+ PI_UNDECODED, PI_WARN,
+ "Unknown message op (%u)",
+ 0x1f & ui8);
+ }
- if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_add_str(pinfo->cinfo, COL_INFO, message_name);
- }
+ if (check_col(pinfo->cinfo, COL_INFO))
+ {
+ col_add_str(pinfo->cinfo, COL_INFO, message_name);
}
offset += 1;