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) 2010 CTTC | 3 * Copyright (c) 2010 CTTC |
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 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 { | 371 { |
372 if (m_queue->IsEmpty ()) | 372 if (m_queue->IsEmpty ()) |
373 { | 373 { |
374 NS_LOG_LOGIC ("new packet is head of queue, starting TX immediately"); | 374 NS_LOG_LOGIC ("new packet is head of queue, starting TX immediately"); |
375 m_currentPkt = packet; | 375 m_currentPkt = packet; |
376 StartTransmission (); | 376 StartTransmission (); |
377 } | 377 } |
378 else | 378 else |
379 { | 379 { |
380 NS_LOG_LOGIC ("enqueueing new packet"); | 380 NS_LOG_LOGIC ("enqueueing new packet"); |
381 if (m_queue->Enqueue (packet) == false) | 381 if (m_queue->Enqueue (Create<QueueItem> (packet)) == false) |
382 { | 382 { |
383 m_macTxDropTrace (packet); | 383 // Do not fire the drop trace if the packet will be re-queued by t
he queue disc |
| 384 if (!IsQueueDiscInstalled ()) |
| 385 { |
| 386 m_macTxDropTrace (packet); |
| 387 } |
384 sendOk = false; | 388 sendOk = false; |
385 } | 389 } |
386 } | 390 } |
387 } | 391 } |
388 else | 392 else |
389 { | 393 { |
390 NS_LOG_LOGIC ("deferring TX, enqueueing new packet"); | 394 NS_LOG_LOGIC ("deferring TX, enqueueing new packet"); |
391 NS_ASSERT (m_queue); | 395 NS_ASSERT (m_queue); |
392 if (m_queue->Enqueue (packet) == false) | 396 if (m_queue->Enqueue (Create<QueueItem> (packet)) == false) |
393 { | 397 { |
394 m_macTxDropTrace (packet); | 398 // Do not fire the drop trace if the packet will be re-queued by the q
ueue disc |
| 399 if (!IsQueueDiscInstalled ()) |
| 400 { |
| 401 m_macTxDropTrace (packet); |
| 402 } |
395 sendOk = false; | 403 sendOk = false; |
396 } | 404 } |
397 } | 405 } |
398 return sendOk; | 406 return sendOk; |
399 } | 407 } |
400 | 408 |
401 void | 409 void |
402 AlohaNoackNetDevice::SetGenericPhyTxStartCallback (GenericPhyTxStartCallback c) | 410 AlohaNoackNetDevice::SetGenericPhyTxStartCallback (GenericPhyTxStartCallback c) |
403 { | 411 { |
404 NS_LOG_FUNCTION (this); | 412 NS_LOG_FUNCTION (this); |
(...skipping 22 matching lines...) Expand all Loading... |
427 | 435 |
428 void | 436 void |
429 AlohaNoackNetDevice::NotifyTransmissionEnd (Ptr<const Packet>) | 437 AlohaNoackNetDevice::NotifyTransmissionEnd (Ptr<const Packet>) |
430 { | 438 { |
431 NS_LOG_FUNCTION (this); | 439 NS_LOG_FUNCTION (this); |
432 NS_ASSERT_MSG (m_state == TX, "TX end notified while state != TX"); | 440 NS_ASSERT_MSG (m_state == TX, "TX end notified while state != TX"); |
433 m_state = IDLE; | 441 m_state = IDLE; |
434 NS_ASSERT (m_queue); | 442 NS_ASSERT (m_queue); |
435 if (m_queue->IsEmpty () == false) | 443 if (m_queue->IsEmpty () == false) |
436 { | 444 { |
437 m_currentPkt = m_queue->Dequeue (); | 445 Ptr<QueueItem> item = m_queue->Dequeue (); |
438 NS_ASSERT (m_currentPkt); | 446 NS_ASSERT (item); |
| 447 m_currentPkt = item->GetPacket (); |
439 NS_LOG_LOGIC ("scheduling transmission now"); | 448 NS_LOG_LOGIC ("scheduling transmission now"); |
440 Simulator::ScheduleNow (&AlohaNoackNetDevice::StartTransmission, this); | 449 Simulator::ScheduleNow (&AlohaNoackNetDevice::StartTransmission, this); |
441 } | 450 } |
442 } | 451 } |
443 | 452 |
444 | 453 |
445 void | 454 void |
446 AlohaNoackNetDevice::NotifyReceptionStart () | 455 AlohaNoackNetDevice::NotifyReceptionStart () |
447 { | 456 { |
448 NS_LOG_FUNCTION (this); | 457 NS_LOG_FUNCTION (this); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 507 |
499 if (packetType != PACKET_OTHERHOST) | 508 if (packetType != PACKET_OTHERHOST) |
500 { | 509 { |
501 m_rxCallback (this, packet, llc.GetType (), header.GetSource () ); | 510 m_rxCallback (this, packet, llc.GetType (), header.GetSource () ); |
502 } | 511 } |
503 } | 512 } |
504 | 513 |
505 | 514 |
506 | 515 |
507 } // namespace ns3 | 516 } // namespace ns3 |
OLD | NEW |