diff options
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 40 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 79 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 303 | ||||
-rw-r--r-- | include/net/bluetooth/hci_mon.h | 51 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 87 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 338 | ||||
-rw-r--r-- | include/net/bluetooth/smp.h | 2 |
7 files changed, 611 insertions, 289 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 4a82ca0bb0b2..262ebd1747d4 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -109,12 +109,14 @@ struct bt_power { | |||
109 | */ | 109 | */ |
110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 | 110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 |
111 | 111 | ||
112 | __printf(2, 3) | 112 | __printf(1, 2) |
113 | int bt_printk(const char *level, const char *fmt, ...); | 113 | int bt_info(const char *fmt, ...); |
114 | __printf(1, 2) | ||
115 | int bt_err(const char *fmt, ...); | ||
114 | 116 | ||
115 | #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) | 117 | #define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) |
116 | #define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) | 118 | #define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) |
117 | #define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) | 119 | #define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) |
118 | 120 | ||
119 | /* Connection and socket states */ | 121 | /* Connection and socket states */ |
120 | enum { | 122 | enum { |
@@ -129,6 +131,33 @@ enum { | |||
129 | BT_CLOSED | 131 | BT_CLOSED |
130 | }; | 132 | }; |
131 | 133 | ||
134 | /* If unused will be removed by compiler */ | ||
135 | static inline const char *state_to_string(int state) | ||
136 | { | ||
137 | switch (state) { | ||
138 | case BT_CONNECTED: | ||
139 | return "BT_CONNECTED"; | ||
140 | case BT_OPEN: | ||
141 | return "BT_OPEN"; | ||
142 | case BT_BOUND: | ||
143 | return "BT_BOUND"; | ||
144 | case BT_LISTEN: | ||
145 | return "BT_LISTEN"; | ||
146 | case BT_CONNECT: | ||
147 | return "BT_CONNECT"; | ||
148 | case BT_CONNECT2: | ||
149 | return "BT_CONNECT2"; | ||
150 | case BT_CONFIG: | ||
151 | return "BT_CONFIG"; | ||
152 | case BT_DISCONN: | ||
153 | return "BT_DISCONN"; | ||
154 | case BT_CLOSED: | ||
155 | return "BT_CLOSED"; | ||
156 | } | ||
157 | |||
158 | return "invalid state"; | ||
159 | } | ||
160 | |||
132 | /* BD Address */ | 161 | /* BD Address */ |
133 | typedef struct { | 162 | typedef struct { |
134 | __u8 b[6]; | 163 | __u8 b[6]; |
@@ -193,7 +222,6 @@ struct bt_skb_cb { | |||
193 | __u16 tx_seq; | 222 | __u16 tx_seq; |
194 | __u8 retries; | 223 | __u8 retries; |
195 | __u8 sar; | 224 | __u8 sar; |
196 | unsigned short channel; | ||
197 | __u8 force_active; | 225 | __u8 force_active; |
198 | }; | 226 | }; |
199 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 227 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 00596e816b4d..d47e523c9d83 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -77,14 +77,6 @@ enum { | |||
77 | 77 | ||
78 | HCI_RAW, | 78 | HCI_RAW, |
79 | 79 | ||
80 | HCI_SETUP, | ||
81 | HCI_AUTO_OFF, | ||
82 | HCI_MGMT, | ||
83 | HCI_PAIRABLE, | ||
84 | HCI_SERVICE_CACHE, | ||
85 | HCI_LINK_KEYS, | ||
86 | HCI_DEBUG_KEYS, | ||
87 | |||
88 | HCI_RESET, | 80 | HCI_RESET, |
89 | }; | 81 | }; |
90 | 82 | ||
@@ -93,7 +85,23 @@ enum { | |||
93 | * states from the controller. | 85 | * states from the controller. |
94 | */ | 86 | */ |
95 | enum { | 87 | enum { |
88 | HCI_SETUP, | ||
89 | HCI_AUTO_OFF, | ||
90 | HCI_MGMT, | ||
91 | HCI_PAIRABLE, | ||
92 | HCI_SERVICE_CACHE, | ||
93 | HCI_LINK_KEYS, | ||
94 | HCI_DEBUG_KEYS, | ||
95 | HCI_UNREGISTER, | ||
96 | |||
96 | HCI_LE_SCAN, | 97 | HCI_LE_SCAN, |
98 | HCI_SSP_ENABLED, | ||
99 | HCI_HS_ENABLED, | ||
100 | HCI_LE_ENABLED, | ||
101 | HCI_CONNECTABLE, | ||
102 | HCI_DISCOVERABLE, | ||
103 | HCI_LINK_SECURITY, | ||
104 | HCI_PENDING_CLASS, | ||
97 | }; | 105 | }; |
98 | 106 | ||
99 | /* HCI ioctl defines */ | 107 | /* HCI ioctl defines */ |
@@ -130,6 +138,7 @@ enum { | |||
130 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 138 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
131 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 139 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ |
132 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | 140 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ |
141 | #define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */ | ||
133 | 142 | ||
134 | /* HCI data types */ | 143 | /* HCI data types */ |
135 | #define HCI_COMMAND_PKT 0x01 | 144 | #define HCI_COMMAND_PKT 0x01 |
@@ -229,7 +238,9 @@ enum { | |||
229 | #define LMP_EXTFEATURES 0x80 | 238 | #define LMP_EXTFEATURES 0x80 |
230 | 239 | ||
231 | /* Extended LMP features */ | 240 | /* Extended LMP features */ |
232 | #define LMP_HOST_LE 0x02 | 241 | #define LMP_HOST_SSP 0x01 |
242 | #define LMP_HOST_LE 0x02 | ||
243 | #define LMP_HOST_LE_BREDR 0x04 | ||
233 | 244 | ||
234 | /* Connection modes */ | 245 | /* Connection modes */ |
235 | #define HCI_CM_ACTIVE 0x0000 | 246 | #define HCI_CM_ACTIVE 0x0000 |
@@ -268,10 +279,11 @@ enum { | |||
268 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | 279 | #define HCI_LK_UNAUTH_COMBINATION 0x04 |
269 | #define HCI_LK_AUTH_COMBINATION 0x05 | 280 | #define HCI_LK_AUTH_COMBINATION 0x05 |
270 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 281 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
271 | /* The spec doesn't define types for SMP keys */ | 282 | /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ |
272 | #define HCI_LK_SMP_LTK 0x81 | 283 | #define HCI_SMP_STK 0x80 |
273 | #define HCI_LK_SMP_IRK 0x82 | 284 | #define HCI_SMP_STK_SLAVE 0x81 |
274 | #define HCI_LK_SMP_CSRK 0x83 | 285 | #define HCI_SMP_LTK 0x82 |
286 | #define HCI_SMP_LTK_SLAVE 0x83 | ||
275 | 287 | ||
276 | /* ---- HCI Error Codes ---- */ | 288 | /* ---- HCI Error Codes ---- */ |
277 | #define HCI_ERROR_AUTH_FAILURE 0x05 | 289 | #define HCI_ERROR_AUTH_FAILURE 0x05 |
@@ -284,6 +296,22 @@ enum { | |||
284 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 | 296 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 |
285 | #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 | 297 | #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 |
286 | 298 | ||
299 | /* Extended Inquiry Response field types */ | ||
300 | #define EIR_FLAGS 0x01 /* flags */ | ||
301 | #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ | ||
302 | #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ | ||
303 | #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ | ||
304 | #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ | ||
305 | #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ | ||
306 | #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ | ||
307 | #define EIR_NAME_SHORT 0x08 /* shortened local name */ | ||
308 | #define EIR_NAME_COMPLETE 0x09 /* complete local name */ | ||
309 | #define EIR_TX_POWER 0x0A /* transmit power level */ | ||
310 | #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ | ||
311 | #define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ | ||
312 | #define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ | ||
313 | #define EIR_DEVICE_ID 0x10 /* device ID */ | ||
314 | |||
287 | /* ----- HCI Commands ---- */ | 315 | /* ----- HCI Commands ---- */ |
288 | #define HCI_OP_NOP 0x0000 | 316 | #define HCI_OP_NOP 0x0000 |
289 | 317 | ||
@@ -666,8 +694,8 @@ struct hci_cp_host_buffer_size { | |||
666 | 694 | ||
667 | #define HCI_OP_WRITE_EIR 0x0c52 | 695 | #define HCI_OP_WRITE_EIR 0x0c52 |
668 | struct hci_cp_write_eir { | 696 | struct hci_cp_write_eir { |
669 | uint8_t fec; | 697 | __u8 fec; |
670 | uint8_t data[HCI_MAX_EIR_LENGTH]; | 698 | __u8 data[HCI_MAX_EIR_LENGTH]; |
671 | } __packed; | 699 | } __packed; |
672 | 700 | ||
673 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 701 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
@@ -698,8 +726,8 @@ struct hci_rp_read_flow_control_mode { | |||
698 | 726 | ||
699 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d | 727 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d |
700 | struct hci_cp_write_le_host_supported { | 728 | struct hci_cp_write_le_host_supported { |
701 | __u8 le; | 729 | __u8 le; |
702 | __u8 simul; | 730 | __u8 simul; |
703 | } __packed; | 731 | } __packed; |
704 | 732 | ||
705 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 733 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
@@ -1155,6 +1183,19 @@ struct hci_ev_le_meta { | |||
1155 | __u8 subevent; | 1183 | __u8 subevent; |
1156 | } __packed; | 1184 | } __packed; |
1157 | 1185 | ||
1186 | #define HCI_EV_NUM_COMP_BLOCKS 0x48 | ||
1187 | struct hci_comp_blocks_info { | ||
1188 | __le16 handle; | ||
1189 | __le16 pkts; | ||
1190 | __le16 blocks; | ||
1191 | } __packed; | ||
1192 | |||
1193 | struct hci_ev_num_comp_blocks { | ||
1194 | __le16 num_blocks; | ||
1195 | __u8 num_hndl; | ||
1196 | struct hci_comp_blocks_info handles[0]; | ||
1197 | } __packed; | ||
1198 | |||
1158 | /* Low energy meta events */ | 1199 | /* Low energy meta events */ |
1159 | #define HCI_EV_LE_CONN_COMPLETE 0x01 | 1200 | #define HCI_EV_LE_CONN_COMPLETE 0x01 |
1160 | struct hci_ev_le_conn_complete { | 1201 | struct hci_ev_le_conn_complete { |
@@ -1287,7 +1328,8 @@ struct sockaddr_hci { | |||
1287 | #define HCI_DEV_NONE 0xffff | 1328 | #define HCI_DEV_NONE 0xffff |
1288 | 1329 | ||
1289 | #define HCI_CHANNEL_RAW 0 | 1330 | #define HCI_CHANNEL_RAW 0 |
1290 | #define HCI_CHANNEL_CONTROL 1 | 1331 | #define HCI_CHANNEL_MONITOR 2 |
1332 | #define HCI_CHANNEL_CONTROL 3 | ||
1291 | 1333 | ||
1292 | struct hci_filter { | 1334 | struct hci_filter { |
1293 | unsigned long type_mask; | 1335 | unsigned long type_mask; |
@@ -1389,5 +1431,6 @@ struct hci_inquiry_req { | |||
1389 | #define IREQ_CACHE_FLUSH 0x0001 | 1431 | #define IREQ_CACHE_FLUSH 0x0001 |
1390 | 1432 | ||
1391 | extern bool enable_hs; | 1433 | extern bool enable_hs; |
1434 | extern bool enable_le; | ||
1392 | 1435 | ||
1393 | #endif /* __HCI_H */ | 1436 | #endif /* __HCI_H */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 453893b3120e..6822d2595aff 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -44,14 +44,31 @@ struct inquiry_data { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct inquiry_entry { | 46 | struct inquiry_entry { |
47 | struct inquiry_entry *next; | 47 | struct list_head all; /* inq_cache.all */ |
48 | struct list_head list; /* unknown or resolve */ | ||
49 | enum { | ||
50 | NAME_NOT_KNOWN, | ||
51 | NAME_NEEDED, | ||
52 | NAME_PENDING, | ||
53 | NAME_KNOWN, | ||
54 | } name_state; | ||
48 | __u32 timestamp; | 55 | __u32 timestamp; |
49 | struct inquiry_data data; | 56 | struct inquiry_data data; |
50 | }; | 57 | }; |
51 | 58 | ||
52 | struct inquiry_cache { | 59 | struct discovery_state { |
60 | int type; | ||
61 | enum { | ||
62 | DISCOVERY_STOPPED, | ||
63 | DISCOVERY_STARTING, | ||
64 | DISCOVERY_FINDING, | ||
65 | DISCOVERY_RESOLVING, | ||
66 | DISCOVERY_STOPPING, | ||
67 | } state; | ||
68 | struct list_head all; /* All devices found during inquiry */ | ||
69 | struct list_head unknown; /* Name state not known */ | ||
70 | struct list_head resolve; /* Name needs to be resolved */ | ||
53 | __u32 timestamp; | 71 | __u32 timestamp; |
54 | struct inquiry_entry *list; | ||
55 | }; | 72 | }; |
56 | 73 | ||
57 | struct hci_conn_hash { | 74 | struct hci_conn_hash { |
@@ -72,18 +89,16 @@ struct bt_uuid { | |||
72 | u8 svc_hint; | 89 | u8 svc_hint; |
73 | }; | 90 | }; |
74 | 91 | ||
75 | struct key_master_id { | 92 | struct smp_ltk { |
76 | __le16 ediv; | 93 | struct list_head list; |
77 | u8 rand[8]; | ||
78 | } __packed; | ||
79 | |||
80 | struct link_key_data { | ||
81 | bdaddr_t bdaddr; | 94 | bdaddr_t bdaddr; |
95 | u8 bdaddr_type; | ||
96 | u8 authenticated; | ||
82 | u8 type; | 97 | u8 type; |
98 | u8 enc_size; | ||
99 | __le16 ediv; | ||
100 | u8 rand[8]; | ||
83 | u8 val[16]; | 101 | u8 val[16]; |
84 | u8 pin_len; | ||
85 | u8 dlen; | ||
86 | u8 data[0]; | ||
87 | } __packed; | 102 | } __packed; |
88 | 103 | ||
89 | struct link_key { | 104 | struct link_key { |
@@ -92,8 +107,6 @@ struct link_key { | |||
92 | u8 type; | 107 | u8 type; |
93 | u8 val[16]; | 108 | u8 val[16]; |
94 | u8 pin_len; | 109 | u8 pin_len; |
95 | u8 dlen; | ||
96 | u8 data[0]; | ||
97 | }; | 110 | }; |
98 | 111 | ||
99 | struct oob_data { | 112 | struct oob_data { |
@@ -109,11 +122,19 @@ struct adv_entry { | |||
109 | u8 bdaddr_type; | 122 | u8 bdaddr_type; |
110 | }; | 123 | }; |
111 | 124 | ||
125 | struct le_scan_params { | ||
126 | u8 type; | ||
127 | u16 interval; | ||
128 | u16 window; | ||
129 | int timeout; | ||
130 | }; | ||
131 | |||
132 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | ||
133 | |||
112 | #define NUM_REASSEMBLY 4 | 134 | #define NUM_REASSEMBLY 4 |
113 | struct hci_dev { | 135 | struct hci_dev { |
114 | struct list_head list; | 136 | struct list_head list; |
115 | struct mutex lock; | 137 | struct mutex lock; |
116 | atomic_t refcnt; | ||
117 | 138 | ||
118 | char name[8]; | 139 | char name[8]; |
119 | unsigned long flags; | 140 | unsigned long flags; |
@@ -122,6 +143,7 @@ struct hci_dev { | |||
122 | __u8 dev_type; | 143 | __u8 dev_type; |
123 | bdaddr_t bdaddr; | 144 | bdaddr_t bdaddr; |
124 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; | 145 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; |
146 | __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; | ||
125 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 147 | __u8 eir[HCI_MAX_EIR_LENGTH]; |
126 | __u8 dev_class[3]; | 148 | __u8 dev_class[3]; |
127 | __u8 major_class; | 149 | __u8 major_class; |
@@ -129,7 +151,6 @@ struct hci_dev { | |||
129 | __u8 features[8]; | 151 | __u8 features[8]; |
130 | __u8 host_features[8]; | 152 | __u8 host_features[8]; |
131 | __u8 commands[64]; | 153 | __u8 commands[64]; |
132 | __u8 ssp_mode; | ||
133 | __u8 hci_ver; | 154 | __u8 hci_ver; |
134 | __u16 hci_rev; | 155 | __u16 hci_rev; |
135 | __u8 lmp_ver; | 156 | __u8 lmp_ver; |
@@ -217,7 +238,7 @@ struct hci_dev { | |||
217 | 238 | ||
218 | struct list_head mgmt_pending; | 239 | struct list_head mgmt_pending; |
219 | 240 | ||
220 | struct inquiry_cache inq_cache; | 241 | struct discovery_state discovery; |
221 | struct hci_conn_hash conn_hash; | 242 | struct hci_conn_hash conn_hash; |
222 | struct list_head blacklist; | 243 | struct list_head blacklist; |
223 | 244 | ||
@@ -225,6 +246,8 @@ struct hci_dev { | |||
225 | 246 | ||
226 | struct list_head link_keys; | 247 | struct list_head link_keys; |
227 | 248 | ||
249 | struct list_head long_term_keys; | ||
250 | |||
228 | struct list_head remote_oob_data; | 251 | struct list_head remote_oob_data; |
229 | 252 | ||
230 | struct list_head adv_entries; | 253 | struct list_head adv_entries; |
@@ -234,7 +257,6 @@ struct hci_dev { | |||
234 | 257 | ||
235 | struct sk_buff_head driver_init; | 258 | struct sk_buff_head driver_init; |
236 | 259 | ||
237 | void *driver_data; | ||
238 | void *core_data; | 260 | void *core_data; |
239 | 261 | ||
240 | atomic_t promisc; | 262 | atomic_t promisc; |
@@ -246,15 +268,17 @@ struct hci_dev { | |||
246 | 268 | ||
247 | struct rfkill *rfkill; | 269 | struct rfkill *rfkill; |
248 | 270 | ||
249 | struct module *owner; | ||
250 | |||
251 | unsigned long dev_flags; | 271 | unsigned long dev_flags; |
252 | 272 | ||
273 | struct delayed_work le_scan_disable; | ||
274 | |||
275 | struct work_struct le_scan; | ||
276 | struct le_scan_params le_scan_params; | ||
277 | |||
253 | int (*open)(struct hci_dev *hdev); | 278 | int (*open)(struct hci_dev *hdev); |
254 | int (*close)(struct hci_dev *hdev); | 279 | int (*close)(struct hci_dev *hdev); |
255 | int (*flush)(struct hci_dev *hdev); | 280 | int (*flush)(struct hci_dev *hdev); |
256 | int (*send)(struct sk_buff *skb); | 281 | int (*send)(struct sk_buff *skb); |
257 | void (*destruct)(struct hci_dev *hdev); | ||
258 | void (*notify)(struct hci_dev *hdev, unsigned int evt); | 282 | void (*notify)(struct hci_dev *hdev, unsigned int evt); |
259 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); | 283 | int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); |
260 | }; | 284 | }; |
@@ -270,11 +294,10 @@ struct hci_conn { | |||
270 | __u16 state; | 294 | __u16 state; |
271 | __u8 mode; | 295 | __u8 mode; |
272 | __u8 type; | 296 | __u8 type; |
273 | __u8 out; | 297 | bool out; |
274 | __u8 attempt; | 298 | __u8 attempt; |
275 | __u8 dev_class[3]; | 299 | __u8 dev_class[3]; |
276 | __u8 features[8]; | 300 | __u8 features[8]; |
277 | __u8 ssp_mode; | ||
278 | __u16 interval; | 301 | __u16 interval; |
279 | __u16 pkt_type; | 302 | __u16 pkt_type; |
280 | __u16 link_policy; | 303 | __u16 link_policy; |
@@ -286,12 +309,10 @@ struct hci_conn { | |||
286 | __u8 pin_length; | 309 | __u8 pin_length; |
287 | __u8 enc_key_size; | 310 | __u8 enc_key_size; |
288 | __u8 io_capability; | 311 | __u8 io_capability; |
289 | __u8 power_save; | ||
290 | __u16 disc_timeout; | 312 | __u16 disc_timeout; |
291 | unsigned long pend; | 313 | unsigned long flags; |
292 | 314 | ||
293 | __u8 remote_cap; | 315 | __u8 remote_cap; |
294 | __u8 remote_oob; | ||
295 | __u8 remote_auth; | 316 | __u8 remote_auth; |
296 | 317 | ||
297 | unsigned int sent; | 318 | unsigned int sent; |
@@ -348,21 +369,26 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); | |||
348 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ | 369 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ |
349 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ | 370 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ |
350 | 371 | ||
351 | static inline void inquiry_cache_init(struct hci_dev *hdev) | 372 | static inline void discovery_init(struct hci_dev *hdev) |
352 | { | 373 | { |
353 | struct inquiry_cache *c = &hdev->inq_cache; | 374 | hdev->discovery.state = DISCOVERY_STOPPED; |
354 | c->list = NULL; | 375 | INIT_LIST_HEAD(&hdev->discovery.all); |
376 | INIT_LIST_HEAD(&hdev->discovery.unknown); | ||
377 | INIT_LIST_HEAD(&hdev->discovery.resolve); | ||
355 | } | 378 | } |
356 | 379 | ||
380 | bool hci_discovery_active(struct hci_dev *hdev); | ||
381 | |||
382 | void hci_discovery_set_state(struct hci_dev *hdev, int state); | ||
383 | |||
357 | static inline int inquiry_cache_empty(struct hci_dev *hdev) | 384 | static inline int inquiry_cache_empty(struct hci_dev *hdev) |
358 | { | 385 | { |
359 | struct inquiry_cache *c = &hdev->inq_cache; | 386 | return list_empty(&hdev->discovery.all); |
360 | return c->list == NULL; | ||
361 | } | 387 | } |
362 | 388 | ||
363 | static inline long inquiry_cache_age(struct hci_dev *hdev) | 389 | static inline long inquiry_cache_age(struct hci_dev *hdev) |
364 | { | 390 | { |
365 | struct inquiry_cache *c = &hdev->inq_cache; | 391 | struct discovery_state *c = &hdev->discovery; |
366 | return jiffies - c->timestamp; | 392 | return jiffies - c->timestamp; |
367 | } | 393 | } |
368 | 394 | ||
@@ -372,8 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) | |||
372 | } | 398 | } |
373 | 399 | ||
374 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, | 400 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, |
375 | bdaddr_t *bdaddr); | 401 | bdaddr_t *bdaddr); |
376 | void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | 402 | struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, |
403 | bdaddr_t *bdaddr); | ||
404 | struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, | ||
405 | bdaddr_t *bdaddr, | ||
406 | int state); | ||
407 | void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | ||
408 | struct inquiry_entry *ie); | ||
409 | bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | ||
410 | bool name_known, bool *ssp); | ||
377 | 411 | ||
378 | /* ----- HCI Connections ----- */ | 412 | /* ----- HCI Connections ----- */ |
379 | enum { | 413 | enum { |
@@ -384,8 +418,19 @@ enum { | |||
384 | HCI_CONN_MODE_CHANGE_PEND, | 418 | HCI_CONN_MODE_CHANGE_PEND, |
385 | HCI_CONN_SCO_SETUP_PEND, | 419 | HCI_CONN_SCO_SETUP_PEND, |
386 | HCI_CONN_LE_SMP_PEND, | 420 | HCI_CONN_LE_SMP_PEND, |
421 | HCI_CONN_MGMT_CONNECTED, | ||
422 | HCI_CONN_SSP_ENABLED, | ||
423 | HCI_CONN_POWER_SAVE, | ||
424 | HCI_CONN_REMOTE_OOB, | ||
387 | }; | 425 | }; |
388 | 426 | ||
427 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | ||
428 | { | ||
429 | struct hci_dev *hdev = conn->hdev; | ||
430 | return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && | ||
431 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); | ||
432 | } | ||
433 | |||
389 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 434 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
390 | { | 435 | { |
391 | struct hci_conn_hash *h = &hdev->conn_hash; | 436 | struct hci_conn_hash *h = &hdev->conn_hash; |
@@ -566,36 +611,33 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
566 | } | 611 | } |
567 | 612 | ||
568 | /* ----- HCI Devices ----- */ | 613 | /* ----- HCI Devices ----- */ |
569 | static inline void __hci_dev_put(struct hci_dev *d) | 614 | static inline void hci_dev_put(struct hci_dev *d) |
570 | { | 615 | { |
571 | if (atomic_dec_and_test(&d->refcnt)) | 616 | put_device(&d->dev); |
572 | d->destruct(d); | ||
573 | } | 617 | } |
574 | 618 | ||
575 | /* | 619 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) |
576 | * hci_dev_put and hci_dev_hold are macros to avoid dragging all the | ||
577 | * overhead of all the modular infrastructure into this header. | ||
578 | */ | ||
579 | #define hci_dev_put(d) \ | ||
580 | do { \ | ||
581 | __hci_dev_put(d); \ | ||
582 | module_put(d->owner); \ | ||
583 | } while (0) | ||
584 | |||
585 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | ||
586 | { | 620 | { |
587 | atomic_inc(&d->refcnt); | 621 | get_device(&d->dev); |
588 | return d; | 622 | return d; |
589 | } | 623 | } |
590 | 624 | ||
591 | #define hci_dev_hold(d) \ | ||
592 | ({ \ | ||
593 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ | ||
594 | }) | ||
595 | |||
596 | #define hci_dev_lock(d) mutex_lock(&d->lock) | 625 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
597 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) | 626 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) |
598 | 627 | ||
628 | #define to_hci_dev(d) container_of(d, struct hci_dev, dev) | ||
629 | #define to_hci_conn(c) container_of(c, struct hci_conn, dev) | ||
630 | |||
631 | static inline void *hci_get_drvdata(struct hci_dev *hdev) | ||
632 | { | ||
633 | return dev_get_drvdata(&hdev->dev); | ||
634 | } | ||
635 | |||
636 | static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) | ||
637 | { | ||
638 | dev_set_drvdata(&hdev->dev, data); | ||
639 | } | ||
640 | |||
599 | struct hci_dev *hci_dev_get(int index); | 641 | struct hci_dev *hci_dev_get(int index); |
600 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 642 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); |
601 | 643 | ||
@@ -619,20 +661,23 @@ int hci_inquiry(void __user *arg); | |||
619 | 661 | ||
620 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 662 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
621 | int hci_blacklist_clear(struct hci_dev *hdev); | 663 | int hci_blacklist_clear(struct hci_dev *hdev); |
622 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); | 664 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
623 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); | 665 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
624 | 666 | ||
625 | int hci_uuids_clear(struct hci_dev *hdev); | 667 | int hci_uuids_clear(struct hci_dev *hdev); |
626 | 668 | ||
627 | int hci_link_keys_clear(struct hci_dev *hdev); | 669 | int hci_link_keys_clear(struct hci_dev *hdev); |
628 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 670 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
629 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 671 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
630 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 672 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
631 | struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | 673 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); |
632 | struct link_key *hci_find_link_key_type(struct hci_dev *hdev, | 674 | int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, |
633 | bdaddr_t *bdaddr, u8 type); | 675 | int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, |
634 | int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | 676 | u8 rand[8]); |
635 | u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); | 677 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, |
678 | u8 addr_type); | ||
679 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
680 | int hci_smp_ltks_clear(struct hci_dev *hdev); | ||
636 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 681 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
637 | 682 | ||
638 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 683 | int hci_remote_oob_data_clear(struct hci_dev *hdev); |
@@ -674,6 +719,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
674 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 719 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
675 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | 720 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) |
676 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | 721 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) |
722 | #define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) | ||
677 | 723 | ||
678 | /* ----- Extended LMP capabilities ----- */ | 724 | /* ----- Extended LMP capabilities ----- */ |
679 | #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) | 725 | #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) |
@@ -755,7 +801,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
755 | if (conn->type != ACL_LINK && conn->type != LE_LINK) | 801 | if (conn->type != ACL_LINK && conn->type != LE_LINK) |
756 | return; | 802 | return; |
757 | 803 | ||
758 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 804 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
759 | return; | 805 | return; |
760 | 806 | ||
761 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 807 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
@@ -796,7 +842,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | |||
796 | 842 | ||
797 | hci_proto_auth_cfm(conn, status); | 843 | hci_proto_auth_cfm(conn, status); |
798 | 844 | ||
799 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 845 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
800 | return; | 846 | return; |
801 | 847 | ||
802 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 848 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
@@ -859,25 +905,73 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, | |||
859 | read_unlock(&hci_cb_list_lock); | 905 | read_unlock(&hci_cb_list_lock); |
860 | } | 906 | } |
861 | 907 | ||
908 | static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | ||
909 | { | ||
910 | size_t parsed = 0; | ||
911 | |||
912 | if (data_len < 2) | ||
913 | return false; | ||
914 | |||
915 | while (parsed < data_len - 1) { | ||
916 | u8 field_len = data[0]; | ||
917 | |||
918 | if (field_len == 0) | ||
919 | break; | ||
920 | |||
921 | parsed += field_len + 1; | ||
922 | |||
923 | if (parsed > data_len) | ||
924 | break; | ||
925 | |||
926 | if (data[1] == type) | ||
927 | return true; | ||
928 | |||
929 | data += field_len + 1; | ||
930 | } | ||
931 | |||
932 | return false; | ||
933 | } | ||
934 | |||
935 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, | ||
936 | u8 data_len) | ||
937 | { | ||
938 | eir[eir_len++] = sizeof(type) + data_len; | ||
939 | eir[eir_len++] = type; | ||
940 | memcpy(&eir[eir_len], data, data_len); | ||
941 | eir_len += data_len; | ||
942 | |||
943 | return eir_len; | ||
944 | } | ||
945 | |||
862 | int hci_register_cb(struct hci_cb *hcb); | 946 | int hci_register_cb(struct hci_cb *hcb); |
863 | int hci_unregister_cb(struct hci_cb *hcb); | 947 | int hci_unregister_cb(struct hci_cb *hcb); |
864 | 948 | ||
865 | int hci_register_notifier(struct notifier_block *nb); | ||
866 | int hci_unregister_notifier(struct notifier_block *nb); | ||
867 | |||
868 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 949 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); |
869 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 950 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
870 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 951 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
871 | 952 | ||
872 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | 953 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); |
873 | 954 | ||
874 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | ||
875 | |||
876 | /* ----- HCI Sockets ----- */ | 955 | /* ----- HCI Sockets ----- */ |
877 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, | 956 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); |
878 | struct sock *skip_sk); | 957 | void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk); |
958 | void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); | ||
959 | |||
960 | void hci_sock_dev_event(struct hci_dev *hdev, int event); | ||
879 | 961 | ||
880 | /* Management interface */ | 962 | /* Management interface */ |
963 | #define MGMT_ADDR_BREDR 0x00 | ||
964 | #define MGMT_ADDR_LE_PUBLIC 0x01 | ||
965 | #define MGMT_ADDR_LE_RANDOM 0x02 | ||
966 | #define MGMT_ADDR_INVALID 0xff | ||
967 | |||
968 | #define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) | ||
969 | #define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
970 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
971 | #define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \ | ||
972 | BIT(MGMT_ADDR_LE_PUBLIC) | \ | ||
973 | BIT(MGMT_ADDR_LE_RANDOM)) | ||
974 | |||
881 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 975 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
882 | int mgmt_index_added(struct hci_dev *hdev); | 976 | int mgmt_index_added(struct hci_dev *hdev); |
883 | int mgmt_index_removed(struct hci_dev *hdev); | 977 | int mgmt_index_removed(struct hci_dev *hdev); |
@@ -886,56 +980,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | |||
886 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 980 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
887 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 981 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
888 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 982 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
889 | u8 persistent); | 983 | u8 persistent); |
890 | int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 984 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
891 | u8 addr_type); | 985 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
892 | int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 986 | u8 *dev_class); |
893 | u8 addr_type); | 987 | int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, |
894 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 988 | u8 link_type, u8 addr_type); |
989 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
990 | u8 link_type, u8 addr_type, u8 status); | ||
895 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 991 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
896 | u8 addr_type, u8 status); | 992 | u8 addr_type, u8 status); |
897 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); | 993 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); |
898 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 994 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
899 | u8 status); | 995 | u8 status); |
900 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 996 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
901 | u8 status); | 997 | u8 status); |
902 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, | 998 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
903 | __le32 value, u8 confirm_hint); | 999 | u8 link_type, u8 addr_type, __le32 value, |
1000 | u8 confirm_hint); | ||
904 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1001 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
905 | u8 status); | 1002 | u8 link_type, u8 addr_type, u8 status); |
906 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, | 1003 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
907 | bdaddr_t *bdaddr, u8 status); | 1004 | u8 link_type, u8 addr_type, u8 status); |
908 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1005 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1006 | u8 link_type, u8 addr_type); | ||
909 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1007 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
910 | u8 status); | 1008 | u8 link_type, u8 addr_type, u8 status); |
911 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, | 1009 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
912 | bdaddr_t *bdaddr, u8 status); | 1010 | u8 link_type, u8 addr_type, u8 status); |
913 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 1011 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1012 | u8 addr_type, u8 status); | ||
1013 | int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); | ||
1014 | int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
1015 | int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, | ||
1016 | u8 status); | ||
914 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | 1017 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); |
915 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, | 1018 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, |
916 | u8 *randomizer, u8 status); | 1019 | u8 *randomizer, u8 status); |
1020 | int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
917 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1021 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
918 | u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); | 1022 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
919 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); | 1023 | u8 ssp, u8 *eir, u16 eir_len); |
1024 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | ||
1025 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | ||
920 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); | 1026 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); |
921 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); | 1027 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); |
922 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1028 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
923 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1029 | int mgmt_interleaved_discovery(struct hci_dev *hdev); |
924 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1030 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
1031 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
1032 | |||
1033 | int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); | ||
925 | 1034 | ||
926 | /* HCI info for socket */ | 1035 | /* HCI info for socket */ |
927 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 1036 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
928 | 1037 | ||
929 | /* HCI socket flags */ | ||
930 | #define HCI_PI_MGMT_INIT 0 | ||
931 | |||
932 | struct hci_pinfo { | 1038 | struct hci_pinfo { |
933 | struct bt_sock bt; | 1039 | struct bt_sock bt; |
934 | struct hci_dev *hdev; | 1040 | struct hci_dev *hdev; |
935 | struct hci_filter filter; | 1041 | struct hci_filter filter; |
936 | __u32 cmsg_mask; | 1042 | __u32 cmsg_mask; |
937 | unsigned short channel; | 1043 | unsigned short channel; |
938 | unsigned long flags; | ||
939 | }; | 1044 | }; |
940 | 1045 | ||
941 | /* HCI security filter */ | 1046 | /* HCI security filter */ |
@@ -966,5 +1071,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn); | |||
966 | 1071 | ||
967 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1072 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
968 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1073 | int hci_cancel_inquiry(struct hci_dev *hdev); |
1074 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | ||
1075 | int timeout); | ||
969 | 1076 | ||
970 | #endif /* __HCI_CORE_H */ | 1077 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h new file mode 100644 index 000000000000..77d1e5764185 --- /dev/null +++ b/include/net/bluetooth/hci_mon.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | BlueZ - Bluetooth protocol stack for Linux | ||
3 | |||
4 | Copyright (C) 2011-2012 Intel Corporation | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License version 2 as | ||
8 | published by the Free Software Foundation; | ||
9 | |||
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
18 | |||
19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
21 | SOFTWARE IS DISCLAIMED. | ||
22 | */ | ||
23 | |||
24 | #ifndef __HCI_MON_H | ||
25 | #define __HCI_MON_H | ||
26 | |||
27 | struct hci_mon_hdr { | ||
28 | __le16 opcode; | ||
29 | __le16 index; | ||
30 | __le16 len; | ||
31 | } __packed; | ||
32 | #define HCI_MON_HDR_SIZE 6 | ||
33 | |||
34 | #define HCI_MON_NEW_INDEX 0 | ||
35 | #define HCI_MON_DEL_INDEX 1 | ||
36 | #define HCI_MON_COMMAND_PKT 2 | ||
37 | #define HCI_MON_EVENT_PKT 3 | ||
38 | #define HCI_MON_ACL_TX_PKT 4 | ||
39 | #define HCI_MON_ACL_RX_PKT 5 | ||
40 | #define HCI_MON_SCO_TX_PKT 6 | ||
41 | #define HCI_MON_SCO_RX_PKT 7 | ||
42 | |||
43 | struct hci_mon_new_index { | ||
44 | __u8 type; | ||
45 | __u8 bus; | ||
46 | bdaddr_t bdaddr; | ||
47 | char name[8]; | ||
48 | } __packed; | ||
49 | #define HCI_MON_NEW_INDEX_SIZE 16 | ||
50 | |||
51 | #endif /* __HCI_MON_H */ | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index b1664ed884e6..9b242c6bf55b 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -45,11 +45,11 @@ | |||
45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF | 45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF |
46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF | 46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF |
47 | 47 | ||
48 | #define L2CAP_DISC_TIMEOUT (100) | 48 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) |
49 | #define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ | 49 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) |
50 | #define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ | 50 | #define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) |
51 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 51 | #define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) |
52 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 52 | #define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) |
53 | 53 | ||
54 | /* L2CAP socket address */ | 54 | /* L2CAP socket address */ |
55 | struct sockaddr_l2 { | 55 | struct sockaddr_l2 { |
@@ -492,51 +492,56 @@ struct l2cap_chan { | |||
492 | struct sk_buff_head srej_q; | 492 | struct sk_buff_head srej_q; |
493 | struct list_head srej_l; | 493 | struct list_head srej_l; |
494 | 494 | ||
495 | struct list_head list; | 495 | struct list_head list; |
496 | struct list_head global_l; | 496 | struct list_head global_l; |
497 | 497 | ||
498 | void *data; | 498 | void *data; |
499 | struct l2cap_ops *ops; | 499 | struct l2cap_ops *ops; |
500 | struct mutex lock; | ||
500 | }; | 501 | }; |
501 | 502 | ||
502 | struct l2cap_ops { | 503 | struct l2cap_ops { |
503 | char *name; | 504 | char *name; |
504 | 505 | ||
505 | struct l2cap_chan *(*new_connection) (void *data); | 506 | struct l2cap_chan *(*new_connection) (void *data); |
506 | int (*recv) (void *data, struct sk_buff *skb); | 507 | int (*recv) (void *data, struct sk_buff *skb); |
507 | void (*close) (void *data); | 508 | void (*close) (void *data); |
508 | void (*state_change) (void *data, int state); | 509 | void (*state_change) (void *data, int state); |
510 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, | ||
511 | unsigned long len, int nb, int *err); | ||
512 | |||
509 | }; | 513 | }; |
510 | 514 | ||
511 | struct l2cap_conn { | 515 | struct l2cap_conn { |
512 | struct hci_conn *hcon; | 516 | struct hci_conn *hcon; |
513 | struct hci_chan *hchan; | 517 | struct hci_chan *hchan; |
514 | 518 | ||
515 | bdaddr_t *dst; | 519 | bdaddr_t *dst; |
516 | bdaddr_t *src; | 520 | bdaddr_t *src; |
517 | 521 | ||
518 | unsigned int mtu; | 522 | unsigned int mtu; |
519 | 523 | ||
520 | __u32 feat_mask; | 524 | __u32 feat_mask; |
525 | __u8 fixed_chan_mask; | ||
521 | 526 | ||
522 | __u8 info_state; | 527 | __u8 info_state; |
523 | __u8 info_ident; | 528 | __u8 info_ident; |
524 | 529 | ||
525 | struct delayed_work info_timer; | 530 | struct delayed_work info_timer; |
526 | 531 | ||
527 | spinlock_t lock; | 532 | spinlock_t lock; |
528 | 533 | ||
529 | struct sk_buff *rx_skb; | 534 | struct sk_buff *rx_skb; |
530 | __u32 rx_len; | 535 | __u32 rx_len; |
531 | __u8 tx_ident; | 536 | __u8 tx_ident; |
532 | 537 | ||
533 | __u8 disc_reason; | 538 | __u8 disc_reason; |
534 | 539 | ||
535 | struct delayed_work security_timer; | 540 | struct delayed_work security_timer; |
536 | struct smp_chan *smp_chan; | 541 | struct smp_chan *smp_chan; |
537 | 542 | ||
538 | struct list_head chan_l; | 543 | struct list_head chan_l; |
539 | struct mutex chan_lock; | 544 | struct mutex chan_lock; |
540 | }; | 545 | }; |
541 | 546 | ||
542 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 547 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
@@ -551,9 +556,9 @@ struct l2cap_conn { | |||
551 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 556 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
552 | 557 | ||
553 | struct l2cap_pinfo { | 558 | struct l2cap_pinfo { |
554 | struct bt_sock bt; | 559 | struct bt_sock bt; |
555 | struct l2cap_chan *chan; | 560 | struct l2cap_chan *chan; |
556 | struct sk_buff *rx_busy_skb; | 561 | struct sk_buff *rx_busy_skb; |
557 | }; | 562 | }; |
558 | 563 | ||
559 | enum { | 564 | enum { |
@@ -606,21 +611,37 @@ static inline void l2cap_chan_put(struct l2cap_chan *c) | |||
606 | kfree(c); | 611 | kfree(c); |
607 | } | 612 | } |
608 | 613 | ||
614 | static inline void l2cap_chan_lock(struct l2cap_chan *chan) | ||
615 | { | ||
616 | mutex_lock(&chan->lock); | ||
617 | } | ||
618 | |||
619 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan) | ||
620 | { | ||
621 | mutex_unlock(&chan->lock); | ||
622 | } | ||
623 | |||
609 | static inline void l2cap_set_timer(struct l2cap_chan *chan, | 624 | static inline void l2cap_set_timer(struct l2cap_chan *chan, |
610 | struct delayed_work *work, long timeout) | 625 | struct delayed_work *work, long timeout) |
611 | { | 626 | { |
612 | BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); | 627 | BT_DBG("chan %p state %s timeout %ld", chan, |
628 | state_to_string(chan->state), timeout); | ||
613 | 629 | ||
614 | if (!cancel_delayed_work(work)) | 630 | if (!cancel_delayed_work(work)) |
615 | l2cap_chan_hold(chan); | 631 | l2cap_chan_hold(chan); |
616 | schedule_delayed_work(work, timeout); | 632 | schedule_delayed_work(work, timeout); |
617 | } | 633 | } |
618 | 634 | ||
619 | static inline void l2cap_clear_timer(struct l2cap_chan *chan, | 635 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan, |
620 | struct delayed_work *work) | 636 | struct delayed_work *work) |
621 | { | 637 | { |
622 | if (cancel_delayed_work(work)) | 638 | bool ret; |
639 | |||
640 | ret = cancel_delayed_work(work); | ||
641 | if (ret) | ||
623 | l2cap_chan_put(chan); | 642 | l2cap_chan_put(chan); |
643 | |||
644 | return ret; | ||
624 | } | 645 | } |
625 | 646 | ||
626 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 647 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index be65d3417883..ebfd91fc20f8 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -2,6 +2,7 @@ | |||
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | 3 | ||
4 | Copyright (C) 2010 Nokia Corporation | 4 | Copyright (C) 2010 Nokia Corporation |
5 | Copyright (C) 2011-2012 Intel Corporation | ||
5 | 6 | ||
6 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License version 2 as | 8 | it under the terms of the GNU General Public License version 2 as |
@@ -39,29 +40,47 @@ | |||
39 | #define MGMT_STATUS_INVALID_PARAMS 0x0d | 40 | #define MGMT_STATUS_INVALID_PARAMS 0x0d |
40 | #define MGMT_STATUS_DISCONNECTED 0x0e | 41 | #define MGMT_STATUS_DISCONNECTED 0x0e |
41 | #define MGMT_STATUS_NOT_POWERED 0x0f | 42 | #define MGMT_STATUS_NOT_POWERED 0x0f |
43 | #define MGMT_STATUS_CANCELLED 0x10 | ||
44 | #define MGMT_STATUS_INVALID_INDEX 0x11 | ||
42 | 45 | ||
43 | struct mgmt_hdr { | 46 | struct mgmt_hdr { |
44 | __le16 opcode; | 47 | __le16 opcode; |
45 | __le16 index; | 48 | __le16 index; |
46 | __le16 len; | 49 | __le16 len; |
47 | } __packed; | 50 | } __packed; |
48 | 51 | ||
52 | struct mgmt_addr_info { | ||
53 | bdaddr_t bdaddr; | ||
54 | __u8 type; | ||
55 | } __packed; | ||
56 | #define MGMT_ADDR_INFO_SIZE 7 | ||
57 | |||
49 | #define MGMT_OP_READ_VERSION 0x0001 | 58 | #define MGMT_OP_READ_VERSION 0x0001 |
59 | #define MGMT_READ_VERSION_SIZE 0 | ||
50 | struct mgmt_rp_read_version { | 60 | struct mgmt_rp_read_version { |
51 | __u8 version; | 61 | __u8 version; |
52 | __le16 revision; | 62 | __le16 revision; |
63 | } __packed; | ||
64 | |||
65 | #define MGMT_OP_READ_COMMANDS 0x0002 | ||
66 | #define MGMT_READ_COMMANDS_SIZE 0 | ||
67 | struct mgmt_rp_read_commands { | ||
68 | __le16 num_commands; | ||
69 | __le16 num_events; | ||
70 | __le16 opcodes[0]; | ||
53 | } __packed; | 71 | } __packed; |
54 | 72 | ||
55 | #define MGMT_OP_READ_INDEX_LIST 0x0003 | 73 | #define MGMT_OP_READ_INDEX_LIST 0x0003 |
74 | #define MGMT_READ_INDEX_LIST_SIZE 0 | ||
56 | struct mgmt_rp_read_index_list { | 75 | struct mgmt_rp_read_index_list { |
57 | __le16 num_controllers; | 76 | __le16 num_controllers; |
58 | __le16 index[0]; | 77 | __le16 index[0]; |
59 | } __packed; | 78 | } __packed; |
60 | 79 | ||
61 | /* Reserve one extra byte for names in management messages so that they | 80 | /* Reserve one extra byte for names in management messages so that they |
62 | * are always guaranteed to be nul-terminated */ | 81 | * are always guaranteed to be nul-terminated */ |
63 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) | 82 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) |
64 | #define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) | 83 | #define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1) |
65 | 84 | ||
66 | #define MGMT_SETTING_POWERED 0x00000001 | 85 | #define MGMT_SETTING_POWERED 0x00000001 |
67 | #define MGMT_SETTING_CONNECTABLE 0x00000002 | 86 | #define MGMT_SETTING_CONNECTABLE 0x00000002 |
@@ -75,28 +94,32 @@ struct mgmt_rp_read_index_list { | |||
75 | #define MGMT_SETTING_LE 0x00000200 | 94 | #define MGMT_SETTING_LE 0x00000200 |
76 | 95 | ||
77 | #define MGMT_OP_READ_INFO 0x0004 | 96 | #define MGMT_OP_READ_INFO 0x0004 |
97 | #define MGMT_READ_INFO_SIZE 0 | ||
78 | struct mgmt_rp_read_info { | 98 | struct mgmt_rp_read_info { |
79 | bdaddr_t bdaddr; | 99 | bdaddr_t bdaddr; |
80 | __u8 version; | 100 | __u8 version; |
81 | __le16 manufacturer; | 101 | __le16 manufacturer; |
82 | __le32 supported_settings; | 102 | __le32 supported_settings; |
83 | __le32 current_settings; | 103 | __le32 current_settings; |
84 | __u8 dev_class[3]; | 104 | __u8 dev_class[3]; |
85 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 105 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
86 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | 106 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; |
87 | } __packed; | 107 | } __packed; |
88 | 108 | ||
89 | struct mgmt_mode { | 109 | struct mgmt_mode { |
90 | __u8 val; | 110 | __u8 val; |
91 | } __packed; | 111 | } __packed; |
92 | 112 | ||
113 | #define MGMT_SETTING_SIZE 1 | ||
114 | |||
93 | #define MGMT_OP_SET_POWERED 0x0005 | 115 | #define MGMT_OP_SET_POWERED 0x0005 |
94 | 116 | ||
95 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | 117 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 |
96 | struct mgmt_cp_set_discoverable { | 118 | struct mgmt_cp_set_discoverable { |
97 | __u8 val; | 119 | __u8 val; |
98 | __u16 timeout; | 120 | __le16 timeout; |
99 | } __packed; | 121 | } __packed; |
122 | #define MGMT_SET_DISCOVERABLE_SIZE 3 | ||
100 | 123 | ||
101 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | 124 | #define MGMT_OP_SET_CONNECTABLE 0x0007 |
102 | 125 | ||
@@ -111,73 +134,76 @@ struct mgmt_cp_set_discoverable { | |||
111 | #define MGMT_OP_SET_HS 0x000C | 134 | #define MGMT_OP_SET_HS 0x000C |
112 | 135 | ||
113 | #define MGMT_OP_SET_LE 0x000D | 136 | #define MGMT_OP_SET_LE 0x000D |
114 | |||
115 | #define MGMT_OP_SET_DEV_CLASS 0x000E | 137 | #define MGMT_OP_SET_DEV_CLASS 0x000E |
116 | struct mgmt_cp_set_dev_class { | 138 | struct mgmt_cp_set_dev_class { |
117 | __u8 major; | 139 | __u8 major; |
118 | __u8 minor; | 140 | __u8 minor; |
119 | } __packed; | 141 | } __packed; |
142 | #define MGMT_SET_DEV_CLASS_SIZE 2 | ||
120 | 143 | ||
121 | #define MGMT_OP_SET_LOCAL_NAME 0x000F | 144 | #define MGMT_OP_SET_LOCAL_NAME 0x000F |
122 | struct mgmt_cp_set_local_name { | 145 | struct mgmt_cp_set_local_name { |
123 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 146 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
147 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | ||
124 | } __packed; | 148 | } __packed; |
149 | #define MGMT_SET_LOCAL_NAME_SIZE 260 | ||
125 | 150 | ||
126 | #define MGMT_OP_ADD_UUID 0x0010 | 151 | #define MGMT_OP_ADD_UUID 0x0010 |
127 | struct mgmt_cp_add_uuid { | 152 | struct mgmt_cp_add_uuid { |
128 | __u8 uuid[16]; | 153 | __u8 uuid[16]; |
129 | __u8 svc_hint; | 154 | __u8 svc_hint; |
130 | } __packed; | 155 | } __packed; |
156 | #define MGMT_ADD_UUID_SIZE 17 | ||
131 | 157 | ||
132 | #define MGMT_OP_REMOVE_UUID 0x0011 | 158 | #define MGMT_OP_REMOVE_UUID 0x0011 |
133 | struct mgmt_cp_remove_uuid { | 159 | struct mgmt_cp_remove_uuid { |
134 | __u8 uuid[16]; | 160 | __u8 uuid[16]; |
135 | } __packed; | 161 | } __packed; |
162 | #define MGMT_REMOVE_UUID_SIZE 16 | ||
136 | 163 | ||
137 | struct mgmt_link_key_info { | 164 | struct mgmt_link_key_info { |
138 | bdaddr_t bdaddr; | 165 | struct mgmt_addr_info addr; |
139 | u8 type; | 166 | __u8 type; |
140 | u8 val[16]; | 167 | __u8 val[16]; |
141 | u8 pin_len; | 168 | __u8 pin_len; |
142 | } __packed; | 169 | } __packed; |
143 | 170 | ||
144 | #define MGMT_OP_LOAD_LINK_KEYS 0x0012 | 171 | #define MGMT_OP_LOAD_LINK_KEYS 0x0012 |
145 | struct mgmt_cp_load_link_keys { | 172 | struct mgmt_cp_load_link_keys { |
146 | __u8 debug_keys; | 173 | __u8 debug_keys; |
147 | __le16 key_count; | 174 | __le16 key_count; |
148 | struct mgmt_link_key_info keys[0]; | 175 | struct mgmt_link_key_info keys[0]; |
149 | } __packed; | 176 | } __packed; |
177 | #define MGMT_LOAD_LINK_KEYS_SIZE 3 | ||
150 | 178 | ||
151 | #define MGMT_OP_REMOVE_KEYS 0x0013 | 179 | struct mgmt_ltk_info { |
152 | struct mgmt_cp_remove_keys { | 180 | struct mgmt_addr_info addr; |
153 | bdaddr_t bdaddr; | 181 | __u8 authenticated; |
154 | __u8 disconnect; | 182 | __u8 master; |
183 | __u8 enc_size; | ||
184 | __le16 ediv; | ||
185 | __u8 rand[8]; | ||
186 | __u8 val[16]; | ||
155 | } __packed; | 187 | } __packed; |
156 | struct mgmt_rp_remove_keys { | 188 | |
157 | bdaddr_t bdaddr; | 189 | #define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013 |
158 | __u8 status; | 190 | struct mgmt_cp_load_long_term_keys { |
159 | }; | 191 | __le16 key_count; |
192 | struct mgmt_ltk_info keys[0]; | ||
193 | } __packed; | ||
194 | #define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2 | ||
160 | 195 | ||
161 | #define MGMT_OP_DISCONNECT 0x0014 | 196 | #define MGMT_OP_DISCONNECT 0x0014 |
162 | struct mgmt_cp_disconnect { | 197 | struct mgmt_cp_disconnect { |
163 | bdaddr_t bdaddr; | 198 | struct mgmt_addr_info addr; |
164 | } __packed; | 199 | } __packed; |
200 | #define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE | ||
165 | struct mgmt_rp_disconnect { | 201 | struct mgmt_rp_disconnect { |
166 | bdaddr_t bdaddr; | 202 | struct mgmt_addr_info addr; |
167 | __u8 status; | ||
168 | } __packed; | ||
169 | |||
170 | #define MGMT_ADDR_BREDR 0x00 | ||
171 | #define MGMT_ADDR_LE_PUBLIC 0x01 | ||
172 | #define MGMT_ADDR_LE_RANDOM 0x02 | ||
173 | #define MGMT_ADDR_INVALID 0xff | ||
174 | |||
175 | struct mgmt_addr_info { | ||
176 | bdaddr_t bdaddr; | ||
177 | __u8 type; | ||
178 | } __packed; | 203 | } __packed; |
179 | 204 | ||
180 | #define MGMT_OP_GET_CONNECTIONS 0x0015 | 205 | #define MGMT_OP_GET_CONNECTIONS 0x0015 |
206 | #define MGMT_GET_CONNECTIONS_SIZE 0 | ||
181 | struct mgmt_rp_get_connections { | 207 | struct mgmt_rp_get_connections { |
182 | __le16 conn_count; | 208 | __le16 conn_count; |
183 | struct mgmt_addr_info addr[0]; | 209 | struct mgmt_addr_info addr[0]; |
@@ -185,124 +211,152 @@ struct mgmt_rp_get_connections { | |||
185 | 211 | ||
186 | #define MGMT_OP_PIN_CODE_REPLY 0x0016 | 212 | #define MGMT_OP_PIN_CODE_REPLY 0x0016 |
187 | struct mgmt_cp_pin_code_reply { | 213 | struct mgmt_cp_pin_code_reply { |
188 | bdaddr_t bdaddr; | 214 | struct mgmt_addr_info addr; |
189 | __u8 pin_len; | 215 | __u8 pin_len; |
190 | __u8 pin_code[16]; | 216 | __u8 pin_code[16]; |
191 | } __packed; | 217 | } __packed; |
218 | #define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17) | ||
192 | struct mgmt_rp_pin_code_reply { | 219 | struct mgmt_rp_pin_code_reply { |
193 | bdaddr_t bdaddr; | 220 | struct mgmt_addr_info addr; |
194 | uint8_t status; | ||
195 | } __packed; | 221 | } __packed; |
196 | 222 | ||
197 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 | 223 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 |
198 | struct mgmt_cp_pin_code_neg_reply { | 224 | struct mgmt_cp_pin_code_neg_reply { |
199 | bdaddr_t bdaddr; | 225 | struct mgmt_addr_info addr; |
200 | } __packed; | 226 | } __packed; |
227 | #define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
201 | 228 | ||
202 | #define MGMT_OP_SET_IO_CAPABILITY 0x0018 | 229 | #define MGMT_OP_SET_IO_CAPABILITY 0x0018 |
203 | struct mgmt_cp_set_io_capability { | 230 | struct mgmt_cp_set_io_capability { |
204 | __u8 io_capability; | 231 | __u8 io_capability; |
205 | } __packed; | 232 | } __packed; |
233 | #define MGMT_SET_IO_CAPABILITY_SIZE 1 | ||
206 | 234 | ||
207 | #define MGMT_OP_PAIR_DEVICE 0x0019 | 235 | #define MGMT_OP_PAIR_DEVICE 0x0019 |
208 | struct mgmt_cp_pair_device { | 236 | struct mgmt_cp_pair_device { |
209 | struct mgmt_addr_info addr; | 237 | struct mgmt_addr_info addr; |
210 | __u8 io_cap; | 238 | __u8 io_cap; |
211 | } __packed; | 239 | } __packed; |
240 | #define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
212 | struct mgmt_rp_pair_device { | 241 | struct mgmt_rp_pair_device { |
213 | struct mgmt_addr_info addr; | 242 | struct mgmt_addr_info addr; |
214 | __u8 status; | ||
215 | } __packed; | 243 | } __packed; |
216 | 244 | ||
217 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001A | 245 | #define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A |
246 | #define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
247 | |||
248 | #define MGMT_OP_UNPAIR_DEVICE 0x001B | ||
249 | struct mgmt_cp_unpair_device { | ||
250 | struct mgmt_addr_info addr; | ||
251 | __u8 disconnect; | ||
252 | } __packed; | ||
253 | #define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
254 | struct mgmt_rp_unpair_device { | ||
255 | struct mgmt_addr_info addr; | ||
256 | }; | ||
257 | |||
258 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001C | ||
218 | struct mgmt_cp_user_confirm_reply { | 259 | struct mgmt_cp_user_confirm_reply { |
219 | bdaddr_t bdaddr; | 260 | struct mgmt_addr_info addr; |
220 | } __packed; | 261 | } __packed; |
262 | #define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
221 | struct mgmt_rp_user_confirm_reply { | 263 | struct mgmt_rp_user_confirm_reply { |
222 | bdaddr_t bdaddr; | 264 | struct mgmt_addr_info addr; |
223 | __u8 status; | ||
224 | } __packed; | 265 | } __packed; |
225 | 266 | ||
226 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B | 267 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D |
227 | struct mgmt_cp_user_confirm_neg_reply { | 268 | struct mgmt_cp_user_confirm_neg_reply { |
228 | bdaddr_t bdaddr; | 269 | struct mgmt_addr_info addr; |
229 | } __packed; | 270 | } __packed; |
271 | #define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
230 | 272 | ||
231 | #define MGMT_OP_USER_PASSKEY_REPLY 0x001C | 273 | #define MGMT_OP_USER_PASSKEY_REPLY 0x001E |
232 | struct mgmt_cp_user_passkey_reply { | 274 | struct mgmt_cp_user_passkey_reply { |
233 | bdaddr_t bdaddr; | 275 | struct mgmt_addr_info addr; |
234 | __le32 passkey; | 276 | __le32 passkey; |
235 | } __packed; | 277 | } __packed; |
278 | #define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4) | ||
236 | struct mgmt_rp_user_passkey_reply { | 279 | struct mgmt_rp_user_passkey_reply { |
237 | bdaddr_t bdaddr; | 280 | struct mgmt_addr_info addr; |
238 | __u8 status; | ||
239 | } __packed; | 281 | } __packed; |
240 | 282 | ||
241 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D | 283 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F |
242 | struct mgmt_cp_user_passkey_neg_reply { | 284 | struct mgmt_cp_user_passkey_neg_reply { |
243 | bdaddr_t bdaddr; | 285 | struct mgmt_addr_info addr; |
244 | } __packed; | 286 | } __packed; |
287 | #define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE | ||
245 | 288 | ||
246 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E | 289 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020 |
290 | #define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 | ||
247 | struct mgmt_rp_read_local_oob_data { | 291 | struct mgmt_rp_read_local_oob_data { |
248 | __u8 hash[16]; | 292 | __u8 hash[16]; |
249 | __u8 randomizer[16]; | 293 | __u8 randomizer[16]; |
250 | } __packed; | 294 | } __packed; |
251 | 295 | ||
252 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F | 296 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 |
253 | struct mgmt_cp_add_remote_oob_data { | 297 | struct mgmt_cp_add_remote_oob_data { |
254 | bdaddr_t bdaddr; | 298 | struct mgmt_addr_info addr; |
255 | __u8 hash[16]; | 299 | __u8 hash[16]; |
256 | __u8 randomizer[16]; | 300 | __u8 randomizer[16]; |
257 | } __packed; | 301 | } __packed; |
302 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) | ||
258 | 303 | ||
259 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 | 304 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 |
260 | struct mgmt_cp_remove_remote_oob_data { | 305 | struct mgmt_cp_remove_remote_oob_data { |
261 | bdaddr_t bdaddr; | 306 | struct mgmt_addr_info addr; |
262 | } __packed; | 307 | } __packed; |
308 | #define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE | ||
263 | 309 | ||
264 | #define MGMT_OP_START_DISCOVERY 0x0021 | 310 | #define MGMT_OP_START_DISCOVERY 0x0023 |
265 | struct mgmt_cp_start_discovery { | 311 | struct mgmt_cp_start_discovery { |
266 | __u8 type; | 312 | __u8 type; |
267 | } __packed; | 313 | } __packed; |
314 | #define MGMT_START_DISCOVERY_SIZE 1 | ||
268 | 315 | ||
269 | #define MGMT_OP_STOP_DISCOVERY 0x0022 | 316 | #define MGMT_OP_STOP_DISCOVERY 0x0024 |
317 | struct mgmt_cp_stop_discovery { | ||
318 | __u8 type; | ||
319 | } __packed; | ||
320 | #define MGMT_STOP_DISCOVERY_SIZE 1 | ||
270 | 321 | ||
271 | #define MGMT_OP_CONFIRM_NAME 0x0023 | 322 | #define MGMT_OP_CONFIRM_NAME 0x0025 |
272 | struct mgmt_cp_confirm_name { | 323 | struct mgmt_cp_confirm_name { |
273 | bdaddr_t bdaddr; | 324 | struct mgmt_addr_info addr; |
274 | __u8 name_known; | 325 | __u8 name_known; |
275 | } __packed; | 326 | } __packed; |
327 | #define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
276 | struct mgmt_rp_confirm_name { | 328 | struct mgmt_rp_confirm_name { |
277 | bdaddr_t bdaddr; | 329 | struct mgmt_addr_info addr; |
278 | __u8 status; | ||
279 | } __packed; | 330 | } __packed; |
280 | 331 | ||
281 | #define MGMT_OP_BLOCK_DEVICE 0x0024 | 332 | #define MGMT_OP_BLOCK_DEVICE 0x0026 |
282 | struct mgmt_cp_block_device { | 333 | struct mgmt_cp_block_device { |
283 | bdaddr_t bdaddr; | 334 | struct mgmt_addr_info addr; |
284 | } __packed; | 335 | } __packed; |
336 | #define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
285 | 337 | ||
286 | #define MGMT_OP_UNBLOCK_DEVICE 0x0025 | 338 | #define MGMT_OP_UNBLOCK_DEVICE 0x0027 |
287 | struct mgmt_cp_unblock_device { | 339 | struct mgmt_cp_unblock_device { |
288 | bdaddr_t bdaddr; | 340 | struct mgmt_addr_info addr; |
289 | } __packed; | 341 | } __packed; |
342 | #define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
290 | 343 | ||
291 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 344 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
292 | struct mgmt_ev_cmd_complete { | 345 | struct mgmt_ev_cmd_complete { |
293 | __le16 opcode; | 346 | __le16 opcode; |
294 | __u8 data[0]; | 347 | __u8 status; |
348 | __u8 data[0]; | ||
295 | } __packed; | 349 | } __packed; |
296 | 350 | ||
297 | #define MGMT_EV_CMD_STATUS 0x0002 | 351 | #define MGMT_EV_CMD_STATUS 0x0002 |
298 | struct mgmt_ev_cmd_status { | 352 | struct mgmt_ev_cmd_status { |
299 | __u8 status; | 353 | __le16 opcode; |
300 | __le16 opcode; | 354 | __u8 status; |
301 | } __packed; | 355 | } __packed; |
302 | 356 | ||
303 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 | 357 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 |
304 | struct mgmt_ev_controller_error { | 358 | struct mgmt_ev_controller_error { |
305 | __u8 error_code; | 359 | __u8 error_code; |
306 | } __packed; | 360 | } __packed; |
307 | 361 | ||
308 | #define MGMT_EV_INDEX_ADDED 0x0004 | 362 | #define MGMT_EV_INDEX_ADDED 0x0004 |
@@ -313,78 +367,96 @@ struct mgmt_ev_controller_error { | |||
313 | 367 | ||
314 | #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 | 368 | #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 |
315 | struct mgmt_ev_class_of_dev_changed { | 369 | struct mgmt_ev_class_of_dev_changed { |
316 | __u8 dev_class[3]; | 370 | __u8 dev_class[3]; |
317 | }; | 371 | }; |
318 | 372 | ||
319 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 | 373 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 |
320 | struct mgmt_ev_local_name_changed { | 374 | struct mgmt_ev_local_name_changed { |
321 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 375 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
322 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | 376 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; |
323 | } __packed; | 377 | } __packed; |
324 | 378 | ||
325 | #define MGMT_EV_NEW_LINK_KEY 0x0009 | 379 | #define MGMT_EV_NEW_LINK_KEY 0x0009 |
326 | struct mgmt_ev_new_link_key { | 380 | struct mgmt_ev_new_link_key { |
327 | __u8 store_hint; | 381 | __u8 store_hint; |
328 | struct mgmt_link_key_info key; | 382 | struct mgmt_link_key_info key; |
329 | } __packed; | 383 | } __packed; |
330 | 384 | ||
331 | #define MGMT_EV_CONNECTED 0x000A | 385 | #define MGMT_EV_NEW_LONG_TERM_KEY 0x000A |
386 | struct mgmt_ev_new_long_term_key { | ||
387 | __u8 store_hint; | ||
388 | struct mgmt_ltk_info key; | ||
389 | } __packed; | ||
332 | 390 | ||
333 | #define MGMT_EV_DISCONNECTED 0x000B | 391 | #define MGMT_EV_DEVICE_CONNECTED 0x000B |
392 | struct mgmt_ev_device_connected { | ||
393 | struct mgmt_addr_info addr; | ||
394 | __le32 flags; | ||
395 | __le16 eir_len; | ||
396 | __u8 eir[0]; | ||
397 | } __packed; | ||
398 | |||
399 | #define MGMT_EV_DEVICE_DISCONNECTED 0x000C | ||
334 | 400 | ||
335 | #define MGMT_EV_CONNECT_FAILED 0x000C | 401 | #define MGMT_EV_CONNECT_FAILED 0x000D |
336 | struct mgmt_ev_connect_failed { | 402 | struct mgmt_ev_connect_failed { |
337 | struct mgmt_addr_info addr; | 403 | struct mgmt_addr_info addr; |
338 | __u8 status; | 404 | __u8 status; |
339 | } __packed; | 405 | } __packed; |
340 | 406 | ||
341 | #define MGMT_EV_PIN_CODE_REQUEST 0x000D | 407 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E |
342 | struct mgmt_ev_pin_code_request { | 408 | struct mgmt_ev_pin_code_request { |
343 | bdaddr_t bdaddr; | 409 | struct mgmt_addr_info addr; |
344 | __u8 secure; | 410 | __u8 secure; |
345 | } __packed; | 411 | } __packed; |
346 | 412 | ||
347 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000E | 413 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F |
348 | struct mgmt_ev_user_confirm_request { | 414 | struct mgmt_ev_user_confirm_request { |
349 | bdaddr_t bdaddr; | 415 | struct mgmt_addr_info addr; |
350 | __u8 confirm_hint; | 416 | __u8 confirm_hint; |
351 | __le32 value; | 417 | __le32 value; |
352 | } __packed; | 418 | } __packed; |
353 | 419 | ||
354 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x000F | 420 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x0010 |
355 | struct mgmt_ev_user_passkey_request { | 421 | struct mgmt_ev_user_passkey_request { |
356 | bdaddr_t bdaddr; | 422 | struct mgmt_addr_info addr; |
357 | } __packed; | 423 | } __packed; |
358 | 424 | ||
359 | #define MGMT_EV_AUTH_FAILED 0x0010 | 425 | #define MGMT_EV_AUTH_FAILED 0x0011 |
360 | struct mgmt_ev_auth_failed { | 426 | struct mgmt_ev_auth_failed { |
361 | bdaddr_t bdaddr; | 427 | struct mgmt_addr_info addr; |
362 | __u8 status; | 428 | __u8 status; |
363 | } __packed; | 429 | } __packed; |
364 | 430 | ||
365 | #define MGMT_EV_DEVICE_FOUND 0x0011 | 431 | #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 |
432 | #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 | ||
433 | |||
434 | #define MGMT_EV_DEVICE_FOUND 0x0012 | ||
366 | struct mgmt_ev_device_found { | 435 | struct mgmt_ev_device_found { |
367 | struct mgmt_addr_info addr; | 436 | struct mgmt_addr_info addr; |
368 | __u8 dev_class[3]; | 437 | __s8 rssi; |
369 | __s8 rssi; | 438 | __u8 flags[4]; |
370 | __u8 confirm_name; | 439 | __le16 eir_len; |
371 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 440 | __u8 eir[0]; |
372 | } __packed; | ||
373 | |||
374 | #define MGMT_EV_REMOTE_NAME 0x0012 | ||
375 | struct mgmt_ev_remote_name { | ||
376 | bdaddr_t bdaddr; | ||
377 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
378 | } __packed; | 441 | } __packed; |
379 | 442 | ||
380 | #define MGMT_EV_DISCOVERING 0x0013 | 443 | #define MGMT_EV_DISCOVERING 0x0013 |
444 | struct mgmt_ev_discovering { | ||
445 | __u8 type; | ||
446 | __u8 discovering; | ||
447 | } __packed; | ||
381 | 448 | ||
382 | #define MGMT_EV_DEVICE_BLOCKED 0x0014 | 449 | #define MGMT_EV_DEVICE_BLOCKED 0x0014 |
383 | struct mgmt_ev_device_blocked { | 450 | struct mgmt_ev_device_blocked { |
384 | bdaddr_t bdaddr; | 451 | struct mgmt_addr_info addr; |
385 | } __packed; | 452 | } __packed; |
386 | 453 | ||
387 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0015 | 454 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0015 |
388 | struct mgmt_ev_device_unblocked { | 455 | struct mgmt_ev_device_unblocked { |
389 | bdaddr_t bdaddr; | 456 | struct mgmt_addr_info addr; |
457 | } __packed; | ||
458 | |||
459 | #define MGMT_EV_DEVICE_UNPAIRED 0x0016 | ||
460 | struct mgmt_ev_device_unpaired { | ||
461 | struct mgmt_addr_info addr; | ||
390 | } __packed; | 462 | } __packed; |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index aeaf5fa2b9f1..7b3acdd29134 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -127,7 +127,7 @@ struct smp_chan { | |||
127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ | 127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ |
128 | u8 pcnf[16]; /* SMP Pairing Confirm */ | 128 | u8 pcnf[16]; /* SMP Pairing Confirm */ |
129 | u8 tk[16]; /* SMP Temporary Key */ | 129 | u8 tk[16]; /* SMP Temporary Key */ |
130 | u8 smp_key_size; | 130 | u8 enc_key_size; |
131 | unsigned long smp_flags; | 131 | unsigned long smp_flags; |
132 | struct crypto_blkcipher *tfm; | 132 | struct crypto_blkcipher *tfm; |
133 | struct work_struct confirm; | 133 | struct work_struct confirm; |