hci_sock.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. BlueZ - Bluetooth protocol stack for Linux
  3. Copyright (C) 2000-2001 Qualcomm Incorporated
  4. Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License version 2 as
  7. published by the Free Software Foundation;
  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. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
  17. COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
  18. SOFTWARE IS DISCLAIMED.
  19. */
  20. #ifndef __HCI_SOCK_H
  21. #define __HCI_SOCK_H
  22. /* Socket options */
  23. #define HCI_DATA_DIR 1
  24. #define HCI_FILTER 2
  25. #define HCI_TIME_STAMP 3
  26. /* CMSG flags */
  27. #define HCI_CMSG_DIR 0x0001
  28. #define HCI_CMSG_TSTAMP 0x0002
  29. struct sockaddr_hci {
  30. sa_family_t hci_family;
  31. unsigned short hci_dev;
  32. unsigned short hci_channel;
  33. };
  34. #define HCI_DEV_NONE 0xffff
  35. #define HCI_CHANNEL_RAW 0
  36. #define HCI_CHANNEL_USER 1
  37. #define HCI_CHANNEL_MONITOR 2
  38. #define HCI_CHANNEL_CONTROL 3
  39. #define HCI_CHANNEL_LOGGING 4
  40. struct hci_filter {
  41. unsigned long type_mask;
  42. unsigned long event_mask[2];
  43. __le16 opcode;
  44. };
  45. struct hci_ufilter {
  46. __u32 type_mask;
  47. __u32 event_mask[2];
  48. __le16 opcode;
  49. };
  50. #define HCI_FLT_TYPE_BITS 31
  51. #define HCI_FLT_EVENT_BITS 63
  52. #define HCI_FLT_OGF_BITS 63
  53. #define HCI_FLT_OCF_BITS 127
  54. /* Ioctl defines */
  55. #define HCIDEVUP _IOW('H', 201, int)
  56. #define HCIDEVDOWN _IOW('H', 202, int)
  57. #define HCIDEVRESET _IOW('H', 203, int)
  58. #define HCIDEVRESTAT _IOW('H', 204, int)
  59. #define HCIGETDEVLIST _IOR('H', 210, int)
  60. #define HCIGETDEVINFO _IOR('H', 211, int)
  61. #define HCIGETCONNLIST _IOR('H', 212, int)
  62. #define HCIGETCONNINFO _IOR('H', 213, int)
  63. #define HCIGETAUTHINFO _IOR('H', 215, int)
  64. #define HCISETRAW _IOW('H', 220, int)
  65. #define HCISETSCAN _IOW('H', 221, int)
  66. #define HCISETAUTH _IOW('H', 222, int)
  67. #define HCISETENCRYPT _IOW('H', 223, int)
  68. #define HCISETPTYPE _IOW('H', 224, int)
  69. #define HCISETLINKPOL _IOW('H', 225, int)
  70. #define HCISETLINKMODE _IOW('H', 226, int)
  71. #define HCISETACLMTU _IOW('H', 227, int)
  72. #define HCISETSCOMTU _IOW('H', 228, int)
  73. #define HCIBLOCKADDR _IOW('H', 230, int)
  74. #define HCIUNBLOCKADDR _IOW('H', 231, int)
  75. #define HCIINQUIRY _IOR('H', 240, int)
  76. /* Ioctl requests structures */
  77. struct hci_dev_stats {
  78. __u32 err_rx;
  79. __u32 err_tx;
  80. __u32 cmd_tx;
  81. __u32 evt_rx;
  82. __u32 acl_tx;
  83. __u32 acl_rx;
  84. __u32 sco_tx;
  85. __u32 sco_rx;
  86. __u32 byte_rx;
  87. __u32 byte_tx;
  88. };
  89. struct hci_dev_info {
  90. __u16 dev_id;
  91. char name[8];
  92. bdaddr_t bdaddr;
  93. __u32 flags;
  94. __u8 type;
  95. __u8 features[8];
  96. __u32 pkt_type;
  97. __u32 link_policy;
  98. __u32 link_mode;
  99. __u16 acl_mtu;
  100. __u16 acl_pkts;
  101. __u16 sco_mtu;
  102. __u16 sco_pkts;
  103. struct hci_dev_stats stat;
  104. };
  105. struct hci_conn_info {
  106. __u16 handle;
  107. bdaddr_t bdaddr;
  108. __u8 type;
  109. __u8 out;
  110. __u16 state;
  111. __u32 link_mode;
  112. };
  113. struct hci_dev_req {
  114. __u16 dev_id;
  115. __u32 dev_opt;
  116. };
  117. struct hci_dev_list_req {
  118. __u16 dev_num;
  119. struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
  120. };
  121. struct hci_conn_list_req {
  122. __u16 dev_id;
  123. __u16 conn_num;
  124. struct hci_conn_info conn_info[0];
  125. };
  126. struct hci_conn_info_req {
  127. bdaddr_t bdaddr;
  128. __u8 type;
  129. struct hci_conn_info conn_info[0];
  130. };
  131. struct hci_auth_info_req {
  132. bdaddr_t bdaddr;
  133. __u8 type;
  134. };
  135. struct hci_inquiry_req {
  136. __u16 dev_id;
  137. __u16 flags;
  138. __u8 lap[3];
  139. __u8 length;
  140. __u8 num_rsp;
  141. };
  142. #define IREQ_CACHE_FLUSH 0x0001
  143. #endif /* __HCI_SOCK_H */