A Discrete-Event Network Simulator
API
mpdu-aggregator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013
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: Ghada Badawy <gbadawy@gmail.com>
19  */
20 
21 #ifndef MPDU_AGGREGATOR_H
22 #define MPDU_AGGREGATOR_H
23 
24 #include "ns3/object.h"
25 #include "wifi-mode.h"
26 #include "qos-txop.h"
27 #include "ns3/nstime.h"
28 #include <vector>
29 
30 namespace ns3 {
31 
32 class AmpduSubframeHeader;
33 class WifiTxVector;
34 class Packet;
35 class WifiMacQueueItem;
36 
41 class MpduAggregator : public Object
42 {
43 public:
47  typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> > DeaggregatedMpdus;
51  typedef std::list<std::pair<Ptr<Packet>, AmpduSubframeHeader> >::const_iterator DeaggregatedMpdusCI;
55  typedef std::map<AcIndex, Ptr<QosTxop> > EdcaQueues;
56 
57 
62  static TypeId GetTypeId (void);
63 
64  MpduAggregator ();
65  virtual ~MpduAggregator ();
66 
74  static void Aggregate (Ptr<const WifiMacQueueItem> mpdu, Ptr<Packet> ampdu, bool isSingle);
75 
83  static void AddHeaderAndPad (Ptr<Packet> mpdu, bool last, bool isSingleMpdu);
84 
93  static uint32_t GetSizeIfAggregated (uint32_t mpduSize, uint32_t ampduSize);
94 
104  uint32_t GetMaxAmpduSize (Mac48Address recipient, uint8_t tid,
105  WifiModulationClass modulation) const;
106 
134  std::vector<Ptr<WifiMacQueueItem>> GetNextAmpdu (Ptr<const WifiMacQueueItem> mpdu,
135  WifiTxVector txVector,
136  Time ppduDurationLimit = Seconds (0)) const;
137 
144  static DeaggregatedMpdus Deaggregate (Ptr<Packet> aggregatedPacket);
145 
152  static std::list<Ptr<const Packet>> PeekAmpduSubframes (Ptr<const Packet> aggregatedPacket);
153 
160  static std::list<Ptr<const Packet>> PeekMpdus (Ptr<const Packet> aggregatedPacket);
161 
169 
175  void SetEdcaQueues (EdcaQueues edcaQueues);
176 
177 private:
186  static uint8_t CalculatePadding (uint32_t ampduSize);
187 
189 };
190 
191 } //namespace ns3
192 
193 #endif /* MPDU_AGGREGATOR_H */
Aggregator used to construct A-MPDUs.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static Ptr< const Packet > PeekMpduInAmpduSubframe(Ptr< const Packet > ampduSubframe)
Peeks the MPDU contained in the A-MPDU subframe.
static DeaggregatedMpdus Deaggregate(Ptr< Packet > aggregatedPacket)
Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
std::vector< Ptr< WifiMacQueueItem > > GetNextAmpdu(Ptr< const WifiMacQueueItem > mpdu, WifiTxVector txVector, Time ppduDurationLimit=Seconds(0)) const
Attempt to aggregate other MPDUs to the given MPDU, while meeting the following constraints: ...
std::list< std::pair< Ptr< Packet >, AmpduSubframeHeader > >::const_iterator DeaggregatedMpdusCI
A constant iterator for a list of deaggregated packets and their A-MPDU subframe headers.
static uint32_t GetSizeIfAggregated(uint32_t mpduSize, uint32_t ampduSize)
Compute the size of the A-MPDU resulting from the aggregation of an MPDU of size mpduSize and an A-MP...
static void AddHeaderAndPad(Ptr< Packet > mpdu, bool last, bool isSingleMpdu)
static std::list< Ptr< const Packet > > PeekMpdus(Ptr< const Packet > aggregatedPacket)
Peeks the MPDUs of the provided A-MPDU.
Introspection did not find any typical Config paths.
static void Aggregate(Ptr< const WifiMacQueueItem > mpdu, Ptr< Packet > ampdu, bool isSingle)
Aggregate an MPDU to an A-MPDU.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static uint8_t CalculatePadding(uint32_t ampduSize)
an EUI-48 address
Definition: mac48-address.h:43
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:36
uint32_t GetMaxAmpduSize(Mac48Address recipient, uint8_t tid, WifiModulationClass modulation) const
Determine the maximum size for an A-MPDU of the given TID that can be sent to the given receiver when...
static TypeId GetTypeId(void)
Get the type ID.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1062
std::list< std::pair< Ptr< Packet >, AmpduSubframeHeader > > DeaggregatedMpdus
A list of deaggregated packets and their A-MPDU subframe headers.
std::map< AcIndex, Ptr< QosTxop > > EdcaQueues
EDCA queues typedef.
static std::list< Ptr< const Packet > > PeekAmpduSubframes(Ptr< const Packet > aggregatedPacket)
Peeks the A-MPDU subframes of the provided A-MPDU.
A base class which provides memory management and object aggregation.
Definition: object.h:87
EdcaQueues m_edca
the map of EDCA queues
a unique identifier for an interface.
Definition: type-id.h:58
void SetEdcaQueues(EdcaQueues edcaQueues)
Set the map of EDCA queues.