xref: /openbmc/linux/include/net/bluetooth/hci_sock.h (revision f49daa8190ebf25eae907048266b590a9cdccb95)
1*f49daa81SMarcel Holtmann /*
2*f49daa81SMarcel Holtmann    BlueZ - Bluetooth protocol stack for Linux
3*f49daa81SMarcel Holtmann    Copyright (C) 2000-2001 Qualcomm Incorporated
4*f49daa81SMarcel Holtmann 
5*f49daa81SMarcel Holtmann    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6*f49daa81SMarcel Holtmann 
7*f49daa81SMarcel Holtmann    This program is free software; you can redistribute it and/or modify
8*f49daa81SMarcel Holtmann    it under the terms of the GNU General Public License version 2 as
9*f49daa81SMarcel Holtmann    published by the Free Software Foundation;
10*f49daa81SMarcel Holtmann 
11*f49daa81SMarcel Holtmann    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12*f49daa81SMarcel Holtmann    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13*f49daa81SMarcel Holtmann    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14*f49daa81SMarcel Holtmann    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15*f49daa81SMarcel Holtmann    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16*f49daa81SMarcel Holtmann    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17*f49daa81SMarcel Holtmann    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18*f49daa81SMarcel Holtmann    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19*f49daa81SMarcel Holtmann 
20*f49daa81SMarcel Holtmann    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21*f49daa81SMarcel Holtmann    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22*f49daa81SMarcel Holtmann    SOFTWARE IS DISCLAIMED.
23*f49daa81SMarcel Holtmann */
24*f49daa81SMarcel Holtmann 
25*f49daa81SMarcel Holtmann #ifndef __HCI_SOCK_H
26*f49daa81SMarcel Holtmann #define __HCI_SOCK_H
27*f49daa81SMarcel Holtmann 
28*f49daa81SMarcel Holtmann /* Socket options */
29*f49daa81SMarcel Holtmann #define HCI_DATA_DIR	1
30*f49daa81SMarcel Holtmann #define HCI_FILTER	2
31*f49daa81SMarcel Holtmann #define HCI_TIME_STAMP	3
32*f49daa81SMarcel Holtmann 
33*f49daa81SMarcel Holtmann /* CMSG flags */
34*f49daa81SMarcel Holtmann #define HCI_CMSG_DIR	0x0001
35*f49daa81SMarcel Holtmann #define HCI_CMSG_TSTAMP	0x0002
36*f49daa81SMarcel Holtmann 
37*f49daa81SMarcel Holtmann struct sockaddr_hci {
38*f49daa81SMarcel Holtmann 	sa_family_t    hci_family;
39*f49daa81SMarcel Holtmann 	unsigned short hci_dev;
40*f49daa81SMarcel Holtmann 	unsigned short hci_channel;
41*f49daa81SMarcel Holtmann };
42*f49daa81SMarcel Holtmann #define HCI_DEV_NONE	0xffff
43*f49daa81SMarcel Holtmann 
44*f49daa81SMarcel Holtmann #define HCI_CHANNEL_RAW		0
45*f49daa81SMarcel Holtmann #define HCI_CHANNEL_USER	1
46*f49daa81SMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
47*f49daa81SMarcel Holtmann #define HCI_CHANNEL_CONTROL	3
48*f49daa81SMarcel Holtmann 
49*f49daa81SMarcel Holtmann struct hci_filter {
50*f49daa81SMarcel Holtmann 	unsigned long type_mask;
51*f49daa81SMarcel Holtmann 	unsigned long event_mask[2];
52*f49daa81SMarcel Holtmann 	__le16 opcode;
53*f49daa81SMarcel Holtmann };
54*f49daa81SMarcel Holtmann 
55*f49daa81SMarcel Holtmann struct hci_ufilter {
56*f49daa81SMarcel Holtmann 	__u32  type_mask;
57*f49daa81SMarcel Holtmann 	__u32  event_mask[2];
58*f49daa81SMarcel Holtmann 	__le16 opcode;
59*f49daa81SMarcel Holtmann };
60*f49daa81SMarcel Holtmann 
61*f49daa81SMarcel Holtmann #define HCI_FLT_TYPE_BITS	31
62*f49daa81SMarcel Holtmann #define HCI_FLT_EVENT_BITS	63
63*f49daa81SMarcel Holtmann #define HCI_FLT_OGF_BITS	63
64*f49daa81SMarcel Holtmann #define HCI_FLT_OCF_BITS	127
65*f49daa81SMarcel Holtmann 
66*f49daa81SMarcel Holtmann /* Ioctl defines */
67*f49daa81SMarcel Holtmann #define HCIDEVUP	_IOW('H', 201, int)
68*f49daa81SMarcel Holtmann #define HCIDEVDOWN	_IOW('H', 202, int)
69*f49daa81SMarcel Holtmann #define HCIDEVRESET	_IOW('H', 203, int)
70*f49daa81SMarcel Holtmann #define HCIDEVRESTAT	_IOW('H', 204, int)
71*f49daa81SMarcel Holtmann 
72*f49daa81SMarcel Holtmann #define HCIGETDEVLIST	_IOR('H', 210, int)
73*f49daa81SMarcel Holtmann #define HCIGETDEVINFO	_IOR('H', 211, int)
74*f49daa81SMarcel Holtmann #define HCIGETCONNLIST	_IOR('H', 212, int)
75*f49daa81SMarcel Holtmann #define HCIGETCONNINFO	_IOR('H', 213, int)
76*f49daa81SMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
77*f49daa81SMarcel Holtmann 
78*f49daa81SMarcel Holtmann #define HCISETRAW	_IOW('H', 220, int)
79*f49daa81SMarcel Holtmann #define HCISETSCAN	_IOW('H', 221, int)
80*f49daa81SMarcel Holtmann #define HCISETAUTH	_IOW('H', 222, int)
81*f49daa81SMarcel Holtmann #define HCISETENCRYPT	_IOW('H', 223, int)
82*f49daa81SMarcel Holtmann #define HCISETPTYPE	_IOW('H', 224, int)
83*f49daa81SMarcel Holtmann #define HCISETLINKPOL	_IOW('H', 225, int)
84*f49daa81SMarcel Holtmann #define HCISETLINKMODE	_IOW('H', 226, int)
85*f49daa81SMarcel Holtmann #define HCISETACLMTU	_IOW('H', 227, int)
86*f49daa81SMarcel Holtmann #define HCISETSCOMTU	_IOW('H', 228, int)
87*f49daa81SMarcel Holtmann 
88*f49daa81SMarcel Holtmann #define HCIBLOCKADDR	_IOW('H', 230, int)
89*f49daa81SMarcel Holtmann #define HCIUNBLOCKADDR	_IOW('H', 231, int)
90*f49daa81SMarcel Holtmann 
91*f49daa81SMarcel Holtmann #define HCIINQUIRY	_IOR('H', 240, int)
92*f49daa81SMarcel Holtmann 
93*f49daa81SMarcel Holtmann /* Ioctl requests structures */
94*f49daa81SMarcel Holtmann struct hci_dev_stats {
95*f49daa81SMarcel Holtmann 	__u32 err_rx;
96*f49daa81SMarcel Holtmann 	__u32 err_tx;
97*f49daa81SMarcel Holtmann 	__u32 cmd_tx;
98*f49daa81SMarcel Holtmann 	__u32 evt_rx;
99*f49daa81SMarcel Holtmann 	__u32 acl_tx;
100*f49daa81SMarcel Holtmann 	__u32 acl_rx;
101*f49daa81SMarcel Holtmann 	__u32 sco_tx;
102*f49daa81SMarcel Holtmann 	__u32 sco_rx;
103*f49daa81SMarcel Holtmann 	__u32 byte_rx;
104*f49daa81SMarcel Holtmann 	__u32 byte_tx;
105*f49daa81SMarcel Holtmann };
106*f49daa81SMarcel Holtmann 
107*f49daa81SMarcel Holtmann struct hci_dev_info {
108*f49daa81SMarcel Holtmann 	__u16 dev_id;
109*f49daa81SMarcel Holtmann 	char  name[8];
110*f49daa81SMarcel Holtmann 
111*f49daa81SMarcel Holtmann 	bdaddr_t bdaddr;
112*f49daa81SMarcel Holtmann 
113*f49daa81SMarcel Holtmann 	__u32 flags;
114*f49daa81SMarcel Holtmann 	__u8  type;
115*f49daa81SMarcel Holtmann 
116*f49daa81SMarcel Holtmann 	__u8  features[8];
117*f49daa81SMarcel Holtmann 
118*f49daa81SMarcel Holtmann 	__u32 pkt_type;
119*f49daa81SMarcel Holtmann 	__u32 link_policy;
120*f49daa81SMarcel Holtmann 	__u32 link_mode;
121*f49daa81SMarcel Holtmann 
122*f49daa81SMarcel Holtmann 	__u16 acl_mtu;
123*f49daa81SMarcel Holtmann 	__u16 acl_pkts;
124*f49daa81SMarcel Holtmann 	__u16 sco_mtu;
125*f49daa81SMarcel Holtmann 	__u16 sco_pkts;
126*f49daa81SMarcel Holtmann 
127*f49daa81SMarcel Holtmann 	struct hci_dev_stats stat;
128*f49daa81SMarcel Holtmann };
129*f49daa81SMarcel Holtmann 
130*f49daa81SMarcel Holtmann struct hci_conn_info {
131*f49daa81SMarcel Holtmann 	__u16    handle;
132*f49daa81SMarcel Holtmann 	bdaddr_t bdaddr;
133*f49daa81SMarcel Holtmann 	__u8     type;
134*f49daa81SMarcel Holtmann 	__u8     out;
135*f49daa81SMarcel Holtmann 	__u16    state;
136*f49daa81SMarcel Holtmann 	__u32    link_mode;
137*f49daa81SMarcel Holtmann };
138*f49daa81SMarcel Holtmann 
139*f49daa81SMarcel Holtmann struct hci_dev_req {
140*f49daa81SMarcel Holtmann 	__u16  dev_id;
141*f49daa81SMarcel Holtmann 	__u32  dev_opt;
142*f49daa81SMarcel Holtmann };
143*f49daa81SMarcel Holtmann 
144*f49daa81SMarcel Holtmann struct hci_dev_list_req {
145*f49daa81SMarcel Holtmann 	__u16  dev_num;
146*f49daa81SMarcel Holtmann 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
147*f49daa81SMarcel Holtmann };
148*f49daa81SMarcel Holtmann 
149*f49daa81SMarcel Holtmann struct hci_conn_list_req {
150*f49daa81SMarcel Holtmann 	__u16  dev_id;
151*f49daa81SMarcel Holtmann 	__u16  conn_num;
152*f49daa81SMarcel Holtmann 	struct hci_conn_info conn_info[0];
153*f49daa81SMarcel Holtmann };
154*f49daa81SMarcel Holtmann 
155*f49daa81SMarcel Holtmann struct hci_conn_info_req {
156*f49daa81SMarcel Holtmann 	bdaddr_t bdaddr;
157*f49daa81SMarcel Holtmann 	__u8     type;
158*f49daa81SMarcel Holtmann 	struct   hci_conn_info conn_info[0];
159*f49daa81SMarcel Holtmann };
160*f49daa81SMarcel Holtmann 
161*f49daa81SMarcel Holtmann struct hci_auth_info_req {
162*f49daa81SMarcel Holtmann 	bdaddr_t bdaddr;
163*f49daa81SMarcel Holtmann 	__u8     type;
164*f49daa81SMarcel Holtmann };
165*f49daa81SMarcel Holtmann 
166*f49daa81SMarcel Holtmann struct hci_inquiry_req {
167*f49daa81SMarcel Holtmann 	__u16 dev_id;
168*f49daa81SMarcel Holtmann 	__u16 flags;
169*f49daa81SMarcel Holtmann 	__u8  lap[3];
170*f49daa81SMarcel Holtmann 	__u8  length;
171*f49daa81SMarcel Holtmann 	__u8  num_rsp;
172*f49daa81SMarcel Holtmann };
173*f49daa81SMarcel Holtmann #define IREQ_CACHE_FLUSH 0x0001
174*f49daa81SMarcel Holtmann 
175*f49daa81SMarcel Holtmann #endif /* __HCI_SOCK_H */
176