Guest User

Untitled

a guest
Sep 10th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. bool
  2. PointToPointNetDevice::Send (
  3. Ptr<Packet> packet,
  4. const Address &dest,
  5. uint16_t protocolNumber)
  6. {
  7. NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
  8. NS_LOG_LOGIC ("p=" << packet << ", dest=" << &dest);
  9. NS_LOG_LOGIC ("UID is " << packet->GetUid ());
  10.  
  11. //
  12. // If IsLinkUp() is false it means there is no channel to send any packet
  13. // over so we just hit the drop trace on the packet and return an error.
  14. //
  15. if (IsLinkUp () == false)
  16. {
  17. m_macTxDropTrace (packet);
  18. return false;
  19. }
  20.  
  21. //
  22. // Stick a point to point protocol header on the packet in preparation for
  23. // shoving it out the door.
  24. //
  25. AddHeader (packet, protocolNumber);
  26.  
  27. m_macTxTrace (packet);
  28.  
  29. //
  30. // We should enqueue and dequeue the packet to hit the tracing hooks.
  31. //
  32. if (m_queue->Enqueue (packet))
  33. {
  34. //
  35. // If the channel is ready for transition we send the packet right now
  36. //
  37. if (m_txMachineState == READY)
  38. {
  39. packet = m_queue->Dequeue ();
  40. m_snifferTrace (packet);
  41. m_promiscSnifferTrace (packet);
  42. return TransmitStart (packet);
  43. }
  44. return true;
  45. }
  46.  
  47. // Enqueue may fail (overflow)
  48. m_macTxDropTrace (packet);
  49. return false;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment