OSDN Git Service

Initial Contribution
[android-x86/external-bluetooth-bluez.git] / libs / include / bluetooth / rfcomm.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
6  *  Copyright (C) 2002-2008  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #ifndef __RFCOMM_H
26 #define __RFCOMM_H
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #include <sys/socket.h>
33
34 /* RFCOMM defaults */
35 #define RFCOMM_DEFAULT_MTU      127
36
37 #define RFCOMM_PSM 3
38
39 #define RFCOMM_CONN_TIMEOUT     (HZ * 30)
40 #define RFCOMM_DISC_TIMEOUT     (HZ * 20)
41
42 /* RFCOMM socket address */
43 struct sockaddr_rc {
44         sa_family_t     rc_family;
45         bdaddr_t        rc_bdaddr;
46         uint8_t         rc_channel;
47 };
48
49 /* RFCOMM socket options */
50 #define RFCOMM_CONNINFO 0x02
51 struct rfcomm_conninfo {
52         uint16_t        hci_handle;
53         uint8_t         dev_class[3];
54 };
55
56 #define RFCOMM_LM       0x03
57 #define RFCOMM_LM_MASTER        0x0001
58 #define RFCOMM_LM_AUTH          0x0002
59 #define RFCOMM_LM_ENCRYPT       0x0004
60 #define RFCOMM_LM_TRUSTED       0x0008
61 #define RFCOMM_LM_RELIABLE      0x0010
62 #define RFCOMM_LM_SECURE        0x0020
63
64 /* RFCOMM TTY support */
65 #define RFCOMM_MAX_DEV  256
66
67 #define RFCOMMCREATEDEV         _IOW('R', 200, int)
68 #define RFCOMMRELEASEDEV        _IOW('R', 201, int)
69 #define RFCOMMGETDEVLIST        _IOR('R', 210, int)
70 #define RFCOMMGETDEVINFO        _IOR('R', 211, int)
71
72 struct rfcomm_dev_req {
73         int16_t         dev_id;
74         uint32_t        flags;
75         bdaddr_t        src;
76         bdaddr_t        dst;
77         uint8_t channel;
78 };
79 #define RFCOMM_REUSE_DLC        0
80 #define RFCOMM_RELEASE_ONHUP    1
81 #define RFCOMM_HANGUP_NOW       2
82 #define RFCOMM_TTY_ATTACHED     3
83
84 struct rfcomm_dev_info {
85         int16_t         id;
86         uint32_t        flags;
87         uint16_t        state;
88         bdaddr_t        src;
89         bdaddr_t        dst;
90         uint8_t         channel;
91 };
92
93 struct rfcomm_dev_list_req {
94         uint16_t        dev_num;
95         struct rfcomm_dev_info dev_info[0];
96 };
97
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif /* __RFCOMM_H */