diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 6c145317f..f9742c649 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -98,8 +98,13 @@ CsmaNetDevice::GetTypeId (void) .AddTraceSource ("MacTxDrop", "Trace source indicating a packet has been dropped by the device before transmission", MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxDropTrace)) + .AddTraceSource ("MacPromiscRx", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a promiscuous trace,", + MakeTraceSourceAccessor (&CsmaNetDevice::m_macPromiscRxTrace)) .AddTraceSource ("MacRx", - "Trace source indicating a packet has been received by this device and is being forwarded up the stack", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,", MakeTraceSourceAccessor (&CsmaNetDevice::m_macRxTrace)) #if 0 // Not currently implemented in this device @@ -831,6 +836,7 @@ CsmaNetDevice::Receive (Ptr packet, Ptr senderDevice) m_promiscSnifferTrace (originalPacket); if (!m_promiscRxCallback.IsNull ()) { + m_macPromiscRxTrace (originalPacket); m_promiscRxCallback (this, packet, protocol, header.GetSource (), header.GetDestination (), packetType); } diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 65e9cbab1..8fe4c487d 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -662,7 +662,16 @@ private: /** * The trace source fired for packets successfully received by the device * immediately before being forwarded up to higher layers (at the L2/L3 - * transition). + * transition). This is a promiscuous trace. + * + * \see class CallBackTraceSource + */ + TracedCallback > m_macPromiscRxTrace; + + /** + * The trace source fired for packets successfully received by the device + * immediately before being forwarded up to higher layers (at the L2/L3 + * transition). This is a non-promiscuous trace. * * \see class CallBackTraceSource */ diff --git a/src/devices/emu/emu-net-device.cc b/src/devices/emu/emu-net-device.cc index 1ab91c0a7..0a987850e 100644 --- a/src/devices/emu/emu-net-device.cc +++ b/src/devices/emu/emu-net-device.cc @@ -110,8 +110,13 @@ EmuNetDevice::GetTypeId (void) .AddTraceSource ("MacTxDrop", "Trace source indicating a packet has been dropped by the device before transmission", MakeTraceSourceAccessor (&EmuNetDevice::m_macTxDropTrace)) + .AddTraceSource ("MacPromiscRx", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a promiscuous trace,", + MakeTraceSourceAccessor (&EmuNetDevice::m_macPromiscRxTrace)) .AddTraceSource ("MacRx", - "Trace source indicating a packet has been received by this device and is being forwarded up the stack", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,", MakeTraceSourceAccessor (&EmuNetDevice::m_macRxTrace)) #if 0 // Not currently implemented for this device @@ -646,6 +651,7 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) if (!m_promiscRxCallback.IsNull ()) { + m_macPromiscRxTrace (originalPacket); m_promiscRxCallback (this, packet, protocol, header.GetSource (), header.GetDestination (), packetType); } diff --git a/src/devices/emu/emu-net-device.h b/src/devices/emu/emu-net-device.h index 11e0af244..02947cb53 100644 --- a/src/devices/emu/emu-net-device.h +++ b/src/devices/emu/emu-net-device.h @@ -282,7 +282,16 @@ private: /** * The trace source fired for packets successfully received by the device * immediately before being forwarded up to higher layers (at the L2/L3 - * transition). + * transition). This is a promiscuous trace. + * + * \see class CallBackTraceSource + */ + TracedCallback > m_macPromiscRxTrace; + + /** + * The trace source fired for packets successfully received by the device + * immediately before being forwarded up to higher layers (at the L2/L3 + * transition). This is a non-promiscuous trace. * * \see class CallBackTraceSource */ diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 4a4376e52..e5cd12384 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -88,8 +88,13 @@ PointToPointNetDevice::GetTypeId (void) .AddTraceSource ("MacTxDrop", "Trace source indicating a packet has been dropped by the device before transmission", MakeTraceSourceAccessor (&PointToPointNetDevice::m_macTxDropTrace)) + .AddTraceSource ("MacPromiscRx", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a promiscuous trace,", + MakeTraceSourceAccessor (&PointToPointNetDevice::m_macPromiscRxTrace)) .AddTraceSource ("MacRx", - "Trace source indicating a packet has been received by this device and is being forwarded up the stack", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,", MakeTraceSourceAccessor (&PointToPointNetDevice::m_macRxTrace)) #if 0 // Not currently implemented for this device @@ -324,12 +329,12 @@ PointToPointNetDevice::Receive (Ptr packet) { // // Hit the trace hooks. All of these hooks are in the same place in this - // device becuase it is so simple, but this is not usually the case. + // device becuase it is so simple, but this is not usually the case in + // more complicated devices. // m_snifferTrace (packet); m_promiscSnifferTrace (packet); m_phyRxEndTrace (packet); - m_macRxTrace (packet); // // Strip off the point-to-point protocol header and forward this packet @@ -341,9 +346,11 @@ PointToPointNetDevice::Receive (Ptr packet) if (!m_promiscCallback.IsNull ()) { + m_macPromiscRxTrace (packet); m_promiscCallback (this, packet, protocol, GetRemote (), GetAddress (), NetDevice::PACKET_HOST); } + m_macRxTrace (packet); m_rxCallback (this, packet, protocol, GetRemote ()); } } diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 9ede84677..5af6c9c66 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -411,7 +411,18 @@ private: /** * The trace source fired for packets successfully received by the device * immediately before being forwarded up to higher layers (at the L2/L3 - * transition). + * transition). This is a promiscuous trace (which doesn't mean a lot here + * in the point-to-point device). + * + * \see class CallBackTraceSource + */ + TracedCallback > m_macPromiscRxTrace; + + /** + * The trace source fired for packets successfully received by the device + * immediately before being forwarded up to higher layers (at the L2/L3 + * transition). This is a non-promiscuous trace (which doesn't mean a lot + * here in the point-to-point device). * * \see class CallBackTraceSource */ diff --git a/src/devices/wifi/adhoc-wifi-mac.cc b/src/devices/wifi/adhoc-wifi-mac.cc index c5da69581..d7539d738 100644 --- a/src/devices/wifi/adhoc-wifi-mac.cc +++ b/src/devices/wifi/adhoc-wifi-mac.cc @@ -235,7 +235,6 @@ AdhocWifiMac::Enqueue (Ptr packet, Mac48Address to) destination->RecordDisassociated (); } - NotifyTx (packet); m_dca->Queue (packet, hdr); } bool @@ -248,7 +247,6 @@ void AdhocWifiMac::ForwardUp (Ptr packet, WifiMacHeader const *hdr) { NS_LOG_DEBUG ("received size="<GetSize ()<<", from="<GetAddr2 ()); - NotifyRx (packet); m_upCallback (packet, hdr->GetAddr2 (), hdr->GetAddr1 ()); } Ptr diff --git a/src/devices/wifi/nqap-wifi-mac.cc b/src/devices/wifi/nqap-wifi-mac.cc index d0d1450da..85c91364a 100644 --- a/src/devices/wifi/nqap-wifi-mac.cc +++ b/src/devices/wifi/nqap-wifi-mac.cc @@ -286,7 +286,6 @@ void NqapWifiMac::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) { NS_LOG_FUNCTION (this << packet << from); - NotifyRx (packet); m_upCallback (packet, from, to); } @@ -302,7 +301,6 @@ NqapWifiMac::ForwardDown (Ptr packet, Mac48Address from, Mac48Addr hdr.SetDsFrom (); hdr.SetDsNotTo (); - NotifyTx (packet); m_dca->Queue (packet, hdr); } void diff --git a/src/devices/wifi/nqsta-wifi-mac.cc b/src/devices/wifi/nqsta-wifi-mac.cc index 0a086d8bd..7a78f071f 100644 --- a/src/devices/wifi/nqsta-wifi-mac.cc +++ b/src/devices/wifi/nqsta-wifi-mac.cc @@ -322,7 +322,6 @@ void NqstaWifiMac::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) { NS_LOG_FUNCTION (this << packet << from << to); - NotifyRx (packet); m_forwardUp (packet, from, to); } void @@ -481,7 +480,6 @@ NqstaWifiMac::Enqueue (Ptr packet, Mac48Address to) hdr.SetDsNotFrom (); hdr.SetDsTo (); - NotifyTx (packet); m_dca->Queue (packet, hdr); } diff --git a/src/devices/wifi/wifi-mac.cc b/src/devices/wifi/wifi-mac.cc index ee6eb08f1..0bc0852c2 100644 --- a/src/devices/wifi/wifi-mac.cc +++ b/src/devices/wifi/wifi-mac.cc @@ -124,9 +124,13 @@ WifiMac::GetTypeId (void) .AddTraceSource ("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.", MakeTraceSourceAccessor (&WifiMac::m_macTxDropTrace)) + .AddTraceSource ("MacPromiscRx", + "A packet has been received by this device, has been passed up from the physical layer " + "and is being forwarded up the local protocol stack. This is a promiscuous trace,", + MakeTraceSourceAccessor (&WifiMac::m_macPromiscRxTrace)) .AddTraceSource ("MacRx", "A packet has been received by this device, has been passed up from the physical layer " - "and is being forwarded up the local protocol stack.", + "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,", MakeTraceSourceAccessor (&WifiMac::m_macRxTrace)) .AddTraceSource ("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical " @@ -184,6 +188,12 @@ WifiMac::NotifyRx (Ptr packet) m_macRxTrace (packet); } +void +WifiMac::NotifyPromiscRx (Ptr packet) +{ + m_macPromiscRxTrace (packet); +} + void WifiMac::NotifyRxDrop (Ptr packet) { diff --git a/src/devices/wifi/wifi-mac.h b/src/devices/wifi/wifi-mac.h index 1c0c19a33..55efb553e 100644 --- a/src/devices/wifi/wifi-mac.h +++ b/src/devices/wifi/wifi-mac.h @@ -195,6 +195,12 @@ public: */ void NotifyRx (Ptr packet); + /** + * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation + * purposes. + */ + void NotifyPromiscRx (Ptr packet); + /** * Public method used to fire a MacRxDrop trace. Implemented for encapsulation * purposes. @@ -231,7 +237,16 @@ private: /** * The trace source fired for packets successfully received by the device * immediately before being forwarded up to higher layers (at the L2/L3 - * transition). + * transition). This is a promiscuous trace. + * + * \see class CallBackTraceSource + */ + TracedCallback > m_macPromiscRxTrace; + + /** + * The trace source fired for packets successfully received by the device + * immediately before being forwarded up to higher layers (at the L2/L3 + * transition). This is a non- promiscuous trace. * * \see class CallBackTraceSource */ diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index d5bd21574..5f67c2224 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -250,8 +250,7 @@ WifiNetDevice::Send (Ptr packet, const Address& dest, uint16_t protocolN llc.SetType (protocolNumber); packet->AddHeader (llc); - m_txLogger (packet, realTo); - + m_mac->NotifyTx (packet); m_mac->Enqueue (packet, realTo); return true; } @@ -280,7 +279,6 @@ WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) void WifiNetDevice::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) { - m_rxLogger (packet, from); LlcSnapHeader llc; packet->RemoveHeader (llc); enum NetDevice::PacketType type; @@ -303,11 +301,13 @@ WifiNetDevice::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to if (type != NetDevice::PACKET_OTHERHOST) { + m_mac->NotifyRx (packet); m_forwardUp (this, packet, llc.GetType (), from); } if (!m_promiscRx.IsNull ()) { + m_mac->NotifyPromiscRx (packet); m_promiscRx (this, packet, llc.GetType (), from, to, type); } } @@ -344,8 +344,7 @@ WifiNetDevice::SendFrom (Ptr packet, const Address& source, const Addres llc.SetType (protocolNumber); packet->AddHeader (llc); - m_txLogger (packet, realTo); - + m_mac->NotifyTx (packet); m_mac->Enqueue (packet, realTo, realFrom); return true;