|
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 ()) |