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_child_real_data(tvb, (guint8*)mfp->reassembled, mfp->tot_len, mfp->tot_len);
708 add_new_data_source(pinfo, next_tvb, "Reassembled L2CAP");
710 /*pass up to higher layer if we have a complete packet*/
711 if(segment == 0x00) {
712 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset) - 2, length);
716 proto_item *psm_item;
718 psm_item=proto_tree_add_uint(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 0, psm);
719 PROTO_ITEM_SET_GENERATED(psm_item);
721 /* call next dissector */
722 if (!dissector_try_port(l2cap_psm_dissector_table, (guint32) psm,
723 next_tvb, pinfo, tree)) {
724 /* unknown protocol. declare as data */
725 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), TRUE);
728 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), TRUE);
731 offset+=(tvb_length_remaining(tvb, offset) - 2);
732 proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, offset, 2, TRUE);
736 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_)
738 proto_item* ti_control;
739 proto_tree* ti_control_subtree;
742 control = tvb_get_letohs(tvb, offset);
743 if(check_col(pinfo->cinfo, COL_INFO)){
744 switch((control & 0x000C) >> 2)
747 col_append_str(pinfo->cinfo, COL_INFO, "[S] Receiver Ready");
750 col_append_str(pinfo->cinfo, COL_INFO, "[S] Reject");
753 col_append_str(pinfo->cinfo, COL_INFO, "[S] Unknown supervisory frame");
757 ti_control = proto_tree_add_none_format(btl2cap_tree, hf_btl2cap_control, tvb,
758 offset, 2, "Control: %s reqseq:%d r:%d",
759 val_to_str((control & 0x000C) >> 2, control_supervisory_vals, "unknown"),
760 (control & 0x3F00) >> 8,
761 (control & 0x0080) >> 7);
762 ti_control_subtree = proto_item_add_subtree(ti_control, ett_btl2cap_control);
763 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_reqseq, tvb, offset, 2, TRUE);
764 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_retransmissiondisable, tvb, offset, 2, TRUE);
765 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_supervisory, tvb, offset, 2, TRUE);
766 proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_type, tvb, offset, 2, TRUE);
768 proto_tree_add_item(ti_control_subtree, hf_btl2cap_fcs, tvb, offset, 2, TRUE);
772 /* Code to actually dissect the packets
773 * This dissector will only be called ontop of BTHCI ACL
774 * and this dissector _REQUIRES_ that
775 * pinfo->private_data points to a valid bthci_acl_data_t structure
777 static void dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
781 proto_tree *btl2cap_tree=NULL;
786 psm_data_t *psm_data;
787 bthci_acl_data_t *acl_data;
788 btl2cap_data_t *l2cap_data;
789 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 pd_save = pinfo->private_data;
818 pinfo->private_data=l2cap_data;
820 if(cid==0x0001){ /* This is a command packet*/
821 while(offset<(length+4)) {
822 proto_tree *btl2cap_cmd_tree=NULL;
823 proto_item *ti_command=NULL;
827 ti_command=proto_tree_add_none_format(btl2cap_tree,
828 hf_btl2cap_command, tvb,
831 btl2cap_cmd_tree=proto_item_add_subtree(ti_command, ett_btl2cap_cmd);
833 cmd_code=tvb_get_guint8(tvb, offset);
834 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_code, tvb, offset, 1, TRUE);
837 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_ident, tvb, offset, 1, TRUE);
840 cmd_length=tvb_get_letohs(tvb, offset);
841 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_length, tvb, offset, 2, TRUE);
842 proto_item_set_len(ti_command, cmd_length+4);
846 case 0x01: /* Command Reject */
847 offset=dissect_comrej(tvb, offset, pinfo, btl2cap_cmd_tree);
848 proto_item_append_text(ti_command, "Command Reject");
849 if ((check_col(pinfo->cinfo, COL_INFO))){
850 col_append_str(pinfo->cinfo, COL_INFO, "Command Reject");
854 case 0x02: /* Connection Request */
855 offset=dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree);
856 proto_item_append_text(ti_command, "Connection Request");
857 if ((check_col(pinfo->cinfo, COL_INFO))){
858 col_append_str(pinfo->cinfo, COL_INFO, "Connection Request");
862 case 0x03: /* Connection Response */
863 offset=dissect_connresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
864 proto_item_append_text(ti_command, "Connection Response");
865 if ((check_col(pinfo->cinfo, COL_INFO))){
866 col_append_str(pinfo->cinfo, COL_INFO, "Connection Response");
869 case 0x04: /* Configure Request */
870 offset=dissect_configrequest(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
871 proto_item_append_text(ti_command, "Configure Request");
872 if ((check_col(pinfo->cinfo, COL_INFO))){
873 col_append_str(pinfo->cinfo, COL_INFO, "Configure Request");
877 case 0x05: /* Configure Response */
878 offset=dissect_configresponse(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
879 proto_item_append_text(ti_command, "Configure Response");
880 if ((check_col(pinfo->cinfo, COL_INFO))){
881 col_append_str(pinfo->cinfo, COL_INFO, "Configure Response");
885 case 0x06: /* Disconnect Request */
886 offset=dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
887 proto_item_append_text(ti_command, "Disconnect Request");
888 if ((check_col(pinfo->cinfo, COL_INFO))){
889 col_append_str(pinfo->cinfo, COL_INFO, "Disconnect Request");
893 case 0x07: /* Disconnect Response */
894 offset=dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
895 proto_item_append_text(ti_command, "Disconnect Response");
896 if ((check_col(pinfo->cinfo, COL_INFO))){
897 col_append_str(pinfo->cinfo, COL_INFO, "Disconnect Response");
901 case 0x08: /* Echo Request */
902 proto_item_append_text(ti_command, "Echo Request");
903 offset+=tvb_length_remaining(tvb, offset);
904 if ((check_col(pinfo->cinfo, COL_INFO))){
905 col_append_str(pinfo->cinfo, COL_INFO, "Echo Request");
909 case 0x09: /* Echo Response */
910 proto_item_append_text(ti_command, "Echo Response");
911 offset+=tvb_length_remaining(tvb, offset);
912 if ((check_col(pinfo->cinfo, COL_INFO))){
913 col_append_str(pinfo->cinfo, COL_INFO, "Echo Response");
917 case 0x0a: /* Information Request */
918 offset=dissect_inforequest(tvb, offset, pinfo, btl2cap_cmd_tree);
920 proto_item_append_text(ti_command, "Information Request");
921 if ((check_col(pinfo->cinfo, COL_INFO))){
922 col_append_str(pinfo->cinfo, COL_INFO, "Information Request");
926 case 0x0b: /* Information Response */
927 offset=dissect_inforesponse(tvb, offset, pinfo, btl2cap_cmd_tree);
928 proto_item_append_text(ti_command, "Information Response");
929 if ((check_col(pinfo->cinfo, COL_INFO))){
930 col_append_str(pinfo->cinfo, COL_INFO, "Information Response");
935 proto_tree_add_item(btl2cap_cmd_tree, hf_btl2cap_cmd_data, tvb, offset, -1, TRUE);
936 offset+=tvb_length_remaining(tvb, offset);
940 } else if (cid == 0x0002) { /* Connectionless reception channel */
941 if(check_col(pinfo->cinfo, COL_INFO)){
942 col_append_str(pinfo->cinfo, COL_INFO, "Connectionless reception channel");
945 psm = tvb_get_letohs(tvb, offset);
946 proto_tree_add_item(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 2, TRUE);
950 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
952 /* call next dissector */
953 if(!dissector_try_port(l2cap_psm_dissector_table, (guint32) psm,
954 next_tvb, pinfo, tree)){
955 /* unknown protocol. declare as data */
956 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
958 offset+=tvb_length_remaining(tvb, offset);
959 } else if(cid >= 0x0040) { /* Connection oriented channel */
960 if((psm_data=se_tree_lookup32(cid_to_psm_table, cid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000)))){
962 if(pinfo->p2p_dir==P2P_DIR_RECV)
963 config_data = &(psm_data->in);
965 config_data = &(psm_data->out);
966 if(config_data->mode == 0) {
967 dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset);
969 control = tvb_get_letohs(tvb, offset);
971 dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset, config_data);
973 dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data);
978 dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset);
981 } else { /* Something else */
982 if(check_col(pinfo->cinfo, COL_INFO)){
983 col_clear(pinfo->cinfo, COL_INFO);
986 proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
989 pinfo->private_data = pd_save;
993 /* Register the protocol with Wireshark */
995 proto_register_btl2cap(void)
998 /* Setup list of header fields See Section 1.6.1 for details*/
999 static hf_register_info hf[] = {
1000 { &hf_btl2cap_length,
1001 { "Length", "btl2cap.length",
1002 FT_UINT16, BASE_DEC, NULL, 0x0,
1003 "L2CAP Payload Length", HFILL }
1006 { "CID", "btl2cap.cid",
1007 FT_UINT16, BASE_HEX, NULL, 0x0,
1008 "L2CAP Channel Identifier", HFILL }
1010 { &hf_btl2cap_payload,
1011 { "Payload", "btl2cap.payload",
1012 FT_BYTES, BASE_NONE, NULL, 0x0,
1013 "L2CAP Payload", HFILL }
1015 { &hf_btl2cap_command,
1016 { "Command", "btl2cap.command",
1017 FT_NONE, BASE_NONE, NULL, 0x0,
1018 "L2CAP Command", HFILL }
1020 { &hf_btl2cap_cmd_code,
1021 { "Command Code", "btl2cap.cmd_code",
1022 FT_UINT8, BASE_HEX, VALS(command_code_vals), 0x0,
1023 "L2CAP Command Code", HFILL }
1025 { &hf_btl2cap_cmd_ident,
1026 { "Command Identifier", "btl2cap.cmd_ident",
1027 FT_UINT8, BASE_HEX, NULL, 0x0,
1028 "L2CAP Command Identifier", HFILL }
1030 { &hf_btl2cap_cmd_length,
1031 { "Command Length", "btl2cap.cmd_length",
1032 FT_UINT8, BASE_DEC, NULL, 0x0,
1033 "L2CAP Command Length", HFILL }
1035 { &hf_btl2cap_cmd_data,
1036 { "Command Data", "btl2cap.cmd_data",
1037 FT_NONE, BASE_NONE, NULL, 0x0,
1038 "L2CAP Command Data", HFILL }
1041 { "PSM", "btl2cap.psm",
1042 FT_UINT16, BASE_HEX, VALS(psm_vals), 0x0,
1043 "Protocol/Service Multiplexer", HFILL }
1046 { "Source CID", "btl2cap.scid",
1047 FT_UINT16, BASE_HEX, NULL, 0x0,
1048 "Source Channel Identifier", HFILL }
1051 { "Destination CID", "btl2cap.dcid",
1052 FT_UINT16, BASE_HEX, NULL, 0x0,
1053 "Destination Channel Identifier", HFILL }
1055 { &hf_btl2cap_result,
1056 { "Result", "btl2cap.result",
1057 FT_UINT16, BASE_HEX, VALS(result_vals), 0x0,
1060 { &hf_btl2cap_status,
1061 { "Status", "btl2cap.status",
1062 FT_UINT16, BASE_HEX, VALS(status_vals), 0x0,
1065 { &hf_btl2cap_rej_reason,
1066 { "Reason", "btl2cap.rej_reason",
1067 FT_UINT16, BASE_HEX, VALS(reason_vals), 0x0,
1070 { &hf_btl2cap_sig_mtu,
1071 { "Maximum Signalling MTU", "btl2cap.sig_mtu",
1072 FT_UINT16, BASE_DEC, NULL, 0x0,
1075 { &hf_btl2cap_info_mtu,
1076 { "Remote Entity MTU", "btl2cap.info_mtu",
1077 FT_UINT16, BASE_DEC, NULL, 0x0,
1078 "Remote entity acceptable connectionless MTU", HFILL }
1080 { &hf_btl2cap_info_flowcontrol,
1081 { "Flow Control Mode", "btl2cap.info_flowcontrol",
1082 FT_UINT8, BASE_DEC, NULL, 0x01,
1083 "Flow Control mode support", HFILL }
1085 { &hf_btl2cap_info_retransmission,
1086 { "Retransmission Mode", "btl2cap.info_retransmission",
1087 FT_UINT8, BASE_DEC, NULL, 0x02,
1088 "Retransmission mode support", HFILL }
1090 { &hf_btl2cap_info_bidirqos,
1091 { "Bi-Directional QOS", "btl2cap.info_bidirqos",
1092 FT_UINT8, BASE_DEC, NULL, 0x04,
1093 "Bi-Directional QOS support", HFILL }
1095 { &hf_btl2cap_info_type,
1096 { "Information Type", "btl2cap.info_type",
1097 FT_UINT16, BASE_HEX, VALS(info_type_vals), 0x0,
1098 "Type of implementation-specific information", HFILL }
1100 { &hf_btl2cap_info_result,
1101 { "Result", "btl2cap.info_result",
1102 FT_UINT16, BASE_HEX, VALS(info_result_vals), 0x0,
1103 "Information about the success of the request", HFILL }
1105 { &hf_btl2cap_info_extfeatures,
1106 { "Extended Features", "btl2cap.info_extfeatures",
1107 FT_NONE, BASE_NONE, NULL, 0x0,
1108 "Extended Features Mask", HFILL }
1110 { &hf_btl2cap_continuation_flag,
1111 { "Continuation Flag", "btl2cap.continuation",
1112 FT_BOOLEAN, 16, NULL, 0x0001,
1115 { &hf_btl2cap_configuration_result,
1116 { "Result", "btl2cap.conf_result",
1117 FT_UINT16, BASE_HEX, VALS(configuration_result_vals), 0x0,
1118 "Configuration Result", HFILL }
1120 { &hf_btl2cap_option_type,
1121 { "Type", "btl2cap.option_type",
1122 FT_UINT8, BASE_HEX, VALS(option_type_vals), 0x0,
1123 "Type of option", HFILL }
1125 { &hf_btl2cap_option_length,
1126 { "Length", "btl2cap.option_length",
1127 FT_UINT8, BASE_DEC, NULL, 0x0,
1128 "Number of octets in option payload", HFILL }
1130 { &hf_btl2cap_option_mtu,
1131 { "MTU", "btl2cap.option_mtu",
1132 FT_UINT16, BASE_DEC, NULL, 0x0,
1133 "Maximum Transmission Unit", HFILL }
1135 { &hf_btl2cap_option_flushTO,
1136 { "Flush Timeout (ms)", "btl2cap.option_flushto",
1137 FT_UINT16, BASE_DEC, NULL, 0x0,
1138 "Flush Timeout in milliseconds", HFILL }
1140 { &hf_btl2cap_option_flags,
1141 { "Flags", "btl2cap.option_flags",
1142 FT_UINT8, BASE_HEX, NULL, 0x0,
1143 "Flags - must be set to 0 (Reserved for future use)", HFILL }
1145 { &hf_btl2cap_option_service_type,
1146 { "Service Type", "btl2cap.option_servicetype",
1147 FT_UINT8, BASE_HEX, VALS(option_servicetype_vals), 0x0,
1148 "Level of service required", HFILL }
1150 { &hf_btl2cap_option_tokenrate,
1151 { "Token Rate (bytes/s)", "btl2cap.option_tokenrate",
1152 FT_UINT32, BASE_DEC, NULL, 0x0,
1153 "Rate at which traffic credits are granted (bytes/s)", HFILL }
1155 { &hf_btl2cap_option_tokenbucketsize,
1156 { "Token Bucket Size (bytes)", "btl2cap.option_tokenbsize",
1157 FT_UINT32, BASE_DEC, NULL, 0x0,
1158 "Size of the token bucket (bytes)", HFILL }
1160 { &hf_btl2cap_option_peakbandwidth,
1161 { "Peak Bandwidth (bytes/s)", "btl2cap.option_peakbandwidth",
1162 FT_UINT32, BASE_DEC, NULL, 0x0,
1163 "Limit how fast packets may be sent (bytes/s)", HFILL }
1165 { &hf_btl2cap_option_latency,
1166 { "Latency (microseconds)", "btl2cap.option_latency",
1167 FT_UINT32, BASE_DEC, NULL, 0x0,
1168 "Maximal acceptable delay (microseconds)", HFILL }
1170 { &hf_btl2cap_option_delayvariation,
1171 { "Delay Variation (microseconds)", "btl2cap.option_delayvar",
1172 FT_UINT32, BASE_DEC, NULL, 0x0,
1173 "Difference between maximum and minimum delay (microseconds)", HFILL }
1175 { &hf_btl2cap_option_retransmissionmode,
1176 { "Mode", "btl2cap.retransmissionmode",
1177 FT_UINT8, BASE_HEX, VALS(option_retransmissionmode_vals), 0x0,
1178 "Retransmission/Flow Control mode", HFILL }
1180 { &hf_btl2cap_option_txwindow,
1181 { "TxWindow", "btl2cap.txwindow",
1182 FT_UINT8, BASE_DEC, NULL, 0x0,
1183 "Retransmission window size", HFILL }
1185 { &hf_btl2cap_option_maxtransmit,
1186 { "MaxTransmit", "btl2cap.maxtransmit",
1187 FT_UINT8, BASE_DEC, NULL, 0x0,
1188 "Maximum I-frame retransmissions", HFILL }
1190 { &hf_btl2cap_option_retransmittimeout,
1191 { "Retransmit timeout (ms)", "btl2cap.retransmittimeout",
1192 FT_UINT16, BASE_DEC, NULL, 0x0,
1193 "Retransmission timeout (milliseconds)", HFILL }
1195 { &hf_btl2cap_option_monitortimeout,
1196 { "Monitor Timeout (ms)", "btl2cap.monitortimeout",
1197 FT_UINT16, BASE_DEC, NULL, 0x0,
1198 "S-frame transmission interval (milliseconds)", HFILL }
1200 { &hf_btl2cap_option_mps,
1201 { "MPS", "btl2cap.mps",
1202 FT_UINT16, BASE_DEC, NULL, 0x0,
1203 "Maximum PDU Payload Size", HFILL }
1205 { &hf_btl2cap_option,
1206 { "Configuration Parameter Option", "btl2cap.conf_param_option",
1207 FT_NONE, BASE_NONE, NULL, 0x0,
1210 { &hf_btl2cap_control_sar,
1211 { "Segmentation and reassembly", "btl2cap.control_sar",
1212 FT_UINT16, BASE_HEX, VALS(control_sar_vals), 0xC000,
1215 { &hf_btl2cap_control_reqseq,
1216 { "ReqSeq", "btl2cap.control_reqseq",
1217 FT_UINT16, BASE_DEC, NULL, 0x3F00,
1218 "Request Sequence Number", HFILL }
1220 { &hf_btl2cap_control_txseq,
1221 { "TxSeq", "btl2cap.control_txseq",
1222 FT_UINT16, BASE_DEC, NULL, 0x007E,
1223 "Transmitted Sequence Number", HFILL }
1225 { &hf_btl2cap_control_retransmissiondisable,
1226 { "R", "btl2cap.control_retransmissiondisable",
1227 FT_UINT16, BASE_HEX, NULL, 0x0080,
1228 "Retransmission Disable", HFILL }
1230 { &hf_btl2cap_control_supervisory,
1231 { "S", "btl2cap.control_supervisory",
1232 FT_UINT16, BASE_HEX, VALS(control_supervisory_vals), 0x000C,
1233 "Supervisory Function", HFILL }
1235 { &hf_btl2cap_control_type,
1236 { "Frame Type", "btl2cap.control_type",
1237 FT_UINT16, BASE_HEX, VALS(control_type_vals), 0x0001,
1240 { &hf_btl2cap_control,
1241 { "Control field", "btl2cap.control",
1242 FT_NONE, BASE_NONE, NULL, 0x0,
1246 { "FCS", "btl2cap.fcs",
1247 FT_UINT16, BASE_HEX, NULL, 0,
1248 "Frame Check Sequence", HFILL }
1250 { &hf_btl2cap_sdulength,
1251 { "SDU Length", "btl2cap.sdulength",
1252 FT_UINT16, BASE_DEC, NULL, 0,
1255 { &hf_btl2cap_reassembled_in,
1256 { "This SDU is reassembled in frame", "btl2cap.reassembled_in",
1257 FT_FRAMENUM, BASE_NONE, NULL, 0,
1258 "This SDU is reassembled in frame #", HFILL }
1260 { &hf_btl2cap_continuation_to,
1261 { "This is a continuation to the SDU in frame", "btl2cap.continuation_to",
1262 FT_FRAMENUM, BASE_NONE, NULL, 0,
1263 "This is a continuation to the SDU in frame #", HFILL }
1267 /* Setup protocol subtree array */
1268 static gint *ett[] = {
1271 &ett_btl2cap_option,
1272 &ett_btl2cap_extfeatures,
1273 &ett_btl2cap_control
1276 /* Register the protocol name and description */
1277 proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Packet", "L2CAP", "btl2cap");
1279 register_dissector("btl2cap", dissect_btl2cap, proto_btl2cap);
1281 /* subdissector code */
1282 l2cap_psm_dissector_table = register_dissector_table("btl2cap.psm", "L2CAP PSM", FT_UINT16, BASE_HEX);
1284 /* Required function calls to register the header fields and subtrees used */
1285 proto_register_field_array(proto_btl2cap, hf, array_length(hf));
1286 proto_register_subtree_array(ett, array_length(ett));
1288 cid_to_psm_table=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "btl2cap scid to psm");
1294 proto_reg_handoff_btl2cap(void)