xref: /linux/include/net/bluetooth/bluetooth.h (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 /*
2    BlueZ - Bluetooth protocol stack for Linux
3    Copyright (C) 2000-2001 Qualcomm Incorporated
4    Copyright 2023 NXP
5 
6    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License version 2 as
10    published by the Free Software Foundation;
11 
12    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
15    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
16    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
17    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 
21    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
22    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
23    SOFTWARE IS DISCLAIMED.
24 */
25 
26 #ifndef __BLUETOOTH_H
27 #define __BLUETOOTH_H
28 
29 #include <linux/poll.h>
30 #include <net/sock.h>
31 #include <linux/seq_file.h>
32 #include <linux/ethtool.h>
33 
34 #define BT_SUBSYS_VERSION	2
35 #define BT_SUBSYS_REVISION	22
36 
37 #ifndef AF_BLUETOOTH
38 #define AF_BLUETOOTH	31
39 #define PF_BLUETOOTH	AF_BLUETOOTH
40 #endif
41 
42 /* Bluetooth versions */
43 #define BLUETOOTH_VER_1_1	1
44 #define BLUETOOTH_VER_1_2	2
45 #define BLUETOOTH_VER_2_0	3
46 #define BLUETOOTH_VER_2_1	4
47 #define BLUETOOTH_VER_4_0	6
48 
49 /* Reserv for core and drivers use */
50 #define BT_SKB_RESERVE	8
51 
52 #define BTPROTO_L2CAP	0
53 #define BTPROTO_HCI	1
54 #define BTPROTO_SCO	2
55 #define BTPROTO_RFCOMM	3
56 #define BTPROTO_BNEP	4
57 #define BTPROTO_CMTP	5
58 #define BTPROTO_HIDP	6
59 #define BTPROTO_AVDTP	7
60 #define BTPROTO_ISO	8
61 #define BTPROTO_LAST	BTPROTO_ISO
62 
63 #define SOL_HCI		0
64 #define SOL_L2CAP	6
65 #define SOL_SCO		17
66 #define SOL_RFCOMM	18
67 
68 #define BT_SECURITY	4
69 struct bt_security {
70 	__u8 level;
71 	__u8 key_size;
72 };
73 #define BT_SECURITY_SDP		0
74 #define BT_SECURITY_LOW		1
75 #define BT_SECURITY_MEDIUM	2
76 #define BT_SECURITY_HIGH	3
77 #define BT_SECURITY_FIPS	4
78 
79 #define BT_DEFER_SETUP	7
80 
81 #define BT_FLUSHABLE	8
82 
83 #define BT_FLUSHABLE_OFF	0
84 #define BT_FLUSHABLE_ON		1
85 
86 #define BT_POWER	9
87 struct bt_power {
88 	__u8 force_active;
89 };
90 #define BT_POWER_FORCE_ACTIVE_OFF 0
91 #define BT_POWER_FORCE_ACTIVE_ON  1
92 
93 #define BT_CHANNEL_POLICY	10
94 
95 /* BR/EDR only (default policy)
96  *   AMP controllers cannot be used.
97  *   Channel move requests from the remote device are denied.
98  *   If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
99  */
100 #define BT_CHANNEL_POLICY_BREDR_ONLY		0
101 
102 /* BR/EDR Preferred
103  *   Allow use of AMP controllers.
104  *   If the L2CAP channel is currently on AMP, move it to BR/EDR.
105  *   Channel move requests from the remote device are allowed.
106  */
107 #define BT_CHANNEL_POLICY_BREDR_PREFERRED	1
108 
109 /* AMP Preferred
110  *   Allow use of AMP controllers
111  *   If the L2CAP channel is currently on BR/EDR and AMP controller
112  *     resources are available, initiate a channel move to AMP.
113  *   Channel move requests from the remote device are allowed.
114  *   If the L2CAP socket has not been connected yet, try to create
115  *     and configure the channel directly on an AMP controller rather
116  *     than BR/EDR.
117  */
118 #define BT_CHANNEL_POLICY_AMP_PREFERRED		2
119 
120 #define BT_VOICE		11
121 struct bt_voice {
122 	__u16 setting;
123 };
124 
125 #define BT_VOICE_TRANSPARENT			0x0003
126 #define BT_VOICE_CVSD_16BIT			0x0060
127 #define BT_VOICE_TRANSPARENT_16BIT		0x0063
128 
129 #define BT_SNDMTU		12
130 #define BT_RCVMTU		13
131 #define BT_PHY			14
132 
133 #define BT_PHY_BR_1M_1SLOT	0x00000001
134 #define BT_PHY_BR_1M_3SLOT	0x00000002
135 #define BT_PHY_BR_1M_5SLOT	0x00000004
136 #define BT_PHY_EDR_2M_1SLOT	0x00000008
137 #define BT_PHY_EDR_2M_3SLOT	0x00000010
138 #define BT_PHY_EDR_2M_5SLOT	0x00000020
139 #define BT_PHY_EDR_3M_1SLOT	0x00000040
140 #define BT_PHY_EDR_3M_3SLOT	0x00000080
141 #define BT_PHY_EDR_3M_5SLOT	0x00000100
142 #define BT_PHY_LE_1M_TX		0x00000200
143 #define BT_PHY_LE_1M_RX		0x00000400
144 #define BT_PHY_LE_2M_TX		0x00000800
145 #define BT_PHY_LE_2M_RX		0x00001000
146 #define BT_PHY_LE_CODED_TX	0x00002000
147 #define BT_PHY_LE_CODED_RX	0x00004000
148 
149 #define BT_MODE			15
150 
151 #define BT_MODE_BASIC		0x00
152 #define BT_MODE_ERTM		0x01
153 #define BT_MODE_STREAMING	0x02
154 #define BT_MODE_LE_FLOWCTL	0x03
155 #define BT_MODE_EXT_FLOWCTL	0x04
156 
157 #define BT_PKT_STATUS           16
158 
159 #define BT_SCM_PKT_STATUS	0x03
160 #define BT_SCM_ERROR		0x04
161 
162 #define BT_ISO_QOS		17
163 
164 #define BT_ISO_QOS_CIG_UNSET	0xff
165 #define BT_ISO_QOS_CIS_UNSET	0xff
166 
167 #define BT_ISO_QOS_BIG_UNSET	0xff
168 #define BT_ISO_QOS_BIS_UNSET	0xff
169 
170 #define BT_ISO_SYNC_TIMEOUT	0x07d0 /* 20 secs */
171 
172 struct bt_iso_io_qos {
173 	__u32 interval;
174 	__u16 latency;
175 	__u16 sdu;
176 	__u8  phy;
177 	__u8  rtn;
178 };
179 
180 struct bt_iso_ucast_qos {
181 	__u8  cig;
182 	__u8  cis;
183 	__u8  sca;
184 	__u8  packing;
185 	__u8  framing;
186 	struct bt_iso_io_qos in;
187 	struct bt_iso_io_qos out;
188 };
189 
190 struct bt_iso_bcast_qos {
191 	__u8  big;
192 	__u8  bis;
193 	__u8  sync_factor;
194 	__u8  packing;
195 	__u8  framing;
196 	struct bt_iso_io_qos in;
197 	struct bt_iso_io_qos out;
198 	__u8  encryption;
199 	__u8  bcode[16];
200 	__u8  options;
201 	__u16 skip;
202 	__u16 sync_timeout;
203 	__u8  sync_cte_type;
204 	__u8  mse;
205 	__u16 timeout;
206 };
207 
208 struct bt_iso_qos {
209 	union {
210 		struct bt_iso_ucast_qos ucast;
211 		struct bt_iso_bcast_qos bcast;
212 	};
213 };
214 
215 #define BT_ISO_PHY_1M		0x01
216 #define BT_ISO_PHY_2M		0x02
217 #define BT_ISO_PHY_CODED	0x04
218 #define BT_ISO_PHY_ANY		(BT_ISO_PHY_1M | BT_ISO_PHY_2M | \
219 				 BT_ISO_PHY_CODED)
220 
221 #define BT_CODEC	19
222 
223 struct	bt_codec_caps {
224 	__u8	len;
225 	__u8	data[];
226 } __packed;
227 
228 struct bt_codec {
229 	__u8	id;
230 	__u16	cid;
231 	__u16	vid;
232 	__u8	data_path;
233 	__u8	num_caps;
234 } __packed;
235 
236 struct bt_codecs {
237 	__u8		num_codecs;
238 	struct bt_codec	codecs[];
239 } __packed;
240 
241 #define BT_CODEC_CVSD		0x02
242 #define BT_CODEC_TRANSPARENT	0x03
243 #define BT_CODEC_MSBC		0x05
244 
245 #define BT_ISO_BASE		20
246 
247 /* Socket option value 21 reserved */
248 
249 #define BT_PKT_SEQNUM		22
250 
251 #define BT_SCM_PKT_SEQNUM	0x05
252 
253 __printf(1, 2)
254 void bt_info(const char *fmt, ...);
255 __printf(1, 2)
256 void bt_warn(const char *fmt, ...);
257 __printf(1, 2)
258 void bt_err(const char *fmt, ...);
259 #if IS_ENABLED(CONFIG_BT_FEATURE_DEBUG)
260 void bt_dbg_set(bool enable);
261 bool bt_dbg_get(void);
262 __printf(1, 2)
263 void bt_dbg(const char *fmt, ...);
264 #endif
265 __printf(1, 2)
266 void bt_warn_ratelimited(const char *fmt, ...);
267 __printf(1, 2)
268 void bt_err_ratelimited(const char *fmt, ...);
269 
270 #define BT_INFO(fmt, ...)	bt_info(fmt "\n", ##__VA_ARGS__)
271 #define BT_WARN(fmt, ...)	bt_warn(fmt "\n", ##__VA_ARGS__)
272 #define BT_ERR(fmt, ...)	bt_err(fmt "\n", ##__VA_ARGS__)
273 
274 #if IS_ENABLED(CONFIG_BT_FEATURE_DEBUG)
275 #define BT_DBG(fmt, ...) \
276 	bt_dbg("%s:%d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)
277 #else
278 #define BT_DBG(fmt, ...)	pr_debug(fmt "\n", ##__VA_ARGS__)
279 #endif
280 
281 #define bt_dev_name(hdev) ((hdev) ? (hdev)->name : "null")
282 
283 #define bt_dev_info(hdev, fmt, ...)				\
284 	BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
285 #define bt_dev_warn(hdev, fmt, ...)				\
286 	BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
287 #define bt_dev_err(hdev, fmt, ...)				\
288 	BT_ERR("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
289 #define bt_dev_dbg(hdev, fmt, ...)				\
290 	BT_DBG("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
291 
292 #define bt_dev_warn_ratelimited(hdev, fmt, ...)			\
293 	bt_warn_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
294 #define bt_dev_err_ratelimited(hdev, fmt, ...)			\
295 	bt_err_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
296 
297 /* Connection and socket states */
298 enum bt_sock_state {
299 	BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
300 	BT_OPEN,
301 	BT_BOUND,
302 	BT_LISTEN,
303 	BT_CONNECT,
304 	BT_CONNECT2,
305 	BT_CONFIG,
306 	BT_DISCONN,
307 	BT_CLOSED
308 };
309 
310 /* If unused will be removed by compiler */
311 static inline const char *state_to_string(int state)
312 {
313 	switch (state) {
314 	case BT_CONNECTED:
315 		return "BT_CONNECTED";
316 	case BT_OPEN:
317 		return "BT_OPEN";
318 	case BT_BOUND:
319 		return "BT_BOUND";
320 	case BT_LISTEN:
321 		return "BT_LISTEN";
322 	case BT_CONNECT:
323 		return "BT_CONNECT";
324 	case BT_CONNECT2:
325 		return "BT_CONNECT2";
326 	case BT_CONFIG:
327 		return "BT_CONFIG";
328 	case BT_DISCONN:
329 		return "BT_DISCONN";
330 	case BT_CLOSED:
331 		return "BT_CLOSED";
332 	}
333 
334 	return "invalid state";
335 }
336 
337 /* BD Address */
338 typedef struct {
339 	__u8 b[6];
340 } __packed bdaddr_t;
341 
342 /* BD Address type */
343 #define BDADDR_BREDR		0x00
344 #define BDADDR_LE_PUBLIC	0x01
345 #define BDADDR_LE_RANDOM	0x02
346 
347 static inline bool bdaddr_type_is_valid(u8 type)
348 {
349 	switch (type) {
350 	case BDADDR_BREDR:
351 	case BDADDR_LE_PUBLIC:
352 	case BDADDR_LE_RANDOM:
353 		return true;
354 	}
355 
356 	return false;
357 }
358 
359 static inline bool bdaddr_type_is_le(u8 type)
360 {
361 	switch (type) {
362 	case BDADDR_LE_PUBLIC:
363 	case BDADDR_LE_RANDOM:
364 		return true;
365 	}
366 
367 	return false;
368 }
369 
370 #define BDADDR_ANY  (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
371 #define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
372 
373 /* Copy, swap, convert BD Address */
374 static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
375 {
376 	return memcmp(ba1, ba2, sizeof(bdaddr_t));
377 }
378 static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
379 {
380 	memcpy(dst, src, sizeof(bdaddr_t));
381 }
382 
383 void baswap(bdaddr_t *dst, const bdaddr_t *src);
384 
385 /* Common socket structures and functions */
386 
387 #define bt_sk(__sk) ((struct bt_sock *) __sk)
388 
389 struct bt_sock {
390 	struct sock sk;
391 	struct list_head accept_q;
392 	struct sock *parent;
393 	unsigned long flags;
394 	void (*skb_msg_name)(struct sk_buff *, void *, int *);
395 	void (*skb_put_cmsg)(struct sk_buff *, struct msghdr *, struct sock *);
396 };
397 
398 enum {
399 	BT_SK_DEFER_SETUP,
400 	BT_SK_SUSPEND,
401 	BT_SK_PKT_STATUS,
402 	BT_SK_PKT_SEQNUM,
403 };
404 
405 struct bt_sock_list {
406 	struct hlist_head head;
407 	rwlock_t          lock;
408 #ifdef CONFIG_PROC_FS
409         int (* custom_seq_show)(struct seq_file *, void *);
410 #endif
411 };
412 
413 int  bt_sock_register(int proto, const struct net_proto_family *ops);
414 void bt_sock_unregister(int proto);
415 void bt_sock_link(struct bt_sock_list *l, struct sock *s);
416 void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
417 bool bt_sock_linked(struct bt_sock_list *l, struct sock *s);
418 struct sock *bt_sock_alloc(struct net *net, struct socket *sock,
419 			   struct proto *prot, int proto, gfp_t prio, int kern);
420 int  bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
421 		     int flags);
422 int  bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
423 			    size_t len, int flags);
424 __poll_t bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
425 int  bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
426 int  bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
427 int  bt_sock_wait_ready(struct sock *sk, unsigned int msg_flags);
428 
429 void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh);
430 void bt_accept_unlink(struct sock *sk);
431 struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
432 
433 /* Skb helpers */
434 struct l2cap_ctrl {
435 	u8	sframe:1,
436 		poll:1,
437 		final:1,
438 		fcs:1,
439 		sar:2,
440 		super:2;
441 
442 	u16	reqseq;
443 	u16	txseq;
444 	u8	retries;
445 	__le16  psm;
446 	bdaddr_t bdaddr;
447 	struct l2cap_chan *chan;
448 };
449 
450 struct hci_dev;
451 
452 typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode);
453 typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
454 				       u16 opcode, struct sk_buff *skb);
455 
456 void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status,
457 			  hci_req_complete_t *req_complete,
458 			  hci_req_complete_skb_t *req_complete_skb);
459 
460 int hci_ethtool_ts_info(unsigned int index, int sk_proto,
461 			struct kernel_ethtool_ts_info *ts_info);
462 
463 #define HCI_REQ_START	BIT(0)
464 #define HCI_REQ_SKB	BIT(1)
465 
466 struct hci_ctrl {
467 	struct sock *sk;
468 	u16 opcode;
469 	u8 req_flags;
470 	u8 req_event;
471 	union {
472 		hci_req_complete_t req_complete;
473 		hci_req_complete_skb_t req_complete_skb;
474 	};
475 };
476 
477 struct mgmt_ctrl {
478 	struct hci_dev *hdev;
479 	u16 opcode;
480 };
481 
482 struct bt_skb_cb {
483 	u8 pkt_type;
484 	u8 force_active;
485 	u16 expect;
486 	u16 pkt_seqnum;
487 	u8 incoming:1;
488 	u8 pkt_status:2;
489 	union {
490 		struct l2cap_ctrl l2cap;
491 		struct hci_ctrl hci;
492 		struct mgmt_ctrl mgmt;
493 		struct scm_creds creds;
494 	};
495 };
496 #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
497 
498 #define hci_skb_pkt_type(skb) bt_cb((skb))->pkt_type
499 #define hci_skb_pkt_status(skb) bt_cb((skb))->pkt_status
500 #define hci_skb_pkt_seqnum(skb) bt_cb((skb))->pkt_seqnum
501 #define hci_skb_expect(skb) bt_cb((skb))->expect
502 #define hci_skb_opcode(skb) bt_cb((skb))->hci.opcode
503 #define hci_skb_event(skb) bt_cb((skb))->hci.req_event
504 #define hci_skb_sk(skb) bt_cb((skb))->hci.sk
505 
506 static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
507 {
508 	struct sk_buff *skb;
509 
510 	skb = alloc_skb(len + BT_SKB_RESERVE, how);
511 	if (skb)
512 		skb_reserve(skb, BT_SKB_RESERVE);
513 	return skb;
514 }
515 
516 static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
517 					unsigned long len, int nb, int *err)
518 {
519 	struct sk_buff *skb;
520 
521 	skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err);
522 	if (skb)
523 		skb_reserve(skb, BT_SKB_RESERVE);
524 
525 	if (!skb && *err)
526 		return NULL;
527 
528 	*err = sock_error(sk);
529 	if (*err)
530 		goto out;
531 
532 	if (sk->sk_shutdown) {
533 		*err = -ECONNRESET;
534 		goto out;
535 	}
536 
537 	return skb;
538 
539 out:
540 	kfree_skb(skb);
541 	return NULL;
542 }
543 
544 /* Shall not be called with lock_sock held */
545 static inline struct sk_buff *bt_skb_sendmsg(struct sock *sk,
546 					     struct msghdr *msg,
547 					     size_t len, size_t mtu,
548 					     size_t headroom, size_t tailroom)
549 {
550 	struct sk_buff *skb;
551 	size_t size = min_t(size_t, len, mtu);
552 	int err;
553 
554 	skb = bt_skb_send_alloc(sk, size + headroom + tailroom,
555 				msg->msg_flags & MSG_DONTWAIT, &err);
556 	if (!skb)
557 		return ERR_PTR(err);
558 
559 	skb_reserve(skb, headroom);
560 	skb_tailroom_reserve(skb, mtu, tailroom);
561 
562 	if (!copy_from_iter_full(skb_put(skb, size), size, &msg->msg_iter)) {
563 		kfree_skb(skb);
564 		return ERR_PTR(-EFAULT);
565 	}
566 
567 	skb->priority = READ_ONCE(sk->sk_priority);
568 
569 	return skb;
570 }
571 
572 /* Similar to bt_skb_sendmsg but can split the msg into multiple fragments
573  * accourding to the MTU.
574  */
575 static inline struct sk_buff *bt_skb_sendmmsg(struct sock *sk,
576 					      struct msghdr *msg,
577 					      size_t len, size_t mtu,
578 					      size_t headroom, size_t tailroom)
579 {
580 	struct sk_buff *skb, **frag;
581 
582 	skb = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom);
583 	if (IS_ERR(skb))
584 		return skb;
585 
586 	len -= skb->len;
587 	if (!len)
588 		return skb;
589 
590 	/* Add remaining data over MTU as continuation fragments */
591 	frag = &skb_shinfo(skb)->frag_list;
592 	while (len) {
593 		struct sk_buff *tmp;
594 
595 		tmp = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom);
596 		if (IS_ERR(tmp)) {
597 			return skb;
598 		}
599 
600 		len -= tmp->len;
601 
602 		*frag = tmp;
603 		frag = &(*frag)->next;
604 	}
605 
606 	return skb;
607 }
608 
609 int bt_to_errno(u16 code);
610 __u8 bt_status(int err);
611 
612 void hci_sock_set_flag(struct sock *sk, int nr);
613 void hci_sock_clear_flag(struct sock *sk, int nr);
614 int hci_sock_test_flag(struct sock *sk, int nr);
615 unsigned short hci_sock_get_channel(struct sock *sk);
616 u32 hci_sock_get_cookie(struct sock *sk);
617 
618 int hci_sock_init(void);
619 void hci_sock_cleanup(void);
620 
621 int bt_sysfs_init(void);
622 void bt_sysfs_cleanup(void);
623 
624 int bt_procfs_init(struct net *net, const char *name,
625 		   struct bt_sock_list *sk_list,
626 		   int (*seq_show)(struct seq_file *, void *));
627 void bt_procfs_cleanup(struct net *net, const char *name);
628 
629 extern struct dentry *bt_debugfs;
630 
631 int l2cap_init(void);
632 void l2cap_exit(void);
633 
634 #if IS_ENABLED(CONFIG_BT_BREDR)
635 int sco_init(void);
636 void sco_exit(void);
637 #else
638 static inline int sco_init(void)
639 {
640 	return 0;
641 }
642 
643 static inline void sco_exit(void)
644 {
645 }
646 #endif
647 
648 #if IS_ENABLED(CONFIG_BT_LE)
649 int iso_init(void);
650 int iso_exit(void);
651 bool iso_inited(void);
652 #else
653 static inline int iso_init(void)
654 {
655 	return 0;
656 }
657 
658 static inline int iso_exit(void)
659 {
660 	return 0;
661 }
662 
663 static inline bool iso_inited(void)
664 {
665 	return false;
666 }
667 #endif
668 
669 int mgmt_init(void);
670 void mgmt_exit(void);
671 void mgmt_cleanup(struct sock *sk);
672 
673 void bt_sock_reclassify_lock(struct sock *sk, int proto);
674 
675 #endif /* __BLUETOOTH_H */
676