A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
he-6ghz-band-capabilities.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Rami Abdallah <abdallah.rami@gmail.com>
18 */
19
21
22namespace ns3
23{
24
26 : m_capabilitiesInfo{}
27{
28}
29
32{
33 return IE_EXTENSION;
34}
35
38{
40}
41
42uint16_t
44{
45 // Return size of Element ID Extension and
46 // Capabilities Information field in octets
47 return 1 + /* Element ID Ext */ +2 /* Capabilities Information */;
48}
49
50void
52{
53 for (uint8_t i = 0; i <= 7; i++)
54 {
55 if ((1UL << (13 + i)) - 1 == maxAmpduLength)
56 {
58 return;
59 }
60 }
61 NS_ABORT_MSG("Invalid A-MPDU Max Length value");
62}
63
66{
67 return (1UL << (13 + m_capabilitiesInfo.m_maxAmpduLengthExponent)) - 1;
68}
69
70void
72{
73 NS_ABORT_MSG_IF(length != 3895 && length != 7991 && length != 11454,
74 "Invalid MPDU Max Length value");
75 if (length == 11454)
76 {
78 }
79 else if (length == 7991)
80 {
82 }
83 else
84 {
86 }
87}
88
89uint16_t
91{
93 {
94 return 3895;
95 }
97 {
98 return 7991;
99 }
101 {
102 return 11454;
103 }
104 NS_ABORT_MSG("The value 3 is reserved");
105}
106
107void
109{
110 uint16_t twoBytes = m_capabilitiesInfo.m_minMpduStartSpacing |
117 start.WriteHtolsbU16(twoBytes);
118}
119
120uint16_t
122{
123 Buffer::Iterator tmp = start;
124 uint16_t twoBytes = start.ReadLsbtohU16();
126 m_capabilitiesInfo.m_maxAmpduLengthExponent = (twoBytes >> 3) & 0x07;
127 m_capabilitiesInfo.m_maxMpduLength = (twoBytes >> 6) & 0x03;
128 m_capabilitiesInfo.m_smPowerSave = (twoBytes >> 9) & 0x03;
129 m_capabilitiesInfo.m_rdResponder = (twoBytes >> 11) & 0x01;
130 m_capabilitiesInfo.m_rxAntennaPatternConsistency = (twoBytes >> 12) & 0x01;
131 m_capabilitiesInfo.m_txAntennaPatternConsistency = (twoBytes >> 13) & 0x01;
132 return start.GetDistanceFrom(tmp);
133}
134
135void
136He6GhzBandCapabilities::Print(std::ostream& os) const
137{
138 os << "HE 6GHz Band Capabilities=[Capabilities Information|"
139 << " Min MPDU start spacing: " << +m_capabilitiesInfo.m_minMpduStartSpacing
140 << " Max A-MPDU Length Exp: " << +m_capabilitiesInfo.m_maxAmpduLengthExponent
141 << " Max MPDU Length: " << +m_capabilitiesInfo.m_maxMpduLength
142 << " SM Power Save: " << +m_capabilitiesInfo.m_smPowerSave
143 << " RD Responder: " << +m_capabilitiesInfo.m_rdResponder
144 << " RX Antenna Pattern: " << +m_capabilitiesInfo.m_rxAntennaPatternConsistency
145 << " TX Antenna Pattern: " << +m_capabilitiesInfo.m_txAntennaPatternConsistency << "]";
146}
147
148} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
uint32_t GetMaxAmpduLength() const
Return the maximum A-MPDU length.
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
void Print(std::ostream &os) const override
Generate human-readable form of IE.
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint16_t GetMaxMpduLength() const
Get the maximum MPDU length.
CapabilitiesInfo m_capabilitiesInfo
capabilities field
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t m_maxAmpduLengthExponent
Maximum A-MPDU Length Exponent (can also be set via convenient methods)
uint8_t m_maxMpduLength
Maximum MPDU Length (can also be set via convenient methods)
uint8_t m_minMpduStartSpacing
Minimum MPDU Start Spacing.
uint8_t m_rxAntennaPatternConsistency
Receive Antenna Pattern Consistency.
uint8_t m_txAntennaPatternConsistency
Transmit Antenna Pattern Consistency.
#define IE_EXTENSION
#define IE_EXT_HE_6GHZ_CAPABILITIES