|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2013 |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Ghada Badawy <gbadawy@gmail.com> |
|
19 */ |
|
20 #ifndef HT_CAPABILITIES_H |
|
21 #define HT_CAPABILITIES_H |
|
22 |
|
23 #include <stdint.h> |
|
24 #include "ns3/buffer.h" |
|
25 #include "ns3/attribute-helper.h" |
|
26 #include "ns3/wifi-information-element.h" |
|
27 |
|
28 /** |
|
29 * This defines the maximum number of supported MCSs that a STA is |
|
30 * allowed to have. Currently this number is set for IEEE 802.11n |
|
31 */ |
|
32 #define MAX_SUPPORTED_MCS (77) |
|
33 |
|
34 namespace ns3 { |
|
35 |
|
36 /** |
|
37 * \brief The Ht Capabilities Information Element |
|
38 * \ingroup wifi |
|
39 * |
|
40 * This class knows how to serialise and deserialise the Ht Capabilities Information Element |
|
41 */ |
|
42 class HtCapabilities: public WifiInformationElement |
|
43 { |
|
44 public: |
|
45 HtCapabilities (); |
|
46 void SetLdpc (uint8_t ldpc); |
|
47 void SetSupportedChannelWidth (uint8_t supportedchannelwidth); |
|
48 void SetGreenfield (uint8_t greenfield); |
|
49 void SetShortGuardInterval20(uint8_t shortguardinterval); |
|
50 void SetHtCapabilitiesInfo(uint16_t ctrl); |
|
51 void SetAmpduParameters (uint8_t ctrl); |
|
52 void SetSupportedMcsSet (uint64_t ctrl1, uint64_t ctrl2); |
|
53 void SetHtSupported(uint8_t htsupported); |
|
54 void SetRxMcsBitmask(uint8_t index); |
|
55 bool IsSupportedMcs (uint8_t mcs); |
|
56 //returns the HT Capabilties info field in the HT Capabilities information element |
|
57 uint16_t GetHtCapabilitiesInfo (void) const; |
|
58 //returns the Ampdu parameters field in the HT Capabilities information element |
|
59 uint8_t GetAmpduParameters (void) const; |
|
60 //returns the first 64bytes of the Supported MCS field in the HT Capabilities information element |
|
61 uint64_t GetSupportedMcsSet1 (void) const; |
|
62 //returns the first 64bytes of the Supported MCS field in the HT Capabilities information element |
|
63 uint64_t GetSupportedMcsSet2 (void) const; |
|
64 uint8_t GetLdpc (void) const; |
|
65 uint8_t GetGreenfield (void) const; |
|
66 uint8_t GetShortGuardInterval20 (void) const; |
|
67 uint8_t GetSupportedChannelWidth (void) const; //2040 supported or not |
|
68 uint8_t ConvertToUint8 () const; |
|
69 uint8_t* GetRxMcsBitmask(); |
|
70 |
|
71 WifiInformationElementId ElementId () const; |
|
72 uint8_t GetInformationFieldSize () const; |
|
73 void SerializeInformationField (Buffer::Iterator start) const; |
|
74 uint8_t DeserializeInformationField (Buffer::Iterator start, |
|
75 uint8_t length); |
|
76 /* |
|
77 * This information element is a bit special in that it is only |
|
78 * included if the STA is an HT STA. To support this we |
|
79 * override the Serialize and GetSerializedSize methods of |
|
80 * WifiInformationElement. |
|
81 */ |
|
82 Buffer::Iterator Serialize (Buffer::Iterator start) const; |
|
83 uint16_t GetSerializedSize () const; |
|
84 |
|
85 private: |
|
86 uint8_t m_ldpc; |
|
87 uint8_t m_supportedChannelWidth; |
|
88 uint8_t m_smPowerSave; |
|
89 uint8_t m_greenField; |
|
90 uint8_t m_shortGuardInterval20; |
|
91 uint8_t m_shortGuardInterval40; |
|
92 uint8_t m_txStbc; |
|
93 uint8_t m_rxStbc; |
|
94 uint8_t m_htDelayedBlockAck; |
|
95 uint8_t m_maxAmsduLength; |
|
96 uint8_t m_dssMode40; |
|
97 uint8_t m_reserved; |
|
98 uint8_t m_fortyMhzIntolerant; |
|
99 uint8_t m_lsigProtectionSupport; |
|
100 uint8_t m_maxAmpduLength; |
|
101 uint8_t m_minMpduStartSpace; |
|
102 uint8_t m_ampduReserved; |
|
103 uint8_t m_reservedMcsSet1; |
|
104 uint16_t m_rxHighestSupportedDataRate; |
|
105 uint8_t m_reservedMcsSet2; |
|
106 uint8_t m_txMcsSetDefined; |
|
107 uint8_t m_txRxMcsSetUnequal; |
|
108 uint8_t m_txMaxNSpatialStreams; |
|
109 uint8_t m_txUnequalModulation; |
|
110 uint32_t m_reservedMcsSet3; |
|
111 uint8_t m_rxMcsBitmask[MAX_SUPPORTED_MCS]; |
|
112 //this is used to decide if this element should be added to the frame or not |
|
113 uint8_t m_htSupported; |
|
114 }; |
|
115 |
|
116 std::ostream &operator << (std::ostream &os, const HtCapabilities &htcapabilities); |
|
117 std::istream &operator >> (std::istream &is, HtCapabilities &htcapabilities); |
|
118 |
|
119 ATTRIBUTE_HELPER_HEADER (HtCapabilities) |
|
120 |
|
121 } // namespace ns3 |
|
122 |
|
123 #endif /* HT_CAPABILITY_H */ |