A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
41{
48 std::size_t operator()(const WifiAddressTidPair& addressTidPair) const;
49};
50
55{
62 std::size_t operator()(const Mac48Address& address) const;
63};
64
71enum AcIndex : uint8_t
72{
74 AC_BE = 0,
76 AC_BK = 1,
78 AC_VI = 2,
80 AC_VO = 3,
87};
88
93class WifiAc
94{
95 public:
102 WifiAc(uint8_t lowTid, uint8_t highTid);
108 uint8_t GetLowTid() const;
114 uint8_t GetHighTid() const;
121 uint8_t GetOtherTid(uint8_t tid) const;
122
123 private:
124 uint8_t m_lowTid;
125 uint8_t m_highTid;
126};
127
137bool operator>(AcIndex left, AcIndex right);
138
148bool operator>=(AcIndex left, AcIndex right);
149
159bool operator<(AcIndex left, AcIndex right);
160
170bool operator<=(AcIndex left, AcIndex right);
171
176extern const std::map<AcIndex, WifiAc> wifiAcList;
177
186AcIndex QosUtilsMapTidToAc(uint8_t tid);
187
199
211uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence);
212
250bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber);
251
260uint8_t GetTid(Ptr<const Packet> packet, const WifiMacHeader hdr);
261
306
307} // namespace ns3
308
309#endif /* QOS_UTILS_H */
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
This class stores the pair of TIDs of an Access Category.
Definition: qos-utils.h:94
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:125
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:124
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:421
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:134
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:182
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:171
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:191
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:156
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:72
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:253
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:82
@ AC_BE
Best Effort.
Definition: qos-utils.h:74
@ AC_VO
Voice.
Definition: qos-utils.h:80
@ AC_VI
Video.
Definition: qos-utils.h:78
@ AC_BK
Background.
Definition: qos-utils.h:76
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:86
@ AC_BEACON
Beacon queue.
Definition: qos-utils.h:84
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:35
Function object to compute the hash of a MAC address.
Definition: qos-utils.h:55
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:41
std::size_t operator()(const WifiAddressTidPair &addressTidPair) const
Functional operator for (MAC address, TID) hash computation.
Definition: qos-utils.cc:34