--- a/src/node/node.cc Mon Aug 25 09:05:41 2008 -0700
+++ b/src/node/node.cc Mon Aug 25 09:13:05 2008 -0700
@@ -222,7 +222,7 @@
}
bool
-Node::PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol,
+Node::PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
const Address &from, const Address &to, NetDevice::PacketType packetType)
{
NS_LOG_FUNCTION(device->GetName ());
@@ -230,7 +230,7 @@
}
bool
-Node::NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol,
+Node::NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
const Address &from)
{
NS_LOG_FUNCTION(device->GetName ());
@@ -238,15 +238,11 @@
}
bool
-Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol,
+Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous)
{
NS_LOG_FUNCTION(device->GetName ());
bool found = false;
- // if there are (potentially) multiple handlers, we need to copy the
- // packet before passing it to each handler, because handlers may
- // modify it.
- bool copyNeeded = (m_handlers.size () > 1);
for (ProtocolHandlerList::iterator i = m_handlers.begin ();
i != m_handlers.end (); i++)
@@ -259,7 +255,7 @@
{
if (promiscuous == i->promiscuous)
{
- i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from, to, packetType);
+ i->handler (device, packet->Copy (), protocol, from, to, packetType);
found = true;
}
}