Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 1 | /* |
| 2 | RFCOMM implementation for Linux Bluetooth stack (BlueZ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> |
| 4 | Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License version 2 as |
| 8 | published by the Free Software Foundation; |
| 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 |
Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | |
Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
| 20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | SOFTWARE IS DISCLAIMED. |
| 22 | */ |
| 23 | |
| 24 | #ifndef __RFCOMM_H |
| 25 | #define __RFCOMM_H |
| 26 | |
| 27 | #define RFCOMM_PSM 3 |
| 28 | |
| 29 | #define RFCOMM_CONN_TIMEOUT (HZ * 30) |
| 30 | #define RFCOMM_DISC_TIMEOUT (HZ * 20) |
| 31 | #define RFCOMM_AUTH_TIMEOUT (HZ * 25) |
Luiz Augusto von Dentz | 9e726b1 | 2009-07-15 13:50:58 -0300 | [diff] [blame] | 32 | #define RFCOMM_IDLE_TIMEOUT (HZ * 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | #define RFCOMM_DEFAULT_MTU 127 |
| 35 | #define RFCOMM_DEFAULT_CREDITS 7 |
| 36 | |
Marcel Holtmann | 56f3a40 | 2006-02-13 11:39:57 +0100 | [diff] [blame] | 37 | #define RFCOMM_MAX_L2CAP_MTU 1013 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | #define RFCOMM_MAX_CREDITS 40 |
| 39 | |
| 40 | #define RFCOMM_SKB_HEAD_RESERVE 8 |
| 41 | #define RFCOMM_SKB_TAIL_RESERVE 2 |
| 42 | #define RFCOMM_SKB_RESERVE (RFCOMM_SKB_HEAD_RESERVE + RFCOMM_SKB_TAIL_RESERVE) |
| 43 | |
| 44 | #define RFCOMM_SABM 0x2f |
| 45 | #define RFCOMM_DISC 0x43 |
| 46 | #define RFCOMM_UA 0x63 |
| 47 | #define RFCOMM_DM 0x0f |
| 48 | #define RFCOMM_UIH 0xef |
| 49 | |
| 50 | #define RFCOMM_TEST 0x08 |
| 51 | #define RFCOMM_FCON 0x28 |
| 52 | #define RFCOMM_FCOFF 0x18 |
| 53 | #define RFCOMM_MSC 0x38 |
| 54 | #define RFCOMM_RPN 0x24 |
| 55 | #define RFCOMM_RLS 0x14 |
| 56 | #define RFCOMM_PN 0x20 |
| 57 | #define RFCOMM_NSC 0x04 |
| 58 | |
| 59 | #define RFCOMM_V24_FC 0x02 |
| 60 | #define RFCOMM_V24_RTC 0x04 |
| 61 | #define RFCOMM_V24_RTR 0x08 |
| 62 | #define RFCOMM_V24_IC 0x40 |
| 63 | #define RFCOMM_V24_DV 0x80 |
| 64 | |
| 65 | #define RFCOMM_RPN_BR_2400 0x0 |
| 66 | #define RFCOMM_RPN_BR_4800 0x1 |
| 67 | #define RFCOMM_RPN_BR_7200 0x2 |
| 68 | #define RFCOMM_RPN_BR_9600 0x3 |
| 69 | #define RFCOMM_RPN_BR_19200 0x4 |
| 70 | #define RFCOMM_RPN_BR_38400 0x5 |
| 71 | #define RFCOMM_RPN_BR_57600 0x6 |
| 72 | #define RFCOMM_RPN_BR_115200 0x7 |
| 73 | #define RFCOMM_RPN_BR_230400 0x8 |
| 74 | |
| 75 | #define RFCOMM_RPN_DATA_5 0x0 |
| 76 | #define RFCOMM_RPN_DATA_6 0x1 |
| 77 | #define RFCOMM_RPN_DATA_7 0x2 |
| 78 | #define RFCOMM_RPN_DATA_8 0x3 |
| 79 | |
| 80 | #define RFCOMM_RPN_STOP_1 0 |
| 81 | #define RFCOMM_RPN_STOP_15 1 |
| 82 | |
| 83 | #define RFCOMM_RPN_PARITY_NONE 0x0 |
J. Suter | 3a5e903 | 2005-08-09 20:28:46 -0700 | [diff] [blame] | 84 | #define RFCOMM_RPN_PARITY_ODD 0x1 |
| 85 | #define RFCOMM_RPN_PARITY_EVEN 0x3 |
| 86 | #define RFCOMM_RPN_PARITY_MARK 0x5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | #define RFCOMM_RPN_PARITY_SPACE 0x7 |
| 88 | |
| 89 | #define RFCOMM_RPN_FLOW_NONE 0x00 |
| 90 | |
| 91 | #define RFCOMM_RPN_XON_CHAR 0x11 |
| 92 | #define RFCOMM_RPN_XOFF_CHAR 0x13 |
| 93 | |
| 94 | #define RFCOMM_RPN_PM_BITRATE 0x0001 |
| 95 | #define RFCOMM_RPN_PM_DATA 0x0002 |
| 96 | #define RFCOMM_RPN_PM_STOP 0x0004 |
| 97 | #define RFCOMM_RPN_PM_PARITY 0x0008 |
| 98 | #define RFCOMM_RPN_PM_PARITY_TYPE 0x0010 |
| 99 | #define RFCOMM_RPN_PM_XON 0x0020 |
| 100 | #define RFCOMM_RPN_PM_XOFF 0x0040 |
| 101 | #define RFCOMM_RPN_PM_FLOW 0x3F00 |
| 102 | |
| 103 | #define RFCOMM_RPN_PM_ALL 0x3F7F |
| 104 | |
| 105 | struct rfcomm_hdr { |
| 106 | u8 addr; |
| 107 | u8 ctrl; |
Andrei Emeltchenko | 285b4e9 | 2010-12-01 16:58:23 +0200 | [diff] [blame] | 108 | u8 len; /* Actual size can be 2 bytes */ |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 109 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | struct rfcomm_cmd { |
| 112 | u8 addr; |
| 113 | u8 ctrl; |
| 114 | u8 len; |
| 115 | u8 fcs; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 116 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
| 118 | struct rfcomm_mcc { |
| 119 | u8 type; |
| 120 | u8 len; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 121 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | |
| 123 | struct rfcomm_pn { |
| 124 | u8 dlci; |
| 125 | u8 flow_ctrl; |
| 126 | u8 priority; |
| 127 | u8 ack_timer; |
Al Viro | 6ba9c75 | 2006-11-08 00:28:19 -0800 | [diff] [blame] | 128 | __le16 mtu; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | u8 max_retrans; |
| 130 | u8 credits; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 131 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
| 133 | struct rfcomm_rpn { |
| 134 | u8 dlci; |
| 135 | u8 bit_rate; |
| 136 | u8 line_settings; |
| 137 | u8 flow_ctrl; |
| 138 | u8 xon_char; |
| 139 | u8 xoff_char; |
Al Viro | 6ba9c75 | 2006-11-08 00:28:19 -0800 | [diff] [blame] | 140 | __le16 param_mask; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 141 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | |
| 143 | struct rfcomm_rls { |
| 144 | u8 dlci; |
| 145 | u8 status; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 146 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
| 148 | struct rfcomm_msc { |
| 149 | u8 dlci; |
| 150 | u8 v24_sig; |
Gustavo F. Padovan | 66c853c | 2010-07-19 02:00:13 -0300 | [diff] [blame] | 151 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
| 153 | /* ---- Core structures, flags etc ---- */ |
| 154 | |
| 155 | struct rfcomm_session { |
| 156 | struct list_head list; |
| 157 | struct socket *sock; |
Luiz Augusto von Dentz | 9e726b1 | 2009-07-15 13:50:58 -0300 | [diff] [blame] | 158 | struct timer_list timer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | unsigned long state; |
| 160 | unsigned long flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | int initiator; |
| 162 | |
| 163 | /* Default DLC parameters */ |
| 164 | int cfc; |
| 165 | uint mtu; |
| 166 | |
| 167 | struct list_head dlcs; |
| 168 | }; |
| 169 | |
| 170 | struct rfcomm_dlc { |
| 171 | struct list_head list; |
| 172 | struct rfcomm_session *session; |
| 173 | struct sk_buff_head tx_queue; |
| 174 | struct timer_list timer; |
| 175 | |
| 176 | spinlock_t lock; |
| 177 | unsigned long state; |
| 178 | unsigned long flags; |
| 179 | atomic_t refcnt; |
| 180 | u8 dlci; |
| 181 | u8 addr; |
| 182 | u8 priority; |
| 183 | u8 v24_sig; |
Marcel Holtmann | 8b6b3da | 2008-07-14 20:13:52 +0200 | [diff] [blame] | 184 | u8 remote_v24_sig; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | u8 mscex; |
Marcel Holtmann | 77db198 | 2008-07-14 20:13:45 +0200 | [diff] [blame] | 186 | u8 out; |
Marcel Holtmann | 9f2c8a0 | 2009-01-15 21:58:40 +0100 | [diff] [blame] | 187 | u8 sec_level; |
| 188 | u8 role_switch; |
Marcel Holtmann | bb23c0a | 2009-01-15 21:56:48 +0100 | [diff] [blame] | 189 | u32 defer_setup; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
| 191 | uint mtu; |
| 192 | uint cfc; |
| 193 | uint rx_credits; |
| 194 | uint tx_credits; |
| 195 | |
| 196 | void *owner; |
| 197 | |
| 198 | void (*data_ready)(struct rfcomm_dlc *d, struct sk_buff *skb); |
| 199 | void (*state_change)(struct rfcomm_dlc *d, int err); |
| 200 | void (*modem_status)(struct rfcomm_dlc *d, u8 v24_sig); |
| 201 | }; |
| 202 | |
| 203 | /* DLC and session flags */ |
| 204 | #define RFCOMM_RX_THROTTLED 0 |
| 205 | #define RFCOMM_TX_THROTTLED 1 |
| 206 | #define RFCOMM_TIMED_OUT 2 |
Marcel Holtmann | bb23c0a | 2009-01-15 21:56:48 +0100 | [diff] [blame] | 207 | #define RFCOMM_MSC_PENDING 3 |
Marcel Holtmann | 8c84b83 | 2009-01-16 08:17:51 +0100 | [diff] [blame] | 208 | #define RFCOMM_SEC_PENDING 4 |
| 209 | #define RFCOMM_AUTH_PENDING 5 |
| 210 | #define RFCOMM_AUTH_ACCEPT 6 |
| 211 | #define RFCOMM_AUTH_REJECT 7 |
| 212 | #define RFCOMM_DEFER_SETUP 8 |
Szymon Janc | 88149db | 2011-09-26 14:19:47 +0200 | [diff] [blame] | 213 | #define RFCOMM_ENC_DROP 9 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | |
| 215 | /* Scheduling flags and events */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | #define RFCOMM_SCHED_WAKEUP 31 |
| 217 | |
| 218 | /* MSC exchange flags */ |
| 219 | #define RFCOMM_MSCEX_TX 1 |
| 220 | #define RFCOMM_MSCEX_RX 2 |
| 221 | #define RFCOMM_MSCEX_OK (RFCOMM_MSCEX_TX + RFCOMM_MSCEX_RX) |
| 222 | |
| 223 | /* CFC states */ |
| 224 | #define RFCOMM_CFC_UNKNOWN -1 |
| 225 | #define RFCOMM_CFC_DISABLED 0 |
| 226 | #define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS |
| 227 | |
J. Suter | 3a5e903 | 2005-08-09 20:28:46 -0700 | [diff] [blame] | 228 | /* ---- RFCOMM SEND RPN ---- */ |
| 229 | int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, |
| 230 | u8 bit_rate, u8 data_bits, u8 stop_bits, |
Andrei Emeltchenko | 285b4e9 | 2010-12-01 16:58:23 +0200 | [diff] [blame] | 231 | u8 parity, u8 flow_ctrl_settings, |
J. Suter | 3a5e903 | 2005-08-09 20:28:46 -0700 | [diff] [blame] | 232 | u8 xon_char, u8 xoff_char, u16 param_mask); |
| 233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | /* ---- RFCOMM DLCs (channels) ---- */ |
Al Viro | dd0fc66 | 2005-10-07 07:46:04 +0100 | [diff] [blame] | 235 | struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | void rfcomm_dlc_free(struct rfcomm_dlc *d); |
Waldemar Rymarkiewicz | 5a9d0a3 | 2011-06-07 11:18:06 +0200 | [diff] [blame] | 237 | int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, |
| 238 | u8 channel); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); |
| 240 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); |
| 241 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); |
| 242 | int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); |
Marcel Holtmann | bb23c0a | 2009-01-15 21:56:48 +0100 | [diff] [blame] | 243 | void rfcomm_dlc_accept(struct rfcomm_dlc *d); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | |
| 245 | #define rfcomm_dlc_lock(d) spin_lock(&d->lock) |
| 246 | #define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) |
| 247 | |
| 248 | static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) |
| 249 | { |
| 250 | atomic_inc(&d->refcnt); |
| 251 | } |
| 252 | |
| 253 | static inline void rfcomm_dlc_put(struct rfcomm_dlc *d) |
| 254 | { |
| 255 | if (atomic_dec_and_test(&d->refcnt)) |
| 256 | rfcomm_dlc_free(d); |
| 257 | } |
| 258 | |
Harvey Harrison | 4138093 | 2007-12-12 10:46:51 -0800 | [diff] [blame] | 259 | extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); |
| 260 | extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | |
| 262 | static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) |
| 263 | { |
| 264 | if (!test_and_set_bit(RFCOMM_RX_THROTTLED, &d->flags)) |
| 265 | __rfcomm_dlc_throttle(d); |
| 266 | } |
| 267 | |
| 268 | static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) |
| 269 | { |
| 270 | if (test_and_clear_bit(RFCOMM_RX_THROTTLED, &d->flags)) |
| 271 | __rfcomm_dlc_unthrottle(d); |
| 272 | } |
| 273 | |
| 274 | /* ---- RFCOMM sessions ---- */ |
Waldemar Rymarkiewicz | 5a9d0a3 | 2011-06-07 11:18:06 +0200 | [diff] [blame] | 275 | void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, |
| 276 | bdaddr_t *dst); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | /* ---- RFCOMM sockets ---- */ |
| 279 | struct sockaddr_rc { |
| 280 | sa_family_t rc_family; |
| 281 | bdaddr_t rc_bdaddr; |
| 282 | u8 rc_channel; |
| 283 | }; |
| 284 | |
| 285 | #define RFCOMM_CONNINFO 0x02 |
| 286 | struct rfcomm_conninfo { |
| 287 | __u16 hci_handle; |
| 288 | __u8 dev_class[3]; |
| 289 | }; |
| 290 | |
| 291 | #define RFCOMM_LM 0x03 |
| 292 | #define RFCOMM_LM_MASTER 0x0001 |
| 293 | #define RFCOMM_LM_AUTH 0x0002 |
| 294 | #define RFCOMM_LM_ENCRYPT 0x0004 |
| 295 | #define RFCOMM_LM_TRUSTED 0x0008 |
| 296 | #define RFCOMM_LM_RELIABLE 0x0010 |
| 297 | #define RFCOMM_LM_SECURE 0x0020 |
| 298 | |
| 299 | #define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) |
| 300 | |
| 301 | struct rfcomm_pinfo { |
| 302 | struct bt_sock bt; |
| 303 | struct rfcomm_dlc *dlc; |
| 304 | u8 channel; |
Marcel Holtmann | 9f2c8a0 | 2009-01-15 21:58:40 +0100 | [diff] [blame] | 305 | u8 sec_level; |
| 306 | u8 role_switch; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | }; |
| 308 | |
| 309 | int rfcomm_init_sockets(void); |
| 310 | void rfcomm_cleanup_sockets(void); |
| 311 | |
Waldemar Rymarkiewicz | 5a9d0a3 | 2011-06-07 11:18:06 +0200 | [diff] [blame] | 312 | int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, |
| 313 | struct rfcomm_dlc **d); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | /* ---- RFCOMM TTY ---- */ |
| 316 | #define RFCOMM_MAX_DEV 256 |
| 317 | |
| 318 | #define RFCOMMCREATEDEV _IOW('R', 200, int) |
| 319 | #define RFCOMMRELEASEDEV _IOW('R', 201, int) |
| 320 | #define RFCOMMGETDEVLIST _IOR('R', 210, int) |
| 321 | #define RFCOMMGETDEVINFO _IOR('R', 211, int) |
| 322 | #define RFCOMMSTEALDLC _IOW('R', 220, int) |
| 323 | |
| 324 | #define RFCOMM_REUSE_DLC 0 |
| 325 | #define RFCOMM_RELEASE_ONHUP 1 |
| 326 | #define RFCOMM_HANGUP_NOW 2 |
| 327 | #define RFCOMM_TTY_ATTACHED 3 |
Ville Tervo | 8de0a15 | 2007-07-11 09:23:41 +0200 | [diff] [blame] | 328 | #define RFCOMM_TTY_RELEASED 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
| 330 | struct rfcomm_dev_req { |
| 331 | s16 dev_id; |
| 332 | u32 flags; |
| 333 | bdaddr_t src; |
| 334 | bdaddr_t dst; |
| 335 | u8 channel; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | }; |
| 337 | |
| 338 | struct rfcomm_dev_info { |
| 339 | s16 id; |
| 340 | u32 flags; |
| 341 | u16 state; |
| 342 | bdaddr_t src; |
| 343 | bdaddr_t dst; |
| 344 | u8 channel; |
| 345 | }; |
| 346 | |
| 347 | struct rfcomm_dev_list_req { |
| 348 | u16 dev_num; |
| 349 | struct rfcomm_dev_info dev_info[0]; |
| 350 | }; |
| 351 | |
| 352 | int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); |
Dave Young | af0d3b1 | 2009-08-03 04:26:16 +0000 | [diff] [blame] | 353 | |
| 354 | #ifdef CONFIG_BT_RFCOMM_TTY |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | int rfcomm_init_ttys(void); |
| 356 | void rfcomm_cleanup_ttys(void); |
Dave Young | af0d3b1 | 2009-08-03 04:26:16 +0000 | [diff] [blame] | 357 | #else |
| 358 | static inline int rfcomm_init_ttys(void) |
| 359 | { |
| 360 | return 0; |
| 361 | } |
| 362 | static inline void rfcomm_cleanup_ttys(void) |
| 363 | { |
| 364 | } |
| 365 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | #endif /* __RFCOMM_H */ |