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;
33 
34 typedef std::pair<Mac48Address, uint8_t> WifiAddressTidPair;
35 
40 {
41  std::size_t operator() (const WifiAddressTidPair& addressTidPair) const;
42 };
43 
48 {
49  std::size_t operator() (const Mac48Address& address) const;
50 };
51 
58 enum AcIndex : uint8_t
59 {
61  AC_BE = 0,
63  AC_BK = 1,
65  AC_VI = 2,
67  AC_VO = 3,
71 };
72 
77 class WifiAc
78 {
79 public:
86  WifiAc (uint8_t lowTid, uint8_t highTid);
92  uint8_t GetLowTid (void) const;
98  uint8_t GetHighTid (void) const;
105  uint8_t GetOtherTid (uint8_t tid) const;
106 
107 private:
108  uint8_t m_lowTid;
109  uint8_t m_highTid;
110 };
111 
121 bool operator> (enum AcIndex left, enum AcIndex right);
122 
132 bool operator>= (enum AcIndex left, enum AcIndex right);
133 
143 bool operator< (enum AcIndex left, enum AcIndex right);
144 
154 bool operator<= (enum AcIndex left, enum AcIndex right);
155 
160 extern const std::map<AcIndex, WifiAc> wifiAcList;
161 
170 AcIndex QosUtilsMapTidToAc (uint8_t tid);
171 
183 
195 uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence);
196 
234 bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber);
235 
245 uint8_t GetTid (Ptr<const Packet> packet, const WifiMacHeader hdr);
246 
290 uint8_t SelectQueueByDSField (Ptr<QueueItem> item);
291 
292 } //namespace ns3
293 
294 #endif /* QOS_UTILS_H */
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Definition: qos-utils.h:32
uint8_t m_lowTid
the TID with lower priority
Definition: qos-utils.h:108
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
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:58
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
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:166
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
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:160
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:155
uint8_t GetHighTid(void) const
Get the TID with higher priority.
Definition: qos-utils.cc:65
Video.
Definition: qos-utils.h:65
Function object to compute the hash of a (MAC address, TID) pair.
Definition: qos-utils.h:39
uint8_t GetLowTid(void) const
Get the TID with lower priority.
Definition: qos-utils.cc:59
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:126
Best Effort.
Definition: qos-utils.h:61
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
Total number of ACs.
Definition: qos-utils.h:69
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:44
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:258
Background.
Definition: qos-utils.h:63
an EUI-48 address
Definition: mac48-address.h:43
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr)
Extraction operator for TypeId.
Definition: qos-utils.cc:193
Voice.
Definition: qos-utils.h:67
Function object to compute the hash of a MAC address.
Definition: qos-utils.h:47
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
std::size_t operator()(const WifiAddressTidPair &addressTidPair) const
Definition: qos-utils.cc:32
bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
Definition: int64x64-128.h:431
std::size_t operator()(const Mac48Address &address) const
Definition: qos-utils.cc:43
uint8_t m_highTid
the TID with higher priority
Definition: qos-utils.h:109
WifiAc(uint8_t lowTid, uint8_t highTid)
Constructor.
Definition: qos-utils.cc:52
Implements the IEEE 802.11 MAC header.
This class stores the pair of TIDs of an Access Category.
Definition: qos-utils.h:77