xref: /freebsd/sys/netgraph/bluetooth/include/ng_hci.h (revision 4ae0fa8a2f8bff9a5e96dbfd862b03172c88e697)
1878ed226SJulian Elischer /*
2878ed226SJulian Elischer  * ng_hci.h
3c398230bSWarner Losh  */
4c398230bSWarner Losh 
5c398230bSWarner Losh /*-
64d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
7fe267a55SPedro F. Giffuni  *
8878ed226SJulian Elischer  * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com>
9878ed226SJulian Elischer  * All rights reserved.
10878ed226SJulian Elischer  *
11878ed226SJulian Elischer  * Redistribution and use in source and binary forms, with or without
12878ed226SJulian Elischer  * modification, are permitted provided that the following conditions
13878ed226SJulian Elischer  * are met:
14878ed226SJulian Elischer  * 1. Redistributions of source code must retain the above copyright
15878ed226SJulian Elischer  *    notice, this list of conditions and the following disclaimer.
16878ed226SJulian Elischer  * 2. Redistributions in binary form must reproduce the above copyright
17878ed226SJulian Elischer  *    notice, this list of conditions and the following disclaimer in the
18878ed226SJulian Elischer  *    documentation and/or other materials provided with the distribution.
19878ed226SJulian Elischer  *
20878ed226SJulian Elischer  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21878ed226SJulian Elischer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22878ed226SJulian Elischer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23878ed226SJulian Elischer  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24878ed226SJulian Elischer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25878ed226SJulian Elischer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26878ed226SJulian Elischer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27878ed226SJulian Elischer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28878ed226SJulian Elischer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29878ed226SJulian Elischer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30878ed226SJulian Elischer  * SUCH DAMAGE.
31878ed226SJulian Elischer  *
32f2bb1caeSJulian Elischer  * $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $
33878ed226SJulian Elischer  */
34878ed226SJulian Elischer 
35878ed226SJulian Elischer /*
36878ed226SJulian Elischer  * This file contains everything that application needs to know about
37878ed226SJulian Elischer  * Host Controller Interface (HCI). All information was obtained from
38878ed226SJulian Elischer  * Bluetooth Specification Book v1.1.
39878ed226SJulian Elischer  *
40878ed226SJulian Elischer  * This file can be included by both kernel and userland applications.
41878ed226SJulian Elischer  *
42878ed226SJulian Elischer  * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth
43878ed226SJulian Elischer  *       specification refers to both devices and units. They are the
44878ed226SJulian Elischer  *       same thing (i think), so to be consistent word "unit" will be
45878ed226SJulian Elischer  *       used.
46878ed226SJulian Elischer  */
47878ed226SJulian Elischer 
48878ed226SJulian Elischer #ifndef _NETGRAPH_HCI_H_
49f21fff6cSMaksim Yevmenkin #define _NETGRAPH_HCI_H_
50878ed226SJulian Elischer 
51878ed226SJulian Elischer /**************************************************************************
52878ed226SJulian Elischer  **************************************************************************
53878ed226SJulian Elischer  **     Netgraph node hook name, type name and type cookie and commands
54878ed226SJulian Elischer  **************************************************************************
55878ed226SJulian Elischer  **************************************************************************/
56878ed226SJulian Elischer 
57878ed226SJulian Elischer /* Node type name and type cookie */
58878ed226SJulian Elischer #define NG_HCI_NODE_TYPE			"hci"
59878ed226SJulian Elischer #define NGM_HCI_COOKIE				1000774184
60878ed226SJulian Elischer 
61878ed226SJulian Elischer /* Netgraph node hook names */
62878ed226SJulian Elischer #define NG_HCI_HOOK_DRV				"drv" /* Driver <-> HCI */
63878ed226SJulian Elischer #define NG_HCI_HOOK_ACL				"acl" /* HCI <-> Upper */
64878ed226SJulian Elischer #define NG_HCI_HOOK_SCO				"sco" /* HCI <-> Upper */
65878ed226SJulian Elischer #define NG_HCI_HOOK_RAW				"raw" /* HCI <-> Upper */
66878ed226SJulian Elischer 
67878ed226SJulian Elischer /**************************************************************************
68878ed226SJulian Elischer  **************************************************************************
69878ed226SJulian Elischer  **                   Common defines and types (HCI)
70878ed226SJulian Elischer  **************************************************************************
71878ed226SJulian Elischer  **************************************************************************/
72878ed226SJulian Elischer 
73878ed226SJulian Elischer /* All sizes are in bytes */
74878ed226SJulian Elischer #define NG_HCI_BDADDR_SIZE			6   /* unit address */
75878ed226SJulian Elischer #define NG_HCI_LAP_SIZE				3   /* unit LAP */
76878ed226SJulian Elischer #define NG_HCI_KEY_SIZE				16  /* link key */
77878ed226SJulian Elischer #define NG_HCI_PIN_SIZE				16  /* link PIN */
78878ed226SJulian Elischer #define NG_HCI_EVENT_MASK_SIZE			8   /* event mask */
79fbc48c2bSTakanori Watanabe #define NG_HCI_LE_EVENT_MASK_SIZE		8   /* event mask */
80878ed226SJulian Elischer #define NG_HCI_CLASS_SIZE			3   /* unit class */
81878ed226SJulian Elischer #define NG_HCI_FEATURES_SIZE			8   /* LMP features */
82878ed226SJulian Elischer #define NG_HCI_UNIT_NAME_SIZE			248 /* unit name size */
83fbc48c2bSTakanori Watanabe #define NG_HCI_COMMANDS_SIZE			64  /*Command list BMP size*/
844aa92fe2STakanori Watanabe #define NG_HCI_EXTINQ_MAX			240 /**/
85878ed226SJulian Elischer /* HCI specification */
86878ed226SJulian Elischer #define NG_HCI_SPEC_V10				0x00 /* v1.0 */
87878ed226SJulian Elischer #define NG_HCI_SPEC_V11				0x01 /* v1.1 */
88878ed226SJulian Elischer /* 0x02 - 0xFF - reserved for future use */
89878ed226SJulian Elischer 
90878ed226SJulian Elischer /* LMP features */
91878ed226SJulian Elischer /* ------------------- byte 0 --------------------*/
92878ed226SJulian Elischer #define NG_HCI_LMP_3SLOT			0x01
93878ed226SJulian Elischer #define NG_HCI_LMP_5SLOT			0x02
94878ed226SJulian Elischer #define NG_HCI_LMP_ENCRYPTION			0x04
95878ed226SJulian Elischer #define NG_HCI_LMP_SLOT_OFFSET			0x08
96878ed226SJulian Elischer #define NG_HCI_LMP_TIMING_ACCURACY		0x10
97878ed226SJulian Elischer #define NG_HCI_LMP_SWITCH			0x20
98878ed226SJulian Elischer #define NG_HCI_LMP_HOLD_MODE			0x40
99878ed226SJulian Elischer #define NG_HCI_LMP_SNIFF_MODE			0x80
100878ed226SJulian Elischer /* ------------------- byte 1 --------------------*/
101878ed226SJulian Elischer #define NG_HCI_LMP_PARK_MODE			0x01
102878ed226SJulian Elischer #define NG_HCI_LMP_RSSI				0x02
103878ed226SJulian Elischer #define NG_HCI_LMP_CHANNEL_QUALITY		0x04
104878ed226SJulian Elischer #define NG_HCI_LMP_SCO_LINK			0x08
105878ed226SJulian Elischer #define NG_HCI_LMP_HV2_PKT			0x10
106878ed226SJulian Elischer #define NG_HCI_LMP_HV3_PKT			0x20
107878ed226SJulian Elischer #define NG_HCI_LMP_ULAW_LOG			0x40
108878ed226SJulian Elischer #define NG_HCI_LMP_ALAW_LOG			0x80
109878ed226SJulian Elischer /* ------------------- byte 2 --------------------*/
110878ed226SJulian Elischer #define NG_HCI_LMP_CVSD				0x01
111878ed226SJulian Elischer #define NG_HCI_LMP_PAGING_SCHEME		0x02
112878ed226SJulian Elischer #define NG_HCI_LMP_POWER_CONTROL		0x04
113878ed226SJulian Elischer #define NG_HCI_LMP_TRANSPARENT_SCO		0x08
114878ed226SJulian Elischer #define NG_HCI_LMP_FLOW_CONTROL_LAG0		0x10
115878ed226SJulian Elischer #define NG_HCI_LMP_FLOW_CONTROL_LAG1		0x20
116878ed226SJulian Elischer #define NG_HCI_LMP_FLOW_CONTROL_LAG2		0x40
117*4ae0fa8aSAndreas Kempe /* ------------------- byte 6 --------------------*/
118*4ae0fa8aSAndreas Kempe #define	NG_HCI_LMP_SECURE_SIMPLE_PAIRING	0x08
119878ed226SJulian Elischer 
120878ed226SJulian Elischer /* Link types */
121878ed226SJulian Elischer #define NG_HCI_LINK_SCO				0x00 /* Voice */
122878ed226SJulian Elischer #define NG_HCI_LINK_ACL				0x01 /* Data */
123fbc48c2bSTakanori Watanabe #define NG_HCI_LINK_LE_PUBLIC			0x02 /* LE Public*/
124fbc48c2bSTakanori Watanabe #define NG_HCI_LINK_LE_RANDOM			0x03 /* LE Random*/
125878ed226SJulian Elischer /* 0x02 - 0xFF - reserved for future use */
126878ed226SJulian Elischer 
127878ed226SJulian Elischer /* Packet types */
128878ed226SJulian Elischer 				/* 0x0001 - 0x0004 - reserved for future use */
129878ed226SJulian Elischer #define NG_HCI_PKT_DM1				0x0008 /* ACL link */
130878ed226SJulian Elischer #define NG_HCI_PKT_DH1				0x0010 /* ACL link */
131878ed226SJulian Elischer #define NG_HCI_PKT_HV1				0x0020 /* SCO link */
132878ed226SJulian Elischer #define NG_HCI_PKT_HV2				0x0040 /* SCO link */
133878ed226SJulian Elischer #define NG_HCI_PKT_HV3				0x0080 /* SCO link */
134878ed226SJulian Elischer 				/* 0x0100 - 0x0200 - reserved for future use */
135878ed226SJulian Elischer #define NG_HCI_PKT_DM3				0x0400 /* ACL link */
136878ed226SJulian Elischer #define NG_HCI_PKT_DH3				0x0800 /* ACL link */
137878ed226SJulian Elischer 				/* 0x1000 - 0x2000 - reserved for future use */
138878ed226SJulian Elischer #define NG_HCI_PKT_DM5				0x4000 /* ACL link */
139878ed226SJulian Elischer #define NG_HCI_PKT_DH5				0x8000 /* ACL link */
140878ed226SJulian Elischer 
141878ed226SJulian Elischer /*
142878ed226SJulian Elischer  * Connection modes/Unit modes
143878ed226SJulian Elischer  *
144878ed226SJulian Elischer  * This is confusing. It means that one of the units change its mode
145878ed226SJulian Elischer  * for the specific connection. For example one connection was put on
146878ed226SJulian Elischer  * hold (but i could be wrong :)
147878ed226SJulian Elischer  */
148878ed226SJulian Elischer 
149878ed226SJulian Elischer #define NG_HCI_UNIT_MODE_ACTIVE			0x00
150878ed226SJulian Elischer #define NG_HCI_UNIT_MODE_HOLD			0x01
151878ed226SJulian Elischer #define NG_HCI_UNIT_MODE_SNIFF			0x02
152878ed226SJulian Elischer #define NG_HCI_UNIT_MODE_PARK			0x03
153878ed226SJulian Elischer /* 0x04 - 0xFF - reserved for future use */
154878ed226SJulian Elischer 
155878ed226SJulian Elischer /* Page scan modes */
156878ed226SJulian Elischer #define NG_HCI_MANDATORY_PAGE_SCAN_MODE		0x00
157878ed226SJulian Elischer #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE1		0x01
158878ed226SJulian Elischer #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE2		0x02
159878ed226SJulian Elischer #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE3		0x03
160878ed226SJulian Elischer /* 0x04 - 0xFF - reserved for future use */
161878ed226SJulian Elischer 
162878ed226SJulian Elischer /* Page scan repetition modes */
163878ed226SJulian Elischer #define NG_HCI_SCAN_REP_MODE0			0x00
164878ed226SJulian Elischer #define NG_HCI_SCAN_REP_MODE1			0x01
165878ed226SJulian Elischer #define NG_HCI_SCAN_REP_MODE2			0x02
166878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
167878ed226SJulian Elischer 
168878ed226SJulian Elischer /* Page scan period modes */
169878ed226SJulian Elischer #define NG_HCI_PAGE_SCAN_PERIOD_MODE0		0x00
170878ed226SJulian Elischer #define NG_HCI_PAGE_SCAN_PERIOD_MODE1		0x01
171878ed226SJulian Elischer #define NG_HCI_PAGE_SCAN_PERIOD_MODE2		0x02
172878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
173878ed226SJulian Elischer 
174878ed226SJulian Elischer /* Scan enable */
175878ed226SJulian Elischer #define NG_HCI_NO_SCAN_ENABLE			0x00
176878ed226SJulian Elischer #define NG_HCI_INQUIRY_ENABLE_PAGE_DISABLE	0x01
177878ed226SJulian Elischer #define NG_HCI_INQUIRY_DISABLE_PAGE_ENABLE	0x02
178878ed226SJulian Elischer #define NG_HCI_INQUIRY_ENABLE_PAGE_ENABLE	0x03
179878ed226SJulian Elischer /* 0x04 - 0xFF - reserved for future use */
180878ed226SJulian Elischer 
181878ed226SJulian Elischer /* Hold mode activities */
182878ed226SJulian Elischer #define NG_HCI_HOLD_MODE_NO_CHANGE		0x00
183878ed226SJulian Elischer #define NG_HCI_HOLD_MODE_SUSPEND_PAGE_SCAN	0x01
184878ed226SJulian Elischer #define NG_HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN	0x02
185878ed226SJulian Elischer #define NG_HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY	0x04
186878ed226SJulian Elischer /* 0x08 - 0x80 - reserved for future use */
187878ed226SJulian Elischer 
188878ed226SJulian Elischer /* Connection roles */
189878ed226SJulian Elischer #define NG_HCI_ROLE_MASTER			0x00
190878ed226SJulian Elischer #define NG_HCI_ROLE_SLAVE			0x01
191878ed226SJulian Elischer /* 0x02 - 0xFF - reserved for future use */
192878ed226SJulian Elischer 
193878ed226SJulian Elischer /* Key flags */
194878ed226SJulian Elischer #define NG_HCI_USE_SEMI_PERMANENT_LINK_KEYS	0x00
195878ed226SJulian Elischer #define NG_HCI_USE_TEMPORARY_LINK_KEY		0x01
196878ed226SJulian Elischer /* 0x02 - 0xFF - reserved for future use */
197878ed226SJulian Elischer 
198878ed226SJulian Elischer /* Pin types */
199878ed226SJulian Elischer #define NG_HCI_PIN_TYPE_VARIABLE		0x00
200878ed226SJulian Elischer #define NG_HCI_PIN_TYPE_FIXED			0x01
201878ed226SJulian Elischer 
202878ed226SJulian Elischer /* Link key types */
203878ed226SJulian Elischer #define NG_HCI_LINK_KEY_TYPE_COMBINATION_KEY	0x00
204878ed226SJulian Elischer #define NG_HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY	0x01
205878ed226SJulian Elischer #define NG_HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY	0x02
206878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
207878ed226SJulian Elischer 
208878ed226SJulian Elischer /* Encryption modes */
209878ed226SJulian Elischer #define NG_HCI_ENCRYPTION_MODE_NONE		0x00
210878ed226SJulian Elischer #define NG_HCI_ENCRYPTION_MODE_P2P		0x01
211878ed226SJulian Elischer #define NG_HCI_ENCRYPTION_MODE_ALL		0x02
212878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
213878ed226SJulian Elischer 
214878ed226SJulian Elischer /* Quality of service types */
215878ed226SJulian Elischer #define NG_HCI_SERVICE_TYPE_NO_TRAFFIC		0x00
216878ed226SJulian Elischer #define NG_HCI_SERVICE_TYPE_BEST_EFFORT		0x01
217878ed226SJulian Elischer #define NG_HCI_SERVICE_TYPE_GUARANTEED		0x02
218878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
219878ed226SJulian Elischer 
220878ed226SJulian Elischer /* Link policy settings */
221878ed226SJulian Elischer #define NG_HCI_LINK_POLICY_DISABLE_ALL_LM_MODES	0x0000
222878ed226SJulian Elischer #define NG_HCI_LINK_POLICY_ENABLE_ROLE_SWITCH	0x0001 /* Master/Slave switch */
223878ed226SJulian Elischer #define NG_HCI_LINK_POLICY_ENABLE_HOLD_MODE	0x0002
224878ed226SJulian Elischer #define NG_HCI_LINK_POLICY_ENABLE_SNIFF_MODE	0x0004
225878ed226SJulian Elischer #define NG_HCI_LINK_POLICY_ENABLE_PARK_MODE	0x0008
226878ed226SJulian Elischer /* 0x0010 - 0x8000 - reserved for future use */
227878ed226SJulian Elischer 
228878ed226SJulian Elischer /* Event masks */
229ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_DEFAULT			0x00001fffffffffff
230ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_ALL		 	0x1fffffffffffffff
231878ed226SJulian Elischer #define NG_HCI_EVMSK_NONE			0x0000000000000000
232878ed226SJulian Elischer #define NG_HCI_EVMSK_INQUIRY_COMPL		0x0000000000000001
233878ed226SJulian Elischer #define NG_HCI_EVMSK_INQUIRY_RESULT		0x0000000000000002
234878ed226SJulian Elischer #define NG_HCI_EVMSK_CON_COMPL			0x0000000000000004
235878ed226SJulian Elischer #define NG_HCI_EVMSK_CON_REQ			0x0000000000000008
236878ed226SJulian Elischer #define NG_HCI_EVMSK_DISCON_COMPL		0x0000000000000010
237878ed226SJulian Elischer #define NG_HCI_EVMSK_AUTH_COMPL			0x0000000000000020
238878ed226SJulian Elischer #define NG_HCI_EVMSK_REMOTE_NAME_REQ_COMPL	0x0000000000000040
239878ed226SJulian Elischer #define NG_HCI_EVMSK_ENCRYPTION_CHANGE		0x0000000000000080
240878ed226SJulian Elischer #define NG_HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL	0x0000000000000100
241878ed226SJulian Elischer #define NG_HCI_EVMSK_MASTER_LINK_KEY_COMPL	0x0000000000000200
242878ed226SJulian Elischer #define NG_HCI_EVMSK_READ_REMOTE_FEATURES_COMPL	0x0000000000000400
243878ed226SJulian Elischer #define NG_HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL	0x0000000000000800
244878ed226SJulian Elischer #define NG_HCI_EVMSK_QOS_SETUP_COMPL		0x0000000000001000
245878ed226SJulian Elischer #define NG_HCI_EVMSK_COMMAND_COMPL		0x0000000000002000
246878ed226SJulian Elischer #define NG_HCI_EVMSK_COMMAND_STATUS		0x0000000000004000
247878ed226SJulian Elischer #define NG_HCI_EVMSK_HARDWARE_ERROR		0x0000000000008000
248878ed226SJulian Elischer #define NG_HCI_EVMSK_FLUSH_OCCUR		0x0000000000010000
249878ed226SJulian Elischer #define NG_HCI_EVMSK_ROLE_CHANGE		0x0000000000020000
250878ed226SJulian Elischer #define NG_HCI_EVMSK_NUM_COMPL_PKTS		0x0000000000040000
251878ed226SJulian Elischer #define NG_HCI_EVMSK_MODE_CHANGE		0x0000000000080000
252878ed226SJulian Elischer #define NG_HCI_EVMSK_RETURN_LINK_KEYS		0x0000000000100000
253878ed226SJulian Elischer #define NG_HCI_EVMSK_PIN_CODE_REQ		0x0000000000200000
254878ed226SJulian Elischer #define NG_HCI_EVMSK_LINK_KEY_REQ		0x0000000000400000
255878ed226SJulian Elischer #define NG_HCI_EVMSK_LINK_KEY_NOTIFICATION	0x0000000000800000
256878ed226SJulian Elischer #define NG_HCI_EVMSK_LOOPBACK_COMMAND		0x0000000001000000
257878ed226SJulian Elischer #define NG_HCI_EVMSK_DATA_BUFFER_OVERFLOW	0x0000000002000000
258878ed226SJulian Elischer #define NG_HCI_EVMSK_MAX_SLOT_CHANGE		0x0000000004000000
259878ed226SJulian Elischer #define NG_HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE	0x0000000008000000
260878ed226SJulian Elischer #define NG_HCI_EVMSK_CON_PKT_TYPE_CHANGED	0x0000000010000000
261878ed226SJulian Elischer #define NG_HCI_EVMSK_QOS_VIOLATION		0x0000000020000000
262878ed226SJulian Elischer #define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE	0x0000000040000000
263878ed226SJulian Elischer #define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE	0x0000000080000000
264ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_FLOW_SPEC_COMPL		0x0000000100000000
265ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_INQUIRY_RESULT_W_RSSI	0x0000000200000000
266ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_READ_REM_EXT_FEAT_COMPL	0x0000000400000000
267ccb9fc32STakanori Watanabe 
268ccb9fc32STakanori Watanabe /* 0x0000000800000000 -	0x0000080000000000 - not in use */
269ccb9fc32STakanori Watanabe 
270ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_SYNC_CONN_COMPL		0x0000100000000000
271ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_SYNC_CONN_CHANGED		0x0000200000000000
272ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_SNIFF_SUBRATING		0x0000400000000000
273ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_EXT_INQUIRY_RESULT		0x0000800000000000
274ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_ENC_KEY_REFRESH_COMPL	0x0001000000000000
275ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_IO_CAPABILITY_REQ		0x0002000000000000
276ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_IO_CAPABILITY_RESP		0x0004000000000000
277ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_USER_CONFIRMATION_REQ	0x0008000000000000
278ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_USER_PASSKEY_REQ		0x0010000000000000
279ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_REM_OOB_DATA_REQ		0x0020000000000000
280ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_SIMPLE_PAIRING_COMPL	0x0040000000000000
281ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_LINK_SUPERV_TO_CHANGED	0x0080000000000000
282ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_ENH_FLUSH_COMPL		0x0100000000000000
283ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_USER_PASSKEY_NOTIFICATION	0x0200000000000000
284ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_KEYPRESS_NOTIFICATION	0x0400000000000000
285ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_REM_HOST_SUPP_FEAT_NOTIFI	0x0800000000000000
286ccb9fc32STakanori Watanabe #define NG_HCI_EVMSK_LE_META			0x1000000000000000
287ccb9fc32STakanori Watanabe /* 0x1000000100000000 - 0x8000000000000000 - reserved for future use */
288ccb9fc32STakanori Watanabe 
289ccb9fc32STakanori Watanabe /* LE events masks*/
290ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_ALL			0x000000003fffffff
291ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_NONE			0x0000000000000000
292ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_DEFAULT			0x000000000000001f
293ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CONN_COMPLETE		0x0000000000000001
294ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_ADV_REP			0x0000000000000002
295ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CONN_UPDATE		0x0000000000000004
296ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_READ_REM_FEAT_REQ	0x0000000000000008
297ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_LONG_TERM_KEY_REQ	0x0000000000000010
298ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_REM_CONN_PARAM_REQ	0x0000000000000020
299ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_DATA_LENGTH_CHG		0x0000000000000040
300ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_RD_LOC_P256_PK_COMPL	0x0000000000000080
301ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_GEN_DHKEY_COMPL		0x0000000000000100
302ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_ENH_CONN_COMPL		0x0000000000000200
303ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_DIR_ADV_REP		0x0000000000000400
304ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PHY_UPD_COMPL		0x0000000000000800
305ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_EXT_ADV_REP		0x0000000000001000
306ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PER_ADV_SYNC_EST		0x0000000000002000
307ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PER_ADV_REP		0x0000000000004000
308ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PER_ADV_SYNC_LOST	0x0000000000008000
309ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_SCAN_TIMEOUT		0x0000000000010000
310ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_ADV_SET_TERM		0x0000000000020000
311ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_SCAN_REQ_RCVD		0x0000000000040000
312ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CHAN_SEL_ALGO		0x0000000000080000
313ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CONNLESS_IQ_REP		0x0000000000010000
314ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CONN_IQ_REP		0x0000000000020000
315ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CTE_REQ_FAILED		0x0000000000040000
316ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PER_ADV_SYN_TRF_RCVD	0x0000000000080000
317ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CIS_EST			0x0000000000100000
318ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CIS_REQ			0x0000000000200000
319ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_CREATE_BIG_COMPL		0x0000000000400000
320ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_TERM_BIG_COMPL		0x0000000000800000
321ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_BIG_SYNC_EST		0x0000000001000000
322ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_BIG_SYNC_LOST		0x0000000002000000
323ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_REQ_PEER_SCA_COMPL	0x0000000004000000
324ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_PATH_LOSS_THRESHOLD	0x0000000008000000
325ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_TX_PWR_REP		0x0000000010000000
326ccb9fc32STakanori Watanabe #define NG_HCI_LEEVMSK_BIGINFO_ADV_REP		0x0000000020000000
327ccb9fc32STakanori Watanabe /* 0x0000000040000000 - 0x8000000000000000 - reserved for future use */
328878ed226SJulian Elischer 
329878ed226SJulian Elischer /* Filter types */
330878ed226SJulian Elischer #define NG_HCI_FILTER_TYPE_NONE			0x00
331878ed226SJulian Elischer #define NG_HCI_FILTER_TYPE_INQUIRY_RESULT	0x01
332878ed226SJulian Elischer #define NG_HCI_FILTER_TYPE_CON_SETUP		0x02
333878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
334878ed226SJulian Elischer 
335878ed226SJulian Elischer /* Filter condition types for NG_HCI_FILTER_TYPE_INQUIRY_RESULT */
336878ed226SJulian Elischer #define NG_HCI_FILTER_COND_INQUIRY_NEW_UNIT	0x00
337878ed226SJulian Elischer #define NG_HCI_FILTER_COND_INQUIRY_UNIT_CLASS	0x01
338878ed226SJulian Elischer #define NG_HCI_FILTER_COND_INQUIRY_BDADDR	0x02
339878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
340878ed226SJulian Elischer 
341878ed226SJulian Elischer /* Filter condition types for NG_HCI_FILTER_TYPE_CON_SETUP */
342878ed226SJulian Elischer #define NG_HCI_FILTER_COND_CON_ANY_UNIT		0x00
343878ed226SJulian Elischer #define NG_HCI_FILTER_COND_CON_UNIT_CLASS	0x01
344878ed226SJulian Elischer #define NG_HCI_FILTER_COND_CON_BDADDR		0x02
345878ed226SJulian Elischer /* 0x03 - 0xFF - reserved for future use */
346878ed226SJulian Elischer 
347878ed226SJulian Elischer /* Xmit level types */
348878ed226SJulian Elischer #define NG_HCI_XMIT_LEVEL_CURRENT		0x00
349878ed226SJulian Elischer #define NG_HCI_XMIT_LEVEL_MAXIMUM		0x01
350878ed226SJulian Elischer /* 0x02 - 0xFF - reserved for future use */
351878ed226SJulian Elischer 
352878ed226SJulian Elischer /* Host to Host Controller flow control */
353878ed226SJulian Elischer #define NG_HCI_H2HC_FLOW_CONTROL_NONE		0x00
354878ed226SJulian Elischer #define NG_HCI_H2HC_FLOW_CONTROL_ACL		0x01
355878ed226SJulian Elischer #define NG_HCI_H2HC_FLOW_CONTROL_SCO		0x02
356878ed226SJulian Elischer #define NG_HCI_H2HC_FLOW_CONTROL_BOTH		0x03	/* ACL and SCO */
357878ed226SJulian Elischer /* 0x04 - 0xFF - reserved future use */
358878ed226SJulian Elischer 
359878ed226SJulian Elischer /* Country codes */
360878ed226SJulian Elischer #define NG_HCI_COUNTRY_CODE_NAM_EUR_JP		0x00
361878ed226SJulian Elischer #define NG_HCI_COUNTRY_CODE_FRANCE		0x01
362878ed226SJulian Elischer /* 0x02 - 0xFF - reserved future use */
363878ed226SJulian Elischer 
364878ed226SJulian Elischer /* Loopback modes */
365878ed226SJulian Elischer #define NG_HCI_LOOPBACK_NONE			0x00
366878ed226SJulian Elischer #define NG_HCI_LOOPBACK_LOCAL			0x01
367878ed226SJulian Elischer #define NG_HCI_LOOPBACK_REMOTE			0x02
368878ed226SJulian Elischer /* 0x03 - 0xFF - reserved future use */
369878ed226SJulian Elischer 
370878ed226SJulian Elischer /**************************************************************************
371878ed226SJulian Elischer  **************************************************************************
372878ed226SJulian Elischer  **                 Link level defines, headers and types
373878ed226SJulian Elischer  **************************************************************************
374878ed226SJulian Elischer  **************************************************************************/
375878ed226SJulian Elischer 
376878ed226SJulian Elischer /*
377878ed226SJulian Elischer  * Macro(s) to combine OpCode and extract OGF (OpCode Group Field)
378878ed226SJulian Elischer  * and OCF (OpCode Command Field) from OpCode.
379878ed226SJulian Elischer  */
380878ed226SJulian Elischer 
381878ed226SJulian Elischer #define NG_HCI_OPCODE(gf,cf)		((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))
382878ed226SJulian Elischer #define NG_HCI_OCF(op)			((op) & 0x3ff)
383878ed226SJulian Elischer #define NG_HCI_OGF(op)			(((op) >> 10) & 0x3f)
384878ed226SJulian Elischer 
385878ed226SJulian Elischer /*
386878ed226SJulian Elischer  * Marco(s) to extract/combine connection handle, BC (Broadcast) and
387878ed226SJulian Elischer  * PB (Packet boundary) flags.
388878ed226SJulian Elischer  */
389878ed226SJulian Elischer 
390878ed226SJulian Elischer #define NG_HCI_CON_HANDLE(h)		((h) & 0x0fff)
391878ed226SJulian Elischer #define NG_HCI_PB_FLAG(h)		(((h) & 0x3000) >> 12)
392878ed226SJulian Elischer #define NG_HCI_BC_FLAG(h)		(((h) & 0xc000) >> 14)
393878ed226SJulian Elischer #define NG_HCI_MK_CON_HANDLE(h, pb, bc) \
394878ed226SJulian Elischer 	(((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
395878ed226SJulian Elischer 
396878ed226SJulian Elischer /* PB flag values */
397b8c46d56STakanori Watanabe #define	NG_HCI_LE_PACKET_START		0x0
398878ed226SJulian Elischer #define	NG_HCI_PACKET_FRAGMENT		0x1
399878ed226SJulian Elischer #define	NG_HCI_PACKET_START		0x2
400b8c46d56STakanori Watanabe 					/* 11 for AMP packet, not supported */
401878ed226SJulian Elischer 
402878ed226SJulian Elischer /* BC flag values */
403878ed226SJulian Elischer #define NG_HCI_POINT2POINT		0x0 /* only Host controller to Host */
404878ed226SJulian Elischer #define NG_HCI_BROADCAST_ACTIVE		0x1 /* both directions */
405878ed226SJulian Elischer #define NG_HCI_BROADCAST_PICONET	0x2 /* both directions */
406878ed226SJulian Elischer 					/* 11 - reserved for future use */
407878ed226SJulian Elischer 
408878ed226SJulian Elischer /* HCI command packet header */
409878ed226SJulian Elischer #define NG_HCI_CMD_PKT			0x01
410878ed226SJulian Elischer #define NG_HCI_CMD_PKT_SIZE		0xff /* without header */
411878ed226SJulian Elischer typedef struct {
412878ed226SJulian Elischer 	u_int8_t	type;   /* MUST be 0x1 */
413878ed226SJulian Elischer 	u_int16_t	opcode; /* OpCode */
414878ed226SJulian Elischer 	u_int8_t	length; /* parameter(s) length in bytes */
415878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_cmd_pkt_t;
416878ed226SJulian Elischer 
417878ed226SJulian Elischer /* ACL data packet header */
418878ed226SJulian Elischer #define NG_HCI_ACL_DATA_PKT		0x02
419878ed226SJulian Elischer #define NG_HCI_ACL_PKT_SIZE		0xffff /* without header */
420878ed226SJulian Elischer typedef struct {
421878ed226SJulian Elischer 	u_int8_t	type;        /* MUST be 0x2 */
422878ed226SJulian Elischer 	u_int16_t	con_handle;  /* connection handle + PB + BC flags */
423878ed226SJulian Elischer 	u_int16_t	length;      /* payload length in bytes */
424878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_acldata_pkt_t;
425878ed226SJulian Elischer 
426878ed226SJulian Elischer /* SCO data packet header */
427878ed226SJulian Elischer #define NG_HCI_SCO_DATA_PKT		0x03
428878ed226SJulian Elischer #define NG_HCI_SCO_PKT_SIZE		0xff /* without header */
429878ed226SJulian Elischer typedef struct {
430878ed226SJulian Elischer 	u_int8_t	type;       /* MUST be 0x3 */
431878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle + reserved bits */
432878ed226SJulian Elischer 	u_int8_t	length;     /* payload length in bytes */
433878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_scodata_pkt_t;
434878ed226SJulian Elischer 
435878ed226SJulian Elischer /* HCI event packet header */
436878ed226SJulian Elischer #define NG_HCI_EVENT_PKT		0x04
437878ed226SJulian Elischer #define NG_HCI_EVENT_PKT_SIZE		0xff /* without header */
438878ed226SJulian Elischer typedef struct {
439878ed226SJulian Elischer 	u_int8_t	type;   /* MUST be 0x4 */
440878ed226SJulian Elischer 	u_int8_t	event;  /* event */
441878ed226SJulian Elischer 	u_int8_t	length; /* parameter(s) length in bytes */
442878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_event_pkt_t;
443878ed226SJulian Elischer 
444878ed226SJulian Elischer /* Bluetooth unit address */
445878ed226SJulian Elischer typedef struct {
446878ed226SJulian Elischer 	u_int8_t	b[NG_HCI_BDADDR_SIZE];
447878ed226SJulian Elischer } __attribute__ ((packed)) bdaddr_t;
448878ed226SJulian Elischer typedef bdaddr_t *	bdaddr_p;
449878ed226SJulian Elischer 
450878ed226SJulian Elischer /* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */
451878ed226SJulian Elischer #define NG_HCI_BDADDR_ANY	((bdaddr_p) "\000\000\000\000\000\000")
452878ed226SJulian Elischer 
453878ed226SJulian Elischer /* HCI status return parameter */
454878ed226SJulian Elischer typedef struct {
455878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
456878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_status_rp;
457878ed226SJulian Elischer 
458878ed226SJulian Elischer /**************************************************************************
459878ed226SJulian Elischer  **************************************************************************
460878ed226SJulian Elischer  **        Upper layer protocol interface. LP_xxx event parameters
461878ed226SJulian Elischer  **************************************************************************
462878ed226SJulian Elischer  **************************************************************************/
463878ed226SJulian Elischer 
464878ed226SJulian Elischer /* Connection Request Event */
465878ed226SJulian Elischer #define NGM_HCI_LP_CON_REQ			1  /* Upper -> HCI */
466878ed226SJulian Elischer typedef struct {
467878ed226SJulian Elischer 	u_int16_t	link_type; /* type of connection */
468878ed226SJulian Elischer 	bdaddr_t	bdaddr;    /* remote unit address */
469878ed226SJulian Elischer } ng_hci_lp_con_req_ep;
470878ed226SJulian Elischer 
471878ed226SJulian Elischer /*
472878ed226SJulian Elischer  * XXX XXX XXX
473878ed226SJulian Elischer  *
474878ed226SJulian Elischer  * NOTE: This request is not defined by Bluetooth specification,
475878ed226SJulian Elischer  * but i find it useful :)
476878ed226SJulian Elischer  */
477878ed226SJulian Elischer #define NGM_HCI_LP_DISCON_REQ			2 /* Upper -> HCI */
478878ed226SJulian Elischer typedef struct {
479878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
480878ed226SJulian Elischer 	u_int16_t	reason;	    /* reason to disconnect (only low byte) */
481878ed226SJulian Elischer } ng_hci_lp_discon_req_ep;
482878ed226SJulian Elischer 
483878ed226SJulian Elischer /* Connection Confirmation Event */
484878ed226SJulian Elischer #define NGM_HCI_LP_CON_CFM			3  /* HCI -> Upper */
485878ed226SJulian Elischer typedef struct {
486878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
487878ed226SJulian Elischer 	u_int8_t	link_type;  /* link type */
488878ed226SJulian Elischer 	u_int16_t	con_handle; /* con_handle */
489878ed226SJulian Elischer 	bdaddr_t	bdaddr;     /* remote unit address */
490878ed226SJulian Elischer } ng_hci_lp_con_cfm_ep;
491878ed226SJulian Elischer 
492878ed226SJulian Elischer /* Connection Indication Event */
493878ed226SJulian Elischer #define NGM_HCI_LP_CON_IND			4  /* HCI -> Upper */
494878ed226SJulian Elischer typedef struct {
495878ed226SJulian Elischer 	u_int8_t	link_type;                 /* link type */
496878ed226SJulian Elischer 	u_int8_t	uclass[NG_HCI_CLASS_SIZE]; /* unit class */
497878ed226SJulian Elischer 	bdaddr_t	bdaddr;                    /* remote unit address */
498878ed226SJulian Elischer } ng_hci_lp_con_ind_ep;
499878ed226SJulian Elischer 
500878ed226SJulian Elischer /* Connection Response Event */
501878ed226SJulian Elischer #define NGM_HCI_LP_CON_RSP			5  /* Upper -> HCI */
502878ed226SJulian Elischer typedef struct {
503878ed226SJulian Elischer 	u_int8_t	status;    /* 0x00 - accept connection */
504878ed226SJulian Elischer 	u_int8_t	link_type; /* link type */
505878ed226SJulian Elischer 	bdaddr_t	bdaddr;    /* remote unit address */
506878ed226SJulian Elischer } ng_hci_lp_con_rsp_ep;
507878ed226SJulian Elischer 
508878ed226SJulian Elischer /* Disconnection Indication Event */
509878ed226SJulian Elischer #define NGM_HCI_LP_DISCON_IND			6  /* HCI -> Upper */
510878ed226SJulian Elischer typedef struct {
511878ed226SJulian Elischer 	u_int8_t	reason;     /* reason to disconnect (only low byte) */
512878ed226SJulian Elischer 	u_int8_t	link_type;  /* link type */
513878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
514878ed226SJulian Elischer } ng_hci_lp_discon_ind_ep;
515878ed226SJulian Elischer 
516878ed226SJulian Elischer /* QoS Setup Request Event */
517878ed226SJulian Elischer #define NGM_HCI_LP_QOS_REQ			7  /* Upper -> HCI */
518878ed226SJulian Elischer typedef struct {
519878ed226SJulian Elischer 	u_int16_t	con_handle;      /* connection handle */
520878ed226SJulian Elischer 	u_int8_t	flags;           /* reserved */
521878ed226SJulian Elischer 	u_int8_t	service_type;    /* service type */
522878ed226SJulian Elischer 	u_int32_t	token_rate;      /* bytes/sec */
523878ed226SJulian Elischer 	u_int32_t	peak_bandwidth;  /* bytes/sec */
524878ed226SJulian Elischer 	u_int32_t	latency;         /* msec */
525878ed226SJulian Elischer 	u_int32_t	delay_variation; /* msec */
526878ed226SJulian Elischer } ng_hci_lp_qos_req_ep;
527878ed226SJulian Elischer 
528878ed226SJulian Elischer /* QoS Conformition Event */
529878ed226SJulian Elischer #define NGM_HCI_LP_QOS_CFM			8  /* HCI -> Upper */
530878ed226SJulian Elischer typedef struct {
531878ed226SJulian Elischer 	u_int16_t	status;          /* 0x00 - success  (only low byte) */
532878ed226SJulian Elischer 	u_int16_t	con_handle;      /* connection handle */
533878ed226SJulian Elischer } ng_hci_lp_qos_cfm_ep;
534878ed226SJulian Elischer 
535878ed226SJulian Elischer /* QoS Violation Indication Event */
536878ed226SJulian Elischer #define NGM_HCI_LP_QOS_IND			9  /* HCI -> Upper */
537878ed226SJulian Elischer typedef struct {
538878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
539878ed226SJulian Elischer } ng_hci_lp_qos_ind_ep;
5403a601a23STakanori Watanabe /*Encryption Change event*/
5413a601a23STakanori Watanabe #define NGM_HCI_LP_ENC_CHG 			10 /* HCI->Upper*/
5423a601a23STakanori Watanabe typedef struct {
5433a601a23STakanori Watanabe 	uint16_t con_handle;
5443a601a23STakanori Watanabe 	uint8_t status;
5453a601a23STakanori Watanabe 	uint8_t link_type;
5463a601a23STakanori Watanabe }ng_hci_lp_enc_change_ep;
547878ed226SJulian Elischer /**************************************************************************
548878ed226SJulian Elischer  **************************************************************************
549878ed226SJulian Elischer  **                    HCI node command/event parameters
550878ed226SJulian Elischer  **************************************************************************
551878ed226SJulian Elischer  **************************************************************************/
552878ed226SJulian Elischer 
553878ed226SJulian Elischer /* Debug levels */
554878ed226SJulian Elischer #define NG_HCI_ALERT_LEVEL		1
555878ed226SJulian Elischer #define NG_HCI_ERR_LEVEL		2
556878ed226SJulian Elischer #define NG_HCI_WARN_LEVEL		3
557878ed226SJulian Elischer #define NG_HCI_INFO_LEVEL		4
558878ed226SJulian Elischer 
559878ed226SJulian Elischer /* Unit states */
560878ed226SJulian Elischer #define NG_HCI_UNIT_CONNECTED		(1 << 0)
561878ed226SJulian Elischer #define NG_HCI_UNIT_INITED		(1 << 1)
562878ed226SJulian Elischer #define NG_HCI_UNIT_READY	(NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED)
563878ed226SJulian Elischer #define NG_HCI_UNIT_COMMAND_PENDING	(1 << 2)
564878ed226SJulian Elischer 
565878ed226SJulian Elischer /* Connection state */
566878ed226SJulian Elischer #define NG_HCI_CON_CLOSED		0 /* connection closed */
567878ed226SJulian Elischer #define NG_HCI_CON_W4_LP_CON_RSP	1 /* wait for LP_ConnectRsp */
568878ed226SJulian Elischer #define NG_HCI_CON_W4_CONN_COMPLETE	2 /* wait for Connection_Complete evt */
569878ed226SJulian Elischer #define NG_HCI_CON_OPEN			3 /* connection open */
570878ed226SJulian Elischer 
571878ed226SJulian Elischer /* Get HCI node (unit) state (see states above) */
572878ed226SJulian Elischer #define NGM_HCI_NODE_GET_STATE			100  /* HCI -> User */
573878ed226SJulian Elischer typedef u_int16_t	ng_hci_node_state_ep;
574878ed226SJulian Elischer 
575878ed226SJulian Elischer /* Turn on "inited" bit */
576878ed226SJulian Elischer #define NGM_HCI_NODE_INIT			101 /* User -> HCI */
577878ed226SJulian Elischer /* No parameters */
578878ed226SJulian Elischer 
579878ed226SJulian Elischer /* Get/Set node debug level (see debug levels above) */
580878ed226SJulian Elischer #define NGM_HCI_NODE_GET_DEBUG			102 /* HCI -> User */
581878ed226SJulian Elischer #define NGM_HCI_NODE_SET_DEBUG			103 /* User -> HCI */
582878ed226SJulian Elischer typedef u_int16_t	ng_hci_node_debug_ep;
583878ed226SJulian Elischer 
584878ed226SJulian Elischer /* Get node buffer info */
585878ed226SJulian Elischer #define NGM_HCI_NODE_GET_BUFFER			104 /* HCI -> User */
586878ed226SJulian Elischer typedef struct {
587878ed226SJulian Elischer 	u_int8_t	cmd_free; /* number of free command packets */
588878ed226SJulian Elischer 	u_int8_t	sco_size; /* max. size of SCO packet */
589878ed226SJulian Elischer 	u_int16_t	sco_pkts; /* number of SCO packets */
590878ed226SJulian Elischer 	u_int16_t	sco_free; /* number of free SCO packets */
591878ed226SJulian Elischer 	u_int16_t	acl_size; /* max. size of ACL packet */
592878ed226SJulian Elischer 	u_int16_t	acl_pkts; /* number of ACL packets */
593878ed226SJulian Elischer 	u_int16_t	acl_free; /* number of free ACL packets */
594878ed226SJulian Elischer } ng_hci_node_buffer_ep;
595878ed226SJulian Elischer 
596878ed226SJulian Elischer /* Get BDADDR */
597878ed226SJulian Elischer #define NGM_HCI_NODE_GET_BDADDR			105 /* HCI -> User */
598878ed226SJulian Elischer /* bdaddr_t -- BDADDR */
599878ed226SJulian Elischer 
600878ed226SJulian Elischer /* Get features */
601878ed226SJulian Elischer #define NGM_HCI_NODE_GET_FEATURES		106 /* HCI -> User */
602878ed226SJulian Elischer /* features[NG_HCI_FEATURES_SIZE] -- features */
603878ed226SJulian Elischer 
604878ed226SJulian Elischer #define NGM_HCI_NODE_GET_STAT			107 /* HCI -> User */
605878ed226SJulian Elischer typedef struct {
606878ed226SJulian Elischer 	u_int32_t	cmd_sent;   /* number of HCI commands sent */
607878ed226SJulian Elischer 	u_int32_t	evnt_recv;  /* number of HCI events received */
608878ed226SJulian Elischer 	u_int32_t	acl_recv;   /* number of ACL packets received */
609878ed226SJulian Elischer 	u_int32_t	acl_sent;   /* number of ACL packets sent */
610878ed226SJulian Elischer 	u_int32_t	sco_recv;   /* number of SCO packets received */
611878ed226SJulian Elischer 	u_int32_t	sco_sent;   /* number of SCO packets sent */
612878ed226SJulian Elischer 	u_int32_t	bytes_recv; /* total number of bytes received */
613878ed226SJulian Elischer 	u_int32_t	bytes_sent; /* total number of bytes sent */
614878ed226SJulian Elischer } ng_hci_node_stat_ep;
615878ed226SJulian Elischer 
616878ed226SJulian Elischer #define NGM_HCI_NODE_RESET_STAT			108 /* User -> HCI */
617878ed226SJulian Elischer /* No parameters */
618878ed226SJulian Elischer 
619878ed226SJulian Elischer #define NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE	109 /* User -> HCI */
620878ed226SJulian Elischer 
621878ed226SJulian Elischer #define NGM_HCI_NODE_GET_NEIGHBOR_CACHE		110 /* HCI -> User */
622878ed226SJulian Elischer typedef struct {
623878ed226SJulian Elischer 	u_int32_t	num_entries;	/* number of entries */
624878ed226SJulian Elischer } ng_hci_node_get_neighbor_cache_ep;
625878ed226SJulian Elischer 
626878ed226SJulian Elischer typedef struct {
627878ed226SJulian Elischer 	u_int16_t	page_scan_rep_mode;             /* page rep scan mode */
628878ed226SJulian Elischer 	u_int16_t	page_scan_mode;                 /* page scan mode */
629878ed226SJulian Elischer 	u_int16_t	clock_offset;                   /* clock offset */
630878ed226SJulian Elischer 	bdaddr_t	bdaddr;                         /* bdaddr */
631878ed226SJulian Elischer 	u_int8_t	features[NG_HCI_FEATURES_SIZE]; /* features */
6324aa92fe2STakanori Watanabe 	uint8_t 	addrtype;
6334aa92fe2STakanori Watanabe 	uint8_t		extinq_size; /* MAX 240*/
6344aa92fe2STakanori Watanabe 	uint8_t		extinq_data[NG_HCI_EXTINQ_MAX];
635878ed226SJulian Elischer } ng_hci_node_neighbor_cache_entry_ep;
636878ed226SJulian Elischer 
637878ed226SJulian Elischer #define NG_HCI_MAX_NEIGHBOR_NUM \
638878ed226SJulian Elischer 	((0xffff - sizeof(ng_hci_node_get_neighbor_cache_ep))/sizeof(ng_hci_node_neighbor_cache_entry_ep))
639878ed226SJulian Elischer 
640878ed226SJulian Elischer #define NGM_HCI_NODE_GET_CON_LIST		111 /* HCI -> User */
641878ed226SJulian Elischer typedef struct {
642878ed226SJulian Elischer 	u_int32_t	num_connections; /* number of connections */
643878ed226SJulian Elischer } ng_hci_node_con_list_ep;
644878ed226SJulian Elischer 
645878ed226SJulian Elischer typedef struct {
646878ed226SJulian Elischer 	u_int8_t	link_type;       /* ACL or SCO */
647878ed226SJulian Elischer 	u_int8_t	encryption_mode; /* none, p2p, ... */
648878ed226SJulian Elischer 	u_int8_t	mode;            /* ACTIVE, HOLD ... */
649878ed226SJulian Elischer 	u_int8_t	role;            /* MASTER/SLAVE */
650878ed226SJulian Elischer 	u_int16_t	state;           /* connection state */
651878ed226SJulian Elischer 	u_int16_t	reserved;        /* place holder */
652878ed226SJulian Elischer 	u_int16_t	pending;         /* number of pending packets */
653878ed226SJulian Elischer 	u_int16_t	queue_len;       /* number of packets in queue */
654878ed226SJulian Elischer 	u_int16_t	con_handle;      /* connection handle */
655878ed226SJulian Elischer 	bdaddr_t	bdaddr;          /* remote bdaddr */
656878ed226SJulian Elischer } ng_hci_node_con_ep;
657878ed226SJulian Elischer 
658878ed226SJulian Elischer #define NG_HCI_MAX_CON_NUM \
659878ed226SJulian Elischer 	((0xffff - sizeof(ng_hci_node_con_list_ep))/sizeof(ng_hci_node_con_ep))
660878ed226SJulian Elischer 
661878ed226SJulian Elischer #define NGM_HCI_NODE_UP				112 /* HCI -> Upper */
662878ed226SJulian Elischer typedef struct {
663878ed226SJulian Elischer 	u_int16_t	pkt_size; /* max. ACL/SCO packet size (w/out header) */
664878ed226SJulian Elischer 	u_int16_t	num_pkts; /* ACL/SCO packet queue size */
665878ed226SJulian Elischer 	u_int16_t	reserved; /* place holder */
666878ed226SJulian Elischer 	bdaddr_t	bdaddr;	  /* bdaddr */
667878ed226SJulian Elischer } ng_hci_node_up_ep;
668878ed226SJulian Elischer 
669878ed226SJulian Elischer #define NGM_HCI_SYNC_CON_QUEUE			113 /* HCI -> Upper */
670878ed226SJulian Elischer typedef struct {
671878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
672878ed226SJulian Elischer 	u_int16_t	completed;  /* number of completed packets */
673878ed226SJulian Elischer } ng_hci_sync_con_queue_ep;
674878ed226SJulian Elischer 
675878ed226SJulian Elischer #define NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK	114 /* HCI -> User */
676878ed226SJulian Elischer #define NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK	115 /* User -> HCI */
677878ed226SJulian Elischer typedef u_int16_t	ng_hci_node_link_policy_mask_ep;
678878ed226SJulian Elischer 
679878ed226SJulian Elischer #define NGM_HCI_NODE_GET_PACKET_MASK		116 /* HCI -> User */
680878ed226SJulian Elischer #define NGM_HCI_NODE_SET_PACKET_MASK		117 /* User -> HCI */
681878ed226SJulian Elischer typedef u_int16_t	ng_hci_node_packet_mask_ep;
682878ed226SJulian Elischer 
683f2bb1caeSJulian Elischer #define NGM_HCI_NODE_GET_ROLE_SWITCH		118 /* HCI -> User */
684f2bb1caeSJulian Elischer #define NGM_HCI_NODE_SET_ROLE_SWITCH		119 /* User -> HCI */
685f2bb1caeSJulian Elischer typedef u_int16_t	ng_hci_node_role_switch_ep;
686f2bb1caeSJulian Elischer 
687c4e3f62cSMaksim Yevmenkin #define	NGM_HCI_NODE_LIST_NAMES			200 /* HCI -> User */
688c4e3f62cSMaksim Yevmenkin 
689878ed226SJulian Elischer /**************************************************************************
690878ed226SJulian Elischer  **************************************************************************
691878ed226SJulian Elischer  **             Link control commands and return parameters
692878ed226SJulian Elischer  **************************************************************************
693878ed226SJulian Elischer  **************************************************************************/
694878ed226SJulian Elischer 
695878ed226SJulian Elischer #define NG_HCI_OGF_LINK_CONTROL			0x01 /* OpCode Group Field */
696878ed226SJulian Elischer 
697878ed226SJulian Elischer #define NG_HCI_OCF_INQUIRY			0x0001
698878ed226SJulian Elischer typedef struct {
699878ed226SJulian Elischer 	u_int8_t	lap[NG_HCI_LAP_SIZE]; /* LAP */
700878ed226SJulian Elischer 	u_int8_t	inquiry_length; /* (N x 1.28) sec */
701878ed226SJulian Elischer 	u_int8_t	num_responses;  /* Max. # of responses before halted */
702878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_inquiry_cp;
703878ed226SJulian Elischer /* No return parameter(s) */
704878ed226SJulian Elischer 
705878ed226SJulian Elischer #define NG_HCI_OCF_INQUIRY_CANCEL		0x0002
706878ed226SJulian Elischer /* No command parameter(s) */
707878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_inquiry_cancel_rp;
708878ed226SJulian Elischer 
709878ed226SJulian Elischer #define NG_HCI_OCF_PERIODIC_INQUIRY		0x0003
710878ed226SJulian Elischer typedef struct {
711878ed226SJulian Elischer 	u_int16_t	max_period_length; /* Max. and min. amount of time */
712878ed226SJulian Elischer 	u_int16_t	min_period_length; /* between consecutive inquiries */
713878ed226SJulian Elischer 	u_int8_t	lap[NG_HCI_LAP_SIZE]; /* LAP */
714878ed226SJulian Elischer 	u_int8_t	inquiry_length;    /* (inquiry_length * 1.28) sec */
715878ed226SJulian Elischer 	u_int8_t	num_responses;     /* Max. # of responses */
716878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_periodic_inquiry_cp;
717878ed226SJulian Elischer 
718878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_periodic_inquiry_rp;
719878ed226SJulian Elischer 
720878ed226SJulian Elischer #define NG_HCI_OCF_EXIT_PERIODIC_INQUIRY	0x0004
721878ed226SJulian Elischer /* No command parameter(s) */
722878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_exit_periodic_inquiry_rp;
723878ed226SJulian Elischer 
724878ed226SJulian Elischer #define NG_HCI_OCF_CREATE_CON			0x0005
725878ed226SJulian Elischer typedef struct {
726878ed226SJulian Elischer 	bdaddr_t	bdaddr;             /* destination address */
727878ed226SJulian Elischer 	u_int16_t	pkt_type;           /* packet type */
728878ed226SJulian Elischer 	u_int8_t	page_scan_rep_mode; /* page scan repetition mode */
729878ed226SJulian Elischer 	u_int8_t	page_scan_mode;     /* page scan mode */
730878ed226SJulian Elischer 	u_int16_t	clock_offset;       /* clock offset */
731878ed226SJulian Elischer 	u_int8_t	accept_role_switch; /* accept role switch? 0x00 - no */
732878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_create_con_cp;
733878ed226SJulian Elischer /* No return parameter(s) */
734878ed226SJulian Elischer 
735878ed226SJulian Elischer #define NG_HCI_OCF_DISCON			0x0006
736878ed226SJulian Elischer typedef struct {
737878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
738878ed226SJulian Elischer 	u_int8_t	reason;     /* reason to disconnect */
739878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_discon_cp;
740878ed226SJulian Elischer /* No return parameter(s) */
741878ed226SJulian Elischer 
742878ed226SJulian Elischer #define NG_HCI_OCF_ADD_SCO_CON			0x0007
743878ed226SJulian Elischer typedef struct {
744878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
745878ed226SJulian Elischer 	u_int16_t	pkt_type;   /* packet type */
746878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_add_sco_con_cp;
747878ed226SJulian Elischer /* No return parameter(s) */
748878ed226SJulian Elischer 
749878ed226SJulian Elischer #define NG_HCI_OCF_ACCEPT_CON			0x0009
750878ed226SJulian Elischer typedef struct {
751878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* address of unit to be connected */
752878ed226SJulian Elischer 	u_int8_t	role;   /* connection role */
753878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_accept_con_cp;
754878ed226SJulian Elischer /* No return parameter(s) */
755878ed226SJulian Elischer 
756878ed226SJulian Elischer #define NG_HCI_OCF_REJECT_CON			0x000a
757878ed226SJulian Elischer typedef struct {
758878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote address */
759878ed226SJulian Elischer 	u_int8_t	reason; /* reason to reject */
760878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_reject_con_cp;
761878ed226SJulian Elischer /* No return parameter(s) */
762878ed226SJulian Elischer 
763878ed226SJulian Elischer #define NG_HCI_OCF_LINK_KEY_REP			0x000b
764878ed226SJulian Elischer typedef struct {
765878ed226SJulian Elischer 	bdaddr_t	bdaddr;               /* remote address */
766878ed226SJulian Elischer 	u_int8_t	key[NG_HCI_KEY_SIZE]; /* key */
767878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_rep_cp;
768878ed226SJulian Elischer 
769878ed226SJulian Elischer typedef struct {
770878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
771878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* unit address */
772878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_rep_rp;
773878ed226SJulian Elischer 
774878ed226SJulian Elischer #define NG_HCI_OCF_LINK_KEY_NEG_REP		0x000c
775878ed226SJulian Elischer typedef struct {
776878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote address */
777878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_neg_rep_cp;
778878ed226SJulian Elischer 
779878ed226SJulian Elischer typedef struct {
780878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
781878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* unit address */
782878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_neg_rep_rp;
783878ed226SJulian Elischer 
784878ed226SJulian Elischer #define NG_HCI_OCF_PIN_CODE_REP			0x000d
785878ed226SJulian Elischer typedef struct {
786878ed226SJulian Elischer 	bdaddr_t	bdaddr;               /* remote address */
787878ed226SJulian Elischer 	u_int8_t	pin_size;             /* pin code length (in bytes) */
788878ed226SJulian Elischer 	u_int8_t	pin[NG_HCI_PIN_SIZE]; /* pin code */
789878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_pin_code_rep_cp;
790878ed226SJulian Elischer 
791878ed226SJulian Elischer typedef struct {
792878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
793878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* unit address */
794878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_pin_code_rep_rp;
795878ed226SJulian Elischer 
796878ed226SJulian Elischer #define NG_HCI_OCF_PIN_CODE_NEG_REP		0x000e
797878ed226SJulian Elischer typedef struct {
798878ed226SJulian Elischer 	bdaddr_t	bdaddr;  /* remote address */
799878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_cp;
800878ed226SJulian Elischer 
801878ed226SJulian Elischer typedef struct {
802878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
803878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* unit address */
804878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_rp;
805878ed226SJulian Elischer 
806878ed226SJulian Elischer #define NG_HCI_OCF_CHANGE_CON_PKT_TYPE		0x000f
807878ed226SJulian Elischer typedef struct {
808878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
809878ed226SJulian Elischer 	u_int16_t	pkt_type;   /* packet type */
810878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_change_con_pkt_type_cp;
811878ed226SJulian Elischer /* No return parameter(s) */
812878ed226SJulian Elischer 
813878ed226SJulian Elischer #define NG_HCI_OCF_AUTH_REQ			0x0011
814878ed226SJulian Elischer typedef struct {
815878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
816878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_auth_req_cp;
817878ed226SJulian Elischer /* No return parameter(s) */
818878ed226SJulian Elischer 
819878ed226SJulian Elischer #define NG_HCI_OCF_SET_CON_ENCRYPTION		0x0013
820878ed226SJulian Elischer typedef struct {
821878ed226SJulian Elischer 	u_int16_t	con_handle;        /* connection handle */
822878ed226SJulian Elischer 	u_int8_t	encryption_enable; /* 0x00 - disable, 0x01 - enable */
823878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_set_con_encryption_cp;
824878ed226SJulian Elischer /* No return parameter(s) */
825878ed226SJulian Elischer 
826878ed226SJulian Elischer #define NG_HCI_OCF_CHANGE_CON_LINK_KEY		0x0015
827878ed226SJulian Elischer typedef struct {
828878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
829878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_change_con_link_key_cp;
830878ed226SJulian Elischer /* No return parameter(s) */
831878ed226SJulian Elischer 
832878ed226SJulian Elischer #define NG_HCI_OCF_MASTER_LINK_KEY		0x0017
833878ed226SJulian Elischer typedef struct {
834878ed226SJulian Elischer 	u_int8_t	key_flag; /* key flag */
835878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_master_link_key_cp;
836878ed226SJulian Elischer /* No return parameter(s) */
837878ed226SJulian Elischer 
838878ed226SJulian Elischer #define NG_HCI_OCF_REMOTE_NAME_REQ		0x0019
839878ed226SJulian Elischer typedef struct {
840878ed226SJulian Elischer 	bdaddr_t	bdaddr;             /* remote address */
841878ed226SJulian Elischer 	u_int8_t	page_scan_rep_mode; /* page scan repetition mode */
842878ed226SJulian Elischer 	u_int8_t	page_scan_mode;     /* page scan mode */
843878ed226SJulian Elischer 	u_int16_t	clock_offset;       /* clock offset */
844878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_remote_name_req_cp;
845878ed226SJulian Elischer /* No return parameter(s) */
846878ed226SJulian Elischer 
847878ed226SJulian Elischer #define NG_HCI_OCF_READ_REMOTE_FEATURES		0x001b
848878ed226SJulian Elischer typedef struct {
849878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
850878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_remote_features_cp;
851878ed226SJulian Elischer /* No return parameter(s) */
852878ed226SJulian Elischer 
853878ed226SJulian Elischer #define NG_HCI_OCF_READ_REMOTE_VER_INFO		0x001d
854878ed226SJulian Elischer typedef struct {
855878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
856878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_remote_ver_info_cp;
857878ed226SJulian Elischer /* No return parameter(s) */
858878ed226SJulian Elischer 
859878ed226SJulian Elischer #define NG_HCI_OCF_READ_CLOCK_OFFSET		 0x001f
860878ed226SJulian Elischer typedef struct {
861878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
862878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_clock_offset_cp;
863878ed226SJulian Elischer /* No return parameter(s) */
864878ed226SJulian Elischer 
865*4ae0fa8aSAndreas Kempe #define	NG_HCI_IO_CAPABILITY_REQUEST_REPLY		0x002b
866*4ae0fa8aSAndreas Kempe typedef struct {
867*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
868*4ae0fa8aSAndreas Kempe 	u_int8_t	io_capability;
869*4ae0fa8aSAndreas Kempe 	u_int8_t	oob_data_present;
870*4ae0fa8aSAndreas Kempe 	u_int8_t	authentication_requirements;
871*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_io_capability_request_reply_cp;
872*4ae0fa8aSAndreas Kempe 
873*4ae0fa8aSAndreas Kempe typedef struct {
874*4ae0fa8aSAndreas Kempe 	u_int8_t	status;
875*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
876*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_io_capability_request_reply_rp;
877*4ae0fa8aSAndreas Kempe 
878*4ae0fa8aSAndreas Kempe #define	NG_HCI_USER_CONFIRMATION_REQUEST_REPLY		0x002c
879*4ae0fa8aSAndreas Kempe typedef struct {
880*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
881*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_cp;
882*4ae0fa8aSAndreas Kempe 
883*4ae0fa8aSAndreas Kempe typedef struct {
884*4ae0fa8aSAndreas Kempe 	u_int8_t	status;
885*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
886*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_rp;
887*4ae0fa8aSAndreas Kempe 
888*4ae0fa8aSAndreas Kempe #define	NG_HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY	0x002d
889*4ae0fa8aSAndreas Kempe typedef struct {
890*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
891*4ae0fa8aSAndreas Kempe } __attribute__((packed)) ng_hci_user_confirmation_request_negative_reply_cp;
892*4ae0fa8aSAndreas Kempe 
893*4ae0fa8aSAndreas Kempe typedef struct {
894*4ae0fa8aSAndreas Kempe 	u_int8_t	status;
895*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
896*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_user_confirmation_request_negative_reply_rp;
897*4ae0fa8aSAndreas Kempe 
898*4ae0fa8aSAndreas Kempe #define	NG_HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY	0x0034
899*4ae0fa8aSAndreas Kempe typedef struct {
900*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
901*4ae0fa8aSAndreas Kempe 	u_int8_t	reason;
902*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_cp;
903*4ae0fa8aSAndreas Kempe 
904*4ae0fa8aSAndreas Kempe typedef struct {
905*4ae0fa8aSAndreas Kempe 	u_int8_t	status;
906*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
907*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_rp;
908*4ae0fa8aSAndreas Kempe 
909878ed226SJulian Elischer /**************************************************************************
910878ed226SJulian Elischer  **************************************************************************
911878ed226SJulian Elischer  **        Link policy commands and return parameters
912878ed226SJulian Elischer  **************************************************************************
913878ed226SJulian Elischer  **************************************************************************/
914878ed226SJulian Elischer 
915878ed226SJulian Elischer #define NG_HCI_OGF_LINK_POLICY			0x02 /* OpCode Group Field */
916878ed226SJulian Elischer 
917878ed226SJulian Elischer #define NG_HCI_OCF_HOLD_MODE			0x0001
918878ed226SJulian Elischer typedef struct {
919878ed226SJulian Elischer 	u_int16_t	con_handle;   /* connection handle */
920878ed226SJulian Elischer 	u_int16_t	max_interval; /* (max_interval * 0.625) msec */
921878ed226SJulian Elischer 	u_int16_t	min_interval; /* (max_interval * 0.625) msec */
922878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_hold_mode_cp;
923878ed226SJulian Elischer /* No return parameter(s) */
924878ed226SJulian Elischer 
925878ed226SJulian Elischer #define NG_HCI_OCF_SNIFF_MODE			0x0003
926878ed226SJulian Elischer typedef struct {
927878ed226SJulian Elischer 	u_int16_t	con_handle;   /* connection handle */
928878ed226SJulian Elischer 	u_int16_t	max_interval; /* (max_interval * 0.625) msec */
929878ed226SJulian Elischer 	u_int16_t	min_interval; /* (max_interval * 0.625) msec */
930878ed226SJulian Elischer 	u_int16_t	attempt;      /* (2 * attempt - 1) * 0.625 msec */
931878ed226SJulian Elischer 	u_int16_t	timeout;      /* (2 * attempt - 1) * 0.625 msec */
932878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_sniff_mode_cp;
933878ed226SJulian Elischer /* No return parameter(s) */
934878ed226SJulian Elischer 
935878ed226SJulian Elischer #define NG_HCI_OCF_EXIT_SNIFF_MODE		0x0004
936878ed226SJulian Elischer typedef struct {
937878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
938878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_exit_sniff_mode_cp;
939878ed226SJulian Elischer /* No return parameter(s) */
940878ed226SJulian Elischer 
941878ed226SJulian Elischer #define NG_HCI_OCF_PARK_MODE			0x0005
942878ed226SJulian Elischer typedef struct {
943878ed226SJulian Elischer 	u_int16_t	con_handle;   /* connection handle */
944878ed226SJulian Elischer 	u_int16_t	max_interval; /* (max_interval * 0.625) msec */
945878ed226SJulian Elischer 	u_int16_t	min_interval; /* (max_interval * 0.625) msec */
946878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_park_mode_cp;
947878ed226SJulian Elischer /* No return parameter(s) */
948878ed226SJulian Elischer 
949878ed226SJulian Elischer #define NG_HCI_OCF_EXIT_PARK_MODE		0x0006
950878ed226SJulian Elischer typedef struct {
951878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
952878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_exit_park_mode_cp;
953878ed226SJulian Elischer /* No return parameter(s) */
954878ed226SJulian Elischer 
955878ed226SJulian Elischer #define NG_HCI_OCF_QOS_SETUP			0x0007
956878ed226SJulian Elischer typedef struct {
957878ed226SJulian Elischer 	u_int16_t	con_handle;      /* connection handle */
958878ed226SJulian Elischer 	u_int8_t	flags;           /* reserved for future use */
959878ed226SJulian Elischer 	u_int8_t	service_type;    /* service type */
960878ed226SJulian Elischer 	u_int32_t	token_rate;      /* bytes per second */
961878ed226SJulian Elischer 	u_int32_t	peak_bandwidth;  /* bytes per second */
962878ed226SJulian Elischer 	u_int32_t	latency;         /* microseconds */
963878ed226SJulian Elischer 	u_int32_t	delay_variation; /* microseconds */
964878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_qos_setup_cp;
965878ed226SJulian Elischer /* No return parameter(s) */
966878ed226SJulian Elischer 
967878ed226SJulian Elischer #define NG_HCI_OCF_ROLE_DISCOVERY		0x0009
968878ed226SJulian Elischer typedef struct {
969878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
970878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_role_discovery_cp;
971878ed226SJulian Elischer 
972878ed226SJulian Elischer typedef struct {
973878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
974878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
975878ed226SJulian Elischer 	u_int8_t	role;       /* role for the connection handle */
976878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_role_discovery_rp;
977878ed226SJulian Elischer 
978878ed226SJulian Elischer #define NG_HCI_OCF_SWITCH_ROLE			0x000b
979878ed226SJulian Elischer typedef struct {
980878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote address */
981878ed226SJulian Elischer 	u_int8_t	role;   /* new local role */
982878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_switch_role_cp;
983878ed226SJulian Elischer /* No return parameter(s) */
984878ed226SJulian Elischer 
985878ed226SJulian Elischer #define NG_HCI_OCF_READ_LINK_POLICY_SETTINGS	0x000c
986878ed226SJulian Elischer typedef struct {
987878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
988878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_link_policy_settings_cp;
989878ed226SJulian Elischer 
990878ed226SJulian Elischer typedef struct {
991878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
992878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
993878ed226SJulian Elischer 	u_int16_t	settings;   /* link policy settings */
994878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_link_policy_settings_rp;
995878ed226SJulian Elischer 
996878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_LINK_POLICY_SETTINGS	0x000d
997878ed226SJulian Elischer typedef struct {
998878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
999878ed226SJulian Elischer 	u_int16_t	settings;   /* link policy settings */
1000878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_link_policy_settings_cp;
1001878ed226SJulian Elischer 
1002878ed226SJulian Elischer typedef struct {
1003878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1004878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1005878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_link_policy_settings_rp;
1006878ed226SJulian Elischer 
1007878ed226SJulian Elischer /**************************************************************************
1008878ed226SJulian Elischer  **************************************************************************
1009878ed226SJulian Elischer  **   Host controller and baseband commands and return parameters
1010878ed226SJulian Elischer  **************************************************************************
1011878ed226SJulian Elischer  **************************************************************************/
1012878ed226SJulian Elischer 
1013878ed226SJulian Elischer #define NG_HCI_OGF_HC_BASEBAND			0x03 /* OpCode Group Field */
1014878ed226SJulian Elischer 
1015878ed226SJulian Elischer #define NG_HCI_OCF_SET_EVENT_MASK		0x0001
1016878ed226SJulian Elischer typedef struct {
1017878ed226SJulian Elischer 	u_int8_t	event_mask[NG_HCI_EVENT_MASK_SIZE]; /* event_mask */
1018878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_set_event_mask_cp;
1019878ed226SJulian Elischer 
1020878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_set_event_mask_rp;
1021d87b1182STakanori Watanabe #define NG_HCI_EVENT_MASK_DEFAULT 0x1fffffffffff
1022d87b1182STakanori Watanabe #define NG_HCI_EVENT_MASK_LE  0x2000000000000000
1023878ed226SJulian Elischer 
1024878ed226SJulian Elischer #define NG_HCI_OCF_RESET			0x0003
1025878ed226SJulian Elischer /* No command parameter(s) */
1026878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_reset_rp;
1027878ed226SJulian Elischer 
1028878ed226SJulian Elischer #define NG_HCI_OCF_SET_EVENT_FILTER		0x0005
1029878ed226SJulian Elischer typedef struct {
1030878ed226SJulian Elischer 	u_int8_t	filter_type;           /* filter type */
1031878ed226SJulian Elischer 	u_int8_t	filter_condition_type; /* filter condition type */
1032878ed226SJulian Elischer 	u_int8_t	condition[0];          /* conditions - variable size */
1033878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_set_event_filter_cp;
1034878ed226SJulian Elischer 
1035878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_set_event_filter_rp;
1036878ed226SJulian Elischer 
1037878ed226SJulian Elischer #define NG_HCI_OCF_FLUSH			0x0008
1038878ed226SJulian Elischer typedef struct {
1039878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1040878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_flush_cp;
1041878ed226SJulian Elischer 
1042878ed226SJulian Elischer typedef struct {
1043878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1044878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1045878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_flush_rp;
1046878ed226SJulian Elischer 
1047878ed226SJulian Elischer #define NG_HCI_OCF_READ_PIN_TYPE		0x0009
1048878ed226SJulian Elischer /* No command parameter(s) */
1049878ed226SJulian Elischer typedef struct {
1050878ed226SJulian Elischer 	u_int8_t	status;   /* 0x00 - success */
1051878ed226SJulian Elischer 	u_int8_t	pin_type; /* PIN type */
1052878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_pin_type_rp;
1053878ed226SJulian Elischer 
1054878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_PIN_TYPE		0x000a
1055878ed226SJulian Elischer typedef struct {
1056878ed226SJulian Elischer 	u_int8_t	pin_type; /* PIN type */
1057878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_pin_type_cp;
1058878ed226SJulian Elischer 
1059878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_pin_type_rp;
1060878ed226SJulian Elischer 
1061878ed226SJulian Elischer #define NG_HCI_OCF_CREATE_NEW_UNIT_KEY		0x000b
1062878ed226SJulian Elischer /* No command parameter(s) */
1063878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_create_new_unit_key_rp;
1064878ed226SJulian Elischer 
1065878ed226SJulian Elischer #define NG_HCI_OCF_READ_STORED_LINK_KEY		0x000d
1066878ed226SJulian Elischer typedef struct {
1067878ed226SJulian Elischer 	bdaddr_t	bdaddr;   /* address */
1068878ed226SJulian Elischer 	u_int8_t	read_all; /* read all keys? 0x01 - yes */
1069878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_stored_link_key_cp;
1070878ed226SJulian Elischer 
1071878ed226SJulian Elischer typedef struct {
1072878ed226SJulian Elischer 	u_int8_t	status;        /* 0x00 - success */
1073878ed226SJulian Elischer 	u_int16_t	max_num_keys;  /* Max. number of keys */
1074878ed226SJulian Elischer 	u_int16_t	num_keys_read; /* Number of stored keys */
1075878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_stored_link_key_rp;
1076878ed226SJulian Elischer 
1077878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_STORED_LINK_KEY	0x0011
1078878ed226SJulian Elischer typedef struct {
1079878ed226SJulian Elischer 	u_int8_t	num_keys_write; /* # of keys to write */
1080878ed226SJulian Elischer /* these are repeated "num_keys_write" times
1081878ed226SJulian Elischer 	bdaddr_t	bdaddr;                --- remote address(es)
1082878ed226SJulian Elischer 	u_int8_t	key[NG_HCI_KEY_SIZE];  --- key(s) */
1083878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_stored_link_key_cp;
1084878ed226SJulian Elischer 
1085878ed226SJulian Elischer typedef struct {
1086878ed226SJulian Elischer 	u_int8_t	status;           /* 0x00 - success */
1087878ed226SJulian Elischer 	u_int8_t	num_keys_written; /* # of keys successfully written */
1088878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_stored_link_key_rp;
1089878ed226SJulian Elischer 
1090878ed226SJulian Elischer #define NG_HCI_OCF_DELETE_STORED_LINK_KEY	0x0012
1091878ed226SJulian Elischer typedef struct {
1092878ed226SJulian Elischer 	bdaddr_t	bdaddr;     /* address */
1093878ed226SJulian Elischer 	u_int8_t	delete_all; /* delete all keys? 0x01 - yes */
1094878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_delete_stored_link_key_cp;
1095878ed226SJulian Elischer 
1096878ed226SJulian Elischer typedef struct {
1097878ed226SJulian Elischer 	u_int8_t	status;           /* 0x00 - success */
1098878ed226SJulian Elischer 	u_int16_t	num_keys_deleted; /* Number of keys deleted */
1099878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_delete_stored_link_key_rp;
1100878ed226SJulian Elischer 
1101878ed226SJulian Elischer #define NG_HCI_OCF_CHANGE_LOCAL_NAME		0x0013
1102878ed226SJulian Elischer typedef struct {
1103878ed226SJulian Elischer 	char		name[NG_HCI_UNIT_NAME_SIZE]; /* new unit name */
1104878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_change_local_name_cp;
1105878ed226SJulian Elischer 
1106878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_change_local_name_rp;
1107878ed226SJulian Elischer 
1108878ed226SJulian Elischer #define NG_HCI_OCF_READ_LOCAL_NAME		0x0014
1109878ed226SJulian Elischer /* No command parameter(s) */
1110878ed226SJulian Elischer typedef struct {
1111878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1112878ed226SJulian Elischer 	char		name[NG_HCI_UNIT_NAME_SIZE]; /* unit name */
1113878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_local_name_rp;
1114878ed226SJulian Elischer 
1115878ed226SJulian Elischer #define NG_HCI_OCF_READ_CON_ACCEPT_TIMO		0x0015
1116878ed226SJulian Elischer /* No command parameter(s) */
1117878ed226SJulian Elischer typedef struct {
1118878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1119878ed226SJulian Elischer 	u_int16_t	timeout; /* (timeout * 0.625) msec */
1120878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_con_accept_timo_rp;
1121878ed226SJulian Elischer 
1122878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO	0x0016
1123878ed226SJulian Elischer typedef struct {
1124878ed226SJulian Elischer 	u_int16_t	timeout; /* (timeout * 0.625) msec */
1125878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_con_accept_timo_cp;
1126878ed226SJulian Elischer 
1127878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_con_accept_timo_rp;
1128878ed226SJulian Elischer 
1129878ed226SJulian Elischer #define NG_HCI_OCF_READ_PAGE_TIMO		0x0017
1130878ed226SJulian Elischer /* No command parameter(s) */
1131878ed226SJulian Elischer typedef struct {
1132878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1133878ed226SJulian Elischer 	u_int16_t	timeout; /* (timeout * 0.625) msec */
1134878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_page_timo_rp;
1135878ed226SJulian Elischer 
1136878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_PAGE_TIMO		0x0018
1137878ed226SJulian Elischer typedef struct {
1138878ed226SJulian Elischer 	u_int16_t	timeout; /* (timeout * 0.625) msec */
1139878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_page_timo_cp;
1140878ed226SJulian Elischer 
1141878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_page_timo_rp;
1142878ed226SJulian Elischer 
1143878ed226SJulian Elischer #define NG_HCI_OCF_READ_SCAN_ENABLE		0x0019
1144878ed226SJulian Elischer /* No command parameter(s) */
1145878ed226SJulian Elischer typedef struct {
1146878ed226SJulian Elischer 	u_int8_t	status;      /* 0x00 - success */
1147878ed226SJulian Elischer 	u_int8_t	scan_enable; /* Scan enable */
1148878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_scan_enable_rp;
1149878ed226SJulian Elischer 
1150878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_SCAN_ENABLE		0x001a
1151878ed226SJulian Elischer typedef struct {
1152878ed226SJulian Elischer 	u_int8_t	scan_enable; /* Scan enable */
1153878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_scan_enable_cp;
1154878ed226SJulian Elischer 
1155878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_scan_enable_rp;
1156878ed226SJulian Elischer 
1157878ed226SJulian Elischer #define NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY	0x001b
1158878ed226SJulian Elischer /* No command parameter(s) */
1159878ed226SJulian Elischer typedef struct {
1160878ed226SJulian Elischer 	u_int8_t	status;             /* 0x00 - success */
1161878ed226SJulian Elischer 	u_int16_t	page_scan_interval; /* interval * 0.625 msec */
1162878ed226SJulian Elischer 	u_int16_t	page_scan_window;   /* window * 0.625 msec */
1163878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_page_scan_activity_rp;
1164878ed226SJulian Elischer 
1165878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY	0x001c
1166878ed226SJulian Elischer typedef struct {
1167878ed226SJulian Elischer 	u_int16_t	page_scan_interval; /* interval * 0.625 msec */
1168878ed226SJulian Elischer 	u_int16_t	page_scan_window;   /* window * 0.625 msec */
1169878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_page_scan_activity_cp;
1170878ed226SJulian Elischer 
1171878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_page_scan_activity_rp;
1172878ed226SJulian Elischer 
1173878ed226SJulian Elischer #define NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY	0x001d
1174878ed226SJulian Elischer /* No command parameter(s) */
1175878ed226SJulian Elischer typedef struct {
1176878ed226SJulian Elischer 	u_int8_t	status;                /* 0x00 - success */
1177878ed226SJulian Elischer 	u_int16_t	inquiry_scan_interval; /* interval * 0.625 msec */
1178878ed226SJulian Elischer 	u_int16_t	inquiry_scan_window;   /* window * 0.625 msec */
1179878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_inquiry_scan_activity_rp;
1180878ed226SJulian Elischer 
1181878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY	0x001e
1182878ed226SJulian Elischer typedef struct {
1183878ed226SJulian Elischer 	u_int16_t	inquiry_scan_interval; /* interval * 0.625 msec */
1184878ed226SJulian Elischer 	u_int16_t	inquiry_scan_window;   /* window * 0.625 msec */
1185878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_inquiry_scan_activity_cp;
1186878ed226SJulian Elischer 
1187878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_inquiry_scan_activity_rp;
1188878ed226SJulian Elischer 
1189878ed226SJulian Elischer #define NG_HCI_OCF_READ_AUTH_ENABLE		0x001f
1190878ed226SJulian Elischer /* No command parameter(s) */
1191878ed226SJulian Elischer typedef struct {
1192878ed226SJulian Elischer 	u_int8_t	status;      /* 0x00 - success */
1193878ed226SJulian Elischer 	u_int8_t	auth_enable; /* 0x01 - enabled */
1194878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_auth_enable_rp;
1195878ed226SJulian Elischer 
1196878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_AUTH_ENABLE		0x0020
1197878ed226SJulian Elischer typedef struct {
1198878ed226SJulian Elischer 	u_int8_t	auth_enable; /* 0x01 - enabled */
1199878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_auth_enable_cp;
1200878ed226SJulian Elischer 
1201878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_auth_enable_rp;
1202878ed226SJulian Elischer 
1203878ed226SJulian Elischer #define NG_HCI_OCF_READ_ENCRYPTION_MODE		0x0021
1204878ed226SJulian Elischer /* No command parameter(s) */
1205878ed226SJulian Elischer typedef struct {
1206878ed226SJulian Elischer 	u_int8_t	status;          /* 0x00 - success */
1207878ed226SJulian Elischer 	u_int8_t	encryption_mode; /* encryption mode */
1208878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_encryption_mode_rp;
1209878ed226SJulian Elischer 
1210878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_ENCRYPTION_MODE	0x0022
1211878ed226SJulian Elischer typedef struct {
1212878ed226SJulian Elischer 	u_int8_t	encryption_mode; /* encryption mode */
1213878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_encryption_mode_cp;
1214878ed226SJulian Elischer 
1215878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_encryption_mode_rp;
1216878ed226SJulian Elischer 
1217878ed226SJulian Elischer #define NG_HCI_OCF_READ_UNIT_CLASS		0x0023
1218878ed226SJulian Elischer /* No command parameter(s) */
1219878ed226SJulian Elischer typedef struct {
1220878ed226SJulian Elischer 	u_int8_t	status;                    /* 0x00 - success */
1221878ed226SJulian Elischer 	u_int8_t	uclass[NG_HCI_CLASS_SIZE]; /* unit class */
1222878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_unit_class_rp;
1223878ed226SJulian Elischer 
1224878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_UNIT_CLASS		0x0024
1225878ed226SJulian Elischer typedef struct {
1226878ed226SJulian Elischer 	u_int8_t	uclass[NG_HCI_CLASS_SIZE]; /* unit class */
1227878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_unit_class_cp;
1228878ed226SJulian Elischer 
1229878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_unit_class_rp;
1230878ed226SJulian Elischer 
1231878ed226SJulian Elischer #define NG_HCI_OCF_READ_VOICE_SETTINGS		0x0025
1232878ed226SJulian Elischer /* No command parameter(s) */
1233878ed226SJulian Elischer typedef struct {
1234878ed226SJulian Elischer 	u_int8_t	status;   /* 0x00 - success */
1235878ed226SJulian Elischer 	u_int16_t	settings; /* voice settings */
1236878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_voice_settings_rp;
1237878ed226SJulian Elischer 
1238878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_VOICE_SETTINGS		0x0026
1239878ed226SJulian Elischer typedef struct {
1240878ed226SJulian Elischer 	u_int16_t	settings; /* voice settings */
1241878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_voice_settings_cp;
1242878ed226SJulian Elischer 
1243878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_voice_settings_rp;
1244878ed226SJulian Elischer 
1245878ed226SJulian Elischer #define NG_HCI_OCF_READ_AUTO_FLUSH_TIMO		0x0027
1246878ed226SJulian Elischer typedef struct {
1247878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1248878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_cp;
1249878ed226SJulian Elischer 
1250878ed226SJulian Elischer typedef struct {
1251878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1252878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1253878ed226SJulian Elischer 	u_int16_t	timeout;    /* 0x00 - no flush, timeout * 0.625 msec */
1254878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_rp;
1255878ed226SJulian Elischer 
1256878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_AUTO_FLUSH_TIMO	0x0028
1257878ed226SJulian Elischer typedef struct {
1258878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1259878ed226SJulian Elischer 	u_int16_t	timeout;    /* 0x00 - no flush, timeout * 0.625 msec */
1260878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_cp;
1261878ed226SJulian Elischer 
1262878ed226SJulian Elischer typedef struct {
1263878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1264878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1265878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_rp;
1266878ed226SJulian Elischer 
1267878ed226SJulian Elischer #define NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS	0x0029
1268878ed226SJulian Elischer /* No command parameter(s) */
1269878ed226SJulian Elischer typedef struct {
1270878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1271878ed226SJulian Elischer 	u_int8_t	counter; /* number of broadcast retransmissions */
1272878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_num_broadcast_retrans_rp;
1273878ed226SJulian Elischer 
1274878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS	0x002a
1275878ed226SJulian Elischer typedef struct {
1276878ed226SJulian Elischer 	u_int8_t	counter; /* number of broadcast retransmissions */
1277878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_num_broadcast_retrans_cp;
1278878ed226SJulian Elischer 
1279878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_num_broadcast_retrans_rp;
1280878ed226SJulian Elischer 
1281878ed226SJulian Elischer #define NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY	0x002b
1282878ed226SJulian Elischer /* No command parameter(s) */
1283878ed226SJulian Elischer typedef struct {
1284878ed226SJulian Elischer 	u_int8_t	status;             /* 0x00 - success */
1285878ed226SJulian Elischer 	u_int8_t	hold_mode_activity; /* Hold mode activities */
1286878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_hold_mode_activity_rp;
1287878ed226SJulian Elischer 
1288878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY	0x002c
1289878ed226SJulian Elischer typedef struct {
1290878ed226SJulian Elischer 	u_int8_t	hold_mode_activity; /* Hold mode activities */
1291878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_hold_mode_activity_cp;
1292878ed226SJulian Elischer 
1293878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_hold_mode_activity_rp;
1294878ed226SJulian Elischer 
1295878ed226SJulian Elischer #define NG_HCI_OCF_READ_XMIT_LEVEL		0x002d
1296878ed226SJulian Elischer typedef struct {
1297878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1298878ed226SJulian Elischer 	u_int8_t	type;       /* Xmit level type */
1299878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_xmit_level_cp;
1300878ed226SJulian Elischer 
1301878ed226SJulian Elischer typedef struct {
1302878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1303878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1304878ed226SJulian Elischer 	char		level;      /* -30 <= level <= 30 dBm */
1305878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_xmit_level_rp;
1306878ed226SJulian Elischer 
1307878ed226SJulian Elischer #define NG_HCI_OCF_READ_SCO_FLOW_CONTROL	0x002e
1308878ed226SJulian Elischer /* No command parameter(s) */
1309878ed226SJulian Elischer typedef struct {
1310878ed226SJulian Elischer 	u_int8_t	status;       /* 0x00 - success */
1311878ed226SJulian Elischer 	u_int8_t	flow_control; /* 0x00 - disabled */
1312878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_sco_flow_control_rp;
1313878ed226SJulian Elischer 
1314878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL	0x002f
1315878ed226SJulian Elischer typedef struct {
1316878ed226SJulian Elischer 	u_int8_t	flow_control; /* 0x00 - disabled */
1317878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_sco_flow_control_cp;
1318878ed226SJulian Elischer 
1319878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_sco_flow_control_rp;
1320878ed226SJulian Elischer 
1321878ed226SJulian Elischer #define NG_HCI_OCF_H2HC_FLOW_CONTROL		0x0031
1322878ed226SJulian Elischer typedef struct {
1323878ed226SJulian Elischer 	u_int8_t	h2hc_flow; /* Host to Host controller flow control */
1324878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_h2hc_flow_control_cp;
1325878ed226SJulian Elischer 
1326878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_h2hc_flow_control_rp;
1327878ed226SJulian Elischer 
1328878ed226SJulian Elischer #define NG_HCI_OCF_HOST_BUFFER_SIZE		0x0033
1329878ed226SJulian Elischer typedef struct {
1330878ed226SJulian Elischer 	u_int16_t	max_acl_size; /* Max. size of ACL packet (bytes) */
1331878ed226SJulian Elischer 	u_int8_t	max_sco_size; /* Max. size of SCO packet (bytes) */
1332878ed226SJulian Elischer 	u_int16_t	num_acl_pkt;  /* Max. number of ACL packets */
1333878ed226SJulian Elischer 	u_int16_t	num_sco_pkt;  /* Max. number of SCO packets */
1334878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_host_buffer_size_cp;
1335878ed226SJulian Elischer 
1336878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_host_buffer_size_rp;
1337878ed226SJulian Elischer 
1338878ed226SJulian Elischer #define NG_HCI_OCF_HOST_NUM_COMPL_PKTS		0x0035
1339878ed226SJulian Elischer typedef struct {
1340878ed226SJulian Elischer 	u_int8_t	num_con_handles; /* # of connection handles */
1341878ed226SJulian Elischer /* these are repeated "num_con_handles" times
1342878ed226SJulian Elischer 	u_int16_t	con_handle; --- connection handle(s)
1343878ed226SJulian Elischer 	u_int16_t	compl_pkt;  --- # of completed packets */
1344878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_host_num_compl_pkts_cp;
1345878ed226SJulian Elischer /* No return parameter(s) */
1346878ed226SJulian Elischer 
1347878ed226SJulian Elischer #define NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO	0x0036
1348878ed226SJulian Elischer typedef struct {
1349878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1350878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_cp;
1351878ed226SJulian Elischer 
1352878ed226SJulian Elischer typedef struct {
1353878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1354878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1355878ed226SJulian Elischer 	u_int16_t	timeout;    /* Link supervision timeout * 0.625 msec */
1356878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_rp;
1357878ed226SJulian Elischer 
1358878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO	0x0037
1359878ed226SJulian Elischer typedef struct {
1360878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1361878ed226SJulian Elischer 	u_int16_t	timeout;    /* Link supervision timeout * 0.625 msec */
1362878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_cp;
1363878ed226SJulian Elischer 
1364878ed226SJulian Elischer typedef struct {
1365878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1366878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1367878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_rp;
1368878ed226SJulian Elischer 
1369878ed226SJulian Elischer #define NG_HCI_OCF_READ_SUPPORTED_IAC_NUM	0x0038
1370878ed226SJulian Elischer /* No command parameter(s) */
1371878ed226SJulian Elischer typedef struct {
1372878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1373878ed226SJulian Elischer 	u_int8_t	num_iac; /* # of supported IAC during scan */
1374878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_supported_iac_num_rp;
1375878ed226SJulian Elischer 
1376878ed226SJulian Elischer #define NG_HCI_OCF_READ_IAC_LAP			0x0039
1377878ed226SJulian Elischer /* No command parameter(s) */
1378878ed226SJulian Elischer typedef struct {
1379878ed226SJulian Elischer 	u_int8_t	status;  /* 0x00 - success */
1380878ed226SJulian Elischer 	u_int8_t	num_iac; /* # of IAC */
1381878ed226SJulian Elischer /* these are repeated "num_iac" times
1382878ed226SJulian Elischer 	u_int8_t	laps[NG_HCI_LAP_SIZE]; --- LAPs */
1383878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_iac_lap_rp;
1384878ed226SJulian Elischer 
1385878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_IAC_LAP		0x003a
1386878ed226SJulian Elischer typedef struct {
1387878ed226SJulian Elischer 	u_int8_t	num_iac; /* # of IAC */
1388878ed226SJulian Elischer /* these are repeated "num_iac" times
1389878ed226SJulian Elischer 	u_int8_t	laps[NG_HCI_LAP_SIZE]; --- LAPs */
1390878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_iac_lap_cp;
1391878ed226SJulian Elischer 
1392878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_iac_lap_rp;
1393878ed226SJulian Elischer 
1394fbc48c2bSTakanori Watanabe /*0x003b-0x003e commands are depricated v2.0 or later*/
1395878ed226SJulian Elischer #define NG_HCI_OCF_READ_PAGE_SCAN_PERIOD	0x003b
1396878ed226SJulian Elischer /* No command parameter(s) */
1397878ed226SJulian Elischer typedef struct {
1398878ed226SJulian Elischer 	u_int8_t	status;                /* 0x00 - success */
1399878ed226SJulian Elischer 	u_int8_t	page_scan_period_mode; /* Page scan period mode */
1400878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_page_scan_period_rp;
1401878ed226SJulian Elischer 
1402878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD	0x003c
1403878ed226SJulian Elischer typedef struct {
1404878ed226SJulian Elischer 	u_int8_t	page_scan_period_mode; /* Page scan period mode */
1405878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_page_scan_period_cp;
1406878ed226SJulian Elischer 
1407878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_page_scan_period_rp;
1408878ed226SJulian Elischer 
1409878ed226SJulian Elischer #define NG_HCI_OCF_READ_PAGE_SCAN		0x003d
1410878ed226SJulian Elischer /* No command parameter(s) */
1411878ed226SJulian Elischer typedef struct {
1412878ed226SJulian Elischer 	u_int8_t	status;         /* 0x00 - success */
1413878ed226SJulian Elischer 	u_int8_t	page_scan_mode; /* Page scan mode */
1414878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_page_scan_rp;
1415878ed226SJulian Elischer 
1416878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_PAGE_SCAN		0x003e
1417878ed226SJulian Elischer typedef struct {
1418878ed226SJulian Elischer 	u_int8_t	page_scan_mode; /* Page scan mode */
1419878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_page_scan_cp;
1420878ed226SJulian Elischer 
1421878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_page_scan_rp;
1422878ed226SJulian Elischer 
1423*4ae0fa8aSAndreas Kempe #define	NG_HCI_OCF_WRITE_SIMPLE_PAIRING		0x0056
1424*4ae0fa8aSAndreas Kempe typedef struct {
1425*4ae0fa8aSAndreas Kempe 	u_int8_t simple_pairing; /* 1 -> enabled, 0 -> disabled */
1426*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_write_simple_pairing_cp;
1427*4ae0fa8aSAndreas Kempe 
1428*4ae0fa8aSAndreas Kempe typedef ng_hci_status_rp	ng_hci_write_simple_pairing_rp;
1429*4ae0fa8aSAndreas Kempe 
1430fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_READ_LE_HOST_SUPPORTED  0x6c
1431fbc48c2bSTakanori Watanabe typedef struct {
1432fbc48c2bSTakanori Watanabe 	u_int8_t	status;         /* 0x00 - success */
1433fbc48c2bSTakanori Watanabe 	u_int8_t	le_supported_host ;/* LE host supported?*/
1434fbc48c2bSTakanori Watanabe 	u_int8_t	simultaneous_le_host; /* BR/LE simulateneous? */
1435fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_read_le_host_supported_rp;
1436fbc48c2bSTakanori Watanabe 
1437fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED  0x6d
1438fbc48c2bSTakanori Watanabe typedef struct {
1439fbc48c2bSTakanori Watanabe 	u_int8_t	le_supported_host; /* LE host supported?*/
1440fbc48c2bSTakanori Watanabe 	u_int8_t	simultaneous_le_host; /* LE host supported?*/
1441fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_write_le_host_supported_cp;
1442fbc48c2bSTakanori Watanabe 
1443fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_write_le_host_supported_rp;
1444fbc48c2bSTakanori Watanabe 
1445*4ae0fa8aSAndreas Kempe #define	NG_HCI_OCF_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT	0x007a
1446*4ae0fa8aSAndreas Kempe typedef struct {
1447*4ae0fa8aSAndreas Kempe 	u_int8_t support; /* 0 - disabled, 1 - enabled */
1448*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_write_secure_connections_host_support_cp;
1449*4ae0fa8aSAndreas Kempe 
1450*4ae0fa8aSAndreas Kempe typedef ng_hci_status_rp ng_hci_write_secure_connections_host_support_rp;
1451*4ae0fa8aSAndreas Kempe 
1452878ed226SJulian Elischer /**************************************************************************
1453878ed226SJulian Elischer  **************************************************************************
1454878ed226SJulian Elischer  **           Informational commands and return parameters
1455878ed226SJulian Elischer  **     All commands in this category do not accept any parameters
1456878ed226SJulian Elischer  **************************************************************************
1457878ed226SJulian Elischer  **************************************************************************/
1458878ed226SJulian Elischer 
1459878ed226SJulian Elischer #define NG_HCI_OGF_INFO				0x04 /* OpCode Group Field */
1460878ed226SJulian Elischer 
1461878ed226SJulian Elischer #define NG_HCI_OCF_READ_LOCAL_VER		0x0001
1462878ed226SJulian Elischer typedef struct {
1463878ed226SJulian Elischer 	u_int8_t	status;         /* 0x00 - success */
1464878ed226SJulian Elischer 	u_int8_t	hci_version;    /* HCI version */
1465878ed226SJulian Elischer 	u_int16_t	hci_revision;   /* HCI revision */
1466878ed226SJulian Elischer 	u_int8_t	lmp_version;    /* LMP version */
1467878ed226SJulian Elischer 	u_int16_t	manufacturer;   /* Hardware manufacturer name */
1468878ed226SJulian Elischer 	u_int16_t	lmp_subversion; /* LMP sub-version */
1469878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_local_ver_rp;
1470878ed226SJulian Elischer 
1471fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_READ_LOCAL_COMMANDS		0x0002
1472fbc48c2bSTakanori Watanabe typedef struct {
1473fbc48c2bSTakanori Watanabe 	u_int8_t	status;                         /* 0x00 - success */
1474fbc48c2bSTakanori Watanabe 	u_int8_t	features[NG_HCI_COMMANDS_SIZE]; /* command bitmsk*/
1475fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_read_local_commands_rp;
1476fbc48c2bSTakanori Watanabe 
1477878ed226SJulian Elischer #define NG_HCI_OCF_READ_LOCAL_FEATURES		0x0003
1478878ed226SJulian Elischer typedef struct {
1479878ed226SJulian Elischer 	u_int8_t	status;                         /* 0x00 - success */
1480878ed226SJulian Elischer 	u_int8_t	features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1481878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_local_features_rp;
1482878ed226SJulian Elischer 
1483878ed226SJulian Elischer #define NG_HCI_OCF_READ_BUFFER_SIZE		0x0005
1484878ed226SJulian Elischer typedef struct {
1485878ed226SJulian Elischer 	u_int8_t	status;       /* 0x00 - success */
1486878ed226SJulian Elischer 	u_int16_t	max_acl_size; /* Max. size of ACL packet (bytes) */
1487878ed226SJulian Elischer 	u_int8_t	max_sco_size; /* Max. size of SCO packet (bytes) */
1488878ed226SJulian Elischer 	u_int16_t	num_acl_pkt;  /* Max. number of ACL packets */
1489878ed226SJulian Elischer 	u_int16_t	num_sco_pkt;  /* Max. number of SCO packets */
1490878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_buffer_size_rp;
1491878ed226SJulian Elischer 
1492878ed226SJulian Elischer #define NG_HCI_OCF_READ_COUNTRY_CODE		0x0007
1493878ed226SJulian Elischer typedef struct {
1494878ed226SJulian Elischer 	u_int8_t	status;       /* 0x00 - success */
1495878ed226SJulian Elischer 	u_int8_t	country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */
1496878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_country_code_rp;
1497878ed226SJulian Elischer 
1498878ed226SJulian Elischer #define NG_HCI_OCF_READ_BDADDR			0x0009
1499878ed226SJulian Elischer typedef struct {
1500878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
1501878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* unit address */
1502878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_bdaddr_rp;
1503878ed226SJulian Elischer 
1504878ed226SJulian Elischer /**************************************************************************
1505878ed226SJulian Elischer  **************************************************************************
1506878ed226SJulian Elischer  **            Status commands and return parameters
1507878ed226SJulian Elischer  **************************************************************************
1508878ed226SJulian Elischer  **************************************************************************/
1509878ed226SJulian Elischer 
1510878ed226SJulian Elischer #define NG_HCI_OGF_STATUS			0x05 /* OpCode Group Field */
1511878ed226SJulian Elischer 
1512878ed226SJulian Elischer #define NG_HCI_OCF_READ_FAILED_CONTACT_CNTR	0x0001
1513878ed226SJulian Elischer typedef struct {
1514878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1515878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_cp;
1516878ed226SJulian Elischer 
1517878ed226SJulian Elischer typedef struct {
1518878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1519878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1520878ed226SJulian Elischer 	u_int16_t	counter;    /* number of consecutive failed contacts */
1521878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_rp;
1522878ed226SJulian Elischer 
1523878ed226SJulian Elischer #define NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR	0x0002
1524878ed226SJulian Elischer typedef struct {
1525878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1526878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_cp;
1527878ed226SJulian Elischer 
1528878ed226SJulian Elischer typedef struct {
1529878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1530878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1531878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_rp;
1532878ed226SJulian Elischer 
1533878ed226SJulian Elischer #define NG_HCI_OCF_GET_LINK_QUALITY		0x0003
1534878ed226SJulian Elischer typedef struct {
1535878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1536878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_get_link_quality_cp;
1537878ed226SJulian Elischer 
1538878ed226SJulian Elischer typedef struct {
1539878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1540878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1541878ed226SJulian Elischer 	u_int8_t	quality;    /* higher value means better quality */
1542878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_get_link_quality_rp;
1543878ed226SJulian Elischer 
1544878ed226SJulian Elischer #define NG_HCI_OCF_READ_RSSI			0x0005
1545878ed226SJulian Elischer typedef struct {
1546878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1547878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_rssi_cp;
1548878ed226SJulian Elischer 
1549878ed226SJulian Elischer typedef struct {
1550878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1551878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1552878ed226SJulian Elischer 	char		rssi;       /* -127 <= rssi <= 127 dB */
1553878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_rssi_rp;
1554878ed226SJulian Elischer 
1555878ed226SJulian Elischer /**************************************************************************
1556878ed226SJulian Elischer  **************************************************************************
1557878ed226SJulian Elischer  **             Testing commands and return parameters
1558878ed226SJulian Elischer  **************************************************************************
1559878ed226SJulian Elischer  **************************************************************************/
1560878ed226SJulian Elischer 
1561878ed226SJulian Elischer #define NG_HCI_OGF_TESTING			0x06 /* OpCode Group Field */
1562878ed226SJulian Elischer 
1563878ed226SJulian Elischer #define NG_HCI_OCF_READ_LOOPBACK_MODE		0x0001
1564878ed226SJulian Elischer /* No command parameter(s) */
1565878ed226SJulian Elischer typedef struct {
1566878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
1567878ed226SJulian Elischer 	u_int8_t	lbmode; /* loopback mode */
1568878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_loopback_mode_rp;
1569878ed226SJulian Elischer 
1570878ed226SJulian Elischer #define NG_HCI_OCF_WRITE_LOOPBACK_MODE		0x0002
1571878ed226SJulian Elischer typedef struct {
1572878ed226SJulian Elischer 	u_int8_t	lbmode; /* loopback mode */
1573878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_write_loopback_mode_cp;
1574878ed226SJulian Elischer 
1575878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_write_loopback_mode_rp;
1576878ed226SJulian Elischer 
1577878ed226SJulian Elischer #define NG_HCI_OCF_ENABLE_UNIT_UNDER_TEST	0x0003
1578878ed226SJulian Elischer /* No command parameter(s) */
1579878ed226SJulian Elischer typedef ng_hci_status_rp	ng_hci_enable_unit_under_test_rp;
1580878ed226SJulian Elischer 
1581878ed226SJulian Elischer /**************************************************************************
1582878ed226SJulian Elischer  **************************************************************************
1583fbc48c2bSTakanori Watanabe  **                LE OpCode group field
1584fbc48c2bSTakanori Watanabe  **************************************************************************
1585fbc48c2bSTakanori Watanabe  **************************************************************************/
1586fbc48c2bSTakanori Watanabe 
1587fbc48c2bSTakanori Watanabe #define NG_HCI_OGF_LE			0x08 /* OpCode Group Field */
1588fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_EVENT_MASK			0x0001
1589fbc48c2bSTakanori Watanabe typedef struct {
1590fbc48c2bSTakanori Watanabe 	u_int8_t	event_mask[NG_HCI_LE_EVENT_MASK_SIZE]; /* event_mask*/
1591fbc48c2bSTakanori Watanabe 
1592fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_set_event_mask_cp;
1593fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_event_mask_rp;
1594d87b1182STakanori Watanabe #define NG_HCI_LE_EVENT_MASK_ALL 0x1f
1595fbc48c2bSTakanori Watanabe 
1596fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_BUFFER_SIZE			0x0002
1597fbc48c2bSTakanori Watanabe /*No command parameter */
1598fbc48c2bSTakanori Watanabe typedef struct {
1599fbc48c2bSTakanori Watanabe 	u_int8_t	status; /*status*/
1600fbc48c2bSTakanori Watanabe 	u_int16_t 	hc_le_data_packet_length;
1601fbc48c2bSTakanori Watanabe 	u_int8_t	hc_total_num_le_data_packets;
1602fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp;
1603fbc48c2bSTakanori Watanabe 
1604fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES	0x0003
1605fbc48c2bSTakanori Watanabe /*No command parameter */
1606fbc48c2bSTakanori Watanabe typedef struct {
1607fbc48c2bSTakanori Watanabe 	u_int8_t       	status; /*status*/
1608fbc48c2bSTakanori Watanabe 	u_int64_t 	le_features;
1609fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_local_supported_features_rp;
1610fbc48c2bSTakanori Watanabe 
1611fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_RANDOM_ADDRESS		0x0005
1612fbc48c2bSTakanori Watanabe typedef struct {
1613fbc48c2bSTakanori Watanabe 	bdaddr_t 	random_address;
1614fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_set_random_address_cp_;
1615fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_random_address_rp;
1616fbc48c2bSTakanori Watanabe 
1617fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_ADVERTISING_PARAMETERS	0x0006
1618fbc48c2bSTakanori Watanabe typedef struct {
1619fbc48c2bSTakanori Watanabe 	u_int16_t	advertising_interval_min;
1620fbc48c2bSTakanori Watanabe 	u_int16_t 	advertising_interval_max;
1621fbc48c2bSTakanori Watanabe 	u_int8_t	advertising_type;
1622fbc48c2bSTakanori Watanabe 	u_int8_t 	own_address_type;
1623fbc48c2bSTakanori Watanabe 	u_int8_t 	direct_address_type;
1624fbc48c2bSTakanori Watanabe 	bdaddr_t	direct_address;
1625fbc48c2bSTakanori Watanabe 	u_int8_t	advertising_channel_map;
1626fbc48c2bSTakanori Watanabe 	u_int8_t	advertising_filter_policy;
1627fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_set_advertising_parameters_cp;
1628fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_advertising_parameters_rp;
1629fbc48c2bSTakanori Watanabe 
1630fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER	0x0007
1631fbc48c2bSTakanori Watanabe /*No command parameter*/
1632fbc48c2bSTakanori Watanabe typedef struct {
1633fbc48c2bSTakanori Watanabe 	u_int8_t status;
1634fbc48c2bSTakanori Watanabe 	u_int8_t transmit_power_level;
1635fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_advertising_channel_tx_power_rp;
1636fbc48c2bSTakanori Watanabe 
1637fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_ADVERTISING_DATA		0x0008
1638fbc48c2bSTakanori Watanabe #define NG_HCI_ADVERTISING_DATA_SIZE 31
1639fbc48c2bSTakanori Watanabe typedef struct {
1640fbc48c2bSTakanori Watanabe 	u_int8_t advertising_data_length;
1641fbc48c2bSTakanori Watanabe 	char advertising_data[NG_HCI_ADVERTISING_DATA_SIZE];
1642fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_set_advertising_data_cp;
1643fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_advertising_data_rp;
1644fbc48c2bSTakanori Watanabe 
1645fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA		0x0009
1646fbc48c2bSTakanori Watanabe 
1647fbc48c2bSTakanori Watanabe typedef struct {
1648fbc48c2bSTakanori Watanabe 	u_int8_t scan_response_data_length;
1649fbc48c2bSTakanori Watanabe 	char scan_response_data[NG_HCI_ADVERTISING_DATA_SIZE];
1650fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_set_scan_response_data_cp;
1651fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_scan_response_data_rp;
1652fbc48c2bSTakanori Watanabe 
1653fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_ADVERTISE_ENABLE		0x000a
1654fbc48c2bSTakanori Watanabe typedef struct {
1655fbc48c2bSTakanori Watanabe 	u_int8_t advertising_enable;
1656fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_set_advertise_enable_cp;
1657fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_advertise_enable_rp;
1658fbc48c2bSTakanori Watanabe 
1659fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_SCAN_PARAMETERS		0x000b
1660fbc48c2bSTakanori Watanabe typedef struct {
1661fbc48c2bSTakanori Watanabe 	u_int8_t le_scan_type;
1662fbc48c2bSTakanori Watanabe 	u_int16_t le_scan_interval;
1663fbc48c2bSTakanori Watanabe 	u_int16_t le_scan_window;
1664fbc48c2bSTakanori Watanabe 	u_int8_t own_address_type;
1665fbc48c2bSTakanori Watanabe 	u_int8_t scanning_filter_policy;
1666fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_set_scan_parameters_cp;
1667fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_scan_parameters_rp;
1668fbc48c2bSTakanori Watanabe 
1669fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_SCAN_ENABLE			0x000c
1670fbc48c2bSTakanori Watanabe typedef struct {
1671fbc48c2bSTakanori Watanabe 	u_int8_t le_scan_enable;
1672fbc48c2bSTakanori Watanabe 	u_int8_t filter_duplicates;
1673fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_set_scan_enable_cp;
1674fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_scan_enable_rp;
1675fbc48c2bSTakanori Watanabe 
1676fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_CREATE_CONNECTION			0x000d
1677fbc48c2bSTakanori Watanabe typedef struct {
1678fbc48c2bSTakanori Watanabe 	u_int16_t scan_interval;
1679fbc48c2bSTakanori Watanabe 	u_int16_t scan_window;
1680fbc48c2bSTakanori Watanabe 	u_int8_t filter_policy;
1681fbc48c2bSTakanori Watanabe 	u_int8_t peer_addr_type;
1682fbc48c2bSTakanori Watanabe 	bdaddr_t peer_addr;
1683fbc48c2bSTakanori Watanabe 	u_int8_t own_address_type;
1684fbc48c2bSTakanori Watanabe 	u_int16_t conn_interval_min;
1685fbc48c2bSTakanori Watanabe 	u_int16_t conn_interval_max;
1686fbc48c2bSTakanori Watanabe 	u_int16_t conn_latency;
1687fbc48c2bSTakanori Watanabe 	u_int16_t supervision_timeout;
1688fbc48c2bSTakanori Watanabe 	u_int16_t min_ce_length;
1689fbc48c2bSTakanori Watanabe 	u_int16_t max_ce_length;
1690fbc48c2bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_create_connection_cp;
1691053359b7SPedro F. Giffuni /* No return parameters. */
1692fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL		0x000e
1693fbc48c2bSTakanori Watanabe /*No command parameter*/
1694fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_create_connection_cancel_rp;
1695fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE		0x000f
1696fbc48c2bSTakanori Watanabe /*No command parameter*/
1697fbc48c2bSTakanori Watanabe typedef struct {
1698fbc48c2bSTakanori Watanabe 	u_int8_t status;
1699fbc48c2bSTakanori Watanabe 	u_int8_t white_list_size;
1700fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_white_list_size_rp;
1701fbc48c2bSTakanori Watanabe 
1702fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_CLEAR_WHITE_LIST			0x0010
1703053359b7SPedro F. Giffuni /* No command parameters. */
1704fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_clear_white_list_rp;
1705fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST		0x0011
1706fbc48c2bSTakanori Watanabe typedef struct {
1707fbc48c2bSTakanori Watanabe 	u_int8_t address_type;
1708fbc48c2bSTakanori Watanabe 	bdaddr_t address;
1709fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_add_device_to_white_list_cp;
1710fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_add_device_to_white_list_rp;
1711fbc48c2bSTakanori Watanabe 
1712fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST	0x0012
1713fbc48c2bSTakanori Watanabe typedef struct {
1714fbc48c2bSTakanori Watanabe 	u_int8_t address_type;
1715fbc48c2bSTakanori Watanabe 	bdaddr_t address;
1716fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_remove_device_from_white_list_cp;
1717fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_remove_device_from_white_list_rp;
1718fbc48c2bSTakanori Watanabe 
1719fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_CONNECTION_UPDATE			0x0013
1720fbc48c2bSTakanori Watanabe typedef struct {
1721fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1722fbc48c2bSTakanori Watanabe 	u_int16_t conn_interval_min;
1723fbc48c2bSTakanori Watanabe 	u_int16_t conn_interval_max;
1724fbc48c2bSTakanori Watanabe 	u_int16_t conn_latency;
1725fbc48c2bSTakanori Watanabe 	u_int16_t supervision_timeout;
1726fbc48c2bSTakanori Watanabe 	u_int16_t minimum_ce_length;
1727fbc48c2bSTakanori Watanabe 	u_int16_t maximum_ce_length;
1728fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_connection_update_cp;
1729fbc48c2bSTakanori Watanabe /*no return parameter*/
1730fbc48c2bSTakanori Watanabe 
1731fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION	0x0014
1732fbc48c2bSTakanori Watanabe typedef struct{
1733fbc48c2bSTakanori Watanabe 	u_int8_t le_channel_map[5];
1734fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_set_host_channel_classification_cp;
1735fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_set_host_channel_classification_rp;
1736fbc48c2bSTakanori Watanabe 
1737fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_CHANNEL_MAP			0x0015
1738fbc48c2bSTakanori Watanabe typedef struct {
1739fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1740fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_read_channel_map_cp;
1741fbc48c2bSTakanori Watanabe typedef struct {
1742fbc48c2bSTakanori Watanabe 	u_int8_t status;
1743fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1744fbc48c2bSTakanori Watanabe 	u_int8_t le_channel_map[5];
1745fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_channel_map_rp;
1746fbc48c2bSTakanori Watanabe 
1747fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_READ_REMOTE_USED_FEATURES		0x0016
1748fbc48c2bSTakanori Watanabe typedef struct {
1749fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1750fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_read_remote_used_features_cp;
1751fbc48c2bSTakanori Watanabe /*No return parameter*/
1752fbc48c2bSTakanori Watanabe #define NG_HCI_128BIT 16
1753fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_ENCRYPT				0x0017
1754fbc48c2bSTakanori Watanabe typedef struct {
1755fbc48c2bSTakanori Watanabe 	u_int8_t key[NG_HCI_128BIT];
1756fbc48c2bSTakanori Watanabe 	u_int8_t plaintext_data[NG_HCI_128BIT];
1757fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_encrypt_cp;
1758fbc48c2bSTakanori Watanabe typedef struct {
1759fbc48c2bSTakanori Watanabe 	u_int8_t status;
1760fbc48c2bSTakanori Watanabe 	u_int8_t plaintext_data[NG_HCI_128BIT];
1761fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_encrypt_rp;
1762fbc48c2bSTakanori Watanabe 
1763fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_RAND				0x0018
1764fbc48c2bSTakanori Watanabe /*No command parameter*/
1765fbc48c2bSTakanori Watanabe typedef struct {
1766fbc48c2bSTakanori Watanabe 	u_int8_t status;
1767fbc48c2bSTakanori Watanabe 	u_int64_t random_number;
1768fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_rand_rp;
1769fbc48c2bSTakanori Watanabe 
1770fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_START_ENCRYPTION			0x0019
1771fbc48c2bSTakanori Watanabe typedef struct {
1772fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1773fbc48c2bSTakanori Watanabe 	u_int64_t random_number;
1774fbc48c2bSTakanori Watanabe 	u_int16_t encrypted_diversifier;
1775fbc48c2bSTakanori Watanabe 	u_int8_t long_term_key[NG_HCI_128BIT];
1776fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_start_encryption_cp;
1777fbc48c2bSTakanori Watanabe /*No return parameter*/
1778fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY	0x001a
1779fbc48c2bSTakanori Watanabe typedef struct {
1780fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1781fbc48c2bSTakanori Watanabe 	u_int8_t long_term_key[NG_HCI_128BIT];
1782fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_cp;
1783fbc48c2bSTakanori Watanabe typedef struct {
1784fbc48c2bSTakanori Watanabe 	u_int8_t status;
1785fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1786fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_rp;
1787fbc48c2bSTakanori Watanabe 
1788fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY 0x001b
1789fbc48c2bSTakanori Watanabe typedef struct{
1790fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1791de402d63STakanori Watanabe }__attribute__((packed)) ng_hci_le_long_term_key_request_negative_reply_cp;
1792fbc48c2bSTakanori Watanabe typedef struct {
1793fbc48c2bSTakanori Watanabe 	u_int8_t status;
1794fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
1795fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp;
1796fbc48c2bSTakanori Watanabe 
1797de402d63STakanori Watanabe #define NG_HCI_OCF_LE_READ_SUGGESTED_DATA_LENGTH 	0x0023
1798de402d63STakanori Watanabe /*No command parameter*/
1799de402d63STakanori Watanabe typedef struct {
1800de402d63STakanori Watanabe 	u_int8_t status;
1801de402d63STakanori Watanabe 	u_int16_t suggested_max_tx_octets;
1802de402d63STakanori Watanabe 	u_int16_t suggested_max_tx_time;
1803de402d63STakanori Watanabe }__attribute__ ((packed)) ng_hci_le_read_suggested_data_length_rp;
1804de402d63STakanori Watanabe 
1805de402d63STakanori Watanabe #define NG_HCI_OCF_LE_WRITE_SUGGESTED_DATA_LENGTH 	0x0024
1806de402d63STakanori Watanabe typedef struct {
1807de402d63STakanori Watanabe 	u_int16_t suggested_max_tx_octets;
1808de402d63STakanori Watanabe 	u_int16_t suggested_max_tx_time;
1809de402d63STakanori Watanabe }__attribute__ ((packed)) ng_hci_le_write_suggested_data_length_cp;
1810de402d63STakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_write_suggested_data_length_rp;
1811de402d63STakanori Watanabe 
18121f5d883dSTakanori Watanabe #define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2		0x0060
18131f5d883dSTakanori Watanabe /*No command parameter */
18141f5d883dSTakanori Watanabe typedef struct {
18151f5d883dSTakanori Watanabe 	u_int8_t	status;
18161f5d883dSTakanori Watanabe 	u_int16_t 	hc_le_data_packet_length;
18171f5d883dSTakanori Watanabe 	u_int8_t	hc_total_num_le_data_packets;
18181f5d883dSTakanori Watanabe 	u_int16_t 	hc_iso_data_packet_length;
18191f5d883dSTakanori Watanabe 	u_int8_t	hc_total_num_iso_data_packets;
18201f5d883dSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp_v2;
1821fbc48c2bSTakanori Watanabe 
182221eefd31SHans Petter Selasky #define NG_HCI_OCF_LE_READ_SUPPORTED_STATES		0x001c
1823fbc48c2bSTakanori Watanabe /*No command parameter*/
1824fbc48c2bSTakanori Watanabe typedef struct {
1825fbc48c2bSTakanori Watanabe 	u_int8_t status;
182621eefd31SHans Petter Selasky 	u_int64_t le_states;
182721eefd31SHans Petter Selasky }__attribute__ ((packed)) ng_hci_le_read_supported_states_rp;
1828fbc48c2bSTakanori Watanabe 
1829fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_RECEIVER_TEST			0x001d
1830fbc48c2bSTakanori Watanabe typedef struct{
1831fbc48c2bSTakanori Watanabe 	u_int8_t rx_frequency;
1832fbc48c2bSTakanori Watanabe } __attribute__((packed)) ng_le_receiver_test_cp;
1833fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_receiver_test_rp;
1834fbc48c2bSTakanori Watanabe 
1835fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_TRANSMITTER_TEST			0x001e
1836fbc48c2bSTakanori Watanabe typedef struct{
1837fbc48c2bSTakanori Watanabe 	u_int8_t tx_frequency;
1838fbc48c2bSTakanori Watanabe 	u_int8_t length_of_test_data;
1839fbc48c2bSTakanori Watanabe 	u_int8_t packet_payload;
1840fbc48c2bSTakanori Watanabe } __attribute__((packed)) ng_le_transmitter_test_cp;
1841fbc48c2bSTakanori Watanabe typedef ng_hci_status_rp	ng_hci_le_transmitter_test_rp;
1842fbc48c2bSTakanori Watanabe 
1843fbc48c2bSTakanori Watanabe #define NG_HCI_OCF_LE_TEST_END				0x001f
1844053359b7SPedro F. Giffuni /* No command parameter. */
1845fbc48c2bSTakanori Watanabe typedef struct {
1846fbc48c2bSTakanori Watanabe 	u_int8_t status;
1847fbc48c2bSTakanori Watanabe 	u_int16_t number_of_packets;
1848fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_test_end_rp;
1849fbc48c2bSTakanori Watanabe 
1850fbc48c2bSTakanori Watanabe /**************************************************************************
1851fbc48c2bSTakanori Watanabe  **************************************************************************
1852878ed226SJulian Elischer  **                Special HCI OpCode group field values
1853878ed226SJulian Elischer  **************************************************************************
1854878ed226SJulian Elischer  **************************************************************************/
1855878ed226SJulian Elischer 
1856878ed226SJulian Elischer #define NG_HCI_OGF_BT_LOGO			0x3e
1857878ed226SJulian Elischer 
1858878ed226SJulian Elischer #define NG_HCI_OGF_VENDOR			0x3f
1859878ed226SJulian Elischer 
1860878ed226SJulian Elischer /**************************************************************************
1861878ed226SJulian Elischer  **************************************************************************
1862878ed226SJulian Elischer  **                         Events and event parameters
1863878ed226SJulian Elischer  **************************************************************************
1864878ed226SJulian Elischer  **************************************************************************/
1865878ed226SJulian Elischer 
1866878ed226SJulian Elischer #define NG_HCI_EVENT_INQUIRY_COMPL		0x01
1867878ed226SJulian Elischer typedef struct {
1868878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
1869878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_inquiry_compl_ep;
1870878ed226SJulian Elischer 
1871878ed226SJulian Elischer #define NG_HCI_EVENT_INQUIRY_RESULT		0x02
1872878ed226SJulian Elischer typedef struct {
1873878ed226SJulian Elischer 	u_int8_t	num_responses;      /* number of responses */
1874b25877a3SMaksim Yevmenkin /*	ng_hci_inquiry_response[num_responses]   -- see below */
1875878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_inquiry_result_ep;
1876878ed226SJulian Elischer 
1877b25877a3SMaksim Yevmenkin typedef struct {
1878b25877a3SMaksim Yevmenkin 	bdaddr_t	bdaddr;                   /* unit address */
1879b25877a3SMaksim Yevmenkin 	u_int8_t	page_scan_rep_mode;       /* page scan rep. mode */
1880b25877a3SMaksim Yevmenkin 	u_int8_t	page_scan_period_mode;    /* page scan period mode */
1881b25877a3SMaksim Yevmenkin 	u_int8_t	page_scan_mode;           /* page scan mode */
18826a2dbfa4SMaksim Yevmenkin 	u_int8_t	uclass[NG_HCI_CLASS_SIZE];/* unit class */
1883b25877a3SMaksim Yevmenkin 	u_int16_t	clock_offset;             /* clock offset */
1884b25877a3SMaksim Yevmenkin } __attribute__ ((packed)) ng_hci_inquiry_response;
1885b25877a3SMaksim Yevmenkin 
1886878ed226SJulian Elischer #define NG_HCI_EVENT_CON_COMPL			0x03
1887878ed226SJulian Elischer typedef struct {
1888878ed226SJulian Elischer 	u_int8_t	status;          /* 0x00 - success */
1889878ed226SJulian Elischer 	u_int16_t	con_handle;      /* Connection handle */
1890878ed226SJulian Elischer 	bdaddr_t	bdaddr;          /* remote unit address */
1891878ed226SJulian Elischer 	u_int8_t	link_type;       /* Link type */
1892878ed226SJulian Elischer 	u_int8_t	encryption_mode; /* Encryption mode */
1893878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_con_compl_ep;
1894878ed226SJulian Elischer 
1895878ed226SJulian Elischer #define NG_HCI_EVENT_CON_REQ			0x04
1896878ed226SJulian Elischer typedef struct {
1897878ed226SJulian Elischer 	bdaddr_t	bdaddr;                    /* remote unit address */
1898878ed226SJulian Elischer 	u_int8_t	uclass[NG_HCI_CLASS_SIZE]; /* remote unit class */
1899878ed226SJulian Elischer 	u_int8_t	link_type;                 /* link type */
1900878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_con_req_ep;
1901878ed226SJulian Elischer 
1902878ed226SJulian Elischer #define NG_HCI_EVENT_DISCON_COMPL		0x05
1903878ed226SJulian Elischer typedef struct {
1904878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1905878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1906878ed226SJulian Elischer 	u_int8_t	reason;     /* reason to disconnect */
1907878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_discon_compl_ep;
1908878ed226SJulian Elischer 
1909878ed226SJulian Elischer #define NG_HCI_EVENT_AUTH_COMPL			0x06
1910878ed226SJulian Elischer typedef struct {
1911878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1912878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1913878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_auth_compl_ep;
1914878ed226SJulian Elischer 
1915878ed226SJulian Elischer #define NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL	0x7
1916878ed226SJulian Elischer typedef struct {
1917878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
1918878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote unit address */
1919878ed226SJulian Elischer 	char		name[NG_HCI_UNIT_NAME_SIZE]; /* remote unit name */
1920878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_remote_name_req_compl_ep;
1921878ed226SJulian Elischer 
1922878ed226SJulian Elischer #define NG_HCI_EVENT_ENCRYPTION_CHANGE		0x08
1923878ed226SJulian Elischer typedef struct {
1924878ed226SJulian Elischer 	u_int8_t	status;            /* 0x00 - success */
1925878ed226SJulian Elischer 	u_int16_t	con_handle;        /* Connection handle */
1926878ed226SJulian Elischer 	u_int8_t	encryption_enable; /* 0x00 - disable */
1927878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_encryption_change_ep;
1928878ed226SJulian Elischer 
1929878ed226SJulian Elischer #define NG_HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL	0x09
1930878ed226SJulian Elischer typedef struct {
1931878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1932878ed226SJulian Elischer 	u_int16_t	con_handle; /* Connection handle */
1933878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_change_con_link_key_compl_ep;
1934878ed226SJulian Elischer 
1935878ed226SJulian Elischer #define NG_HCI_EVENT_MASTER_LINK_KEY_COMPL	0x0a
1936878ed226SJulian Elischer typedef struct {
1937878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
1938878ed226SJulian Elischer 	u_int16_t	con_handle; /* Connection handle */
1939878ed226SJulian Elischer 	u_int8_t	key_flag;   /* Key flag */
1940878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_master_link_key_compl_ep;
1941878ed226SJulian Elischer 
1942878ed226SJulian Elischer #define NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL	0x0b
1943878ed226SJulian Elischer typedef struct {
1944878ed226SJulian Elischer 	u_int8_t	status;                         /* 0x00 - success */
1945878ed226SJulian Elischer 	u_int16_t	con_handle;                     /* Connection handle */
1946878ed226SJulian Elischer 	u_int8_t	features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1947878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_remote_features_compl_ep;
1948878ed226SJulian Elischer 
1949878ed226SJulian Elischer #define NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL	0x0c
1950878ed226SJulian Elischer typedef struct {
1951878ed226SJulian Elischer 	u_int8_t	status;         /* 0x00 - success */
1952878ed226SJulian Elischer 	u_int16_t	con_handle;     /* Connection handle */
1953878ed226SJulian Elischer 	u_int8_t	lmp_version;    /* LMP version */
1954878ed226SJulian Elischer 	u_int16_t	manufacturer;   /* Hardware manufacturer name */
1955878ed226SJulian Elischer 	u_int16_t	lmp_subversion; /* LMP sub-version */
1956878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_remote_ver_info_compl_ep;
1957878ed226SJulian Elischer 
1958878ed226SJulian Elischer #define NG_HCI_EVENT_QOS_SETUP_COMPL		0x0d
1959878ed226SJulian Elischer typedef struct {
1960878ed226SJulian Elischer 	u_int8_t	status;          /* 0x00 - success */
1961878ed226SJulian Elischer 	u_int16_t	con_handle;      /* connection handle */
1962878ed226SJulian Elischer 	u_int8_t	flags;           /* reserved for future use */
1963878ed226SJulian Elischer 	u_int8_t	service_type;    /* service type */
1964878ed226SJulian Elischer 	u_int32_t	token_rate;      /* bytes per second */
1965878ed226SJulian Elischer 	u_int32_t	peak_bandwidth;  /* bytes per second */
1966878ed226SJulian Elischer 	u_int32_t	latency;         /* microseconds */
1967878ed226SJulian Elischer 	u_int32_t	delay_variation; /* microseconds */
1968878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_qos_setup_compl_ep;
1969878ed226SJulian Elischer 
1970878ed226SJulian Elischer #define NG_HCI_EVENT_COMMAND_COMPL		0x0e
1971878ed226SJulian Elischer typedef struct {
1972878ed226SJulian Elischer 	u_int8_t	num_cmd_pkts; /* # of HCI command packets */
1973878ed226SJulian Elischer 	u_int16_t	opcode;       /* command OpCode */
1974878ed226SJulian Elischer 	/* command return parameters (if any) */
1975878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_command_compl_ep;
1976878ed226SJulian Elischer 
1977878ed226SJulian Elischer #define NG_HCI_EVENT_COMMAND_STATUS		0x0f
1978878ed226SJulian Elischer typedef struct {
1979878ed226SJulian Elischer 	u_int8_t	status;       /* 0x00 - pending */
1980878ed226SJulian Elischer 	u_int8_t	num_cmd_pkts; /* # of HCI command packets */
1981878ed226SJulian Elischer 	u_int16_t	opcode;       /* command OpCode */
1982878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_command_status_ep;
1983878ed226SJulian Elischer 
1984878ed226SJulian Elischer #define NG_HCI_EVENT_HARDWARE_ERROR		0x10
1985878ed226SJulian Elischer typedef struct {
1986878ed226SJulian Elischer 	u_int8_t	hardware_code; /* hardware error code */
1987878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_hardware_error_ep;
1988878ed226SJulian Elischer 
1989878ed226SJulian Elischer #define NG_HCI_EVENT_FLUSH_OCCUR		0x11
1990878ed226SJulian Elischer typedef struct {
1991878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
1992878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_flush_occur_ep;
1993878ed226SJulian Elischer 
1994878ed226SJulian Elischer #define NG_HCI_EVENT_ROLE_CHANGE		0x12
1995878ed226SJulian Elischer typedef struct {
1996878ed226SJulian Elischer 	u_int8_t	status; /* 0x00 - success */
1997878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* address of remote unit */
1998878ed226SJulian Elischer 	u_int8_t	role;   /* new connection role */
1999878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_role_change_ep;
2000878ed226SJulian Elischer 
2001878ed226SJulian Elischer #define NG_HCI_EVENT_NUM_COMPL_PKTS		0x13
2002878ed226SJulian Elischer typedef struct {
2003878ed226SJulian Elischer 	u_int8_t	num_con_handles; /* # of connection handles */
2004878ed226SJulian Elischer /* these are repeated "num_con_handles" times
2005878ed226SJulian Elischer 	u_int16_t	con_handle; --- connection handle(s)
2006878ed226SJulian Elischer 	u_int16_t	compl_pkt;  --- # of completed packets */
2007878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_num_compl_pkts_ep;
2008878ed226SJulian Elischer 
2009878ed226SJulian Elischer #define NG_HCI_EVENT_MODE_CHANGE		0x14
2010878ed226SJulian Elischer typedef struct {
2011878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
2012878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
2013878ed226SJulian Elischer 	u_int8_t	unit_mode;  /* remote unit mode */
2014878ed226SJulian Elischer 	u_int16_t	interval;   /* interval * 0.625 msec */
2015878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_mode_change_ep;
2016878ed226SJulian Elischer 
2017878ed226SJulian Elischer #define NG_HCI_EVENT_RETURN_LINK_KEYS		0x15
2018878ed226SJulian Elischer typedef struct {
2019878ed226SJulian Elischer 	u_int8_t	num_keys; /* # of keys */
2020878ed226SJulian Elischer /* these are repeated "num_keys" times
2021878ed226SJulian Elischer 	bdaddr_t	bdaddr;               --- remote address(es)
2022878ed226SJulian Elischer 	u_int8_t	key[NG_HCI_KEY_SIZE]; --- key(s) */
2023878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_return_link_keys_ep;
2024878ed226SJulian Elischer 
2025878ed226SJulian Elischer #define NG_HCI_EVENT_PIN_CODE_REQ		0x16
2026878ed226SJulian Elischer typedef struct {
2027878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote unit address */
2028878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_pin_code_req_ep;
2029878ed226SJulian Elischer 
2030878ed226SJulian Elischer #define NG_HCI_EVENT_LINK_KEY_REQ		0x17
2031878ed226SJulian Elischer typedef struct {
2032878ed226SJulian Elischer 	bdaddr_t	bdaddr; /* remote unit address */
2033878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_req_ep;
2034878ed226SJulian Elischer 
2035878ed226SJulian Elischer #define NG_HCI_EVENT_LINK_KEY_NOTIFICATION	0x18
2036878ed226SJulian Elischer typedef struct {
2037878ed226SJulian Elischer 	bdaddr_t	bdaddr;               /* remote unit address */
2038878ed226SJulian Elischer 	u_int8_t	key[NG_HCI_KEY_SIZE]; /* link key */
2039878ed226SJulian Elischer 	u_int8_t	key_type;             /* type of the key */
2040878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_link_key_notification_ep;
2041878ed226SJulian Elischer 
2042878ed226SJulian Elischer #define NG_HCI_EVENT_LOOPBACK_COMMAND		0x19
2043878ed226SJulian Elischer typedef struct {
2044878ed226SJulian Elischer 	u_int8_t	command[0]; /* Command packet */
2045878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_loopback_command_ep;
2046878ed226SJulian Elischer 
2047878ed226SJulian Elischer #define NG_HCI_EVENT_DATA_BUFFER_OVERFLOW	0x1a
2048878ed226SJulian Elischer typedef struct {
2049878ed226SJulian Elischer 	u_int8_t	link_type; /* Link type */
2050878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_data_buffer_overflow_ep;
2051878ed226SJulian Elischer 
2052878ed226SJulian Elischer #define NG_HCI_EVENT_MAX_SLOT_CHANGE		0x1b
2053878ed226SJulian Elischer typedef struct {
2054878ed226SJulian Elischer 	u_int16_t	con_handle;    /* connection handle */
2055878ed226SJulian Elischer 	u_int8_t	lmp_max_slots; /* Max. # of slots allowed */
2056878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_max_slot_change_ep;
2057878ed226SJulian Elischer 
2058878ed226SJulian Elischer #define NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL	0x1c
2059878ed226SJulian Elischer typedef struct {
2060878ed226SJulian Elischer 	u_int8_t	status;       /* 0x00 - success */
2061878ed226SJulian Elischer 	u_int16_t	con_handle;   /* Connection handle */
2062878ed226SJulian Elischer 	u_int16_t	clock_offset; /* Clock offset */
2063878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_read_clock_offset_compl_ep;
2064878ed226SJulian Elischer 
2065878ed226SJulian Elischer #define NG_HCI_EVENT_CON_PKT_TYPE_CHANGED	0x1d
2066878ed226SJulian Elischer typedef struct {
2067878ed226SJulian Elischer 	u_int8_t	status;     /* 0x00 - success */
2068878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
2069878ed226SJulian Elischer 	u_int16_t	pkt_type;   /* packet type */
2070878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_con_pkt_type_changed_ep;
2071878ed226SJulian Elischer 
2072878ed226SJulian Elischer #define NG_HCI_EVENT_QOS_VIOLATION		0x1e
2073878ed226SJulian Elischer typedef struct {
2074878ed226SJulian Elischer 	u_int16_t	con_handle; /* connection handle */
2075878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_qos_violation_ep;
2076878ed226SJulian Elischer 
2077878ed226SJulian Elischer #define NG_HCI_EVENT_PAGE_SCAN_MODE_CHANGE	0x1f
2078878ed226SJulian Elischer typedef struct {
2079878ed226SJulian Elischer 	bdaddr_t	bdaddr;         /* destination address */
2080878ed226SJulian Elischer 	u_int8_t	page_scan_mode; /* page scan mode */
2081878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_page_scan_mode_change_ep;
2082878ed226SJulian Elischer 
2083878ed226SJulian Elischer #define NG_HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE	0x20
2084878ed226SJulian Elischer typedef struct {
2085878ed226SJulian Elischer 	bdaddr_t	bdaddr;             /* destination address */
2086878ed226SJulian Elischer 	u_int8_t	page_scan_rep_mode; /* page scan repetition mode */
2087878ed226SJulian Elischer } __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep;
2088*4ae0fa8aSAndreas Kempe 
2089*4ae0fa8aSAndreas Kempe #define	NG_HCI_EVENT_IO_CAPABILITY_REQUEST	0x31
2090*4ae0fa8aSAndreas Kempe typedef struct {
2091*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
2092*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_io_capability_request_ep;
2093*4ae0fa8aSAndreas Kempe 
2094*4ae0fa8aSAndreas Kempe #define	NG_HCI_EVENT_USER_CONFIRMATION_REQUEST	0x33
2095*4ae0fa8aSAndreas Kempe typedef struct {
2096*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
2097*4ae0fa8aSAndreas Kempe 	u_int32_t	numeric_value;
2098*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_user_confirmation_request_ep;
2099*4ae0fa8aSAndreas Kempe 
2100*4ae0fa8aSAndreas Kempe #define	NG_HCI_EVENT_SIMPLE_PAIRING_COMPLETE	0x36
2101*4ae0fa8aSAndreas Kempe typedef struct {
2102*4ae0fa8aSAndreas Kempe 	u_int8_t	status;
2103*4ae0fa8aSAndreas Kempe 	bdaddr_t	bdaddr;
2104*4ae0fa8aSAndreas Kempe } __attribute__ ((packed)) ng_hci_simple_pairing_complete_ep;
2105*4ae0fa8aSAndreas Kempe 
2106fbc48c2bSTakanori Watanabe #define NG_HCI_EVENT_LE				0x3e
2107fbc48c2bSTakanori Watanabe typedef struct {
2108fbc48c2bSTakanori Watanabe 	u_int8_t	subevent_code;
2109fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_ep;
2110fbc48c2bSTakanori Watanabe 
2111fbc48c2bSTakanori Watanabe #define NG_HCI_LEEV_CON_COMPL		0x01
2112fbc48c2bSTakanori Watanabe 
2113fbc48c2bSTakanori Watanabe typedef struct {
2114fbc48c2bSTakanori Watanabe 	u_int8_t	status;
2115fbc48c2bSTakanori Watanabe 	u_int16_t	handle;
2116fbc48c2bSTakanori Watanabe 	u_int8_t 	role;
2117fbc48c2bSTakanori Watanabe 	u_int8_t 	address_type;
2118fbc48c2bSTakanori Watanabe 	bdaddr_t	address;
2119fbc48c2bSTakanori Watanabe 	u_int16_t 	interval;
2120fbc48c2bSTakanori Watanabe 	u_int8_t	latency;
2121fbc48c2bSTakanori Watanabe 	u_int16_t	supervision_timeout;
2122022f2795STakanori Watanabe 	u_int8_t	master_clock_accuracy;
2123fbc48c2bSTakanori Watanabe 
2124fbc48c2bSTakanori Watanabe } __attribute__ ((packed)) ng_hci_le_connection_complete_ep;
2125fbc48c2bSTakanori Watanabe 
2126fbc48c2bSTakanori Watanabe #define NG_HCI_LEEV_ADVREP 0x02
2127fbc48c2bSTakanori Watanabe typedef struct {
2128fbc48c2bSTakanori Watanabe 	u_int8_t num_reports;
2129fbc48c2bSTakanori Watanabe 
2130fbc48c2bSTakanori Watanabe }__attribute__ ((packed)) ng_hci_le_advertising_report_ep;
2131fbc48c2bSTakanori Watanabe #define NG_HCI_SCAN_RESPONSE_DATA_MAX 0x1f
2132fbc48c2bSTakanori Watanabe 
2133fbc48c2bSTakanori Watanabe typedef struct {
2134fbc48c2bSTakanori Watanabe 	u_int8_t event_type;
2135fbc48c2bSTakanori Watanabe 	u_int8_t addr_type;
2136fbc48c2bSTakanori Watanabe 	bdaddr_t bdaddr;
2137fbc48c2bSTakanori Watanabe 	u_int8_t length_data;
213875afc548STakanori Watanabe 	/* The last octet is for RSSI */
213975afc548STakanori Watanabe 	u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX+1];
2140fbc48c2bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_advreport;
2141fbc48c2bSTakanori Watanabe 
2142fbc48c2bSTakanori Watanabe #define NG_HCI_LEEV_CON_UPDATE_COMPL 0x03
2143fbc48c2bSTakanori Watanabe typedef struct {
2144fbc48c2bSTakanori Watanabe 	u_int8_t status;
2145fbc48c2bSTakanori Watanabe 	u_int16_t connection_handle;
2146fbc48c2bSTakanori Watanabe 	u_int16_t conn_interval;
2147fbc48c2bSTakanori Watanabe 	u_int16_t conn_latency;
2148fbc48c2bSTakanori Watanabe 	u_int16_t supervision_timeout;
2149fbc48c2bSTakanori Watanabe }__attribute__((packed)) ng_hci_connection_update_complete_ep;
2150fbc48c2bSTakanori Watanabe 
21517a33c92bSTakanori Watanabe #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04
21527a33c92bSTakanori Watanabe typedef struct {
21537a33c92bSTakanori Watanabe 	u_int8_t 	status;
21547a33c92bSTakanori Watanabe 	u_int16_t 	connection_handle;
21557a33c92bSTakanori Watanabe 	u_int8_t	features[NG_HCI_FEATURES_SIZE];
21567a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_read_remote_features_ep;
21577a33c92bSTakanori Watanabe 
21587a33c92bSTakanori Watanabe #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05
21597a33c92bSTakanori Watanabe typedef struct {
21607a33c92bSTakanori Watanabe 	u_int16_t 	connection_handle;
21617a33c92bSTakanori Watanabe 	u_int64_t 	random_number;
21627a33c92bSTakanori Watanabe 	u_int16_t 	encrypted_diversifier;
21637a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_long_term_key_request_ep;
21647a33c92bSTakanori Watanabe 
21657a33c92bSTakanori Watanabe #define NG_HCI_LEEV_REMOTE_CONN_PARAM_REQUEST 0x06
21667a33c92bSTakanori Watanabe typedef struct {
21677a33c92bSTakanori Watanabe 	u_int16_t 	connection_handle;
21687a33c92bSTakanori Watanabe 	u_int16_t 	interval_min;
21697a33c92bSTakanori Watanabe 	u_int16_t 	interval_max;
21707a33c92bSTakanori Watanabe 	u_int16_t 	latency;
21717a33c92bSTakanori Watanabe 	u_int16_t 	timeout;
21727a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_remote_conn_param_ep;
21737a33c92bSTakanori Watanabe 
21747a33c92bSTakanori Watanabe #define NG_HCI_LEEV_DATA_LENGTH_CHANGE 0x07
21757a33c92bSTakanori Watanabe typedef struct {
21767a33c92bSTakanori Watanabe 	u_int16_t 	connection_handle;
21777a33c92bSTakanori Watanabe 	u_int16_t 	min_tx_octets;
21787a33c92bSTakanori Watanabe 	u_int16_t 	max_tx_time;
21797a33c92bSTakanori Watanabe 	u_int16_t 	max_rx_octets;
21807a33c92bSTakanori Watanabe 	u_int16_t 	max_rx_time;
21817a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_data_length_change_ep;
21827a33c92bSTakanori Watanabe 
21837a33c92bSTakanori Watanabe #define NG_HCI_LEEV_READ_LOCAL_P256_PK_COMPL 0x08
21847a33c92bSTakanori Watanabe typedef struct {
21857a33c92bSTakanori Watanabe 	u_int8_t 	status;
21867a33c92bSTakanori Watanabe 	u_int8_t 	local_p256_pk[64];
21877a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_read_local_p256_pk_compl_ep;
21887a33c92bSTakanori Watanabe 
21897a33c92bSTakanori Watanabe #define NG_HCI_LEEV_GEN_DHKEY_COMPL 0x09
21907a33c92bSTakanori Watanabe typedef struct {
21917a33c92bSTakanori Watanabe 	u_int8_t 	status;
21927a33c92bSTakanori Watanabe 	u_int8_t 	dh_key[32];
21937a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_gen_dhkey_compl_ep;
21947a33c92bSTakanori Watanabe 
21957a33c92bSTakanori Watanabe #define NG_HCI_LEEV_ENH_CONN_COMPL 0x0a
21967a33c92bSTakanori Watanabe typedef struct {
21977a33c92bSTakanori Watanabe 	u_int8_t 	status;
21987a33c92bSTakanori Watanabe 	u_int16_t 	connection_handle;
21997a33c92bSTakanori Watanabe 	u_int8_t	role;
22007a33c92bSTakanori Watanabe 	u_int8_t 	peer_addr_type;
22017a33c92bSTakanori Watanabe 	bdaddr_t 	peer_addr;
22027a33c92bSTakanori Watanabe 	bdaddr_t 	local_res_private_addr;
22037a33c92bSTakanori Watanabe 	bdaddr_t 	peer_res_private_addr;
22047a33c92bSTakanori Watanabe 	u_int16_t 	conn_interval;
22057a33c92bSTakanori Watanabe 	u_int16_t 	conn_latency;
22067a33c92bSTakanori Watanabe 	u_int16_t 	supervision_timeout;
22077a33c92bSTakanori Watanabe 	u_int8_t	master_clock_accuracy;
22087a33c92bSTakanori Watanabe }__attribute__((packed)) ng_hci_le_enh_conn_compl_ep;
2209878ed226SJulian Elischer 
2210878ed226SJulian Elischer #define NG_HCI_EVENT_BT_LOGO			0xfe
2211878ed226SJulian Elischer 
2212878ed226SJulian Elischer #define NG_HCI_EVENT_VENDOR			0xff
2213878ed226SJulian Elischer 
2214878ed226SJulian Elischer #endif /* ndef _NETGRAPH_HCI_H_ */
2215