23 #include "ns3/he-phy.h"
25 #include "ns3/address-utils.h"
38 : m_barAckPolicy (false),
50 static TypeId tid =
TypeId (
"ns3::CtrlBAckRequestHeader")
52 .SetGroupName (
"Wifi")
164 if (((bar >> 1) & 0x0f) == 0x03)
168 else if (((bar >> 1) & 0x0f) == 0x01)
172 else if (((bar >> 1) & 0x0f) == 0x02)
234 uint8_t tid =
static_cast<uint8_t
> (
m_tidInfo);
276 : m_baAckPolicy (false),
289 static TypeId tid =
TypeId (
"ns3::CtrlBAckResponseHeader")
291 .SetGroupName (
"Wifi")
308 os <<
"TID_INFO=" <<
m_tidInfo <<
", StartingSeq=0x" << std::hex <<
m_baInfo[0].m_startingSeq << std::dec;
312 for (std::size_t i = 0; i <
m_baInfo.size (); i++)
316 <<
", StartingSeq=0x" << std::hex <<
m_baInfo[i].m_startingSeq << std::dec <<
"}";
341 size += 2 + (bitmapLen > 0 ? 2 : 0) + bitmapLen;
365 for (std::size_t index = 0; index <
m_baInfo.size (); index++)
370 if (
m_baInfo[index].m_bitmap.size () > 0)
378 uint32_t reserved = 0;
408 std::size_t index = 0;
463 m_baInfo.push_back ({.m_aidTidInfo = 0,
465 .m_bitmap = std::vector<uint8_t> (bitmapLen, 0),
480 "index can only be non null for Multi-STA Block Ack");
489 m_baInfo[index].m_aidTidInfo |= ((
static_cast<uint16_t
> (tid) & 0x000f) << 12);
497 "index can only be non null for Multi-STA Block Ack");
500 m_baInfo[index].m_startingSeq = seq;
513 "index can only be non null for Multi-STA Block Ack");
524 tid =
static_cast<uint8_t
> ((
m_baInfo[index].m_aidTidInfo >> 12) & 0x000f);
533 "index can only be non null for Multi-STA Block Ack");
536 return m_baInfo[index].m_startingSeq;
574 m_baInfo[index].m_aidTidInfo |= (aid & 0x07ff);
582 return m_baInfo[index].m_aidTidInfo & 0x07ff;
592 m_baInfo[index].m_aidTidInfo |= (1 << 11);
601 return ((
m_baInfo[index].m_aidTidInfo >> 11) & 0x0001) != 0;
627 std::vector<uint32_t>
632 std::vector<uint32_t> ret;
634 for (uint32_t i = 0; i <
m_baInfo.size (); i++)
683 if (((ba >> 1) & 0x0f) == 0x03)
687 else if (((ba >> 1) & 0x0f) == 0x01)
691 else if (((ba >> 1) & 0x0f) == 0x02)
695 else if (((ba >> 1) & 0x0f) == 0)
699 else if (((ba >> 1) & 0x0f) == 0x0b)
717 "index can only be non null for Multi-STA Block Ack");
720 uint16_t ret = (
m_baInfo[index].m_startingSeq << 4) & 0xfff0;
736 "This Per AID TID Info subfield has no Starting Sequence Control subfield");
758 "index can only be non null for Multi-STA Block Ack");
766 if ((seqControl & 0x0001) == 1)
770 if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 0)
774 else if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 2)
785 if ((seqControl & 0x0001) == 1)
789 uint8_t bitmapLen = 0;
790 if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 0)
794 else if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 1)
798 else if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 2)
802 else if (((seqControl >> 3) & 0x0001) == 0 && ((seqControl >> 1) & 0x0003) == 3)
811 m_baInfo[index].m_bitmap.assign (bitmapLen, 0);
814 m_baInfo[index].m_startingSeq = (seqControl >> 4) & 0x0fff;
821 "index can only be non null for Multi-STA Block Ack");
831 for (
const auto&
byte :
m_baInfo[index].m_bitmap)
850 "index can only be non null for Multi-STA Block Ack");
879 "index can only be non null for Multi-STA Block Ack");
898 m_baInfo[index].m_bitmap[i / 8] |= (uint8_t (0x01) << (i % 8));
942 "index can only be non null for Multi-STA Block Ack");
965 uint8_t mask = uint8_t (0x01) << (i % 8);
966 return (
m_baInfo[index].m_bitmap[i / 8] & mask) != 0;
1014 if (seq >=
m_baInfo[index].m_startingSeq)
1016 i = seq -
m_baInfo[index].m_startingSeq;
1027 nAckedMpdus = nAckedMpdus / 16;
1038 "index can only be non null for Multi-STA Block Ack");
1045 nAckedMpdus = nAckedMpdus / 16;
1051 const std::vector<uint8_t>&
1055 "index can only be non null for Multi-STA Block Ack");
1065 "index can only be non null for Multi-STA Block Ack");
1079 m_ulFecCodingType (false),
1083 m_triggerType (triggerType),
1084 m_basicTriggerDependentUserInfo (0)
1099 if (&userInfo ==
this)
1152 uint32_t userInfo = 0;
1153 userInfo |= (
m_aid12 & 0x0fff);
1156 userInfo |= (
m_ulMcs & 0x0f) << 21;
1157 userInfo |= (
m_ulDcm ? 1 << 25 : 0);
1161 userInfo |= (
m_bits26To31.ssAllocation.startingSs & 0x07) << 26;
1162 userInfo |= (
m_bits26To31.ssAllocation.nSs & 0x07) << 29;
1166 userInfo |= (
m_bits26To31.raRuInformation.nRaRu & 0x1f) << 26;
1167 userInfo |= (
m_bits26To31.raRuInformation.moreRaRu ? 1 << 31 : 0);
1204 m_ulMcs = (userInfo >> 21) & 0x0f;
1205 m_ulDcm = (userInfo >> 25) & 0x01;
1209 m_bits26To31.ssAllocation.startingSs = (userInfo >> 26) & 0x07;
1210 m_bits26To31.ssAllocation.nSs = (userInfo >> 29) & 0x07;
1214 m_bits26To31.raRuInformation.nRaRu = (userInfo >> 26) & 0x1f;
1215 m_bits26To31.raRuInformation.moreRaRu = (userInfo >> 31) & 0x01;
1461 NS_ABORT_MSG_IF (dBm < -110 || dBm > -20,
"Invalid values for signal power");
1486 | (tidLimit & 0x07) << 2
1488 | (prefAc & 0x03) << 6;
1521 "BAR Control indicates it is neither the Compressed nor the Multi-TID variant");
1540 : m_triggerType (0),
1543 m_csRequired (false),
1547 m_ulSpatialReuse (0)
1558 if (gi == 800 || gi == 1600)
1571 ui.
SetUlMcs (userInfo.second.mcs.GetMcsValue ());
1584 if (&trigger ==
this)
1607 .SetGroupName (
"Wifi")
1645 size += ui.GetSerializedSize ();
1662 uint64_t commonInfo = 0;
1665 commonInfo |= (
m_moreTF ? 1 << 16 : 0);
1669 commonInfo |=
static_cast<uint64_t
> (
m_apTxPower & 0x3f) << 28;
1676 i = ui.Serialize (i);
1691 m_moreTF = (commonInfo >> 16) & 0x01;
1703 bool isPadding =
false;
1840 userInfoIt->GetNss ()});
1900 if (ltfType == 1 && guardInterval == 1600)
1904 else if (ltfType == 2 && guardInterval == 1600)
1908 else if (ltfType == 4 && guardInterval == 3200)
1960 NS_ABORT_MSG_IF (power < -20 || power > 40,
"Out of range power values");
2004 "Trying to add a User Info field of a type other than the type of the Trigger Frame");
2045 {
return (ui.
GetAid12 () == aid12); });
2083 std::vector<HeRu::RuSpec> prevRus;
2091 prevRus.push_back (ui.GetRuAllocation ());
iterator in a Buffer instance
void WriteHtolsbU16(uint16_t data)
uint32_t ReadLsbtohU32(void)
void WriteU8(uint8_t data)
uint32_t GetRemainingSize(void) const
void WriteHtolsbU32(uint32_t data)
void Next(void)
go forward by one byte
void WriteHtolsbU64(uint64_t data)
uint16_t ReadLsbtohU16(void)
void Prev(void)
go backward by one byte
uint64_t ReadLsbtohU64(void)
uint32_t GetDistanceFrom(Iterator const &o) const
User Info field of Trigger frames.
bool HasRaRuForAssociatedSta(void) const
Check if this User Info field allocates a Random Access RU for stations associated with the AP that t...
uint8_t GetStartingSs(void) const
Get the starting spatial stream.
uint8_t startingSs
Starting spatial stream.
HeRu::RuSpec GetRuAllocation(void) const
Get the RU specified by the RU Allocation subfield.
const CtrlBAckRequestHeader & GetMuBarTriggerDepUserInfo(void) const
Get the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
uint8_t m_triggerType
Trigger frame type.
int8_t GetUlTargetRssi(void) const
Get the expected receive signal power for the solicited HE TB PPDU.
void Print(std::ostream &os) const
Print the content of this User Info field.
bool IsUlTargetRssiMaxTxPower(void) const
Return true if the UL Target RSSI subfield indicates to the station to transmit an HE TB PPDU respons...
uint8_t nRaRu
Number of Random Access RUs.
uint16_t GetAid12(void) const
Get the value of the AID12 subfield.
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 ...
union ns3::CtrlTriggerUserInfoField::@73 m_bits26To31
Fields occupying bits 26-31 in the User Info field.
~CtrlTriggerUserInfoField()
Destructor.
AcIndex GetPreferredAc(void) const
Get the Preferred AC subfield.
CtrlTriggerUserInfoField(uint8_t triggerType)
Constructor.
uint8_t GetTidAggregationLimit(void) const
Get the TID Aggregation Limit.
void SetUlFecCodingType(bool ldpc)
Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
bool HasRaRuForUnassociatedSta(void) const
Check if this User Info field allocates a Random Access RU for stations not associated with the AP th...
bool GetUlDcm(void) const
Get the UL DCM subfield, which indicates whether or not DCM is used.
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.
uint8_t m_ulMcs
MCS to be used by the addressed station.
uint8_t m_ruAllocation
RU Allocation.
bool GetUlFecCodingType(void) const
Get the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
uint8_t GetNRaRus(void) const
Get the number of contiguous RUs for Random Access.
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize the User Info field to the given buffer.
uint32_t GetSerializedSize(void) const
Get the expected size of this User Info field.
bool m_ulDcm
whether or not to use Dual Carrier Modulation
void SetUlTargetRssi(int8_t dBm)
Set the UL Target RSSI subfield to indicate the expected receive signal power in dBm.
TriggerFrameType GetType(void) const
Get the type of the Trigger Frame this User Info field belongs to.
void SetUlTargetRssiMaxTxPower(void)
Set the UL Target RSSI subfield to indicate to the station to transmit an HE TB PPDU response at its ...
CtrlTriggerUserInfoField & operator=(const CtrlTriggerUserInfoField &userInfo)
Copy assignment operator.
uint8_t GetUlMcs(void) const
Get the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
uint8_t GetNss(void) const
Get the number of spatial streams.
uint8_t GetMpduMuSpacingFactor(void) const
Get the MPDU MU spacing factor.
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.
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.
bool GetMoreRaRu(void) const
Return true if more RA-RUs are allocated in subsequent Trigger frames that are sent before the end of...
CtrlBAckRequestHeader m_muBarTriggerDependentUserInfo
MU-BAR variant of Trigger Dependent User Info subfield.
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
RuType GetRuType(void) const
Get the RU type.
bool GetPrimary80MHz(void) const
Get the primary 80 MHz flag.
std::size_t GetIndex(void) const
Get the RU index.
static bool DoesOverlap(uint16_t 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.
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 SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t 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.
uint16_t GetLength(void) const
Get the LENGTH field of the L-SIG.
void SetLength(uint16_t length)
Set the LENGTH field of the L-SIG.
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
uint16_t GetChannelWidth(void) const
uint16_t GetGuardInterval(void) 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_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.
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.
const 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.
enum Variant m_variant
Block Ack Request variant.
The different BlockAck variants.
enum Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.