*
* Copyright 2013, Michal Labedzki for Tieto Corporation
*
- * $Id$
- *
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
void proto_register_btmcap(void);
void proto_reg_handoff_btmcap(void);
-static void
-dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *main_item;
proto_tree *main_tree;
guint32 bluetooth_clock_sync_time;
guint64 timestamp_sync_time;
+ main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, -1, ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_btmcap);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MCAP");
- col_clear(pinfo->cinfo, COL_INFO);
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
- col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
+ col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
break;
case P2P_DIR_RECV:
- col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
+ col_set_str(pinfo->cinfo, COL_INFO, "Rcvd ");
break;
default:
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
break;
}
- main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, -1, ENC_NA);
- main_tree = proto_item_add_subtree(main_item, ett_btmcap);
-
pitem = proto_tree_add_item(main_tree, hf_btmcap_op_code, tvb, offset, 1, ENC_BIG_ENDIAN);
op_code = tvb_get_guint8(tvb, offset);
offset += 1;
col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(op_code, op_code_vals, "Unknown Op Code"));
if (op_code >= 0x11 && op_code <= 0x20) {
proto_item_append_text(pitem, " (Clock Sync)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Clock Sync)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Clock Sync)");
} else {
proto_item_append_text(pitem, " (Standard)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Standard)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Standard)");
}
if (op_code & 0x01) {
col_append_fstr(pinfo->cinfo, COL_INFO, " (Dynamic Range)");
} else if (mdl_id == 0x0000) {
proto_item_append_text(pitem, " (Reserved)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Reserved)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Reserved)");
}
if (op_code != 0x07 && mdl_id == 0xFFFF) {
if (bluetooth_clock_sync_time == 0xFFFFFFFF)
proto_item_append_text(pitem, " (Instant Synchronization)");
else
- proto_item_append_text(pitem, " (Baseband Half-Slot Instant)");;
+ proto_item_append_text(pitem, " (Baseband Half-Slot Instant)");
offset += 4;
pitem = proto_tree_add_item(main_tree, hf_btmcap_timestamp_sync_time, tvb, offset, 8, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, " - %u", mdl_id);
if (mdl_id == 0xFFFF) {
proto_item_append_text(pitem, " (Indicates all MDLs)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Indicates all MDLs)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Indicates all MDLs)");
} else if (mdl_id >= 0x0001 && mdl_id <= 0xFEFF) {
proto_item_append_text(pitem, " (Dynamic Range)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Dynamic Range)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Dynamic Range)");
} else if (mdl_id == 0x0000) {
proto_item_append_text(pitem, " (Reserved)");
- col_append_fstr(pinfo->cinfo, COL_INFO, " (Reserved)");
+ col_append_str(pinfo->cinfo, COL_INFO, " (Reserved)");
}
if ((op_code == 0x03 || op_code == 0x05 || op_code == 0x07) && tvb_length_remaining(tvb, offset)) {
- expert_add_info_format_text(pinfo, pitem, &ei_btmcap_response_parameters_bad,
+ expert_add_info_format(pinfo, pitem, &ei_btmcap_response_parameters_bad,
"The Response Parameters for MD_RECONNECT_MDL_RSP shall have length zero.");
} else if (tvb_length_remaining(tvb, offset)) {
pitem = proto_tree_add_item(main_tree, hf_btmcap_response_parameters, tvb, offset, -1, ENC_NA);
if (response_code != 0x00) {
- expert_add_info_format_text(pinfo, pitem, &ei_btmcap_response_parameters_bad,
+ expert_add_info_format(pinfo, pitem, &ei_btmcap_response_parameters_bad,
"When the Response Code is not Success, the Response Parameters shall have length zero.");
}
offset += tvb_length_remaining(tvb, offset);
if (tvb_length_remaining(tvb, offset)) {
pitem = proto_tree_add_item(main_tree, hf_btmcap_data, tvb, offset, -1, ENC_NA);
expert_add_info(pinfo, pitem, &ei_btmcap_unexpected_data);
+ offset = tvb_length(tvb);
}
+
+ return offset;
}
proto_register_btmcap(void)
{
module_t *module;
- expert_module_t* expert_btmcap;
+ expert_module_t *expert_btmcap;
static hf_register_info hf[] = {
{ &hf_btmcap_op_code,
};
proto_btmcap = proto_register_protocol("Bluetooth MCAP Protocol", "BT MCAP", "btmcap");
- register_dissector("btmcap", dissect_btmcap, proto_btmcap);
+ new_register_dissector("btmcap", dissect_btmcap, proto_btmcap);
proto_register_field_array(proto_btmcap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));