author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 10 May 2007 20:19:26 +0200 | |
changeset 568 | e1660959ecbb |
parent 553 | eb9d614accf0 |
child 604 | 0b6bef4e99bc |
permissions | -rw-r--r-- |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* All rights reserved. |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* Authors: |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
*/ |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
22 |
#include "ns3/empty-trace-resolver.h" |
524
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
522
diff
changeset
|
23 |
#include "ns3/net-device.h" |
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
522
diff
changeset
|
24 |
#include "ns3/node.h" |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ipv4-loopback-interface.h" |
522
d5039448597a
remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
499
diff
changeset
|
26 |
#include "i-ipv4-private.h" |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
|
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
namespace ns3 { |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
553
eb9d614accf0
convert more code to use Ptr<Node> instead of Node *
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
30 |
Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr<Node> node) |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
31 |
: Ipv4Interface (0), |
251
caea4ced7571
make rx work by upping the interface once it is ready
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
250
diff
changeset
|
32 |
m_node (node) |
553
eb9d614accf0
convert more code to use Ptr<Node> instead of Node *
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
33 |
{} |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
Ipv4LoopbackInterface::~Ipv4LoopbackInterface () |
553
eb9d614accf0
convert more code to use Ptr<Node> instead of Node *
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
35 |
{} |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
|
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
37 |
TraceResolver * |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
38 |
Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context) |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
39 |
{ |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
40 |
return new EmptyTraceResolver (context); |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
41 |
} |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
251
diff
changeset
|
42 |
|
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
void |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
{ |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
553
diff
changeset
|
46 |
Ptr<IIpv4Private> ipv4 = m_node->QueryInterface<IIpv4Private> (IIpv4Private::iid); |
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
553
diff
changeset
|
47 |
ipv4->Receive (packet, GetDevice ()); |
246
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
} |
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
|
612b3c16b24e
implement ipv4 loopback for testing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
}//namespace ns3 |