2 * Routines for the Bluetooth L2CAP dissection
3 * Copyright 2002, Christoph Scholz <scholz@cs.uni-bonn.de>
4 * From: http://affix.sourceforge.net/archive/ethereal_affix-3.patch
6 * Refactored for wireshark checkin
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
38 #include <epan/emem.h>
39 #include "packet-bthci_acl.h"
40 #include "packet-btl2cap.h"
42 /* Initialize the protocol and registered fields */
43 static int proto_btl2cap = -1;
44 static int hf_btl2cap_length = -1;
45 static int hf_btl2cap_cid = -1;
46 static int hf_btl2cap_payload = -1;
47 static int hf_btl2cap_command = -1;
48 static int hf_btl2cap_cmd_code = -1;
49 static int hf_btl2cap_cmd_ident = -1;
50 static int hf_btl2cap_cmd_length = -1;
51 static int hf_btl2cap_cmd_data = -1;
52 static int hf_btl2cap_psm = -1;
53 static int hf_btl2cap_scid = -1;
54 static int hf_btl2cap_dcid = -1;
55 static int hf_btl2cap_result = -1;
56 static int hf_btl2cap_status = -1;
57 static int hf_btl2cap_rej_reason = -1;
58 static int hf_btl2cap_sig_mtu = -1;
59 static int hf_btl2cap_info_mtu = -1;
60 static int hf_btl2cap_info_flowcontrol = -1;
61 static int hf_btl2cap_info_retransmission = -1;
62 static int hf_btl2cap_info_bidirqos = -1;
63 static int hf_btl2cap_info_type = -1;
64 static int hf_btl2cap_info_result = -1;
65 static int hf_btl2cap_continuation_flag = -1;
66 static int hf_btl2cap_configuration_result = -1;
67 static int hf_btl2cap_info_extfeatures = -1;
68 static int hf_btl2cap_option = -1;
69 static int hf_btl2cap_option_type = -1;
70 static int hf_btl2cap_option_length = -1;
71 static int hf_btl2cap_option_mtu = -1;
72 static int hf_btl2cap_option_flushTO = -1;
73 static int hf_btl2cap_option_flags = -1;
74 static int hf_btl2cap_option_service_type = -1;
75 static int hf_btl2cap_option_tokenrate = -1;
76 static int hf_btl2cap_option_tokenbucketsize = -1;
77 static int hf_btl2cap_option_peakbandwidth = -1;
78 static int hf_btl2cap_option_latency = -1;
79 static int hf_btl2cap_option_delayvariation = -1;
80 static int hf_btl2cap_option_retransmissionmode = -1;
81 static int hf_btl2cap_option_txwindow = -1;
82 static int hf_btl2cap_option_maxtransmit = -1;
83 static int hf_btl2cap_option_retransmittimeout = -1;
84 static int hf_btl2cap_option_monitortimeout = -1;
85 static int hf_btl2cap_option_mps = -1;
86 static int hf_btl2cap_control = -1;
87 static int hf_btl2cap_control_sar = -1;
88 static int hf_btl2cap_control_reqseq = -1;
89 static int hf_btl2cap_control_txseq = -1;
90 static int hf_btl2cap_control_retransmissiondisable = -1;
91 static int hf_btl2cap_control_supervisory = -1;
92 static int hf_btl2cap_control_type = -1;
93 static int hf_btl2cap_fcs = -1;
94 static int hf_btl2cap_sdulength = -1;
95 static int hf_btl2cap_continuation_to = -1;
96 static int hf_btl2cap_reassembled_in = -1;
98 /* Initialize the subtree pointers */
99 static gint ett_btl2cap = -1;
100 static gint ett_btl2cap_cmd = -1;
101 static gint ett_btl2cap_option = -1;
102 static gint ett_btl2cap_extfeatures = -1;
103 static gint ett_btl2cap_control = -1;
106 /* Initialize dissector table */
107 dissector_table_t l2cap_psm_dissector_table;
109 /* This table maps cid values to psm values.
110 * The same table is used both for SCID and DCID.
111 * For received CIDs we mask the cid with 0x8000 in this table
113 static emem_tree_t *cid_to_psm_table = NULL;
114 typedef struct _config_data_t {
117 emem_tree_t *start_fragments; /* indexed by pinfo->fd->num */
119 typedef struct _psm_data_t {
125 static const value_string command_code_vals[] = {
126 { 0x01, "Command Reject" },
127 { 0x02, "Connection Request" },
128 { 0x03, "Connection Response" },
129 { 0x04, "Configure Request" },
130 { 0x05, "Configure Response" },
131 { 0x06, "Disconnect Request" },
132 { 0x07, "Disconnect Response" },
133 { 0x08, "Echo Request" },
134 { 0x09, "Echo Response" },
135 { 0x0A, "Information Request" },
136 { 0x0B, "Information Response" },
141 static const value_string psm_vals[] = {
143 { 0x0003, "RFCOMM" },
144 { 0x0005, "TCS-BIN" },
145 { 0x0007, "TCS-BIN-CORDLESS" },
147 { 0x0011, "HID_CONTROL" },
148 { 0x0013, "HID_INTERRUPT" },
152 { 0x001D, "UDI_C-Plane" },
157 static const value_string result_vals[] = {
158 { 0x0000, "Connection successful" },
159 { 0x0001, "Connection pending" },
160 { 0x0002, "Connection Refused - PSM not supported" },
161 { 0x0003, "Connection refused - security block" },
162 { 0x0004, "Connection refused - no resources available" },
166 static const value_string configuration_result_vals[] = {
167 { 0x0000, "Success"},
168 { 0x0001, "Failure - unacceptable parameters" },
169 { 0x0002, "Failure - reject (no reason provided)" },
170 { 0x0003, "Failure - unknown options" },
174 static const value_string status_vals[] = {
175 { 0x0000, "No further information available" },
176 { 0x0001, "Authentication pending" },
177 { 0x0002, "Authorization pending" },
181 static const value_string reason_vals[] = {
182 { 0x0000, "Command not understood" },
183 { 0x0001, "Signaling MTU exceeded" },
184 { 0x0002, "Invalid CID in request" },
188 static const value_string info_type_vals[] = {
189 { 0x0001, "Connectionless MTU" },
190 { 0x0002, "Extended Features Mask" },
194 static const value_string info_result_vals[] = {
195 { 0x0000, "Success" },
196 { 0x0001, "Not Supported" },
200 static const value_string option_servicetype_vals[] = {
201 { 0x00, "No traffic" },
202 { 0x01, "Best effort (Default)" },
203 { 0x02, "Guaranteed" },
207 static const value_string option_type_vals[] = {
208 { 0x01, "Maximum Transmission Unit" },
209 { 0x02, "Flush Timeout" },
210 { 0x03, "Quality of Service" },
211 { 0x04, "Retransmission and Flow Control" },
215 static const value_string option_retransmissionmode_vals[] = {
216 { 0x00, "Basic Mode" },
217 { 0x01, "Retransmission Mode" },
218 { 0x02, "Flow Control Mode" },
222 static const value_string control_sar_vals[] = {
223 { 0x00, "Unsegmented" },
226 { 0x03, "Continuation" },
230 static const value_string control_supervisory_vals[] = {
236 static const value_string control_type_vals[] = {
243 dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
247 reason = tvb_get_letohs(tvb, offset);
248 proto_tree_add_item(tree, hf_btl2cap_rej_reason, tvb, offset, 2, TRUE);
252 case 0x0000: /* Command not understood */
255 case 0x0001: /* Signaling MTU exceeded */
256 proto_tree_add_item(tree, hf_btl2cap_sig_mtu, tvb, offset, 2, TRUE);
260 case 0x0002: /* Invalid CID in requets */
261 proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
264 proto_tree_add_item(tree, hf_btl2cap_dcid, tvb, offset, 2, TRUE);
277 dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
280 psm_data_t *psm_data;
282 psm=tvb_get_letohs(tvb, offset);
283 proto_tree_add_item(tree, hf_btl2cap_psm, tvb, offset, 2, TRUE);
286 scid=tvb_get_letohs(tvb, offset);
287 proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
290 if (pinfo->fd->flags.visited == 0) {
291 psm_data=se_alloc(sizeof(psm_data_t));
294 psm_data->in.txwindow=0;
295 psm_data->in.start_fragments=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "bthci_l2cap fragment starts");
296 psm_data->out.mode=0;
297 psm_data->out.txwindow=0;
298 psm_data->out.start_fragments=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "bthci_l2cap fragment starts");
299 se_tree_insert32(cid_to_psm_table, scid|((pinfo->p2p_dir == P2P_DIR_RECV)?0x8000:0x0000), psm_data);
307 dissect_options(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int length, config_data_t *config_data)
309 proto_item *ti_option=NULL;
310 proto_tree *ti_option_subtree=NULL;
311 guint8 option_type, option_length;
314 option_type = tvb_get_guint8(tvb, offset);
315 option_length = tvb_get_guint8(tvb, offset+1);
317 ti_option = proto_tree_add_none_format(tree,
318 hf_btl2cap_option, tvb,
319 offset, option_length + 2,
321 ti_option_subtree = proto_item_add_subtree(ti_option, ett_btl2cap_option);
322 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_type, tvb, offset, 1, TRUE);
323 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_length, tvb, offset+1, 1, TRUE);
329 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_mtu, tvb, offset, 2, TRUE);
332 proto_item_append_text(ti_option, "MTU");
335 case 0x02: /* Flush timeout */
336 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_flushTO, tvb, offset, 2, TRUE);
339 proto_item_append_text(ti_option, "Flush Timeout");
343 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_flags, tvb, offset, 1, TRUE);
346 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_service_type, tvb, offset, 1, TRUE);
349 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_tokenrate, tvb, offset, 4, TRUE);
352 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_tokenbucketsize, tvb, offset, 4, TRUE);
355 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_peakbandwidth, tvb, offset, 4, TRUE);
358 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_latency, tvb, offset, 4, TRUE);
361 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_delayvariation, tvb, offset, 4, TRUE);
364 proto_item_append_text(ti_option, "QOS");
367 case 0x04: /* Retransmission and Flow Control*/
370 config_data->mode = tvb_get_guint8(tvb, offset);
371 config_data->txwindow = tvb_get_guint8(tvb, offset+1);
373 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_retransmissionmode, tvb, offset, 1, TRUE);
376 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_txwindow, tvb, offset, 1, TRUE);
379 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_maxtransmit, tvb, offset, 1, TRUE);
382 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_retransmittimeout, tvb, offset, 2, TRUE);
385 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_monitortimeout, tvb, offset, 2, TRUE);
388 proto_tree_add_item(ti_option_subtree, hf_btl2cap_option_mps, tvb, offset, 2, TRUE);
391 proto_item_append_text(ti_option, "Retransmission and Flow Control");
395 proto_item_append_text(ti_option, "unknown");
396 offset+=option_length;
400 length -= (option_length + 2);
408 dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint16 length)
410 psm_data_t *psm_data;
411 config_data_t *config_data;
414 dcid = tvb_get_letohs(tvb, offset);
415 psm_data=se_tree_lookup32(cid_to_psm_table, dcid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000));
416 proto_tree_add_item(tree, hf_btl2cap_dcid, tvb, offset, 2, TRUE);
419 proto_tree_add_item(tree, hf_btl2cap_continuation_flag, tvb, offset, 2, TRUE);
422 if(tvb_length_remaining(tvb, offset)){
424 if(pinfo->p2p_dir==P2P_DIR_RECV)
425 config_data = &(psm_data->out);
427 config_data = &(psm_data->in);
430 offset=dissect_options(tvb, offset, pinfo, tree, length - 4, config_data);
438 dissect_inforequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
440 proto_tree_add_item(tree, hf_btl2cap_info_type, tvb, offset, 2, TRUE);
447 dissect_inforesponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
450 proto_item *ti_features=NULL;
451 proto_tree *ti_features_subtree=NULL;
454 info_type=tvb_get_letohs(tvb, offset);
455 proto_tree_add_item(tree, hf_btl2cap_info_type, tvb, offset, 2, TRUE);
458 proto_tree_add_item(tree, hf_btl2cap_info_result, tvb, offset, 2, TRUE);
461 if(tvb_length_remaining(tvb, offset)) {
463 case 0x0001: /* Connectionless MTU */
464 proto_tree_add_item(tree, hf_btl2cap_info_mtu, tvb, offset, 2, TRUE);
468 case 0x0002: /* Extended Features */
469 ti_features = proto_tree_add_none_format(tree,
470 hf_btl2cap_info_extfeatures, tvb,
473 ti_features_subtree = proto_item_add_subtree(ti_features, ett_btl2cap_extfeatures);
474 features = tvb_get_letohl(tvb, offset);
476 proto_item_append_text(ti_features, "FlowControl ");
478 proto_item_append_text(ti_features, "Retransmission ");
480 proto_item_append_text(ti_features, "BiDirQOS ");
481 proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_flowcontrol, tvb, offset, 1, TRUE);
482 proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_retransmission, tvb, offset, 1, TRUE);
483 proto_tree_add_item(ti_features_subtree, hf_btl2cap_info_bidirqos, tvb, offset, 1, TRUE);
488 proto_tree_add_item(tree, hf_btl2cap_cmd_data, tvb, offset, -1, TRUE);
489 offset+=tvb_length_remaining(tvb, offset);
499 dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint16 length)
501 psm_data_t *psm_data;
502 config_data_t *config_data;
505 scid = tvb_get_letohs(tvb, offset);
506 psm_data=se_tree_lookup32(cid_to_psm_table, scid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000));
507 proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
510 proto_tree_add_item(tree, hf_btl2cap_continuation_flag, tvb, offset, 2, TRUE);
513 proto_tree_add_item(tree, hf_btl2cap_configuration_result, tvb, offset, 2, TRUE);
516 if(tvb_length_remaining(tvb, offset)){
518 if(pinfo->p2p_dir==P2P_DIR_RECV)
519 config_data = &(psm_data->out);
521 config_data = &(psm_data->in);
524 offset=dissect_options(tvb, offset, pinfo, tree, length - 6, config_data);
531 dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
534 psm_data_t *psm_data;
536 dcid = tvb_get_letohs(tvb, offset);
537 proto_tree_add_item(tree, hf_btl2cap_dcid, tvb, offset, 2, TRUE);
540 scid = tvb_get_letohs(tvb, offset);
541 proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
544 proto_tree_add_item(tree, hf_btl2cap_result, tvb, offset, 2, TRUE);
547 proto_tree_add_item(tree, hf_btl2cap_status, tvb, offset, 2, TRUE);
550 if (pinfo->fd->flags.visited == 0) {
551 if((psm_data=se_tree_lookup32(cid_to_psm_table, scid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000)))){
552 se_tree_insert32(cid_to_psm_table, dcid|((pinfo->p2p_dir == P2P_DIR_RECV)?0x8000:0x0000), psm_data);
561 dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
565 dcid = tvb_get_letohs(tvb, offset);
566 proto_tree_add_item(tree, hf_btl2cap_dcid, tvb, offset, 2, TRUE);
569 scid = tvb_get_letohs(tvb, offset);
570 proto_tree_add_item(tree, hf_btl2cap_scid, tvb, offset, 2, TRUE);
576 static void dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *btl2cap_tree, guint16 psm, guint16 length, int offset)
579 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
581 if(check_col(pinfo->cinfo, COL_INFO)){
582 col_append_str(pinfo->cinfo, COL_INFO, "Connection oriented channel");
586 proto_item *psm_item;
588 psm_item=proto_tree_add_uint(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 0, psm);
589 PROTO_ITEM_SET_GENERATED(psm_item);
591 /* call next dissector */
592 if (!dissector_try_port(l2cap_psm_dissector_table, (guint32) psm,
593 next_tvb, pinfo, tree)) {
594 /* unknown protocol. declare as data */
595 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
597 offset+=tvb_length_remaining(tvb, offset);
599 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
600 offset+=tvb_length_remaining(tvb, offset);
604 typedef struct _sdu_reassembly_t
611 int cur_off; /* counter used by reassembly */
614 static void dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *btl2cap_tree, psm_data_t *psm_data, guint16 length, int offset, config_data_t *config_data)
616 tvbuff_t *next_tvb = NULL;
617 guint16 control, segment;
619 proto_item* ti_control;
620 proto_tree* ti_control_subtree;
621 sdu_reassembly_t* mfp = NULL;
622 guint16 psm = (psm_data?psm_data->psm:0);
624 control = tvb_get_letohs(tvb, offset);
625 segment = (control & 0xC000) >> 14;
626 if(check_col(pinfo->cinfo, COL_INFO)){
630 col_append_str(pinfo->cinfo, COL_INFO, "[I] Unsegmented SDU");
633 col_append_str(pinfo->cinfo, COL_INFO, "[I] Start SDU");
636 col_append_str(pinfo->cinfo, COL_INFO, "[I] End SDU");
639 col_append_str(pinfo->cinfo, COL_INFO, "[I] Continuation SDU");
643 ti_control = proto_tree_add_none_format(btl2cap_tree, hf_btl2cap_control, tvb,
644 offset, 2, "Control: %s reqseq:%d r:%d txseq:%d",
645 val_to_str((control & 0xC000) >> 14, control_sar_vals, "unknown"),
646 (control & 0x3F00) >> 8,
647 (control & 0x0080) >> 7,
648 (control & 0x007E) >> 1);
649 ti_control_subtree = proto_item_add_subtree(ti_control, ett_btl2cap_control);
650 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_sar, tvb, offset, 2, TRUE);
651 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_reqseq, tvb, offset, 2, TRUE);
652 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_retransmissiondisable, tvb, offset, 2, TRUE);
653 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_txseq, tvb, offset, 2, TRUE);
654 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_type, tvb, offset, 2, TRUE);
657 /*Segmented frames with SAR = start have an extra SDU length header field*/
658 if(segment == 0x01) {
659 sdulen = tvb_get_letohs(tvb, offset);
660 proto_tree_add_item(btl2cap_tree, hf_btl2cap_sdulength, tvb, offset, 2, TRUE);
662 length -= 6; /*Control, SDUlength, FCS*/
663 if(!pinfo->fd->flags.visited){
664 mfp=se_alloc(sizeof(sdu_reassembly_t));
665 mfp->first_frame=pinfo->fd->num;
668 mfp->reassembled=se_alloc(sdulen);
669 tvb_memcpy(tvb, mfp->reassembled, offset, length);
671 se_tree_insert32(config_data->start_fragments, pinfo->fd->num, mfp);
673 mfp=se_tree_lookup32(config_data->start_fragments, pinfo->fd->num);
675 if(mfp && mfp->last_frame){
677 item=proto_tree_add_uint(btl2cap_tree, hf_btl2cap_reassembled_in, tvb, 0, 0, mfp->last_frame);
678 PROTO_ITEM_SET_GENERATED(item);
679 if (check_col(pinfo->cinfo, COL_INFO)){
680 col_append_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ", mfp->last_frame);
684 length -= 4; /*Control, FCS*/
686 if(segment == 0x02 || segment == 0x03) {
687 mfp=se_tree_lookup32_le(config_data->start_fragments, pinfo->fd->num);
688 if(!pinfo->fd->flags.visited){
689 if(mfp && !mfp->last_frame && (mfp->tot_len>=mfp->cur_off+length)){
690 tvb_memcpy(tvb, mfp->reassembled+mfp->cur_off, offset, length);
691 mfp->cur_off+=length;
693 mfp->last_frame=pinfo->fd->num;
699 item=proto_tree_add_uint(btl2cap_tree, hf_btl2cap_continuation_to, tvb, 0, 0, mfp->first_frame);
700 PROTO_ITEM_SET_GENERATED(item);
701 if (check_col(pinfo->cinfo, COL_INFO)){
702 col_append_fstr(pinfo->cinfo, COL_INFO, "[Continuation to #%u] ", mfp->first_frame);
706 if(segment == 0x02 && mfp && mfp->last_frame==pinfo->fd->num){
707 next_tvb = tvb_new_real_data((guint8*)mfp->reassembled, mfp->tot_len, mfp->tot_len);
708 tvb_set_child_real_data_tvbuff(tvb, next_tvb);
709 add_new_data_source(pinfo, next_tvb, "Reassembled L2CAP");
711 /*pass up to higher layer if we have a complete packet*/
712 if(segment == 0x00) {
713 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset) - 2, length);
717 proto_item *psm_item;
719 psm_item=proto_tree_add_uint(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 0, psm);
720 PROTO_ITEM_SET_GENERATED(psm_item);
722 /* call next dissector */
723 if (!dissector_try_port(l2cap_psm_dissector_table, (guint32) psm,
724 next_tvb, pinfo, tree)) {
725 /* unknown protocol. declare as data */
726 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), TRUE);
729 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), TRUE);
732 offset+=(tvb_length_remaining(tvb, offset) - 2);
733 proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, offset, 2, TRUE);
737 static void dissect_s_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_tree *btl2cap_tree, guint16 psm _U_, guint16 length _U_, int offset, config_data_t *config_data _U_)
739 proto_item* ti_control;
740 proto_tree* ti_control_subtree;
743 control = tvb_get_letohs(tvb, offset);
744 if(check_col(pinfo->cinfo, COL_INFO)){
745 switch((control & 0x000C) >> 2)
748 col_append_str(pinfo->cinfo, COL_INFO, "[S] Receiver Ready");
751 col_append_str(pinfo->cinfo, COL_INFO, "[S] Reject");
754 col_append_str(pinfo->cinfo, COL_INFO, "[S] Unknown supervisory frame");
758 ti_control = proto_tree_add_none_format(btl2cap_tree, hf_btl2cap_control, tvb,
759 offset, 2, "Control: %s reqseq:%d r:%d",
760 val_to_str((control & 0x000C) >> 2, control_supervisory_vals, "unknown"),
761 (control & 0x3F00) >> 8,
762 (control & 0x0080) >> 7);
763 ti_control_subtree = proto_item_add_subtree(ti_control, ett_btl2cap_control);
764 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_reqseq, tvb, offset, 2, TRUE);
765 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_retransmissiondisable, tvb, offset, 2, TRUE);
766 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_supervisory, tvb, offset, 2, TRUE);
767 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_type, tvb, offset, 2, TRUE);
769 proto_tree_add_item(ti_control_subtree, hf_btl2cap_fcs, tvb, offset, 2, TRUE);
773 /* Code to actually dissect the packets
774 * This dissector will only be called ontop of BTHCI ACL
775 * and this dissector _REQUIRES_ that
776 * pinfo->private_data points to a valid bthci_acl_data_t structure
778 static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
782 proto_tree *btl2cap_tree=NULL;
787 psm_data_t *psm_data;
788 bthci_acl_data_t *acl_data;
789 btl2cap_data_t *l2cap_data;
790 config_data_t *config_data;
792 if(check_col(pinfo->cinfo, COL_PROTOCOL)){
793 col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2CAP");
795 if(check_col(pinfo->cinfo, COL_INFO)){
796 col_clear(pinfo->cinfo, COL_INFO);
797 col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
801 ti=proto_tree_add_item(tree, proto_btl2cap, tvb, offset, -1, FALSE);
802 btl2cap_tree=proto_item_add_subtree(ti, ett_btl2cap);
805 length = tvb_get_letohs(tvb, offset);
806 proto_tree_add_item(btl2cap_tree, hf_btl2cap_length, tvb, offset, 2, TRUE);
809 cid = tvb_get_letohs(tvb, offset);
810 proto_tree_add_item(btl2cap_tree, hf_btl2cap_cid, tvb, offset, 2, TRUE);
813 acl_data=(bthci_acl_data_t *)pinfo->private_data;
814 l2cap_data=ep_alloc(sizeof(btl2cap_data_t));
815 l2cap_data->chandle=acl_data->chandle;
817 pinfo->private_data=l2cap_data;
819 if(cid==0x0001){ /* This is a command packet*/
820 while(offset<(length+4)) {
821 proto_tree *btl2cap_cmd_tree=NULL;
822 proto_item *ti_command=NULL;
826 ti_command=proto_tree_add_none_format(btl2cap_tree,
827 hf_btl2cap_command, tvb,
830 btl2cap_cmd_tree=proto_item_add_subtree(ti_command, ett_btl2cap_cmd);
832 cmd_code=tvb_get_guint8(tvb, offset);
833 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_code, tvb, offset, 1, TRUE);
836 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_ident, tvb, offset, 1, TRUE);
839 cmd_length=tvb_get_letohs(tvb, offset);
840 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_length, tvb, offset, 2, TRUE);
841 proto_item_set_len(ti_command, cmd_length+4);
845 case 0x01: /* Command Reject */
846 offset=dissect_comrej(tvb, offset, pinfo, btl2cap_cmd_tree);
847 proto_item_append_text(ti_command, "Command Reject");
848 if ((check_col(pinfo->cinfo, COL_INFO))){
849 col_append_str(pinfo->cinfo, COL_INFO, "Command Reject");
853 case 0x02: /* Connection Request */
854 offset=dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree);
855 proto_item_append_text(ti_command, "Connection Request");
856 if ((check_col(pinfo->cinfo, COL_INFO))){
857 col_append_str(pinfo->cinfo, COL_INFO, "Connection Request");
861 case 0x03: /* Connection Response */
862 offset=dissect_connresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
863 proto_item_append_text(ti_command, "Connection Response");
864 if ((check_col(pinfo->cinfo, COL_INFO))){
865 col_append_str(pinfo->cinfo, COL_INFO, "Connection Response");
868 case 0x04: /* Configure Request */
869 offset=dissect_configrequest(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
870 proto_item_append_text(ti_command, "Configure Request");
871 if ((check_col(pinfo->cinfo, COL_INFO))){
872 col_append_str(pinfo->cinfo, COL_INFO, "Configure Request");
876 case 0x05: /* Configure Response */
877 offset=dissect_configresponse(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
878 proto_item_append_text(ti_command, "Configure Response");
879 if ((check_col(pinfo->cinfo, COL_INFO))){
880 col_append_str(pinfo->cinfo, COL_INFO, "Configure Response");
884 case 0x06: /* Disconnect Request */
885 offset=dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
886 proto_item_append_text(ti_command, "Disconnect Request");
887 if ((check_col(pinfo->cinfo, COL_INFO))){
888 col_append_str(pinfo->cinfo, COL_INFO, "Disconnect Request");
892 case 0x07: /* Disconnect Response */
893 offset=dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
894 proto_item_append_text(ti_command, "Disconnect Response");
895 if ((check_col(pinfo->cinfo, COL_INFO))){
896 col_append_str(pinfo->cinfo, COL_INFO, "Disconnect Response");
900 case 0x08: /* Echo Request */
901 proto_item_append_text(ti_command, "Echo Request");
902 offset+=tvb_length_remaining(tvb, offset);
903 if ((check_col(pinfo->cinfo, COL_INFO))){
904 col_append_str(pinfo->cinfo, COL_INFO, "Echo Request");
908 case 0x09: /* Echo Response */
909 proto_item_append_text(ti_command, "Echo Response");
910 offset+=tvb_length_remaining(tvb, offset);
911 if ((check_col(pinfo->cinfo, COL_INFO))){
912 col_append_str(pinfo->cinfo, COL_INFO, "Echo Response");
916 case 0x0a: /* Information Request */
917 offset=dissect_inforequest(tvb, offset, pinfo, btl2cap_cmd_tree);
919 proto_item_append_text(ti_command, "Information Request");
920 if ((check_col(pinfo->cinfo, COL_INFO))){
921 col_append_str(pinfo->cinfo, COL_INFO, "Information Request");
925 case 0x0b: /* Information Response */
926 offset=dissect_inforesponse(tvb, offset, pinfo, btl2cap_cmd_tree);
927 proto_item_append_text(ti_command, "Information Response");
928 if ((check_col(pinfo->cinfo, COL_INFO))){
929 col_append_str(pinfo->cinfo, COL_INFO, "Information Response");
934 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_data, tvb, offset, -1, TRUE);
935 offset+=tvb_length_remaining(tvb, offset);
939 } else if (cid == 0x0002) { /* Connectionless reception channel */
940 if(check_col(pinfo->cinfo, COL_INFO)){
941 col_append_str(pinfo->cinfo, COL_INFO, "Connectionless reception channel");
944 psm = tvb_get_letohs(tvb, offset);
945 proto_tree_add_item(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 2, TRUE);
949 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
951 /* call next dissector */
952 if(!dissector_try_port(l2cap_psm_dissector_table, (guint32) psm,
953 next_tvb, pinfo, tree)){
954 /* unknown protocol. declare as data */
955 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
957 offset+=tvb_length_remaining(tvb, offset);
958 } else if(cid >= 0x0040) { /* Connection oriented channel */
959 if((psm_data=se_tree_lookup32(cid_to_psm_table, cid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000)))){
961 if(pinfo->p2p_dir==P2P_DIR_RECV)
962 config_data = &(psm_data->in);
964 config_data = &(psm_data->out);
965 if(config_data->mode == 0) {
966 dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset);
968 control = tvb_get_letohs(tvb, offset);
970 dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset, config_data);
972 dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data);
977 dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset);
980 } else { /* Something else */
981 if(check_col(pinfo->cinfo, COL_INFO)){
982 col_clear(pinfo->cinfo, COL_INFO);
985 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
991 /* Register the protocol with Wireshark */
993 proto_register_btl2cap(void)
996 /* Setup list of header fields See Section 1.6.1 for details*/
997 static hf_register_info hf[] = {
998 { &hf_btl2cap_length,
999 { "Length", "btl2cap.length",
1000 FT_UINT16, BASE_DEC, NULL, 0x0,
1001 "L2CAP Payload Length", HFILL }
1004 { "CID", "btl2cap.cid",
1005 FT_UINT16, BASE_HEX, NULL, 0x0,
1006 "L2CAP Channel Identifier", HFILL }
1008 { &hf_btl2cap_payload,
1009 { "Payload", "btl2cap.payload",
1010 FT_BYTES, BASE_HEX, NULL, 0x0,
1011 "L2CAP Payload", HFILL }
1013 { &hf_btl2cap_command,
1014 { "Command", "btl2cap.command",
1015 FT_NONE, BASE_NONE, NULL, 0x0,
1016 "L2CAP Command", HFILL }
1018 { &hf_btl2cap_cmd_code,
1019 { "Command Code", "btl2cap.cmd_code",
1020 FT_UINT8, BASE_HEX, VALS(command_code_vals), 0x0,
1021 "L2CAP Command Code", HFILL }
1023 { &hf_btl2cap_cmd_ident,
1024 { "Command Identifier", "btl2cap.cmd_ident",
1025 FT_UINT8, BASE_HEX, NULL, 0x0,
1026 "L2CAP Command Identifier", HFILL }
1028 { &hf_btl2cap_cmd_length,
1029 { "Command Length", "btl2cap.cmd_length",
1030 FT_UINT8, BASE_DEC, NULL, 0x0,
1031 "L2CAP Command Length", HFILL }
1033 { &hf_btl2cap_cmd_data,
1034 { "Command Data", "btl2cap.cmd_data",
1035 FT_NONE, BASE_NONE, NULL, 0x0,
1036 "L2CAP Command Data", HFILL }
1039 { "PSM", "btl2cap.psm",
1040 FT_UINT16, BASE_HEX, VALS(psm_vals), 0x0,
1041 "Protocol/Service Multiplexer", HFILL }
1044 { "Source CID", "btl2cap.scid",
1045 FT_UINT16, BASE_HEX, NULL, 0x0,
1046 "Source Channel Identifier", HFILL }
1049 { "Destination CID", "btl2cap.dcid",
1050 FT_UINT16, BASE_HEX, NULL, 0x0,
1051 "Destination Channel Identifier", HFILL }
1053 { &hf_btl2cap_result,
1054 { "Result", "btl2cap.result",
1055 FT_UINT16, BASE_HEX, VALS(result_vals), 0x0,
1058 { &hf_btl2cap_status,
1059 { "Status", "btl2cap.status",
1060 FT_UINT16, BASE_HEX, VALS(status_vals), 0x0,
1063 { &hf_btl2cap_rej_reason,
1064 { "Reason", "btl2cap.rej_reason",
1065 FT_UINT16, BASE_HEX, VALS(reason_vals), 0x0,
1068 { &hf_btl2cap_sig_mtu,
1069 { "Maximum Signalling MTU", "btl2cap.sig_mtu",
1070 FT_UINT16, BASE_DEC, NULL, 0x0,
1071 "Maximum Signalling MTU", HFILL }
1073 { &hf_btl2cap_info_mtu,
1074 { "Remote Entity MTU", "btl2cap.info_mtu",
1075 FT_UINT16, BASE_DEC, NULL, 0x0,
1076 "Remote entity acceptable connectionless MTU", HFILL }
1078 { &hf_btl2cap_info_flowcontrol,
1079 { "Flow Control Mode", "btl2cap.info_flowcontrol",
1080 FT_UINT8, BASE_DEC, NULL, 0x01,
1081 "Flow Control mode support", HFILL }
1083 { &hf_btl2cap_info_retransmission,
1084 { "Retransmission Mode", "btl2cap.info_retransmission",
1085 FT_UINT8, BASE_DEC, NULL, 0x02,
1086 "Retransmission mode support", HFILL }
1088 { &hf_btl2cap_info_bidirqos,
1089 { "Bi-Directional QOS", "btl2cap.info_bidirqos",
1090 FT_UINT8, BASE_DEC, NULL, 0x04,
1091 "Bi-Directional QOS support", HFILL }
1093 { &hf_btl2cap_info_type,
1094 { "Information Type", "btl2cap.info_type",
1095 FT_UINT16, BASE_HEX, VALS(info_type_vals), 0x0,
1096 "Type of implementation-specific information", HFILL }
1098 { &hf_btl2cap_info_result,
1099 { "Result", "btl2cap.info_result",
1100 FT_UINT16, BASE_HEX, VALS(info_result_vals), 0x0,
1101 "Information about the success of the request", HFILL }
1103 { &hf_btl2cap_info_extfeatures,
1104 { "Extended Features", "btl2cap.info_extfeatures",
1105 FT_NONE, BASE_NONE, NULL, 0x0,
1106 "Extended Features Mask", HFILL }
1108 { &hf_btl2cap_continuation_flag,
1109 { "Continuation Flag", "btl2cap.continuation",
1110 FT_BOOLEAN, BASE_DEC, NULL, 0x0001,
1111 "Continuation Flag", HFILL }
1113 { &hf_btl2cap_configuration_result,
1114 { "Result", "btl2cap.conf_result",
1115 FT_UINT16, BASE_HEX, VALS(configuration_result_vals), 0x0,
1116 "Configuration Result", HFILL }
1118 { &hf_btl2cap_option_type,
1119 { "Type", "btl2cap.option_type",
1120 FT_UINT8, BASE_HEX, VALS(option_type_vals), 0x0,
1121 "Type of option", HFILL }
1123 { &hf_btl2cap_option_length,
1124 { "Length", "btl2cap.option_length",
1125 FT_UINT8, BASE_DEC, NULL, 0x0,
1126 "Number of octets in option payload ", HFILL }
1128 { &hf_btl2cap_option_mtu,
1129 { "MTU", "btl2cap.option_mtu",
1130 FT_UINT16, BASE_DEC, NULL, 0x0,
1131 "Maximum Transmission Unit", HFILL }
1133 { &hf_btl2cap_option_flushTO,
1134 { "Flush Timeout (ms)", "btl2cap.option_flushto",
1135 FT_UINT16, BASE_DEC, NULL, 0x0,
1136 "Flush Timeout in milliseconds", HFILL }
1138 { &hf_btl2cap_option_flags,
1139 { "Flags", "btl2cap.option_flags",
1140 FT_UINT8, BASE_HEX, NULL, 0x0,
1141 "Flags - must be set to 0 (Reserved for future use)", HFILL }
1143 { &hf_btl2cap_option_service_type,
1144 { "Service Type", "btl2cap.option_servicetype",
1145 FT_UINT8, BASE_HEX, VALS(option_servicetype_vals), 0x0,
1146 "Level of service required", HFILL }
1148 { &hf_btl2cap_option_tokenrate,
1149 { "Token Rate (bytes/s)", "btl2cap.option_tokenrate",
1150 FT_UINT32, BASE_DEC, NULL, 0x0,
1151 "Rate at which traffic credits are granted (bytes/s)", HFILL }
1153 { &hf_btl2cap_option_tokenbucketsize,
1154 { "Token Bucket Size (bytes)", "btl2cap.option_tokenbsize",
1155 FT_UINT32, BASE_DEC, NULL, 0x0,
1156 "Size of the token bucket (bytes)", HFILL }
1158 { &hf_btl2cap_option_peakbandwidth,
1159 { "Peak Bandwidth (bytes/s)", "btl2cap.option_peakbandwidth",
1160 FT_UINT32, BASE_DEC, NULL, 0x0,
1161 "Limit how fast packets may be sent (bytes/s)", HFILL }
1163 { &hf_btl2cap_option_latency,
1164 { "Latency (microseconds)", "btl2cap.option_latency",
1165 FT_UINT32, BASE_DEC, NULL, 0x0,
1166 "Maximal acceptable delay (microseconds)", HFILL }
1168 { &hf_btl2cap_option_delayvariation,
1169 { "Delay Variation (microseconds)", "btl2cap.option_delayvar",
1170 FT_UINT32, BASE_DEC, NULL, 0x0,
1171 "Difference between maximum and minimum delay (microseconds)", HFILL }
1173 { &hf_btl2cap_option_retransmissionmode,
1174 { "Mode", "btl2cap.retransmissionmode",
1175 FT_UINT8, BASE_HEX, VALS(option_retransmissionmode_vals), 0x0,
1176 "Retransmission/Flow Control mode", HFILL }
1178 { &hf_btl2cap_option_txwindow,
1179 { "TxWindow", "btl2cap.txwindow",
1180 FT_UINT8, BASE_DEC, NULL, 0x0,
1181 "Retransmission window size", HFILL }
1183 { &hf_btl2cap_option_maxtransmit,
1184 { "MaxTransmit", "btl2cap.maxtransmit",
1185 FT_UINT8, BASE_DEC, NULL, 0x0,
1186 "Maximum I-frame retransmissions", HFILL }
1188 { &hf_btl2cap_option_retransmittimeout,
1189 { "Retransmit timeout (ms)", "btl2cap.retransmittimeout",
1190 FT_UINT16, BASE_DEC, NULL, 0x0,
1191 "Retransmission timeout (milliseconds)", HFILL }
1193 { &hf_btl2cap_option_monitortimeout,
1194 { "Monitor Timeout (ms)", "btl2cap.monitortimeout",
1195 FT_UINT16, BASE_DEC, NULL, 0x0,
1196 "S-frame transmission interval (milliseconds)", HFILL }
1198 { &hf_btl2cap_option_mps,
1199 { "MPS", "btl2cap.mps",
1200 FT_UINT16, BASE_DEC, NULL, 0x0,
1201 "Maximum PDU Payload Size", HFILL }
1203 { &hf_btl2cap_option,
1204 { "Configuration Parameter Option", "btl2cap.conf_param_option",
1205 FT_NONE, BASE_NONE, NULL, 0x0,
1206 "Configuration Parameter Option", HFILL }
1208 { &hf_btl2cap_control_sar,
1209 { "Segmentation and reassembly", "btl2cap.control_sar",
1210 FT_UINT16, BASE_HEX, VALS(control_sar_vals), 0xC000,
1211 "Segmentation and reassembly", HFILL }
1213 { &hf_btl2cap_control_reqseq,
1214 { "ReqSeq", "btl2cap.control_reqseq",
1215 FT_UINT16, BASE_DEC, NULL, 0x3F00,
1216 "Request Sequence Number", HFILL }
1218 { &hf_btl2cap_control_txseq,
1219 { "TxSeq", "btl2cap.control_txseq",
1220 FT_UINT16, BASE_DEC, NULL, 0x007E,
1221 "Transmitted Sequence Number", HFILL }
1223 { &hf_btl2cap_control_retransmissiondisable,
1224 { "R", "btl2cap.control_retransmissiondisable",
1225 FT_UINT16, BASE_HEX, NULL, 0x0080,
1226 "Retransmission Disable", HFILL }
1228 { &hf_btl2cap_control_supervisory,
1229 { "S", "btl2cap.control_supervisory",
1230 FT_UINT16, BASE_HEX, VALS(control_supervisory_vals), 0x000C,
1231 "Supervisory Function", HFILL }
1233 { &hf_btl2cap_control_type,
1234 { "Frame Type", "btl2cap.control_type",
1235 FT_UINT16, BASE_HEX, VALS(control_type_vals), 0x0001,
1236 "Frame Type", HFILL }
1238 { &hf_btl2cap_control,
1239 { "Control field", "btl2cap.control",
1240 FT_NONE, BASE_NONE, NULL, 0x0,
1241 "Control field", HFILL }
1244 { "FCS", "btl2cap.fcs",
1245 FT_UINT16, BASE_HEX, NULL, 0,
1246 "Frame Check Sequence", HFILL }
1248 { &hf_btl2cap_sdulength,
1249 { "SDU Length", "btl2cap.sdulength",
1250 FT_UINT16, BASE_DEC, NULL, 0,
1251 "SDU Length", HFILL }
1253 { &hf_btl2cap_reassembled_in,
1254 { "This SDU is reassembled in frame", "btl2cap.reassembled_in",
1255 FT_FRAMENUM, BASE_NONE, NULL, 0,
1256 "This SDU is reassembled in frame #", HFILL }
1258 { &hf_btl2cap_continuation_to,
1259 { "This is a continuation to the SDU in frame", "btl2cap.continuation_to",
1260 FT_FRAMENUM, BASE_NONE, NULL, 0,
1261 "This is a continuation to the SDU in frame #", HFILL }
1265 /* Setup protocol subtree array */
1266 static gint *ett[] = {
1269 &ett_btl2cap_option,
1270 &ett_btl2cap_extfeatures,
1271 &ett_btl2cap_control
1274 /* Register the protocol name and description */
1275 proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Packet", "L2CAP", "btl2cap");
1277 register_dissector("btl2cap", dissect_btl2cap, proto_btl2cap);
1279 /* subdissector code */
1280 l2cap_psm_dissector_table = register_dissector_table("btl2cap.psm", "L2CAP PSM", FT_UINT16, BASE_HEX);
1282 /* Required function calls to register the header fields and subtrees used */
1283 proto_register_field_array(proto_btl2cap, hf, array_length(hf));
1284 proto_register_subtree_array(ett, array_length(ett));
1286 cid_to_psm_table=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "btl2cap scid to psm");
1292 proto_reg_handoff_btl2cap(void)