1/*
2 *
3 *  BlueZ - Bluetooth protocol stack for Linux
4 *
5 *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
6 *  Copyright (C) 2002-2010  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
29extern "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/* RFCOMM socket address */
40struct sockaddr_rc {
41	sa_family_t	rc_family;
42	bdaddr_t	rc_bdaddr;
43	uint8_t		rc_channel;
44};
45
46/* RFCOMM socket options */
47#define RFCOMM_CONNINFO	0x02
48struct rfcomm_conninfo {
49	uint16_t	hci_handle;
50	uint8_t		dev_class[3];
51};
52
53#define RFCOMM_LM	0x03
54#define RFCOMM_LM_MASTER	0x0001
55#define RFCOMM_LM_AUTH		0x0002
56#define RFCOMM_LM_ENCRYPT	0x0004
57#define RFCOMM_LM_TRUSTED	0x0008
58#define RFCOMM_LM_RELIABLE	0x0010
59#define RFCOMM_LM_SECURE	0x0020
60
61/* RFCOMM TTY support */
62#define RFCOMM_MAX_DEV	256
63
64#define RFCOMMCREATEDEV		_IOW('R', 200, int)
65#define RFCOMMRELEASEDEV	_IOW('R', 201, int)
66#define RFCOMMGETDEVLIST	_IOR('R', 210, int)
67#define RFCOMMGETDEVINFO	_IOR('R', 211, int)
68
69struct rfcomm_dev_req {
70	int16_t		dev_id;
71	uint32_t	flags;
72	bdaddr_t	src;
73	bdaddr_t	dst;
74	uint8_t	channel;
75};
76#define RFCOMM_REUSE_DLC	0
77#define RFCOMM_RELEASE_ONHUP	1
78#define RFCOMM_HANGUP_NOW	2
79#define RFCOMM_TTY_ATTACHED	3
80
81struct rfcomm_dev_info {
82	int16_t		id;
83	uint32_t	flags;
84	uint16_t	state;
85	bdaddr_t	src;
86	bdaddr_t	dst;
87	uint8_t		channel;
88};
89
90struct rfcomm_dev_list_req {
91	uint16_t	dev_num;
92	struct rfcomm_dev_info dev_info[0];
93};
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* __RFCOMM_H */
100