LEFT | RIGHT |
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) 2005, 2009 INRIA | 3 * Copyright (c) 2005, 2009 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | 4 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 Ptr<const Packet> | 161 Ptr<const Packet> |
162 WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, | 162 WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, |
163 WifiMacHeader::AddressType type, Mac48Addr
ess dest) | 163 WifiMacHeader::AddressType type, Mac48Addr
ess dest) |
164 { | 164 { |
165 Cleanup (); | 165 Cleanup (); |
166 Ptr<const Packet> packet = 0; | 166 Ptr<const Packet> packet = 0; |
167 if (!m_queue.empty ()) | 167 if (!m_queue.empty ()) |
168 { | 168 { |
169 PacketQueueI it; | 169 PacketQueueI it; |
170 // NS_ASSERT (type <= 4); | |
171 for (it = m_queue.begin (); it != m_queue.end (); ++it) | 170 for (it = m_queue.begin (); it != m_queue.end (); ++it) |
172 { | 171 { |
173 if (it->hdr.IsQosData ()) | 172 if (it->hdr.IsQosData ()) |
174 { | 173 { |
175 if (GetAddressForPacket (type, it) == dest | 174 if (GetAddressForPacket (type, it) == dest |
176 && it->hdr.GetQosTid () == tid) | 175 && it->hdr.GetQosTid () == tid) |
177 { | 176 { |
178 packet = it->packet; | 177 packet = it->packet; |
179 *hdr = it->hdr; | 178 *hdr = it->hdr; |
180 m_queue.erase (it); | 179 m_queue.erase (it); |
181 m_size--; | 180 m_size--; |
182 break; | 181 break; |
183 } | 182 } |
184 } | 183 } |
185 } | 184 } |
186 } | 185 } |
187 return packet; | 186 return packet; |
188 } | 187 } |
189 | 188 |
190 Ptr<const Packet> | 189 Ptr<const Packet> |
191 WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, | 190 WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, |
192 WifiMacHeader::AddressType type, Mac48Address
dest) | 191 WifiMacHeader::AddressType type, Mac48Address
dest) |
193 { | 192 { |
194 Cleanup (); | 193 Cleanup (); |
195 if (!m_queue.empty ()) | 194 if (!m_queue.empty ()) |
196 { | 195 { |
197 PacketQueueI it; | 196 PacketQueueI it; |
198 // NS_ASSERT (type <= 4); | |
199 for (it = m_queue.begin (); it != m_queue.end (); ++it) | 197 for (it = m_queue.begin (); it != m_queue.end (); ++it) |
200 { | 198 { |
201 if (it->hdr.IsQosData ()) | 199 if (it->hdr.IsQosData ()) |
202 { | 200 { |
203 if (GetAddressForPacket (type, it) == dest | 201 if (GetAddressForPacket (type, it) == dest |
204 && it->hdr.GetQosTid () == tid) | 202 && it->hdr.GetQosTid () == tid) |
205 { | 203 { |
206 *hdr = it->hdr; | 204 *hdr = it->hdr; |
207 return it->packet; | 205 return it->packet; |
208 } | 206 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 279 |
282 uint32_t | 280 uint32_t |
283 WifiMacQueue::GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressTyp
e type, | 281 WifiMacQueue::GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressTyp
e type, |
284 Mac48Address addr) | 282 Mac48Address addr) |
285 { | 283 { |
286 Cleanup (); | 284 Cleanup (); |
287 uint32_t nPackets = 0; | 285 uint32_t nPackets = 0; |
288 if (!m_queue.empty ()) | 286 if (!m_queue.empty ()) |
289 { | 287 { |
290 PacketQueueI it; | 288 PacketQueueI it; |
291 // NS_ASSERT (type <= 4); | |
292 for (it = m_queue.begin (); it != m_queue.end (); it++) | 289 for (it = m_queue.begin (); it != m_queue.end (); it++) |
293 { | 290 { |
294 if (GetAddressForPacket (type, it) == addr) | 291 if (GetAddressForPacket (type, it) == addr) |
295 { | 292 { |
296 if (it->hdr.IsQosData () && it->hdr.GetQosTid () == tid) | 293 if (it->hdr.IsQosData () && it->hdr.GetQosTid () == tid) |
297 { | 294 { |
298 nPackets++; | 295 nPackets++; |
299 } | 296 } |
300 } | 297 } |
301 } | 298 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 { | 334 { |
338 *hdr = it->hdr; | 335 *hdr = it->hdr; |
339 timestamp = it->tstamp; | 336 timestamp = it->tstamp; |
340 return it->packet; | 337 return it->packet; |
341 } | 338 } |
342 } | 339 } |
343 return 0; | 340 return 0; |
344 } | 341 } |
345 | 342 |
346 } // namespace ns3 | 343 } // namespace ns3 |
LEFT | RIGHT |