View | Details | Raw Unified | Return to bug 3010
Collapse All | Expand All

(-)a/src/network/utils/queue.cc (-1 / +1 lines)
 Lines 37-43   QueueBase::GetTypeId (void) Link Here 
37
    .SetGroupName ("Network")
37
    .SetGroupName ("Network")
38
    .AddAttribute ("MaxSize",
38
    .AddAttribute ("MaxSize",
39
                   "The max queue size",
39
                   "The max queue size",
40
                   QueueSizeValue (QueueSize ("300p")),
40
                   QueueSizeValue (QueueSize ("100p")),
41
                   MakeQueueSizeAccessor (&QueueBase::SetMaxSize,
41
                   MakeQueueSizeAccessor (&QueueBase::SetMaxSize,
42
                                          &QueueBase::GetMaxSize),
42
                                          &QueueBase::GetMaxSize),
43
                   MakeQueueSizeChecker ())
43
                   MakeQueueSizeChecker ())
(-)a/src/wifi/model/wifi-mac-queue.cc (+22 lines)
 Lines 38-43   WifiMacQueue::GetTypeId (void) Link Here 
38
    .SetParent<Queue<WifiMacQueueItem> > ()
38
    .SetParent<Queue<WifiMacQueueItem> > ()
39
    .SetGroupName ("Wifi")
39
    .SetGroupName ("Wifi")
40
    .AddConstructor<WifiMacQueue> ()
40
    .AddConstructor<WifiMacQueue> ()
41
    .AddAttribute ("MaxQueueSize",
42
                   "The max queue size",
43
                   QueueSizeValue (QueueSize ("500p")),
44
                   MakeQueueSizeAccessor (&WifiMacQueue::SetMaxQueueSize),
45
                   MakeQueueSizeChecker ())
41
    .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
46
    .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
42
                   TimeValue (MilliSeconds (500)),
47
                   TimeValue (MilliSeconds (500)),
43
                   MakeTimeAccessor (&WifiMacQueue::SetMaxDelay),
48
                   MakeTimeAccessor (&WifiMacQueue::SetMaxDelay),
 Lines 62-67   WifiMacQueue::~WifiMacQueue () Link Here 
62
}
67
}
63
68
64
void
69
void
70
WifiMacQueue::SetMaxQueueSize (QueueSize size)
71
{
72
  NS_LOG_FUNCTION (this << size);
73
  m_maxSize = size;
74
}
75
76
QueueSize
77
WifiMacQueue::GetMaxQueueSize (void) const
78
{
79
  return m_maxSize;
80
}
81
82
void
65
WifiMacQueue::SetMaxDelay (Time delay)
83
WifiMacQueue::SetMaxDelay (Time delay)
66
{
84
{
67
  NS_LOG_FUNCTION (this << delay);
85
  NS_LOG_FUNCTION (this << delay);
 Lines 97-102   WifiMacQueue::Enqueue (Ptr<WifiMacQueueItem> item) Link Here 
97
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
115
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
98
                 "WifiMacQueues must be in packet mode");
116
                 "WifiMacQueues must be in packet mode");
99
117
118
  QueueBase::SetMaxSize (GetMaxQueueSize ()); //Make sure QueueBase has the same maximum queue size
119
100
  // if the queue is full, remove the first stale packet (if any) encountered
120
  // if the queue is full, remove the first stale packet (if any) encountered
101
  // starting from the head of the queue, in order to make room for the new packet.
121
  // starting from the head of the queue, in order to make room for the new packet.
102
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
122
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
 Lines 124-129   WifiMacQueue::PushFront (Ptr<WifiMacQueueItem> item) Link Here 
124
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
144
  NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
125
                 "WifiMacQueues must be in packet mode");
145
                 "WifiMacQueues must be in packet mode");
126
146
147
  QueueBase::SetMaxSize (GetMaxQueueSize ()); //Make sure QueueBase has the same maximum queue size
148
127
  // if the queue is full, remove the first stale packet (if any) encountered
149
  // if the queue is full, remove the first stale packet (if any) encountered
128
  // starting from the head of the queue, in order to make room for the new packet.
150
  // starting from the head of the queue, in order to make room for the new packet.
129
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
151
  if (QueueBase::GetNPackets () == GetMaxSize ().GetValue ())
(-)a/src/wifi/model/wifi-mac-queue.h (+13 lines)
 Lines 64-69   public: Link Here 
64
  };
64
  };
65
65
66
  /**
66
  /**
67
   * \brief Set the maximum size of this queue
68
   *
69
   * Trying to set a null size has no effect.
70
   *
71
   * \param size the maximum size
72
   */
73
  void SetMaxQueueSize (QueueSize size);
74
  /**
75
   * \return the maximum size of this queue
76
   */
77
  QueueSize GetMaxQueueSize (void) const;
78
  /**
67
   * Set the maximum delay before the packet is discarded.
79
   * Set the maximum delay before the packet is discarded.
68
   *
80
   *
69
   * \param delay the maximum delay
81
   * \param delay the maximum delay
 Lines 229-234   private: Link Here 
229
   */
241
   */
230
  bool TtlExceeded (ConstIterator &it);
242
  bool TtlExceeded (ConstIterator &it);
231
243
244
  QueueSize m_maxSize;                      //!< max queue size
232
  Time m_maxDelay;                          //!< Time to live for packets in the queue
245
  Time m_maxDelay;                          //!< Time to live for packets in the queue
233
  DropPolicy m_dropPolicy;                  //!< Drop behavior of queue
246
  DropPolicy m_dropPolicy;                  //!< Drop behavior of queue
234
247

Return to bug 3010