blob: 6559f189213c8b27140bb123fefe1f3a4250c80c [file] [log] [blame]
Johan Hedberga380b6c2015-03-17 13:48:48 +02001/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2015 Intel Coropration
4
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
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
23struct mgmt_pending_cmd {
24 struct list_head list;
25 u16 opcode;
26 int index;
27 void *param;
28 size_t param_len;
29 struct sock *sk;
30 void *user_data;
31 int (*cmd_complete)(struct mgmt_pending_cmd *cmd, u8 status);
32};
33
34int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel,
35 void *data, u16 data_len, int flag, struct sock *skip_sk);
36int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status);
37int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
38 void *rp, size_t rp_len);
39
40struct mgmt_pending_cmd *mgmt_pending_find(unsigned short channel, u16 opcode,
41 struct hci_dev *hdev);
42struct mgmt_pending_cmd *mgmt_pending_find_data(unsigned short channel,
43 u16 opcode,
44 struct hci_dev *hdev,
45 const void *data);
46void mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
47 void (*cb)(struct mgmt_pending_cmd *cmd, void *data),
48 void *data);
49struct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
50 struct hci_dev *hdev,
51 void *data, u16 len);
52void mgmt_pending_free(struct mgmt_pending_cmd *cmd);
53void mgmt_pending_remove(struct mgmt_pending_cmd *cmd);