/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file u_net_wlan.h
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *
 *  @par Description:
 *         This header file contains wifi definitions, which are exported
 */
/*----------------------------------------------------------------------------*/
#ifndef _U_NET_WLAN_H
#define _U_NET_WLAN_H

/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_INET_WIFI WIFI
 *  @ingroup groupMW_INET
 *  @brief The Svl builder module is the super module of other svl builder engine
 *  %MW Application API would be used by Application, lot of these APIs would
 *   be wrapped from Exported API. Using these APIs, application could create scan engine
 *   or start scan from the exported API of svl builder.
 *
 *  @see groupMW_INET
 *  @{
 */
/*----------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/

#define WLAN_SUB_VERSION     0x00         /**< Wlan FW version.*/

#define NET_WLAN_OK                 0     /**< Success. */
#define NET_WLAN_ERROR              -1    /**< Undefined error.*/
#define NET_WLAN_INVALID_PARAM      -2    /**< The parameter was incompatible to this software or invalid.*/
#define NET_WLAN_DEV_NOT_READY      -3    /**< Wlan driver/device is not ready.       */
#define NET_WLAN_NOT_INIT           -4    /**< Wlan module is not init.        */
#define NET_WLAN_ALREADY_INIT       -6    /**< Wlan module is already init.       */
#define NET_WLAN_NOT_STARTED        -7    /**< Wlan module is not started.       */
#define NET_WLAN_ALREADY_STARTED    -8    /**< Wlan module is already started.       */
#define NET_WLAN_DRV_INTERFACE_ERR  -9    /**< Wlan module function pointer is incorrect.       */
#define NET_WLAN_SUPPLICANT_STARTING  -10    /**< Wlan supplicant is starting     */


#define NET_WLAN_WPS_FAILED       (-1)    /**< Process is terminated because some error occurred or WPS process was cancelled by a user. */
#define NET_WLAN_WPS_IDLE          (0)    /**< Idle.    */
#define NET_WLAN_WPS_SEARCHING     (1)    /**< Searching a registrar.   */
#define NET_WLAN_WPS_REGISTERING   (2)    /**< Registering.  */
#define NET_WLAN_WPS_REGISTERED    (3)    /**< Registered.   */


#define NET_802_11_MAX_LEN_SSID     32    /**< maximum SSID length.       */
#define WLAN_KEY_MAX_LENGTH     (64)

#define NET_WPA_DATA_LENGTH         1024  /**< NET_802_11_WPA_T DATA length.       */
#define NET_NFY_DATA_LENGTH         256   /**< NET_802_11_NFY_T DATA length.       */
#define DRIVER_VERSION_LENGTH       30

/** \defgroup CAPINFO Defines for Capability IE definitions
 *  @{
 */
#define NET_WLAN_IEEE80211_CAP_ESS      0x0001
#define NET_WLAN_IEEE80211_CAP_IBSS     0x0002 /* Set when in Ad-hoc mode */
#define NET_WLAN_IEEE80211_CAP_PRIVACY  0x0010
#define ACFG_MAX_ANTENNA       3
/**
 * @brief Type of BSSID data array.
 */
typedef UINT8 NET_802_11_BSSID_T [6]; /**< Type of BSSID data array.       */

typedef enum
{
    OID_802_11_A,
    OID_802_11_B,
    OID_802_11_G,
    OID_802_11_N,
    OID_802_11_B_G,
    OID_802_11_G_N,
    OID_802_11_B_G_N,
    OID_802_11_A_N,
    OID_802_11_A_B_G,
    OID_802_11_A_G_N,
    OID_802_11_A_B_G_N
} NET_802_11_T;

typedef enum
{
    OID_802_11_BW20,
    OID_802_11_BW40
} NET_802_11_BW_T;

#define WPA_SUPPLICANT_PATH LINUX_3RD_PATH"/bin/wpa_supplicant"
#if CONFIG_MW_CUSTOM_JSN

typedef enum
{
    OID_802_11_START = 0x00040000,
    /* set OIDs */
    OID_802_11_SCAN,            /* param : NET_802_11_SCAN_T */
    OID_802_11_ASSOCIATE,       /* param : NET_802_11_ASSOCIATE_T */
    OID_802_11_DISASSOCIATE,    /* param : NULL */
    OID_802_11_SET_MAC_ADDR,    /* param : UINT8 */
    OID_802_11_WPS_ASSOCIATE,   /* param : NET_802_11_WPS_ASSOC_MODE_T */
    OID_802_11_WPS_REG_CB,      /* param : NONE */
    OID_802_11_WPS_UNREG_CB,    /* param : NONE */
    OID_802_11_WPS_CANCEL,      /* param : NONE */
    OID_802_11_WPS_REFRESH_PIN, /* param : NONE */
    /* get OIDs */
    OID_802_11_GET_SCAN_RESULT, /* param : NET_802_11_SCAN_RESULT_T */
    OID_802_11_GET_ESS_LIST,    /* param : NET_802_11_ESS_LIST_T */
    OID_802_11_GET_CURR_BSS,    /* param : NET_802_11_BSS_INFO_T */
    OID_802_11_GET_SIG_STRENGTH,/* param : UINT8 */
    OID_802_11_GET_MAC_ADDR,    /* param : UINT8 */
    OID_802_11_GET_EEPROM,      /* param : UINT32 */
    OID_802_11_WPA_GET_STATUS,  /* param : INT32 */
    OID_802_11_WPS_GET_PIN,     /* param : NONE */
    OID_802_11_WPS_GET_STATUS,  /* param : NONE */

    OID_802_11_WLAN_CHECK_INIT,/* param: NONE*/
    OID_802_11_WLAN_DUMMY_START,/* param : NONE */
    OID_802_11_WLAN_INIT,       /* param : NONE */
    OID_802_11_WLAN_DEINIT,     /* param : NONE */
    OID_802_11_WLAN_START,      /* param : NONE */
    OID_802_11_WLAN_STOP,       /* param : NONE */
    OID_802_11_WLAN_TASK_CREATE,/* param : NONE */
    OID_802_11_WLAN_PLUG_IN,    /* param : NONE */
    OID_802_11_WLAN_PLUG_OUT,   /* param : NONE */

    OID_802_11_GET_RSSI

}WLAN_OID_T;


#else

#if CONFIG_WIFI_MW_NEW_SUPPLICANT
typedef enum
{
    OID_802_11_START = 0x00040000,
    /* set OIDs */
    OID_802_11_SCAN,            /* param : NET_802_11_SCAN_T */
    OID_802_11_ASSOCIATE,       /* param : NET_802_11_ASSOCIATE_T */
    OID_802_11_DISASSOCIATE,    /* param : NULL */
    OID_802_11_SET_MAC_ADDR,    /* param : UINT8 */
    OID_802_11_WPS_ASSOCIATE,   /* param : NET_802_11_WPS_ASSOC_MODE_T */
    OID_802_11_WPS_REG_CB,      /* param : NONE */
    OID_802_11_WPS_UNREG_CB,    /* param : NONE */
    OID_802_11_WPS_CANCEL,      /* param : NONE */
    OID_802_11_WPS_REFRESH_PIN, /* param : NONE */
    /* get OIDs */
    OID_802_11_GET_SCAN_RESULT, /* param : NET_802_11_SCAN_RESULT_T */
    OID_802_11_GET_ESS_LIST,    /* param : NET_802_11_ESS_LIST_T */
    OID_802_11_GET_CURR_BSS,    /* param : NET_802_11_BSS_INFO_T */
    OID_802_11_GET_SIG_STRENGTH,/* param : UINT8 */
    OID_802_11_GET_MAC_ADDR,    /* param : UINT8 */
    OID_802_11_GET_EEPROM,      /* param : UINT32 */
    OID_802_11_WPA_GET_STATUS,  /* param : INT32 */
    OID_802_11_WPS_GET_PIN,     /* param : NONE */
    OID_802_11_WPS_GET_STATUS,  /* param : NONE */

    OID_802_11_WLAN_CHECK_INIT,/* param: NONE*/
    OID_802_11_WLAN_DUMMY_START,/* param : NONE */
    OID_802_11_WLAN_INIT,		/* param : NONE */
    OID_802_11_WLAN_DEINIT,		/* param : NONE */
    OID_802_11_WLAN_START,		/* param : NONE */
    OID_802_11_WLAN_STOP,		/* param : NONE */
    OID_802_11_WLAN_TASK_CREATE,/* param : NONE */
    OID_802_11_WLAN_PLUG_IN,	/* param : NONE */
    OID_802_11_WLAN_PLUG_OUT,	/* param : NONE */

    OID_802_11_GET_RSSI

}WLAN_OID_T;
#endif

#endif

/*------------------------------------------------------------------*/
/*! @brief Type of wlan callback fuction that notifies upper layer.
 *  @param [in]  i4CallbackId - callback ID
 *  @param [in]  pParam - parameter
 *  @return   results
 *  @retval   WLAN_NFY_MSG_OK   -  successful
 *  @retval   Others         -  failed
 */
/*------------------------------------------------------------------*/
typedef INT32 (*x_net_wlan_notify_fct)(INT32 i4CallbackId,
                                            VOID *pParam);

/*--------------------------------------------------------------*/
/*                                                              */
/* Enumeration                                                  */
/*                                                              */
/*--------------------------------------------------------------*/

/*------------------------------------------------------------------*/
/*! @enum WLAN_NOTIFY_ID_T
 *  @brief NotifyID Defines for notification types
 *  @code
 *  typedef enum
 *  {
 *      WLAN_NOTIFY_START_IND,
 *      WLAN_NOTIFY_STOP_IND,
 *      WLAN_NOTIFY_INIT_IND,
 *      WLAN_NOTIFY_DEINIT_IND,
 *      WLAN_NOTIFY_SCAN,
 *      WLAN_NOTIFY_ASSOCIATE,
 *      WLAN_NOTIFY_WPS_ASSOC_SETTING,
 *      WLAN_NOTIFY_WPS_STATE,
 *      WLAN_NOTIFY_WPS_ASSOCIATE
 *  }   WLAN_NOTIFY_ID_T;
 *  @endcode
 *  @li@c  WLAN_NOTIFY_START_IND                            - WLAN module start \ref NotifyMsg "indication
 *  @li@c  WLAN_NOTIFY_STOP_IND                              - WLAN module stopinit \ref NotifyMsg "indication
 *  @li@c  WLAN_NOTIFY_INIT_IND                               - WLAN module init \ref NotifyMsg "indication
 *  @li@c  WLAN_NOTIFY_DEINIT_IND                            - WLAN module deinit \ref NotifyMsg "indication"
 *  @li@c  WLAN_NOTIFY_SCAN                                    - Scan result notification \ref NotifyMsg "message"
 *  @li@c  WLAN_NOTIFY_ASSOCIATE                            - Association result notification \ref NotifyMsg "message"
 *  @li@c  WLAN_NOTIFY_WPS_ASSOC_SETTING             - WPS association notification \ref NotifyMsg "message"
 *  @li@c  WLAN_NOTIFY_WPS_STATE                           - WPS processing \ref WPSStatus "state"
 *  @li@c  WLAN_NOTIFY_WPS_ASSOCIATE                    - WPS Association result notification \ref NotifyMsg "message"
 */
/*------------------------------------------------------------------*/
typedef enum
{
    WLAN_NOTIFY_START_IND,
    WLAN_NOTIFY_STOP_IND,
    WLAN_NOTIFY_INIT_IND,
    WLAN_NOTIFY_DEINIT_IND,
    WLAN_NOTIFY_SCAN,
    WLAN_NOTIFY_ASSOCIATE,
    WLAN_NOTIFY_WPS_ASSOC_SETTING,
    WLAN_NOTIFY_WPS_STATE,
    WLAN_NOTIFY_WPS_ASSOCIATE,
    WLAN_NOTIFY_DEV_PLUG_IN,
    WLAN_NOTIFY_DEV_PLUG_OUT,
    WLAN_NOTIFY_DISCONNECTED,
    WLAN_NOTIFY_P2P_DEVICE_FOUND,
    WLAN_NOTIFY_P2P_GROUP_STARTED,
    WLAN_NOTIFY_P2P_GROUP_REMOVED,
    WLAN_NOTIFY_P2P_GO_NEG_REQUEST,
    WLAN_NOTIFY_P2P_LEGACY_CONNECT,
    WLAN_NOTIFY_P2P_LEGACY_DISCONNECT,
    WLAN_NOTIFY_DRIVER_START_IND,
    WLAN_NOTIFY_DRIVER_START_FAILED ,
    WLAN_NOTIFY_PROV_DISC_SHOW_PIN,
    WLAN_NOTIFY_PROV_DISC_ENTER_PIN,
    WLAN_NOTIFY_P2P_PROV_DISC_PBC_REQ,
    WLAN_NOTIFY_P2P_INVITATION_RECEIVED,
    WLAN_NOTIFY_P2P_ASSOC_TAB,
    WLAN_NOTIFY_P2P_PROV_DISC_RESP,
    WLAN_NOTIFY_DRIVER_VERSION,
    WLAN_NOTIFY_WFD_IP_GET,
    //mtk94097 Porting
    WLAN_NOTIFY_P2P_DEVICE_LOST ,
    WLAN_NOTIFY_P2P_GROUP_FORMATION_SUCCESS ,
    WLAN_NOTIFY_P2P_GROUP_FORMATION_FAILURE ,
    WLAN_NOTIFY_P2P_SUPP_START_IND,
    WLAN_NOTIFY_P2P_SUPP_START_FAILED,
    WLAN_NOTIFY_WFD_PIN_KEYPAD ,
    WLAN_NOTIFY_WFD_PIN_DISPLAY ,
    WLAN_NOTIFY_WFD_PBC ,
    WLAN_NOTIFY_P2P_GO_NEG_SUCCESS ,
    WLAN_NOTIFY_P2P_GO_NEG_FAILURE ,
    WLAN_NOTIFY_P2P_DHCP_SUCCESS_DHCPv4 ,
    WLAN_NOTIFY_P2P_DHCP_SUCCESS_LINKLOCAL ,
    WLAN_NOTIFY_P2P_DHCP_FAILURE_LINKLOCAL ,
    WLAN_NOTIFY_P2P_INVITATION_RESULT ,
    WLAN_NOTIFY_AP_STA_CONNECTED ,
    WLAN_NOTIFY_AP_STA_DISCONNECTED,
    WLAN_NOTIFY_P2P_WPS_SEND_M2D, //pin code error
    WLAN_NOTIFY_P2P_WPS_RECEIVE_NACK, //pin code error
	WLAN_NOTIFY_P2P_GO_NEGO_FAIL_INTENT,
	WLAN_NOTIFY_P2P_OPR_CH,
	WLAN_NOTIFY_SUPPLICANT_TERMINATING,
	WLAN_NOTIFY_P2P_GO_NEGO_FAIL_RECV_RESP,
	WLAN_NOTIFY_P2P_GO_NEGO_FAIL_RECV_CONFIRM,
	WLAN_NOTIFY_P2P_WPS_FAIL,
	WLAN_NOTIFY_P2P_WPS_TIMEOUT,
	WLAN_NOTIFY_P2P_WPS_2MINS_TIMEOUT,
	WLAN_NOTIFY_P2P_WPS_PBC_SESSION_OVERLAP,
	WLAN_NOTIFY_WPS_SUCCESS,
	WLAN_NOTIFY_P2P_STOP_CONNECT,
	WLAN_NOTIFY_P2P_DEAUTH_AP,
	WLAN_NOTIFY_P2P_PROV_DISC_PBC_RESP,
	WLAN_NOTIFY_CANCEL_CONNECT
	//mtk94097
}   WLAN_NOTIFY_ID_T;


/*------------------------------------------------------------------*/
/*! @brief NotifyMsg Defines for notification messages
 *  @code
 *  typedef enum
 *  {
 *      WLAN_NFY_MSG_OK                     = 0,
 *      WLAN_NFY_MSG_ALREADY_ASSOCIATED,
 *      WLAN_NFY_MSG_INIT_FAIL,
 *      WLAN_NFY_MSG_DEINIT_FAIL,
 *      WLAN_NFY_MSG_DONGLE_UNPLUG,
 *      WLAN_NFY_MSG_ASSOC_FAIL             = 10,
 *      WLAN_NFY_MSG_ASSOC_TIMEOUT,
 *      WLAN_NFY_MSG_AUTH_TIMEOUT,
 *      WLAN_NFY_MSG_PSK_INCORRECT,
 *      WLAN_NFY_MSG_NO_MATCHED_CONFIG,
 *      WLAN_NFY_MSG_NO_MATCHED_SSID,
 *      WLAN_NFY_MSG_WPS_CANCELLED,
 *      WLAN_NFY_MSG_WPS_PIN_MISMATCH,
 *      WLAN_NFY_MSG_WPS_SCAN_TIMEOUT,
 *      WLAN_NFY_MSG_WPS_PBC_OVERLAP,
 *      WLAN_NFY_MSG_WPS_PROTOCOL_TIMEOUT,
 *      WLAN_NFY_MSG_WPS_CREDENTIAL_INVALID
 *  }   WLAN_NOTIFY_MSG_T;
 *  @endcode
 *  @li@c  WLAN_NFY_MSG_OK                                             - Success.
 *  @li@c  WLAN_NFY_MSG_ALREADY_ASSOCIATED                  - WLAN already associated.
 *  @li@c  WLAN_NFY_MSG_INIT_FAIL                                    - WLAN driver init fail.
 *  @li@c  WLAN_NFY_MSG_DEINIT_FAIL                                 - WLAN driver deinit fail.
 *  @li@c  WLAN_NFY_MSG_DONGLE_UNPLUG                           - WLAN dongle is unplugged.
 *  @li@c  WLAN_NFY_MSG_ASSOC_FAIL                                 - Undefined association fail.
 *  @li@c  WLAN_NFY_MSG_ASSOC_TIMEOUT                           - Association timeout.
 *  @li@c  WLAN_NFY_MSG_AUTH_TIMEOUT                             - WPA association fail, authentication timeout.
 *  @li@c  WLAN_NFY_MSG_PSK_INCORRECT                             - WPA association fail, incorrect Pre-share key.
 *  @li@c  WLAN_NFY_MSG_NO_MATCHED_CONFIG                     - WPA association fail, no matched config is found.
 *  @li@c  WLAN_NFY_MSG_NO_MATCHED_SSID                         - WPA association fail, no matched SSID is found.
 *  @li@c  WLAN_NFY_MSG_WPS_CANCELLED                            - WPS Registration was cancelled by a user.
 *  @li@c  WLAN_NFY_MSG_WPS_PIN_MISMATCH                       - WPS Association fail, PIN was mismatched to the registrar's PIN.
 *  @li@c  WLAN_NFY_MSG_WPS_SCAN_TIMEOUT                      - WPS Association fail, failed to detect a registrar in PIN/PBC mode.
 *  @li@c  WLAN_NFY_MSG_WPS_PBC_OVERLAP                         - WPS Association fail, due to PBC overlap.
 *  @li@c  WLAN_NFY_MSG_WPS_PROTOCOL_TIMEOUT               - WPS Association fail, protocol failed to complete after the credential(PIN/PBC) was authorized.
 *  @li@c  WLAN_NFY_MSG_WPS_CREDENTIAL_INVALID               - WPS Association fail, credential received from the registrar is incompatible or invalid.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    /* normal message */
    WLAN_NFY_MSG_OK                     = 0,
    WLAN_NFY_MSG_ALREADY_ASSOCIATED,

    /* wndrv abnormal message */
    WLAN_NFY_MSG_INIT_FAIL,
    WLAN_NFY_MSG_DEINIT_FAIL,
    WLAN_NFY_MSG_DONGLE_UNPLUG,
    //add for marvell
    //CONFIG_SUPPORT_MARVELL_WIFI
    WLAN_NFY_MSG_CONN_ESTABLISHING,
    /* wpa abnormal message */
    WLAN_NFY_MSG_ASSOC_FAIL             = 10,
    WLAN_NFY_MSG_ASSOC_TIMEOUT,
    WLAN_NFY_MSG_AUTH_TIMEOUT,
    WLAN_NFY_MSG_PSK_INCORRECT,
    WLAN_NFY_MSG_NO_MATCHED_CONFIG,
    WLAN_NFY_MSG_NO_MATCHED_SSID,
    /* wps abnormal message */
    WLAN_NFY_MSG_WPS_CANCELLED,
    WLAN_NFY_MSG_WPS_PIN_MISMATCH,
    WLAN_NFY_MSG_WPS_SCAN_TIMEOUT,
    WLAN_NFY_MSG_WPS_PBC_OVERLAP,
    WLAN_NFY_MSG_WPS_PROTOCOL_TIMEOUT,
    WLAN_NFY_MSG_WPS_CREDENTIAL_INVALID ,
    WLAN_NFY_MSG_DISCONNECTED,
    WLAN_NFY_MSG_WPS_CREDENTIAL_WEP
}   WLAN_NOTIFY_MSG_T;


/*------------------------------------------------------------------*/
/*! @enum WLAN_WPS_STATE_T
 *  @brief WPSStatus Defines for WPS status codes
 *  @code
 *  typedef enum
 *  {
 *      WLAN_MW_WPS_IDLE            = 0,
 *      WLAN_MW_WPS_FAIL_RE_DO,
 *      WLAN_MW_WPS_DISCOVER,
 *      WLAN_MW_WPS_ASSOCIATING,
 *      WLAN_MW_WPS_WAIT_REQ_ID,
 *      WLAN_MW_WPS_WAIT_WSC_START,
 *      WLAN_MW_WPS_WAIT_WSC_M2,
 *      WLAN_MW_WPS_WAIT_WSC_M4,
 *      WLAN_MW_WPS_WAIT_WSC_M6,
 *      WLAN_MW_WPS_WAIT_WSC_M8,
 *      WLAN_MW_WPS_WAIT_EAP_FAIL,
 *      WLAN_MW_WPS_WAIT_WPA_SUPC,
 *      WLAN_MW_WPS_CONNECTED,
 *      WLAN_MW_WPS_FAIL,
 *      WLAN_MW_WPS_PERIOD_START,
 *      WLAN_MW_WPS_STATE_MAX
 *  }   WLAN_WPS_STATE_T;
 *  @endcode
 *  @li@c  WLAN_MW_WPS_IDLE                                      - WPS Idle state.
 *  @li@c  WLAN_MW_WPS_FAIL_RE_DO                            - WPS Fail and Redo state.
 *  @li@c  WLAN_MW_WPS_DISCOVER                               - WPS Discover AP state.
 *  @li@c  WLAN_MW_WPS_ASSOCIATING                          - WPS Associating AP state.
 *  @li@c  WLAN_MW_WPS_WAIT_REQ_ID                          - WPS Wait Req ID state.
 *  @li@c  WLAN_MW_WPS_WAIT_WSC_START                   - WPS Wait Start state.
 *  @li@c  WLAN_MW_WPS_WAIT_WSC_M2                        - WPS Wait M2 state.
 *  @li@c  WLAN_MW_WPS_WAIT_WSC_M4                        - WPS Wait M4 state.
 *  @li@c  WLAN_MW_WPS_WAIT_WSC_M6                        - WPS Wait M6 state.
 *  @li@c  WLAN_MW_WPS_WAIT_WSC_M8                        - WPS Wait M8 state.
 *  @li@c  WLAN_MW_WPS_WAIT_EAP_FAIL                       - WPS Wait EAP Fail state.
 *  @li@c  WLAN_MW_WPS_WAIT_WPA_SUPC                     - WPS Connecting state.
 *  @li@c  WLAN_MW_WPS_CONNECTED                             - WPS Connected state.
 *  @li@c  WLAN_MW_WPS_FAIL                                       - WPS Fail state.
 *  @li@c  WLAN_MW_WPS_PERIOD_START                         - WPS period state.
 *  @li@c  WLAN_MW_WPS_STATE_MAX                             - WPS state Max number.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    WLAN_MW_WPS_IDLE            = 0,
    WLAN_MW_WPS_FAIL_RE_DO,
    WLAN_MW_WPS_DISCOVER,
    WLAN_MW_WPS_ASSOCIATING,
    WLAN_MW_WPS_WAIT_REQ_ID,
    WLAN_MW_WPS_WAIT_WSC_START,
    WLAN_MW_WPS_WAIT_WSC_M2,
    WLAN_MW_WPS_WAIT_WSC_M4,
    WLAN_MW_WPS_WAIT_WSC_M6,
    WLAN_MW_WPS_WAIT_WSC_M8,
    WLAN_MW_WPS_WAIT_EAP_FAIL,
    WLAN_MW_WPS_WAIT_WPA_SUPC,
    WLAN_MW_WPS_CONNECTED,
    WLAN_MW_WPS_FAIL,
    WLAN_MW_WPS_PERIOD_START,
    WLAN_MW_WPS_STATE_MAX
}   WLAN_WPS_STATE_T;


/*------------------------------------------------------------------*/
/*! @enum WLAN_WPA_STATUS_T
 *  @brief WPAStatus Defines for WPA status codes
 *  @code
 *  typedef enum
 *  {
 *  	WLAN_WPA_DISCONNECTED           = 0,
 *  	WLAN_WPA_INACTIVE,
 *  	WLAN_WPA_SCANNING,
 *  	WLAN_WPA_ASSOCIATING,
 *  	WLAN_WPA_ASSOCIATED,
 *  	WLAN_WPA_4WAY_HANDSHAKE,
 *  	WLAN_WPA_GROUP_HANDSHAKE,
 *  	WLAN_WPA_COMPLETED
 *  }   WLAN_WPA_STATUS_T;
 *  @endcode
 *  @li@c  WLAN_WPA_DISCONNECTED                         - Disconnected state.
 *  @li@c  WLAN_WPA_INACTIVE                                 - Inactive state (WPA disabled).
 *  @li@c  WLAN_WPA_SCANNING                                - Scanning for a network.
 *  @li@c  WLAN_WPA_ASSOCIATING                           - Trying to associate with a BSS/SSID.
 *  @li@c  WLAN_WPA_ASSOCIATED                            - Association completed.
 *  @li@c  WLAN_WPA_4WAY_HANDSHAKE                    - WPA 4-Way Key Handshake in progress.
 *  @li@c  WLAN_WPA_GROUP_HANDSHAKE                   - WPA Group Key Handshake in progress.
 *  @li@c  WLAN_WPA_COMPLETED                             - All authentication completed.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    /* normal status */
	WLAN_WPA_DISCONNECTED           = 0,
	WLAN_WPA_INACTIVE,
	WLAN_WPA_SCANNING,
	WLAN_WPA_ASSOCIATING,
	WLAN_WPA_ASSOCIATED,
	WLAN_WPA_4WAY_HANDSHAKE,
	WLAN_WPA_GROUP_HANDSHAKE,
    WLAN_WPA_COMPLETED,
    WLAN_WPA_CONN_FAIL
}   WLAN_WPA_STATUS_T;



/*------------------------------------------------------------------*/
/*! @enum NET_802_11_ASSOC_CASE_T
 *  @brief AssocCase Defines for association cases
 *  @code
 *  typedef enum
 *  {
 *      IEEE_802_11_PWR_ON_ASSOC,
 *      IEEE_802_11_MANUAL_ASSOC,
 *      IEEE_802_11_SCAN_ASSOC,
 *      IEEE_802_11_WPS_ASSOC
 *  }   NET_802_11_ASSOC_CASE_T;
 *  @endcode
 *  @li@c  IEEE_802_11_PWR_ON_ASSOC                         - power on association.
 *  @li@c  IEEE_802_11_MANUAL_ASSOC                         - manual association.
 *  @li@c  IEEE_802_11_SCAN_ASSOC                             - scan and select SSID to associate.
 *  @li@c  IEEE_802_11_WPS_ASSOC                              - WPS association.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    IEEE_802_11_PWR_ON_ASSOC,
    IEEE_802_11_MANUAL_ASSOC,
    IEEE_802_11_SCAN_ASSOC,
    IEEE_802_11_WPS_ASSOC
}   NET_802_11_ASSOC_CASE_T;



/*------------------------------------------------------------------*/
/*! @enum NET_802_11_AUTH_MODE_T
 *  @brief  802.11 auth mode
 *  @code
 *  typedef enum
 *  {
 *      IEEE_802_11_AUTH_MODE_NONE,
 *      IEEE_802_11_AUTH_MODE_OPEN,
 *      IEEE_802_11_AUTH_MODE_SHARED,
 *      IEEE_802_11_AUTH_MODE_WEPAUTO,
 *      IEEE_802_11_AUTH_MODE_WPA,
 *      IEEE_802_11_AUTH_MODE_WPA_PSK,
 *      IEEE_802_11_AUTH_MODE_WPA2,
 *      IEEE_802_11_AUTH_MODE_WPA2_PSK,
 *      IEEE_802_11_AUTH_MODE_WPAPSK_OR_WPA2PSK
 *  }   NET_802_11_AUTH_MODE_T;
 *  @endcode
 *  @li@c  IEEE_802_11_AUTH_MODE_NONE                                - no security.
 *  @li@c  IEEE_802_11_AUTH_MODE_OPEN                                - WEP open system.
 *  @li@c  IEEE_802_11_AUTH_MODE_SHARED                             - WEP shared key.
 *  @li@c  IEEE_802_11_AUTH_MODE_WEPAUTO                          - WEP open/share auto switch.
 *  @li@c  IEEE_802_11_AUTH_MODE_WPA                                 - WPA 802.1X enterprise mdoe.
 *  @li@c  IEEE_802_11_AUTH_MODE_WPA_PSK                           - WPA pre-share key mdoe.
 *  @li@c  IEEE_802_11_AUTH_MODE_WPA2                                - WPA2 802.1X enterprise mdoe.
 *  @li@c  IEEE_802_11_AUTH_MODE_WPA2_PSK                         - WPA2 pre-share key mdoe.
 *  @li@c  IEEE_802_11_AUTH_MODE_WPAPSK_OR_WPA2PSK         - Either WPA-PSK or WPA2-PSK mdoe.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    IEEE_802_11_AUTH_MODE_NONE,
    IEEE_802_11_AUTH_MODE_OPEN,
    IEEE_802_11_AUTH_MODE_SHARED,
    IEEE_802_11_AUTH_MODE_WEPAUTO,
    IEEE_802_11_AUTH_MODE_WPA,
    IEEE_802_11_AUTH_MODE_WPA_PSK,
    IEEE_802_11_AUTH_MODE_WPA_PSK_GTKIP,
    IEEE_802_11_AUTH_MODE_WPA_PSK_AES,
    IEEE_802_11_AUTH_MODE_WPA_PSK_AES_GTKIP,
    IEEE_802_11_AUTH_MODE_WPA_PSK_TKIP,
    IEEE_802_11_AUTH_MODE_WPA2,
    IEEE_802_11_AUTH_MODE_WPA2_PSK,
    IEEE_802_11_AUTH_MODE_WPA2_PSK_GTKIP,
    IEEE_802_11_AUTH_MODE_WPA2_PSK_AES,
    IEEE_802_11_AUTH_MODE_WPA2_PSK_AES_GTKIP,
    IEEE_802_11_AUTH_MODE_WPA2_PSK_TKIP,
    IEEE_802_11_AUTH_MODE_WPAPSK_OR_WPA2PSK,
    IEEE_802_11_AUTH_MODE_WPAPSK_OR_WPA2PSK_GTKIP,
    IEEE_802_11_AUTH_MODE_WPA_PSK_TKIP_GWEP104,
    IEEE_802_11_AUTH_MODE_WPA2_PSK_GWEP104,
    IEEE_802_11_AUTH_MODE_WPA_EAP,   // add for wpa_eap now DTV is not support
    IEEE_802_11_AUTH_MODE_WPA2_EAP,	// add for wpa_eap now DTV is not support
	IEEE_802_11_AUTH_MODE_WPAEAP_OR_WPA2EAP // add for wpa_eap now DTV is not support
}   NET_802_11_AUTH_MODE_T;

#define IEEE_802_11_AUTH_MODE_WEP IEEE_802_11_AUTH_MODE_WEPAUTO    /**< AuthMode       */



/*------------------------------------------------------------------*/
/*! @enum NET_802_11_AUTH_CIPHER_T
 *  @brief CipherMode Defines for cipher modes
 *  @code
 *  typedef enum
 *  {
 *      IEEE_802_11_AUTH_CIPHER_NONE        = (0x01 << 0),
 *      IEEE_802_11_AUTH_CIPHER_WEP40      = (0x01 << 1),
 *      IEEE_802_11_AUTH_CIPHER_WEP104     = (0x01 << 2),
 *      IEEE_802_11_AUTH_CIPHER_TKIP         = (0x01 << 3),
 *      IEEE_802_11_AUTH_CIPHER_AES          = (0x01 << 4),
 *      IEEE_802_11_AUTH_CIPHER_AES_OR_TKIP = (IEEE_802_11_AUTH_CIPHER_AES | IEEE_802_11_AUTH_CIPHER_TKIP)
 *  }   NET_802_11_AUTH_CIPHER_T;
 *  @endcode
 *  @li@c  IEEE_802_11_AUTH_CIPHER_NONE                      - No cipher
 *  @li@c  IEEE_802_11_AUTH_CIPHER_WEP40                    - WEP40 cipher
 *  @li@c  IEEE_802_11_AUTH_CIPHER_WEP104                  - WEP104 cipher
 *  @li@c  IEEE_802_11_AUTH_CIPHER_TKIP                       - YKIP cipher
 *  @li@c  IEEE_802_11_AUTH_CIPHER_AES                        - AES cipher
 *  @li@c  IEEE_802_11_AUTH_CIPHER_AES_OR_TKIP           - TKIP/AES cipher
 */
/*------------------------------------------------------------------*/
typedef enum
{
    IEEE_802_11_AUTH_CIPHER_NONE        = (0x01 << 0),
    IEEE_802_11_AUTH_CIPHER_WEP40       = (0x01 << 1),
    IEEE_802_11_AUTH_CIPHER_WEP104      = (0x01 << 2),
    IEEE_802_11_AUTH_CIPHER_TKIP        = (0x01 << 3),
    IEEE_802_11_AUTH_CIPHER_AES         = (0x01 << 4),
    IEEE_802_11_AUTH_CIPHER_AES_OR_TKIP = (IEEE_802_11_AUTH_CIPHER_AES | IEEE_802_11_AUTH_CIPHER_TKIP)
}   NET_802_11_AUTH_CIPHER_T;



/*------------------------------------------------------------------*/
/*! @enum NET_802_11_WPS_ASSOC_MODE_T
 *  @brief WPSOpMode Defines for WPS operation mode
 *  @code
 *  typedef enum
 *  {
 *      IEEE_802_11_PIN_SETUP,
 *      IEEE_802_11_PBC_SETUP,
 *      IEEE_802_11_NFC_SETUP,
 *      IEEE_802_11_USB_SETUP
 *  }   NET_802_11_WPS_ASSOC_MODE_T;
 *  @endcode
 *  @li@c  IEEE_802_11_PIN_SETUP                             - WPS PIN.
 *  @li@c  IEEE_802_11_PBC_SETUP                             - WPS PBC.
 *  @li@c  IEEE_802_11_NFC_SETUP                             - WPS NFC.
 *  @li@c  IEEE_802_11_USB_SETUP                             - WPS USB.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    IEEE_802_11_PIN_SETUP,
    IEEE_802_11_PBC_SETUP,
    IEEE_802_11_NFC_SETUP,
    IEEE_802_11_USB_SETUP
}   NET_802_11_WPS_ASSOC_MODE_T;


typedef enum
{
    FLAG_NONE               = (0x00),
    FLAG_REPLY_NOT_END      = (0x01 << 0)
}   WPA_FLAG_T;

/*--------------------------------------------------------------*/
/*                                                              */
/* Structure                                                    */
/*                                                              */
/*--------------------------------------------------------------*/




/*------------------------------------------------------------------*/
/*! @struct NET_802_11_KEY_T
 *  @brief Structure of Key
 *  @code
 *  typedef struct
 *  {
 *      BOOL    b_IsAscii;
 *      CHAR    *pui1_PassPhrase;
 *  }   NET_802_11_KEY_T;
 *  @endcode
 *  @li@c  b_IsAscii                                         - TRUE for ASCII passphrase(key).
 *  @li@c  *pui1_PassPhrase                             -Buffer pointer of the key content.
 *
 *                                                            1.)8-63 ASCII or 64 hexadecimal words for valid WPA key
 *
 *                                                            2.)5 ASCII or 10 hexadecimal words for valid 64-bit WEP key
 *
 *                                                            3.)13 ASCII or 26 hexadecimal words for valid 128-bit WEP key
 */
/*------------------------------------------------------------------*/
typedef struct
{
    BOOL    b_IsAscii;
    CHAR    *pui1_PassPhrase;
    CHAR    key_body[WLAN_KEY_MAX_LENGTH + 1];         /* Benny'100521 add */
}   NET_802_11_KEY_T;



/*------------------------------------------------------------------*/
/*! @struct NET_802_11_SSID_T
 *  @brief Structure of SSID
 *  @code
 *  typedef struct
 *  {
 *      UINT32  ui4_SsidLen;
 *      CHAR    ui1_aSsid[NET_802_11_MAX_LEN_SSID];
 *  }   NET_802_11_SSID_T;
 *  @endcode
 *  @li@c  ui4_SsidLen                                                     - SSID length in bytes.
 *  @li@c  ui1_aSsid[NET_802_11_MAX_LEN_SSID]                - SSID array with \ref SSIDLen "maximum length".
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32  ui4_SsidLen;
    CHAR    ui1_aSsid[NET_802_11_MAX_LEN_SSID+1];
}   NET_802_11_SSID_T;





/*------------------------------------------------------------------*/
/*! @struct NET_802_11_SCAN_T
 *  @brief Structure of Scan Mode
 *  @code
 *  typedef struct
 *  {
 *      NET_802_11_SSID_T           t_Ssid;
 *      BOOL                        b_ImplicitScan;
 *  }   NET_802_11_SCAN_T;
 *  @endcode
 *  @li@c  t_Ssid                                               - SSID in null-terminated string form.
 *  @li@c  b_ImplicitScan                                    - TRUE for Implicit scan or FLASE for explicit scan.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    NET_802_11_SSID_T           t_Ssid;
    BOOL                        b_ImplicitScan;
}   NET_802_11_SCAN_T;





/*------------------------------------------------------------------*/
/*! @struct NET_802_11_BSS_INFO_T
 *  @brief Structure of BSS Information
 *  @code
 *  typedef struct
 *  {
 *      NET_802_11_BSSID_T                  t_Bssid;
 *      NET_802_11_SSID_T                    t_Ssid;
 *      NET_802_11_AUTH_MODE_T          e_AuthMode;
 *      NET_802_11_AUTH_CIPHER_T        e_AuthCipher;
 *      INT16                                        i2_Freq;
 *      INT16                                        i2_Channel;
 *      INT16                                        i2_Quality;
 *      INT16                                        i2_Noise;
 *      INT16                                        i2_Level;
 *      INT32                                        i4_MaxRate;
 *      UINT16                                      u2_Caps;
 *      UINT8                                       *ie;
 *      UINT32                                      u4_ieLength;
 *  }   NET_802_11_BSS_INFO_T;
 *  @endcode
 *  @li@c  t_Bssid                                           - BSSID in binary form. If it's unknown, set it as ff:ff:ff:ff:ff:ff
 *  @li@c  t_Ssid                                            - SSID in null-terminated string form.
 *  @li@c  e_AuthMode                                    - Authentication mode.
 *  @li@c  e_AuthCipher                                   - Cipher mode.
 *  @li@c  i2_Freq                                           - Primary radio frequency in unit of MHz
 *  @li@c  i2_Channel                                      - Primary radio channel number
 *  @li@c  i2_Quality                                        - Quality of signal
 *  @li@c  i2_Noise                                          - Noise level
 *  @li@c  i2_Level                                          - Normalized signal strength ranged from 1 to 100.
 *  @li@c  i4_MaxRate                                      - Max. supported radio rate of WiFi driver.
 *  @li@c  u2_Caps                                          - Capabilities included in the 802.11 management frames.
 *  @li@c  *ie                                                 - Buffer pointer of the information elements.
 *  @li@c  u4_ieLength                                     - Buffer length of the information elements.
 *  @li@is_wps_support						0 not support 1-support 2-unknown
 */
/*------------------------------------------------------------------*/
typedef struct
{
    NET_802_11_BSSID_T              t_Bssid;
    NET_802_11_SSID_T               t_Ssid;
    NET_802_11_AUTH_MODE_T          e_AuthMode;
    NET_802_11_AUTH_CIPHER_T        e_AuthCipher;
    NET_802_11_T                   e_802_11_type;
    NET_802_11_BW_T                 e_802_11_bw;
    INT16                           i2_Freq;
    INT16                           i2_Channel;
    INT16                           i2_Quality;
    INT16                           i2_Noise;
    INT16                           i2_Level;
    INT16                           i2_Level_dB;
    INT32                           i4_MaxRate;
    UINT16                          u2_Caps;
	UINT8                           is_wps_support;
    UINT8                           *ie;
    UINT32                          u4_ieLength;
	UINT8 							u8_wpa_status;
}   NET_802_11_BSS_INFO_T;



/*------------------------------------------------------------------*/
/*! @struct NET_802_11_SCAN_RESULT_T
 *  @brief Structure of Scan Result
 *  @code
 *  typedef struct
 *  {
 *      UINT32                                 ui4_NumberOfItems;
 *      NET_802_11_BSS_INFO_T       *p_BssInfo;
 *  }   NET_802_11_SCAN_RESULT_T;
 *  @endcode
 *  @li@c  ui4_NumberOfItems                             - Number of entries in the list.
 *  @li@c  *p_BssInfo                                        - Buffer in which BSS information is stored. The size of this buffer must
 *                                                             be enough to store num x sizeof(NET_802_11_BSS_INFO_T) bytes.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32                      ui4_NumberOfItems;
    NET_802_11_BSS_INFO_T       *p_BssInfo;
}   NET_802_11_SCAN_RESULT_T;



/*------------------------------------------------------------------*/
/*! @struct NET_802_11_ESS_INFO_T
 *  @brief Structure of ESS Information
 *  @code
 *  typedef struct
 *  {
 *      NET_802_11_BSSID_T               t_Bssid;
 *      NET_802_11_SSID_T                t_Ssid;
 *      NET_802_11_AUTH_MODE_T      e_AuthMode;
 *      NET_802_11_AUTH_CIPHER_T    e_AuthCipher;
 *      INT16                                    i2_Level;
 *      INT32                                    i4_isConnected;
 *  }   NET_802_11_ESS_INFO_T;
 *  @endcode
 *  @li@c  t_Bssid                                           - BSSID in binary form.
 *  @li@c  t_Ssid                                            - SSID in null-terminated string form.
 *  @li@c  e_AuthMode                                    - Authentication mode.
 *  @li@c  e_AuthCipher                                   - Cipher mode.
 *  @li@c  i2_Level                                          - Normalized signal strength ranged from 1 to 100.
 *  @li@c  i4_isConnected                                 - Already connect with it
 */
/*------------------------------------------------------------------*/
typedef struct
{
    NET_802_11_BSSID_T          t_Bssid;
    NET_802_11_SSID_T           t_Ssid;
    NET_802_11_AUTH_MODE_T      e_AuthMode;
    NET_802_11_AUTH_CIPHER_T    e_AuthCipher;
    INT16                       i2_Level;
    INT32                       i4_isConnected;
	UINT8                       is_wps_support; //
}   NET_802_11_ESS_INFO_T;



/*------------------------------------------------------------------*/
/*! @struct NET_802_11_ESS_LIST_T
 *  @brief Structure of ESS List
 *  @code
 *  typedef struct
 *  {
 *      UINT32                                 ui4_NumberOfItems;
 *      NET_802_11_ESS_INFO_T       *p_EssInfo;
 *  }   NET_802_11_ESS_LIST_T;
 *  @endcode
 *  @li@c  ui4_NumberOfItems                             - Number of entries in the list.
 *  @li@c  *p_EssInfo                                        -Buffer in which ESS information is stored. The size of this buffer must
 *                                                            be enough to store num x sizeof(NET_802_11_ESS_INFO_T) bytes.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32                      ui4_NumberOfItems;
    NET_802_11_ESS_INFO_T       *p_EssInfo;

}   NET_802_11_ESS_LIST_T;



/*------------------------------------------------------------------*/
/*! @struct NET_802_11_ASSOCIATE_T
 *  @brief Structure of Association
 *  @code
 *  typedef struct
 *  {
 *      NET_802_11_BSSID_T               t_Bssid;
 *      NET_802_11_SSID_T                t_Ssid;
 *      UINT8                                    ui1_Priority;
 *      NET_802_11_ASSOC_CASE_T     e_AssocCase;
 *      NET_802_11_AUTH_MODE_T      e_AuthMode;
 *      NET_802_11_AUTH_CIPHER_T    e_AuthCipher;
 *      NET_802_11_KEY_T        	        t_Key;
 *  }   NET_802_11_ASSOCIATE_T;
 *  @endcode
 *  @li@c  t_Bssid                                           - BSSID in binary form.
 *  @li@c  t_Ssid                                            - SSID in null-terminated string form.
 *  @li@c  ui1_Priority                                      - Priority of the selected SSID.
 *  @li@c  e_AssocCase                                   - Association condition.
 *  @li@c  e_AuthMode                                    - Authentication mode.
 *  @li@c  e_AuthCipher                                   - Cipher mode.
 *  @li@c  t_Key                                             - Key information.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    NET_802_11_BSSID_T          t_Bssid;
    NET_802_11_SSID_T           t_Ssid;
    UINT8                       ui1_Priority;
    NET_802_11_ASSOC_CASE_T     e_AssocCase;
    NET_802_11_AUTH_MODE_T      e_AuthMode;
    NET_802_11_AUTH_CIPHER_T    e_AuthCipher;
    NET_802_11_KEY_T        	t_Key;
}   NET_802_11_ASSOCIATE_T;

typedef struct
{
    NET_802_11_ASSOCIATE_T      t_Assocaite;
    BOOL                        fgWepShared;
    BOOL                        fgWepAutoMode;
}   NET_802_11_ASSOCIATE_WEP_T;


/*------------------------------------------------------------------*/
/*! @struct NET_802_11_EEPORM_T
 *  @brief Structure of EEPORM Data
 *  @code
 *  typedef struct
 *  {
 *      UINT32  u4Addr;
 *      UINT8   *pData;
 *      UINT32  u4Len;
 *  }   NET_802_11_EEPORM_T;
 *  @endcode
 *  @li@c  u4Addr                                            - EEPORM address.
 *  @li@c  *pData                                           - Pointer to the data.
 *  @li@c  u4Len                                             - Size in bytes.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32  u4Addr;
    UINT8   *pData;
    UINT32  u4Len;
}   NET_802_11_EEPORM_T;

/*------------------------------------------------------------------*/
/*! @struct NET_802_11_RSSI_T
 *  @brief Structure of EEPORM Data
 *  @code
 *  typedef struct
 *  {
 *      UINT32  u4Rssi_a;
 *      UINT32  u4Rssi_b;
 *      UINT32  u4Rssi_c;
 *  }   NET_802_11_RSSI_T;;
 *  @endcode
 *  @li@c  u4Rssi_a                                           - Antenna 1.
 *  @li@c  u4Rssi_b                                           - Antenna 2.
 *  @li@c  u4Rssi_b                                           - Antenna 3.
 */
/*------------------------------------------------------------------*/

typedef struct
{
    INT32  i4Rssi_a;
    INT32  i4Rssi_b;
    INT32  i4Rssi_c;
}   NET_802_11_WIFI_RSSI_T;





/*------------------------------------------------------------------*/
/*! @struct NET_802_11_WPA_T
 * @brief Structure of WPA Data
 *  @code
 *  typedef struct
 *  {
 *      CHAR     ifname[8];
 *      UINT32   ui4_type;
 *      UINT8    pData[256];
 *  }   NET_802_11_WPA_T;
 *  @endcode
 *  @li@c  ifname[8]                                       - Ctrl interface name
 *  @li@c  ui4_type                                         - WLAN_OID_T
 *  @li@c  pData[256]                                     - Data area.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    CHAR        ifname[8];
    UINT32      u4type;
    INT32       i4Ret;
    WPA_FLAG_T  eFlag;
    UINT8       pData[NET_WPA_DATA_LENGTH];
}   NET_802_11_WPA_T;


/*------------------------------------------------------------------*/
/*! @struct NET_802_11_NFY_T
 * @brief Structure of WPA Data
 *  @code
 *  typedef struct
 *  {
 *      INT32     i4NotifykId;
 *      INT32     pParam[256];
 *  }   NET_802_11_NFY_T;
 *  @endcode
 *  @li@c  i4NotifykId                                        - WLAN_NOTIFY_ID_T
 *  @li@c  pParam[256]                                     - Data area.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    INT32   i4NotifykId;
    INT32   i4Ret;
    INT32   pParam[NET_NFY_DATA_LENGTH];
    char    pDriverVer[DRIVER_VERSION_LENGTH];
}   NET_802_11_NFY_T;


/*----------------------------------------------------------------------------*/
/*! @} */                                           /* end of groupMW_INET_WIFI*/
/*----------------------------------------------------------------------------*/
/**
 * @brief Generic RSSI Types
 */
typedef struct{
    UINT8      bc_avg_rssi;     /* average rssi */
    UINT8      bc_valid_mask;   /* bitmap of valid elements in rssi_ctrl/ext array */
    UINT8      bc_rssi_ctrl[ACFG_MAX_ANTENNA];
    UINT8      bc_rssi_ext[ACFG_MAX_ANTENNA];
    UINT8      data_avg_rssi;     /* average rssi */
    UINT8      data_valid_mask;   /* bitmap of valid elements in rssi_ctrl/ext array */
    UINT8      data_rssi_ctrl[ACFG_MAX_ANTENNA];
    UINT8      data_rssi_ext[ACFG_MAX_ANTENNA];
} NET_802_11_CHAIN_RSSI_T;


/*------------------------------------------------------------------*/
/*! @struct NET_802_11_KEY_T
 * @brief Structure of ATE parameters
 *  @code
 * typedef struct
 * {
 *    UINT8   antNum;
 *    UINT8   80211Standard;
 *    UINT8   channelNum;
 *    UINT8   PHYRate;
 *    UINT8   ModulationFlag;
 * }   NET_802_11_ATE_PARAMETER_T;
 *  @endcode
 *  @li@c  antNum  - the index of antenna.
 *  @li@c  80211Standard -the 802.11 standard.
                            0: CCK 802.11b, 1: OFDM 802.11g, 2: HT_MIX 802.11b/g/n, 3: Green Field 802.11n
 *  @li@c  channelNum -the channel number.
 *  @li@c  PHYRate -the PHY rate.
 *               1) 802.11b
 *                      0: 1Mbps, 1: 2Mbps, 2: 5.5Mbps, 3: 11Mbps, 8: 1Mbps, 9: 2Mbps, 10: 5.5Mbps, 11: 11Mbps
 *               2) 802.11g
 *                      0: 6Mbps, 1: 9Mbps, 2: 12Mbps, 3: 18Mbps, 4: 24Mbps, 5: 36Mbps, 6: 48Mbps, 7: 54Mbps
 *               3) 802.11b/g/n
 *                      0: 6.5Mbps, 1:13Mbps, 2:19.5Mbps, 3:26Mbps, 4:39Mbps, 5:52Mbps, 6:58.5Mbps, 7:65Mbps
 *                      8: 13Mbps, 9: 26Mbps, 10:39Mbps, 11:52Mbps, 12:78Mbps, 13:104Mbps, 14:117Mbps, 15:130Mbps, 32:6Mbps 
 *  @li@c  ModulationFlag -the flag of Modulation ON or OFF, 1: ON, 0: OFF.
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT8   antNum;
    UINT8   WiFiStandard;
    UINT8   channelNum;
    UINT8   PHYRate;
    UINT8   ModulationFlag;
}   NET_802_11_ATE_PARAMETER_T;


#define ACFG_CUSTDATA_LENGTH       20
/**
 * @brief get custdata
 */
typedef struct {
    UINT8      custdata[ACFG_CUSTDATA_LENGTH];
}NET_802_11_ACFG_CUSTDAT_T;

/**
 * @brief get p2p find device data ;
 *  P2P_CONNECT_MODE_PBC : p2p connect with pbc .
 *  P2P_CONNECT_MODE_PIN  : p2p connect with pin.
 */

/**
 * @brief This structure stores the network IP base info.
 */

typedef struct _NW_IP_INFO_T
{
	UINT32 ui4_address; 	/**< IP address */
	UINT32 ui4_netmask; 	/**< Subnet mask */
	UINT32 ui4_gw;		   /**< Default gateway */
	UINT32 ui4_1st_dns; 	/**< First DNS */
	UINT32 ui4_2nd_dns; 	/**< Second DNS */
} NW_IP_INFO_T;


typedef struct
{
    UINT8    ret_value;
    CHAR    _mac[18];
    CHAR    _addr[18];
    CHAR    _peer[18];
    CHAR    _name[33];
    UINT8    _length;
    CHAR    _pri_dev_type[13];
    BOOL    b_Is_GO;
    BOOL    b_Is_ForceGO;
    BOOL    b_Is_WFD;
    BOOL    b_Is_REJECT;
    UINT32  config_methods ;
    UINT32  dev_capab;
    UINT32  group_capab;
    UINT32  wfd_dev_info;
    UINT32  rtsp_port;
    UINT32  max_throughput;
    INT32   i4rssi;
    UINT32    devType;
    INT32   opchannel;
    CHAR	go_ssid[33];
    CHAR        primaryDevType[40];
    CHAR	go_passphrase[66];
    UINT8 devpasswdid;
    CHAR    pincode[9];
	BOOL b_update_ptable;
    BOOL b_is_peer_5G;
    BOOL b_is_SCCChannel;
    INT32   status_code;
    BOOL   b_Is_legacy_client;
	CHAR   _p2p_go_name[5] ;
}   NET_802_11_P2P_DATA;

typedef struct
{
    CHAR _sa[18];
    CHAR _addr[18];
    CHAR _bssid[18];
    CHAR _network_name[65];
    UINT32 _status;
}NET_802_11_P2P_INVITATION_DATA;

/**
 * @brief wifi display data ;
 *  _port :port number that wifi display need .
 * _ip_addr : the ip address that wifi display need .
 */
typedef struct
{
    UINT32    _port;
    CHAR    _ip_addr[20];
}NET_802_11_WFD_DATA;

/**
 * @brief wifi display data ;
 *  _port :port number that wifi display need .
 * _ip_addr : the ip address that wifi display need .
 */

typedef struct
{
    UINT32    _port;
    CHAR    _ip_addr[20];
    CHAR    _mac[18];
}NET_802_11_IP_DATA;



/**
 * @brief wifi display pin data ; it is be used when wfd connect with pin (keypad or display mode )
 *  _length :length of pin code  number that wifi display need .
 * _pin : pin code that up layer needed to show.
 */

typedef struct
{
    UINT8    _length;
    CHAR    _pin[10];
    CHAR    _mac[20];
}NET_802_11_WFD_PIN_DATA;


/**
 * @brief get p2p find device data ;
 *  P2P_CONNECT_MODE_PBC : p2p connect with pbc .
 *  P2P_CONNECT_MODE_PIN  : p2p connect with pin.
 */

typedef enum
{
    P2P_CONNECT_MODE_PBC,
    P2P_CONNECT_MODE_PIN_KEYPAD,
    P2P_CONNECT_MODE_PIN_DISPLAY,
    P2P_CONNECT_MODE_PIN,
	P2P_CONNECT_MODE_PBC_DIS
} P2P_CONNECT_MODE_T;

/*add for p2p persistent*/
typedef struct
{
    CHAR    subnet[20];
    CHAR    netmask[20];
    CHAR    range_start[20];
    CHAR    range_end[20];
    CHAR    routers[20];
    UINT32  default_lease_time;
    UINT32  max_lease_time;

}   NET_DHCP_CONFIG;

typedef struct
{
	UINT8    is_valid;		
	UINT8    my_p2p_rule;
	UINT8 peer_mac[6];
	UINT8 ap_mac[6];
    UINT8 DeviceName[33];
	UINT8 key_index;
	UINT16 auth_type;
	UINT16 encr_type;
	CHAR ssid[32];
	UINT16 ssid_len;
	CHAR key[64];
	UINT16 key_len;
}EEPROM_PER_ENTRY_T;

typedef struct
{ 
	int NumOfEntry;
	EEPROM_PER_ENTRY_T* eep_per_entry;
}PERSISTENT_ENTRY_T;

typedef struct
{
	UINT8    is_p2p;
	UINT8    is_wfd;
	UINT8 peer_mac[6];
	UINT8 dev_type[8];
	CHAR dev_name[32+1];
    INT32   i4rssi;
    UINT32  rtsp_port;
}P2P_ASSOC_PER_ENTRY_T;
typedef struct
{ 
	int NumOfEntry;
	P2P_ASSOC_PER_ENTRY_T* p2p_assoc_per_entry;
}P2P_ASSOC_ENTRY_T;

typedef enum
{
	IWPRIV_TX_PACKETS 		= (0x00000001 << 0),
	IWPRIV_RSSI 			= (0x00000001 << 1),
	IWPRIV_P2P_GO_RSSI 		= (0x00000001 << 2),
	IWPRIV_RXLEV 			= (0x00000001 << 3),
	IWPRIV_TXRXRATE 		= (0x00000001 << 4),
	IWPRIV_P2P_GO_TXRXRATE 	= (0x00000001 << 5),
	IWPRIV_P2P_GC_TXRXRATE 	= (0x00000001 << 6),
	IWPRIV_NOISE 			= (0x00000001 << 7),
	IWPRIV_P2P_NOISE 		= (0x00000001 << 8),
	IWPRIV_GI 				= (0x00000001 << 9),
	IWPRIV_P2P_GC_GI 		= (0x00000001 << 10),
	IWPRIV_P2P_GO_GI 		= (0x00000001 << 11),
	IWPRIV_PHYRATE 			= (0x00000001 << 12),
	IWPRIV_P2P_GC_PHYRATE 	= (0x00000001 << 13),
	IWPRIV_P2P_GO_PHYRATE 	= (0x00000001 << 14),
	IWPRIV_PHYMODE			= (0x00000001 << 15),
	IWPRIV_P2P_GC_PHYMODE	= (0x00000001 << 16),
	IWPRIV_P2P_GO_PHYMODE	= (0x00000001 << 17),
	IWPRIV_MAC 				= (0x00000001 << 18),
	IWPRIV_P2P_GC_MAC 		= (0x00000001 << 19),
	IWPRIV_P2P_GO_MAC 		= (0x00000001 << 20),
	IWPRIV_LOCAL_MAC		= (0x00000001 << 21),
	IWPRIV_TYPE				= (0x00000001 << 22),
	IWPRIV_P2P_GC_RSSI 		= (0x00000001 << 23),
	IWPRIV_MAX 				= (0x00000001 << 31)
}IWPRIV_ITEM;

typedef enum
{
	IWPRIV_NOT_CONNECTED	= (0x00000001 << 0),
	IWPRIV_STA_MODE			= (0x00000001 << 1),
	IWPRIV_P2P_GO_MODE		= (0x00000001 << 2),
	IWPRIV_P2P_GC_MODE		= (0x00000001 << 3),
	IWPRIV_MODE_MAX			= (0x00000001 << 31)
}IWPRIV_MODE_ITEM;

typedef enum
{
   NET_802_11NA,
   NET_802_11NG,
   NET_802_11A,
   NET_802_11G,
   NET_802_11B,
   NET_802_11N,
   NET_802_11AC,
   NET_802_11_MAX
}PHY_MODE;

typedef struct
{
   PHY_MODE t_phymode;
   INT16 bandwidth;
} NET_DRIVER_STA_INFO;

typedef struct
{
 
    UINT8                           num;
    CHAR                  mac_add[8][20];
}   CLIENT_MAC_ADD;

typedef enum
{
	IWPRIV_GO_MAC0,
	IWPRIV_GO_MAC1,
	IWPRIV_GO_MAC2,
	IWPRIV_GO_MAC3,
	IWPRIV_GO_MAC4,
	IWPRIV_GO_MAC5,
	IWPRIV_GO_MAC6,
	IWPRIV_GO_MAC7,
	IWPRIV_GO_MAC8,
	IWPRIV_GO_MAC9,
	IWPRIV_GO_MAC_MAX
}IWPRIV_GO_MAC_ITEM;

typedef struct
{
 
    IWPRIV_GO_MAC_ITEM			num;
    CHAR                  		mac_add[10][20];
}   P2P_GO_MAC_ADD;

typedef struct
{
	UINT16	tx_packets;
	UINT16	rx_packets;
	INT16	rssi[2];
	INT16	go_rssi[2];
	INT16	gc_rssi[2];
	CHAR	tx_rate[16];
	CHAR	rx_rate[16];
	CHAR	tx_gc_rate[16];
	CHAR	rx_gc_rate[16];
	CHAR	tx_go_rate[10][16];
	CHAR	rx_go_rate[10][16];
	INT16	i2_rssi_lev;
	INT16	i2_noise[2];
	INT16	i2_p2p_noise[2];
	CHAR	gi[5];
	CHAR	gc_gi[5];
	CHAR	go_gi[10][5];
	NET_DRIVER_STA_INFO	phymode;
	NET_DRIVER_STA_INFO	gc_phymode;
	NET_DRIVER_STA_INFO	go_phymode[10];
	UINT32	ui4_phyrate;
	UINT32	ui4_gc_phyrate;
	UINT32	ui4_go_phyrate[10];
	CHAR	mac_add[20];
	CHAR	gc_mac_add[20];	
	P2P_GO_MAC_ADD p2p_go_client_table;
	CHAR	local_mac_add[20];
	IWPRIV_MODE_ITEM	tpye;
	
	INT16	i2_tx_last_bandwidth;
	INT16	i2_rx_last_bandwidth;
	INT16	i2_tx_gc_last_bandwidth;
	INT16	i2_rx_gc_last_bandwidth;
	INT16	i2_tx_go_last_bandwidth[10];
	INT16	i2_rx_go_last_bandwidth[10];

	CHAR	tx_last_mcs[16];
	CHAR	rx_last_mcs[16];
	CHAR	tx_gc_last_mcs[16];
	CHAR	rx_gc_last_mcs[16];
	CHAR	tx_go_last_mcs[10][16];
	CHAR	rx_go_last_mcs[10][16];

	CHAR	tx_last_nss[16];
	CHAR	rx_last_nss[16];
	CHAR	tx_gc_last_nss[16];
	CHAR	rx_gc_last_nss[16];
	CHAR	tx_go_last_nss[10][16];
	CHAR	rx_go_last_nss[10][16];

	CHAR	tx_last_phymode[16];
	CHAR	rx_last_phymode[16];
	CHAR	tx_gc_last_phymode[16];
	CHAR	rx_gc_last_phymode[16];
	CHAR	tx_go_last_phymode[10][16];
	CHAR	rx_go_last_phymode[10][16];

	CHAR	tx_last_gi[5];
	CHAR	rx_last_gi[5];
	CHAR	tx_gc_last_gi[5];
	CHAR	rx_gc_last_gi[5];
	CHAR	tx_go_last_gi[10][5];
	CHAR	rx_go_last_gi[10][5];

	
}NET_IWPRIV_STAT_INFO;


#endif /* end of _U_NET_WLAN_H */



