|
Lines 222-228
Node::UnregisterProtocolHandler (Protoco
|
Link Here
|
|---|
|
| 222 |
} |
222 |
} |
| 223 |
|
223 |
|
| 224 |
bool |
224 |
bool |
| 225 |
Node::PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol, |
225 |
Node::PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, |
| 226 |
const Address &from, const Address &to, NetDevice::PacketType packetType) |
226 |
const Address &from, const Address &to, NetDevice::PacketType packetType) |
| 227 |
{ |
227 |
{ |
| 228 |
NS_LOG_FUNCTION(device->GetName ()); |
228 |
NS_LOG_FUNCTION(device->GetName ()); |
|
Lines 230-236
Node::PromiscReceiveFromDevice (Ptr<NetD
|
Link Here
|
|---|
|
| 230 |
} |
230 |
} |
| 231 |
|
231 |
|
| 232 |
bool |
232 |
bool |
| 233 |
Node::NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol, |
233 |
Node::NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, |
| 234 |
const Address &from) |
234 |
const Address &from) |
| 235 |
{ |
235 |
{ |
| 236 |
NS_LOG_FUNCTION(device->GetName ()); |
236 |
NS_LOG_FUNCTION(device->GetName ()); |
|
Lines 238-252
Node::NonPromiscReceiveFromDevice (Ptr<N
|
Link Here
|
|---|
|
| 238 |
} |
238 |
} |
| 239 |
|
239 |
|
| 240 |
bool |
240 |
bool |
| 241 |
Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol, |
241 |
Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, |
| 242 |
const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous) |
242 |
const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous) |
| 243 |
{ |
243 |
{ |
| 244 |
NS_LOG_FUNCTION(device->GetName ()); |
244 |
NS_LOG_FUNCTION(device->GetName ()); |
| 245 |
bool found = false; |
245 |
bool found = false; |
| 246 |
// if there are (potentially) multiple handlers, we need to copy the |
|
|
| 247 |
// packet before passing it to each handler, because handlers may |
| 248 |
// modify it. |
| 249 |
bool copyNeeded = (m_handlers.size () > 1); |
| 250 |
|
246 |
|
| 251 |
for (ProtocolHandlerList::iterator i = m_handlers.begin (); |
247 |
for (ProtocolHandlerList::iterator i = m_handlers.begin (); |
| 252 |
i != m_handlers.end (); i++) |
248 |
i != m_handlers.end (); i++) |
|
Lines 259-265
Node::ReceiveFromDevice (Ptr<NetDevice>
|
Link Here
|
|---|
|
| 259 |
{ |
255 |
{ |
| 260 |
if (promiscuous == i->promiscuous) |
256 |
if (promiscuous == i->promiscuous) |
| 261 |
{ |
257 |
{ |
| 262 |
i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from, to, packetType); |
258 |
i->handler (device, packet->Copy (), protocol, from, to, packetType); |
| 263 |
found = true; |
259 |
found = true; |
| 264 |
} |
260 |
} |
| 265 |
} |
261 |
} |