18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci BlueZ - Bluetooth protocol stack for Linux 38c2ecf20Sopenharmony_ci Copyright (C) 2000-2001 Qualcomm Incorporated 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci This program is free software; you can redistribute it and/or modify 88c2ecf20Sopenharmony_ci it under the terms of the GNU General Public License version 2 as 98c2ecf20Sopenharmony_ci published by the Free Software Foundation; 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 128c2ecf20Sopenharmony_ci OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 138c2ecf20Sopenharmony_ci FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 148c2ecf20Sopenharmony_ci IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 158c2ecf20Sopenharmony_ci CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 168c2ecf20Sopenharmony_ci WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 178c2ecf20Sopenharmony_ci ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 188c2ecf20Sopenharmony_ci OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 218c2ecf20Sopenharmony_ci COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 228c2ecf20Sopenharmony_ci SOFTWARE IS DISCLAIMED. 238c2ecf20Sopenharmony_ci*/ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#ifndef __HCI_SOCK_H 268c2ecf20Sopenharmony_ci#define __HCI_SOCK_H 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* Socket options */ 298c2ecf20Sopenharmony_ci#define HCI_DATA_DIR 1 308c2ecf20Sopenharmony_ci#define HCI_FILTER 2 318c2ecf20Sopenharmony_ci#define HCI_TIME_STAMP 3 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* CMSG flags */ 348c2ecf20Sopenharmony_ci#define HCI_CMSG_DIR 0x01 358c2ecf20Sopenharmony_ci#define HCI_CMSG_TSTAMP 0x02 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct sockaddr_hci { 388c2ecf20Sopenharmony_ci sa_family_t hci_family; 398c2ecf20Sopenharmony_ci unsigned short hci_dev; 408c2ecf20Sopenharmony_ci unsigned short hci_channel; 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci#define HCI_DEV_NONE 0xffff 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define HCI_CHANNEL_RAW 0 458c2ecf20Sopenharmony_ci#define HCI_CHANNEL_USER 1 468c2ecf20Sopenharmony_ci#define HCI_CHANNEL_MONITOR 2 478c2ecf20Sopenharmony_ci#define HCI_CHANNEL_CONTROL 3 488c2ecf20Sopenharmony_ci#define HCI_CHANNEL_LOGGING 4 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistruct hci_filter { 518c2ecf20Sopenharmony_ci unsigned long type_mask; 528c2ecf20Sopenharmony_ci unsigned long event_mask[2]; 538c2ecf20Sopenharmony_ci __le16 opcode; 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistruct hci_ufilter { 578c2ecf20Sopenharmony_ci __u32 type_mask; 588c2ecf20Sopenharmony_ci __u32 event_mask[2]; 598c2ecf20Sopenharmony_ci __le16 opcode; 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define HCI_FLT_TYPE_BITS 31 638c2ecf20Sopenharmony_ci#define HCI_FLT_EVENT_BITS 63 648c2ecf20Sopenharmony_ci#define HCI_FLT_OGF_BITS 63 658c2ecf20Sopenharmony_ci#define HCI_FLT_OCF_BITS 127 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Ioctl defines */ 688c2ecf20Sopenharmony_ci#define HCIDEVUP _IOW('H', 201, int) 698c2ecf20Sopenharmony_ci#define HCIDEVDOWN _IOW('H', 202, int) 708c2ecf20Sopenharmony_ci#define HCIDEVRESET _IOW('H', 203, int) 718c2ecf20Sopenharmony_ci#define HCIDEVRESTAT _IOW('H', 204, int) 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define HCIGETDEVLIST _IOR('H', 210, int) 748c2ecf20Sopenharmony_ci#define HCIGETDEVINFO _IOR('H', 211, int) 758c2ecf20Sopenharmony_ci#define HCIGETCONNLIST _IOR('H', 212, int) 768c2ecf20Sopenharmony_ci#define HCIGETCONNINFO _IOR('H', 213, int) 778c2ecf20Sopenharmony_ci#define HCIGETAUTHINFO _IOR('H', 215, int) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define HCISETRAW _IOW('H', 220, int) 808c2ecf20Sopenharmony_ci#define HCISETSCAN _IOW('H', 221, int) 818c2ecf20Sopenharmony_ci#define HCISETAUTH _IOW('H', 222, int) 828c2ecf20Sopenharmony_ci#define HCISETENCRYPT _IOW('H', 223, int) 838c2ecf20Sopenharmony_ci#define HCISETPTYPE _IOW('H', 224, int) 848c2ecf20Sopenharmony_ci#define HCISETLINKPOL _IOW('H', 225, int) 858c2ecf20Sopenharmony_ci#define HCISETLINKMODE _IOW('H', 226, int) 868c2ecf20Sopenharmony_ci#define HCISETACLMTU _IOW('H', 227, int) 878c2ecf20Sopenharmony_ci#define HCISETSCOMTU _IOW('H', 228, int) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define HCIBLOCKADDR _IOW('H', 230, int) 908c2ecf20Sopenharmony_ci#define HCIUNBLOCKADDR _IOW('H', 231, int) 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define HCIINQUIRY _IOR('H', 240, int) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* Ioctl requests structures */ 958c2ecf20Sopenharmony_cistruct hci_dev_stats { 968c2ecf20Sopenharmony_ci __u32 err_rx; 978c2ecf20Sopenharmony_ci __u32 err_tx; 988c2ecf20Sopenharmony_ci __u32 cmd_tx; 998c2ecf20Sopenharmony_ci __u32 evt_rx; 1008c2ecf20Sopenharmony_ci __u32 acl_tx; 1018c2ecf20Sopenharmony_ci __u32 acl_rx; 1028c2ecf20Sopenharmony_ci __u32 sco_tx; 1038c2ecf20Sopenharmony_ci __u32 sco_rx; 1048c2ecf20Sopenharmony_ci __u32 byte_rx; 1058c2ecf20Sopenharmony_ci __u32 byte_tx; 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistruct hci_dev_info { 1098c2ecf20Sopenharmony_ci __u16 dev_id; 1108c2ecf20Sopenharmony_ci char name[8]; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci bdaddr_t bdaddr; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci __u32 flags; 1158c2ecf20Sopenharmony_ci __u8 type; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci __u8 features[8]; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci __u32 pkt_type; 1208c2ecf20Sopenharmony_ci __u32 link_policy; 1218c2ecf20Sopenharmony_ci __u32 link_mode; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci __u16 acl_mtu; 1248c2ecf20Sopenharmony_ci __u16 acl_pkts; 1258c2ecf20Sopenharmony_ci __u16 sco_mtu; 1268c2ecf20Sopenharmony_ci __u16 sco_pkts; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci struct hci_dev_stats stat; 1298c2ecf20Sopenharmony_ci}; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistruct hci_conn_info { 1328c2ecf20Sopenharmony_ci __u16 handle; 1338c2ecf20Sopenharmony_ci bdaddr_t bdaddr; 1348c2ecf20Sopenharmony_ci __u8 type; 1358c2ecf20Sopenharmony_ci __u8 out; 1368c2ecf20Sopenharmony_ci __u16 state; 1378c2ecf20Sopenharmony_ci __u32 link_mode; 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistruct hci_dev_req { 1418c2ecf20Sopenharmony_ci __u16 dev_id; 1428c2ecf20Sopenharmony_ci __u32 dev_opt; 1438c2ecf20Sopenharmony_ci}; 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_cistruct hci_dev_list_req { 1468c2ecf20Sopenharmony_ci __u16 dev_num; 1478c2ecf20Sopenharmony_ci struct hci_dev_req dev_req[]; /* hci_dev_req structures */ 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistruct hci_conn_list_req { 1518c2ecf20Sopenharmony_ci __u16 dev_id; 1528c2ecf20Sopenharmony_ci __u16 conn_num; 1538c2ecf20Sopenharmony_ci struct hci_conn_info conn_info[]; 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistruct hci_conn_info_req { 1578c2ecf20Sopenharmony_ci bdaddr_t bdaddr; 1588c2ecf20Sopenharmony_ci __u8 type; 1598c2ecf20Sopenharmony_ci struct hci_conn_info conn_info[]; 1608c2ecf20Sopenharmony_ci}; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct hci_auth_info_req { 1638c2ecf20Sopenharmony_ci bdaddr_t bdaddr; 1648c2ecf20Sopenharmony_ci __u8 type; 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistruct hci_inquiry_req { 1688c2ecf20Sopenharmony_ci __u16 dev_id; 1698c2ecf20Sopenharmony_ci __u16 flags; 1708c2ecf20Sopenharmony_ci __u8 lap[3]; 1718c2ecf20Sopenharmony_ci __u8 length; 1728c2ecf20Sopenharmony_ci __u8 num_rsp; 1738c2ecf20Sopenharmony_ci}; 1748c2ecf20Sopenharmony_ci#define IREQ_CACHE_FLUSH 0x0001 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#endif /* __HCI_SOCK_H */ 177