mgmt.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /*
  2. BlueZ - Bluetooth protocol stack for Linux
  3. Copyright (C) 2010 Nokia Corporation
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License version 2 as
  6. published by the Free Software Foundation;
  7. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  8. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  10. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
  11. CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
  12. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
  16. COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
  17. SOFTWARE IS DISCLAIMED.
  18. */
  19. #define MGMT_INDEX_NONE 0xFFFF
  20. struct mgmt_hdr {
  21. __le16 opcode;
  22. __le16 index;
  23. __le16 len;
  24. } __packed;
  25. #define MGMT_OP_READ_VERSION 0x0001
  26. struct mgmt_rp_read_version {
  27. __u8 version;
  28. __le16 revision;
  29. } __packed;
  30. #define MGMT_OP_READ_INDEX_LIST 0x0003
  31. struct mgmt_rp_read_index_list {
  32. __le16 num_controllers;
  33. __le16 index[0];
  34. } __packed;
  35. #define MGMT_OP_READ_INFO 0x0004
  36. struct mgmt_rp_read_info {
  37. __u8 type;
  38. __u8 powered;
  39. __u8 connectable;
  40. __u8 discoverable;
  41. __u8 pairable;
  42. __u8 sec_mode;
  43. bdaddr_t bdaddr;
  44. __u8 dev_class[3];
  45. __u8 features[8];
  46. __u16 manufacturer;
  47. __u8 hci_ver;
  48. __u16 hci_rev;
  49. } __packed;
  50. struct mgmt_mode {
  51. __u8 val;
  52. } __packed;
  53. #define MGMT_OP_SET_POWERED 0x0005
  54. #define MGMT_OP_SET_DISCOVERABLE 0x0006
  55. #define MGMT_OP_SET_CONNECTABLE 0x0007
  56. #define MGMT_OP_SET_PAIRABLE 0x0008
  57. #define MGMT_OP_ADD_UUID 0x0009
  58. struct mgmt_cp_add_uuid {
  59. __u8 uuid[16];
  60. __u8 svc_hint;
  61. } __packed;
  62. #define MGMT_OP_REMOVE_UUID 0x000A
  63. struct mgmt_cp_remove_uuid {
  64. __u8 uuid[16];
  65. } __packed;
  66. #define MGMT_OP_SET_DEV_CLASS 0x000B
  67. struct mgmt_cp_set_dev_class {
  68. __u8 major;
  69. __u8 minor;
  70. } __packed;
  71. #define MGMT_OP_SET_SERVICE_CACHE 0x000C
  72. struct mgmt_cp_set_service_cache {
  73. __u8 enable;
  74. } __packed;
  75. struct mgmt_key_info {
  76. bdaddr_t bdaddr;
  77. u8 type;
  78. u8 val[16];
  79. u8 pin_len;
  80. } __packed;
  81. #define MGMT_OP_LOAD_KEYS 0x000D
  82. struct mgmt_cp_load_keys {
  83. __u8 debug_keys;
  84. __le16 key_count;
  85. struct mgmt_key_info keys[0];
  86. } __packed;
  87. #define MGMT_OP_REMOVE_KEY 0x000E
  88. struct mgmt_cp_remove_key {
  89. bdaddr_t bdaddr;
  90. __u8 disconnect;
  91. } __packed;
  92. #define MGMT_OP_DISCONNECT 0x000F
  93. struct mgmt_cp_disconnect {
  94. bdaddr_t bdaddr;
  95. } __packed;
  96. struct mgmt_rp_disconnect {
  97. bdaddr_t bdaddr;
  98. } __packed;
  99. #define MGMT_OP_GET_CONNECTIONS 0x0010
  100. struct mgmt_rp_get_connections {
  101. __le16 conn_count;
  102. bdaddr_t conn[0];
  103. } __packed;
  104. #define MGMT_OP_PIN_CODE_REPLY 0x0011
  105. struct mgmt_cp_pin_code_reply {
  106. bdaddr_t bdaddr;
  107. __u8 pin_len;
  108. __u8 pin_code[16];
  109. } __packed;
  110. struct mgmt_rp_pin_code_reply {
  111. bdaddr_t bdaddr;
  112. uint8_t status;
  113. } __packed;
  114. #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
  115. struct mgmt_cp_pin_code_neg_reply {
  116. bdaddr_t bdaddr;
  117. } __packed;
  118. #define MGMT_OP_SET_IO_CAPABILITY 0x0013
  119. struct mgmt_cp_set_io_capability {
  120. __u8 io_capability;
  121. } __packed;
  122. #define MGMT_OP_PAIR_DEVICE 0x0014
  123. struct mgmt_cp_pair_device {
  124. bdaddr_t bdaddr;
  125. __u8 io_cap;
  126. } __packed;
  127. struct mgmt_rp_pair_device {
  128. bdaddr_t bdaddr;
  129. __u8 status;
  130. } __packed;
  131. #define MGMT_OP_USER_CONFIRM_REPLY 0x0015
  132. struct mgmt_cp_user_confirm_reply {
  133. bdaddr_t bdaddr;
  134. } __packed;
  135. struct mgmt_rp_user_confirm_reply {
  136. bdaddr_t bdaddr;
  137. __u8 status;
  138. } __packed;
  139. #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016
  140. #define MGMT_EV_CMD_COMPLETE 0x0001
  141. struct mgmt_ev_cmd_complete {
  142. __le16 opcode;
  143. __u8 data[0];
  144. } __packed;
  145. #define MGMT_EV_CMD_STATUS 0x0002
  146. struct mgmt_ev_cmd_status {
  147. __u8 status;
  148. __le16 opcode;
  149. } __packed;
  150. #define MGMT_EV_CONTROLLER_ERROR 0x0003
  151. struct mgmt_ev_controller_error {
  152. __u8 error_code;
  153. } __packed;
  154. #define MGMT_EV_INDEX_ADDED 0x0004
  155. #define MGMT_EV_INDEX_REMOVED 0x0005
  156. #define MGMT_EV_POWERED 0x0006
  157. #define MGMT_EV_DISCOVERABLE 0x0007
  158. #define MGMT_EV_CONNECTABLE 0x0008
  159. #define MGMT_EV_PAIRABLE 0x0009
  160. #define MGMT_EV_NEW_KEY 0x000A
  161. struct mgmt_ev_new_key {
  162. struct mgmt_key_info key;
  163. __u8 old_key_type;
  164. } __packed;
  165. #define MGMT_EV_CONNECTED 0x000B
  166. struct mgmt_ev_connected {
  167. bdaddr_t bdaddr;
  168. } __packed;
  169. #define MGMT_EV_DISCONNECTED 0x000C
  170. struct mgmt_ev_disconnected {
  171. bdaddr_t bdaddr;
  172. } __packed;
  173. #define MGMT_EV_CONNECT_FAILED 0x000D
  174. struct mgmt_ev_connect_failed {
  175. bdaddr_t bdaddr;
  176. __u8 status;
  177. } __packed;
  178. #define MGMT_EV_PIN_CODE_REQUEST 0x000E
  179. struct mgmt_ev_pin_code_request {
  180. bdaddr_t bdaddr;
  181. } __packed;
  182. #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
  183. struct mgmt_ev_user_confirm_request {
  184. bdaddr_t bdaddr;
  185. __le32 value;
  186. } __packed;
  187. #define MGMT_EV_AUTH_FAILED 0x0010
  188. struct mgmt_ev_auth_failed {
  189. bdaddr_t bdaddr;
  190. __u8 status;
  191. } __packed;