Home | History | Annotate | Download | only in wifi_hal
      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 
     63 #ifdef __cplusplus
     64 extern "C"
     65 {
     66 #endif /* __cplusplus */
     67 
     68 #define IS_GLOBAL_TDLS_SUPPORTED        BIT(0)
     69 #define IS_PER_MAC_TDLS_SUPPORTED       BIT(1)
     70 #define IS_OFF_CHANNEL_TDLS_SUPPORTED   BIT(2)
     71 
     72 typedef struct {
     73     int maxConcurrentTdlsSessionNum;
     74     u32 tdlsSupportedFeatures;
     75 } wifiTdlsCapabilities;
     76 
     77 class TdlsCommand: public WifiVendorCommand
     78 {
     79 private:
     80     static TdlsCommand *mTdlsCommandInstance;
     81     wifi_tdls_status mTDLSgetStatusRspParams;
     82     wifi_request_id mRequestId;
     83     wifi_tdls_handler mHandler;
     84     wifiTdlsCapabilities mTDLSgetCaps;
     85 
     86     TdlsCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd);
     87 
     88 public:
     89     static TdlsCommand* instance(wifi_handle handle);
     90     virtual ~TdlsCommand();
     91 
     92     virtual void setSubCmd(u32 subcmd);
     93 
     94     virtual int requestResponse();
     95 
     96     virtual int handleEvent(WifiEvent &event);
     97 
     98     virtual int handleResponse(WifiEvent &reply);
     99 
    100     virtual int setCallbackHandler(wifi_tdls_handler nHandler, u32 event);
    101 
    102     virtual void unregisterHandler(u32 subCmd);
    103 
    104     virtual void getStatusRspParams(wifi_tdls_status *status);
    105 
    106     virtual void getCapsRspParams(wifi_tdls_capabilities *caps);
    107 };
    108 
    109 #ifdef __cplusplus
    110 }
    111 #endif /* __cplusplus */
    112 #endif
    113