/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 University of Washington * * 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 */ #ifndef REORDER_QUEUE_H #define REORDER_QUEUE_H #include #include "ns3/packet.h" #include "ns3/queue.h" namespace ns3 { class TraceContainer; /** * \ingroup queue * * \brief A FIFO packet queue that drops tail-end packets on overflow * and reorders packets * * Not a real ns-3 model; just used for demo purposes */ class ReorderQueue : public Queue { public: /** * \brief Get the type ID. * \return the object TypeId */ static TypeId GetTypeId (void); /** * \brief ReorderQueue Constructor * * Creates a droptail queue with a maximum size of 100 packets by default */ ReorderQueue (); virtual ~ReorderQueue(); /** * Set the operating mode of this device. * * \param mode The operating mode of this device. * */ void SetMode (ReorderQueue::QueueMode mode); /** * Get the encapsulation mode of this device. * * \returns The encapsulation mode of this device. */ ReorderQueue::QueueMode GetMode (void); private: virtual bool DoEnqueue (Ptr p); virtual Ptr DoDequeue (void); virtual Ptr DoPeek (void) const; std::queue > m_packets; //!< the packets in the queue uint32_t m_maxPackets; //!< max packets in the queue uint32_t m_maxBytes; //!< max bytes in the queue uint32_t m_bytesInQueue; //!< actual bytes in the queue uint32_t m_reorderDepth; uint32_t m_inSequenceLength; uint32_t m_holdCount; uint32_t m_inSequenceCount; Ptr m_held; QueueMode m_mode; //!< queue mode (packets or bytes limited) }; } // namespace ns3 #endif /* REORDER_QUEUE_H */