• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_WIFI_NATIVE_STRUCT_H
17 #define OHOS_WIFI_NATIVE_STRUCT_H
18 
19 #include <string>
20 #include <vector>
21 #include "wifi_native_define.h"
22 
23 namespace OHOS {
24 namespace Wifi {
25 struct WifiHalEapConfig {
26     std::string eap;                        /* EAP authentication mode:PEAP/TLS/TTLS/PWD/SIM/AKA/AKA' */
27     int phase2Method;                       /* Second stage authentication method */
28     std::string identity;                   /* Identity information */
29     std::string anonymousIdentity;          /* Anonymous identity information */
30     char password[HAL_PASSWORD_LEN];       /* EAP mode password */
31 
32     std::string caCertPath;                 /* CA certificate path */
33     std::string caCertAlias;                /* CA certificate alias */
34     std::vector<uint8_t> certEntry;       /* CA certificate entry */
35 
36     std::string clientCert;                 /* Client certificate */
37     char certPassword[HAL_PASSWORD_LEN];   /* Certificate password */
38     std::string privateKey;                 /* Client certificate private key */
39 
40     std::string altSubjectMatch;            /* Alternative topic matching */
41     std::string domainSuffixMatch;          /* Domain suffix matching */
42     std::string realm;                      /* The field of passport credentials */
43     std::string plmn;                       /* PLMN */
44     int eapSubId;                           /* Sub ID of SIM card */
WifiHalEapConfigWifiHalEapConfig45     WifiHalEapConfig() : phase2Method(0), password{0}, certPassword{0}, eapSubId(-1)
46     {}
47 
~WifiHalEapConfigWifiHalEapConfig48     ~WifiHalEapConfig()
49     {}
50 };
51 
52 struct WifiHalDeviceConfig {
53     int networkId;
54     int priority;
55     int scanSsid;
56     int authAlgorithms; /* WifiDeviceConfig.allowedAuthAlgorithms */
57     int wepKeyIdx;
58     std::string wepKeys[HAL_MAX_WEPKEYS_SIZE]; /* max set 4 wepkeys */
59     std::string ssid;
60     std::string psk;
61     std::string keyMgmt;
62     WifiHalEapConfig eapConfig;
63     std::string bssid;
64     bool isRequirePmf;
65     int allowedProtocols;
66     int allowedPairwiseCiphers;
67     int allowedGroupCiphers;
68     int allowedGroupMgmtCiphers;
69     int wapiPskType;
70     std::string wapiAsCertData;
71     std::string wapiUserCertData;
WifiHalDeviceConfigWifiHalDeviceConfig72     WifiHalDeviceConfig() : networkId(-1), priority(-1), scanSsid(-1), authAlgorithms(-1), wepKeyIdx(-1),
73                             isRequirePmf(false), allowedProtocols(-1), allowedPairwiseCiphers(-1),
74                             allowedGroupCiphers(-1), allowedGroupMgmtCiphers(-1), wapiPskType(-1)
75     {}
76 
~WifiHalDeviceConfigWifiHalDeviceConfig77     ~WifiHalDeviceConfig()
78     {}
79 };
80 
81 struct WifiHalGetDeviceConfig {
82     int networkId;
83     std::string param;
84     std::string value;
85 
WifiHalGetDeviceConfigWifiHalGetDeviceConfig86     WifiHalGetDeviceConfig() : networkId(-1)
87     {}
88 
~WifiHalGetDeviceConfigWifiHalGetDeviceConfig89     ~WifiHalGetDeviceConfig()
90     {}
91 };
92 
93 struct WifiHalWpsConfig {
94     int anyFlag;
95     int multiAp;
96     std::string bssid;
97     std::string pinCode;
98 
WifiHalWpsConfigWifiHalWpsConfig99     WifiHalWpsConfig() : anyFlag(-1), multiAp(-1)
100     {}
101 
~WifiHalWpsConfigWifiHalWpsConfig102     ~WifiHalWpsConfig()
103     {}
104 };
105 
106 struct WifiHalRoamCapability {
107     int maxBlocklistSize;
108     int maxTrustlistSize;
109 
WifiHalRoamCapabilityWifiHalRoamCapability110     WifiHalRoamCapability() : maxBlocklistSize(0), maxTrustlistSize(0)
111     {}
112 
~WifiHalRoamCapabilityWifiHalRoamCapability113     ~WifiHalRoamCapability()
114     {}
115 };
116 
117 struct WifiHalRoamConfig {
118     std::vector<std::string> blocklistBssids;
119     std::vector<std::string> trustlistBssids;
120 };
121 
122 struct WifiHalWpaNetworkInfo {
123     int id;
124     std::string ssid;
125     std::string bssid;
126     std::string flag;
127 
WifiHalWpaNetworkInfoWifiHalWpaNetworkInfo128     WifiHalWpaNetworkInfo() : id(0)
129     {}
130 
~WifiHalWpaNetworkInfoWifiHalWpaNetworkInfo131     ~WifiHalWpaNetworkInfo()
132     {}
133 };
134 
135 struct HalP2pDeviceFound {
136     std::string srcAddress;
137     std::string p2pDeviceAddress;
138     std::string primaryDeviceType;
139     std::string deviceName;
140     int configMethods;
141     int deviceCapabilities;
142     int groupCapabilities;
143     std::vector<char> wfdDeviceInfo;
144 
HalP2pDeviceFoundHalP2pDeviceFound145     HalP2pDeviceFound() : configMethods(0), deviceCapabilities(0), groupCapabilities(0)
146     {}
147 
~HalP2pDeviceFoundHalP2pDeviceFound148     ~HalP2pDeviceFound()
149     {}
150 };
151 
152 struct HalP2pInvitationInfo {
153     int type; /* 0:Received, 1:Accepted */
154     int persistentNetworkId;
155     int operatingFrequency;
156     std::string srcAddress;
157     std::string goDeviceAddress;
158     std::string bssid;
159 
HalP2pInvitationInfoHalP2pInvitationInfo160     HalP2pInvitationInfo() : type(0), persistentNetworkId(0), operatingFrequency(0)
161     {}
162 
~HalP2pInvitationInfoHalP2pInvitationInfo163     ~HalP2pInvitationInfo()
164     {}
165 };
166 
167 struct HalP2pGroupInfo {
168     int isGo;
169     int isPersistent;
170     int frequency;
171     std::string groupName;
172     std::string ssid;
173     std::string psk;
174     std::string passphrase;
175     std::string goDeviceAddress;
176     std::string goRandomAddress;
177 
HalP2pGroupInfoHalP2pGroupInfo178     HalP2pGroupInfo() : isGo(0), isPersistent(0), frequency(0)
179     {}
180 
~HalP2pGroupInfoHalP2pGroupInfo181     ~HalP2pGroupInfo()
182     {}
183 };
184 
185 struct HalP2pServDiscReqInfo {
186     int freq;
187     int dialogToken;
188     int updateIndic;
189     std::string mac;
190     std::vector<unsigned char> tlvList;
191 
HalP2pServDiscReqInfoHalP2pServDiscReqInfo192     HalP2pServDiscReqInfo() : freq(0), dialogToken(0), updateIndic(0)
193     {}
194 
~HalP2pServDiscReqInfoHalP2pServDiscReqInfo195     ~HalP2pServDiscReqInfo()
196     {}
197 };
198 
199 struct HalP2pGroupConfig {
200     std::string ssid;
201     std::string bssid;
202     std::string psk;
203     std::string proto;
204     std::string keyMgmt;
205     std::string pairwise;
206     std::string authAlg;
207     std::string clientList;
208     int mode;
209     int disabled;
210 
HalP2pGroupConfigHalP2pGroupConfig211     HalP2pGroupConfig()
212         : bssid("00:00:00:00:00:00"),
213           proto("RSN"),
214           keyMgmt("WPA-PSK"),
215           pairwise("CCMP"),
216           authAlg("OPEN"),
217           clientList(""),
218           mode(0),
219           disabled(0)
220     {}
221 
~HalP2pGroupConfigHalP2pGroupConfig222     ~HalP2pGroupConfig()
223     {}
224 };
225 
226 struct WifiHalScanParam {
227     std::vector<std::string> hiddenNetworkSsid; /* Hiding Network SSIDs */
228     std::vector<int> scanFreqs;                 /* Scan frequency */
229     int scanStyle;
WifiHalScanParamWifiHalScanParam230     WifiHalScanParam()
231     {
232         scanStyle = 0;
233     }
234 };
235 
236 struct WifiHalPnoScanParam {
237     int scanInterval;                    /* PNO Scan Interval */
238     std::vector<int> scanFreqs;          /* Scanning frequency */
239     std::vector<std::string> hiddenSsid; /* Network name of hidden network */
240     std::vector<std::string> savedSsid;  /* Network name of saved network */
241     int minRssi2Dot4Ghz;                 /* Minimum 2.4 GHz network signal strength */
242     int minRssi5Ghz;                     /* Minimum 5 GHz network signal strength */
243 
WifiHalPnoScanParamWifiHalPnoScanParam244     WifiHalPnoScanParam()
245     {
246         scanFreqs.clear();
247         hiddenSsid.clear();
248         savedSsid.clear();
249 
250         scanInterval = 0;
251         minRssi2Dot4Ghz = 0;
252         minRssi5Ghz = 0;
253     }
254 
~WifiHalPnoScanParamWifiHalPnoScanParam255     ~WifiHalPnoScanParam()
256     {
257         scanFreqs.clear();
258         hiddenSsid.clear();
259         savedSsid.clear();
260     }
261 };
262 
263 struct WifiHalApConnectionNofify {
264     int type;
265     std::string mac;
266 
WifiHalApConnectionNofifyWifiHalApConnectionNofify267     WifiHalApConnectionNofify() : type(0)
268     {}
269 
~WifiHalApConnectionNofifyWifiHalApConnectionNofify270     ~WifiHalApConnectionNofify()
271     {}
272 };
273 
274 }  // namespace Wifi
275 }  // namespace OHOS
276 #endif