Path: blob/main/sys/netgraph/bluetooth/include/ng_hci.h
34814 views
/*1* ng_hci.h2*/34/*-5* SPDX-License-Identifier: BSD-2-Clause6*7* Copyright (c) 2001 Maksim Yevmenkin <[email protected]>8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions and the following disclaimer.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18*19* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND20* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE21* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE22* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE23* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL24* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS25* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT27* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY28* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF29* SUCH DAMAGE.30*31* $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $32*/3334/*35* This file contains everything that application needs to know about36* Host Controller Interface (HCI). All information was obtained from37* Bluetooth Specification Book v1.1.38*39* This file can be included by both kernel and userland applications.40*41* NOTE: Here and after Bluetooth device is called a "unit". Bluetooth42* specification refers to both devices and units. They are the43* same thing (i think), so to be consistent word "unit" will be44* used.45*/4647#ifndef _NETGRAPH_HCI_H_48#define _NETGRAPH_HCI_H_4950/**************************************************************************51**************************************************************************52** Netgraph node hook name, type name and type cookie and commands53**************************************************************************54**************************************************************************/5556/* Node type name and type cookie */57#define NG_HCI_NODE_TYPE "hci"58#define NGM_HCI_COOKIE 10007741845960/* Netgraph node hook names */61#define NG_HCI_HOOK_DRV "drv" /* Driver <-> HCI */62#define NG_HCI_HOOK_ACL "acl" /* HCI <-> Upper */63#define NG_HCI_HOOK_SCO "sco" /* HCI <-> Upper */64#define NG_HCI_HOOK_RAW "raw" /* HCI <-> Upper */6566/**************************************************************************67**************************************************************************68** Common defines and types (HCI)69**************************************************************************70**************************************************************************/7172/* All sizes are in bytes */73#define NG_HCI_BDADDR_SIZE 6 /* unit address */74#define NG_HCI_LAP_SIZE 3 /* unit LAP */75#define NG_HCI_KEY_SIZE 16 /* link key */76#define NG_HCI_PIN_SIZE 16 /* link PIN */77#define NG_HCI_EVENT_MASK_SIZE 8 /* event mask */78#define NG_HCI_LE_EVENT_MASK_SIZE 8 /* event mask */79#define NG_HCI_CLASS_SIZE 3 /* unit class */80#define NG_HCI_FEATURES_SIZE 8 /* LMP features */81#define NG_HCI_UNIT_NAME_SIZE 248 /* unit name size */82#define NG_HCI_COMMANDS_SIZE 64 /*Command list BMP size*/83#define NG_HCI_EXTINQ_MAX 240 /**/84/* HCI specification */85#define NG_HCI_SPEC_V10 0x00 /* v1.0 */86#define NG_HCI_SPEC_V11 0x01 /* v1.1 */87/* 0x02 - 0xFF - reserved for future use */8889/* LMP features */90/* ------------------- byte 0 --------------------*/91#define NG_HCI_LMP_3SLOT 0x0192#define NG_HCI_LMP_5SLOT 0x0293#define NG_HCI_LMP_ENCRYPTION 0x0494#define NG_HCI_LMP_SLOT_OFFSET 0x0895#define NG_HCI_LMP_TIMING_ACCURACY 0x1096#define NG_HCI_LMP_SWITCH 0x2097#define NG_HCI_LMP_HOLD_MODE 0x4098#define NG_HCI_LMP_SNIFF_MODE 0x8099/* ------------------- byte 1 --------------------*/100#define NG_HCI_LMP_PARK_MODE 0x01101#define NG_HCI_LMP_RSSI 0x02102#define NG_HCI_LMP_CHANNEL_QUALITY 0x04103#define NG_HCI_LMP_SCO_LINK 0x08104#define NG_HCI_LMP_HV2_PKT 0x10105#define NG_HCI_LMP_HV3_PKT 0x20106#define NG_HCI_LMP_ULAW_LOG 0x40107#define NG_HCI_LMP_ALAW_LOG 0x80108/* ------------------- byte 2 --------------------*/109#define NG_HCI_LMP_CVSD 0x01110#define NG_HCI_LMP_PAGING_SCHEME 0x02111#define NG_HCI_LMP_POWER_CONTROL 0x04112#define NG_HCI_LMP_TRANSPARENT_SCO 0x08113#define NG_HCI_LMP_FLOW_CONTROL_LAG0 0x10114#define NG_HCI_LMP_FLOW_CONTROL_LAG1 0x20115#define NG_HCI_LMP_FLOW_CONTROL_LAG2 0x40116/* ------------------- byte 6 --------------------*/117#define NG_HCI_LMP_SECURE_SIMPLE_PAIRING 0x08118119/* Link types */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 */125126/* Packet types */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 */139140/*141* Connection modes/Unit modes142*143* This is confusing. It means that one of the units change its mode144* for the specific connection. For example one connection was put on145* hold (but i could be wrong :)146*/147148#define NG_HCI_UNIT_MODE_ACTIVE 0x00149#define NG_HCI_UNIT_MODE_HOLD 0x01150#define NG_HCI_UNIT_MODE_SNIFF 0x02151#define NG_HCI_UNIT_MODE_PARK 0x03152/* 0x04 - 0xFF - reserved for future use */153154/* Page scan modes */155#define NG_HCI_MANDATORY_PAGE_SCAN_MODE 0x00156#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01157#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02158#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03159/* 0x04 - 0xFF - reserved for future use */160161/* Page scan repetition modes */162#define NG_HCI_SCAN_REP_MODE0 0x00163#define NG_HCI_SCAN_REP_MODE1 0x01164#define NG_HCI_SCAN_REP_MODE2 0x02165/* 0x03 - 0xFF - reserved for future use */166167/* Page scan period modes */168#define NG_HCI_PAGE_SCAN_PERIOD_MODE0 0x00169#define NG_HCI_PAGE_SCAN_PERIOD_MODE1 0x01170#define NG_HCI_PAGE_SCAN_PERIOD_MODE2 0x02171/* 0x03 - 0xFF - reserved for future use */172173/* Scan enable */174#define NG_HCI_NO_SCAN_ENABLE 0x00175#define NG_HCI_INQUIRY_ENABLE_PAGE_DISABLE 0x01176#define NG_HCI_INQUIRY_DISABLE_PAGE_ENABLE 0x02177#define NG_HCI_INQUIRY_ENABLE_PAGE_ENABLE 0x03178/* 0x04 - 0xFF - reserved for future use */179180/* Hold mode activities */181#define NG_HCI_HOLD_MODE_NO_CHANGE 0x00182#define NG_HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01183#define NG_HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02184#define NG_HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04185/* 0x08 - 0x80 - reserved for future use */186187/* Connection roles */188#define NG_HCI_ROLE_MASTER 0x00189#define NG_HCI_ROLE_SLAVE 0x01190/* 0x02 - 0xFF - reserved for future use */191192/* Key flags */193#define NG_HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00194#define NG_HCI_USE_TEMPORARY_LINK_KEY 0x01195/* 0x02 - 0xFF - reserved for future use */196197/* Pin types */198#define NG_HCI_PIN_TYPE_VARIABLE 0x00199#define NG_HCI_PIN_TYPE_FIXED 0x01200201/* Link key types */202#define NG_HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00203#define NG_HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01204#define NG_HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02205/* 0x03 - 0xFF - reserved for future use */206207/* Encryption modes */208#define NG_HCI_ENCRYPTION_MODE_NONE 0x00209#define NG_HCI_ENCRYPTION_MODE_P2P 0x01210#define NG_HCI_ENCRYPTION_MODE_ALL 0x02211/* 0x03 - 0xFF - reserved for future use */212213/* Quality of service types */214#define NG_HCI_SERVICE_TYPE_NO_TRAFFIC 0x00215#define NG_HCI_SERVICE_TYPE_BEST_EFFORT 0x01216#define NG_HCI_SERVICE_TYPE_GUARANTEED 0x02217/* 0x03 - 0xFF - reserved for future use */218219/* Link policy settings */220#define NG_HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000221#define NG_HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */222#define NG_HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002223#define NG_HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004224#define NG_HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008225/* 0x0010 - 0x8000 - reserved for future use */226227/* Event masks */228#define NG_HCI_EVMSK_DEFAULT 0x00001fffffffffff229#define NG_HCI_EVMSK_ALL 0x1fffffffffffffff230#define NG_HCI_EVMSK_NONE 0x0000000000000000231#define NG_HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001232#define NG_HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002233#define NG_HCI_EVMSK_CON_COMPL 0x0000000000000004234#define NG_HCI_EVMSK_CON_REQ 0x0000000000000008235#define NG_HCI_EVMSK_DISCON_COMPL 0x0000000000000010236#define NG_HCI_EVMSK_AUTH_COMPL 0x0000000000000020237#define NG_HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040238#define NG_HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080239#define NG_HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100240#define NG_HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200241#define NG_HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400242#define NG_HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800243#define NG_HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000244#define NG_HCI_EVMSK_COMMAND_COMPL 0x0000000000002000245#define NG_HCI_EVMSK_COMMAND_STATUS 0x0000000000004000246#define NG_HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000247#define NG_HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000248#define NG_HCI_EVMSK_ROLE_CHANGE 0x0000000000020000249#define NG_HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000250#define NG_HCI_EVMSK_MODE_CHANGE 0x0000000000080000251#define NG_HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000252#define NG_HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000253#define NG_HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000254#define NG_HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000255#define NG_HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000256#define NG_HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000257#define NG_HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000258#define NG_HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000259#define NG_HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000260#define NG_HCI_EVMSK_QOS_VIOLATION 0x0000000020000000261#define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000262#define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000263#define NG_HCI_EVMSK_FLOW_SPEC_COMPL 0x0000000100000000264#define NG_HCI_EVMSK_INQUIRY_RESULT_W_RSSI 0x0000000200000000265#define NG_HCI_EVMSK_READ_REM_EXT_FEAT_COMPL 0x0000000400000000266267/* 0x0000000800000000 - 0x0000080000000000 - not in use */268269#define NG_HCI_EVMSK_SYNC_CONN_COMPL 0x0000100000000000270#define NG_HCI_EVMSK_SYNC_CONN_CHANGED 0x0000200000000000271#define NG_HCI_EVMSK_SNIFF_SUBRATING 0x0000400000000000272#define NG_HCI_EVMSK_EXT_INQUIRY_RESULT 0x0000800000000000273#define NG_HCI_EVMSK_ENC_KEY_REFRESH_COMPL 0x0001000000000000274#define NG_HCI_EVMSK_IO_CAPABILITY_REQ 0x0002000000000000275#define NG_HCI_EVMSK_IO_CAPABILITY_RESP 0x0004000000000000276#define NG_HCI_EVMSK_USER_CONFIRMATION_REQ 0x0008000000000000277#define NG_HCI_EVMSK_USER_PASSKEY_REQ 0x0010000000000000278#define NG_HCI_EVMSK_REM_OOB_DATA_REQ 0x0020000000000000279#define NG_HCI_EVMSK_SIMPLE_PAIRING_COMPL 0x0040000000000000280#define NG_HCI_EVMSK_LINK_SUPERV_TO_CHANGED 0x0080000000000000281#define NG_HCI_EVMSK_ENH_FLUSH_COMPL 0x0100000000000000282#define NG_HCI_EVMSK_USER_PASSKEY_NOTIFICATION 0x0200000000000000283#define NG_HCI_EVMSK_KEYPRESS_NOTIFICATION 0x0400000000000000284#define NG_HCI_EVMSK_REM_HOST_SUPP_FEAT_NOTIFI 0x0800000000000000285#define NG_HCI_EVMSK_LE_META 0x1000000000000000286/* 0x1000000100000000 - 0x8000000000000000 - reserved for future use */287288/* LE events masks*/289#define NG_HCI_LEEVMSK_ALL 0x000000003fffffff290#define NG_HCI_LEEVMSK_NONE 0x0000000000000000291#define NG_HCI_LEEVMSK_DEFAULT 0x000000000000001f292#define NG_HCI_LEEVMSK_CONN_COMPLETE 0x0000000000000001293#define NG_HCI_LEEVMSK_ADV_REP 0x0000000000000002294#define NG_HCI_LEEVMSK_CONN_UPDATE 0x0000000000000004295#define NG_HCI_LEEVMSK_READ_REM_FEAT_REQ 0x0000000000000008296#define NG_HCI_LEEVMSK_LONG_TERM_KEY_REQ 0x0000000000000010297#define NG_HCI_LEEVMSK_REM_CONN_PARAM_REQ 0x0000000000000020298#define NG_HCI_LEEVMSK_DATA_LENGTH_CHG 0x0000000000000040299#define NG_HCI_LEEVMSK_RD_LOC_P256_PK_COMPL 0x0000000000000080300#define NG_HCI_LEEVMSK_GEN_DHKEY_COMPL 0x0000000000000100301#define NG_HCI_LEEVMSK_ENH_CONN_COMPL 0x0000000000000200302#define NG_HCI_LEEVMSK_DIR_ADV_REP 0x0000000000000400303#define NG_HCI_LEEVMSK_PHY_UPD_COMPL 0x0000000000000800304#define NG_HCI_LEEVMSK_EXT_ADV_REP 0x0000000000001000305#define NG_HCI_LEEVMSK_PER_ADV_SYNC_EST 0x0000000000002000306#define NG_HCI_LEEVMSK_PER_ADV_REP 0x0000000000004000307#define NG_HCI_LEEVMSK_PER_ADV_SYNC_LOST 0x0000000000008000308#define NG_HCI_LEEVMSK_SCAN_TIMEOUT 0x0000000000010000309#define NG_HCI_LEEVMSK_ADV_SET_TERM 0x0000000000020000310#define NG_HCI_LEEVMSK_SCAN_REQ_RCVD 0x0000000000040000311#define NG_HCI_LEEVMSK_CHAN_SEL_ALGO 0x0000000000080000312#define NG_HCI_LEEVMSK_CONNLESS_IQ_REP 0x0000000000010000313#define NG_HCI_LEEVMSK_CONN_IQ_REP 0x0000000000020000314#define NG_HCI_LEEVMSK_CTE_REQ_FAILED 0x0000000000040000315#define NG_HCI_LEEVMSK_PER_ADV_SYN_TRF_RCVD 0x0000000000080000316#define NG_HCI_LEEVMSK_CIS_EST 0x0000000000100000317#define NG_HCI_LEEVMSK_CIS_REQ 0x0000000000200000318#define NG_HCI_LEEVMSK_CREATE_BIG_COMPL 0x0000000000400000319#define NG_HCI_LEEVMSK_TERM_BIG_COMPL 0x0000000000800000320#define NG_HCI_LEEVMSK_BIG_SYNC_EST 0x0000000001000000321#define NG_HCI_LEEVMSK_BIG_SYNC_LOST 0x0000000002000000322#define NG_HCI_LEEVMSK_REQ_PEER_SCA_COMPL 0x0000000004000000323#define NG_HCI_LEEVMSK_PATH_LOSS_THRESHOLD 0x0000000008000000324#define NG_HCI_LEEVMSK_TX_PWR_REP 0x0000000010000000325#define NG_HCI_LEEVMSK_BIGINFO_ADV_REP 0x0000000020000000326/* 0x0000000040000000 - 0x8000000000000000 - reserved for future use */327328/* Filter types */329#define NG_HCI_FILTER_TYPE_NONE 0x00330#define NG_HCI_FILTER_TYPE_INQUIRY_RESULT 0x01331#define NG_HCI_FILTER_TYPE_CON_SETUP 0x02332/* 0x03 - 0xFF - reserved for future use */333334/* Filter condition types for NG_HCI_FILTER_TYPE_INQUIRY_RESULT */335#define NG_HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00336#define NG_HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01337#define NG_HCI_FILTER_COND_INQUIRY_BDADDR 0x02338/* 0x03 - 0xFF - reserved for future use */339340/* Filter condition types for NG_HCI_FILTER_TYPE_CON_SETUP */341#define NG_HCI_FILTER_COND_CON_ANY_UNIT 0x00342#define NG_HCI_FILTER_COND_CON_UNIT_CLASS 0x01343#define NG_HCI_FILTER_COND_CON_BDADDR 0x02344/* 0x03 - 0xFF - reserved for future use */345346/* Xmit level types */347#define NG_HCI_XMIT_LEVEL_CURRENT 0x00348#define NG_HCI_XMIT_LEVEL_MAXIMUM 0x01349/* 0x02 - 0xFF - reserved for future use */350351/* Host to Host Controller flow control */352#define NG_HCI_H2HC_FLOW_CONTROL_NONE 0x00353#define NG_HCI_H2HC_FLOW_CONTROL_ACL 0x01354#define NG_HCI_H2HC_FLOW_CONTROL_SCO 0x02355#define NG_HCI_H2HC_FLOW_CONTROL_BOTH 0x03 /* ACL and SCO */356/* 0x04 - 0xFF - reserved future use */357358/* Country codes */359#define NG_HCI_COUNTRY_CODE_NAM_EUR_JP 0x00360#define NG_HCI_COUNTRY_CODE_FRANCE 0x01361/* 0x02 - 0xFF - reserved future use */362363/* Loopback modes */364#define NG_HCI_LOOPBACK_NONE 0x00365#define NG_HCI_LOOPBACK_LOCAL 0x01366#define NG_HCI_LOOPBACK_REMOTE 0x02367/* 0x03 - 0xFF - reserved future use */368369/**************************************************************************370**************************************************************************371** Link level defines, headers and types372**************************************************************************373**************************************************************************/374375/*376* Macro(s) to combine OpCode and extract OGF (OpCode Group Field)377* and OCF (OpCode Command Field) from OpCode.378*/379380#define NG_HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))381#define NG_HCI_OCF(op) ((op) & 0x3ff)382#define NG_HCI_OGF(op) (((op) >> 10) & 0x3f)383384/*385* Marco(s) to extract/combine connection handle, BC (Broadcast) and386* PB (Packet boundary) flags.387*/388389#define NG_HCI_CON_HANDLE(h) ((h) & 0x0fff)390#define NG_HCI_PB_FLAG(h) (((h) & 0x3000) >> 12)391#define NG_HCI_BC_FLAG(h) (((h) & 0xc000) >> 14)392#define NG_HCI_MK_CON_HANDLE(h, pb, bc) \393(((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))394395/* PB flag values */396#define NG_HCI_LE_PACKET_START 0x0397#define NG_HCI_PACKET_FRAGMENT 0x1398#define NG_HCI_PACKET_START 0x2399/* 11 for AMP packet, not supported */400401/* BC flag values */402#define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */403#define NG_HCI_BROADCAST_ACTIVE 0x1 /* both directions */404#define NG_HCI_BROADCAST_PICONET 0x2 /* both directions */405/* 11 - reserved for future use */406407/* HCI command packet header */408#define NG_HCI_CMD_PKT 0x01409#define NG_HCI_CMD_PKT_SIZE 0xff /* without header */410typedef struct {411u_int8_t type; /* MUST be 0x1 */412u_int16_t opcode; /* OpCode */413u_int8_t length; /* parameter(s) length in bytes */414} __attribute__ ((packed)) ng_hci_cmd_pkt_t;415416/* ACL data packet header */417#define NG_HCI_ACL_DATA_PKT 0x02418#define NG_HCI_ACL_PKT_SIZE 0xffff /* without header */419typedef struct {420u_int8_t type; /* MUST be 0x2 */421u_int16_t con_handle; /* connection handle + PB + BC flags */422u_int16_t length; /* payload length in bytes */423} __attribute__ ((packed)) ng_hci_acldata_pkt_t;424425/* SCO data packet header */426#define NG_HCI_SCO_DATA_PKT 0x03427#define NG_HCI_SCO_PKT_SIZE 0xff /* without header */428typedef struct {429u_int8_t type; /* MUST be 0x3 */430u_int16_t con_handle; /* connection handle + reserved bits */431u_int8_t length; /* payload length in bytes */432} __attribute__ ((packed)) ng_hci_scodata_pkt_t;433434/* HCI event packet header */435#define NG_HCI_EVENT_PKT 0x04436#define NG_HCI_EVENT_PKT_SIZE 0xff /* without header */437typedef struct {438u_int8_t type; /* MUST be 0x4 */439u_int8_t event; /* event */440u_int8_t length; /* parameter(s) length in bytes */441} __attribute__ ((packed)) ng_hci_event_pkt_t;442443/* Bluetooth unit address */444typedef struct {445u_int8_t b[NG_HCI_BDADDR_SIZE];446} __attribute__ ((packed)) bdaddr_t;447typedef bdaddr_t * bdaddr_p;448449/* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */450#define NG_HCI_BDADDR_ANY ((bdaddr_p) "\000\000\000\000\000\000")451452/* HCI status return parameter */453typedef struct {454u_int8_t status; /* 0x00 - success */455} __attribute__ ((packed)) ng_hci_status_rp;456457/**************************************************************************458**************************************************************************459** Upper layer protocol interface. LP_xxx event parameters460**************************************************************************461**************************************************************************/462463/* Connection Request Event */464#define NGM_HCI_LP_CON_REQ 1 /* Upper -> HCI */465typedef struct {466u_int16_t link_type; /* type of connection */467bdaddr_t bdaddr; /* remote unit address */468} ng_hci_lp_con_req_ep;469470/*471* XXX XXX XXX472*473* NOTE: This request is not defined by Bluetooth specification,474* but i find it useful :)475*/476#define NGM_HCI_LP_DISCON_REQ 2 /* Upper -> HCI */477typedef struct {478u_int16_t con_handle; /* connection handle */479u_int16_t reason; /* reason to disconnect (only low byte) */480} ng_hci_lp_discon_req_ep;481482/* Connection Confirmation Event */483#define NGM_HCI_LP_CON_CFM 3 /* HCI -> Upper */484typedef struct {485u_int8_t status; /* 0x00 - success */486u_int8_t link_type; /* link type */487u_int16_t con_handle; /* con_handle */488bdaddr_t bdaddr; /* remote unit address */489} ng_hci_lp_con_cfm_ep;490491/* Connection Indication Event */492#define NGM_HCI_LP_CON_IND 4 /* HCI -> Upper */493typedef struct {494u_int8_t link_type; /* link type */495u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */496bdaddr_t bdaddr; /* remote unit address */497} ng_hci_lp_con_ind_ep;498499/* Connection Response Event */500#define NGM_HCI_LP_CON_RSP 5 /* Upper -> HCI */501typedef struct {502u_int8_t status; /* 0x00 - accept connection */503u_int8_t link_type; /* link type */504bdaddr_t bdaddr; /* remote unit address */505} ng_hci_lp_con_rsp_ep;506507/* Disconnection Indication Event */508#define NGM_HCI_LP_DISCON_IND 6 /* HCI -> Upper */509typedef struct {510u_int8_t reason; /* reason to disconnect (only low byte) */511u_int8_t link_type; /* link type */512u_int16_t con_handle; /* connection handle */513} ng_hci_lp_discon_ind_ep;514515/* QoS Setup Request Event */516#define NGM_HCI_LP_QOS_REQ 7 /* Upper -> HCI */517typedef struct {518u_int16_t con_handle; /* connection handle */519u_int8_t flags; /* reserved */520u_int8_t service_type; /* service type */521u_int32_t token_rate; /* bytes/sec */522u_int32_t peak_bandwidth; /* bytes/sec */523u_int32_t latency; /* msec */524u_int32_t delay_variation; /* msec */525} ng_hci_lp_qos_req_ep;526527/* QoS Conformition Event */528#define NGM_HCI_LP_QOS_CFM 8 /* HCI -> Upper */529typedef struct {530u_int16_t status; /* 0x00 - success (only low byte) */531u_int16_t con_handle; /* connection handle */532} ng_hci_lp_qos_cfm_ep;533534/* QoS Violation Indication Event */535#define NGM_HCI_LP_QOS_IND 9 /* HCI -> Upper */536typedef struct {537u_int16_t con_handle; /* connection handle */538} ng_hci_lp_qos_ind_ep;539/*Encryption Change event*/540#define NGM_HCI_LP_ENC_CHG 10 /* HCI->Upper*/541typedef struct {542uint16_t con_handle;543uint8_t status;544uint8_t link_type;545}ng_hci_lp_enc_change_ep;546/**************************************************************************547**************************************************************************548** HCI node command/event parameters549**************************************************************************550**************************************************************************/551552/* Debug levels */553#define NG_HCI_ALERT_LEVEL 1554#define NG_HCI_ERR_LEVEL 2555#define NG_HCI_WARN_LEVEL 3556#define NG_HCI_INFO_LEVEL 4557558/* Unit states */559#define NG_HCI_UNIT_CONNECTED (1 << 0)560#define NG_HCI_UNIT_INITED (1 << 1)561#define NG_HCI_UNIT_READY (NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED)562#define NG_HCI_UNIT_COMMAND_PENDING (1 << 2)563564/* Connection state */565#define NG_HCI_CON_CLOSED 0 /* connection closed */566#define NG_HCI_CON_W4_LP_CON_RSP 1 /* wait for LP_ConnectRsp */567#define NG_HCI_CON_W4_CONN_COMPLETE 2 /* wait for Connection_Complete evt */568#define NG_HCI_CON_OPEN 3 /* connection open */569570/* Get HCI node (unit) state (see states above) */571#define NGM_HCI_NODE_GET_STATE 100 /* HCI -> User */572typedef u_int16_t ng_hci_node_state_ep;573574/* Turn on "inited" bit */575#define NGM_HCI_NODE_INIT 101 /* User -> HCI */576/* No parameters */577578/* Get/Set node debug level (see debug levels above) */579#define NGM_HCI_NODE_GET_DEBUG 102 /* HCI -> User */580#define NGM_HCI_NODE_SET_DEBUG 103 /* User -> HCI */581typedef u_int16_t ng_hci_node_debug_ep;582583/* Get node buffer info */584#define NGM_HCI_NODE_GET_BUFFER 104 /* HCI -> User */585typedef struct {586u_int8_t cmd_free; /* number of free command packets */587u_int8_t sco_size; /* max. size of SCO packet */588u_int16_t sco_pkts; /* number of SCO packets */589u_int16_t sco_free; /* number of free SCO packets */590u_int16_t acl_size; /* max. size of ACL packet */591u_int16_t acl_pkts; /* number of ACL packets */592u_int16_t acl_free; /* number of free ACL packets */593} ng_hci_node_buffer_ep;594595/* Get BDADDR */596#define NGM_HCI_NODE_GET_BDADDR 105 /* HCI -> User */597/* bdaddr_t -- BDADDR */598599/* Get features */600#define NGM_HCI_NODE_GET_FEATURES 106 /* HCI -> User */601/* features[NG_HCI_FEATURES_SIZE] -- features */602603#define NGM_HCI_NODE_GET_STAT 107 /* HCI -> User */604typedef struct {605u_int32_t cmd_sent; /* number of HCI commands sent */606u_int32_t evnt_recv; /* number of HCI events received */607u_int32_t acl_recv; /* number of ACL packets received */608u_int32_t acl_sent; /* number of ACL packets sent */609u_int32_t sco_recv; /* number of SCO packets received */610u_int32_t sco_sent; /* number of SCO packets sent */611u_int32_t bytes_recv; /* total number of bytes received */612u_int32_t bytes_sent; /* total number of bytes sent */613} ng_hci_node_stat_ep;614615#define NGM_HCI_NODE_RESET_STAT 108 /* User -> HCI */616/* No parameters */617618#define NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE 109 /* User -> HCI */619620#define NGM_HCI_NODE_GET_NEIGHBOR_CACHE 110 /* HCI -> User */621typedef struct {622u_int32_t num_entries; /* number of entries */623} ng_hci_node_get_neighbor_cache_ep;624625typedef struct {626u_int16_t page_scan_rep_mode; /* page rep scan mode */627u_int16_t page_scan_mode; /* page scan mode */628u_int16_t clock_offset; /* clock offset */629bdaddr_t bdaddr; /* bdaddr */630u_int8_t features[NG_HCI_FEATURES_SIZE]; /* features */631uint8_t addrtype;632uint8_t extinq_size; /* MAX 240*/633uint8_t extinq_data[NG_HCI_EXTINQ_MAX];634} ng_hci_node_neighbor_cache_entry_ep;635636#define NG_HCI_MAX_NEIGHBOR_NUM \637((0xffff - sizeof(ng_hci_node_get_neighbor_cache_ep))/sizeof(ng_hci_node_neighbor_cache_entry_ep))638639#define NGM_HCI_NODE_GET_CON_LIST 111 /* HCI -> User */640typedef struct {641u_int32_t num_connections; /* number of connections */642} ng_hci_node_con_list_ep;643644typedef struct {645u_int8_t link_type; /* ACL or SCO */646u_int8_t encryption_mode; /* none, p2p, ... */647u_int8_t mode; /* ACTIVE, HOLD ... */648u_int8_t role; /* MASTER/SLAVE */649u_int16_t state; /* connection state */650u_int16_t reserved; /* place holder */651u_int16_t pending; /* number of pending packets */652u_int16_t queue_len; /* number of packets in queue */653u_int16_t con_handle; /* connection handle */654bdaddr_t bdaddr; /* remote bdaddr */655} ng_hci_node_con_ep;656657#define NG_HCI_MAX_CON_NUM \658((0xffff - sizeof(ng_hci_node_con_list_ep))/sizeof(ng_hci_node_con_ep))659660#define NGM_HCI_NODE_UP 112 /* HCI -> Upper */661typedef struct {662u_int16_t pkt_size; /* max. ACL/SCO packet size (w/out header) */663u_int16_t num_pkts; /* ACL/SCO packet queue size */664u_int16_t reserved; /* place holder */665bdaddr_t bdaddr; /* bdaddr */666} ng_hci_node_up_ep;667668#define NGM_HCI_SYNC_CON_QUEUE 113 /* HCI -> Upper */669typedef struct {670u_int16_t con_handle; /* connection handle */671u_int16_t completed; /* number of completed packets */672} ng_hci_sync_con_queue_ep;673674#define NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK 114 /* HCI -> User */675#define NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK 115 /* User -> HCI */676typedef u_int16_t ng_hci_node_link_policy_mask_ep;677678#define NGM_HCI_NODE_GET_PACKET_MASK 116 /* HCI -> User */679#define NGM_HCI_NODE_SET_PACKET_MASK 117 /* User -> HCI */680typedef u_int16_t ng_hci_node_packet_mask_ep;681682#define NGM_HCI_NODE_GET_ROLE_SWITCH 118 /* HCI -> User */683#define NGM_HCI_NODE_SET_ROLE_SWITCH 119 /* User -> HCI */684typedef u_int16_t ng_hci_node_role_switch_ep;685686#define NGM_HCI_NODE_LIST_NAMES 200 /* HCI -> User */687688/**************************************************************************689**************************************************************************690** Link control commands and return parameters691**************************************************************************692**************************************************************************/693694#define NG_HCI_OGF_LINK_CONTROL 0x01 /* OpCode Group Field */695696#define NG_HCI_OCF_INQUIRY 0x0001697typedef struct {698u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */699u_int8_t inquiry_length; /* (N x 1.28) sec */700u_int8_t num_responses; /* Max. # of responses before halted */701} __attribute__ ((packed)) ng_hci_inquiry_cp;702/* No return parameter(s) */703704#define NG_HCI_OCF_INQUIRY_CANCEL 0x0002705/* No command parameter(s) */706typedef ng_hci_status_rp ng_hci_inquiry_cancel_rp;707708#define NG_HCI_OCF_PERIODIC_INQUIRY 0x0003709typedef struct {710u_int16_t max_period_length; /* Max. and min. amount of time */711u_int16_t min_period_length; /* between consecutive inquiries */712u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */713u_int8_t inquiry_length; /* (inquiry_length * 1.28) sec */714u_int8_t num_responses; /* Max. # of responses */715} __attribute__ ((packed)) ng_hci_periodic_inquiry_cp;716717typedef ng_hci_status_rp ng_hci_periodic_inquiry_rp;718719#define NG_HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004720/* No command parameter(s) */721typedef ng_hci_status_rp ng_hci_exit_periodic_inquiry_rp;722723#define NG_HCI_OCF_CREATE_CON 0x0005724typedef struct {725bdaddr_t bdaddr; /* destination address */726u_int16_t pkt_type; /* packet type */727u_int8_t page_scan_rep_mode; /* page scan repetition mode */728u_int8_t page_scan_mode; /* page scan mode */729u_int16_t clock_offset; /* clock offset */730u_int8_t accept_role_switch; /* accept role switch? 0x00 - no */731} __attribute__ ((packed)) ng_hci_create_con_cp;732/* No return parameter(s) */733734#define NG_HCI_OCF_DISCON 0x0006735typedef struct {736u_int16_t con_handle; /* connection handle */737u_int8_t reason; /* reason to disconnect */738} __attribute__ ((packed)) ng_hci_discon_cp;739/* No return parameter(s) */740741#define NG_HCI_OCF_ADD_SCO_CON 0x0007742typedef struct {743u_int16_t con_handle; /* connection handle */744u_int16_t pkt_type; /* packet type */745} __attribute__ ((packed)) ng_hci_add_sco_con_cp;746/* No return parameter(s) */747748#define NG_HCI_OCF_ACCEPT_CON 0x0009749typedef struct {750bdaddr_t bdaddr; /* address of unit to be connected */751u_int8_t role; /* connection role */752} __attribute__ ((packed)) ng_hci_accept_con_cp;753/* No return parameter(s) */754755#define NG_HCI_OCF_REJECT_CON 0x000a756typedef struct {757bdaddr_t bdaddr; /* remote address */758u_int8_t reason; /* reason to reject */759} __attribute__ ((packed)) ng_hci_reject_con_cp;760/* No return parameter(s) */761762#define NG_HCI_OCF_LINK_KEY_REP 0x000b763typedef struct {764bdaddr_t bdaddr; /* remote address */765u_int8_t key[NG_HCI_KEY_SIZE]; /* key */766} __attribute__ ((packed)) ng_hci_link_key_rep_cp;767768typedef struct {769u_int8_t status; /* 0x00 - success */770bdaddr_t bdaddr; /* unit address */771} __attribute__ ((packed)) ng_hci_link_key_rep_rp;772773#define NG_HCI_OCF_LINK_KEY_NEG_REP 0x000c774typedef struct {775bdaddr_t bdaddr; /* remote address */776} __attribute__ ((packed)) ng_hci_link_key_neg_rep_cp;777778typedef struct {779u_int8_t status; /* 0x00 - success */780bdaddr_t bdaddr; /* unit address */781} __attribute__ ((packed)) ng_hci_link_key_neg_rep_rp;782783#define NG_HCI_OCF_PIN_CODE_REP 0x000d784typedef struct {785bdaddr_t bdaddr; /* remote address */786u_int8_t pin_size; /* pin code length (in bytes) */787u_int8_t pin[NG_HCI_PIN_SIZE]; /* pin code */788} __attribute__ ((packed)) ng_hci_pin_code_rep_cp;789790typedef struct {791u_int8_t status; /* 0x00 - success */792bdaddr_t bdaddr; /* unit address */793} __attribute__ ((packed)) ng_hci_pin_code_rep_rp;794795#define NG_HCI_OCF_PIN_CODE_NEG_REP 0x000e796typedef struct {797bdaddr_t bdaddr; /* remote address */798} __attribute__ ((packed)) ng_hci_pin_code_neg_rep_cp;799800typedef struct {801u_int8_t status; /* 0x00 - success */802bdaddr_t bdaddr; /* unit address */803} __attribute__ ((packed)) ng_hci_pin_code_neg_rep_rp;804805#define NG_HCI_OCF_CHANGE_CON_PKT_TYPE 0x000f806typedef struct {807u_int16_t con_handle; /* connection handle */808u_int16_t pkt_type; /* packet type */809} __attribute__ ((packed)) ng_hci_change_con_pkt_type_cp;810/* No return parameter(s) */811812#define NG_HCI_OCF_AUTH_REQ 0x0011813typedef struct {814u_int16_t con_handle; /* connection handle */815} __attribute__ ((packed)) ng_hci_auth_req_cp;816/* No return parameter(s) */817818#define NG_HCI_OCF_SET_CON_ENCRYPTION 0x0013819typedef struct {820u_int16_t con_handle; /* connection handle */821u_int8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */822} __attribute__ ((packed)) ng_hci_set_con_encryption_cp;823/* No return parameter(s) */824825#define NG_HCI_OCF_CHANGE_CON_LINK_KEY 0x0015826typedef struct {827u_int16_t con_handle; /* connection handle */828} __attribute__ ((packed)) ng_hci_change_con_link_key_cp;829/* No return parameter(s) */830831#define NG_HCI_OCF_MASTER_LINK_KEY 0x0017832typedef struct {833u_int8_t key_flag; /* key flag */834} __attribute__ ((packed)) ng_hci_master_link_key_cp;835/* No return parameter(s) */836837#define NG_HCI_OCF_REMOTE_NAME_REQ 0x0019838typedef struct {839bdaddr_t bdaddr; /* remote address */840u_int8_t page_scan_rep_mode; /* page scan repetition mode */841u_int8_t page_scan_mode; /* page scan mode */842u_int16_t clock_offset; /* clock offset */843} __attribute__ ((packed)) ng_hci_remote_name_req_cp;844/* No return parameter(s) */845846#define NG_HCI_OCF_READ_REMOTE_FEATURES 0x001b847typedef struct {848u_int16_t con_handle; /* connection handle */849} __attribute__ ((packed)) ng_hci_read_remote_features_cp;850/* No return parameter(s) */851852#define NG_HCI_OCF_READ_REMOTE_VER_INFO 0x001d853typedef struct {854u_int16_t con_handle; /* connection handle */855} __attribute__ ((packed)) ng_hci_read_remote_ver_info_cp;856/* No return parameter(s) */857858#define NG_HCI_OCF_READ_CLOCK_OFFSET 0x001f859typedef struct {860u_int16_t con_handle; /* connection handle */861} __attribute__ ((packed)) ng_hci_read_clock_offset_cp;862/* No return parameter(s) */863864#define NG_HCI_IO_CAPABILITY_REQUEST_REPLY 0x002b865typedef struct {866bdaddr_t bdaddr;867u_int8_t io_capability;868u_int8_t oob_data_present;869u_int8_t authentication_requirements;870} __attribute__ ((packed)) ng_hci_io_capability_request_reply_cp;871872typedef struct {873u_int8_t status;874bdaddr_t bdaddr;875} __attribute__ ((packed)) ng_hci_io_capability_request_reply_rp;876877#define NG_HCI_USER_CONFIRMATION_REQUEST_REPLY 0x002c878typedef struct {879bdaddr_t bdaddr;880} __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_cp;881882typedef struct {883u_int8_t status;884bdaddr_t bdaddr;885} __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_rp;886887#define NG_HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY 0x002d888typedef struct {889bdaddr_t bdaddr;890} __attribute__((packed)) ng_hci_user_confirmation_request_negative_reply_cp;891892typedef struct {893u_int8_t status;894bdaddr_t bdaddr;895} __attribute__ ((packed)) ng_hci_user_confirmation_request_negative_reply_rp;896897#define NG_HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY 0x0034898typedef struct {899bdaddr_t bdaddr;900u_int8_t reason;901} __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_cp;902903typedef struct {904u_int8_t status;905bdaddr_t bdaddr;906} __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_rp;907908/**************************************************************************909**************************************************************************910** Link policy commands and return parameters911**************************************************************************912**************************************************************************/913914#define NG_HCI_OGF_LINK_POLICY 0x02 /* OpCode Group Field */915916#define NG_HCI_OCF_HOLD_MODE 0x0001917typedef struct {918u_int16_t con_handle; /* connection handle */919u_int16_t max_interval; /* (max_interval * 0.625) msec */920u_int16_t min_interval; /* (max_interval * 0.625) msec */921} __attribute__ ((packed)) ng_hci_hold_mode_cp;922/* No return parameter(s) */923924#define NG_HCI_OCF_SNIFF_MODE 0x0003925typedef struct {926u_int16_t con_handle; /* connection handle */927u_int16_t max_interval; /* (max_interval * 0.625) msec */928u_int16_t min_interval; /* (max_interval * 0.625) msec */929u_int16_t attempt; /* (2 * attempt - 1) * 0.625 msec */930u_int16_t timeout; /* (2 * attempt - 1) * 0.625 msec */931} __attribute__ ((packed)) ng_hci_sniff_mode_cp;932/* No return parameter(s) */933934#define NG_HCI_OCF_EXIT_SNIFF_MODE 0x0004935typedef struct {936u_int16_t con_handle; /* connection handle */937} __attribute__ ((packed)) ng_hci_exit_sniff_mode_cp;938/* No return parameter(s) */939940#define NG_HCI_OCF_PARK_MODE 0x0005941typedef struct {942u_int16_t con_handle; /* connection handle */943u_int16_t max_interval; /* (max_interval * 0.625) msec */944u_int16_t min_interval; /* (max_interval * 0.625) msec */945} __attribute__ ((packed)) ng_hci_park_mode_cp;946/* No return parameter(s) */947948#define NG_HCI_OCF_EXIT_PARK_MODE 0x0006949typedef struct {950u_int16_t con_handle; /* connection handle */951} __attribute__ ((packed)) ng_hci_exit_park_mode_cp;952/* No return parameter(s) */953954#define NG_HCI_OCF_QOS_SETUP 0x0007955typedef struct {956u_int16_t con_handle; /* connection handle */957u_int8_t flags; /* reserved for future use */958u_int8_t service_type; /* service type */959u_int32_t token_rate; /* bytes per second */960u_int32_t peak_bandwidth; /* bytes per second */961u_int32_t latency; /* microseconds */962u_int32_t delay_variation; /* microseconds */963} __attribute__ ((packed)) ng_hci_qos_setup_cp;964/* No return parameter(s) */965966#define NG_HCI_OCF_ROLE_DISCOVERY 0x0009967typedef struct {968u_int16_t con_handle; /* connection handle */969} __attribute__ ((packed)) ng_hci_role_discovery_cp;970971typedef struct {972u_int8_t status; /* 0x00 - success */973u_int16_t con_handle; /* connection handle */974u_int8_t role; /* role for the connection handle */975} __attribute__ ((packed)) ng_hci_role_discovery_rp;976977#define NG_HCI_OCF_SWITCH_ROLE 0x000b978typedef struct {979bdaddr_t bdaddr; /* remote address */980u_int8_t role; /* new local role */981} __attribute__ ((packed)) ng_hci_switch_role_cp;982/* No return parameter(s) */983984#define NG_HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c985typedef struct {986u_int16_t con_handle; /* connection handle */987} __attribute__ ((packed)) ng_hci_read_link_policy_settings_cp;988989typedef struct {990u_int8_t status; /* 0x00 - success */991u_int16_t con_handle; /* connection handle */992u_int16_t settings; /* link policy settings */993} __attribute__ ((packed)) ng_hci_read_link_policy_settings_rp;994995#define NG_HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d996typedef struct {997u_int16_t con_handle; /* connection handle */998u_int16_t settings; /* link policy settings */999} __attribute__ ((packed)) ng_hci_write_link_policy_settings_cp;10001001typedef struct {1002u_int8_t status; /* 0x00 - success */1003u_int16_t con_handle; /* connection handle */1004} __attribute__ ((packed)) ng_hci_write_link_policy_settings_rp;10051006/**************************************************************************1007**************************************************************************1008** Host controller and baseband commands and return parameters1009**************************************************************************1010**************************************************************************/10111012#define NG_HCI_OGF_HC_BASEBAND 0x03 /* OpCode Group Field */10131014#define NG_HCI_OCF_SET_EVENT_MASK 0x00011015typedef struct {1016u_int8_t event_mask[NG_HCI_EVENT_MASK_SIZE]; /* event_mask */1017} __attribute__ ((packed)) ng_hci_set_event_mask_cp;10181019typedef ng_hci_status_rp ng_hci_set_event_mask_rp;1020#define NG_HCI_EVENT_MASK_DEFAULT 0x1fffffffffff1021#define NG_HCI_EVENT_MASK_LE 0x200000000000000010221023#define NG_HCI_OCF_RESET 0x00031024/* No command parameter(s) */1025typedef ng_hci_status_rp ng_hci_reset_rp;10261027#define NG_HCI_OCF_SET_EVENT_FILTER 0x00051028typedef struct {1029u_int8_t filter_type; /* filter type */1030u_int8_t filter_condition_type; /* filter condition type */1031u_int8_t condition[0]; /* conditions - variable size */1032} __attribute__ ((packed)) ng_hci_set_event_filter_cp;10331034typedef ng_hci_status_rp ng_hci_set_event_filter_rp;10351036#define NG_HCI_OCF_FLUSH 0x00081037typedef struct {1038u_int16_t con_handle; /* connection handle */1039} __attribute__ ((packed)) ng_hci_flush_cp;10401041typedef struct {1042u_int8_t status; /* 0x00 - success */1043u_int16_t con_handle; /* connection handle */1044} __attribute__ ((packed)) ng_hci_flush_rp;10451046#define NG_HCI_OCF_READ_PIN_TYPE 0x00091047/* No command parameter(s) */1048typedef struct {1049u_int8_t status; /* 0x00 - success */1050u_int8_t pin_type; /* PIN type */1051} __attribute__ ((packed)) ng_hci_read_pin_type_rp;10521053#define NG_HCI_OCF_WRITE_PIN_TYPE 0x000a1054typedef struct {1055u_int8_t pin_type; /* PIN type */1056} __attribute__ ((packed)) ng_hci_write_pin_type_cp;10571058typedef ng_hci_status_rp ng_hci_write_pin_type_rp;10591060#define NG_HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b1061/* No command parameter(s) */1062typedef ng_hci_status_rp ng_hci_create_new_unit_key_rp;10631064#define NG_HCI_OCF_READ_STORED_LINK_KEY 0x000d1065typedef struct {1066bdaddr_t bdaddr; /* address */1067u_int8_t read_all; /* read all keys? 0x01 - yes */1068} __attribute__ ((packed)) ng_hci_read_stored_link_key_cp;10691070typedef struct {1071u_int8_t status; /* 0x00 - success */1072u_int16_t max_num_keys; /* Max. number of keys */1073u_int16_t num_keys_read; /* Number of stored keys */1074} __attribute__ ((packed)) ng_hci_read_stored_link_key_rp;10751076#define NG_HCI_OCF_WRITE_STORED_LINK_KEY 0x00111077typedef struct {1078u_int8_t num_keys_write; /* # of keys to write */1079/* these are repeated "num_keys_write" times1080bdaddr_t bdaddr; --- remote address(es)1081u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */1082} __attribute__ ((packed)) ng_hci_write_stored_link_key_cp;10831084typedef struct {1085u_int8_t status; /* 0x00 - success */1086u_int8_t num_keys_written; /* # of keys successfully written */1087} __attribute__ ((packed)) ng_hci_write_stored_link_key_rp;10881089#define NG_HCI_OCF_DELETE_STORED_LINK_KEY 0x00121090typedef struct {1091bdaddr_t bdaddr; /* address */1092u_int8_t delete_all; /* delete all keys? 0x01 - yes */1093} __attribute__ ((packed)) ng_hci_delete_stored_link_key_cp;10941095typedef struct {1096u_int8_t status; /* 0x00 - success */1097u_int16_t num_keys_deleted; /* Number of keys deleted */1098} __attribute__ ((packed)) ng_hci_delete_stored_link_key_rp;10991100#define NG_HCI_OCF_CHANGE_LOCAL_NAME 0x00131101typedef struct {1102char name[NG_HCI_UNIT_NAME_SIZE]; /* new unit name */1103} __attribute__ ((packed)) ng_hci_change_local_name_cp;11041105typedef ng_hci_status_rp ng_hci_change_local_name_rp;11061107#define NG_HCI_OCF_READ_LOCAL_NAME 0x00141108/* No command parameter(s) */1109typedef struct {1110u_int8_t status; /* 0x00 - success */1111char name[NG_HCI_UNIT_NAME_SIZE]; /* unit name */1112} __attribute__ ((packed)) ng_hci_read_local_name_rp;11131114#define NG_HCI_OCF_READ_CON_ACCEPT_TIMO 0x00151115/* No command parameter(s) */1116typedef struct {1117u_int8_t status; /* 0x00 - success */1118u_int16_t timeout; /* (timeout * 0.625) msec */1119} __attribute__ ((packed)) ng_hci_read_con_accept_timo_rp;11201121#define NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO 0x00161122typedef struct {1123u_int16_t timeout; /* (timeout * 0.625) msec */1124} __attribute__ ((packed)) ng_hci_write_con_accept_timo_cp;11251126typedef ng_hci_status_rp ng_hci_write_con_accept_timo_rp;11271128#define NG_HCI_OCF_READ_PAGE_TIMO 0x00171129/* No command parameter(s) */1130typedef struct {1131u_int8_t status; /* 0x00 - success */1132u_int16_t timeout; /* (timeout * 0.625) msec */1133} __attribute__ ((packed)) ng_hci_read_page_timo_rp;11341135#define NG_HCI_OCF_WRITE_PAGE_TIMO 0x00181136typedef struct {1137u_int16_t timeout; /* (timeout * 0.625) msec */1138} __attribute__ ((packed)) ng_hci_write_page_timo_cp;11391140typedef ng_hci_status_rp ng_hci_write_page_timo_rp;11411142#define NG_HCI_OCF_READ_SCAN_ENABLE 0x00191143/* No command parameter(s) */1144typedef struct {1145u_int8_t status; /* 0x00 - success */1146u_int8_t scan_enable; /* Scan enable */1147} __attribute__ ((packed)) ng_hci_read_scan_enable_rp;11481149#define NG_HCI_OCF_WRITE_SCAN_ENABLE 0x001a1150typedef struct {1151u_int8_t scan_enable; /* Scan enable */1152} __attribute__ ((packed)) ng_hci_write_scan_enable_cp;11531154typedef ng_hci_status_rp ng_hci_write_scan_enable_rp;11551156#define NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b1157/* No command parameter(s) */1158typedef struct {1159u_int8_t status; /* 0x00 - success */1160u_int16_t page_scan_interval; /* interval * 0.625 msec */1161u_int16_t page_scan_window; /* window * 0.625 msec */1162} __attribute__ ((packed)) ng_hci_read_page_scan_activity_rp;11631164#define NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c1165typedef struct {1166u_int16_t page_scan_interval; /* interval * 0.625 msec */1167u_int16_t page_scan_window; /* window * 0.625 msec */1168} __attribute__ ((packed)) ng_hci_write_page_scan_activity_cp;11691170typedef ng_hci_status_rp ng_hci_write_page_scan_activity_rp;11711172#define NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d1173/* No command parameter(s) */1174typedef struct {1175u_int8_t status; /* 0x00 - success */1176u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */1177u_int16_t inquiry_scan_window; /* window * 0.625 msec */1178} __attribute__ ((packed)) ng_hci_read_inquiry_scan_activity_rp;11791180#define NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e1181typedef struct {1182u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */1183u_int16_t inquiry_scan_window; /* window * 0.625 msec */1184} __attribute__ ((packed)) ng_hci_write_inquiry_scan_activity_cp;11851186typedef ng_hci_status_rp ng_hci_write_inquiry_scan_activity_rp;11871188#define NG_HCI_OCF_READ_AUTH_ENABLE 0x001f1189/* No command parameter(s) */1190typedef struct {1191u_int8_t status; /* 0x00 - success */1192u_int8_t auth_enable; /* 0x01 - enabled */1193} __attribute__ ((packed)) ng_hci_read_auth_enable_rp;11941195#define NG_HCI_OCF_WRITE_AUTH_ENABLE 0x00201196typedef struct {1197u_int8_t auth_enable; /* 0x01 - enabled */1198} __attribute__ ((packed)) ng_hci_write_auth_enable_cp;11991200typedef ng_hci_status_rp ng_hci_write_auth_enable_rp;12011202#define NG_HCI_OCF_READ_ENCRYPTION_MODE 0x00211203/* No command parameter(s) */1204typedef struct {1205u_int8_t status; /* 0x00 - success */1206u_int8_t encryption_mode; /* encryption mode */1207} __attribute__ ((packed)) ng_hci_read_encryption_mode_rp;12081209#define NG_HCI_OCF_WRITE_ENCRYPTION_MODE 0x00221210typedef struct {1211u_int8_t encryption_mode; /* encryption mode */1212} __attribute__ ((packed)) ng_hci_write_encryption_mode_cp;12131214typedef ng_hci_status_rp ng_hci_write_encryption_mode_rp;12151216#define NG_HCI_OCF_READ_UNIT_CLASS 0x00231217/* No command parameter(s) */1218typedef struct {1219u_int8_t status; /* 0x00 - success */1220u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */1221} __attribute__ ((packed)) ng_hci_read_unit_class_rp;12221223#define NG_HCI_OCF_WRITE_UNIT_CLASS 0x00241224typedef struct {1225u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */1226} __attribute__ ((packed)) ng_hci_write_unit_class_cp;12271228typedef ng_hci_status_rp ng_hci_write_unit_class_rp;12291230#define NG_HCI_OCF_READ_VOICE_SETTINGS 0x00251231/* No command parameter(s) */1232typedef struct {1233u_int8_t status; /* 0x00 - success */1234u_int16_t settings; /* voice settings */1235} __attribute__ ((packed)) ng_hci_read_voice_settings_rp;12361237#define NG_HCI_OCF_WRITE_VOICE_SETTINGS 0x00261238typedef struct {1239u_int16_t settings; /* voice settings */1240} __attribute__ ((packed)) ng_hci_write_voice_settings_cp;12411242typedef ng_hci_status_rp ng_hci_write_voice_settings_rp;12431244#define NG_HCI_OCF_READ_AUTO_FLUSH_TIMO 0x00271245typedef struct {1246u_int16_t con_handle; /* connection handle */1247} __attribute__ ((packed)) ng_hci_read_auto_flush_timo_cp;12481249typedef struct {1250u_int8_t status; /* 0x00 - success */1251u_int16_t con_handle; /* connection handle */1252u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */1253} __attribute__ ((packed)) ng_hci_read_auto_flush_timo_rp;12541255#define NG_HCI_OCF_WRITE_AUTO_FLUSH_TIMO 0x00281256typedef struct {1257u_int16_t con_handle; /* connection handle */1258u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */1259} __attribute__ ((packed)) ng_hci_write_auto_flush_timo_cp;12601261typedef struct {1262u_int8_t status; /* 0x00 - success */1263u_int16_t con_handle; /* connection handle */1264} __attribute__ ((packed)) ng_hci_write_auto_flush_timo_rp;12651266#define NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x00291267/* No command parameter(s) */1268typedef struct {1269u_int8_t status; /* 0x00 - success */1270u_int8_t counter; /* number of broadcast retransmissions */1271} __attribute__ ((packed)) ng_hci_read_num_broadcast_retrans_rp;12721273#define NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a1274typedef struct {1275u_int8_t counter; /* number of broadcast retransmissions */1276} __attribute__ ((packed)) ng_hci_write_num_broadcast_retrans_cp;12771278typedef ng_hci_status_rp ng_hci_write_num_broadcast_retrans_rp;12791280#define NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b1281/* No command parameter(s) */1282typedef struct {1283u_int8_t status; /* 0x00 - success */1284u_int8_t hold_mode_activity; /* Hold mode activities */1285} __attribute__ ((packed)) ng_hci_read_hold_mode_activity_rp;12861287#define NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c1288typedef struct {1289u_int8_t hold_mode_activity; /* Hold mode activities */1290} __attribute__ ((packed)) ng_hci_write_hold_mode_activity_cp;12911292typedef ng_hci_status_rp ng_hci_write_hold_mode_activity_rp;12931294#define NG_HCI_OCF_READ_XMIT_LEVEL 0x002d1295typedef struct {1296u_int16_t con_handle; /* connection handle */1297u_int8_t type; /* Xmit level type */1298} __attribute__ ((packed)) ng_hci_read_xmit_level_cp;12991300typedef struct {1301u_int8_t status; /* 0x00 - success */1302u_int16_t con_handle; /* connection handle */1303char level; /* -30 <= level <= 30 dBm */1304} __attribute__ ((packed)) ng_hci_read_xmit_level_rp;13051306#define NG_HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e1307/* No command parameter(s) */1308typedef struct {1309u_int8_t status; /* 0x00 - success */1310u_int8_t flow_control; /* 0x00 - disabled */1311} __attribute__ ((packed)) ng_hci_read_sco_flow_control_rp;13121313#define NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f1314typedef struct {1315u_int8_t flow_control; /* 0x00 - disabled */1316} __attribute__ ((packed)) ng_hci_write_sco_flow_control_cp;13171318typedef ng_hci_status_rp ng_hci_write_sco_flow_control_rp;13191320#define NG_HCI_OCF_H2HC_FLOW_CONTROL 0x00311321typedef struct {1322u_int8_t h2hc_flow; /* Host to Host controller flow control */1323} __attribute__ ((packed)) ng_hci_h2hc_flow_control_cp;13241325typedef ng_hci_status_rp ng_hci_h2hc_flow_control_rp;13261327#define NG_HCI_OCF_HOST_BUFFER_SIZE 0x00331328typedef struct {1329u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */1330u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */1331u_int16_t num_acl_pkt; /* Max. number of ACL packets */1332u_int16_t num_sco_pkt; /* Max. number of SCO packets */1333} __attribute__ ((packed)) ng_hci_host_buffer_size_cp;13341335typedef ng_hci_status_rp ng_hci_host_buffer_size_rp;13361337#define NG_HCI_OCF_HOST_NUM_COMPL_PKTS 0x00351338typedef struct {1339u_int8_t num_con_handles; /* # of connection handles */1340/* these are repeated "num_con_handles" times1341u_int16_t con_handle; --- connection handle(s)1342u_int16_t compl_pkt; --- # of completed packets */1343} __attribute__ ((packed)) ng_hci_host_num_compl_pkts_cp;1344/* No return parameter(s) */13451346#define NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO 0x00361347typedef struct {1348u_int16_t con_handle; /* connection handle */1349} __attribute__ ((packed)) ng_hci_read_link_supervision_timo_cp;13501351typedef struct {1352u_int8_t status; /* 0x00 - success */1353u_int16_t con_handle; /* connection handle */1354u_int16_t timeout; /* Link supervision timeout * 0.625 msec */1355} __attribute__ ((packed)) ng_hci_read_link_supervision_timo_rp;13561357#define NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO 0x00371358typedef struct {1359u_int16_t con_handle; /* connection handle */1360u_int16_t timeout; /* Link supervision timeout * 0.625 msec */1361} __attribute__ ((packed)) ng_hci_write_link_supervision_timo_cp;13621363typedef struct {1364u_int8_t status; /* 0x00 - success */1365u_int16_t con_handle; /* connection handle */1366} __attribute__ ((packed)) ng_hci_write_link_supervision_timo_rp;13671368#define NG_HCI_OCF_READ_SUPPORTED_IAC_NUM 0x00381369/* No command parameter(s) */1370typedef struct {1371u_int8_t status; /* 0x00 - success */1372u_int8_t num_iac; /* # of supported IAC during scan */1373} __attribute__ ((packed)) ng_hci_read_supported_iac_num_rp;13741375#define NG_HCI_OCF_READ_IAC_LAP 0x00391376/* No command parameter(s) */1377typedef struct {1378u_int8_t status; /* 0x00 - success */1379u_int8_t num_iac; /* # of IAC */1380/* these are repeated "num_iac" times1381u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */1382} __attribute__ ((packed)) ng_hci_read_iac_lap_rp;13831384#define NG_HCI_OCF_WRITE_IAC_LAP 0x003a1385typedef struct {1386u_int8_t num_iac; /* # of IAC */1387/* these are repeated "num_iac" times1388u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */1389} __attribute__ ((packed)) ng_hci_write_iac_lap_cp;13901391typedef ng_hci_status_rp ng_hci_write_iac_lap_rp;13921393/*0x003b-0x003e commands are depricated v2.0 or later*/1394#define NG_HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b1395/* No command parameter(s) */1396typedef struct {1397u_int8_t status; /* 0x00 - success */1398u_int8_t page_scan_period_mode; /* Page scan period mode */1399} __attribute__ ((packed)) ng_hci_read_page_scan_period_rp;14001401#define NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c1402typedef struct {1403u_int8_t page_scan_period_mode; /* Page scan period mode */1404} __attribute__ ((packed)) ng_hci_write_page_scan_period_cp;14051406typedef ng_hci_status_rp ng_hci_write_page_scan_period_rp;14071408#define NG_HCI_OCF_READ_PAGE_SCAN 0x003d1409/* No command parameter(s) */1410typedef struct {1411u_int8_t status; /* 0x00 - success */1412u_int8_t page_scan_mode; /* Page scan mode */1413} __attribute__ ((packed)) ng_hci_read_page_scan_rp;14141415#define NG_HCI_OCF_WRITE_PAGE_SCAN 0x003e1416typedef struct {1417u_int8_t page_scan_mode; /* Page scan mode */1418} __attribute__ ((packed)) ng_hci_write_page_scan_cp;14191420typedef ng_hci_status_rp ng_hci_write_page_scan_rp;14211422#define NG_HCI_OCF_WRITE_SIMPLE_PAIRING 0x00561423typedef struct {1424u_int8_t simple_pairing; /* 1 -> enabled, 0 -> disabled */1425} __attribute__ ((packed)) ng_hci_write_simple_pairing_cp;14261427typedef ng_hci_status_rp ng_hci_write_simple_pairing_rp;14281429#define NG_HCI_OCF_READ_LE_HOST_SUPPORTED 0x6c1430typedef struct {1431u_int8_t status; /* 0x00 - success */1432u_int8_t le_supported_host ;/* LE host supported?*/1433u_int8_t simultaneous_le_host; /* BR/LE simulateneous? */1434} __attribute__ ((packed)) ng_hci_read_le_host_supported_rp;14351436#define NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED 0x6d1437typedef struct {1438u_int8_t le_supported_host; /* LE host supported?*/1439u_int8_t simultaneous_le_host; /* LE host supported?*/1440} __attribute__ ((packed)) ng_hci_write_le_host_supported_cp;14411442typedef ng_hci_status_rp ng_hci_write_le_host_supported_rp;14431444#define NG_HCI_OCF_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT 0x007a1445typedef struct {1446u_int8_t support; /* 0 - disabled, 1 - enabled */1447} __attribute__ ((packed)) ng_hci_write_secure_connections_host_support_cp;14481449typedef ng_hci_status_rp ng_hci_write_secure_connections_host_support_rp;14501451/**************************************************************************1452**************************************************************************1453** Informational commands and return parameters1454** All commands in this category do not accept any parameters1455**************************************************************************1456**************************************************************************/14571458#define NG_HCI_OGF_INFO 0x04 /* OpCode Group Field */14591460#define NG_HCI_OCF_READ_LOCAL_VER 0x00011461typedef struct {1462u_int8_t status; /* 0x00 - success */1463u_int8_t hci_version; /* HCI version */1464u_int16_t hci_revision; /* HCI revision */1465u_int8_t lmp_version; /* LMP version */1466u_int16_t manufacturer; /* Hardware manufacturer name */1467u_int16_t lmp_subversion; /* LMP sub-version */1468} __attribute__ ((packed)) ng_hci_read_local_ver_rp;14691470#define NG_HCI_OCF_READ_LOCAL_COMMANDS 0x00021471typedef struct {1472u_int8_t status; /* 0x00 - success */1473u_int8_t features[NG_HCI_COMMANDS_SIZE]; /* command bitmsk*/1474} __attribute__ ((packed)) ng_hci_read_local_commands_rp;14751476#define NG_HCI_OCF_READ_LOCAL_FEATURES 0x00031477typedef struct {1478u_int8_t status; /* 0x00 - success */1479u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/1480} __attribute__ ((packed)) ng_hci_read_local_features_rp;14811482#define NG_HCI_OCF_READ_BUFFER_SIZE 0x00051483typedef struct {1484u_int8_t status; /* 0x00 - success */1485u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */1486u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */1487u_int16_t num_acl_pkt; /* Max. number of ACL packets */1488u_int16_t num_sco_pkt; /* Max. number of SCO packets */1489} __attribute__ ((packed)) ng_hci_read_buffer_size_rp;14901491#define NG_HCI_OCF_READ_COUNTRY_CODE 0x00071492typedef struct {1493u_int8_t status; /* 0x00 - success */1494u_int8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */1495} __attribute__ ((packed)) ng_hci_read_country_code_rp;14961497#define NG_HCI_OCF_READ_BDADDR 0x00091498typedef struct {1499u_int8_t status; /* 0x00 - success */1500bdaddr_t bdaddr; /* unit address */1501} __attribute__ ((packed)) ng_hci_read_bdaddr_rp;15021503/**************************************************************************1504**************************************************************************1505** Status commands and return parameters1506**************************************************************************1507**************************************************************************/15081509#define NG_HCI_OGF_STATUS 0x05 /* OpCode Group Field */15101511#define NG_HCI_OCF_READ_FAILED_CONTACT_CNTR 0x00011512typedef struct {1513u_int16_t con_handle; /* connection handle */1514} __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_cp;15151516typedef struct {1517u_int8_t status; /* 0x00 - success */1518u_int16_t con_handle; /* connection handle */1519u_int16_t counter; /* number of consecutive failed contacts */1520} __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_rp;15211522#define NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x00021523typedef struct {1524u_int16_t con_handle; /* connection handle */1525} __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_cp;15261527typedef struct {1528u_int8_t status; /* 0x00 - success */1529u_int16_t con_handle; /* connection handle */1530} __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_rp;15311532#define NG_HCI_OCF_GET_LINK_QUALITY 0x00031533typedef struct {1534u_int16_t con_handle; /* connection handle */1535} __attribute__ ((packed)) ng_hci_get_link_quality_cp;15361537typedef struct {1538u_int8_t status; /* 0x00 - success */1539u_int16_t con_handle; /* connection handle */1540u_int8_t quality; /* higher value means better quality */1541} __attribute__ ((packed)) ng_hci_get_link_quality_rp;15421543#define NG_HCI_OCF_READ_RSSI 0x00051544typedef struct {1545u_int16_t con_handle; /* connection handle */1546} __attribute__ ((packed)) ng_hci_read_rssi_cp;15471548typedef struct {1549u_int8_t status; /* 0x00 - success */1550u_int16_t con_handle; /* connection handle */1551char rssi; /* -127 <= rssi <= 127 dB */1552} __attribute__ ((packed)) ng_hci_read_rssi_rp;15531554/**************************************************************************1555**************************************************************************1556** Testing commands and return parameters1557**************************************************************************1558**************************************************************************/15591560#define NG_HCI_OGF_TESTING 0x06 /* OpCode Group Field */15611562#define NG_HCI_OCF_READ_LOOPBACK_MODE 0x00011563/* No command parameter(s) */1564typedef struct {1565u_int8_t status; /* 0x00 - success */1566u_int8_t lbmode; /* loopback mode */1567} __attribute__ ((packed)) ng_hci_read_loopback_mode_rp;15681569#define NG_HCI_OCF_WRITE_LOOPBACK_MODE 0x00021570typedef struct {1571u_int8_t lbmode; /* loopback mode */1572} __attribute__ ((packed)) ng_hci_write_loopback_mode_cp;15731574typedef ng_hci_status_rp ng_hci_write_loopback_mode_rp;15751576#define NG_HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x00031577/* No command parameter(s) */1578typedef ng_hci_status_rp ng_hci_enable_unit_under_test_rp;15791580/**************************************************************************1581**************************************************************************1582** LE OpCode group field1583**************************************************************************1584**************************************************************************/15851586#define NG_HCI_OGF_LE 0x08 /* OpCode Group Field */1587#define NG_HCI_OCF_LE_SET_EVENT_MASK 0x00011588typedef struct {1589u_int8_t event_mask[NG_HCI_LE_EVENT_MASK_SIZE]; /* event_mask*/15901591} __attribute__ ((packed)) ng_hci_le_set_event_mask_cp;1592typedef ng_hci_status_rp ng_hci_le_set_event_mask_rp;1593#define NG_HCI_LE_EVENT_MASK_ALL 0x1f15941595#define NG_HCI_OCF_LE_READ_BUFFER_SIZE 0x00021596/*No command parameter */1597typedef struct {1598u_int8_t status; /*status*/1599u_int16_t hc_le_data_packet_length;1600u_int8_t hc_total_num_le_data_packets;1601} __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp;16021603#define NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x00031604/*No command parameter */1605typedef struct {1606u_int8_t status; /*status*/1607u_int64_t le_features;1608} __attribute__ ((packed)) ng_hci_le_read_local_supported_features_rp;16091610#define NG_HCI_OCF_LE_SET_RANDOM_ADDRESS 0x00051611typedef struct {1612bdaddr_t random_address;1613} __attribute__ ((packed)) ng_hci_le_set_random_address_cp_;1614typedef ng_hci_status_rp ng_hci_le_set_random_address_rp;16151616#define NG_HCI_OCF_LE_SET_ADVERTISING_PARAMETERS 0x00061617typedef struct {1618u_int16_t advertising_interval_min;1619u_int16_t advertising_interval_max;1620u_int8_t advertising_type;1621u_int8_t own_address_type;1622u_int8_t direct_address_type;1623bdaddr_t direct_address;1624u_int8_t advertising_channel_map;1625u_int8_t advertising_filter_policy;1626} __attribute__ ((packed)) ng_hci_le_set_advertising_parameters_cp;1627typedef ng_hci_status_rp ng_hci_le_set_advertising_parameters_rp;16281629#define NG_HCI_OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x00071630/*No command parameter*/1631typedef struct {1632u_int8_t status;1633u_int8_t transmit_power_level;1634} __attribute__ ((packed)) ng_hci_le_read_advertising_channel_tx_power_rp;16351636#define NG_HCI_OCF_LE_SET_ADVERTISING_DATA 0x00081637#define NG_HCI_ADVERTISING_DATA_SIZE 311638typedef struct {1639u_int8_t advertising_data_length;1640char advertising_data[NG_HCI_ADVERTISING_DATA_SIZE];1641} __attribute__ ((packed)) ng_hci_le_set_advertising_data_cp;1642typedef ng_hci_status_rp ng_hci_le_set_advertising_data_rp;16431644#define NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA 0x000916451646typedef struct {1647u_int8_t scan_response_data_length;1648char scan_response_data[NG_HCI_ADVERTISING_DATA_SIZE];1649} __attribute__ ((packed)) ng_hci_le_set_scan_response_data_cp;1650typedef ng_hci_status_rp ng_hci_le_set_scan_response_data_rp;16511652#define NG_HCI_OCF_LE_SET_ADVERTISE_ENABLE 0x000a1653typedef struct {1654u_int8_t advertising_enable;1655}__attribute__ ((packed)) ng_hci_le_set_advertise_enable_cp;1656typedef ng_hci_status_rp ng_hci_le_set_advertise_enable_rp;16571658#define NG_HCI_OCF_LE_SET_SCAN_PARAMETERS 0x000b1659typedef struct {1660u_int8_t le_scan_type;1661u_int16_t le_scan_interval;1662u_int16_t le_scan_window;1663u_int8_t own_address_type;1664u_int8_t scanning_filter_policy;1665}__attribute__ ((packed)) ng_hci_le_set_scan_parameters_cp;1666typedef ng_hci_status_rp ng_hci_le_set_scan_parameters_rp;16671668#define NG_HCI_OCF_LE_SET_SCAN_ENABLE 0x000c1669typedef struct {1670u_int8_t le_scan_enable;1671u_int8_t filter_duplicates;1672}__attribute__ ((packed)) ng_hci_le_set_scan_enable_cp;1673typedef ng_hci_status_rp ng_hci_le_set_scan_enable_rp;16741675#define NG_HCI_OCF_LE_CREATE_CONNECTION 0x000d1676typedef struct {1677u_int16_t scan_interval;1678u_int16_t scan_window;1679u_int8_t filter_policy;1680u_int8_t peer_addr_type;1681bdaddr_t peer_addr;1682u_int8_t own_address_type;1683u_int16_t conn_interval_min;1684u_int16_t conn_interval_max;1685u_int16_t conn_latency;1686u_int16_t supervision_timeout;1687u_int16_t min_ce_length;1688u_int16_t max_ce_length;1689}__attribute__((packed)) ng_hci_le_create_connection_cp;1690/* No return parameters. */1691#define NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL 0x000e1692/*No command parameter*/1693typedef ng_hci_status_rp ng_hci_le_create_connection_cancel_rp;1694#define NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE 0x000f1695/*No command parameter*/1696typedef struct {1697u_int8_t status;1698u_int8_t white_list_size;1699} __attribute__ ((packed)) ng_hci_le_read_white_list_size_rp;17001701#define NG_HCI_OCF_LE_CLEAR_WHITE_LIST 0x00101702/* No command parameters. */1703typedef ng_hci_status_rp ng_hci_le_clear_white_list_rp;1704#define NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x00111705typedef struct {1706u_int8_t address_type;1707bdaddr_t address;1708} __attribute__ ((packed)) ng_hci_le_add_device_to_white_list_cp;1709typedef ng_hci_status_rp ng_hci_le_add_device_to_white_list_rp;17101711#define NG_HCI_OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x00121712typedef struct {1713u_int8_t address_type;1714bdaddr_t address;1715} __attribute__ ((packed)) ng_hci_le_remove_device_from_white_list_cp;1716typedef ng_hci_status_rp ng_hci_le_remove_device_from_white_list_rp;17171718#define NG_HCI_OCF_LE_CONNECTION_UPDATE 0x00131719typedef struct {1720u_int16_t connection_handle;1721u_int16_t conn_interval_min;1722u_int16_t conn_interval_max;1723u_int16_t conn_latency;1724u_int16_t supervision_timeout;1725u_int16_t minimum_ce_length;1726u_int16_t maximum_ce_length;1727}__attribute__ ((packed)) ng_hci_le_connection_update_cp;1728/*no return parameter*/17291730#define NG_HCI_OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x00141731typedef struct{1732u_int8_t le_channel_map[5];1733}__attribute__ ((packed)) ng_hci_le_set_host_channel_classification_cp;1734typedef ng_hci_status_rp ng_hci_le_set_host_channel_classification_rp;17351736#define NG_HCI_OCF_LE_READ_CHANNEL_MAP 0x00151737typedef struct {1738u_int16_t connection_handle;1739}__attribute__ ((packed)) ng_hci_le_read_channel_map_cp;1740typedef struct {1741u_int8_t status;1742u_int16_t connection_handle;1743u_int8_t le_channel_map[5];1744} __attribute__ ((packed)) ng_hci_le_read_channel_map_rp;17451746#define NG_HCI_OCF_LE_READ_REMOTE_USED_FEATURES 0x00161747typedef struct {1748u_int16_t connection_handle;1749}__attribute__ ((packed)) ng_hci_le_read_remote_used_features_cp;1750/*No return parameter*/1751#define NG_HCI_128BIT 161752#define NG_HCI_OCF_LE_ENCRYPT 0x00171753typedef struct {1754u_int8_t key[NG_HCI_128BIT];1755u_int8_t plaintext_data[NG_HCI_128BIT];1756}__attribute__ ((packed)) ng_hci_le_encrypt_cp;1757typedef struct {1758u_int8_t status;1759u_int8_t plaintext_data[NG_HCI_128BIT];1760}__attribute__ ((packed)) ng_hci_le_encrypt_rp;17611762#define NG_HCI_OCF_LE_RAND 0x00181763/*No command parameter*/1764typedef struct {1765u_int8_t status;1766u_int64_t random_number;1767}__attribute__ ((packed)) ng_hci_le_rand_rp;17681769#define NG_HCI_OCF_LE_START_ENCRYPTION 0x00191770typedef struct {1771u_int16_t connection_handle;1772u_int64_t random_number;1773u_int16_t encrypted_diversifier;1774u_int8_t long_term_key[NG_HCI_128BIT];1775}__attribute__ ((packed)) ng_hci_le_start_encryption_cp;1776/*No return parameter*/1777#define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY 0x001a1778typedef struct {1779u_int16_t connection_handle;1780u_int8_t long_term_key[NG_HCI_128BIT];1781}__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_cp;1782typedef struct {1783u_int8_t status;1784u_int16_t connection_handle;1785}__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_rp;17861787#define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY 0x001b1788typedef struct{1789u_int16_t connection_handle;1790}__attribute__((packed)) ng_hci_le_long_term_key_request_negative_reply_cp;1791typedef struct {1792u_int8_t status;1793u_int16_t connection_handle;1794}__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp;17951796#define NG_HCI_OCF_LE_READ_SUGGESTED_DATA_LENGTH 0x00231797/*No command parameter*/1798typedef struct {1799u_int8_t status;1800u_int16_t suggested_max_tx_octets;1801u_int16_t suggested_max_tx_time;1802}__attribute__ ((packed)) ng_hci_le_read_suggested_data_length_rp;18031804#define NG_HCI_OCF_LE_WRITE_SUGGESTED_DATA_LENGTH 0x00241805typedef struct {1806u_int16_t suggested_max_tx_octets;1807u_int16_t suggested_max_tx_time;1808}__attribute__ ((packed)) ng_hci_le_write_suggested_data_length_cp;1809typedef ng_hci_status_rp ng_hci_le_write_suggested_data_length_rp;18101811#define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2 0x00601812/*No command parameter */1813typedef struct {1814u_int8_t status;1815u_int16_t hc_le_data_packet_length;1816u_int8_t hc_total_num_le_data_packets;1817u_int16_t hc_iso_data_packet_length;1818u_int8_t hc_total_num_iso_data_packets;1819} __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp_v2;18201821#define NG_HCI_OCF_LE_READ_SUPPORTED_STATES 0x001c1822/*No command parameter*/1823typedef struct {1824u_int8_t status;1825u_int64_t le_states;1826}__attribute__ ((packed)) ng_hci_le_read_supported_states_rp;18271828#define NG_HCI_OCF_LE_RECEIVER_TEST 0x001d1829typedef struct{1830u_int8_t rx_frequency;1831} __attribute__((packed)) ng_le_receiver_test_cp;1832typedef ng_hci_status_rp ng_hci_le_receiver_test_rp;18331834#define NG_HCI_OCF_LE_TRANSMITTER_TEST 0x001e1835typedef struct{1836u_int8_t tx_frequency;1837u_int8_t length_of_test_data;1838u_int8_t packet_payload;1839} __attribute__((packed)) ng_le_transmitter_test_cp;1840typedef ng_hci_status_rp ng_hci_le_transmitter_test_rp;18411842#define NG_HCI_OCF_LE_TEST_END 0x001f1843/* No command parameter. */1844typedef struct {1845u_int8_t status;1846u_int16_t number_of_packets;1847}__attribute__ ((packed)) ng_hci_le_test_end_rp;18481849/**************************************************************************1850**************************************************************************1851** Special HCI OpCode group field values1852**************************************************************************1853**************************************************************************/18541855#define NG_HCI_OGF_BT_LOGO 0x3e18561857#define NG_HCI_OGF_VENDOR 0x3f18581859/**************************************************************************1860**************************************************************************1861** Events and event parameters1862**************************************************************************1863**************************************************************************/18641865#define NG_HCI_EVENT_INQUIRY_COMPL 0x011866typedef struct {1867u_int8_t status; /* 0x00 - success */1868} __attribute__ ((packed)) ng_hci_inquiry_compl_ep;18691870#define NG_HCI_EVENT_INQUIRY_RESULT 0x021871typedef struct {1872u_int8_t num_responses; /* number of responses */1873/* ng_hci_inquiry_response[num_responses] -- see below */1874} __attribute__ ((packed)) ng_hci_inquiry_result_ep;18751876typedef struct {1877bdaddr_t bdaddr; /* unit address */1878u_int8_t page_scan_rep_mode; /* page scan rep. mode */1879u_int8_t page_scan_period_mode; /* page scan period mode */1880u_int8_t page_scan_mode; /* page scan mode */1881u_int8_t uclass[NG_HCI_CLASS_SIZE];/* unit class */1882u_int16_t clock_offset; /* clock offset */1883} __attribute__ ((packed)) ng_hci_inquiry_response;18841885#define NG_HCI_EVENT_CON_COMPL 0x031886typedef struct {1887u_int8_t status; /* 0x00 - success */1888u_int16_t con_handle; /* Connection handle */1889bdaddr_t bdaddr; /* remote unit address */1890u_int8_t link_type; /* Link type */1891u_int8_t encryption_mode; /* Encryption mode */1892} __attribute__ ((packed)) ng_hci_con_compl_ep;18931894#define NG_HCI_EVENT_CON_REQ 0x041895typedef struct {1896bdaddr_t bdaddr; /* remote unit address */1897u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* remote unit class */1898u_int8_t link_type; /* link type */1899} __attribute__ ((packed)) ng_hci_con_req_ep;19001901#define NG_HCI_EVENT_DISCON_COMPL 0x051902typedef struct {1903u_int8_t status; /* 0x00 - success */1904u_int16_t con_handle; /* connection handle */1905u_int8_t reason; /* reason to disconnect */1906} __attribute__ ((packed)) ng_hci_discon_compl_ep;19071908#define NG_HCI_EVENT_AUTH_COMPL 0x061909typedef struct {1910u_int8_t status; /* 0x00 - success */1911u_int16_t con_handle; /* connection handle */1912} __attribute__ ((packed)) ng_hci_auth_compl_ep;19131914#define NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x71915typedef struct {1916u_int8_t status; /* 0x00 - success */1917bdaddr_t bdaddr; /* remote unit address */1918char name[NG_HCI_UNIT_NAME_SIZE]; /* remote unit name */1919} __attribute__ ((packed)) ng_hci_remote_name_req_compl_ep;19201921#define NG_HCI_EVENT_ENCRYPTION_CHANGE 0x081922typedef struct {1923u_int8_t status; /* 0x00 - success */1924u_int16_t con_handle; /* Connection handle */1925u_int8_t encryption_enable; /* 0x00 - disable */1926} __attribute__ ((packed)) ng_hci_encryption_change_ep;19271928#define NG_HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x091929typedef struct {1930u_int8_t status; /* 0x00 - success */1931u_int16_t con_handle; /* Connection handle */1932} __attribute__ ((packed)) ng_hci_change_con_link_key_compl_ep;19331934#define NG_HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a1935typedef struct {1936u_int8_t status; /* 0x00 - success */1937u_int16_t con_handle; /* Connection handle */1938u_int8_t key_flag; /* Key flag */1939} __attribute__ ((packed)) ng_hci_master_link_key_compl_ep;19401941#define NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b1942typedef struct {1943u_int8_t status; /* 0x00 - success */1944u_int16_t con_handle; /* Connection handle */1945u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/1946} __attribute__ ((packed)) ng_hci_read_remote_features_compl_ep;19471948#define NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c1949typedef struct {1950u_int8_t status; /* 0x00 - success */1951u_int16_t con_handle; /* Connection handle */1952u_int8_t lmp_version; /* LMP version */1953u_int16_t manufacturer; /* Hardware manufacturer name */1954u_int16_t lmp_subversion; /* LMP sub-version */1955} __attribute__ ((packed)) ng_hci_read_remote_ver_info_compl_ep;19561957#define NG_HCI_EVENT_QOS_SETUP_COMPL 0x0d1958typedef struct {1959u_int8_t status; /* 0x00 - success */1960u_int16_t con_handle; /* connection handle */1961u_int8_t flags; /* reserved for future use */1962u_int8_t service_type; /* service type */1963u_int32_t token_rate; /* bytes per second */1964u_int32_t peak_bandwidth; /* bytes per second */1965u_int32_t latency; /* microseconds */1966u_int32_t delay_variation; /* microseconds */1967} __attribute__ ((packed)) ng_hci_qos_setup_compl_ep;19681969#define NG_HCI_EVENT_COMMAND_COMPL 0x0e1970typedef struct {1971u_int8_t num_cmd_pkts; /* # of HCI command packets */1972u_int16_t opcode; /* command OpCode */1973/* command return parameters (if any) */1974} __attribute__ ((packed)) ng_hci_command_compl_ep;19751976#define NG_HCI_EVENT_COMMAND_STATUS 0x0f1977typedef struct {1978u_int8_t status; /* 0x00 - pending */1979u_int8_t num_cmd_pkts; /* # of HCI command packets */1980u_int16_t opcode; /* command OpCode */1981} __attribute__ ((packed)) ng_hci_command_status_ep;19821983#define NG_HCI_EVENT_HARDWARE_ERROR 0x101984typedef struct {1985u_int8_t hardware_code; /* hardware error code */1986} __attribute__ ((packed)) ng_hci_hardware_error_ep;19871988#define NG_HCI_EVENT_FLUSH_OCCUR 0x111989typedef struct {1990u_int16_t con_handle; /* connection handle */1991} __attribute__ ((packed)) ng_hci_flush_occur_ep;19921993#define NG_HCI_EVENT_ROLE_CHANGE 0x121994typedef struct {1995u_int8_t status; /* 0x00 - success */1996bdaddr_t bdaddr; /* address of remote unit */1997u_int8_t role; /* new connection role */1998} __attribute__ ((packed)) ng_hci_role_change_ep;19992000#define NG_HCI_EVENT_NUM_COMPL_PKTS 0x132001typedef struct {2002u_int8_t num_con_handles; /* # of connection handles */2003/* these are repeated "num_con_handles" times2004u_int16_t con_handle; --- connection handle(s)2005u_int16_t compl_pkt; --- # of completed packets */2006} __attribute__ ((packed)) ng_hci_num_compl_pkts_ep;20072008#define NG_HCI_EVENT_MODE_CHANGE 0x142009typedef struct {2010u_int8_t status; /* 0x00 - success */2011u_int16_t con_handle; /* connection handle */2012u_int8_t unit_mode; /* remote unit mode */2013u_int16_t interval; /* interval * 0.625 msec */2014} __attribute__ ((packed)) ng_hci_mode_change_ep;20152016#define NG_HCI_EVENT_RETURN_LINK_KEYS 0x152017typedef struct {2018u_int8_t num_keys; /* # of keys */2019/* these are repeated "num_keys" times2020bdaddr_t bdaddr; --- remote address(es)2021u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */2022} __attribute__ ((packed)) ng_hci_return_link_keys_ep;20232024#define NG_HCI_EVENT_PIN_CODE_REQ 0x162025typedef struct {2026bdaddr_t bdaddr; /* remote unit address */2027} __attribute__ ((packed)) ng_hci_pin_code_req_ep;20282029#define NG_HCI_EVENT_LINK_KEY_REQ 0x172030typedef struct {2031bdaddr_t bdaddr; /* remote unit address */2032} __attribute__ ((packed)) ng_hci_link_key_req_ep;20332034#define NG_HCI_EVENT_LINK_KEY_NOTIFICATION 0x182035typedef struct {2036bdaddr_t bdaddr; /* remote unit address */2037u_int8_t key[NG_HCI_KEY_SIZE]; /* link key */2038u_int8_t key_type; /* type of the key */2039} __attribute__ ((packed)) ng_hci_link_key_notification_ep;20402041#define NG_HCI_EVENT_LOOPBACK_COMMAND 0x192042typedef struct {2043u_int8_t command[0]; /* Command packet */2044} __attribute__ ((packed)) ng_hci_loopback_command_ep;20452046#define NG_HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a2047typedef struct {2048u_int8_t link_type; /* Link type */2049} __attribute__ ((packed)) ng_hci_data_buffer_overflow_ep;20502051#define NG_HCI_EVENT_MAX_SLOT_CHANGE 0x1b2052typedef struct {2053u_int16_t con_handle; /* connection handle */2054u_int8_t lmp_max_slots; /* Max. # of slots allowed */2055} __attribute__ ((packed)) ng_hci_max_slot_change_ep;20562057#define NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c2058typedef struct {2059u_int8_t status; /* 0x00 - success */2060u_int16_t con_handle; /* Connection handle */2061u_int16_t clock_offset; /* Clock offset */2062} __attribute__ ((packed)) ng_hci_read_clock_offset_compl_ep;20632064#define NG_HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d2065typedef struct {2066u_int8_t status; /* 0x00 - success */2067u_int16_t con_handle; /* connection handle */2068u_int16_t pkt_type; /* packet type */2069} __attribute__ ((packed)) ng_hci_con_pkt_type_changed_ep;20702071#define NG_HCI_EVENT_QOS_VIOLATION 0x1e2072typedef struct {2073u_int16_t con_handle; /* connection handle */2074} __attribute__ ((packed)) ng_hci_qos_violation_ep;20752076#define NG_HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f2077typedef struct {2078bdaddr_t bdaddr; /* destination address */2079u_int8_t page_scan_mode; /* page scan mode */2080} __attribute__ ((packed)) ng_hci_page_scan_mode_change_ep;20812082#define NG_HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x202083typedef struct {2084bdaddr_t bdaddr; /* destination address */2085u_int8_t page_scan_rep_mode; /* page scan repetition mode */2086} __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep;20872088#define NG_HCI_EVENT_IO_CAPABILITY_REQUEST 0x312089typedef struct {2090bdaddr_t bdaddr;2091} __attribute__ ((packed)) ng_hci_io_capability_request_ep;20922093#define NG_HCI_EVENT_USER_CONFIRMATION_REQUEST 0x332094typedef struct {2095bdaddr_t bdaddr;2096u_int32_t numeric_value;2097} __attribute__ ((packed)) ng_hci_user_confirmation_request_ep;20982099#define NG_HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x362100typedef struct {2101u_int8_t status;2102bdaddr_t bdaddr;2103} __attribute__ ((packed)) ng_hci_simple_pairing_complete_ep;21042105#define NG_HCI_EVENT_LE 0x3e2106typedef struct {2107u_int8_t subevent_code;2108}__attribute__ ((packed)) ng_hci_le_ep;21092110#define NG_HCI_LEEV_CON_COMPL 0x0121112112typedef struct {2113u_int8_t status;2114u_int16_t handle;2115u_int8_t role;2116u_int8_t address_type;2117bdaddr_t address;2118u_int16_t interval;2119u_int8_t latency;2120u_int16_t supervision_timeout;2121u_int8_t master_clock_accuracy;21222123} __attribute__ ((packed)) ng_hci_le_connection_complete_ep;21242125#define NG_HCI_LEEV_ADVREP 0x022126typedef struct {2127u_int8_t num_reports;21282129}__attribute__ ((packed)) ng_hci_le_advertising_report_ep;2130#define NG_HCI_SCAN_RESPONSE_DATA_MAX 0x1f21312132typedef struct {2133u_int8_t event_type;2134u_int8_t addr_type;2135bdaddr_t bdaddr;2136u_int8_t length_data;2137/* The last octet is for RSSI */2138u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX+1];2139}__attribute__((packed)) ng_hci_le_advreport;21402141#define NG_HCI_LEEV_CON_UPDATE_COMPL 0x032142typedef struct {2143u_int8_t status;2144u_int16_t connection_handle;2145u_int16_t conn_interval;2146u_int16_t conn_latency;2147u_int16_t supervision_timeout;2148}__attribute__((packed)) ng_hci_connection_update_complete_ep;21492150#define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x042151typedef struct {2152u_int8_t status;2153u_int16_t connection_handle;2154u_int8_t features[NG_HCI_FEATURES_SIZE];2155}__attribute__((packed)) ng_hci_le_read_remote_features_ep;21562157#define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x052158typedef struct {2159u_int16_t connection_handle;2160u_int64_t random_number;2161u_int16_t encrypted_diversifier;2162}__attribute__((packed)) ng_hci_le_long_term_key_request_ep;21632164#define NG_HCI_LEEV_REMOTE_CONN_PARAM_REQUEST 0x062165typedef struct {2166u_int16_t connection_handle;2167u_int16_t interval_min;2168u_int16_t interval_max;2169u_int16_t latency;2170u_int16_t timeout;2171}__attribute__((packed)) ng_hci_le_remote_conn_param_ep;21722173#define NG_HCI_LEEV_DATA_LENGTH_CHANGE 0x072174typedef struct {2175u_int16_t connection_handle;2176u_int16_t min_tx_octets;2177u_int16_t max_tx_time;2178u_int16_t max_rx_octets;2179u_int16_t max_rx_time;2180}__attribute__((packed)) ng_hci_le_data_length_change_ep;21812182#define NG_HCI_LEEV_READ_LOCAL_P256_PK_COMPL 0x082183typedef struct {2184u_int8_t status;2185u_int8_t local_p256_pk[64];2186}__attribute__((packed)) ng_hci_le_read_local_p256_pk_compl_ep;21872188#define NG_HCI_LEEV_GEN_DHKEY_COMPL 0x092189typedef struct {2190u_int8_t status;2191u_int8_t dh_key[32];2192}__attribute__((packed)) ng_hci_le_gen_dhkey_compl_ep;21932194#define NG_HCI_LEEV_ENH_CONN_COMPL 0x0a2195typedef struct {2196u_int8_t status;2197u_int16_t connection_handle;2198u_int8_t role;2199u_int8_t peer_addr_type;2200bdaddr_t peer_addr;2201bdaddr_t local_res_private_addr;2202bdaddr_t peer_res_private_addr;2203u_int16_t conn_interval;2204u_int16_t conn_latency;2205u_int16_t supervision_timeout;2206u_int8_t master_clock_accuracy;2207}__attribute__((packed)) ng_hci_le_enh_conn_compl_ep;22082209#define NG_HCI_EVENT_BT_LOGO 0xfe22102211#define NG_HCI_EVENT_VENDOR 0xff22122213#endif /* ndef _NETGRAPH_HCI_H_ */221422152216