OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007 University of Washington | 3 * Copyright (c) 2007 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 */ | 17 */ |
18 | 18 |
19 #ifndef DROPTAIL_H | 19 #ifndef DROPTAIL_H |
20 #define DROPTAIL_H | 20 #define DROPTAIL_H |
21 | 21 |
22 #include <queue> | 22 #include <queue> |
23 #include "ns3/packet.h" | |
24 #include "ns3/queue.h" | 23 #include "ns3/queue.h" |
25 | 24 |
26 namespace ns3 { | 25 namespace ns3 { |
27 | 26 |
28 class TraceContainer; | |
29 | |
30 /** | 27 /** |
31 * \ingroup queue | 28 * \ingroup queue |
32 * | 29 * |
33 * \brief A FIFO packet queue that drops tail-end packets on overflow | 30 * \brief A FIFO packet queue that drops tail-end packets on overflow |
34 */ | 31 */ |
35 class DropTailQueue : public Queue { | 32 class DropTailQueue : public Queue |
| 33 { |
36 public: | 34 public: |
37 /** | 35 /** |
38 * \brief Get the type ID. | 36 * \brief Get the type ID. |
39 * \return the object TypeId | 37 * \return the object TypeId |
40 */ | 38 */ |
41 static TypeId GetTypeId (void); | 39 static TypeId GetTypeId (void); |
42 /** | 40 /** |
43 * \brief DropTailQueue Constructor | 41 * \brief DropTailQueue Constructor |
44 * | 42 * |
45 * Creates a droptail queue with a maximum size of 100 packets by default | 43 * Creates a droptail queue with a maximum size of 100 packets by default |
46 */ | 44 */ |
47 DropTailQueue (); | 45 DropTailQueue (); |
48 | 46 |
49 virtual ~DropTailQueue(); | 47 virtual ~DropTailQueue(); |
50 | 48 |
51 /** | 49 private: |
52 * Set the operating mode of this device. | 50 virtual bool DoEnqueue (Ptr<QueueItem> item); |
53 * | 51 virtual Ptr<QueueItem> DoDequeue (void); |
54 * \param mode The operating mode of this device. | 52 virtual Ptr<const QueueItem> DoPeek (void) const; |
55 * | |
56 */ | |
57 void SetMode (DropTailQueue::QueueMode mode); | |
58 | 53 |
59 /** | 54 std::queue<Ptr<QueueItem> > m_packets; //!< the items in the queue |
60 * Get the encapsulation mode of this device. | |
61 * | |
62 * \returns The encapsulation mode of this device. | |
63 */ | |
64 DropTailQueue::QueueMode GetMode (void) const; | |
65 | |
66 private: | |
67 virtual bool DoEnqueue (Ptr<Packet> p); | |
68 virtual Ptr<Packet> DoDequeue (void); | |
69 virtual Ptr<const Packet> DoPeek (void) const; | |
70 | |
71 std::queue<Ptr<Packet> > m_packets; //!< the packets in the queue | |
72 uint32_t m_maxPackets; //!< max packets in the queue | |
73 uint32_t m_maxBytes; //!< max bytes in the queue | |
74 uint32_t m_bytesInQueue; //!< actual bytes in the queue | |
75 QueueMode m_mode; //!< queue mode (packets or bytes limited) | |
76 }; | 55 }; |
77 | 56 |
78 } // namespace ns3 | 57 } // namespace ns3 |
79 | 58 |
80 #endif /* DROPTAIL_H */ | 59 #endif /* DROPTAIL_H */ |
OLD | NEW |