A Discrete-Event Network Simulator
API
qos-utils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 MIRKO BANCHI
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mirko Banchi <mk.banchi@gmail.com>
18 */
19
20#ifndef QOS_UTILS_H
21#define QOS_UTILS_H
22
23#include "ns3/ptr.h"
24
25#include <map>
26
27namespace ns3
28{
29
30class Packet;
31class WifiMacHeader;
32class QueueItem;
33class Mac48Address;
34
35typedef std::pair<Mac48Address, uint8_t> WifiAddressTidPair;
36
37#define WIFI_TID_UNDEFINED 0xff
38
43{
50 std::size_t operator()(const WifiAddressTidPair& addressTidPair) const;
51};
52
57{
64 std::size_t operator()(const Mac48Address& address) const;
65};
66
73enum AcIndex : uint8_t
74{
76 AC_BE = 0,
78 AC_BK = 1,
80 AC_VI = 2,
82 AC_VO = 3,
89};
90
95class WifiAc
96{
97 public:
104 WifiAc(uint8_t lowTid, uint8_t highTid);
110 uint8_t GetLowTid() const;
116 uint8_t GetHighTid() const;
123 uint8_t GetOtherTid(uint8_t tid) const;
124
125 private:
126 uint8_t m_lowTid;
127 uint8_t m_highTid;
128};
129
139bool operator>(enum AcIndex left, enum AcIndex right);
140
150bool operator>=(enum AcIndex left, enum AcIndex right);
151
161bool operator<(enum AcIndex left, enum AcIndex right);
162
172bool operator<=(enum AcIndex left, enum AcIndex right);
173
178extern const std::map<AcIndex, WifiAc> wifiAcList;
179
188AcIndex QosUtilsMapTidToAc(uint8_t tid);
189
201
213uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence);
214
252bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber);
253
262uint8_t GetTid(Ptr<const Packet> packet, const WifiMacHeader hdr);
263
308
309} // namespace ns3
310
311#endif /* QOS_UTILS_H */
an EUI-48 address
Definition: mac48-address.h:46
This class stores the pair of TIDs of an Access Category.
Definition: qos-utils.h:96
WifiAc(uint8_t lowTid, uint8_t highTid)
Constructor.
Definition: qos-utils.cc:54
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:73
uint8_t m_highTid
the TID with higher priority
Definition: qos-utils.h:127
uint8_t GetHighTid() const
Get the TID with higher priority.
Definition: qos-utils.cc:67
uint8_t GetLowTid() const
Get the TID with lower priority.
Definition: qos-utils.cc:61
uint8_t m_lowTid
the TID with lower priority
Definition: qos-utils.h:126
Implements the IEEE 802.11 MAC header.
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:174
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:161
bool operator>(const Length &left, const Length &right)
Check if left has a value greater than right.
Definition: length.cc:420
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:132
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:184
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:173
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:193
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:158
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:255
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:84
@ AC_BE
Best Effort.
Definition: qos-utils.h:76
@ AC_VO
Voice.
Definition: qos-utils.h:82
@ AC_VI
Video.
Definition: qos-utils.h:80
@ AC_BK
Background.
Definition: qos-utils.h:78
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:88
@ AC_BEACON
Beacon queue.
Definition: qos-utils.h:86
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:170
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:126
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Definition: qos-utils.h:33
Function object to compute the hash of a MAC address.
Definition: qos-utils.h:57
std::size_t operator()(const Mac48Address &address) const
Functional operator for MAC address hash computation.
Definition: qos-utils.cc:45
Function object to compute the hash of a (MAC address, TID) pair.
Definition: qos-utils.h:43
std::size_t operator()(const WifiAddressTidPair &addressTidPair) const
Functional operator for (MAC address, TID) hash computation.
Definition: qos-utils.cc:34