From Kovarththanan Rajaratnam:

The Bluetooth AMP Manager protocol was recently adopted by the Bluetooth SIG.
This protocol sits on top of L2CAP and requires a few changes in order to
accommodate the new move/create channel request.

This patch includes:
* a new Bluetooth AMP Manager Protocol dissector
* changes to L2CAP to handle the new move/create channel signals
* introduce a dissector table for fixed channel, allowing btamp dissector to
handle the BT AMP Manager Protocol channel
* Preliminary changes in L2CAP to support the new enhanced L2CAP modes
(enhanced retransmission/streaming mode)

svn path=/trunk/; revision=28819
This commit is contained in:
Jaap Keuter 2009-06-23 06:49:38 +00:00
parent 9ba3058f05
commit 083c3a3027
4 changed files with 1100 additions and 21 deletions

View File

@ -264,6 +264,7 @@ DISSECTOR_SRC = \
packet-brdwlk.c \
packet-bssap.c \
packet-bssgp.c \
packet-btamp.c \
packet-bthci_acl.c \
packet-bthci_cmd.c \
packet-bthci_evt.c \

View File

@ -0,0 +1,645 @@
/* packet-btamp.c
* Routines for the Bluetooth AMP dissection
*
* Copyright 2009, Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <glib.h>
#include <epan/packet.h>
#include <etypes.h>
#include <epan/emem.h>
#include "packet-bthci_acl.h"
#include "packet-btl2cap.h"
/* Initialize the protocol and registered fields */
static int proto_btamp = -1;
static int hf_btamp_command = -1;
static int hf_btamp_cmd_code = -1;
static int hf_btamp_cmd_ident = -1;
static int hf_btamp_cmd_length = -1;
static int hf_btamp_cmd_data = -1;
static int hf_btamp_rej_reason = -1;
static int hf_btamp_mtu = -1;
static int hf_btamp_extfeatures = -1;
static int hf_btamp_lcontroller_id = -1;
static int hf_btamp_rcontroller_id = -1;
static int hf_btamp_controller_list = -1;
static int hf_btamp_controllers = -1;
static int hf_btamp_controller_id = -1;
static int hf_btamp_controller_type = -1;
static int hf_btamp_controller_status = -1;
static int hf_btamp_status = -1;
static int hf_btamp_create_status = -1;
static int hf_btamp_disc_status = -1;
static int hf_btamp_total_bw = -1;
static int hf_btamp_max_guaran_bw = -1;
static int hf_btamp_min_latency = -1;
static int hf_btamp_pal_caps_guaranteed = -1;
static int hf_btamp_pal_caps_mask = -1;
static int hf_btamp_amp_assoc_size = -1;
static int hf_btamp_amp_assoc = -1;
/* Initialize the subtree pointers */
static gint ett_btamp = -1;
static gint ett_btamp_cmd = -1;
static gint ett_btamp_caps = -1;
static gint ett_btamp_controller_entry = -1;
static gint ett_btamp_controller_list = -1;
static const value_string command_code_vals[] = {
{ 0x01, "AMP Command Reject" },
{ 0x02, "AMP Discover Request" },
{ 0x03, "AMP Discover Response" },
{ 0x04, "AMP Change Notify" },
{ 0x05, "AMP Change Response" },
{ 0x06, "AMP Get Info Request" },
{ 0x07, "AMP Get Info Response" },
{ 0x08, "AMP Get AMP Assoc Request" },
{ 0x09, "AMP Get AMP Assoc Response" },
{ 0x0A, "AMP Create Physical Link Request" },
{ 0x0B, "AMP Create Physical Link Response" },
{ 0x0C, "AMP Disconnect Physical Link Request" },
{ 0x0D, "AMP Disconnect Physical Link Response" },
{ 0, NULL }
};
static const value_string reason_vals[] = {
{ 0x0000, "Command not understood" },
{ 0, NULL }
};
static const value_string controller_type_vals[] = {
{ 0x0000, "Bluetooth BR/EDR" },
{ 0x0001, "802.11" },
{ 0x0002, "ECMA-368" },
{ 0, NULL }
};
static const value_string controller_status_vals[] = {
{ 0x0000, "Controller available but currently physically powered down" },
{ 0x0001, "Controller used exclusively by Bluetooth BR/EDR" },
{ 0x0002, "Controller has no capacity available for Bluetooth operation" },
{ 0x0003, "Controller has low capacity available for Bluetooth operation" },
{ 0x0004, "Controller has medium capacity available for Bluetooth operation" },
{ 0x0005, "Controller has high capacity available for Bluetooth operation" },
{ 0x0006, "Controller has full capacity available for Bluetooth operation" },
{ 0, NULL }
};
static const value_string status_vals[] = {
{ 0x0000, "Success" },
{ 0x0001, "Invalid Controller ID" },
{ 0, NULL }
};
static const value_string create_status_vals[] = {
{ 0x0000, "Success" },
{ 0x0001, "Invalid Controller ID" },
{ 0x0002, "Failed - Unable to start link creation" },
{ 0x0003, "Failed - Collision Occurred" },
{ 0x0004, "Failed - AMP Disconnected Physical Link Request packet received" },
{ 0x0005, "Failed - Physical Link Already Exists" },
{ 0, NULL }
};
static const value_string disc_status_vals[] = {
{ 0x0000, "Success" },
{ 0x0001, "Invalid Controller ID" },
{ 0x0002, "Failed - No Physical Link exists and no Physical Link creation is in progress" },
{ 0, NULL }
};
static int
dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 reason;
reason = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btamp_rej_reason, tvb, offset, 2, TRUE);
offset+=2;
switch(reason){
case 0x0000: /* Command not understood */
break;
default:
break;
}
return offset;
}
static int
dissect_discoverrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, TRUE);
offset+=2;
return offset;
}
static int
dissect_controller_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint16 idx)
{
proto_tree *btamp_controller_entry_tree=NULL;
proto_item *ti_controller_entry=NULL;
ti_controller_entry=proto_tree_add_none_format(tree,
hf_btamp_controllers, tvb,
offset, 3,
"Entry: %u", idx);
btamp_controller_entry_tree=proto_item_add_subtree(ti_controller_entry, ett_btamp_controller_entry);
proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_type, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_status, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_discoverresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
guint16 length;
guint16 idx = 1;
proto_tree *btamp_controller_list_tree=NULL;
proto_item *ti_controller_list=NULL;
proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, TRUE);
offset+=2;
length = tvb_length_remaining(tvb, offset);
ti_controller_list=proto_tree_add_none_format(tree,
hf_btamp_controller_list, tvb,
offset, length,
"Controller list");
btamp_controller_list_tree=proto_item_add_subtree(ti_controller_list, ett_btamp_controller_list);
while ((length = tvb_length_remaining(tvb, offset)) >= 3) {
offset = dissect_controller_entry(tvb, offset, pinfo, btamp_controller_list_tree, idx);
++idx;
}
return offset;
}
static int
dissect_changenotify(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
guint16 length;
guint16 idx = 1;
proto_tree *btamp_controller_list_tree=NULL;
proto_item *ti_controller_list=NULL;
length = tvb_length_remaining(tvb, offset);
ti_controller_list=proto_tree_add_none_format(tree,
hf_btamp_controller_list, tvb,
offset, length,
"Controller list");
btamp_controller_list_tree=proto_item_add_subtree(ti_controller_list, ett_btamp_controller_list);
while ((length = tvb_length_remaining(tvb, offset)) >= 3) {
offset = dissect_controller_entry(tvb, offset, pinfo, btamp_controller_list_tree, idx);
++idx;
}
return offset;
}
static int
dissect_changeresponse(tvbuff_t *tvb _U_, int offset, packet_info *pinfo _U_, proto_tree *tree _U_)
{
return offset;
}
static int
dissect_getinforequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_getinforesponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree *btamp_controller_tree=NULL;
proto_item *ti_controller=NULL;
proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_total_bw, tvb, offset, 4, TRUE);
offset+=4;
proto_tree_add_item(tree, hf_btamp_max_guaran_bw, tvb, offset, 4, TRUE);
offset+=4;
proto_tree_add_item(tree, hf_btamp_min_latency, tvb, offset, 4, TRUE);
offset+=4;
ti_controller=proto_tree_add_none_format(tree,
hf_btamp_pal_caps_mask, tvb,
offset, 2,
"PAL Capabilities");
btamp_controller_tree=proto_item_add_subtree(ti_controller, ett_btamp_caps);
proto_tree_add_item(btamp_controller_tree, hf_btamp_pal_caps_guaranteed, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btamp_amp_assoc_size, tvb, offset, 2, TRUE);
offset+=2;
return offset;
}
static int
dissect_getampassocrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_ampassoc(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_amp_assoc, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
offset+=tvb_length_remaining(tvb, offset);
return offset;
}
static int
dissect_getampassocresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
offset+=1;
offset=dissect_ampassoc(tvb, offset, pinfo, tree);
return offset;
}
static int
dissect_createphysicalrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
offset=dissect_ampassoc(tvb, offset, pinfo, tree);
return offset;
}
static int
dissect_createphysicalresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_discphysicalchanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_discphysicalchanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
offset+=1;
proto_tree_add_item(tree, hf_btamp_controller_status, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static void dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset=0;
proto_item *ti=NULL;
proto_tree *btamp_tree=NULL;
guint16 length;
proto_tree *btamp_cmd_tree=NULL;
proto_item *ti_command=NULL;
guint8 cmd_code;
guint16 cmd_length;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMP");
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
if(tree){
ti=proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, FALSE);
btamp_tree=proto_item_add_subtree(ti, ett_btamp);
}
length = tvb_length_remaining(tvb, offset);
ti_command=proto_tree_add_none_format(btamp_tree,
hf_btamp_command, tvb,
offset, length,
"Command: ");
btamp_cmd_tree=proto_item_add_subtree(ti_command, ett_btamp_cmd);
cmd_code=tvb_get_guint8(tvb, offset);
proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_code, tvb, offset, 1, TRUE);
offset++;
proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_ident, tvb, offset, 1, TRUE);
offset++;
cmd_length=tvb_get_letohs(tvb, offset);
proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_length, tvb, offset, 2, TRUE);
proto_item_set_len(ti_command, cmd_length+4);
offset+=2;
switch(cmd_code) {
case 0x01: /* Command Reject */
offset=dissect_comrej(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x02: /* Discover Request */
offset=dissect_discoverrequest(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x03: /* Discover Response */
offset=dissect_discoverresponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x04: /* AMP Change Notify */
offset=dissect_changenotify(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x05: /* AMP Change Response */
offset=dissect_changeresponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x06: /* AMP Get Info Request */
offset=dissect_getinforequest(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x07: /* AMP Get Info Response */
offset=dissect_getinforesponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x08: /* Get AMP Assoc Request */
offset=dissect_getampassocrequest(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x09: /* Get AMP Assoc Response */
offset=dissect_getampassocresponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x0A: /* Create Physical Link Request */
offset=dissect_createphysicalrequest(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x0B: /* Create Physical Link Response */
offset=dissect_createphysicalresponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x0c: /* Disconnect Physical Link Request */
offset=dissect_discphysicalchanrequest(tvb, offset, pinfo, btamp_cmd_tree);
break;
case 0x0d: /* Disconnect Physical Link Response */
offset=dissect_discphysicalchanresponse(tvb, offset, pinfo, btamp_cmd_tree);
break;
default:
proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_data, tvb, offset, -1, TRUE);
offset+=tvb_length_remaining(tvb, offset);
break;
}
proto_item_append_text(ti_command, "%s", val_to_str(cmd_code, command_code_vals, "Unknown PDU (%u)"));
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(cmd_code, command_code_vals, "Unknown PDU (%u)"));
}
/* Register the protocol with Wireshark */
void
proto_register_btamp(void)
{
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
{ &hf_btamp_command,
{ "Command", "btamp.command",
FT_NONE, BASE_NONE, NULL, 0x0,
"L2CAP Command", HFILL }
},
{ &hf_btamp_cmd_code,
{ "Command Code", "btamp.cmd_code",
FT_UINT8, BASE_HEX, VALS(command_code_vals), 0x0,
"L2CAP Command Code", HFILL }
},
{ &hf_btamp_cmd_ident,
{ "Command Identifier", "btamp.cmd_ident",
FT_UINT8, BASE_HEX, NULL, 0x0,
"L2CAP Command Identifier", HFILL }
},
{ &hf_btamp_cmd_length,
{ "Command Length", "btamp.cmd_length",
FT_UINT8, BASE_DEC, NULL, 0x0,
"L2CAP Command Length", HFILL }
},
{ &hf_btamp_cmd_data,
{ "Command Data", "btamp.cmd_data",
FT_NONE, BASE_NONE, NULL, 0x0,
"L2CAP Command Data", HFILL }
},
{ &hf_btamp_rej_reason,
{ "Reason", "btl2cap.rej_reason",
FT_UINT16, BASE_HEX, VALS(reason_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_mtu,
{ "MPS/MTU", "btamp.mps",
FT_UINT16, BASE_HEX, NULL, 0x0,
"MPS/MTU Size", HFILL }
},
{ &hf_btamp_extfeatures,
{ "Extended Features", "btamp.extfeatures",
FT_UINT16, BASE_HEX, NULL, 0x0,
"Extended Features Mask", HFILL }
},
{ &hf_btamp_controllers,
{ "Controller entry", "btamp.ctrl_entry",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_controller_list,
{ "Controller list", "btamp.ctrl_list",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_lcontroller_id,
{ "Local Controller ID", "btamp.lctrl_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_rcontroller_id,
{ "Remote Controller ID", "btamp.rctrl_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_controller_id,
{ "Controller ID", "btamp.ctrl_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_controller_type,
{ "Controller Type", "btamp.ctrl_type",
FT_UINT8, BASE_DEC, VALS(controller_type_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_controller_status,
{ "Controller Status", "btamp.ctrl_status",
FT_UINT8, BASE_DEC, VALS(controller_status_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_status,
{ "Status", "btamp.status",
FT_UINT8, BASE_DEC, VALS(status_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_create_status,
{ "Status", "btamp.create_status",
FT_UINT8, BASE_DEC, VALS(create_status_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_disc_status,
{ "Status", "btamp.disc_status",
FT_UINT8, BASE_DEC, VALS(disc_status_vals), 0x0,
NULL, HFILL }
},
{ &hf_btamp_pal_caps_mask,
{ "PAL Capabilities Mask", "btamp.pal_caps_mask",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_pal_caps_guaranteed,
{ "Guaranteed Service type", "btamp.guaranteed_type",
FT_BOOLEAN, 16, NULL, 0x01,
NULL, HFILL }
},
{ &hf_btamp_total_bw,
{ "Total Bandwidth", "btamp.total_bw",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_max_guaran_bw,
{ "Max Guaranteed Bandwidth", "btamp.max_guaran_bw",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_min_latency,
{ "Minimum latency", "btamp.min_latency",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_amp_assoc_size,
{ "Assoc Size", "btamp.assoc_size",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btamp_amp_assoc,
{ "Assoc", "btamp.assoc",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_btamp,
&ett_btamp_cmd,
&ett_btamp_caps,
&ett_btamp_controller_entry,
&ett_btamp_controller_list,
};
/* Register the protocol name and description */
proto_btamp = proto_register_protocol("Bluetooth AMP Packet", "AMP", "btamp");
register_dissector("btamp", dissect_btamp, proto_btamp);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btamp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_btamp(void)
{
dissector_handle_t btamp_handle;
btamp_handle = find_dissector("btamp");
dissector_add("btl2cap.cid", BTL2CAP_FIXED_CID_AMP_MAN, btamp_handle);
}

View File

@ -52,7 +52,12 @@ static int hf_btl2cap_cmd_data = -1;
static int hf_btl2cap_psm = -1;
static int hf_btl2cap_scid = -1;
static int hf_btl2cap_dcid = -1;
static int hf_btl2cap_icid = -1;
static int hf_btl2cap_controller = -1;
static int hf_btl2cap_dcontroller = -1;
static int hf_btl2cap_result = -1;
static int hf_btl2cap_move_result = -1;
static int hf_btl2cap_move_confirmation_result = -1;
static int hf_btl2cap_status = -1;
static int hf_btl2cap_rej_reason = -1;
static int hf_btl2cap_sig_mtu = -1;
@ -60,6 +65,19 @@ static int hf_btl2cap_info_mtu = -1;
static int hf_btl2cap_info_flowcontrol = -1;
static int hf_btl2cap_info_retransmission = -1;
static int hf_btl2cap_info_bidirqos = -1;
static int hf_btl2cap_info_enh_retransmission = -1;
static int hf_btl2cap_info_streaming = -1;
static int hf_btl2cap_info_fcs = -1;
static int hf_btl2cap_info_flow_spec = -1;
static int hf_btl2cap_info_fixedchan = -1;
static int hf_btl2cap_info_fixedchans = -1;
static int hf_btl2cap_info_fixedchans_null = -1;
static int hf_btl2cap_info_fixedchans_signal = -1;
static int hf_btl2cap_info_fixedchans_connless = -1;
static int hf_btl2cap_info_fixedchans_amp_man = -1;
static int hf_btl2cap_info_fixedchans_amp_test = -1;
static int hf_btl2cap_info_window = -1;
static int hf_btl2cap_info_unicast = -1;
static int hf_btl2cap_info_type = -1;
static int hf_btl2cap_info_result = -1;
static int hf_btl2cap_continuation_flag = -1;
@ -70,6 +88,7 @@ static int hf_btl2cap_option_type = -1;
static int hf_btl2cap_option_length = -1;
static int hf_btl2cap_option_mtu = -1;
static int hf_btl2cap_option_flushTO = -1;
static int hf_btl2cap_option_flush_to_us = -1;
static int hf_btl2cap_option_flags = -1;
static int hf_btl2cap_option_service_type = -1;
static int hf_btl2cap_option_tokenrate = -1;
@ -83,6 +102,12 @@ static int hf_btl2cap_option_maxtransmit = -1;
static int hf_btl2cap_option_retransmittimeout = -1;
static int hf_btl2cap_option_monitortimeout = -1;
static int hf_btl2cap_option_mps = -1;
static int hf_btl2cap_option_fcs = -1;
static int hf_btl2cap_option_window = -1;
static int hf_btl2cap_option_identifier = -1;
static int hf_btl2cap_option_sdu_size = -1;
static int hf_btl2cap_option_sdu_arrival_time = -1;
static int hf_btl2cap_option_access_latency = -1;
static int hf_btl2cap_control = -1;
static int hf_btl2cap_control_sar = -1;
static int hf_btl2cap_control_reqseq = -1;
@ -100,11 +125,13 @@ static gint ett_btl2cap = -1;
static gint ett_btl2cap_cmd = -1;
static gint ett_btl2cap_option = -1;
static gint ett_btl2cap_extfeatures = -1;
static gint ett_btl2cap_fixedchans = -1;
static gint ett_btl2cap_control = -1;
/* Initialize dissector table */
dissector_table_t l2cap_psm_dissector_table;
dissector_table_t l2cap_cid_dissector_table;
/* This table maps cid values to psm values.
* The same table is used both for SCID and DCID.
@ -134,6 +161,12 @@ static const value_string command_code_vals[] = {
{ 0x09, "Echo Response" },
{ 0x0A, "Information Request" },
{ 0x0B, "Information Response" },
{ 0x0C, "Create Channel Request" },
{ 0x0D, "Create Channel Response" },
{ 0x0E, "Move Channel Request" },
{ 0x0F, "Move Channel Response" },
{ 0x10, "Move Channel Confirmation" },
{ 0x11, "Move Channel Confirmation Response" },
{ 0, NULL }
};
@ -157,9 +190,27 @@ static const value_string psm_vals[] = {
static const value_string result_vals[] = {
{ 0x0000, "Connection successful" },
{ 0x0001, "Connection pending" },
{ 0x0002, "Connection Refused - PSM not supported" },
{ 0x0002, "Connection refused - PSM not supported" },
{ 0x0003, "Connection refused - security block" },
{ 0x0004, "Connection refused - no resources available" },
{ 0x0005, "Connection refused - Controller ID not supported" },
{ 0, NULL }
};
static const value_string move_result_vals[] = {
{ 0x0000, "Move success" },
{ 0x0001, "Move pending" },
{ 0x0002, "Move refused - Controller ID not supported" },
{ 0x0003, "Move refused - New Controller ID is same as old" },
{ 0x0004, "Move refused - Configuration not supported" },
{ 0x0005, "Move refused - Move Channel collision" },
{ 0x0006, "Move refused - Channel not allowed to be moved" },
{ 0, NULL }
};
static const value_string move_result_confirmation_vals[] = {
{ 0x0000, "Move success - both sides succeed" },
{ 0x0001, "Move failure - one or both sides refuse" },
{ 0, NULL }
};
@ -168,6 +219,8 @@ static const value_string configuration_result_vals[] = {
{ 0x0001, "Failure - unacceptable parameters" },
{ 0x0002, "Failure - reject (no reason provided)" },
{ 0x0003, "Failure - unknown options" },
{ 0x0004, "Pending" },
{ 0x0005, "Failure - flow spec rejected" },
{ 0, NULL }
};
@ -188,6 +241,7 @@ static const value_string reason_vals[] = {
static const value_string info_type_vals[] = {
{ 0x0001, "Connectionless MTU" },
{ 0x0002, "Extended Features Mask" },
{ 0x0003, "Fixed Channels Supported" },
{ 0, NULL }
};
@ -209,6 +263,9 @@ static const value_string option_type_vals[] = {
{ 0x02, "Flush Timeout" },
{ 0x03, "Quality of Service" },
{ 0x04, "Retransmission and Flow Control" },
{ 0x05, "FCS" },
{ 0x06, "Extended Flow Specification" },
{ 0x07, "Extended Window Size" },
{ 0, NULL }
};
@ -216,6 +273,8 @@ static const value_string option_retransmissionmode_vals[] = {
{ 0x00, "Basic Mode" },
{ 0x01, "Retransmission Mode" },
{ 0x02, "Flow Control Mode" },
{ 0x03, "Enhanced Retransmission Mode" },
{ 0x04, "Streaming Mode" },
{ 0, NULL }
};
@ -230,6 +289,8 @@ static const value_string control_sar_vals[] = {
static const value_string control_supervisory_vals[] = {
{ 0x00, "RR" },
{ 0x01, "REJ" },
{ 0x02, "RNR" },
{ 0x03, "SREJ" },
{ 0, NULL }
};
@ -239,6 +300,12 @@ static const value_string control_type_vals[] = {
{ 0, NULL }
};
static const value_string option_fcs_vals[] = {
{ 0x00, "No FCS" },
{ 0x01, "16-bit FCS" },
{ 0, NULL }
};
static int
dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
@ -303,6 +370,50 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
}
static int
dissect_chanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
guint16 scid, psm;
psm_data_t *psm_data;
psm=tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_psm, tvb, offset, 2, TRUE);
offset+=2;
scid=tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btl2cap_controller, tvb, offset, 1, TRUE);
offset+=1;
if (pinfo->fd->flags.visited == 0) {
psm_data=se_alloc(sizeof(psm_data_t));
psm_data->psm=psm;
psm_data->in.mode=0;
psm_data->in.txwindow=0;
psm_data->in.start_fragments=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "bthci_l2cap fragment starts");
psm_data->out.mode=0;
psm_data->out.txwindow=0;
psm_data->out.start_fragments=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "bthci_l2cap fragment starts");
se_tree_insert32(cid_to_psm_table, scid|((pinfo->p2p_dir == P2P_DIR_RECV)?0x8000:0x0000), psm_data);
}
return offset;
}
static int
dissect_movechanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btl2cap_dcontroller, tvb, offset, 1, TRUE);
offset+=1;
return offset;
}
static int
dissect_options(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int length, config_data_t *config_data)
{
@ -391,6 +502,42 @@ dissect_options(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *t
proto_item_append_text(ti_option, "Retransmission and Flow Control");
break;
case 0x05: /* FCS */
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_fcs, tvb, offset, 1, TRUE);
offset+=1;
proto_item_append_text(ti_option, "FCS");
break;
case 0x06: /* Extended Flow Specification */
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_identifier, tvb, offset, 1, TRUE);
offset++;
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_service_type, tvb, offset, 1, TRUE);
offset++;
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_sdu_size, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_sdu_arrival_time, tvb, offset, 4, TRUE);
offset+=4;
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_access_latency, tvb, offset, 4, TRUE);
offset+=4;
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_flush_to_us, tvb, offset, 4, TRUE);
offset+=4;
proto_item_append_text(ti_option, "Extended Flow Specification");
break;
case 0x07: /* Extended Window Size */
proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_window, tvb, offset, 2, TRUE);
offset+=2;
proto_item_append_text(ti_option, "Extended Window Size");
break;
default:
proto_item_append_text(ti_option, "unknown");
offset+=option_length;
@ -478,12 +625,50 @@ dissect_inforesponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
proto_item_append_text(ti_features, "Retransmission ");
if(features & 0x4)
proto_item_append_text(ti_features, "BiDirQOS ");
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_flowcontrol, tvb, offset, 1, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_retransmission, tvb, offset, 1, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_bidirqos, tvb, offset, 1, TRUE);
if(features & 0x8)
proto_item_append_text(ti_features, "EnhRetransmission ");
if(features & 0x10)
proto_item_append_text(ti_features, "Streaming ");
if(features & 0x20)
proto_item_append_text(ti_features, "FCS ");
if(features & 0x40)
proto_item_append_text(ti_features, "FlowSpec ");
if(features & 0x80)
proto_item_append_text(ti_features, "FixedChan ");
if(features & 0x100)
proto_item_append_text(ti_features, "WindowSize ");
if(features & 0x200)
proto_item_append_text(ti_features, "Unicast ");
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_flowcontrol, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_retransmission, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_bidirqos, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_enh_retransmission, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_streaming, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fcs, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_flow_spec, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchan, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_window, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_unicast, tvb, offset, 4, TRUE);
offset+=4;
break;
case 0x0003: /* Fixed Channels Supported */
ti_features = proto_tree_add_none_format(tree,
hf_btl2cap_info_fixedchans, tvb,
offset, 8,
"Fixed Channels Supported:");
ti_features_subtree = proto_item_add_subtree(ti_features, ett_btl2cap_fixedchans);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchans_null, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchans_signal, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchans_connless, tvb, offset, 4, TRUE);
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchans_amp_man, tvb, offset, 4, TRUE);
offset+=4;
proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_fixedchans_amp_test, tvb, offset, 4, TRUE);
offset+=4;
break;
default:
proto_tree_add_item(tree, hf_btl2cap_cmd_data, tvb, offset, -1, TRUE);
offset+=tvb_length_remaining(tvb, offset);
@ -556,17 +741,51 @@ dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
return offset;
}
static int
dissect_chanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
return dissect_connresponse(tvb, offset, pinfo, tree);
}
static int
dissect_movechanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btl2cap_move_result, tvb, offset, 2, TRUE);
offset+=2;
return offset;
}
static int
dissect_movechanconfirmation(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
proto_tree_add_item(tree, hf_btl2cap_move_confirmation_result, tvb, offset, 2, TRUE);
offset+=2;
return offset;
}
static int
dissect_movechanconfirmationresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
return offset;
}
static int
dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 scid, dcid;
dcid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_dcid, tvb, offset, 2, TRUE);
offset+=2;
scid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
offset+=2;
@ -782,7 +1001,7 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 length, cid;
guint16 psm;
guint16 control;
tvbuff_t *next_tvb;
tvbuff_t *next_tvb = NULL;
psm_data_t *psm_data;
bthci_acl_data_t *acl_data;
btl2cap_data_t *l2cap_data;
@ -817,7 +1036,7 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pd_save = pinfo->private_data;
pinfo->private_data=l2cap_data;
if(cid==0x0001){ /* This is a command packet*/
if(cid==BTL2CAP_FIXED_CID_SIGNAL){ /* This is a command packet*/
while(offset<(length+4)) {
proto_tree *btl2cap_cmd_tree=NULL;
proto_item *ti_command=NULL;
@ -931,13 +1150,61 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
break;
case 0x0c: /* Create Channel Request */
offset=dissect_chanrequest(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Create Channel Request");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Create Channel Request");
}
break;
case 0x0d: /* Create Channel Response */
offset=dissect_chanresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Create Channel Response");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Create Channel Response");
}
break;
case 0x0e: /* Move Channel Request */
offset=dissect_movechanrequest(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Move Channel Request");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Move Channel Request");
}
break;
case 0x0f: /* Move Channel Response */
offset=dissect_movechanresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Move Channel Response");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Move Channel Response");
}
break;
case 0x10: /* Move Channel Confirmation */
offset=dissect_movechanconfirmation(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Move Channel Confirmation");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Move Channel Confirmation");
}
break;
case 0x11: /* Move Channel Confirmation Response */
offset=dissect_movechanconfirmationresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
proto_item_append_text(ti_command, "Move Channel Confirmation Response");
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_str(pinfo->cinfo, COL_INFO, "Move Channel Confirmation Response");
}
break;
default:
proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_data, tvb, offset, -1, TRUE);
offset+=tvb_length_remaining(tvb, offset);
break;
}
}
} else if (cid == 0x0002) { /* Connectionless reception channel */
} else if (cid == BTL2CAP_FIXED_CID_CONNLESS) { /* Connectionless reception channel */
if(check_col(pinfo->cinfo, COL_INFO)){
col_append_str(pinfo->cinfo, COL_INFO, "Connectionless reception channel");
}
@ -956,7 +1223,47 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
}
offset+=tvb_length_remaining(tvb, offset);
} else if(cid >= 0x0040) { /* Connection oriented channel */
}
else if(cid < BTL2CAP_FIXED_CID_MAX) {
if (cid == BTL2CAP_FIXED_CID_AMP_MAN) {
guint16 control;
control = tvb_get_letohs(tvb, offset);
if(control & 0x1) {
dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, 0 /* unused */, length, offset, NULL /* unused */);
} else {
proto_item* ti_control;
proto_tree* ti_control_subtree;
ti_control = proto_tree_add_none_format(btl2cap_tree, hf_btl2cap_control, tvb,
offset, 2, "Control: %s reqseq:%d r:%d txseq:%d",
val_to_str((control & 0xC000) >> 14, control_sar_vals, "unknown"),
(control & 0x3F00) >> 8,
(control & 0x0080) >> 7,
(control & 0x007E) >> 1);
ti_control_subtree = proto_item_add_subtree(ti_control, ett_btl2cap_control);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_sar, tvb, offset, 2, TRUE);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_reqseq, tvb, offset, 2, TRUE);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_retransmissiondisable, tvb, offset, 2, TRUE);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_txseq, tvb, offset, 2, TRUE);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_type, tvb, offset, 2, TRUE);
offset += 2;
proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, tvb_length(tvb)-2, 2, TRUE);
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset)-2, length);
}
}
else {
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
}
/* call next dissector */
if(next_tvb && !dissector_try_port(l2cap_cid_dissector_table, (guint32) cid,
next_tvb, pinfo, tree)){
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
}
}
else /* if(cid >= BTL2CAP_FIXED_CID_MAX) */ { /* Connection oriented channel */
if((psm_data=se_tree_lookup32(cid_to_psm_table, cid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000)))){
psm=psm_data->psm;
if(pinfo->p2p_dir==P2P_DIR_RECV)
@ -977,14 +1284,6 @@ static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
psm=0;
dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset);
}
} else { /* Something else */
if(check_col(pinfo->cinfo, COL_INFO)){
col_clear(pinfo->cinfo, COL_INFO);
}
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
offset+=length;
}
pinfo->private_data = pd_save;
}
@ -1052,11 +1351,36 @@ proto_register_btl2cap(void)
FT_UINT16, BASE_HEX, NULL, 0x0,
"Destination Channel Identifier", HFILL }
},
{ &hf_btl2cap_icid,
{ "Initiator CID", "btl2cap.icid",
FT_UINT16, BASE_HEX, NULL, 0x0,
"Initiator Channel Identifier", HFILL }
},
{ &hf_btl2cap_controller,
{ "Controller ID", "btl2cap.ctrl_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_dcontroller,
{ "Controller ID", "btl2cap.dctrl_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Destination Controller ID", HFILL }
},
{ &hf_btl2cap_result,
{ "Result", "btl2cap.result",
FT_UINT16, BASE_HEX, VALS(result_vals), 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_move_result,
{ "Move Result", "btl2cap.move_result",
FT_UINT16, BASE_HEX, VALS(move_result_vals), 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_move_confirmation_result,
{ "Move Result", "btl2cap.move_result",
FT_UINT16, BASE_HEX, VALS(move_result_confirmation_vals), 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_status,
{ "Status", "btl2cap.status",
FT_UINT16, BASE_HEX, VALS(status_vals), 0x0,
@ -1092,6 +1416,71 @@ proto_register_btl2cap(void)
FT_UINT8, BASE_DEC, NULL, 0x04,
"Bi-Directional QOS support", HFILL }
},
{ &hf_btl2cap_info_enh_retransmission,
{ "Enhancded Retransmission Mode", "btl2cap.info_enh_retransmission",
FT_UINT8, BASE_DEC, NULL, 0x08,
"Enhancded Retransmission mode support", HFILL }
},
{ &hf_btl2cap_info_streaming,
{ "Streaming Mode", "btl2cap.info_streaming",
FT_UINT8, BASE_DEC, NULL, 0x10,
"Streaming mode support", HFILL }
},
{ &hf_btl2cap_info_fcs,
{ "FCS", "btl2cap.info_fcs",
FT_UINT8, BASE_DEC, NULL, 0x20,
"FCS support", HFILL }
},
{ &hf_btl2cap_info_flow_spec,
{ "Extended Flow Specification for BR/EDR", "btl2cap.info_flow_spec",
FT_UINT8, BASE_DEC, NULL, 0x40,
"Extended Flow Specification for BR/EDR support", HFILL }
},
{ &hf_btl2cap_info_fixedchan,
{ "Fixed Channels", "btl2cap.info_fixedchan",
FT_UINT8, BASE_DEC, NULL, 0x80,
"Fixed Channels support", HFILL }
},
{ &hf_btl2cap_info_window,
{ "Extended Window Size", "btl2cap.info_window",
FT_UINT8, BASE_DEC, NULL, 0x01,
"Extended Window Size support", HFILL }
},
{ &hf_btl2cap_info_unicast,
{ "Unicast Connectionless Data Reception", "btl2cap.info_unicast",
FT_UINT8, BASE_DEC, NULL, 0x02,
"Unicast Connectionless Data Reception support", HFILL }
},
{ &hf_btl2cap_info_fixedchans,
{ "Fixed Channels", "btl2cap.info_fixedchans",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_info_fixedchans_null,
{ "Null identifier", "btl2cap.info_fixedchans_null",
FT_UINT32, BASE_DEC, NULL, 0x1,
NULL, HFILL }
},
{ &hf_btl2cap_info_fixedchans_signal,
{ "L2CAP signaling channel", "btl2cap.info_fixedchans_signal",
FT_UINT32, BASE_DEC, NULL, 0x2,
NULL, HFILL }
},
{ &hf_btl2cap_info_fixedchans_connless,
{ "Connectionless reception", "btl2cap.info_fixedchans_connless",
FT_UINT32, BASE_DEC, NULL, 0x4,
NULL, HFILL }
},
{ &hf_btl2cap_info_fixedchans_amp_man,
{ "AMP Manager protocol", "btl2cap.info_fixedchans_amp_man",
FT_UINT32, BASE_DEC, NULL, 0x8,
NULL, HFILL }
},
{ &hf_btl2cap_info_fixedchans_amp_test,
{ "AMP Test Manager", "btl2cap.info_fixedchans_amp_test",
FT_UINT32, BASE_DEC, NULL, 0x80000000,
NULL, HFILL }
},
{ &hf_btl2cap_info_type,
{ "Information Type", "btl2cap.info_type",
FT_UINT16, BASE_HEX, VALS(info_type_vals), 0x0,
@ -1137,6 +1526,31 @@ proto_register_btl2cap(void)
FT_UINT16, BASE_DEC, NULL, 0x0,
"Flush Timeout in milliseconds", HFILL }
},
{ &hf_btl2cap_option_flush_to_us,
{ "Flush Timeout (us)", "btl2cap.option_flushto",
FT_UINT32, BASE_DEC, NULL, 0x0,
"Flush Timeout (microseconds)", HFILL }
},
{ &hf_btl2cap_option_sdu_size,
{ "Maximum SDU Size", "btl2cap.option_sdu_size",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_option_sdu_arrival_time,
{ "SDU Inter-arrival Time (us)", "btl2cap.option_sdu_arrival_time",
FT_UINT32, BASE_DEC, NULL, 0x0,
"SDU Inter-arrival Time (microseconds)", HFILL }
},
{ &hf_btl2cap_option_identifier,
{ "Identifier", "btl2cap.option_ident",
FT_UINT8, BASE_HEX, NULL, 0x0,
"Flow Specification Identifier", HFILL }
},
{ &hf_btl2cap_option_access_latency,
{ "Access Latency (us)", "btl2cap.option_access_latency",
FT_UINT32, BASE_DEC, NULL, 0x0,
"Access Latency (microseconds)", HFILL }
},
{ &hf_btl2cap_option_flags,
{ "Flags", "btl2cap.option_flags",
FT_UINT8, BASE_HEX, NULL, 0x0,
@ -1202,6 +1616,16 @@ proto_register_btl2cap(void)
FT_UINT16, BASE_DEC, NULL, 0x0,
"Maximum PDU Payload Size", HFILL }
},
{ &hf_btl2cap_option_fcs,
{ "FCS", "btl2cap.option_fcs",
FT_UINT16, BASE_HEX, VALS(option_fcs_vals), 0x0,
"Frame Check Sequence", HFILL }
},
{ &hf_btl2cap_option_window,
{ "Extended Window Size", "btl2cap.option_window",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_btl2cap_option,
{ "Configuration Parameter Option", "btl2cap.conf_param_option",
FT_NONE, BASE_NONE, NULL, 0x0,
@ -1270,6 +1694,7 @@ proto_register_btl2cap(void)
&ett_btl2cap_cmd,
&ett_btl2cap_option,
&ett_btl2cap_extfeatures,
&ett_btl2cap_fixedchans,
&ett_btl2cap_control
};
@ -1280,6 +1705,7 @@ proto_register_btl2cap(void)
/* subdissector code */
l2cap_psm_dissector_table = register_dissector_table("btl2cap.psm", "L2CAP PSM", FT_UINT16, BASE_HEX);
l2cap_cid_dissector_table = register_dissector_table("btl2cap.cid", "L2CAP CID", FT_UINT16, BASE_HEX);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btl2cap, hf, array_length(hf));

View File

@ -28,7 +28,14 @@
#define BTL2CAP_PSM_RFCOMM 0x0003
#define BTL2CAP_PSM_BNEP 0x000f
/* This structure is passed to higher layer protocols through
#define BTL2CAP_FIXED_CID_NULL 0x0000
#define BTL2CAP_FIXED_CID_SIGNAL 0x0001
#define BTL2CAP_FIXED_CID_CONNLESS 0x0002
#define BTL2CAP_FIXED_CID_AMP_MAN 0x0003
#define BTL2CAP_FIXED_CID_AMP_TEST 0x003F
#define BTL2CAP_FIXED_CID_MAX 0x0040
/* This structure is passed to higher layer protocols through
* pinfo->private_data so that they can track "conversations" based on
* chandle, cid and direction
*/