aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hci_mon.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-hci_mon.c')
-rw-r--r--epan/dissectors/packet-hci_mon.c93
1 files changed, 55 insertions, 38 deletions
diff --git a/epan/dissectors/packet-hci_mon.c b/epan/dissectors/packet-hci_mon.c
index e9a8b07bae..0fb54e7953 100644
--- a/epan/dissectors/packet-hci_mon.c
+++ b/epan/dissectors/packet-hci_mon.c
@@ -19,33 +19,34 @@
#include "packet-bluetooth.h"
-static int proto_hci_mon = -1;
-
-static int hf_adapter_id = -1;
-static int hf_opcode = -1;
-static int hf_type = -1;
-static int hf_bus = -1;
-static int hf_bd_addr = -1;
-static int hf_name = -1;
-static int hf_manufacturer = -1;
-static int hf_system_note = -1;
-static int hf_priority = -1;
-static int hf_ident_length = -1;
-static int hf_ident = -1;
-static int hf_cookie = -1;
-static int hf_format = -1;
-static int hf_version = -1;
-static int hf_revision = -1;
-static int hf_flags = -1;
-static int hf_flags_trusted_socket = -1;
-static int hf_command_length = -1;
-static int hf_command = -1;
-static int hf_event = -1;
-
-static gint ett_hci_mon = -1;
-static gint ett_flags = -1;
-
-static expert_field ei_unknown_data = EI_INIT;
+static int proto_hci_mon;
+
+static int hf_adapter_id;
+static int hf_opcode;
+static int hf_type;
+static int hf_bus;
+static int hf_bd_addr;
+static int hf_name;
+static int hf_manufacturer;
+static int hf_system_note;
+static int hf_priority;
+static int hf_ident_length;
+static int hf_ident;
+static int hf_message;
+static int hf_cookie;
+static int hf_format;
+static int hf_version;
+static int hf_revision;
+static int hf_flags;
+static int hf_flags_trusted_socket;
+static int hf_command_length;
+static int hf_command;
+static int hf_event;
+
+static gint ett_hci_mon;
+static gint ett_flags;
+
+static expert_field ei_unknown_data;
static wmem_tree_t *adapter_to_disconnect_in_frame = NULL;
@@ -128,6 +129,19 @@ static const value_string format_vals[] = {
};
static value_string_ext(format_vals_ext) = VALUE_STRING_EXT_INIT(format_vals);
+static const value_string priority_vals[] = {
+ { 0, "EMERG" },
+ { 1, "ALERT" },
+ { 2, "CRIT" },
+ { 3, "ERR" },
+ { 4, "WARNING" },
+ { 5, "NOTICE" },
+ { 6, "INFO" },
+ { 7, "DEBUG" },
+ { 0, NULL }
+};
+static value_string_ext(priority_vals_ext) = VALUE_STRING_EXT_INIT(priority_vals);
+
#define EVENT_COMMAND_COMPLETE 0x0001
#define EVENT_COMMAND_STATUS 0x0002
#define EVENT_CONTROLLER_ERROR 0x0003
@@ -286,7 +300,7 @@ dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_item_set_generated(sub_item);
col_append_fstr(pinfo->cinfo, COL_INFO, "Adapter Id: %u, Opcode: %s",
- adapter_id, val_to_str_ext_const(opcode, &hci_mon_opcode_vals_ext, "Unknown (%u)"));
+ adapter_id, val_to_str_ext(opcode, &hci_mon_opcode_vals_ext, "Unknown (%u)"));
bluetooth_data->adapter_id = adapter_id;
@@ -324,7 +338,7 @@ dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (adapter_disconnect_in_frame) {
bluetooth_data->adapter_disconnect_in_frame = adapter_disconnect_in_frame;
} else {
- bluetooth_data->adapter_disconnect_in_frame = &max_disconnect_in_frame;
+ bluetooth_data->adapter_disconnect_in_frame = &bluetooth_max_disconnect_in_frame;
}
pinfo->ptype = PT_BLUETOOTH;
@@ -414,16 +428,14 @@ dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(hci_mon_tree, hf_priority, tvb, offset, 1, ENC_NA);
offset += 1;
- proto_tree_add_item_ret_uint(hci_mon_tree, hf_priority, tvb, offset, 1, ENC_NA, &ident_length);
+ proto_tree_add_item_ret_uint(hci_mon_tree, hf_ident_length, tvb, offset, 1, ENC_NA, &ident_length);
offset += 1;
- /*
- * XXX - this is both counted and NUL-terminated, so you have
- * <length> bytes of string followed by a NUL. We'll just
- * treat it as counted.
- */
- proto_tree_add_item(hci_mon_tree, hf_priority, tvb, offset, ident_length, ENC_NA | ENC_ASCII);
- offset += ident_length + 1; /* Skip the terminating NUL */
+ proto_tree_add_item(hci_mon_tree, hf_ident, tvb, offset, ident_length, ENC_NA | ENC_ASCII);
+ offset += ident_length;
+
+ proto_tree_add_item(hci_mon_tree, hf_message, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA | ENC_ASCII);
+ offset = tvb_reported_length(tvb);
break;
@@ -545,7 +557,7 @@ proto_register_hci_mon(void)
},
{ &hf_priority,
{ "Priority", "hci_mon.priority",
- FT_UINT8, BASE_DEC, NULL, 0x0,
+ FT_UINT8, BASE_DEC | BASE_EXT_STRING, &priority_vals_ext, 0x0,
NULL, HFILL}
},
{ &hf_ident_length,
@@ -558,6 +570,11 @@ proto_register_hci_mon(void)
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL}
},
+ { &hf_message,
+ { "Message", "hci_mon.message",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
{ &hf_cookie,
{ "Cookie", "hci_mon.cookie",
FT_UINT32, BASE_HEX, NULL, 0x0,