18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci   BlueZ - Bluetooth protocol stack for Linux
38c2ecf20Sopenharmony_ci   Copyright (C) 2015  Intel Coropration
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci   This program is free software; you can redistribute it and/or modify
68c2ecf20Sopenharmony_ci   it under the terms of the GNU General Public License version 2 as
78c2ecf20Sopenharmony_ci   published by the Free Software Foundation;
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
108c2ecf20Sopenharmony_ci   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
118c2ecf20Sopenharmony_ci   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
128c2ecf20Sopenharmony_ci   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
138c2ecf20Sopenharmony_ci   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
148c2ecf20Sopenharmony_ci   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
158c2ecf20Sopenharmony_ci   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
168c2ecf20Sopenharmony_ci   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
198c2ecf20Sopenharmony_ci   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
208c2ecf20Sopenharmony_ci   SOFTWARE IS DISCLAIMED.
218c2ecf20Sopenharmony_ci*/
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct mgmt_pending_cmd {
248c2ecf20Sopenharmony_ci	struct list_head list;
258c2ecf20Sopenharmony_ci	u16 opcode;
268c2ecf20Sopenharmony_ci	int index;
278c2ecf20Sopenharmony_ci	void *param;
288c2ecf20Sopenharmony_ci	size_t param_len;
298c2ecf20Sopenharmony_ci	struct sock *sk;
308c2ecf20Sopenharmony_ci	void *user_data;
318c2ecf20Sopenharmony_ci	int (*cmd_complete)(struct mgmt_pending_cmd *cmd, u8 status);
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciint mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel,
358c2ecf20Sopenharmony_ci		    void *data, u16 data_len, int flag, struct sock *skip_sk);
368c2ecf20Sopenharmony_ciint mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status);
378c2ecf20Sopenharmony_ciint mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
388c2ecf20Sopenharmony_ci		      void *rp, size_t rp_len);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_find(unsigned short channel, u16 opcode,
418c2ecf20Sopenharmony_ci					   struct hci_dev *hdev);
428c2ecf20Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_find_data(unsigned short channel,
438c2ecf20Sopenharmony_ci						u16 opcode,
448c2ecf20Sopenharmony_ci						struct hci_dev *hdev,
458c2ecf20Sopenharmony_ci						const void *data);
468c2ecf20Sopenharmony_civoid mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
478c2ecf20Sopenharmony_ci			  void (*cb)(struct mgmt_pending_cmd *cmd, void *data),
488c2ecf20Sopenharmony_ci			  void *data);
498c2ecf20Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
508c2ecf20Sopenharmony_ci					  struct hci_dev *hdev,
518c2ecf20Sopenharmony_ci					  void *data, u16 len);
528c2ecf20Sopenharmony_civoid mgmt_pending_free(struct mgmt_pending_cmd *cmd);
538c2ecf20Sopenharmony_civoid mgmt_pending_remove(struct mgmt_pending_cmd *cmd);
54