11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds BlueZ - Bluetooth protocol stack for Linux
31da177e4SLinus Torvalds Copyright (C) 2000-2001 Qualcomm Incorporated
4ce5706bdSGustavo F. Padovan Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org>
55d8868ffSGustavo F. Padovan Copyright (C) 2010 Google Inc.
61da177e4SLinus Torvalds
71da177e4SLinus Torvalds Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
81da177e4SLinus Torvalds
91da177e4SLinus Torvalds This program is free software; you can redistribute it and/or modify
101da177e4SLinus Torvalds it under the terms of the GNU General Public License version 2 as
111da177e4SLinus Torvalds published by the Free Software Foundation;
121da177e4SLinus Torvalds
131da177e4SLinus Torvalds THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
141da177e4SLinus Torvalds OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151da177e4SLinus Torvalds FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
161da177e4SLinus Torvalds IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
171da177e4SLinus Torvalds CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
181da177e4SLinus Torvalds WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
191da177e4SLinus Torvalds ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
201da177e4SLinus Torvalds OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
211da177e4SLinus Torvalds
221da177e4SLinus Torvalds ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
231da177e4SLinus Torvalds COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
241da177e4SLinus Torvalds SOFTWARE IS DISCLAIMED.
251da177e4SLinus Torvalds */
261da177e4SLinus Torvalds
271da177e4SLinus Torvalds #ifndef __L2CAP_H
281da177e4SLinus Torvalds #define __L2CAP_H
291da177e4SLinus Torvalds
3088843ab0SAndrei Emeltchenko #include <asm/unaligned.h>
31abe84903SJohan Hedberg #include <linux/atomic.h>
3288843ab0SAndrei Emeltchenko
331da177e4SLinus Torvalds /* L2CAP defaults */
341da177e4SLinus Torvalds #define L2CAP_DEFAULT_MTU 672
35f2fcfcd6SGustavo F. Padovan #define L2CAP_DEFAULT_MIN_MTU 48
368936fa6dSAndrei Emeltchenko #define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
378936fa6dSAndrei Emeltchenko #define L2CAP_EFS_DEFAULT_FLUSH_TO 0xFFFFFFFF
381c2acffbSGustavo F. Padovan #define L2CAP_DEFAULT_TX_WINDOW 63
396327eb98SAndrei Emeltchenko #define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
40e90bac06SGustavo F. Padovan #define L2CAP_DEFAULT_MAX_TX 3
41fa235562SMat Martineau #define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
42e90bac06SGustavo F. Padovan #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
430b4558e3SAndrei Emeltchenko #define L2CAP_DEFAULT_MAX_PDU_SIZE 1492 /* Sized for AMP packet */
44c1b4f43bSGustavo F. Padovan #define L2CAP_DEFAULT_ACK_TO 200
458f7975b1SAndrei Emeltchenko #define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
468f7975b1SAndrei Emeltchenko #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
478f7975b1SAndrei Emeltchenko #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
4894122bbeSMat Martineau #define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */
498c3a4f00SAndre Guedes #define L2CAP_LE_MIN_MTU 23
50da49b602SLuiz Augusto von Dentz #define L2CAP_ECRED_CONN_SCID_MAX 5
511da177e4SLinus Torvalds
52ba13ccd9SMarcel Holtmann #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
53ba13ccd9SMarcel Holtmann #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
54ba13ccd9SMarcel Holtmann #define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
55ba13ccd9SMarcel Holtmann #define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
56ba13ccd9SMarcel Holtmann #define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
575b155ef9SMat Martineau #define L2CAP_MOVE_TIMEOUT msecs_to_jiffies(4000)
585b155ef9SMat Martineau #define L2CAP_MOVE_ERTX_TIMEOUT msecs_to_jiffies(60000)
59cb02a255SDean Jenkins #define L2CAP_WAIT_ACK_POLL_PERIOD msecs_to_jiffies(200)
60e432c72cSDean Jenkins #define L2CAP_WAIT_ACK_TIMEOUT msecs_to_jiffies(10000)
611da177e4SLinus Torvalds
621da177e4SLinus Torvalds /* L2CAP socket address */
631da177e4SLinus Torvalds struct sockaddr_l2 {
641da177e4SLinus Torvalds sa_family_t l2_family;
658e036fc3SAl Viro __le16 l2_psm;
661da177e4SLinus Torvalds bdaddr_t l2_bdaddr;
67f29972deSMarcel Holtmann __le16 l2_cid;
6843ef0b8bSAndre Guedes __u8 l2_bdaddr_type;
691da177e4SLinus Torvalds };
701da177e4SLinus Torvalds
711da177e4SLinus Torvalds /* L2CAP socket options */
721da177e4SLinus Torvalds #define L2CAP_OPTIONS 0x01
731da177e4SLinus Torvalds struct l2cap_options {
741da177e4SLinus Torvalds __u16 omtu;
751da177e4SLinus Torvalds __u16 imtu;
761da177e4SLinus Torvalds __u16 flush_to;
771da177e4SLinus Torvalds __u8 mode;
78fcc203c3SGustavo F. Padovan __u8 fcs;
7968d7f0ceSGustavo F. Padovan __u8 max_tx;
8014b5aa71SGustavo F. Padovan __u16 txwin_size;
811da177e4SLinus Torvalds };
821da177e4SLinus Torvalds
831da177e4SLinus Torvalds #define L2CAP_CONNINFO 0x02
841da177e4SLinus Torvalds struct l2cap_conninfo {
851da177e4SLinus Torvalds __u16 hci_handle;
861da177e4SLinus Torvalds __u8 dev_class[3];
871da177e4SLinus Torvalds };
881da177e4SLinus Torvalds
891da177e4SLinus Torvalds #define L2CAP_LM 0x03
901da177e4SLinus Torvalds #define L2CAP_LM_MASTER 0x0001
911da177e4SLinus Torvalds #define L2CAP_LM_AUTH 0x0002
921da177e4SLinus Torvalds #define L2CAP_LM_ENCRYPT 0x0004
931da177e4SLinus Torvalds #define L2CAP_LM_TRUSTED 0x0008
941da177e4SLinus Torvalds #define L2CAP_LM_RELIABLE 0x0010
951da177e4SLinus Torvalds #define L2CAP_LM_SECURE 0x0020
967d513e92SMarcel Holtmann #define L2CAP_LM_FIPS 0x0040
971da177e4SLinus Torvalds
981da177e4SLinus Torvalds /* L2CAP command codes */
991da177e4SLinus Torvalds #define L2CAP_COMMAND_REJ 0x01
1001da177e4SLinus Torvalds #define L2CAP_CONN_REQ 0x02
1011da177e4SLinus Torvalds #define L2CAP_CONN_RSP 0x03
1021da177e4SLinus Torvalds #define L2CAP_CONF_REQ 0x04
1031da177e4SLinus Torvalds #define L2CAP_CONF_RSP 0x05
1041da177e4SLinus Torvalds #define L2CAP_DISCONN_REQ 0x06
1051da177e4SLinus Torvalds #define L2CAP_DISCONN_RSP 0x07
1061da177e4SLinus Torvalds #define L2CAP_ECHO_REQ 0x08
1071da177e4SLinus Torvalds #define L2CAP_ECHO_RSP 0x09
1081da177e4SLinus Torvalds #define L2CAP_INFO_REQ 0x0a
1091da177e4SLinus Torvalds #define L2CAP_INFO_RSP 0x0b
1103300d9a9SClaudio Takahasi #define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
1113300d9a9SClaudio Takahasi #define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
112ee5ec5cfSJohan Hedberg #define L2CAP_LE_CONN_REQ 0x14
113ee5ec5cfSJohan Hedberg #define L2CAP_LE_CONN_RSP 0x15
114ee5ec5cfSJohan Hedberg #define L2CAP_LE_CREDITS 0x16
11514572096SLuiz Augusto von Dentz #define L2CAP_ECRED_CONN_REQ 0x17
11614572096SLuiz Augusto von Dentz #define L2CAP_ECRED_CONN_RSP 0x18
11714572096SLuiz Augusto von Dentz #define L2CAP_ECRED_RECONF_REQ 0x19
11814572096SLuiz Augusto von Dentz #define L2CAP_ECRED_RECONF_RSP 0x1a
1191da177e4SLinus Torvalds
120a858393bSAndrei Emeltchenko /* L2CAP extended feature mask */
12147ec1dcdSMarcel Holtmann #define L2CAP_FEAT_FLOWCTL 0x00000001
12247ec1dcdSMarcel Holtmann #define L2CAP_FEAT_RETRANS 0x00000002
123a858393bSAndrei Emeltchenko #define L2CAP_FEAT_BIDIR_QOS 0x00000004
12447ec1dcdSMarcel Holtmann #define L2CAP_FEAT_ERTM 0x00000008
12547ec1dcdSMarcel Holtmann #define L2CAP_FEAT_STREAMING 0x00000010
12647ec1dcdSMarcel Holtmann #define L2CAP_FEAT_FCS 0x00000020
127a858393bSAndrei Emeltchenko #define L2CAP_FEAT_EXT_FLOW 0x00000040
12847ec1dcdSMarcel Holtmann #define L2CAP_FEAT_FIXED_CHAN 0x00000080
129a858393bSAndrei Emeltchenko #define L2CAP_FEAT_EXT_WINDOW 0x00000100
130a858393bSAndrei Emeltchenko #define L2CAP_FEAT_UCD 0x00000200
13147ec1dcdSMarcel Holtmann
13247ec1dcdSMarcel Holtmann /* L2CAP checksum option */
13347ec1dcdSMarcel Holtmann #define L2CAP_FCS_NONE 0x00
13447ec1dcdSMarcel Holtmann #define L2CAP_FCS_CRC16 0x01
13547ec1dcdSMarcel Holtmann
136d835ac0fSMat Martineau /* L2CAP fixed channels */
137a6801ca9SMarcel Holtmann #define L2CAP_FC_SIG_BREDR 0x02
138d40bffbcSMarcel Holtmann #define L2CAP_FC_CONNLESS 0x04
139a6801ca9SMarcel Holtmann #define L2CAP_FC_ATT 0x10
140a6801ca9SMarcel Holtmann #define L2CAP_FC_SIG_LE 0x20
141a6801ca9SMarcel Holtmann #define L2CAP_FC_SMP_LE 0x40
142ef8efe4bSJohan Hedberg #define L2CAP_FC_SMP_BREDR 0x80
143d835ac0fSMat Martineau
1441c2acffbSGustavo F. Padovan /* L2CAP Control Field bit masks */
1451c2acffbSGustavo F. Padovan #define L2CAP_CTRL_SAR 0xC000
1461c2acffbSGustavo F. Padovan #define L2CAP_CTRL_REQSEQ 0x3F00
1471c2acffbSGustavo F. Padovan #define L2CAP_CTRL_TXSEQ 0x007E
14857253fd8SAndrei Emeltchenko #define L2CAP_CTRL_SUPERVISE 0x000C
14957253fd8SAndrei Emeltchenko
1501c2acffbSGustavo F. Padovan #define L2CAP_CTRL_RETRANS 0x0080
1511c2acffbSGustavo F. Padovan #define L2CAP_CTRL_FINAL 0x0080
1521c2acffbSGustavo F. Padovan #define L2CAP_CTRL_POLL 0x0010
1531c2acffbSGustavo F. Padovan #define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
1541c2acffbSGustavo F. Padovan
1551c2acffbSGustavo F. Padovan #define L2CAP_CTRL_TXSEQ_SHIFT 1
15657253fd8SAndrei Emeltchenko #define L2CAP_CTRL_SUPER_SHIFT 2
157d5f7ac38SMat Martineau #define L2CAP_CTRL_POLL_SHIFT 4
158d5f7ac38SMat Martineau #define L2CAP_CTRL_FINAL_SHIFT 7
1591c2acffbSGustavo F. Padovan #define L2CAP_CTRL_REQSEQ_SHIFT 8
1608f17154fSGustavo F. Padovan #define L2CAP_CTRL_SAR_SHIFT 14
1611c2acffbSGustavo F. Padovan
16257253fd8SAndrei Emeltchenko /* L2CAP Extended Control Field bit mask */
16357253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_TXSEQ 0xFFFC0000
16457253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_SAR 0x00030000
16557253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_SUPERVISE 0x00030000
16657253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_REQSEQ 0x0000FFFC
16757253fd8SAndrei Emeltchenko
16857253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_POLL 0x00040000
16957253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_FINAL 0x00000002
17057253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
17157253fd8SAndrei Emeltchenko
172d5f7ac38SMat Martineau #define L2CAP_EXT_CTRL_FINAL_SHIFT 1
17357253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
17457253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_SAR_SHIFT 16
17557253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_SUPER_SHIFT 16
176d5f7ac38SMat Martineau #define L2CAP_EXT_CTRL_POLL_SHIFT 18
17757253fd8SAndrei Emeltchenko #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
17857253fd8SAndrei Emeltchenko
1791c2acffbSGustavo F. Padovan /* L2CAP Supervisory Function */
180ab784b73SAndrei Emeltchenko #define L2CAP_SUPER_RR 0x00
181ab784b73SAndrei Emeltchenko #define L2CAP_SUPER_REJ 0x01
182ab784b73SAndrei Emeltchenko #define L2CAP_SUPER_RNR 0x02
183ab784b73SAndrei Emeltchenko #define L2CAP_SUPER_SREJ 0x03
1841c2acffbSGustavo F. Padovan
1851c2acffbSGustavo F. Padovan /* L2CAP Segmentation and Reassembly */
1867e0ef6eeSAndrei Emeltchenko #define L2CAP_SAR_UNSEGMENTED 0x00
1877e0ef6eeSAndrei Emeltchenko #define L2CAP_SAR_START 0x01
1887e0ef6eeSAndrei Emeltchenko #define L2CAP_SAR_END 0x02
1897e0ef6eeSAndrei Emeltchenko #define L2CAP_SAR_CONTINUE 0x03
1901c2acffbSGustavo F. Padovan
191e2fd318eSIlia Kolomisnky /* L2CAP Command rej. reasons */
192e2fd318eSIlia Kolomisnky #define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
193e2fd318eSIlia Kolomisnky #define L2CAP_REJ_MTU_EXCEEDED 0x0001
194e2fd318eSIlia Kolomisnky #define L2CAP_REJ_INVALID_CID 0x0002
195e2fd318eSIlia Kolomisnky
1961da177e4SLinus Torvalds /* L2CAP structures */
1971da177e4SLinus Torvalds struct l2cap_hdr {
1988e036fc3SAl Viro __le16 len;
1998e036fc3SAl Viro __le16 cid;
20066c853ccSGustavo F. Padovan } __packed;
2014d7ea8eeSLuiz Augusto von Dentz #define L2CAP_LEN_SIZE 2
2021da177e4SLinus Torvalds #define L2CAP_HDR_SIZE 4
203d43cb289SAndrei Emeltchenko #define L2CAP_ENH_HDR_SIZE 6
204d43cb289SAndrei Emeltchenko #define L2CAP_EXT_HDR_SIZE 8
205d43cb289SAndrei Emeltchenko
206d43cb289SAndrei Emeltchenko #define L2CAP_FCS_SIZE 2
207d43cb289SAndrei Emeltchenko #define L2CAP_SDULEN_SIZE 2
208d43cb289SAndrei Emeltchenko #define L2CAP_PSMLEN_SIZE 2
209d5f7ac38SMat Martineau #define L2CAP_ENH_CTRL_SIZE 2
210d5f7ac38SMat Martineau #define L2CAP_EXT_CTRL_SIZE 4
2111da177e4SLinus Torvalds
2121da177e4SLinus Torvalds struct l2cap_cmd_hdr {
2131da177e4SLinus Torvalds __u8 code;
2141da177e4SLinus Torvalds __u8 ident;
2158e036fc3SAl Viro __le16 len;
21666c853ccSGustavo F. Padovan } __packed;
2171da177e4SLinus Torvalds #define L2CAP_CMD_HDR_SIZE 4
2181da177e4SLinus Torvalds
219e2fd318eSIlia Kolomisnky struct l2cap_cmd_rej_unk {
2208e036fc3SAl Viro __le16 reason;
22166c853ccSGustavo F. Padovan } __packed;
2221da177e4SLinus Torvalds
223e2fd318eSIlia Kolomisnky struct l2cap_cmd_rej_mtu {
224e2fd318eSIlia Kolomisnky __le16 reason;
225e2fd318eSIlia Kolomisnky __le16 max_mtu;
226e2fd318eSIlia Kolomisnky } __packed;
227e2fd318eSIlia Kolomisnky
228e2fd318eSIlia Kolomisnky struct l2cap_cmd_rej_cid {
229e2fd318eSIlia Kolomisnky __le16 reason;
230e2fd318eSIlia Kolomisnky __le16 scid;
231e2fd318eSIlia Kolomisnky __le16 dcid;
232e2fd318eSIlia Kolomisnky } __packed;
233e2fd318eSIlia Kolomisnky
2341da177e4SLinus Torvalds struct l2cap_conn_req {
2358e036fc3SAl Viro __le16 psm;
2368e036fc3SAl Viro __le16 scid;
23766c853ccSGustavo F. Padovan } __packed;
2381da177e4SLinus Torvalds
2391da177e4SLinus Torvalds struct l2cap_conn_rsp {
2408e036fc3SAl Viro __le16 dcid;
2418e036fc3SAl Viro __le16 scid;
2428e036fc3SAl Viro __le16 result;
2438e036fc3SAl Viro __le16 status;
24466c853ccSGustavo F. Padovan } __packed;
2451da177e4SLinus Torvalds
2462983fd68SAndrei Emeltchenko /* protocol/service multiplexer (PSM) */
2472983fd68SAndrei Emeltchenko #define L2CAP_PSM_SDP 0x0001
2482983fd68SAndrei Emeltchenko #define L2CAP_PSM_RFCOMM 0x0003
2493124b843SMarcel Holtmann #define L2CAP_PSM_3DSP 0x0021
250cab9e3a0SJukka Rissanen #define L2CAP_PSM_IPSP 0x0023 /* 6LoWPAN */
2512983fd68SAndrei Emeltchenko
252114f9f1eSJohan Hedberg #define L2CAP_PSM_DYN_START 0x1001
253114f9f1eSJohan Hedberg #define L2CAP_PSM_DYN_END 0xffff
254114f9f1eSJohan Hedberg #define L2CAP_PSM_AUTO_END 0x10ff
255114f9f1eSJohan Hedberg #define L2CAP_PSM_LE_DYN_START 0x0080
256114f9f1eSJohan Hedberg #define L2CAP_PSM_LE_DYN_END 0x00ff
257114f9f1eSJohan Hedberg
2583f79410cSMaxime Jayat /* channel identifier */
2598db4dc46SGustavo F. Padovan #define L2CAP_CID_SIGNALING 0x0001
2608db4dc46SGustavo F. Padovan #define L2CAP_CID_CONN_LESS 0x0002
261073d1cf3SJohan Hedberg #define L2CAP_CID_ATT 0x0004
262acd7d370SVille Tervo #define L2CAP_CID_LE_SIGNALING 0x0005
263acd7d370SVille Tervo #define L2CAP_CID_SMP 0x0006
264ef8efe4bSJohan Hedberg #define L2CAP_CID_SMP_BREDR 0x0007
2658db4dc46SGustavo F. Padovan #define L2CAP_CID_DYN_START 0x0040
2668db4dc46SGustavo F. Padovan #define L2CAP_CID_DYN_END 0xffff
267e77af755SJohan Hedberg #define L2CAP_CID_LE_DYN_END 0x007f
2688db4dc46SGustavo F. Padovan
26938094c75SMat Martineau /* connect/create channel results */
2701da177e4SLinus Torvalds #define L2CAP_CR_SUCCESS 0x0000
2711da177e4SLinus Torvalds #define L2CAP_CR_PEND 0x0001
2721da177e4SLinus Torvalds #define L2CAP_CR_BAD_PSM 0x0002
2731da177e4SLinus Torvalds #define L2CAP_CR_SEC_BLOCK 0x0003
2741da177e4SLinus Torvalds #define L2CAP_CR_NO_MEM 0x0004
275dd1a8f8aSMallikarjun Phulari #define L2CAP_CR_INVALID_SCID 0x0006
276dd1a8f8aSMallikarjun Phulari #define L2CAP_CR_SCID_IN_USE 0x0007
277571f7390SMallikarjun Phulari
278571f7390SMallikarjun Phulari /* credit based connect results */
279571f7390SMallikarjun Phulari #define L2CAP_CR_LE_SUCCESS 0x0000
280571f7390SMallikarjun Phulari #define L2CAP_CR_LE_BAD_PSM 0x0002
281571f7390SMallikarjun Phulari #define L2CAP_CR_LE_NO_MEM 0x0004
282571f7390SMallikarjun Phulari #define L2CAP_CR_LE_AUTHENTICATION 0x0005
283571f7390SMallikarjun Phulari #define L2CAP_CR_LE_AUTHORIZATION 0x0006
284571f7390SMallikarjun Phulari #define L2CAP_CR_LE_BAD_KEY_SIZE 0x0007
285571f7390SMallikarjun Phulari #define L2CAP_CR_LE_ENCRYPTION 0x0008
286571f7390SMallikarjun Phulari #define L2CAP_CR_LE_INVALID_SCID 0x0009
287571f7390SMallikarjun Phulari #define L2CAP_CR_LE_SCID_IN_USE 0X000A
28815f02b91SLuiz Augusto von Dentz #define L2CAP_CR_LE_UNACCEPT_PARAMS 0X000B
28915f02b91SLuiz Augusto von Dentz #define L2CAP_CR_LE_INVALID_PARAMS 0X000C
2901da177e4SLinus Torvalds
29138094c75SMat Martineau /* connect/create channel status */
2921da177e4SLinus Torvalds #define L2CAP_CS_NO_INFO 0x0000
2931da177e4SLinus Torvalds #define L2CAP_CS_AUTHEN_PEND 0x0001
2941da177e4SLinus Torvalds #define L2CAP_CS_AUTHOR_PEND 0x0002
2951da177e4SLinus Torvalds
2961da177e4SLinus Torvalds struct l2cap_conf_req {
2978e036fc3SAl Viro __le16 dcid;
2988e036fc3SAl Viro __le16 flags;
299a7e45454SGustavo A. R. Silva __u8 data[];
30066c853ccSGustavo F. Padovan } __packed;
3011da177e4SLinus Torvalds
3021da177e4SLinus Torvalds struct l2cap_conf_rsp {
3038e036fc3SAl Viro __le16 scid;
3048e036fc3SAl Viro __le16 flags;
3058e036fc3SAl Viro __le16 result;
306a7e45454SGustavo A. R. Silva __u8 data[];
30766c853ccSGustavo F. Padovan } __packed;
3081da177e4SLinus Torvalds
3095dee9e7cSMarcel Holtmann #define L2CAP_CONF_SUCCESS 0x0000
3105dee9e7cSMarcel Holtmann #define L2CAP_CONF_UNACCEPT 0x0001
3115dee9e7cSMarcel Holtmann #define L2CAP_CONF_REJECT 0x0002
3125dee9e7cSMarcel Holtmann #define L2CAP_CONF_UNKNOWN 0x0003
3130e8b207eSAndrei Emeltchenko #define L2CAP_CONF_PENDING 0x0004
3145a9e7057SAndrei Emeltchenko #define L2CAP_CONF_EFS_REJECT 0x0005
3151da177e4SLinus Torvalds
31659e54bd1SAndrei Emeltchenko /* configuration req/rsp continuation flag */
31759e54bd1SAndrei Emeltchenko #define L2CAP_CONF_FLAG_CONTINUATION 0x0001
31859e54bd1SAndrei Emeltchenko
3191da177e4SLinus Torvalds struct l2cap_conf_opt {
3201da177e4SLinus Torvalds __u8 type;
3211da177e4SLinus Torvalds __u8 len;
322a7e45454SGustavo A. R. Silva __u8 val[];
32366c853ccSGustavo F. Padovan } __packed;
3241da177e4SLinus Torvalds #define L2CAP_CONF_OPT_SIZE 2
3251da177e4SLinus Torvalds
326589d2746SGustavo F. Padovan #define L2CAP_CONF_HINT 0x80
32747ec1dcdSMarcel Holtmann #define L2CAP_CONF_MASK 0x7f
328589d2746SGustavo F. Padovan
3291da177e4SLinus Torvalds #define L2CAP_CONF_MTU 0x01
3301da177e4SLinus Torvalds #define L2CAP_CONF_FLUSH_TO 0x02
3311da177e4SLinus Torvalds #define L2CAP_CONF_QOS 0x03
3321da177e4SLinus Torvalds #define L2CAP_CONF_RFC 0x04
33347ec1dcdSMarcel Holtmann #define L2CAP_CONF_FCS 0x05
3345a9e7057SAndrei Emeltchenko #define L2CAP_CONF_EFS 0x06
3356327eb98SAndrei Emeltchenko #define L2CAP_CONF_EWS 0x07
3361da177e4SLinus Torvalds
3371da177e4SLinus Torvalds #define L2CAP_CONF_MAX_SIZE 22
3381da177e4SLinus Torvalds
3396464f35fSMarcel Holtmann struct l2cap_conf_rfc {
3406464f35fSMarcel Holtmann __u8 mode;
3416464f35fSMarcel Holtmann __u8 txwin_size;
3426464f35fSMarcel Holtmann __u8 max_transmit;
3436464f35fSMarcel Holtmann __le16 retrans_timeout;
3446464f35fSMarcel Holtmann __le16 monitor_timeout;
3456464f35fSMarcel Holtmann __le16 max_pdu_size;
34666c853ccSGustavo F. Padovan } __packed;
3476464f35fSMarcel Holtmann
3486464f35fSMarcel Holtmann #define L2CAP_MODE_BASIC 0x00
3496464f35fSMarcel Holtmann #define L2CAP_MODE_RETRANS 0x01
3506464f35fSMarcel Holtmann #define L2CAP_MODE_FLOWCTL 0x02
35147ec1dcdSMarcel Holtmann #define L2CAP_MODE_ERTM 0x03
352c6b03cf9SMarcel Holtmann #define L2CAP_MODE_STREAMING 0x04
3536464f35fSMarcel Holtmann
35438319713SJohan Hedberg /* Unlike the above this one doesn't actually map to anything that would
35538319713SJohan Hedberg * ever be sent over the air. Therefore, use a value that's unlikely to
35638319713SJohan Hedberg * ever be used in the BR/EDR configuration phase.
35738319713SJohan Hedberg */
35838319713SJohan Hedberg #define L2CAP_MODE_LE_FLOWCTL 0x80
35914572096SLuiz Augusto von Dentz #define L2CAP_MODE_EXT_FLOWCTL 0x81
36038319713SJohan Hedberg
3615a9e7057SAndrei Emeltchenko struct l2cap_conf_efs {
3625a9e7057SAndrei Emeltchenko __u8 id;
3635a9e7057SAndrei Emeltchenko __u8 stype;
3645a9e7057SAndrei Emeltchenko __le16 msdu;
3655a9e7057SAndrei Emeltchenko __le32 sdu_itime;
3665a9e7057SAndrei Emeltchenko __le32 acc_lat;
3675a9e7057SAndrei Emeltchenko __le32 flush_to;
3685a9e7057SAndrei Emeltchenko } __packed;
3695a9e7057SAndrei Emeltchenko
3708f7975b1SAndrei Emeltchenko #define L2CAP_SERV_NOTRAFIC 0x00
3718f7975b1SAndrei Emeltchenko #define L2CAP_SERV_BESTEFFORT 0x01
3728f7975b1SAndrei Emeltchenko #define L2CAP_SERV_GUARANTEED 0x02
3738f7975b1SAndrei Emeltchenko
3748f7975b1SAndrei Emeltchenko #define L2CAP_BESTEFFORT_ID 0x01
3758f7975b1SAndrei Emeltchenko
3761da177e4SLinus Torvalds struct l2cap_disconn_req {
3778e036fc3SAl Viro __le16 dcid;
3788e036fc3SAl Viro __le16 scid;
37966c853ccSGustavo F. Padovan } __packed;
3801da177e4SLinus Torvalds
3811da177e4SLinus Torvalds struct l2cap_disconn_rsp {
3828e036fc3SAl Viro __le16 dcid;
3838e036fc3SAl Viro __le16 scid;
38466c853ccSGustavo F. Padovan } __packed;
3851da177e4SLinus Torvalds
3861da177e4SLinus Torvalds struct l2cap_info_req {
3878e036fc3SAl Viro __le16 type;
38866c853ccSGustavo F. Padovan } __packed;
3891da177e4SLinus Torvalds
3901da177e4SLinus Torvalds struct l2cap_info_rsp {
3918e036fc3SAl Viro __le16 type;
3928e036fc3SAl Viro __le16 result;
393a7e45454SGustavo A. R. Silva __u8 data[];
39466c853ccSGustavo F. Padovan } __packed;
3951da177e4SLinus Torvalds
39638094c75SMat Martineau #define L2CAP_MR_SUCCESS 0x0000
39738094c75SMat Martineau #define L2CAP_MR_PEND 0x0001
39838094c75SMat Martineau #define L2CAP_MR_BAD_ID 0x0002
39938094c75SMat Martineau #define L2CAP_MR_SAME_ID 0x0003
40038094c75SMat Martineau #define L2CAP_MR_NOT_SUPP 0x0004
40138094c75SMat Martineau #define L2CAP_MR_COLLISION 0x0005
40238094c75SMat Martineau #define L2CAP_MR_NOT_ALLOWED 0x0006
40338094c75SMat Martineau
40438094c75SMat Martineau struct l2cap_move_chan_cfm {
40538094c75SMat Martineau __le16 icid;
40638094c75SMat Martineau __le16 result;
40738094c75SMat Martineau } __packed;
40838094c75SMat Martineau
40938094c75SMat Martineau #define L2CAP_MC_CONFIRMED 0x0000
41038094c75SMat Martineau #define L2CAP_MC_UNCONFIRMED 0x0001
41138094c75SMat Martineau
41238094c75SMat Martineau struct l2cap_move_chan_cfm_rsp {
41338094c75SMat Martineau __le16 icid;
41438094c75SMat Martineau } __packed;
41538094c75SMat Martineau
4161da177e4SLinus Torvalds /* info type */
4171da177e4SLinus Torvalds #define L2CAP_IT_CL_MTU 0x0001
4181da177e4SLinus Torvalds #define L2CAP_IT_FEAT_MASK 0x0002
419e1027a7cSMarcel Holtmann #define L2CAP_IT_FIXED_CHAN 0x0003
4201da177e4SLinus Torvalds
4211da177e4SLinus Torvalds /* info result */
4221da177e4SLinus Torvalds #define L2CAP_IR_SUCCESS 0x0000
4231da177e4SLinus Torvalds #define L2CAP_IR_NOTSUPP 0x0001
4241da177e4SLinus Torvalds
425de73115aSClaudio Takahasi struct l2cap_conn_param_update_req {
426de73115aSClaudio Takahasi __le16 min;
427de73115aSClaudio Takahasi __le16 max;
428de73115aSClaudio Takahasi __le16 latency;
429de73115aSClaudio Takahasi __le16 to_multiplier;
430de73115aSClaudio Takahasi } __packed;
431de73115aSClaudio Takahasi
432de73115aSClaudio Takahasi struct l2cap_conn_param_update_rsp {
433de73115aSClaudio Takahasi __le16 result;
434de73115aSClaudio Takahasi } __packed;
435de73115aSClaudio Takahasi
436de73115aSClaudio Takahasi /* Connection Parameters result */
437de73115aSClaudio Takahasi #define L2CAP_CONN_PARAM_ACCEPTED 0x0000
438de73115aSClaudio Takahasi #define L2CAP_CONN_PARAM_REJECTED 0x0001
439de73115aSClaudio Takahasi
440ee5ec5cfSJohan Hedberg struct l2cap_le_conn_req {
441ee5ec5cfSJohan Hedberg __le16 psm;
442ee5ec5cfSJohan Hedberg __le16 scid;
443ee5ec5cfSJohan Hedberg __le16 mtu;
444ee5ec5cfSJohan Hedberg __le16 mps;
445ee5ec5cfSJohan Hedberg __le16 credits;
446ee5ec5cfSJohan Hedberg } __packed;
447ee5ec5cfSJohan Hedberg
448ee5ec5cfSJohan Hedberg struct l2cap_le_conn_rsp {
449ee5ec5cfSJohan Hedberg __le16 dcid;
450ee5ec5cfSJohan Hedberg __le16 mtu;
451ee5ec5cfSJohan Hedberg __le16 mps;
452ee5ec5cfSJohan Hedberg __le16 credits;
453ee5ec5cfSJohan Hedberg __le16 result;
454ee5ec5cfSJohan Hedberg } __packed;
455ee5ec5cfSJohan Hedberg
456ee5ec5cfSJohan Hedberg struct l2cap_le_credits {
457ee5ec5cfSJohan Hedberg __le16 cid;
458ee5ec5cfSJohan Hedberg __le16 credits;
459ee5ec5cfSJohan Hedberg } __packed;
460ee5ec5cfSJohan Hedberg
46114572096SLuiz Augusto von Dentz #define L2CAP_ECRED_MIN_MTU 64
46214572096SLuiz Augusto von Dentz #define L2CAP_ECRED_MIN_MPS 64
4637cf3b1ddSLuiz Augusto von Dentz #define L2CAP_ECRED_MAX_CID 5
46414572096SLuiz Augusto von Dentz
46514572096SLuiz Augusto von Dentz struct l2cap_ecred_conn_req {
46614572096SLuiz Augusto von Dentz __le16 psm;
46714572096SLuiz Augusto von Dentz __le16 mtu;
46814572096SLuiz Augusto von Dentz __le16 mps;
46914572096SLuiz Augusto von Dentz __le16 credits;
470631512f8SGustavo A. R. Silva __le16 scid[];
47114572096SLuiz Augusto von Dentz } __packed;
47214572096SLuiz Augusto von Dentz
47314572096SLuiz Augusto von Dentz struct l2cap_ecred_conn_rsp {
47414572096SLuiz Augusto von Dentz __le16 mtu;
47514572096SLuiz Augusto von Dentz __le16 mps;
47614572096SLuiz Augusto von Dentz __le16 credits;
47714572096SLuiz Augusto von Dentz __le16 result;
478631512f8SGustavo A. R. Silva __le16 dcid[];
47914572096SLuiz Augusto von Dentz };
48014572096SLuiz Augusto von Dentz
48114572096SLuiz Augusto von Dentz struct l2cap_ecred_reconf_req {
48214572096SLuiz Augusto von Dentz __le16 mtu;
48314572096SLuiz Augusto von Dentz __le16 mps;
484631512f8SGustavo A. R. Silva __le16 scid[];
48514572096SLuiz Augusto von Dentz } __packed;
48614572096SLuiz Augusto von Dentz
48714572096SLuiz Augusto von Dentz #define L2CAP_RECONF_SUCCESS 0x0000
48814572096SLuiz Augusto von Dentz #define L2CAP_RECONF_INVALID_MTU 0x0001
48914572096SLuiz Augusto von Dentz #define L2CAP_RECONF_INVALID_MPS 0x0002
49014572096SLuiz Augusto von Dentz
49114572096SLuiz Augusto von Dentz struct l2cap_ecred_reconf_rsp {
49214572096SLuiz Augusto von Dentz __le16 result;
49314572096SLuiz Augusto von Dentz } __packed;
49414572096SLuiz Augusto von Dentz
49548454079SGustavo F. Padovan /* ----- L2CAP channels and connections ----- */
4963c588192SMat Martineau struct l2cap_seq_list {
4973c588192SMat Martineau __u16 head;
4983c588192SMat Martineau __u16 tail;
4993c588192SMat Martineau __u16 mask;
5003c588192SMat Martineau __u16 *list;
5013c588192SMat Martineau };
5023c588192SMat Martineau
5033c588192SMat Martineau #define L2CAP_SEQ_LIST_CLEAR 0xFFFF
5043c588192SMat Martineau #define L2CAP_SEQ_LIST_TAIL 0x8000
5053c588192SMat Martineau
50648454079SGustavo F. Padovan struct l2cap_chan {
5078c1d787bSGustavo F. Padovan struct l2cap_conn *conn;
508144ad330SSyam Sidhardhan struct kref kref;
509abe84903SJohan Hedberg atomic_t nesting;
5108c1d787bSGustavo F. Padovan
51189bc500eSGustavo F. Padovan __u8 state;
51289bc500eSGustavo F. Padovan
5137eafc59eSMarcel Holtmann bdaddr_t dst;
5144f1654e0SMarcel Holtmann __u8 dst_type;
5157eafc59eSMarcel Holtmann bdaddr_t src;
5164f1654e0SMarcel Holtmann __u8 src_type;
517fe4128e0SGustavo F. Padovan __le16 psm;
5184f1654e0SMarcel Holtmann __le16 sport;
519fe4128e0SGustavo F. Padovan __u16 dcid;
520fe4128e0SGustavo F. Padovan __u16 scid;
5214343478fSGustavo F. Padovan
5220c1bc5c6SGustavo F. Padovan __u16 imtu;
5230c1bc5c6SGustavo F. Padovan __u16 omtu;
5240c1bc5c6SGustavo F. Padovan __u16 flush_to;
5250c1bc5c6SGustavo F. Padovan __u8 mode;
526715ec005SGustavo F. Padovan __u8 chan_type;
5272ea66482SMat Martineau __u8 chan_policy;
5280c1bc5c6SGustavo F. Padovan
5294343478fSGustavo F. Padovan __u8 sec_level;
5304343478fSGustavo F. Padovan
531fc7f8a7eSGustavo F. Padovan __u8 ident;
532fc7f8a7eSGustavo F. Padovan
53373ffa904SGustavo F. Padovan __u8 conf_req[64];
53473ffa904SGustavo F. Padovan __u8 conf_len;
53573ffa904SGustavo F. Padovan __u8 num_conf_req;
53673ffa904SGustavo F. Padovan __u8 num_conf_rsp;
53773ffa904SGustavo F. Padovan
53847d1ec61SGustavo F. Padovan __u8 fcs;
53947d1ec61SGustavo F. Padovan
5406327eb98SAndrei Emeltchenko __u16 tx_win;
541836be934SAndrei Emeltchenko __u16 tx_win_max;
542c20f8e35SMat Martineau __u16 ack_win;
54347d1ec61SGustavo F. Padovan __u8 max_tx;
54447d1ec61SGustavo F. Padovan __u16 retrans_timeout;
54547d1ec61SGustavo F. Padovan __u16 monitor_timeout;
54647d1ec61SGustavo F. Padovan __u16 mps;
54747d1ec61SGustavo F. Padovan
5480cd75f7eSJohan Hedberg __u16 tx_credits;
5490cd75f7eSJohan Hedberg __u16 rx_credits;
5500cd75f7eSJohan Hedberg
551*e2310343SSebastian Urban /* estimated available receive buffer space or -1 if unknown */
552*e2310343SSebastian Urban ssize_t rx_avail;
553*e2310343SSebastian Urban
554d5f7ac38SMat Martineau __u8 tx_state;
555d5f7ac38SMat Martineau __u8 rx_state;
556d5f7ac38SMat Martineau
557c1360a1cSGustavo F. Padovan unsigned long conf_state;
558e2ab4353SGustavo F. Padovan unsigned long conn_state;
559d57b0e8bSAndrei Emeltchenko unsigned long flags;
560525cd185SGustavo F. Padovan
561fb45de7dSAndrei Emeltchenko __u16 next_tx_seq;
562fb45de7dSAndrei Emeltchenko __u16 expected_ack_seq;
563fb45de7dSAndrei Emeltchenko __u16 expected_tx_seq;
5640b209faeSAndrei Emeltchenko __u16 buffer_seq;
565fb45de7dSAndrei Emeltchenko __u16 srej_save_reqseq;
566d5f7ac38SMat Martineau __u16 last_acked_seq;
567fb45de7dSAndrei Emeltchenko __u16 frames_sent;
568fb45de7dSAndrei Emeltchenko __u16 unacked_frames;
5696a026610SGustavo F. Padovan __u8 retry_count;
5706f61fd47SGustavo F. Padovan __u16 sdu_len;
5716f61fd47SGustavo F. Padovan struct sk_buff *sdu;
57284084a31SMat Martineau struct sk_buff *sdu_last_frag;
5736f61fd47SGustavo F. Padovan
5746327eb98SAndrei Emeltchenko __u16 remote_tx_win;
5752c03a7a4SGustavo F. Padovan __u8 remote_max_tx;
5762c03a7a4SGustavo F. Padovan __u16 remote_mps;
57742e5c802SGustavo F. Padovan
5785a9e7057SAndrei Emeltchenko __u8 local_id;
5795a9e7057SAndrei Emeltchenko __u8 local_stype;
5805a9e7057SAndrei Emeltchenko __u16 local_msdu;
5815a9e7057SAndrei Emeltchenko __u32 local_sdu_itime;
5825a9e7057SAndrei Emeltchenko __u32 local_acc_lat;
5835a9e7057SAndrei Emeltchenko __u32 local_flush_to;
5845a9e7057SAndrei Emeltchenko
5855a9e7057SAndrei Emeltchenko __u8 remote_id;
5865a9e7057SAndrei Emeltchenko __u8 remote_stype;
5875a9e7057SAndrei Emeltchenko __u16 remote_msdu;
5885a9e7057SAndrei Emeltchenko __u32 remote_sdu_itime;
5895a9e7057SAndrei Emeltchenko __u32 remote_acc_lat;
5905a9e7057SAndrei Emeltchenko __u32 remote_flush_to;
5915a9e7057SAndrei Emeltchenko
592721c4181SGustavo F. Padovan struct delayed_work chan_timer;
593721c4181SGustavo F. Padovan struct delayed_work retrans_timer;
594721c4181SGustavo F. Padovan struct delayed_work monitor_timer;
595721c4181SGustavo F. Padovan struct delayed_work ack_timer;
596721c4181SGustavo F. Padovan
59758d35f87SGustavo F. Padovan struct sk_buff *tx_send_head;
59858d35f87SGustavo F. Padovan struct sk_buff_head tx_q;
599f1c6775bSGustavo F. Padovan struct sk_buff_head srej_q;
6003c588192SMat Martineau struct l2cap_seq_list srej_list;
6013c588192SMat Martineau struct l2cap_seq_list retrans_list;
602e92c8e70SGustavo F. Padovan
603baa7e1faSGustavo F. Padovan struct list_head list;
60423691d75SGustavo F. Padovan struct list_head global_l;
60580808e43SGustavo F. Padovan
60680808e43SGustavo F. Padovan void *data;
60767f86a45SMarcel Holtmann const struct l2cap_ops *ops;
608c03b355eSAndrei Emeltchenko struct mutex lock;
60980808e43SGustavo F. Padovan };
61080808e43SGustavo F. Padovan
61180808e43SGustavo F. Padovan struct l2cap_ops {
61280808e43SGustavo F. Padovan char *name;
61380808e43SGustavo F. Padovan
61480b98027SGustavo Padovan struct l2cap_chan *(*new_connection) (struct l2cap_chan *chan);
61580b98027SGustavo Padovan int (*recv) (struct l2cap_chan * chan,
61680b98027SGustavo Padovan struct sk_buff *skb);
617c0df7f6eSAndrei Emeltchenko void (*teardown) (struct l2cap_chan *chan, int err);
61880b98027SGustavo Padovan void (*close) (struct l2cap_chan *chan);
61980b98027SGustavo Padovan void (*state_change) (struct l2cap_chan *chan,
62053f52121SGustavo Padovan int state, int err);
62154a59aa2SAndrei Emeltchenko void (*ready) (struct l2cap_chan *chan);
6222dc4e510SGustavo Padovan void (*defer) (struct l2cap_chan *chan);
623d97c899bSMarcel Holtmann void (*resume) (struct l2cap_chan *chan);
624837776f7SJohan Hedberg void (*suspend) (struct l2cap_chan *chan);
6255ec1bbe5SGustavo Padovan void (*set_shutdown) (struct l2cap_chan *chan);
6268d836d71SGustavo Padovan long (*get_sndtimeo) (struct l2cap_chan *chan);
627b48596d1SLuiz Augusto von Dentz struct pid *(*get_peer_pid) (struct l2cap_chan *chan);
6282f7719ceSAndrei Emeltchenko struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
629d9fbd02bSMarcel Holtmann unsigned long hdr_len,
63090338947SGustavo Padovan unsigned long len, int nb);
631f1942564SLuiz Augusto von Dentz int (*filter) (struct l2cap_chan * chan,
632f1942564SLuiz Augusto von Dentz struct sk_buff *skb);
6331da177e4SLinus Torvalds };
6341da177e4SLinus Torvalds
6351da177e4SLinus Torvalds struct l2cap_conn {
6361da177e4SLinus Torvalds struct hci_conn *hcon;
63773d80debSLuiz Augusto von Dentz struct hci_chan *hchan;
6381da177e4SLinus Torvalds
6391da177e4SLinus Torvalds unsigned int mtu;
6401da177e4SLinus Torvalds
6414e8402a3SMarcel Holtmann __u32 feat_mask;
6420bd49fc7SJohan Hedberg __u8 remote_fixed_chan;
6430bd49fc7SJohan Hedberg __u8 local_fixed_chan;
6444e8402a3SMarcel Holtmann
6454e8402a3SMarcel Holtmann __u8 info_state;
6464e8402a3SMarcel Holtmann __u8 info_ident;
6474e8402a3SMarcel Holtmann
648030013d8SGustavo F. Padovan struct delayed_work info_timer;
6494e8402a3SMarcel Holtmann
6501da177e4SLinus Torvalds struct sk_buff *rx_skb;
6511da177e4SLinus Torvalds __u32 rx_len;
6521da177e4SLinus Torvalds __u8 tx_ident;
6535a54e7c8SMarcel Holtmann struct mutex ident_lock;
6541da177e4SLinus Torvalds
65561a939c6SJohan Hedberg struct sk_buff_head pending_rx;
65661a939c6SJohan Hedberg struct work_struct pending_rx_work;
65761a939c6SJohan Hedberg
658b8b23001SLuiz Augusto von Dentz struct delayed_work id_addr_timer;
659f3d82d0cSJohan Hedberg
6602950f21aSMarcel Holtmann __u8 disc_reason;
6612950f21aSMarcel Holtmann
66270db83c4SJohan Hedberg struct l2cap_chan *smp;
6635d3de7dfSVinicius Costa Gomes
664baa7e1faSGustavo F. Padovan struct list_head chan_l;
665d01b2ff4SGustavo F. Padovan struct mutex chan_lock;
6669c903e37SDavid Herrmann struct kref ref;
6672c8e1411SDavid Herrmann struct list_head users;
6682c8e1411SDavid Herrmann };
6692c8e1411SDavid Herrmann
6702c8e1411SDavid Herrmann struct l2cap_user {
6712c8e1411SDavid Herrmann struct list_head list;
6722c8e1411SDavid Herrmann int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user);
6732c8e1411SDavid Herrmann void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user);
6741da177e4SLinus Torvalds };
6751da177e4SLinus Torvalds
6764e8402a3SMarcel Holtmann #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
677984947dcSMarcel Holtmann #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
678984947dcSMarcel Holtmann #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
6794e8402a3SMarcel Holtmann
680715ec005SGustavo F. Padovan #define L2CAP_CHAN_RAW 1
681715ec005SGustavo F. Padovan #define L2CAP_CHAN_CONN_LESS 2
682715ec005SGustavo F. Padovan #define L2CAP_CHAN_CONN_ORIENTED 3
6832338a7e0SJohan Hedberg #define L2CAP_CHAN_FIXED 4
684715ec005SGustavo F. Padovan
68548454079SGustavo F. Padovan /* ----- L2CAP socket info ----- */
6861da177e4SLinus Torvalds #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
6871da177e4SLinus Torvalds
688*e2310343SSebastian Urban struct l2cap_rx_busy {
689*e2310343SSebastian Urban struct list_head list;
690*e2310343SSebastian Urban struct sk_buff *skb;
691*e2310343SSebastian Urban };
692*e2310343SSebastian Urban
6931da177e4SLinus Torvalds struct l2cap_pinfo {
6941da177e4SLinus Torvalds struct bt_sock bt;
69548454079SGustavo F. Padovan struct l2cap_chan *chan;
696*e2310343SSebastian Urban struct list_head rx_busy;
6971da177e4SLinus Torvalds };
6981da177e4SLinus Torvalds
699c1360a1cSGustavo F. Padovan enum {
700c1360a1cSGustavo F. Padovan CONF_REQ_SENT,
701c1360a1cSGustavo F. Padovan CONF_INPUT_DONE,
702c1360a1cSGustavo F. Padovan CONF_OUTPUT_DONE,
703c1360a1cSGustavo F. Padovan CONF_MTU_DONE,
704c1360a1cSGustavo F. Padovan CONF_MODE_DONE,
705c1360a1cSGustavo F. Padovan CONF_CONNECT_PEND,
706f2592d3eSAndrei Emeltchenko CONF_RECV_NO_FCS,
707c1360a1cSGustavo F. Padovan CONF_STATE2_DEVICE,
7086327eb98SAndrei Emeltchenko CONF_EWS_RECV,
7090e8b207eSAndrei Emeltchenko CONF_LOC_CONF_PEND,
7100e8b207eSAndrei Emeltchenko CONF_REM_CONF_PEND,
7112827011fSMat Martineau CONF_NOT_COMPLETE,
712c1360a1cSGustavo F. Padovan };
713861d6882SMarcel Holtmann
714f2fcfcd6SGustavo F. Padovan #define L2CAP_CONF_MAX_CONF_REQ 2
715f2fcfcd6SGustavo F. Padovan #define L2CAP_CONF_MAX_CONF_RSP 2
716f2fcfcd6SGustavo F. Padovan
717e2ab4353SGustavo F. Padovan enum {
718e2ab4353SGustavo F. Padovan CONN_SREJ_SENT,
719e2ab4353SGustavo F. Padovan CONN_WAIT_F,
720e2ab4353SGustavo F. Padovan CONN_SREJ_ACT,
721e2ab4353SGustavo F. Padovan CONN_SEND_PBIT,
722e2ab4353SGustavo F. Padovan CONN_REMOTE_BUSY,
723e2ab4353SGustavo F. Padovan CONN_LOCAL_BUSY,
724e2ab4353SGustavo F. Padovan CONN_REJ_ACT,
725e2ab4353SGustavo F. Padovan CONN_SEND_FBIT,
726e2ab4353SGustavo F. Padovan CONN_RNR_SENT,
727e2ab4353SGustavo F. Padovan };
728e90bac06SGustavo F. Padovan
729d57b0e8bSAndrei Emeltchenko /* Definitions for flags in l2cap_chan */
730d57b0e8bSAndrei Emeltchenko enum {
73143bd0f32SAndrei Emeltchenko FLAG_ROLE_SWITCH,
73215770b1aSAndrei Emeltchenko FLAG_FORCE_ACTIVE,
733ecf61bdbSAndrei Emeltchenko FLAG_FORCE_RELIABLE,
734d57b0e8bSAndrei Emeltchenko FLAG_FLUSHABLE,
7356327eb98SAndrei Emeltchenko FLAG_EXT_CTRL,
7365a9e7057SAndrei Emeltchenko FLAG_EFS_ENABLE,
737bdc25783SMarcel Holtmann FLAG_DEFER_SETUP,
738595177f3SJohan Hedberg FLAG_LE_CONN_REQ_SENT,
73914572096SLuiz Augusto von Dentz FLAG_ECRED_CONN_REQ_SENT,
740d52deb17SJohan Hedberg FLAG_PENDING_SECURITY,
741c16900cfSJohan Hedberg FLAG_HOLD_HCI_CONN,
742d57b0e8bSAndrei Emeltchenko };
743d57b0e8bSAndrei Emeltchenko
744abe84903SJohan Hedberg /* Lock nesting levels for L2CAP channels. We need these because lockdep
745abe84903SJohan Hedberg * otherwise considers all channels equal and will e.g. complain about a
746abe84903SJohan Hedberg * connection oriented channel triggering SMP procedures or a listening
747abe84903SJohan Hedberg * channel creating and locking a child channel.
748abe84903SJohan Hedberg */
749abe84903SJohan Hedberg enum {
750abe84903SJohan Hedberg L2CAP_NESTING_SMP,
751abe84903SJohan Hedberg L2CAP_NESTING_NORMAL,
752abe84903SJohan Hedberg L2CAP_NESTING_PARENT,
753abe84903SJohan Hedberg };
754abe84903SJohan Hedberg
755d5f7ac38SMat Martineau enum {
756d5f7ac38SMat Martineau L2CAP_TX_STATE_XMIT,
757d5f7ac38SMat Martineau L2CAP_TX_STATE_WAIT_F,
758d5f7ac38SMat Martineau };
759d5f7ac38SMat Martineau
760d5f7ac38SMat Martineau enum {
761d5f7ac38SMat Martineau L2CAP_RX_STATE_RECV,
762d5f7ac38SMat Martineau L2CAP_RX_STATE_SREJ_SENT,
76308333283SMat Martineau L2CAP_RX_STATE_MOVE,
76408333283SMat Martineau L2CAP_RX_STATE_WAIT_P,
76508333283SMat Martineau L2CAP_RX_STATE_WAIT_F,
766d5f7ac38SMat Martineau };
767d5f7ac38SMat Martineau
768d5f7ac38SMat Martineau enum {
769d5f7ac38SMat Martineau L2CAP_TXSEQ_EXPECTED,
770d5f7ac38SMat Martineau L2CAP_TXSEQ_EXPECTED_SREJ,
771d5f7ac38SMat Martineau L2CAP_TXSEQ_UNEXPECTED,
772d5f7ac38SMat Martineau L2CAP_TXSEQ_UNEXPECTED_SREJ,
773d5f7ac38SMat Martineau L2CAP_TXSEQ_DUPLICATE,
774d5f7ac38SMat Martineau L2CAP_TXSEQ_DUPLICATE_SREJ,
775d5f7ac38SMat Martineau L2CAP_TXSEQ_INVALID,
776d5f7ac38SMat Martineau L2CAP_TXSEQ_INVALID_IGNORE,
777d5f7ac38SMat Martineau };
778d5f7ac38SMat Martineau
779d5f7ac38SMat Martineau enum {
780d5f7ac38SMat Martineau L2CAP_EV_DATA_REQUEST,
781d5f7ac38SMat Martineau L2CAP_EV_LOCAL_BUSY_DETECTED,
782d5f7ac38SMat Martineau L2CAP_EV_LOCAL_BUSY_CLEAR,
783d5f7ac38SMat Martineau L2CAP_EV_RECV_REQSEQ_AND_FBIT,
784d5f7ac38SMat Martineau L2CAP_EV_RECV_FBIT,
785d5f7ac38SMat Martineau L2CAP_EV_RETRANS_TO,
786d5f7ac38SMat Martineau L2CAP_EV_MONITOR_TO,
787d5f7ac38SMat Martineau L2CAP_EV_EXPLICIT_POLL,
788d5f7ac38SMat Martineau L2CAP_EV_RECV_IFRAME,
789d5f7ac38SMat Martineau L2CAP_EV_RECV_RR,
790d5f7ac38SMat Martineau L2CAP_EV_RECV_REJ,
791d5f7ac38SMat Martineau L2CAP_EV_RECV_RNR,
792d5f7ac38SMat Martineau L2CAP_EV_RECV_SREJ,
793d5f7ac38SMat Martineau L2CAP_EV_RECV_FRAME,
794d5f7ac38SMat Martineau };
795d5f7ac38SMat Martineau
79608333283SMat Martineau enum {
79708333283SMat Martineau L2CAP_MOVE_ROLE_NONE,
79808333283SMat Martineau L2CAP_MOVE_ROLE_INITIATOR,
79908333283SMat Martineau L2CAP_MOVE_ROLE_RESPONDER,
80008333283SMat Martineau };
80108333283SMat Martineau
80208333283SMat Martineau enum {
80308333283SMat Martineau L2CAP_MOVE_STABLE,
80408333283SMat Martineau L2CAP_MOVE_WAIT_REQ,
80508333283SMat Martineau L2CAP_MOVE_WAIT_RSP,
80608333283SMat Martineau L2CAP_MOVE_WAIT_RSP_SUCCESS,
80708333283SMat Martineau L2CAP_MOVE_WAIT_CONFIRM,
80808333283SMat Martineau L2CAP_MOVE_WAIT_CONFIRM_RSP,
80908333283SMat Martineau L2CAP_MOVE_WAIT_LOGICAL_COMP,
81008333283SMat Martineau L2CAP_MOVE_WAIT_LOGICAL_CFM,
81108333283SMat Martineau L2CAP_MOVE_WAIT_LOCAL_BUSY,
81208333283SMat Martineau L2CAP_MOVE_WAIT_PREPARE,
81308333283SMat Martineau };
81408333283SMat Martineau
81530648372SJaganath Kanakkassery void l2cap_chan_hold(struct l2cap_chan *c);
816d0be8347SLuiz Augusto von Dentz struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c);
81730648372SJaganath Kanakkassery void l2cap_chan_put(struct l2cap_chan *c);
818371fd835SUlisses Furquim
l2cap_chan_lock(struct l2cap_chan * chan)819c03b355eSAndrei Emeltchenko static inline void l2cap_chan_lock(struct l2cap_chan *chan)
820c03b355eSAndrei Emeltchenko {
821abe84903SJohan Hedberg mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting));
822c03b355eSAndrei Emeltchenko }
823c03b355eSAndrei Emeltchenko
l2cap_chan_unlock(struct l2cap_chan * chan)824c03b355eSAndrei Emeltchenko static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
825c03b355eSAndrei Emeltchenko {
826c03b355eSAndrei Emeltchenko mutex_unlock(&chan->lock);
827c03b355eSAndrei Emeltchenko }
828c03b355eSAndrei Emeltchenko
l2cap_set_timer(struct l2cap_chan * chan,struct delayed_work * work,long timeout)829c2ec9c1bSGustavo F. Padovan static inline void l2cap_set_timer(struct l2cap_chan *chan,
830c2ec9c1bSGustavo F. Padovan struct delayed_work *work, long timeout)
831c2ec9c1bSGustavo F. Padovan {
832e05dcc32SAndrei Emeltchenko BT_DBG("chan %p state %s timeout %ld", chan,
833e05dcc32SAndrei Emeltchenko state_to_string(chan->state), timeout);
834c2ec9c1bSGustavo F. Padovan
8356f74b6f3SAndrei Emeltchenko /* If delayed work cancelled do not hold(chan)
8366f74b6f3SAndrei Emeltchenko since it is already done with previous set_timer */
83717cd3f37SUlisses Furquim if (!cancel_delayed_work(work))
838371fd835SUlisses Furquim l2cap_chan_hold(chan);
8396f74b6f3SAndrei Emeltchenko
840c2ec9c1bSGustavo F. Padovan schedule_delayed_work(work, timeout);
841c2ec9c1bSGustavo F. Padovan }
842c2ec9c1bSGustavo F. Padovan
l2cap_clear_timer(struct l2cap_chan * chan,struct delayed_work * work)84375b93b59SSzymon Janc static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
844371fd835SUlisses Furquim struct delayed_work *work)
845c2ec9c1bSGustavo F. Padovan {
84675b93b59SSzymon Janc bool ret;
84775b93b59SSzymon Janc
8486f74b6f3SAndrei Emeltchenko /* put(chan) if delayed work cancelled otherwise it
8496f74b6f3SAndrei Emeltchenko is done in delayed work function */
85017cd3f37SUlisses Furquim ret = cancel_delayed_work(work);
85175b93b59SSzymon Janc if (ret)
852371fd835SUlisses Furquim l2cap_chan_put(chan);
85375b93b59SSzymon Janc
85475b93b59SSzymon Janc return ret;
855c2ec9c1bSGustavo F. Padovan }
856c2ec9c1bSGustavo F. Padovan
857c9b66675SGustavo F. Padovan #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
858c9b66675SGustavo F. Padovan #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
8591a09bcb9SGustavo F. Padovan #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
8601a09bcb9SGustavo F. Padovan #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
8611a09bcb9SGustavo F. Padovan #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
862b83ddfe2SAndrzej Kaczmarek msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
8631a09bcb9SGustavo F. Padovan #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
864c74e560cSGustavo F. Padovan
__seq_offset(struct l2cap_chan * chan,__u16 seq1,__u16 seq2)865836be934SAndrei Emeltchenko static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
866836be934SAndrei Emeltchenko {
8675a364bd3SMat Martineau if (seq1 >= seq2)
8685a364bd3SMat Martineau return seq1 - seq2;
8695a364bd3SMat Martineau else
8705a364bd3SMat Martineau return chan->tx_win_max + 1 - seq2 + seq1;
871836be934SAndrei Emeltchenko }
872836be934SAndrei Emeltchenko
__next_seq(struct l2cap_chan * chan,__u16 seq)873836be934SAndrei Emeltchenko static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
874836be934SAndrei Emeltchenko {
875836be934SAndrei Emeltchenko return (seq + 1) % (chan->tx_win_max + 1);
876836be934SAndrei Emeltchenko }
877836be934SAndrei Emeltchenko
l2cap_chan_no_new_connection(struct l2cap_chan * chan)8787e1af8a3SGustavo Padovan static inline struct l2cap_chan *l2cap_chan_no_new_connection(struct l2cap_chan *chan)
8797e1af8a3SGustavo Padovan {
8807e1af8a3SGustavo Padovan return NULL;
8817e1af8a3SGustavo Padovan }
8827e1af8a3SGustavo Padovan
l2cap_chan_no_recv(struct l2cap_chan * chan,struct sk_buff * skb)883f193844cSJohan Hedberg static inline int l2cap_chan_no_recv(struct l2cap_chan *chan, struct sk_buff *skb)
884f193844cSJohan Hedberg {
885f193844cSJohan Hedberg return -ENOSYS;
886f193844cSJohan Hedberg }
887f193844cSJohan Hedberg
l2cap_chan_no_alloc_skb(struct l2cap_chan * chan,unsigned long hdr_len,unsigned long len,int nb)888f193844cSJohan Hedberg static inline struct sk_buff *l2cap_chan_no_alloc_skb(struct l2cap_chan *chan,
889f193844cSJohan Hedberg unsigned long hdr_len,
890f193844cSJohan Hedberg unsigned long len, int nb)
891f193844cSJohan Hedberg {
892f193844cSJohan Hedberg return ERR_PTR(-ENOSYS);
893f193844cSJohan Hedberg }
894f193844cSJohan Hedberg
l2cap_chan_no_teardown(struct l2cap_chan * chan,int err)8957e1af8a3SGustavo Padovan static inline void l2cap_chan_no_teardown(struct l2cap_chan *chan, int err)
8967e1af8a3SGustavo Padovan {
8977e1af8a3SGustavo Padovan }
8987e1af8a3SGustavo Padovan
l2cap_chan_no_close(struct l2cap_chan * chan)899f193844cSJohan Hedberg static inline void l2cap_chan_no_close(struct l2cap_chan *chan)
900f193844cSJohan Hedberg {
901f193844cSJohan Hedberg }
902f193844cSJohan Hedberg
l2cap_chan_no_ready(struct l2cap_chan * chan)9037e1af8a3SGustavo Padovan static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
9047e1af8a3SGustavo Padovan {
9057e1af8a3SGustavo Padovan }
9061da177e4SLinus Torvalds
l2cap_chan_no_state_change(struct l2cap_chan * chan,int state,int err)907f193844cSJohan Hedberg static inline void l2cap_chan_no_state_change(struct l2cap_chan *chan,
908f193844cSJohan Hedberg int state, int err)
909f193844cSJohan Hedberg {
910f193844cSJohan Hedberg }
911f193844cSJohan Hedberg
l2cap_chan_no_defer(struct l2cap_chan * chan)9122dc4e510SGustavo Padovan static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
9132dc4e510SGustavo Padovan {
9142dc4e510SGustavo Padovan }
9152dc4e510SGustavo Padovan
l2cap_chan_no_suspend(struct l2cap_chan * chan)916f193844cSJohan Hedberg static inline void l2cap_chan_no_suspend(struct l2cap_chan *chan)
917f193844cSJohan Hedberg {
918f193844cSJohan Hedberg }
919f193844cSJohan Hedberg
l2cap_chan_no_resume(struct l2cap_chan * chan)9202ce5fb51SMarcel Holtmann static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
9212ce5fb51SMarcel Holtmann {
9222ce5fb51SMarcel Holtmann }
9232ce5fb51SMarcel Holtmann
l2cap_chan_no_set_shutdown(struct l2cap_chan * chan)9245ec1bbe5SGustavo Padovan static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
9255ec1bbe5SGustavo Padovan {
9265ec1bbe5SGustavo Padovan }
9275ec1bbe5SGustavo Padovan
l2cap_chan_no_get_sndtimeo(struct l2cap_chan * chan)9288d836d71SGustavo Padovan static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
9298d836d71SGustavo Padovan {
9308d836d71SGustavo Padovan return 0;
9318d836d71SGustavo Padovan }
9328d836d71SGustavo Padovan
933eb939922SRusty Russell extern bool disable_ertm;
9344be5ca67SLuiz Augusto von Dentz extern bool enable_ecred;
935bb58f747SGustavo F. Padovan
936bb58f747SGustavo F. Padovan int l2cap_init_sockets(void);
937bb58f747SGustavo F. Padovan void l2cap_cleanup_sockets(void);
938b3916db3SDavid Herrmann bool l2cap_is_socket(struct socket *sock);
939bb58f747SGustavo F. Padovan
94027e2d4c8SJohan Hedberg void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan);
94115f02b91SLuiz Augusto von Dentz void __l2cap_ecred_conn_rsp_defer(struct l2cap_chan *chan);
9428c1d787bSGustavo F. Padovan void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
94368983259SGustavo F. Padovan
9449e4425ffSGustavo F. Padovan int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
9459e4425ffSGustavo F. Padovan int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
9469e4425ffSGustavo F. Padovan
947eef1d9b6SGustavo Padovan struct l2cap_chan *l2cap_chan_create(void);
9480f852724SGustavo F. Padovan void l2cap_chan_close(struct l2cap_chan *chan, int reason);
949cbe8fed4SJohan Hedberg int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
9508e9f9892SAndre Guedes bdaddr_t *dst, u8 dst_type);
95115f02b91SLuiz Augusto von Dentz int l2cap_chan_reconfigure(struct l2cap_chan *chan, __u16 mtu);
9528d46321cSMarcel Holtmann int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
953e328140fSMat Martineau void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
954*e2310343SSebastian Urban void l2cap_chan_rx_avail(struct l2cap_chan *chan, ssize_t rx_avail);
955e7cafc45SJohan Hedberg int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator);
956bd4b1653SAndrei Emeltchenko void l2cap_chan_set_defaults(struct l2cap_chan *chan);
957466f8004SAndrei Emeltchenko int l2cap_ertm_init(struct l2cap_chan *chan);
958466f8004SAndrei Emeltchenko void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
95993c3e8f5SAndrei Emeltchenko void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
960da49b602SLuiz Augusto von Dentz typedef void (*l2cap_chan_func_t)(struct l2cap_chan *chan, void *data);
961da49b602SLuiz Augusto von Dentz void l2cap_chan_list(struct l2cap_conn *conn, l2cap_chan_func_t func,
962da49b602SLuiz Augusto von Dentz void *data);
963466f8004SAndrei Emeltchenko void l2cap_chan_del(struct l2cap_chan *chan, int err);
9642766be48SAndrei Emeltchenko void l2cap_send_conn_req(struct l2cap_chan *chan);
9653f7a56c4SMat Martineau void l2cap_move_start(struct l2cap_chan *chan);
96627695fb4SAndrei Emeltchenko void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
96727695fb4SAndrei Emeltchenko u8 status);
968a514b17fSAndrei Emeltchenko void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
969bb58f747SGustavo F. Padovan
97051bb8457SJohan Hedberg struct l2cap_conn *l2cap_conn_get(struct l2cap_conn *conn);
9719c903e37SDavid Herrmann void l2cap_conn_put(struct l2cap_conn *conn);
9729c903e37SDavid Herrmann
9732c8e1411SDavid Herrmann int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
9742c8e1411SDavid Herrmann void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
9752c8e1411SDavid Herrmann
9761da177e4SLinus Torvalds #endif /* __L2CAP_H */
977