| 1 |
|
| 2 | |
| 3 | BlueZ - Bluetooth protocol stack for Linux
|
| 4 | Copyright (C) 2000-2001 Qualcomm Incorporated
|
| 5 | Copyright (C) 2009-2010 Gustavo F. Padovan <[email protected]>
|
| 6 | Copyright (C) 2010 Google Inc.
|
| 7 |
|
| 8 | Written 2000,2001 by Maxim Krasnyansky <[email protected]>
|
| 9 |
|
| 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
| 13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
|
| 14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
|
| 15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
| 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 18 |
|
| 19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
|
| 20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
|
| 21 | SOFTWARE IS DISCLAIMED.
|
| 22 |
|
| 23 |
|
| 24 | #ifndef __L2CAP_H
|
| 25 | #define __L2CAP_H
|
| 26 |
|
| 27 | #include <linux/unaligned.h>
|
| 28 | #include <linux/atomic.h>
|
| 29 |
|
| 30 |
|
| 31 | #define L2CAP_DEFAULT_MTU 672
|
| 32 | #define L2CAP_DEFAULT_MIN_MTU 48
|
| 33 | #define L2CAP_SIG_MTU 48
|
| 34 | #define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
|
| 35 | #define L2CAP_EFS_DEFAULT_FLUSH_TO 0xFFFFFFFF
|
| 36 | #define L2CAP_DEFAULT_TX_WINDOW 63
|
| 37 | #define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
|
| 38 | #define L2CAP_DEFAULT_MAX_TX 3
|
| 39 | #define L2CAP_DEFAULT_RETRANS_TO 2000
|
| 40 | #define L2CAP_DEFAULT_MONITOR_TO 12000
|
| 41 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1492
|
| 42 | #define L2CAP_DEFAULT_ACK_TO 200
|
| 43 | #define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
|
| 44 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
|
| 45 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
|
| 46 | #define L2CAP_BREDR_MAX_PAYLOAD 1019
|
| 47 | #define L2CAP_LE_MIN_MTU 23
|
| 48 | #define L2CAP_ECRED_CONN_SCID_MAX 5
|
| 49 |
|
| 50 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
|
| 51 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
|
| 52 | #define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
|
| 53 | #define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
|
| 54 | #define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
|
| 55 | #define L2CAP_MOVE_TIMEOUT msecs_to_jiffies(4000)
|
| 56 | #define L2CAP_MOVE_ERTX_TIMEOUT msecs_to_jiffies(60000)
|
| 57 | #define L2CAP_WAIT_ACK_POLL_PERIOD msecs_to_jiffies(200)
|
| 58 | #define L2CAP_WAIT_ACK_TIMEOUT msecs_to_jiffies(10000)
|
| 59 |
|
| 60 |
|
| 61 | struct sockaddr_l2 {
|
| 62 | sa_family_t l2_family;
|
| 63 | __le16 l2_psm;
|
| 64 | bdaddr_t l2_bdaddr;
|
| 65 | __le16 l2_cid;
|
| 66 | __u8 l2_bdaddr_type;
|
| 67 | };
|
| 68 |
|
| 69 |
|
| 70 | #define L2CAP_OPTIONS 0x01
|
| 71 | struct l2cap_options {
|
| 72 | __u16 omtu;
|
| 73 | __u16 imtu;
|
| 74 | __u16 flush_to;
|
| 75 | __u8 mode;
|
| 76 | __u8 fcs;
|
| 77 | __u8 max_tx;
|
| 78 | __u16 txwin_size;
|
| 79 | };
|
| 80 |
|
| 81 | #define L2CAP_CONNINFO 0x02
|
| 82 | struct l2cap_conninfo {
|
| 83 | __u16 hci_handle;
|
| 84 | __u8 dev_class[3];
|
| 85 | };
|
| 86 |
|
| 87 | #define L2CAP_LM 0x03
|
| 88 | #define L2CAP_LM_MASTER 0x0001
|
| 89 | #define L2CAP_LM_AUTH 0x0002
|
| 90 | #define L2CAP_LM_ENCRYPT 0x0004
|
| 91 | #define L2CAP_LM_TRUSTED 0x0008
|
| 92 | #define L2CAP_LM_RELIABLE 0x0010
|
| 93 | #define L2CAP_LM_SECURE 0x0020
|
| 94 | #define L2CAP_LM_FIPS 0x0040
|
| 95 |
|
| 96 |
|
| 97 | #define L2CAP_COMMAND_REJ 0x01
|
| 98 | #define L2CAP_CONN_REQ 0x02
|
| 99 | #define L2CAP_CONN_RSP 0x03
|
| 100 | #define L2CAP_CONF_REQ 0x04
|
| 101 | #define L2CAP_CONF_RSP 0x05
|
| 102 | #define L2CAP_DISCONN_REQ 0x06
|
| 103 | #define L2CAP_DISCONN_RSP 0x07
|
| 104 | #define L2CAP_ECHO_REQ 0x08
|
| 105 | #define L2CAP_ECHO_RSP 0x09
|
| 106 | #define L2CAP_INFO_REQ 0x0a
|
| 107 | #define L2CAP_INFO_RSP 0x0b
|
| 108 | #define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
|
| 109 | #define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
|
| 110 | #define L2CAP_LE_CONN_REQ 0x14
|
| 111 | #define L2CAP_LE_CONN_RSP 0x15
|
| 112 | #define L2CAP_LE_CREDITS 0x16
|
| 113 | #define L2CAP_ECRED_CONN_REQ 0x17
|
| 114 | #define L2CAP_ECRED_CONN_RSP 0x18
|
| 115 | #define L2CAP_ECRED_RECONF_REQ 0x19
|
| 116 | #define L2CAP_ECRED_RECONF_RSP 0x1a
|
| 117 |
|
| 118 |
|
| 119 | #define L2CAP_FEAT_FLOWCTL 0x00000001
|
| 120 | #define L2CAP_FEAT_RETRANS 0x00000002
|
| 121 | #define L2CAP_FEAT_BIDIR_QOS 0x00000004
|
| 122 | #define L2CAP_FEAT_ERTM 0x00000008
|
| 123 | #define L2CAP_FEAT_STREAMING 0x00000010
|
| 124 | #define L2CAP_FEAT_FCS 0x00000020
|
| 125 | #define L2CAP_FEAT_EXT_FLOW 0x00000040
|
| 126 | #define L2CAP_FEAT_FIXED_CHAN 0x00000080
|
| 127 | #define L2CAP_FEAT_EXT_WINDOW 0x00000100
|
| 128 | #define L2CAP_FEAT_UCD 0x00000200
|
| 129 |
|
| 130 |
|
| 131 | #define L2CAP_FCS_NONE 0x00
|
| 132 | #define L2CAP_FCS_CRC16 0x01
|
| 133 |
|
| 134 |
|
| 135 | #define L2CAP_FC_SIG_BREDR 0x02
|
| 136 | #define L2CAP_FC_CONNLESS 0x04
|
| 137 | #define L2CAP_FC_ATT 0x10
|
| 138 | #define L2CAP_FC_SIG_LE 0x20
|
| 139 | #define L2CAP_FC_SMP_LE 0x40
|
| 140 | #define L2CAP_FC_SMP_BREDR 0x80
|
| 141 |
|
| 142 |
|
| 143 | #define L2CAP_CTRL_SAR 0xC000
|
| 144 | #define L2CAP_CTRL_REQSEQ 0x3F00
|
| 145 | #define L2CAP_CTRL_TXSEQ 0x007E
|
| 146 | #define L2CAP_CTRL_SUPERVISE 0x000C
|
| 147 |
|
| 148 | #define L2CAP_CTRL_RETRANS 0x0080
|
| 149 | #define L2CAP_CTRL_FINAL 0x0080
|
| 150 | #define L2CAP_CTRL_POLL 0x0010
|
| 151 | #define L2CAP_CTRL_FRAME_TYPE 0x0001
|
| 152 |
|
| 153 | #define L2CAP_CTRL_TXSEQ_SHIFT 1
|
| 154 | #define L2CAP_CTRL_SUPER_SHIFT 2
|
| 155 | #define L2CAP_CTRL_POLL_SHIFT 4
|
| 156 | #define L2CAP_CTRL_FINAL_SHIFT 7
|
| 157 | #define L2CAP_CTRL_REQSEQ_SHIFT 8
|
| 158 | #define L2CAP_CTRL_SAR_SHIFT 14
|
| 159 |
|
| 160 |
|
| 161 | #define L2CAP_EXT_CTRL_TXSEQ 0xFFFC0000
|
| 162 | #define L2CAP_EXT_CTRL_SAR 0x00030000
|
| 163 | #define L2CAP_EXT_CTRL_SUPERVISE 0x00030000
|
| 164 | #define L2CAP_EXT_CTRL_REQSEQ 0x0000FFFC
|
| 165 |
|
| 166 | #define L2CAP_EXT_CTRL_POLL 0x00040000
|
| 167 | #define L2CAP_EXT_CTRL_FINAL 0x00000002
|
| 168 | #define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001
|
| 169 |
|
| 170 | #define L2CAP_EXT_CTRL_FINAL_SHIFT 1
|
| 171 | #define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
|
| 172 | #define L2CAP_EXT_CTRL_SAR_SHIFT 16
|
| 173 | #define L2CAP_EXT_CTRL_SUPER_SHIFT 16
|
| 174 | #define L2CAP_EXT_CTRL_POLL_SHIFT 18
|
| 175 | #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
|
| 176 |
|
| 177 |
|
| 178 | #define L2CAP_SUPER_RR 0x00
|
| 179 | #define L2CAP_SUPER_REJ 0x01
|
| 180 | #define L2CAP_SUPER_RNR 0x02
|
| 181 | #define L2CAP_SUPER_SREJ 0x03
|
| 182 |
|
| 183 |
|
| 184 | #define L2CAP_SAR_UNSEGMENTED 0x00
|
| 185 | #define L2CAP_SAR_START 0x01
|
| 186 | #define L2CAP_SAR_END 0x02
|
| 187 | #define L2CAP_SAR_CONTINUE 0x03
|
| 188 |
|
| 189 |
|
| 190 | #define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
|
| 191 | #define L2CAP_REJ_MTU_EXCEEDED 0x0001
|
| 192 | #define L2CAP_REJ_INVALID_CID 0x0002
|
| 193 |
|
| 194 |
|
| 195 | struct l2cap_hdr {
|
| 196 | __le16 len;
|
| 197 | __le16 cid;
|
| 198 | } __packed;
|
| 199 | #define L2CAP_LEN_SIZE 2
|
| 200 | #define L2CAP_HDR_SIZE 4
|
| 201 | #define L2CAP_ENH_HDR_SIZE 6
|
| 202 | #define L2CAP_EXT_HDR_SIZE 8
|
| 203 |
|
| 204 | #define L2CAP_FCS_SIZE 2
|
| 205 | #define L2CAP_SDULEN_SIZE 2
|
| 206 | #define L2CAP_PSMLEN_SIZE 2
|
| 207 | #define L2CAP_ENH_CTRL_SIZE 2
|
| 208 | #define L2CAP_EXT_CTRL_SIZE 4
|
| 209 |
|
| 210 | struct l2cap_cmd_hdr {
|
| 211 | __u8 code;
|
| 212 | __u8 ident;
|
| 213 | __le16 len;
|
| 214 | } __packed;
|
| 215 | #define L2CAP_CMD_HDR_SIZE 4
|
| 216 |
|
| 217 | struct l2cap_cmd_rej_unk {
|
| 218 | __le16 reason;
|
| 219 | } __packed;
|
| 220 |
|
| 221 | struct l2cap_cmd_rej_mtu {
|
| 222 | __le16 reason;
|
| 223 | __le16 max_mtu;
|
| 224 | } __packed;
|
| 225 |
|
| 226 | struct l2cap_cmd_rej_cid {
|
| 227 | __le16 reason;
|
| 228 | __le16 scid;
|
| 229 | __le16 dcid;
|
| 230 | } __packed;
|
| 231 |
|
| 232 | struct l2cap_conn_req {
|
| 233 | __le16 psm;
|
| 234 | __le16 scid;
|
| 235 | } __packed;
|
| 236 |
|
| 237 | struct l2cap_conn_rsp {
|
| 238 | __le16 dcid;
|
| 239 | __le16 scid;
|
| 240 | __le16 result;
|
| 241 | __le16 status;
|
| 242 | } __packed;
|
| 243 |
|
| 244 |
|
| 245 | #define L2CAP_PSM_SDP 0x0001
|
| 246 | #define L2CAP_PSM_RFCOMM 0x0003
|
| 247 | #define L2CAP_PSM_3DSP 0x0021
|
| 248 | #define L2CAP_PSM_IPSP 0x0023
|
| 249 |
|
| 250 | #define L2CAP_PSM_DYN_START 0x1001
|
| 251 | #define L2CAP_PSM_DYN_END 0xffff
|
| 252 | #define L2CAP_PSM_AUTO_END 0x10ff
|
| 253 | #define L2CAP_PSM_LE_DYN_START 0x0080
|
| 254 | #define L2CAP_PSM_LE_DYN_END 0x00ff
|
| 255 |
|
| 256 |
|
| 257 | #define L2CAP_CID_SIGNALING 0x0001
|
| 258 | #define L2CAP_CID_CONN_LESS 0x0002
|
| 259 | #define L2CAP_CID_ATT 0x0004
|
| 260 | #define L2CAP_CID_LE_SIGNALING 0x0005
|
| 261 | #define L2CAP_CID_SMP 0x0006
|
| 262 | #define L2CAP_CID_SMP_BREDR 0x0007
|
| 263 | #define L2CAP_CID_DYN_START 0x0040
|
| 264 | #define L2CAP_CID_DYN_END 0xffff
|
| 265 | #define L2CAP_CID_LE_DYN_END 0x007f
|
| 266 |
|
| 267 |
|
| 268 | #define L2CAP_CR_SUCCESS 0x0000
|
| 269 | #define L2CAP_CR_PEND 0x0001
|
| 270 | #define L2CAP_CR_BAD_PSM 0x0002
|
| 271 | #define L2CAP_CR_SEC_BLOCK 0x0003
|
| 272 | #define L2CAP_CR_NO_MEM 0x0004
|
| 273 | #define L2CAP_CR_INVALID_SCID 0x0006
|
| 274 | #define L2CAP_CR_SCID_IN_USE 0x0007
|
| 275 |
|
| 276 |
|
| 277 | #define L2CAP_CR_LE_SUCCESS 0x0000
|
| 278 | #define L2CAP_CR_LE_BAD_PSM 0x0002
|
| 279 | #define L2CAP_CR_LE_NO_MEM 0x0004
|
| 280 | #define L2CAP_CR_LE_AUTHENTICATION 0x0005
|
| 281 | #define L2CAP_CR_LE_AUTHORIZATION 0x0006
|
| 282 | #define L2CAP_CR_LE_BAD_KEY_SIZE 0x0007
|
| 283 | #define L2CAP_CR_LE_ENCRYPTION 0x0008
|
| 284 | #define L2CAP_CR_LE_INVALID_SCID 0x0009
|
| 285 | #define L2CAP_CR_LE_SCID_IN_USE 0x000A
|
| 286 | #define L2CAP_CR_LE_UNACCEPT_PARAMS 0x000B
|
| 287 | #define L2CAP_CR_LE_INVALID_PARAMS 0x000C
|
| 288 |
|
| 289 |
|
| 290 | #define L2CAP_CS_NO_INFO 0x0000
|
| 291 | #define L2CAP_CS_AUTHEN_PEND 0x0001
|
| 292 | #define L2CAP_CS_AUTHOR_PEND 0x0002
|
| 293 |
|
| 294 | struct l2cap_conf_req {
|
| 295 | __le16 dcid;
|
| 296 | __le16 flags;
|
| 297 | __u8 data[];
|
| 298 | } __packed;
|
| 299 |
|
| 300 | struct l2cap_conf_rsp {
|
| 301 | __le16 scid;
|
| 302 | __le16 flags;
|
| 303 | __le16 result;
|
| 304 | __u8 data[];
|
| 305 | } __packed;
|
| 306 |
|
| 307 | #define L2CAP_CONF_SUCCESS 0x0000
|
| 308 | #define L2CAP_CONF_UNACCEPT 0x0001
|
| 309 | #define L2CAP_CONF_REJECT 0x0002
|
| 310 | #define L2CAP_CONF_UNKNOWN 0x0003
|
| 311 | #define L2CAP_CONF_PENDING 0x0004
|
| 312 | #define L2CAP_CONF_EFS_REJECT 0x0005
|
| 313 |
|
| 314 |
|
| 315 | #define L2CAP_CONF_FLAG_CONTINUATION 0x0001
|
| 316 |
|
| 317 | struct l2cap_conf_opt {
|
| 318 | __u8 type;
|
| 319 | __u8 len;
|
| 320 | __u8 val[];
|
| 321 | } __packed;
|
| 322 | #define L2CAP_CONF_OPT_SIZE 2
|
| 323 |
|
| 324 | #define L2CAP_CONF_HINT 0x80
|
| 325 | #define L2CAP_CONF_MASK 0x7f
|
| 326 |
|
| 327 | #define L2CAP_CONF_MTU 0x01
|
| 328 | #define L2CAP_CONF_FLUSH_TO 0x02
|
| 329 | #define L2CAP_CONF_QOS 0x03
|
| 330 | #define L2CAP_CONF_RFC 0x04
|
| 331 | #define L2CAP_CONF_FCS 0x05
|
| 332 | #define L2CAP_CONF_EFS 0x06
|
| 333 | #define L2CAP_CONF_EWS 0x07
|
| 334 |
|
| 335 | #define L2CAP_CONF_MAX_SIZE 22
|
| 336 |
|
| 337 | struct l2cap_conf_rfc {
|
| 338 | __u8 mode;
|
| 339 | __u8 txwin_size;
|
| 340 | __u8 max_transmit;
|
| 341 | __le16 retrans_timeout;
|
| 342 | __le16 monitor_timeout;
|
| 343 | __le16 max_pdu_size;
|
| 344 | } __packed;
|
| 345 |
|
| 346 | #define L2CAP_MODE_BASIC 0x00
|
| 347 | #define L2CAP_MODE_RETRANS 0x01
|
| 348 | #define L2CAP_MODE_FLOWCTL 0x02
|
| 349 | #define L2CAP_MODE_ERTM 0x03
|
| 350 | #define L2CAP_MODE_STREAMING 0x04
|
| 351 |
|
| 352 | |
| 353 | * ever be sent over the air. Therefore, use a value that's unlikely to
|
| 354 | * ever be used in the BR/EDR configuration phase.
|
| 355 |
|
| 356 | #define L2CAP_MODE_LE_FLOWCTL 0x80
|
| 357 | #define L2CAP_MODE_EXT_FLOWCTL 0x81
|
| 358 |
|
| 359 | struct l2cap_conf_efs {
|
| 360 | __u8 id;
|
| 361 | __u8 stype;
|
| 362 | __le16 msdu;
|
| 363 | __le32 sdu_itime;
|
| 364 | __le32 acc_lat;
|
| 365 | __le32 flush_to;
|
| 366 | } __packed;
|
| 367 |
|
| 368 | #define L2CAP_SERV_NOTRAFIC 0x00
|
| 369 | #define L2CAP_SERV_BESTEFFORT 0x01
|
| 370 | #define L2CAP_SERV_GUARANTEED 0x02
|
| 371 |
|
| 372 | #define L2CAP_BESTEFFORT_ID 0x01
|
| 373 |
|
| 374 | struct l2cap_disconn_req {
|
| 375 | __le16 dcid;
|
| 376 | __le16 scid;
|
| 377 | } __packed;
|
| 378 |
|
| 379 | struct l2cap_disconn_rsp {
|
| 380 | __le16 dcid;
|
| 381 | __le16 scid;
|
| 382 | } __packed;
|
| 383 |
|
| 384 | struct l2cap_info_req {
|
| 385 | __le16 type;
|
| 386 | } __packed;
|
| 387 |
|
| 388 | struct l2cap_info_rsp {
|
| 389 | __le16 type;
|
| 390 | __le16 result;
|
| 391 | __u8 data[];
|
| 392 | } __packed;
|
| 393 |
|
| 394 | #define L2CAP_MR_SUCCESS 0x0000
|
| 395 | #define L2CAP_MR_PEND 0x0001
|
| 396 | #define L2CAP_MR_BAD_ID 0x0002
|
| 397 | #define L2CAP_MR_SAME_ID 0x0003
|
| 398 | #define L2CAP_MR_NOT_SUPP 0x0004
|
| 399 | #define L2CAP_MR_COLLISION 0x0005
|
| 400 | #define L2CAP_MR_NOT_ALLOWED 0x0006
|
| 401 |
|
| 402 | struct l2cap_move_chan_cfm {
|
| 403 | __le16 icid;
|
| 404 | __le16 result;
|
| 405 | } __packed;
|
| 406 |
|
| 407 | #define L2CAP_MC_CONFIRMED 0x0000
|
| 408 | #define L2CAP_MC_UNCONFIRMED 0x0001
|
| 409 |
|
| 410 | struct l2cap_move_chan_cfm_rsp {
|
| 411 | __le16 icid;
|
| 412 | } __packed;
|
| 413 |
|
| 414 |
|
| 415 | #define L2CAP_IT_CL_MTU 0x0001
|
| 416 | #define L2CAP_IT_FEAT_MASK 0x0002
|
| 417 | #define L2CAP_IT_FIXED_CHAN 0x0003
|
| 418 |
|
| 419 |
|
| 420 | #define L2CAP_IR_SUCCESS 0x0000
|
| 421 | #define L2CAP_IR_NOTSUPP 0x0001
|
| 422 |
|
| 423 | struct l2cap_conn_param_update_req {
|
| 424 | __le16 min;
|
| 425 | __le16 max;
|
| 426 | __le16 latency;
|
| 427 | __le16 to_multiplier;
|
| 428 | } __packed;
|
| 429 |
|
| 430 | struct l2cap_conn_param_update_rsp {
|
| 431 | __le16 result;
|
| 432 | } __packed;
|
| 433 |
|
| 434 |
|
| 435 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000
|
| 436 | #define L2CAP_CONN_PARAM_REJECTED 0x0001
|
| 437 |
|
| 438 | struct l2cap_le_conn_req {
|
| 439 | __le16 psm;
|
| 440 | __le16 scid;
|
| 441 | __le16 mtu;
|
| 442 | __le16 mps;
|
| 443 | __le16 credits;
|
| 444 | } __packed;
|
| 445 |
|
| 446 | struct l2cap_le_conn_rsp {
|
| 447 | __le16 dcid;
|
| 448 | __le16 mtu;
|
| 449 | __le16 mps;
|
| 450 | __le16 credits;
|
| 451 | __le16 result;
|
| 452 | } __packed;
|
| 453 |
|
| 454 | struct l2cap_le_credits {
|
| 455 | __le16 cid;
|
| 456 | __le16 credits;
|
| 457 | } __packed;
|
| 458 |
|
| 459 | #define L2CAP_ECRED_MIN_MTU 64
|
| 460 | #define L2CAP_ECRED_MIN_MPS 64
|
| 461 | #define L2CAP_ECRED_MAX_CID 5
|
| 462 |
|
| 463 | struct l2cap_ecred_conn_req {
|
| 464 |
|
| 465 | __struct_group(l2cap_ecred_conn_req_hdr, hdr, __packed,
|
| 466 | __le16 psm;
|
| 467 | __le16 mtu;
|
| 468 | __le16 mps;
|
| 469 | __le16 credits;
|
| 470 | );
|
| 471 | __le16 scid[];
|
| 472 | } __packed;
|
| 473 |
|
| 474 | struct l2cap_ecred_conn_rsp {
|
| 475 |
|
| 476 | struct_group_tagged(l2cap_ecred_conn_rsp_hdr, hdr,
|
| 477 | __le16 mtu;
|
| 478 | __le16 mps;
|
| 479 | __le16 credits;
|
| 480 | __le16 result;
|
| 481 | );
|
| 482 | __le16 dcid[];
|
| 483 | };
|
| 484 |
|
| 485 | struct l2cap_ecred_reconf_req {
|
| 486 | __le16 mtu;
|
| 487 | __le16 mps;
|
| 488 | __le16 scid[];
|
| 489 | } __packed;
|
| 490 |
|
| 491 | #define L2CAP_RECONF_SUCCESS 0x0000
|
| 492 | #define L2CAP_RECONF_INVALID_MTU 0x0001
|
| 493 | #define L2CAP_RECONF_INVALID_MPS 0x0002
|
| 494 | #define L2CAP_RECONF_INVALID_CID 0x0003
|
| 495 | #define L2CAP_RECONF_INVALID_PARAMS 0x0004
|
| 496 |
|
| 497 | struct l2cap_ecred_reconf_rsp {
|
| 498 | __le16 result;
|
| 499 | } __packed;
|
| 500 |
|
| 501 |
|
| 502 | struct l2cap_seq_list {
|
| 503 | __u16 head;
|
| 504 | __u16 tail;
|
| 505 | __u16 mask;
|
| 506 | __u16 *list;
|
| 507 | };
|
| 508 |
|
| 509 | #define L2CAP_SEQ_LIST_CLEAR 0xFFFF
|
| 510 | #define L2CAP_SEQ_LIST_TAIL 0x8000
|
| 511 |
|
| 512 | struct l2cap_chan {
|
| 513 | struct l2cap_conn *conn;
|
| 514 | struct kref kref;
|
| 515 | atomic_t nesting;
|
| 516 |
|
| 517 | __u8 state;
|
| 518 |
|
| 519 | bdaddr_t dst;
|
| 520 | __u8 dst_type;
|
| 521 | bdaddr_t src;
|
| 522 | __u8 src_type;
|
| 523 | __le16 psm;
|
| 524 | __le16 sport;
|
| 525 | __u16 dcid;
|
| 526 | __u16 scid;
|
| 527 |
|
| 528 | __u16 imtu;
|
| 529 | __u16 omtu;
|
| 530 | __u16 flush_to;
|
| 531 | __u8 mode;
|
| 532 | __u8 chan_type;
|
| 533 | __u8 chan_policy;
|
| 534 |
|
| 535 | __u8 sec_level;
|
| 536 |
|
| 537 | __u8 ident;
|
| 538 |
|
| 539 | __u8 conf_req[64];
|
| 540 | __u8 conf_len;
|
| 541 | __u8 num_conf_req;
|
| 542 | __u8 num_conf_rsp;
|
| 543 |
|
| 544 | __u8 fcs;
|
| 545 |
|
| 546 | __u16 tx_win;
|
| 547 | __u16 tx_win_max;
|
| 548 | __u16 ack_win;
|
| 549 | __u8 max_tx;
|
| 550 | __u16 retrans_timeout;
|
| 551 | __u16 monitor_timeout;
|
| 552 | __u16 mps;
|
| 553 |
|
| 554 | __u16 tx_credits;
|
| 555 | __u16 rx_credits;
|
| 556 |
|
| 557 |
|
| 558 | ssize_t rx_avail;
|
| 559 |
|
| 560 | __u8 tx_state;
|
| 561 | __u8 rx_state;
|
| 562 |
|
| 563 | unsigned long conf_state;
|
| 564 | unsigned long conn_state;
|
| 565 | unsigned long flags;
|
| 566 |
|
| 567 | __u16 next_tx_seq;
|
| 568 | __u16 expected_ack_seq;
|
| 569 | __u16 expected_tx_seq;
|
| 570 | __u16 buffer_seq;
|
| 571 | __u16 srej_save_reqseq;
|
| 572 | __u16 last_acked_seq;
|
| 573 | __u16 frames_sent;
|
| 574 | __u16 unacked_frames;
|
| 575 | __u8 retry_count;
|
| 576 | __u16 sdu_len;
|
| 577 | struct sk_buff *sdu;
|
| 578 | struct sk_buff *sdu_last_frag;
|
| 579 |
|
| 580 | __u16 remote_tx_win;
|
| 581 | __u8 remote_max_tx;
|
| 582 | __u16 remote_mps;
|
| 583 |
|
| 584 | __u8 local_id;
|
| 585 | __u8 local_stype;
|
| 586 | __u16 local_msdu;
|
| 587 | __u32 local_sdu_itime;
|
| 588 | __u32 local_acc_lat;
|
| 589 | __u32 local_flush_to;
|
| 590 |
|
| 591 | __u8 remote_id;
|
| 592 | __u8 remote_stype;
|
| 593 | __u16 remote_msdu;
|
| 594 | __u32 remote_sdu_itime;
|
| 595 | __u32 remote_acc_lat;
|
| 596 | __u32 remote_flush_to;
|
| 597 |
|
| 598 | struct delayed_work chan_timer;
|
| 599 | struct delayed_work retrans_timer;
|
| 600 | struct delayed_work monitor_timer;
|
| 601 | struct delayed_work ack_timer;
|
| 602 |
|
| 603 | struct sk_buff *tx_send_head;
|
| 604 | struct sk_buff_head tx_q;
|
| 605 | struct sk_buff_head srej_q;
|
| 606 | struct l2cap_seq_list srej_list;
|
| 607 | struct l2cap_seq_list retrans_list;
|
| 608 |
|
| 609 | struct list_head list;
|
| 610 | struct list_head global_l;
|
| 611 |
|
| 612 | void *data;
|
| 613 | const struct l2cap_ops *ops;
|
| 614 | struct mutex lock;
|
| 615 | };
|
| 616 |
|
| 617 | struct l2cap_ops {
|
| 618 | char *name;
|
| 619 |
|
| 620 | int (*new_connection)(struct l2cap_chan *chan,
|
| 621 | struct l2cap_chan *new_chan);
|
| 622 | int (*recv) (struct l2cap_chan * chan,
|
| 623 | struct sk_buff *skb);
|
| 624 | void (*teardown) (struct l2cap_chan *chan, int err);
|
| 625 | void (*close) (struct l2cap_chan *chan);
|
| 626 | void (*state_change) (struct l2cap_chan *chan,
|
| 627 | int state, int err);
|
| 628 | void (*ready) (struct l2cap_chan *chan);
|
| 629 | void (*defer) (struct l2cap_chan *chan);
|
| 630 | void (*resume) (struct l2cap_chan *chan);
|
| 631 | void (*suspend) (struct l2cap_chan *chan);
|
| 632 | void (*set_shutdown) (struct l2cap_chan *chan);
|
| 633 | long (*get_sndtimeo) (struct l2cap_chan *chan);
|
| 634 | struct pid *(*get_peer_pid) (struct l2cap_chan *chan);
|
| 635 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
|
| 636 | unsigned long hdr_len,
|
| 637 | unsigned long len, int nb);
|
| 638 | int (*filter) (struct l2cap_chan * chan,
|
| 639 | struct sk_buff *skb);
|
| 640 | };
|
| 641 |
|
| 642 | struct l2cap_conn {
|
| 643 | struct hci_conn *hcon;
|
| 644 | struct hci_chan *hchan;
|
| 645 |
|
| 646 | unsigned int mtu;
|
| 647 |
|
| 648 | __u32 feat_mask;
|
| 649 | __u8 remote_fixed_chan;
|
| 650 | __u8 local_fixed_chan;
|
| 651 |
|
| 652 | __u8 info_state;
|
| 653 | __u8 info_ident;
|
| 654 |
|
| 655 | struct delayed_work info_timer;
|
| 656 |
|
| 657 | struct sk_buff *rx_skb;
|
| 658 | __u32 rx_len;
|
| 659 | struct ida tx_ida;
|
| 660 | __u8 tx_ident;
|
| 661 |
|
| 662 | struct sk_buff_head pending_rx;
|
| 663 | struct work_struct pending_rx_work;
|
| 664 |
|
| 665 | struct delayed_work id_addr_timer;
|
| 666 |
|
| 667 | __u8 disc_reason;
|
| 668 |
|
| 669 | struct l2cap_chan *smp;
|
| 670 |
|
| 671 | struct list_head chan_l;
|
| 672 | struct mutex lock;
|
| 673 | struct kref ref;
|
| 674 | struct list_head users;
|
| 675 | };
|
| 676 |
|
| 677 | struct l2cap_user {
|
| 678 | struct list_head list;
|
| 679 | int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user);
|
| 680 | void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user);
|
| 681 | };
|
| 682 |
|
| 683 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
|
| 684 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
|
| 685 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
|
| 686 |
|
| 687 | #define L2CAP_CHAN_RAW 1
|
| 688 | #define L2CAP_CHAN_CONN_LESS 2
|
| 689 | #define L2CAP_CHAN_CONN_ORIENTED 3
|
| 690 | #define L2CAP_CHAN_FIXED 4
|
| 691 |
|
| 692 |
|
| 693 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
|
| 694 |
|
| 695 | struct l2cap_rx_busy {
|
| 696 | struct list_head list;
|
| 697 | struct sk_buff *skb;
|
| 698 | };
|
| 699 |
|
| 700 | struct l2cap_pinfo {
|
| 701 | struct bt_sock bt;
|
| 702 |
|
| 703 | |
| 704 | * should hold lock_sock.
|
| 705 |
|
| 706 | struct l2cap_chan *chan;
|
| 707 |
|
| 708 | struct list_head rx_busy;
|
| 709 | };
|
| 710 |
|
| 711 | enum {
|
| 712 | CONF_REQ_SENT,
|
| 713 | CONF_INPUT_DONE,
|
| 714 | CONF_OUTPUT_DONE,
|
| 715 | CONF_MTU_DONE,
|
| 716 | CONF_MODE_DONE,
|
| 717 | CONF_CONNECT_PEND,
|
| 718 | CONF_RECV_NO_FCS,
|
| 719 | CONF_STATE2_DEVICE,
|
| 720 | CONF_EWS_RECV,
|
| 721 | CONF_LOC_CONF_PEND,
|
| 722 | CONF_REM_CONF_PEND,
|
| 723 | CONF_NOT_COMPLETE,
|
| 724 | };
|
| 725 |
|
| 726 | #define L2CAP_CONF_MAX_CONF_REQ 2
|
| 727 | #define L2CAP_CONF_MAX_CONF_RSP 2
|
| 728 |
|
| 729 | enum {
|
| 730 | CONN_SREJ_SENT,
|
| 731 | CONN_WAIT_F,
|
| 732 | CONN_SREJ_ACT,
|
| 733 | CONN_SEND_PBIT,
|
| 734 | CONN_REMOTE_BUSY,
|
| 735 | CONN_LOCAL_BUSY,
|
| 736 | CONN_REJ_ACT,
|
| 737 | CONN_SEND_FBIT,
|
| 738 | CONN_RNR_SENT,
|
| 739 | };
|
| 740 |
|
| 741 |
|
| 742 | enum {
|
| 743 | FLAG_ROLE_SWITCH,
|
| 744 | FLAG_FORCE_ACTIVE,
|
| 745 | FLAG_FORCE_RELIABLE,
|
| 746 | FLAG_FLUSHABLE,
|
| 747 | FLAG_EXT_CTRL,
|
| 748 | FLAG_EFS_ENABLE,
|
| 749 | FLAG_DEFER_SETUP,
|
| 750 | FLAG_LE_CONN_REQ_SENT,
|
| 751 | FLAG_ECRED_CONN_REQ_SENT,
|
| 752 | FLAG_PENDING_SECURITY,
|
| 753 | FLAG_HOLD_HCI_CONN,
|
| 754 | FLAG_DEL,
|
| 755 | };
|
| 756 |
|
| 757 | |
| 758 | * otherwise considers all channels equal and will e.g. complain about a
|
| 759 | * connection oriented channel triggering SMP procedures or a listening
|
| 760 | * channel creating and locking a child channel.
|
| 761 |
|
| 762 | enum {
|
| 763 | L2CAP_NESTING_SMP,
|
| 764 | L2CAP_NESTING_NORMAL,
|
| 765 | L2CAP_NESTING_PARENT,
|
| 766 | };
|
| 767 |
|
| 768 | enum {
|
| 769 | L2CAP_TX_STATE_XMIT,
|
| 770 | L2CAP_TX_STATE_WAIT_F,
|
| 771 | };
|
| 772 |
|
| 773 | enum {
|
| 774 | L2CAP_RX_STATE_RECV,
|
| 775 | L2CAP_RX_STATE_SREJ_SENT,
|
| 776 | L2CAP_RX_STATE_MOVE,
|
| 777 | L2CAP_RX_STATE_WAIT_P,
|
| 778 | L2CAP_RX_STATE_WAIT_F,
|
| 779 | };
|
| 780 |
|
| 781 | enum {
|
| 782 | L2CAP_TXSEQ_EXPECTED,
|
| 783 | L2CAP_TXSEQ_EXPECTED_SREJ,
|
| 784 | L2CAP_TXSEQ_UNEXPECTED,
|
| 785 | L2CAP_TXSEQ_UNEXPECTED_SREJ,
|
| 786 | L2CAP_TXSEQ_DUPLICATE,
|
| 787 | L2CAP_TXSEQ_DUPLICATE_SREJ,
|
| 788 | L2CAP_TXSEQ_INVALID,
|
| 789 | L2CAP_TXSEQ_INVALID_IGNORE,
|
| 790 | };
|
| 791 |
|
| 792 | enum {
|
| 793 | L2CAP_EV_DATA_REQUEST,
|
| 794 | L2CAP_EV_LOCAL_BUSY_DETECTED,
|
| 795 | L2CAP_EV_LOCAL_BUSY_CLEAR,
|
| 796 | L2CAP_EV_RECV_REQSEQ_AND_FBIT,
|
| 797 | L2CAP_EV_RECV_FBIT,
|
| 798 | L2CAP_EV_RETRANS_TO,
|
| 799 | L2CAP_EV_MONITOR_TO,
|
| 800 | L2CAP_EV_EXPLICIT_POLL,
|
| 801 | L2CAP_EV_RECV_IFRAME,
|
| 802 | L2CAP_EV_RECV_RR,
|
| 803 | L2CAP_EV_RECV_REJ,
|
| 804 | L2CAP_EV_RECV_RNR,
|
| 805 | L2CAP_EV_RECV_SREJ,
|
| 806 | L2CAP_EV_RECV_FRAME,
|
| 807 | };
|
| 808 |
|
| 809 | enum {
|
| 810 | L2CAP_MOVE_ROLE_NONE,
|
| 811 | L2CAP_MOVE_ROLE_INITIATOR,
|
| 812 | L2CAP_MOVE_ROLE_RESPONDER,
|
| 813 | };
|
| 814 |
|
| 815 | enum {
|
| 816 | L2CAP_MOVE_STABLE,
|
| 817 | L2CAP_MOVE_WAIT_REQ,
|
| 818 | L2CAP_MOVE_WAIT_RSP,
|
| 819 | L2CAP_MOVE_WAIT_RSP_SUCCESS,
|
| 820 | L2CAP_MOVE_WAIT_CONFIRM,
|
| 821 | L2CAP_MOVE_WAIT_CONFIRM_RSP,
|
| 822 | L2CAP_MOVE_WAIT_LOGICAL_COMP,
|
| 823 | L2CAP_MOVE_WAIT_LOGICAL_CFM,
|
| 824 | L2CAP_MOVE_WAIT_LOCAL_BUSY,
|
| 825 | L2CAP_MOVE_WAIT_PREPARE,
|
| 826 | };
|
| 827 |
|
| 828 | void l2cap_chan_hold(struct l2cap_chan *c);
|
| 829 | struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c);
|
| 830 | void l2cap_chan_put(struct l2cap_chan *c);
|
| 831 |
|
| 832 | static inline void l2cap_chan_lock(struct l2cap_chan *chan)
|
| 833 | {
|
| 834 | mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting));
|
| 835 | }
|
| 836 |
|
| 837 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
|
| 838 | {
|
| 839 | mutex_unlock(&chan->lock);
|
| 840 | }
|
| 841 |
|
| 842 | static inline void l2cap_set_timer(struct l2cap_chan *chan,
|
| 843 | struct delayed_work *work, long timeout)
|
| 844 | {
|
| 845 | BT_DBG("chan %p state %s timeout %ld", chan,
|
| 846 | state_to_string(chan->state), timeout);
|
| 847 |
|
| 848 | |
| 849 | since it is already done with previous set_timer
|
| 850 | if (!cancel_delayed_work(work))
|
| 851 | l2cap_chan_hold(chan);
|
| 852 |
|
| 853 | schedule_delayed_work(work, timeout);
|
| 854 | }
|
| 855 |
|
| 856 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
|
| 857 | struct delayed_work *work)
|
| 858 | {
|
| 859 | bool ret;
|
| 860 |
|
| 861 | |
| 862 | is done in delayed work function
|
| 863 | ret = cancel_delayed_work(work);
|
| 864 | if (ret)
|
| 865 | l2cap_chan_put(chan);
|
| 866 |
|
| 867 | return ret;
|
| 868 | }
|
| 869 |
|
| 870 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
|
| 871 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
|
| 872 | #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
|
| 873 | #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
|
| 874 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
|
| 875 | msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
|
| 876 | #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
|
| 877 |
|
| 878 | static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
|
| 879 | {
|
| 880 | if (seq1 >= seq2)
|
| 881 | return seq1 - seq2;
|
| 882 | else
|
| 883 | return chan->tx_win_max + 1 - seq2 + seq1;
|
| 884 | }
|
| 885 |
|
| 886 | static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
|
| 887 | {
|
| 888 | return (seq + 1) % (chan->tx_win_max + 1);
|
| 889 | }
|
| 890 |
|
| 891 | static inline int l2cap_chan_no_new_connection(struct l2cap_chan *chan,
|
| 892 | struct l2cap_chan *new_chan)
|
| 893 | {
|
| 894 | return -EOPNOTSUPP;
|
| 895 | }
|
| 896 |
|
| 897 | static inline int l2cap_chan_no_recv(struct l2cap_chan *chan, struct sk_buff *skb)
|
| 898 | {
|
| 899 | return -ENOSYS;
|
| 900 | }
|
| 901 |
|
| 902 | static inline struct sk_buff *l2cap_chan_no_alloc_skb(struct l2cap_chan *chan,
|
| 903 | unsigned long hdr_len,
|
| 904 | unsigned long len, int nb)
|
| 905 | {
|
| 906 | return ERR_PTR(-ENOSYS);
|
| 907 | }
|
| 908 |
|
| 909 | static inline void l2cap_chan_no_teardown(struct l2cap_chan *chan, int err)
|
| 910 | {
|
| 911 | }
|
| 912 |
|
| 913 | static inline void l2cap_chan_no_close(struct l2cap_chan *chan)
|
| 914 | {
|
| 915 | }
|
| 916 |
|
| 917 | static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
|
| 918 | {
|
| 919 | }
|
| 920 |
|
| 921 | static inline void l2cap_chan_no_state_change(struct l2cap_chan *chan,
|
| 922 | int state, int err)
|
| 923 | {
|
| 924 | }
|
| 925 |
|
| 926 | static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
|
| 927 | {
|
| 928 | }
|
| 929 |
|
| 930 | static inline void l2cap_chan_no_suspend(struct l2cap_chan *chan)
|
| 931 | {
|
| 932 | }
|
| 933 |
|
| 934 | static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
|
| 935 | {
|
| 936 | }
|
| 937 |
|
| 938 | static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
|
| 939 | {
|
| 940 | }
|
| 941 |
|
| 942 | static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
|
| 943 | {
|
| 944 | return 0;
|
| 945 | }
|
| 946 |
|
| 947 | extern bool disable_ertm;
|
| 948 | extern bool enable_ecred;
|
| 949 |
|
| 950 | int l2cap_init_sockets(void);
|
| 951 | void l2cap_cleanup_sockets(void);
|
| 952 | bool l2cap_is_socket(struct socket *sock);
|
| 953 |
|
| 954 | void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan);
|
| 955 | void __l2cap_ecred_conn_rsp_defer(struct l2cap_chan *chan);
|
| 956 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
|
| 957 |
|
| 958 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
|
| 959 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
|
| 960 |
|
| 961 | struct l2cap_chan *l2cap_chan_create(void);
|
| 962 | void l2cap_chan_close(struct l2cap_chan *chan, int reason);
|
| 963 | int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
|
| 964 | bdaddr_t *dst, u8 dst_type, u16 timeout);
|
| 965 | int l2cap_chan_reconfigure(struct l2cap_chan *chan, __u16 mtu);
|
| 966 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
|
| 967 | const struct sockcm_cookie *sockc);
|
| 968 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
|
| 969 | void l2cap_chan_rx_avail(struct l2cap_chan *chan, ssize_t rx_avail);
|
| 970 | int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator);
|
| 971 | void l2cap_chan_set_defaults(struct l2cap_chan *chan, struct l2cap_chan *pchan);
|
| 972 | int l2cap_ertm_init(struct l2cap_chan *chan);
|
| 973 | void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
|
| 974 | void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
|
| 975 | typedef void (*l2cap_chan_func_t)(struct l2cap_chan *chan, void *data);
|
| 976 | void l2cap_chan_list(struct l2cap_conn *conn, l2cap_chan_func_t func,
|
| 977 | void *data);
|
| 978 | void l2cap_chan_del(struct l2cap_chan *chan, int err);
|
| 979 | void l2cap_send_conn_req(struct l2cap_chan *chan);
|
| 980 |
|
| 981 | struct l2cap_conn *l2cap_conn_get(struct l2cap_conn *conn);
|
| 982 | struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *conn);
|
| 983 | void l2cap_conn_put(struct l2cap_conn *conn);
|
| 984 |
|
| 985 | int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
|
| 986 | void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
|
| 987 |
|
| 988 | #endif
|