2 * Routines for the Bluetooth SCO dissection
3 * Copyright 2002, Christoph Scholz <scholz@cs.uni-bonn.de>
5 * Refactored for wireshark checkin
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include <epan/packet.h>
33 #include "packet-bluetooth-hci.h"
35 /* Initialize the protocol and registered fields */
36 static int proto_bthci_sco
= -1;
37 static int hf_bthci_sco_chandle
= -1;
38 static int hf_bthci_sco_length
= -1;
39 static int hf_bthci_sco_data
= -1;
41 /* Initialize the subtree pointers */
42 static gint ett_bthci_sco
= -1;
44 void proto_register_bthci_sco(void);
45 void proto_reg_handoff_bthci_sco(void);
47 /* Code to actually dissect the packets */
49 dissect_bthci_sco(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void *data _U_
)
52 proto_tree
*bthci_sco_tree
;
55 ti
= proto_tree_add_item(tree
, proto_bthci_sco
, tvb
, offset
, -1, ENC_NA
);
56 bthci_sco_tree
= proto_item_add_subtree(ti
, ett_bthci_sco
);
58 switch (pinfo
->p2p_dir
) {
60 col_set_str(pinfo
->cinfo
, COL_INFO
, "Sent ");
63 col_set_str(pinfo
->cinfo
, COL_INFO
, "Rcvd ");
66 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "Unknown direction %d ",
71 proto_tree_add_item(bthci_sco_tree
, hf_bthci_sco_chandle
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
74 proto_tree_add_item(bthci_sco_tree
, hf_bthci_sco_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
77 proto_tree_add_item(bthci_sco_tree
, hf_bthci_sco_data
, tvb
, offset
, -1, ENC_NA
);
79 return tvb_length(tvb
);
84 proto_register_bthci_sco(void)
86 static hf_register_info hf
[] = {
87 { &hf_bthci_sco_chandle
,
88 { "Connection Handle", "bthci_sco.chandle",
89 FT_UINT16
, BASE_HEX
, NULL
, 0x0FFF,
92 { &hf_bthci_sco_length
,
93 { "Data Total Length", "bthci_sco.length",
94 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
98 { "Data", "bthci_sco.data",
99 FT_NONE
, BASE_NONE
, NULL
, 0x0,
104 /* Setup protocol subtree array */
105 static gint
*ett
[] = {
109 /* Register the protocol name and description */
110 proto_bthci_sco
= proto_register_protocol("Bluetooth HCI SCO Packet", "HCI_SCO", "bthci_sco");
111 new_register_dissector("bthci_sco", dissect_bthci_sco
, proto_bthci_sco
);
113 /* Required function calls to register the header fields and subtrees used */
114 proto_register_field_array(proto_bthci_sco
, hf
, array_length(hf
));
115 proto_register_subtree_array(ett
, array_length(ett
));
120 proto_reg_handoff_bthci_sco(void)
122 dissector_handle_t bthci_sco_handle
;
124 bthci_sco_handle
= find_dissector("bthci_sco");
125 dissector_add_uint("hci_h4.type", HCI_H4_TYPE_SCO
, bthci_sco_handle
);
126 dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_SCO
, bthci_sco_handle
);
130 * Editor modelines - http://www.wireshark.org/tools/modelines.html
135 * indent-tabs-mode: nil
138 * vi: set shiftwidth=4 tabstop=8 expandtab:
139 * :indentSize=4:tabSize=8:noTabs=true: