wifi: Add a map storing ACs in increasing order of priority
This commit is contained in:
@@ -49,6 +49,79 @@ WifiAddressHash::operator()(const Mac48Address& address) const
|
||||
return std::hash<std::string>{} (s);
|
||||
}
|
||||
|
||||
WifiAc::WifiAc (uint8_t lowTid, uint8_t highTid)
|
||||
: m_lowTid (lowTid),
|
||||
m_highTid (highTid)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiAc::GetLowTid (void) const
|
||||
{
|
||||
return m_lowTid;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiAc::GetHighTid (void) const
|
||||
{
|
||||
return m_highTid;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiAc::GetOtherTid (uint8_t tid) const
|
||||
{
|
||||
if (tid == m_lowTid)
|
||||
{
|
||||
return m_highTid;
|
||||
}
|
||||
if (tid == m_highTid)
|
||||
{
|
||||
return m_lowTid;
|
||||
}
|
||||
NS_ABORT_MSG ("TID " << tid << " does not belong to this AC");
|
||||
}
|
||||
|
||||
bool operator> (enum AcIndex left, enum AcIndex right)
|
||||
{
|
||||
NS_ABORT_MSG_IF (left > 3 || right > 3, "Cannot compare non-QoS ACs");
|
||||
|
||||
if (left == right)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (left == AC_BK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (right == AC_BK)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return static_cast<uint8_t> (left) > static_cast<uint8_t> (right);
|
||||
}
|
||||
|
||||
bool operator>= (enum AcIndex left, enum AcIndex right)
|
||||
{
|
||||
NS_ABORT_MSG_IF (left > 3 || right > 3, "Cannot compare non-QoS ACs");
|
||||
|
||||
return (left == right || left > right);
|
||||
}
|
||||
|
||||
bool operator< (enum AcIndex left, enum AcIndex right)
|
||||
{
|
||||
return !(left >= right);
|
||||
}
|
||||
|
||||
bool operator<= (enum AcIndex left, enum AcIndex right)
|
||||
{
|
||||
return !(left > right);
|
||||
}
|
||||
|
||||
const std::map<AcIndex, WifiAc> wifiAcList = { {AC_BE, {0, 3}},
|
||||
{AC_BK, {1, 2}},
|
||||
{AC_VI, {4, 5}},
|
||||
{AC_VO, {6, 7}} };
|
||||
|
||||
AcIndex
|
||||
QosUtilsMapTidToAc (uint8_t tid)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define QOS_UTILS_H
|
||||
|
||||
#include "ns3/ptr.h"
|
||||
#include <map>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -69,6 +70,95 @@ enum AcIndex : uint8_t
|
||||
AC_UNDEF
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* This class stores the pair of TIDs of an Access Category.
|
||||
*/
|
||||
class WifiAc
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* \param lowTid the TID with lower priority
|
||||
* \param highTid the TID with higher priority
|
||||
*/
|
||||
WifiAc (uint8_t lowTid, uint8_t highTid);
|
||||
/**
|
||||
* Get the TID with lower priority
|
||||
*
|
||||
* \return the TID with lower priority
|
||||
*/
|
||||
uint8_t GetLowTid (void) const;
|
||||
/**
|
||||
* Get the TID with higher priority
|
||||
*
|
||||
* \return the TID with higher priority
|
||||
*/
|
||||
uint8_t GetHighTid (void) const;
|
||||
/**
|
||||
* Given a TID belonging to this Access Category, get the other TID of this AC.
|
||||
*
|
||||
* \param tid a TID belonging to this AC
|
||||
* \return the other TID belonging to this AC
|
||||
*/
|
||||
uint8_t GetOtherTid (uint8_t tid) const;
|
||||
|
||||
private:
|
||||
uint8_t m_lowTid; //!< the TID with lower priority
|
||||
uint8_t m_highTid; //!< the TID with higher priority
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Operator> overload returning true if the AC on the left has higher priority
|
||||
* than the AC on the right.
|
||||
*
|
||||
* \param left the AC on the left of operator>
|
||||
* \param right the AC on the right of operator>
|
||||
* \return true if the AC on the left has higher priority than the AC on the right
|
||||
*/
|
||||
bool operator> (enum AcIndex left, enum AcIndex right);
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Operator>= overload returning true if the AC on the left has higher or the same
|
||||
* priority than the AC on the right.
|
||||
*
|
||||
* \param left the AC on the left of operator>=
|
||||
* \param right the AC on the right of operator>=
|
||||
* \return true if the AC on the left has higher or the same priority than the AC on the right
|
||||
*/
|
||||
bool operator>= (enum AcIndex left, enum AcIndex right);
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Operator< overload returning true if the AC on the left has lower priority
|
||||
* than the AC on the right.
|
||||
*
|
||||
* \param left the AC on the left of operator<
|
||||
* \param right the AC on the right of operator<
|
||||
* \return true if the AC on the left has lower priority than the AC on the right
|
||||
*/
|
||||
bool operator< (enum AcIndex left, enum AcIndex right);
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Operator<= overload returning true if the AC on the left has lower or the same
|
||||
* priority than the AC on the right.
|
||||
*
|
||||
* \param left the AC on the left of operator<=
|
||||
* \param right the AC on the right of operator<=
|
||||
* \return true if the AC on the left has lower or the same priority than the AC on the right
|
||||
*/
|
||||
bool operator<= (enum AcIndex left, enum AcIndex right);
|
||||
|
||||
/**
|
||||
* Map containing the four ACs in increasing order of priority (according to
|
||||
* Table 10-1 "UP-to-AC Mappings" of 802.11-2016)
|
||||
*/
|
||||
extern const std::map<AcIndex, WifiAc> wifiAcList;
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
* Maps TID (Traffic ID) to Access classes.
|
||||
|
||||
Reference in New Issue
Block a user