14#include "ns3/address-utils.h"
15#include "ns3/he-phy.h"
29 : m_barAckPolicy(false),
154 if (((bar >> 1) & 0x0f) == 0x03)
158 else if (((bar >> 1) & 0x0f) == 0x01)
162 else if (((bar >> 1) & 0x0f) == 0x02)
224 auto tid =
static_cast<uint8_t
>(
m_tidInfo);
265 : m_baAckPolicy(false),
278 static TypeId tid =
TypeId(
"ns3::CtrlBAckResponseHeader")
280 .SetGroupName(
"Wifi")
296 os <<
"TID_INFO=" <<
m_tidInfo <<
", StartingSeq=0x" << std::hex
297 <<
m_baInfo[0].m_startingSeq << std::dec;
301 for (std::size_t i = 0; i <
m_baInfo.size(); i++)
304 << std::hex <<
m_baInfo[i].m_startingSeq << std::dec <<
"}";
329 size += 2 + (bitmapLen > 0 ? 2 : 0) + bitmapLen;
353 for (std::size_t index = 0; index <
m_baInfo.size(); index++)
358 if (!
m_baInfo[index].m_bitmap.empty())
395 std::size_t index = 0;
452 .m_bitmap = std::vector<uint8_t>(bitmapLen, 0),
455 m_baInfo.emplace_back(baInfoInstance);
469 "index can only be non null for Multi-STA Block Ack");
478 m_baInfo[index].m_aidTidInfo |= ((
static_cast<uint16_t
>(tid) & 0x000f) << 12);
486 "index can only be non null for Multi-STA Block Ack");
489 m_baInfo[index].m_startingSeq = seq;
502 "index can only be non null for Multi-STA Block Ack");
513 tid =
static_cast<uint8_t
>((
m_baInfo[index].m_aidTidInfo >> 12) & 0x000f);
522 "index can only be non null for Multi-STA Block Ack");
525 return m_baInfo[index].m_startingSeq;
563 m_baInfo[index].m_aidTidInfo |= (aid & 0x07ff);
571 return m_baInfo[index].m_aidTidInfo & 0x07ff;
581 m_baInfo[index].m_aidTidInfo |= (1 << 11);
590 return ((
m_baInfo[index].m_aidTidInfo >> 11) & 0x0001) != 0;
621 std::vector<uint32_t> ret;
672 if (((ba >> 1) & 0x0f) == 0x03)
676 else if (((ba >> 1) & 0x0f) == 0x01)
680 else if (((ba >> 1) & 0x0f) == 0x02)
684 else if (((ba >> 1) & 0x0f) == 0)
688 else if (((ba >> 1) & 0x0f) == 0x0b)
706 "index can only be non null for Multi-STA Block Ack");
709 uint16_t ret = (
m_baInfo[index].m_startingSeq << 4) & 0xfff0;
738 "This Per AID TID Info subfield has no Starting Sequence Control subfield");
771 "index can only be non null for Multi-STA Block Ack");
779 uint16_t fragNumber = seqControl & 0x000f;
781 if ((fragNumber & 0x0001) == 1)
800 NS_ABORT_MSG(
"Unsupported fragment number: " << fragNumber);
805 uint16_t fragNumber = seqControl & 0x000f;
807 if ((fragNumber & 0x0001) == 1)
811 uint8_t bitmapLen = 0;
833 NS_ABORT_MSG(
"Unsupported fragment number: " << fragNumber);
836 m_baInfo[index].m_bitmap.assign(bitmapLen, 0);
839 m_baInfo[index].m_startingSeq = (seqControl >> 4) & 0x0fff;
846 "index can only be non null for Multi-STA Block Ack");
856 for (
const auto&
byte :
m_baInfo[index].m_bitmap)
875 "index can only be non null for Multi-STA Block Ack");
904 "index can only be non null for Multi-STA Block Ack");
922 m_baInfo[index].m_bitmap[i / 8] |= (uint8_t(0x01) << (i % 8));
966 "index can only be non null for Multi-STA Block Ack");
988 uint8_t mask = uint8_t(0x01) << (i % 8);
989 return (
m_baInfo[index].m_bitmap[i / 8] & mask) != 0;
1036 if (seq >=
m_baInfo[index].m_startingSeq)
1038 i = seq -
m_baInfo[index].m_startingSeq;
1049 nAckedMpdus = nAckedMpdus / 16;
1060 "index can only be non null for Multi-STA Block Ack");
1067 nAckedMpdus = nAckedMpdus / 16;
1074const std::vector<uint8_t>&
1078 "index can only be non null for Multi-STA Block Ack");
1088 "index can only be non null for Multi-STA Block Ack");
1100 : m_variant(variant),
1103 m_ulFecCodingType(false),
1108 m_triggerType(triggerType),
1109 m_basicTriggerDependentUserInfo(0)
1124 if (&userInfo ==
this)
1178 "BFRP Trigger frame is not supported");
1180 "GCR-MU-BAR Trigger frame is not supported");
1182 "NFRP Trigger frame is not supported");
1187 userInfo |= (
m_aid12 & 0x0fff);
1190 userInfo |= (
m_ulMcs & 0x0f) << 21;
1193 userInfo |= (
m_ulDcm ? 1 << 25 : 0);
1198 userInfo |= (
m_bits26To31.ssAllocation.startingSs & 0x07) << 26;
1199 userInfo |= (
m_bits26To31.ssAllocation.nSs & 0x07) << 29;
1203 userInfo |= (
m_bits26To31.raRuInformation.nRaRu & 0x1f) << 26;
1204 userInfo |= (
m_bits26To31.raRuInformation.moreRaRu ? 1 << 31 : 0);
1213 bit32To39 |= (
m_ps160 ? 1 << 7 : 0);
1235 "BFRP Trigger frame is not supported");
1237 "GCR-MU-BAR Trigger frame is not supported");
1239 "NFRP Trigger frame is not supported");
1249 m_ulMcs = (userInfo >> 21) & 0x0f;
1252 m_ulDcm = (userInfo >> 25) & 0x01;
1257 m_bits26To31.ssAllocation.startingSs = (userInfo >> 26) & 0x07;
1258 m_bits26To31.ssAllocation.nSs = (userInfo >> 29) & 0x07;
1262 m_bits26To31.raRuInformation.nRaRu = (userInfo >> 26) & 0x1f;
1263 m_bits26To31.raRuInformation.moreRaRu = (userInfo >> 31) & 0x01;
1266 uint8_t bit32To39 = i.
ReadU8();
1270 m_ps160 = (bit32To39 >> 7) == 1;
1336 "SetMuRtsRuAllocation() must be used for MU-RTS");
1379 "GetMuRtsRuAllocation() must be used for MU-RTS");
1435 "SetMuRtsRuAllocation() can only be used for MU-RTS");
1437 value < 61 || value > 68,
1440 <<
" is not admitted for B7-B1 of the RU Allocation subfield of MU-RTS Trigger Frames");
1454 "GetMuRtsRuAllocation() can only be used for MU-RTS");
1457 value < 61 || value > 68,
1460 <<
" is not admitted for B7-B1 of the RU Allocation subfield of MU-RTS Trigger Frames");
1570 NS_ABORT_MSG_IF(dBm < -110 || dBm > -20,
"Invalid values for signal power");
1597 (tidLimit & 0x07) << 2
1599 | (prefAc & 0x03) << 6;
1630 "Not a MU-BAR Trigger frame");
1633 "BAR Control indicates it is neither the Compressed nor the Multi-TID variant");
1641 "Not a MU-BAR Trigger frame");
1657 m_csRequired(false),
1661 m_ulSpatialReuse(0),
1670 "This constructor cannot be used for MU-RTS");
1681 NS_ABORT_MSG(
"Cannot create a TF out of a TXVECTOR with preamble type: "
1689 if ((gi == 800) || (gi == 1600))
1715 if (&trigger ==
this)
1740 .SetGroupName(
"Wifi")
1767 "Cannot change Common Info field variant if User Info fields are present");
1791 size += ui.GetSerializedSize();
1803 "BFRP Trigger frame is not supported");
1805 "GCR-MU-BAR Trigger frame is not supported");
1807 "NFRP Trigger frame is not supported");
1811 uint64_t commonInfo = 0;
1814 commonInfo |= (
m_moreTF ? 1 << 16 : 0);
1818 commonInfo |=
static_cast<uint64_t
>(
m_apTxPower & 0x3f) << 28;
1822 uint64_t ulHeSigA2 = 0x01ff;
1823 commonInfo |= ulHeSigA2 << 54;
1830 i = ui.Serialize(i);
1833 for (std::size_t count = 0; count <
m_padding; count++)
1848 m_moreTF = (commonInfo >> 16) & 0x01;
1854 uint8_t bit54and55 = (commonInfo >> 54) & 0x03;
1860 "BFRP Trigger frame is not supported");
1862 "GCR-MU-BAR Trigger frame is not supported");
1864 "NFRP Trigger frame is not supported");
1907 case TriggerFrameType::x: \
1990 "GetHeTbTxVector() cannot be used for MU-RTS");
2001 {userInfoIt->GetRuAllocation(), userInfoIt->GetUlMcs(), userInfoIt->GetNss()});
2032 switch (
static_cast<uint16_t
>(bw))
2062 if ((ltfType == 1) && (gi == 1600))
2066 else if ((ltfType == 2) && (gi == 1600))
2070 else if ((ltfType == 4) && (gi == 3200))
2122 NS_ABORT_MSG_IF(power < -20 || power > 40,
"Out of range power values");
2149 NS_ABORT_MSG_IF(size == 1,
"The Padding field, if present, shall be at least two octets");
2180 "Trying to add a User Info field of a type other than the type of the Trigger Frame");
2265 std::vector<HeRu::RuSpec> prevRus;
2273 prevRus.push_back(ui.GetRuAllocation());
iterator in a Buffer instance
uint32_t GetRemainingSize() const
void WriteHtolsbU16(uint16_t data)
void WriteU8(uint8_t data)
void WriteHtolsbU32(uint32_t data)
void WriteHtolsbU64(uint64_t data)
uint32_t GetDistanceFrom(const Iterator &o) const
void Prev()
go backward by one byte
void Next()
go forward by one byte
User Info field of Trigger frames.
bool GetUlFecCodingType() const
Get the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
bool GetUlDcm() const
Get the UL DCM subfield, which indicates whether or not DCM is used This method can only be used with...
AcIndex GetPreferredAc() const
Get the Preferred AC subfield.
uint8_t GetMpduMuSpacingFactor() const
Get the MPDU MU spacing factor.
int8_t GetUlTargetRssi() const
Get the expected receive signal power for the solicited HE TB PPDU.
uint8_t startingSs
Starting spatial stream.
TriggerFrameType m_triggerType
Trigger frame type.
uint8_t GetUlMcs() const
Get the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
WifiPreamble GetPreambleType() const
uint32_t GetSerializedSize() const
Get the expected size of this User Info field.
void SetMuRtsRuAllocation(uint8_t value)
Set the RU Allocation subfield based on the given value for the B7-B1 bits.
CtrlTriggerUserInfoField(TriggerFrameType triggerType, TriggerFrameVariant variant)
Constructor.
void Print(std::ostream &os) const
Print the content of this User Info field.
uint8_t nRaRu
Number of Random Access RUs.
union ns3::CtrlTriggerUserInfoField::@69 m_bits26To31
Fields occupying bits 26-31 in the User Info field.
void SetAid12(uint16_t aid)
Set the AID12 subfield, which carries the 12 LSBs of the AID of the station for which this User Info ...
~CtrlTriggerUserInfoField()
Destructor.
bool m_ps160
identifies the location of the RU (EHT variant only)
const CtrlBAckRequestHeader & GetMuBarTriggerDepUserInfo() const
Get the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
void SetUlFecCodingType(bool ldpc)
Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
bool HasRaRuForUnassociatedSta() const
Check if this User Info field allocates a Random Access RU for stations not associated with the AP th...
void SetUlTargetRssiMaxTxPower()
Set the UL Target RSSI subfield to indicate to the station to transmit an HE TB PPDU response at its ...
void SetUlMcs(uint8_t mcs)
Set the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
void SetMuBarTriggerDepUserInfo(const CtrlBAckRequestHeader &bar)
Set the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
void SetUlDcm(bool dcm)
Set the UL DCM subfield, which indicates whether or not DCM is used.
void SetSsAllocation(uint8_t startingSs, uint8_t nSs)
Set the SS Allocation subfield, which is present when the AID12 subfield is neither 0 nor 2045.
uint16_t m_aid12
Association ID of the addressed station.
uint8_t nSs
Number of spatial streams.
uint8_t m_basicTriggerDependentUserInfo
Basic Trigger variant of Trigger Dependent User Info subfield.
TriggerFrameVariant m_variant
User Info field variant.
uint8_t GetTidAggregationLimit() const
Get the TID Aggregation Limit.
uint8_t m_ulMcs
MCS to be used by the addressed station.
TriggerFrameType GetType() const
Get the type of the Trigger Frame this User Info field belongs to.
uint8_t m_ruAllocation
RU Allocation.
HeRu::RuSpec GetRuAllocation() const
Get the RU specified by the RU Allocation subfield.
uint8_t GetNss() const
Get the number of spatial streams.
bool HasRaRuForAssociatedSta() const
Check if this User Info field allocates a Random Access RU for stations associated with the AP that t...
uint8_t GetMuRtsRuAllocation() const
This method can only be called on MU-RTS Trigger Frames.
uint16_t GetAid12() const
Get the value of the AID12 subfield.
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize the User Info field to the given buffer.
uint8_t GetNRaRus() const
Get the number of contiguous RUs for Random Access.
bool m_ulDcm
whether or not to use Dual Carrier Modulation (HE variant only)
void SetUlTargetRssi(int8_t dBm)
Set the UL Target RSSI subfield to indicate the expected receive signal power in dBm.
uint8_t GetStartingSs() const
Get the starting spatial stream.
CtrlTriggerUserInfoField & operator=(const CtrlTriggerUserInfoField &userInfo)
Copy assignment operator.
uint8_t m_ulTargetRssi
Expected receive signal power.
void SetRaRuInformation(uint8_t nRaRu, bool moreRaRu)
Set the RA-RU Information subfield, which is present when the AID12 subfield is 0 or 2045.
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize the User Info field from the given buffer.
bool IsUlTargetRssiMaxTxPower() const
Return true if the UL Target RSSI subfield indicates to the station to transmit an HE TB PPDU respons...
void SetRuAllocation(HeRu::RuSpec ru)
Set the RU Allocation subfield according to the specified RU.
void SetBasicTriggerDepUserInfo(uint8_t spacingFactor, uint8_t tidLimit, AcIndex prefAc)
Set the Trigger Dependent User Info subfield for Basic Trigger frames.
bool moreRaRu
More RA-RU in subsequent Trigger frames.
bool m_ulFecCodingType
UL FEC Coding Type.
CtrlBAckRequestHeader m_muBarTriggerDependentUserInfo
MU-BAR variant of Trigger Dependent User Info subfield.
bool GetMoreRaRu() const
Return true if more RA-RUs are allocated in subsequent Trigger frames that are sent before the end of...
std::size_t GetIndex() const
Get the RU index.
RuType GetRuType() const
Get the RU type.
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
static bool DoesOverlap(MHz_u bw, RuSpec ru, const std::vector< RuSpec > &v)
Check whether the given RU overlaps with the given set of RUs.
RuType
The different HE Resource Unit (RU) types.
Simulation virtual time values and global simulation resolution.
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetGuardInterval(Time guardInterval)
Sets the guard interval duration (in nanoseconds)
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
WifiPreamble GetPreambleType() const
void SetChannelWidth(MHz_u channelWidth)
Sets the selected channelWidth.
uint16_t GetLength() const
Get the LENGTH field of the L-SIG.
const HeMuUserInfoMap & GetHeMuUserInfoMap() const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
void SetLength(uint16_t length)
Set the LENGTH field of the L-SIG.
MHz_u GetChannelWidth() const
Time GetGuardInterval() const
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
TriggerFrameVariant
The different variants for Common Info field and User Info field of Trigger Frames.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
TriggerFrameType
The different Trigger frame types.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double MHz_u
MHz weak type.
static constexpr uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
The different BlockAckRequest variants.
Variant m_variant
Block Ack Request variant.
The different BlockAck variants.
Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.