1 /** @file
2   This file provides management service interfaces of 802.11 MAC layer. It is used by
3   network applications (and drivers) to establish wireless connection with an access
4   point (AP).
5 
6   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9   @par Revision Reference:
10   This Protocol is introduced in UEFI Specification 2.5
11 
12 **/
13 
14 #ifndef __EFI_WIFI_PROTOCOL_H__
15 #define __EFI_WIFI_PROTOCOL_H__
16 
17 #include <Protocol/WiFi2.h>
18 
19 #define EFI_WIRELESS_MAC_CONNECTION_PROTOCOL_GUID \
20   { \
21     0xda55bc9, 0x45f8, 0x4bb4, {0x87, 0x19, 0x52, 0x24, 0xf1, 0x8a, 0x4d, 0x45 } \
22   }
23 
24 typedef struct _EFI_WIRELESS_MAC_CONNECTION_PROTOCOL EFI_WIRELESS_MAC_CONNECTION_PROTOCOL;
25 
26 ///
27 /// EFI_80211_ACC_NET_TYPE
28 ///
29 typedef enum {
30   IeeePrivate           = 0,
31   IeeePrivatewithGuest  = 1,
32   IeeeChargeablePublic  = 2,
33   IeeeFreePublic        = 3,
34   IeeePersonal          = 4,
35   IeeeEmergencyServOnly = 5,
36   IeeeTestOrExp         = 14,
37   IeeeWildcard          = 15
38 } EFI_80211_ACC_NET_TYPE;
39 
40 ///
41 /// EFI_80211_ASSOCIATE_RESULT_CODE
42 ///
43 typedef enum {
44   AssociateSuccess,
45   AssociateRefusedReasonUnspecified,
46   AssociateRefusedCapsMismatch,
47   AssociateRefusedExtReason,
48   AssociateRefusedAPOutOfMemory,
49   AssociateRefusedBasicRatesMismatch,
50   AssociateRejectedEmergencyServicesNotSupported,
51   AssociateRefusedTemporarily
52 } EFI_80211_ASSOCIATE_RESULT_CODE;
53 
54 ///
55 /// EFI_80211_SCAN_RESULT_CODE
56 ///
57 typedef enum {
58   ///
59   /// The scan operation finished successfully.
60   ///
61   ScanSuccess,
62   ///
63   /// The scan operation is not supported in current implementation.
64   ///
65   ScanNotSupported
66 } EFI_80211_SCAN_RESULT_CODE;
67 
68 ///
69 /// EFI_80211_REASON_CODE
70 ///
71 typedef enum {
72   Ieee80211UnspecifiedReason           = 1,
73   Ieee80211PreviousAuthenticateInvalid = 2,
74   Ieee80211DeauthenticatedSinceLeaving = 3,
75   Ieee80211DisassociatedDueToInactive  = 4,
76   Ieee80211DisassociatedSinceApUnable  = 5,
77   Ieee80211Class2FrameNonauthenticated = 6,
78   Ieee80211Class3FrameNonassociated    = 7,
79   Ieee80211DisassociatedSinceLeaving   = 8,
80   // ...
81 } EFI_80211_REASON_CODE;
82 
83 ///
84 /// EFI_80211_DISASSOCIATE_RESULT_CODE
85 ///
86 typedef enum {
87   ///
88   /// Disassociation process completed successfully.
89   ///
90   DisassociateSuccess,
91   ///
92   /// Disassociation failed due to any input parameter is invalid.
93   ///
94   DisassociateInvalidParameters
95 } EFI_80211_DISASSOCIATE_RESULT_CODE;
96 
97 ///
98 /// EFI_80211_AUTHENTICATION_TYPE
99 ///
100 typedef enum {
101   ///
102   /// Open system authentication, admits any STA to the DS.
103   ///
104   OpenSystem,
105   ///
106   /// Shared Key authentication relies on WEP to demonstrate knowledge of a WEP
107   /// encryption key.
108   ///
109   SharedKey,
110   ///
111   /// FT authentication relies on keys derived during the initial mobility domain
112   /// association to authenticate the stations.
113   ///
114   FastBSSTransition,
115   ///
116   /// SAE authentication uses finite field cryptography to prove knowledge of a shared
117   /// password.
118   ///
119   SAE
120 } EFI_80211_AUTHENTICATION_TYPE;
121 
122 ///
123 /// EFI_80211_AUTHENTICATION_RESULT_CODE
124 ///
125 typedef enum {
126   AuthenticateSuccess,
127   AuthenticateRefused,
128   AuthenticateAnticLoggingTokenRequired,
129   AuthenticateFiniteCyclicGroupNotSupported,
130   AuthenticationRejected,
131   AuthenticateInvalidParameter
132 } EFI_80211_AUTHENTICATE_RESULT_CODE;
133 
134 ///
135 /// EFI_80211_ELEMENT_HEADER
136 ///
137 typedef struct {
138   ///
139   /// A unique element ID defined in IEEE 802.11 specification.
140   ///
141   UINT8                              ElementID;
142   ///
143   /// Specifies the number of octets in the element body.
144   ///
145   UINT8                              Length;
146 } EFI_80211_ELEMENT_HEADER;
147 
148 ///
149 /// EFI_80211_ELEMENT_REQ
150 ///
151 typedef struct {
152   ///
153   /// Common header of an element.
154   ///
155   EFI_80211_ELEMENT_HEADER           Hdr;
156   ///
157   /// Start of elements that are requested to be included in the Probe Response frame.
158   /// The elements are listed in order of increasing element ID.
159   ///
160   UINT8                              RequestIDs[1];
161 } EFI_80211_ELEMENT_REQ;
162 
163 ///
164 /// EFI_80211_ELEMENT_SSID
165 ///
166 typedef struct {
167   ///
168   /// Common header of an element.
169   ///
170   EFI_80211_ELEMENT_HEADER           Hdr;
171   ///
172   /// Service set identifier. If Hdr.Length is zero, this field is ignored.
173   ///
174   UINT8                              SSId[32];
175 } EFI_80211_ELEMENT_SSID;
176 
177 ///
178 /// EFI_80211_SCAN_DATA
179 ///
180 typedef struct {
181   ///
182   /// Determines whether infrastructure BSS, IBSS, MBSS, or all, are included in the
183   /// scan.
184   ///
185   EFI_80211_BSS_TYPE                 BSSType;
186   ///
187   /// Indicates a specific or wildcard BSSID. Use all binary 1s to represent all SSIDs.
188   ///
189   EFI_80211_MAC_ADDRESS              BSSId;
190   ///
191   /// Length in bytes of the SSId. If zero, ignore SSId field.
192   ///
193   UINT8                              SSIdLen;
194   ///
195   /// Specifies the desired SSID or the wildcard SSID. Use NULL to represent all SSIDs.
196   ///
197   UINT8                              *SSId;
198   ///
199   /// Indicates passive scanning if TRUE.
200   ///
201   BOOLEAN                            PassiveMode;
202   ///
203   /// The delay in microseconds to be used prior to transmitting a Probe frame during
204   /// active scanning. If zero, the value can be overridden by an
205   /// implementation-dependent default value.
206   ///
207   UINT32                             ProbeDelay;
208   ///
209   /// Specifies a list of channels that are examined when scanning for a BSS. If set to
210   /// NULL, all valid channels will be scanned.
211   ///
212   UINT32                             *ChannelList;
213   ///
214   /// Indicates the minimum time in TU to spend on each channel when scanning. If zero,
215   /// the value can be overridden by an implementation-dependent default value.
216   ///
217   UINT32                             MinChannelTime;
218   ///
219   /// Indicates the maximum time in TU to spend on each channel when scanning. If zero,
220   /// the value can be overridden by an implementation-dependent default value.
221   ///
222   UINT32                             MaxChannelTime;
223   ///
224   /// Points to an optionally present element. This is an optional parameter and may be
225   /// NULL.
226   ///
227   EFI_80211_ELEMENT_REQ              *RequestInformation;
228   ///
229   /// Indicates one or more SSID elements that are optionally present. This is an
230   /// optional parameter and may be NULL.
231   ///
232   EFI_80211_ELEMENT_SSID             *SSIDList;
233   ///
234   /// Specifies a desired specific access network type or the wildcard access network
235   /// type. Use 15 as wildcard access network type.
236   ///
237   EFI_80211_ACC_NET_TYPE             AccessNetworkType;
238   ///
239   ///  Specifies zero or more elements. This is an optional parameter and may be NULL.
240   ///
241   UINT8                              *VendorSpecificInfo;
242 } EFI_80211_SCAN_DATA;
243 
244 ///
245 /// EFI_80211_COUNTRY_TRIPLET_SUBBAND
246 ///
247 typedef struct {
248   ///
249   /// Indicates the lowest channel number in the subband. It has a positive integer
250   /// value less than 201.
251   ///
252   UINT8                              FirstChannelNum;
253   ///
254   /// Indicates the number of channels in the subband.
255   ///
256   UINT8                              NumOfChannels;
257   ///
258   /// Indicates the maximum power in dBm allowed to be transmitted.
259   ///
260   UINT8                              MaxTxPowerLevel;
261 } EFI_80211_COUNTRY_TRIPLET_SUBBAND;
262 
263 ///
264 /// EFI_80211_COUNTRY_TRIPLET_OPERATE
265 ///
266 typedef struct {
267   ///
268   /// Indicates the operating extension identifier. It has a positive integer value of
269   /// 201 or greater.
270   ///
271   UINT8                              OperatingExtId;
272   ///
273   /// Index into a set of values for radio equipment set of rules.
274   ///
275   UINT8                              OperatingClass;
276   ///
277   /// Specifies aAirPropagationTime characteristics used in BSS operation. Refer the
278   /// definition of aAirPropagationTime in IEEE 802.11 specification.
279   ///
280   UINT8                              CoverageClass;
281 } EFI_80211_COUNTRY_TRIPLET_OPERATE;
282 
283 ///
284 /// EFI_80211_COUNTRY_TRIPLET
285 ///
286 typedef union {
287   ///
288   /// The subband triplet.
289   ///
290   EFI_80211_COUNTRY_TRIPLET_SUBBAND  Subband;
291   ///
292   /// The operating triplet.
293   ///
294   EFI_80211_COUNTRY_TRIPLET_OPERATE  Operating;
295 } EFI_80211_COUNTRY_TRIPLET;
296 
297 ///
298 /// EFI_80211_ELEMENT_COUNTRY
299 ///
300 typedef struct {
301   ///
302   /// Common header of an element.
303   ///
304   EFI_80211_ELEMENT_HEADER           Hdr;
305   ///
306   /// Specifies country strings in 3 octets.
307   ///
308   UINT8                              CountryStr[3];
309   ///
310   /// Indicates a triplet that repeated in country element. The number of triplets is
311   /// determined by the Hdr.Length field.
312   ///
313   EFI_80211_COUNTRY_TRIPLET          CountryTriplet[1];
314 } EFI_80211_ELEMENT_COUNTRY;
315 
316 ///
317 /// EFI_80211_ELEMENT_DATA_RSN
318 ///
319 typedef struct {
320   ///
321   /// Indicates the version number of the RSNA protocol. Value 1 is defined in current
322   /// IEEE 802.11 specification.
323   ///
324   UINT16                             Version;
325   ///
326   /// Specifies the cipher suite selector used by the BSS to protect group address frames.
327   ///
328   UINT32                             GroupDataCipherSuite;
329   ///
330   /// Indicates the number of pairwise cipher suite selectors that are contained in
331   /// PairwiseCipherSuiteList.
332   ///
333 //UINT16                             PairwiseCipherSuiteCount;
334   ///
335   /// Contains a series of cipher suite selectors that indicate the pairwise cipher
336   /// suites contained in this element.
337   ///
338 //UINT32                             PairwiseCipherSuiteList[PairwiseCipherSuiteCount];
339   ///
340   /// Indicates the number of AKM suite selectors that are contained in AKMSuiteList.
341   ///
342 //UINT16                             AKMSuiteCount;
343   ///
344   /// Contains a series of AKM suite selectors that indicate the AKM suites contained in
345   /// this element.
346   ///
347 //UINT32                             AKMSuiteList[AKMSuiteCount];
348   ///
349   /// Indicates requested or advertised capabilities.
350   ///
351 //UINT16                             RSNCapabilities;
352   ///
353   /// Indicates the number of PKMIDs in the PMKIDList.
354   ///
355 //UINT16                             PMKIDCount;
356   ///
357   /// Contains zero or more PKMIDs that the STA believes to be valid for the destination
358   /// AP.
359 //UINT8                              PMKIDList[PMKIDCount][16];
360   ///
361   /// Specifies the cipher suite selector used by the BSS to protect group addressed
362   /// robust management frames.
363   ///
364 //UINT32                             GroupManagementCipherSuite;
365 } EFI_80211_ELEMENT_DATA_RSN;
366 
367 ///
368 /// EFI_80211_ELEMENT_RSN
369 ///
370 typedef struct {
371   ///
372   /// Common header of an element.
373   ///
374   EFI_80211_ELEMENT_HEADER           Hdr;
375   ///
376   /// Points to RSN element. The size of a RSN element is limited to 255 octets.
377   ///
378   EFI_80211_ELEMENT_DATA_RSN         *Data;
379 } EFI_80211_ELEMENT_RSN;
380 
381 ///
382 /// EFI_80211_ELEMENT_EXT_CAP
383 ///
384 typedef struct {
385   ///
386   /// Common header of an element.
387   ///
388   EFI_80211_ELEMENT_HEADER           Hdr;
389   ///
390   /// Indicates the capabilities being advertised by the STA transmitting the element.
391   /// This is a bit field with variable length. Refer to IEEE 802.11 specification for
392   /// bit value.
393   ///
394   UINT8                              Capabilities[1];
395 } EFI_80211_ELEMENT_EXT_CAP;
396 
397 ///
398 /// EFI_80211_BSS_DESCRIPTION
399 ///
400 typedef struct {
401   ///
402   /// Indicates a specific BSSID of the found BSS.
403   ///
404   EFI_80211_MAC_ADDRESS              BSSId;
405   ///
406   /// Specifies the SSID of the found BSS. If NULL, ignore SSIdLen field.
407   ///
408   UINT8                              *SSId;
409   ///
410   /// Specifies the SSID of the found BSS. If NULL, ignore SSIdLen field.
411   ///
412   UINT8                              SSIdLen;
413   ///
414   /// Specifies the type of the found BSS.
415   ///
416   EFI_80211_BSS_TYPE                 BSSType;
417   ///
418   /// The beacon period in TU of the found BSS.
419   ///
420   UINT16                             BeaconPeriod;
421   ///
422   /// The timestamp of the received frame from the found BSS.
423   ///
424   UINT64                             Timestamp;
425   ///
426   /// The advertised capabilities of the BSS.
427   ///
428   UINT16                             CapabilityInfo;
429   ///
430   /// The set of data rates that shall be supported by all STAs that desire to join this
431   /// BSS.
432   ///
433   UINT8                              *BSSBasicRateSet;
434   ///
435   /// The set of data rates that the peer STA desires to use for communication within
436   /// the BSS.
437   ///
438   UINT8                              *OperationalRateSet;
439   ///
440   /// The information required to identify the regulatory domain in which the peer STA
441   /// is located.
442   ///
443   EFI_80211_ELEMENT_COUNTRY          *Country;
444   ///
445   /// The cipher suites and AKM suites supported in the BSS.
446   ///
447   EFI_80211_ELEMENT_RSN              RSN;
448   ///
449   /// Specifies the RSSI of the received frame.
450   ///
451   UINT8                              RSSI;
452   ///
453   /// Specifies the RCPI of the received frame.
454   ///
455   UINT8                              RCPIMeasurement;
456   ///
457   /// Specifies the RSNI of the received frame.
458   ///
459   UINT8                              RSNIMeasurement;
460   ///
461   /// Specifies the elements requested by the request element of the Probe Request frame.
462   /// This is an optional parameter and may be NULL.
463   ///
464   UINT8                              *RequestedElements;
465   ///
466   /// Specifies the BSS membership selectors that represent the set of features that
467   /// shall be supported by all STAs to join this BSS.
468   ///
469   UINT8                              *BSSMembershipSelectorSet;
470   ///
471   /// Specifies the parameters within the Extended Capabilities element that are
472   /// supported by the MAC entity. This is an optional parameter and may be NULL.
473   ///
474   EFI_80211_ELEMENT_EXT_CAP          *ExtCapElement;
475 } EFI_80211_BSS_DESCRIPTION;
476 
477 ///
478 /// EFI_80211_SUBELEMENT_INFO
479 ///
480 typedef struct {
481   ///
482   /// Indicates the unique identifier within the containing element or sub-element.
483   ///
484   UINT8                              SubElementID;
485   ///
486   /// Specifies the number of octets in the Data field.
487   ///
488   UINT8                              Length;
489   ///
490   /// A variable length data buffer.
491   ///
492   UINT8                              Data[1];
493 } EFI_80211_SUBELEMENT_INFO;
494 
495 ///
496 /// EFI_80211_MULTIPLE_BSSID
497 ///
498 typedef struct {
499   ///
500   /// Common header of an element.
501   ///
502   EFI_80211_ELEMENT_HEADER           Hdr;
503   ///
504   /// Indicates the maximum number of BSSIDs in the multiple BSSID set. When Indicator
505   /// is set to n, 2n is the maximum number.
506   ///
507   UINT8                              Indicator;
508   ///
509   /// Contains zero or more sub-elements.
510   ///
511   EFI_80211_SUBELEMENT_INFO          SubElement[1];
512 } EFI_80211_MULTIPLE_BSSID;
513 
514 ///
515 /// EFI_80211_BSS_DESP_PILOT
516 ///
517 typedef struct {
518   ///
519   /// Indicates a specific BSSID of the found BSS.
520   ///
521   EFI_80211_MAC_ADDRESS              BSSId;
522   ///
523   /// Specifies the type of the found BSS.
524   ///
525   EFI_80211_BSS_TYPE                 BSSType;
526   ///
527   /// One octet field to report condensed capability information.
528   ///
529   UINT8                              ConCapInfo;
530   ///
531   /// Two octet's field to report condensed country string.
532   ///
533   UINT8                              ConCountryStr[2];
534   ///
535   /// Indicates the operating class value for the operating channel.
536   ///
537   UINT8                              OperatingClass;
538   ///
539   /// Indicates the operating channel.
540   ///
541   UINT8                              Channel;
542   ///
543   /// Indicates the measurement pilot interval in TU.
544   ///
545   UINT8                              Interval;
546   ///
547   /// Indicates that the BSS is within a multiple BSSID set.
548   ///
549   EFI_80211_MULTIPLE_BSSID           *MultipleBSSID;
550   ///
551   /// Specifies the RCPI of the received frame.
552   ///
553   UINT8                              RCPIMeasurement;
554   ///
555   /// Specifies the RSNI of the received frame.
556   ///
557   UINT8                              RSNIMeasurement;
558 } EFI_80211_BSS_DESP_PILOT;
559 
560 ///
561 /// EFI_80211_SCAN_RESULT
562 ///
563 typedef struct {
564   ///
565   /// The number of EFI_80211_BSS_DESCRIPTION in BSSDespSet. If zero, BSSDespSet should
566   /// be ignored.
567   ///
568   UINTN                              NumOfBSSDesp;
569   ///
570   /// Points to zero or more instances of EFI_80211_BSS_DESCRIPTION.
571   ///
572   EFI_80211_BSS_DESCRIPTION          **BSSDespSet;
573   ///
574   /// The number of EFI_80211_BSS_DESP_PILOT in BSSDespFromPilotSet. If zero,
575   /// BSSDespFromPilotSet should be ignored.
576   ///
577   UINTN                              NumofBSSDespFromPilot;
578   ///
579   /// Points to zero or more instances of EFI_80211_BSS_DESP_PILOT.
580   ///
581   EFI_80211_BSS_DESP_PILOT           **BSSDespFromPilotSet;
582   ///
583   /// Specifies zero or more elements. This is an optional parameter and may be NULL.
584   ///
585   UINT8                              *VendorSpecificInfo;
586 } EFI_80211_SCAN_RESULT;
587 
588 ///
589 /// EFI_80211_SCAN_DATA_TOKEN
590 ///
591 typedef struct {
592   ///
593   /// This Event will be signaled after the Status field is updated by the EFI Wireless
594   /// MAC Connection Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
595   ///
596   EFI_EVENT                          Event;
597   ///
598   /// Will be set to one of the following values:
599   ///   EFI_SUCCESS:       Scan operation completed successfully.
600   ///   EFI_NOT_FOUND:     Failed to find available BSS.
601   ///   EFI_DEVICE_ERROR:  An unexpected network or system error occurred.
602   ///   EFI_ACCESS_DENIED: The scan operation is not completed due to some underlying
603   ///                      hardware or software state.
604   ///   EFI_NOT_READY:     The scan operation is started but not yet completed.
605   EFI_STATUS                         Status;
606   ///
607   /// Pointer to the scan data.
608   ///
609   EFI_80211_SCAN_DATA                *Data;
610   ///
611   /// Indicates the scan state.
612   ///
613   EFI_80211_SCAN_RESULT_CODE         ResultCode;
614   ///
615   /// Indicates the scan result. It is caller's responsibility to free this buffer.
616   ///
617   EFI_80211_SCAN_RESULT              *Result;
618 } EFI_80211_SCAN_DATA_TOKEN;
619 
620 ///
621 /// EFI_80211_ELEMENT_SUPP_CHANNEL_TUPLE
622 ///
623 typedef struct {
624   ///
625   /// The first channel number in a subband of supported channels.
626   ///
627   UINT8                              FirstChannelNumber;
628   ///
629   /// The number of channels in a subband of supported channels.
630   ///
631   UINT8                              NumberOfChannels;
632 } EFI_80211_ELEMENT_SUPP_CHANNEL_TUPLE;
633 
634 ///
635 /// EFI_80211_ELEMENT_SUPP_CHANNEL
636 ///
637 typedef struct {
638   ///
639   /// Common header of an element.
640   ///
641   EFI_80211_ELEMENT_HEADER                Hdr;
642   ///
643   /// Indicates one or more tuples of (first channel, number of channels).
644   ///
645   EFI_80211_ELEMENT_SUPP_CHANNEL_TUPLE    Subband[1];
646 } EFI_80211_ELEMENT_SUPP_CHANNEL;
647 
648 ///
649 /// EFI_80211_ASSOCIATE_DATA
650 ///
651 typedef struct {
652   ///
653   /// Specifies the address of the peer MAC entity to associate with.
654   ///
655   EFI_80211_MAC_ADDRESS              BSSId;
656   ///
657   /// Specifies the requested operational capabilities to the AP in 2 octets.
658   ///
659   UINT16                             CapabilityInfo;
660   ///
661   /// Specifies a time limit in TU, after which the associate procedure is terminated.
662   ///
663   UINT32                             FailureTimeout;
664   ///
665   /// Specifies if in power save mode, how often the STA awakes and listens for the next
666   /// beacon frame in TU.
667   ///
668   UINT32                             ListenInterval;
669   ///
670   /// Indicates a list of channels in which the STA is capable of operating.
671   ///
672   EFI_80211_ELEMENT_SUPP_CHANNEL     *Channels;
673   ///
674   /// The cipher suites and AKM suites selected by the STA.
675   ///
676   EFI_80211_ELEMENT_RSN              RSN;
677   ///
678   /// Specifies the parameters within the Extended Capabilities element that are
679   /// supported by the MAC entity.  This is an optional parameter and may be NULL.
680   ///
681   EFI_80211_ELEMENT_EXT_CAP          *ExtCapElement;
682   ///
683   /// Specifies zero or more elements. This is an optional parameter and may be NULL.
684   ///
685   UINT8                              *VendorSpecificInfo;
686 } EFI_80211_ASSOCIATE_DATA;
687 
688 ///
689 /// EFI_80211_ELEMENT_TIMEOUT_VAL
690 ///
691 typedef struct {
692   ///
693   /// Common header of an element.
694   ///
695   EFI_80211_ELEMENT_HEADER           Hdr;
696   ///
697   /// Specifies the timeout interval type.
698   ///
699   UINT8                              Type;
700   ///
701   /// Specifies the timeout interval value.
702   ///
703   UINT32                             Value;
704 } EFI_80211_ELEMENT_TIMEOUT_VAL;
705 
706 ///
707 /// EFI_80211_ASSOCIATE_RESULT
708 ///
709 typedef struct {
710   ///
711   /// Specifies the address of the peer MAC entity from which the association request
712   /// was received.
713   ///
714   EFI_80211_MAC_ADDRESS              BSSId;
715   ///
716   /// Specifies the operational capabilities advertised by the AP.
717   ///
718   UINT16                             CapabilityInfo;
719   ///
720   /// Specifies the association ID value assigned by the AP.
721   ///
722   UINT16                             AssociationID;
723   ///
724   /// Indicates the measured RCPI of the corresponding association request frame. It is
725   /// an optional parameter and is set to zero if unavailable.
726   ///
727   UINT8                              RCPIValue;
728   ///
729   /// Indicates the measured RSNI at the time the corresponding association request
730   /// frame was received. It is an optional parameter and is set to zero if unavailable.
731   ///
732   UINT8                              RSNIValue;
733   ///
734   /// Specifies the parameters within the Extended Capabilities element that are
735   /// supported by the MAC entity.  This is an optional parameter and may be NULL.
736   ///
737   EFI_80211_ELEMENT_EXT_CAP          *ExtCapElement;
738   ///
739   /// Specifies the timeout interval when the result code is AssociateRefusedTemporarily.
740   ///
741   EFI_80211_ELEMENT_TIMEOUT_VAL      TimeoutInterval;
742   ///
743   /// Specifies zero or more elements. This is an optional parameter and may be NULL.
744   ///
745   UINT8                              *VendorSpecificInfo;
746 } EFI_80211_ASSOCIATE_RESULT;
747 
748 ///
749 /// EFI_80211_ASSOCIATE_DATA_TOKEN
750 ///
751 typedef struct {
752   ///
753   /// This Event will be signaled after the Status field is updated by the EFI Wireless
754   /// MAC Connection Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
755   ///
756   EFI_EVENT                          Event;
757   ///
758   /// Will be set to one of the following values:
759   ///   EFI_SUCCESS:      Association operation completed successfully.
760   ///   EFI_DEVICE_ERROR: An unexpected network or system error occurred.
761   ///
762   EFI_STATUS                         Status;
763   ///
764   /// Pointer to the association data.
765   ///
766   EFI_80211_ASSOCIATE_DATA           *Data;
767   ///
768   /// Indicates the association state.
769   ///
770   EFI_80211_ASSOCIATE_RESULT_CODE    ResultCode;
771   ///
772   /// Indicates the association result. It is caller's responsibility to free this
773   /// buffer.
774   ///
775   EFI_80211_ASSOCIATE_RESULT         *Result;
776 } EFI_80211_ASSOCIATE_DATA_TOKEN;
777 
778 ///
779 /// EFI_80211_DISASSOCIATE_DATA
780 ///
781 typedef struct {
782   ///
783   /// Specifies the address of the peer MAC entity with which to perform the
784   /// disassociation process.
785   ///
786   EFI_80211_MAC_ADDRESS              BSSId;
787   ///
788   /// Specifies the reason for initiating the disassociation process.
789   ///
790   EFI_80211_REASON_CODE              ReasonCode;
791   ///
792   /// Zero or more elements, may be NULL.
793   ///
794   UINT8                              *VendorSpecificInfo;
795 } EFI_80211_DISASSOCIATE_DATA;
796 
797 ///
798 /// EFI_80211_DISASSOCIATE_DATA_TOKEN
799 ///
800 typedef struct {
801   ///
802   /// This Event will be signaled after the Status field is updated by the EFI Wireless
803   /// MAC Connection Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
804   ///
805   EFI_EVENT                          Event;
806   ///
807   /// Will be set to one of the following values:
808   ///   EFI_SUCCESS:       Disassociation operation completed successfully.
809   ///   EFI_DEVICE_ERROR:  An unexpected network or system error occurred.
810   ///   EFI_ACCESS_DENIED: The disassociation operation is not completed due to some
811   ///                      underlying hardware or software state.
812   ///   EFI_NOT_READY:     The disassociation operation is started but not yet completed.
813   ///
814   EFI_STATUS                         Status;
815   ///
816   /// Pointer to the disassociation data.
817   ///
818   EFI_80211_DISASSOCIATE_DATA        *Data;
819   ///
820   /// Indicates the disassociation state.
821   ///
822   EFI_80211_DISASSOCIATE_RESULT_CODE ResultCode;
823 } EFI_80211_DISASSOCIATE_DATA_TOKEN;
824 
825 ///
826 /// EFI_80211_AUTHENTICATION_DATA
827 ///
828 typedef struct {
829   ///
830   /// Specifies the address of the peer MAC entity with which to perform the
831   /// authentication process.
832   ///
833   EFI_80211_MAC_ADDRESS              BSSId;
834   ///
835   /// Specifies the type of authentication algorithm to use during the authentication
836   /// process.
837   ///
838   EFI_80211_AUTHENTICATION_TYPE      AuthType;
839   ///
840   /// Specifies a time limit in TU after which the authentication procedure is
841   /// terminated.
842   ///
843   UINT32                             FailureTimeout;
844   ///
845   /// Specifies the set of elements to be included in the first message of the FT
846   /// authentication sequence, may be NULL.
847   ///
848   UINT8                              *FTContent;
849   ///
850   /// Specifies the set of elements to be included in the SAE Commit Message or SAE
851   /// Confirm Message, may be NULL.
852   ///
853   UINT8                              *SAEContent;
854   ///
855   /// Zero or more elements, may be NULL.
856   ///
857   UINT8                              *VendorSpecificInfo;
858 } EFI_80211_AUTHENTICATE_DATA;
859 
860 ///
861 /// EFI_80211_AUTHENTICATION_RESULT
862 ///
863 typedef struct {
864   ///
865   /// Specifies the address of the peer MAC entity from which the authentication request
866   /// was received.
867   ///
868   EFI_80211_MAC_ADDRESS              BSSId;
869   ///
870   /// Specifies the set of elements to be included in the second message of the FT
871   /// authentication sequence, may be NULL.
872   ///
873   UINT8                              *FTContent;
874   ///
875   /// Specifies the set of elements to be included in the SAE Commit Message or SAE
876   /// Confirm Message, may be NULL.
877   ///
878   UINT8                              *SAEContent;
879   ///
880   /// Zero or more elements, may be NULL.
881   ///
882   UINT8                              *VendorSpecificInfo;
883 } EFI_80211_AUTHENTICATE_RESULT;
884 
885 ///
886 /// EFI_80211_AUTHENTICATE_DATA_TOKEN
887 ///
888 typedef struct {
889   ///
890   /// This Event will be signaled after the Status field is updated by the EFI Wireless
891   /// MAC Connection Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
892   ///
893   EFI_EVENT                          Event;
894   ///
895   /// Will be set to one of the following values:
896   ///   EFI_SUCCESS: Authentication operation completed successfully.
897   ///   EFI_PROTOCOL_ERROR: Peer MAC entity rejects the authentication.
898   ///   EFI_NO_RESPONSE:    Peer MAC entity does not response the authentication request.
899   ///   EFI_DEVICE_ERROR:   An unexpected network or system error occurred.
900   ///   EFI_ACCESS_DENIED:  The authentication operation is not completed due to some
901   ///                       underlying hardware or software state.
902   ///   EFI_NOT_READY:      The authentication operation is started but not yet completed.
903   ///
904   EFI_STATUS                         Status;
905   ///
906   /// Pointer to the authentication data.
907   ///
908   EFI_80211_AUTHENTICATE_DATA        *Data;
909   ///
910   /// Indicates the association state.
911   ///
912   EFI_80211_AUTHENTICATE_RESULT_CODE ResultCode;
913   ///
914   /// Indicates the association result. It is caller's responsibility to free this
915   /// buffer.
916   ///
917   EFI_80211_AUTHENTICATE_RESULT      *Result;
918 } EFI_80211_AUTHENTICATE_DATA_TOKEN;
919 
920 ///
921 /// EFI_80211_DEAUTHENTICATE_DATA
922 ///
923 typedef struct {
924   ///
925   /// Specifies the address of the peer MAC entity with which to perform the
926   /// deauthentication process.
927   ///
928   EFI_80211_MAC_ADDRESS              BSSId;
929   ///
930   /// Specifies the reason for initiating the deauthentication process.
931   ///
932   EFI_80211_REASON_CODE              ReasonCode;
933   ///
934   /// Zero or more elements, may be NULL.
935   ///
936   UINT8                              *VendorSpecificInfo;
937 } EFI_80211_DEAUTHENTICATE_DATA;
938 
939 ///
940 /// EFI_80211_DEAUTHENTICATE_DATA_TOKEN
941 ///
942 typedef struct {
943   ///
944   /// This Event will be signaled after the Status field is updated by the EFI Wireless
945   /// MAC Connection Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
946   ///
947   EFI_EVENT                          Event;
948   ///
949   /// Will be set to one of the following values:
950   ///   EFI_SUCCESS:       Deauthentication operation completed successfully.
951   ///   EFI_DEVICE_ERROR:  An unexpected network or system error occurred.
952   ///   EFI_ACCESS_DENIED: The deauthentication operation is not completed due to some
953   ///                      underlying hardware or software state.
954   ///   EFI_NOT_READY:     The deauthentication operation is started but not yet
955   ///                      completed.
956   ///
957   EFI_STATUS                         Status;
958   ///
959   /// Pointer to the deauthentication data.
960   ///
961   EFI_80211_DEAUTHENTICATE_DATA      *Data;
962 } EFI_80211_DEAUTHENTICATE_DATA_TOKEN;
963 
964 /**
965   Request a survey of potential BSSs that administrator can later elect to try to join.
966 
967   The Scan() function returns the description of the set of BSSs detected by the scan
968   process. Passive scan operation is performed by default.
969 
970   @param[in]  This                Pointer to the EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
971                                   instance.
972   @param[in]  Data                Pointer to the scan token.
973 
974   @retval EFI_SUCCESS             The operation completed successfully.
975   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
976                                   This is NULL.
977                                   Data is NULL.
978                                   Data->Data is NULL.
979   @retval EFI_UNSUPPORTED         One or more of the input parameters are not supported
980                                   by this implementation.
981   @retval EFI_ALREADY_STARTED     The scan operation is already started.
982 **/
983 typedef
984 EFI_STATUS
985 (EFIAPI *EFI_WIRELESS_MAC_CONNECTION_SCAN)(
986   IN EFI_WIRELESS_MAC_CONNECTION_PROTOCOL        *This,
987   IN EFI_80211_SCAN_DATA_TOKEN                   *Data
988   );
989 
990 /**
991   Request an association with a specified peer MAC entity that is within an AP.
992 
993   The Associate() function provides the capability for MAC layer to become associated
994   with an AP.
995 
996   @param[in]  This                Pointer to the EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
997                                   instance.
998   @param[in]  Data                Pointer to the association token.
999 
1000   @retval EFI_SUCCESS             The operation completed successfully.
1001   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
1002                                   This is NULL.
1003                                   Data is NULL.
1004                                   Data->Data is NULL.
1005   @retval EFI_UNSUPPORTED         One or more of the input parameters are not supported
1006                                   by this implementation.
1007   @retval EFI_ALREADY_STARTED     The association process is already started.
1008   @retval EFI_NOT_READY           Authentication is not performed before this association
1009                                   process.
1010   @retval EFI_NOT_FOUND           The specified peer MAC entity is not found.
1011   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
1012 **/
1013 typedef
1014 EFI_STATUS
1015 (EFIAPI *EFI_WIRELESS_MAC_CONNECTION_ASSOCIATE)(
1016   IN EFI_WIRELESS_MAC_CONNECTION_PROTOCOL        *This,
1017   IN EFI_80211_ASSOCIATE_DATA_TOKEN              *Data
1018   );
1019 
1020 /**
1021   Request a disassociation with a specified peer MAC entity.
1022 
1023   The Disassociate() function is invoked to terminate an existing association.
1024   Disassociation is a notification and cannot be refused by the receiving peer except
1025   when management frame protection is negotiated and the message integrity check fails.
1026 
1027   @param[in]  This                Pointer to the EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
1028                                   instance.
1029   @param[in]  Data                Pointer to the disassociation token.
1030 
1031   @retval EFI_SUCCESS             The operation completed successfully.
1032   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
1033                                   This is NULL.
1034                                   Data is NULL.
1035   @retval EFI_ALREADY_STARTED     The disassociation process is already started.
1036   @retval EFI_NOT_READY           The disassociation service is invoked to a
1037                                   nonexistent association relationship.
1038   @retval EFI_NOT_FOUND           The specified peer MAC entity is not found.
1039   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
1040 **/
1041 typedef
1042 EFI_STATUS
1043 (EFIAPI *EFI_WIRELESS_MAC_CONNECTION_DISASSOCIATE)(
1044   IN EFI_WIRELESS_MAC_CONNECTION_PROTOCOL        *This,
1045   IN EFI_80211_DISASSOCIATE_DATA_TOKEN           *Data
1046   );
1047 
1048 /**
1049   Request the process of establishing an authentication relationship with a peer MAC
1050   entity.
1051 
1052   The Authenticate() function requests authentication with a specified peer MAC entity.
1053   This service might be time-consuming thus is designed to be invoked independently of
1054   the association service.
1055 
1056   @param[in]  This                Pointer to the EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
1057                                   instance.
1058   @param[in]  Data                Pointer to the authentication token.
1059 
1060   @retval EFI_SUCCESS             The operation completed successfully.
1061   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
1062                                   This is NULL.
1063                                   Data is NULL.
1064                                   Data.Data is NULL.
1065   @retval EFI_UNSUPPORTED         One or more of the input parameters are not supported
1066                                   by this implementation.
1067   @retval EFI_ALREADY_STARTED     The authentication process is already started.
1068   @retval EFI_NOT_FOUND           The specified peer MAC entity is not found.
1069   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
1070 **/
1071 typedef
1072 EFI_STATUS
1073 (EFIAPI *EFI_WIRELESS_MAC_CONNECTION_AUTHENTICATE)(
1074   IN EFI_WIRELESS_MAC_CONNECTION_PROTOCOL        *This,
1075   IN EFI_80211_AUTHENTICATE_DATA_TOKEN           *Data
1076   );
1077 
1078 /**
1079   Invalidate the authentication relationship with a peer MAC entity.
1080 
1081   The Deauthenticate() function requests that the authentication relationship with a
1082   specified peer MAC entity be invalidated. Deauthentication is a notification and when
1083   it is sent out the association at the transmitting station is terminated.
1084 
1085   @param[in]  This                Pointer to the EFI_WIRELESS_MAC_CONNECTION_PROTOCOL
1086                                   instance.
1087   @param[in]  Data                Pointer to the deauthentication token.
1088 
1089   @retval EFI_SUCCESS             The operation completed successfully.
1090   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
1091                                   This is NULL.
1092                                   Data is NULL.
1093                                   Data.Data is NULL.
1094   @retval EFI_ALREADY_STARTED     The deauthentication process is already started.
1095   @retval EFI_NOT_READY           The deauthentication service is invoked to a
1096                                   nonexistent association or authentication relationship.
1097   @retval EFI_NOT_FOUND           The specified peer MAC entity is not found.
1098   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
1099 **/
1100 typedef
1101 EFI_STATUS
1102 (EFIAPI *EFI_WIRELESS_MAC_CONNECTION_DEAUTHENTICATE)(
1103   IN EFI_WIRELESS_MAC_CONNECTION_PROTOCOL        *This,
1104   IN EFI_80211_DEAUTHENTICATE_DATA_TOKEN         *Data
1105   );
1106 
1107 ///
1108 /// The EFI_WIRELESS_MAC_CONNECTION_PROTOCOL is designed to provide management service
1109 /// interfaces for the EFI wireless network stack to establish wireless connection with
1110 /// AP. An EFI Wireless MAC Connection Protocol instance will be installed on each
1111 /// communication device that the EFI wireless network stack runs on.
1112 ///
1113 struct _EFI_WIRELESS_MAC_CONNECTION_PROTOCOL {
1114   EFI_WIRELESS_MAC_CONNECTION_SCAN               Scan;
1115   EFI_WIRELESS_MAC_CONNECTION_ASSOCIATE          Associate;
1116   EFI_WIRELESS_MAC_CONNECTION_DISASSOCIATE       Disassociate;
1117   EFI_WIRELESS_MAC_CONNECTION_AUTHENTICATE       Authenticate;
1118   EFI_WIRELESS_MAC_CONNECTION_DEAUTHENTICATE     Deauthenticate;
1119 };
1120 
1121 extern EFI_GUID gEfiWiFiProtocolGuid;
1122 
1123 #endif
1124