diff -Nur ethereal-0.9.7/Makefile.am ethereal-0.9.7-patched/Makefile.am --- ethereal-0.9.7/Makefile.am 2002-09-29 21:10:05.000000000 +0200 +++ ethereal-0.9.7-patched/Makefile.am 2002-11-08 18:14:04.000000000 +0100 @@ -372,7 +372,16 @@ packet-yppasswd.c \ packet-ypserv.c \ packet-ypxfr.c \ - packet-zebra.c + packet-zebra.c \ + packet-affix-hci.c \ + packet-bthci-cmd.c \ + packet-bthci-evt.c \ + packet-btacl.c \ + packet-btsco.c \ + packet-btl2cap.c \ + packet-btbnep.c \ + packet-btrfcomm.c \ + packet-btsdp.c if HAVE_PLUGINS plugin_src = \ @@ -579,7 +588,8 @@ packet-ypbind.h \ packet-yppasswd.h \ packet-ypserv.h \ - packet-ypxfr.h + packet-ypxfr.h \ + packet-bthci-cmd.h ETHEREAL_COMMON_SRC = \ afn.c \ diff -Nur ethereal-0.9.7/packet-affix-hci.c ethereal-0.9.7-patched/packet-affix-hci.c --- ethereal-0.9.7/packet-affix-hci.c 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-affix-hci.c 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,202 @@ +/* packet-affix-hci.c + * Routines for the Affix HCI dissection + * Copyright 2002, Christoph Scholz + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include +#include + +/* Initialize the protocol and registered fields */ +static int proto_affix_hci = -1; +static int hf_affix_hci_type = -1; + +/* Initialize the subtree pointers */ +static gint ett_affix_hci = -1; + + + +static const value_string affix_hci_type_vals[] = { + {1, "HCI Command"}, + {2, "ACL Data"}, + {3, "SCO Data"}, + {4, "HCI Event"}, +}; + + +/* Code to actually dissect the packets */ +static void +dissect_affix_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + + guint16 ptype, rtype; + tvbuff_t *next_tvb; + tvbuff_t *affix_hci_tvb; + dissector_handle_t bthci_cmd_handle, bthci_evt_handle; + dissector_handle_t btacl_handle, btsco_handle; + + proto_item *ti; + proto_tree *affix_hci_tree; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "affix_hci"); + + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + + ptype = tvb_get_ntohs(tvb, 0); + rtype = tvb_get_guint8(tvb, 16); + + if (ptype == 0) { /* Packet has been received */ + pinfo->p2p_dir = P2P_DIR_RECV; + if (rtype == 2) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Incoming ACL"); + } + if (rtype == 3) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Incoming SCO"); + } + if (rtype == 4) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Event"); + } + } + else if (ptype == 4) { /* Packet has been sent */ + pinfo->p2p_dir = P2P_DIR_SENT; + if (rtype == 1) { /* Command */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Command"); + } + else if (rtype == 2) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Outgoing ACL"); + } + else if (rtype == 3) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Outgoing SCO"); + } + + } + + affix_hci_tvb = tvb_new_subset(tvb, 16, -1, -1); + next_tvb = tvb_new_subset(tvb, 17, -1, -1); + + ti = proto_tree_add_item(tree, proto_affix_hci, affix_hci_tvb, 0, -1, FALSE); + affix_hci_tree = proto_item_add_subtree(ti, ett_affix_hci); + + proto_tree_add_item(affix_hci_tree, hf_affix_hci_type, + affix_hci_tvb, 0, 1, TRUE); + + if (rtype == 1) { /* Command */ + bthci_cmd_handle = find_dissector("bthci_cmd"); + call_dissector(bthci_cmd_handle, next_tvb, pinfo, tree); + } + else if (rtype == 2) { /* ACL */ + btacl_handle = find_dissector("btacl"); + call_dissector(btacl_handle, next_tvb, pinfo, tree); + } + else if (rtype == 3) { /* SCO */ + btsco_handle = find_dissector("btsco"); + call_dissector(btsco_handle, next_tvb, pinfo, tree); + } + if (rtype == 4) { /* Event */ + bthci_evt_handle = find_dissector("bthci_evt"); + call_dissector(bthci_evt_handle, next_tvb, pinfo, tree); + } +} + + +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + +void +proto_register_affix_hci(void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + { &hf_affix_hci_type, + { "HCI Packet Type", "affix.type", + FT_UINT8, BASE_HEX, VALS(affix_hci_type_vals), 0x0, + "HCI Packet Type" } + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_affix_hci, + }; + +/* Register the protocol name and description */ + proto_affix_hci = proto_register_protocol("Affix HCI", + "Affix_HCI", "affix_hci"); + + register_dissector("affix_hci", dissect_affix_hci, proto_affix_hci); + + + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_affix_hci, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_bthci(void) +{ + dissector_handle_t affix_hci_handle; + + affix_hci_handle = find_dissector("affix_hci"); +} + + diff -Nur ethereal-0.9.7/packet-btacl.c ethereal-0.9.7-patched/packet-btacl.c --- ethereal-0.9.7/packet-btacl.c 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-btacl.c 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,374 @@ +/* packet-btacl.c + * Routines for the Bluetooth ACL dissection + * Copyright 2002, Christoph Scholz + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include +#include + +/* Initialize the protocol and registered fields */ +static int proto_btacl = -1; +static int hf_btacl_chandle = -1; +static int hf_btacl_pb_flag = -1; +static int hf_btacl_bc_flag = -1; +static int hf_btacl_length = -1; +static int hf_btacl_data = -1; + +/* Initialize the subtree pointers */ +static gint ett_btacl = -1; + + +static const value_string pb_flag_vals[] = { + {1, "Continuing Fragment"}, + {2, "Start Fragment"}, +}; + +static const value_string bc_flag_vals[] = { + {0, "Point-To-Point"}, + {1, "Active Broadcast"}, + {2, "Piconet Broadcast"}, +}; + +typedef struct { + guint16 handle; + struct l2cap_packet *l2p; +} handle_info; +#define HANDLE_TABLE_SIZE 20 + +static handle_info handle_table[HANDLE_TABLE_SIZE]; + +struct l2cap_packet { + guint8 data [65540]; + guint32 packet_len; + guint32 recvd_len; +}; + +static struct l2cap_packet *add_l2p(guint16 handle) { + handle_info *t = handle_table; + int i; + + for (i=0; i> 12; + + + /* determine if packet is fragmented */ + if (pb_flag == 1) { /* Continuing fragment */ + fragmented = TRUE; + } + else if (pb_flag == 2) { /* Start fragment */ + if (length < 2) { + fragmented = TRUE; + } + else { + l2cap_length = tvb_get_letohs(tvb, 4); + fragmented = ((l2cap_length + 4) != length); + } + } + else { /* unknown pb_flag */ + fragmented = FALSE; + } + + + if (!fragmented) { + /* call L2CAP dissector */ + next_tvb = tvb_new_subset(tvb, 4, -1, -1); + btl2cap_handle = find_dissector("btl2cap"); + call_dissector(btl2cap_handle, next_tvb, pinfo, tree); + } + else { + proto_tree_add_item(btacl_tree, hf_btacl_data, tvb, 4, -1, TRUE); + + if (pinfo->fd->flags.visited == 0) { /* This is the first pass */ + + chandle = tvb_get_letohs(tvb, 0) & 0x0FFF; + + /* same connection handle but differnet direction needs to be + distinguished, therefore we set the highest bit of the + handle for outgoing packets */ + if (pinfo->p2p_dir == P2P_DIR_RECV) { + handle = chandle; + } + else { + handle = chandle + 0x8000; + } + + + l2p = NULL; + if (pb_flag == 2) { /* Start Fragment */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_str(pinfo->cinfo, COL_INFO, " (Start Fragment)"); + + if (get_l2p(handle)) { /* Error: There is still data for the same handle */ + fprintf(stderr, "Incomplete L2CAP packet detected: packet no. %d\n", pinfo->fd->num); + del_l2p(handle); + } + + /* Start reassembly */ + if ((l2p = add_l2p(handle))) { + l2p->packet_len = 65540; /* Maybe we don't know the length now */ + /* So we have to set it to maximum */ + + /* memcpy the data */ + tvb_memcpy(tvb, l2p->data, 4, length); + l2p->recvd_len = length; + } + else { + fprintf(stderr, "no more handles!\n"); + } + + } + + if (pb_flag == 1) { /* Continuing Fragment */ + if (!(l2p = get_l2p(handle))) { /* Error: Cont fragment without start */ + fprintf(stderr, "Cont. fragment without start detected!\n"); + } + else { /* OK: Continue reassembly */ + + /* memcpy the data */ + tvb_memcpy(tvb, (l2p->data)+l2p->recvd_len, 4, length); + l2p->recvd_len += length; + } + } + + + if (l2p) { + if (l2p->recvd_len > 1) { /* We have collected enough bytes */ + l2p->packet_len = ((l2p->data)[0])+256*((l2p->data)[1])+4; + } + + if (l2p->recvd_len > l2p->packet_len) { + fprintf(stderr, "Packet too long!\n"); + del_l2p(handle); + l2p = NULL; + } + + else if (l2p->recvd_len == l2p->packet_len) { + + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_str(pinfo->cinfo, COL_INFO, " (End Fragment)"); + + reassembled_packet = malloc(sizeof(struct l2cap_packet)); + memcpy(reassembled_packet, l2p, sizeof(struct l2cap_packet)); + l2p = reassembled_packet; + + p_add_proto_data(pinfo->fd, proto_btacl, reassembled_packet); + + del_l2p(handle); + } + + else { /* Packet is not complete */ + l2p = NULL; + if (pb_flag == 1) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_str(pinfo->cinfo, COL_INFO, " (Continuation Fragment)"); + } + } + } + } + else { /* This is an additional pass */ + l2p = p_get_proto_data(pinfo->fd, proto_btacl); /* Is there a reassembled packet saved ? */ + } + + if (l2p) { + next_tvb = tvb_new_real_data(l2p->data, l2p->packet_len, + l2p->packet_len); + tvb_set_child_real_data_tvbuff(tvb, next_tvb); + add_new_data_source(pinfo, next_tvb, "Reassembled L2CAP"); + + /* call L2CAP dissector */ + btl2cap_handle = find_dissector("btl2cap"); + call_dissector(btl2cap_handle, next_tvb, pinfo, tree); + } + + } + +} + + +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + +void +proto_register_btacl(void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + { &hf_btacl_chandle, + { "Connection Handle", "btacl.chandle", + FT_UINT16, BASE_HEX, NULL, 0x0FFF, + "Connection Handle" } + }, + { &hf_btacl_pb_flag, + { "PB Flag", "btacl.pb_flag", + FT_UINT16, BASE_BIN, VALS(pb_flag_vals), 0x3000, + "Packet Boundary Flag" } + }, + { &hf_btacl_bc_flag, + { "BC Flag", "btacl.bc_flag", + FT_UINT16, BASE_BIN, VALS(bc_flag_vals), 0xC000, + "Broadcast Flag" } + }, + { &hf_btacl_length, + { "Data Total Length", "btacl.length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Data Total Length" } + }, + { &hf_btacl_data, + { "Data", "btacl.data", + FT_NONE, BASE_NONE, NULL, 0x0, + "Data" } + }, + }; + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_btacl, + }; + +/* Register the protocol name and description */ + proto_btacl = proto_register_protocol("Bluetooth ACL Packet", + "ACL", "btacl"); + + register_dissector("btacl", dissect_btacl, proto_btacl); + + + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_btacl, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + register_init_routine(l2cap_defragment_init); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_btacl(void) +{ + dissector_handle_t btacl_handle; + + btacl_handle = find_dissector("btacl"); + +} + + diff -Nur ethereal-0.9.7/packet-btbnep.c ethereal-0.9.7-patched/packet-btbnep.c --- ethereal-0.9.7/packet-btbnep.c 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-btbnep.c 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,724 @@ +/* -*- Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ + +/* packet-btbnep.c + * Routines for the Bluetooth BNEP dissection + * Copyright 2002, Wolfgang Hansmann + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include +#include +#include + +#include "packet-btbnep.h" + +extern dissector_table_t ethertype_dissector_table; + +/* Initialize the protocol and registered fields */ +static int proto_btbnep = -1; + +static int hf_btbnep_type = -1; +static int hf_btbnep_extflag = -1; + +static int hf_btbnep_exthdr_type = 1; +static int hf_btbnep_exthdr_extflag = 1; +static int hf_btbnep_exthdr_len = 1; + +static int hf_btbnep_cmd_type = 1; + +static int hf_btbnep_conn_resp_msg = -1; + +static int hf_btbnep_src = -1; +static int hf_btbnep_dst = -1; +static int hf_btbnep_proto = -1; + +static int hf_btbnep_src_uuid = -1; +static int hf_btbnep_dst_uuid = -1; + +static int hf_btbnep_pset_list_len = -1; + +static int hf_btbnep_pres_msg = -1; +static int hf_btbnep_mres_msg = -1; + +/* Initialize the subtree pointers */ + +static gint ett_btbnep = -1; +static gint ett_btbnep_ethgen = -1; +static gint ett_btbnep_eth = 1; +static gint ett_btbnep_ethdst = 1; +static gint ett_btbnep_ethsrc = 1; +static gint ett_btbnep_exthdr = 1; +static gint ett_btbnep_cmd = 1; + +static dissector_handle_t data_handle; +static dissector_handle_t llc_handle; +static dissector_handle_t ipx_handle; + +static const value_string vs_extension_type[] = { + {0x0, "Control Extension Header"}, + {0x0, NULL} +}; + +static const value_string vs_type[] = { + {BTBNEP_TYPE_GENERAL_ETHERNET, "General Ethernet"}, + {BTBNEP_TYPE_CONTROL, "Control Packet"}, + {BTBNEP_TYPE_COMPRESSED_ETHERNET, "Compressed Ethernet"}, + {BTBNEP_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY, + "Compressed Ethernet Source only"}, + {BTBNEP_TYPE_COMPRESSED_ETHERNET_DEST_ONLY, + "Compressed Ethernet Destination only"}, + {0x0, NULL} +}; + +static const value_string vs_control_type[] = { + {BTBNEP_CONTROL_CMD_NOT_UNDERSTOOD, "Command not understood"}, + {BTBNEP_SETUP_CONN_REQ_MSG, "Setup Connection Request"}, + {BTBNEP_SETUP_CONN_RESP_MSG, "Setup Connection Response"}, + {BTBNEP_FILTER_NET_TYPE_SET_MSG, "Filter Net Type Set"}, + {BTBNEP_FILTER_NET_TYPE_RESP_MSG, "Filter Net Type Response"}, + {BTBNEP_FILTER_MULTI_ADDR_SET_MSG, "Multicast Addr. Set"}, + {BTBNEP_FILTER_MULTI_ADDR_RESP_MSG, "Multicast Addr. Response"}, + {0x0, NULL} +}; + +static const value_string vs_conn_resp_msg[] = { + {BTBNEP_CONN_MSG_SUCCESS, "Operation Successful"}, + {BTBNEP_CONN_MSG_INV_DST_UUID, "Operation Failed: Invalid Dest. Service UUID"}, + {BTBNEP_CONN_MSG_INV_SRC_UUID, "Operation Failed: Invalid Src. Service UUID"}, + {BTBNEP_CONN_MSG_INV_UUID_SIZE, "Operation Failed: Invalid Service UUID Size"}, + {BTBNEP_CONN_MSG_CONN_NOT_ALLOWED, "Operation Failed: Connection not allowed"}, + {0x0, NULL} +}; + +static const value_string vs_proto_filter_resp_msg[] = { + {BTBNEP_FLT_SUCCESS, "Operation Successful"}, + {BTBNEP_FLT_UNSUPPORTED, "Unsupported Request"}, + {BTBNEP_FLT_INV_RANGE, "Operation Failed: Invalid " + "Networking Protocol Range"}, + {BTBNEP_FLT_LIMIT_REACHED, "Operation Failed: Max. " + "Protocol Filter Limit Reached"}, + {BTBNEP_CONN_MSG_CONN_NOT_ALLOWED, "Operation Failed: " + "Unable to fulfill request due to security reasons"}, + {0x0, NULL} +}; + +static const value_string vs_mc_filter_resp_msg[] = { + {BTBNEP_MC_SUCCESS, "Operation Successful"}, + {BTBNEP_MC_UNSUPPORTED, "Unsupported Request"}, + {BTBNEP_MC_INV_RANGE, "Operation Failed: Invalid Multicast Addr. Range"}, + {BTBNEP_MC_LIMIT_REACHED, "Operation Failed: Max. Multicast Address " + "Filter Limit reached"}, + {BTBNEP_MC_SEC_NOT_ALLOWED, "Operation Failed: Unable to fulfill " + "request due to security reasons"}, + {0x0, NULL} +}; + + +static const value_string vs_extension_flag[] = { + {0, "Last Extension Header"}, + {1, "More Extension Headers following"}, + {0, NULL} +}; + +static int dissect_type_ethfull(tvbuff_t *tvb, proto_tree *tree, int off, + guint16 *ethertype) { + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 14) { + proto_tree_add_text(tree, tvb, off, len, "Garbled General " + "Ethernet Packet Type Header"); + return -1; + } + + proto_tree_add_item(tree, hf_btbnep_dst, tvb, off, 6, FALSE); + proto_tree_add_item(tree, hf_btbnep_src, tvb, off + 6, 6, FALSE); + proto_tree_add_item(tree, hf_btbnep_proto, tvb, off + 12, 2, FALSE); + + *ethertype = tvb_get_ntohs(tvb, off + 12); + + return 14; +} + + +static int dissect_type_eth(tvbuff_t *tvb, proto_tree *tree, int off, + guint16 *ethertype) { + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, len, "Garbled Compressed " + "Ethernet Packet Type Header"); + return -1; + } + proto_tree_add_item(tree, hf_btbnep_proto, tvb, off, 2, FALSE); + + *ethertype = tvb_get_ntohs(tvb, off); + + return 2; +} + + +static int dissect_type_ethsrc(tvbuff_t *tvb, proto_tree *tree, int off, + guint16 *ethertype) { + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 8) { + proto_tree_add_text(tree, tvb, off, len, "Garbled Compressed " + "Ethernet Source only Packet Type Header"); + return -1; + } + + proto_tree_add_item(tree, hf_btbnep_src, tvb, off, 6, FALSE); + proto_tree_add_item(tree, hf_btbnep_proto, tvb, off + 6, 2, FALSE); + + *ethertype = tvb_get_ntohs(tvb, off + 6); + + return 8; +} + + +static int dissect_type_ethdst(tvbuff_t *tvb, proto_tree *tree, int off, + guint16 *ethertype) { + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 8) { + proto_tree_add_text(tree, tvb, off, len, "Garbled Compressed " + "Ethernet Destination only Packet Type Header"); + return -1; + } + + proto_tree_add_item(tree, hf_btbnep_dst, tvb, off, 6, FALSE); + proto_tree_add_item(tree, hf_btbnep_proto, tvb, off + 6, 2, FALSE); + + *ethertype = tvb_get_ntohs(tvb, off + 6); + + return 8; +} + + +static int dissect_extension(tvbuff_t *tvb, proto_tree *tree, int off) { + + proto_tree *st; + proto_item *it; + int len, size; + guint8 type; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, len, "Garbled Extension Header"); + return -1; + } + + type = tvb_get_guint8(tvb, off); + + it = proto_tree_add_text(tree, tvb, off, 1, "Extension header"); + st = proto_item_add_subtree(it, ett_btbnep_exthdr); + + proto_tree_add_item(st, hf_btbnep_exthdr_type, tvb, off, 1, FALSE); + proto_tree_add_item(st, hf_btbnep_exthdr_extflag, tvb, off, 1, FALSE); + proto_tree_add_item(st, hf_btbnep_exthdr_len, tvb, off + 1, 1, FALSE); + + len = tvb_get_guint8(tvb, off + 1); + proto_item_set_len(it, len + 2); + + switch(type & 0x7f) { + case 0x0: + size = dissect_type_control(tvb, st, off + 2); + proto_item_append_text(it, " (Command extension)"); + if (size == -1) + return -1; + break; + default: + proto_item_append_text(it, " (Unknown Extension type 0x%x)", + type & 0x7f); + } + return 2 + len; +} + + +static int dissect_ctr_err(tvbuff_t *tvb, proto_tree *tree, int off) { + + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 1) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + proto_tree_add_text(tree, tvb, off, 1, "Unknown opcode was: 0x%x", + tvb_get_guint8(tvb, off)); + return 1; +} + + +static int dissect_ctr_conreq(tvbuff_t *tvb, proto_tree *tree, int off) { + + gint uuid_size; + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 1) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + uuid_size = tvb_get_guint8(tvb, off); + proto_tree_add_text(tree, tvb, off, 1, "UUID Size: %d", + uuid_size); + if (len < 1 + uuid_size * 2) { + proto_tree_add_text(tree, tvb, off + 1, -1, "Garbled"); + return -1; + } + proto_tree_add_bytes(tree, hf_btbnep_dst_uuid, tvb, off + 1, uuid_size, + tvb_get_ptr(tvb, off + 1, uuid_size)); + proto_tree_add_bytes(tree, hf_btbnep_src_uuid, tvb, off + 1 + uuid_size, + uuid_size, + tvb_get_ptr(tvb, off + 1 + uuid_size, uuid_size)); + + return 1 + 2 * uuid_size; +} + + +static int dissect_ctr_conres(tvbuff_t *tvb, proto_tree *tree, int off) { + + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + proto_tree_add_item(tree, hf_btbnep_conn_resp_msg, tvb, off, 2, 0); + return 2; +} + + +static int dissect_ctr_pset(tvbuff_t *tvb, proto_tree *tree, int off) { + + int i, len, off_tmp; + guint16 list_length; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + + list_length = tvb_get_ntohs(tvb, off); + proto_tree_add_uint(tree, hf_btbnep_pset_list_len, tvb, + off, 2, list_length); + if (len < 2 + list_length || (list_length % 4) != 0) { + proto_tree_add_text(tree, tvb, off + 2, -1, "Garbled"); + return -1; + } + + for (off_tmp = off + 2, i = 0; i < list_length; i += 4, off_tmp += 4) { + proto_tree_add_text(tree, tvb, off_tmp, 4, + "Allowed Protocol Range: 0x%x - 0x%x", + tvb_get_ntohs(tvb, off_tmp), + tvb_get_ntohs(tvb, off_tmp + 2)); + } + + return 2 + list_length; +} + + +static int dissect_ctr_pres(tvbuff_t *tvb, proto_tree *tree, int off) { + + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + + proto_tree_add_uint(tree, hf_btbnep_pres_msg, tvb, off, 2, + tvb_get_ntohs(tvb, off)); + + return 2; +} + + +static int dissect_ctr_mset(tvbuff_t *tvb, proto_tree *tree, int off) { + + int i, len, off_tmp; + guint16 list_length; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + + list_length = tvb_get_ntohs(tvb, off); + + proto_tree_add_uint(tree, hf_btbnep_pset_list_len, tvb, + off, 2, list_length); + if (len < 2 + list_length || (list_length % 12) != 0) { + proto_tree_add_text(tree, tvb, off + 2, -1, "Garbled"); + return -1; + } + + for (off_tmp = off + 2, i = 0; i < list_length; i += 12, off_tmp += 12) { + + char buf1[32], buf2[32]; + + strncpy(buf1, ether_to_str(tvb_get_ptr(tvb, off_tmp, 6)), 32); + strncpy(buf2, ether_to_str(tvb_get_ptr(tvb, off_tmp + 6, 6)), 32); + buf1[31] = buf2[31] = 0; + + proto_tree_add_text(tree, tvb, off_tmp, 12, + "Allowed Multicast Range: %s - %s", buf1, buf2); + } + return 2 + list_length; +} + + +static int dissect_ctr_mres(tvbuff_t *tvb, proto_tree *tree, int off) { + + int len; + + len = tvb_length_remaining(tvb, off); + if (len < 2) { + proto_tree_add_text(tree, tvb, off, -1, "Garbled"); + return -1; + } + + proto_tree_add_uint(tree, hf_btbnep_mres_msg, tvb, off, 2, + tvb_get_ntohs(tvb, off)); + return 2; +} + + +static int dissect_type_control(tvbuff_t *tvb, proto_tree *tree, int off) { + + proto_tree *st; + proto_item *it; + int len, size; + guint8 type; + + len = tvb_length_remaining(tvb, off); + if (len < 1) { + proto_tree_add_text(tree, tvb, off, len, "Garbled Compressed " + "Command Packet"); + return -1; + } + + it = proto_tree_add_item(tree, hf_btbnep_cmd_type, tvb, off, 1, FALSE); + st = proto_item_add_subtree(it, ett_btbnep_cmd); + + type = tvb_get_guint8(tvb, off); + + off++; + + switch(type) { + case BTBNEP_CONTROL_CMD_NOT_UNDERSTOOD: + size = dissect_ctr_err(tvb, st, off); + break; + case BTBNEP_SETUP_CONN_REQ_MSG: + size = dissect_ctr_conreq(tvb, st, off); + break; + case BTBNEP_SETUP_CONN_RESP_MSG: + size = dissect_ctr_conres(tvb, st, off); + break; + case BTBNEP_FILTER_NET_TYPE_SET_MSG: + size = dissect_ctr_pset(tvb, st, off); + break; + case BTBNEP_FILTER_NET_TYPE_RESP_MSG: + size = dissect_ctr_pres(tvb, st, off); + break; + case BTBNEP_FILTER_MULTI_ADDR_SET_MSG: + size = dissect_ctr_mset(tvb, st, off); + break; + case BTBNEP_FILTER_MULTI_ADDR_RESP_MSG: + size = dissect_ctr_mres(tvb, st, off); + break; + default: + /* TODO: display error */ + size = -1; + } + if (size == -1) + return -1; + + proto_item_set_len(it, 1 + size); + return size + 1; +} + +/* Code to actually dissect the packets */ + +static void dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + gchar *col_info = ""; + proto_item *ti, *ti_type; + proto_tree *st, *st_type; + guint8 type, off = 1, size, extflag; + guint16 ethertype = 0; + tvbuff_t *next_tvb; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "BNEP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + if (tvb_length_remaining(tvb, 0) < 1) + return; + + ti = proto_tree_add_item(tree, proto_btbnep, tvb, 0, -1, FALSE); + st = proto_item_add_subtree(ti, ett_btbnep); + + ti_type = proto_tree_add_text(st, tvb, 0, 1, "Type: "); + st_type = proto_item_add_subtree(ti_type, ett_btbnep); + + proto_tree_add_item(st_type, hf_btbnep_type, tvb, 0, 1, TRUE); + proto_tree_add_item(st_type, hf_btbnep_extflag, tvb, 0, 1, TRUE); + + type = tvb_get_guint8(tvb, 0); + extflag = type & 0x80; + type = type & 0x7f; + + col_info = val_to_str(type & 0x7f, VALS(vs_type), "%s"); + if (!col_info) + col_info = "(Unknown)"; + + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_fstr(pinfo->cinfo, COL_INFO, col_info); + proto_item_append_text(ti, " (%s)", col_info); + proto_item_append_text(ti_type, "%s (0x%x), Extension flag: %d", + col_info, type, extflag ? 1 : 0); + + switch (type) { + case BTBNEP_TYPE_GENERAL_ETHERNET: + size = dissect_type_ethfull(tvb, st, off, ðertype); + break; + case BTBNEP_TYPE_CONTROL: + size = dissect_type_control(tvb, st, off); + break; + case BTBNEP_TYPE_COMPRESSED_ETHERNET: + size = dissect_type_eth(tvb, st, off, ðertype); + break; + case BTBNEP_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY: + size = dissect_type_ethsrc(tvb, st, off, ðertype); + break; + case BTBNEP_TYPE_COMPRESSED_ETHERNET_DEST_ONLY: + size = dissect_type_ethdst(tvb, st, off, ðertype); + break; + default: + /* error */ + size = -1; + } + + if (size < 2) + return; + + off += size; + + while (extflag) { + + size = dissect_extension(tvb, st, off); + if (size < 1) + break; + + extflag = tvb_get_guint8(tvb, off) & 0x80; + off += size; + } + + /* set length of ti */ + + next_tvb = tvb_new_subset(tvb, off, -1, -1); + proto_item_set_len(ti, off); + + if (ethertype) { + if (ethertype <= IEEE_802_3_MAX_LEN) { + + if (tvb_get_ntohs(next_tvb, off) == 0xffff) + call_dissector(ipx_handle, next_tvb, pinfo, tree); + else + call_dissector(llc_handle, next_tvb, pinfo, tree); + + } else { + + if (!dissector_try_port(ethertype_dissector_table, + (guint32) ethertype, + next_tvb, pinfo, tree)) + call_dissector(data_handle, next_tvb, pinfo, tree); + } + } +} + + + +void proto_register_btbnep(void) +{ + static hf_register_info hf[] = { + {&hf_btbnep_type, + {"Type", "btbnep.type", + FT_UINT8, BASE_HEX, &vs_type, 0x7f, + "BNEP Packet Type", HFILL} + }, + {&hf_btbnep_extflag, + {"Extension flag", "btbnep.extflag", + FT_UINT8, BASE_HEX, NULL, 0x80, + "Extension flag", HFILL} + }, + {&hf_btbnep_src, + {"Source MAC", "btbnep.src", + FT_ETHER, BASE_NONE, NULL, 0x0, "Source MAC", HFILL} + }, + {&hf_btbnep_dst, + {"Destination MAC", "btbnep.dst", + FT_ETHER, BASE_NONE, NULL, 0x0, "Destination MAC", HFILL} + }, + {&hf_btbnep_proto, + {"Protocol type", "btbnep.proto", + FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0, + "Protocol Type", HFILL} + }, + {&hf_btbnep_cmd_type, + {"Command type", "btbnep.cmdtype", + FT_UINT8, BASE_HEX, VALS(vs_control_type), 0x0, + "Command Type", HFILL} + }, + {&hf_btbnep_exthdr_type, + {"Extension Type", "btbnep.ext_type", + FT_UINT8, BASE_HEX, VALS(vs_extension_type), 0x7f, + "Extension Type", HFILL} + }, + {&hf_btbnep_exthdr_extflag, + {"Extension Flag", "btbnep.ext_flag", + FT_UINT8, BASE_HEX, VALS(vs_extension_flag), 0x80, + "Extension Flag", HFILL} + }, + {&hf_btbnep_exthdr_len, + {"Extension Length", "btbnep.ext_length", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Extension Length", HFILL} + }, + {&hf_btbnep_src_uuid, + {"Source Service UUID", "btbnep.SS_uuid", + FT_BYTES, BASE_HEX, NULL, 0x0, "Source Service UUID (hex)", + HFILL} + }, + {&hf_btbnep_dst_uuid, + {"Destination Service UUID", "btbnep.DS_uuid", + FT_BYTES, BASE_HEX, NULL, 0x0, "Destination Service UUID " + "(hex)", HFILL} + }, + {&hf_btbnep_conn_resp_msg, + {"Response Message", "btbnep.cresp_mess", + FT_UINT16, BASE_HEX, VALS(vs_conn_resp_msg), 0x0, + "Response Message", HFILL} + }, + {&hf_btbnep_pset_list_len, + {"List Length", "btbnep.list_length", + FT_UINT16, BASE_DEC, NULL, 0x0, "List Length", HFILL} + }, + {&hf_btbnep_pres_msg, + {"Response Message", "btbnep.presp_mess", + FT_UINT16, BASE_HEX, VALS(vs_proto_filter_resp_msg), + 0x0, "Response Message", HFILL} + }, + {&hf_btbnep_mres_msg, + {"Response Message", "btbnep.mresp_mess", + FT_UINT16, BASE_HEX, VALS(vs_mc_filter_resp_msg), + 0x0, "Response Message", HFILL} + } + }; + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_btbnep, + &ett_btbnep_ethgen, + &ett_btbnep_eth, + &ett_btbnep_ethdst, + &ett_btbnep_ethsrc, + &ett_btbnep_exthdr, + &ett_btbnep_cmd + }; + +/* Register the protocol name and description */ + + proto_btbnep = proto_register_protocol("Bluetooth BNEP Packet", + "BNEP", "btbnep"); + + register_dissector("btbnep", dissect_btbnep, proto_btbnep); + + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_btbnep, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_btbnep(void) +{ + dissector_handle_t btbnep_handle; + + btbnep_handle = find_dissector("btbnep"); + dissector_add("btl2cap.psm", 0x000f, btbnep_handle); + + data_handle = find_dissector("data"); + ipx_handle = find_dissector("ipx"); + llc_handle = find_dissector("llc"); +} + + + + + + + + + + + + diff -Nur ethereal-0.9.7/packet-btbnep.h ethereal-0.9.7-patched/packet-btbnep.h --- ethereal-0.9.7/packet-btbnep.h 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-btbnep.h 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,57 @@ +#ifndef ETHEREAL_PACKET_BTBNEP_H +#define ETHEREAL_PACKET_BTBNEP_H + +/* packet types */ + +#define BTBNEP_TYPE_GENERAL_ETHERNET 0 +#define BTBNEP_TYPE_CONTROL 1 +#define BTBNEP_TYPE_COMPRESSED_ETHERNET 2 +#define BTBNEP_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY 3 +#define BTBNEP_TYPE_COMPRESSED_ETHERNET_DEST_ONLY 4 + +/* command types */ + +#define BTBNEP_CONTROL_CMD_NOT_UNDERSTOOD 0 +#define BTBNEP_SETUP_CONN_REQ_MSG 1 +#define BTBNEP_SETUP_CONN_RESP_MSG 2 +#define BTBNEP_FILTER_NET_TYPE_SET_MSG 3 +#define BTBNEP_FILTER_NET_TYPE_RESP_MSG 4 +#define BTBNEP_FILTER_MULTI_ADDR_SET_MSG 5 +#define BTBNEP_FILTER_MULTI_ADDR_RESP_MSG 6 + +/* setup connection response messages */ + +#define BTBNEP_CONN_MSG_SUCCESS 0 +#define BTBNEP_CONN_MSG_INV_DST_UUID 1 +#define BTBNEP_CONN_MSG_INV_SRC_UUID 2 +#define BTBNEP_CONN_MSG_INV_UUID_SIZE 3 +#define BTBNEP_CONN_MSG_CONN_NOT_ALLOWED 4 + +/* protocol filter response messages */ + +#define BTBNEP_FLT_SUCCESS 0 +#define BTBNEP_FLT_UNSUPPORTED 1 +#define BTBNEP_FLT_INV_RANGE 2 +#define BTBNEP_FLT_LIMIT_REACHED 3 +#define BTBNEP_FLT_SEC_NOT_ALLOWED 4 + +/* multicast filter response messages */ + +#define BTBNEP_MC_SUCCESS 0 +#define BTBNEP_MC_UNSUPPORTED 1 +#define BTBNEP_MC_INV_RANGE 2 +#define BTBNEP_MC_LIMIT_REACHED 3 +#define BTBNEP_MC_SEC_NOT_ALLOWED 4 + + + +static int dissect_type_control(tvbuff_t *, proto_tree *, int); + +#endif /* ETHEREAL_PACKET_BTBNEP_H */ + + + + + + + diff -Nur ethereal-0.9.7/packet-bthci-cmd.c ethereal-0.9.7-patched/packet-bthci-cmd.c --- ethereal-0.9.7/packet-bthci-cmd.c 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-bthci-cmd.c 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,1469 @@ +/* packet-bthci-cmd.c + * Routines for the Bluetooth HCI Command dissection + * Copyright 2002, Christoph Scholz + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include +#include + +#include + +/* Initialize the protocol and registered fields */ +static int proto_bthci_cmd = -1; +static int hf_bthci_cmd_opcode = -1; +static int hf_bthci_cmd_ogf = -1; +static int hf_bthci_cmd_ocf = -1; +static int hf_bthci_cmd_param_length = -1; +static int hf_bthci_cmd_params = -1; +static int hf_bthci_cmd_lap = -1; +static int hf_bthci_cmd_inq_length = -1; +static int hf_bthci_cmd_num_responses = -1; +static int hf_bthci_cmd_encrypt_mode = -1; +static int hf_bthci_cmd_bd_addr = -1; +static int hf_bthci_cmd_packet_type_dm1 = -1; +static int hf_bthci_cmd_packet_type_dm3 = -1; +static int hf_bthci_cmd_packet_type_dm5 = -1; +static int hf_bthci_cmd_packet_type_dh1 = -1; +static int hf_bthci_cmd_packet_type_dh3 = -1; +static int hf_bthci_cmd_packet_type_dh5 = -1; +static int hf_bthci_cmd_clock_offset = -1; +static int hf_bthci_cmd_clock_offset_valid = -1; +static int hf_bthci_cmd_allow_role_switch = -1; +static int hf_bthci_cmd_page_scan_mode = -1; +static int hf_bthci_cmd_page_scan_repetition_mode = -1; +static int hf_bthci_cmd_page_scan_period_mode = -1; +static int hf_bthci_cmd_status = -1; +static int hf_bthci_cmd_max_period_length = -1; +static int hf_bthci_cmd_min_period_length = -1; +static int hf_bthci_cmd_connection_handle = -1; +static int hf_bthci_cmd_reason = -1; +static int hf_bthci_cmd_num_link_keys = -1; +static int hf_bthci_cmd_link_key = -1; +static int hf_bthci_cmd_packet_type_hv1 = -1; +static int hf_bthci_cmd_packet_type_hv2 = -1; +static int hf_bthci_cmd_packet_type_hv3 = -1; +static int hf_bthci_cmd_role = -1; +static int hf_bthci_cmd_pin_code_length = -1; +static int hf_bthci_cmd_pin_code = -1; +static int hf_bthci_cmd_pin_type = -1; +static int hf_bthci_cmd_encryption_enable = -1; +static int hf_bthci_cmd_key_flag = -1; +static int hf_bthci_cmd_max_interval_hold = -1; +static int hf_bthci_cmd_min_interval_hold = -1; +static int hf_bthci_cmd_max_interval_sniff = -1; +static int hf_bthci_cmd_min_interval_sniff = -1; +static int hf_bthci_cmd_sniff_attempt = -1; +static int hf_bthci_cmd_timeout = -1; +static int hf_bthci_cmd_max_interval_beacon = -1; +static int hf_bthci_cmd_min_interval_beacon = -1; +static int hf_bthci_cmd_flags = -1; +static int hf_bthci_cmd_service_type = -1; +static int hf_bthci_cmd_token_rate = -1; +static int hf_bthci_cmd_peak_bandwidth = -1; +static int hf_bthci_cmd_latency = -1; +static int hf_bthci_cmd_delay_variation = -1; +static int hf_bthci_cmd_link_policy_setting_switch = -1; +static int hf_bthci_cmd_link_policy_setting_hold = -1; +static int hf_bthci_cmd_link_policy_setting_sniff = -1; +static int hf_bthci_cmd_link_policy_setting_park = -1; +static int hf_bthci_cmd_filter_type = -1; +static int hf_bthci_cmd_inquiry_result_filter_condition_type = -1; +static int hf_bthci_cmd_connection_setup_filter_condition_type = -1; +static int hf_bthci_cmd_class_of_device = -1; +static int hf_bthci_cmd_class_of_device_mask = -1; +static int hf_bthci_cmd_auto_acc_flag = -1; +static int hf_bthci_cmd_read_all_flag = -1; +static int hf_bthci_cmd_delete_all_flag = -1; +static int hf_bthci_cmd_authentication_enable = -1; +static int hf_bthci_cmd_input_coding = -1; +static int hf_bthci_cmd_input_data_format = -1; +static int hf_bthci_cmd_input_sample_size = -1; +static int hf_bthci_cmd_linear_pcm_bit_pos = -1; +static int hf_bthci_cmd_air_coding_format = -1; +static int hf_bthci_cmd_num_broadcast_retransmissions = -1; +static int hf_bthci_cmd_hold_mode_act_page = -1; +static int hf_bthci_cmd_hold_mode_act_inquiry = -1; +static int hf_bthci_cmd_hold_mode_act_periodic = -1; +static int hf_bthci_cmd_scan_enable = -1; +static int hf_bthci_cmd_interval = -1; +static int hf_bthci_cmd_window = -1; +static int hf_bthci_cmd_local_name = -1; +static int hf_bthci_cmd_num_curr_iac = -1; +static int hf_bthci_cmd_iac_lap = -1; +static int hf_bthci_cmd_evt_mask_01 = -1; +static int hf_bthci_cmd_evt_mask_02 = -1; +static int hf_bthci_cmd_evt_mask_03 = -1; +static int hf_bthci_cmd_evt_mask_04 = -1; +static int hf_bthci_cmd_evt_mask_05 = -1; +static int hf_bthci_cmd_evt_mask_06 = -1; +static int hf_bthci_cmd_evt_mask_07 = -1; +static int hf_bthci_cmd_evt_mask_08 = -1; +static int hf_bthci_cmd_evt_mask_09 = -1; +static int hf_bthci_cmd_evt_mask_0a = -1; +static int hf_bthci_cmd_evt_mask_0b = -1; +static int hf_bthci_cmd_evt_mask_0c = -1; +static int hf_bthci_cmd_evt_mask_0d = -1; +static int hf_bthci_cmd_evt_mask_0e = -1; +static int hf_bthci_cmd_evt_mask_0f = -1; +static int hf_bthci_cmd_evt_mask_10 = -1; +static int hf_bthci_cmd_evt_mask_11 = -1; +static int hf_bthci_cmd_evt_mask_12 = -1; +static int hf_bthci_cmd_evt_mask_13 = -1; +static int hf_bthci_cmd_evt_mask_14 = -1; +static int hf_bthci_cmd_evt_mask_15 = -1; +static int hf_bthci_cmd_evt_mask_16 = -1; +static int hf_bthci_cmd_evt_mask_17 = -1; +static int hf_bthci_cmd_evt_mask_18 = -1; +static int hf_bthci_cmd_evt_mask_19 = -1; +static int hf_bthci_cmd_evt_mask_1a = -1; +static int hf_bthci_cmd_evt_mask_1b = -1; +static int hf_bthci_cmd_evt_mask_1c = -1; +static int hf_bthci_cmd_evt_mask_1d = -1; +static int hf_bthci_cmd_evt_mask_1e = -1; +static int hf_bthci_cmd_evt_mask_1f = -1; +static int hf_bthci_cmd_evt_mask_20 = -1; +static int hf_bthci_cmd_sco_flow_control = -1; +static int hf_bthci_cmd_num_handles = -1; +static int hf_bthci_cmd_num_compl_packets = -1; +static int hf_bthci_cmd_flow_contr_enable = -1; +static int hf_bthci_cmd_host_data_packet_length_acl = -1; +static int hf_bthci_cmd_host_data_packet_length_sco = -1; +static int hf_bthci_cmd_host_total_num_acl_data_packets = -1; +static int hf_bthci_cmd_host_total_num_sco_data_packets = -1; +static int hf_bthci_cmd_power_level_type = -1; +static int hf_bthci_cmd_loopback_mode = -1; + +/* Initialize the subtree pointers */ +static gint ett_bthci_cmd = -1; +static gint ett_opcode = -1; + +void +dissect_link_control_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 cmd_ocf) +{ + proto_item *item; + guint32 clock; + + switch(cmd_ocf) { + case 0x0001: /* Inquiry */ + proto_tree_add_item(tree, hf_bthci_cmd_lap, tvb, 3, 3, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_inq_length, tvb, 6, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_num_responses, tvb, 7, 1, TRUE); + break; + + case 0x0002: /* Inquiry Cancel */ + /* no parameters */ + break; + + case 0x0003: /* Periodic Inquiry Mode */ + proto_tree_add_item(tree, hf_bthci_cmd_max_period_length, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_min_period_length, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_lap, tvb, 7, 3, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_inq_length, tvb, 10, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_num_responses, tvb, 11, 1, TRUE); + break; + + case 0x0004: /* Exit Periodic Inquiry Mode */ + /* no parameters */ + break; + + case 0x0005: /* Create Connection */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm1, tvb, 9, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh1, tvb, 9, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm3, tvb, 9, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh3, tvb, 9, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm5, tvb, 9, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh5, tvb, 9, 2, TRUE); + + proto_tree_add_item(tree, hf_bthci_cmd_page_scan_repetition_mode, tvb, 11, 1, TRUE); + + proto_tree_add_item(tree, hf_bthci_cmd_page_scan_mode, tvb, 12, 1, TRUE); + + item = proto_tree_add_item(tree, hf_bthci_cmd_clock_offset, tvb, 13, 2, TRUE); + clock = tvb_get_letohs(tvb, 13) & 32767; /* only bit0-14 are valid */ + proto_item_append_text(item, " (%g ms)", 1.25*clock); + proto_tree_add_item(tree, hf_bthci_cmd_clock_offset_valid , tvb, 13, 2, TRUE); + + proto_tree_add_item(tree, hf_bthci_cmd_allow_role_switch, tvb, 15, 1, TRUE); + break; + + case 0x0006: /* Disconnect */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, 5, 1, TRUE); + break; + + case 0x0007: /* Add SCO Connection */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv1, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv2, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv3, tvb, 5, 2, TRUE); + break; + + case 0x0009: /* Accept Connection Request */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, 9, 1, TRUE); + break; + + case 0x000a: /* Reject Connection Request */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, 9, 1, TRUE); + break; + + case 0x000b: /* Link Key Request Reply */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_link_key, tvb, 9, 16, TRUE); + break; + + case 0x000c: /* Link Key Request Negative Reply */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + break; + + case 0x000d: /* PIN Code Request Reply */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_pin_code_length ,tvb, 9, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_pin_code ,tvb, 10, 16, TRUE); + break; + + case 0x000e: /* PIN Code Request Negative Reply */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + break; + + case 0x000f: /* Change Connection Packet Type */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm1, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh1, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm3, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh3, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dm5, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_dh5, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv1, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv2, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_packet_type_hv3, tvb, 5, 2, TRUE); + break; + + case 0x0011: /* Authentication Request */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + break; + + case 0x0013: /* Set Connection Encryption */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_encryption_enable, tvb, 5, 1, TRUE); + break; + + case 0x0017: /* Master Link Key */ + proto_tree_add_item(tree, hf_bthci_cmd_key_flag, tvb, 3, 1, TRUE); + break; + + case 0x0019: /* Remote Name Request */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_page_scan_repetition_mode, tvb, 9, 1, TRUE); + + proto_tree_add_item(tree, hf_bthci_cmd_page_scan_mode, tvb, 10, 1, TRUE); + + item = proto_tree_add_item(tree, hf_bthci_cmd_clock_offset, tvb, 11, 2, TRUE); + clock = tvb_get_letohs(tvb, 11) & 32767; /* only bit0-14 are valid */ + proto_item_append_text(item, " (%g ms)", 1.25*clock); + proto_tree_add_item(tree, hf_bthci_cmd_clock_offset_valid , tvb, 11, 2, TRUE); + break; + + case 0x0015: /* Change Connection Link Key */ + case 0x001b: /* Read Remote Supported Features */ + case 0x001d: /* Read Remote Version Information */ + case 0x001f: /* Read Clock Offset*/ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + break; + + default: + proto_tree_add_item(tree, hf_bthci_cmd_params, tvb, 3, -1, TRUE); + break; + } +} + +void +dissect_link_policy_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 cmd_ocf) +{ + proto_item *item; + guint16 timeout; + + switch(cmd_ocf) { + + case 0x0001: /* Hold Mode */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_max_interval_hold, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_min_interval_hold, tvb, 7, 2, TRUE); + break; + + case 0x0003: /* sniff mode */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_max_interval_sniff, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_min_interval_sniff, tvb, 7, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_sniff_attempt, tvb, 9, 2, TRUE); + item = proto_tree_add_item(tree, hf_bthci_cmd_timeout, tvb, 11, 2, TRUE); + timeout = tvb_get_letohs(tvb, 11); + if (timeout>0) + proto_item_append_text(item, " (%g msec)", (2*timeout-1)*0.625); + else + proto_item_append_text(item, " (0 msec)"); + break; + + case 0x0005: /* Park Mode */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_max_interval_beacon, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_min_interval_beacon, tvb, 7, 2, TRUE); + break; + + case 0x0007: /* QoS Setup */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_flags, tvb, 5, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_service_type, tvb, 6, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_token_rate, tvb, 7, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_peak_bandwidth, tvb, 11, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_latency, tvb, 15, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_delay_variation, tvb, 19, 4, TRUE); + break; + + case 0x000b: /* Switch Role */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, 9, 1, TRUE); + break; + + case 0x000d: /* Write Link Policy Settings */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_link_policy_setting_switch, tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_link_policy_setting_hold , tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_link_policy_setting_sniff , tvb, 5, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_link_policy_setting_park , tvb, 5, 2, TRUE); + break; + + case 0x0004: /* Exit Sniff Mode */ + case 0x0006: /* Exit Park Mode */ + case 0x0009: /* Role Discovery */ + case 0x000c: /* Read Link Policy Settings */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + break; + + default: + proto_tree_add_item(tree, hf_bthci_cmd_params, tvb, 3, -1, TRUE); + break; + + } +} + +void +dissect_host_controller_baseband_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 cmd_ocf) +{ + proto_item *item; + guint16 timeout; + guint8 filter_type, filter_condition_type, num8; + int i; + + switch(cmd_ocf) { + + case 0x0001: /* Set Event Mask */ + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_01, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_02, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_03, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_04, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_05, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_06, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_07, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_08, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_09, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0a, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0b, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0c, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0d, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0e, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_0f, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_10, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_11, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_12, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_13, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_14, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_15, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_16, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_17, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_18, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_19, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1a, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1b, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1c, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1d, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1e, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_1f, tvb, 3, 4, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_evt_mask_20, tvb, 3, 4, TRUE); + break; + + case 0x0005: /* Set Event Filter */ + proto_tree_add_item(tree, hf_bthci_cmd_filter_type, tvb, 3, 1, TRUE); + filter_type = tvb_get_guint8(tvb, 3); + switch (filter_type) { + + case 0x01: /* Inquiry Result Filter */ + proto_tree_add_item(tree, hf_bthci_cmd_inquiry_result_filter_condition_type, + tvb, 4, 1, TRUE); + filter_condition_type = tvb_get_guint8(tvb, 4); + switch (filter_condition_type) { + case 0x01: + proto_tree_add_item(tree, hf_bthci_cmd_class_of_device, tvb, 5, 3, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_class_of_device_mask, tvb, 8, 3, TRUE); + break; + + case 0x02: + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 5, 6, TRUE); + break; + + default: + break; + + } + break; + + case 0x02: /* Connection Setup Filter */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_setup_filter_condition_type, + tvb, 4, 1, TRUE); + filter_condition_type = tvb_get_guint8(tvb, 4); + switch (filter_condition_type) { + case 0x00: + proto_tree_add_item(tree, hf_bthci_cmd_auto_acc_flag, tvb, 5, 1, TRUE); + break; + + case 0x01: + proto_tree_add_item(tree, hf_bthci_cmd_class_of_device, tvb, 5, 3, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_class_of_device_mask, tvb, 8, 3, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_auto_acc_flag, tvb, 11, 1, TRUE); + break; + + case 0x02: + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 5, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_auto_acc_flag, tvb, 11, 1, TRUE); + break; + + default: + break; + + } + break; + + default: + break; + + } + + break; + + case 0x000a: /* Write PIN Type */ + proto_tree_add_item(tree, hf_bthci_cmd_pin_type, tvb, 3, 1, TRUE); + break; + + case 0x000d: /* Read Stored Link Key */ + proto_tree_add_item(tree, hf_bthci_cmd_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_read_all_flag, tvb, 9, 1, TRUE); + break; + + case 0x0011: /* Write Stored Link Key */ + proto_tree_add_item(tree, hf_bthci_cmd_num_link_keys, tvb, 3, 1, TRUE); + num8 = tvb_get_guint8(tvb, 3); + for (i=0; i 0) + proto_item_append_text(item, " slots (%g msec)", timeout*0.625); + else + proto_item_append_text(item, " Illegal Page Timeout"); + break; + + case 0x001a: /* Write Scan Anable */ + proto_tree_add_item(tree, hf_bthci_cmd_scan_enable, + tvb, 3, 1, TRUE); + break; + + case 0x0020: /* Write Authentication Enable */ + proto_tree_add_item(tree, hf_bthci_cmd_authentication_enable, + tvb, 3, 1, TRUE); + break; + + case 0x0022: /* Write Encryption Mode */ + proto_tree_add_item(tree, hf_bthci_cmd_encrypt_mode, tvb, 3, 1, TRUE); + break; + + case 0x0024: /* Write Class of Device */ + proto_tree_add_item(tree, hf_bthci_cmd_class_of_device, + tvb, 3, 3, TRUE); + break; + + case 0x0026: /* Write Voice Setting */ + proto_tree_add_item(tree, hf_bthci_cmd_input_coding, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_input_data_format, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_input_sample_size, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_linear_pcm_bit_pos, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_air_coding_format, + tvb, 3, 2, TRUE); + break; + + case 0x0028: /* Write Automatic Flush Timeout */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, 3, 2, TRUE); + item = proto_tree_add_item(tree, hf_bthci_cmd_timeout, tvb, 5, 2, TRUE); + timeout = tvb_get_letohs(tvb, 5); + if (timeout>0) + proto_item_append_text(item, " slots (%g msec)", timeout*0.625); + else + proto_item_append_text(item, " (= No Automatic Flush )"); + break; + + case 0x002a: /* Write Num of Broadcast Retransmissions */ + proto_tree_add_item(tree, hf_bthci_cmd_num_broadcast_retransmissions, + tvb, 3, 1, TRUE); + break; + + case 0x002c: /* Write Hold Mode Activity */ + proto_tree_add_item(tree, hf_bthci_cmd_hold_mode_act_page, + tvb, 3, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_hold_mode_act_inquiry, + tvb, 3, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_hold_mode_act_periodic, + tvb, 3, 1, TRUE); + break; + + case 0x002d: /* Read Transmit Power Level */ + proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_power_level_type, + tvb, 5, 1, TRUE); + break; + + case 0x002f: /* Write SCO Flow Control Enable */ + proto_tree_add_item(tree, hf_bthci_cmd_sco_flow_control, + tvb, 3, 1, TRUE); + break; + + case 0x0031: /* Set Host Controller To Host Flow Control */ + proto_tree_add_item(tree, hf_bthci_cmd_flow_contr_enable, + tvb, 3, 1, TRUE); + break; + + case 0x0033: /* Host Buffer Size */ + proto_tree_add_item(tree, hf_bthci_cmd_host_data_packet_length_acl, + tvb, 3, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_host_data_packet_length_sco, + tvb, 5, 1, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_host_total_num_acl_data_packets, + tvb, 6, 2, TRUE); + proto_tree_add_item(tree, hf_bthci_cmd_host_total_num_sco_data_packets, + tvb, 8, 2, TRUE); + break; + + case 0x0035: /* Host Number Of Completed Packets */ + proto_tree_add_item(tree, hf_bthci_cmd_num_handles, + tvb, 3, 1, TRUE); + num8 = tvb_get_guint8(tvb, 3); + for (i=0; i0) + proto_item_append_text(item, " slots (%g msec)", timeout*0.625); + else + proto_item_append_text(item, " (= No Link Supervision Timeout)"); + break; + + case 0x003a: /* Write Current IAC LAP */ + proto_tree_add_item(tree, hf_bthci_cmd_num_curr_iac, tvb, 3, 1, TRUE); + num8 = tvb_get_guint8(tvb, 3); + for (i=0; i> 2; + + ti_opcode = proto_tree_add_item(bthci_cmd_tree, hf_bthci_cmd_opcode, tvb, 0, 2, TRUE); + opcode_tree = proto_item_add_subtree(ti_opcode, ett_opcode); + + proto_tree_add_item(opcode_tree, hf_bthci_cmd_ogf, tvb, 0, 2, TRUE); + proto_tree_add_item(opcode_tree, hf_bthci_cmd_ocf, tvb, 0, 2, TRUE); + + proto_tree_add_item(bthci_cmd_tree, hf_bthci_cmd_param_length, tvb, 2, 1, TRUE); + param_length = tvb_get_guint8(tvb, 2); + + if ((check_col(pinfo->cinfo, COL_INFO))) + col_add_fstr(pinfo->cinfo, COL_INFO, "Command: %s", val_to_str(opcode, cmd_opcode_vals, NULL)); + + proto_item_append_text(ti_cmd," - %s", val_to_str(opcode, cmd_opcode_vals, NULL)); + + if (param_length > 0) { + switch (ogf) { + + case 0x01: /* Link Control Command */ + dissect_link_control_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + + case 0x02: /* Link Policy Command */ + dissect_link_policy_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + + case 0x03: /* Host Controller & Baseband Command */ + dissect_host_controller_baseband_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + + case 0x04: /* Informational Parameter Command */ + dissect_informational_parameters_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + + case 0x05: /* Status Parameter Command */ + dissect_status_parameters_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + + case 0x06: /* Testing Command */ + dissect_testing_cmd(tvb, pinfo, bthci_cmd_tree, ocf); + break; + +/* case 0x0c22:*/ /* Write Encryption Mode */ +/* proto_tree_add_item(bthci_cmd_tree, hf_bthci_cmd_encrypt_mode, tvb, 3, 1, TRUE); + break; +*/ + default: + proto_tree_add_item(bthci_cmd_tree, hf_bthci_cmd_params, tvb, 3, -1, TRUE); + break; + } + } + +} + + +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + +void +proto_register_bthci_cmd(void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + { &hf_bthci_cmd_opcode, + { "Command Opcode", "bthci_cmd.opcode", + FT_UINT16, BASE_HEX, VALS(cmd_opcode_vals), 0x0, + "HCI Command Opcode" } + }, + { &hf_bthci_cmd_ogf, + { "ogf", "bthci_cmd.ogf", + FT_UINT16, BASE_HEX, VALS(ogf_vals), 0xfc00, + "Opcode Group Field" } + }, + { &hf_bthci_cmd_ocf, + { "ocf", "bthci_cmd.ocf", + FT_UINT16, BASE_HEX, NULL, 0x03ff, + "Opcode Command Field" } + }, + { &hf_bthci_cmd_param_length, + { "Parameter Total Length", "bthci_cmd.param_length", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Parameter Total Length" } + }, + { &hf_bthci_cmd_params, + { "Command Parameter", "bthci_cmd.params", + FT_NONE, BASE_NONE, NULL, 0x0, + "Command Parameter" } + }, + { &hf_bthci_cmd_lap, + { "LAP", "bthci_cmd.lap", + FT_UINT24, BASE_HEX, NULL, 0x0, + "LAP for the inquiry access code" } + }, + { &hf_bthci_cmd_inq_length, + { "Inquiry Length", "bthci_cmd.inq_length", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Inquiry Length (*1.28s)" } + }, + { &hf_bthci_cmd_num_responses, + { "Num Responses", "bthci_cmd.num_responses", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Responses" } + }, + { &hf_bthci_cmd_encrypt_mode, + { "Encryption Mode", "bthci_cmd.encrypt_mode", + FT_UINT8, BASE_HEX, VALS(encrypt_mode_vals), 0x0, + "Encryption Mode" } + }, + { &hf_bthci_cmd_bd_addr, + { "BD_ADDR", "bthci_cmd.bd_addr", + FT_ETHER, BASE_HEX, NULL, 0x0, + "Bluetooth Device Address"} + }, + { &hf_bthci_cmd_packet_type_dm1, + { "Packet Type DM1", "bthci_cmd.packet_type_dm1", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0008, + "Packet Type DM1" } + }, + { &hf_bthci_cmd_packet_type_dh1, + { "Packet Type DH1", "bthci_cmd.packet_type_dh1", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0010, + "Packet Type DH1" } + }, + { &hf_bthci_cmd_packet_type_dm3, + { "Packet Type DM3", "bthci_cmd.packet_type_dm3", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0400, + "Packet Type DM3" } + }, + { &hf_bthci_cmd_packet_type_dh3, + { "Packet Type DH3", "bthci_cmd.packet_type_dh3", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0800, + "Packet Type DH3" } + }, + { &hf_bthci_cmd_packet_type_dm5, + { "Packet Type DM5", "bthci_cmd.packet_type_dm5", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x4000, + "Packet Type DM5" } + }, + { &hf_bthci_cmd_packet_type_dh5, + { "Packet Type DH5", "bthci_cmd.packet_type_dh5", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x8000, + "Packet Type DH5" } + }, + { &hf_bthci_cmd_page_scan_mode, + { "Page Scan Mode", "bthci_cmd.page_scan_mode", + FT_UINT8, BASE_HEX, VALS(cmd_page_scan_modes), 0x0, + "Page Scan Mode" } + }, + { &hf_bthci_cmd_page_scan_repetition_mode, + { "Page Scan Repetition Mode", "bthci_cmd.page_scan_repetition_mode", + FT_UINT8, BASE_HEX, VALS(cmd_page_scan_repetition_modes), 0x0, + "Page Scan Repetition Mode" } + }, + { &hf_bthci_cmd_page_scan_period_mode, + { "Page Scan Period Mode", "bthci_cmd.page_scan_period_mode", + FT_UINT8, BASE_HEX, VALS(cmd_page_scan_period_modes), 0x0, + "Page Scan Period Mode" } + }, + { &hf_bthci_cmd_clock_offset, + { "Clock Offset", "bthci_cmd.clock_offset", + FT_UINT16, BASE_HEX, NULL, 0x7FFF, + "Bit 2-16 of the Clock Offset between CLKmaster-CLKslave" } + }, + { &hf_bthci_cmd_clock_offset_valid, + { "Clock_Offset_Valid_Flag", "bthci_cmd.clock_offset_valid", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x8000, + "Indicates if clock offset is valid" } + }, + { &hf_bthci_cmd_allow_role_switch, + { "Allow Role Switch", "bthci_cmd.allow_role_switch", + FT_UINT8, BASE_HEX, VALS(cmd_role_switch_modes), 0x0, + "Allow Role Switch" } + }, + { &hf_bthci_cmd_status, + { "Status", "bthci_cmd.status", + FT_UINT8, BASE_HEX, VALS(cmd_status_vals), 0x0, + "Status" } + }, + + { &hf_bthci_cmd_max_period_length, + { "Max Period Length", "bthci_cmd.max_period_length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Maximum amount of time specified between consecutive inquiries." } + }, + { &hf_bthci_cmd_min_period_length, + { "Min Period Length", "bthci_cmd.min_period_length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Minimum amount of time specified between consecutive inquiries." } + }, + { &hf_bthci_cmd_connection_handle, + { "Connection Handle", "bthci_cmd.connection_handle", + FT_UINT16, BASE_HEX, NULL, 0x0, + "Connection Handle" } + }, + { &hf_bthci_cmd_reason, + { "Reason", "bthci_cmd.reason", + FT_UINT8, BASE_HEX, VALS(cmd_status_vals), 0x0, + "Reason" } + }, + { &hf_bthci_cmd_num_link_keys, + { "Number of Link Keys", "bthci_cmd_num_link_keys", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Link Keys" } + }, + { &hf_bthci_cmd_link_key, + { "Link Key", "bthci_cmd.link_key", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Link Key for the associated BD_ADDR" } + }, + { &hf_bthci_cmd_packet_type_hv1, + { "Packet Type HV1", "bthci_cmd.packet_type_hv1", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0020, + "Packet Type HV1" } + }, + { &hf_bthci_cmd_packet_type_hv2, + { "Packet Type HV2", "bthci_cmd.packet_type_hv2", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0040, + "Packet Type HV2" } + }, + { &hf_bthci_cmd_packet_type_hv3, + { "Packet Type HV3", "bthci_cmd.packet_type_hv3", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0080, + "Packet Type HV3" } + }, + { &hf_bthci_cmd_role, + { "Role", "bthci_cmd.role", + FT_UINT8, BASE_HEX, VALS(cmd_role_vals), 0x0, + "Role" } + }, + { &hf_bthci_cmd_pin_code_length, + { "PIN Code Length", "bthci_cmd.pin_code_length", + FT_UINT8, BASE_DEC, NULL, 0x0, + "PIN Code Length" } + }, + { &hf_bthci_cmd_pin_code, + { "PIN Code Length", "bthci_cmd.pin_code_length", + FT_BYTES, BASE_HEX, NULL, 0x0, + "PIN Code Length" } + }, + { &hf_bthci_cmd_pin_type, + { "PIN Type", "bthci_cmd.pin_type", + FT_UINT8, BASE_HEX, VALS(cmd_pin_types), 0x0, + "PIN Types" } + }, + { &hf_bthci_cmd_encryption_enable, + { "Encryption Enable", "bthci_cmd.encryption_enable", + FT_UINT8, BASE_HEX, VALS(cmd_encryption_enable), 0x0, + "Encryption Enable" } + }, + { &hf_bthci_cmd_key_flag, + { "Key Flag", "bthci_cmd.key_flag", + FT_UINT8, BASE_HEX, VALS(cmd_key_flag), 0x0, + "Key Flag" } + }, + { &hf_bthci_cmd_max_interval_hold, + { "Hold Mode Max Interval", "bthci_cmd.hold_mode_max_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Maximal acceptable number of Baseband slots to wait in Hold Mode." } + }, + { &hf_bthci_cmd_min_interval_hold, + { "Hold Mode Min Interval", "bthci_cmd.hold_mode_min_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Minimum acceptable number of Baseband slots to wait in Hold Mode." } + }, + { &hf_bthci_cmd_max_interval_sniff, + { "Sniff Max Interval", "bthci_cmd.sniff_max_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Maximal acceptable number of Baseband slots between each sniff period." } + }, + { &hf_bthci_cmd_min_interval_sniff, + { "Sniff Min Interval", "bthci_cmd.sniff_min_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Minimum acceptable number of Baseband slots between each sniff period." } + }, + { &hf_bthci_cmd_sniff_attempt, + { "Sniff Attempt", "bthci_cmd.sniff_attempt", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of Baseband receive slots for sniff attempt." } + }, + { &hf_bthci_cmd_timeout, + { "Timeout", "bthci_cmd.timeout", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of Baseband slots for timeout." } + }, + { &hf_bthci_cmd_max_interval_beacon, + { "Beacon Max Interval", "bthci_cmd.beacon_max_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Maximal acceptable number of Baseband slots between consecutive beacons." } + }, + { &hf_bthci_cmd_min_interval_beacon, + { "Beacon Min Interval", "bthci_cmd.beacon_min_int", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Minimum acceptable number of Baseband slots between consecutive beacons." } + }, + { &hf_bthci_cmd_flags, + { "Flags", "bthci_cmd.flags", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Flags" } + }, + { &hf_bthci_cmd_service_type, + { "Service Type", "bthci_cmd.service_type", + FT_UINT8, BASE_HEX, VALS(cmd_service_types), 0x0, + "Service Type" } + }, + { &hf_bthci_cmd_token_rate, + { "Available Token Rate", "bthci_cmd.token_rate", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Token Rate, in bytes per second" } + }, + { &hf_bthci_cmd_peak_bandwidth, + { "Peak Bandwidth", "bthci_cmd.peak_bandwidth", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Peak Bandwidth, in bytes per second" } + }, + { &hf_bthci_cmd_latency, + { "Latecy", "bthci_cmd.latency", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Latency, in microseconds" } + }, + { &hf_bthci_cmd_delay_variation, + { "Delay Variation", "bthci_cmd.delay_variation", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Delay Variation, in microseconds" } + }, + { &hf_bthci_cmd_link_policy_setting_switch, + { "Enable Master Slave Switch", "bthci_cmd.link_policy_switch", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0001, + "Enable Master Slave Switch" } + }, + { &hf_bthci_cmd_link_policy_setting_hold, + { "Enable Hold Mode", "bthci_cmd.link_policy_hold", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0002, + "Enable Hold Mode" } + }, + { &hf_bthci_cmd_link_policy_setting_sniff, + { "Enable Sniff Mode", "bthci_cmd.link_policy_sniff", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0004, + "Enable Sniff Mode" } + }, + { &hf_bthci_cmd_link_policy_setting_park, + { "Enable Park Mode", "bthci_cmd.link_policy_park", + FT_UINT16, BASE_BIN, VALS(cmd_boolean), 0x0008, + "Enable Park Mode" } + }, + { &hf_bthci_cmd_filter_type, + { "Filter Type", "bthci_cmd.filter_type", + FT_UINT8, BASE_HEX, VALS(cmd_filter_types), 0x0, + "Filter Type" } + }, + { &hf_bthci_cmd_inquiry_result_filter_condition_type, + { "Filter Condition Type", "bthci_cmd.filter_condition_type", + FT_UINT8, BASE_HEX, VALS(cmd_inquiry_result_filter_condition_types), 0x0, + "Filter Condition Type" } + }, + { &hf_bthci_cmd_connection_setup_filter_condition_type, + { "Filter Condition Type", "bthci_cmd.filter_condition_type", + FT_UINT8, BASE_HEX, VALS(cmd_connection_setup_filter_condition_types), 0x0, + "Filter Condition Type" } + }, + { &hf_bthci_cmd_class_of_device, + { "Class of Device", "bthci_cmd.class_of_device", + FT_UINT24, BASE_HEX, NULL, 0x0, + "Class of Device" } + }, + { &hf_bthci_cmd_class_of_device_mask, + { "Class of Device Mask", "bthci_cmd.class_of_device_mask", + FT_UINT24, BASE_BIN, NULL, 0x0, + "Bit Mask used to determine which bits of the Class of Device parameter are of interest." } + }, + { &hf_bthci_cmd_auto_acc_flag, + { "Auto Accept Flag", "bthci_cmd.auto_accept_flag", + FT_UINT8, BASE_HEX, VALS(cmd_auto_acc_flag_values), 0x0, + "Class of Device of Interest" } + }, + { &hf_bthci_cmd_read_all_flag, + { "Read All Flag", "bthci_cmd.read_all_flag", + FT_UINT8, BASE_HEX, VALS(cmd_read_all_flag_values), 0x0, + "Read All Flag" } + }, + { &hf_bthci_cmd_delete_all_flag, + { "Delete All Flag", "bthci_cmd.delete_all_flag", + FT_UINT8, BASE_HEX, VALS(cmd_delete_all_flag_values), 0x0, + "Delete All Flag" } + }, + { &hf_bthci_cmd_authentication_enable, + { "Authentication Enable", "bthci_cmd.auth_enable", + FT_UINT8, BASE_HEX, VALS(cmd_authentication_enable_values), 0x0, + "Authentication Enable" } + }, + { &hf_bthci_cmd_input_coding, + { "Input Coding", "bthci_cmd.input_coding", + FT_UINT16, BASE_BIN, VALS(cmd_input_coding_values), 0x0300, + "Authentication Enable" } + }, + { &hf_bthci_cmd_input_data_format, + { "Input Data Format", "bthci_cmd.input_data_format", + FT_UINT16, BASE_BIN, VALS(cmd_input_data_format_values), 0x00c0, + "Input Data Format" } + }, + { &hf_bthci_cmd_input_sample_size, + { "Input Sample Size", "bthci_cmd.input_sample_size", + FT_UINT16, BASE_BIN, VALS(cmd_input_sample_size_values), 0x0020, + "Input Sample Size" } + }, + { &hf_bthci_cmd_linear_pcm_bit_pos, + { "Linear PCM Bit Pos", "bthci_cmd.lin_pcm_bit_pos", + FT_UINT16, BASE_BIN, NULL, 0x001c, + "# bit pos. that MSB of sample is away from starting at MSB" } + }, + { &hf_bthci_cmd_air_coding_format, + { "Air Coding Format", "bthci_cmd.air_coding_format", + FT_UINT16, BASE_BIN, VALS(cmd_air_coding_format_values), 0x0003, + "Air Coding Format" } + }, + { &hf_bthci_cmd_num_broadcast_retransmissions, + { "Num Broadcast Retran", "bthci_cmd.num_broad_retran", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Broadcast Retransmissions" } + }, + { &hf_bthci_cmd_hold_mode_act_page, + { "Suspend Page Scan", "bthci_cmd.hold_mode_page", + FT_UINT8, BASE_BIN, VALS(cmd_boolean), 0x1, + "Device can enter low power state" } + }, + { &hf_bthci_cmd_hold_mode_act_inquiry, + { "Suspend Inquiry Scan", "bthci_cmd.hold_mode_inquiry", + FT_UINT8, BASE_BIN, VALS(cmd_boolean), 0x2, + "Device can enter low power state" } + }, + { &hf_bthci_cmd_hold_mode_act_periodic, + { "Suspend Periodic Inquiries", "bthci_cmd.hold_mode_periodic", + FT_UINT8, BASE_BIN, VALS(cmd_boolean), 0x4, + "Device can enter low power state" } + }, + { &hf_bthci_cmd_scan_enable, + { "Scan Enable", "bthci_cmd.scan_enable", + FT_UINT8, BASE_HEX, VALS(cmd_scan_enable_values), 0x0, + "Scan Enable" } + }, + { &hf_bthci_cmd_interval, + { "Interval", "bthci_cmd.interval", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Interval" } + }, + { &hf_bthci_cmd_window, + { "Interval", "bthci_cmd.window", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Window" } + }, + { &hf_bthci_cmd_local_name, + { "Remote Name", "bthci_cmd.local_name", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Userfriendly descriptive name for the device" } + }, + { &hf_bthci_cmd_num_curr_iac, + { "Number of Current IAC", "bthci_cmd.num_curr_iac", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of IACs which are currently in use" } + }, + { &hf_bthci_cmd_iac_lap, + { "IAC LAP", "bthci_cmd.num_curr_iac", + FT_UINT24, BASE_HEX, NULL, 0x0, + "LAP(s)used to create IAC" } + }, + { &hf_bthci_cmd_evt_mask_01, + { "Inquiry Complete ", "bthci_cmd.evt_mask_01", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000001, + "Inquiry Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_02, + { "Inquiry Result ", "bthci_cmd.evt_mask_02", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000002, + "Inquiry Result Bit" } + }, + { &hf_bthci_cmd_evt_mask_03, + { "Connect Complete ", "bthci_cmd.evt_mask_03", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000004, + "Connection Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_04, + { "Connect Request ", "bthci_cmd.evt_mask_04", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000008, + "Connect Request Bit" } + }, + { &hf_bthci_cmd_evt_mask_05, + { "Disconn Complete ", "bthci_cmd.evt_mask_05", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000010, + "Disconn Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_06, + { "Auth Complete ", "bthci_cmd.evt_mask_06", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000020, + "Auth Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_07, + { "Remote Name Req Complete ", "bthci_cmd.evt_mask_07", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000040, + "Remote Name Req Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_08, + { "Encrypt Change ", "bthci_cmd.evt_mask_08", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000080, + "Encrypt Change Bit" } + }, + { &hf_bthci_cmd_evt_mask_09, + { "Change Connection Link Key Complete", "bthci_cmd.evt_mask_09", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000100, + "Change Connection Link Key Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_0a, + { "Master Link Key Complete ", "bthci_cmd.evt_mask_0a", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000200, + "Master Link Key Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_0b, + { "Read Remote Supported Features ", "bthci_cmd.evt_mask_0b", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000400, + "Read Remote Supported Features Bit" } + }, + { &hf_bthci_cmd_evt_mask_0c, + { "Read Remote Ver Info Complete ", "bthci_cmd.evt_mask_0c", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00000800, + "Read Remote Ver Info Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_0d, + { "QoS Setup Complete ", "bthci_cmd.evt_mask_0d", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00001000, + "QoS Setup Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_0e, + { "Command Complete ", "bthci_cmd.evt_mask_0e", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00002000, + "Command Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_0f, + { "Command Status ", "bthci_cmd.evt_mask_0f", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00004000, + "Command Status Bit" } + }, + { &hf_bthci_cmd_evt_mask_10, + { "Hardware Error ", "bthci_cmd.evt_mask_10", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00008000, + "Hardware Error Bit" } + }, + { &hf_bthci_cmd_evt_mask_11, + { "Flush Occurred ", "bthci_cmd.evt_mask_11", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00010000, + "Flush Occurred Bit" } + }, + { &hf_bthci_cmd_evt_mask_12, + { "Role Change ", "bthci_cmd.evt_mask_12", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00020000, + "Role Change Bit" } + }, + { &hf_bthci_cmd_evt_mask_13, + { "Number of Completed Packets ", "bthci_cmd.evt_mask_13", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00040000, + "Number of Completed Packets Bit" } + }, + { &hf_bthci_cmd_evt_mask_14, + { "Mode Change ", "bthci_cmd.evt_mask_14", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00080000, + "Mode Change Bit" } + }, + { &hf_bthci_cmd_evt_mask_15, + { "Return Link Keys ", "bthci_cmd.evt_mask_15", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00100000, + "Return Link Keys Bit" } + }, + { &hf_bthci_cmd_evt_mask_16, + { "PIN Code Request ", "bthci_cmd.evt_mask_16", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00200000, + "PIN Code Request Bit" } + }, + { &hf_bthci_cmd_evt_mask_17, + { "Link Key Request ", "bthci_cmd.evt_mask_17", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00400000, + "Link Key Request Bit" } + }, + { &hf_bthci_cmd_evt_mask_18, + { "Link Key Notification ", "bthci_cmd.evt_mask_18", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x00800000, + "Link Key Notification Bit" } + }, + { &hf_bthci_cmd_evt_mask_19, + { "Loopback Command ", "bthci_cmd.evt_mask_19", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x01000000, + "Loopback Command Bit" } + }, + { &hf_bthci_cmd_evt_mask_1a, + {"Data Buffer Overflow " , "bthci_cmd.evt_mask_1a", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x02000000, + "Data Buffer Overflow Bit" } + }, + { &hf_bthci_cmd_evt_mask_1b, + { "Max Slots Change ", "bthci_cmd.evt_mask_1b", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x04000000, + "Max Slots Change Bit" } + }, + { &hf_bthci_cmd_evt_mask_1c, + { "Read Clock Offset Complete ", "bthci_cmd.evt_mask_1c", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x08000000, + "Read Clock Offset Complete Bit" } + }, + { &hf_bthci_cmd_evt_mask_1d, + { "Connection Packet Type Changed ", "bthci_cmd.evt_mask_1d", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x10000000, + "Connection Packet Type Changed Bit" } + }, + { &hf_bthci_cmd_evt_mask_1e, + { "QoS Violation ", "bthci_cmd.evt_mask_1e", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x20000000, + "QoS Violation Bit" } + }, + { &hf_bthci_cmd_evt_mask_1f, + { "Page Scan Mode Change ", "bthci_cmd.evt_mask_1f", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x40000000, + "Page Scan Mode Change Bit" } + }, + { &hf_bthci_cmd_evt_mask_20, + { "Page Scan Repetition Mode Change ", "bthci_cmd.evt_mask_20", + FT_UINT32, BASE_HEX, VALS(cmd_boolean), 0x80000000, + "Page Scan Repetition Mode Change Bit" } + }, + { &hf_bthci_cmd_sco_flow_control, + { "SCO Flow Control","bthci_cmd.flow_control", + FT_UINT8, BASE_HEX, VALS(cmd_en_disabled), 0x0, + "SCO Flow Control" } + }, + { &hf_bthci_cmd_num_handles, + { "Number of Handles", "bthci_cmd.num_handles", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Handles" } + }, + + { &hf_bthci_cmd_num_compl_packets, + { "Number of Completed Packets", "bthci_cmd.num_compl_packets", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of Completed HCI Data Packets" } + }, + { &hf_bthci_cmd_flow_contr_enable, + { "Flow Control Enable", "bthci_cmd.flow_contr_enable", + FT_UINT8, BASE_HEX, VALS(cmd_flow_contr_enable), 0x0, + "Flow Control Enable" } + }, + { &hf_bthci_cmd_host_data_packet_length_acl, + {"Host ACL Data Packet Length (bytes)", "bthci_cmd.max_data_length_acl", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Max Host ACL Data Packet length of data portion host is able to accept" } + }, + { &hf_bthci_cmd_host_data_packet_length_sco, + {"Host SCO Data Packet Length (bytes)", "bthci_cmd.max_data_length_sco", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Max Host SCO Data Packet length of data portion host is able to accept" } + }, + { &hf_bthci_cmd_host_total_num_acl_data_packets, + {"Host Total Num ACL Data Packets", "bthci_cmd.max_data_num_acl", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Total Number of HCI ACL Data Packets that can be stored in the data buffers of the Host" } + }, + { &hf_bthci_cmd_host_total_num_sco_data_packets, + {"Host Total Num SCO Data Packets", "bthci_cmd.max_data_num_sco", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Total Number of HCI SCO Data Packets that can be stored in the data buffers of the Host" } + }, + { &hf_bthci_cmd_power_level_type, + {"Type", "bthci_cmd.power_level_type", + FT_UINT8, BASE_HEX, VALS(cmd_power_level_types), 0x0, + "Type"} + }, + { &hf_bthci_cmd_loopback_mode, + {"Loopback Mode", "bthci_cmd.loopback_mode", + FT_UINT8, BASE_HEX, VALS(cmd_loopback_modes), 0x0, + "Loopback Mode"} + }, + }; + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_bthci_cmd, + &ett_opcode, + }; + +/* Register the protocol name and description */ + proto_bthci_cmd = proto_register_protocol("Bluetooth HCI Command", + "HCI_CMD", "bthci_cmd"); + + register_dissector("bthci_cmd", dissect_bthci_cmd, proto_bthci_cmd); + + + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_bthci_cmd, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_bthci_cmd(void) +{ + dissector_handle_t bthci_cmd_handle; + + bthci_cmd_handle = find_dissector("bthci_cmd"); + +} + + diff -Nur ethereal-0.9.7/packet-bthci-cmd.h ethereal-0.9.7-patched/packet-bthci-cmd.h --- ethereal-0.9.7/packet-bthci-cmd.h 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-bthci-cmd.h 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,374 @@ +/* packet-bthci-cmd.h + * Definitionsfor the Bluetooth HCI Command dissection + * Copyright 2002, Christoph Scholz + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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. + */ + + +#ifndef __PACKET_BTHCI_CMD_H__ +#define __PACKET_BTHCI_CMD_H__ + +static const value_string cmd_opcode_vals[] = { + {0x0000, "No Operation"}, + {0x0401, "Inquiry"}, + {0x0402, "Inquiry Cancel"}, + {0x0403, "Periodic Inquiry Mode"}, + {0x0404, "Exit Periodic Inquiry Mode"}, + {0x0405, "Create Connection"}, + {0x0406, "Disconnect"}, + {0x0407, "Add SCO Connection"}, + {0x0409, "Accept Connection Request"}, + {0x040a, "Reject Connection Request"}, + {0x040b, "Link Key Request Reply"}, + {0x040c, "Link Key Request Negative Reply"}, + {0x040d, "PIN Code Request Reply"}, + {0x040e, "PIN Code Request Negative Reply"}, + {0x040f, "Change Connection Packet Type"}, + {0x0411, "Authentication Requested"}, + {0x0413, "Set Connection Encryption"}, + {0x0415, "Change Connection Link Key"}, + {0x0417, "Master Link Key"}, + {0x0419, "Remote Name Request"}, + {0x041b, "Read Remote Supported Features"}, + {0x041d, "Read Remote Version Information"}, + {0x041f, "Read Clock offset"}, + {0x0801, "Hold Mode"}, + {0x0803, "Sniff Mode"}, + {0x0804, "Exit Sniff Mode"}, + {0x0805, "Park Mode"}, + {0x0806, "Exit Park Mode"}, + {0x0807, "QoS Setup"}, + {0x0809, "Role Discovery"}, + {0x080b, "Switch Role"}, + {0x080c, "Read Link Policy Settings"}, + {0x080d, "Write Link Policy Settings"}, + {0x0c01, "Set Event Mask"}, + {0x0c03, "Reset"}, + {0x0c05, "Set Event Filter"}, + {0x0c08, "Flush"}, + {0x0c09, "Read PIN Type "}, + {0x0c0a, "Write PIN Type"}, + {0x0c0b, "Create New Unit Key"}, + {0x0c0d, "Read Stored Link Key"}, + {0x0c11, "Write Stored Link Key"}, + {0x0c12, "Delete Stored Link Key"}, + {0x0c13, "Change Local Name"}, + {0x0c14, "Read Local Name"}, + {0x0c15, "Read Connection Accept Timeout"}, + {0x0c16, "Write Connection Accept Timeout"}, + {0x0c17, "Read Page Timeout"}, + {0x0c18, "Write Page Timeout"}, + {0x0c19, "Read Scan Enable"}, + {0x0c1a, "Write Scan Enable"}, + {0x0c1b, "Read Page Scan Activity"}, + {0x0c1c, "Write Page Scan Activity"}, + {0x0c1d, "Read Inquiry Scan Activity"}, + {0x0c1e, "Write Inquiry Scan Activity"}, + {0x0c1f, "Read Authentication Enable"}, + {0x0c20, "Write Authentication Enable"}, + {0x0c21, "Read Encryption Mode"}, + {0x0c22, "Write Encryption Mode"}, + {0x0c23, "Read Class of Device"}, + {0x0c24, "Write Class of Device"}, + {0x0c25, "Read Voice Setting"}, + {0x0c26, "Write Voice Setting"}, + {0x0c27, "Read Automatic Flush Timeout"}, + {0x0c28, "Write Automatic Flush Timeout"}, + {0x0c29, "Read Num Broadcast Retransmissions"}, + {0x0c2a, "Write Num Broadcast Retransmissions"}, + {0x0c2b, "Read Hold Mode Activity "}, + {0x0c2c, "Write Hold Mode Activity"}, + {0x0c2d, "Read Transmit Power Level"}, + {0x0c2e, "Read SCO Flow Control Enable"}, + {0x0c2f, "Write SCO Flow Control Enable"}, + {0x0c31, "Set Host Controller To Host Flow Control"}, + {0x0c33, "Host Buffer Size"}, + {0x0c35, "Host Number of Completed Packets"}, + {0x0c36, "Read Link Supervision Timeout"}, + {0x0c37, "Write Link Supervision Timeout"}, + {0x0c38, "Read Number of Supported IAC"}, + {0x0c39, "Read Current IAC LAP"}, + {0x0c3a, "Write Current IAC LAP"}, + {0x0c3b, "Read Page Scan Period Mode"}, + {0x0c3c, "Write Page Scan Period Mode"}, + {0x0c3d, "Read Page Scan Mode"}, + {0x0c3e, "Write Page Scan Mode"}, + {0x1001, "Read Local Version Information"}, + {0x1003, "Read Local Supported Features"}, + {0x1005, "Read Buffer Size"}, + {0x1007, "Read Country Code"}, + {0x1009, "Read BD ADDR"}, + {0x1401, "Read Failed Contact Counter"}, + {0x1402, "Reset Failed Contact Counter"}, + {0x1403, "Get Link Quality"}, + {0x1405, "Read RSSI"}, + {0x1801, "Read Loopback Mode"}, + {0x1802, "Write Loopback Mode"}, + {0x1803, "Enable Device Under Test Mode"}, +}; + +/* + * The HCI_OGF_ values for "ogf". + */ +#define HCI_OGF_LINK_CONTROL 0x01 +#define HCI_OGF_LINK_POLICY 0x02 +#define HCI_OGF_HOST_CONTROLLER 0x03 +#define HCI_OGF_INFORMATIONAL 0x04 +#define HCI_OGF_STATUS 0x05 +#define HCI_OGF_TESTING 0x06 + +static const value_string ogf_vals[] = { + { HCI_OGF_LINK_CONTROL, "Link Control Commands" }, + { HCI_OGF_LINK_POLICY, "Link Policy Commands" }, + { HCI_OGF_HOST_CONTROLLER,"Host Controller & Baseband Commands" }, + { HCI_OGF_INFORMATIONAL, "Informational Parameters" }, + { HCI_OGF_STATUS, "Status Parameters" }, + { HCI_OGF_TESTING, "Testing Commands" }, + { 0, NULL } +}; + +static const value_string cmd_status_vals[] = { + {0x00, "Command Succeeded"}, + {0x01, "Unknown HCI Command"}, + {0x02, "No Connection"}, + {0x03, "Hardware Failure"}, + {0x04, "Page Timeout"}, + {0x05, "Authentication Failure"}, + {0x06, "Key Missing"}, + {0x07, "Memory Full"}, + {0x08, "Connection Timeout"}, + {0x09, "Max Number Of Connections"}, + {0x0A, "Max Number Of SCO Connections To A Device"}, + {0x0B, "ACL connection already exists"}, + {0x0C, "Command Disallowed"}, + {0x0D, "Host Rejected due to limited resources"}, + {0x0E, "Host Rejected due to security reasons"}, + {0x0F, "Host Rejected due to remote device is only a personal device"}, + {0x10, "Host Timeout"}, + {0x11, "Unsupported Feature or Parameter Value"}, + {0x12, "Invalid HCI Command Parameters"}, + {0x13, "Other End Terminated Connection: User Ended Connection"}, + {0x14, "Other End Terminated Connection: Low Resources"}, + {0x15, "Other End Terminated Connection: About to Power Off"}, + {0x16, "Connection Terminated by Local Host"}, + {0x17, "Repeated Attempts"}, + {0x18, "Pairing Not Allowed"}, + {0x19, "Unknown LMP PDU"}, + {0x1A, "Unsupported Remote Feature"}, + {0x1B, "SCO Offset Rejected"}, + {0x1C, "SCO Interval Rejected"}, + {0x1D, "SCO Air Mode Rejected"}, + {0x1E, "Invalid LMP Parameters"}, + {0x1F, "Unspecified Error"}, + {0x20, "Unsupported LMP Parameter Value"}, + {0x21, "Role Change Not Allowed"}, + {0x22, "LMP Response Timeout"}, + {0x23, "LMP Error Transaction Collision"}, + {0x24, "LMP PDU Not Allowed"}, + {0x25, "Encryption Mode Not Acceptable"}, + {0x26, "Unit Key Used"}, + {0x27, "QoS is Not Supported"}, + {0x28, "Instant Passed"}, + {0x29, "Pairing with Unit Key Not Supported"}, +}; + +static const value_string encrypt_mode_vals[] = { + { 0x00, "Encryption Disabled" }, + { 0x01, "Encryption only for Point-To-Point Packets" }, + { 0x02, "Encryption for Point-To-Point and Broadcast Packets" }, + { 0, NULL } +}; + +static const value_string cmd_page_scan_repetition_modes[] = { + {0x00, "R0"}, + {0x01, "R1"}, + {0x02, "R2"}, + { 0, NULL}, +}; + +static const value_string cmd_page_scan_period_modes[] = { + {0x00, "P0"}, + {0x01, "P1"}, + {0x02, "P2"}, + { 0, NULL}, +}; + +static const value_string cmd_page_scan_modes[] = { + {0x00, "Mandatory Page Scan Mode"}, + {0x01, "Optional Page Scan Mode I"}, + {0x02, "Optional Page Scan Mode II"}, + {0x03, "Optional Page Scan Mode III"}, + { 0, NULL}, +}; + +static const value_string cmd_role_switch_modes[] = { + {0x00, "Local device will be master, and will not accept a master-slave switch request." }, + {0x01, "Local device may be master, or may become slave after accepting a master slave switch." }, + { 0, NULL}, +}; + +static const value_string cmd_boolean[] = { + {0x0 , "false" }, + {0x1 , "true" }, + { 0 , NULL }, +}; + +static const value_string cmd_en_disabled[] = { + {0x00, "disabled" }, + {0x01, "enabled" }, + { 0, NULL }, +}; + +static const value_string cmd_role_vals[] = { + {0x00, "Become Master"}, + {0x01, "Remain Slave"}, + { 0, NULL}, +}; + +static const value_string cmd_encryption_enable[] = { + {0x00, "Link Level Encryption is OFF"}, + {0x01, "Link Level Encryption is ON"}, + { 0, NULL}, +}; + +static const value_string cmd_key_flag[] = { + {0x00, "Using Semi-permanent Link Key"}, + {0x01, "Using Temporary Link Key"}, + { 0, NULL}, +}; + +static const value_string cmd_service_types[] = { + {0x00, "No Traffic"}, + {0x01, "Best Effort"}, + {0x02, "Guaranteed"}, + { 0, NULL}, +}; + +static const value_string cmd_filter_types[] = { + {0x00, "Clear all Filters" }, + {0x01, "Inquiry Result" }, + {0x02, "Connection Setup" }, + { 0, NULL }, +}; + +static const value_string cmd_inquiry_result_filter_condition_types[] = { + {0x00, "A new device responded" }, + {0x01, "A device with the specified Class of Device responded" }, + {0x01, "A device with the specified BD_ADDR responded" }, + { 0, NULL}, +}; + +static const value_string cmd_connection_setup_filter_condition_types[] = { + {0x00, "Allow Connections from all devices" }, + {0x01, "Allow Connections from a device with a specific Class of Device" }, + {0x02, "Allow Connections from a device with a specific BD_ADDR" }, + { 0, NULL}, +}; + +static const value_string cmd_auto_acc_flag_values[] = { + {0x01, "Do NOT Auto accept" }, + {0x02, "Do Auto accept, role switch disabled" }, + {0x03, "Do Auto accept, role switch enabled" }, + { 0, NULL}, +}; + +static const value_string cmd_pin_types[] = { + {0x00, "Variable PIN" }, + {0x01, "Fixed PIN" }, + { 0, NULL }, +}; + +static const value_string cmd_read_all_flag_values[] = { + {0x00, "Return Link Key for speified BD_ADDR" }, + {0x01, "Return all stored Link Keys" }, + { 0, NULL }, +}; + +static const value_string cmd_delete_all_flag_values[] = { + {0x00, "Delete only Link Key for speified BD_ADDR" }, + {0x01, "Delete all stored Link Keys" }, + { 0, NULL }, +}; + +static const value_string cmd_scan_enable_values[] = { + {0x00, "No Scans enabled" }, + {0x01, "Inquiry Scan enabled/Page Scan disable" }, + {0x02, "Inquiry Scan disabled/Page Scan enabled" }, + {0x03, "Inquiry Scan enabled/Page Scan enabled" }, + { 0, NULL }, +}; + +static const value_string cmd_authentication_enable_values[] = { + {0x00, "Authentication disabled" }, + {0x01, "Authentication enabled for all connection" }, + { 0, NULL }, +}; + +static const value_string cmd_input_coding_values[] = { + {0x0, "Linear" }, + {0x1, "\xb5-law" }, + {0x2, "A-law" }, + { 0, NULL }, +}; + +static const value_string cmd_input_data_format_values[] = { + {0x0, "1's complement" }, + {0x1, "2's complement" }, + {0x2, "Sign-Magnitude" }, + { 0, NULL }, +}; + +static const value_string cmd_input_sample_size_values[] = { + {0x0, "8 bit (only for Linear PCM)" }, + {0x1, "16 bit (only for Linear PCM)" }, + { 0, NULL }, +}; + +static const value_string cmd_air_coding_format_values[] = { + {0x0, "CVSD" }, + {0x1, "\xb5-law" }, + {0x2, "A-law" }, + { 0, NULL }, +}; + +static const value_string cmd_flow_contr_enable[] = { + {0x00, "Flow control off in direction from Host Controller to Host." }, + {0x01, "ON - HCI ACL Data Packets / OFF - HCI SCO Data Packets" }, + {0x02, "OFF - HCI ACL Data Packets / ON - HCI SCO Data Packets" }, + {0x03, "ON - HCI ACL Data Packets / ON - HCI SCO Data Packets" }, + { 0, NULL }, +}; + +static const value_string cmd_power_level_types[] = { + {0x00, "Read Current Transmission Power Level" }, + {0x01, "Read Maximum Transmission Power Level" }, + { 0, NULL }, +}; + +static const value_string cmd_loopback_modes[] = { + {0x00, "No Loopback mode enabled" }, + {0x01, "Enable Local Loopback" }, + {0x02, "Enable Remote Loopback" }, + { 0, NULL }, +}; + +#endif diff -Nur ethereal-0.9.7/packet-bthci-evt.c ethereal-0.9.7-patched/packet-bthci-evt.c --- ethereal-0.9.7/packet-bthci-evt.c 1970-01-01 01:00:00.000000000 +0100 +++ ethereal-0.9.7-patched/packet-bthci-evt.c 2002-11-08 18:14:04.000000000 +0100 @@ -0,0 +1,1709 @@ +/* packet-bthci-evt.c + * Routines for the Bluetooth HCI Event dissection + * Copyright 2002, Christoph Scholz + * + * $Id: ethereal_affix-3.patch,v 1.1 2002/11/10 20:47:21 kds Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include +#include + +#include + +static dissector_handle_t hci_com_handle; + +/* Initialize the protocol and registered fields */ +static int proto_bthci_evt = -1; +static int hf_bthci_evt_code = -1; +static int hf_bthci_evt_param_length = -1; +static int hf_bthci_evt_params = -1; +static int hf_bthci_evt_num_command_packets = -1; +static int hf_bthci_evt_num_handles = -1; +static int hf_bthci_evt_connection_handle = -1; +static int hf_bthci_evt_num_compl_packets = -1; +static int hf_bthci_evt_com_opcode = -1; +static int hf_bthci_evt_ret_params = -1; +static int hf_bthci_evt_status = -1; +static int hf_bthci_evt_ocf = -1; +static int hf_bthci_evt_ogf = -1; +static int hf_bthci_evt_bd_addr = -1; +static int hf_bthci_evt_link_type = -1; +static int hf_bthci_evt_encryption_mode = -1; +static int hf_bthci_evt_class_of_device = -1; +static int hf_bthci_evt_reason = -1; +static int hf_bthci_evt_remote_name = -1; +static int hf_bthci_evt_encryption_enable = -1; +static int hf_bthci_evt_key_flag = -1; +static int hf_bthci_evt_vers_nr = -1; +static int hf_bthci_evt_hci_vers_nr = -1; +static int hf_bthci_evt_hci_revision = -1; +static int hf_bthci_evt_comp_id = -1; +static int hf_bthci_evt_sub_vers_nr = -1; +static int hf_bthci_evt_flags = -1; +static int hf_bthci_evt_service_type = -1; +static int hf_bthci_evt_token_rate = -1; +static int hf_bthci_evt_peak_bandwidth = -1; +static int hf_bthci_evt_latency = -1; +static int hf_bthci_evt_delay_variation = -1; +static int hf_bthci_evt_hardware_code = -1; +static int hf_bthci_evt_role = -1; +static int hf_bthci_evt_curr_role = -1; +static int hf_bthci_evt_curr_mode = -1; +static int hf_bthci_evt_interval = -1; +static int hf_bthci_evt_link_key = -1; +static int hf_bthci_evt_key_type = -1; +static int hf_bthci_evt_max_slots = -1; +static int hf_bthci_evt_clock_offset = -1; +static int hf_bthci_evt_link_type_dm1 = -1; +static int hf_bthci_evt_link_type_dh1 = -1; +static int hf_bthci_evt_link_type_dm3 = -1; +static int hf_bthci_evt_link_type_dh3 = -1; +static int hf_bthci_evt_link_type_dm5 = -1; +static int hf_bthci_evt_link_type_dh5 = -1; +static int hf_bthci_evt_link_type_hv1 = -1; +static int hf_bthci_evt_link_type_hv2 = -1; +static int hf_bthci_evt_link_type_hv3 = -1; +static int hf_bthci_evt_page_scan_mode = -1; +static int hf_bthci_evt_page_scan_repetition_mode = -1; +static int hf_bthci_evt_page_scan_period_mode = -1; +static int hf_bthci_evt_lmp_feature_00 = -1; +static int hf_bthci_evt_lmp_feature_01 = -1; +static int hf_bthci_evt_lmp_feature_02 = -1; +static int hf_bthci_evt_lmp_feature_03 = -1; +static int hf_bthci_evt_lmp_feature_04 = -1; +static int hf_bthci_evt_lmp_feature_05 = -1; +static int hf_bthci_evt_lmp_feature_06 = -1; +static int hf_bthci_evt_lmp_feature_07 = -1; +static int hf_bthci_evt_lmp_feature_10 = -1; +static int hf_bthci_evt_lmp_feature_11 = -1; +static int hf_bthci_evt_lmp_feature_12 = -1; +static int hf_bthci_evt_lmp_feature_13 = -1; +static int hf_bthci_evt_lmp_feature_14 = -1; +static int hf_bthci_evt_lmp_feature_15 = -1; +static int hf_bthci_evt_lmp_feature_16 = -1; +static int hf_bthci_evt_lmp_feature_17 = -1; +static int hf_bthci_evt_lmp_feature_20 = -1; +static int hf_bthci_evt_lmp_feature_21 = -1; +static int hf_bthci_evt_lmp_feature_22 = -1; +static int hf_bthci_evt_lmp_feature_23 = -1; +static int hf_bthci_evt_lmp_feature_24 = -1; +static int hf_bthci_evt_num_keys = -1; +static int hf_bthci_evt_num_keys_read = -1; +static int hf_bthci_evt_max_num_keys = -1; +static int hf_bthci_evt_num_responses = -1; +static int hf_bthci_evt_num_keys_written = -1; +static int hf_bthci_evt_num_keys_deleted = -1; +static int hf_bthci_evt_link_policy_setting_switch = -1; +static int hf_bthci_evt_link_policy_setting_hold = -1; +static int hf_bthci_evt_link_policy_setting_sniff = -1; +static int hf_bthci_evt_link_policy_setting_park = -1; +static int hf_bthci_evt_pin_type = -1; +static int hf_bthci_evt_name = -1; +static int hf_bthci_evt_timeout = -1; +static int hf_bthci_evt_scan_enable = -1; +static int hf_bthci_evt_authentication_enable = -1; +static int hf_bthci_evt_sco_flow_cont_enable = -1; +static int hf_bthci_evt_window = -1; +static int hf_bthci_evt_input_coding = -1; +static int hf_bthci_evt_input_data_format = -1; +static int hf_bthci_evt_input_sample_size = -1; +static int hf_bthci_evt_num_broadcast_retransm = -1; +static int hf_bthci_evt_hold_mode_act_page = -1; +static int hf_bthci_evt_hold_mode_act_inquiry = -1; +static int hf_bthci_evt_hold_mode_act_periodic = -1; +static int hf_bthci_evt_transmit_power_level = -1; +static int hf_bthci_evt_num_supp_iac = -1; +static int hf_bthci_evt_num_curr_iac = -1; +static int hf_bthci_evt_iac_lap = -1; +static int hf_bthci_evt_loopback_mode = -1; +static int hf_bthci_evt_country_code = -1; +static int hf_bthci_evt_failed_contact_counter = -1; +static int hf_bthci_evt_link_quality = -1; +static int hf_bthci_evt_rssi = -1; +static int hf_bthci_evt_host_data_packet_length_acl = -1; +static int hf_bthci_evt_host_data_packet_length_sco = -1; +static int hf_bthci_evt_host_total_num_acl_data_packets = -1; +static int hf_bthci_evt_host_total_num_sco_data_packets = -1; + +/* Initialize the subtree pointers */ +static gint ett_bthci_evt = -1; +static gint ett_opcode = -1; +static gint ett_lmp_subtree = -1; +static gint ett_ptype_subtree = -1; + + +static const value_string evt_code_vals[] = { + {0x01, "Inquiry Complete"}, + {0x02, "Inquiry Result"}, + {0x03, "Connect Complete"}, + {0x04, "Connect Request"}, + {0x05, "Disconn Complete"}, + {0x06, "Auth Complete"}, + {0x07, "Remote Name Req Complete"}, + {0x08, "Encrypt Change"}, + {0x09, "Change Connection Link Key Complete"}, + {0x0a, "Master Link Key Complete"}, + {0x0b, "Read Remote Supported Features"}, + {0x0c, "Read Remote Ver Info Complete"}, + {0x0d, "QoS Setup Complete"}, + {0x0e, "Command Complete"}, + {0x0f, "Command Status"}, + {0x10, "Hardware Error"}, + {0x11, "Flush Occurred"}, + {0x12, "Role Change"}, + {0x13, "Number of Completed Packets"}, + {0x14, "Mode Change"}, + {0x15, "Return Link Keys"}, + {0x16, "PIN Code Request"}, + {0x17, "Link Key Request"}, + {0x18, "Link Key Notification"}, + {0x19, "Loopback Command"}, + {0x1a, "Data Buffer Overflow"}, + {0x1b, "Max Slots Change"}, + {0x1c, "Read Clock Offset Complete"}, + {0x1d, "Connection Packet Type Changed"}, + {0x1e, "QoS Violation"}, + {0x1f, "Page Scan Mode Change"}, + {0x20, "Page Scan Repetition Mode Change"}, +}; + +static const value_string evt_status_vals[] = { + {0x00, "Command Succeeded"}, + {0x01, "Unknown HCI Command"}, + {0x02, "No Connection"}, + {0x03, "Hardware Failure"}, + {0x04, "Page Timeout"}, + {0x05, "Authentication Failure"}, + {0x06, "Key Missing"}, + {0x07, "Memory Full"}, + {0x08, "Connection Timeout"}, + {0x09, "Max Number Of Connections"}, + {0x0A, "Max Number Of SCO Connections To A Device"}, + {0x0B, "ACL connection already exists"}, + {0x0C, "Command Disallowed"}, + {0x0D, "Host Rejected due to limited resources"}, + {0x0E, "Host Rejected due to security reasons"}, + {0x0F, "Host Rejected due to remote device is only a personal device"}, + {0x10, "Host Timeout"}, + {0x11, "Unsupported Feature or Parameter Value"}, + {0x12, "Invalid HCI Command Parameters"}, + {0x13, "Other End Terminated Connection: User Ended Connection"}, + {0x14, "Other End Terminated Connection: Low Resources"}, + {0x15, "Other End Terminated Connection: About to Power Off"}, + {0x16, "Connection Terminated by Local Host"}, + {0x17, "Repeated Attempts"}, + {0x18, "Pairing Not Allowed"}, + {0x19, "Unknown LMP PDU"}, + {0x1A, "Unsupported Remote Feature"}, + {0x1B, "SCO Offset Rejected"}, + {0x1C, "SCO Interval Rejected"}, + {0x1D, "SCO Air Mode Rejected"}, + {0x1E, "Invalid LMP Parameters"}, + {0x1F, "Unspecified Error"}, + {0x20, "Unsupported LMP Parameter Value"}, + {0x21, "Role Change Not Allowed"}, + {0x22, "LMP Response Timeout"}, + {0x23, "LMP Error Transaction Collision"}, + {0x24, "LMP PDU Not Allowed"}, + {0x25, "Encryption Mode Not Acceptable"}, + {0x26, "Unit Key Used"}, + {0x27, "QoS is Not Supported"}, + {0x28, "Instant Passed"}, + {0x29, "Pairing with Unit Key Not Supported"}, +}; + +static const value_string evt_link_types[] = { + {0x00, "SCO connection (Voice Channels)"}, + {0x01, "ACL connection (Data Channels)"}, + { 0, NULL}, +}; + +static const value_string evt_encryption_modes[] = { + {0x00, "Encryption Disabled"}, + {0x01, "Encryption only for point-to-point packets"}, + {0x02, "Encryption for both point-to-point and broadcast packets"}, + { 0, NULL}, +}; + +static const value_string evt_encryption_enable[] = { + {0x00, "Link Level Encryption is OFF"}, + {0x01, "Link Level Encryption is ON"}, + { 0, NULL}, +}; + +static const value_string evt_key_flag[] = { + {0x00, "Using Semi-permanent Link Key"}, + {0x01, "Using Temporary Link Key"}, + { 0, NULL}, +}; + +static const value_string evt_lmp_vers_nr[] = { + {0x00, "Bluetooth LMP 1.0"}, + {0x01, "Bluetooth LMP 1.1"}, + { 0, NULL}, +}; + +static const value_string evt_hci_vers_nr[] = { + {0x00, "Bluetooth HCI Specification 1.0B"}, + {0x01, "Bluetooth HCI Specification 1.1"}, + { 0, NULL}, +}; + +static const value_string evt_comp_id[] = { + {0x0000, "Ericsson Mobile Communications"}, + {0x0001, "Nokia Mobile Phones"}, + {0x0002, "Intel Corp."}, + {0x0003, "IBM Corp."}, + {0x0004, "Toshiba Corp."}, + {0x0005, "3Com"}, + {0x0006, "Microsoft"}, + {0x0007, "Lucent"}, + {0x0008, "Motorola"}, + {0x0009, "Infineon Technologies AG"}, + {0x000a, "Cambridge Silicon Radio"}, + {0x000b, "Silicon Wave"}, + {0x000c, "Digianswer"}, + {0xFFFF, "For use in internal and interoperability tests."}, + { 0, NULL}, +}; + +static const value_string evt_service_types[] = { + {0x00, "No Traffic Available"}, + {0x01, "Best Effort Available"}, + {0x02, "Guaranteed Available"}, + { 0, NULL}, +}; + +static const value_string evt_role_vals[] = { + {0x00, "Currently the Master for specified BD_ADDR"}, + {0x01, "Currently the Slave for specified BD_ADDR"}, + { 0, NULL}, +}; + +static const value_string evt_role_vals_handle[] = { + {0x00, "Currently the Master for this connection handle"}, + {0x01, "Currently the Slave for this connection handle"}, + { 0, NULL}, +}; + +static const value_string evt_modes[] = { + {0x00, "Active Mode"}, + {0x01, "Hold Mode"}, + {0x02, "Sniff Mode"}, + {0x03, "Park Mode"}, + { 0, NULL}, +}; + +static const value_string evt_key_types[] = { + {0x00, "Combination Key"}, + {0x01, "Local Unit Key"}, + {0x02, "Remote Unit Key"}, + { 0, NULL}, +}; + +static const value_string evt_page_scan_modes[] = { + {0x00, "Mandatory Page Scan Mode"}, + {0x01, "Optional Page Scan Mode I"}, + {0x02, "Optional Page Scan Mode II"}, + {0x03, "Optional Page Scan Mode III"}, + { 0, NULL}, +}; + +static const value_string evt_page_scan_repetition_modes[] = { + {0x00, "R0"}, + {0x01, "R1"}, + {0x02, "R2"}, + { 0, NULL}, +}; + +static const value_string evt_page_scan_period_modes[] = { + {0x00, "P0"}, + {0x01, "P1"}, + {0x02, "P2"}, + { 0, NULL}, +}; + +static const value_string evt_boolean[] = { + {0x0 , "false" }, + {0x1 , "true" }, + { 0 , NULL }, +}; + +static const value_string evt_pin_types[] = { + {0x00, "Variable PIN" }, + {0x01, "Fixed PIN" }, + { 0, NULL }, +}; + +static const value_string evt_scan_enable_values[] = { + {0x00, "No Scans enabled" }, + {0x01, "Inquiry Scan enabled/Page Scan disable" }, + {0x02, "Inquiry Scan disabled/Page Scan enabled" }, + {0x03, "Inquiry Scan enabled/Page Scan enabled" }, + { 0, NULL }, +}; + +static const value_string evt_auth_enable_values[] = { + {0x00, "Disabled" }, + {0x01, "Enabled for all connections "}, + { 0, NULL }, +}; + +static const value_string evt_enable_values[] = { + {0x00, "Disabled" }, + {0x01, "Enabled"}, + { 0, NULL } +}; + +static const value_string evt_input_coding_values[] = { + {0x0, "Linear" }, + {0x1, "\xb5-law" }, + {0x2, "A-law" }, + { 0, NULL }, +}; + +static const value_string evt_input_data_format_values[] = { + {0x0, "1's complement" }, + {0x1, "2's complement" }, + {0x2, "Sign-Magnitude" }, + { 0, NULL }, +}; + +static const value_string evt_input_sample_size_values[] = { + {0x0, "8 bit (only for Linear PCM)" }, + {0x1, "16 bit (only for Linear PCM)" }, + { 0, NULL }, +}; + +static const value_string evt_loopback_modes[] = { + {0x00, "No Loopback mode enabled" }, + {0x01, "Enable Local Loopback" }, + {0x02, "Enable Remote Loopback" }, + { 0, NULL }, +}; + +static const value_string evt_country_code_values[] = { + {0x0, "North America & Europe (except France) and Japan" }, + {0x1, "France" }, + { 0, NULL }, +}; + +/* Code to actually dissect the packets */ +static void +dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_item *ti; + proto_item *ti_opcode; + proto_item *ti_lmp_features; + proto_item *ti_lmp_subtree; + proto_item *handle_tree; + proto_item *ti_ptype_subtree; + proto_tree *handle_tree_sub; + proto_tree *bthci_evt_tree; + proto_tree *opcode_tree; + guint8 param_length, evt_code, evt_num_handles, evt_num_keys, evt_num_responses, num, num8; + guint16 com_opcode; + guint32 clock; + int flag_DM1, flag_DM3, flag_DM5, flag_DH1, flag_DH3, flag_DH5, flag_HV1, flag_HV2, flag_HV3, i; + tvbuff_t *next_tvb; + proto_item *item; + guint16 timeout; + + ti = proto_tree_add_item(tree, proto_bthci_evt, tvb, 0, -1, FALSE); + + bthci_evt_tree = proto_item_add_subtree(ti, ett_bthci_evt); + + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_code, tvb, 0, 1, TRUE); + evt_code = tvb_get_guint8(tvb, 0); + + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_param_length, tvb, 1, 1, TRUE); + param_length = tvb_get_guint8(tvb, 1); + + if ((check_col(pinfo->cinfo, COL_INFO))) + col_add_fstr(pinfo->cinfo, COL_INFO, "Event: %s", val_to_str(evt_code, evt_code_vals, NULL)); + + proto_item_append_text(ti," - %s", val_to_str(evt_code, evt_code_vals, NULL)); + + if (param_length > 0) { + switch(evt_code) { + + case 0x01: /* Inquiry Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + break; + + case 0x02: /* Inquiry result event */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_num_responses, tvb, 2, 1, TRUE); + evt_num_responses = tvb_get_guint8(tvb, 2); + + for (num = 0; num < evt_num_responses; num++) { + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_bd_addr, tvb, 3+(num*15), 6, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_page_scan_repetition_mode, tvb, 9+(num*15), 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_page_scan_period_mode, tvb, 10+(num*15), 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_page_scan_mode, tvb, 11+(num*15), 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_class_of_device, tvb, 12+(num*15), 3, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_clock_offset, tvb, 15+(num*15), 2, TRUE); + } + + break; + + case 0x03: /* Connection Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_bd_addr, tvb, 5, 6, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_link_type, tvb, 11, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_encryption_mode, tvb, 12, 1, TRUE); + break; + + case 0x04: /* Connection Request */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_bd_addr, tvb, 2, 6, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_class_of_device, tvb,8,3, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_link_type, tvb, 11, 1, TRUE); + break; + + case 0x05: /* Disconnection Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_reason, tvb, 5, 1, TRUE); + break; + + case 0x06: /* Authentication Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + break; + + case 0x07: /* Remote Name Request Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_bd_addr, tvb, 3, 6, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_remote_name, tvb, 9, 248, FALSE); + break; + + case 0x08: /* Encryption Change */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_encryption_enable, tvb, 5, 1, TRUE); + break; + + case 0x09: /* Change Connection Link Key Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + break; + + case 0x0a: /* Master Link Key Complete */ + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_status, tvb, 2, 1, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_connection_handle, tvb, 3, 2, TRUE); + proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_key_flag, tvb, 5, 1, TRUE); + break; + + case 0x0b: /* Read Remote Support Features Complete */ + proto_tree_add_