1b06ebda0SMatthew Dillon /*
2b06ebda0SMatthew Dillon  * ng_btsocket.h
3b06ebda0SMatthew Dillon  */
4b06ebda0SMatthew Dillon 
5b06ebda0SMatthew Dillon /*-
6b06ebda0SMatthew Dillon  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7b06ebda0SMatthew Dillon  * All rights reserved.
8b06ebda0SMatthew Dillon  *
9b06ebda0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
10b06ebda0SMatthew Dillon  * modification, are permitted provided that the following conditions
11b06ebda0SMatthew Dillon  * are met:
12b06ebda0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
13b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
14b06ebda0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
15b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
16b06ebda0SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
17b06ebda0SMatthew Dillon  *
18b06ebda0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19b06ebda0SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20b06ebda0SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21b06ebda0SMatthew Dillon  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22b06ebda0SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23b06ebda0SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24b06ebda0SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25b06ebda0SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26b06ebda0SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27b06ebda0SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28b06ebda0SMatthew Dillon  * SUCH DAMAGE.
29b06ebda0SMatthew Dillon  *
30b06ebda0SMatthew Dillon  * $Id: ng_btsocket.h,v 1.8 2003/04/26 22:32:10 max Exp $
31b06ebda0SMatthew Dillon  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket.h,v 1.8 2006/05/17 00:13:06 emax Exp $
32b06ebda0SMatthew Dillon  */
33b06ebda0SMatthew Dillon 
34b06ebda0SMatthew Dillon #ifndef _NETGRAPH_BTSOCKET_H_
35b06ebda0SMatthew Dillon #define _NETGRAPH_BTSOCKET_H_
36b06ebda0SMatthew Dillon 
37*99dd49c5SSascha Wildner #include <sys/ioccom.h>
38*99dd49c5SSascha Wildner 
39b06ebda0SMatthew Dillon /*
40b06ebda0SMatthew Dillon  * Bluetooth protocols
41b06ebda0SMatthew Dillon  */
42b06ebda0SMatthew Dillon 
43b06ebda0SMatthew Dillon #define BLUETOOTH_PROTO_HCI	134	/* HCI protocol number */
44b06ebda0SMatthew Dillon #define BLUETOOTH_PROTO_L2CAP	135	/* L2CAP protocol number */
45b06ebda0SMatthew Dillon #define BLUETOOTH_PROTO_RFCOMM	136	/* RFCOMM protocol number */
46b06ebda0SMatthew Dillon 
47b06ebda0SMatthew Dillon /*
48b06ebda0SMatthew Dillon  * Bluetooth version of struct sockaddr for raw HCI sockets
49b06ebda0SMatthew Dillon  */
50b06ebda0SMatthew Dillon 
51b06ebda0SMatthew Dillon struct sockaddr_hci {
52b06ebda0SMatthew Dillon 	u_char		hci_len;	/* total length */
53b06ebda0SMatthew Dillon 	u_char		hci_family;	/* address family */
54b06ebda0SMatthew Dillon 	char		hci_node[32];	/* address (size == NG_NODESIZ ) */
55b06ebda0SMatthew Dillon };
56b06ebda0SMatthew Dillon 
57b06ebda0SMatthew Dillon /* Raw HCI socket options */
58b06ebda0SMatthew Dillon #define SOL_HCI_RAW		0x0802	/* socket options level */
59b06ebda0SMatthew Dillon 
60b06ebda0SMatthew Dillon #define SO_HCI_RAW_FILTER	1	/* get/set filter on socket */
61b06ebda0SMatthew Dillon #define SO_HCI_RAW_DIRECTION	2	/* turn on/off direction info */
62b06ebda0SMatthew Dillon #define SCM_HCI_RAW_DIRECTION	SO_HCI_RAW_DIRECTION /* cmsg_type  */
63b06ebda0SMatthew Dillon 
64b06ebda0SMatthew Dillon /*
65b06ebda0SMatthew Dillon  * Raw HCI socket filter.
66b06ebda0SMatthew Dillon  *
67b06ebda0SMatthew Dillon  * For packet mask use (1 << (HCI packet indicator - 1))
68b06ebda0SMatthew Dillon  * For event mask use (1 << (Event - 1))
69b06ebda0SMatthew Dillon  */
70b06ebda0SMatthew Dillon 
71b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_filter {
72b06ebda0SMatthew Dillon 	bitstr_t	bit_decl(packet_mask, 32);
73b06ebda0SMatthew Dillon 	bitstr_t	bit_decl(event_mask, (NG_HCI_EVENT_MASK_SIZE * 8));
74b06ebda0SMatthew Dillon };
75b06ebda0SMatthew Dillon 
76b06ebda0SMatthew Dillon /*
77b06ebda0SMatthew Dillon  * Raw HCI sockets ioctl's
78b06ebda0SMatthew Dillon  */
79b06ebda0SMatthew Dillon 
80b06ebda0SMatthew Dillon /* Get state */
81b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_state {
82b06ebda0SMatthew Dillon 	ng_hci_node_state_ep	state;
83b06ebda0SMatthew Dillon };
84b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_STATE \
85b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_STATE, \
86b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_state)
87b06ebda0SMatthew Dillon 
88b06ebda0SMatthew Dillon /* Initialize */
89b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_INIT \
90b06ebda0SMatthew Dillon 	_IO('b', NGM_HCI_NODE_INIT)
91b06ebda0SMatthew Dillon 
92b06ebda0SMatthew Dillon /* Get/Set debug level */
93b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_debug {
94b06ebda0SMatthew Dillon 	ng_hci_node_debug_ep	debug;
95b06ebda0SMatthew Dillon };
96b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_DEBUG \
97b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_DEBUG, \
98b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_debug)
99b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_SET_DEBUG \
100b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_SET_DEBUG, \
101b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_debug)
102b06ebda0SMatthew Dillon 
103b06ebda0SMatthew Dillon /* Get buffer info */
104b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_buffer {
105b06ebda0SMatthew Dillon 	ng_hci_node_buffer_ep	buffer;
106b06ebda0SMatthew Dillon };
107b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_BUFFER \
108b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_BUFFER, \
109b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_buffer)
110b06ebda0SMatthew Dillon 
111b06ebda0SMatthew Dillon /* Get BD_ADDR */
112b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_bdaddr {
113b06ebda0SMatthew Dillon 	bdaddr_t	bdaddr;
114b06ebda0SMatthew Dillon };
115b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_BDADDR \
116b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_BDADDR, \
117b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_bdaddr)
118b06ebda0SMatthew Dillon 
119b06ebda0SMatthew Dillon /* Get features */
120b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_features {
121b06ebda0SMatthew Dillon 	u_int8_t	features[NG_HCI_FEATURES_SIZE];
122b06ebda0SMatthew Dillon };
123b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_FEATURES \
124b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_FEATURES, \
125b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_features)
126b06ebda0SMatthew Dillon 
127b06ebda0SMatthew Dillon /* Get stat */
128b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_stat {
129b06ebda0SMatthew Dillon 	ng_hci_node_stat_ep	stat;
130b06ebda0SMatthew Dillon };
131b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_STAT \
132b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_STAT, \
133b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_stat)
134b06ebda0SMatthew Dillon 
135b06ebda0SMatthew Dillon /* Reset stat */
136b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_RESET_STAT \
137b06ebda0SMatthew Dillon 	_IO('b', NGM_HCI_NODE_RESET_STAT)
138b06ebda0SMatthew Dillon 
139b06ebda0SMatthew Dillon /* Flush neighbor cache */
140b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE \
141b06ebda0SMatthew Dillon 	_IO('b', NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE)
142b06ebda0SMatthew Dillon 
143b06ebda0SMatthew Dillon /* Get neighbor cache */
144b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_neighbor_cache {
145b06ebda0SMatthew Dillon 	u_int32_t				 num_entries;
146b06ebda0SMatthew Dillon 	ng_hci_node_neighbor_cache_entry_ep	*entries;
147b06ebda0SMatthew Dillon };
148b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE \
149b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_NEIGHBOR_CACHE, \
150b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_neighbor_cache)
151b06ebda0SMatthew Dillon 
152b06ebda0SMatthew Dillon /* Get connection list */
153b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_con_list {
154b06ebda0SMatthew Dillon 	u_int32_t		 num_connections;
155b06ebda0SMatthew Dillon 	ng_hci_node_con_ep	*connections;
156b06ebda0SMatthew Dillon };
157b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_CON_LIST \
158b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_CON_LIST, \
159b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_con_list)
160b06ebda0SMatthew Dillon 
161b06ebda0SMatthew Dillon /* Get/Set link policy settings mask */
162b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_link_policy_mask {
163b06ebda0SMatthew Dillon 	ng_hci_node_link_policy_mask_ep	policy_mask;
164b06ebda0SMatthew Dillon };
165b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK \
166b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK, \
167b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_link_policy_mask)
168b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK \
169b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK, \
170b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_link_policy_mask)
171b06ebda0SMatthew Dillon 
172b06ebda0SMatthew Dillon /* Get/Set packet mask */
173b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_packet_mask {
174b06ebda0SMatthew Dillon 	ng_hci_node_packet_mask_ep	packet_mask;
175b06ebda0SMatthew Dillon };
176b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_PACKET_MASK \
177b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_PACKET_MASK, \
178b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_packet_mask)
179b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_SET_PACKET_MASK \
180b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_SET_PACKET_MASK, \
181b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_packet_mask)
182b06ebda0SMatthew Dillon 
183b06ebda0SMatthew Dillon /* Get/Set role switch */
184b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_role_switch {
185b06ebda0SMatthew Dillon 	ng_hci_node_role_switch_ep	role_switch;
186b06ebda0SMatthew Dillon };
187b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH \
188b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_GET_ROLE_SWITCH, \
189b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_role_switch)
190b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH \
191b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_SET_ROLE_SWITCH, \
192b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_role_switch)
193b06ebda0SMatthew Dillon 
194b06ebda0SMatthew Dillon /* Get list of HCI node names */
195b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_node_list_names {
196b06ebda0SMatthew Dillon 	u_int32_t	 num_names;
197b06ebda0SMatthew Dillon 	struct nodeinfo	*names;
198b06ebda0SMatthew Dillon };
199b06ebda0SMatthew Dillon #define SIOC_HCI_RAW_NODE_LIST_NAMES \
200b06ebda0SMatthew Dillon 	_IOWR('b', NGM_HCI_NODE_LIST_NAMES, \
201b06ebda0SMatthew Dillon 		struct ng_btsocket_hci_raw_node_list_names)
202b06ebda0SMatthew Dillon 
203b06ebda0SMatthew Dillon /*
204b06ebda0SMatthew Dillon  * XXX FIXME: probably does not belong here
205b06ebda0SMatthew Dillon  * Bluetooth version of struct sockaddr for L2CAP sockets (RAW and SEQPACKET)
206b06ebda0SMatthew Dillon  */
207b06ebda0SMatthew Dillon 
208b06ebda0SMatthew Dillon struct sockaddr_l2cap {
209b06ebda0SMatthew Dillon 	u_char		l2cap_len;	/* total length */
210b06ebda0SMatthew Dillon 	u_char		l2cap_family;	/* address family */
211b06ebda0SMatthew Dillon 	u_int16_t	l2cap_psm;	/* PSM (Protocol/Service Multiplexor) */
212b06ebda0SMatthew Dillon 	bdaddr_t	l2cap_bdaddr;	/* address */
213b06ebda0SMatthew Dillon };
214b06ebda0SMatthew Dillon 
215b06ebda0SMatthew Dillon /* L2CAP socket options */
216b06ebda0SMatthew Dillon #define SOL_L2CAP		0x1609	/* socket option level */
217b06ebda0SMatthew Dillon 
218b06ebda0SMatthew Dillon #define SO_L2CAP_IMTU		1	/* get/set incoming MTU */
219b06ebda0SMatthew Dillon #define SO_L2CAP_OMTU		2	/* get outgoing (peer incoming) MTU */
220b06ebda0SMatthew Dillon #define SO_L2CAP_IFLOW		3	/* get incoming flow spec. */
221b06ebda0SMatthew Dillon #define SO_L2CAP_OFLOW		4	/* get/set outgoing flow spec. */
222b06ebda0SMatthew Dillon #define SO_L2CAP_FLUSH		5	/* get/set flush timeout */
223b06ebda0SMatthew Dillon 
224b06ebda0SMatthew Dillon /*
225b06ebda0SMatthew Dillon  * Raw L2CAP sockets ioctl's
226b06ebda0SMatthew Dillon  */
227b06ebda0SMatthew Dillon 
228b06ebda0SMatthew Dillon /* Ping */
229b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_ping {
230b06ebda0SMatthew Dillon 	u_int32_t		 result;
231b06ebda0SMatthew Dillon 	u_int32_t		 echo_size;
232b06ebda0SMatthew Dillon 	u_int8_t		*echo_data;
233b06ebda0SMatthew Dillon };
234b06ebda0SMatthew Dillon #define SIOC_L2CAP_L2CA_PING \
235b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_L2CA_PING, \
236b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_ping)
237b06ebda0SMatthew Dillon 
238b06ebda0SMatthew Dillon /* Get info */
239b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_get_info {
240b06ebda0SMatthew Dillon 	u_int32_t		 result;
241b06ebda0SMatthew Dillon 	u_int32_t		 info_type;
242b06ebda0SMatthew Dillon 	u_int32_t		 info_size;
243b06ebda0SMatthew Dillon 	u_int8_t		*info_data;
244b06ebda0SMatthew Dillon };
245b06ebda0SMatthew Dillon #define SIOC_L2CAP_L2CA_GET_INFO \
246b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_L2CA_GET_INFO, \
247b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_get_info)
248b06ebda0SMatthew Dillon 
249b06ebda0SMatthew Dillon /* Get flags */
250b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_node_flags {
251b06ebda0SMatthew Dillon 	ng_l2cap_node_flags_ep	flags;
252b06ebda0SMatthew Dillon };
253b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_GET_FLAGS \
254b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_GET_FLAGS, \
255b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_node_flags)
256b06ebda0SMatthew Dillon 
257b06ebda0SMatthew Dillon /* Get/Set debug level */
258b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_node_debug {
259b06ebda0SMatthew Dillon 	ng_l2cap_node_debug_ep	debug;
260b06ebda0SMatthew Dillon };
261b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_GET_DEBUG \
262b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_GET_DEBUG, \
263b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_node_debug)
264b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_SET_DEBUG \
265b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_SET_DEBUG, \
266b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_node_debug)
267b06ebda0SMatthew Dillon 
268b06ebda0SMatthew Dillon /* Get connection list */
269b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_con_list {
270b06ebda0SMatthew Dillon 	u_int32_t		 num_connections;
271b06ebda0SMatthew Dillon 	ng_l2cap_node_con_ep	*connections;
272b06ebda0SMatthew Dillon };
273b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_GET_CON_LIST \
274b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_GET_CON_LIST, \
275b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_con_list)
276b06ebda0SMatthew Dillon 
277b06ebda0SMatthew Dillon /* Get channel list */
278b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_chan_list {
279b06ebda0SMatthew Dillon 	u_int32_t		 num_channels;
280b06ebda0SMatthew Dillon 	ng_l2cap_node_chan_ep	*channels;
281b06ebda0SMatthew Dillon };
282b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_GET_CHAN_LIST \
283b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_GET_CHAN_LIST, \
284b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_chan_list)
285b06ebda0SMatthew Dillon 
286b06ebda0SMatthew Dillon /* Get/Set auto disconnect timeout */
287b06ebda0SMatthew Dillon struct ng_btsocket_l2cap_raw_auto_discon_timo
288b06ebda0SMatthew Dillon {
289b06ebda0SMatthew Dillon 	ng_l2cap_node_auto_discon_ep	timeout;
290b06ebda0SMatthew Dillon };
291b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO \
292b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO, \
293b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_auto_discon_timo)
294b06ebda0SMatthew Dillon #define SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO \
295b06ebda0SMatthew Dillon 	_IOWR('b', NGM_L2CAP_NODE_SET_AUTO_DISCON_TIMO, \
296b06ebda0SMatthew Dillon 		struct ng_btsocket_l2cap_raw_auto_discon_timo)
297b06ebda0SMatthew Dillon 
298b06ebda0SMatthew Dillon /*
299b06ebda0SMatthew Dillon  * XXX FIXME: probably does not belong here
300b06ebda0SMatthew Dillon  * Bluetooth version of struct sockaddr for RFCOMM sockets (STREAM)
301b06ebda0SMatthew Dillon  */
302b06ebda0SMatthew Dillon 
303b06ebda0SMatthew Dillon struct sockaddr_rfcomm {
304b06ebda0SMatthew Dillon 	u_char		rfcomm_len;	/* total length */
305b06ebda0SMatthew Dillon 	u_char		rfcomm_family;	/* address family */
306b06ebda0SMatthew Dillon 	bdaddr_t	rfcomm_bdaddr;	/* address */
307b06ebda0SMatthew Dillon 	u_int8_t	rfcomm_channel;	/* channel */
308b06ebda0SMatthew Dillon };
309b06ebda0SMatthew Dillon 
310b06ebda0SMatthew Dillon /* Flow control information */
311b06ebda0SMatthew Dillon struct ng_btsocket_rfcomm_fc_info {
312b06ebda0SMatthew Dillon 	u_int8_t	lmodem;		/* modem signals (local) */
313b06ebda0SMatthew Dillon 	u_int8_t	rmodem;		/* modem signals (remote) */
314b06ebda0SMatthew Dillon 	u_int8_t	tx_cred;	/* TX credits */
315b06ebda0SMatthew Dillon 	u_int8_t	rx_cred;	/* RX credits */
316b06ebda0SMatthew Dillon 	u_int8_t	cfc;		/* credit flow control */
317b06ebda0SMatthew Dillon 	u_int8_t	reserved;
318b06ebda0SMatthew Dillon };
319b06ebda0SMatthew Dillon 
320b06ebda0SMatthew Dillon /* STREAM RFCOMM socket options */
321b06ebda0SMatthew Dillon #define SOL_RFCOMM		0x0816	/* socket options level */
322b06ebda0SMatthew Dillon 
323b06ebda0SMatthew Dillon #define SO_RFCOMM_MTU		1	/* get channel MTU */
324b06ebda0SMatthew Dillon #define SO_RFCOMM_FC_INFO	2	/* get flow control information */
325b06ebda0SMatthew Dillon 
326b06ebda0SMatthew Dillon /*
327b06ebda0SMatthew Dillon  * Netgraph node type name and cookie
328b06ebda0SMatthew Dillon  */
329b06ebda0SMatthew Dillon 
330b06ebda0SMatthew Dillon #define	NG_BTSOCKET_HCI_RAW_NODE_TYPE	"btsock_hci_raw"
331b06ebda0SMatthew Dillon #define	NG_BTSOCKET_L2CAP_RAW_NODE_TYPE	"btsock_l2c_raw"
332b06ebda0SMatthew Dillon #define	NG_BTSOCKET_L2CAP_NODE_TYPE	"btsock_l2c"
333b06ebda0SMatthew Dillon 
334b06ebda0SMatthew Dillon /*
335b06ebda0SMatthew Dillon  * Debug levels
336b06ebda0SMatthew Dillon  */
337b06ebda0SMatthew Dillon 
338b06ebda0SMatthew Dillon #define NG_BTSOCKET_ALERT_LEVEL	1
339b06ebda0SMatthew Dillon #define NG_BTSOCKET_ERR_LEVEL	2
340b06ebda0SMatthew Dillon #define NG_BTSOCKET_WARN_LEVEL	3
341b06ebda0SMatthew Dillon #define NG_BTSOCKET_INFO_LEVEL	4
342b06ebda0SMatthew Dillon 
343b06ebda0SMatthew Dillon #endif /* _NETGRAPH_BTSOCKET_H_ */
344b06ebda0SMatthew Dillon 
345