--- a/examples/mixed-wireless.cc Fri May 16 10:25:24 2008 -0700
+++ b/examples/mixed-wireless.cc Fri May 16 10:29:34 2008 -0700
@@ -268,7 +268,6 @@
{
subnetAlloc->Add (Vector (0.0, j, 0.0));
}
- mobility.EnableNotifier ();
mobility.PushReferenceMobilityModel (backbone.Get (i));
mobility.SetPositionAllocator (subnetAlloc);
mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
@@ -344,7 +343,7 @@
CsmaHelper::EnablePcap ("mixed-wireless", appSink->GetId (), 0);
#ifdef ENABLE_FOR_TRACING_EXAMPLE
- Config::Connect ("/NodeList/*/$MobilityModelNotifier/CourseChange",
+ Config::Connect ("/NodeList/*/$MobilityModel/CourseChange",
MakeCallback (&CourseChangeCallback));
#endif
--- a/samples/main-random-topology.cc Fri May 16 10:25:24 2008 -0700
+++ b/samples/main-random-topology.cc Fri May 16 10:29:34 2008 -0700
@@ -25,7 +25,6 @@
c.Create (10000);
MobilityHelper mobility;
- mobility.EnableNotifier ();
mobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
"X", StringValue ("100.0"),
"Y", StringValue ("100.0"),
--- a/samples/main-random-walk.cc Fri May 16 10:25:24 2008 -0700
+++ b/samples/main-random-walk.cc Fri May 16 10:29:34 2008 -0700
@@ -8,7 +8,7 @@
using namespace ns3;
static void
-CourseChange (ns3::TraceContext const&, Ptr<const MobilityModel> mobility)
+CourseChange (std::string foo, Ptr<const MobilityModel> mobility)
{
Vector pos = mobility->GetPosition ();
Vector vel = mobility->GetVelocity ();
@@ -22,7 +22,7 @@
Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Mode", StringValue ("Time"));
Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Time", StringValue ("2s"));
Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Speed", StringValue ("Constant:1.0"));
- Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Bounds", StringValue ("0:200:0:100"));
+ Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Bounds", StringValue ("0|200|0|200"));
CommandLine cmd;
cmd.Parse (argc, argv);
@@ -31,7 +31,6 @@
c.Create (100);
MobilityHelper mobility;
- mobility.EnableNotifier ();
mobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
"X", StringValue ("100.0"),
"Y", StringValue ("100.0"),
@@ -40,9 +39,9 @@
"Mode", StringValue ("Time"),
"Time", StringValue ("2s"),
"Speed", StringValue ("Constant:1.0"),
- "Bounds", StringValue ("0:200:0:100"));
+ "Bounds", StringValue ("0|200|0|200"));
mobility.InstallAll ();
- Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
+ Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
MakeCallback (&CourseChange));
Simulator::StopAt (Seconds (100.0));
--- a/src/applications/udp-echo/udp-echo-client.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/applications/udp-echo/udp-echo-client.cc Fri May 16 10:29:34 2008 -0700
@@ -93,7 +93,7 @@
{
NS_LOG_FUNCTION_NOARGS ();
- if (!m_socket)
+ if (m_socket == 0)
{
TypeId tid = TypeId::LookupByName ("ns3::Udp");
Ptr<SocketFactory> socketFactory =
@@ -113,10 +113,10 @@
{
NS_LOG_FUNCTION_NOARGS ();
- if (!m_socket)
+ if (m_socket != 0)
{
- m_socket->SetRecvCallback(MakeNullCallback<void, Ptr<Socket>, Ptr<Packet>,
- const Address &> ());
+ m_socket->SetRecvCallback(MakeNullCallback<void, Ptr<Socket>,
+ Ptr<Packet>, const Address &> ());
}
Simulator::Cancel(m_sendEvent);
--- a/src/applications/udp-echo/udp-echo-server.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/applications/udp-echo/udp-echo-server.cc Fri May 16 10:29:34 2008 -0700
@@ -69,13 +69,14 @@
{
NS_LOG_FUNCTION_NOARGS ();
- if (!m_socket)
+ if (m_socket == 0)
{
TypeId tid = TypeId::LookupByName ("ns3::Udp");
Ptr<SocketFactory> socketFactory =
GetNode ()->GetObject<SocketFactory> (tid);
m_socket = socketFactory->CreateSocket ();
- InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), m_port);
+ InetSocketAddress local =
+ InetSocketAddress (Ipv4Address::GetAny (), m_port);
m_socket->Bind (local);
}
@@ -87,7 +88,7 @@
{
NS_LOG_FUNCTION_NOARGS ();
- if (!m_socket)
+ if (m_socket != 0)
{
m_socket->SetRecvCallback(MakeNullCallback<void, Ptr<Socket>,
Ptr<Packet>, const Address &> ());
--- a/src/devices/csma/csma-net-device.h Fri May 16 10:25:24 2008 -0700
+++ b/src/devices/csma/csma-net-device.h Fri May 16 10:29:34 2008 -0700
@@ -420,7 +420,6 @@
* fire.
*
* @see class CallBackTraceSource
- * @see class TraceResolver
*/
TracedCallback<Ptr<const Packet> > m_rxTrace;
TracedCallback<Ptr<const Packet> > m_dropTrace;
--- a/src/devices/point-to-point/point-to-point-net-device.h Fri May 16 10:25:24 2008 -0700
+++ b/src/devices/point-to-point/point-to-point-net-device.h Fri May 16 10:29:34 2008 -0700
@@ -267,7 +267,6 @@
* fire.
*
* @see class CallBackTraceSource
- * @see class TraceResolver
*/
TracedCallback<Ptr<const Packet> > m_rxTrace;
/**
@@ -275,7 +274,6 @@
* fire.
*
* @see class CallBackTraceSource
- * @see class TraceResolver
*/
TracedCallback<Ptr<const Packet> > m_dropTrace;
--- a/src/helper/mobility-helper.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/helper/mobility-helper.cc Fri May 16 10:29:34 2008 -0700
@@ -19,7 +19,6 @@
*/
#include "ns3/mobility-helper.h"
#include "ns3/mobility-model.h"
-#include "ns3/mobility-model-notifier.h"
#include "ns3/position-allocator.h"
#include "ns3/hierarchical-mobility-model.h"
#include "ns3/log.h"
@@ -30,7 +29,6 @@
NS_LOG_COMPONENT_DEFINE ("MobilityHelper");
MobilityHelper::MobilityHelper ()
- : m_notifierEnabled (false)
{
m_position = CreateObject<RandomRectanglePositionAllocator>
("X", RandomVariableValue (ConstantVariable (0.0)),
@@ -40,16 +38,6 @@
MobilityHelper::~MobilityHelper ()
{}
void
-MobilityHelper::EnableNotifier (void)
-{
- m_notifierEnabled = true;
-}
-void
-MobilityHelper::DisableNotifier (void)
-{
- m_notifierEnabled = false;
-}
-void
MobilityHelper::SetPositionAllocator (Ptr<PositionAllocator> allocator)
{
m_position = allocator;
@@ -156,15 +144,6 @@
}
Vector position = m_position->GetNext ();
model->SetPosition (position);
- if (m_notifierEnabled)
- {
- Ptr<MobilityModelNotifier> notifier =
- object->GetObject<MobilityModelNotifier> ();
- if (notifier == 0)
- {
- object->AggregateObject (CreateObject<MobilityModelNotifier> ());
- }
- }
}
}
--- a/src/helper/mobility-helper.h Fri May 16 10:25:24 2008 -0700
+++ b/src/helper/mobility-helper.h Fri May 16 10:29:34 2008 -0700
@@ -43,20 +43,6 @@
~MobilityHelper ();
/**
- * After this method is called, every call to MobilityHelper::Install
- * will also attach to the new ns3::MobilityModel an ns3::MobilityModelNotifier
- * which can be used to listen to CourseChange events.
- */
- void EnableNotifier (void);
- /**
- * After this method is called, no ns3::MobilityModelNotifier object will
- * be associated to any new ns3::MobilityModel created by MobilityHelper::Install.
- * This will make it impossible to listen to "CourseChange" events from these
- * new ns3::MobilityModel instances.
- */
- void DisableNotifier (void);
-
- /**
* \param allocator allocate initial node positions
*
* Set the position allocator which will be used to allocate
@@ -169,9 +155,6 @@
* subclass (the type of which was set with MobilityHelper::SetMobilityModel),
* aggregates it to the mode, and sets an initial position based on the current
* position allocator (set through MobilityHelper::SetPositionAllocator).
- * Optionally, this method will also create and aggregate a
- * ns3::MobilityModelNotifier to generate 'CourseChange' events based on the
- * boolean flag set by MobilityHelper::EnableNotifierAll and MobilityHelper::DisableNotifier.
*/
void Install (NodeContainer container);
@@ -183,7 +166,6 @@
private:
std::vector<Ptr<MobilityModel> > m_mobilityStack;
- bool m_notifierEnabled;
ObjectFactory m_mobility;
Ptr<PositionAllocator> m_position;
};
--- a/src/helper/ns2-mobility-helper.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/helper/ns2-mobility-helper.cc Fri May 16 10:29:34 2008 -0700
@@ -24,7 +24,6 @@
#include "ns3/node-list.h"
#include "ns3/node.h"
#include "ns3/static-speed-mobility-model.h"
-#include "ns3/mobility-model-notifier.h"
#include "ns2-mobility-helper.h"
NS_LOG_COMPONENT_DEFINE ("Ns2MobilityHelper");
@@ -36,17 +35,6 @@
: m_filename (filename)
{}
-void
-Ns2MobilityHelper::EnableNotifier (void)
-{
- m_notifierEnabled = true;
-}
-void
-Ns2MobilityHelper::DisableNotifier (void)
-{
- m_notifierEnabled = false;
-}
-
Ptr<StaticSpeedMobilityModel>
@@ -67,12 +55,6 @@
model = CreateObject<StaticSpeedMobilityModel> ();
object->AggregateObject (model);
}
- Ptr<MobilityModelNotifier> notifier = object->GetObject<MobilityModelNotifier> ();
- if (notifier == 0)
- {
- notifier = CreateObject<MobilityModelNotifier> ();
- object->AggregateObject (notifier);
- }
return model;
}
--- a/src/helper/ns2-mobility-helper.h Fri May 16 10:25:24 2008 -0700
+++ b/src/helper/ns2-mobility-helper.h Fri May 16 10:29:34 2008 -0700
@@ -42,9 +42,6 @@
*/
Ns2MobilityHelper (std::string filename);
- void EnableNotifier (void);
- void DisableNotifier (void);
-
/**
* Read the ns2 trace file and configure the movement
* patterns of all nodes contained in the global ns3::NodeList
@@ -77,7 +74,6 @@
Ptr<StaticSpeedMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
double ReadDouble (std::string valueString) const;
std::string m_filename;
- bool m_notifierEnabled;
};
} // namespace ns3
--- a/src/internet-node/arp-l3-protocol.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/arp-l3-protocol.h Fri May 16 10:29:34 2008 -0700
@@ -31,7 +31,7 @@
class NetDevice;
class Node;
class Packet;
-class TraceContext;
+
/**
* \brief An implementation of the ARP protocol
*/
--- a/src/internet-node/ipv4-interface.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/ipv4-interface.h Fri May 16 10:29:34 2008 -0700
@@ -31,7 +31,6 @@
class NetDevice;
class Packet;
-class TraceContext;
/**
* \brief The IPv4 representation of a network interface
--- a/src/internet-node/ipv4-l4-demux.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/ipv4-l4-demux.h Fri May 16 10:29:34 2008 -0700
@@ -32,7 +32,6 @@
class Ipv4L4Protocol;
class Node;
-class TraceContext;
/**
* \brief L4 Ipv4 Demux
--- a/src/internet-node/ipv4-l4-protocol.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/ipv4-l4-protocol.h Fri May 16 10:29:34 2008 -0700
@@ -31,8 +31,6 @@
class Packet;
class Ipv4Address;
-class TraceResolver;
-class TraceContext;
/**
* \brief L4 Protocol base class
--- a/src/internet-node/tcp-l4-protocol.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/tcp-l4-protocol.h Fri May 16 10:29:34 2008 -0700
@@ -37,7 +37,6 @@
namespace ns3 {
class Node;
-class TraceContext;
class Socket;
class TcpHeader;
/**
--- a/src/internet-node/udp-l4-protocol.h Fri May 16 10:25:24 2008 -0700
+++ b/src/internet-node/udp-l4-protocol.h Fri May 16 10:29:34 2008 -0700
@@ -32,7 +32,6 @@
namespace ns3 {
class Node;
-class TraceContext;
class Socket;
/**
* \brief Implementation of the UDP protocol
--- a/src/mobility/hierarchical-mobility-model.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/mobility/hierarchical-mobility-model.cc Fri May 16 10:29:34 2008 -0700
@@ -18,7 +18,6 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "hierarchical-mobility-model.h"
-#include "mobility-model-notifier.h"
#include "ns3/pointer.h"
namespace ns3 {
@@ -52,28 +51,14 @@
HierarchicalMobilityModel::SetChild (Ptr<MobilityModel> model)
{
m_child = model;
- Ptr<MobilityModelNotifier> notifier =
- m_child->GetObject<MobilityModelNotifier> ();
- if (notifier == 0)
- {
- notifier = CreateObject<MobilityModelNotifier> ();
- m_child->AggregateObject (notifier);
- }
- notifier->TraceConnectWithoutContext ("CourseChange", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this));
+ m_child->TraceConnectWithoutContext ("CourseChange", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this));
}
void
HierarchicalMobilityModel::SetParent (Ptr<MobilityModel> model)
{
m_parent = model;
- Ptr<MobilityModelNotifier> notifier =
- m_parent->GetObject<MobilityModelNotifier> ();
- if (notifier == 0)
- {
- notifier = CreateObject<MobilityModelNotifier> ();
- m_parent->AggregateObject (notifier);
- }
- notifier->TraceConnectWithoutContext ("CourseChange", MakeCallback (&HierarchicalMobilityModel::ParentChanged, this));
+ m_parent->TraceConnectWithoutContext ("CourseChange", MakeCallback (&HierarchicalMobilityModel::ParentChanged, this));
}
--- a/src/mobility/mobility-model-notifier.cc Fri May 16 10:25:24 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "mobility-model-notifier.h"
-#include "ns3/trace-source-accessor.h"
-
-namespace ns3 {
-
-TypeId
-MobilityModelNotifier::GetTypeId (void)
-{
- static TypeId tid = TypeId ("MobilityModelNotifier")
- .SetParent<Object> ()
- .AddConstructor<MobilityModelNotifier> ()
- .AddTraceSource ("CourseChange",
- "The value of the position and/or velocity vector changed",
- MakeTraceSourceAccessor (&MobilityModelNotifier::m_trace))
- ;
- return tid;
-}
-
-MobilityModelNotifier::MobilityModelNotifier ()
-{}
-
-void
-MobilityModelNotifier::Notify (Ptr<const MobilityModel> position) const
-{
- m_trace (position);
-}
-
-} // namespace ns3
--- a/src/mobility/mobility-model-notifier.h Fri May 16 10:25:24 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef MOBILITY_MODEL_NOTIFIER_H
-#define MOBILITY_MODEL_NOTIFIER_H
-
-#include "ns3/object.h"
-#include "ns3/callback.h"
-#include "ns3/traced-callback.h"
-#include "mobility-model.h"
-
-namespace ns3 {
-
-/**
- * \brief notify listeners of position changes.
- */
-class MobilityModelNotifier : public Object
-{
-public:
- static TypeId GetTypeId (void);
-
- /**
- * Create a new position notifier
- */
- MobilityModelNotifier ();
-
- /**
- * \param position the position which just changed.
- */
- void Notify (Ptr<const MobilityModel> position) const;
-private:
- TracedCallback<Ptr<const MobilityModel> > m_trace;
-};
-
-} // namespace ns3
-
-#endif /* MOBILITY_MODEL_NOTIFIER_H */
--- a/src/mobility/mobility-model.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/mobility/mobility-model.cc Fri May 16 10:29:34 2008 -0700
@@ -17,9 +17,11 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
+#include <math.h>
+
#include "mobility-model.h"
-#include "mobility-model-notifier.h"
-#include <math.h>
+#include "ns3/trace-source-accessor.h"
namespace ns3 {
@@ -39,6 +41,9 @@
VectorValue (Vector (0.0, 0.0, 0.0)), // ignored initial value.
MakeVectorAccessor (&MobilityModel::GetVelocity),
MakeVectorChecker ())
+ .AddTraceSource ("CourseChange",
+ "The value of the position and/or velocity vector changed",
+ MakeTraceSourceAccessor (&MobilityModel::m_courseChangeTrace))
;
return tid;
}
@@ -77,11 +82,7 @@
void
MobilityModel::NotifyCourseChange (void) const
{
- Ptr<MobilityModelNotifier> notifier = GetObject<MobilityModelNotifier> ();
- if (notifier != 0)
- {
- notifier->Notify (this);
- }
+ m_courseChangeTrace(this);
}
} // namespace ns3
--- a/src/mobility/mobility-model.h Fri May 16 10:25:24 2008 -0700
+++ b/src/mobility/mobility-model.h Fri May 16 10:29:34 2008 -0700
@@ -20,8 +20,10 @@
#ifndef MOBILITY_MODEL_H
#define MOBILITY_MODEL_H
+#include "vector.h"
+
#include "ns3/object.h"
-#include "vector.h"
+#include "ns3/traced-callback.h"
namespace ns3 {
@@ -84,6 +86,13 @@
* implement this method.
*/
virtual Vector DoGetVelocity (void) const = 0;
+
+ /**
+ * Used to alert subscribers that a change in direction, velocity,
+ * or position has occurred.
+ */
+ TracedCallback<Ptr<const MobilityModel> > m_courseChangeTrace;
+
};
}; // namespace ns3
--- a/src/mobility/mobility.h Fri May 16 10:25:24 2008 -0700
+++ b/src/mobility/mobility.h Fri May 16 10:29:34 2008 -0700
@@ -5,8 +5,8 @@
* - a set of mobility models which are used to track and maintain
* the "current" cartesian position and speed of an object.
*
- * - a "course change notifier" which can be used to register listeners
- * to the course changes of a mobility model: ns3::MobilityModelNotifier.
+ * - a "course change notifier" trace which can be used to register
+ * listeners to the course changes of a mobility model
*
* The mobility models themselves are:
* - ns3::StaticMobilityModel: a model which maintains a constant position
--- a/src/mobility/wscript Fri May 16 10:25:24 2008 -0700
+++ b/src/mobility/wscript Fri May 16 10:29:34 2008 -0700
@@ -6,7 +6,6 @@
'vector.cc',
'hierarchical-mobility-model.cc',
'mobility-model.cc',
- 'mobility-model-notifier.cc',
'position-allocator.cc',
'rectangle.cc',
'static-mobility-model.cc',
@@ -23,7 +22,6 @@
'vector.h',
'hierarchical-mobility-model.h',
'mobility-model.h',
- 'mobility-model-notifier.h',
'position-allocator.h',
'rectangle.h',
'static-mobility-model.h',
--- a/src/node/net-device.h Fri May 16 10:25:24 2008 -0700
+++ b/src/node/net-device.h Fri May 16 10:29:34 2008 -0700
@@ -32,7 +32,6 @@
namespace ns3 {
class Node;
-class TraceContext;
class Channel;
class Packet;
--- a/src/node/node.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/node/node.cc Fri May 16 10:29:34 2008 -0700
@@ -186,6 +186,11 @@
uint16_t protocol, const Address &from)
{
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++)
{
@@ -195,7 +200,7 @@
if (i->protocol == 0 ||
i->protocol == protocol)
{
- i->handler (device, packet, protocol, from);
+ i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from);
found = true;
}
}
--- a/src/node/node.h Fri May 16 10:25:24 2008 -0700
+++ b/src/node/node.h Fri May 16 10:29:34 2008 -0700
@@ -29,7 +29,6 @@
namespace ns3 {
-class TraceContext;
class NetDevice;
class Application;
class Packet;
--- a/src/node/packet-socket.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/node/packet-socket.cc Fri May 16 10:29:34 2008 -0700
@@ -111,11 +111,11 @@
Ptr<NetDevice> dev ;
if (address.IsSingleDevice ())
{
- dev = 0;
+ dev = m_node->GetDevice (address.GetSingleDevice ());
}
else
{
- dev = m_node->GetDevice (address.GetSingleDevice ());
+ dev = 0;
}
m_node->RegisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this),
address.GetProtocol (), dev);
--- a/src/routing/global-routing/global-router-interface.cc Fri May 16 10:25:24 2008 -0700
+++ b/src/routing/global-routing/global-router-interface.cc Fri May 16 10:29:34 2008 -0700
@@ -533,6 +533,21 @@
{
Ptr<NetDevice> ndLocal = node->GetDevice(i);
+ // Check if it is an IP interface (could be a pure L2 NetDevice)
+ bool isIp = false;
+ for (uint32_t i = 0; i < ipv4Local->GetNInterfaces (); ++i )
+ {
+ if (ipv4Local->GetNetDevice (i) == ndLocal)
+ {
+ isIp = true;
+ break;
+ }
+ }
+ if (!isIp)
+ {
+ continue;
+ }
+
if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () )
{
NS_LOG_LOGIC ("Broadcast link");
@@ -623,6 +638,10 @@
// router (to use OSPF lingo) is running.
//
Ptr<Channel> ch = ndLocal->GetChannel();
+ if (ch == NULL)
+ {
+ continue;
+ }
Ptr<NetDevice> ndRemote = GetAdjacent(ndLocal, ch);
//
// The adjacent net device is aggregated to a node. We need to ask that net