bug 273: constify packet pointers.
This commit is contained in:
@@ -222,7 +222,7 @@ Node::UnregisterProtocolHandler (ProtocolHandler handler)
|
||||
}
|
||||
|
||||
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 @@ Node::PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint1
|
||||
}
|
||||
|
||||
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 @@ Node::NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, ui
|
||||
}
|
||||
|
||||
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 @@ Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t pro
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user