1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  *          Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #ifndef MGT_HEADERS_H
24 #define MGT_HEADERS_H
25 
26 #include "ns3/mac48-address.h"
27 #include "status-code.h"
28 #include "capability-information.h"
29 #include "supported-rates.h"
30 #include "ssid.h"
31 #include "ns3/dsss-parameter-set.h"
32 #include "extended-capabilities.h"
33 #include "ns3/ht-capabilities.h"
34 #include "ns3/ht-operation.h"
35 #include "ns3/vht-capabilities.h"
36 #include "ns3/vht-operation.h"
37 #include "ns3/erp-information.h"
38 #include "edca-parameter-set.h"
39 #include "ns3/he-capabilities.h"
40 #include "ns3/he-operation.h"
41 #include "ns3/mu-edca-parameter-set.h"
42 
43 namespace ns3 {
44 
45 /**
46  * \ingroup wifi
47  * Implement the header for management frames of type association request.
48  */
49 class MgtAssocRequestHeader : public Header
50 {
51 public:
52   MgtAssocRequestHeader ();
53   ~MgtAssocRequestHeader ();
54 
55   /**
56    * Set the Service Set Identifier (SSID).
57    *
58    * \param ssid SSID
59    */
60   void SetSsid (Ssid ssid);
61   /**
62    * Set the supported rates.
63    *
64    * \param rates the supported rates
65    */
66   void SetSupportedRates (SupportedRates rates);
67   /**
68    * Set the listen interval.
69    *
70    * \param interval the listen interval
71    */
72   void SetListenInterval (uint16_t interval);
73   /**
74    * Set the Capability information.
75    *
76    * \param capabilities Capability information
77    */
78   void SetCapabilities (CapabilityInformation capabilities);
79   /**
80    * Set the Extended Capabilities.
81    *
82    * \param extendedCapabilities the Extended Capabilities
83    */
84   void SetExtendedCapabilities (ExtendedCapabilities extendedCapabilities);
85   /**
86    * Set the HT capabilities.
87    *
88    * \param htCapabilities HT capabilities
89    */
90   void SetHtCapabilities (HtCapabilities htCapabilities);
91   /**
92    * Set the VHT capabilities.
93    *
94    * \param vhtCapabilities VHT capabilities
95    */
96   void SetVhtCapabilities (VhtCapabilities vhtCapabilities);
97   /**
98    * Set the HE capabilities.
99    *
100    * \param heCapabilities HE capabilities
101    */
102   void SetHeCapabilities (HeCapabilities heCapabilities);
103   /**
104    * Return the Capability information.
105    *
106    * \return Capability information
107    */
108   CapabilityInformation GetCapabilities (void) const;
109   /**
110    * Return the extended capabilities.
111    *
112    * \return the extended capabilities
113    */
114   ExtendedCapabilities GetExtendedCapabilities (void) const;
115   /**
116    * Return the HT capabilities.
117    *
118    * \return HT capabilities
119    */
120   HtCapabilities GetHtCapabilities (void) const;
121   /**
122    * Return the VHT capabilities.
123    *
124    * \return VHT capabilities
125    */
126   VhtCapabilities GetVhtCapabilities (void) const;
127   /**
128    * Return the HE capabilities.
129    *
130    * \return HE capabilities
131    */
132   HeCapabilities GetHeCapabilities (void) const;
133   /**
134    * Return the Service Set Identifier (SSID).
135    *
136    * \return SSID
137    */
138   Ssid GetSsid (void) const;
139   /**
140    * Return the supported rates.
141    *
142    * \return the supported rates
143    */
144   SupportedRates GetSupportedRates (void) const;
145   /**
146    * Return the listen interval.
147    *
148    * \return the listen interval
149    */
150   uint16_t GetListenInterval (void) const;
151 
152   /**
153    * Register this type.
154    * \return The TypeId.
155    */
156   static TypeId GetTypeId (void);
157 
158   TypeId GetInstanceTypeId (void) const override;
159   void Print (std::ostream &os) const override;
160   uint32_t GetSerializedSize (void) const override;
161   void Serialize (Buffer::Iterator start) const override;
162   uint32_t Deserialize (Buffer::Iterator start) override;
163 
164 
165 private:
166   Ssid m_ssid;                        //!< Service Set ID (SSID)
167   SupportedRates m_rates;             //!< List of supported rates
168   CapabilityInformation m_capability; //!< Capability information
169   ExtendedCapabilities m_extendedCapability; //!< Extended capabilities
170   HtCapabilities m_htCapability;      //!< HT capabilities
171   VhtCapabilities m_vhtCapability;    //!< VHT capabilities
172   HeCapabilities m_heCapability;      //!< HE capabilities
173   uint16_t m_listenInterval;          //!< listen interval
174 };
175 
176 
177 /**
178  * \ingroup wifi
179  * Implement the header for management frames of type reassociation request.
180  */
181 class MgtReassocRequestHeader : public Header
182 {
183 public:
184   MgtReassocRequestHeader ();
185   ~MgtReassocRequestHeader ();
186 
187   /**
188    * Set the Service Set Identifier (SSID).
189    *
190    * \param ssid SSID
191    */
192   void SetSsid (Ssid ssid);
193   /**
194    * Set the supported rates.
195    *
196    * \param rates the supported rates
197    */
198   void SetSupportedRates (SupportedRates rates);
199   /**
200    * Set the listen interval.
201    *
202    * \param interval the listen interval
203    */
204   void SetListenInterval (uint16_t interval);
205   /**
206    * Set the Capability information.
207    *
208    * \param capabilities Capability information
209    */
210   void SetCapabilities (CapabilityInformation capabilities);
211   /**
212    * Set the Extended Capabilities.
213    *
214    * \param extendedCapabilities the Extended Capabilities
215    */
216   void SetExtendedCapabilities (ExtendedCapabilities extendedCapabilities);
217   /**
218    * Set the HT capabilities.
219    *
220    * \param htCapabilities HT capabilities
221    */
222   void SetHtCapabilities (HtCapabilities htCapabilities);
223   /**
224    * Set the VHT capabilities.
225    *
226    * \param vhtCapabilities VHT capabilities
227    */
228   void SetVhtCapabilities (VhtCapabilities vhtCapabilities);
229   /**
230    * Set the HE capabilities.
231    *
232    * \param heCapabilities HE capabilities
233    */
234   void SetHeCapabilities (HeCapabilities heCapabilities);
235   /**
236    * Return the Capability information.
237    *
238    * \return Capability information
239    */
240   CapabilityInformation GetCapabilities (void) const;
241   /**
242    * Return the extended capabilities.
243    *
244    * \return the extended capabilities
245    */
246   ExtendedCapabilities GetExtendedCapabilities (void) const;
247   /**
248    * Return the HT capabilities.
249    *
250    * \return HT capabilities
251    */
252   HtCapabilities GetHtCapabilities (void) const;
253   /**
254    * Return the VHT capabilities.
255    *
256    * \return VHT capabilities
257    */
258   VhtCapabilities GetVhtCapabilities (void) const;
259   /**
260    * Return the HE capabilities.
261    *
262    * \return HE capabilities
263    */
264   HeCapabilities GetHeCapabilities (void) const;
265   /**
266    * Return the Service Set Identifier (SSID).
267    *
268    * \return SSID
269    */
270   Ssid GetSsid (void) const;
271   /**
272    * Return the supported rates.
273    *
274    * \return the supported rates
275    */
276   SupportedRates GetSupportedRates (void) const;
277   /**
278    * Return the listen interval.
279    *
280    * \return the listen interval
281    */
282   uint16_t GetListenInterval (void) const;
283   /**
284    * Set the address of the current access point.
285    *
286    * \param currentApAddr address of the current access point
287    */
288   void SetCurrentApAddress (Mac48Address currentApAddr);
289 
290   /**
291    * Register this type.
292    * \return The TypeId.
293    */
294   static TypeId GetTypeId (void);
295   TypeId GetInstanceTypeId (void) const;
296   void Print (std::ostream &os) const;
297   uint32_t GetSerializedSize (void) const;
298   void Serialize (Buffer::Iterator start) const;
299   uint32_t Deserialize (Buffer::Iterator start);
300 
301 
302 private:
303   Mac48Address m_currentApAddr;       //!< Address of the current access point
304   Ssid m_ssid;                        //!< Service Set ID (SSID)
305   SupportedRates m_rates;             //!< List of supported rates
306   CapabilityInformation m_capability; //!< Capability information
307   ExtendedCapabilities m_extendedCapability; //!< Extended capabilities
308   HtCapabilities m_htCapability;      //!< HT capabilities
309   VhtCapabilities m_vhtCapability;    //!< VHT capabilities
310   HeCapabilities m_heCapability;      //!< HE capabilities
311   uint16_t m_listenInterval;          //!< listen interval
312 };
313 
314 
315 /**
316  * \ingroup wifi
317  * Implement the header for management frames of type association and reassociation response.
318  */
319 class MgtAssocResponseHeader : public Header
320 {
321 public:
322   MgtAssocResponseHeader ();
323   ~MgtAssocResponseHeader ();
324 
325   /**
326    * Return the status code.
327    *
328    * \return the status code
329    */
330   StatusCode GetStatusCode (void);
331   /**
332    * Return the supported rates.
333    *
334    * \return the supported rates
335    */
336   SupportedRates GetSupportedRates (void);
337   /**
338    * Return the Capability information.
339    *
340    * \return Capability information
341    */
342   CapabilityInformation GetCapabilities (void) const;
343   /**
344    * Return the extended capabilities.
345    *
346    * \return the extended capabilities
347    */
348   ExtendedCapabilities GetExtendedCapabilities (void) const;
349   /**
350    * Return the HT capabilities.
351    *
352    * \return HT capabilities
353    */
354   HtCapabilities GetHtCapabilities (void) const;
355   /**
356    * Return the HT operation.
357    *
358    * \return HT operation
359    */
360   HtOperation GetHtOperation (void) const;
361   /**
362    * Return the VHT capabilities.
363    *
364    * \return VHT capabilities
365    */
366   VhtCapabilities GetVhtCapabilities (void) const;
367   /**
368    * Return the VHT operation.
369    *
370    * \return VHT operation
371    */
372   VhtOperation GetVhtOperation (void) const;
373   /**
374    * Return the HE capabilities.
375    *
376    * \return HE capabilities
377    */
378   HeCapabilities GetHeCapabilities (void) const;
379   /**
380    * Return the HE operation.
381    *
382    * \return HE operation
383    */
384   HeOperation GetHeOperation (void) const;
385   /**
386    * Return the association ID.
387    *
388    * \return the association ID
389    */
390   uint16_t GetAssociationId (void) const;
391   /**
392    * Return the ERP information.
393    *
394    * \return the ERP information
395    */
396   ErpInformation GetErpInformation (void) const;
397   /**
398    * Return the EDCA Parameter Set.
399    *
400    * \return the EDCA Parameter Set
401    */
402   EdcaParameterSet GetEdcaParameterSet (void) const;
403   /**
404    * Return the MU EDCA Parameter Set.
405    *
406    * \return the MU EDCA Parameter Set
407    */
408   MuEdcaParameterSet GetMuEdcaParameterSet (void) const;
409   /**
410    * Set the Capability information.
411    *
412    * \param capabilities Capability information
413    */
414   void SetCapabilities (CapabilityInformation capabilities);
415   /**
416    * Set the extended capabilities.
417    *
418    * \param extendedCapabilities the extended capabilities
419    */
420   void SetExtendedCapabilities (ExtendedCapabilities extendedCapabilities);
421   /**
422    * Set the VHT operation.
423    *
424    * \param vhtOperation VHT operation
425    */
426   void SetVhtOperation (VhtOperation vhtOperation);
427   /**
428    * Set the VHT capabilities.
429    *
430    * \param vhtCapabilities VHT capabilities
431    */
432   void SetVhtCapabilities (VhtCapabilities vhtCapabilities);
433   /**
434    * Set the HT capabilities.
435    *
436    * \param htCapabilities HT capabilities
437    */
438   void SetHtCapabilities (HtCapabilities htCapabilities);
439   /**
440    * Set the HT operation.
441    *
442    * \param htOperation HT operation
443    */
444   void SetHtOperation (HtOperation htOperation);
445   /**
446    * Set the supported rates.
447    *
448    * \param rates the supported rates
449    */
450   void SetSupportedRates (SupportedRates rates);
451   /**
452    * Set the status code.
453    *
454    * \param code the status code
455    */
456   void SetStatusCode (StatusCode code);
457   /**
458    * Set the association ID.
459    *
460    * \param aid the association ID
461    */
462   void SetAssociationId (uint16_t aid);
463   /**
464    * Set the ERP information.
465    *
466    * \param erpInformation the ERP information
467    */
468   void SetErpInformation (ErpInformation erpInformation);
469   /**
470    * Set the EDCA Parameter Set.
471    *
472    * \param edcaParameterSet the EDCA Parameter Set
473    */
474   void SetEdcaParameterSet (EdcaParameterSet edcaParameterSet);
475   /**
476    * Set the MU EDCA Parameter Set.
477    *
478    * \param muEdcaParameterSet the MU EDCA Parameter Set
479    */
480   void SetMuEdcaParameterSet (MuEdcaParameterSet muEdcaParameterSet);
481   /**
482    * Set the HE capabilities.
483    *
484    * \param heCapabilities HE capabilities
485    */
486   void SetHeCapabilities (HeCapabilities heCapabilities);
487   /**
488    * Set the HE operation.
489    *
490    * \param heOperation HE operation
491    */
492   void SetHeOperation (HeOperation heOperation);
493 
494   /**
495    * Register this type.
496    * \return The TypeId.
497    */
498   static TypeId GetTypeId (void);
499   TypeId GetInstanceTypeId (void) const;
500   void Print (std::ostream &os) const;
501   uint32_t GetSerializedSize (void) const;
502   void Serialize (Buffer::Iterator start) const;
503   uint32_t Deserialize (Buffer::Iterator start);
504 
505 
506 private:
507   SupportedRates m_rates; //!< List of supported rates
508   CapabilityInformation m_capability; //!< Capability information
509   StatusCode m_code; //!< Status code
510   uint16_t m_aid; //!< AID
511   ExtendedCapabilities m_extendedCapability; //!< extended capabilities
512   HtCapabilities m_htCapability; //!< HT capabilities
513   HtOperation m_htOperation; //!< HT operation
514   VhtCapabilities m_vhtCapability; //!< VHT capabilities
515   VhtOperation m_vhtOperation; //!< VHT operation
516   ErpInformation m_erpInformation; //!< ERP information
517   EdcaParameterSet m_edcaParameterSet; //!< EDCA Parameter Set
518   HeCapabilities m_heCapability; //!< HE capabilities
519   HeOperation m_heOperation; //!< HE operation
520   MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set
521 };
522 
523 
524 /**
525  * \ingroup wifi
526  * Implement the header for management frames of type probe request.
527  */
528 class MgtProbeRequestHeader : public Header
529 {
530 public:
531   ~MgtProbeRequestHeader ();
532 
533   /**
534    * Set the Service Set Identifier (SSID).
535    *
536    * \param ssid SSID
537    */
538   void SetSsid (Ssid ssid);
539   /**
540    * Set the supported rates.
541    *
542    * \param rates the supported rates
543    */
544   void SetSupportedRates (SupportedRates rates);
545   /**
546    * Set the extended capabilities.
547    *
548    * \param extendedCapabilities the extended capabilities
549    */
550   void SetExtendedCapabilities (ExtendedCapabilities extendedCapabilities);
551   /**
552    * Set the HT capabilities.
553    *
554    * \param htCapabilities HT capabilities
555    */
556   void SetHtCapabilities (HtCapabilities htCapabilities);
557   /**
558    * Set the VHT capabilities.
559    *
560    * \param vhtCapabilities VHT capabilities
561    */
562   void SetVhtCapabilities (VhtCapabilities vhtCapabilities);
563   /**
564    * Set the HE capabilities.
565    *
566    * \param heCapabilities HE capabilities
567    */
568   void SetHeCapabilities (HeCapabilities heCapabilities);
569   /**
570    * Return the Service Set Identifier (SSID).
571    *
572    * \return SSID
573    */
574   Ssid GetSsid (void) const;
575   /**
576    * Return the supported rates.
577    *
578    * \return the supported rates
579    */
580   SupportedRates GetSupportedRates (void) const;
581   /**
582    * Return the extended capabilities.
583    *
584    * \return the extended capabilities
585    */
586   ExtendedCapabilities GetExtendedCapabilities (void) const;
587   /**
588    * Return the HT capabilities.
589    *
590    * \return HT capabilities
591    */
592   HtCapabilities GetHtCapabilities (void) const;
593   /**
594    * Return the VHT capabilities.
595    *
596    * \return VHT capabilities
597    */
598   VhtCapabilities GetVhtCapabilities (void) const;
599   /**
600    * Return the HE capabilities.
601    *
602    * \return HE capabilities
603    */
604   HeCapabilities GetHeCapabilities (void) const;
605 
606   /**
607    * Register this type.
608    * \return The TypeId.
609    */
610   static TypeId GetTypeId (void);
611   TypeId GetInstanceTypeId (void) const;
612   void Print (std::ostream &os) const;
613   uint32_t GetSerializedSize (void) const;
614   void Serialize (Buffer::Iterator start) const;
615   uint32_t Deserialize (Buffer::Iterator start);
616 
617 
618 private:
619   Ssid m_ssid;                     //!< Service Set ID (SSID)
620   SupportedRates m_rates;          //!< List of supported rates
621   ExtendedCapabilities m_extendedCapability; //!< extended capabilities
622   HtCapabilities m_htCapability;   //!< HT capabilities
623   VhtCapabilities m_vhtCapability; //!< VHT capabilities
624   HeCapabilities m_heCapability; //!< HE capabilities
625 };
626 
627 
628 /**
629  * \ingroup wifi
630  * Implement the header for management frames of type probe response.
631  */
632 class MgtProbeResponseHeader : public Header
633 {
634 public:
635   MgtProbeResponseHeader ();
636   ~MgtProbeResponseHeader ();
637 
638   /**
639    * Return the Service Set Identifier (SSID).
640    *
641    * \return SSID
642    */
643   Ssid GetSsid (void) const;
644   /**
645    * Return the beacon interval in microseconds unit.
646    *
647    * \return beacon interval in microseconds unit
648    */
649   uint64_t GetBeaconIntervalUs (void) const;
650   /**
651    * Return the supported rates.
652    *
653    * \return the supported rates
654    */
655   SupportedRates GetSupportedRates (void) const;
656   /**
657    * Return the Capability information.
658    *
659    * \return Capability information
660    */
661   CapabilityInformation GetCapabilities (void) const;
662   /**
663    * Return the DSSS Parameter Set.
664    *
665    * \return the DSSS Parameter Set
666    */
667   DsssParameterSet GetDsssParameterSet (void) const;
668   /**
669    * Return the extended capabilities.
670    *
671    * \return the extended capabilities
672    */
673   ExtendedCapabilities GetExtendedCapabilities (void) const;
674   /**
675    * Return the HT capabilities.
676    *
677    * \return HT capabilities
678    */
679   HtCapabilities GetHtCapabilities (void) const;
680   /**
681    * Return the HT operation.
682    *
683    * \return HT operation
684    */
685   HtOperation GetHtOperation (void) const;
686   /**
687    * Return the VHT capabilities.
688    *
689    * \return VHT capabilities
690    */
691   VhtCapabilities GetVhtCapabilities (void) const;
692   /**
693    * Return the VHT operation.
694    *
695    * \return VHT operation
696    */
697   VhtOperation GetVhtOperation (void) const;
698   /**
699    * Return the HE capabilities.
700    *
701    * \return HE capabilities
702    */
703   HeCapabilities GetHeCapabilities (void) const;
704   /**
705    * Return the HE operation.
706    *
707    * \return HE operation
708    */
709   HeOperation GetHeOperation (void) const;
710   /**
711    * Return the ERP information.
712    *
713    * \return the ERP information
714    */
715   ErpInformation GetErpInformation (void) const;
716   /**
717    * Return the EDCA Parameter Set.
718    *
719    * \return the EDCA Parameter Set
720    */
721   EdcaParameterSet GetEdcaParameterSet (void) const;
722   /**
723    * Return the MU EDCA Parameter Set.
724    *
725    * \return the MU EDCA Parameter Set
726    */
727   MuEdcaParameterSet GetMuEdcaParameterSet (void) const;
728   /**
729    * Set the Capability information.
730    *
731    * \param capabilities Capability information
732    */
733   void SetCapabilities (CapabilityInformation capabilities);
734   /**
735    * Set the extended capabilities.
736    *
737    * \param extendedCapabilities the extended capabilities
738    */
739   void SetExtendedCapabilities (ExtendedCapabilities extendedCapabilities);
740   /**
741    * Set the HT capabilities.
742    *
743    * \param htCapabilities HT capabilities
744    */
745   void SetHtCapabilities (HtCapabilities htCapabilities);
746   /**
747    * Set the HT operation.
748    *
749    * \param htOperation HT operation
750    */
751   void SetHtOperation (HtOperation htOperation);
752   /**
753    * Set the VHT capabilities.
754    *
755    * \param vhtCapabilities VHT capabilities
756    */
757   void SetVhtCapabilities (VhtCapabilities vhtCapabilities);
758   /**
759    * Set the VHT operation.
760    *
761    * \param vhtOperation VHT operation
762    */
763   void SetVhtOperation (VhtOperation vhtOperation);
764   /**
765    * Set the HE capabilities.
766    *
767    * \param heCapabilities HE capabilities
768    */
769   void SetHeCapabilities (HeCapabilities heCapabilities);
770   /**
771    * Set the HE operation.
772    *
773    * \param heOperation HE operation
774    */
775   void SetHeOperation (HeOperation heOperation);
776   /**
777    * Set the Service Set Identifier (SSID).
778    *
779    * \param ssid SSID
780    */
781   void SetSsid (Ssid ssid);
782   /**
783    * Set the beacon interval in microseconds unit.
784    *
785    * \param us beacon interval in microseconds unit
786    */
787   void SetBeaconIntervalUs (uint64_t us);
788   /**
789    * Set the supported rates.
790    *
791    * \param rates the supported rates
792    */
793   void SetSupportedRates (SupportedRates rates);
794   /**
795    * Set the DSSS Parameter Set.
796    *
797    * \param dsssParameterSet the DSSS Parameter Set
798    */
799   void SetDsssParameterSet (DsssParameterSet dsssParameterSet);
800   /**
801    * Set the ERP information.
802    *
803    * \param erpInformation the ERP information
804    */
805   void SetErpInformation (ErpInformation erpInformation);
806   /**
807    * Set the EDCA Parameter Set.
808    *
809    * \param edcaParameterSet the EDCA Parameter Set
810    */
811   void SetEdcaParameterSet (EdcaParameterSet edcaParameterSet);
812   /**
813    * Set the MU EDCA Parameter Set.
814    *
815    * \param muEdcaParameterSet the MU EDCA Parameter Set
816    */
817   void SetMuEdcaParameterSet (MuEdcaParameterSet muEdcaParameterSet);
818   /**
819    * Return the time stamp.
820    *
821    * \return time stamp
822    */
823   uint64_t GetTimestamp ();
824 
825   /**
826    * Register this type.
827    * \return The TypeId.
828    */
829   static TypeId GetTypeId (void);
830   TypeId GetInstanceTypeId (void) const;
831   void Print (std::ostream &os) const;
832   uint32_t GetSerializedSize (void) const;
833   void Serialize (Buffer::Iterator start) const;
834   uint32_t Deserialize (Buffer::Iterator start);
835 
836 
837 private:
838   uint64_t m_timestamp;                //!< Timestamp
839   Ssid m_ssid;                         //!< Service set ID (SSID)
840   uint64_t m_beaconInterval;           //!< Beacon interval
841   SupportedRates m_rates;              //!< List of supported rates
842   CapabilityInformation m_capability;  //!< Capability information
843   DsssParameterSet m_dsssParameterSet; //!< DSSS Parameter Set
844   ExtendedCapabilities m_extendedCapability; //!< extended capabilities
845   HtCapabilities m_htCapability;       //!< HT capabilities
846   HtOperation m_htOperation;           //!< HT operation
847   VhtCapabilities m_vhtCapability;     //!< VHT capabilities
848   VhtOperation m_vhtOperation;         //!< VHT operation
849   HeCapabilities m_heCapability;       //!< HE capabilities
850   HeOperation m_heOperation;         //!< HE operation
851   ErpInformation m_erpInformation;     //!< ERP information
852   EdcaParameterSet m_edcaParameterSet; //!< EDCA Parameter Set
853   MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set
854 };
855 
856 
857 /**
858  * \ingroup wifi
859  * Implement the header for management frames of type beacon.
860  */
861 class MgtBeaconHeader : public MgtProbeResponseHeader
862 {
863 public:
864   /** Register this type. */
865   /**
866    * Register this type.
867    * \return The TypeId.
868    */
869   static TypeId GetTypeId (void);
870 };
871 
872 
873 /****************************
874 *     Action frames
875 *****************************/
876 
877 /**
878  * \ingroup wifi
879  *
880  * See IEEE 802.11 chapter 7.3.1.11
881  * Header format: | category: 1 | action value: 1 |
882  *
883  */
884 class WifiActionHeader : public Header
885 {
886 public:
887   WifiActionHeader ();
888   ~WifiActionHeader ();
889 
890   /*
891    * Compatible with table 8-38 IEEE 802.11, Part11, (Year 2012)
892    * Category values - see 802.11-2012 Table 8-38
893    */
894 
895   ///CategoryValue enumeration
896   enum CategoryValue //table 8-38 staring from IEEE 802.11, Part11, (Year 2012)
897   {
898     BLOCK_ACK = 3,
899     MESH = 13,                  //Category: Mesh
900     MULTIHOP = 14,              //not used so far
901     SELF_PROTECTED = 15,        //Category: Self Protected
902     //Since vendor specific action has no stationary Action value,the parse process is not here.
903     //Refer to vendor-specific-action in wave module.
904     VENDOR_SPECIFIC_ACTION = 127,
905   };
906 
907   ///SelfProtectedActionValue enumeration
908   enum SelfProtectedActionValue //Category: 15 (Self Protected)
909   {
910     PEER_LINK_OPEN = 1,         //Mesh Peering Open
911     PEER_LINK_CONFIRM = 2,      //Mesh Peering Confirm
912     PEER_LINK_CLOSE = 3,        //Mesh Peering Close
913     GROUP_KEY_INFORM = 4,       //Mesh Group Key Inform
914     GROUP_KEY_ACK = 5,          //Mesh Group Key Acknowledge
915   };
916 
917   ///MultihopActionValue enumeration
918   enum MultihopActionValue
919   {
920     PROXY_UPDATE = 0,                   //not used so far
921     PROXY_UPDATE_CONFIRMATION = 1,      //not used so far
922   };
923 
924   ///MeshActionValue enumeration
925   enum MeshActionValue
926   {
927     LINK_METRIC_REPORT = 0,               //Action Value:0 in Category 13: Mesh
928     PATH_SELECTION = 1,                   //Action Value:1 in Category 13: Mesh
929     PORTAL_ANNOUNCEMENT = 2,              //Action Value:2 in Category 13: Mesh
930     CONGESTION_CONTROL_NOTIFICATION = 3,  //Action Value:3 in Category 13: Mesh
931     MDA_SETUP_REQUEST = 4,                //Action Value:4 in Category 13: Mesh MCCA-Setup-Request (not used so far)
932     MDA_SETUP_REPLY = 5,                  //Action Value:5 in Category 13: Mesh MCCA-Setup-Reply (not used so far)
933     MDAOP_ADVERTISMENT_REQUEST = 6,       //Action Value:6 in Category 13: Mesh MCCA-Advertisement-Request (not used so far)
934     MDAOP_ADVERTISMENTS = 7,              //Action Value:7 in Category 13: Mesh (not used so far)
935     MDAOP_SET_TEARDOWN = 8,               //Action Value:8 in Category 13: Mesh (not used so far)
936     TBTT_ADJUSTMENT_REQUEST = 9,          //Action Value:9 in Category 13: Mesh (not used so far)
937     TBTT_ADJUSTMENT_RESPONSE = 10,        //Action Value:10 in Category 13: Mesh (not used so far)
938   };
939 
940   /**
941    * Block Ack Action field values
942    * See 802.11 Table 8-202
943    */
944   enum BlockAckActionValue
945   {
946     BLOCK_ACK_ADDBA_REQUEST = 0,
947     BLOCK_ACK_ADDBA_RESPONSE = 1,
948     BLOCK_ACK_DELBA = 2
949   };
950 
951 
952   /**
953    * typedef for union of different ActionValues
954    */
955   typedef union
956   {
957     MeshActionValue meshAction; ///< mesh action
958     MultihopActionValue multihopAction; ///< multi hop action
959     SelfProtectedActionValue selfProtectedAction; ///< self protected action
960     BlockAckActionValue blockAck; ///< block ack
961   } ActionValue; ///< the action value
962   /**
963    * Set action for this Action header.
964    *
965    * \param type category
966    * \param action action
967    */
968   void SetAction (CategoryValue type, ActionValue action);
969 
970   /**
971    * Return the category value.
972    *
973    * \return CategoryValue
974    */
975   CategoryValue GetCategory ();
976   /**
977    * Return the action value.
978    *
979    * \return ActionValue
980    */
981   ActionValue GetAction ();
982 
983   /**
984    * Register this type.
985    * \return The TypeId.
986    */
987   static TypeId GetTypeId (void);
988   TypeId GetInstanceTypeId () const;
989   void Print (std::ostream &os) const;
990   uint32_t GetSerializedSize () const;
991   void Serialize (Buffer::Iterator start) const;
992   uint32_t Deserialize (Buffer::Iterator start);
993 
994 
995 private:
996   /**
997    * Category value to string function
998    * \param value the category value
999    * \returns the category value string
1000    */
1001   std::string CategoryValueToString (CategoryValue value) const;
1002   /**
1003    * Self protected action value to string function
1004    * \param value the protected action value
1005    * \returns the self protected action value string
1006    */
1007   std::string SelfProtectedActionValueToString (SelfProtectedActionValue value) const;
1008   uint8_t m_category; //!< Category of the action
1009   uint8_t m_actionValue; //!< Action value
1010 };
1011 
1012 
1013 /**
1014  * \ingroup wifi
1015  * Implement the header for management frames of type Add Block Ack request.
1016  */
1017 class MgtAddBaRequestHeader : public Header
1018 {
1019 public:
1020   MgtAddBaRequestHeader ();
1021 
1022   /**
1023    * Register this type.
1024    * \return The TypeId.
1025    */
1026   static TypeId GetTypeId (void);
1027   TypeId GetInstanceTypeId (void) const;
1028   void Print (std::ostream &os) const;
1029   uint32_t GetSerializedSize (void) const;
1030   void Serialize (Buffer::Iterator start) const;
1031   uint32_t Deserialize (Buffer::Iterator start);
1032 
1033   /**
1034    * Enable delayed BlockAck.
1035    */
1036   void SetDelayedBlockAck ();
1037   /**
1038    * Enable immediate BlockAck
1039    */
1040   void SetImmediateBlockAck ();
1041   /**
1042    * Set Traffic ID (TID).
1043    *
1044    * \param tid traffic ID
1045    */
1046   void SetTid (uint8_t tid);
1047   /**
1048    * Set timeout.
1049    *
1050    * \param timeout timeout
1051    */
1052   void SetTimeout (uint16_t timeout);
1053   /**
1054    * Set buffer size.
1055    *
1056    * \param size buffer size
1057    */
1058   void SetBufferSize (uint16_t size);
1059   /**
1060    * Set the starting sequence number.
1061    *
1062    * \param seq the starting sequence number
1063    */
1064   void SetStartingSequence (uint16_t seq);
1065   /**
1066    * Enable or disable A-MSDU support.
1067    *
1068    * \param supported enable or disable A-MSDU support
1069    */
1070   void SetAmsduSupport (bool supported);
1071 
1072   /**
1073    * Return the starting sequence number.
1074    *
1075    * \return the starting sequence number
1076    */
1077   uint16_t GetStartingSequence (void) const;
1078   /**
1079    * Return the Traffic ID (TID).
1080    *
1081    * \return TID
1082    */
1083   uint8_t GetTid (void) const;
1084   /**
1085    * Return whether the Block Ack policy is immediate Block Ack.
1086    *
1087    * \return true if immediate Block Ack is being used, false otherwise
1088    */
1089   bool IsImmediateBlockAck (void) const;
1090   /**
1091    * Return the timeout.
1092    *
1093    * \return timeout
1094    */
1095   uint16_t GetTimeout (void) const;
1096   /**
1097    * Return the buffer size.
1098    *
1099    * \return the buffer size.
1100    */
1101   uint16_t GetBufferSize (void) const;
1102   /**
1103    * Return whether A-MSDU capability is supported.
1104    *
1105    * \return true is A-MSDU is supported, false otherwise
1106    */
1107   bool IsAmsduSupported (void) const;
1108 
1109 private:
1110   /**
1111    * Return the raw parameter set.
1112    *
1113    * \return the raw parameter set
1114    */
1115   uint16_t GetParameterSet (void) const;
1116   /**
1117    * Set the parameter set from the given raw value.
1118    *
1119    * \param params raw parameter set value
1120    */
1121   void SetParameterSet (uint16_t params);
1122   /**
1123    * Return the raw sequence control.
1124    *
1125    * \return the raw sequence control
1126    */
1127   uint16_t GetStartingSequenceControl (void) const;
1128   /**
1129    * Set sequence control with the given raw value.
1130    *
1131    * \param seqControl the raw sequence control
1132    */
1133   void SetStartingSequenceControl (uint16_t seqControl);
1134 
1135   uint8_t m_dialogToken;   //!< Not used for now
1136   uint8_t m_amsduSupport;  //!< Flag if A-MSDU is supported
1137   uint8_t m_policy;        //!< Block Ack policy
1138   uint8_t m_tid;           //!< Traffic ID
1139   uint16_t m_bufferSize;   //!< Buffer size
1140   uint16_t m_timeoutValue; //!< Timeout
1141   uint16_t m_startingSeq;  //!< Starting sequence number
1142 };
1143 
1144 
1145 /**
1146  * \ingroup wifi
1147  * Implement the header for management frames of type Add Block Ack response.
1148  */
1149 class MgtAddBaResponseHeader : public Header
1150 {
1151 public:
1152   MgtAddBaResponseHeader ();
1153 
1154   /**
1155    * Register this type.
1156    * \return The TypeId.
1157    */
1158   static TypeId GetTypeId (void);
1159   TypeId GetInstanceTypeId (void) const;
1160   void Print (std::ostream &os) const;
1161   uint32_t GetSerializedSize (void) const;
1162   void Serialize (Buffer::Iterator start) const;
1163   uint32_t Deserialize (Buffer::Iterator start);
1164 
1165   /**
1166    * Enable delayed BlockAck.
1167    */
1168   void SetDelayedBlockAck ();
1169   /**
1170    * Enable immediate BlockAck.
1171    */
1172   void SetImmediateBlockAck ();
1173   /**
1174    * Set Traffic ID (TID).
1175    *
1176    * \param tid traffic ID
1177    */
1178   void SetTid (uint8_t tid);
1179   /**
1180    * Set timeout.
1181    *
1182    * \param timeout timeout
1183    */
1184   void SetTimeout (uint16_t timeout);
1185   /**
1186    * Set buffer size.
1187    *
1188    * \param size buffer size
1189    */
1190   void SetBufferSize (uint16_t size);
1191   /**
1192    * Set the status code.
1193    *
1194    * \param code the status code
1195    */
1196   void SetStatusCode (StatusCode code);
1197   /**
1198    * Enable or disable A-MSDU support.
1199    *
1200    * \param supported enable or disable A-MSDU support
1201    */
1202   void SetAmsduSupport (bool supported);
1203 
1204   /**
1205    * Return the status code.
1206    *
1207    * \return the status code
1208    */
1209   StatusCode GetStatusCode (void) const;
1210   /**
1211    * Return the Traffic ID (TID).
1212    *
1213    * \return TID
1214    */
1215   uint8_t GetTid (void) const;
1216   /**
1217    * Return whether the Block Ack policy is immediate Block Ack.
1218    *
1219    * \return true if immediate Block Ack is being used, false otherwise
1220    */
1221   bool IsImmediateBlockAck (void) const;
1222   /**
1223    * Return the timeout.
1224    *
1225    * \return timeout
1226    */
1227   uint16_t GetTimeout (void) const;
1228   /**
1229    * Return the buffer size.
1230    *
1231    * \return the buffer size.
1232    */
1233   uint16_t GetBufferSize (void) const;
1234   /**
1235    * Return whether A-MSDU capability is supported.
1236    *
1237    * \return true is A-MSDU is supported, false otherwise
1238    */
1239   bool IsAmsduSupported (void) const;
1240 
1241 
1242 private:
1243   /**
1244    * Return the raw parameter set.
1245    *
1246    * \return the raw parameter set
1247    */
1248   uint16_t GetParameterSet (void) const;
1249   /**
1250    * Set the parameter set from the given raw value.
1251    *
1252    * \param params raw parameter set value
1253    */
1254   void SetParameterSet (uint16_t params);
1255 
1256   uint8_t m_dialogToken;   //!< Not used for now
1257   StatusCode m_code;       //!< Status code
1258   uint8_t m_amsduSupport;  //!< Flag if A-MSDU is supported
1259   uint8_t m_policy;        //!< Block ACK policy
1260   uint8_t m_tid;           //!< Traffic ID
1261   uint16_t m_bufferSize;   //!< Buffer size
1262   uint16_t m_timeoutValue; //!< Timeout
1263 };
1264 
1265 
1266 /**
1267  * \ingroup wifi
1268  * Implement the header for management frames of type Delete Block Ack.
1269  */
1270 class MgtDelBaHeader : public Header
1271 {
1272 public:
1273   MgtDelBaHeader ();
1274 
1275   /**
1276    * Register this type.
1277    * \return The TypeId.
1278    */
1279   static TypeId GetTypeId (void);
1280 
1281   TypeId GetInstanceTypeId (void) const;
1282   void Print (std::ostream &os) const;
1283   uint32_t GetSerializedSize (void) const;
1284   void Serialize (Buffer::Iterator start) const;
1285   uint32_t Deserialize (Buffer::Iterator start);
1286 
1287   /**
1288    * Check if the initiator bit in the DELBA is set.
1289    *
1290    * \return true if the initiator bit in the DELBA is set,
1291    *         false otherwise
1292    */
1293   bool IsByOriginator (void) const;
1294   /**
1295    * Return the Traffic ID (TID).
1296    *
1297    * \return TID
1298    */
1299   uint8_t GetTid (void) const;
1300   /**
1301    * Set Traffic ID (TID).
1302    *
1303    * \param tid traffic ID
1304    */
1305   void SetTid (uint8_t tid);
1306   /**
1307    * Set the initiator bit in the DELBA.
1308    */
1309   void SetByOriginator (void);
1310   /**
1311    * Un-set the initiator bit in the DELBA.
1312    */
1313   void SetByRecipient (void);
1314 
1315 
1316 private:
1317   /**
1318    * Return the raw parameter set.
1319    *
1320    * \return the raw parameter set
1321    */
1322   uint16_t GetParameterSet (void) const;
1323   /**
1324    * Set the parameter set from the given raw value.
1325    *
1326    * \param params raw parameter set value
1327    */
1328   void SetParameterSet (uint16_t params);
1329 
1330   uint16_t m_initiator; //!< initiator
1331   uint16_t m_tid; //!< Traffic ID
1332   uint16_t m_reasonCode; //!< Not used for now. Always set to 1: "Unspecified reason"
1333 };
1334 
1335 } //namespace ns3
1336 
1337 #endif /* MGT_HEADERS_H */
1338