--- a/SConstruct Wed Mar 28 19:26:58 2007 +0200
+++ b/SConstruct Wed Mar 28 19:38:56 2007 +0200
@@ -271,24 +271,13 @@
])
p2p = build.Ns3Module ('p2p', 'src/devices/p2p')
-#ns3.add (p2p)
-p2p.add_deps (['node'])
-p2p.add_sources ([
- 'p2p-net-device.cc',
- 'p2p-channel.cc',
- ])
-p2p.add_inst_headers ([
- 'p2p-net-device.h',
- 'p2p-channel.h',
- ])
-
-p2p = build.Ns3Module ('p2p', 'src/devices/p2p')
ns3.add (p2p)
p2p.add_deps (['node'])
p2p.add_sources ([
'p2p-net-device.cc',
'p2p-channel.cc',
'p2p-topology.cc',
+ 'p2p-ipv4-interface.cc',
])
p2p.add_headers ([
'propagator.h',
@@ -297,6 +286,7 @@
'p2p-net-device.h',
'p2p-channel.h',
'p2p-topology.h',
+ 'p2p-ipv4-interface.h',
])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/p2p/p2p-ipv4-interface.cc Wed Mar 28 19:38:56 2007 +0200
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
+ */
+#include "p2p-ipv4-interface.h"
+
+#include "ns3/packet.h"
+#include "ns3/net-device.h"
+#include "ns3/composite-trace-resolver.h"
+#include "ns3/ipv4.h"
+
+namespace ns3 {
+
+PointToPointIpv4Interface::PointToPointIpv4Interface (Node *node, NetDevice *device)
+ : Ipv4Interface (device),
+ m_node (node)
+{}
+PointToPointIpv4Interface::~PointToPointIpv4Interface ()
+{}
+
+void
+PointToPointIpv4Interface::SendTo (Packet p, Ipv4Address dest)
+{
+ GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4::PROT_NUMBER);
+}
+
+TraceResolver *
+PointToPointIpv4Interface::DoCreateTraceResolver (TraceContext const &context)
+{
+ CompositeTraceResolver *resolver = new CompositeTraceResolver (context);
+ resolver->Add ("netdevice",
+ MakeCallback (&NetDevice::CreateTraceResolver, GetDevice ()),
+ PointToPointIpv4Interface::NETDEVICE);
+ return resolver;
+
+}
+
+}//namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/p2p/p2p-ipv4-interface.h Wed Mar 28 19:38:56 2007 +0200
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Authors:
+ * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
+ */
+#ifndef POINT_TO_POINT_IPV4_INTERFACE_H
+#define POINT_TO_POINT_IPV4_INTERFACE_H
+
+#include "ns3/ipv4-interface.h"
+
+namespace ns3 {
+
+class Node;
+
+class PointToPointIpv4Interface : public Ipv4Interface
+{
+ public:
+ enum TraceType {
+ NETDEVICE,
+ };
+ PointToPointIpv4Interface (Node *node, NetDevice *device);
+ virtual ~PointToPointIpv4Interface ();
+
+ private:
+ virtual void SendTo (Packet p, Ipv4Address dest);
+ virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
+ Node *m_node;
+};
+
+}//namespace ns3
+
+
+#endif /* ARP_IPV4_INTERFACE_H */
--- a/src/devices/p2p/p2p-topology.cc Wed Mar 28 19:26:58 2007 +0200
+++ b/src/devices/p2p/p2p-topology.cc Wed Mar 28 19:38:56 2007 +0200
@@ -30,10 +30,10 @@
#include "ns3/internet-node.h"
#include "ns3/ipv4-address.h"
#include "ns3/drop-tail.h"
-#include "ns3/arp-ipv4-interface.h"
#include "ns3/ipv4.h"
#include "ns3/net-device-list.h"
+#include "p2p-ipv4-interface.h"
#include "p2p-channel.h"
#include "p2p-net-device.h"
#include "p2p-topology.h"
@@ -67,7 +67,7 @@
PointToPointNetDevice* net1 = new PointToPointNetDevice(n1);
net1->AddQueue(Queue::Default().Copy());
ndl1->Add(net1);
- Ipv4Interface *interf1 = new ArpIpv4Interface (n1, net1);
+ Ipv4Interface *interf1 = new PointToPointIpv4Interface (n1, net1);
uint32_t index1 = n1->GetIpv4 ()->AddInterface (interf1);
net1->Attach (channel);
@@ -78,7 +78,7 @@
PointToPointNetDevice* net2 = new PointToPointNetDevice(n2);
net2->AddQueue(Queue::Default().Copy());
ndl2->Add(net2);
- Ipv4Interface *interf2 = new ArpIpv4Interface (n2, net2);
+ Ipv4Interface *interf2 = new PointToPointIpv4Interface (n2, net2);
uint32_t index2 = n2->GetIpv4 ()->AddInterface (interf2);
net2->Attach (channel);