Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | BlueZ - Bluetooth protocol stack for Linux |
| 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 4 | Copyright (c) 2011, The Linux Foundation. All rights reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 20 | |
Andrei Emeltchenko | be21871 | 2010-12-01 16:58:26 +0200 | [diff] [blame] | 21 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
| 22 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | SOFTWARE IS DISCLAIMED. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __SCO_H |
| 27 | #define __SCO_H |
| 28 | |
| 29 | /* SCO defaults */ |
| 30 | #define SCO_DEFAULT_MTU 500 |
| 31 | #define SCO_DEFAULT_FLUSH_TO 0xFFFF |
| 32 | |
| 33 | #define SCO_CONN_TIMEOUT (HZ * 40) |
Srinivas Krovvidi | f799996 | 2012-08-01 18:21:37 +0530 | [diff] [blame] | 34 | #define SCO_DISCONN_TIMEOUT (HZ * 20) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #define SCO_CONN_IDLE_TIMEOUT (HZ * 60) |
| 36 | |
| 37 | /* SCO socket address */ |
| 38 | struct sockaddr_sco { |
| 39 | sa_family_t sco_family; |
| 40 | bdaddr_t sco_bdaddr; |
Nick Pelly | bbcda3b | 2010-02-11 11:54:28 -0800 | [diff] [blame] | 41 | __u16 sco_pkt_type; |
Kun Han Kim | 15b911f | 2011-07-08 09:30:28 -0700 | [diff] [blame] | 42 | __s8 is_wbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | /* SCO socket options */ |
| 46 | #define SCO_OPTIONS 0x01 |
| 47 | struct sco_options { |
| 48 | __u16 mtu; |
| 49 | }; |
| 50 | |
| 51 | #define SCO_CONNINFO 0x02 |
| 52 | struct sco_conninfo { |
| 53 | __u16 hci_handle; |
| 54 | __u8 dev_class[3]; |
| 55 | }; |
| 56 | |
| 57 | /* ---- SCO connections ---- */ |
| 58 | struct sco_conn { |
| 59 | struct hci_conn *hcon; |
| 60 | |
Andrei Emeltchenko | 735cbc4 | 2010-12-01 16:58:22 +0200 | [diff] [blame] | 61 | bdaddr_t *dst; |
| 62 | bdaddr_t *src; |
| 63 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | spinlock_t lock; |
Andrei Emeltchenko | 735cbc4 | 2010-12-01 16:58:22 +0200 | [diff] [blame] | 65 | struct sock *sk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | unsigned int mtu; |
| 68 | }; |
| 69 | |
| 70 | #define sco_conn_lock(c) spin_lock(&c->lock); |
| 71 | #define sco_conn_unlock(c) spin_unlock(&c->lock); |
| 72 | |
| 73 | /* ----- SCO socket info ----- */ |
| 74 | #define sco_pi(sk) ((struct sco_pinfo *) sk) |
| 75 | |
| 76 | struct sco_pinfo { |
| 77 | struct bt_sock bt; |
Nick Pelly | bbcda3b | 2010-02-11 11:54:28 -0800 | [diff] [blame] | 78 | __u16 pkt_type; |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | struct sco_conn *conn; |
| 81 | }; |
| 82 | |
| 83 | #endif /* __SCO_H */ |