A Discrete-Event Network Simulator
API
qos-utils.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 MIRKO BANCHI
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mirko Banchi <mk.banchi@gmail.com>
19  */
20 
21 #ifndef QOS_UTILS_H
22 #define QOS_UTILS_H
23 
24 #include "ns3/ptr.h"
25 #include <map>
26 
27 namespace ns3 {
28 
29 class Packet;
30 class WifiMacHeader;
31 class QueueItem;
32 class Mac48Address;
33 
34 typedef std::pair<Mac48Address, uint8_t> WifiAddressTidPair;
35 
40 {
47  std::size_t operator() (const WifiAddressTidPair& addressTidPair) const;
48 };
49 
54 {
61  std::size_t operator() (const Mac48Address& address) const;
62 };
63 
70 enum AcIndex : uint8_t
71 {
73  AC_BE = 0,
75  AC_BK = 1,
77  AC_VI = 2,
79  AC_VO = 3,
82  AC_UNDEF
83 };
84 
89 class WifiAc
90 {
91 public:
98  WifiAc (uint8_t lowTid, uint8_t highTid);
104  uint8_t GetLowTid (void) const;
110  uint8_t GetHighTid (void) const;
117  uint8_t GetOtherTid (uint8_t tid) const;
118 
119 private:
120  uint8_t m_lowTid;
121  uint8_t m_highTid;
122 };
123 
133 bool operator> (enum AcIndex left, enum AcIndex right);
134 
144 bool operator>= (enum AcIndex left, enum AcIndex right);
145 
155 bool operator< (enum AcIndex left, enum AcIndex right);
156 
166 bool operator<= (enum AcIndex left, enum AcIndex right);
167 
172 extern const std::map<AcIndex, WifiAc> wifiAcList;
173 
182 AcIndex QosUtilsMapTidToAc (uint8_t tid);
183 
195 
207 uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence);
208 
246 bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber);
247 
256 uint8_t GetTid (Ptr<const Packet> packet, const WifiMacHeader hdr);
257 
301 uint8_t SelectQueueByDSField (Ptr<QueueItem> item);
302 
303 } //namespace ns3
304 
305 #endif /* QOS_UTILS_H */
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:160
ns3::WifiAc::GetLowTid
uint8_t GetLowTid(void) const
Get the TID with lower priority.
Definition: qos-utils.cc:59
ns3::operator>=
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:166
ns3::WifiAddressHash
Function object to compute the hash of a MAC address.
Definition: qos-utils.h:54
ns3::WifiAc::m_highTid
uint8_t m_highTid
the TID with higher priority
Definition: qos-utils.h:121
ns3::WifiAddressHash::operator()
std::size_t operator()(const Mac48Address &address) const
Functional operator for MAC address hash computation.
Definition: qos-utils.cc:43
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::QosUtilsMapSeqControlToUniqueInteger
uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence)
Next function is useful to correctly sort buffered packets under block ack.
Definition: qos-utils.cc:167
ns3::GetTid
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr)
This function is useful to get traffic id of different packet types.
Definition: qos-utils.cc:187
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::Ptr< const Packet >
ns3::WifiAc::m_lowTid
uint8_t m_lowTid
the TID with lower priority
Definition: qos-utils.h:120
ns3::operator<=
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:155
ns3::AC_VI
@ AC_VI
Video.
Definition: qos-utils.h:77
ns3::WifiAc
This class stores the pair of TIDs of an Access Category.
Definition: qos-utils.h:90
ns3::QosUtilsIsOldPacket
bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber)
This function checks if packet with sequence number seqNumber is an "old" packet.
Definition: qos-utils.cc:178
ns3::QosUtilsMapTidToAc
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:126
ns3::WifiAddressTidHash::operator()
std::size_t operator()(const WifiAddressTidPair &addressTidPair) const
Functional operator for (MAC address, TID) hash computation.
Definition: qos-utils.cc:32
ns3::AC_UNDEF
@ AC_UNDEF
Definition: qos-utils.h:82
ns3::AC_BE
@ AC_BE
Best Effort.
Definition: qos-utils.h:73
ns3::AC_BE_NQOS
@ AC_BE_NQOS
Total number of ACs.
Definition: qos-utils.h:81
ns3::AC_BK
@ AC_BK
Background.
Definition: qos-utils.h:75
first.address
address
Definition: first.py:44
ns3::wifiAcList
const std::map< AcIndex, WifiAc > wifiAcList
Map containing the four ACs in increasing order of priority (according to Table 10-1 "UP-to-AC Mappin...
Definition: qos-utils.cc:120
ns3::SelectQueueByDSField
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:252
ns3::AC_VO
@ AC_VO
Voice.
Definition: qos-utils.h:79
ns3::WifiAc::GetOtherTid
uint8_t GetOtherTid(uint8_t tid) const
Given a TID belonging to this Access Category, get the other TID of this AC.
Definition: qos-utils.cc:71
ns3::WifiAddressTidPair
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Definition: qos-utils.h:32
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::operator>
bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
Definition: int64x64-128.h:431
ns3::WifiAddressTidHash
Function object to compute the hash of a (MAC address, TID) pair.
Definition: qos-utils.h:40
ns3::WifiAc::WifiAc
WifiAc(uint8_t lowTid, uint8_t highTid)
Constructor.
Definition: qos-utils.cc:52
ns3::QosUtilsGetTidForPacket
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:152
ns3::WifiAc::GetHighTid
uint8_t GetHighTid(void) const
Get the TID with higher priority.
Definition: qos-utils.cc:65