1/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 *  * Redistributions of source code must retain the above copyright
7 *    notice, this list of conditions and the following disclaimer.
8 *  * Redistributions in binary form must reproduce the above copyright
9 *    notice, this list of conditions and the following disclaimer in
10 *    the documentation and/or other materials provided with the
11 *    distribution.
12 *  * Neither the name of The Linux Foundation nor the names of its
13 *    contributors may be used to endorse or promote products derived
14 *    from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __WIFI_HAL_LLSTATSCOMMAND_H__
30#define __WIFI_HAL_LLSTATSCOMMAND_H__
31
32#include <stdint.h>
33#include <fcntl.h>
34#include <sys/socket.h>
35#include <netlink/genl/genl.h>
36#include <netlink/genl/family.h>
37#include <netlink/genl/ctrl.h>
38#include <linux/rtnetlink.h>
39#include <netpacket/packet.h>
40#include <linux/filter.h>
41#include <linux/errqueue.h>
42
43#include <linux/pkt_sched.h>
44#include <netlink/object-api.h>
45#include <netlink/netlink.h>
46#include <netlink/socket.h>
47#include <netlink-types.h>
48#include <net/if.h>
49
50#include "nl80211_copy.h"
51#include "common.h"
52#include "cpp_bindings.h"
53#include "tdls.h"
54
55#ifdef __GNUC__
56#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
57#define STRUCT_PACKED __attribute__ ((packed))
58#else
59#define PRINTF_FORMAT(a,b)
60#define STRUCT_PACKED
61#endif
62#include "qca-vendor.h"
63
64#ifdef __cplusplus
65extern "C"
66{
67#endif /* __cplusplus */
68
69#define IS_GLOBAL_TDLS_SUPPORTED        BIT(0)
70#define IS_PER_MAC_TDLS_SUPPORTED       BIT(1)
71#define IS_OFF_CHANNEL_TDLS_SUPPORTED   BIT(2)
72
73typedef struct {
74    int maxConcurrentTdlsSessionNum;
75    u32 tdlsSupportedFeatures;
76} wifiTdlsCapabilities;
77
78class TdlsCommand: public WifiVendorCommand
79{
80private:
81    static TdlsCommand *mTdlsCommandInstance;
82    wifi_tdls_status mTDLSgetStatusRspParams;
83    wifi_request_id mRequestId;
84    wifi_tdls_handler mHandler;
85    wifiTdlsCapabilities mTDLSgetCaps;
86
87    TdlsCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd);
88
89public:
90    static TdlsCommand* instance(wifi_handle handle);
91    virtual ~TdlsCommand();
92
93    virtual void setSubCmd(u32 subcmd);
94
95    virtual int requestResponse();
96
97    virtual int handleEvent(WifiEvent &event);
98
99    virtual int handleResponse(WifiEvent &reply);
100
101    virtual int setCallbackHandler(wifi_tdls_handler nHandler, u32 event);
102
103    virtual void unregisterHandler(u32 subCmd);
104
105    virtual void getStatusRspParams(wifi_tdls_status *status);
106
107    virtual void getCapsRspParams(wifi_tdls_capabilities *caps);
108};
109
110#ifdef __cplusplus
111}
112#endif /* __cplusplus */
113#endif
114