1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 BlueZ - Bluetooth protocol stack for Linux 4 Copyright (C) 2000-2001 Qualcomm Incorporated 5 6 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 7 8 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 9 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 11 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 12 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 13 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 17 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 18 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 19 SOFTWARE IS DISCLAIMED. 20 */ 21 22 #ifndef __HCI_SOCK_H 23 #define __HCI_SOCK_H 24 25 /* Socket options */ 26 #define HCI_DATA_DIR 1 27 #define HCI_FILTER 2 28 #define HCI_TIME_STAMP 3 29 30 /* CMSG flags */ 31 #define HCI_CMSG_DIR 0x01 32 #define HCI_CMSG_TSTAMP 0x02 33 34 struct sockaddr_hci { 35 sa_family_t hci_family; 36 unsigned short hci_dev; 37 unsigned short hci_channel; 38 }; 39 #define HCI_DEV_NONE 0xffff 40 41 #define HCI_CHANNEL_RAW 0 42 #define HCI_CHANNEL_USER 1 43 #define HCI_CHANNEL_MONITOR 2 44 #define HCI_CHANNEL_CONTROL 3 45 #define HCI_CHANNEL_LOGGING 4 46 47 struct hci_filter { 48 unsigned long type_mask; 49 unsigned long event_mask[2]; 50 __le16 opcode; 51 }; 52 53 struct hci_ufilter { 54 __u32 type_mask; 55 __u32 event_mask[2]; 56 __le16 opcode; 57 }; 58 59 #define HCI_FLT_TYPE_BITS 31 60 #define HCI_FLT_EVENT_BITS 63 61 #define HCI_FLT_OGF_BITS 63 62 #define HCI_FLT_OCF_BITS 127 63 64 /* Ioctl defines */ 65 #define HCIDEVUP _IOW('H', 201, int) 66 #define HCIDEVDOWN _IOW('H', 202, int) 67 #define HCIDEVRESET _IOW('H', 203, int) 68 #define HCIDEVRESTAT _IOW('H', 204, int) 69 70 #define HCIGETDEVLIST _IOR('H', 210, int) 71 #define HCIGETDEVINFO _IOR('H', 211, int) 72 #define HCIGETCONNLIST _IOR('H', 212, int) 73 #define HCIGETCONNINFO _IOR('H', 213, int) 74 #define HCIGETAUTHINFO _IOR('H', 215, int) 75 76 #define HCISETRAW _IOW('H', 220, int) 77 #define HCISETSCAN _IOW('H', 221, int) 78 #define HCISETAUTH _IOW('H', 222, int) 79 #define HCISETENCRYPT _IOW('H', 223, int) 80 #define HCISETPTYPE _IOW('H', 224, int) 81 #define HCISETLINKPOL _IOW('H', 225, int) 82 #define HCISETLINKMODE _IOW('H', 226, int) 83 #define HCISETACLMTU _IOW('H', 227, int) 84 #define HCISETSCOMTU _IOW('H', 228, int) 85 86 #define HCIBLOCKADDR _IOW('H', 230, int) 87 #define HCIUNBLOCKADDR _IOW('H', 231, int) 88 89 #define HCIINQUIRY _IOR('H', 240, int) 90 91 /* Ioctl requests structures */ 92 struct hci_dev_stats { 93 __u32 err_rx; 94 __u32 err_tx; 95 __u32 cmd_tx; 96 __u32 evt_rx; 97 __u32 acl_tx; 98 __u32 acl_rx; 99 __u32 sco_tx; 100 __u32 sco_rx; 101 __u32 byte_rx; 102 __u32 byte_tx; 103 }; 104 105 struct hci_dev_info { 106 __u16 dev_id; 107 char name[8]; 108 109 bdaddr_t bdaddr; 110 111 __u32 flags; 112 __u8 type; 113 114 __u8 features[8]; 115 116 __u32 pkt_type; 117 __u32 link_policy; 118 __u32 link_mode; 119 120 __u16 acl_mtu; 121 __u16 acl_pkts; 122 __u16 sco_mtu; 123 __u16 sco_pkts; 124 125 struct hci_dev_stats stat; 126 }; 127 128 struct hci_conn_info { 129 __u16 handle; 130 bdaddr_t bdaddr; 131 __u8 type; 132 __u8 out; 133 __u16 state; 134 __u32 link_mode; 135 }; 136 137 struct hci_dev_req { 138 __u16 dev_id; 139 __u32 dev_opt; 140 }; 141 142 struct hci_dev_list_req { 143 __u16 dev_num; 144 struct hci_dev_req dev_req[] __counted_by(dev_num); 145 }; 146 147 struct hci_conn_list_req { 148 __u16 dev_id; 149 __u16 conn_num; 150 struct hci_conn_info conn_info[]; 151 }; 152 153 struct hci_conn_info_req { 154 bdaddr_t bdaddr; 155 __u8 type; 156 struct hci_conn_info conn_info[]; 157 }; 158 159 struct hci_auth_info_req { 160 bdaddr_t bdaddr; 161 __u8 type; 162 }; 163 164 struct hci_inquiry_req { 165 __u16 dev_id; 166 __u16 flags; 167 __u8 lap[3]; 168 __u8 length; 169 __u8 num_rsp; 170 }; 171 #define IREQ_CACHE_FLUSH 0x0001 172 173 #endif /* __HCI_SOCK_H */ 174