162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci   BlueZ - Bluetooth protocol stack for Linux
362306a36Sopenharmony_ci   Copyright (C) 2015  Intel Coropration
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci   This program is free software; you can redistribute it and/or modify
662306a36Sopenharmony_ci   it under the terms of the GNU General Public License version 2 as
762306a36Sopenharmony_ci   published by the Free Software Foundation;
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1062306a36Sopenharmony_ci   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1162306a36Sopenharmony_ci   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
1262306a36Sopenharmony_ci   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
1362306a36Sopenharmony_ci   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
1462306a36Sopenharmony_ci   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1562306a36Sopenharmony_ci   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1662306a36Sopenharmony_ci   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
1962306a36Sopenharmony_ci   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
2062306a36Sopenharmony_ci   SOFTWARE IS DISCLAIMED.
2162306a36Sopenharmony_ci*/
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cistruct mgmt_mesh_tx {
2462306a36Sopenharmony_ci	struct list_head list;
2562306a36Sopenharmony_ci	int index;
2662306a36Sopenharmony_ci	size_t param_len;
2762306a36Sopenharmony_ci	struct sock *sk;
2862306a36Sopenharmony_ci	u8 handle;
2962306a36Sopenharmony_ci	u8 instance;
3062306a36Sopenharmony_ci	u8 param[sizeof(struct mgmt_cp_mesh_send) + 31];
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistruct mgmt_pending_cmd {
3462306a36Sopenharmony_ci	struct list_head list;
3562306a36Sopenharmony_ci	u16 opcode;
3662306a36Sopenharmony_ci	int index;
3762306a36Sopenharmony_ci	void *param;
3862306a36Sopenharmony_ci	size_t param_len;
3962306a36Sopenharmony_ci	struct sock *sk;
4062306a36Sopenharmony_ci	struct sk_buff *skb;
4162306a36Sopenharmony_ci	void *user_data;
4262306a36Sopenharmony_ci	int (*cmd_complete)(struct mgmt_pending_cmd *cmd, u8 status);
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistruct sk_buff *mgmt_alloc_skb(struct hci_dev *hdev, u16 opcode,
4662306a36Sopenharmony_ci			       unsigned int size);
4762306a36Sopenharmony_ciint mgmt_send_event_skb(unsigned short channel, struct sk_buff *skb, int flag,
4862306a36Sopenharmony_ci			struct sock *skip_sk);
4962306a36Sopenharmony_ciint mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel,
5062306a36Sopenharmony_ci		    void *data, u16 data_len, int flag, struct sock *skip_sk);
5162306a36Sopenharmony_ciint mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status);
5262306a36Sopenharmony_ciint mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
5362306a36Sopenharmony_ci		      void *rp, size_t rp_len);
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_find(unsigned short channel, u16 opcode,
5662306a36Sopenharmony_ci					   struct hci_dev *hdev);
5762306a36Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_find_data(unsigned short channel,
5862306a36Sopenharmony_ci						u16 opcode,
5962306a36Sopenharmony_ci						struct hci_dev *hdev,
6062306a36Sopenharmony_ci						const void *data);
6162306a36Sopenharmony_civoid mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
6262306a36Sopenharmony_ci			  void (*cb)(struct mgmt_pending_cmd *cmd, void *data),
6362306a36Sopenharmony_ci			  void *data);
6462306a36Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
6562306a36Sopenharmony_ci					  struct hci_dev *hdev,
6662306a36Sopenharmony_ci					  void *data, u16 len);
6762306a36Sopenharmony_cistruct mgmt_pending_cmd *mgmt_pending_new(struct sock *sk, u16 opcode,
6862306a36Sopenharmony_ci					  struct hci_dev *hdev,
6962306a36Sopenharmony_ci					  void *data, u16 len);
7062306a36Sopenharmony_civoid mgmt_pending_free(struct mgmt_pending_cmd *cmd);
7162306a36Sopenharmony_civoid mgmt_pending_remove(struct mgmt_pending_cmd *cmd);
7262306a36Sopenharmony_civoid mgmt_mesh_foreach(struct hci_dev *hdev,
7362306a36Sopenharmony_ci		       void (*cb)(struct mgmt_mesh_tx *mesh_tx, void *data),
7462306a36Sopenharmony_ci		       void *data, struct sock *sk);
7562306a36Sopenharmony_cistruct mgmt_mesh_tx *mgmt_mesh_find(struct hci_dev *hdev, u8 handle);
7662306a36Sopenharmony_cistruct mgmt_mesh_tx *mgmt_mesh_next(struct hci_dev *hdev, struct sock *sk);
7762306a36Sopenharmony_cistruct mgmt_mesh_tx *mgmt_mesh_add(struct sock *sk, struct hci_dev *hdev,
7862306a36Sopenharmony_ci				   void *data, u16 len);
7962306a36Sopenharmony_civoid mgmt_mesh_remove(struct mgmt_mesh_tx *mesh_tx);
80