src/devices/csma/csma-net-device.cc
changeset 3460 99698bc858e8
parent 3448 0bd851bb1225
child 3476 b834a9204124
equal deleted inserted replaced
3459:a67df503c7bc 3460:99698bc858e8
   479     }
   479     }
   480 
   480 
   481   if (m_encapMode == RAW)
   481   if (m_encapMode == RAW)
   482     {
   482     {
   483       m_rxTrace (packet);
   483       m_rxTrace (packet);
   484       m_rxCallback (this, packet, 0, GetBroadcast (), GetAddress (), PACKET_HOST);
   484       if (!m_promiscRxCallback.IsNull ())
       
   485         {
       
   486           m_promiscRxCallback (this, packet, 0, GetBroadcast (), GetAddress (), PACKET_HOST);
       
   487         }
       
   488       m_rxCallback (this, packet, 0, GetBroadcast ());
   485       return;
   489       return;
   486     }
   490     }
   487 
   491 
   488 //
   492 //
   489 // Trace sinks will expect complete packets, not packets without some of the
   493 // Trace sinks will expect complete packets, not packets without some of the
   573       else
   577       else
   574         {
   578         {
   575           packetType = PACKET_OTHERHOST;
   579           packetType = PACKET_OTHERHOST;
   576         }
   580         }
   577       
   581       
   578       m_rxCallback (this, packet, protocol, header.GetSource (), header.GetDestination (), packetType);
   582       if (!m_promiscRxCallback.IsNull ())
       
   583         {
       
   584           m_promiscRxCallback (this, packet, protocol, header.GetSource (), header.GetDestination (), packetType);
       
   585         }
       
   586 
       
   587       if (packetType != PACKET_OTHERHOST)
       
   588         {
       
   589           m_rxCallback (this, packet, protocol, header.GetSource ());
       
   590         }
   579     }
   591     }
   580 }
   592 }
   581 
   593 
   582   Ptr<Queue>
   594   Ptr<Queue>
   583 CsmaNetDevice::GetQueue (void) const 
   595 CsmaNetDevice::GetQueue (void) const 
   845 CsmaNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
   857 CsmaNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
   846 {
   858 {
   847   m_rxCallback = cb;
   859   m_rxCallback = cb;
   848 }
   860 }
   849 
   861 
       
   862 void 
       
   863 CsmaNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
       
   864 {
       
   865   m_promiscRxCallback = cb;
       
   866 }
       
   867 
       
   868 bool 
       
   869 CsmaNetDevice::SupportsPromiscuous () const
       
   870 {
       
   871   return true;
       
   872 }
       
   873 
   850 } // namespace ns3
   874 } // namespace ns3