11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds BlueZ - Bluetooth protocol stack for Linux 31da177e4SLinus Torvalds Copyright (C) 2000-2001 Qualcomm Incorporated 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 61da177e4SLinus Torvalds 71da177e4SLinus Torvalds This program is free software; you can redistribute it and/or modify 81da177e4SLinus Torvalds it under the terms of the GNU General Public License version 2 as 91da177e4SLinus Torvalds published by the Free Software Foundation; 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 121da177e4SLinus Torvalds OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 131da177e4SLinus Torvalds FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 141da177e4SLinus Torvalds IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 151da177e4SLinus Torvalds CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 161da177e4SLinus Torvalds WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 171da177e4SLinus Torvalds ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 181da177e4SLinus Torvalds OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 191da177e4SLinus Torvalds 201da177e4SLinus Torvalds ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 211da177e4SLinus Torvalds COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 221da177e4SLinus Torvalds SOFTWARE IS DISCLAIMED. 231da177e4SLinus Torvalds */ 241da177e4SLinus Torvalds 251da177e4SLinus Torvalds #ifndef __BLUETOOTH_H 261da177e4SLinus Torvalds #define __BLUETOOTH_H 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds #include <linux/poll.h> 291da177e4SLinus Torvalds #include <net/sock.h> 30256a06c8SMasatake YAMATO #include <linux/seq_file.h> 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds #ifndef AF_BLUETOOTH 331da177e4SLinus Torvalds #define AF_BLUETOOTH 31 341da177e4SLinus Torvalds #define PF_BLUETOOTH AF_BLUETOOTH 351da177e4SLinus Torvalds #endif 361da177e4SLinus Torvalds 37d095c1ebSAndrei Emeltchenko /* Bluetooth versions */ 38d095c1ebSAndrei Emeltchenko #define BLUETOOTH_VER_1_1 1 39d095c1ebSAndrei Emeltchenko #define BLUETOOTH_VER_1_2 2 40d095c1ebSAndrei Emeltchenko #define BLUETOOTH_VER_2_0 3 41d095c1ebSAndrei Emeltchenko 421da177e4SLinus Torvalds /* Reserv for core and drivers use */ 431da177e4SLinus Torvalds #define BT_SKB_RESERVE 8 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds #define BTPROTO_L2CAP 0 461da177e4SLinus Torvalds #define BTPROTO_HCI 1 471da177e4SLinus Torvalds #define BTPROTO_SCO 2 481da177e4SLinus Torvalds #define BTPROTO_RFCOMM 3 491da177e4SLinus Torvalds #define BTPROTO_BNEP 4 501da177e4SLinus Torvalds #define BTPROTO_CMTP 5 511da177e4SLinus Torvalds #define BTPROTO_HIDP 6 521da177e4SLinus Torvalds #define BTPROTO_AVDTP 7 531da177e4SLinus Torvalds 541da177e4SLinus Torvalds #define SOL_HCI 0 551da177e4SLinus Torvalds #define SOL_L2CAP 6 561da177e4SLinus Torvalds #define SOL_SCO 17 571da177e4SLinus Torvalds #define SOL_RFCOMM 18 581da177e4SLinus Torvalds 598c1b2355SMarcel Holtmann #define BT_SECURITY 4 608c1b2355SMarcel Holtmann struct bt_security { 618c1b2355SMarcel Holtmann __u8 level; 628f360119SVinicius Costa Gomes __u8 key_size; 638c1b2355SMarcel Holtmann }; 648c1b2355SMarcel Holtmann #define BT_SECURITY_SDP 0 658c1b2355SMarcel Holtmann #define BT_SECURITY_LOW 1 668c1b2355SMarcel Holtmann #define BT_SECURITY_MEDIUM 2 678c1b2355SMarcel Holtmann #define BT_SECURITY_HIGH 3 687b5a9241SMarcel Holtmann #define BT_SECURITY_FIPS 4 698c1b2355SMarcel Holtmann 70c4f912e1SMarcel Holtmann #define BT_DEFER_SETUP 7 71c4f912e1SMarcel Holtmann 72e702112fSAndrei Emeltchenko #define BT_FLUSHABLE 8 73e702112fSAndrei Emeltchenko 74e702112fSAndrei Emeltchenko #define BT_FLUSHABLE_OFF 0 75e702112fSAndrei Emeltchenko #define BT_FLUSHABLE_ON 1 76e702112fSAndrei Emeltchenko 7714b12d0bSJaikumar Ganesh #define BT_POWER 9 7814b12d0bSJaikumar Ganesh struct bt_power { 7914b12d0bSJaikumar Ganesh __u8 force_active; 8014b12d0bSJaikumar Ganesh }; 8114b12d0bSJaikumar Ganesh #define BT_POWER_FORCE_ACTIVE_OFF 0 8214b12d0bSJaikumar Ganesh #define BT_POWER_FORCE_ACTIVE_ON 1 8314b12d0bSJaikumar Ganesh 84c14968b0SMat Martineau #define BT_CHANNEL_POLICY 10 85c14968b0SMat Martineau 86c14968b0SMat Martineau /* BR/EDR only (default policy) 87c14968b0SMat Martineau * AMP controllers cannot be used. 88c14968b0SMat Martineau * Channel move requests from the remote device are denied. 89c14968b0SMat Martineau * If the L2CAP channel is currently using AMP, move the channel to BR/EDR. 90c14968b0SMat Martineau */ 91c14968b0SMat Martineau #define BT_CHANNEL_POLICY_BREDR_ONLY 0 92c14968b0SMat Martineau 93c14968b0SMat Martineau /* BR/EDR Preferred 94c14968b0SMat Martineau * Allow use of AMP controllers. 95c14968b0SMat Martineau * If the L2CAP channel is currently on AMP, move it to BR/EDR. 96c14968b0SMat Martineau * Channel move requests from the remote device are allowed. 97c14968b0SMat Martineau */ 98c14968b0SMat Martineau #define BT_CHANNEL_POLICY_BREDR_PREFERRED 1 99c14968b0SMat Martineau 100c14968b0SMat Martineau /* AMP Preferred 101c14968b0SMat Martineau * Allow use of AMP controllers 102c14968b0SMat Martineau * If the L2CAP channel is currently on BR/EDR and AMP controller 103c14968b0SMat Martineau * resources are available, initiate a channel move to AMP. 104c14968b0SMat Martineau * Channel move requests from the remote device are allowed. 105c14968b0SMat Martineau * If the L2CAP socket has not been connected yet, try to create 106c14968b0SMat Martineau * and configure the channel directly on an AMP controller rather 107c14968b0SMat Martineau * than BR/EDR. 108c14968b0SMat Martineau */ 109c14968b0SMat Martineau #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 110c14968b0SMat Martineau 111ad10b1a4SFrédéric Dalleau #define BT_VOICE 11 112ad10b1a4SFrédéric Dalleau struct bt_voice { 113ad10b1a4SFrédéric Dalleau __u16 setting; 114ad10b1a4SFrédéric Dalleau }; 115ad10b1a4SFrédéric Dalleau 116ad10b1a4SFrédéric Dalleau #define BT_VOICE_TRANSPARENT 0x0003 117ad10b1a4SFrédéric Dalleau #define BT_VOICE_CVSD_16BIT 0x0060 118ad10b1a4SFrédéric Dalleau 1191f435424SJohan Hedberg #define BT_SNDMTU 12 1201f435424SJohan Hedberg #define BT_RCVMTU 13 1211f435424SJohan Hedberg 1223ed7003eSJoe Perches __printf(1, 2) 1232b0bf6c8SJoe Perches void bt_info(const char *fmt, ...); 1243ed7003eSJoe Perches __printf(1, 2) 1252b0bf6c8SJoe Perches void bt_err(const char *fmt, ...); 126e1447d8dSJoe Perches 1273ed7003eSJoe Perches #define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) 1283ed7003eSJoe Perches #define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) 1293ed7003eSJoe Perches #define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) 1301da177e4SLinus Torvalds 131*6f558b70SLoic Poulain #define bt_dev_info(hdev, fmt, ...) \ 132*6f558b70SLoic Poulain BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__) 133*6f558b70SLoic Poulain #define bt_dev_err(hdev, fmt, ...) \ 134*6f558b70SLoic Poulain BT_ERR("%s: " fmt, (hdev)->name, ##__VA_ARGS__) 135*6f558b70SLoic Poulain #define bt_dev_dbg(hdev, fmt, ...) \ 136*6f558b70SLoic Poulain BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__) 137*6f558b70SLoic Poulain 1381da177e4SLinus Torvalds /* Connection and socket states */ 1391da177e4SLinus Torvalds enum { 1401da177e4SLinus Torvalds BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ 1411da177e4SLinus Torvalds BT_OPEN, 1421da177e4SLinus Torvalds BT_BOUND, 1431da177e4SLinus Torvalds BT_LISTEN, 1441da177e4SLinus Torvalds BT_CONNECT, 1451da177e4SLinus Torvalds BT_CONNECT2, 1461da177e4SLinus Torvalds BT_CONFIG, 1471da177e4SLinus Torvalds BT_DISCONN, 1481da177e4SLinus Torvalds BT_CLOSED 1491da177e4SLinus Torvalds }; 1501da177e4SLinus Torvalds 15120d1803aSAndrei Emeltchenko /* If unused will be removed by compiler */ 15220d1803aSAndrei Emeltchenko static inline const char *state_to_string(int state) 15320d1803aSAndrei Emeltchenko { 15420d1803aSAndrei Emeltchenko switch (state) { 15520d1803aSAndrei Emeltchenko case BT_CONNECTED: 15620d1803aSAndrei Emeltchenko return "BT_CONNECTED"; 15720d1803aSAndrei Emeltchenko case BT_OPEN: 15820d1803aSAndrei Emeltchenko return "BT_OPEN"; 15920d1803aSAndrei Emeltchenko case BT_BOUND: 16020d1803aSAndrei Emeltchenko return "BT_BOUND"; 16120d1803aSAndrei Emeltchenko case BT_LISTEN: 16220d1803aSAndrei Emeltchenko return "BT_LISTEN"; 16320d1803aSAndrei Emeltchenko case BT_CONNECT: 16420d1803aSAndrei Emeltchenko return "BT_CONNECT"; 16520d1803aSAndrei Emeltchenko case BT_CONNECT2: 16620d1803aSAndrei Emeltchenko return "BT_CONNECT2"; 16720d1803aSAndrei Emeltchenko case BT_CONFIG: 16820d1803aSAndrei Emeltchenko return "BT_CONFIG"; 16920d1803aSAndrei Emeltchenko case BT_DISCONN: 17020d1803aSAndrei Emeltchenko return "BT_DISCONN"; 17120d1803aSAndrei Emeltchenko case BT_CLOSED: 17220d1803aSAndrei Emeltchenko return "BT_CLOSED"; 17320d1803aSAndrei Emeltchenko } 17420d1803aSAndrei Emeltchenko 17520d1803aSAndrei Emeltchenko return "invalid state"; 17620d1803aSAndrei Emeltchenko } 17720d1803aSAndrei Emeltchenko 1781da177e4SLinus Torvalds /* BD Address */ 1791da177e4SLinus Torvalds typedef struct { 1801da177e4SLinus Torvalds __u8 b[6]; 18166c853ccSGustavo F. Padovan } __packed bdaddr_t; 1821da177e4SLinus Torvalds 183591f47f3SAndre Guedes /* BD Address type */ 184591f47f3SAndre Guedes #define BDADDR_BREDR 0x00 185591f47f3SAndre Guedes #define BDADDR_LE_PUBLIC 0x01 186591f47f3SAndre Guedes #define BDADDR_LE_RANDOM 0x02 187591f47f3SAndre Guedes 188679efe2bSJohan Hedberg static inline bool bdaddr_type_is_valid(__u8 type) 189679efe2bSJohan Hedberg { 190679efe2bSJohan Hedberg switch (type) { 191679efe2bSJohan Hedberg case BDADDR_BREDR: 192679efe2bSJohan Hedberg case BDADDR_LE_PUBLIC: 193679efe2bSJohan Hedberg case BDADDR_LE_RANDOM: 194679efe2bSJohan Hedberg return true; 195679efe2bSJohan Hedberg } 196679efe2bSJohan Hedberg 197679efe2bSJohan Hedberg return false; 198679efe2bSJohan Hedberg } 199679efe2bSJohan Hedberg 200679efe2bSJohan Hedberg static inline bool bdaddr_type_is_le(__u8 type) 201679efe2bSJohan Hedberg { 202679efe2bSJohan Hedberg switch (type) { 203679efe2bSJohan Hedberg case BDADDR_LE_PUBLIC: 204679efe2bSJohan Hedberg case BDADDR_LE_RANDOM: 205679efe2bSJohan Hedberg return true; 206679efe2bSJohan Hedberg } 207679efe2bSJohan Hedberg 208679efe2bSJohan Hedberg return false; 209679efe2bSJohan Hedberg } 210679efe2bSJohan Hedberg 2111da177e4SLinus Torvalds #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 212a59ac2f7SMarcel Holtmann #define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) 2131da177e4SLinus Torvalds 2141da177e4SLinus Torvalds /* Copy, swap, convert BD Address */ 215f53c20e9SDavid Herrmann static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) 2161da177e4SLinus Torvalds { 2171da177e4SLinus Torvalds return memcmp(ba1, ba2, sizeof(bdaddr_t)); 2181da177e4SLinus Torvalds } 219f53c20e9SDavid Herrmann static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src) 2201da177e4SLinus Torvalds { 2211da177e4SLinus Torvalds memcpy(dst, src, sizeof(bdaddr_t)); 2221da177e4SLinus Torvalds } 2231da177e4SLinus Torvalds 2241da177e4SLinus Torvalds void baswap(bdaddr_t *dst, bdaddr_t *src); 2251da177e4SLinus Torvalds 2261da177e4SLinus Torvalds /* Common socket structures and functions */ 2271da177e4SLinus Torvalds 2281da177e4SLinus Torvalds #define bt_sk(__sk) ((struct bt_sock *) __sk) 2291da177e4SLinus Torvalds 2301da177e4SLinus Torvalds struct bt_sock { 2311da177e4SLinus Torvalds struct sock sk; 2321da177e4SLinus Torvalds struct list_head accept_q; 2331da177e4SLinus Torvalds struct sock *parent; 234c5daa683SGustavo Padovan unsigned long flags; 235d9763698SMarcel Holtmann void (*skb_msg_name)(struct sk_buff *, void *, int *); 236c5daa683SGustavo Padovan }; 237c5daa683SGustavo Padovan 238c5daa683SGustavo Padovan enum { 239c5daa683SGustavo Padovan BT_SK_DEFER_SETUP, 240c5daa683SGustavo Padovan BT_SK_SUSPEND, 2411da177e4SLinus Torvalds }; 2421da177e4SLinus Torvalds 2431da177e4SLinus Torvalds struct bt_sock_list { 2441da177e4SLinus Torvalds struct hlist_head head; 2451da177e4SLinus Torvalds rwlock_t lock; 246256a06c8SMasatake YAMATO #ifdef CONFIG_PROC_FS 247256a06c8SMasatake YAMATO int (* custom_seq_show)(struct seq_file *, void *); 248256a06c8SMasatake YAMATO #endif 2491da177e4SLinus Torvalds }; 2501da177e4SLinus Torvalds 251ec1b4cf7SStephen Hemminger int bt_sock_register(int proto, const struct net_proto_family *ops); 252be9f97f0SDavid Herrmann void bt_sock_unregister(int proto); 2531da177e4SLinus Torvalds void bt_sock_link(struct bt_sock_list *l, struct sock *s); 2541da177e4SLinus Torvalds void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 2551b784140SYing Xue int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, 2561b784140SYing Xue int flags); 2571b784140SYing Xue int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg, 2581b784140SYing Xue size_t len, int flags); 2591da177e4SLinus Torvalds uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); 2603241ad82SMarcel Holtmann int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 2611da177e4SLinus Torvalds int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 262e793dcf0SJohan Hedberg int bt_sock_wait_ready(struct sock *sk, unsigned long flags); 2631da177e4SLinus Torvalds 2641da177e4SLinus Torvalds void bt_accept_enqueue(struct sock *parent, struct sock *sk); 2651da177e4SLinus Torvalds void bt_accept_unlink(struct sock *sk); 2661da177e4SLinus Torvalds struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); 2671da177e4SLinus Torvalds 2681da177e4SLinus Torvalds /* Skb helpers */ 26900e3112cSMat Martineau struct l2cap_ctrl { 27007758991SMarcel Holtmann __u8 sframe:1, 27100e3112cSMat Martineau poll:1, 27200e3112cSMat Martineau final:1, 27300e3112cSMat Martineau fcs:1, 27400e3112cSMat Martineau sar:2, 27500e3112cSMat Martineau super:2; 27600e3112cSMat Martineau __u16 reqseq; 27700e3112cSMat Martineau __u16 txseq; 27800e3112cSMat Martineau __u8 retries; 279a4368ff3SJohan Hedberg __le16 psm; 280a4368ff3SJohan Hedberg bdaddr_t bdaddr; 281a4368ff3SJohan Hedberg struct l2cap_chan *chan; 28200e3112cSMat Martineau }; 28300e3112cSMat Martineau 2843119ae95SJohan Hedberg struct hci_dev; 2853119ae95SJohan Hedberg 2861904a853SMarcel Holtmann typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode); 287e6214487SJohan Hedberg typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status, 288e6214487SJohan Hedberg u16 opcode, struct sk_buff *skb); 2893119ae95SJohan Hedberg 290db6e3e8dSJohan Hedberg struct req_ctrl { 291db6e3e8dSJohan Hedberg bool start; 292db6e3e8dSJohan Hedberg u8 event; 293db6e3e8dSJohan Hedberg hci_req_complete_t complete; 294e6214487SJohan Hedberg hci_req_complete_skb_t complete_skb; 295db6e3e8dSJohan Hedberg }; 296db6e3e8dSJohan Hedberg 2971da177e4SLinus Torvalds struct bt_skb_cb { 2980d48d939SMarcel Holtmann __u8 pkt_type; 2996368c235SEyal Birger __u8 force_active; 30043e73e4eSMarcel Holtmann __u16 opcode; 30133e882a5SSuraj Sumangala __u16 expect; 3026368c235SEyal Birger __u8 incoming:1; 303db6e3e8dSJohan Hedberg union { 304a4368ff3SJohan Hedberg struct l2cap_ctrl l2cap; 305db6e3e8dSJohan Hedberg struct req_ctrl req; 306db6e3e8dSJohan Hedberg }; 3071da177e4SLinus Torvalds }; 3081c2acffbSGustavo F. Padovan #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 3091da177e4SLinus Torvalds 310dd0fc66fSAl Viro static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) 3111da177e4SLinus Torvalds { 3121da177e4SLinus Torvalds struct sk_buff *skb; 3131da177e4SLinus Torvalds 314c3c7ea65SGustavo Padovan skb = alloc_skb(len + BT_SKB_RESERVE, how); 315c3c7ea65SGustavo Padovan if (skb) { 3161da177e4SLinus Torvalds skb_reserve(skb, BT_SKB_RESERVE); 3171da177e4SLinus Torvalds bt_cb(skb)->incoming = 0; 3181da177e4SLinus Torvalds } 3191da177e4SLinus Torvalds return skb; 3201da177e4SLinus Torvalds } 3211da177e4SLinus Torvalds 3225a9d0a3fSWaldemar Rymarkiewicz static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, 3235a9d0a3fSWaldemar Rymarkiewicz unsigned long len, int nb, int *err) 3241da177e4SLinus Torvalds { 3251da177e4SLinus Torvalds struct sk_buff *skb; 3261da177e4SLinus Torvalds 327c3c7ea65SGustavo Padovan skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err); 328c3c7ea65SGustavo Padovan if (skb) { 3291da177e4SLinus Torvalds skb_reserve(skb, BT_SKB_RESERVE); 3301da177e4SLinus Torvalds bt_cb(skb)->incoming = 0; 3311da177e4SLinus Torvalds } 332e454c844SGustavo F. Padovan 333e454c844SGustavo F. Padovan if (!skb && *err) 334e454c844SGustavo F. Padovan return NULL; 335e454c844SGustavo F. Padovan 336e454c844SGustavo F. Padovan *err = sock_error(sk); 337e454c844SGustavo F. Padovan if (*err) 338e454c844SGustavo F. Padovan goto out; 339e454c844SGustavo F. Padovan 340e454c844SGustavo F. Padovan if (sk->sk_shutdown) { 341e454c844SGustavo F. Padovan *err = -ECONNRESET; 342e454c844SGustavo F. Padovan goto out; 343e454c844SGustavo F. Padovan } 3441da177e4SLinus Torvalds 3451da177e4SLinus Torvalds return skb; 346e454c844SGustavo F. Padovan 347e454c844SGustavo F. Padovan out: 348e454c844SGustavo F. Padovan kfree_skb(skb); 349e454c844SGustavo F. Padovan return NULL; 3501da177e4SLinus Torvalds } 3511da177e4SLinus Torvalds 352e175072fSJoe Perches int bt_to_errno(__u16 code); 3531da177e4SLinus Torvalds 3546befc644SMarcel Holtmann void hci_sock_set_flag(struct sock *sk, int nr); 3556befc644SMarcel Holtmann void hci_sock_clear_flag(struct sock *sk, int nr); 356c85be545SMarcel Holtmann int hci_sock_test_flag(struct sock *sk, int nr); 357d0f172b1SJohan Hedberg unsigned short hci_sock_get_channel(struct sock *sk); 3586befc644SMarcel Holtmann 359e74e58f8SJoe Perches int hci_sock_init(void); 360e74e58f8SJoe Perches void hci_sock_cleanup(void); 3616516455dSMarcel Holtmann 362e74e58f8SJoe Perches int bt_sysfs_init(void); 363e74e58f8SJoe Perches void bt_sysfs_cleanup(void); 3646516455dSMarcel Holtmann 365e74e58f8SJoe Perches int bt_procfs_init(struct net *net, const char *name, 366256a06c8SMasatake YAMATO struct bt_sock_list *sk_list, 367256a06c8SMasatake YAMATO int (*seq_show)(struct seq_file *, void *)); 368e74e58f8SJoe Perches void bt_procfs_cleanup(struct net *net, const char *name); 369256a06c8SMasatake YAMATO 370aef7d97cSMarcel Holtmann extern struct dentry *bt_debugfs; 371be9d1227SMarcel Holtmann 37264274518SGustavo F. Padovan int l2cap_init(void); 37364274518SGustavo F. Padovan void l2cap_exit(void); 37464274518SGustavo F. Padovan 375ff50e8afSArron Wang #if IS_ENABLED(CONFIG_BT_BREDR) 37664274518SGustavo F. Padovan int sco_init(void); 37764274518SGustavo F. Padovan void sco_exit(void); 378ff50e8afSArron Wang #else 379ff50e8afSArron Wang static inline int sco_init(void) 380ff50e8afSArron Wang { 381ff50e8afSArron Wang return 0; 382ff50e8afSArron Wang } 383ff50e8afSArron Wang 384ff50e8afSArron Wang static inline void sco_exit(void) 385ff50e8afSArron Wang { 386ff50e8afSArron Wang } 387ff50e8afSArron Wang #endif 38864274518SGustavo F. Padovan 3896d785aa3SJohan Hedberg int mgmt_init(void); 3906d785aa3SJohan Hedberg void mgmt_exit(void); 3916d785aa3SJohan Hedberg 392d22015aaSOctavian Purdila void bt_sock_reclassify_lock(struct sock *sk, int proto); 393d22015aaSOctavian Purdila 3941da177e4SLinus Torvalds #endif /* __BLUETOOTH_H */ 395