A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
he-6ghz-band-capabilities.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Rami Abdallah <abdallah.rami@gmail.com>
7
*/
8
9
#include "
he-6ghz-band-capabilities.h
"
10
11
namespace
ns3
12
{
13
14
He6GhzBandCapabilities::He6GhzBandCapabilities
()
15
:
m_capabilitiesInfo
{}
16
{
17
}
18
19
WifiInformationElementId
20
He6GhzBandCapabilities::ElementId
()
const
21
{
22
return
IE_EXTENSION
;
23
}
24
25
WifiInformationElementId
26
He6GhzBandCapabilities::ElementIdExt
()
const
27
{
28
return
IE_EXT_HE_6GHZ_CAPABILITIES
;
29
}
30
31
uint16_t
32
He6GhzBandCapabilities::GetInformationFieldSize
()
const
33
{
34
// Return size of Element ID Extension and
35
// Capabilities Information field in octets
36
return
1 +
/* Element ID Ext */
+2
/* Capabilities Information */
;
37
}
38
39
void
40
He6GhzBandCapabilities::SetMaxAmpduLength
(
uint32_t
maxAmpduLength)
41
{
42
for
(uint8_t i = 0; i <= 7; i++)
43
{
44
if
((1UL << (13 + i)) - 1 == maxAmpduLength)
45
{
46
m_capabilitiesInfo
.m_maxAmpduLengthExponent = i;
47
return
;
48
}
49
}
50
NS_ABORT_MSG
(
"Invalid A-MPDU Max Length value"
);
51
}
52
53
uint32_t
54
He6GhzBandCapabilities::GetMaxAmpduLength
()
const
55
{
56
return
(1UL << (13 +
m_capabilitiesInfo
.m_maxAmpduLengthExponent)) - 1;
57
}
58
59
void
60
He6GhzBandCapabilities::SetMaxMpduLength
(uint16_t length)
61
{
62
NS_ABORT_MSG_IF
(length != 3895 && length != 7991 && length != 11454,
63
"Invalid MPDU Max Length value"
);
64
if
(length == 11454)
65
{
66
m_capabilitiesInfo
.m_maxMpduLength = 2;
67
}
68
else
if
(length == 7991)
69
{
70
m_capabilitiesInfo
.m_maxMpduLength = 1;
71
}
72
else
73
{
74
m_capabilitiesInfo
.m_maxMpduLength = 0;
75
}
76
}
77
78
uint16_t
79
He6GhzBandCapabilities::GetMaxMpduLength
()
const
80
{
81
if
(
m_capabilitiesInfo
.m_maxMpduLength == 0)
82
{
83
return
3895;
84
}
85
if
(
m_capabilitiesInfo
.m_maxMpduLength == 1)
86
{
87
return
7991;
88
}
89
if
(
m_capabilitiesInfo
.m_maxMpduLength == 2)
90
{
91
return
11454;
92
}
93
NS_ABORT_MSG
(
"The value 3 is reserved"
);
94
}
95
96
void
97
He6GhzBandCapabilities::SerializeInformationField
(
Buffer::Iterator
start)
const
98
{
99
uint16_t twoBytes =
m_capabilitiesInfo
.m_minMpduStartSpacing |
100
(
m_capabilitiesInfo
.m_maxAmpduLengthExponent << 3) |
101
(
m_capabilitiesInfo
.m_maxMpduLength << 6) |
102
(
m_capabilitiesInfo
.m_smPowerSave << 9) |
103
(
m_capabilitiesInfo
.m_rdResponder << 11) |
104
(
m_capabilitiesInfo
.m_rxAntennaPatternConsistency << 12) |
105
(
m_capabilitiesInfo
.m_txAntennaPatternConsistency << 13);
106
start.WriteHtolsbU16(twoBytes);
107
}
108
109
uint16_t
110
He6GhzBandCapabilities::DeserializeInformationField
(
Buffer::Iterator
start, uint16_t length)
111
{
112
Buffer::Iterator
tmp = start;
113
uint16_t twoBytes = start.ReadLsbtohU16();
114
m_capabilitiesInfo
.m_minMpduStartSpacing = twoBytes & 0x07;
115
m_capabilitiesInfo
.m_maxAmpduLengthExponent = (twoBytes >> 3) & 0x07;
116
m_capabilitiesInfo
.m_maxMpduLength = (twoBytes >> 6) & 0x03;
117
m_capabilitiesInfo
.m_smPowerSave = (twoBytes >> 9) & 0x03;
118
m_capabilitiesInfo
.m_rdResponder = (twoBytes >> 11) & 0x01;
119
m_capabilitiesInfo
.m_rxAntennaPatternConsistency = (twoBytes >> 12) & 0x01;
120
m_capabilitiesInfo
.m_txAntennaPatternConsistency = (twoBytes >> 13) & 0x01;
121
return
start.GetDistanceFrom(tmp);
122
}
123
124
void
125
He6GhzBandCapabilities::Print
(std::ostream& os)
const
126
{
127
os <<
"HE 6GHz Band Capabilities=["
128
<<
"Min MPDU start spacing: "
<< +
m_capabilitiesInfo
.m_minMpduStartSpacing
129
<<
", Max A-MPDU Length Exp: "
<< +
m_capabilitiesInfo
.m_maxAmpduLengthExponent
130
<<
", Max MPDU Length: "
<< +
m_capabilitiesInfo
.m_maxMpduLength
131
<<
", SM Power Save: "
<< +
m_capabilitiesInfo
.m_smPowerSave
132
<<
", RD Responder: "
<< +
m_capabilitiesInfo
.m_rdResponder
133
<<
", RX Antenna Pattern: "
<< +
m_capabilitiesInfo
.m_rxAntennaPatternConsistency
134
<<
", TX Antenna Pattern: "
<< +
m_capabilitiesInfo
.m_txAntennaPatternConsistency <<
"]"
;
135
}
136
137
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::He6GhzBandCapabilities::GetInformationFieldSize
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
Definition
he-6ghz-band-capabilities.cc:32
ns3::He6GhzBandCapabilities::GetMaxAmpduLength
uint32_t GetMaxAmpduLength() const
Return the maximum A-MPDU length.
Definition
he-6ghz-band-capabilities.cc:54
ns3::He6GhzBandCapabilities::He6GhzBandCapabilities
He6GhzBandCapabilities()
Definition
he-6ghz-band-capabilities.cc:14
ns3::He6GhzBandCapabilities::DeserializeInformationField
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)
Definition
he-6ghz-band-capabilities.cc:110
ns3::He6GhzBandCapabilities::SetMaxAmpduLength
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
Definition
he-6ghz-band-capabilities.cc:40
ns3::He6GhzBandCapabilities::Print
void Print(std::ostream &os) const override
Generate human-readable form of IE.
Definition
he-6ghz-band-capabilities.cc:125
ns3::He6GhzBandCapabilities::ElementIdExt
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
Definition
he-6ghz-band-capabilities.cc:26
ns3::He6GhzBandCapabilities::SerializeInformationField
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
Definition
he-6ghz-band-capabilities.cc:97
ns3::He6GhzBandCapabilities::GetMaxMpduLength
uint16_t GetMaxMpduLength() const
Get the maximum MPDU length.
Definition
he-6ghz-band-capabilities.cc:79
ns3::He6GhzBandCapabilities::m_capabilitiesInfo
CapabilitiesInfo m_capabilitiesInfo
capabilities field
Definition
he-6ghz-band-capabilities.h:47
ns3::He6GhzBandCapabilities::ElementId
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
Definition
he-6ghz-band-capabilities.cc:20
ns3::He6GhzBandCapabilities::SetMaxMpduLength
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
Definition
he-6ghz-band-capabilities.cc:60
uint32_t
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition
abort.h:38
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition
abort.h:97
he-6ghz-band-capabilities.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiInformationElementId
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
Definition
wifi-information-element.h:34
IE_EXTENSION
#define IE_EXTENSION
Definition
wifi-information-element.h:225
IE_EXT_HE_6GHZ_CAPABILITIES
#define IE_EXT_HE_6GHZ_CAPABILITIES
Definition
wifi-information-element.h:234
src
wifi
model
he
he-6ghz-band-capabilities.cc
Generated on Wed Jun 11 2025 13:15:40 for ns-3 by
1.13.2