• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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_HDI_STRUCT_H
17 #define OHOS_WIFI_HDI_STRUCT_H
18 
19 #include <stdint.h>
20 #include "wifi_hdi_define.h"
21 #include "wifi_error_no.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct HdiIeHdr {
28     uint8_t elemId;
29     uint8_t len;
30     uint8_t oui[4];
31     uint8_t version[2];
32 };
33 
34 struct HdiElem {
35     uint8_t id;
36     uint8_t datalen;
37     uint8_t data[];
38 };
39 
40 struct HdiMdie {
41     uint8_t mobilityDomain[HDI_MOBILITY_DOMAIN_ID_LEN];
42     uint8_t ftCapab;
43 };
44 
45 struct HdiFtie {
46     uint8_t micControl[2];
47     uint8_t mic[16];
48     uint8_t anonce[HDI_NONCE_LEN];
49     uint8_t snonce[HDI_NONCE_LEN];
50 };
51 
52 struct HdiRsnIeHdr {
53     uint8_t elemId;
54     uint8_t len;
55     uint8_t version[2];
56 };
57 
58 struct HdiIesInfo {
59     struct {
60         const uint8_t *ie;
61         uint8_t ieLen;
62     } ies[HDI_MAX_IES_SUPPORTED];
63     uint8_t nofIes;
64 };
65 
66 
67 struct HdiElems {
68     const uint8_t *ssid;
69     const uint8_t *suppRates;
70     const uint8_t *dsParams;
71     const uint8_t *challenge;
72     const uint8_t *erpInfo;
73     const uint8_t *extSuppRates;
74     const uint8_t *hdiIe;
75     const uint8_t *rsnIe;
76     const uint8_t *wmm; /* WMM Information or Parameter Element */
77     const uint8_t *wmmTspec;
78     const uint8_t *wpsIe;
79     const uint8_t *hdiChannels;
80     const uint8_t *mdie;
81     const uint8_t *ftie;
82     const uint8_t *timeout;
83     const uint8_t *htCapabilities;
84     const uint8_t *htOperation;
85     const uint8_t *meshCfg;
86     const uint8_t *meshId;
87     const uint8_t *peerMgmt;
88     const uint8_t *vhtCapabilities;
89     const uint8_t *vhtOperation;
90     const uint8_t *vhtOpmodeNotif;
91     const uint8_t *vendorHtCap;
92     const uint8_t *vendorVht;
93     const uint8_t *p2p;
94     const uint8_t *wfd;
95     const uint8_t *linkId;
96     const uint8_t *interworking;
97     const uint8_t *mapSet;
98     const uint8_t *hs20;
99     const uint8_t *extCapab;
100     const uint8_t *maxIdlePeriod;
101     const uint8_t *ssidList;
102     const uint8_t *osen;
103     const uint8_t *mbo;
104     const uint8_t *ampe;
105     const uint8_t *mic;
106     const uint8_t *prefFreqList;
107     const uint8_t *opClasses;
108     const uint8_t *rrmEnabled;
109     const uint8_t *cagNumber;
110     const uint8_t *apCsn;
111     const uint8_t *filsIndic;
112     const uint8_t *dils;
113     const uint8_t *assocDelayInfo;
114     const uint8_t *filsReqParams;
115     const uint8_t *filsKeyConfirm;
116     const uint8_t *filsSession;
117     const uint8_t *filsHlp;
118     const uint8_t *addrAssign;
119     const uint8_t *delivery;
120     const uint8_t *wrappedData;
121     const uint8_t *filsPk;
122     const uint8_t *filsNonce;
123     const uint8_t *oweDh;
124     const uint8_t *powerCapab;
125     const uint8_t *roamingConsSel;
126     const uint8_t *passwordId;
127     const uint8_t *oci;
128     const uint8_t *multiAp;
129     const uint8_t *heCapabilities;
130     const uint8_t *heOperation;
131     const uint8_t *ehtCapabilities80211Be;
132 
133     uint8_t ssidLen;
134     uint8_t ratesLen;
135     uint8_t challengeLen;
136     uint8_t suppRatesLlen;
137     uint8_t wpaIeLen;
138     uint8_t rsnIeLen;
139     uint8_t wmmLen; /* 7 = WMM Information; 24 = WMM Parameter */
140     uint8_t wmmTspecLen;
141     uint8_t hdiIeLen;
142     uint8_t channelsLen;
143     uint8_t mdieLen;
144     uint8_t ftieLen;
145     uint8_t meshConfigLen;
146     uint8_t meshIdLen;
147     uint8_t peerMgmtLen;
148     uint8_t vendorHtCapLen;
149     uint8_t vendorVhtLen;
150     uint8_t p2pLen;
151     uint8_t wfdLen;
152     uint8_t interworkingLen;
153     uint8_t qosMapSetLen;
154     uint8_t hs20Len;
155     uint8_t extCapabLen;
156     uint8_t ssidListLen;
157     uint8_t osenLen;
158     uint8_t mboLen;
159     uint8_t ampeLen;
160     uint8_t micLen;
161     uint8_t prefFreqListLen;
162     uint8_t suppOpClassesLen;
163     uint8_t rrmEnabledLen;
164     uint8_t cagNumberLen;
165     uint8_t filsIndicLen;
166     uint8_t dilsLen;
167     uint8_t filsReqParamsLen;
168     uint8_t filsKeyConfirmLen;
169     uint8_t filsHlpLen;
170     uint8_t filsIpAddrAssignLen;
171     uint8_t keyDeliveryLen;
172     uint8_t filWrappedDataLen;
173     uint8_t filsPkLen;
174     uint8_t oweDhLen;
175     uint8_t powerCapabLen;
176     uint8_t roamingConsSelLen;
177     uint8_t passwordIdLen;
178     uint8_t ociLen;
179     uint8_t multiApLen;
180     uint8_t heCapabilitiesLen;
181     uint8_t heOperationLen;
182     uint8_t ehtCapabilities80211BeLen;
183 
184     struct HdiIesInfo hdiIes;
185 };
186 
187 struct HdiIeData {
188     int proto;
189     int pairwiseCipher;
190     int hasPairwise;
191     int groupCipher;
192     int hasGroup;
193     int keyMgmt;
194     int capabilities;
195     size_t numPmkid;
196     const uint8_t *pmkid;
197     int mgmtGroupCipher;
198 };
199 
200 /* HT Capabilities HdiElem */
201 struct HdiHtCapabilities {
202     uint16_t htCapabilitiesInfo;
203     uint8_t mpduParams; /* Maximum A-MPDU Length Exponent B0..B1
204                * Minimum MPDU Start Spacing B2..B4
205                * Reserved B5..B7 */
206     uint8_t supportedMcsSet[16];
207     uint16_t htExtendedCapabilities;
208     uint32_t txbfCapabilityInfo;
209     uint8_t aselCapabilities;
210 };
211 
212 struct HdiHtOperation {
213     uint8_t primaryChan;
214     uint8_t htParam;
215     uint16_t operationMode;
216     uint16_t param;
217     uint8_t basicMcsSet[16];
218 };
219 
220 struct HdiVhtCapabilities {
221     uint32_t capabilitiesInfo;
222     struct {
223         uint16_t rxMap;
224         uint16_t rxHighest;
225         uint16_t txMap;
226         uint16_t txHighest;
227     } vhtSupportedset;
228 };
229 
230 struct HdiVhtOperation {
231     uint8_t chwidth;
232     uint8_t seg0Idx;
233     uint8_t seg1Idx;
234     uint16_t set;
235 };
236 
237 struct HdiParseAttr {
238     const uint8_t *version;
239     const uint8_t *version2;
240     const uint8_t *msgType;
241     const uint8_t *enrolleeNonce;
242     const uint8_t *registrarNonce;
243     const uint8_t *uuidr;
244     const uint8_t *uuide;
245     const uint8_t *authFlags;
246     const uint8_t *encrflags;
247     const uint8_t *connFlags;
248     const uint8_t *methods;
249     const uint8_t *configMethods;
250     const uint8_t *primaryDevType;
251     const uint8_t *rfBands;
252     const uint8_t *tate;
253     const uint8_t *error;
254     const uint8_t *passwordId;
255     const uint8_t *version3;
256     const uint8_t *state;
257     const uint8_t *authenticator;
258     const uint8_t *hash1;
259     const uint8_t *hash2;
260     const uint8_t *hash3;
261     const uint8_t *hash4;
262     const uint8_t *snonce1;
263     const uint8_t *snonce2;
264     const uint8_t *snonce3;
265     const uint8_t *snonce4;
266     const uint8_t *auth;
267     const uint8_t *authType;
268     const uint8_t *encrType;
269     const uint8_t *idx;
270     const uint8_t *keyIdx;
271     const uint8_t *mac;
272     const uint8_t *registrar;
273     const uint8_t *requestType;
274     const uint8_t *responseType;
275     const uint8_t *setupLocked;
276     const uint8_t *delayTime;
277     const uint8_t *shareable;
278     const uint8_t *enroll;
279     const uint8_t *channel;
280     const uint8_t *methods2;
281 
282     const uint8_t *manufacturer;
283     const uint8_t *modelNname;
284     const uint8_t *modelNumber;
285     const uint8_t *serialNumber;
286     const uint8_t *devName;
287     const uint8_t *publicKey;
288     const uint8_t *encrSettings;
289     const uint8_t *ssid;
290     const uint8_t *networkKey;
291     const uint8_t *authorizedMacs;
292     const uint8_t *typeList;
293     const uint8_t *devPassword;
294     uint16_t manufacturerLen;
295     uint16_t modelNameLen;
296     uint16_t modelNumberLen;
297     uint16_t serialNumberLen;
298     uint16_t devNameLen;
299     uint16_t publicKeyLen;
300     uint16_t encrSettingsLen;
301     uint16_t ssidLen;
302     uint16_t networkKeyLen;
303     uint16_t authorizedMacsLen;
304     uint16_t secDevTypeListLen;
305     uint16_t oobDevPasswordLen;
306 
307     unsigned int numCred;
308     unsigned int numReqDevType;
309     unsigned int numVendorExt;
310 
311     uint16_t credLen[HDI_MAX_CRED_COUNT];
312     uint16_t vendorExtLen[HDI_MAX__VENDOR_EXT];
313 
314     const uint8_t *cred[HDI_MAX_CRED_COUNT];
315     const uint8_t *reqDevType[HDI_MAX_REQ_DEV_TYPE_COUNT];
316     const uint8_t *vendorExt[HDI_MAX__VENDOR_EXT];
317     uint8_t multiApExt;
318 };
319 
320 struct WifiScanResultExt {
321     uint32_t flags;
322     uint8_t* bssid;
323     uint32_t bssidLen;
324     uint16_t caps;
325     uint32_t freq;
326     uint16_t beaconInt;
327     int32_t qual;
328     int32_t level;
329     uint32_t age;
330     uint64_t tsf;
331     uint8_t* variable;
332     uint32_t variableLen;
333     uint8_t* ie;
334     uint32_t ieLen;
335     uint8_t* beaconIe;
336     uint32_t beaconIeLen;
337 };
338 
339 #ifdef __cplusplus
340 }
341 #endif
342 #endif