OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006 Georgia Tech Research Corporation, INRIA | 3 * Copyright (c) 2006 Georgia Tech Research Corporation, INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "node.h" | 21 #include "node.h" |
22 #include "node-list.h" | 22 #include "node-list.h" |
23 #include "net-device.h" | 23 #include "net-device.h" |
24 #include "application.h" | 24 #include "application.h" |
25 #include "ns3/packet.h" | 25 #include "ns3/packet.h" |
26 #include "ns3/simulator.h" | 26 #include "ns3/simulator.h" |
27 #include "ns3/object-vector.h" | 27 #include "ns3/object-vector.h" |
28 #include "ns3/uinteger.h" | 28 #include "ns3/uinteger.h" |
29 #include "ns3/log.h" | 29 #include "ns3/log.h" |
30 #include "ns3/assert.h" | 30 #include "ns3/assert.h" |
| 31 #include "ns3/socket.h" |
31 | 32 |
32 NS_LOG_COMPONENT_DEFINE ("Node"); | 33 NS_LOG_COMPONENT_DEFINE ("Node"); |
33 | 34 |
34 namespace ns3{ | 35 namespace ns3{ |
35 | 36 |
36 NS_OBJECT_ENSURE_REGISTERED (Node); | 37 NS_OBJECT_ENSURE_REGISTERED (Node); |
37 | 38 |
38 TypeId· | 39 TypeId· |
39 Node::GetTypeId (void) | 40 Node::GetTypeId (void) |
40 { | 41 { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 bool | 241 bool |
241 Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16
_t protocol, | 242 Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16
_t protocol, |
242 const Address &from, const Address &to, NetDevice::Pack
etType packetType, bool promiscuous) | 243 const Address &from, const Address &to, NetDevice::Pack
etType packetType, bool promiscuous) |
243 { | 244 { |
244 NS_LOG_DEBUG("Node " << GetId () << " ReceiveFromDevice: dev " | 245 NS_LOG_DEBUG("Node " << GetId () << " ReceiveFromDevice: dev " |
245 << device->GetIfIndex () << " (" | 246 << device->GetIfIndex () << " (" |
246 << device->GetName () << " type " << device->GetInstanceTypeId ()
.GetName () | 247 << device->GetName () << " type " << device->GetInstanceTypeId ()
.GetName () |
247 << ") Packet UID " << packet->GetUid ()); | 248 << ") Packet UID " << packet->GetUid ()); |
248 bool found = false; | 249 bool found = false; |
249 | 250 |
| 251 SocketRecvIfTag tag; |
| 252 tag.SetRecvIf (device->GetIfIndex()); |
| 253 packet->AddTag (tag); |
| 254 |
250 for (ProtocolHandlerList::iterator i = m_handlers.begin (); | 255 for (ProtocolHandlerList::iterator i = m_handlers.begin (); |
251 i != m_handlers.end (); i++) | 256 i != m_handlers.end (); i++) |
252 { | 257 { |
253 if (i->device == 0 || | 258 if (i->device == 0 || |
254 (i->device != 0 && i->device == device)) | 259 (i->device != 0 && i->device == device)) |
255 { | 260 { |
256 if (i->protocol == 0 ||· | 261 if (i->protocol == 0 ||· |
257 i->protocol == protocol) | 262 i->protocol == protocol) |
258 { | 263 { |
259 if (promiscuous == i->promiscuous) | 264 if (promiscuous == i->promiscuous) |
260 { | 265 { |
261 i->handler (device, packet, protocol, from, to, packetType); | 266 i->handler (device, packet, protocol, from, to, packetType); |
262 found = true; | 267 found = true; |
263 } | 268 } |
264 } | 269 } |
265 } | 270 } |
266 } | 271 } |
267 return found; | 272 return found; |
268 } | 273 } |
269 | 274 |
270 }//namespace ns3 | 275 }//namespace ns3 |
OLD | NEW |