fixed bug 668

This commit is contained in:
Nicola Baldo
2009-11-24 13:59:14 +01:00
parent e4cb79a343
commit 078a37a72d
4 changed files with 80 additions and 16 deletions

View File

@@ -401,11 +401,11 @@ MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address
if (packet->RemovePacketTag (tag))
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosTid (tag.Get ());
hdr.SetQosTid (tag.GetTid ());
//Aftre setting type DsFrom and DsTo fields are reset.
hdr.SetDsFrom ();
hdr.SetDsTo ();
ac = QosUtilsMapTidToAc (tag.Get ());
ac = QosUtilsMapTidToAc (tag.GetTid ());
}
m_stats.sentFrames++;
m_stats.sentBytes += packet->GetSize ();

View File

@@ -31,7 +31,7 @@ QosTag::GetTypeId (void)
.AddConstructor<QosTag> ()
.AddAttribute ("tid", "The tid that indicates AC which packet belongs",
UintegerValue (0),
MakeUintegerAccessor (&QosTag::Get),
MakeUintegerAccessor (&QosTag::GetTid),
MakeUintegerChecker<uint8_t> ())
;
return tid;
@@ -49,6 +49,18 @@ QosTag::QosTag ():
QosTag::QosTag (uint8_t tid):
m_tid (tid)
{}
void
QosTag::SetTid (uint8_t tid)
{
m_tid = tid;
}
void
QosTag::SetUserPriority (UserPriority up)
{
m_tid = up;
}
uint32_t
QosTag::GetSerializedSize (void) const
@@ -65,17 +77,11 @@ QosTag::Serialize (TagBuffer i) const
void
QosTag::Deserialize (TagBuffer i)
{
m_tid = i.ReadU8 ();
}
void
QosTag::Set (uint8_t tid)
{
m_tid = tid;
m_tid = (UserPriority) i.ReadU8 ();
}
uint8_t
QosTag::Get () const
QosTag::GetTid () const
{
return m_tid;
}

View File

@@ -26,21 +26,79 @@ namespace ns3 {
class Tag;
/**
* As per IEEE Std. 802.11-2007, Section 6.1.1.1.1, when EDCA is used the
* the Traffic ID (TID) value corresponds to one of the User Priority (UP)
* values defined by the IEEE Std. 802.1D-2004, Annex G, table G-2.
*
* Note that this correspondence does not hold for HCCA, since in that
* case the mapping between UPs and TIDs should be determined by a
* TSPEC element as per IEEE Std. 802.11-2007, Section 7.3.2.30
*/
enum UserPriority {
UP_BK = 1, /**< background */
UP_BE = 0, /**< best effort (default) */
UP_EE = 3, /**< excellent effort */
UP_CL = 4, /**< controlled load */
UP_VI = 5, /**< video, < 100ms latency and jitter */
UP_VO = 6, /**< voice, < 10ms latency and jitter */
UP_NC = 7 /**< network control */
};
/**
* The aim of the QosTag is to provide means for an Application to
* specify the TID which will be used by a QoS-aware WifiMac for a
* given traffic flow. Note that the current QosTag class was
* designed to be completely mac/wifi specific without any attempt
* at being generic.
*/
class QosTag : public Tag
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
/**
* Create a QosTag with the default TID = 0 (best effort traffic)
*/
QosTag ();
/**
* Create a QosTag with the given TID
*/
QosTag (uint8_t tid);
/**
* Set the TID to the given value. This assumes that the
* application is aware of the QoS support provided by the MAC
* layer, and is therefore able to set the correct TID.
*
* @param tid the value of the TID to set
*/
void SetTid (uint8_t tid);
/**
* Set the TID to the value that corresponds to the requested
* UserPriority. Note that, since the mapping of UserPriority to TID
* is defined for EDCA only, you should call this method only when
* EDCA is used. When using HDCA, QosTag(uint8_t tid) should be used
* instead.
*
* @param up the requested UserPriority
*
*/
void SetUserPriority (UserPriority up);
virtual void Serialize (TagBuffer i) const;
virtual void Deserialize (TagBuffer i);
virtual uint32_t GetSerializedSize () const;
virtual void Print (std::ostream &os) const;
uint8_t Get (void) const;
void Set (uint8_t tid);
uint8_t GetTid (void) const;
private:
uint8_t m_tid;
};

View File

@@ -61,9 +61,9 @@ QosUtilsGetTidForPacket (Ptr<const Packet> packet)
uint8_t tid = 8;
if (packet->PeekPacketTag (qos))
{
if (qos.Get () < 8)
if (qos.GetTid () < 8)
{
tid = qos.Get ();
tid = qos.GetTid ();
}
}
return tid;