diff -r 9b4c47e6c37e -r 780a43e4980c src/wifi/model/mpdu-aggregator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/wifi/model/mpdu-aggregator.h Wed Jan 28 10:11:32 2015 -0800 @@ -0,0 +1,91 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2013 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Ghada Badawy + */ +#ifndef MPDU_AGGREGATOR_H +#define MPDU_AGGREGATOR_H + +#include "ns3/ptr.h" +#include "ns3/packet.h" +#include "ns3/object.h" + +#include "ampdu-subframe-header.h" + +#include + +namespace ns3 { + +class WifiMacHeader; + +/** + * \brief Abstract class that concrete mpdu aggregators have to implement + * \ingroup wifi + */ +class MpduAggregator : public Object +{ +public: + /** + * A list of deaggregated packets and their A-MPDU subframe headers. + */ + typedef std::list, AmpduSubframeHeader> > DeaggregatedMpdus; + /** + * A constant iterator for a list of deaggregated packets and their A-MPDU subframe headers. + */ + typedef std::list, AmpduSubframeHeader> >::const_iterator DeaggregatedMpdusCI; + + static TypeId GetTypeId (void); + /** + * \param packet Packet we have to insert into aggregatedPacket. + * \param aggregatedPacket Packet that will contain packet, if aggregation is possible. + * \return true if packet can be aggregated to aggregatedPacket, false otherwise. + * + * Adds packet to aggregatedPacket. In concrete aggregator's implementation is + * specified how and if packet can be added to aggregatedPacket. + */ + virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket) = 0; + /** + * Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent. + */ + virtual void AddHeaderAndPad (Ptr packet,bool last) = 0; + /** + * \param packetSize size of the packet we want to insert into aggregatedPacket. + * \param aggregatedPacket packet that will contain the packet of size packetSize, if aggregation is possible. + * \param blockAckSize size of the piggybacked block ack request + * \return true if the packet of size packetSize can be aggregated to aggregatedPacket, false otherwise. + * + * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size. + */ + virtual bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) = 0; + /** + * \return padding that must be added to the end of an aggregated packet + * + * Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added. + * Each A-MPDU subframe is padded so that its length is multiple of 4 octets. + */ + virtual uint32_t CalculatePadding (Ptr packet) = 0; + /** + * Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding. + * + * \return list of deaggragted packets and their A-MPDU subframe headers + */ + static DeaggregatedMpdus Deaggregate (Ptr aggregatedPacket); +}; + +} // namespace ns3 + +#endif /* MPDU_AGGREGATOR_H */