6 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
8 * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com>
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $
37 * This file contains everything that application needs to know about
38 * Host Controller Interface (HCI). All information was obtained from
39 * Bluetooth Specification Book v1.1.
41 * This file can be included by both kernel and userland applications.
43 * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth
44 * specification refers to both devices and units. They are the
45 * same thing (i think), so to be consistent word "unit" will be
49 #ifndef _NETGRAPH_HCI_H_
50 #define _NETGRAPH_HCI_H_
52 /**************************************************************************
53 **************************************************************************
54 ** Netgraph node hook name, type name and type cookie and commands
55 **************************************************************************
56 **************************************************************************/
58 /* Node type name and type cookie */
59 #define NG_HCI_NODE_TYPE "hci"
60 #define NGM_HCI_COOKIE 1000774184
62 /* Netgraph node hook names */
63 #define NG_HCI_HOOK_DRV "drv" /* Driver <-> HCI */
64 #define NG_HCI_HOOK_ACL "acl" /* HCI <-> Upper */
65 #define NG_HCI_HOOK_SCO "sco" /* HCI <-> Upper */
66 #define NG_HCI_HOOK_RAW "raw" /* HCI <-> Upper */
68 /**************************************************************************
69 **************************************************************************
70 ** Common defines and types (HCI)
71 **************************************************************************
72 **************************************************************************/
74 /* All sizes are in bytes */
75 #define NG_HCI_BDADDR_SIZE 6 /* unit address */
76 #define NG_HCI_LAP_SIZE 3 /* unit LAP */
77 #define NG_HCI_KEY_SIZE 16 /* link key */
78 #define NG_HCI_PIN_SIZE 16 /* link PIN */
79 #define NG_HCI_EVENT_MASK_SIZE 8 /* event mask */
80 #define NG_HCI_LE_EVENT_MASK_SIZE 8 /* event mask */
81 #define NG_HCI_CLASS_SIZE 3 /* unit class */
82 #define NG_HCI_FEATURES_SIZE 8 /* LMP features */
83 #define NG_HCI_UNIT_NAME_SIZE 248 /* unit name size */
84 #define NG_HCI_COMMANDS_SIZE 64 /*Command list BMP size*/
85 #define NG_HCI_EXTINQ_MAX 240 /**/
86 /* HCI specification */
87 #define NG_HCI_SPEC_V10 0x00 /* v1.0 */
88 #define NG_HCI_SPEC_V11 0x01 /* v1.1 */
89 /* 0x02 - 0xFF - reserved for future use */
92 /* ------------------- byte 0 --------------------*/
93 #define NG_HCI_LMP_3SLOT 0x01
94 #define NG_HCI_LMP_5SLOT 0x02
95 #define NG_HCI_LMP_ENCRYPTION 0x04
96 #define NG_HCI_LMP_SLOT_OFFSET 0x08
97 #define NG_HCI_LMP_TIMING_ACCURACY 0x10
98 #define NG_HCI_LMP_SWITCH 0x20
99 #define NG_HCI_LMP_HOLD_MODE 0x40
100 #define NG_HCI_LMP_SNIFF_MODE 0x80
101 /* ------------------- byte 1 --------------------*/
102 #define NG_HCI_LMP_PARK_MODE 0x01
103 #define NG_HCI_LMP_RSSI 0x02
104 #define NG_HCI_LMP_CHANNEL_QUALITY 0x04
105 #define NG_HCI_LMP_SCO_LINK 0x08
106 #define NG_HCI_LMP_HV2_PKT 0x10
107 #define NG_HCI_LMP_HV3_PKT 0x20
108 #define NG_HCI_LMP_ULAW_LOG 0x40
109 #define NG_HCI_LMP_ALAW_LOG 0x80
110 /* ------------------- byte 2 --------------------*/
111 #define NG_HCI_LMP_CVSD 0x01
112 #define NG_HCI_LMP_PAGING_SCHEME 0x02
113 #define NG_HCI_LMP_POWER_CONTROL 0x04
114 #define NG_HCI_LMP_TRANSPARENT_SCO 0x08
115 #define NG_HCI_LMP_FLOW_CONTROL_LAG0 0x10
116 #define NG_HCI_LMP_FLOW_CONTROL_LAG1 0x20
117 #define NG_HCI_LMP_FLOW_CONTROL_LAG2 0x40
120 #define NG_HCI_LINK_SCO 0x00 /* Voice */
121 #define NG_HCI_LINK_ACL 0x01 /* Data */
122 #define NG_HCI_LINK_LE_PUBLIC 0x02 /* LE Public*/
123 #define NG_HCI_LINK_LE_RANDOM 0x03 /* LE Random*/
124 /* 0x02 - 0xFF - reserved for future use */
127 /* 0x0001 - 0x0004 - reserved for future use */
128 #define NG_HCI_PKT_DM1 0x0008 /* ACL link */
129 #define NG_HCI_PKT_DH1 0x0010 /* ACL link */
130 #define NG_HCI_PKT_HV1 0x0020 /* SCO link */
131 #define NG_HCI_PKT_HV2 0x0040 /* SCO link */
132 #define NG_HCI_PKT_HV3 0x0080 /* SCO link */
133 /* 0x0100 - 0x0200 - reserved for future use */
134 #define NG_HCI_PKT_DM3 0x0400 /* ACL link */
135 #define NG_HCI_PKT_DH3 0x0800 /* ACL link */
136 /* 0x1000 - 0x2000 - reserved for future use */
137 #define NG_HCI_PKT_DM5 0x4000 /* ACL link */
138 #define NG_HCI_PKT_DH5 0x8000 /* ACL link */
141 * Connection modes/Unit modes
143 * This is confusing. It means that one of the units change its mode
144 * for the specific connection. For example one connection was put on
145 * hold (but i could be wrong :)
148 #define NG_HCI_UNIT_MODE_ACTIVE 0x00
149 #define NG_HCI_UNIT_MODE_HOLD 0x01
150 #define NG_HCI_UNIT_MODE_SNIFF 0x02
151 #define NG_HCI_UNIT_MODE_PARK 0x03
152 /* 0x04 - 0xFF - reserved for future use */
154 /* Page scan modes */
155 #define NG_HCI_MANDATORY_PAGE_SCAN_MODE 0x00
156 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01
157 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02
158 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03
159 /* 0x04 - 0xFF - reserved for future use */
161 /* Page scan repetition modes */
162 #define NG_HCI_SCAN_REP_MODE0 0x00
163 #define NG_HCI_SCAN_REP_MODE1 0x01
164 #define NG_HCI_SCAN_REP_MODE2 0x02
165 /* 0x03 - 0xFF - reserved for future use */
167 /* Page scan period modes */
168 #define NG_HCI_PAGE_SCAN_PERIOD_MODE0 0x00
169 #define NG_HCI_PAGE_SCAN_PERIOD_MODE1 0x01
170 #define NG_HCI_PAGE_SCAN_PERIOD_MODE2 0x02
171 /* 0x03 - 0xFF - reserved for future use */
174 #define NG_HCI_NO_SCAN_ENABLE 0x00
175 #define NG_HCI_INQUIRY_ENABLE_PAGE_DISABLE 0x01
176 #define NG_HCI_INQUIRY_DISABLE_PAGE_ENABLE 0x02
177 #define NG_HCI_INQUIRY_ENABLE_PAGE_ENABLE 0x03
178 /* 0x04 - 0xFF - reserved for future use */
180 /* Hold mode activities */
181 #define NG_HCI_HOLD_MODE_NO_CHANGE 0x00
182 #define NG_HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01
183 #define NG_HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02
184 #define NG_HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04
185 /* 0x08 - 0x80 - reserved for future use */
187 /* Connection roles */
188 #define NG_HCI_ROLE_MASTER 0x00
189 #define NG_HCI_ROLE_SLAVE 0x01
190 /* 0x02 - 0xFF - reserved for future use */
193 #define NG_HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00
194 #define NG_HCI_USE_TEMPORARY_LINK_KEY 0x01
195 /* 0x02 - 0xFF - reserved for future use */
198 #define NG_HCI_PIN_TYPE_VARIABLE 0x00
199 #define NG_HCI_PIN_TYPE_FIXED 0x01
202 #define NG_HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00
203 #define NG_HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01
204 #define NG_HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02
205 /* 0x03 - 0xFF - reserved for future use */
207 /* Encryption modes */
208 #define NG_HCI_ENCRYPTION_MODE_NONE 0x00
209 #define NG_HCI_ENCRYPTION_MODE_P2P 0x01
210 #define NG_HCI_ENCRYPTION_MODE_ALL 0x02
211 /* 0x03 - 0xFF - reserved for future use */
213 /* Quality of service types */
214 #define NG_HCI_SERVICE_TYPE_NO_TRAFFIC 0x00
215 #define NG_HCI_SERVICE_TYPE_BEST_EFFORT 0x01
216 #define NG_HCI_SERVICE_TYPE_GUARANTEED 0x02
217 /* 0x03 - 0xFF - reserved for future use */
219 /* Link policy settings */
220 #define NG_HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000
221 #define NG_HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */
222 #define NG_HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002
223 #define NG_HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004
224 #define NG_HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008
225 /* 0x0010 - 0x8000 - reserved for future use */
228 #define NG_HCI_EVMSK_ALL 0x00000000ffffffff
229 #define NG_HCI_EVMSK_NONE 0x0000000000000000
230 #define NG_HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001
231 #define NG_HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002
232 #define NG_HCI_EVMSK_CON_COMPL 0x0000000000000004
233 #define NG_HCI_EVMSK_CON_REQ 0x0000000000000008
234 #define NG_HCI_EVMSK_DISCON_COMPL 0x0000000000000010
235 #define NG_HCI_EVMSK_AUTH_COMPL 0x0000000000000020
236 #define NG_HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040
237 #define NG_HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080
238 #define NG_HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100
239 #define NG_HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200
240 #define NG_HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400
241 #define NG_HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800
242 #define NG_HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000
243 #define NG_HCI_EVMSK_COMMAND_COMPL 0x0000000000002000
244 #define NG_HCI_EVMSK_COMMAND_STATUS 0x0000000000004000
245 #define NG_HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000
246 #define NG_HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000
247 #define NG_HCI_EVMSK_ROLE_CHANGE 0x0000000000020000
248 #define NG_HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000
249 #define NG_HCI_EVMSK_MODE_CHANGE 0x0000000000080000
250 #define NG_HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000
251 #define NG_HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000
252 #define NG_HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000
253 #define NG_HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000
254 #define NG_HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000
255 #define NG_HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000
256 #define NG_HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000
257 #define NG_HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000
258 #define NG_HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000
259 #define NG_HCI_EVMSK_QOS_VIOLATION 0x0000000020000000
260 #define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000
261 #define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000
262 /* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */
265 #define NG_HCI_FILTER_TYPE_NONE 0x00
266 #define NG_HCI_FILTER_TYPE_INQUIRY_RESULT 0x01
267 #define NG_HCI_FILTER_TYPE_CON_SETUP 0x02
268 /* 0x03 - 0xFF - reserved for future use */
270 /* Filter condition types for NG_HCI_FILTER_TYPE_INQUIRY_RESULT */
271 #define NG_HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00
272 #define NG_HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01
273 #define NG_HCI_FILTER_COND_INQUIRY_BDADDR 0x02
274 /* 0x03 - 0xFF - reserved for future use */
276 /* Filter condition types for NG_HCI_FILTER_TYPE_CON_SETUP */
277 #define NG_HCI_FILTER_COND_CON_ANY_UNIT 0x00
278 #define NG_HCI_FILTER_COND_CON_UNIT_CLASS 0x01
279 #define NG_HCI_FILTER_COND_CON_BDADDR 0x02
280 /* 0x03 - 0xFF - reserved for future use */
282 /* Xmit level types */
283 #define NG_HCI_XMIT_LEVEL_CURRENT 0x00
284 #define NG_HCI_XMIT_LEVEL_MAXIMUM 0x01
285 /* 0x02 - 0xFF - reserved for future use */
287 /* Host to Host Controller flow control */
288 #define NG_HCI_H2HC_FLOW_CONTROL_NONE 0x00
289 #define NG_HCI_H2HC_FLOW_CONTROL_ACL 0x01
290 #define NG_HCI_H2HC_FLOW_CONTROL_SCO 0x02
291 #define NG_HCI_H2HC_FLOW_CONTROL_BOTH 0x03 /* ACL and SCO */
292 /* 0x04 - 0xFF - reserved future use */
295 #define NG_HCI_COUNTRY_CODE_NAM_EUR_JP 0x00
296 #define NG_HCI_COUNTRY_CODE_FRANCE 0x01
297 /* 0x02 - 0xFF - reserved future use */
300 #define NG_HCI_LOOPBACK_NONE 0x00
301 #define NG_HCI_LOOPBACK_LOCAL 0x01
302 #define NG_HCI_LOOPBACK_REMOTE 0x02
303 /* 0x03 - 0xFF - reserved future use */
305 /**************************************************************************
306 **************************************************************************
307 ** Link level defines, headers and types
308 **************************************************************************
309 **************************************************************************/
312 * Macro(s) to combine OpCode and extract OGF (OpCode Group Field)
313 * and OCF (OpCode Command Field) from OpCode.
316 #define NG_HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))
317 #define NG_HCI_OCF(op) ((op) & 0x3ff)
318 #define NG_HCI_OGF(op) (((op) >> 10) & 0x3f)
321 * Marco(s) to extract/combine connection handle, BC (Broadcast) and
322 * PB (Packet boundary) flags.
325 #define NG_HCI_CON_HANDLE(h) ((h) & 0x0fff)
326 #define NG_HCI_PB_FLAG(h) (((h) & 0x3000) >> 12)
327 #define NG_HCI_BC_FLAG(h) (((h) & 0xc000) >> 14)
328 #define NG_HCI_MK_CON_HANDLE(h, pb, bc) \
329 (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
332 /* 00 - reserved for future use */
333 #define NG_HCI_PACKET_FRAGMENT 0x1
334 #define NG_HCI_PACKET_START 0x2
335 /* 11 - reserved for future use */
338 #define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */
339 #define NG_HCI_BROADCAST_ACTIVE 0x1 /* both directions */
340 #define NG_HCI_BROADCAST_PICONET 0x2 /* both directions */
341 /* 11 - reserved for future use */
343 /* HCI command packet header */
344 #define NG_HCI_CMD_PKT 0x01
345 #define NG_HCI_CMD_PKT_SIZE 0xff /* without header */
347 u_int8_t type; /* MUST be 0x1 */
348 u_int16_t opcode; /* OpCode */
349 u_int8_t length; /* parameter(s) length in bytes */
350 } __attribute__ ((packed)) ng_hci_cmd_pkt_t;
352 /* ACL data packet header */
353 #define NG_HCI_ACL_DATA_PKT 0x02
354 #define NG_HCI_ACL_PKT_SIZE 0xffff /* without header */
356 u_int8_t type; /* MUST be 0x2 */
357 u_int16_t con_handle; /* connection handle + PB + BC flags */
358 u_int16_t length; /* payload length in bytes */
359 } __attribute__ ((packed)) ng_hci_acldata_pkt_t;
361 /* SCO data packet header */
362 #define NG_HCI_SCO_DATA_PKT 0x03
363 #define NG_HCI_SCO_PKT_SIZE 0xff /* without header */
365 u_int8_t type; /* MUST be 0x3 */
366 u_int16_t con_handle; /* connection handle + reserved bits */
367 u_int8_t length; /* payload length in bytes */
368 } __attribute__ ((packed)) ng_hci_scodata_pkt_t;
370 /* HCI event packet header */
371 #define NG_HCI_EVENT_PKT 0x04
372 #define NG_HCI_EVENT_PKT_SIZE 0xff /* without header */
374 u_int8_t type; /* MUST be 0x4 */
375 u_int8_t event; /* event */
376 u_int8_t length; /* parameter(s) length in bytes */
377 } __attribute__ ((packed)) ng_hci_event_pkt_t;
379 /* Bluetooth unit address */
381 u_int8_t b[NG_HCI_BDADDR_SIZE];
382 } __attribute__ ((packed)) bdaddr_t;
383 typedef bdaddr_t * bdaddr_p;
385 /* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */
386 #define NG_HCI_BDADDR_ANY ((bdaddr_p) "\000\000\000\000\000\000")
388 /* HCI status return parameter */
390 u_int8_t status; /* 0x00 - success */
391 } __attribute__ ((packed)) ng_hci_status_rp;
393 /**************************************************************************
394 **************************************************************************
395 ** Upper layer protocol interface. LP_xxx event parameters
396 **************************************************************************
397 **************************************************************************/
399 /* Connection Request Event */
400 #define NGM_HCI_LP_CON_REQ 1 /* Upper -> HCI */
402 u_int16_t link_type; /* type of connection */
403 bdaddr_t bdaddr; /* remote unit address */
404 } ng_hci_lp_con_req_ep;
409 * NOTE: This request is not defined by Bluetooth specification,
410 * but i find it useful :)
412 #define NGM_HCI_LP_DISCON_REQ 2 /* Upper -> HCI */
414 u_int16_t con_handle; /* connection handle */
415 u_int16_t reason; /* reason to disconnect (only low byte) */
416 } ng_hci_lp_discon_req_ep;
418 /* Connection Confirmation Event */
419 #define NGM_HCI_LP_CON_CFM 3 /* HCI -> Upper */
421 u_int8_t status; /* 0x00 - success */
422 u_int8_t link_type; /* link type */
423 u_int16_t con_handle; /* con_handle */
424 bdaddr_t bdaddr; /* remote unit address */
425 } ng_hci_lp_con_cfm_ep;
427 /* Connection Indication Event */
428 #define NGM_HCI_LP_CON_IND 4 /* HCI -> Upper */
430 u_int8_t link_type; /* link type */
431 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */
432 bdaddr_t bdaddr; /* remote unit address */
433 } ng_hci_lp_con_ind_ep;
435 /* Connection Response Event */
436 #define NGM_HCI_LP_CON_RSP 5 /* Upper -> HCI */
438 u_int8_t status; /* 0x00 - accept connection */
439 u_int8_t link_type; /* link type */
440 bdaddr_t bdaddr; /* remote unit address */
441 } ng_hci_lp_con_rsp_ep;
443 /* Disconnection Indication Event */
444 #define NGM_HCI_LP_DISCON_IND 6 /* HCI -> Upper */
446 u_int8_t reason; /* reason to disconnect (only low byte) */
447 u_int8_t link_type; /* link type */
448 u_int16_t con_handle; /* connection handle */
449 } ng_hci_lp_discon_ind_ep;
451 /* QoS Setup Request Event */
452 #define NGM_HCI_LP_QOS_REQ 7 /* Upper -> HCI */
454 u_int16_t con_handle; /* connection handle */
455 u_int8_t flags; /* reserved */
456 u_int8_t service_type; /* service type */
457 u_int32_t token_rate; /* bytes/sec */
458 u_int32_t peak_bandwidth; /* bytes/sec */
459 u_int32_t latency; /* msec */
460 u_int32_t delay_variation; /* msec */
461 } ng_hci_lp_qos_req_ep;
463 /* QoS Conformition Event */
464 #define NGM_HCI_LP_QOS_CFM 8 /* HCI -> Upper */
466 u_int16_t status; /* 0x00 - success (only low byte) */
467 u_int16_t con_handle; /* connection handle */
468 } ng_hci_lp_qos_cfm_ep;
470 /* QoS Violation Indication Event */
471 #define NGM_HCI_LP_QOS_IND 9 /* HCI -> Upper */
473 u_int16_t con_handle; /* connection handle */
474 } ng_hci_lp_qos_ind_ep;
475 /*Encryption Change event*/
476 #define NGM_HCI_LP_ENC_CHG 10 /* HCI->Upper*/
481 }ng_hci_lp_enc_change_ep;
482 /**************************************************************************
483 **************************************************************************
484 ** HCI node command/event parameters
485 **************************************************************************
486 **************************************************************************/
489 #define NG_HCI_ALERT_LEVEL 1
490 #define NG_HCI_ERR_LEVEL 2
491 #define NG_HCI_WARN_LEVEL 3
492 #define NG_HCI_INFO_LEVEL 4
495 #define NG_HCI_UNIT_CONNECTED (1 << 0)
496 #define NG_HCI_UNIT_INITED (1 << 1)
497 #define NG_HCI_UNIT_READY (NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED)
498 #define NG_HCI_UNIT_COMMAND_PENDING (1 << 2)
500 /* Connection state */
501 #define NG_HCI_CON_CLOSED 0 /* connection closed */
502 #define NG_HCI_CON_W4_LP_CON_RSP 1 /* wait for LP_ConnectRsp */
503 #define NG_HCI_CON_W4_CONN_COMPLETE 2 /* wait for Connection_Complete evt */
504 #define NG_HCI_CON_OPEN 3 /* connection open */
506 /* Get HCI node (unit) state (see states above) */
507 #define NGM_HCI_NODE_GET_STATE 100 /* HCI -> User */
508 typedef u_int16_t ng_hci_node_state_ep;
510 /* Turn on "inited" bit */
511 #define NGM_HCI_NODE_INIT 101 /* User -> HCI */
514 /* Get/Set node debug level (see debug levels above) */
515 #define NGM_HCI_NODE_GET_DEBUG 102 /* HCI -> User */
516 #define NGM_HCI_NODE_SET_DEBUG 103 /* User -> HCI */
517 typedef u_int16_t ng_hci_node_debug_ep;
519 /* Get node buffer info */
520 #define NGM_HCI_NODE_GET_BUFFER 104 /* HCI -> User */
522 u_int8_t cmd_free; /* number of free command packets */
523 u_int8_t sco_size; /* max. size of SCO packet */
524 u_int16_t sco_pkts; /* number of SCO packets */
525 u_int16_t sco_free; /* number of free SCO packets */
526 u_int16_t acl_size; /* max. size of ACL packet */
527 u_int16_t acl_pkts; /* number of ACL packets */
528 u_int16_t acl_free; /* number of free ACL packets */
529 } ng_hci_node_buffer_ep;
532 #define NGM_HCI_NODE_GET_BDADDR 105 /* HCI -> User */
533 /* bdaddr_t -- BDADDR */
536 #define NGM_HCI_NODE_GET_FEATURES 106 /* HCI -> User */
537 /* features[NG_HCI_FEATURES_SIZE] -- features */
539 #define NGM_HCI_NODE_GET_STAT 107 /* HCI -> User */
541 u_int32_t cmd_sent; /* number of HCI commands sent */
542 u_int32_t evnt_recv; /* number of HCI events received */
543 u_int32_t acl_recv; /* number of ACL packets received */
544 u_int32_t acl_sent; /* number of ACL packets sent */
545 u_int32_t sco_recv; /* number of SCO packets received */
546 u_int32_t sco_sent; /* number of SCO packets sent */
547 u_int32_t bytes_recv; /* total number of bytes received */
548 u_int32_t bytes_sent; /* total number of bytes sent */
549 } ng_hci_node_stat_ep;
551 #define NGM_HCI_NODE_RESET_STAT 108 /* User -> HCI */
554 #define NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE 109 /* User -> HCI */
556 #define NGM_HCI_NODE_GET_NEIGHBOR_CACHE 110 /* HCI -> User */
558 u_int32_t num_entries; /* number of entries */
559 } ng_hci_node_get_neighbor_cache_ep;
562 u_int16_t page_scan_rep_mode; /* page rep scan mode */
563 u_int16_t page_scan_mode; /* page scan mode */
564 u_int16_t clock_offset; /* clock offset */
565 bdaddr_t bdaddr; /* bdaddr */
566 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* features */
568 uint8_t extinq_size; /* MAX 240*/
569 uint8_t extinq_data[NG_HCI_EXTINQ_MAX];
570 } ng_hci_node_neighbor_cache_entry_ep;
572 #define NG_HCI_MAX_NEIGHBOR_NUM \
573 ((0xffff - sizeof(ng_hci_node_get_neighbor_cache_ep))/sizeof(ng_hci_node_neighbor_cache_entry_ep))
575 #define NGM_HCI_NODE_GET_CON_LIST 111 /* HCI -> User */
577 u_int32_t num_connections; /* number of connections */
578 } ng_hci_node_con_list_ep;
581 u_int8_t link_type; /* ACL or SCO */
582 u_int8_t encryption_mode; /* none, p2p, ... */
583 u_int8_t mode; /* ACTIVE, HOLD ... */
584 u_int8_t role; /* MASTER/SLAVE */
585 u_int16_t state; /* connection state */
586 u_int16_t reserved; /* place holder */
587 u_int16_t pending; /* number of pending packets */
588 u_int16_t queue_len; /* number of packets in queue */
589 u_int16_t con_handle; /* connection handle */
590 bdaddr_t bdaddr; /* remote bdaddr */
591 } ng_hci_node_con_ep;
593 #define NG_HCI_MAX_CON_NUM \
594 ((0xffff - sizeof(ng_hci_node_con_list_ep))/sizeof(ng_hci_node_con_ep))
596 #define NGM_HCI_NODE_UP 112 /* HCI -> Upper */
598 u_int16_t pkt_size; /* max. ACL/SCO packet size (w/out header) */
599 u_int16_t num_pkts; /* ACL/SCO packet queue size */
600 u_int16_t reserved; /* place holder */
601 bdaddr_t bdaddr; /* bdaddr */
604 #define NGM_HCI_SYNC_CON_QUEUE 113 /* HCI -> Upper */
606 u_int16_t con_handle; /* connection handle */
607 u_int16_t completed; /* number of completed packets */
608 } ng_hci_sync_con_queue_ep;
610 #define NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK 114 /* HCI -> User */
611 #define NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK 115 /* User -> HCI */
612 typedef u_int16_t ng_hci_node_link_policy_mask_ep;
614 #define NGM_HCI_NODE_GET_PACKET_MASK 116 /* HCI -> User */
615 #define NGM_HCI_NODE_SET_PACKET_MASK 117 /* User -> HCI */
616 typedef u_int16_t ng_hci_node_packet_mask_ep;
618 #define NGM_HCI_NODE_GET_ROLE_SWITCH 118 /* HCI -> User */
619 #define NGM_HCI_NODE_SET_ROLE_SWITCH 119 /* User -> HCI */
620 typedef u_int16_t ng_hci_node_role_switch_ep;
622 #define NGM_HCI_NODE_LIST_NAMES 200 /* HCI -> User */
624 /**************************************************************************
625 **************************************************************************
626 ** Link control commands and return parameters
627 **************************************************************************
628 **************************************************************************/
630 #define NG_HCI_OGF_LINK_CONTROL 0x01 /* OpCode Group Field */
632 #define NG_HCI_OCF_INQUIRY 0x0001
634 u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */
635 u_int8_t inquiry_length; /* (N x 1.28) sec */
636 u_int8_t num_responses; /* Max. # of responses before halted */
637 } __attribute__ ((packed)) ng_hci_inquiry_cp;
638 /* No return parameter(s) */
640 #define NG_HCI_OCF_INQUIRY_CANCEL 0x0002
641 /* No command parameter(s) */
642 typedef ng_hci_status_rp ng_hci_inquiry_cancel_rp;
644 #define NG_HCI_OCF_PERIODIC_INQUIRY 0x0003
646 u_int16_t max_period_length; /* Max. and min. amount of time */
647 u_int16_t min_period_length; /* between consecutive inquiries */
648 u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */
649 u_int8_t inquiry_length; /* (inquiry_length * 1.28) sec */
650 u_int8_t num_responses; /* Max. # of responses */
651 } __attribute__ ((packed)) ng_hci_periodic_inquiry_cp;
653 typedef ng_hci_status_rp ng_hci_periodic_inquiry_rp;
655 #define NG_HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004
656 /* No command parameter(s) */
657 typedef ng_hci_status_rp ng_hci_exit_periodic_inquiry_rp;
659 #define NG_HCI_OCF_CREATE_CON 0x0005
661 bdaddr_t bdaddr; /* destination address */
662 u_int16_t pkt_type; /* packet type */
663 u_int8_t page_scan_rep_mode; /* page scan repetition mode */
664 u_int8_t page_scan_mode; /* page scan mode */
665 u_int16_t clock_offset; /* clock offset */
666 u_int8_t accept_role_switch; /* accept role switch? 0x00 - no */
667 } __attribute__ ((packed)) ng_hci_create_con_cp;
668 /* No return parameter(s) */
670 #define NG_HCI_OCF_DISCON 0x0006
672 u_int16_t con_handle; /* connection handle */
673 u_int8_t reason; /* reason to disconnect */
674 } __attribute__ ((packed)) ng_hci_discon_cp;
675 /* No return parameter(s) */
677 #define NG_HCI_OCF_ADD_SCO_CON 0x0007
679 u_int16_t con_handle; /* connection handle */
680 u_int16_t pkt_type; /* packet type */
681 } __attribute__ ((packed)) ng_hci_add_sco_con_cp;
682 /* No return parameter(s) */
684 #define NG_HCI_OCF_ACCEPT_CON 0x0009
686 bdaddr_t bdaddr; /* address of unit to be connected */
687 u_int8_t role; /* connection role */
688 } __attribute__ ((packed)) ng_hci_accept_con_cp;
689 /* No return parameter(s) */
691 #define NG_HCI_OCF_REJECT_CON 0x000a
693 bdaddr_t bdaddr; /* remote address */
694 u_int8_t reason; /* reason to reject */
695 } __attribute__ ((packed)) ng_hci_reject_con_cp;
696 /* No return parameter(s) */
698 #define NG_HCI_OCF_LINK_KEY_REP 0x000b
700 bdaddr_t bdaddr; /* remote address */
701 u_int8_t key[NG_HCI_KEY_SIZE]; /* key */
702 } __attribute__ ((packed)) ng_hci_link_key_rep_cp;
705 u_int8_t status; /* 0x00 - success */
706 bdaddr_t bdaddr; /* unit address */
707 } __attribute__ ((packed)) ng_hci_link_key_rep_rp;
709 #define NG_HCI_OCF_LINK_KEY_NEG_REP 0x000c
711 bdaddr_t bdaddr; /* remote address */
712 } __attribute__ ((packed)) ng_hci_link_key_neg_rep_cp;
715 u_int8_t status; /* 0x00 - success */
716 bdaddr_t bdaddr; /* unit address */
717 } __attribute__ ((packed)) ng_hci_link_key_neg_rep_rp;
719 #define NG_HCI_OCF_PIN_CODE_REP 0x000d
721 bdaddr_t bdaddr; /* remote address */
722 u_int8_t pin_size; /* pin code length (in bytes) */
723 u_int8_t pin[NG_HCI_PIN_SIZE]; /* pin code */
724 } __attribute__ ((packed)) ng_hci_pin_code_rep_cp;
727 u_int8_t status; /* 0x00 - success */
728 bdaddr_t bdaddr; /* unit address */
729 } __attribute__ ((packed)) ng_hci_pin_code_rep_rp;
731 #define NG_HCI_OCF_PIN_CODE_NEG_REP 0x000e
733 bdaddr_t bdaddr; /* remote address */
734 } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_cp;
737 u_int8_t status; /* 0x00 - success */
738 bdaddr_t bdaddr; /* unit address */
739 } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_rp;
741 #define NG_HCI_OCF_CHANGE_CON_PKT_TYPE 0x000f
743 u_int16_t con_handle; /* connection handle */
744 u_int16_t pkt_type; /* packet type */
745 } __attribute__ ((packed)) ng_hci_change_con_pkt_type_cp;
746 /* No return parameter(s) */
748 #define NG_HCI_OCF_AUTH_REQ 0x0011
750 u_int16_t con_handle; /* connection handle */
751 } __attribute__ ((packed)) ng_hci_auth_req_cp;
752 /* No return parameter(s) */
754 #define NG_HCI_OCF_SET_CON_ENCRYPTION 0x0013
756 u_int16_t con_handle; /* connection handle */
757 u_int8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */
758 } __attribute__ ((packed)) ng_hci_set_con_encryption_cp;
759 /* No return parameter(s) */
761 #define NG_HCI_OCF_CHANGE_CON_LINK_KEY 0x0015
763 u_int16_t con_handle; /* connection handle */
764 } __attribute__ ((packed)) ng_hci_change_con_link_key_cp;
765 /* No return parameter(s) */
767 #define NG_HCI_OCF_MASTER_LINK_KEY 0x0017
769 u_int8_t key_flag; /* key flag */
770 } __attribute__ ((packed)) ng_hci_master_link_key_cp;
771 /* No return parameter(s) */
773 #define NG_HCI_OCF_REMOTE_NAME_REQ 0x0019
775 bdaddr_t bdaddr; /* remote address */
776 u_int8_t page_scan_rep_mode; /* page scan repetition mode */
777 u_int8_t page_scan_mode; /* page scan mode */
778 u_int16_t clock_offset; /* clock offset */
779 } __attribute__ ((packed)) ng_hci_remote_name_req_cp;
780 /* No return parameter(s) */
782 #define NG_HCI_OCF_READ_REMOTE_FEATURES 0x001b
784 u_int16_t con_handle; /* connection handle */
785 } __attribute__ ((packed)) ng_hci_read_remote_features_cp;
786 /* No return parameter(s) */
788 #define NG_HCI_OCF_READ_REMOTE_VER_INFO 0x001d
790 u_int16_t con_handle; /* connection handle */
791 } __attribute__ ((packed)) ng_hci_read_remote_ver_info_cp;
792 /* No return parameter(s) */
794 #define NG_HCI_OCF_READ_CLOCK_OFFSET 0x001f
796 u_int16_t con_handle; /* connection handle */
797 } __attribute__ ((packed)) ng_hci_read_clock_offset_cp;
798 /* No return parameter(s) */
800 /**************************************************************************
801 **************************************************************************
802 ** Link policy commands and return parameters
803 **************************************************************************
804 **************************************************************************/
806 #define NG_HCI_OGF_LINK_POLICY 0x02 /* OpCode Group Field */
808 #define NG_HCI_OCF_HOLD_MODE 0x0001
810 u_int16_t con_handle; /* connection handle */
811 u_int16_t max_interval; /* (max_interval * 0.625) msec */
812 u_int16_t min_interval; /* (max_interval * 0.625) msec */
813 } __attribute__ ((packed)) ng_hci_hold_mode_cp;
814 /* No return parameter(s) */
816 #define NG_HCI_OCF_SNIFF_MODE 0x0003
818 u_int16_t con_handle; /* connection handle */
819 u_int16_t max_interval; /* (max_interval * 0.625) msec */
820 u_int16_t min_interval; /* (max_interval * 0.625) msec */
821 u_int16_t attempt; /* (2 * attempt - 1) * 0.625 msec */
822 u_int16_t timeout; /* (2 * attempt - 1) * 0.625 msec */
823 } __attribute__ ((packed)) ng_hci_sniff_mode_cp;
824 /* No return parameter(s) */
826 #define NG_HCI_OCF_EXIT_SNIFF_MODE 0x0004
828 u_int16_t con_handle; /* connection handle */
829 } __attribute__ ((packed)) ng_hci_exit_sniff_mode_cp;
830 /* No return parameter(s) */
832 #define NG_HCI_OCF_PARK_MODE 0x0005
834 u_int16_t con_handle; /* connection handle */
835 u_int16_t max_interval; /* (max_interval * 0.625) msec */
836 u_int16_t min_interval; /* (max_interval * 0.625) msec */
837 } __attribute__ ((packed)) ng_hci_park_mode_cp;
838 /* No return parameter(s) */
840 #define NG_HCI_OCF_EXIT_PARK_MODE 0x0006
842 u_int16_t con_handle; /* connection handle */
843 } __attribute__ ((packed)) ng_hci_exit_park_mode_cp;
844 /* No return parameter(s) */
846 #define NG_HCI_OCF_QOS_SETUP 0x0007
848 u_int16_t con_handle; /* connection handle */
849 u_int8_t flags; /* reserved for future use */
850 u_int8_t service_type; /* service type */
851 u_int32_t token_rate; /* bytes per second */
852 u_int32_t peak_bandwidth; /* bytes per second */
853 u_int32_t latency; /* microseconds */
854 u_int32_t delay_variation; /* microseconds */
855 } __attribute__ ((packed)) ng_hci_qos_setup_cp;
856 /* No return parameter(s) */
858 #define NG_HCI_OCF_ROLE_DISCOVERY 0x0009
860 u_int16_t con_handle; /* connection handle */
861 } __attribute__ ((packed)) ng_hci_role_discovery_cp;
864 u_int8_t status; /* 0x00 - success */
865 u_int16_t con_handle; /* connection handle */
866 u_int8_t role; /* role for the connection handle */
867 } __attribute__ ((packed)) ng_hci_role_discovery_rp;
869 #define NG_HCI_OCF_SWITCH_ROLE 0x000b
871 bdaddr_t bdaddr; /* remote address */
872 u_int8_t role; /* new local role */
873 } __attribute__ ((packed)) ng_hci_switch_role_cp;
874 /* No return parameter(s) */
876 #define NG_HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c
878 u_int16_t con_handle; /* connection handle */
879 } __attribute__ ((packed)) ng_hci_read_link_policy_settings_cp;
882 u_int8_t status; /* 0x00 - success */
883 u_int16_t con_handle; /* connection handle */
884 u_int16_t settings; /* link policy settings */
885 } __attribute__ ((packed)) ng_hci_read_link_policy_settings_rp;
887 #define NG_HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d
889 u_int16_t con_handle; /* connection handle */
890 u_int16_t settings; /* link policy settings */
891 } __attribute__ ((packed)) ng_hci_write_link_policy_settings_cp;
894 u_int8_t status; /* 0x00 - success */
895 u_int16_t con_handle; /* connection handle */
896 } __attribute__ ((packed)) ng_hci_write_link_policy_settings_rp;
898 /**************************************************************************
899 **************************************************************************
900 ** Host controller and baseband commands and return parameters
901 **************************************************************************
902 **************************************************************************/
904 #define NG_HCI_OGF_HC_BASEBAND 0x03 /* OpCode Group Field */
906 #define NG_HCI_OCF_SET_EVENT_MASK 0x0001
908 u_int8_t event_mask[NG_HCI_EVENT_MASK_SIZE]; /* event_mask */
909 } __attribute__ ((packed)) ng_hci_set_event_mask_cp;
911 typedef ng_hci_status_rp ng_hci_set_event_mask_rp;
912 #define NG_HCI_EVENT_MASK_DEFAULT 0x1fffffffffff
913 #define NG_HCI_EVENT_MASK_LE 0x2000000000000000
915 #define NG_HCI_OCF_RESET 0x0003
916 /* No command parameter(s) */
917 typedef ng_hci_status_rp ng_hci_reset_rp;
919 #define NG_HCI_OCF_SET_EVENT_FILTER 0x0005
921 u_int8_t filter_type; /* filter type */
922 u_int8_t filter_condition_type; /* filter condition type */
923 u_int8_t condition[0]; /* conditions - variable size */
924 } __attribute__ ((packed)) ng_hci_set_event_filter_cp;
926 typedef ng_hci_status_rp ng_hci_set_event_filter_rp;
928 #define NG_HCI_OCF_FLUSH 0x0008
930 u_int16_t con_handle; /* connection handle */
931 } __attribute__ ((packed)) ng_hci_flush_cp;
934 u_int8_t status; /* 0x00 - success */
935 u_int16_t con_handle; /* connection handle */
936 } __attribute__ ((packed)) ng_hci_flush_rp;
938 #define NG_HCI_OCF_READ_PIN_TYPE 0x0009
939 /* No command parameter(s) */
941 u_int8_t status; /* 0x00 - success */
942 u_int8_t pin_type; /* PIN type */
943 } __attribute__ ((packed)) ng_hci_read_pin_type_rp;
945 #define NG_HCI_OCF_WRITE_PIN_TYPE 0x000a
947 u_int8_t pin_type; /* PIN type */
948 } __attribute__ ((packed)) ng_hci_write_pin_type_cp;
950 typedef ng_hci_status_rp ng_hci_write_pin_type_rp;
952 #define NG_HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b
953 /* No command parameter(s) */
954 typedef ng_hci_status_rp ng_hci_create_new_unit_key_rp;
956 #define NG_HCI_OCF_READ_STORED_LINK_KEY 0x000d
958 bdaddr_t bdaddr; /* address */
959 u_int8_t read_all; /* read all keys? 0x01 - yes */
960 } __attribute__ ((packed)) ng_hci_read_stored_link_key_cp;
963 u_int8_t status; /* 0x00 - success */
964 u_int16_t max_num_keys; /* Max. number of keys */
965 u_int16_t num_keys_read; /* Number of stored keys */
966 } __attribute__ ((packed)) ng_hci_read_stored_link_key_rp;
968 #define NG_HCI_OCF_WRITE_STORED_LINK_KEY 0x0011
970 u_int8_t num_keys_write; /* # of keys to write */
971 /* these are repeated "num_keys_write" times
972 bdaddr_t bdaddr; --- remote address(es)
973 u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */
974 } __attribute__ ((packed)) ng_hci_write_stored_link_key_cp;
977 u_int8_t status; /* 0x00 - success */
978 u_int8_t num_keys_written; /* # of keys successfully written */
979 } __attribute__ ((packed)) ng_hci_write_stored_link_key_rp;
981 #define NG_HCI_OCF_DELETE_STORED_LINK_KEY 0x0012
983 bdaddr_t bdaddr; /* address */
984 u_int8_t delete_all; /* delete all keys? 0x01 - yes */
985 } __attribute__ ((packed)) ng_hci_delete_stored_link_key_cp;
988 u_int8_t status; /* 0x00 - success */
989 u_int16_t num_keys_deleted; /* Number of keys deleted */
990 } __attribute__ ((packed)) ng_hci_delete_stored_link_key_rp;
992 #define NG_HCI_OCF_CHANGE_LOCAL_NAME 0x0013
994 char name[NG_HCI_UNIT_NAME_SIZE]; /* new unit name */
995 } __attribute__ ((packed)) ng_hci_change_local_name_cp;
997 typedef ng_hci_status_rp ng_hci_change_local_name_rp;
999 #define NG_HCI_OCF_READ_LOCAL_NAME 0x0014
1000 /* No command parameter(s) */
1002 u_int8_t status; /* 0x00 - success */
1003 char name[NG_HCI_UNIT_NAME_SIZE]; /* unit name */
1004 } __attribute__ ((packed)) ng_hci_read_local_name_rp;
1006 #define NG_HCI_OCF_READ_CON_ACCEPT_TIMO 0x0015
1007 /* No command parameter(s) */
1009 u_int8_t status; /* 0x00 - success */
1010 u_int16_t timeout; /* (timeout * 0.625) msec */
1011 } __attribute__ ((packed)) ng_hci_read_con_accept_timo_rp;
1013 #define NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO 0x0016
1015 u_int16_t timeout; /* (timeout * 0.625) msec */
1016 } __attribute__ ((packed)) ng_hci_write_con_accept_timo_cp;
1018 typedef ng_hci_status_rp ng_hci_write_con_accept_timo_rp;
1020 #define NG_HCI_OCF_READ_PAGE_TIMO 0x0017
1021 /* No command parameter(s) */
1023 u_int8_t status; /* 0x00 - success */
1024 u_int16_t timeout; /* (timeout * 0.625) msec */
1025 } __attribute__ ((packed)) ng_hci_read_page_timo_rp;
1027 #define NG_HCI_OCF_WRITE_PAGE_TIMO 0x0018
1029 u_int16_t timeout; /* (timeout * 0.625) msec */
1030 } __attribute__ ((packed)) ng_hci_write_page_timo_cp;
1032 typedef ng_hci_status_rp ng_hci_write_page_timo_rp;
1034 #define NG_HCI_OCF_READ_SCAN_ENABLE 0x0019
1035 /* No command parameter(s) */
1037 u_int8_t status; /* 0x00 - success */
1038 u_int8_t scan_enable; /* Scan enable */
1039 } __attribute__ ((packed)) ng_hci_read_scan_enable_rp;
1041 #define NG_HCI_OCF_WRITE_SCAN_ENABLE 0x001a
1043 u_int8_t scan_enable; /* Scan enable */
1044 } __attribute__ ((packed)) ng_hci_write_scan_enable_cp;
1046 typedef ng_hci_status_rp ng_hci_write_scan_enable_rp;
1048 #define NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b
1049 /* No command parameter(s) */
1051 u_int8_t status; /* 0x00 - success */
1052 u_int16_t page_scan_interval; /* interval * 0.625 msec */
1053 u_int16_t page_scan_window; /* window * 0.625 msec */
1054 } __attribute__ ((packed)) ng_hci_read_page_scan_activity_rp;
1056 #define NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c
1058 u_int16_t page_scan_interval; /* interval * 0.625 msec */
1059 u_int16_t page_scan_window; /* window * 0.625 msec */
1060 } __attribute__ ((packed)) ng_hci_write_page_scan_activity_cp;
1062 typedef ng_hci_status_rp ng_hci_write_page_scan_activity_rp;
1064 #define NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d
1065 /* No command parameter(s) */
1067 u_int8_t status; /* 0x00 - success */
1068 u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */
1069 u_int16_t inquiry_scan_window; /* window * 0.625 msec */
1070 } __attribute__ ((packed)) ng_hci_read_inquiry_scan_activity_rp;
1072 #define NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e
1074 u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */
1075 u_int16_t inquiry_scan_window; /* window * 0.625 msec */
1076 } __attribute__ ((packed)) ng_hci_write_inquiry_scan_activity_cp;
1078 typedef ng_hci_status_rp ng_hci_write_inquiry_scan_activity_rp;
1080 #define NG_HCI_OCF_READ_AUTH_ENABLE 0x001f
1081 /* No command parameter(s) */
1083 u_int8_t status; /* 0x00 - success */
1084 u_int8_t auth_enable; /* 0x01 - enabled */
1085 } __attribute__ ((packed)) ng_hci_read_auth_enable_rp;
1087 #define NG_HCI_OCF_WRITE_AUTH_ENABLE 0x0020
1089 u_int8_t auth_enable; /* 0x01 - enabled */
1090 } __attribute__ ((packed)) ng_hci_write_auth_enable_cp;
1092 typedef ng_hci_status_rp ng_hci_write_auth_enable_rp;
1094 #define NG_HCI_OCF_READ_ENCRYPTION_MODE 0x0021
1095 /* No command parameter(s) */
1097 u_int8_t status; /* 0x00 - success */
1098 u_int8_t encryption_mode; /* encryption mode */
1099 } __attribute__ ((packed)) ng_hci_read_encryption_mode_rp;
1101 #define NG_HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022
1103 u_int8_t encryption_mode; /* encryption mode */
1104 } __attribute__ ((packed)) ng_hci_write_encryption_mode_cp;
1106 typedef ng_hci_status_rp ng_hci_write_encryption_mode_rp;
1108 #define NG_HCI_OCF_READ_UNIT_CLASS 0x0023
1109 /* No command parameter(s) */
1111 u_int8_t status; /* 0x00 - success */
1112 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */
1113 } __attribute__ ((packed)) ng_hci_read_unit_class_rp;
1115 #define NG_HCI_OCF_WRITE_UNIT_CLASS 0x0024
1117 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */
1118 } __attribute__ ((packed)) ng_hci_write_unit_class_cp;
1120 typedef ng_hci_status_rp ng_hci_write_unit_class_rp;
1122 #define NG_HCI_OCF_READ_VOICE_SETTINGS 0x0025
1123 /* No command parameter(s) */
1125 u_int8_t status; /* 0x00 - success */
1126 u_int16_t settings; /* voice settings */
1127 } __attribute__ ((packed)) ng_hci_read_voice_settings_rp;
1129 #define NG_HCI_OCF_WRITE_VOICE_SETTINGS 0x0026
1131 u_int16_t settings; /* voice settings */
1132 } __attribute__ ((packed)) ng_hci_write_voice_settings_cp;
1134 typedef ng_hci_status_rp ng_hci_write_voice_settings_rp;
1136 #define NG_HCI_OCF_READ_AUTO_FLUSH_TIMO 0x0027
1138 u_int16_t con_handle; /* connection handle */
1139 } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_cp;
1142 u_int8_t status; /* 0x00 - success */
1143 u_int16_t con_handle; /* connection handle */
1144 u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */
1145 } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_rp;
1147 #define NG_HCI_OCF_WRITE_AUTO_FLUSH_TIMO 0x0028
1149 u_int16_t con_handle; /* connection handle */
1150 u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */
1151 } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_cp;
1154 u_int8_t status; /* 0x00 - success */
1155 u_int16_t con_handle; /* connection handle */
1156 } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_rp;
1158 #define NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029
1159 /* No command parameter(s) */
1161 u_int8_t status; /* 0x00 - success */
1162 u_int8_t counter; /* number of broadcast retransmissions */
1163 } __attribute__ ((packed)) ng_hci_read_num_broadcast_retrans_rp;
1165 #define NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a
1167 u_int8_t counter; /* number of broadcast retransmissions */
1168 } __attribute__ ((packed)) ng_hci_write_num_broadcast_retrans_cp;
1170 typedef ng_hci_status_rp ng_hci_write_num_broadcast_retrans_rp;
1172 #define NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b
1173 /* No command parameter(s) */
1175 u_int8_t status; /* 0x00 - success */
1176 u_int8_t hold_mode_activity; /* Hold mode activities */
1177 } __attribute__ ((packed)) ng_hci_read_hold_mode_activity_rp;
1179 #define NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c
1181 u_int8_t hold_mode_activity; /* Hold mode activities */
1182 } __attribute__ ((packed)) ng_hci_write_hold_mode_activity_cp;
1184 typedef ng_hci_status_rp ng_hci_write_hold_mode_activity_rp;
1186 #define NG_HCI_OCF_READ_XMIT_LEVEL 0x002d
1188 u_int16_t con_handle; /* connection handle */
1189 u_int8_t type; /* Xmit level type */
1190 } __attribute__ ((packed)) ng_hci_read_xmit_level_cp;
1193 u_int8_t status; /* 0x00 - success */
1194 u_int16_t con_handle; /* connection handle */
1195 char level; /* -30 <= level <= 30 dBm */
1196 } __attribute__ ((packed)) ng_hci_read_xmit_level_rp;
1198 #define NG_HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e
1199 /* No command parameter(s) */
1201 u_int8_t status; /* 0x00 - success */
1202 u_int8_t flow_control; /* 0x00 - disabled */
1203 } __attribute__ ((packed)) ng_hci_read_sco_flow_control_rp;
1205 #define NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f
1207 u_int8_t flow_control; /* 0x00 - disabled */
1208 } __attribute__ ((packed)) ng_hci_write_sco_flow_control_cp;
1210 typedef ng_hci_status_rp ng_hci_write_sco_flow_control_rp;
1212 #define NG_HCI_OCF_H2HC_FLOW_CONTROL 0x0031
1214 u_int8_t h2hc_flow; /* Host to Host controller flow control */
1215 } __attribute__ ((packed)) ng_hci_h2hc_flow_control_cp;
1217 typedef ng_hci_status_rp ng_hci_h2hc_flow_control_rp;
1219 #define NG_HCI_OCF_HOST_BUFFER_SIZE 0x0033
1221 u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */
1222 u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */
1223 u_int16_t num_acl_pkt; /* Max. number of ACL packets */
1224 u_int16_t num_sco_pkt; /* Max. number of SCO packets */
1225 } __attribute__ ((packed)) ng_hci_host_buffer_size_cp;
1227 typedef ng_hci_status_rp ng_hci_host_buffer_size_rp;
1229 #define NG_HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035
1231 u_int8_t num_con_handles; /* # of connection handles */
1232 /* these are repeated "num_con_handles" times
1233 u_int16_t con_handle; --- connection handle(s)
1234 u_int16_t compl_pkt; --- # of completed packets */
1235 } __attribute__ ((packed)) ng_hci_host_num_compl_pkts_cp;
1236 /* No return parameter(s) */
1238 #define NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO 0x0036
1240 u_int16_t con_handle; /* connection handle */
1241 } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_cp;
1244 u_int8_t status; /* 0x00 - success */
1245 u_int16_t con_handle; /* connection handle */
1246 u_int16_t timeout; /* Link supervision timeout * 0.625 msec */
1247 } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_rp;
1249 #define NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO 0x0037
1251 u_int16_t con_handle; /* connection handle */
1252 u_int16_t timeout; /* Link supervision timeout * 0.625 msec */
1253 } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_cp;
1256 u_int8_t status; /* 0x00 - success */
1257 u_int16_t con_handle; /* connection handle */
1258 } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_rp;
1260 #define NG_HCI_OCF_READ_SUPPORTED_IAC_NUM 0x0038
1261 /* No command parameter(s) */
1263 u_int8_t status; /* 0x00 - success */
1264 u_int8_t num_iac; /* # of supported IAC during scan */
1265 } __attribute__ ((packed)) ng_hci_read_supported_iac_num_rp;
1267 #define NG_HCI_OCF_READ_IAC_LAP 0x0039
1268 /* No command parameter(s) */
1270 u_int8_t status; /* 0x00 - success */
1271 u_int8_t num_iac; /* # of IAC */
1272 /* these are repeated "num_iac" times
1273 u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */
1274 } __attribute__ ((packed)) ng_hci_read_iac_lap_rp;
1276 #define NG_HCI_OCF_WRITE_IAC_LAP 0x003a
1278 u_int8_t num_iac; /* # of IAC */
1279 /* these are repeated "num_iac" times
1280 u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */
1281 } __attribute__ ((packed)) ng_hci_write_iac_lap_cp;
1283 typedef ng_hci_status_rp ng_hci_write_iac_lap_rp;
1285 /*0x003b-0x003e commands are depricated v2.0 or later*/
1286 #define NG_HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b
1287 /* No command parameter(s) */
1289 u_int8_t status; /* 0x00 - success */
1290 u_int8_t page_scan_period_mode; /* Page scan period mode */
1291 } __attribute__ ((packed)) ng_hci_read_page_scan_period_rp;
1293 #define NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c
1295 u_int8_t page_scan_period_mode; /* Page scan period mode */
1296 } __attribute__ ((packed)) ng_hci_write_page_scan_period_cp;
1298 typedef ng_hci_status_rp ng_hci_write_page_scan_period_rp;
1300 #define NG_HCI_OCF_READ_PAGE_SCAN 0x003d
1301 /* No command parameter(s) */
1303 u_int8_t status; /* 0x00 - success */
1304 u_int8_t page_scan_mode; /* Page scan mode */
1305 } __attribute__ ((packed)) ng_hci_read_page_scan_rp;
1307 #define NG_HCI_OCF_WRITE_PAGE_SCAN 0x003e
1309 u_int8_t page_scan_mode; /* Page scan mode */
1310 } __attribute__ ((packed)) ng_hci_write_page_scan_cp;
1312 typedef ng_hci_status_rp ng_hci_write_page_scan_rp;
1314 #define NG_HCI_OCF_READ_LE_HOST_SUPPORTED 0x6c
1316 u_int8_t status; /* 0x00 - success */
1317 u_int8_t le_supported_host ;/* LE host supported?*/
1318 u_int8_t simultaneous_le_host; /* BR/LE simulateneous? */
1319 } __attribute__ ((packed)) ng_hci_read_le_host_supported_rp;
1321 #define NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED 0x6d
1323 u_int8_t le_supported_host; /* LE host supported?*/
1324 u_int8_t simultaneous_le_host; /* LE host supported?*/
1325 } __attribute__ ((packed)) ng_hci_write_le_host_supported_cp;
1327 typedef ng_hci_status_rp ng_hci_write_le_host_supported_rp;
1329 /**************************************************************************
1330 **************************************************************************
1331 ** Informational commands and return parameters
1332 ** All commands in this category do not accept any parameters
1333 **************************************************************************
1334 **************************************************************************/
1336 #define NG_HCI_OGF_INFO 0x04 /* OpCode Group Field */
1338 #define NG_HCI_OCF_READ_LOCAL_VER 0x0001
1340 u_int8_t status; /* 0x00 - success */
1341 u_int8_t hci_version; /* HCI version */
1342 u_int16_t hci_revision; /* HCI revision */
1343 u_int8_t lmp_version; /* LMP version */
1344 u_int16_t manufacturer; /* Hardware manufacturer name */
1345 u_int16_t lmp_subversion; /* LMP sub-version */
1346 } __attribute__ ((packed)) ng_hci_read_local_ver_rp;
1348 #define NG_HCI_OCF_READ_LOCAL_COMMANDS 0x0002
1350 u_int8_t status; /* 0x00 - success */
1351 u_int8_t features[NG_HCI_COMMANDS_SIZE]; /* command bitmsk*/
1352 } __attribute__ ((packed)) ng_hci_read_local_commands_rp;
1354 #define NG_HCI_OCF_READ_LOCAL_FEATURES 0x0003
1356 u_int8_t status; /* 0x00 - success */
1357 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1358 } __attribute__ ((packed)) ng_hci_read_local_features_rp;
1360 #define NG_HCI_OCF_READ_BUFFER_SIZE 0x0005
1362 u_int8_t status; /* 0x00 - success */
1363 u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */
1364 u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */
1365 u_int16_t num_acl_pkt; /* Max. number of ACL packets */
1366 u_int16_t num_sco_pkt; /* Max. number of SCO packets */
1367 } __attribute__ ((packed)) ng_hci_read_buffer_size_rp;
1369 #define NG_HCI_OCF_READ_COUNTRY_CODE 0x0007
1371 u_int8_t status; /* 0x00 - success */
1372 u_int8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */
1373 } __attribute__ ((packed)) ng_hci_read_country_code_rp;
1375 #define NG_HCI_OCF_READ_BDADDR 0x0009
1377 u_int8_t status; /* 0x00 - success */
1378 bdaddr_t bdaddr; /* unit address */
1379 } __attribute__ ((packed)) ng_hci_read_bdaddr_rp;
1381 /**************************************************************************
1382 **************************************************************************
1383 ** Status commands and return parameters
1384 **************************************************************************
1385 **************************************************************************/
1387 #define NG_HCI_OGF_STATUS 0x05 /* OpCode Group Field */
1389 #define NG_HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001
1391 u_int16_t con_handle; /* connection handle */
1392 } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_cp;
1395 u_int8_t status; /* 0x00 - success */
1396 u_int16_t con_handle; /* connection handle */
1397 u_int16_t counter; /* number of consecutive failed contacts */
1398 } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_rp;
1400 #define NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002
1402 u_int16_t con_handle; /* connection handle */
1403 } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_cp;
1406 u_int8_t status; /* 0x00 - success */
1407 u_int16_t con_handle; /* connection handle */
1408 } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_rp;
1410 #define NG_HCI_OCF_GET_LINK_QUALITY 0x0003
1412 u_int16_t con_handle; /* connection handle */
1413 } __attribute__ ((packed)) ng_hci_get_link_quality_cp;
1416 u_int8_t status; /* 0x00 - success */
1417 u_int16_t con_handle; /* connection handle */
1418 u_int8_t quality; /* higher value means better quality */
1419 } __attribute__ ((packed)) ng_hci_get_link_quality_rp;
1421 #define NG_HCI_OCF_READ_RSSI 0x0005
1423 u_int16_t con_handle; /* connection handle */
1424 } __attribute__ ((packed)) ng_hci_read_rssi_cp;
1427 u_int8_t status; /* 0x00 - success */
1428 u_int16_t con_handle; /* connection handle */
1429 char rssi; /* -127 <= rssi <= 127 dB */
1430 } __attribute__ ((packed)) ng_hci_read_rssi_rp;
1432 /**************************************************************************
1433 **************************************************************************
1434 ** Testing commands and return parameters
1435 **************************************************************************
1436 **************************************************************************/
1438 #define NG_HCI_OGF_TESTING 0x06 /* OpCode Group Field */
1440 #define NG_HCI_OCF_READ_LOOPBACK_MODE 0x0001
1441 /* No command parameter(s) */
1443 u_int8_t status; /* 0x00 - success */
1444 u_int8_t lbmode; /* loopback mode */
1445 } __attribute__ ((packed)) ng_hci_read_loopback_mode_rp;
1447 #define NG_HCI_OCF_WRITE_LOOPBACK_MODE 0x0002
1449 u_int8_t lbmode; /* loopback mode */
1450 } __attribute__ ((packed)) ng_hci_write_loopback_mode_cp;
1452 typedef ng_hci_status_rp ng_hci_write_loopback_mode_rp;
1454 #define NG_HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003
1455 /* No command parameter(s) */
1456 typedef ng_hci_status_rp ng_hci_enable_unit_under_test_rp;
1458 /**************************************************************************
1459 **************************************************************************
1460 ** LE OpCode group field
1461 **************************************************************************
1462 **************************************************************************/
1464 #define NG_HCI_OGF_LE 0x08 /* OpCode Group Field */
1465 #define NG_HCI_OCF_LE_SET_EVENT_MASK 0x0001
1467 u_int8_t event_mask[NG_HCI_LE_EVENT_MASK_SIZE]; /* event_mask*/
1469 } __attribute__ ((packed)) ng_hci_le_set_event_mask_cp;
1470 typedef ng_hci_status_rp ng_hci_le_set_event_mask_rp;
1471 #define NG_HCI_LE_EVENT_MASK_ALL 0x1f
1473 #define NG_HCI_OCF_LE_READ_BUFFER_SIZE 0x0002
1474 /*No command parameter */
1476 u_int8_t status; /*status*/
1477 u_int16_t hc_le_data_packet_length;
1478 u_int8_t hc_total_num_le_data_packets;
1479 } __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp;
1482 #define NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003
1483 /*No command parameter */
1485 u_int8_t status; /*status*/
1486 u_int64_t le_features;
1487 } __attribute__ ((packed)) ng_hci_le_read_local_supported_features_rp;
1489 #define NG_HCI_OCF_LE_SET_RANDOM_ADDRESS 0x0005
1491 bdaddr_t random_address;
1492 } __attribute__ ((packed)) ng_hci_le_set_random_address_cp_;
1493 typedef ng_hci_status_rp ng_hci_le_set_random_address_rp;
1495 #define NG_HCI_OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006
1497 u_int16_t advertising_interval_min;
1498 u_int16_t advertising_interval_max;
1499 u_int8_t advertising_type;
1500 u_int8_t own_address_type;
1501 u_int8_t direct_address_type;
1502 bdaddr_t direct_address;
1503 u_int8_t advertising_channel_map;
1504 u_int8_t advertising_filter_policy;
1505 } __attribute__ ((packed)) ng_hci_le_set_advertising_parameters_cp;
1506 typedef ng_hci_status_rp ng_hci_le_set_advertising_parameters_rp;
1508 #define NG_HCI_OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007
1509 /*No command parameter*/
1512 u_int8_t transmit_power_level;
1513 } __attribute__ ((packed)) ng_hci_le_read_advertising_channel_tx_power_rp;
1515 #define NG_HCI_OCF_LE_SET_ADVERTISING_DATA 0x0008
1516 #define NG_HCI_ADVERTISING_DATA_SIZE 31
1518 u_int8_t advertising_data_length;
1519 char advertising_data[NG_HCI_ADVERTISING_DATA_SIZE];
1520 } __attribute__ ((packed)) ng_hci_le_set_advertising_data_cp;
1521 typedef ng_hci_status_rp ng_hci_le_set_advertising_data_rp;
1523 #define NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009
1526 u_int8_t scan_response_data_length;
1527 char scan_response_data[NG_HCI_ADVERTISING_DATA_SIZE];
1528 } __attribute__ ((packed)) ng_hci_le_set_scan_response_data_cp;
1529 typedef ng_hci_status_rp ng_hci_le_set_scan_response_data_rp;
1531 #define NG_HCI_OCF_LE_SET_ADVERTISE_ENABLE 0x000a
1533 u_int8_t advertising_enable;
1534 }__attribute__ ((packed)) ng_hci_le_set_advertise_enable_cp;
1535 typedef ng_hci_status_rp ng_hci_le_set_advertise_enable_rp;
1537 #define NG_HCI_OCF_LE_SET_SCAN_PARAMETERS 0x000b
1539 u_int8_t le_scan_type;
1540 u_int16_t le_scan_interval;
1541 u_int16_t le_scan_window;
1542 u_int8_t own_address_type;
1543 u_int8_t scanning_filter_policy;
1544 }__attribute__ ((packed)) ng_hci_le_set_scan_parameters_cp;
1545 typedef ng_hci_status_rp ng_hci_le_set_scan_parameters_rp;
1547 #define NG_HCI_OCF_LE_SET_SCAN_ENABLE 0x000c
1549 u_int8_t le_scan_enable;
1550 u_int8_t filter_duplicates;
1551 }__attribute__ ((packed)) ng_hci_le_set_scan_enable_cp;
1552 typedef ng_hci_status_rp ng_hci_le_set_scan_enable_rp;
1554 #define NG_HCI_OCF_LE_CREATE_CONNECTION 0x000d
1556 u_int16_t scan_interval;
1557 u_int16_t scan_window;
1558 u_int8_t filter_policy;
1559 u_int8_t peer_addr_type;
1561 u_int8_t own_address_type;
1562 u_int16_t conn_interval_min;
1563 u_int16_t conn_interval_max;
1564 u_int16_t conn_latency;
1565 u_int16_t supervision_timeout;
1566 u_int16_t min_ce_length;
1567 u_int16_t max_ce_length;
1568 }__attribute__((packed)) ng_hci_le_create_connection_cp;
1569 /* No return parameters. */
1570 #define NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL 0x000e
1571 /*No command parameter*/
1572 typedef ng_hci_status_rp ng_hci_le_create_connection_cancel_rp;
1573 #define NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE 0x000f
1574 /*No command parameter*/
1577 u_int8_t white_list_size;
1578 } __attribute__ ((packed)) ng_hci_le_read_white_list_size_rp;
1580 #define NG_HCI_OCF_LE_CLEAR_WHITE_LIST 0x0010
1581 /* No command parameters. */
1582 typedef ng_hci_status_rp ng_hci_le_clear_white_list_rp;
1583 #define NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
1585 u_int8_t address_type;
1587 } __attribute__ ((packed)) ng_hci_le_add_device_to_white_list_cp;
1588 typedef ng_hci_status_rp ng_hci_le_add_device_to_white_list_rp;
1590 #define NG_HCI_OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012
1592 u_int8_t address_type;
1594 } __attribute__ ((packed)) ng_hci_le_remove_device_from_white_list_cp;
1595 typedef ng_hci_status_rp ng_hci_le_remove_device_from_white_list_rp;
1597 #define NG_HCI_OCF_LE_CONNECTION_UPDATE 0x0013
1599 u_int16_t connection_handle;
1600 u_int16_t conn_interval_min;
1601 u_int16_t conn_interval_max;
1602 u_int16_t conn_latency;
1603 u_int16_t supervision_timeout;
1604 u_int16_t minimum_ce_length;
1605 u_int16_t maximum_ce_length;
1606 }__attribute__ ((packed)) ng_hci_le_connection_update_cp;
1607 /*no return parameter*/
1609 #define NG_HCI_OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014
1611 u_int8_t le_channel_map[5];
1612 }__attribute__ ((packed)) ng_hci_le_set_host_channel_classification_cp;
1613 typedef ng_hci_status_rp ng_hci_le_set_host_channel_classification_rp;
1615 #define NG_HCI_OCF_LE_READ_CHANNEL_MAP 0x0015
1617 u_int16_t connection_handle;
1618 }__attribute__ ((packed)) ng_hci_le_read_channel_map_cp;
1621 u_int16_t connection_handle;
1622 u_int8_t le_channel_map[5];
1623 } __attribute__ ((packed)) ng_hci_le_read_channel_map_rp;
1625 #define NG_HCI_OCF_LE_READ_REMOTE_USED_FEATURES 0x0016
1627 u_int16_t connection_handle;
1628 }__attribute__ ((packed)) ng_hci_le_read_remote_used_features_cp;
1629 /*No return parameter*/
1630 #define NG_HCI_128BIT 16
1631 #define NG_HCI_OCF_LE_ENCRYPT 0x0017
1633 u_int8_t key[NG_HCI_128BIT];
1634 u_int8_t plaintext_data[NG_HCI_128BIT];
1635 }__attribute__ ((packed)) ng_hci_le_encrypt_cp;
1638 u_int8_t plaintext_data[NG_HCI_128BIT];
1639 }__attribute__ ((packed)) ng_hci_le_encrypt_rp;
1641 #define NG_HCI_OCF_LE_RAND 0x0018
1642 /*No command parameter*/
1645 u_int64_t random_number;
1646 }__attribute__ ((packed)) ng_hci_le_rand_rp;
1648 #define NG_HCI_OCF_LE_START_ENCRYPTION 0x0019
1650 u_int16_t connection_handle;
1651 u_int64_t random_number;
1652 u_int16_t encrypted_diversifier;
1653 u_int8_t long_term_key[NG_HCI_128BIT];
1654 }__attribute__ ((packed)) ng_hci_le_start_encryption_cp;
1655 /*No return parameter*/
1656 #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY 0x001a
1658 u_int16_t connection_handle;
1659 u_int8_t long_term_key[NG_HCI_128BIT];
1660 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_cp;
1663 u_int16_t connection_handle;
1664 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_rp;
1666 #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY 0x001b
1668 u_int16_t connection_handle;
1669 }ng_hci_le_long_term_key_request_negative_reply_cp;
1672 u_int16_t connection_handle;
1673 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp;
1675 #define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2 0x0060
1676 /*No command parameter */
1679 u_int16_t hc_le_data_packet_length;
1680 u_int8_t hc_total_num_le_data_packets;
1681 u_int16_t hc_iso_data_packet_length;
1682 u_int8_t hc_total_num_iso_data_packets;
1683 } __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp_v2;
1685 #define NG_HCI_OCF_LE_READ_SUPPORTED_STATES 0x001c
1686 /*No command parameter*/
1689 u_int64_t le_states;
1690 }__attribute__ ((packed)) ng_hci_le_read_supported_states_rp;
1692 #define NG_HCI_OCF_LE_RECEIVER_TEST 0x001d
1694 u_int8_t rx_frequency;
1695 } __attribute__((packed)) ng_le_receiver_test_cp;
1696 typedef ng_hci_status_rp ng_hci_le_receiver_test_rp;
1698 #define NG_HCI_OCF_LE_TRANSMITTER_TEST 0x001e
1700 u_int8_t tx_frequency;
1701 u_int8_t length_of_test_data;
1702 u_int8_t packet_payload;
1703 } __attribute__((packed)) ng_le_transmitter_test_cp;
1704 typedef ng_hci_status_rp ng_hci_le_transmitter_test_rp;
1706 #define NG_HCI_OCF_LE_TEST_END 0x001f
1707 /* No command parameter. */
1710 u_int16_t number_of_packets;
1711 }__attribute__ ((packed)) ng_hci_le_test_end_rp;
1713 /**************************************************************************
1714 **************************************************************************
1715 ** Special HCI OpCode group field values
1716 **************************************************************************
1717 **************************************************************************/
1719 #define NG_HCI_OGF_BT_LOGO 0x3e
1721 #define NG_HCI_OGF_VENDOR 0x3f
1723 /**************************************************************************
1724 **************************************************************************
1725 ** Events and event parameters
1726 **************************************************************************
1727 **************************************************************************/
1729 #define NG_HCI_EVENT_INQUIRY_COMPL 0x01
1731 u_int8_t status; /* 0x00 - success */
1732 } __attribute__ ((packed)) ng_hci_inquiry_compl_ep;
1734 #define NG_HCI_EVENT_INQUIRY_RESULT 0x02
1736 u_int8_t num_responses; /* number of responses */
1737 /* ng_hci_inquiry_response[num_responses] -- see below */
1738 } __attribute__ ((packed)) ng_hci_inquiry_result_ep;
1741 bdaddr_t bdaddr; /* unit address */
1742 u_int8_t page_scan_rep_mode; /* page scan rep. mode */
1743 u_int8_t page_scan_period_mode; /* page scan period mode */
1744 u_int8_t page_scan_mode; /* page scan mode */
1745 u_int8_t uclass[NG_HCI_CLASS_SIZE];/* unit class */
1746 u_int16_t clock_offset; /* clock offset */
1747 } __attribute__ ((packed)) ng_hci_inquiry_response;
1749 #define NG_HCI_EVENT_CON_COMPL 0x03
1751 u_int8_t status; /* 0x00 - success */
1752 u_int16_t con_handle; /* Connection handle */
1753 bdaddr_t bdaddr; /* remote unit address */
1754 u_int8_t link_type; /* Link type */
1755 u_int8_t encryption_mode; /* Encryption mode */
1756 } __attribute__ ((packed)) ng_hci_con_compl_ep;
1758 #define NG_HCI_EVENT_CON_REQ 0x04
1760 bdaddr_t bdaddr; /* remote unit address */
1761 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* remote unit class */
1762 u_int8_t link_type; /* link type */
1763 } __attribute__ ((packed)) ng_hci_con_req_ep;
1765 #define NG_HCI_EVENT_DISCON_COMPL 0x05
1767 u_int8_t status; /* 0x00 - success */
1768 u_int16_t con_handle; /* connection handle */
1769 u_int8_t reason; /* reason to disconnect */
1770 } __attribute__ ((packed)) ng_hci_discon_compl_ep;
1772 #define NG_HCI_EVENT_AUTH_COMPL 0x06
1774 u_int8_t status; /* 0x00 - success */
1775 u_int16_t con_handle; /* connection handle */
1776 } __attribute__ ((packed)) ng_hci_auth_compl_ep;
1778 #define NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x7
1780 u_int8_t status; /* 0x00 - success */
1781 bdaddr_t bdaddr; /* remote unit address */
1782 char name[NG_HCI_UNIT_NAME_SIZE]; /* remote unit name */
1783 } __attribute__ ((packed)) ng_hci_remote_name_req_compl_ep;
1785 #define NG_HCI_EVENT_ENCRYPTION_CHANGE 0x08
1787 u_int8_t status; /* 0x00 - success */
1788 u_int16_t con_handle; /* Connection handle */
1789 u_int8_t encryption_enable; /* 0x00 - disable */
1790 } __attribute__ ((packed)) ng_hci_encryption_change_ep;
1792 #define NG_HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09
1794 u_int8_t status; /* 0x00 - success */
1795 u_int16_t con_handle; /* Connection handle */
1796 } __attribute__ ((packed)) ng_hci_change_con_link_key_compl_ep;
1798 #define NG_HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a
1800 u_int8_t status; /* 0x00 - success */
1801 u_int16_t con_handle; /* Connection handle */
1802 u_int8_t key_flag; /* Key flag */
1803 } __attribute__ ((packed)) ng_hci_master_link_key_compl_ep;
1805 #define NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b
1807 u_int8_t status; /* 0x00 - success */
1808 u_int16_t con_handle; /* Connection handle */
1809 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1810 } __attribute__ ((packed)) ng_hci_read_remote_features_compl_ep;
1812 #define NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c
1814 u_int8_t status; /* 0x00 - success */
1815 u_int16_t con_handle; /* Connection handle */
1816 u_int8_t lmp_version; /* LMP version */
1817 u_int16_t manufacturer; /* Hardware manufacturer name */
1818 u_int16_t lmp_subversion; /* LMP sub-version */
1819 } __attribute__ ((packed)) ng_hci_read_remote_ver_info_compl_ep;
1821 #define NG_HCI_EVENT_QOS_SETUP_COMPL 0x0d
1823 u_int8_t status; /* 0x00 - success */
1824 u_int16_t con_handle; /* connection handle */
1825 u_int8_t flags; /* reserved for future use */
1826 u_int8_t service_type; /* service type */
1827 u_int32_t token_rate; /* bytes per second */
1828 u_int32_t peak_bandwidth; /* bytes per second */
1829 u_int32_t latency; /* microseconds */
1830 u_int32_t delay_variation; /* microseconds */
1831 } __attribute__ ((packed)) ng_hci_qos_setup_compl_ep;
1833 #define NG_HCI_EVENT_COMMAND_COMPL 0x0e
1835 u_int8_t num_cmd_pkts; /* # of HCI command packets */
1836 u_int16_t opcode; /* command OpCode */
1837 /* command return parameters (if any) */
1838 } __attribute__ ((packed)) ng_hci_command_compl_ep;
1840 #define NG_HCI_EVENT_COMMAND_STATUS 0x0f
1842 u_int8_t status; /* 0x00 - pending */
1843 u_int8_t num_cmd_pkts; /* # of HCI command packets */
1844 u_int16_t opcode; /* command OpCode */
1845 } __attribute__ ((packed)) ng_hci_command_status_ep;
1847 #define NG_HCI_EVENT_HARDWARE_ERROR 0x10
1849 u_int8_t hardware_code; /* hardware error code */
1850 } __attribute__ ((packed)) ng_hci_hardware_error_ep;
1852 #define NG_HCI_EVENT_FLUSH_OCCUR 0x11
1854 u_int16_t con_handle; /* connection handle */
1855 } __attribute__ ((packed)) ng_hci_flush_occur_ep;
1857 #define NG_HCI_EVENT_ROLE_CHANGE 0x12
1859 u_int8_t status; /* 0x00 - success */
1860 bdaddr_t bdaddr; /* address of remote unit */
1861 u_int8_t role; /* new connection role */
1862 } __attribute__ ((packed)) ng_hci_role_change_ep;
1864 #define NG_HCI_EVENT_NUM_COMPL_PKTS 0x13
1866 u_int8_t num_con_handles; /* # of connection handles */
1867 /* these are repeated "num_con_handles" times
1868 u_int16_t con_handle; --- connection handle(s)
1869 u_int16_t compl_pkt; --- # of completed packets */
1870 } __attribute__ ((packed)) ng_hci_num_compl_pkts_ep;
1872 #define NG_HCI_EVENT_MODE_CHANGE 0x14
1874 u_int8_t status; /* 0x00 - success */
1875 u_int16_t con_handle; /* connection handle */
1876 u_int8_t unit_mode; /* remote unit mode */
1877 u_int16_t interval; /* interval * 0.625 msec */
1878 } __attribute__ ((packed)) ng_hci_mode_change_ep;
1880 #define NG_HCI_EVENT_RETURN_LINK_KEYS 0x15
1882 u_int8_t num_keys; /* # of keys */
1883 /* these are repeated "num_keys" times
1884 bdaddr_t bdaddr; --- remote address(es)
1885 u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */
1886 } __attribute__ ((packed)) ng_hci_return_link_keys_ep;
1888 #define NG_HCI_EVENT_PIN_CODE_REQ 0x16
1890 bdaddr_t bdaddr; /* remote unit address */
1891 } __attribute__ ((packed)) ng_hci_pin_code_req_ep;
1893 #define NG_HCI_EVENT_LINK_KEY_REQ 0x17
1895 bdaddr_t bdaddr; /* remote unit address */
1896 } __attribute__ ((packed)) ng_hci_link_key_req_ep;
1898 #define NG_HCI_EVENT_LINK_KEY_NOTIFICATION 0x18
1900 bdaddr_t bdaddr; /* remote unit address */
1901 u_int8_t key[NG_HCI_KEY_SIZE]; /* link key */
1902 u_int8_t key_type; /* type of the key */
1903 } __attribute__ ((packed)) ng_hci_link_key_notification_ep;
1905 #define NG_HCI_EVENT_LOOPBACK_COMMAND 0x19
1907 u_int8_t command[0]; /* Command packet */
1908 } __attribute__ ((packed)) ng_hci_loopback_command_ep;
1910 #define NG_HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a
1912 u_int8_t link_type; /* Link type */
1913 } __attribute__ ((packed)) ng_hci_data_buffer_overflow_ep;
1915 #define NG_HCI_EVENT_MAX_SLOT_CHANGE 0x1b
1917 u_int16_t con_handle; /* connection handle */
1918 u_int8_t lmp_max_slots; /* Max. # of slots allowed */
1919 } __attribute__ ((packed)) ng_hci_max_slot_change_ep;
1921 #define NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c
1923 u_int8_t status; /* 0x00 - success */
1924 u_int16_t con_handle; /* Connection handle */
1925 u_int16_t clock_offset; /* Clock offset */
1926 } __attribute__ ((packed)) ng_hci_read_clock_offset_compl_ep;
1928 #define NG_HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d
1930 u_int8_t status; /* 0x00 - success */
1931 u_int16_t con_handle; /* connection handle */
1932 u_int16_t pkt_type; /* packet type */
1933 } __attribute__ ((packed)) ng_hci_con_pkt_type_changed_ep;
1935 #define NG_HCI_EVENT_QOS_VIOLATION 0x1e
1937 u_int16_t con_handle; /* connection handle */
1938 } __attribute__ ((packed)) ng_hci_qos_violation_ep;
1940 #define NG_HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f
1942 bdaddr_t bdaddr; /* destination address */
1943 u_int8_t page_scan_mode; /* page scan mode */
1944 } __attribute__ ((packed)) ng_hci_page_scan_mode_change_ep;
1946 #define NG_HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20
1948 bdaddr_t bdaddr; /* destination address */
1949 u_int8_t page_scan_rep_mode; /* page scan repetition mode */
1950 } __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep;
1951 #define NG_HCI_EVENT_LE 0x3e
1953 u_int8_t subevent_code;
1954 }__attribute__ ((packed)) ng_hci_le_ep;
1956 #define NG_HCI_LEEV_CON_COMPL 0x01
1962 u_int8_t address_type;
1966 u_int16_t supervision_timeout;
1967 u_int8_t master_clock_accuracy;
1969 } __attribute__ ((packed)) ng_hci_le_connection_complete_ep;
1971 #define NG_HCI_LEEV_ADVREP 0x02
1973 u_int8_t num_reports;
1975 }__attribute__ ((packed)) ng_hci_le_advertising_report_ep;
1976 #define NG_HCI_SCAN_RESPONSE_DATA_MAX 0x1f
1979 u_int8_t event_type;
1982 u_int8_t length_data;
1983 /* The last octet is for RSSI */
1984 u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX+1];
1985 }__attribute__((packed)) ng_hci_le_advreport;
1987 #define NG_HCI_LEEV_CON_UPDATE_COMPL 0x03
1990 u_int16_t connection_handle;
1991 u_int16_t conn_interval;
1992 u_int16_t conn_latency;
1993 u_int16_t supervision_timeout;
1994 }__attribute__((packed)) ng_hci_connection_update_complete_ep;
1995 #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04
1997 #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05
2001 #define NG_HCI_EVENT_BT_LOGO 0xfe
2003 #define NG_HCI_EVENT_VENDOR 0xff
2005 #endif /* ndef _NETGRAPH_HCI_H_ */