blob: 3af193543cdbae0f1775a867c0eddbfda71ca7bd [file] [log] [blame]
Johnny Kimc5c77ba2015-05-11 14:30:56 +09001
2/*!
3 * @file coreconfigurator.h
4 * @brief
5 * @author
6 * @sa coreconfigurator.c
7 * @date 1 Mar 2012
8 * @version 1.0
9 */
10
Johnny Kimc5c77ba2015-05-11 14:30:56 +090011#ifndef CORECONFIGURATOR_H
12#define CORECONFIGURATOR_H
13
Johnny Kimc5c77ba2015-05-11 14:30:56 +090014#include "wilc_wlan_if.h"
15/*****************************************************************************/
16/* Constants */
17/*****************************************************************************/
18/* Number of WID Options Supported */
19#define NUM_BASIC_SWITCHES 45
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030020#define NUM_FHSS_SWITCHES 0
Johnny Kimc5c77ba2015-05-11 14:30:56 +090021
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030022#define NUM_RSSI 5
Johnny Kimc5c77ba2015-05-11 14:30:56 +090023
24#ifdef MAC_802_11N
25#define NUM_11N_BASIC_SWITCHES 25
26#define NUM_11N_HUT_SWITCHES 47
27#else /* MAC_802_11N */
28#define NUM_11N_BASIC_SWITCHES 0
29#define NUM_11N_HUT_SWITCHES 0
30#endif /* MAC_802_11N */
31
Chaehyun Limd85f5322015-06-11 14:35:54 +090032extern u16 g_num_total_switches;
Johnny Kimc5c77ba2015-05-11 14:30:56 +090033
34#define MAC_HDR_LEN 24 /* No Address4 - non-ESS */
35#define MAX_SSID_LEN 33
36#define FCS_LEN 4
37#define TIME_STAMP_LEN 8
38#define BEACON_INTERVAL_LEN 2
39#define CAP_INFO_LEN 2
40#define STATUS_CODE_LEN 2
41#define AID_LEN 2
42#define IE_HDR_LEN 2
43
Johnny Kimc5c77ba2015-05-11 14:30:56 +090044/* Operating Mode: SET */
45#define SET_CFG 0
46/* Operating Mode: GET */
47#define GET_CFG 1
48
49#define MAX_PACKET_BUFF_SIZE 1596
50
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030051#define MAX_STRING_LEN 256
52#define MAX_SURVEY_RESULT_FRAG_SIZE MAX_STRING_LEN
53#define SURVEY_RESULT_LENGTH 44
54#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN
Johnny Kimc5c77ba2015-05-11 14:30:56 +090055
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030056#define STATUS_MSG_LEN 12
57#define MAC_CONNECTED 1
58#define MAC_DISCONNECTED 0
Johnny Kimc5c77ba2015-05-11 14:30:56 +090059
Johnny Kimc5c77ba2015-05-11 14:30:56 +090060/*****************************************************************************/
61/* Function Macros */
62/*****************************************************************************/
Chaehyun Limd85f5322015-06-11 14:35:54 +090063#define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
Chaehyun Lim4e4467f2015-06-11 14:35:55 +090064#define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
Johnny Kimc5c77ba2015-05-11 14:30:56 +090065
Johnny Kimc5c77ba2015-05-11 14:30:56 +090066/*****************************************************************************/
67/* Type Definitions */
68/*****************************************************************************/
Johnny Kimc5c77ba2015-05-11 14:30:56 +090069/* Status Codes for Authentication and Association Frames */
70typedef enum {
Stanislav Kholmanskikh13994d12015-06-10 21:57:26 +030071 SUCCESSFUL_STATUSCODE = 0,
72 UNSPEC_FAIL = 1,
73 UNSUP_CAP = 10,
74 REASOC_NO_ASOC = 11,
75 FAIL_OTHER = 12,
76 UNSUPT_ALG = 13,
77 AUTH_SEQ_FAIL = 14,
78 CHLNG_FAIL = 15,
79 AUTH_TIMEOUT = 16,
80 AP_FULL = 17,
81 UNSUP_RATE = 18,
82 SHORT_PREAMBLE_UNSUP = 19,
83 PBCC_UNSUP = 20,
84 CHANNEL_AGIL_UNSUP = 21,
85 SHORT_SLOT_UNSUP = 25,
86 OFDM_DSSS_UNSUP = 26,
Johnny Kimc5c77ba2015-05-11 14:30:56 +090087 CONNECT_STS_FORCE_16_BIT = 0xFFFF
88} tenuConnectSts;
89
90typedef struct {
Chaehyun Limd85f5322015-06-11 14:35:54 +090091 u16 u16WIDid;
Johnny Kimc5c77ba2015-05-11 14:30:56 +090092 tenuWIDtype enuWIDtype;
Chaehyun Limfb4ec9c2015-06-11 14:35:59 +090093 s32 s32ValueSize;
Chaehyun Limca356ad2015-06-11 14:35:57 +090094 s8 *ps8WidVal;
Johnny Kimc5c77ba2015-05-11 14:30:56 +090095
96} tstrWID;
97
98typedef struct {
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +090099 u8 u8Full;
100 u8 u8Index;
Chaehyun Limca356ad2015-06-11 14:35:57 +0900101 s8 as8RSSI[NUM_RSSI];
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900102} tstrRSSI;
103/* This structure is used to support parsing of the received 'N' message */
104typedef struct {
Chaehyun Limca356ad2015-06-11 14:35:57 +0900105 s8 s8rssi;
Chaehyun Limd85f5322015-06-11 14:35:54 +0900106 u16 u16CapInfo;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900107 u8 au8ssid[MAX_SSID_LEN];
108 u8 u8SsidLen;
109 u8 au8bssid[6];
Chaehyun Limd85f5322015-06-11 14:35:54 +0900110 u16 u16BeaconPeriod;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900111 u8 u8DtimPeriod;
112 u8 u8channel;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900113 unsigned long u32TimeRcvdInScanCached; /* of type unsigned long to be accepted by the linux kernel macro time_after() */
114 unsigned long u32TimeRcvdInScan;
Dean Lee72ed4dc2015-06-12 14:11:44 +0900115 bool bNewNetwork;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900116#ifdef AGING_ALG
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900117 u8 u8Found;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900118#endif
119#ifdef WILC_P2P
Chaehyun Lim4e4467f2015-06-11 14:35:55 +0900120 u32 u32Tsf; /* time-stamp [Low only 32 bit] */
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900121#endif
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900122 u8 *pu8IEs;
Chaehyun Limd85f5322015-06-11 14:35:54 +0900123 u16 u16IEsLen;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900124 void *pJoinParams;
125 tstrRSSI strRssi;
Chaehyun Lim57b298f2015-06-11 14:35:56 +0900126 u64 u64Tsf; /* time-stamp [Low and High 64 bit] */
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900127} tstrNetworkInfo;
128
129/* This structure is used to support parsing of the received Association Response frame */
130typedef struct {
Chaehyun Limd85f5322015-06-11 14:35:54 +0900131 u16 u16capability;
132 u16 u16ConnectStatus;
133 u16 u16AssocID;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900134 u8 *pu8RespIEs;
Chaehyun Limd85f5322015-06-11 14:35:54 +0900135 u16 u16RespIEsLen;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900136} tstrConnectRespInfo;
137
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900138typedef struct {
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900139 u8 au8bssid[6];
140 u8 *pu8ReqIEs;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900141 size_t ReqIEsLen;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900142 u8 *pu8RespIEs;
Chaehyun Limd85f5322015-06-11 14:35:54 +0900143 u16 u16RespIEsLen;
144 u16 u16ConnectStatus;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900145} tstrConnectInfo;
146
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900147typedef struct {
Chaehyun Limd85f5322015-06-11 14:35:54 +0900148 u16 u16reason;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900149 u8 *ie;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900150 size_t ie_len;
151} tstrDisconnectNotifInfo;
152
153#ifndef CONNECT_DIRECT
154typedef struct wid_site_survey_reslts {
Dean Lee576917a2015-06-15 11:58:57 +0900155 char SSID[MAX_SSID_LEN];
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900156 u8 BssType;
157 u8 Channel;
158 u8 SecurityStatus;
159 u8 BSSID[6];
Dean Lee576917a2015-06-15 11:58:57 +0900160 char RxPower;
Greg Kroah-Hartman63d03e42015-06-02 14:16:04 +0900161 u8 Reserved;
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900162
163} wid_site_survey_reslts_s;
164#endif
165
Joe Perchesb3ff2912015-08-10 14:51:33 -0700166s32 CoreConfiguratorInit(void);
167s32 CoreConfiguratorDeInit(void);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900168
Joe Perchesb3ff2912015-08-10 14:51:33 -0700169s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
170 u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
171s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
172s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900173
Joe Perchesb3ff2912015-08-10 14:51:33 -0700174s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
175 tstrConnectRespInfo **ppstrConnectRespInfo);
176s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900177
178#ifndef CONNECT_DIRECT
Joe Perchesb3ff2912015-08-10 14:51:33 -0700179s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE],
180 wid_site_survey_reslts_s **ppstrSurveyResults,
181 u32 *pu32SurveyResultsCount);
182s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900183#endif
184
Joe Perchesb3ff2912015-08-10 14:51:33 -0700185s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen);
186void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
Chaehyun Lim4e4467f2015-06-11 14:35:55 +0900187void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
188void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
Johnny Kimc5c77ba2015-05-11 14:30:56 +0900189
190#endif