From 308d109968ccc56962c89920d007765448b6488a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 9 Aug 2007 21:25:23 +0200 Subject: [PATCH 001/218] remove TraceContext argument from TraceResolver constructor and move it to Connect --- src/common/array-trace-resolver.h | 14 +++---- src/common/composite-trace-resolver.cc | 36 +++++++++--------- src/common/composite-trace-resolver.h | 37 +++++++++---------- src/common/empty-trace-resolver.cc | 3 +- src/common/empty-trace-resolver.h | 2 +- src/common/terminal-trace-resolver.h | 14 +++---- src/common/trace-resolver.cc | 23 ++++-------- src/common/trace-resolver.h | 21 ++--------- src/common/trace-root.cc | 6 +-- src/common/trace-root.h | 2 +- src/devices/csma-cd/csma-cd-net-device.cc | 4 +- src/devices/csma-cd/csma-cd-net-device.h | 2 +- .../point-to-point-net-device.cc | 5 +-- .../point-to-point-net-device.h | 2 +- src/internet-node/arp-ipv4-interface.cc | 4 +- src/internet-node/arp-ipv4-interface.h | 2 +- src/internet-node/arp-l3-protocol.cc | 4 +- src/internet-node/arp-l3-protocol.h | 2 +- src/internet-node/ipv4-interface.cc | 4 +- src/internet-node/ipv4-interface.h | 4 +- src/internet-node/ipv4-l3-protocol.cc | 9 ++--- src/internet-node/ipv4-l3-protocol.h | 4 +- src/internet-node/ipv4-l4-demux.cc | 4 +- src/internet-node/ipv4-l4-demux.h | 2 +- src/internet-node/ipv4-l4-protocol.h | 2 +- src/internet-node/ipv4-loopback-interface.cc | 4 +- src/internet-node/ipv4-loopback-interface.h | 2 +- src/internet-node/udp-l4-protocol.cc | 4 +- src/internet-node/udp-l4-protocol.h | 2 +- src/node/net-device.cc | 4 +- src/node/net-device.h | 4 +- src/node/node-list.cc | 11 +++--- src/node/node-list.h | 2 +- src/node/node.cc | 9 ++--- src/node/node.h | 5 +-- src/node/queue.cc | 4 +- src/node/queue.h | 2 +- 37 files changed, 114 insertions(+), 151 deletions(-) diff --git a/src/common/array-trace-resolver.h b/src/common/array-trace-resolver.h index e4507d4af..ffcc6cc89 100644 --- a/src/common/array-trace-resolver.h +++ b/src/common/array-trace-resolver.h @@ -37,7 +37,6 @@ class ArrayTraceResolver : public TraceResolver { public: /** - * \param context trace context associated to this trace resolver * \param getSize callback which returns dynamically the size of underlying array * \param get callback which returns any element in the underlying array * @@ -51,8 +50,7 @@ public: * a pointer to a TraceResolver. i.e. the signature is: * TraceResolver * (*) (TraceContext const &) */ - ArrayTraceResolver (TraceContext const &context, - Callback getSize, + ArrayTraceResolver (Callback getSize, Callback get); private: virtual TraceResolverList DoLookup (std::string id) const; @@ -64,11 +62,9 @@ private: namespace ns3 { template -ArrayTraceResolver::ArrayTraceResolver (TraceContext const &context, - Callback getSize, +ArrayTraceResolver::ArrayTraceResolver (Callback getSize, Callback get) - : TraceResolver (context), - m_getSize (getSize), + : m_getSize (getSize), m_get (get) {} template @@ -80,10 +76,10 @@ ArrayTraceResolver::DoLookup (std::string id) const { for (uint32_t i = 0; i < m_getSize (); i++) { - TraceContext context = GetContext (); + TraceContext context; INDEX index = i; context.Add (index); - list.push_back (m_get (i)->CreateTraceResolver (context)); + list.push_back (std::make_pair (m_get (i)->CreateTraceResolver (), context)); } } return list; diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc index bf60aa81e..e9f461959 100644 --- a/src/common/composite-trace-resolver.cc +++ b/src/common/composite-trace-resolver.cc @@ -22,8 +22,7 @@ namespace ns3 { -CompositeTraceResolver::CompositeTraceResolver (TraceContext const &context) - : TraceResolver (context) +CompositeTraceResolver::CompositeTraceResolver () {} CompositeTraceResolver::~CompositeTraceResolver () @@ -31,15 +30,14 @@ CompositeTraceResolver::~CompositeTraceResolver () void CompositeTraceResolver::Add (std::string name, - Callback createResolver) + Callback createResolver) { - TraceContext traceContext = GetContext (); - DoAdd (name, createResolver, traceContext); + DoAdd (name, createResolver, TraceContext ()); } void CompositeTraceResolver::DoAdd (std::string name, - Callback createResolver, + Callback createResolver, TraceContext const &context) { struct CallbackTraceSourceItem item; @@ -57,7 +55,7 @@ CompositeTraceResolver::DoLookup (std::string id) const TraceResolver::TraceResolverList list; for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { - list.push_back (i->createResolver (i->context)); + list.push_back (std::make_pair (i->createResolver (), i->context)); } return list; } @@ -71,7 +69,7 @@ CompositeTraceResolver::DoLookup (std::string id) const if (i->name == id) { TraceResolver::TraceResolverList list; - list.push_back (i->createResolver (i->context)); + list.push_back (std::make_pair (i->createResolver (), i->context)); return list; } } @@ -102,7 +100,7 @@ CompositeTraceResolver::DoLookup (std::string id) const { if (j->name == *i) { - list.push_back (j->createResolver (j->context)); + list.push_back (std::make_pair (j->createResolver (), j->context)); break; } } @@ -168,7 +166,7 @@ public: private: void TraceDouble (TraceContext const &context, double v); void TraceInt (TraceContext const &context, int v); - TraceResolver *CreateSubResolver (TraceContext const &context); + TraceResolver *CreateSubResolver (); bool m_gotDoubleA; @@ -209,9 +207,9 @@ CompositeTraceResolverTest::TraceInt (TraceContext const &context, int v) } TraceResolver * -CompositeTraceResolverTest::CreateSubResolver (TraceContext const &context) +CompositeTraceResolverTest::CreateSubResolver (void) { - CompositeTraceResolver *subresolver = new CompositeTraceResolver (context); + CompositeTraceResolver *subresolver = new CompositeTraceResolver (); subresolver->Add ("trace-int", m_traceInt, SubTraceSourceTest (SubTraceSourceTest::INT)); return subresolver; @@ -225,14 +223,14 @@ CompositeTraceResolverTest::RunTests (void) CallbackTraceSource traceDoubleB; TraceContext context; - CompositeTraceResolver resolver (context) ; + CompositeTraceResolver resolver; resolver.Add ("trace-double-a", traceDoubleA, TraceSourceTest (TraceSourceTest::DOUBLEA)); resolver.Add ("trace-double-b", traceDoubleB, TraceSourceTest (TraceSourceTest::DOUBLEB)); - resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); m_gotDoubleA = false; m_gotDoubleB = false; @@ -263,7 +261,7 @@ CompositeTraceResolverTest::RunTests (void) } resolver.Connect ("/trace-double-a", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); m_gotDoubleA = false; m_gotDoubleB = false; traceDoubleA (0); @@ -276,7 +274,7 @@ CompositeTraceResolverTest::RunTests (void) MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); resolver.Connect ("/(trace-double-a)", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); m_gotDoubleA = false; m_gotDoubleB = false; traceDoubleA (0); @@ -289,7 +287,7 @@ CompositeTraceResolverTest::RunTests (void) MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); resolver.Connect ("/(trace-double-a|trace-double-b)", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); m_gotDoubleA = false; m_gotDoubleB = false; traceDoubleA (0); @@ -326,7 +324,7 @@ CompositeTraceResolverTest::RunTests (void) TraceSourceTest (TraceSourceTest::SUBRESOLVER)); resolver.Connect ("/subresolver/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); + MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ()); m_gotInt = false; m_traceInt (1); if (!m_gotInt) @@ -344,7 +342,7 @@ CompositeTraceResolverTest::RunTests (void) } resolver.Connect ("/*/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); + MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ()); m_gotInt = false; m_traceInt (1); if (!m_gotInt) diff --git a/src/common/composite-trace-resolver.h b/src/common/composite-trace-resolver.h index cadf9da2d..0f08be274 100644 --- a/src/common/composite-trace-resolver.h +++ b/src/common/composite-trace-resolver.h @@ -38,7 +38,7 @@ namespace ns3 { class CompositeTraceResolver : public TraceResolver { public: - CompositeTraceResolver (TraceContext const &context); + CompositeTraceResolver (); virtual ~CompositeTraceResolver (); /** * \param name name of trace source @@ -109,7 +109,7 @@ public: */ template void Add (std::string name, - Callback createResolver, + Callback createResolver, T const &context); /** @@ -122,23 +122,22 @@ public: * will be invoked to create the child trace resolver. */ void Add (std::string name, - Callback createResolver); + Callback createResolver); private: template void DoAddTraceSource (std::string name, SOURCE &traceSource, CONTEXT const &context); template - static TraceResolver *CreateTerminalTraceResolver (SOURCE *trace, - TraceContext const &context); + static TraceResolver *CreateTerminalTraceResolver (SOURCE *trace); void DoAdd (std::string name, - Callback createResolver, + Callback createResolver, TraceContext const &context); virtual TraceResolverList DoLookup (std::string id) const; struct CallbackTraceSourceItem { std::string name; - Callback createResolver; + Callback createResolver; TraceContext context; }; @@ -155,21 +154,21 @@ void CompositeTraceResolver::DoAddTraceSource (std::string name, SOURCE &traceSource, CONTEXT const &context) { - TraceContext traceContext = GetContext (); - traceContext.Add (context); - TraceResolver *(*create) (SOURCE *trace, TraceContext const &context); + TraceResolver *(*create) (SOURCE *trace); create = &CompositeTraceResolver::CreateTerminalTraceResolver; - Callback createResolver = + Callback createResolver = MakeBoundCallback (create, &traceSource); - DoAdd (name, createResolver, traceContext); + + TraceContext ctx; + ctx.Add (context); + DoAdd (name, createResolver, ctx); } template TraceResolver * -CompositeTraceResolver::CreateTerminalTraceResolver (SOURCE *traceSource, - TraceContext const &context) +CompositeTraceResolver::CreateTerminalTraceResolver (SOURCE *traceSource) { - return new TerminalTraceResolver (*traceSource, context); + return new TerminalTraceResolver (*traceSource); } @@ -209,12 +208,12 @@ CompositeTraceResolver::Add (std::string name, template void CompositeTraceResolver::Add (std::string name, - Callback createResolver, + Callback createResolver, T const &context) { - TraceContext traceContext = GetContext (); - traceContext.Add (context); - DoAdd (name, createResolver, traceContext); + TraceContext ctx; + ctx.Add (context); + DoAdd (name, createResolver, ctx); } }//namespace ns3 diff --git a/src/common/empty-trace-resolver.cc b/src/common/empty-trace-resolver.cc index 18b9e5301..dc3478864 100644 --- a/src/common/empty-trace-resolver.cc +++ b/src/common/empty-trace-resolver.cc @@ -20,6 +20,5 @@ */ #include "empty-trace-resolver.h" -ns3::EmptyTraceResolver::EmptyTraceResolver (TraceContext const &context) - : TraceResolver (context) +ns3::EmptyTraceResolver::EmptyTraceResolver () {} diff --git a/src/common/empty-trace-resolver.h b/src/common/empty-trace-resolver.h index 04f1c1bc4..1e5ddab46 100644 --- a/src/common/empty-trace-resolver.h +++ b/src/common/empty-trace-resolver.h @@ -44,7 +44,7 @@ public: * * The only constructor exported by this class. */ - EmptyTraceResolver (TraceContext const &o); + EmptyTraceResolver (); }; }//namespace ns3 diff --git a/src/common/terminal-trace-resolver.h b/src/common/terminal-trace-resolver.h index e026d07cb..a2d985ad8 100644 --- a/src/common/terminal-trace-resolver.h +++ b/src/common/terminal-trace-resolver.h @@ -31,9 +31,9 @@ template class TerminalTraceResolver : public TraceResolver { public: - TerminalTraceResolver (T &traceSource, TraceContext const &context); + TerminalTraceResolver (T &traceSource); private: - virtual void DoConnect (CallbackBase const &cb); + virtual void DoConnect (CallbackBase const &cb, const TraceContext &context); virtual void DoDisconnect (CallbackBase const &cb); T &m_traceSource; }; @@ -43,16 +43,14 @@ class TerminalTraceResolver : public TraceResolver namespace ns3 { template -TerminalTraceResolver::TerminalTraceResolver (T &traceSource, - TraceContext const &context) - : TraceResolver (context), - m_traceSource (traceSource) +TerminalTraceResolver::TerminalTraceResolver (T &traceSource) + : m_traceSource (traceSource) {} template void -TerminalTraceResolver::DoConnect (CallbackBase const &cb) +TerminalTraceResolver::DoConnect (CallbackBase const &cb, const TraceContext &context) { - m_traceSource.AddCallback (cb, GetContext ()); + m_traceSource.AddCallback (cb, context); } template void diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc index 251e7cc87..75c7a576d 100644 --- a/src/common/trace-resolver.cc +++ b/src/common/trace-resolver.cc @@ -22,21 +22,12 @@ namespace ns3 { -TraceResolver::TraceResolver (TraceContext const &context) - : m_context (context) -{} TraceResolver::~TraceResolver () {} -TraceContext const & -TraceResolver::GetContext (void) const -{ - return m_context; -} - void -TraceResolver::Connect (std::string path, CallbackBase const &cb) +TraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { std::string::size_type cur = 1; // check that first char is "/" @@ -45,16 +36,18 @@ TraceResolver::Connect (std::string path, CallbackBase const &cb) TraceResolverList resolverList = DoLookup (element); for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) { - TraceResolver *resolver = *i; + TraceResolver *resolver = i->first; + TraceContext tmp = context; + tmp.Add (i->second); if (next == std::string::npos) { // we really break the recursion here. - resolver->DoConnect (cb); + resolver->DoConnect (cb, tmp); } else { std::string subpath = std::string (path, next, std::string::npos); - resolver->Connect (subpath, cb); + resolver->Connect (subpath, cb, tmp); } delete resolver; } @@ -71,7 +64,7 @@ TraceResolver::Disconnect (std::string path, CallbackBase const &cb) TraceResolverList resolverList = DoLookup (element); for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) { - TraceResolver *resolver = *i; + TraceResolver *resolver = i->first; if (next == std::string::npos) { // we really break the recursion here. @@ -93,7 +86,7 @@ TraceResolver::DoLookup (std::string id) const return TraceResolverList (); } void -TraceResolver::DoConnect (CallbackBase const &cb) +TraceResolver::DoConnect (CallbackBase const &cb, const TraceContext &context) {} void diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h index 93bf43095..63dbd267e 100644 --- a/src/common/trace-resolver.h +++ b/src/common/trace-resolver.h @@ -59,7 +59,7 @@ public: * users could also conceivably call it directly if they want to * skip the ns3::TraceRoot. */ - void Connect (std::string path, CallbackBase const &cb); + void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); /** * \param path the namespace path to resolver * \param cb the callback to disconnect in the matching namespace @@ -70,23 +70,8 @@ public: */ void Disconnect (std::string path, CallbackBase const &cb); protected: - /** - * \param context the context used to initialize this TraceResolver. - * - * Every subclass must call this constructor - */ - TraceResolver (TraceContext const &context); - /** - * \returns the ns3::TraceContext stored in this ns3::TraceResolver. - * - * Subclasses usually invoke this method to get access to the - * TraceContext stored here to pass it down to the TraceResolver - * constructors invoked from within the DoLookup method. - */ - TraceContext const &GetContext (void) const; - typedef std::list TraceResolverList; + typedef std::list > TraceResolverList; private: - TraceResolver (); /** * \param id the id to resolve. This is supposed to be * one element of the global tracing namespace. @@ -104,7 +89,7 @@ private: * * This method is invoked on leaf trace resolvers. */ - virtual void DoConnect (CallbackBase const &cb); + virtual void DoConnect (CallbackBase const &cb, const TraceContext &context); /** * \param cb callback to disconnect * diff --git a/src/common/trace-root.cc b/src/common/trace-root.cc index 5bb270b8c..cd49b1150 100644 --- a/src/common/trace-root.cc +++ b/src/common/trace-root.cc @@ -28,7 +28,7 @@ void TraceRoot::Connect (std::string path, CallbackBase const &cb) { TraceResolver *resolver = GetComposite (); - resolver->Connect (path, cb); + resolver->Connect (path, cb, TraceContext ()); } void TraceRoot::Disconnect (std::string path, CallbackBase const &cb) @@ -38,7 +38,7 @@ TraceRoot::Disconnect (std::string path, CallbackBase const &cb) } void TraceRoot::Register (std::string name, - Callback createResolver) + Callback createResolver) { CompositeTraceResolver *resolver = GetComposite (); resolver->Add (name, createResolver); @@ -47,7 +47,7 @@ TraceRoot::Register (std::string name, CompositeTraceResolver * TraceRoot::GetComposite (void) { - static CompositeTraceResolver resolver = CompositeTraceResolver (TraceContext ()); + static CompositeTraceResolver resolver; return &resolver; } diff --git a/src/common/trace-root.h b/src/common/trace-root.h index a07f923cd..270747fce 100644 --- a/src/common/trace-root.h +++ b/src/common/trace-root.h @@ -325,7 +325,7 @@ public: static void Connect (std::string path, CallbackBase const &cb); static void Disconnect (std::string path, CallbackBase const &cb); static void Register (std::string name, - Callback createResolver); + Callback createResolver); private: static CompositeTraceResolver *GetComposite (void); }; diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index d5dfc8501..bb51fd36a 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -450,9 +450,9 @@ CsmaCdNetDevice::TransmitReadyEvent (void) } TraceResolver * -CsmaCdNetDevice::DoCreateTraceResolver (TraceContext const &context) +CsmaCdNetDevice::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); resolver->Add ("queue", MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); diff --git a/src/devices/csma-cd/csma-cd-net-device.h b/src/devices/csma-cd/csma-cd-net-device.h index 36a555339..51b3db8ea 100644 --- a/src/devices/csma-cd/csma-cd-net-device.h +++ b/src/devices/csma-cd/csma-cd-net-device.h @@ -311,7 +311,7 @@ private: * (NOT TESTED) * @see class TraceResolver */ - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); + virtual TraceResolver *DoCreateTraceResolver (void); /** * Aborts the transmission of the current packet diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 86c9d9a4c..f09810f82 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -188,10 +188,9 @@ void PointToPointNetDevice::TransmitComplete (void) TransmitStart(p); } -TraceResolver* PointToPointNetDevice::DoCreateTraceResolver ( - TraceContext const &context) +TraceResolver* PointToPointNetDevice::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); resolver->Add ("queue", MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); resolver->Add ("rx", diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index b6be56afa..8d2a02fe2 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -243,7 +243,7 @@ private: * * @see class TraceResolver */ - virtual TraceResolver* DoCreateTraceResolver (TraceContext const &context); + virtual TraceResolver* DoCreateTraceResolver (void); virtual bool DoNeedsArp (void) const; /** * Enumeration of the states of the transmit machine of the net device. diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index efe767531..7077d0903 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -41,9 +41,9 @@ ArpIpv4Interface::~ArpIpv4Interface () {} TraceResolver * -ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) +ArpIpv4Interface::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); if (GetDevice () != 0) { resolver->Add ("netdevice", diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 7df522e01..537a16a2f 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -44,7 +44,7 @@ class ArpIpv4Interface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); + virtual TraceResolver *DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 100f1df88..46654c89e 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -59,9 +59,9 @@ ArpL3Protocol::DoDispose (void) } TraceResolver * -ArpL3Protocol::CreateTraceResolver (TraceContext const &context) +ArpL3Protocol::CreateTraceResolver (void) { - return new EmptyTraceResolver (context); + return new EmptyTraceResolver (); } ArpCache * diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index a2ea8227e..3d752b46e 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -49,7 +49,7 @@ public: ArpL3Protocol (Ptr node); virtual ~ArpL3Protocol (); - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); + virtual TraceResolver *CreateTraceResolver (void); /** * \brief Recieve a packet */ diff --git a/src/internet-node/ipv4-interface.cc b/src/internet-node/ipv4-interface.cc index cfc398582..d44edf130 100644 --- a/src/internet-node/ipv4-interface.cc +++ b/src/internet-node/ipv4-interface.cc @@ -46,9 +46,9 @@ Ipv4Interface::GetDevice (void) const } TraceResolver * -Ipv4Interface::CreateTraceResolver (TraceContext const &context) +Ipv4Interface::CreateTraceResolver (void) { - return DoCreateTraceResolver (context); + return DoCreateTraceResolver (); } void diff --git a/src/internet-node/ipv4-interface.h b/src/internet-node/ipv4-interface.h index 1098c567c..e5c6788eb 100644 --- a/src/internet-node/ipv4-interface.h +++ b/src/internet-node/ipv4-interface.h @@ -83,7 +83,7 @@ public: * This method will delegate the work to the private DoCreateTraceResolver * method which is supposed to be implemented by subclasses. */ - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); /** * \returns the underlying NetDevice. This method can return * zero if this interface has no associated NetDevice. @@ -153,7 +153,7 @@ public: private: virtual void SendTo (Packet p, Ipv4Address dest) = 0; - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0; + virtual TraceResolver *DoCreateTraceResolver (void) = 0; Ptr m_netdevice; bool m_ifup; Ipv4Address m_address; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index be483dfa0..9fd06abba 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -154,9 +154,9 @@ Ipv4L3Protocol::SetupLoopback (void) } TraceResolver * -Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) +Ipv4L3Protocol::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); resolver->Add ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); @@ -166,12 +166,11 @@ Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) } TraceResolver * -Ipv4L3Protocol::InterfacesCreateTraceResolver (TraceContext const &context) const +Ipv4L3Protocol::InterfacesCreateTraceResolver (void) const { ArrayTraceResolver *resolver = new ArrayTraceResolver - (context, - MakeCallback (&Ipv4L3Protocol::GetNInterfaces, this), + (MakeCallback (&Ipv4L3Protocol::GetNInterfaces, this), MakeCallback (&Ipv4L3Protocol::GetInterface, this)); return resolver; } diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 2cce3efa3..4209019ad 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -92,7 +92,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); + virtual TraceResolver *CreateTraceResolver (void); /** * \param ttl default ttl to use @@ -189,7 +189,7 @@ private: void ForwardUp (Packet p, Ipv4Header const&ip); uint32_t AddIpv4Interface (Ipv4Interface *interface); void SetupLoopback (void); - TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; + TraceResolver *InterfacesCreateTraceResolver (void) const; typedef std::list Ipv4InterfaceList; typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 977b802ba..9981a718d 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -79,9 +79,9 @@ Ipv4L4Demux::DoDispose (void) } TraceResolver * -Ipv4L4Demux::CreateTraceResolver (TraceContext const &context) +Ipv4L4Demux::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) { Ptr protocol = *i; diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 7e7fba62e..8431e1e48 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -66,7 +66,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. diff --git a/src/internet-node/ipv4-l4-protocol.h b/src/internet-node/ipv4-l4-protocol.h index f23aa510b..4ecd5a142 100644 --- a/src/internet-node/ipv4-l4-protocol.h +++ b/src/internet-node/ipv4-l4-protocol.h @@ -59,7 +59,7 @@ public: */ int GetVersion() const; - virtual TraceResolver *CreateTraceResolver (TraceContext const &context) = 0; + virtual TraceResolver *CreateTraceResolver () = 0; /** * \param p packet to forward up diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 47ddc9ee2..4e23abde3 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -35,9 +35,9 @@ Ipv4LoopbackInterface::~Ipv4LoopbackInterface () {} TraceResolver * -Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context) +Ipv4LoopbackInterface::DoCreateTraceResolver (void) { - return new EmptyTraceResolver (context); + return new EmptyTraceResolver (); } void diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index 3eead3a01..b17f46449 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -43,7 +43,7 @@ class Ipv4LoopbackInterface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); + virtual TraceResolver *DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index f0ef8569b..a83cb4657 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -46,9 +46,9 @@ UdpL4Protocol::~UdpL4Protocol () {} TraceResolver * -UdpL4Protocol::CreateTraceResolver (TraceContext const &context) +UdpL4Protocol::CreateTraceResolver (void) { - return new EmptyTraceResolver (context); + return new EmptyTraceResolver (); } void diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 4d7a082d4..d41bbb839 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -49,7 +49,7 @@ public: UdpL4Protocol (Ptr node); virtual ~UdpL4Protocol (); - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); + virtual TraceResolver *CreateTraceResolver (void); /** * \return A smart Socket pointer to a UdpSocket, allocated by this instance * of the UDP protocol diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 4fa2e8d51..626b82c63 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -184,9 +184,9 @@ NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber) } TraceResolver * -NetDevice::CreateTraceResolver (TraceContext const &context) +NetDevice::CreateTraceResolver (void) { - return DoCreateTraceResolver (context); + return DoCreateTraceResolver (); } Ptr diff --git a/src/node/net-device.h b/src/node/net-device.h index dd590f39c..cadd70dfc 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -69,7 +69,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); /** * \return the channel this NetDevice is connected to. The value @@ -290,7 +290,7 @@ public: * * Subclasses must implement this method. */ - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0; + virtual TraceResolver *DoCreateTraceResolver (void) = 0; /** * \returns the channel associated to this NetDevice. * diff --git a/src/node/node-list.cc b/src/node/node-list.cc index eb43727d9..761717c9f 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -76,7 +76,7 @@ public: uint32_t Add (Ptr node); NodeList::Iterator Begin (void); NodeList::Iterator End (void); - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); Ptr GetNode (uint32_t n); uint32_t GetNNodes (void); @@ -131,12 +131,11 @@ NodeListPriv::GetNode (uint32_t n) TraceResolver * -NodeListPriv::CreateTraceResolver (TraceContext const &context) +NodeListPriv::CreateTraceResolver (void) { ArrayTraceResolver, NodeListIndex> *resolver = new ArrayTraceResolver, NodeListIndex> - (context, - MakeCallback (&NodeListPriv::GetNNodes, this), + (MakeCallback (&NodeListPriv::GetNNodes, this), MakeCallback (&NodeListPriv::GetNode, this)); return resolver; } @@ -166,9 +165,9 @@ NodeList::End (void) return SimulationSingleton::Get ()->End (); } TraceResolver * -NodeList::CreateTraceResolver (TraceContext const &context) +NodeList::CreateTraceResolver (void) { - return SimulationSingleton::Get ()->CreateTraceResolver (context); + return SimulationSingleton::Get ()->CreateTraceResolver (); } Ptr NodeList::GetNode (uint32_t n) diff --git a/src/node/node-list.h b/src/node/node-list.h index 1fdcd9e0e..beda5611c 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -79,7 +79,7 @@ public: * \returns the requested trace resolver. The caller * takes ownership of the returned pointer. */ - static TraceResolver *CreateTraceResolver (TraceContext const &context); + static TraceResolver *CreateTraceResolver (void); /** * \param n index of requested node. diff --git a/src/node/node.cc b/src/node/node.cc index ee83e8588..4de3a93ad 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -83,9 +83,9 @@ Node::~Node () {} TraceResolver * -Node::CreateTraceResolver (TraceContext const &context) +Node::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); DoFillTraceResolver (*resolver); return resolver; } @@ -142,12 +142,11 @@ Node::GetNApplications (void) const } TraceResolver * -Node::CreateDevicesTraceResolver (const TraceContext &context) +Node::CreateDevicesTraceResolver (void) { ArrayTraceResolver,NodeNetDeviceIndex> *resolver = new ArrayTraceResolver,NodeNetDeviceIndex> - (context, - MakeCallback (&Node::GetNDevices, this), + (MakeCallback (&Node::GetNDevices, this), MakeCallback (&Node::GetDevice, this)); return resolver; diff --git a/src/node/node.h b/src/node/node.h index f4d898f53..104f3a2a4 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -85,7 +85,6 @@ public: virtual ~Node(); /** - * \param context the trace context for the TraceResolver to create * \returns a newly-created TraceResolver. The caller takes * ownership of the returned pointer. * @@ -93,7 +92,7 @@ public: * could be used directly by a user who needs access to very low-level * trace configuration. */ - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); /** * \returns the unique id of this node. @@ -213,7 +212,7 @@ private: bool ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); void Construct (void); - TraceResolver *CreateDevicesTraceResolver (const TraceContext &context); + TraceResolver *CreateDevicesTraceResolver (void); struct ProtocolHandlerEntry { ProtocolHandler handler; diff --git a/src/node/queue.cc b/src/node/queue.cc index 72eafed69..163f73ffc 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -95,9 +95,9 @@ Queue::~Queue() } TraceResolver * -Queue::CreateTraceResolver (TraceContext const &context) +Queue::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + CompositeTraceResolver *resolver = new CompositeTraceResolver (); resolver->Add ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); resolver->Add ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); resolver->Add ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); diff --git a/src/node/queue.h b/src/node/queue.h index d135fff68..2c010c363 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -70,7 +70,7 @@ public: Queue (); virtual ~Queue (); - TraceResolver *CreateTraceResolver (TraceContext const &context); + TraceResolver *CreateTraceResolver (void); /** * \return true if the queue is empty; false otherwise From a426810413014c6f15636361dd8edec631f7202c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 14:13:47 +0200 Subject: [PATCH 002/218] allow resolvers to override Connect and Disconnect directly --- src/common/trace-resolver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h index 63dbd267e..abb5cf1da 100644 --- a/src/common/trace-resolver.h +++ b/src/common/trace-resolver.h @@ -59,7 +59,7 @@ public: * users could also conceivably call it directly if they want to * skip the ns3::TraceRoot. */ - void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); /** * \param path the namespace path to resolver * \param cb the callback to disconnect in the matching namespace @@ -68,7 +68,7 @@ public: * users could also conceivably call it directly if they want to * skip the ns3::TraceRoot. */ - void Disconnect (std::string path, CallbackBase const &cb); + virtual void Disconnect (std::string path, CallbackBase const &cb); protected: typedef std::list > TraceResolverList; private: From 8a2b2325fc87aad4ca3a10a4624bfb144d6b84e1 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 14:14:29 +0200 Subject: [PATCH 003/218] override Connect and Disconnect in Composite and Terminal Trace resolvers --- src/common/composite-trace-resolver.cc | 86 ++++++++++++++++++++------ src/common/composite-trace-resolver.h | 32 +++++++--- src/common/terminal-trace-resolver.h | 20 ++++-- 3 files changed, 106 insertions(+), 32 deletions(-) diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc index e9f461959..a789a9b51 100644 --- a/src/common/composite-trace-resolver.cc +++ b/src/common/composite-trace-resolver.cc @@ -19,6 +19,9 @@ * Author: Mathieu Lacage */ #include "composite-trace-resolver.h" +#include "ns3/debug.h" + +NS_DEBUG_COMPONENT_DEFINE ("CompositeTraceResolver"); namespace ns3 { @@ -47,17 +50,39 @@ CompositeTraceResolver::DoAdd (std::string name, m_items.push_back (item); } -TraceResolver::TraceResolverList -CompositeTraceResolver::DoLookup (std::string id) const +void +CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { + NS_DEBUG ("connect path="<createResolver (), i->context)); - } - return list; + OperationOne (subpath, i, cb, context, op); + } + return; } std::string::size_type start, end; start = id.find_first_of ("(", 0); @@ -68,30 +93,29 @@ CompositeTraceResolver::DoLookup (std::string id) const { if (i->name == id) { - TraceResolver::TraceResolverList list; - list.push_back (std::make_pair (i->createResolver (), i->context)); - return list; + OperationOne (subpath, i, cb, context, op); + return; } } } std::list names; std::string alternatives = std::string (id, start+1, end-1); - std::string::size_type next, cur; - next = 0; - cur = 0; + std::string::size_type next_pos, cur_pos; + next_pos = 0; + cur_pos = 0; while (true) { std::string element; - next = alternatives.find ("|", cur); - if (next == std::string::npos) + next_pos = alternatives.find ("|", cur_pos); + if (next_pos == std::string::npos) { - element = std::string (alternatives, cur, alternatives.size ()); + element = std::string (alternatives, cur_pos, alternatives.size ()); names.push_back (element); break; } - element = std::string (alternatives, cur, next); + element = std::string (alternatives, cur_pos, next_pos); names.push_back (element); - cur = next + 1; + cur_pos = next_pos + 1; } TraceResolver::TraceResolverList list; for (std::list::const_iterator i = names.begin (); i != names.end (); i++) @@ -100,12 +124,38 @@ CompositeTraceResolver::DoLookup (std::string id) const { if (j->name == *i) { - list.push_back (std::make_pair (j->createResolver (), j->context)); + OperationOne (subpath, j, cb, context, op); break; } } } - return list; +} + +void +CompositeTraceResolver::OperationOne (std::string subpath, + TraceItems::const_iterator i, + const CallbackBase &cb, + const TraceContext &context, + enum Operation op) +{ + TraceResolver *resolver = i->createResolver (); + switch (op) { + case CONNECT: { + NS_DEBUG ("connect to path="<::TerminalTraceResolver (T &traceSource) {} template void -TerminalTraceResolver::DoConnect (CallbackBase const &cb, const TraceContext &context) +TerminalTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { - m_traceSource.AddCallback (cb, context); + if (path == "") + { + m_traceSource.AddCallback (cb, context); + } } template void -TerminalTraceResolver::DoDisconnect (CallbackBase const &cb) +TerminalTraceResolver::Disconnect (std::string path, CallbackBase const &cb) { - m_traceSource.RemoveCallback (cb); + if (path == "") + { + m_traceSource.RemoveCallback (cb); + } } }//namespace ns3 From 495efb222af0aebf39f7137cf7a013fa92d9fcf9 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 14:25:58 +0200 Subject: [PATCH 004/218] override Connect from ArrayTraceResolver --- src/common/array-trace-resolver.h | 37 ++++++++++++++++++++------ src/common/composite-trace-resolver.cc | 18 +++---------- src/common/trace-resolver.cc | 28 +++++++++++++++++++ src/common/trace-resolver.h | 2 ++ 4 files changed, 63 insertions(+), 22 deletions(-) diff --git a/src/common/array-trace-resolver.h b/src/common/array-trace-resolver.h index ffcc6cc89..65fe2b546 100644 --- a/src/common/array-trace-resolver.h +++ b/src/common/array-trace-resolver.h @@ -52,8 +52,10 @@ public: */ ArrayTraceResolver (Callback getSize, Callback get); + + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Disconnect (std::string path, CallbackBase const &cb); private: - virtual TraceResolverList DoLookup (std::string id) const; Callback m_getSize; Callback m_get; }; @@ -67,22 +69,41 @@ ArrayTraceResolver::ArrayTraceResolver (Callback getSize, : m_getSize (getSize), m_get (get) {} + template -TraceResolver::TraceResolverList -ArrayTraceResolver::DoLookup (std::string id) const +void +ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { - TraceResolverList list; + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); if (id == "*") { for (uint32_t i = 0; i < m_getSize (); i++) { - TraceContext context; + TraceContext tmp = context; INDEX index = i; - context.Add (index); - list.push_back (std::make_pair (m_get (i)->CreateTraceResolver (), context)); + tmp.Add (index); + TraceResolver *resolver = m_get (i)->CreateTraceResolver (); + resolver->Connect (subpath, cb, tmp); + delete resolver; + } + } +} +template +void +ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); + if (id == "*") + { + for (uint32_t i = 0; i < m_getSize (); i++) + { + TraceResolver *resolver = m_get (i)->CreateTraceResolver (); + resolver->Disconnect (subpath, cb); + delete resolver; } } - return list; } diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc index a789a9b51..ed0da7c8e 100644 --- a/src/common/composite-trace-resolver.cc +++ b/src/common/composite-trace-resolver.cc @@ -61,19 +61,8 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con const TraceContext &context, enum Operation op) { - std::string::size_type cur = 1; - // check that first char is "/" - std::string::size_type next = path.find ("/", cur); - std::string id = std::string (path, cur, next-1); - std::string subpath; - if (next != std::string::npos) - { - subpath = std::string (path, next, std::string::npos); - } - else - { - subpath = ""; - } + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); if (id == "*") { @@ -150,7 +139,8 @@ CompositeTraceResolver::OperationOne (std::string subpath, resolver->Disconnect (subpath, cb); break; } - } + delete resolver; +} void CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb) diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc index 75c7a576d..0b2d5124e 100644 --- a/src/common/trace-resolver.cc +++ b/src/common/trace-resolver.cc @@ -80,6 +80,34 @@ TraceResolver::Disconnect (std::string path, CallbackBase const &cb) resolverList.erase (resolverList.begin (), resolverList.end ()); } +std::string +TraceResolver::GetElement (std::string path) +{ + std::string::size_type cur = 1; + // check that first char is "/" + std::string::size_type next = path.find ("/", cur); + std::string id = std::string (path, cur, next-1); + return id; +} +std::string +TraceResolver::GetSubpath (std::string path) +{ + std::string::size_type cur = 1; + // check that first char is "/" + std::string::size_type next = path.find ("/", cur); + std::string subpath; + if (next != std::string::npos) + { + subpath = std::string (path, next, std::string::npos); + } + else + { + subpath = ""; + } + return subpath; +} + + TraceResolver::TraceResolverList TraceResolver::DoLookup (std::string id) const { diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h index abb5cf1da..04f6b2751 100644 --- a/src/common/trace-resolver.h +++ b/src/common/trace-resolver.h @@ -71,6 +71,8 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb); protected: typedef std::list > TraceResolverList; + std::string GetElement (std::string path); + std::string GetSubpath (std::string path); private: /** * \param id the id to resolve. This is supposed to be From 0d38cd5db54ebeabbcdef5e6a366ad33593d83b4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 14:28:52 +0200 Subject: [PATCH 005/218] remove dead code --- src/common/composite-trace-resolver.cc | 2 - src/common/trace-resolver.cc | 65 +------------------------- src/common/trace-resolver.h | 27 ----------- 3 files changed, 2 insertions(+), 92 deletions(-) diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc index ed0da7c8e..fa7157afb 100644 --- a/src/common/composite-trace-resolver.cc +++ b/src/common/composite-trace-resolver.cc @@ -66,7 +66,6 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con if (id == "*") { - TraceResolver::TraceResolverList list; for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { OperationOne (subpath, i, cb, context, op); @@ -106,7 +105,6 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con names.push_back (element); cur_pos = next_pos + 1; } - TraceResolver::TraceResolverList list; for (std::list::const_iterator i = names.begin (); i != names.end (); i++) { for (TraceItems::const_iterator j = m_items.begin (); j != m_items.end (); j++) diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc index 0b2d5124e..7d2a00700 100644 --- a/src/common/trace-resolver.cc +++ b/src/common/trace-resolver.cc @@ -28,57 +28,11 @@ TraceResolver::~TraceResolver () void TraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) -{ - std::string::size_type cur = 1; - // check that first char is "/" - std::string::size_type next = path.find ("/", cur); - std::string element = std::string (path, cur, next-1); - TraceResolverList resolverList = DoLookup (element); - for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) - { - TraceResolver *resolver = i->first; - TraceContext tmp = context; - tmp.Add (i->second); - if (next == std::string::npos) - { - // we really break the recursion here. - resolver->DoConnect (cb, tmp); - } - else - { - std::string subpath = std::string (path, next, std::string::npos); - resolver->Connect (subpath, cb, tmp); - } - delete resolver; - } - resolverList.erase (resolverList.begin (), resolverList.end ()); -} +{} void TraceResolver::Disconnect (std::string path, CallbackBase const &cb) -{ - std::string::size_type cur = 1; - // check that first char is "/" - std::string::size_type next = path.find ("/", cur); - std::string element = std::string (path, cur, next-1); - TraceResolverList resolverList = DoLookup (element); - for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) - { - TraceResolver *resolver = i->first; - if (next == std::string::npos) - { - // we really break the recursion here. - resolver->DoDisconnect (cb); - } - else - { - std::string subpath = std::string (path, next, std::string::npos); - resolver->Disconnect (subpath, cb); - } - delete resolver; - } - resolverList.erase (resolverList.begin (), resolverList.end ()); -} +{} std::string TraceResolver::GetElement (std::string path) @@ -107,19 +61,4 @@ TraceResolver::GetSubpath (std::string path) return subpath; } - -TraceResolver::TraceResolverList -TraceResolver::DoLookup (std::string id) const -{ - return TraceResolverList (); -} -void -TraceResolver::DoConnect (CallbackBase const &cb, const TraceContext &context) -{} - -void -TraceResolver::DoDisconnect (CallbackBase const &cb) -{} - - }//namespace ns3 diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h index 04f6b2751..f34827716 100644 --- a/src/common/trace-resolver.h +++ b/src/common/trace-resolver.h @@ -70,35 +70,8 @@ public: */ virtual void Disconnect (std::string path, CallbackBase const &cb); protected: - typedef std::list > TraceResolverList; std::string GetElement (std::string path); std::string GetSubpath (std::string path); -private: - /** - * \param id the id to resolve. This is supposed to be - * one element of the global tracing namespace. - * \returns a list of reslvers which match the input namespace element - * - * A subclass which overrides this method should return a potentially - * empty list of pointers to ns3::TraceResolver instances which match - * the input namespace element. Each of these TraceResolver should be - * instanciated with a TraceContext which holds enough context - * information to identify the type of the TraceResolver. - */ - virtual TraceResolverList DoLookup (std::string id) const; - /** - * \param cb callback to connect - * - * This method is invoked on leaf trace resolvers. - */ - virtual void DoConnect (CallbackBase const &cb, const TraceContext &context); - /** - * \param cb callback to disconnect - * - * This method is invoked on leaf trace resolvers. - */ - virtual void DoDisconnect (CallbackBase const &cb); - TraceContext m_context; }; }//namespace ns3 From 741bcabbc52ab92ba0d1cb85e74491423155f2f6 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 14:43:15 +0200 Subject: [PATCH 006/218] add refcounting to TraceResolver --- src/common/trace-resolver.cc | 19 +++++++++++++++++++ src/common/trace-resolver.h | 6 ++++++ src/core/object.h | 1 + 3 files changed, 26 insertions(+) diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc index 7d2a00700..1dd6126a3 100644 --- a/src/common/trace-resolver.cc +++ b/src/common/trace-resolver.cc @@ -22,10 +22,29 @@ namespace ns3 { +TraceResolver::TraceResolver () + : m_count (1) +{} TraceResolver::~TraceResolver () {} +void +TraceResolver::Ref (void) +{ + m_count++; +} +void +TraceResolver::Unref (void) +{ + m_count--; + if (m_count == 0) + { + delete this; + } +} + + void TraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) {} diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h index f34827716..78a3a0a4b 100644 --- a/src/common/trace-resolver.h +++ b/src/common/trace-resolver.h @@ -50,7 +50,12 @@ class CallbackBase; class TraceResolver { public: + + TraceResolver (); virtual ~TraceResolver (); + void Ref (void); + void Unref (void); + /** * \param path the namespace path to resolver * \param cb the callback to connect to the matching namespace @@ -72,6 +77,7 @@ public: protected: std::string GetElement (std::string path); std::string GetSubpath (std::string path); + uint32_t m_count; }; }//namespace ns3 diff --git a/src/core/object.h b/src/core/object.h index d45d7f67c..1b60e85e9 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -131,6 +131,7 @@ public: * on one to get the other, and vice-versa. */ void AddInterface (Ptr other); + protected: /** * \param iid an InterfaceId From 92e7e241a8da1458c7bf1df159283702bedd58ac Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 15:08:50 +0200 Subject: [PATCH 007/218] remove dead code --- .../global-route-manager-impl.cc | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 142f613be..85ee4ee2d 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1195,27 +1195,6 @@ GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) namespace ns3 { -class GlobalRouterTestNode : public Node -{ -public: - GlobalRouterTestNode (); - -private: - virtual void DoAddDevice (Ptr device) const {}; - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); -}; - -GlobalRouterTestNode::GlobalRouterTestNode () -{ -// Ptr ipv4 = Create (this); -} - - TraceResolver* -GlobalRouterTestNode::DoCreateTraceResolver (TraceContext const &context) -{ - return 0; -} - class GlobalRouteManagerImplTest : public Test { public: GlobalRouteManagerImplTest (); From 9fea38c55a7adda70bec68228487a215d861fa2f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 15:47:00 +0200 Subject: [PATCH 008/218] avoid problems by converting back and forth between pointers and references --- src/common/terminal-trace-resolver.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/terminal-trace-resolver.h b/src/common/terminal-trace-resolver.h index 32422edb4..f35d32d86 100644 --- a/src/common/terminal-trace-resolver.h +++ b/src/common/terminal-trace-resolver.h @@ -32,12 +32,12 @@ template class TerminalTraceResolver : public TraceResolver { public: - TerminalTraceResolver (T &traceSource); + TerminalTraceResolver (T *traceSource); virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); private: - T &m_traceSource; + T *m_traceSource; }; }//namespace ns3 @@ -45,7 +45,7 @@ class TerminalTraceResolver : public TraceResolver namespace ns3 { template -TerminalTraceResolver::TerminalTraceResolver (T &traceSource) +TerminalTraceResolver::TerminalTraceResolver (T *traceSource) : m_traceSource (traceSource) {} template @@ -54,7 +54,7 @@ TerminalTraceResolver::Connect (std::string path, CallbackBase const &cb, con { if (path == "") { - m_traceSource.AddCallback (cb, context); + m_traceSource->AddCallback (cb, context); } } template @@ -63,7 +63,7 @@ TerminalTraceResolver::Disconnect (std::string path, CallbackBase const &cb) { if (path == "") { - m_traceSource.RemoveCallback (cb); + m_traceSource->RemoveCallback (cb); } } From 111413d06f56a5a25b1b269111b829b1a416c972 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 15:47:13 +0200 Subject: [PATCH 009/218] convert TraceResolver * to Ptr --- src/common/array-trace-resolver.h | 8 +++---- src/common/composite-trace-resolver.cc | 13 ++++++------ src/common/composite-trace-resolver.h | 21 ++++++++++--------- src/common/trace-resolver.cc | 4 ++++ src/common/trace-root.cc | 10 ++++----- src/common/trace-root.h | 4 ++-- src/devices/csma-cd/csma-cd-net-device.cc | 4 ++-- src/devices/csma-cd/csma-cd-net-device.h | 2 +- .../point-to-point-net-device.cc | 5 +++-- .../point-to-point-net-device.h | 2 +- src/internet-node/arp-ipv4-interface.cc | 4 ++-- src/internet-node/arp-ipv4-interface.h | 2 +- src/internet-node/arp-l3-protocol.cc | 4 ++-- src/internet-node/arp-l3-protocol.h | 2 +- src/internet-node/ipv4-interface.cc | 3 ++- src/internet-node/ipv4-interface.h | 4 ++-- src/internet-node/ipv4-l3-protocol.cc | 10 ++++----- src/internet-node/ipv4-l3-protocol.h | 4 ++-- src/internet-node/ipv4-l4-demux.cc | 4 ++-- src/internet-node/ipv4-l4-demux.h | 2 +- src/internet-node/ipv4-l4-protocol.h | 2 +- src/internet-node/ipv4-loopback-interface.cc | 4 ++-- src/internet-node/ipv4-loopback-interface.h | 2 +- src/internet-node/udp-l4-protocol.cc | 4 ++-- src/internet-node/udp-l4-protocol.h | 2 +- src/node/net-device.cc | 3 ++- src/node/net-device.h | 4 ++-- src/node/node-list.cc | 10 ++++----- src/node/node-list.h | 2 +- src/node/node.cc | 12 +++++------ src/node/node.h | 4 ++-- src/node/queue.cc | 4 ++-- src/node/queue.h | 2 +- 33 files changed, 86 insertions(+), 81 deletions(-) diff --git a/src/common/array-trace-resolver.h b/src/common/array-trace-resolver.h index 65fe2b546..b6ffe0212 100644 --- a/src/common/array-trace-resolver.h +++ b/src/common/array-trace-resolver.h @@ -48,7 +48,7 @@ public: * to provide a method named CreateTraceResolver which takes as * only argument a reference to a const TraceContext and returns * a pointer to a TraceResolver. i.e. the signature is: - * TraceResolver * (*) (TraceContext const &) + * Ptr (*) (void) */ ArrayTraceResolver (Callback getSize, Callback get); @@ -83,9 +83,8 @@ ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, TraceContext tmp = context; INDEX index = i; tmp.Add (index); - TraceResolver *resolver = m_get (i)->CreateTraceResolver (); + Ptr resolver = m_get (i)->CreateTraceResolver (); resolver->Connect (subpath, cb, tmp); - delete resolver; } } } @@ -99,9 +98,8 @@ ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &c { for (uint32_t i = 0; i < m_getSize (); i++) { - TraceResolver *resolver = m_get (i)->CreateTraceResolver (); + Ptr resolver = m_get (i)->CreateTraceResolver (); resolver->Disconnect (subpath, cb); - delete resolver; } } } diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc index fa7157afb..ee19ae960 100644 --- a/src/common/composite-trace-resolver.cc +++ b/src/common/composite-trace-resolver.cc @@ -33,14 +33,14 @@ CompositeTraceResolver::~CompositeTraceResolver () void CompositeTraceResolver::Add (std::string name, - Callback createResolver) + Callback > createResolver) { DoAdd (name, createResolver, TraceContext ()); } void CompositeTraceResolver::DoAdd (std::string name, - Callback createResolver, + Callback > createResolver, TraceContext const &context) { struct CallbackTraceSourceItem item; @@ -125,7 +125,7 @@ CompositeTraceResolver::OperationOne (std::string subpath, const TraceContext &context, enum Operation op) { - TraceResolver *resolver = i->createResolver (); + Ptr resolver = i->createResolver (); switch (op) { case CONNECT: { NS_DEBUG ("connect to path="< void Add (std::string name, - Callback createResolver, + Callback > createResolver, T const &context); /** @@ -122,7 +123,7 @@ public: * will be invoked to create the child trace resolver. */ void Add (std::string name, - Callback createResolver); + Callback > createResolver); virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); @@ -130,7 +131,7 @@ private: struct CallbackTraceSourceItem { std::string name; - Callback createResolver; + Callback > createResolver; TraceContext context; }; typedef std::list TraceItems; @@ -143,9 +144,9 @@ private: void DoAddTraceSource (std::string name, SOURCE &traceSource, CONTEXT const &context); template - static TraceResolver *CreateTerminalTraceResolver (SOURCE *trace); + static Ptr CreateTerminalTraceResolver (SOURCE *trace); void DoAdd (std::string name, - Callback createResolver, + Callback > createResolver, TraceContext const &context); void OperationOne (std::string subpath, TraceItems::const_iterator i, @@ -170,9 +171,9 @@ void CompositeTraceResolver::DoAddTraceSource (std::string name, SOURCE &traceSource, CONTEXT const &context) { - TraceResolver *(*create) (SOURCE *trace); + Ptr (*create) (SOURCE *trace); create = &CompositeTraceResolver::CreateTerminalTraceResolver; - Callback createResolver = + Callback > createResolver = MakeBoundCallback (create, &traceSource); TraceContext ctx; @@ -181,10 +182,10 @@ CompositeTraceResolver::DoAddTraceSource (std::string name, } template -TraceResolver * +Ptr CompositeTraceResolver::CreateTerminalTraceResolver (SOURCE *traceSource) { - return new TerminalTraceResolver (*traceSource); + return Create > (traceSource); } @@ -224,7 +225,7 @@ CompositeTraceResolver::Add (std::string name, template void CompositeTraceResolver::Add (std::string name, - Callback createResolver, + Callback > createResolver, T const &context) { TraceContext ctx; diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc index 1dd6126a3..0bd3e0443 100644 --- a/src/common/trace-resolver.cc +++ b/src/common/trace-resolver.cc @@ -19,6 +19,9 @@ * Author: Mathieu Lacage */ #include "trace-resolver.h" +#include "ns3/debug.h" + +NS_DEBUG_COMPONENT_DEFINE ("TraceResolver"); namespace ns3 { @@ -40,6 +43,7 @@ TraceResolver::Unref (void) m_count--; if (m_count == 0) { + NS_DEBUG ("delete "< resolver = GetComposite (); resolver->Connect (path, cb, TraceContext ()); } void TraceRoot::Disconnect (std::string path, CallbackBase const &cb) { - TraceResolver *resolver = GetComposite (); + Ptr resolver = GetComposite (); resolver->Disconnect (path, cb); } void TraceRoot::Register (std::string name, - Callback createResolver) + Callback > createResolver) { - CompositeTraceResolver *resolver = GetComposite (); + Ptr resolver = GetComposite (); resolver->Add (name, createResolver); } -CompositeTraceResolver * +Ptr TraceRoot::GetComposite (void) { static CompositeTraceResolver resolver; diff --git a/src/common/trace-root.h b/src/common/trace-root.h index 270747fce..76b6a7efb 100644 --- a/src/common/trace-root.h +++ b/src/common/trace-root.h @@ -325,9 +325,9 @@ public: static void Connect (std::string path, CallbackBase const &cb); static void Disconnect (std::string path, CallbackBase const &cb); static void Register (std::string name, - Callback createResolver); + Callback > createResolver); private: - static CompositeTraceResolver *GetComposite (void); + static Ptr GetComposite (void); }; }// namespace ns3 diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index bb51fd36a..e587bb089 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -449,10 +449,10 @@ CsmaCdNetDevice::TransmitReadyEvent (void) } } -TraceResolver * +Ptr CsmaCdNetDevice::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); resolver->Add ("queue", MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); diff --git a/src/devices/csma-cd/csma-cd-net-device.h b/src/devices/csma-cd/csma-cd-net-device.h index 51b3db8ea..42b85f3b5 100644 --- a/src/devices/csma-cd/csma-cd-net-device.h +++ b/src/devices/csma-cd/csma-cd-net-device.h @@ -311,7 +311,7 @@ private: * (NOT TESTED) * @see class TraceResolver */ - virtual TraceResolver *DoCreateTraceResolver (void); + virtual Ptr DoCreateTraceResolver (void); /** * Aborts the transmission of the current packet diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index f09810f82..5275b6209 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -188,9 +188,10 @@ void PointToPointNetDevice::TransmitComplete (void) TransmitStart(p); } -TraceResolver* PointToPointNetDevice::DoCreateTraceResolver (void) +Ptr +PointToPointNetDevice::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); resolver->Add ("queue", MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); resolver->Add ("rx", diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 8d2a02fe2..3a1bc1e0e 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -243,7 +243,7 @@ private: * * @see class TraceResolver */ - virtual TraceResolver* DoCreateTraceResolver (void); + virtual Ptr DoCreateTraceResolver (void); virtual bool DoNeedsArp (void) const; /** * Enumeration of the states of the transmit machine of the net device. diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 7077d0903..3c353efe6 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -40,10 +40,10 @@ ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) ArpIpv4Interface::~ArpIpv4Interface () {} -TraceResolver * +Ptr ArpIpv4Interface::DoCreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); if (GetDevice () != 0) { resolver->Add ("netdevice", diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 537a16a2f..a31039478 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -44,7 +44,7 @@ class ArpIpv4Interface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (void); + virtual Ptr DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 46654c89e..b116ce648 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -58,10 +58,10 @@ ArpL3Protocol::DoDispose (void) Object::DoDispose (); } -TraceResolver * +Ptr ArpL3Protocol::CreateTraceResolver (void) { - return new EmptyTraceResolver (); + return Create (); } ArpCache * diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index 3d752b46e..468c301b6 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -49,7 +49,7 @@ public: ArpL3Protocol (Ptr node); virtual ~ArpL3Protocol (); - virtual TraceResolver *CreateTraceResolver (void); + virtual Ptr CreateTraceResolver (void); /** * \brief Recieve a packet */ diff --git a/src/internet-node/ipv4-interface.cc b/src/internet-node/ipv4-interface.cc index d44edf130..699d6109d 100644 --- a/src/internet-node/ipv4-interface.cc +++ b/src/internet-node/ipv4-interface.cc @@ -22,6 +22,7 @@ #include "ipv4-interface.h" #include "ns3/ipv4-address.h" #include "ns3/net-device.h" +#include "ns3/trace-resolver.h" namespace ns3 { @@ -45,7 +46,7 @@ Ipv4Interface::GetDevice (void) const return m_netdevice; } -TraceResolver * +Ptr Ipv4Interface::CreateTraceResolver (void) { return DoCreateTraceResolver (); diff --git a/src/internet-node/ipv4-interface.h b/src/internet-node/ipv4-interface.h index e5c6788eb..a462d5be5 100644 --- a/src/internet-node/ipv4-interface.h +++ b/src/internet-node/ipv4-interface.h @@ -83,7 +83,7 @@ public: * This method will delegate the work to the private DoCreateTraceResolver * method which is supposed to be implemented by subclasses. */ - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); /** * \returns the underlying NetDevice. This method can return * zero if this interface has no associated NetDevice. @@ -153,7 +153,7 @@ public: private: virtual void SendTo (Packet p, Ipv4Address dest) = 0; - virtual TraceResolver *DoCreateTraceResolver (void) = 0; + virtual Ptr DoCreateTraceResolver (void) = 0; Ptr m_netdevice; bool m_ifup; Ipv4Address m_address; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 9fd06abba..df97fafc0 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -153,10 +153,10 @@ Ipv4L3Protocol::SetupLoopback (void) interface->SetUp (); } -TraceResolver * +Ptr Ipv4L3Protocol::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); resolver->Add ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); @@ -165,11 +165,11 @@ Ipv4L3Protocol::CreateTraceResolver (void) return resolver; } -TraceResolver * +Ptr Ipv4L3Protocol::InterfacesCreateTraceResolver (void) const { - ArrayTraceResolver *resolver = - new ArrayTraceResolver + Ptr >resolver = + Create > (MakeCallback (&Ipv4L3Protocol::GetNInterfaces, this), MakeCallback (&Ipv4L3Protocol::GetInterface, this)); return resolver; diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 4209019ad..f6fcec7a7 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -92,7 +92,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - virtual TraceResolver *CreateTraceResolver (void); + virtual Ptr CreateTraceResolver (void); /** * \param ttl default ttl to use @@ -189,7 +189,7 @@ private: void ForwardUp (Packet p, Ipv4Header const&ip); uint32_t AddIpv4Interface (Ipv4Interface *interface); void SetupLoopback (void); - TraceResolver *InterfacesCreateTraceResolver (void) const; + Ptr InterfacesCreateTraceResolver (void) const; typedef std::list Ipv4InterfaceList; typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 9981a718d..56ee9eb9a 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -78,10 +78,10 @@ Ipv4L4Demux::DoDispose (void) Object::DoDispose (); } -TraceResolver * +Ptr Ipv4L4Demux::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) { Ptr protocol = *i; diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 8431e1e48..0b4755435 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -66,7 +66,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. diff --git a/src/internet-node/ipv4-l4-protocol.h b/src/internet-node/ipv4-l4-protocol.h index 4ecd5a142..c658318a1 100644 --- a/src/internet-node/ipv4-l4-protocol.h +++ b/src/internet-node/ipv4-l4-protocol.h @@ -59,7 +59,7 @@ public: */ int GetVersion() const; - virtual TraceResolver *CreateTraceResolver () = 0; + virtual Ptr CreateTraceResolver () = 0; /** * \param p packet to forward up diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 4e23abde3..1364e2daf 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -34,10 +34,10 @@ Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) Ipv4LoopbackInterface::~Ipv4LoopbackInterface () {} -TraceResolver * +Ptr Ipv4LoopbackInterface::DoCreateTraceResolver (void) { - return new EmptyTraceResolver (); + return Create (); } void diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index b17f46449..e9df32007 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -43,7 +43,7 @@ class Ipv4LoopbackInterface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (void); + virtual Ptr DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index a83cb4657..13e937d3c 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -45,10 +45,10 @@ UdpL4Protocol::UdpL4Protocol (Ptr node) UdpL4Protocol::~UdpL4Protocol () {} -TraceResolver * +Ptr UdpL4Protocol::CreateTraceResolver (void) { - return new EmptyTraceResolver (); + return Create (); } void diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index d41bbb839..da2cd0e2d 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -49,7 +49,7 @@ public: UdpL4Protocol (Ptr node); virtual ~UdpL4Protocol (); - virtual TraceResolver *CreateTraceResolver (void); + virtual Ptr CreateTraceResolver (void); /** * \return A smart Socket pointer to a UdpSocket, allocated by this instance * of the UDP protocol diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 626b82c63..cdc1f63f3 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -23,6 +23,7 @@ #include "ns3/assert.h" #include "ns3/object.h" #include "ns3/debug.h" +#include "ns3/trace-resolver.h" #include "channel.h" @@ -183,7 +184,7 @@ NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber) } } -TraceResolver * +Ptr NetDevice::CreateTraceResolver (void) { return DoCreateTraceResolver (); diff --git a/src/node/net-device.h b/src/node/net-device.h index cadd70dfc..af63be5b4 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -69,7 +69,7 @@ public: * performed in this object. The caller must * delete the returned object. */ - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); /** * \return the channel this NetDevice is connected to. The value @@ -290,7 +290,7 @@ public: * * Subclasses must implement this method. */ - virtual TraceResolver *DoCreateTraceResolver (void) = 0; + virtual Ptr DoCreateTraceResolver (void) = 0; /** * \returns the channel associated to this NetDevice. * diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 761717c9f..823b92a0c 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -76,7 +76,7 @@ public: uint32_t Add (Ptr node); NodeList::Iterator Begin (void); NodeList::Iterator End (void); - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); Ptr GetNode (uint32_t n); uint32_t GetNNodes (void); @@ -130,11 +130,11 @@ NodeListPriv::GetNode (uint32_t n) } -TraceResolver * +Ptr NodeListPriv::CreateTraceResolver (void) { - ArrayTraceResolver, NodeListIndex> *resolver = - new ArrayTraceResolver, NodeListIndex> + Ptr, NodeListIndex> >resolver = + Create, NodeListIndex> > (MakeCallback (&NodeListPriv::GetNNodes, this), MakeCallback (&NodeListPriv::GetNode, this)); return resolver; @@ -164,7 +164,7 @@ NodeList::End (void) { return SimulationSingleton::Get ()->End (); } -TraceResolver * +Ptr NodeList::CreateTraceResolver (void) { return SimulationSingleton::Get ()->CreateTraceResolver (); diff --git a/src/node/node-list.h b/src/node/node-list.h index beda5611c..66cd6965d 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -79,7 +79,7 @@ public: * \returns the requested trace resolver. The caller * takes ownership of the returned pointer. */ - static TraceResolver *CreateTraceResolver (void); + static Ptr CreateTraceResolver (void); /** * \param n index of requested node. diff --git a/src/node/node.cc b/src/node/node.cc index 4de3a93ad..554431db1 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -82,11 +82,11 @@ Node::Construct (void) Node::~Node () {} -TraceResolver * +Ptr Node::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); - DoFillTraceResolver (*resolver); + Ptr resolver = Create (); + DoFillTraceResolver (*PeekPointer (resolver)); return resolver; } @@ -141,11 +141,11 @@ Node::GetNApplications (void) const return m_applications.size (); } -TraceResolver * +Ptr Node::CreateDevicesTraceResolver (void) { - ArrayTraceResolver,NodeNetDeviceIndex> *resolver = - new ArrayTraceResolver,NodeNetDeviceIndex> + Ptr,NodeNetDeviceIndex> >resolver = + Create,NodeNetDeviceIndex> > (MakeCallback (&Node::GetNDevices, this), MakeCallback (&Node::GetDevice, this)); diff --git a/src/node/node.h b/src/node/node.h index 104f3a2a4..7931dd001 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -92,7 +92,7 @@ public: * could be used directly by a user who needs access to very low-level * trace configuration. */ - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); /** * \returns the unique id of this node. @@ -212,7 +212,7 @@ private: bool ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); void Construct (void); - TraceResolver *CreateDevicesTraceResolver (void); + Ptr CreateDevicesTraceResolver (void); struct ProtocolHandlerEntry { ProtocolHandler handler; diff --git a/src/node/queue.cc b/src/node/queue.cc index 163f73ffc..8a6725e4e 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -94,10 +94,10 @@ Queue::~Queue() NS_DEBUG("Queue::~Queue ()"); } -TraceResolver * +Ptr Queue::CreateTraceResolver (void) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (); + Ptr resolver = Create (); resolver->Add ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); resolver->Add ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); resolver->Add ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); diff --git a/src/node/queue.h b/src/node/queue.h index 2c010c363..bf2c6a2d6 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -70,7 +70,7 @@ public: Queue (); virtual ~Queue (); - TraceResolver *CreateTraceResolver (void); + Ptr CreateTraceResolver (void); /** * \return true if the queue is empty; false otherwise From a054cc2385b396d4bbc6655a3e3f4debf9a2b654 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 15:53:43 +0200 Subject: [PATCH 010/218] move trace code to core module --HG-- rename : src/common/array-trace-resolver.h => src/core/array-trace-resolver.h rename : src/common/callback-trace-source.cc => src/core/callback-trace-source.cc rename : src/common/callback-trace-source.h => src/core/callback-trace-source.h rename : src/common/composite-trace-resolver.cc => src/core/composite-trace-resolver.cc rename : src/common/composite-trace-resolver.h => src/core/composite-trace-resolver.h rename : src/common/empty-trace-resolver.cc => src/core/empty-trace-resolver.cc rename : src/common/empty-trace-resolver.h => src/core/empty-trace-resolver.h rename : src/common/fv-trace-source.h => src/core/fv-trace-source.h rename : src/common/stream-tracer-test.cc => src/core/stream-tracer-test.cc rename : src/common/stream-tracer.h => src/core/stream-tracer.h rename : src/common/sv-trace-source.h => src/core/sv-trace-source.h rename : src/common/terminal-trace-resolver.h => src/core/terminal-trace-resolver.h rename : src/common/trace-context-element.cc => src/core/trace-context-element.cc rename : src/common/trace-context-element.h => src/core/trace-context-element.h rename : src/common/trace-context.cc => src/core/trace-context.cc rename : src/common/trace-context.h => src/core/trace-context.h rename : src/common/trace-resolver.cc => src/core/trace-resolver.cc rename : src/common/trace-resolver.h => src/core/trace-resolver.h rename : src/common/trace-root.cc => src/core/trace-root.cc rename : src/common/trace-root.h => src/core/trace-root.h rename : src/common/uv-trace-source.h => src/core/uv-trace-source.h rename : src/common/variable-tracer-test.cc => src/core/variable-tracer-test.cc --- src/common/wscript | 20 ------------------- src/{common => core}/array-trace-resolver.h | 0 src/{common => core}/callback-trace-source.cc | 0 src/{common => core}/callback-trace-source.h | 0 .../composite-trace-resolver.cc | 0 .../composite-trace-resolver.h | 0 src/{common => core}/empty-trace-resolver.cc | 0 src/{common => core}/empty-trace-resolver.h | 0 src/{common => core}/fv-trace-source.h | 0 src/{common => core}/stream-tracer-test.cc | 0 src/{common => core}/stream-tracer.h | 0 src/{common => core}/sv-trace-source.h | 0 .../terminal-trace-resolver.h | 0 src/{common => core}/trace-context-element.cc | 0 src/{common => core}/trace-context-element.h | 0 src/{common => core}/trace-context.cc | 0 src/{common => core}/trace-context.h | 0 src/{common => core}/trace-resolver.cc | 0 src/{common => core}/trace-resolver.h | 0 src/{common => core}/trace-root.cc | 0 src/{common => core}/trace-root.h | 0 src/{common => core}/uv-trace-source.h | 0 src/{common => core}/variable-tracer-test.cc | 0 src/core/wscript | 20 +++++++++++++++++++ 24 files changed, 20 insertions(+), 20 deletions(-) rename src/{common => core}/array-trace-resolver.h (100%) rename src/{common => core}/callback-trace-source.cc (100%) rename src/{common => core}/callback-trace-source.h (100%) rename src/{common => core}/composite-trace-resolver.cc (100%) rename src/{common => core}/composite-trace-resolver.h (100%) rename src/{common => core}/empty-trace-resolver.cc (100%) rename src/{common => core}/empty-trace-resolver.h (100%) rename src/{common => core}/fv-trace-source.h (100%) rename src/{common => core}/stream-tracer-test.cc (100%) rename src/{common => core}/stream-tracer.h (100%) rename src/{common => core}/sv-trace-source.h (100%) rename src/{common => core}/terminal-trace-resolver.h (100%) rename src/{common => core}/trace-context-element.cc (100%) rename src/{common => core}/trace-context-element.h (100%) rename src/{common => core}/trace-context.cc (100%) rename src/{common => core}/trace-context.h (100%) rename src/{common => core}/trace-resolver.cc (100%) rename src/{common => core}/trace-resolver.h (100%) rename src/{common => core}/trace-root.cc (100%) rename src/{common => core}/trace-root.h (100%) rename src/{common => core}/uv-trace-source.h (100%) rename src/{common => core}/variable-tracer-test.cc (100%) diff --git a/src/common/wscript b/src/common/wscript index c6e9cb45d..2472ecd1e 100644 --- a/src/common/wscript +++ b/src/common/wscript @@ -12,14 +12,6 @@ def build(bld): 'tags.cc', 'tag-registry.cc', 'pcap-writer.cc', - 'variable-tracer-test.cc', - 'trace-context.cc', - 'trace-context-element.cc', - 'trace-resolver.cc', - 'callback-trace-source.cc', - 'empty-trace-resolver.cc', - 'composite-trace-resolver.cc', - 'trace-root.cc', 'data-rate.cc', ] @@ -35,18 +27,6 @@ def build(bld): 'packet.h', 'packet-printer.h', 'packet-metadata.h', - 'uv-trace-source.h', - 'sv-trace-source.h', - 'fv-trace-source.h', 'pcap-writer.h', - 'callback-trace-source.h', - 'trace-context.h', - 'trace-context-element.h', - 'trace-resolver.h', - 'empty-trace-resolver.h', - 'composite-trace-resolver.h', - 'array-trace-resolver.h', - 'trace-root.h', - 'terminal-trace-resolver.h', 'data-rate.h', ] diff --git a/src/common/array-trace-resolver.h b/src/core/array-trace-resolver.h similarity index 100% rename from src/common/array-trace-resolver.h rename to src/core/array-trace-resolver.h diff --git a/src/common/callback-trace-source.cc b/src/core/callback-trace-source.cc similarity index 100% rename from src/common/callback-trace-source.cc rename to src/core/callback-trace-source.cc diff --git a/src/common/callback-trace-source.h b/src/core/callback-trace-source.h similarity index 100% rename from src/common/callback-trace-source.h rename to src/core/callback-trace-source.h diff --git a/src/common/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc similarity index 100% rename from src/common/composite-trace-resolver.cc rename to src/core/composite-trace-resolver.cc diff --git a/src/common/composite-trace-resolver.h b/src/core/composite-trace-resolver.h similarity index 100% rename from src/common/composite-trace-resolver.h rename to src/core/composite-trace-resolver.h diff --git a/src/common/empty-trace-resolver.cc b/src/core/empty-trace-resolver.cc similarity index 100% rename from src/common/empty-trace-resolver.cc rename to src/core/empty-trace-resolver.cc diff --git a/src/common/empty-trace-resolver.h b/src/core/empty-trace-resolver.h similarity index 100% rename from src/common/empty-trace-resolver.h rename to src/core/empty-trace-resolver.h diff --git a/src/common/fv-trace-source.h b/src/core/fv-trace-source.h similarity index 100% rename from src/common/fv-trace-source.h rename to src/core/fv-trace-source.h diff --git a/src/common/stream-tracer-test.cc b/src/core/stream-tracer-test.cc similarity index 100% rename from src/common/stream-tracer-test.cc rename to src/core/stream-tracer-test.cc diff --git a/src/common/stream-tracer.h b/src/core/stream-tracer.h similarity index 100% rename from src/common/stream-tracer.h rename to src/core/stream-tracer.h diff --git a/src/common/sv-trace-source.h b/src/core/sv-trace-source.h similarity index 100% rename from src/common/sv-trace-source.h rename to src/core/sv-trace-source.h diff --git a/src/common/terminal-trace-resolver.h b/src/core/terminal-trace-resolver.h similarity index 100% rename from src/common/terminal-trace-resolver.h rename to src/core/terminal-trace-resolver.h diff --git a/src/common/trace-context-element.cc b/src/core/trace-context-element.cc similarity index 100% rename from src/common/trace-context-element.cc rename to src/core/trace-context-element.cc diff --git a/src/common/trace-context-element.h b/src/core/trace-context-element.h similarity index 100% rename from src/common/trace-context-element.h rename to src/core/trace-context-element.h diff --git a/src/common/trace-context.cc b/src/core/trace-context.cc similarity index 100% rename from src/common/trace-context.cc rename to src/core/trace-context.cc diff --git a/src/common/trace-context.h b/src/core/trace-context.h similarity index 100% rename from src/common/trace-context.h rename to src/core/trace-context.h diff --git a/src/common/trace-resolver.cc b/src/core/trace-resolver.cc similarity index 100% rename from src/common/trace-resolver.cc rename to src/core/trace-resolver.cc diff --git a/src/common/trace-resolver.h b/src/core/trace-resolver.h similarity index 100% rename from src/common/trace-resolver.h rename to src/core/trace-resolver.h diff --git a/src/common/trace-root.cc b/src/core/trace-root.cc similarity index 100% rename from src/common/trace-root.cc rename to src/core/trace-root.cc diff --git a/src/common/trace-root.h b/src/core/trace-root.h similarity index 100% rename from src/common/trace-root.h rename to src/core/trace-root.h diff --git a/src/common/uv-trace-source.h b/src/core/uv-trace-source.h similarity index 100% rename from src/common/uv-trace-source.h rename to src/core/uv-trace-source.h diff --git a/src/common/variable-tracer-test.cc b/src/core/variable-tracer-test.cc similarity index 100% rename from src/common/variable-tracer-test.cc rename to src/core/variable-tracer-test.cc diff --git a/src/core/wscript b/src/core/wscript index bba53ae71..c9b13f4ac 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -42,6 +42,14 @@ def build(bld): 'type-name.cc', 'component-manager.cc', 'random-variable-default-value.cc', + 'variable-tracer-test.cc', + 'trace-context.cc', + 'trace-context-element.cc', + 'trace-resolver.cc', + 'callback-trace-source.cc', + 'empty-trace-resolver.cc', + 'composite-trace-resolver.cc', + 'trace-root.cc', ] if sys.platform == 'win32': @@ -73,5 +81,17 @@ def build(bld): 'component-manager.h', 'type-traits.h', 'random-variable-default-value.h', + 'uv-trace-source.h', + 'sv-trace-source.h', + 'fv-trace-source.h', + 'callback-trace-source.h', + 'trace-context.h', + 'trace-context-element.h', + 'trace-resolver.h', + 'empty-trace-resolver.h', + 'composite-trace-resolver.h', + 'array-trace-resolver.h', + 'trace-root.h', + 'terminal-trace-resolver.h', ] From e34b7e8bf7464504bf9387aa6e6fe45cb4832783 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 15:57:33 +0200 Subject: [PATCH 011/218] fix includes --- src/core/array-trace-resolver.h | 2 +- src/core/callback-trace-source.cc | 2 +- src/core/callback-trace-source.h | 4 ++-- src/core/composite-trace-resolver.cc | 4 ++-- src/core/composite-trace-resolver.h | 4 ++-- src/core/random-variable-default-value.cc | 2 +- src/core/stream-tracer-test.cc | 2 +- src/core/sv-trace-source.h | 2 +- src/core/terminal-trace-resolver.h | 2 +- src/core/trace-context.cc | 4 ++-- src/core/trace-context.h | 2 +- src/core/trace-resolver.cc | 2 +- src/core/trace-root.cc | 4 ++-- src/core/trace-root.h | 2 +- src/core/uid-manager.cc | 4 ++-- src/core/uv-trace-source.h | 2 +- src/core/variable-tracer-test.cc | 4 ++-- 17 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index b6ffe0212..547ff0009 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -23,7 +23,7 @@ #include #include -#include "ns3/callback.h" +#include "callback.h" #include "trace-resolver.h" namespace ns3 { diff --git a/src/core/callback-trace-source.cc b/src/core/callback-trace-source.cc index d35b4f860..7bcb41fe0 100644 --- a/src/core/callback-trace-source.cc +++ b/src/core/callback-trace-source.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "callback-trace-source.h" -#include "ns3/test.h" +#include "test.h" namespace ns3 { diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index a1e13df9d..6282467f9 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -23,8 +23,8 @@ #define CALLBACK_TRACE_H #include -#include "ns3/callback.h" -#include "ns3/fatal-error.h" +#include "callback.h" +#include "fatal-error.h" #include "trace-context.h" namespace ns3 { diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index ee19ae960..83d63c29b 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "composite-trace-resolver.h" -#include "ns3/debug.h" +#include "debug.h" NS_DEBUG_COMPONENT_DEFINE ("CompositeTraceResolver"); @@ -149,7 +149,7 @@ CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb) #ifdef RUN_SELF_TESTS -#include "ns3/test.h" +#include "test.h" #include "trace-context-element.h" namespace ns3 { diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 7f87c708c..d33c4cc5c 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -21,8 +21,8 @@ #ifndef COMPOSITE_TRACE_RESOLVER_H #define COMPOSITE_TRACE_RESOLVER_H -#include "ns3/callback.h" -#include "ns3/ptr.h" +#include "callback.h" +#include "ptr.h" #include "trace-resolver.h" #include "callback-trace-source.h" #include "uv-trace-source.h" diff --git a/src/core/random-variable-default-value.cc b/src/core/random-variable-default-value.cc index 3217c3513..14fdfa5a3 100644 --- a/src/core/random-variable-default-value.cc +++ b/src/core/random-variable-default-value.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "random-variable-default-value.h" -#include "ns3/debug.h" +#include "debug.h" NS_DEBUG_COMPONENT_DEFINE ("RandomVariableDefaultValue"); diff --git a/src/core/stream-tracer-test.cc b/src/core/stream-tracer-test.cc index f38e80dc4..f708015b6 100644 --- a/src/core/stream-tracer-test.cc +++ b/src/core/stream-tracer-test.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "stream-tracer.h" -#include "ns3/test.h" +#include "test.h" #include #ifdef RUN_SELF_TESTS diff --git a/src/core/sv-trace-source.h b/src/core/sv-trace-source.h index ce5511705..291bc764e 100644 --- a/src/core/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -74,7 +74,7 @@ class UVTraceSource; * ns3::UVTraceSource : \code #include - #include "ns3/sv-trace-source.h" + #include "sv-trace-source.h" ns3::SVTraceSource var; \endcode diff --git a/src/core/terminal-trace-resolver.h b/src/core/terminal-trace-resolver.h index f35d32d86..42ee7fc2d 100644 --- a/src/core/terminal-trace-resolver.h +++ b/src/core/terminal-trace-resolver.h @@ -22,7 +22,7 @@ #define TERMINAL_TRACE_RESOLVER_H #include "trace-resolver.h" -#include "ns3/assert.h" +#include "assert.h" namespace ns3 { diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index 50e9d0a73..3082f50b5 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -20,7 +20,7 @@ */ #include "trace-context.h" #include "trace-context-element.h" -#include "ns3/assert.h" +#include "assert.h" namespace ns3 { @@ -233,7 +233,7 @@ TraceContext::Print (std::ostream &os) const }//namespace ns3 -#include "ns3/test.h" +#include "test.h" #include namespace ns3 { diff --git a/src/core/trace-context.h b/src/core/trace-context.h index eee3c960c..d33ee2fda 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -23,7 +23,7 @@ #include #include -#include "ns3/fatal-error.h" +#include "fatal-error.h" #include "trace-context-element.h" namespace ns3 { diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 0bd3e0443..b92bc785f 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "trace-resolver.h" -#include "ns3/debug.h" +#include "debug.h" NS_DEBUG_COMPONENT_DEFINE ("TraceResolver"); diff --git a/src/core/trace-root.cc b/src/core/trace-root.cc index 826cc419b..9de21a127 100644 --- a/src/core/trace-root.cc +++ b/src/core/trace-root.cc @@ -19,8 +19,8 @@ * Author: Mathieu Lacage */ #include "trace-root.h" -#include "ns3/composite-trace-resolver.h" -#include "ns3/trace-context.h" +#include "composite-trace-resolver.h" +#include "trace-context.h" namespace ns3 { diff --git a/src/core/trace-root.h b/src/core/trace-root.h index 76b6a7efb..eb3ddc2ea 100644 --- a/src/core/trace-root.h +++ b/src/core/trace-root.h @@ -22,7 +22,7 @@ #define TRACE_ROOT_H #include -#include "ns3/callback.h" +#include "callback.h" /** * \defgroup lowleveltracing Low-level tracing diff --git a/src/core/uid-manager.cc b/src/core/uid-manager.cc index f6aa3f6de..364ab769c 100644 --- a/src/core/uid-manager.cc +++ b/src/core/uid-manager.cc @@ -19,8 +19,8 @@ * Author: Mathieu Lacage */ #include "uid-manager.h" -#include "ns3/fatal-error.h" -#include "ns3/assert.h" +#include "fatal-error.h" +#include "assert.h" namespace ns3 { diff --git a/src/core/uv-trace-source.h b/src/core/uv-trace-source.h index b83873580..0bdfb3f94 100644 --- a/src/core/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -78,7 +78,7 @@ class SVTraceSource; * ns3::UVTraceSource : \code #include - #include "ns3/uv-trace-source.h" + #include "uv-trace-source.h" ns3::UVTraceSource var; \endcode diff --git a/src/core/variable-tracer-test.cc b/src/core/variable-tracer-test.cc index 29f3fc148..bd996e739 100644 --- a/src/core/variable-tracer-test.cc +++ b/src/core/variable-tracer-test.cc @@ -22,8 +22,8 @@ #include "uv-trace-source.h" #include "sv-trace-source.h" #include "trace-context.h" -#include "ns3/test.h" -#include "ns3/callback.h" +#include "test.h" +#include "callback.h" namespace ns3 { From 84612be15effc41131b7dfd572bcd3a80d90699e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 10 Aug 2007 16:05:20 +0200 Subject: [PATCH 012/218] add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods --- src/core/object.cc | 19 +++++++++++++++++++ src/core/object.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/src/core/object.cc b/src/core/object.cc index 9b4812c42..8e2ada60a 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -22,6 +22,7 @@ #include "assert.h" #include "singleton.h" #include "uid-manager.h" +#include "empty-trace-resolver.h" #include namespace { @@ -163,6 +164,18 @@ Object::AddInterface (Ptr o) NS_ASSERT (o->Check ()); } +void +Object::TraceConnect (std::string path, const CallbackBase &cb) +{ + GetTraceResolver ()->Connect (path, cb, TraceContext ()); +} +void +Object::TraceDisconnect (std::string path, const CallbackBase &cb) +{ + GetTraceResolver ()->Disconnect (path, cb); +} + + void Object::SetInterfaceId (InterfaceId iid) { @@ -176,6 +189,12 @@ Object::DoDispose (void) NS_ASSERT (!m_disposed); } +Ptr +Object::GetTraceResolver (void) const +{ + return Create (); +} + bool Object::Check (void) const { diff --git a/src/core/object.h b/src/core/object.h index 1b60e85e9..355d196ee 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -27,6 +27,9 @@ namespace ns3 { +class TraceResolver; +class CallbackBase; + /** * \brief a unique identifier for an interface. * @@ -132,6 +135,9 @@ public: */ void AddInterface (Ptr other); + + void TraceConnect (std::string path, const CallbackBase &cb); + void TraceDisconnect (std::string path, const CallbackBase &cb); protected: /** * \param iid an InterfaceId @@ -147,6 +153,8 @@ protected: * up to their parent's implementation once they are done. */ virtual void DoDispose (void); + + virtual Ptr GetTraceResolver (void) const; private: Ptr DoQueryInterface (InterfaceId iid) const; bool Check (void) const; From a36a00fb5a0bb31c74e45cdeae68ccfe46c0d311 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 16:25:19 +0200 Subject: [PATCH 013/218] rewrite the ArrayTraceResolver to use iterators --- src/core/array-trace-resolver.h | 169 +++++++++++++++++++++----------- 1 file changed, 114 insertions(+), 55 deletions(-) diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index 547ff0009..3ba7147c5 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -25,85 +25,144 @@ #include #include "callback.h" #include "trace-resolver.h" +#include "object.h" namespace ns3 { /** * \brief a helper class to offer trace resolution for an array of objects. * \ingroup lowleveltracing + * + * \class ArrayTraceResolver + * + * An ArrayTraceResolver is a resolver which can match any input integer + * against an element in an array. The array is accessed using a + * pair iterators. Each element of the array is expected + * to be a subclass of the Object base class. + * + * When the Connect method is called, this trace resolver will + * automatically store in the TraceContext of each resolved object + * its index through an object of type INDEX specified during the + * instanciation of the ArrayTraceResolver template. */ -template +template class ArrayTraceResolver : public TraceResolver { public: - /** - * \param getSize callback which returns dynamically the size of underlying array - * \param get callback which returns any element in the underlying array - * - * Construct a trace resolver which can match any input integer - * against an element in an array. The array is accessed using a - * pair of callbacks. It is the responsability of the user to - * provide two such callbacks whose job is to adapt the array - * API to the resolver needs. Each element of the array is expected - * to provide a method named CreateTraceResolver which takes as - * only argument a reference to a const TraceContext and returns - * a pointer to a TraceResolver. i.e. the signature is: - * Ptr (*) (void) - */ - ArrayTraceResolver (Callback getSize, - Callback get); + ArrayTraceResolver (); + ~ArrayTraceResolver (); + /** + * \param begin an iterator which points to the start of the array. + * \param end an iterator which points to the end of the array. + */ + template + void SetIterators (T begin, T end); + + // inherited from TraceResolver virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); + private: - Callback m_getSize; - Callback m_get; + class IteratorBase + { + public: + virtual ~IteratorBase () {} + virtual void Next (void) = 0; + virtual bool HasNext (void) = 0; + virtual Ptr Get (void) = 0; + virtual void Rewind (void) = 0; + }; + IteratorBase *m_iter; }; }//namespace ns3 + +// implementation namespace ns3 { -template -ArrayTraceResolver::ArrayTraceResolver (Callback getSize, - Callback get) - : m_getSize (getSize), - m_get (get) +template +ArrayTraceResolver::ArrayTraceResolver () + : m_iter (0) {} -template -void -ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +template +ArrayTraceResolver::~ArrayTraceResolver () { - std::string id = GetElement (path); - std::string subpath = GetSubpath (path); - if (id == "*") - { - for (uint32_t i = 0; i < m_getSize (); i++) - { - TraceContext tmp = context; - INDEX index = i; - tmp.Add (index); - Ptr resolver = m_get (i)->CreateTraceResolver (); - resolver->Connect (subpath, cb, tmp); - } - } -} -template -void -ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &cb) -{ - std::string id = GetElement (path); - std::string subpath = GetSubpath (path); - if (id == "*") - { - for (uint32_t i = 0; i < m_getSize (); i++) - { - Ptr resolver = m_get (i)->CreateTraceResolver (); - resolver->Disconnect (subpath, cb); - } - } + delete m_iter; } +template +template +void +ArrayTraceResolver::SetIterators (T begin, T end) +{ + class Iterator : public IteratorBase + { + public: + Iterator (T begin, T end) + : m_begin (begin), m_end (end), m_cur (begin) + {} + virtual void Next (void) + {m_cur++;} + virtual bool HasNext (void) + {return m_cur != m_end;} + virtual Ptr Get (void) + {return *m_cur;} + virtual void Rewind (void) + {m_cur = m_begin;} + private: + T m_begin; + T m_end; + T m_cur; + }; + delete m_iter; + m_iter = new Iterator (begin, end); +} + +template +void +ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +{ + if (path == "") + { + return; + } + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); + if (id == "*") + { + uint32_t j = 0; + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.Add (index); + Ptr obj = m_iter->Get (); + obj->TraceConnect (subpath, cb, tmp); + j++; + } + } +} +template +void +ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + if (path == "") + { + return; + } + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); + if (id == "*") + { + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + Ptr obj = m_iter->Get (); + obj->TraceDisconnect (subpath, cb); + } + } +} }//namespace ns3 From 62bf3d38debcec4096907bc1f0030f1190234377 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 16:26:25 +0200 Subject: [PATCH 014/218] rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks --- src/core/composite-trace-resolver.cc | 116 +++++++++++++---- src/core/composite-trace-resolver.h | 184 +++++++++++++++++---------- 2 files changed, 208 insertions(+), 92 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 83d63c29b..72a768e91 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -29,25 +29,68 @@ CompositeTraceResolver::CompositeTraceResolver () {} CompositeTraceResolver::~CompositeTraceResolver () -{} +{ + for (TraceItems::iterator i = m_items.begin (); i != m_items.end (); i++) + { + delete *i; + } + m_items.clear (); +} + +void +CompositeTraceResolver::AddItem (CompositeItem *item) +{ + m_items.push_back (item); +} void CompositeTraceResolver::Add (std::string name, Callback > createResolver) { - DoAdd (name, createResolver, TraceContext ()); + class MakerCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {maker ()->Connect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {maker ()->Disconnect (subpath, cb);} + + Callback > maker; + } *item = new MakerCompositeItem (); + item->name = name; + item->context = TraceContext (); + item->maker = createResolver; + AddItem (item); } void -CompositeTraceResolver::DoAdd (std::string name, - Callback > createResolver, - TraceContext const &context) +CompositeTraceResolver::AddChild (std::string name, Ptr child) { - struct CallbackTraceSourceItem item; - item.name = name; - item.createResolver = createResolver; - item.context = context; - m_items.push_back (item); + DoAddChild (name, child, TraceContext ()); +} +void +CompositeTraceResolver::DoAddChild (std::string name, Ptr child, const TraceContext &context) +{ + class ChildCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {child->TraceConnect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {child->TraceDisconnect (subpath, cb);} + + Ptr child; + } *item = new ChildCompositeItem (); + item->name = name; + item->context = context; + item->child = child; + AddItem (item); +} + +void +CompositeTraceResolver::SetParent (Ptr resolver) +{ + m_parent = resolver; } void @@ -57,10 +100,15 @@ CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const DoRecursiveOperation (path, cb, context, CONNECT); } void -CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase const &cb, +CompositeTraceResolver::DoRecursiveOperation (std::string path, + const CallbackBase &cb, const TraceContext &context, enum Operation op) { + if (path == "") + { + return; + } std::string id = GetElement (path); std::string subpath = GetSubpath (path); @@ -70,6 +118,7 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con { OperationOne (subpath, i, cb, context, op); } + DoRecursiveOperationForParent (path, cb, context, op); return; } std::string::size_type start, end; @@ -79,9 +128,10 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con { for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { - if (i->name == id) + if ((*i)->name == id) { OperationOne (subpath, i, cb, context, op); + DoRecursiveOperationForParent (path, cb, context, op); return; } } @@ -109,13 +159,34 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, CallbackBase con { for (TraceItems::const_iterator j = m_items.begin (); j != m_items.end (); j++) { - if (j->name == *i) + if ((*j)->name == *i) { OperationOne (subpath, j, cb, context, op); break; } } } + DoRecursiveOperationForParent (path, cb, context, op); +} + +void +CompositeTraceResolver::DoRecursiveOperationForParent (std::string path, + const CallbackBase &cb, + const TraceContext &context, + enum Operation op) +{ + if (m_parent == 0) + { + return; + } + switch (op) { + case CONNECT: + m_parent->Connect (path, cb, context); + break; + case DISCONNECT: + m_parent->Disconnect (path, cb); + break; + } } void @@ -125,16 +196,15 @@ CompositeTraceResolver::OperationOne (std::string subpath, const TraceContext &context, enum Operation op) { - Ptr resolver = i->createResolver (); switch (op) { case CONNECT: { - NS_DEBUG ("connect to path="< #include "callback.h" #include "ptr.h" #include "trace-resolver.h" @@ -28,7 +29,7 @@ #include "uv-trace-source.h" #include "sv-trace-source.h" #include "fv-trace-source.h" -#include "terminal-trace-resolver.h" +#include "array-trace-resolver.h" namespace ns3 { @@ -95,24 +96,6 @@ public: template void Add (std::string name, FVTraceSource &trace, T const &context); - - /** - * \param name name of child trace resolver - * \param createResolver a trace resolver constructor - * \param context the context associated to this entry - * - * Add a child trace resolver to this resolver. This child - * trace resolver will match the name specified during - * namespace resolution. When this happens, the constructor - * will be invoked to create the child trace resolver and - * the associated TraceContext will be automatically extended - * to contain the input context. - */ - template - void Add (std::string name, - Callback > createResolver, - T const &context); - /** * \param name name of child trace resolver * \param createResolver a trace resolver constructor @@ -124,71 +107,63 @@ public: */ void Add (std::string name, Callback > createResolver); + + void AddChild (std::string name, Ptr child); + + template + void AddChild (std::string name, Ptr child, const T &contextElement); + + template + void AddArray (std::string name, + ITERATOR begin, ITERATOR end, INDEX index); + + + void SetParent (Ptr parent); + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); private: - struct CallbackTraceSourceItem + class CompositeItem { + public: + virtual ~CompositeItem () {} + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) = 0; + virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; + std::string name; - Callback > createResolver; TraceContext context; }; - typedef std::list TraceItems; + typedef std::vector TraceItems; enum Operation { CONNECT, DISCONNECT }; - template - void DoAddTraceSource (std::string name, - SOURCE &traceSource, CONTEXT const &context); - template - static Ptr CreateTerminalTraceResolver (SOURCE *trace); - void DoAdd (std::string name, - Callback > createResolver, - TraceContext const &context); + void AddItem (CompositeItem *item); void OperationOne (std::string subpath, TraceItems::const_iterator i, const CallbackBase &cb, const TraceContext &context, enum Operation op); - void DoRecursiveOperation (std::string path, CallbackBase const &cb, + void DoRecursiveOperation (std::string path, + const CallbackBase &cb, const TraceContext &context, enum Operation op); + void DoRecursiveOperationForParent (std::string path, + const CallbackBase &cb, + const TraceContext &context, + enum Operation op); + void DoAddChild (std::string name, Ptr child, const TraceContext &context); - - - TraceItems m_items; + CompositeTraceResolver::TraceItems m_items; + Ptr m_parent; }; }//namespace ns3 namespace ns3 { -template -void -CompositeTraceResolver::DoAddTraceSource (std::string name, - SOURCE &traceSource, CONTEXT const &context) -{ - Ptr (*create) (SOURCE *trace); - create = &CompositeTraceResolver::CreateTerminalTraceResolver; - Callback > createResolver = - MakeBoundCallback (create, &traceSource); - - TraceContext ctx; - ctx.Add (context); - DoAdd (name, createResolver, ctx); -} - -template -Ptr -CompositeTraceResolver::CreateTerminalTraceResolver (SOURCE *traceSource) -{ - return Create > (traceSource); -} - - template &trace, T const &context) { - DoAddTraceSource (name, trace, context); + class CallbackCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + CallbackTraceSource *trace; + } *item = new CallbackCompositeItem (); + item->name = name; + item->context.Add (context); + item->trace = &trace; + AddItem (item); } template void CompositeTraceResolver::Add (std::string name, SVTraceSource &trace, T const &context) { - DoAddTraceSource (name, trace, context); + class SVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + SVTraceSource *trace; + } *item = new SVCompositeItem (); + item->name = name; + item->context.Add (context); + item->trace = &trace; + AddItem (item); } template void CompositeTraceResolver::Add (std::string name, UVTraceSource &trace, T const &context) { - DoAddTraceSource (name, trace, context); + class UVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + UVTraceSource *trace; + } *item = new UVCompositeItem (); + item->name = name; + item->context.Add (context); + item->trace = &trace; + AddItem (item); } template void CompositeTraceResolver::Add (std::string name, FVTraceSource &trace, T const &context) { - DoAddTraceSource (name, trace, context); + class FVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + FVTraceSource *trace; + } *item = new FVCompositeItem (); + item->name = name; + item->context.Add (context); + item->trace = &trace; + AddItem (item); } + +template +void +CompositeTraceResolver::AddArray (std::string name, + ITERATOR begin, ITERATOR end, INDEX index) +{ + class ArrayCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {array->Connect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {array->Disconnect (subpath, cb);} + + Ptr > array; + } *item = new ArrayCompositeItem (); + item->name = name; + item->context = TraceContext (); + item->array = Create > (); + item->array->SetIterators (begin, end); + AddItem (item); +} + template void -CompositeTraceResolver::Add (std::string name, - Callback > createResolver, - T const &context) +CompositeTraceResolver::AddChild (std::string name, Ptr child, const T &contextElement) { - TraceContext ctx; - ctx.Add (context); - DoAdd (name, createResolver, ctx); + TraceContext context; + context.Add (contextElement); + DoAddChild (name, child, context); } + + }//namespace ns3 #endif /* COMPOSITE_TRACE_RESOLVER_H */ From 79d5c077ac0ae25511128af60aca592ae03a61ce Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 16:26:53 +0200 Subject: [PATCH 015/218] the TerminalTraceResolver is not used anymore by the CompositeTraceResolver implementation --- src/core/terminal-trace-resolver.h | 72 ------------------------------ src/core/wscript | 1 - 2 files changed, 73 deletions(-) delete mode 100644 src/core/terminal-trace-resolver.h diff --git a/src/core/terminal-trace-resolver.h b/src/core/terminal-trace-resolver.h deleted file mode 100644 index 42ee7fc2d..000000000 --- a/src/core/terminal-trace-resolver.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- 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 - * - * Author: Mathieu Lacage - */ -#ifndef TERMINAL_TRACE_RESOLVER_H -#define TERMINAL_TRACE_RESOLVER_H - -#include "trace-resolver.h" -#include "assert.h" - -namespace ns3 { - -class TraceContext; - -template -class TerminalTraceResolver : public TraceResolver -{ - public: - TerminalTraceResolver (T *traceSource); - - virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); - virtual void Disconnect (std::string path, CallbackBase const &cb); - private: - T *m_traceSource; -}; - -}//namespace ns3 - -namespace ns3 { - -template -TerminalTraceResolver::TerminalTraceResolver (T *traceSource) - : m_traceSource (traceSource) -{} -template -void -TerminalTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) -{ - if (path == "") - { - m_traceSource->AddCallback (cb, context); - } -} -template -void -TerminalTraceResolver::Disconnect (std::string path, CallbackBase const &cb) -{ - if (path == "") - { - m_traceSource->RemoveCallback (cb); - } -} - -}//namespace ns3 - -#endif /* TERMINAL_TRACE_RESOLVER_H */ diff --git a/src/core/wscript b/src/core/wscript index c9b13f4ac..7a9e8171a 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -92,6 +92,5 @@ def build(bld): 'composite-trace-resolver.h', 'array-trace-resolver.h', 'trace-root.h', - 'terminal-trace-resolver.h', ] From 81ac231de4dce16e77d8f3c1c907f9b81ce3c7c2 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 16:27:42 +0200 Subject: [PATCH 016/218] remove const keyword and add a TraceConnect method which takes a TraceContext argument --- src/core/object.cc | 9 +++++++-- src/core/object.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index 8e2ada60a..440bd0f31 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -167,7 +167,12 @@ Object::AddInterface (Ptr o) void Object::TraceConnect (std::string path, const CallbackBase &cb) { - GetTraceResolver ()->Connect (path, cb, TraceContext ()); + TraceConnect (path, cb, TraceContext ()); +} +void +Object::TraceConnect (std::string path, const CallbackBase &cb, const TraceContext &context) +{ + GetTraceResolver ()->Connect (path, cb, context); } void Object::TraceDisconnect (std::string path, const CallbackBase &cb) @@ -190,7 +195,7 @@ Object::DoDispose (void) } Ptr -Object::GetTraceResolver (void) const +Object::GetTraceResolver (void) { return Create (); } diff --git a/src/core/object.h b/src/core/object.h index 355d196ee..1b0825381 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -28,6 +28,7 @@ namespace ns3 { class TraceResolver; +class TraceContext; class CallbackBase; /** @@ -137,6 +138,7 @@ public: void TraceConnect (std::string path, const CallbackBase &cb); + void TraceConnect (std::string path, const CallbackBase &cb, const TraceContext &context); void TraceDisconnect (std::string path, const CallbackBase &cb); protected: /** @@ -154,7 +156,7 @@ protected: */ virtual void DoDispose (void); - virtual Ptr GetTraceResolver (void) const; + virtual Ptr GetTraceResolver (void); private: Ptr DoQueryInterface (InterfaceId iid) const; bool Check (void) const; From e11c1343b3a568af565b1440456817abf690674f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 16:28:29 +0200 Subject: [PATCH 017/218] use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code --- src/devices/csma-cd/csma-cd-net-device.cc | 9 ++- src/devices/csma-cd/csma-cd-net-device.h | 13 ++-- .../point-to-point-net-device.cc | 6 +- .../point-to-point-net-device.h | 12 ++-- src/internet-node/arp-cache.cc | 6 +- src/internet-node/arp-cache.h | 6 +- src/internet-node/arp-ipv4-interface.cc | 7 +- src/internet-node/arp-ipv4-interface.h | 5 +- src/internet-node/arp-l3-protocol.cc | 8 +-- src/internet-node/arp-l3-protocol.h | 2 - src/internet-node/internet-node.cc | 11 ++-- src/internet-node/internet-node.h | 2 +- src/internet-node/ipv4-interface.cc | 13 ++-- src/internet-node/ipv4-interface.h | 21 ++---- src/internet-node/ipv4-l3-protocol.cc | 66 ++++++++----------- src/internet-node/ipv4-l3-protocol.h | 25 +++---- src/internet-node/ipv4-l4-demux.cc | 7 +- src/internet-node/ipv4-l4-demux.h | 12 +--- src/internet-node/ipv4-l4-protocol.h | 6 -- src/internet-node/ipv4-loopback-interface.cc | 7 -- src/internet-node/ipv4-loopback-interface.h | 1 - src/internet-node/udp-l4-protocol.cc | 6 -- src/internet-node/udp-l4-protocol.h | 1 - src/node/net-device.cc | 6 -- src/node/net-device.h | 17 ----- src/node/node-list.cc | 17 +++-- src/node/node-list.h | 2 +- src/node/node.cc | 24 +------ src/node/node.h | 23 +------ src/node/queue.cc | 3 +- src/node/queue.h | 3 +- 31 files changed, 109 insertions(+), 238 deletions(-) diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index e587bb089..fe5c0ba26 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -450,19 +450,18 @@ CsmaCdNetDevice::TransmitReadyEvent (void) } Ptr -CsmaCdNetDevice::DoCreateTraceResolver (void) +CsmaCdNetDevice::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->Add ("queue", - MakeCallback (&Queue::CreateTraceResolver, - PeekPointer (m_queue))); + resolver->AddChild ("queue", m_queue); resolver->Add ("rx", m_rxTrace, CsmaCdTraceType (CsmaCdTraceType::RX)); resolver->Add ("drop", m_dropTrace, CsmaCdTraceType (CsmaCdTraceType::DROP)); - return resolver; + resolver->SetParent (NetDevice::GetTraceResolver ()); + return resolver; } bool diff --git a/src/devices/csma-cd/csma-cd-net-device.h b/src/devices/csma-cd/csma-cd-net-device.h index 42b85f3b5..5de056109 100644 --- a/src/devices/csma-cd/csma-cd-net-device.h +++ b/src/devices/csma-cd/csma-cd-net-device.h @@ -191,6 +191,13 @@ enum CsmaCdEncapsulationMode { protected: virtual bool DoNeedsArp (void) const; virtual void DoDispose (void); + /** + * Create a Trace Resolver for events in the net device. + * (NOT TESTED) + * @see class TraceResolver + */ + virtual Ptr GetTraceResolver (void); + /** * Get a copy of the attached Queue. * @@ -306,12 +313,6 @@ private: * @see TransmitStart () */ void TransmitReadyEvent (void); - /** - * Create a Trace Resolver for events in the net device. - * (NOT TESTED) - * @see class TraceResolver - */ - virtual Ptr DoCreateTraceResolver (void); /** * Aborts the transmission of the current packet diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 5275b6209..633fbe5c6 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -189,14 +189,14 @@ void PointToPointNetDevice::TransmitComplete (void) } Ptr -PointToPointNetDevice::DoCreateTraceResolver (void) +PointToPointNetDevice::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->Add ("queue", - MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); + resolver->AddChild ("queue", m_queue); resolver->Add ("rx", m_rxTrace, PointToPointTraceType ()); + resolver->SetParent (NetDevice::GetTraceResolver ()); return resolver; } diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 3a1bc1e0e..5cee2cf70 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -152,6 +152,12 @@ public: */ void Receive (Packet& p); protected: + /** + * Create a Trace Resolver for events in the net device. + * + * @see class TraceResolver + */ + virtual Ptr GetTraceResolver (void); virtual void DoDispose (void); /** * Get a copy of the attached Queue. @@ -238,12 +244,6 @@ private: * */ void TransmitComplete(void); - /** - * Create a Trace Resolver for events in the net device. - * - * @see class TraceResolver - */ - virtual Ptr DoCreateTraceResolver (void); virtual bool DoNeedsArp (void) const; /** * Enumeration of the states of the transmit machine of the net device. diff --git a/src/internet-node/arp-cache.cc b/src/internet-node/arp-cache.cc index b4987daef..15a1d9316 100644 --- a/src/internet-node/arp-cache.cc +++ b/src/internet-node/arp-cache.cc @@ -19,16 +19,16 @@ * Author: Mathieu Lacage */ #include "ns3/assert.h" - #include "ns3/packet.h" #include "ns3/simulator.h" #include "arp-cache.h" #include "arp-header.h" +#include "ipv4-interface.h" namespace ns3 { -ArpCache::ArpCache (Ptr device, Ipv4Interface *interface) +ArpCache::ArpCache (Ptr device, Ptr interface) : m_device (device), m_interface (interface), m_aliveTimeout (Seconds (120)), @@ -47,7 +47,7 @@ ArpCache::GetDevice (void) const return m_device; } -Ipv4Interface * +Ptr ArpCache::GetInterface (void) const { return m_interface; diff --git a/src/internet-node/arp-cache.h b/src/internet-node/arp-cache.h index 2cd88c85f..adf106009 100644 --- a/src/internet-node/arp-cache.h +++ b/src/internet-node/arp-cache.h @@ -48,7 +48,7 @@ public: * \param device The hardware NetDevice associated with this ARP chache * \param interface the Ipv4Interface associated with this ARP chache */ - ArpCache (Ptr device, Ipv4Interface *interface); + ArpCache (Ptr device, Ptr interface); ~ArpCache (); /** * \return The NetDevice that this ARP cache is associated with @@ -57,7 +57,7 @@ public: /** * \return the Ipv4Interface that this ARP cache is associated with */ - Ipv4Interface *GetInterface (void) const; + Ptr GetInterface (void) const; void SetAliveTimeout (Time aliveTimeout); void SetDeadTimeout (Time deadTimeout); @@ -152,7 +152,7 @@ private: typedef sgi::hash_map::iterator CacheI; Ptr m_device; - Ipv4Interface *m_interface; + Ptr m_interface; Time m_aliveTimeout; Time m_deadTimeout; Time m_waitReplyTimeout; diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 3c353efe6..2648c5ec4 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -41,15 +41,14 @@ ArpIpv4Interface::~ArpIpv4Interface () {} Ptr -ArpIpv4Interface::DoCreateTraceResolver (void) +ArpIpv4Interface::GetTraceResolver (void) { Ptr resolver = Create (); if (GetDevice () != 0) { - resolver->Add ("netdevice", - MakeCallback (&NetDevice::CreateTraceResolver, PeekPointer (GetDevice ()))); + resolver->AddChild ("netdevice", GetDevice ()); } - + resolver->SetParent (Ipv4Interface::GetTraceResolver ()); return resolver; } diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index a31039478..73bf4f462 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -42,9 +42,10 @@ class ArpIpv4Interface : public Ipv4Interface ArpIpv4Interface (Ptr node, Ptr device); virtual ~ArpIpv4Interface (); - private: +protected: + virtual Ptr GetTraceResolver (void); +private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual Ptr DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index b116ce648..b4d346e60 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -58,12 +58,6 @@ ArpL3Protocol::DoDispose (void) Object::DoDispose (); } -Ptr -ArpL3Protocol::CreateTraceResolver (void) -{ - return Create (); -} - ArpCache * ArpL3Protocol::FindCache (Ptr device) { @@ -75,7 +69,7 @@ ArpL3Protocol::FindCache (Ptr device) } } Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); - Ipv4Interface *interface = ipv4->FindInterfaceForDevice (device); + Ptr interface = ipv4->FindInterfaceForDevice (device); ArpCache * cache = new ArpCache (device, interface); NS_ASSERT (device->IsBroadcast ()); device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache)); diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index 468c301b6..5f6819df6 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -48,8 +48,6 @@ public: */ ArpL3Protocol (Ptr node); virtual ~ArpL3Protocol (); - - virtual Ptr CreateTraceResolver (void); /** * \brief Recieve a packet */ diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 5c2a3de72..7bc9cd3c8 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -74,13 +74,14 @@ InternetNode::Construct (void) Object::AddInterface (ipv4L4Demux); } -void -InternetNode::DoFillTraceResolver (CompositeTraceResolver &resolver) +Ptr +InternetNode::GetTraceResolver () { - Node::DoFillTraceResolver (resolver); + Ptr resolver = Create (); Ptr ipv4 = QueryInterface (Ipv4L3Protocol::iid); - resolver.Add ("ipv4", - MakeCallback (&Ipv4L3Protocol::CreateTraceResolver, PeekPointer (ipv4))); + resolver->AddChild ("ipv4", ipv4); + resolver->SetParent (Node::GetTraceResolver ()); + return resolver; } void diff --git a/src/internet-node/internet-node.h b/src/internet-node/internet-node.h index deabd20eb..d54714a8b 100644 --- a/src/internet-node/internet-node.h +++ b/src/internet-node/internet-node.h @@ -42,8 +42,8 @@ public: protected: virtual void DoDispose(void); + virtual Ptr GetTraceResolver (void); private: - virtual void DoFillTraceResolver (CompositeTraceResolver &resolver); bool ReceiveFromDevice (Ptr device, const Packet &p, uint16_t protocolNumber) const; void Construct (void); }; diff --git a/src/internet-node/ipv4-interface.cc b/src/internet-node/ipv4-interface.cc index 699d6109d..3ea9120d2 100644 --- a/src/internet-node/ipv4-interface.cc +++ b/src/internet-node/ipv4-interface.cc @@ -40,18 +40,19 @@ Ipv4Interface::Ipv4Interface (Ptr nd) Ipv4Interface::~Ipv4Interface () {} +void +Ipv4Interface::DoDispose (void) +{ + m_netdevice = 0; + Object::DoDispose (); +} + Ptr Ipv4Interface::GetDevice (void) const { return m_netdevice; } -Ptr -Ipv4Interface::CreateTraceResolver (void) -{ - return DoCreateTraceResolver (); -} - void Ipv4Interface::SetAddress (Ipv4Address a) { diff --git a/src/internet-node/ipv4-interface.h b/src/internet-node/ipv4-interface.h index a462d5be5..1836aa3b7 100644 --- a/src/internet-node/ipv4-interface.h +++ b/src/internet-node/ipv4-interface.h @@ -26,6 +26,7 @@ #include #include "ns3/ipv4-address.h" #include "ns3/ptr.h" +#include "ns3/object.h" namespace ns3 { @@ -60,9 +61,8 @@ class TraceContext; * * Subclasses must implement the two methods: * - Ipv4Interface::SendTo - * - Ipv4Interface::DoCreateTraceResolver */ -class Ipv4Interface +class Ipv4Interface : public Object { public: /** @@ -73,17 +73,6 @@ public: Ipv4Interface (Ptr nd); virtual ~Ipv4Interface(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - * - * This method will delegate the work to the private DoCreateTraceResolver - * method which is supposed to be implemented by subclasses. - */ - Ptr CreateTraceResolver (void); /** * \returns the underlying NetDevice. This method can return * zero if this interface has no associated NetDevice. @@ -150,10 +139,10 @@ public: */ void Send(Packet p, Ipv4Address dest); - - private: +protected: + virtual void DoDispose (void); +private: virtual void SendTo (Packet p, Ipv4Address dest) = 0; - virtual Ptr DoCreateTraceResolver (void) = 0; Ptr m_netdevice; bool m_ifup; Ipv4Address m_address; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index df97fafc0..75320e886 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -22,7 +22,6 @@ #include "ns3/packet.h" #include "ns3/debug.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/array-trace-resolver.h" #include "ns3/callback.h" #include "ns3/ipv4-address.h" #include "ns3/ipv4-route.h" @@ -90,26 +89,26 @@ Ipv4L3ProtocolTraceContextElement::GetUid (void) } -Ipv4l3ProtocolInterfaceIndex::Ipv4l3ProtocolInterfaceIndex () +Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex () : m_index (0) {} -Ipv4l3ProtocolInterfaceIndex::Ipv4l3ProtocolInterfaceIndex (uint32_t index) +Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex (uint32_t index) : m_index (index) {} uint32_t -Ipv4l3ProtocolInterfaceIndex::Get (void) const +Ipv4L3ProtocolInterfaceIndex::Get (void) const { return m_index; } void -Ipv4l3ProtocolInterfaceIndex::Print (std::ostream &os) const +Ipv4L3ProtocolInterfaceIndex::Print (std::ostream &os) const { os << "ipv4-interface=" << m_index; } uint16_t -Ipv4l3ProtocolInterfaceIndex::GetUid (void) +Ipv4L3ProtocolInterfaceIndex::GetUid (void) { - static uint16_t uid = AllocateUid ("Ipv4l3ProtocolInterfaceIndex"); + static uint16_t uid = AllocateUid ("Ipv4L3ProtocolInterfaceIndex"); return uid; } @@ -131,10 +130,6 @@ Ipv4L3Protocol::~Ipv4L3Protocol () void Ipv4L3Protocol::DoDispose (void) { - for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) - { - delete (*i); - } m_interfaces.clear (); m_node = 0; m_staticRouting->Dispose (); @@ -145,7 +140,7 @@ Ipv4L3Protocol::DoDispose (void) void Ipv4L3Protocol::SetupLoopback (void) { - Ipv4LoopbackInterface * interface = new Ipv4LoopbackInterface (m_node); + Ptr interface = Create (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); uint32_t index = AddIpv4Interface (interface); @@ -154,24 +149,15 @@ Ipv4L3Protocol::SetupLoopback (void) } Ptr -Ipv4L3Protocol::CreateTraceResolver (void) +Ipv4L3Protocol::GetTraceResolver (void) { Ptr resolver = Create (); resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); resolver->Add ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); - resolver->Add ("interfaces", - MakeCallback (&Ipv4L3Protocol::InterfacesCreateTraceResolver, this)); - return resolver; -} - -Ptr -Ipv4L3Protocol::InterfacesCreateTraceResolver (void) const -{ - Ptr >resolver = - Create > - (MakeCallback (&Ipv4L3Protocol::GetNInterfaces, this), - MakeCallback (&Ipv4L3Protocol::GetInterface, this)); + resolver->AddArray ("interfaces", + m_interfaces.begin (), m_interfaces.end (), + Ipv4L3ProtocolInterfaceIndex ()); return resolver; } @@ -264,18 +250,18 @@ Ipv4L3Protocol::RemoveRoute (uint32_t index) uint32_t Ipv4L3Protocol::AddInterface (Ptr device) { - Ipv4Interface *interface = new ArpIpv4Interface (m_node, device); + Ptr interface = Create (m_node, device); return AddIpv4Interface (interface); } uint32_t -Ipv4L3Protocol::AddIpv4Interface (Ipv4Interface *interface) +Ipv4L3Protocol::AddIpv4Interface (Ptrinterface) { uint32_t index = m_nInterfaces; m_interfaces.push_back (interface); m_nInterfaces++; return index; } -Ipv4Interface * +Ptr Ipv4L3Protocol::GetInterface (uint32_t index) const { uint32_t tmp = 0; @@ -295,7 +281,7 @@ Ipv4L3Protocol::GetNInterfaces (void) const return m_nInterfaces; } -Ipv4Interface * +Ptr Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) { for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -363,7 +349,7 @@ Ipv4L3Protocol::Send (Packet const &packet, for (Ipv4InterfaceList::iterator ifaceIter = m_interfaces.begin (); ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++) { - Ipv4Interface *outInterface = *ifaceIter; + Ptr outInterface = *ifaceIter; Packet packetCopy = packet; NS_ASSERT (packetCopy.GetSize () <= outInterface->GetMtu ()); @@ -400,7 +386,7 @@ Ipv4L3Protocol::SendRealOut (bool found, return; } packet.AddHeader (ipHeader); - Ipv4Interface *outInterface = GetInterface (route.GetInterface ()); + Ptr outInterface = GetInterface (route.GetInterface ()); NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); m_txTrace (packet, route.GetInterface ()); if (route.IsGateway ()) @@ -430,7 +416,7 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr interface = *i; if (interface->GetDevice () == device) { if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ())) @@ -480,43 +466,43 @@ Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) void Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); interface->SetAddress (address); } void Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); interface->SetNetworkMask (mask); } Ipv4Mask Ipv4L3Protocol::GetNetworkMask (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); return interface->GetNetworkMask (); } Ipv4Address Ipv4L3Protocol::GetAddress (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); return interface->GetAddress (); } uint16_t Ipv4L3Protocol::GetMtu (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); return interface->GetMtu (); } bool Ipv4L3Protocol::IsUp (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); return interface->IsUp (); } void Ipv4L3Protocol::SetUp (uint32_t i) { - Ipv4Interface *interface = GetInterface (i); + Ptr interface = GetInterface (i); interface->SetUp (); // If interface address and network mask have been set, add a route @@ -532,7 +518,7 @@ Ipv4L3Protocol::SetUp (uint32_t i) void Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) { - Ipv4Interface *interface = GetInterface (ifaceIndex); + Ptr interface = GetInterface (ifaceIndex); interface->SetDown (); // Remove all routes that are going through this interface diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index f6fcec7a7..0866861c0 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -63,11 +63,11 @@ private: enum Type m_type; }; -class Ipv4l3ProtocolInterfaceIndex : public TraceContextElement +class Ipv4L3ProtocolInterfaceIndex : public TraceContextElement { public: - Ipv4l3ProtocolInterfaceIndex (); - Ipv4l3ProtocolInterfaceIndex (uint32_t index); + Ipv4L3ProtocolInterfaceIndex (); + Ipv4L3ProtocolInterfaceIndex (uint32_t index); uint32_t Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); @@ -85,15 +85,6 @@ public: Ipv4L3Protocol(Ptr node); virtual ~Ipv4L3Protocol (); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - virtual Ptr CreateTraceResolver (void); - /** * \param ttl default ttl to use * @@ -109,7 +100,7 @@ public: * Try to find an Ipv4Interface whose NetDevice is equal to * the input NetDevice. */ - Ipv4Interface *FindInterfaceForDevice (Ptr device); + Ptr FindInterfaceForDevice (Ptr device); /** * Lower layer calls this method after calling L3Demux::Lookup @@ -159,7 +150,7 @@ public: void RemoveRoute (uint32_t i); uint32_t AddInterface (Ptr device); - Ipv4Interface * GetInterface (uint32_t i) const; + Ptr GetInterface (uint32_t i) const; uint32_t GetNInterfaces (void) const; @@ -178,6 +169,7 @@ public: protected: virtual void DoDispose (void); + virtual Ptr GetTraceResolver (void); private: @@ -187,11 +179,10 @@ private: Ipv4Header const &ipHeader); bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); void ForwardUp (Packet p, Ipv4Header const&ip); - uint32_t AddIpv4Interface (Ipv4Interface *interface); + uint32_t AddIpv4Interface (Ptr interface); void SetupLoopback (void); - Ptr InterfacesCreateTraceResolver (void) const; - typedef std::list Ipv4InterfaceList; + typedef std::list > Ipv4InterfaceList; typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; Ipv4InterfaceList m_interfaces; diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 56ee9eb9a..74ee536b5 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -79,7 +79,7 @@ Ipv4L4Demux::DoDispose (void) } Ptr -Ipv4L4Demux::CreateTraceResolver (void) +Ipv4L4Demux::GetTraceResolver (void) { Ptr resolver = Create (); for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) @@ -89,10 +89,9 @@ Ipv4L4Demux::CreateTraceResolver (void) std::ostringstream oss (protValue); oss << (*i)->GetProtocolNumber (); Ipv4L4ProtocolTraceContextElement protocolNumber = (*i)->GetProtocolNumber (); - resolver->Add (protValue, - MakeCallback (&Ipv4L4Protocol::CreateTraceResolver, PeekPointer (protocol)), - protocolNumber); + resolver->AddChild (protValue, protocol, protocolNumber); } + resolver->SetParent (Object::GetTraceResolver ()); return resolver; } void diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 0b4755435..4700ec697 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -59,14 +59,6 @@ public: Ipv4L4Demux (Ptr node); virtual ~Ipv4L4Demux(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - Ptr CreateTraceResolver (void); /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. @@ -95,8 +87,10 @@ public: * returned from the Ipv4L4Protocol::Insert method. */ void Remove (Ptr protocol); -private: +protected: + Ptr GetTraceResolver (void); virtual void DoDispose (void); +private: typedef std::list > L4List_t; L4List_t m_protocols; Ptr m_node; diff --git a/src/internet-node/ipv4-l4-protocol.h b/src/internet-node/ipv4-l4-protocol.h index c658318a1..e54dfcc97 100644 --- a/src/internet-node/ipv4-l4-protocol.h +++ b/src/internet-node/ipv4-l4-protocol.h @@ -37,10 +37,6 @@ class TraceContext; /** * \brief L4 Protocol base class * - * All subclasses must implement: - * - Ipv4L4Protocol::Copy - * - Ipv4L4Protocol::CreateTraceResolver - * * If you want to implement a new L4 protocol, all you have to do is * implement a subclass of this base class and add it to an L4Demux. */ @@ -59,8 +55,6 @@ public: */ int GetVersion() const; - virtual Ptr CreateTraceResolver () = 0; - /** * \param p packet to forward up * \param source source address of packet received diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 1364e2daf..307533d6e 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -33,13 +33,6 @@ Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) {} Ipv4LoopbackInterface::~Ipv4LoopbackInterface () {} - -Ptr -Ipv4LoopbackInterface::DoCreateTraceResolver (void) -{ - return Create (); -} - void Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) { diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index e9df32007..8e33f81d7 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -43,7 +43,6 @@ class Ipv4LoopbackInterface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual Ptr DoCreateTraceResolver (void); Ptr m_node; }; diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index 13e937d3c..d9b5afe23 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -45,12 +45,6 @@ UdpL4Protocol::UdpL4Protocol (Ptr node) UdpL4Protocol::~UdpL4Protocol () {} -Ptr -UdpL4Protocol::CreateTraceResolver (void) -{ - return Create (); -} - void UdpL4Protocol::DoDispose (void) { diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index da2cd0e2d..46fe62761 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -49,7 +49,6 @@ public: UdpL4Protocol (Ptr node); virtual ~UdpL4Protocol (); - virtual Ptr CreateTraceResolver (void); /** * \return A smart Socket pointer to a UdpSocket, allocated by this instance * of the UDP protocol diff --git a/src/node/net-device.cc b/src/node/net-device.cc index cdc1f63f3..8ec8b0992 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -184,12 +184,6 @@ NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber) } } -Ptr -NetDevice::CreateTraceResolver (void) -{ - return DoCreateTraceResolver (); -} - Ptr NetDevice::GetChannel (void) const { diff --git a/src/node/net-device.h b/src/node/net-device.h index af63be5b4..7516345d8 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -62,14 +62,6 @@ public: static const InterfaceId iid; virtual ~NetDevice(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - Ptr CreateTraceResolver (void); /** * \return the channel this NetDevice is connected to. The value @@ -282,15 +274,6 @@ public: * Subclasses must implement this method. */ virtual bool DoNeedsArp (void) const = 0; - /** - * \param context the trace context to associated to the - * trace resolver. - * \returns a trace resolver associated to the input context. - * the caller takes ownership of the pointer returned. - * - * Subclasses must implement this method. - */ - virtual Ptr DoCreateTraceResolver (void) = 0; /** * \returns the channel associated to this NetDevice. * diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 823b92a0c..1b74dbe86 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -33,7 +33,7 @@ static class Initialization public: Initialization () { - ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::CreateTraceResolver)); + ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::GetTraceResolver)); } } g_initialization; } @@ -76,7 +76,7 @@ public: uint32_t Add (Ptr node); NodeList::Iterator Begin (void); NodeList::Iterator End (void); - Ptr CreateTraceResolver (void); + Ptr GetTraceResolver (void); Ptr GetNode (uint32_t n); uint32_t GetNNodes (void); @@ -131,12 +131,11 @@ NodeListPriv::GetNode (uint32_t n) Ptr -NodeListPriv::CreateTraceResolver (void) +NodeListPriv::GetTraceResolver (void) { - Ptr, NodeListIndex> >resolver = - Create, NodeListIndex> > - (MakeCallback (&NodeListPriv::GetNNodes, this), - MakeCallback (&NodeListPriv::GetNode, this)); + Ptr >resolver = + Create > (); + resolver->SetIterators (Begin (), End ()); return resolver; } @@ -165,9 +164,9 @@ NodeList::End (void) return SimulationSingleton::Get ()->End (); } Ptr -NodeList::CreateTraceResolver (void) +NodeList::GetTraceResolver (void) { - return SimulationSingleton::Get ()->CreateTraceResolver (); + return SimulationSingleton::Get ()->GetTraceResolver (); } Ptr NodeList::GetNode (uint32_t n) diff --git a/src/node/node-list.h b/src/node/node-list.h index 66cd6965d..8af457b88 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -79,7 +79,7 @@ public: * \returns the requested trace resolver. The caller * takes ownership of the returned pointer. */ - static Ptr CreateTraceResolver (void); + static Ptr GetTraceResolver (void); /** * \param n index of requested node. diff --git a/src/node/node.cc b/src/node/node.cc index 554431db1..031ed34ab 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -25,7 +25,6 @@ #include "packet-socket-factory.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/array-trace-resolver.h" namespace ns3{ @@ -83,10 +82,11 @@ Node::~Node () {} Ptr -Node::CreateTraceResolver (void) +Node::GetTraceResolver (void) { Ptr resolver = Create (); - DoFillTraceResolver (*PeekPointer (resolver)); + resolver->AddArray ("devices", m_devices.begin (), m_devices.end (), NodeNetDeviceIndex ()); + resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -141,24 +141,6 @@ Node::GetNApplications (void) const return m_applications.size (); } -Ptr -Node::CreateDevicesTraceResolver (void) -{ - Ptr,NodeNetDeviceIndex> >resolver = - Create,NodeNetDeviceIndex> > - (MakeCallback (&Node::GetNDevices, this), - MakeCallback (&Node::GetDevice, this)); - - return resolver; -} - -void -Node::DoFillTraceResolver (CompositeTraceResolver &resolver) -{ - resolver.Add ("devices", - MakeCallback (&Node::CreateDevicesTraceResolver, this)); -} - void Node::DoDispose() { diff --git a/src/node/node.h b/src/node/node.h index 7931dd001..0066bf319 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -84,16 +84,6 @@ public: virtual ~Node(); - /** - * \returns a newly-created TraceResolver. The caller takes - * ownership of the returned pointer. - * - * Request the Node to create a trace resolver. This method - * could be used directly by a user who needs access to very low-level - * trace configuration. - */ - Ptr CreateTraceResolver (void); - /** * \returns the unique id of this node. * @@ -182,23 +172,15 @@ public: void UnregisterProtocolHandler (ProtocolHandler handler); protected: + virtual Ptr GetTraceResolver (void); /** * The dispose method. Subclasses must override this method * and must chain up to it by calling Node::DoDispose at the * end of their own DoDispose method. */ virtual void DoDispose (void); - /** - * \param resolver the resolver to store trace sources in. - * - * If a subclass wants to add new traces to a Node, it needs - * to override this method and record the new trace sources - * in the input resolver. Subclasses also _must_ chain up to - * their parent's DoFillTraceResolver method prior - * to recording they own trace sources. - */ - virtual void DoFillTraceResolver (CompositeTraceResolver &resolver); private: + /** * \param device the device added to this Node. * @@ -212,7 +194,6 @@ private: bool ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); void Construct (void); - Ptr CreateDevicesTraceResolver (void); struct ProtocolHandlerEntry { ProtocolHandler handler; diff --git a/src/node/queue.cc b/src/node/queue.cc index 8a6725e4e..78ad9369c 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -95,12 +95,13 @@ Queue::~Queue() } Ptr -Queue::CreateTraceResolver (void) +Queue::GetTraceResolver (void) { Ptr resolver = Create (); resolver->Add ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); resolver->Add ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); resolver->Add ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); + resolver->SetParent (Object::GetTraceResolver ()); return resolver; } diff --git a/src/node/queue.h b/src/node/queue.h index bf2c6a2d6..c10795c67 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -69,8 +69,6 @@ public: Queue (); virtual ~Queue (); - - Ptr CreateTraceResolver (void); /** * \return true if the queue is empty; false otherwise @@ -167,6 +165,7 @@ private: virtual bool DoPeek (Packet &p) = 0; protected: + Ptr GetTraceResolver (void); // called by subclasses to notify parent of packet drops. void Drop (const Packet& p); From dab62fcabf1303c0315455727532a6bbf76d3a5d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 17:59:56 +0200 Subject: [PATCH 018/218] constify --- src/core/callback.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/callback.h b/src/core/callback.h index 94e58ca92..c5d3cf442 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -306,11 +306,11 @@ public: return (*(PeekImpl ())) (a1,a2,a3,a4,a5); } - bool IsEqual (CallbackBase const &other) { + bool IsEqual (CallbackBase const &other) const { return PeekImpl ()->IsEqual (other.PeekImpl ()); } - bool CheckType (CallbackBase const& other) { + bool CheckType (CallbackBase const& other) const { CallbackImplBase *otherBase = other.PeekImpl (); if (dynamic_cast *> (otherBase) != 0) { From ee1ec26f39a46c69d3d8cd909824470573bf6826 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:00:15 +0200 Subject: [PATCH 019/218] constify --- src/core/callback-trace-source.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index 6282467f9..7de77c56a 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -44,11 +44,11 @@ public: CallbackTraceSource (); void AddCallback (CallbackBase const & callback, TraceContext const & context); void RemoveCallback (CallbackBase const & callback); - void operator() (void); - void operator() (T1 a1); - void operator() (T1 a1, T2 a2); - void operator() (T1 a1, T2 a2, T3 a3); - void operator() (T1 a1, T2 a2, T3 a3, T4 a4); + void operator() (void) const; + void operator() (T1 a1) const; + void operator() (T1 a1, T2 a2) const; + void operator() (T1 a1, T2 a2, T3 a3) const; + void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const; private: typedef std::list > CallbackList; @@ -99,9 +99,9 @@ CallbackTraceSource::RemoveCallback (CallbackBase const & callback) template void -CallbackTraceSource::operator() (void) +CallbackTraceSource::operator() (void) const { - for (typename CallbackList::iterator i = m_callbackList.begin (); + for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { (*i) (m_context); @@ -110,9 +110,9 @@ CallbackTraceSource::operator() (void) template void -CallbackTraceSource::operator() (T1 a1) +CallbackTraceSource::operator() (T1 a1) const { - for (typename CallbackList::iterator i = m_callbackList.begin (); + for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { (*i) (m_context, a1); @@ -121,9 +121,9 @@ CallbackTraceSource::operator() (T1 a1) template void -CallbackTraceSource::operator() (T1 a1, T2 a2) +CallbackTraceSource::operator() (T1 a1, T2 a2) const { - for (typename CallbackList::iterator i = m_callbackList.begin (); + for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { (*i) (m_context, a1, a2); @@ -132,9 +132,9 @@ CallbackTraceSource::operator() (T1 a1, T2 a2) template void -CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3) +CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3) const { - for (typename CallbackList::iterator i = m_callbackList.begin (); + for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { (*i) (m_context, a1, a2, a3); @@ -143,9 +143,9 @@ CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3) template void -CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3, T4 a4) +CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const { - for (typename CallbackList::iterator i = m_callbackList.begin (); + for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { (*i) (m_context, a1, a2, a3, a4); From 4a32d596595285b2943088840bc580b8fa4be47b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:27:30 +0200 Subject: [PATCH 020/218] add an abstract base to CallbackTraceSource --- src/core/callback-trace-source.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index 7de77c56a..e5cc1a599 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -29,6 +29,14 @@ namespace ns3 { +class CallbackTraceSourceBase +{ +public: + virtual ~CallbackTraceSourceBase () {} + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; + virtual void RemoveCallback (CallbackBase const & callback) = 0; +}; + /** * \brief log arbitrary number of parameters to a matching ns3::Callback @@ -39,11 +47,11 @@ namespace ns3 { */ template -class CallbackTraceSource { +class CallbackTraceSource : public CallbackTraceSourceBase { public: CallbackTraceSource (); - void AddCallback (CallbackBase const & callback, TraceContext const & context); - void RemoveCallback (CallbackBase const & callback); + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context); + virtual void RemoveCallback (CallbackBase const & callback); void operator() (void) const; void operator() (T1 a1) const; void operator() (T1 a1, T2 a2) const; From b7880a591579102299a03b66427408e81ff4d185 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:27:52 +0200 Subject: [PATCH 021/218] use the abstract base of CallbackTraceSource to avoid pushing too much code in the header --- src/core/composite-trace-resolver.cc | 123 +++++++++++++++++++- src/core/composite-trace-resolver.h | 164 +++++++++++++++------------ 2 files changed, 209 insertions(+), 78 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 72a768e91..ddc7bd001 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -63,6 +63,115 @@ CompositeTraceResolver::Add (std::string name, AddItem (item); } +void +CompositeTraceResolver::Add (std::string name, + FVTraceSourceBase &trace) +{ + DoAddFV (name, trace, TraceContext ()); +} + + +void +CompositeTraceResolver::DoAddFV (std::string name, + FVTraceSourceBase &trace, + const TraceContext &context) +{ + class FVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + FVTraceSourceBase *trace; + } *item = new FVCompositeItem (); + item->name = name; + item->context = context; + item->trace = &trace; + AddItem (item); +} + +void +CompositeTraceResolver::Add (std::string name, + UVTraceSourceBase &trace) +{ + DoAddUV (name, trace, TraceContext ()); +} + + +void +CompositeTraceResolver::DoAddUV (std::string name, + UVTraceSourceBase &trace, + const TraceContext &context) +{ + class UVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + UVTraceSourceBase *trace; + } *item = new UVCompositeItem (); + item->name = name; + item->context = context; + item->trace = &trace; + AddItem (item); +} + +void +CompositeTraceResolver::Add (std::string name, + SVTraceSourceBase &trace) +{ + DoAddSV (name, trace, TraceContext ()); +} +void +CompositeTraceResolver::DoAddSV (std::string name, + SVTraceSourceBase &trace, + const TraceContext &context) +{ + class SVCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + SVTraceSourceBase *trace; + } *item = new SVCompositeItem (); + item->name = name; + item->context = context; + item->trace = &trace; + AddItem (item); +} + +void +CompositeTraceResolver::DoAddCallback (std::string name, + CallbackTraceSourceBase &trace, + const TraceContext &context) +{ + class CallbackCompositeItem : public CompositeItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + + CallbackTraceSourceBase *trace; + } *item = new CallbackCompositeItem (); + item->name = name; + item->context = context; + item->trace = &trace; + AddItem (item); +} + + + + void CompositeTraceResolver::AddChild (std::string name, Ptr child) { @@ -229,18 +338,22 @@ class TraceSourceTest : public TraceContextElement public: enum Sources { DOUBLEA, - DOUBLEB + DOUBLEB, + UINT16_T }; static uint16_t GetUid (void) {static uint16_t uid = AllocateUid ("TraceSourceTest"); return uid;} void Print (std::ostream &os) {os << "tracesource="; if (m_sources == DOUBLEA) {os << "doubleA";} - else if (m_sources == DOUBLEB) {os << "doubleB";}} + else if (m_sources == DOUBLEB) {os << "doubleB";} + else if (m_sources == UINT16_T) {os << "uint16_t";} + } TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {} TraceSourceTest (enum Sources sources) :m_sources (sources) {} - bool IsDoubleA (void) {return m_sources == TraceSourceTest::DOUBLEA;} - bool IsDoubleB (void) {return m_sources == TraceSourceTest::DOUBLEB;} + bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;} + bool IsDoubleB (void) const {return m_sources == TraceSourceTest::DOUBLEB;} + bool IsUint16 (void) const {return m_sources == TraceSourceTest::UINT16_T;} private: enum TraceSourceTest::Sources m_sources; }; @@ -462,7 +575,9 @@ CompositeTraceResolverTest::RunTests (void) ok = false; } + SVTraceSource source; + resolver.Add ("uint16_t", source, TraceSourceTest (TraceSourceTest::UINT16_T)); return ok; diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index e8b09610c..5d6415055 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -52,11 +52,9 @@ public: * resolution. The TraceContext of this trace source will also * be automatically extended to contain the input context. */ - template + template void Add (std::string name, - CallbackTraceSource &trace, T const &context); + CallbackTraceSourceBase &trace, T const &context); /** * \param name name of trace source * \param trace a signed variable trace source @@ -69,7 +67,7 @@ public: */ template void Add (std::string name, - SVTraceSource &trace, T const &context); + SVTraceSourceBase &trace, T const &context); /** * \param name name of trace source * \param trace an unsigned variable trace source @@ -82,7 +80,7 @@ public: */ template void Add (std::string name, - UVTraceSource &trace, T const &context); + UVTraceSourceBase &trace, T const &context); /** * \param name name of trace source * \param trace a floating-point variable trace source @@ -95,7 +93,49 @@ public: */ template void Add (std::string name, - FVTraceSource &trace, T const &context); + FVTraceSourceBase &trace, T const &context); + /** + * \param name name of trace source + * \param trace a callback trace source + * + * Add a callback trace source in this resolver. This trace + * source will match the name specified during namespace + * resolution. + */ + template + void Add (std::string name, + CallbackTraceSource &trace); + /** + * \param name name of trace source + * \param trace a signed variable trace source + * + * Add a signed variable trace source in this resolver. + * This trace source will match the name specified during namespace + * resolution. + */ + void Add (std::string name, + SVTraceSourceBase &trace); + /** + * \param name name of trace source + * \param trace an unsigned variable trace source + * + * Add an unsigned variable trace source in this resolver. + * This trace source will match the name specified during namespace + * resolution. + */ + void Add (std::string name, + UVTraceSourceBase &trace); + /** + * \param name name of trace source + * \param trace a floating-point variable trace source + * + * Add a floating-point variable trace source in this resolver. + * This trace source will match the name specified during namespace + * resolution. + */ + void Add (std::string name, + FVTraceSourceBase &trace); /** * \param name name of child trace resolver * \param createResolver a trace resolver constructor @@ -155,6 +195,19 @@ private: const TraceContext &context, enum Operation op); void DoAddChild (std::string name, Ptr child, const TraceContext &context); + void DoAddCallback (std::string name, + CallbackTraceSourceBase &trace, + const TraceContext &context); + void DoAddSV (std::string name, + SVTraceSourceBase &trace, + const TraceContext &context); + void DoAddUV (std::string name, + UVTraceSourceBase &trace, + const TraceContext &context); + void DoAddFV (std::string name, + FVTraceSourceBase &trace, + const TraceContext &context); + CompositeTraceResolver::TraceItems m_items; Ptr m_parent; @@ -166,88 +219,51 @@ namespace ns3 { -template +template void CompositeTraceResolver::Add (std::string name, - CallbackTraceSource &trace, + CallbackTraceSourceBase &trace, T const &context) { - class CallbackCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} + TraceContext ctx; + ctx.Add (context); + DoAddCallback (name, trace, ctx); +} +template +void +CompositeTraceResolver::Add (std::string name, + CallbackTraceSource &trace) +{ + DoAddCallback (name, trace, TraceContext ()); +} - CallbackTraceSource *trace; - } *item = new CallbackCompositeItem (); - item->name = name; - item->context.Add (context); - item->trace = &trace; - AddItem (item); +template +void +CompositeTraceResolver::Add (std::string name, + SVTraceSourceBase &trace, T const &context) +{ + TraceContext ctx; + ctx.Add (context); + DoAddSV (name, trace, ctx); } template void CompositeTraceResolver::Add (std::string name, - SVTraceSource &trace, T const &context) + UVTraceSourceBase &trace, T const &context) { - class SVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - SVTraceSource *trace; - } *item = new SVCompositeItem (); - item->name = name; - item->context.Add (context); - item->trace = &trace; - AddItem (item); + TraceContext ctx; + ctx.Add (context); + DoAddUV (name, trace, ctx); } template void CompositeTraceResolver::Add (std::string name, - UVTraceSource &trace, T const &context) + FVTraceSourceBase &trace, T const &context) { - class UVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - UVTraceSource *trace; - } *item = new UVCompositeItem (); - item->name = name; - item->context.Add (context); - item->trace = &trace; - AddItem (item); -} -template -void -CompositeTraceResolver::Add (std::string name, - FVTraceSource &trace, T const &context) -{ - class FVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - FVTraceSource *trace; - } *item = new FVCompositeItem (); - item->name = name; - item->context.Add (context); - item->trace = &trace; - AddItem (item); + TraceContext ctx; + ctx.Add (context); + DoAddFV (name, trace, ctx); } template From 1de6b26ecb1cd4ef0464014d5579eba5824d2b29 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:28:13 +0200 Subject: [PATCH 022/218] an untested interface id trace resolver --- src/core/object.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/src/core/object.cc b/src/core/object.cc index 440bd0f31..f19d4ae65 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -35,6 +35,7 @@ class IidTree public: void SetParent (uint16_t child, const uint16_t *parent); uint16_t LookupParent (uint16_t child); + private: std::vector m_parents; }; @@ -56,6 +57,54 @@ IidTree::LookupParent (uint16_t child) namespace ns3 { +class InterfaceIdTraceResolver : public TraceResolver +{ +public: + InterfaceIdTraceResolver (Ptr aggregate); + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Disconnect (std::string path, CallbackBase const &cb); +private: + Ptr ParseForInterface (std::string path); + Ptr m_aggregate; +}; + +InterfaceIdTraceResolver::InterfaceIdTraceResolver (Ptr aggregate) + : m_aggregate (aggregate) +{} +Ptr +InterfaceIdTraceResolver::ParseForInterface (std::string path) +{ + std::string element = GetElement (path); + std::string::size_type dollar_pos = element.find ("$"); + if (dollar_pos != 0) + { + return 0; + } + std::string interfaceName = element.substr (1, std::string::npos); + InterfaceId interfaceId = InterfaceId::LookupByName (interfaceName); + Ptr interface = m_aggregate->QueryInterface (interfaceId); + return interface; +} +void +InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +{ + Ptr interface = ParseForInterface (path); + if (interface != 0) + { + interface->TraceConnect (GetSubpath (path), cb, context); + } +} +void +InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + Ptr interface = ParseForInterface (path); + if (interface != 0) + { + interface->TraceDisconnect (GetSubpath (path), cb); + } +} + + InterfaceId::InterfaceId (uint16_t iid) : m_iid (iid) {} @@ -197,7 +246,9 @@ Object::DoDispose (void) Ptr Object::GetTraceResolver (void) { - return Create (); + Ptr resolver = + Create (this); + return resolver; } bool From c8bbf2e69762255e12f8acb71cc76d8952aeda50 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:28:37 +0200 Subject: [PATCH 023/218] replace the adhoc mobility course change callbacks with a trace source --- samples/main-random-topology.cc | 4 +-- src/mobility/hierarchical-mobility-model.cc | 8 ++--- src/mobility/hierarchical-mobility-model.h | 4 +-- src/mobility/mobility-model-notifier.cc | 39 ++++++--------------- src/mobility/mobility-model-notifier.h | 22 +++--------- 5 files changed, 23 insertions(+), 54 deletions(-) diff --git a/samples/main-random-topology.cc b/samples/main-random-topology.cc index 3fb52a0d9..3021ed3fb 100644 --- a/samples/main-random-topology.cc +++ b/samples/main-random-topology.cc @@ -15,7 +15,7 @@ using namespace ns3; static void -CourseChange (Ptr position) +CourseChange (const TraceContext &context, Ptr position) { Position pos = position->Get (); std::cout << Simulator::Now () << ", pos=" << position << ", x=" << pos.x << ", y=" << pos.y @@ -39,7 +39,7 @@ int main (int argc, char *argv[]) for (uint32_t i = 0; i < 10000; i++) { Ptr notifier = Create (); - notifier->RegisterListener (MakeCallback (&CourseChange)); + notifier->TraceConnect ("/course-change", MakeCallback (&CourseChange)); objects.push_back (notifier); } diff --git a/src/mobility/hierarchical-mobility-model.cc b/src/mobility/hierarchical-mobility-model.cc index 7e4aa3fe3..046f98056 100644 --- a/src/mobility/hierarchical-mobility-model.cc +++ b/src/mobility/hierarchical-mobility-model.cc @@ -41,8 +41,8 @@ HierarchicalMobilityModel::HierarchicalMobilityModel (Ptr child, parentNotifier = Create (); parent->AddInterface (parentNotifier); } - childNotifier->RegisterListener (MakeCallback (&HierarchicalMobilityModel::ChildChanged, this)); - parentNotifier->RegisterListener (MakeCallback (&HierarchicalMobilityModel::ParentChanged, this)); + childNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this)); + parentNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ParentChanged, this)); } Ptr @@ -89,13 +89,13 @@ HierarchicalMobilityModel::DoGetSpeed (void) const } void -HierarchicalMobilityModel::ParentChanged (Ptr model) +HierarchicalMobilityModel::ParentChanged (const TraceContext &context, Ptr model) { MobilityModel::NotifyCourseChange (); } void -HierarchicalMobilityModel::ChildChanged (Ptr model) +HierarchicalMobilityModel::ChildChanged (const TraceContext &context, Ptr model) { MobilityModel::NotifyCourseChange (); } diff --git a/src/mobility/hierarchical-mobility-model.h b/src/mobility/hierarchical-mobility-model.h index 1502c516a..16be7820b 100644 --- a/src/mobility/hierarchical-mobility-model.h +++ b/src/mobility/hierarchical-mobility-model.h @@ -63,8 +63,8 @@ private: virtual void DoSet (const Position &position); virtual Speed DoGetSpeed (void) const; - void ParentChanged (Ptr model); - void ChildChanged (Ptr model); + void ParentChanged (const TraceContext &context, Ptr model); + void ChildChanged (const TraceContext &context, Ptr model); Ptr m_child; Ptr m_parent; diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index abb476c20..adea6d771 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -19,6 +19,7 @@ * Author: Mathieu Lacage */ #include "mobility-model-notifier.h" +#include "ns3/composite-trace-resolver.h" namespace ns3 { @@ -32,37 +33,19 @@ MobilityModelNotifier::MobilityModelNotifier () SetInterfaceId (MobilityModelNotifier::iid); } -void -MobilityModelNotifier::RegisterListener (Listener listener) -{ - m_listeners.push_back (listener); -} -void -MobilityModelNotifier::UnregisterListener (Listener callback) -{ - for (std::list::iterator i = m_listeners.begin (); - i != m_listeners.end ();) - { - Listener listener = *i; - if (listener.IsEqual (callback)) - { - i = m_listeners.erase (i); - } - else - { - i++; - } - } -} void MobilityModelNotifier::Notify (Ptr position) const { - for (std::list::const_iterator i = m_listeners.begin (); - i != m_listeners.end (); i++) - { - Listener listener = *i; - listener (position); - } + m_trace (position); +} + +Ptr +MobilityModelNotifier::GetTraceResolver (void) +{ + Ptr resolver = + Create (); + resolver->Add ("course-change", m_trace); + return resolver; } } // namespace ns3 diff --git a/src/mobility/mobility-model-notifier.h b/src/mobility/mobility-model-notifier.h index 8aec327de..0f8422d4e 100644 --- a/src/mobility/mobility-model-notifier.h +++ b/src/mobility/mobility-model-notifier.h @@ -24,6 +24,7 @@ #include "ns3/object.h" #include "ns3/component-manager.h" #include "ns3/callback.h" +#include "ns3/callback-trace-source.h" #include "mobility-model.h" namespace ns3 { @@ -37,8 +38,6 @@ public: static const InterfaceId iid; static const ClassId cid; - typedef Callback > Listener; - /** * Create a new position notifier */ @@ -48,23 +47,10 @@ public: * \param position the position which just changed. */ void Notify (Ptr position) const; - - /** - * \param listener listener to add - * - * The listener will be notified upon every position change. - */ - void RegisterListener (Listener listener); - /** - * \param listener listener to remove - * - * The listener will not be notified anymore upon every - * position change. It is not an error to try to unregister - * a non-registered liste - */ - void UnregisterListener (Listener listener); +protected: + virtual Ptr GetTraceResolver (void); private: - std::list m_listeners; + CallbackTraceSource > m_trace; }; } // namespace ns3 From bb4d8f882ff22a6ec0107f55b3662928c80cda3e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:37:38 +0200 Subject: [PATCH 024/218] add NS_TEST_ASSERT_UNEQUAL --- src/core/test.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/core/test.h b/src/core/test.h index 356c08ee2..809c44f0d 100644 --- a/src/core/test.h +++ b/src/core/test.h @@ -118,6 +118,23 @@ private: << ", got " << (got) << std::endl; \ result = false; \ } +/** + * Convenience macro to check that a value returned by a test is what + * is expected. Note: this macro assumes a 'bool result = true' + * declaration exists in the test function body, and that the function + * returns that value. + * + * \param got value obtained from the test + * \param expected value that the test is expected to return + */ +#define NS_TEST_ASSERT_UNEQUAL(got, expected) \ + if ((got) == (expected)) \ + { \ + Failure () << __FILE__ << ":" <<__LINE__ \ + << ": did not want " << (expected) \ + << ", got " << (got) << std::endl; \ + result = false; \ + } /** * Convenience macro to check an assertion is held during an unit * test. Note: this macro assumes a 'bool result = true' declaration From 8e3050a9967fe74f2172369078729425f8624a3e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 18:43:15 +0200 Subject: [PATCH 025/218] rewrite Object tests with test.h macros --- src/core/object.cc | 119 ++++++++++----------------------------------- 1 file changed, 25 insertions(+), 94 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index f19d4ae65..6e67ecae6 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -368,112 +368,43 @@ ObjectTest::ObjectTest () bool ObjectTest::RunTests (void) { - bool ok = true; + bool result = true; Ptr baseA = Create (); - if (baseA->QueryInterface (BaseA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); baseA = Create (10); - if (baseA->QueryInterface (BaseA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), baseA); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedA::iid), 0); baseA = Create (); Ptr baseB = Create (); Ptr baseBCopy = baseB; baseA->AddInterface (baseB); - if (baseA->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseA->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedB::iid) != 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedB::iid) != 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_EQUAL (baseB->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseB->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (BaseA::iid), 0); baseA = Create (1); baseB = Create (1); baseBCopy = baseB; baseA->AddInterface (baseB); - if (baseA->QueryInterface (DerivedB::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseB::iid), 0) baseA = Create (); baseB = Create (); @@ -481,7 +412,7 @@ ObjectTest::RunTests (void) baseA = 0; baseA = baseB->QueryInterface (BaseA::iid); - return ok; + return result; } static ObjectTest g_interfaceObjectTests; From 3ef653cf5ab0287ea1280a0cbda778d08fdb4b54 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 21:08:28 +0200 Subject: [PATCH 026/218] rewrite tests with test.h macros --- src/core/callback-trace-source.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/core/callback-trace-source.cc b/src/core/callback-trace-source.cc index 7bcb41fe0..aa686c14d 100644 --- a/src/core/callback-trace-source.cc +++ b/src/core/callback-trace-source.cc @@ -55,7 +55,7 @@ CallbackTraceSourceTest::CbTwo (TraceContext const &context, uint8_t a, double b bool CallbackTraceSourceTest::RunTests (void) { - bool ok = true; + bool result = true; TraceContext ctx; CallbackTraceSource trace; @@ -64,28 +64,31 @@ CallbackTraceSourceTest::RunTests (void) m_one = false; m_two = false; trace (1, 2); - if (!m_one || !m_two) - { - ok = false; - } + NS_TEST_ASSERT (m_one); + NS_TEST_ASSERT (m_two); + trace.RemoveCallback (MakeCallback (&CallbackTraceSourceTest::CbOne, this)); m_one = false; m_two = false; trace (1, 2); - if (m_one || !m_two) - { - ok = false; - } + NS_TEST_ASSERT (!m_one); + NS_TEST_ASSERT (m_two); trace.RemoveCallback (MakeCallback (&CallbackTraceSourceTest::CbTwo, this)); m_one = false; m_two = false; trace (1, 2); - if (m_one || m_two) - { - ok = false; - } + NS_TEST_ASSERT (!m_one); + NS_TEST_ASSERT (!m_two); - return ok; + trace.AddCallback (MakeCallback (&CallbackTraceSourceTest::CbOne, this), ctx); + trace.AddCallback (MakeCallback (&CallbackTraceSourceTest::CbTwo, this), ctx); + m_one = false; + m_two = false; + trace (1, 2); + NS_TEST_ASSERT (m_one); + NS_TEST_ASSERT (m_two); + + return result; } CallbackTraceSourceTest g_callbackTraceTest; From 0b748285769e9177076dbad5532708adf962899a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 21:23:40 +0200 Subject: [PATCH 027/218] test object-based tracing --- src/core/object.cc | 124 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) diff --git a/src/core/object.cc b/src/core/object.cc index 6e67ecae6..c16a7db63 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -22,7 +22,9 @@ #include "assert.h" #include "singleton.h" #include "uid-manager.h" -#include "empty-trace-resolver.h" +#include "sv-trace-source.h" +#include "trace-resolver.h" +#include "composite-trace-resolver.h" #include namespace { @@ -301,7 +303,18 @@ public: { SetInterfaceId (BaseA::iid); } + void BaseGenerateTrace (int16_t v) + { m_source = v; } virtual void Dispose (void) {} + virtual ns3::Ptr GetTraceResolver (void) + { + ns3::Ptr resolver = + ns3::Create (); + resolver->Add ("basea-x", m_source); + resolver->SetParent (Object::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_source; }; class DerivedA : public BaseA @@ -312,9 +325,20 @@ public: { SetInterfaceId (DerivedA::iid); } + void DerivedGenerateTrace (int16_t v) + { m_sourceDerived = v; } virtual void Dispose (void) { BaseA::Dispose (); } + virtual ns3::Ptr GetTraceResolver (void) + { + ns3::Ptr resolver = + ns3::Create (); + resolver->Add ("deriveda-x", m_sourceDerived); + resolver->SetParent (BaseA::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_sourceDerived; }; const ns3::InterfaceId BaseA::iid = @@ -330,7 +354,18 @@ public: { SetInterfaceId (BaseB::iid); } + void BaseGenerateTrace (int16_t v) + { m_source = v; } virtual void Dispose (void) {} + virtual ns3::Ptr GetTraceResolver (void) + { + ns3::Ptr resolver = + ns3::Create (); + resolver->Add ("baseb-x", m_source); + resolver->SetParent (Object::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_source; }; class DerivedB : public BaseB @@ -341,9 +376,20 @@ public: { SetInterfaceId (DerivedB::iid); } + void DerivedGenerateTrace (int16_t v) + { m_sourceDerived = v; } virtual void Dispose (void) { BaseB::Dispose (); } + virtual ns3::Ptr GetTraceResolver (void) + { + ns3::Ptr resolver = + ns3::Create (); + resolver->Add ("derivedb-x", m_sourceDerived); + resolver->SetParent (BaseB::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_sourceDerived; }; const ns3::InterfaceId BaseB::iid = @@ -360,11 +406,42 @@ class ObjectTest : public Test public: ObjectTest (); virtual bool RunTests (void); +private: + void BaseATrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void DerivedATrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void BaseBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void DerivedBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + + bool m_baseATrace; + bool m_derivedATrace; + bool m_baseBTrace; + bool m_derivedBTrace; }; ObjectTest::ObjectTest () : Test ("Object") {} +void +ObjectTest::BaseATrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_baseATrace = true; +} +void +ObjectTest::DerivedATrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_derivedATrace = true; +} +void +ObjectTest::BaseBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_baseBTrace = true; +} +void +ObjectTest::DerivedBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_derivedBTrace = true; +} + bool ObjectTest::RunTests (void) { @@ -412,6 +489,51 @@ ObjectTest::RunTests (void) baseA = 0; baseA = baseB->QueryInterface (BaseA::iid); + baseA = Create (); + baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (1); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseB = Create (); + baseB->TraceConnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (2); + NS_TEST_ASSERT (m_baseBTrace); + baseB->TraceDisconnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + + baseA->AddInterface (baseB); + + baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (3); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseA->TraceConnect ("/$BaseB/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (4); + NS_TEST_ASSERT (m_baseBTrace); + baseA->TraceDisconnect ("/$BaseB/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (5); + NS_TEST_ASSERT (!m_baseBTrace); + + baseB->TraceConnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (6); + NS_TEST_ASSERT (m_baseATrace); + baseB->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseA->TraceConnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (7); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + + return result; } From 025ac36aec2078303793ab463e3023ab91f4059b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 21:23:55 +0200 Subject: [PATCH 028/218] add some debugging for disconnect --- src/core/composite-trace-resolver.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index ddc7bd001..92bec309c 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -313,6 +313,7 @@ CompositeTraceResolver::OperationOne (std::string subpath, (*i)->Connect (subpath, cb, ctx); } break; case DISCONNECT: + NS_DEBUG ("disconnect from path="< -class CallbackTraceSource : public CallbackTraceSourceBase { +class CallbackTraceSource : public TraceSource { public: CallbackTraceSource (); virtual void AddCallback (CallbackBase const & callback, TraceContext const & context); diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 92bec309c..736ddbd3e 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -63,6 +63,14 @@ CompositeTraceResolver::Add (std::string name, AddItem (item); } +void +CompositeTraceResolver::Add (std::string name, + TraceSource &trace) +{ + DoAddSource (name, trace, TraceContext ()); +} + + void CompositeTraceResolver::Add (std::string name, FVTraceSourceBase &trace) @@ -149,11 +157,11 @@ CompositeTraceResolver::DoAddSV (std::string name, } void -CompositeTraceResolver::DoAddCallback (std::string name, - CallbackTraceSourceBase &trace, - const TraceContext &context) +CompositeTraceResolver::DoAddSource (std::string name, + TraceSource &trace, + const TraceContext &context) { - class CallbackCompositeItem : public CompositeItem + class SourceCompositeItem : public CompositeItem { public: virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) @@ -161,8 +169,8 @@ CompositeTraceResolver::DoAddCallback (std::string name, virtual void Disconnect (std::string subpath, const CallbackBase &cb) {if (subpath == "") {trace->RemoveCallback (cb);}} - CallbackTraceSourceBase *trace; - } *item = new CallbackCompositeItem (); + TraceSource *trace; + } *item = new SourceCompositeItem (); item->name = name; item->context = context; item->trace = &trace; diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 5d6415055..6da904ec8 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -54,7 +54,7 @@ public: */ template void Add (std::string name, - CallbackTraceSourceBase &trace, T const &context); + TraceSource &trace, T const &context); /** * \param name name of trace source * \param trace a signed variable trace source @@ -102,10 +102,8 @@ public: * source will match the name specified during namespace * resolution. */ - template void Add (std::string name, - CallbackTraceSource &trace); + TraceSource &trace); /** * \param name name of trace source * \param trace a signed variable trace source @@ -195,9 +193,9 @@ private: const TraceContext &context, enum Operation op); void DoAddChild (std::string name, Ptr child, const TraceContext &context); - void DoAddCallback (std::string name, - CallbackTraceSourceBase &trace, - const TraceContext &context); + void DoAddSource (std::string name, + TraceSource &trace, + const TraceContext &context); void DoAddSV (std::string name, SVTraceSourceBase &trace, const TraceContext &context); @@ -222,20 +220,12 @@ namespace ns3 { template void CompositeTraceResolver::Add (std::string name, - CallbackTraceSourceBase &trace, + TraceSource &trace, T const &context) { TraceContext ctx; ctx.Add (context); - DoAddCallback (name, trace, ctx); -} -template -void -CompositeTraceResolver::Add (std::string name, - CallbackTraceSource &trace) -{ - DoAddCallback (name, trace, TraceContext ()); + DoAddSource (name, trace, ctx); } template diff --git a/src/core/fv-trace-source.h b/src/core/fv-trace-source.h index 2e059303b..f305980a5 100644 --- a/src/core/fv-trace-source.h +++ b/src/core/fv-trace-source.h @@ -23,11 +23,12 @@ #define F_VARIABLE_TRACER_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class FVTraceSourceBase { +class FVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; diff --git a/src/core/sv-trace-source.h b/src/core/sv-trace-source.h index 291bc764e..d7038c0ad 100644 --- a/src/core/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -23,11 +23,12 @@ #define SV_TRACE_SOURCE_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class SVTraceSourceBase { +class SVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; @@ -37,7 +38,7 @@ public: return *this; } - ~SVTraceSourceBase () {} + virtual ~SVTraceSourceBase () {} void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); diff --git a/src/core/trace-source.h b/src/core/trace-source.h new file mode 100644 index 000000000..1b4c96577 --- /dev/null +++ b/src/core/trace-source.h @@ -0,0 +1,36 @@ +/* -*- 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 + * + * Author: Mathieu Lacage + */ +#ifndef TRACE_SOURCE_H +#define TRACE_SOURCE_H + +namespace ns3 { + +class TraceSource +{ +public: + virtual ~TraceSource () {} + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; + virtual void RemoveCallback (CallbackBase const & callback) = 0; +}; + +} // namespace ns3 + +#endif /* TRACE_SOURCE_H */ diff --git a/src/core/uv-trace-source.h b/src/core/uv-trace-source.h index 0bdfb3f94..2216f2c98 100644 --- a/src/core/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -23,11 +23,12 @@ #define UV_TRACE_SOURCE_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class UVTraceSourceBase { +class UVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; diff --git a/src/core/wscript b/src/core/wscript index 7a9e8171a..ea91c7619 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -81,6 +81,7 @@ def build(bld): 'component-manager.h', 'type-traits.h', 'random-variable-default-value.h', + 'trace-source.h', 'uv-trace-source.h', 'sv-trace-source.h', 'fv-trace-source.h', From ea69601bef43a9e9e05063bec1ece16257da9c4c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 22:24:45 +0200 Subject: [PATCH 030/218] remove useless code --- src/core/composite-trace-resolver.cc | 86 --------------------- src/core/composite-trace-resolver.h | 107 --------------------------- 2 files changed, 193 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 736ddbd3e..8f8f31ed2 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -70,92 +70,6 @@ CompositeTraceResolver::Add (std::string name, DoAddSource (name, trace, TraceContext ()); } - -void -CompositeTraceResolver::Add (std::string name, - FVTraceSourceBase &trace) -{ - DoAddFV (name, trace, TraceContext ()); -} - - -void -CompositeTraceResolver::DoAddFV (std::string name, - FVTraceSourceBase &trace, - const TraceContext &context) -{ - class FVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - FVTraceSourceBase *trace; - } *item = new FVCompositeItem (); - item->name = name; - item->context = context; - item->trace = &trace; - AddItem (item); -} - -void -CompositeTraceResolver::Add (std::string name, - UVTraceSourceBase &trace) -{ - DoAddUV (name, trace, TraceContext ()); -} - - -void -CompositeTraceResolver::DoAddUV (std::string name, - UVTraceSourceBase &trace, - const TraceContext &context) -{ - class UVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - UVTraceSourceBase *trace; - } *item = new UVCompositeItem (); - item->name = name; - item->context = context; - item->trace = &trace; - AddItem (item); -} - -void -CompositeTraceResolver::Add (std::string name, - SVTraceSourceBase &trace) -{ - DoAddSV (name, trace, TraceContext ()); -} -void -CompositeTraceResolver::DoAddSV (std::string name, - SVTraceSourceBase &trace, - const TraceContext &context) -{ - class SVCompositeItem : public CompositeItem - { - public: - virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {if (subpath == "") {trace->AddCallback (cb, context);}} - virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {if (subpath == "") {trace->RemoveCallback (cb);}} - - SVTraceSourceBase *trace; - } *item = new SVCompositeItem (); - item->name = name; - item->context = context; - item->trace = &trace; - AddItem (item); -} - void CompositeTraceResolver::DoAddSource (std::string name, TraceSource &trace, diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 6da904ec8..8c43e8f98 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -55,45 +55,6 @@ public: template void Add (std::string name, TraceSource &trace, T const &context); - /** - * \param name name of trace source - * \param trace a signed variable trace source - * \param context the context associated to this trace source - * - * Add a signed variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - SVTraceSourceBase &trace, T const &context); - /** - * \param name name of trace source - * \param trace an unsigned variable trace source - * \param context the context associated to this trace source - * - * Add an unsigned variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - UVTraceSourceBase &trace, T const &context); - /** - * \param name name of trace source - * \param trace a floating-point variable trace source - * \param context the context associated to this trace source - * - * Add a floating-point variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - FVTraceSourceBase &trace, T const &context); /** * \param name name of trace source * \param trace a callback trace source @@ -104,36 +65,6 @@ public: */ void Add (std::string name, TraceSource &trace); - /** - * \param name name of trace source - * \param trace a signed variable trace source - * - * Add a signed variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. - */ - void Add (std::string name, - SVTraceSourceBase &trace); - /** - * \param name name of trace source - * \param trace an unsigned variable trace source - * - * Add an unsigned variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. - */ - void Add (std::string name, - UVTraceSourceBase &trace); - /** - * \param name name of trace source - * \param trace a floating-point variable trace source - * - * Add a floating-point variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. - */ - void Add (std::string name, - FVTraceSourceBase &trace); /** * \param name name of child trace resolver * \param createResolver a trace resolver constructor @@ -196,16 +127,6 @@ private: void DoAddSource (std::string name, TraceSource &trace, const TraceContext &context); - void DoAddSV (std::string name, - SVTraceSourceBase &trace, - const TraceContext &context); - void DoAddUV (std::string name, - UVTraceSourceBase &trace, - const TraceContext &context); - void DoAddFV (std::string name, - FVTraceSourceBase &trace, - const TraceContext &context); - CompositeTraceResolver::TraceItems m_items; Ptr m_parent; @@ -228,34 +149,6 @@ CompositeTraceResolver::Add (std::string name, DoAddSource (name, trace, ctx); } -template -void -CompositeTraceResolver::Add (std::string name, - SVTraceSourceBase &trace, T const &context) -{ - TraceContext ctx; - ctx.Add (context); - DoAddSV (name, trace, ctx); -} -template -void -CompositeTraceResolver::Add (std::string name, - UVTraceSourceBase &trace, T const &context) -{ - TraceContext ctx; - ctx.Add (context); - DoAddUV (name, trace, ctx); -} -template -void -CompositeTraceResolver::Add (std::string name, - FVTraceSourceBase &trace, T const &context) -{ - TraceContext ctx; - ctx.Add (context); - DoAddFV (name, trace, ctx); -} - template void CompositeTraceResolver::AddArray (std::string name, From 402830980e909545105b2ae2723a7b6f102fb03e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 22:31:16 +0200 Subject: [PATCH 031/218] CompositeTraceResolver::Add -> CompositeTraceResolver::AddSource --- src/core/composite-trace-resolver.cc | 18 +++++++++--------- src/core/composite-trace-resolver.h | 14 +++++++------- src/core/object.cc | 8 ++++---- src/devices/csma-cd/csma-cd-net-device.cc | 12 ++++++------ .../point-to-point-net-device.cc | 6 +++--- src/internet-node/ipv4-l3-protocol.cc | 6 +++--- src/mobility/mobility-model-notifier.cc | 2 +- src/node/queue.cc | 6 +++--- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 8f8f31ed2..3b69b6da2 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -64,7 +64,7 @@ CompositeTraceResolver::Add (std::string name, } void -CompositeTraceResolver::Add (std::string name, +CompositeTraceResolver::AddSource (std::string name, TraceSource &trace) { DoAddSource (name, trace, TraceContext ()); @@ -351,8 +351,8 @@ Ptr CompositeTraceResolverTest::CreateSubResolver (void) { Ptr subresolver = Create (); - subresolver->Add ("trace-int", m_traceInt, - SubTraceSourceTest (SubTraceSourceTest::INT)); + subresolver->AddSource ("trace-int", m_traceInt, + SubTraceSourceTest (SubTraceSourceTest::INT)); return subresolver; } bool @@ -366,10 +366,10 @@ CompositeTraceResolverTest::RunTests (void) CompositeTraceResolver resolver; - resolver.Add ("trace-double-a", traceDoubleA, - TraceSourceTest (TraceSourceTest::DOUBLEA)); - resolver.Add ("trace-double-b", traceDoubleB, - TraceSourceTest (TraceSourceTest::DOUBLEB)); + resolver.AddSource ("trace-double-a", traceDoubleA, + TraceSourceTest (TraceSourceTest::DOUBLEA)); + resolver.AddSource ("trace-double-b", traceDoubleB, + TraceSourceTest (TraceSourceTest::DOUBLEB)); resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); @@ -461,7 +461,7 @@ CompositeTraceResolverTest::RunTests (void) } resolver.Add ("subresolver", - MakeCallback (&CompositeTraceResolverTest::CreateSubResolver, this)); + MakeCallback (&CompositeTraceResolverTest::CreateSubResolver, this)); resolver.Connect ("/subresolver/trace-int", MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ()); @@ -501,7 +501,7 @@ CompositeTraceResolverTest::RunTests (void) SVTraceSource source; - resolver.Add ("uint16_t", source, TraceSourceTest (TraceSourceTest::UINT16_T)); + resolver.AddSource ("uint16_t", source, TraceSourceTest (TraceSourceTest::UINT16_T)); return ok; diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 8c43e8f98..b5579c14e 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -53,8 +53,8 @@ public: * be automatically extended to contain the input context. */ template - void Add (std::string name, - TraceSource &trace, T const &context); + void AddSource (std::string name, + TraceSource &trace, T const &context); /** * \param name name of trace source * \param trace a callback trace source @@ -63,8 +63,8 @@ public: * source will match the name specified during namespace * resolution. */ - void Add (std::string name, - TraceSource &trace); + void AddSource (std::string name, + TraceSource &trace); /** * \param name name of child trace resolver * \param createResolver a trace resolver constructor @@ -140,9 +140,9 @@ namespace ns3 { template void -CompositeTraceResolver::Add (std::string name, - TraceSource &trace, - T const &context) +CompositeTraceResolver::AddSource (std::string name, + TraceSource &trace, + T const &context) { TraceContext ctx; ctx.Add (context); diff --git a/src/core/object.cc b/src/core/object.cc index c16a7db63..b820a5b7c 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -310,7 +310,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->Add ("basea-x", m_source); + resolver->AddSource ("basea-x", m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -334,7 +334,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->Add ("deriveda-x", m_sourceDerived); + resolver->AddSource ("deriveda-x", m_sourceDerived); resolver->SetParent (BaseA::GetTraceResolver ()); return resolver; } @@ -361,7 +361,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->Add ("baseb-x", m_source); + resolver->AddSource ("baseb-x", m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -385,7 +385,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->Add ("derivedb-x", m_sourceDerived); + resolver->AddSource ("derivedb-x", m_sourceDerived); resolver->SetParent (BaseB::GetTraceResolver ()); return resolver; } diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index fe5c0ba26..82b6b7db6 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -454,12 +454,12 @@ CsmaCdNetDevice::GetTraceResolver (void) { Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); - resolver->Add ("rx", - m_rxTrace, - CsmaCdTraceType (CsmaCdTraceType::RX)); - resolver->Add ("drop", - m_dropTrace, - CsmaCdTraceType (CsmaCdTraceType::DROP)); + resolver->AddSource ("rx", + m_rxTrace, + CsmaCdTraceType (CsmaCdTraceType::RX)); + resolver->AddSource ("drop", + m_dropTrace, + CsmaCdTraceType (CsmaCdTraceType::DROP)); resolver->SetParent (NetDevice::GetTraceResolver ()); return resolver; } diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 633fbe5c6..3b94b5bcf 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -193,9 +193,9 @@ PointToPointNetDevice::GetTraceResolver (void) { Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); - resolver->Add ("rx", - m_rxTrace, - PointToPointTraceType ()); + resolver->AddSource ("rx", + m_rxTrace, + PointToPointTraceType ()); resolver->SetParent (NetDevice::GetTraceResolver ()); return resolver; } diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 75320e886..2e3f4a421 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -152,9 +152,9 @@ Ptr Ipv4L3Protocol::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); - resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); - resolver->Add ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); + resolver->AddSource ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); + resolver->AddSource ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); + resolver->AddSource ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); resolver->AddArray ("interfaces", m_interfaces.begin (), m_interfaces.end (), Ipv4L3ProtocolInterfaceIndex ()); diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index adea6d771..ffab72953 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -44,7 +44,7 @@ MobilityModelNotifier::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->Add ("course-change", m_trace); + resolver->AddSource ("course-change", m_trace); return resolver; } diff --git a/src/node/queue.cc b/src/node/queue.cc index 78ad9369c..00b6f5387 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -98,9 +98,9 @@ Ptr Queue::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->Add ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); - resolver->Add ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); - resolver->Add ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); + resolver->AddSource ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); + resolver->AddSource ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); + resolver->AddSource ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } From 5d003bc306b87813ade903c95e290f9cf09a3aac Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 22:44:12 +0200 Subject: [PATCH 032/218] add forgotten virtual keyword --- src/core/fv-trace-source.h | 4 ++-- src/core/sv-trace-source.h | 4 ++-- src/core/uv-trace-source.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/fv-trace-source.h b/src/core/fv-trace-source.h index f305980a5..5b9f44df4 100644 --- a/src/core/fv-trace-source.h +++ b/src/core/fv-trace-source.h @@ -40,10 +40,10 @@ public: ~FVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { + virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } protected: diff --git a/src/core/sv-trace-source.h b/src/core/sv-trace-source.h index d7038c0ad..7c2bd8818 100644 --- a/src/core/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -40,10 +40,10 @@ public: virtual ~SVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { + virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } protected: diff --git a/src/core/uv-trace-source.h b/src/core/uv-trace-source.h index 2216f2c98..55602e614 100644 --- a/src/core/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -43,10 +43,10 @@ public: } ~UVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { + virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } From 4ad74ffa7225009206306b69b4e65a88f77b40ea Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 22:44:21 +0200 Subject: [PATCH 033/218] more tests --- src/core/object.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core/object.cc b/src/core/object.cc index b820a5b7c..57f288cda 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -532,7 +532,31 @@ ObjectTest::RunTests (void) NS_TEST_ASSERT (m_baseATrace); baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); - + Ptr derivedA; + derivedA = Create (1); + baseB = Create (); + derivedA->AddInterface (baseB); + baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this)); + baseB->TraceConnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_derivedATrace = false; + m_baseATrace = false; + derivedA->DerivedGenerateTrace (8); + derivedA->BaseGenerateTrace (9); + NS_TEST_ASSERT (m_derivedATrace); + NS_TEST_ASSERT (m_baseATrace); + baseB->TraceDisconnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::BaseATrace, this)); + baseB->TraceDisconnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseB->TraceConnect ("/$DerivedA/*", MakeCallback (&ObjectTest::DerivedATrace, this)); + m_derivedATrace = false; + derivedA->DerivedGenerateTrace (10); + NS_TEST_ASSERT (m_derivedATrace); + // here, we have connected the derived trace sink to all + // trace sources, including the base trace source. + m_derivedATrace = false; + derivedA->BaseGenerateTrace (11); + NS_TEST_ASSERT (m_derivedATrace); + baseB->TraceDisconnect ("/$DerivedA/*", MakeCallback (&ObjectTest::BaseATrace, this)); return result; } From 5305ca4e2ae57309f9dbbc3b8b0200d3ef7c999b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 12 Aug 2007 22:45:24 +0200 Subject: [PATCH 034/218] move includes down to where they are really needed --- src/core/object.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index 57f288cda..73ade0d61 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -22,9 +22,7 @@ #include "assert.h" #include "singleton.h" #include "uid-manager.h" -#include "sv-trace-source.h" #include "trace-resolver.h" -#include "composite-trace-resolver.h" #include namespace { @@ -292,6 +290,8 @@ Object::MaybeDelete (void) const #ifdef RUN_SELF_TESTS #include "test.h" +#include "sv-trace-source.h" +#include "composite-trace-resolver.h" namespace { From a82fc38dbb62458f3fb5a3055eaf6c4018604fef Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sun, 12 Aug 2007 13:59:49 -0700 Subject: [PATCH 035/218] untested multicast support --- examples/csma-multicast.cc | 173 +++++++++++++++++++++++ examples/wscript | 5 + src/internet-node/ipv4-impl.cc | 48 +++++++ src/internet-node/ipv4-impl.h | 18 +++ src/internet-node/ipv4-l3-protocol.cc | 88 +++++++++++- src/internet-node/ipv4-l3-protocol.h | 23 ++- src/internet-node/ipv4-static-routing.cc | 126 ++++++++++++++++- src/internet-node/ipv4-static-routing.h | 22 ++- src/node/ipv4-route.cc | 96 ++++++++++++- src/node/ipv4-route.h | 62 ++++++++ src/node/ipv4.h | 60 ++++++++ 11 files changed, 709 insertions(+), 12 deletions(-) create mode 100644 examples/csma-multicast.cc diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc new file mode 100644 index 000000000..a36f11b64 --- /dev/null +++ b/examples/csma-multicast.cc @@ -0,0 +1,173 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Network topology +// +// n0 n1 n2 n3 +// | | | | +// ===================== +// +// - CBR/UDP flows from n0 to n1, and from n3 to n0 +// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. +// (i.e., DataRate of 448,000 bps) +// - DropTail queues +// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" + +#include +#include +#include +#include + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/random-variable.h" +#include "ns3/debug.h" + +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" + +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/eui48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/onoff-application.h" + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this +#if 0 + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("PacketSocket"); +#endif + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, + // and what the queue limit is + + // The below Bind command tells the queue factory which class to + // instantiate, when the queue factory is invoked in the topology code + DefaultValue::Bind ("Queue", "DropTailQueue"); + + // Allow the user to override any of the defaults and the above + // Bind()s at run-time, via command-line arguments + CommandLine::Parse (argc, argv); + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + // We create the channels first without any IP addressing information + Ptr channel0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, + Eui48Address("10:54:23:54:23:50")); + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, + Eui48Address("10:54:23:54:23:51")); + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, + Eui48Address("10:54:23:54:23:52")); + uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, + Eui48Address("10:54:23:54:23:53")); + + // Later, we add IP addresses. + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); + + // Configure multicasting + Ipv4Address multicastSource ("10.1.1.1"); + Ipv4Address multicastGroup ("225.0.0.0"); + + Ptr ipv4; + ipv4 = n0->QueryInterface (Ipv4::iid); + + std::vector outputInterfaces (1); + outputInterfaces[0] = n0ifIndex; + + ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, + outputInterfaces); + + ipv4 = n1->QueryInterface (Ipv4::iid); + ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + + ipv4 = n2->QueryInterface (Ipv4::iid); + ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + + ipv4 = n3->QueryInterface (Ipv4::iid); + ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + + // Create the OnOff application to send UDP datagrams of size + // 210 bytes at a rate of 448 Kb/s + // from n0 to n1 + Ptr ooff = Create ( + n0, + InetSocketAddress (multicastGroup, 80), + "Udp", + ConstantVariable(1), + ConstantVariable(0)); + // Start the application + ooff->Start(Seconds(1.0)); + ooff->Stop (Seconds(10.0)); + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-one-subnet.tr file + AsciiTrace asciitrace ("csma-one-subnet.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); + + // Also configure some tcpdump traces; each interface will be traced + // The output files will be named + // simple-point-to-point.pcap-- + // and can be read by the "tcpdump -r" command (use "-tt" option to + // display timestamps correctly) + PcapTrace pcaptrace ("csma-one-subnet.pcap"); + pcaptrace.TraceAllIp (); + + Simulator::Run (); + + Simulator::Destroy (); +} diff --git a/examples/wscript b/examples/wscript index e7559756f..a38656c0f 100644 --- a/examples/wscript +++ b/examples/wscript @@ -17,3 +17,8 @@ def build(bld): obj = bld.create_ns3_program('csma-packet-socket', ['csma', 'internet-node']) obj.source = 'csma-packet-socket.cc' + + obj = bld.create_ns3_program('csma-multicast', + ['csma', 'internet-node']) + obj.source = 'csma-multicast.cc' + diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index 307425114..c1dbc2c49 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -95,6 +95,42 @@ Ipv4Impl::RemoveRoute (uint32_t i) { return m_ipv4->RemoveRoute (i); } + +void +Ipv4Impl::AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + m_ipv4->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); +} + +uint32_t +Ipv4Impl::GetNMulticastRoutes (void) const +{ + return m_ipv4->GetNMulticastRoutes (); +} + +Ipv4MulticastRoute +Ipv4Impl::GetMulticastRoute (uint32_t i) const +{ + return *m_ipv4->GetMulticastRoute (i); +} + +void +Ipv4Impl::RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +{ + m_ipv4->RemoveMulticastRoute (origin, group, inputInterface); +} + +void +Ipv4Impl::RemoveMulticastRoute (uint32_t i) +{ + return m_ipv4->RemoveMulticastRoute (i); +} + uint32_t Ipv4Impl::AddInterface (Ptr device) { @@ -111,6 +147,18 @@ Ipv4Impl::GetNetDevice (uint32_t i) return m_ipv4->GetInterface (i)-> GetDevice (); } +void +Ipv4Impl::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + m_ipv4->JoinMulticastGroup(origin, group); +} + +void +Ipv4Impl::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + m_ipv4->LeaveMulticastGroup(origin, group); +} + void Ipv4Impl::SetAddress (uint32_t i, Ipv4Address address) { diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index 445c10454..5ad9b3e0c 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -55,10 +55,28 @@ public: virtual uint32_t GetNRoutes (void); virtual Ipv4Route GetRoute (uint32_t i); virtual void RemoveRoute (uint32_t i); + + + virtual void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + + virtual uint32_t GetNMulticastRoutes (void) const; + virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; + + virtual void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + virtual void RemoveMulticastRoute (uint32_t i); + virtual uint32_t AddInterface (Ptr device); virtual uint32_t GetNInterfaces (void); virtual Ptr GetNetDevice(uint32_t i); + virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); + virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + virtual void SetAddress (uint32_t i, Ipv4Address address); virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask); virtual Ipv4Mask GetNetworkMask (uint32_t t) const; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index be483dfa0..f7506c59b 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -17,6 +17,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Author: George F. Riley +// Craig Dowell // #include "ns3/packet.h" @@ -131,7 +132,8 @@ Ipv4L3Protocol::~Ipv4L3Protocol () void Ipv4L3Protocol::DoDispose (void) { - for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); + i != m_interfaces.end (); i++) { delete (*i); } @@ -224,12 +226,15 @@ Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { - for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); - rprotoIter != m_routingProtocols.end (); rprotoIter++) + for (Ipv4RoutingProtocolList::const_iterator rprotoIter = + m_routingProtocols.begin (); + rprotoIter != m_routingProtocols.end (); + rprotoIter++) { if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) return; } + // No route found routeReply (false, Ipv4Route (), packet, ipHeader); } @@ -261,6 +266,41 @@ Ipv4L3Protocol::RemoveRoute (uint32_t index) m_staticRouting->RemoveRoute (index); } +void +Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + m_staticRouting->AddMulticastRoute (origin, group, inputInterface, + outputInterfaces); +} + +uint32_t +Ipv4L3Protocol::GetNMulticastRoutes (void) const +{ + return m_staticRouting->GetNMulticastRoutes (); +} + +Ipv4MulticastRoute * +Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const +{ + return m_staticRouting->GetMulticastRoute (index); +} + +void +Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +{ + m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); +} + +void +Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) +{ + m_staticRouting->RemoveMulticastRoute (index); +} uint32_t Ipv4L3Protocol::AddInterface (Ptr device) @@ -463,13 +503,29 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, PtrReceive (p, ip.GetSource (), ip.GetDestination ()); } +void +Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + m_multicastGroups.push_back( + std::pair (origin, group)); +} + +void +Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); + i != m_multicastGroups.end (); + i++) + { + if ((*i).first.IsEqual(origin) && (*i).second.IsEqual(group)) + { + m_multicastGroups.erase (i); + return; + } + } +} + void Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) { diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 2cce3efa3..9269a80fa 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -158,11 +158,26 @@ public: Ipv4Route *GetRoute (uint32_t i); void RemoveRoute (uint32_t i); + void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + + void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + void RemoveMulticastRoute (uint32_t i); + uint32_t AddInterface (Ptr device); Ipv4Interface * GetInterface (uint32_t i) const; uint32_t GetNInterfaces (void) const; - + virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); + virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + void SetAddress (uint32_t i, Ipv4Address address); void SetNetworkMask (uint32_t i, Ipv4Mask mask); Ipv4Mask GetNetworkMask (uint32_t t) const; @@ -192,7 +207,10 @@ private: TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; typedef std::list Ipv4InterfaceList; - typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; + typedef std::list > + Ipv4MulticastGroupList; + typedef std::list > > + Ipv4RoutingProtocolList; Ipv4InterfaceList m_interfaces; uint32_t m_nInterfaces; @@ -206,6 +224,7 @@ private: Ipv4RoutingProtocolList m_routingProtocols; Ptr m_staticRouting; + Ipv4MulticastGroupList m_multicastGroups; }; } // Namespace ns3 diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index b70c1c1af..27962bd40 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -18,11 +18,11 @@ // // Author: George F. Riley // Gustavo Carneiro +// Craig Dowell #include "ipv4-static-routing.h" #include "ns3/packet.h" - namespace ns3 { @@ -77,6 +77,83 @@ Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, m_defaultRoute = route; } +void +Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); + *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, + inputInterface, outputInterfaces); + m_multicastRoutes.push_back (route); +} + +uint32_t +Ipv4StaticRouting::GetNMulticastRoutes (void) const +{ + return m_multicastRoutes.size (); +} + +Ipv4MulticastRoute * +Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const +{ + NS_ASSERT_MSG(index < m_multicastRoutes.size (), + "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); + + uint32_t tmp = 0; + for (MulticastRoutesCI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + if (tmp == index) + { + return *i; + } + tmp++; + } + return 0; +} + +void +Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +{ + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; + if (origin == route->GetOrigin () && + group == route->GetGroup () && + inputInterface == route->GetInputInterface ()) + { + delete *i; + m_multicastRoutes.erase (i); + return; + } + } +} + +void +Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) +{ + uint32_t tmp = 0; + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + if (tmp == index) + { + delete *i; + m_multicastRoutes.erase (i); + return; + } + tmp++; + } +} + Ipv4Route * Ipv4StaticRouting::LookupStatic (Ipv4Address dest) { @@ -110,6 +187,25 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest) return 0; } +Ipv4MulticastRoute * +Ipv4StaticRouting::LookupStatic ( + Ipv4Address origin, + Ipv4Address group) +{ + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; + if (origin == route->GetOrigin () && + group == route->GetGroup ()) + { + return *i; + } + } + return 0; +} + uint32_t Ipv4StaticRouting::GetNRoutes (void) { @@ -213,6 +309,27 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, Packet packet, RouteReplyCallback routeReply) { +// +// First, see if this is a multicast packet we have a route for. If we +// have a route, then send the packet down each of the specified interfaces. +// + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), + ipHeader.GetDestination ()); + if (mRoute) + { + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; + Ipv4Route route = + Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), + mRoute->GetOutputInterface(i)); + routeReply (true, route, p, ipHeader); + return true; + } + } +// +// See if this is a unicast packet we have a route for. +// Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); if (route != 0) { @@ -246,8 +363,13 @@ Ipv4StaticRouting::DoDispose (void) delete m_defaultRoute; m_defaultRoute = 0; } + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i = m_multicastRoutes.erase (i)) + { + delete (*i); + } Ipv4RoutingProtocol::DoDispose (); } - }//namespace ns3 diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 8462f55a7..24a228048 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -75,6 +75,20 @@ public: Ipv4Route *GetRoute (uint32_t i); void RemoveRoute (uint32_t i); + void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + + void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + + void RemoveMulticastRoute (uint32_t index); + protected: void DoDispose (void); @@ -86,15 +100,19 @@ private: typedef std::list::const_iterator NetworkRoutesCI; typedef std::list::iterator NetworkRoutesI; + typedef std::list MulticastRoutes; + typedef std::list::const_iterator MulticastRoutesCI; + typedef std::list::iterator MulticastRoutesI; + Ipv4Route *LookupStatic (Ipv4Address dest); + Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group); HostRoutes m_hostRoutes; NetworkRoutes m_networkRoutes; Ipv4Route *m_defaultRoute; + MulticastRoutes m_multicastRoutes; }; - - } // Namespace ns3 #endif /* IPV4_STATIC_ROUTING_H */ diff --git a/src/node/ipv4-route.cc b/src/node/ipv4-route.cc index bcc556894..9d6a2286b 100644 --- a/src/node/ipv4-route.cc +++ b/src/node/ipv4-route.cc @@ -137,7 +137,6 @@ Ipv4Route::GetInterface (void) const return m_interface; } - Ipv4Route Ipv4Route::CreateHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, @@ -220,4 +219,99 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route) return os; } +/***************************************************** + * Ipv4MulticastRoute + *****************************************************/ + +Ipv4MulticastRoute::Ipv4MulticastRoute () +{ +} + +Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const &route) +: + m_origin (route.m_origin), + m_group (route.m_group), + m_inputInterface (route.m_inputInterface), + m_outputInterfaces (route.m_outputInterfaces) +{ +} + +Ipv4MulticastRoute::Ipv4MulticastRoute ( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + m_origin = origin; + m_group = group; + m_inputInterface = inputInterface; + m_outputInterfaces = outputInterfaces; +} + +Ipv4Address +Ipv4MulticastRoute::GetOrigin (void) const +{ + return m_origin; +} + +Ipv4Address +Ipv4MulticastRoute::GetGroup (void) const +{ + return m_group; +} + +uint32_t +Ipv4MulticastRoute::GetInputInterface (void) const +{ + return m_inputInterface; +} + +uint32_t +Ipv4MulticastRoute::GetNOutputInterfaces (void) const +{ + return m_outputInterfaces.size (); +} + +uint32_t +Ipv4MulticastRoute::GetOutputInterface (uint32_t n) const +{ + NS_ASSERT_MSG(n < m_outputInterfaces.size (), + "Ipv4MulticastRoute::GetOutputInterface (): index out of bounds"); + + return m_outputInterfaces[n]; +} + +std::vector +Ipv4MulticastRoute::GetOutputInterfaces (void) const +{ + return m_outputInterfaces; +} + +Ipv4MulticastRoute +Ipv4MulticastRoute::CreateMulticastRoute ( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + return Ipv4MulticastRoute (origin, group, inputInterface, outputInterfaces); +} + +std::ostream& +operator<< (std::ostream& os, Ipv4MulticastRoute const& route) +{ + os << "origin=" << route.GetOrigin () << + ", group=" << route.GetGroup () << + ", input interface=" << route.GetInputInterface () << + ", output interfaces="; + + for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i) + { + os << route.GetOutputInterface (i) << " "; + + } + + return os; +} + }//namespace ns3 diff --git a/src/node/ipv4-route.h b/src/node/ipv4-route.h index efe9b52e2..f80a1ae00 100644 --- a/src/node/ipv4-route.h +++ b/src/node/ipv4-route.h @@ -22,6 +22,7 @@ #define IPV4_ROUTE_H #include +#include #include #include "ipv4-address.h" @@ -98,6 +99,67 @@ private: std::ostream& operator<< (std::ostream& os, Ipv4Route const& route); +/** + * \brief A record of an IPv4 multicast route + */ +class Ipv4MulticastRoute { +public: + /** + * \brief This constructor does nothing + */ + Ipv4MulticastRoute (); + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4MulticastRoute (Ipv4MulticastRoute const &route); + + /** + * \return The IPv4 address of the source of this route + */ + Ipv4Address GetOrigin (void) const; + + /** + * \return The IPv4 address of the multicast group of this route + */ + Ipv4Address GetGroup (void) const; + + /** + * \return The IPv4 address of the input interface of this route + */ + uint32_t GetInputInterface (void) const; + + /** + * \return The number of output interfaces of this route + */ + uint32_t GetNOutputInterfaces (void) const; + + /** + * \return A specified output interface. + */ + uint32_t GetOutputInterface (uint32_t n) const; + + /** + * \return A vector of all of the output interfaces of this route. + */ + std::vector GetOutputInterfaces (void) const; + + static Ipv4MulticastRoute CreateMulticastRoute (Ipv4Address origin, + Ipv4Address group, uint32_t inputInterface, + std::vector outputInterfaces); + +private: + Ipv4MulticastRoute (Ipv4Address origin, Ipv4Address group, + uint32_t inputInterface, std::vector outputInterfaces); + + Ipv4Address m_origin; + Ipv4Address m_group; + uint32_t m_inputInterface; + std::vector m_outputInterfaces; +}; + +std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoute const& route); + }//namespace ns3 #endif /* IPV4_ROUTE_H */ diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 76d88faea..06cf5c130 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -202,7 +202,49 @@ public: * \param i index of route to remove from routing table. */ virtual void RemoveRoute (uint32_t i) = 0; + + /** + * \brief Add a static multicast route for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + * \param inputInterface The interface index over which the packet arrived. + * \param outputInterfaces The list of output interface indices over which + * the packet should be sent (excluding the inputInterface). + */ + virtual void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) = 0; + /** + * \brief Remove a static multicast route for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + * \param inputInterface The interface index over which the packet arrived. + */ + virtual void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) = 0; + /** + * \returns the number of entries in the multicast routing table. + */ + virtual uint32_t GetNMulticastRoutes (void) const = 0; + + /** + * \param i index of route to return + * \returns the route whose index is i + */ + virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const = 0; + + /** + * \param i index of route to remove from routing table. + */ + virtual void RemoveMulticastRoute (uint32_t i) = 0; + /** * \param device device to add to the list of ipv4 interfaces * which can be used as output interfaces during packet forwarding. @@ -224,6 +266,24 @@ public: */ virtual Ptr GetNetDevice (uint32_t i) = 0; + /** + * \brief Join a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; + + /** + * \brief Leave a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; + /** * \param i index of ipv4 interface * \param address address to associate to the underlying ipv4 interface From 09b235eaecfb06900fd52b8199236fdb23e6b5cd Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sun, 12 Aug 2007 15:51:12 -0700 Subject: [PATCH 036/218] debug prints to make validation easier --- examples/csma-multicast.cc | 34 +++++++-- src/applications/onoff-application.cc | 37 ++++++++-- src/internet-node/ipv4-l3-protocol.cc | 88 +++++++++++++++++++++++- src/internet-node/ipv4-static-routing.cc | 21 +++++- src/internet-node/udp-l4-protocol.cc | 31 ++++++++- src/internet-node/udp-socket.cc | 46 ++++++++++++- 6 files changed, 240 insertions(+), 17 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index a36f11b64..19e01be7e 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -58,20 +58,37 @@ using namespace ns3; +NS_DEBUG_COMPONENT_DEFINE ("Me"); + int main (int argc, char *argv[]) { // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 + DebugComponentEnable("Me"); DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("NetDevice"); DebugComponentEnable("Channel"); DebugComponentEnable("CsmaChannel"); DebugComponentEnable("PacketSocket"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); #endif + DebugComponentEnable("Me"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("CsmaChannel"); + // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -86,16 +103,19 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_DEBUG("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); + NS_DEBUG("Create channels."); // We create the channels first without any IP addressing information Ptr channel0 = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); + NS_DEBUG("Build Topology."); uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, Eui48Address("10:54:23:54:23:50")); uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, @@ -106,6 +126,8 @@ main (int argc, char *argv[]) Eui48Address("10:54:23:54:23:53")); // Later, we add IP addresses. + NS_DEBUG("Assign IP Addresses."); + CsmaIpv4Topology::AddIpv4Address ( n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); @@ -119,6 +141,7 @@ main (int argc, char *argv[]) n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); // Configure multicasting + NS_DEBUG("Configure multicasting."); Ipv4Address multicastSource ("10.1.1.1"); Ipv4Address multicastGroup ("225.0.0.0"); @@ -142,7 +165,8 @@ main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s - // from n0 to n1 + // from n0 to the multicast group + NS_DEBUG("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress (multicastGroup, 80), @@ -155,7 +179,8 @@ main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-one-subnet.tr file - AsciiTrace asciitrace ("csma-one-subnet.tr"); + NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("csma-multicast.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); @@ -164,10 +189,11 @@ main (int argc, char *argv[]) // simple-point-to-point.pcap-- // and can be read by the "tcpdump -r" command (use "-tt" option to // display timestamps correctly) - PcapTrace pcaptrace ("csma-one-subnet.pcap"); + PcapTrace pcaptrace ("csma-multicast.pcap"); pcaptrace.TraceAllIp (); + NS_DEBUG("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_DEBUG("Done."); } diff --git a/src/applications/onoff-application.cc b/src/applications/onoff-application.cc index 32bcd7564..297d57e3e 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff-application.cc @@ -22,6 +22,7 @@ // George F. Riley, Georgia Tech, Spring 2007 // Adapted from ApplicationOnOff in GTNetS. +#include "ns3/debug.h" #include "ns3/address.h" #include "ns3/node.h" #include "ns3/nstime.h" @@ -34,6 +35,8 @@ #include "ns3/packet.h" #include "onoff-application.h" +NS_DEBUG_COMPONENT_DEFINE ("OnOffApplication"); + using namespace std; namespace ns3 { @@ -95,30 +98,37 @@ OnOffApplication::Construct (Ptr n, m_iid = iid; } - OnOffApplication::~OnOffApplication() -{} +{ + NS_DEBUG("OnOffApplication::~OnOffApplication()"); +} void OnOffApplication::SetMaxBytes(uint32_t maxBytes) { + NS_DEBUG("OnOffApplication::SetMaxBytes(" << maxBytes << ")"); m_maxBytes = maxBytes; } void OnOffApplication::SetDefaultRate (const DataRate &rate) { + NS_DEBUG("OnOffApplication::SetDefaultRate(" << &rate << ")"); g_defaultRate.SetValue (rate); } + void OnOffApplication::SetDefaultSize (uint32_t size) { + NS_DEBUG("OnOffApplication::SetDefaultSize(" << size << ")"); g_defaultSize.SetValue (size); } void OnOffApplication::DoDispose (void) { + NS_DEBUG("OnOffApplication::DoDispose()"); + m_socket = 0; delete m_onTime; delete m_offTime; @@ -130,10 +140,11 @@ OnOffApplication::DoDispose (void) Application::DoDispose (); } - // Application Methods -void OnOffApplication::StartApplication() // Called at time specified by Start +void OnOffApplication::StartApplication() // Called at time specified by Start { + NS_DEBUG("OnOffApplication::StartApplication()"); + // Create the socket if not already if (!m_socket) { @@ -151,8 +162,10 @@ void OnOffApplication::StartApplication() // Called at time specified by Star ScheduleStartEvent(); } -void OnOffApplication::StopApplication() // Called at time specified by Stop +void OnOffApplication::StopApplication() // Called at time specified by Stop { + NS_DEBUG("OnOffApplication::StopApplication()"); + if (m_sendEvent.IsRunning ()) { // Cancel the pending send packet event // Calculate residual bits since last packet sent @@ -166,17 +179,23 @@ void OnOffApplication::StopApplication() // Called at time specified by Stop // Event handlers void OnOffApplication::StartSending() { + NS_DEBUG("OnOffApplication::StartSending ()"); + ScheduleNextTx(); // Schedule the send packet event } void OnOffApplication::StopSending() { + NS_DEBUG("OnOffApplication::StopSending ()"); + Simulator::Cancel(m_sendEvent); } // Private helpers void OnOffApplication::ScheduleNextTx() { + NS_DEBUG("OnOffApplication::ScheduleNextTx ()"); + if (m_totBytes < m_maxBytes) { uint32_t bits = m_pktSize * 8 - m_residualBits; @@ -192,12 +211,16 @@ void OnOffApplication::ScheduleNextTx() void OnOffApplication::ScheduleStartEvent() { // Schedules the event to start sending data (switch to the "On" state) + NS_DEBUG("OnOffApplication::ScheduleStartEvent ()"); + Time offInterval = Seconds(m_offTime->GetValue()); m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); } void OnOffApplication::ScheduleStopEvent() { // Schedules the event to stop sending data (switch to "Off" state) + NS_DEBUG("OnOffApplication::ScheduleStopEvent ()"); + Time onInterval = Seconds(m_onTime->GetValue()); Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this); } @@ -205,6 +228,8 @@ void OnOffApplication::ScheduleStopEvent() void OnOffApplication::SendPacket() { + NS_DEBUG("OnOffApplication::SendPacket ()"); + NS_ASSERT (m_sendEvent.IsExpired ()); m_socket->Send(Packet (m_pktSize)); m_totBytes += m_pktSize; @@ -215,6 +240,8 @@ void OnOffApplication::SendPacket() void OnOffApplication::ConnectionSucceeded(Ptr) { + NS_DEBUG("OnOffApplication::ConnectionSucceeded ()"); + m_connected = true; ScheduleStartEvent(); } diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index f7506c59b..8ccadb05e 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -17,7 +17,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Author: George F. Riley -// Craig Dowell // #include "ns3/packet.h" @@ -121,17 +120,24 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) m_identification (0), m_node (node) { + NS_DEBUG("Ipv4L3Protocol::Ipv4L3Protocol ()"); + SetInterfaceId (Ipv4L3Protocol::iid); m_staticRouting = Create (); AddRoutingProtocol (m_staticRouting, 0); SetupLoopback (); } + Ipv4L3Protocol::~Ipv4L3Protocol () -{} +{ + NS_DEBUG("Ipv4L3Protocol::~Ipv4L3Protocol ()"); +} void Ipv4L3Protocol::DoDispose (void) { + NS_DEBUG("Ipv4L3Protocol::DoDispose ()"); + for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -147,6 +153,8 @@ Ipv4L3Protocol::DoDispose (void) void Ipv4L3Protocol::SetupLoopback (void) { + NS_DEBUG("Ipv4L3Protocol::SetupLoopback ()"); + Ipv4LoopbackInterface * interface = new Ipv4LoopbackInterface (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); @@ -158,6 +166,8 @@ Ipv4L3Protocol::SetupLoopback (void) TraceResolver * Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) { + NS_DEBUG("Ipv4L3Protocol::CreateTraceResolver ()"); + CompositeTraceResolver *resolver = new CompositeTraceResolver (context); resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); @@ -170,6 +180,8 @@ Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) TraceResolver * Ipv4L3Protocol::InterfacesCreateTraceResolver (TraceContext const &context) const { + NS_DEBUG("Ipv4L3Protocol::InterfacesCreateTraceResolver ()"); + ArrayTraceResolver *resolver = new ArrayTraceResolver (context, @@ -181,6 +193,7 @@ Ipv4L3Protocol::InterfacesCreateTraceResolver (TraceContext const &context) cons void Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl) { + NS_DEBUG("Ipv4L3Protocol::SetDefaultTtl ()"); m_defaultTtl = ttl; } @@ -190,20 +203,28 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { + NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << nextHop << + ", " << interface << ")"); m_staticRouting->AddHostRouteTo (dest, nextHop, interface); } + void Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, uint32_t interface) { + NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << + interface << ")"); m_staticRouting->AddHostRouteTo (dest, interface); } + void Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface) { + NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << + networkMask << ", " << nextHop << ", " << interface << ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, nextHop, interface); } void @@ -211,26 +232,33 @@ Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface) { + NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << + networkMask << ", " << interface << ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, interface); } void Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) { + NS_DEBUG("Ipv4L3Protocol::SetDefaultRoute (" << nextHop << ", " << + interface << ")"); m_staticRouting->SetDefaultRoute (nextHop, interface); } - void Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { + NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << ", " << &packet << + &routeReply << ")"); + for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); rprotoIter++) { + NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting route"); if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) return; } @@ -243,6 +271,8 @@ void Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, int priority) { + NS_DEBUG("Ipv4L3Protocol::AddRoutingProtocol (" << &routingProtocol << + ", " << priority << ")"); m_routingProtocols.push_back (std::pair > (-priority, routingProtocol)); m_routingProtocols.sort (); @@ -251,18 +281,21 @@ Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, uint32_t Ipv4L3Protocol::GetNRoutes (void) { + NS_DEBUG("Ipv4L3Protocol::GetNRoutes ()"); return m_staticRouting->GetNRoutes (); } Ipv4Route * Ipv4L3Protocol::GetRoute (uint32_t index) { + NS_DEBUG("Ipv4L3Protocol::GetRoute ()"); return m_staticRouting->GetRoute (index); } void Ipv4L3Protocol::RemoveRoute (uint32_t index) { + NS_DEBUG("Ipv4L3Protocol::RemoveRoute (" << index << ")"); m_staticRouting->RemoveRoute (index); } @@ -272,6 +305,9 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, uint32_t inputInterface, std::vector outputInterfaces) { + NS_DEBUG("Ipv4L3Protocol::AddMulticastRoute (" << origin << ", " << + group << ", " << inputInterface << ", " << &outputInterfaces << ")"); + m_staticRouting->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); } @@ -279,12 +315,14 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, uint32_t Ipv4L3Protocol::GetNMulticastRoutes (void) const { + NS_DEBUG("Ipv4L3Protocol::GetNMulticastRoutes ()"); return m_staticRouting->GetNMulticastRoutes (); } Ipv4MulticastRoute * Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const { + NS_DEBUG("Ipv4L3Protocol::GetMulticastRoute (" << index << ")"); return m_staticRouting->GetMulticastRoute (index); } @@ -293,32 +331,40 @@ Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface) { + NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << origin << ", " << + group << ", " << inputInterface << ")"); m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); } void Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) { + NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << index << ")"); m_staticRouting->RemoveMulticastRoute (index); } uint32_t Ipv4L3Protocol::AddInterface (Ptr device) { + NS_DEBUG("Ipv4L3Protocol::AddInterface (" << &device << ")"); Ipv4Interface *interface = new ArpIpv4Interface (m_node, device); return AddIpv4Interface (interface); } + uint32_t Ipv4L3Protocol::AddIpv4Interface (Ipv4Interface *interface) { + NS_DEBUG("Ipv4L3Protocol::AddIpv4Interface (" << interface << ")"); uint32_t index = m_nInterfaces; m_interfaces.push_back (interface); m_nInterfaces++; return index; } + Ipv4Interface * Ipv4L3Protocol::GetInterface (uint32_t index) const { + NS_DEBUG("Ipv4L3Protocol::GetInterface (" << index << ")"); uint32_t tmp = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -330,15 +376,18 @@ Ipv4L3Protocol::GetInterface (uint32_t index) const } return 0; } + uint32_t Ipv4L3Protocol::GetNInterfaces (void) const { + NS_DEBUG("Ipv4L3Protocol::GetNInterface ()"); return m_nInterfaces; } Ipv4Interface * Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) { + NS_DEBUG("Ipv4L3Protocol::FindInterfaceForDevice (" << &device << ")"); for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { if ((*i)->GetDevice () == device) @@ -352,6 +401,9 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) void Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) { + NS_DEBUG("Ipv4L3Protocol::Receive (" << &device << ", " << &p << ", " << + protocol << ", " << from << ")"); + uint32_t index = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -386,6 +438,9 @@ Ipv4L3Protocol::Send (Packet const &packet, Ipv4Address destination, uint8_t protocol) { + NS_DEBUG("Ipv4L3Protocol::Send (" << &packet << ", " << source << ", " << + ", " << destination << ", " << protocol << ")"); + Ipv4Header ipHeader; ipHeader.SetSource (source); @@ -434,6 +489,9 @@ Ipv4L3Protocol::SendRealOut (bool found, Packet packet, Ipv4Header const &ipHeader) { + NS_DEBUG("Ipv4L3Protocol::SendRealOut (" << found << ", " << &route << + ", " << &packet << &ipHeader << ")"); + if (!found) { NS_DEBUG ("no route to host. drop."); @@ -458,6 +516,9 @@ Ipv4L3Protocol::SendRealOut (bool found, bool Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) { + NS_DEBUG("Ipv4L3Protocol::Forwarding (" << &packet << ", " << &ipHeader << + ", " << device << ")"); + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -529,6 +590,7 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); @@ -537,6 +599,8 @@ Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) void Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) { + NS_DEBUG("Ipv4L3Protocol::JoinMulticastGroup (" << origin << ", " << + group << ")"); m_multicastGroups.push_back( std::pair (origin, group)); } @@ -544,6 +608,9 @@ Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) void Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) { + NS_DEBUG("Ipv4L3Protocol::LeaveMulticastGroup (" << origin << ", " << + group << ")"); + for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); i != m_multicastGroups.end (); i++) @@ -559,42 +626,55 @@ Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) void Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) { + NS_DEBUG("Ipv4L3Protocol::SetAddress (" << i << ", " << address << ")"); Ipv4Interface *interface = GetInterface (i); interface->SetAddress (address); } + void Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) { + NS_DEBUG("Ipv4L3Protocol::SetNetworkMask (" << i << ", " << mask << ")"); Ipv4Interface *interface = GetInterface (i); interface->SetNetworkMask (mask); } + Ipv4Mask Ipv4L3Protocol::GetNetworkMask (uint32_t i) const { + NS_DEBUG("Ipv4L3Protocol::GetNetworkMask (" << i << ")"); Ipv4Interface *interface = GetInterface (i); return interface->GetNetworkMask (); } + Ipv4Address Ipv4L3Protocol::GetAddress (uint32_t i) const { + NS_DEBUG("Ipv4L3Protocol::GetAddress (" << i << ")"); Ipv4Interface *interface = GetInterface (i); return interface->GetAddress (); } + uint16_t Ipv4L3Protocol::GetMtu (uint32_t i) const { + NS_DEBUG("Ipv4L3Protocol::GetMtu (" << i << ")"); Ipv4Interface *interface = GetInterface (i); return interface->GetMtu (); } + bool Ipv4L3Protocol::IsUp (uint32_t i) const { + NS_DEBUG("Ipv4L3Protocol::IsUp (" << i << ")"); Ipv4Interface *interface = GetInterface (i); return interface->IsUp (); } + void Ipv4L3Protocol::SetUp (uint32_t i) { + NS_DEBUG("Ipv4L3Protocol::SetUp (" << i << ")"); Ipv4Interface *interface = GetInterface (i); interface->SetUp (); @@ -608,9 +688,11 @@ Ipv4L3Protocol::SetUp (uint32_t i) interface->GetNetworkMask (), i); } } + void Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) { + NS_DEBUG("Ipv4L3Protocol::SetDown (" << ifaceIndex << ")"); Ipv4Interface *interface = GetInterface (ifaceIndex); interface->SetDown (); diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 27962bd40..a7cc93bac 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -18,11 +18,13 @@ // // Author: George F. Riley // Gustavo Carneiro -// Craig Dowell +#include "ns3/debug.h" #include "ipv4-static-routing.h" #include "ns3/packet.h" +NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); + namespace ns3 { @@ -31,10 +33,12 @@ Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { + Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface); m_hostRoutes.push_back (route); } + void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, uint32_t interface) @@ -43,6 +47,7 @@ Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, *route = Ipv4Route::CreateHostRouteTo (dest, interface); m_hostRoutes.push_back (route); } + void Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, @@ -56,6 +61,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, interface); m_networkRoutes.push_back (route); } + void Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, @@ -67,6 +73,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, interface); m_networkRoutes.push_back (route); } + void Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) @@ -197,7 +204,8 @@ Ipv4StaticRouting::LookupStatic ( i++) { Ipv4MulticastRoute *route = *i; - if (origin == route->GetOrigin () && + if ( (origin == route->GetOrigin () || + origin == Ipv4Address::GetAny ()) && group == route->GetGroup ()) { return *i; @@ -309,6 +317,15 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, Packet packet, RouteReplyCallback routeReply) { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << + &packet << ", " << &routeReply << ")"); + + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): source = " << + ipHeader.GetSource ()); + + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << + ipHeader.GetDestination ()); + // // First, see if this is a multicast packet we have a route for. If we // have a route, then send the packet down each of the specified interfaces. diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index f0ef8569b..2626866b8 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -19,6 +19,7 @@ * Author: Mathieu Lacage */ +#include "ns3/debug.h" #include "ns3/assert.h" #include "ns3/packet.h" #include "ns3/empty-trace-resolver.h" @@ -31,6 +32,8 @@ #include "ipv4-l3-protocol.h" #include "udp-socket.h" +NS_DEBUG_COMPONENT_DEFINE ("UdpL4Protocol"); + namespace ns3 { /* see http://www.iana.org/assignments/protocol-numbers */ @@ -40,20 +43,26 @@ UdpL4Protocol::UdpL4Protocol (Ptr node) : Ipv4L4Protocol (PROT_NUMBER, 2), m_node (node), m_endPoints (new Ipv4EndPointDemux ()) -{} +{ + NS_DEBUG("UdpL4Protocol::UdpL4Protocol ()"); +} UdpL4Protocol::~UdpL4Protocol () -{} +{ + NS_DEBUG("UdpL4Protocol::~UdpL4Protocol ()"); +} TraceResolver * UdpL4Protocol::CreateTraceResolver (TraceContext const &context) { + NS_DEBUG("UdpL4Protocol::CreateTraceResolver ()"); return new EmptyTraceResolver (context); } void UdpL4Protocol::DoDispose (void) { + NS_DEBUG("UdpL4Protocol::DoDispose ()"); if (m_endPoints != 0) { delete m_endPoints; @@ -66,6 +75,7 @@ UdpL4Protocol::DoDispose (void) Ptr UdpL4Protocol::CreateSocket (void) { + NS_DEBUG("UdpL4Protocol::CreateSocket ()"); Ptr socket = Create (m_node, this); return socket; } @@ -73,27 +83,36 @@ UdpL4Protocol::CreateSocket (void) Ipv4EndPoint * UdpL4Protocol::Allocate (void) { + NS_DEBUG("UdpL4Protocol::Allocate ()"); return m_endPoints->Allocate (); } + Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address) { + NS_DEBUG("UdpL4Protocol::Allocate (" << address << ")"); return m_endPoints->Allocate (address); } + Ipv4EndPoint * UdpL4Protocol::Allocate (uint16_t port) { + NS_DEBUG("UdpL4Protocol::Allocate (" << port << ")"); return m_endPoints->Allocate (port); } + Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address, uint16_t port) { + NS_DEBUG("UdpL4Protocol::Allocate (" << address << ", " << port << ")"); return m_endPoints->Allocate (address, port); } Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) { + NS_DEBUG("UdpL4Protocol::Allocate (" << localAddress << ", " << localPort << + ", " << peerAddress << ", " << peerPort << ")"); return m_endPoints->Allocate (localAddress, localPort, peerAddress, peerPort); } @@ -101,6 +120,7 @@ UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, void UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) { + NS_DEBUG("UdpL4Protocol::Deallocate (" << endPoint << ")"); m_endPoints->DeAllocate (endPoint); } @@ -109,6 +129,9 @@ UdpL4Protocol::Receive(Packet& packet, Ipv4Address const &source, Ipv4Address const &destination) { + NS_DEBUG("UdpL4Protocol::Receive (" << &packet << ", " << source << + ", " << destination << ")"); + UdpHeader udpHeader; packet.RemoveHeader (udpHeader); Ipv4EndPointDemux::EndPoints endPoints = @@ -126,6 +149,9 @@ UdpL4Protocol::Send (Packet packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) { + NS_DEBUG("UdpL4Protocol::Send (" << &packet << ", " << saddr << + ", " << daddr << ", " << sport << ", " << dport << ")"); + UdpHeader udpHeader; udpHeader.SetDestination (dport); udpHeader.SetSource (sport); @@ -139,6 +165,7 @@ UdpL4Protocol::Send (Packet packet, Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); if (ipv4 != 0) { + NS_DEBUG("UdpL4Protocol::Send (): Sending to IP"); ipv4->Send (packet, saddr, daddr, PROT_NUMBER); } } diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index a2bde3224..1442e1d11 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -18,6 +18,8 @@ * * Author: Mathieu Lacage */ + +#include "ns3/debug.h" #include "ns3/node.h" #include "ns3/inet-socket-address.h" #include "udp-socket.h" @@ -25,6 +27,8 @@ #include "ipv4-end-point.h" #include "ipv4-l4-demux.h" +NS_DEBUG_COMPONENT_DEFINE ("UdpSocket"); + namespace ns3 { UdpSocket::UdpSocket (Ptr node, Ptr udp) @@ -35,9 +39,14 @@ UdpSocket::UdpSocket (Ptr node, Ptr udp) m_shutdownSend (false), m_shutdownRecv (false), m_connected (false) -{} +{ + NS_DEBUG("UdpSocket::UdpSocket ()"); +} + UdpSocket::~UdpSocket () { + NS_DEBUG("UdpSocket::~UdpSocket ()"); + m_node = 0; if (m_endPoint != 0) { @@ -60,25 +69,32 @@ UdpSocket::~UdpSocket () enum Socket::SocketErrno UdpSocket::GetErrno (void) const { + NS_DEBUG("UdpSocket::GetErrno ()"); + return m_errno; } Ptr UdpSocket::GetNode (void) const { + NS_DEBUG("UdpSocket::GetNode ()"); return m_node; } void UdpSocket::Destroy (void) { + NS_DEBUG("UdpSocket::Destroy ()"); m_node = 0; m_endPoint = 0; m_udp = 0; } + int UdpSocket::FinishBind (void) { + NS_DEBUG("UdpSocket::FinishBind ()"); + if (m_endPoint == 0) { return -1; @@ -91,14 +107,20 @@ UdpSocket::FinishBind (void) int UdpSocket::Bind (void) { + NS_DEBUG("UdpSocket::Bind ()"); + m_endPoint = m_udp->Allocate (); return FinishBind (); } + int UdpSocket::Bind (const Address &address) { + NS_DEBUG("UdpSocket::Bind (" << address << ")"); + if (!InetSocketAddress::IsMatchingType (address)) { + NS_DEBUG("UdpSocket::Bind (): Not IsMatchingType"); return ERROR_INVAL; } InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -127,12 +149,15 @@ UdpSocket::Bind (const Address &address) int UdpSocket::ShutdownSend (void) { + NS_DEBUG("UdpSocket::ShutDownSend ()"); m_shutdownSend = true; return 0; } + int UdpSocket::ShutdownRecv (void) { + NS_DEBUG("UdpSocket::ShutDownRecv ()"); m_shutdownRecv = false; return 0; } @@ -140,6 +165,7 @@ UdpSocket::ShutdownRecv (void) int UdpSocket::Close(void) { + NS_DEBUG("UdpSocket::Close ()"); NotifyCloseCompleted (); return 0; } @@ -147,6 +173,8 @@ UdpSocket::Close(void) int UdpSocket::Connect(const Address & address) { + NS_DEBUG("UdpSocket::Connect (" << address << ")"); + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); m_defaultPort = transport.GetPort (); @@ -154,9 +182,12 @@ UdpSocket::Connect(const Address & address) m_connected = true; return 0; } + int UdpSocket::Send (const Packet &p) { + NS_DEBUG("UdpSocket::Send (" << &p << ")"); + if (!m_connected) { m_errno = ERROR_NOTCONN; @@ -164,17 +195,23 @@ UdpSocket::Send (const Packet &p) } return DoSendTo (p, m_defaultAddress, m_defaultPort); } + int UdpSocket::DoSendTo (const Packet &p, const Address &address) { + NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << address << ")"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); return DoSendTo (p, ipv4, port); } + int UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) { + NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << ipv4 << ", " << + port << ")"); + if (m_endPoint == 0) { if (Bind () == -1) @@ -189,14 +226,18 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) m_errno = ERROR_SHUTDOWN; return -1; } + + NS_DEBUG("UdpSocket::DoSendTo (): Send to UDP"); m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, m_endPoint->GetLocalPort (), port); NotifyDataSent (p.GetSize ()); return 0; } + int UdpSocket::SendTo(const Address &address, const Packet &p) { + NS_DEBUG("UdpSocket::SendTo (" << address << ", " << &p << ")"); if (m_connected) { m_errno = ERROR_ISCONN; @@ -211,6 +252,9 @@ UdpSocket::SendTo(const Address &address, const Packet &p) void UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) { + NS_DEBUG("UdpSocket::ForwardUp (" << &packet << ", " << ipv4 << ", " << + port << ")"); + if (m_shutdownRecv) { return; From 6520f1335aba7ddca75002f1b41331da5eca1f2e Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sun, 12 Aug 2007 22:41:24 -0700 Subject: [PATCH 037/218] many debug prints --- examples/csma-multicast.cc | 13 +++++- examples/csma-one-subnet.cc | 43 +++++++++++++++--- examples/simple-point-to-point.cc | 48 ++++++++++++++++---- src/devices/csma/csma-ipv4-topology.cc | 44 +++++++++--------- src/internet-node/arp-ipv4-interface.cc | 28 ++++++++++-- src/internet-node/ipv4-interface.cc | 40 +++++++++++++--- src/internet-node/ipv4-l3-protocol.cc | 35 ++++++++++---- src/internet-node/ipv4-loopback-interface.cc | 24 ++++++++-- src/internet-node/ipv4-static-routing.cc | 6 ++- 9 files changed, 213 insertions(+), 68 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 19e01be7e..207d611b9 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -67,17 +67,23 @@ main (int argc, char *argv[]) // for selected modules; the below lines suggest how to do this #if 0 DebugComponentEnable("Me"); + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("NetDevice"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); DebugComponentEnable("PacketSocket"); DebugComponentEnable("OnOffApplication"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); #endif DebugComponentEnable("Me"); @@ -88,6 +94,9 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4StaticRouting"); DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index dc1bd58c0..033a0135d 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -58,24 +58,48 @@ #include "ns3/ipv4-route.h" #include "ns3/onoff-application.h" - using namespace ns3; +NS_DEBUG_COMPONENT_DEFINE ("Me"); -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { - // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 + DebugComponentEnable("Me"); + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("NetDevice"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); DebugComponentEnable("PacketSocket"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); #endif + DebugComponentEnable("Me"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -90,16 +114,19 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_DEBUG("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information + NS_DEBUG("Create channels."); Ptr channel0 = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); + NS_DEBUG("Build Topology."); uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, Eui48Address("10:54:23:54:23:50")); uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, @@ -110,6 +137,7 @@ int main (int argc, char *argv[]) Eui48Address("10:54:23:54:23:53")); // Later, we add IP addresses. + NS_DEBUG("Assign IP Addresses."); CsmaIpv4Topology::AddIpv4Address ( n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); @@ -125,6 +153,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s // from n0 to n1 + NS_DEBUG("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.1.2", 80), @@ -148,6 +177,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-one-subnet.tr file + NS_DEBUG("Configure Tracing."); AsciiTrace asciitrace ("csma-one-subnet.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); @@ -160,7 +190,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("csma-one-subnet.pcap"); pcaptrace.TraceAllIp (); + NS_DEBUG("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_DEBUG("Done."); } diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 9b185143b..14838a18e 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -38,11 +38,7 @@ // - Tracing of queues and packet receptions to file // "simple-point-to-point.tr" -#include -#include -#include -#include - +#include "ns3/debug.h" #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" @@ -67,20 +63,47 @@ using namespace ns3; -int main (int argc, char *argv[]) +NS_DEBUG_COMPONENT_DEFINE ("Me"); + +int +main (int argc, char *argv[]) { // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 + DebugComponentEnable("Me"); DebugComponentEnable("Object"); DebugComponentEnable("Queue"); DebugComponentEnable("DropTailQueue"); DebugComponentEnable("Channel"); DebugComponentEnable("PointToPointChannel"); DebugComponentEnable("PointToPointNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("PacketSocket"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); #endif + DebugComponentEnable("Me"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("PointToPointChannel"); + DebugComponentEnable("PointToPointNetDevice"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -100,12 +123,14 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_DEBUG("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information + NS_DEBUG("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate(5000000), MilliSeconds(2)); @@ -119,6 +144,7 @@ int main (int argc, char *argv[]) n2, n3, DataRate(1500000), MilliSeconds(10)); // Later, we add IP addresses. + NS_DEBUG("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address("10.1.1.1"), n2, Ipv4Address("10.1.1.2")); @@ -135,13 +161,14 @@ int main (int argc, char *argv[]) // NetDevice creation, IP Address assignment, and routing) are // separated because there may be a need to postpone IP Address // assignment (emulation) or modify to use dynamic routing + NS_DEBUG("Add Static Routes."); PointToPointTopology::AddIpv4Routes(n0, n2, channel0); PointToPointTopology::AddIpv4Routes(n1, n2, channel1); PointToPointTopology::AddIpv4Routes(n2, n3, channel2); - // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_DEBUG("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.3.2", 80), @@ -165,6 +192,7 @@ int main (int argc, char *argv[]) // Here, finish off packet routing configuration // This will likely set by some global StaticRouting object in the future + NS_DEBUG("Set Default Routes."); Ptr ipv4; ipv4 = n0->QueryInterface (Ipv4::iid); ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1); @@ -173,6 +201,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-point-to-point.tr file + NS_DEBUG("Configure Tracing."); AsciiTrace asciitrace ("simple-point-to-point.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -185,7 +214,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("simple-point-to-point.pcap"); pcaptrace.TraceAllIp (); - Simulator::Run (); - + NS_DEBUG("Run Simulation."); + Simulator::Run (); Simulator::Destroy (); + NS_DEBUG("Done."); } diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 02cd0e487..8e102af0b 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -36,15 +36,15 @@ namespace ns3 { uint32_t CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) + Ptr ch, + Eui48Address addr) { Ptr q = Queue::CreateDefault (); // assume full-duplex Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::IP_ARP, - true, true); + ns3::CsmaNetDevice::IP_ARP, + true, true); nd0->AddQueue(q); nd0->Attach (ch); return nd0->GetIfIndex (); @@ -53,51 +53,50 @@ CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, void CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) + Ptr ch, + Eui48Address addr) { Ptr q = Queue::CreateDefault (); Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::LLC, - true, false); + ns3::CsmaNetDevice::LLC, + true, false); nd0->AddQueue(q); nd0->Attach (ch); Ptr nd1 = Create (n1, addr, - ns3::CsmaNetDevice::LLC, - false, true); + ns3::CsmaNetDevice::LLC, + false, true); nd1->AddQueue(q); nd1->Attach (ch); } void CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) + Ptr ch, + Eui48Address addr) { Ptr q = Queue::CreateDefault (); Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::RAW, - true, false); + ns3::CsmaNetDevice::RAW, + true, false); nd0->AddQueue(q); nd0->Attach (ch); Ptr nd1 = Create (n1, addr, - ns3::CsmaNetDevice::RAW, - false, true); + ns3::CsmaNetDevice::RAW, + false, true); nd1->AddQueue(q); nd1->Attach (ch); } void CsmaIpv4Topology::AddIpv4Address(Ptr n1, - int ndNum, - const Ipv4Address& addr1, - const Ipv4Mask& netmask1) + int ndNum, + const Ipv4Address& addr1, + const Ipv4Mask& netmask1) { - // Duplex link is assumed to be subnetted as a /30 // May run this unnumbered in the future? Ipv4Mask netmask(netmask1); @@ -110,7 +109,6 @@ CsmaIpv4Topology::AddIpv4Address(Ptr n1, ip1->SetAddress (index1, addr1); ip1->SetNetworkMask (index1, netmask); ip1->SetUp (index1); - } void @@ -133,7 +131,7 @@ CsmaIpv4Topology::AddIpv4Routes ( found = true; } } - NS_ASSERT(found); + NS_ASSERT (found); uint32_t index2 = 0; found = false; @@ -145,7 +143,7 @@ CsmaIpv4Topology::AddIpv4Routes ( found = true; } } - NS_ASSERT(found); + NS_ASSERT (found); ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index efe767531..2e9d375b7 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -31,18 +31,26 @@ #include "ipv4-l3-protocol.h" #include "arp-l3-protocol.h" +NS_DEBUG_COMPONENT_DEFINE ("ArpIpv4Interface"); + namespace ns3 { ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) : Ipv4Interface (device), m_node (node) -{} +{ + NS_DEBUG ("ArpIpv4Interface::ArpIpv4Interface ()"); +} + ArpIpv4Interface::~ArpIpv4Interface () -{} +{ + NS_DEBUG ("ArpIpv4Interface::~ArpIpv4Interface ()"); +} TraceResolver * ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) { + NS_DEBUG ("ArpIpv4Interface::DoCreateTraceResolver ()"); CompositeTraceResolver *resolver = new CompositeTraceResolver (context); if (GetDevice () != 0) { @@ -56,31 +64,41 @@ ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) void ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) { + NS_DEBUG ("ArpIpv4Interface::SendTo (" << &p << ", " << dest << ")"); + NS_ASSERT (GetDevice () != 0); if (GetDevice ()->NeedsArp ()) { - Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); + NS_DEBUG ("ArpIpv4Interface::SendTo (): Needs ARP"); + Ptr arp = + m_node->QueryInterface (ArpL3Protocol::iid); Address hardwareDestination; bool found; if (dest.IsBroadcast ()) { + NS_DEBUG ("ArpIpv4Interface::SendTo (): IsBroadcast"); hardwareDestination = GetDevice ()->GetBroadcast (); found = true; } else { + NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup"); found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination); } if (found) { - GetDevice ()->Send (p, hardwareDestination, Ipv4L3Protocol::PROT_NUMBER); + NS_DEBUG ("ArpIpv4Interface::SendTo (): Address Resolved. Send."); + GetDevice ()->Send (p, hardwareDestination, + Ipv4L3Protocol::PROT_NUMBER); } } else { - GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4L3Protocol::PROT_NUMBER); + NS_DEBUG ("ArpIpv4Interface::SendTo (): Doesn't need ARP"); + GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), + Ipv4L3Protocol::PROT_NUMBER); } } diff --git a/src/internet-node/ipv4-interface.cc b/src/internet-node/ipv4-interface.cc index cfc398582..c22a1e783 100644 --- a/src/internet-node/ipv4-interface.cc +++ b/src/internet-node/ipv4-interface.cc @@ -22,6 +22,9 @@ #include "ipv4-interface.h" #include "ns3/ipv4-address.h" #include "ns3/net-device.h" +#include "ns3/debug.h" + +NS_DEBUG_COMPONENT_DEFINE ("Ipv4Interface"); namespace ns3 { @@ -34,56 +37,72 @@ namespace ns3 { Ipv4Interface::Ipv4Interface (Ptr nd) : m_netdevice (nd), m_ifup(false) -{} +{ + NS_DEBUG ("Ipv4Interface::Ipv4Interface (" << &nd << ")"); +} Ipv4Interface::~Ipv4Interface () -{} +{ + NS_DEBUG ("Ipv4Interface::~Ipv4Interface ()"); +} Ptr Ipv4Interface::GetDevice (void) const { + NS_DEBUG ("Ipv4Interface::GetDevice ()"); return m_netdevice; } TraceResolver * Ipv4Interface::CreateTraceResolver (TraceContext const &context) { + NS_DEBUG ("Ipv4Interface::CreateTraceResolver (" << &context << ")"); return DoCreateTraceResolver (context); } void Ipv4Interface::SetAddress (Ipv4Address a) { + NS_DEBUG ("Ipv4Interface::SetAddress (" << a << ")"); m_address = a; } + void Ipv4Interface::SetNetworkMask (Ipv4Mask mask) { + NS_DEBUG ("Ipv4Interface::SetMask (" << mask << ")"); m_netmask = mask; } Ipv4Address Ipv4Interface::GetBroadcast (void) const { + NS_DEBUG ("Ipv4Interface::GetBroadcast ()"); + uint32_t mask = m_netmask.GetHostOrder (); uint32_t address = m_address.GetHostOrder (); Ipv4Address broadcast = Ipv4Address (address | (~mask)); return broadcast; } + Ipv4Mask Ipv4Interface::GetNetworkMask (void) const { + NS_DEBUG ("Ipv4Interface::GetNetworkMask ()"); return m_netmask; } + Ipv4Address Ipv4Interface::GetAddress (void) const { + NS_DEBUG ("Ipv4Interface::Address ()"); return m_address; } uint16_t Ipv4Interface::GetMtu (void) const { + NS_DEBUG ("Ipv4Interface::GetMtu ()"); if (m_netdevice == 0) { uint32_t mtu = (1<<16) - 1; @@ -92,32 +111,36 @@ Ipv4Interface::GetMtu (void) const return m_netdevice->GetMtu (); } - /** - * These are IP interface states and may be distinct from - * NetDevice states, such as found in real implementations - * (where the device may be down but IP interface state is still up). - */ +/** + * These are IP interface states and may be distinct from + * NetDevice states, such as found in real implementations + * (where the device may be down but IP interface state is still up). + */ bool Ipv4Interface::IsUp (void) const { + NS_DEBUG ("Ipv4Interface::IsUp ()"); return m_ifup; } bool Ipv4Interface::IsDown (void) const { + NS_DEBUG ("Ipv4Interface::IsDown ()"); return !m_ifup; } void Ipv4Interface::SetUp (void) { + NS_DEBUG ("Ipv4Interface::SetUp ()"); m_ifup = true; } void Ipv4Interface::SetDown (void) { + NS_DEBUG ("Ipv4Interface::SetDown ()"); m_ifup = false; } @@ -125,7 +148,10 @@ Ipv4Interface::SetDown (void) void Ipv4Interface::Send(Packet p, Ipv4Address dest) { + NS_DEBUG ("Ipv4Interface::Send ()"); + if (IsUp()) { + NS_DEBUG ("Ipv4Interface::Send (): SendTo ()"); SendTo(p, dest); } } diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 8ccadb05e..d140febe0 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -494,25 +494,32 @@ Ipv4L3Protocol::SendRealOut (bool found, if (!found) { - NS_DEBUG ("no route to host. drop."); + NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): No route to host. Drop."); m_dropTrace (packet); return; } + + NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send via interface " << + route.GetInterface ()); + packet.AddHeader (ipHeader); Ipv4Interface *outInterface = GetInterface (route.GetInterface ()); NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); m_txTrace (packet, route.GetInterface ()); if (route.IsGateway ()) { + NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to gateway " << + route.GetGateway ()); outInterface->Send (packet, route.GetGateway ()); } else { + NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to destination " << + ipHeader.GetDestination ()); outInterface->Send (packet, ipHeader.GetDestination ()); } } - bool Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) { @@ -524,7 +531,8 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, PtrGetAddress ().IsEqual (ipHeader.GetDestination ())) { - NS_DEBUG ("for me 1"); + NS_DEBUG("Ipv4L3Protocol::Forwarding (): " + "For me (destination match)"); return false; } } @@ -537,7 +545,8 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, PtrGetBroadcast ())) { - NS_DEBUG ("for me 2"); + NS_DEBUG("Ipv4L3Protocol::Forwarding (): " + "For me (interface broadcast address)"); return false; } break; @@ -546,25 +555,30 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr, */ + +#include "ns3/debug.h" #include "ns3/empty-trace-resolver.h" #include "ns3/net-device.h" #include "ns3/node.h" @@ -26,26 +28,40 @@ #include "ipv4-loopback-interface.h" #include "ipv4-l3-protocol.h" +NS_DEBUG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); + namespace ns3 { Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) : Ipv4Interface (0), m_node (node) -{} +{ + NS_DEBUG("Ipv4LoopbackInterface::Ipv4LoopbackInterface ()"); +} + Ipv4LoopbackInterface::~Ipv4LoopbackInterface () -{} +{ + NS_DEBUG("Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()"); +} TraceResolver * Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context) { + NS_DEBUG("Ipv4LoopbackInterface::DoCreateTraceResolver ()"); return new EmptyTraceResolver (context); } void Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) { - Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); - ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, Eui48Address ("ff:ff:ff:ff:ff:ff")); + NS_DEBUG("Ipv4LoopbackInterface::SendTo (" << &packet << ", " << + dest << ")"); + + Ptr ipv4 = + m_node->QueryInterface (Ipv4L3Protocol::iid); + + ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, + Eui48Address ("ff:ff:ff:ff:ff:ff")); } }//namespace ns3 diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index a7cc93bac..785e817ff 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -27,7 +27,6 @@ NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); namespace ns3 { - void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, @@ -325,7 +324,6 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << ipHeader.GetDestination ()); - // // First, see if this is a multicast packet we have a route for. If we // have a route, then send the packet down each of the specified interfaces. @@ -334,12 +332,15 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, ipHeader.GetDestination ()); if (mRoute) { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast route"); for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) { Packet p = packet; Ipv4Route route = Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), mRoute->GetOutputInterface(i)); + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " + "Send via interface " << mRoute->GetOutputInterface(i)); routeReply (true, route, p, ipHeader); return true; } @@ -347,6 +348,7 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, // // See if this is a unicast packet we have a route for. // + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast route"); Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); if (route != 0) { From b2ee3ded9b74360c258edba4c3eec929d35a4ee6 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 12:08:01 -0700 Subject: [PATCH 038/218] more multicast plumbing --- examples/csma-multicast.cc | 84 ++++++++++++++---------- src/applications/onoff-application.cc | 7 +- src/devices/csma/csma-ipv4-topology.cc | 28 ++++---- src/devices/csma/csma-ipv4-topology.h | 23 ++++--- src/internet-node/arp-ipv4-interface.cc | 8 +++ src/internet-node/ipv4-l3-protocol.cc | 45 +++++++++---- src/internet-node/ipv4-l3-protocol.h | 9 ++- src/internet-node/ipv4-static-routing.cc | 51 +++++++++----- src/internet-node/ipv4-static-routing.h | 6 +- src/node/ipv4-address.cc | 7 +- src/node/ipv4.h | 6 +- 11 files changed, 177 insertions(+), 97 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 207d611b9..3af6fc937 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -65,7 +65,7 @@ main (int argc, char *argv[]) { // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this -#if 0 +#if 0 DebugComponentEnable("Me"); DebugComponentEnable("Object"); DebugComponentEnable("Queue"); @@ -87,16 +87,9 @@ main (int argc, char *argv[]) #endif DebugComponentEnable("Me"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("UdpL4Protocol"); // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, @@ -125,29 +118,47 @@ main (int argc, char *argv[]) DataRate(5000000), MilliSeconds(2)); NS_DEBUG("Build Topology."); - uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, - Eui48Address("10:54:23:54:23:50")); - uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, - Eui48Address("10:54:23:54:23:51")); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, - Eui48Address("10:54:23:54:23:52")); - uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, - Eui48Address("10:54:23:54:23:53")); + uint32_t netDeviceNumberNode0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, + channel0, Eui48Address("10:54:23:54:23:50")); + uint32_t netDeviceNumberNode1 = CsmaIpv4Topology::AddIpv4CsmaNode (n1, + channel0, Eui48Address("10:54:23:54:23:51")); + uint32_t netDeviceNumberNode2 = CsmaIpv4Topology::AddIpv4CsmaNode (n2, + channel0, Eui48Address("10:54:23:54:23:52")); + uint32_t netDeviceNumberNode3 = CsmaIpv4Topology::AddIpv4CsmaNode (n3, + channel0, Eui48Address("10:54:23:54:23:53")); + + NS_DEBUG ("netDeviceNumberNode0 = " << netDeviceNumberNode0); + NS_DEBUG ("netDeviceNumberNode1 = " << netDeviceNumberNode1); + NS_DEBUG ("netDeviceNumberNode2 = " << netDeviceNumberNode2); + NS_DEBUG ("netDeviceNumberNode3 = " << netDeviceNumberNode3); // Later, we add IP addresses. NS_DEBUG("Assign IP Addresses."); + // XXX BUGBUG + // Need a better way to get the interface index. The point-to-point topology + // as implemented can't return the index since it creates interfaces on both + // sides (i.e., AddIpv4Addresses, not AddIpv4Address). Need a method on + // Ipv4 to find the interface index corresponding to a given ipv4 address. + uint32_t ifIndexNode0 = CsmaIpv4Topology::AddIpv4Address (n0, + netDeviceNumberNode0, Ipv4Address ("10.1.1.1"), + Ipv4Mask ("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); + uint32_t ifIndexNode1 = CsmaIpv4Topology::AddIpv4Address (n1, + netDeviceNumberNode1, Ipv4Address ("10.1.1.2"), + Ipv4Mask ("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); - - CsmaIpv4Topology::AddIpv4Address ( - n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); + uint32_t ifIndexNode2 = CsmaIpv4Topology::AddIpv4Address (n2, + netDeviceNumberNode2, Ipv4Address ("10.1.1.3"), + Ipv4Mask ("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); + uint32_t ifIndexNode3 = CsmaIpv4Topology::AddIpv4Address (n3, + netDeviceNumberNode3, Ipv4Address ("10.1.1.4"), + Ipv4Mask ("255.255.255.0")); + + NS_DEBUG ("ifIndexNode0 = " << ifIndexNode0); + NS_DEBUG ("ifIndexNode1 = " << ifIndexNode1); + NS_DEBUG ("ifIndexNode2 = " << ifIndexNode2); + NS_DEBUG ("ifIndexNode3 = " << ifIndexNode3); // Configure multicasting NS_DEBUG("Configure multicasting."); @@ -158,22 +169,21 @@ main (int argc, char *argv[]) ipv4 = n0->QueryInterface (Ipv4::iid); std::vector outputInterfaces (1); - outputInterfaces[0] = n0ifIndex; + outputInterfaces[0] = ifIndexNode0; ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, outputInterfaces); ipv4 = n1->QueryInterface (Ipv4::iid); - ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ipv4 = n2->QueryInterface (Ipv4::iid); - ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ipv4 = n3->QueryInterface (Ipv4::iid); - ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); - // Create the OnOff application to send UDP datagrams of size - // 210 bytes at a rate of 448 Kb/s + // Create the OnOff application to send UDP datagrams // from n0 to the multicast group NS_DEBUG("Create Applications."); Ptr ooff = Create ( @@ -181,10 +191,12 @@ main (int argc, char *argv[]) InetSocketAddress (multicastGroup, 80), "Udp", ConstantVariable(1), - ConstantVariable(0)); + ConstantVariable(0), + DataRate ("128b/s"), + 128); // Start the application - ooff->Start(Seconds(1.0)); - ooff->Stop (Seconds(10.0)); + ooff->Start(Seconds(1.)); + ooff->Stop (Seconds(10.)); // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-one-subnet.tr file diff --git a/src/applications/onoff-application.cc b/src/applications/onoff-application.cc index 297d57e3e..9df4274bc 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff-application.cc @@ -199,9 +199,12 @@ void OnOffApplication::ScheduleNextTx() if (m_totBytes < m_maxBytes) { uint32_t bits = m_pktSize * 8 - m_residualBits; + NS_DEBUG("OnOffApplication::ScheduleNextTx (): bits = " << bits); Time nextTime(Seconds (bits / static_cast(m_cbrRate.GetBitRate()))); // Time till next packet - m_sendEvent = Simulator::Schedule(nextTime, &OnOffApplication::SendPacket, this); + NS_DEBUG("OnOffApplication::ScheduleNextTx (): nextTime = " << nextTime); + m_sendEvent = Simulator::Schedule(nextTime, + &OnOffApplication::SendPacket, this); } else { // All done, cancel any pending events @@ -214,6 +217,8 @@ void OnOffApplication::ScheduleStartEvent() NS_DEBUG("OnOffApplication::ScheduleStartEvent ()"); Time offInterval = Seconds(m_offTime->GetValue()); + NS_DEBUG("OnOffApplication::ScheduleStartEvent (): " + "start at " << offInterval); m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); } diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 8e102af0b..ff36b5502 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -91,24 +91,22 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, nd1->Attach (ch); } -void -CsmaIpv4Topology::AddIpv4Address(Ptr n1, - int ndNum, - const Ipv4Address& addr1, - const Ipv4Mask& netmask1) +uint32_t +CsmaIpv4Topology::AddIpv4Address( + Ptr node, + uint32_t netDeviceNumber, + const Ipv4Address address, + const Ipv4Mask mask) { - // Duplex link is assumed to be subnetted as a /30 - // May run this unnumbered in the future? - Ipv4Mask netmask(netmask1); + Ptr nd = node->GetDevice(netDeviceNumber); - Ptr nd1 = n1->GetDevice(ndNum); + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + uint32_t ifIndex = ipv4->AddInterface (nd); - Ptr ip1 = n1->QueryInterface (Ipv4::iid); - uint32_t index1 = ip1->AddInterface (nd1); - - ip1->SetAddress (index1, addr1); - ip1->SetNetworkMask (index1, netmask); - ip1->SetUp (index1); + ipv4->SetAddress (ifIndex, address); + ipv4->SetNetworkMask (ifIndex, mask); + ipv4->SetUp (ifIndex); + return ifIndex; } void diff --git a/src/devices/csma/csma-ipv4-topology.h b/src/devices/csma/csma-ipv4-topology.h index 37f546118..ca4aa982b 100644 --- a/src/devices/csma/csma-ipv4-topology.h +++ b/src/devices/csma/csma-ipv4-topology.h @@ -94,18 +94,23 @@ public: /** - * \param n1 Node - * \param ndNum NetDevice number with which to associate address - * \param addr1 Ipv4 Address for ndNum of n1 - * \param network network mask for ndNum of node n1 + * \brief Create an Ipv4 interface for a net device and assign an + * Ipv4Address to that interface. + * + * \param node The node to which to add the new address and corresponding + * interface. + * \param netDeviceNumber The NetDevice index number with which to associate + * the address. + * \param address The Ipv4 Address for the interface. + * \param network The network mask for the interface * * Add an Ipv4Address to the Ipv4 interface associated with the - * ndNum CsmaIpv4NetDevices on the provided - * CsmaIpv4Channel + * ndNum CsmaIpv4NetDevices on the provided CsmaIpv4Channel */ - static void AddIpv4Address(Ptr n1, int ndNum, - const Ipv4Address& addr1, - const Ipv4Mask& netmask1); + static uint32_t AddIpv4Address(Ptr node, + uint32_t netDeviceNumber, + const Ipv4Address address, + const Ipv4Mask mask); /** * \param nd1 Node diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 2e9d375b7..b5f87f0b6 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -81,6 +81,14 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) hardwareDestination = GetDevice ()->GetBroadcast (); found = true; } + else if (dest.IsMulticast ()) + { + NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast"); + // XXX BUGBUG + // Need real multicast addresses + hardwareDestination = GetDevice ()->GetBroadcast (); + found = true; + } else { NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup"); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index d140febe0..2326d1021 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -246,12 +246,26 @@ Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, } void -Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, - Packet packet, - Ipv4RoutingProtocol::RouteReplyCallback routeReply) +Ipv4L3Protocol::Lookup ( + Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) { - NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << ", " << &packet << - &routeReply << ")"); + NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << + ", " << &packet << &routeReply << ")"); + + Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply); +} + +void +Ipv4L3Protocol::Lookup ( + uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) +{ + NS_DEBUG("Ipv4L3Protocol::Lookup (" << ifIndex << ", " << &ipHeader << + ", " << &packet << &routeReply << ")"); for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); @@ -259,7 +273,8 @@ Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, rprotoIter++) { NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting route"); - if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) + if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet, + routeReply)) return; } @@ -405,7 +420,9 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc protocol << ", " << from << ")"); uint32_t index = 0; - for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++) { if ((*i)->GetDevice () == device) { @@ -423,7 +440,7 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc return; } - if (Forwarding (packet, ipHeader, device)) + if (Forwarding (index, packet, ipHeader, device)) { return; } @@ -521,10 +538,14 @@ Ipv4L3Protocol::SendRealOut (bool found, } bool -Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) +Ipv4L3Protocol::Forwarding ( + uint32_t ifIndex, + Packet const &packet, + Ipv4Header &ipHeader, + Ptr device) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (" << &packet << ", " << &ipHeader << - ", " << device << ")"); + NS_DEBUG("Ipv4L3Protocol::Forwarding (" << ifIndex << ", " << &packet << + ", " << &ipHeader << ", " << device << ")"); for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -579,7 +600,7 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); + bool Forwarding (uint32_t ifIndex, + Packet const &packet, + Ipv4Header &ipHeader, + Ptr device); void ForwardUp (Packet p, Ipv4Header const&ip); uint32_t AddIpv4Interface (Ipv4Interface *interface); void SetupLoopback (void); diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 785e817ff..e6e67b516 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -196,7 +196,8 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest) Ipv4MulticastRoute * Ipv4StaticRouting::LookupStatic ( Ipv4Address origin, - Ipv4Address group) + Ipv4Address group, + uint32_t ifIndex) { for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); @@ -207,7 +208,11 @@ Ipv4StaticRouting::LookupStatic ( origin == Ipv4Address::GetAny ()) && group == route->GetGroup ()) { - return *i; + if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || + ifIndex == route->GetInputInterface ()) + { + return *i; + } } } return 0; @@ -312,9 +317,11 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index) } bool -Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, - Packet packet, - RouteReplyCallback routeReply) +Ipv4StaticRouting::RequestRoute ( + uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + RouteReplyCallback routeReply) { NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << &packet << ", " << &routeReply << ")"); @@ -328,27 +335,35 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, // First, see if this is a multicast packet we have a route for. If we // have a route, then send the packet down each of the specified interfaces. // - Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), - ipHeader.GetDestination ()); - if (mRoute) + if (ipHeader.GetDestination ().IsMulticast ()) { - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast route"); - for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); + + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), + ipHeader.GetDestination (), ifIndex); + + if (mRoute) { - Packet p = packet; - Ipv4Route route = - Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), - mRoute->GetOutputInterface(i)); NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " - "Send via interface " << mRoute->GetOutputInterface(i)); - routeReply (true, route, p, ipHeader); - return true; + "Multicast route found"); + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; + Ipv4Route route = + Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), + mRoute->GetOutputInterface(i)); + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " + "Send via interface " << mRoute->GetOutputInterface(i)); + routeReply (true, route, p, ipHeader); + return true; + } } + return false; // Let other routing protocols try to handle this } // // See if this is a unicast packet we have a route for. // - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast route"); + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); if (route != 0) { diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 24a228048..76bb80c40 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -51,7 +51,8 @@ class Ipv4StaticRouting : public Ipv4RoutingProtocol public: Ipv4StaticRouting () : m_defaultRoute (0) {} - virtual bool RequestRoute (Ipv4Header const &ipHeader, + virtual bool RequestRoute (uint32_t ifIndex, + Ipv4Header const &ipHeader, Packet packet, RouteReplyCallback routeReply); @@ -105,7 +106,8 @@ private: typedef std::list::iterator MulticastRoutesI; Ipv4Route *LookupStatic (Ipv4Address dest); - Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group); + Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group, + uint32_t ifIndex); HostRoutes m_hostRoutes; NetworkRoutes m_networkRoutes; diff --git a/src/node/ipv4-address.cc b/src/node/ipv4-address.cc index 34b15372d..4e1e344c5 100644 --- a/src/node/ipv4-address.cc +++ b/src/node/ipv4-address.cc @@ -171,8 +171,11 @@ Ipv4Address::IsBroadcast (void) const bool Ipv4Address::IsMulticast (void) const { - // XXX - return false; +// +// Multicast addresses are defined as ranging from 224.0.0.0 through +// 239.255.255.255 (which is E0000000 through EFFFFFFF in hex). +// + return (m_address >= 0xe0000000 && m_address <= 0xefffffff); } uint32_t diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 06cf5c130..d56a70c70 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -70,6 +70,7 @@ public: /** * \brief Asynchronously requests a route for a given packet and IP header * + * \param ifIndex The interface index on which the packet was received. * \param ipHeader IP header of the packet * \param packet packet that is being sent or forwarded * \param routeReply callback that will receive the route reply @@ -99,9 +100,12 @@ public: * immediately after the IP header, although most routing do not * insert any extra header. */ - virtual bool RequestRoute (const Ipv4Header &ipHeader, + virtual bool RequestRoute (uint32_t ifIndex, + const Ipv4Header &ipHeader, Packet packet, RouteReplyCallback routeReply) = 0; + + static const uint32_t IF_INDEX_ANY = 0xffffffff; }; /** From 78c14ff326c8f11a4dfb911a625c35d38a62a8ad Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 14:58:06 -0700 Subject: [PATCH 039/218] cleanup. more complex multicast example --- examples/csma-multicast.cc | 278 ++++++++++++++++--------- examples/csma-one-subnet.cc | 181 +++++++++------- examples/mixed-global-routing.cc | 8 +- src/devices/csma/csma-ipv4-topology.cc | 19 +- src/devices/csma/csma-ipv4-topology.h | 6 +- 5 files changed, 297 insertions(+), 195 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 3af6fc937..ae4c3c4cf 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -16,31 +16,27 @@ // Network topology // -// n0 n1 n2 n3 -// | | | | -// ===================== +// Lan1 +// =========== +// | | | +// n0 n1 n2 n3 n4 +// | | | +// =========== +// Lan0 // -// - CBR/UDP flows from n0 to n1, and from n3 to n0 -// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. -// (i.e., DataRate of 448,000 bps) -// - DropTail queues -// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" - -#include -#include -#include -#include +// - Multicast source is at node n0; +// - Multicast forwarded by node n2 onto LAN1; +// - Nodes n0, n1, n2, n3, and n4 receive the multicast frame. +// - Node n4 listens for the data (actual listener not yet implementted) #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" #include "ns3/debug.h" - #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" - #include "ns3/ascii-trace.h" #include "ns3/pcap-trace.h" #include "ns3/internet-node.h" @@ -58,15 +54,18 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("Me"); +NS_DEBUG_COMPONENT_DEFINE ("CsmaMulticast"); int main (int argc, char *argv[]) { - // Users may find it convenient to turn on explicit debugging - // for selected modules; the below lines suggest how to do this +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// #if 0 - DebugComponentEnable("Me"); + DebugComponentEnable("CsmaMulticast"); + DebugComponentEnable("Object"); DebugComponentEnable("Queue"); DebugComponentEnable("DropTailQueue"); @@ -86,105 +85,182 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4LoopbackInterface"); #endif - DebugComponentEnable("Me"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + + DebugComponentEnable("CsmaMulticast"); DebugComponentEnable("CsmaChannel"); DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("UdpL4Protocol"); - - // Set up some default values for the simulation. Use the Bind() - // technique to tell the system what subclass of Queue to use, - // and what the queue limit is - - // The below Bind command tells the queue factory which class to - // instantiate, when the queue factory is invoked in the topology code +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// DefaultValue::Bind ("Queue", "DropTailQueue"); - - // Allow the user to override any of the defaults and the above - // Bind()s at run-time, via command-line arguments +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// CommandLine::Parse (argc, argv); - - // Here, we will explicitly create four nodes. In more sophisticated - // topologies, we could configure a node factory. +// +// Explicitly create the nodes required by the topology (shown above). +// NS_DEBUG("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); + Ptr n4 = Create (); NS_DEBUG("Create channels."); - // We create the channels first without any IP addressing information - Ptr channel0 = +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + Ptr lan1 = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); NS_DEBUG("Build Topology."); - uint32_t netDeviceNumberNode0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, - channel0, Eui48Address("10:54:23:54:23:50")); - uint32_t netDeviceNumberNode1 = CsmaIpv4Topology::AddIpv4CsmaNode (n1, - channel0, Eui48Address("10:54:23:54:23:51")); - uint32_t netDeviceNumberNode2 = CsmaIpv4Topology::AddIpv4CsmaNode (n2, - channel0, Eui48Address("10:54:23:54:23:52")); - uint32_t netDeviceNumberNode3 = CsmaIpv4Topology::AddIpv4CsmaNode (n3, - channel0, Eui48Address("10:54:23:54:23:53")); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. Interpret nd2Lan0 as the net device we created for node two to +// connect to Lan0. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan0, + Eui48Address("08:00:2e:00:00:00")); + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan0, + Eui48Address("08:00:2e:00:00:01")); + uint32_t nd2Lan0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan0, + Eui48Address("08:00:2e:00:00:02")); - NS_DEBUG ("netDeviceNumberNode0 = " << netDeviceNumberNode0); - NS_DEBUG ("netDeviceNumberNode1 = " << netDeviceNumberNode1); - NS_DEBUG ("netDeviceNumberNode2 = " << netDeviceNumberNode2); - NS_DEBUG ("netDeviceNumberNode3 = " << netDeviceNumberNode3); + uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, + Eui48Address("08:00:2e:00:00:00")); + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, + Eui48Address("08:00:2e:00:00:01")); + uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, + Eui48Address("08:00:2e:00:00:02")); - // Later, we add IP addresses. + NS_DEBUG ("nd0 = " << nd0); + NS_DEBUG ("nd1 = " << nd1); + NS_DEBUG ("nd2Lan0 = " << nd2Lan0); + NS_DEBUG ("nd2Lan1 = " << nd2Lan1); + NS_DEBUG ("nd3 = " << nd3); + NS_DEBUG ("nd4 = " << nd3); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// NS_DEBUG("Assign IP Addresses."); - // XXX BUGBUG - // Need a better way to get the interface index. The point-to-point topology - // as implemented can't return the index since it creates interfaces on both - // sides (i.e., AddIpv4Addresses, not AddIpv4Address). Need a method on - // Ipv4 to find the interface index corresponding to a given ipv4 address. - uint32_t ifIndexNode0 = CsmaIpv4Topology::AddIpv4Address (n0, - netDeviceNumberNode0, Ipv4Address ("10.1.1.1"), - Ipv4Mask ("255.255.255.0")); +// +// XXX BUGBUG +// Need a better way to get the interface index. The point-to-point topology +// as implemented can't return the index since it creates interfaces on both +// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +// method on Ipv4 to find the interface index corresponding to a given ipv4 +// address. +// +// First, assign IP addresses to the net devices and associated interfaces +// on Lan0. The AddIpv4Address method returns an Ipv4 interface index. +// Interpret ifIndexNd0 as the interface index to use to reference the +// net device we created on node zero when coming in from the Ipv4 interface. +// Net device numbers and interface indices are distinct. Interpret +// ifIndexNd2Lan0 as the interface index to use to reference the +// net device we created that connects node two to lan zero. +// + uint32_t ifIndexNd0 = CsmaIpv4Topology::AddIpv4Address (n0, nd0, + Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNode1 = CsmaIpv4Topology::AddIpv4Address (n1, - netDeviceNumberNode1, Ipv4Address ("10.1.1.2"), - Ipv4Mask ("255.255.255.0")); + uint32_t ifIndexNd1 = CsmaIpv4Topology::AddIpv4Address (n1, nd1, + Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNode2 = CsmaIpv4Topology::AddIpv4Address (n2, - netDeviceNumberNode2, Ipv4Address ("10.1.1.3"), - Ipv4Mask ("255.255.255.0")); - - uint32_t ifIndexNode3 = CsmaIpv4Topology::AddIpv4Address (n3, - netDeviceNumberNode3, Ipv4Address ("10.1.1.4"), - Ipv4Mask ("255.255.255.0")); + uint32_t ifIndexNd2Lan0 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, + Ipv4Address ("10.1.1.3"), Ipv4Mask ("255.255.255.0")); +// +// Assign IP addresses to the net devices and associated interfaces on Lan1 +// + uint32_t ifIndexNd2Lan1 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, + Ipv4Address ("10.1.2.1"), Ipv4Mask ("255.255.255.0")); - NS_DEBUG ("ifIndexNode0 = " << ifIndexNode0); - NS_DEBUG ("ifIndexNode1 = " << ifIndexNode1); - NS_DEBUG ("ifIndexNode2 = " << ifIndexNode2); - NS_DEBUG ("ifIndexNode3 = " << ifIndexNode3); + uint32_t ifIndexNd3 = CsmaIpv4Topology::AddIpv4Address (n3, nd1, + Ipv4Address ("10.1.2.2"), Ipv4Mask ("255.255.255.0")); - // Configure multicasting + uint32_t ifIndexNd4 = CsmaIpv4Topology::AddIpv4Address (n4, nd4, + Ipv4Address ("10.1.2.3"), Ipv4Mask ("255.255.255.0")); + + NS_DEBUG ("ifIndexNd0 = " << ifIndexNd0); + NS_DEBUG ("ifIndexNd1 = " << ifIndexNd1); + NS_DEBUG ("ifIndexNd2Lan0 = " << ifIndexNd2Lan0); + NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); + NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); + NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); NS_DEBUG("Configure multicasting."); +// +// Now we can configure multicasting. As described above, the multicast +// source is at node zero, which we assigned the IP address of 10.1.1.1 +// earlier. We need to define a multicast group to send packets to. This +// can be any multicast address from 224.0.0.0 through 239.255.255.255 +// (avoiding the reserved routing protocol addresses). We just pick a +// convenient number. +// Ipv4Address multicastSource ("10.1.1.1"); Ipv4Address multicastGroup ("225.0.0.0"); - +// +// We are going to manually configure multicast routing. This means telling +// node two that it should expect multicast data coming from IP address +// 10.1.1.1 over its IP interface connected to Lan0. These are called +// multicastSource and ifIndexNd2Lan0 respectively. When node two receives +// these packets, they should be forwarded out the interface that connects it +// to Lan1 which is called ifIndexNd2Lan1. All we need to do is to call the +// AddMulticastRoute method on node two's Ipv4 interface and provide this +// information. (Note: the vector of output interfaces is in case there are +// multiple net devices on a node). +// Ptr ipv4; - ipv4 = n0->QueryInterface (Ipv4::iid); + ipv4 = n2->QueryInterface (Ipv4::iid); std::vector outputInterfaces (1); - outputInterfaces[0] = ifIndexNode0; + outputInterfaces[0] = ifIndexNd2Lan1; - ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, + ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexNd2Lan0, outputInterfaces); +// +// We also need to explain to the node zero forwarding code that when it sees +// a packet destined for the multicast group it needs to send it out its +// one and only interface. The 0xffffffff in the call means that the input +// interface qualification is not applicable in this case (the packet has +// not been received over an interface, it has been created locally). +// + ipv4 = n0->QueryInterface (Ipv4::iid); - ipv4 = n1->QueryInterface (Ipv4::iid); - // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + outputInterfaces[0] = ifIndexNd0;; - ipv4 = n2->QueryInterface (Ipv4::iid); - // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); - - ipv4 = n3->QueryInterface (Ipv4::iid); - // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); - - // Create the OnOff application to send UDP datagrams - // from n0 to the multicast group + ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0xffffffff, + outputInterfaces); +// +// As described above, node four will be the only node listening for the +// multicast data. To enable forwarding bits up the protocol stack, we need +// to tell the stack to join the multicast group. +// + ipv4 = n4->QueryInterface (Ipv4::iid); + ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +// +// Create an OnOff application to send UDP datagrams from node zero to the +// multicast group (node four will be listening). +// NS_DEBUG("Create Applications."); Ptr ooff = Create ( n0, @@ -192,27 +268,33 @@ main (int argc, char *argv[]) "Udp", ConstantVariable(1), ConstantVariable(0), - DataRate ("128b/s"), + DataRate ("255b/s"), 128); - // Start the application +// +// Tell the application when to start and stop. +// ooff->Start(Seconds(1.)); ooff->Stop (Seconds(10.)); - - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the csma-one-subnet.tr file +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "csma-multicast.tr" +// NS_DEBUG("Configure Tracing."); AsciiTrace asciitrace ("csma-multicast.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); - - // Also configure some tcpdump traces; each interface will be traced - // The output files will be named - // simple-point-to-point.pcap-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// csma-multicast.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// PcapTrace pcaptrace ("csma-multicast.pcap"); pcaptrace.TraceAllIp (); - +// +// Now, do the actual simulation. +// NS_DEBUG("Run Simulation."); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 033a0135d..b7926c0db 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -14,35 +14,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Port of ns-2/tcl/ex/simple.tcl to ns-3 -// // Network topology // // n0 n1 n2 n3 // | | | | -// ===================== +// ================= +// LAN // -// - CBR/UDP flows from n0 to n1, and from n3 to n0 -// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. -// (i.e., DataRate of 448,000 bps) +// - CBR/UDP flows from n0 to n1 and from n3 to n0 // - DropTail queues // - Tracing of queues and packet receptions to file "csma-one-subnet.tr" -#include -#include -#include -#include - #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" #include "ns3/debug.h" - #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" - #include "ns3/ascii-trace.h" #include "ns3/pcap-trace.h" #include "ns3/internet-node.h" @@ -60,15 +50,18 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("Me"); +NS_DEBUG_COMPONENT_DEFINE ("CsmaOneSubnet"); int main (int argc, char *argv[]) { - // Users may find it convenient to turn on explicit debugging - // for selected modules; the below lines suggest how to do this +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// #if 0 - DebugComponentEnable("Me"); + DebugComponentEnable("CsmaOneSubnet"); + DebugComponentEnable("Object"); DebugComponentEnable("Queue"); DebugComponentEnable("DropTailQueue"); @@ -88,71 +81,90 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4LoopbackInterface"); #endif - DebugComponentEnable("Me"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); - - // Set up some default values for the simulation. Use the Bind() - // technique to tell the system what subclass of Queue to use, - // and what the queue limit is - - // The below Bind command tells the queue factory which class to - // instantiate, when the queue factory is invoked in the topology code +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// DefaultValue::Bind ("Queue", "DropTailQueue"); - - // Allow the user to override any of the defaults and the above - // Bind()s at run-time, via command-line arguments +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// CommandLine::Parse (argc, argv); - - // Here, we will explicitly create four nodes. In more sophisticated - // topologies, we could configure a node factory. +// +// Explicitly create the nodes required by the topology (shown above). +// NS_DEBUG("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); - // We create the channels first without any IP addressing information NS_DEBUG("Create channels."); - Ptr channel0 = - CsmaTopology::CreateCsmaChannel( - DataRate(5000000), MilliSeconds(2)); +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan = CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); NS_DEBUG("Build Topology."); - uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, - Eui48Address("10:54:23:54:23:50")); - uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, - Eui48Address("10:54:23:54:23:51")); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, - Eui48Address("10:54:23:54:23:52")); - uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, - Eui48Address("10:54:23:54:23:53")); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + Eui48Address("08:00:2e:00:00:00")); - // Later, we add IP addresses. + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + Eui48Address("08:00:2e:00:00:01")); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + Eui48Address("08:00:2e:00:00:02")); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + Eui48Address("08:00:2e:00:00:03")); + + NS_DEBUG ("nd0 = " << nd0); + NS_DEBUG ("nd1 = " << nd1); + NS_DEBUG ("nd2 = " << nd2); + NS_DEBUG ("nd3 = " << nd3); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// NS_DEBUG("Assign IP Addresses."); - CsmaIpv4Topology::AddIpv4Address ( - n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); +// +// XXX BUGBUG +// Need a better way to get the interface index. The point-to-point topology +// as implemented can't return the index since it creates interfaces on both +// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +// method on Ipv4 to find the interface index corresponding to a given ipv4 +// address. +// +// Assign IP addresses to the net devices and associated interfaces +// on the lan. The AddIpv4Address method returns an Ipv4 interface index +// which we do not need here. +// + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address("10.1.1.1"), + Ipv4Mask("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address("10.1.1.2"), + Ipv4Mask("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address("10.1.1.3"), + Ipv4Mask("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); - - // Create the OnOff application to send UDP datagrams of size - // 210 bytes at a rate of 448 Kb/s - // from n0 to n1 + CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), + Ipv4Mask("255.255.255.0")); +// +// Create an OnOff application to send UDP datagrams from node zero to node 1. +// NS_DEBUG("Create Applications."); Ptr ooff = Create ( n0, @@ -160,36 +172,43 @@ main (int argc, char *argv[]) "Udp", ConstantVariable(1), ConstantVariable(0)); - // Start the application +// +// Tell the application when to start and stop. +// ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); - - // Create a similar flow from n3 to n0, starting at time 1.1 seconds +// +// Create a similar flow from n3 to n0, starting at time 1.1 seconds +// ooff = Create ( n3, InetSocketAddress ("10.1.1.1", 80), "Udp", ConstantVariable(1), ConstantVariable(0)); - // Start the application + ooff->Start(Seconds(1.1)); ooff->Stop (Seconds(10.0)); - - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the csma-one-subnet.tr file - NS_DEBUG("Configure Tracing."); +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "csma-one-subnet.tr" +// + NS_DEBUG("Configure Tracing."); AsciiTrace asciitrace ("csma-one-subnet.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); - - // Also configure some tcpdump traces; each interface will be traced - // The output files will be named - // simple-point-to-point.pcap-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// csma-one-subnet.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// PcapTrace pcaptrace ("csma-one-subnet.pcap"); pcaptrace.TraceAllIp (); - +// +// Now, do the actual simulation. +// NS_DEBUG("Run Simulation."); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index b3017e029..07dcdcaad 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -128,13 +128,13 @@ int main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channelc0, + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0, Eui48Address("10:54:23:54:23:50")); - uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channelc0, + uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0, Eui48Address("10:54:23:54:23:51")); - uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n4, channelc0, + uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, channelc0, Eui48Address("10:54:23:54:23:52")); - uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n5, channelc0, + uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, channelc0, Eui48Address("10:54:23:54:23:53")); // Later, we add IP addresses. diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index ff36b5502..80aa1c10a 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -35,19 +35,20 @@ namespace ns3 { uint32_t -CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) +CsmaIpv4Topology::AddIpv4CsmaNetDevice( + Ptr node, + Ptr channel, + Eui48Address addr) { Ptr q = Queue::CreateDefault (); // assume full-duplex - Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::IP_ARP, - true, true); - nd0->AddQueue(q); - nd0->Attach (ch); - return nd0->GetIfIndex (); + Ptr nd = Create (node, addr, + ns3::CsmaNetDevice::IP_ARP, true, true); + + nd->AddQueue(q); + nd->Attach (channel); + return nd->GetIfIndex (); } diff --git a/src/devices/csma/csma-ipv4-topology.h b/src/devices/csma/csma-ipv4-topology.h index ca4aa982b..8ee60a9df 100644 --- a/src/devices/csma/csma-ipv4-topology.h +++ b/src/devices/csma/csma-ipv4-topology.h @@ -61,9 +61,9 @@ public: * * \return ifIndex of the device */ - static uint32_t AddIpv4CsmaNode( Ptr n1, - Ptr ch, - Eui48Address addr); + static uint32_t AddIpv4CsmaNetDevice(Ptr node, + Ptr channel, + Eui48Address addr); /** * \param n1 Node to be attached to the Csma channel From 5b2c17667c5c3256d39845a19b07e2c86946f25d Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 16:21:39 -0700 Subject: [PATCH 040/218] set source address in socket --- examples/csma-multicast.cc | 6 +-- src/internet-node/ipv4-end-point.cc | 7 ++++ src/internet-node/ipv4-end-point.h | 2 + src/internet-node/ipv4-impl.cc | 17 ++++++++ src/internet-node/ipv4-impl.h | 2 + src/internet-node/ipv4-l3-protocol.cc | 22 +++++++++++ src/internet-node/ipv4-l3-protocol.h | 2 + src/internet-node/ipv4-static-routing.cc | 49 ++++++++++++++++++++++++ src/internet-node/ipv4-static-routing.h | 1 + src/internet-node/udp-socket.cc | 5 +++ src/node/ipv4.h | 16 ++++++++ 11 files changed, 125 insertions(+), 4 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index ae4c3c4cf..5017805aa 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -123,12 +123,10 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // Ptr lan0 = - CsmaTopology::CreateCsmaChannel( - DataRate(5000000), MilliSeconds(2)); + CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); Ptr lan1 = - CsmaTopology::CreateCsmaChannel( - DataRate(5000000), MilliSeconds(2)); + CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); NS_DEBUG("Build Topology."); // diff --git a/src/internet-node/ipv4-end-point.cc b/src/internet-node/ipv4-end-point.cc index 69faf523e..a71ee47b2 100644 --- a/src/internet-node/ipv4-end-point.cc +++ b/src/internet-node/ipv4-end-point.cc @@ -42,6 +42,13 @@ Ipv4EndPoint::GetLocalAddress (void) { return m_localAddr; } + +void +Ipv4EndPoint::SetLocalAddress (Ipv4Address address) +{ + m_localAddr = address; +} + uint16_t Ipv4EndPoint::GetLocalPort (void) { diff --git a/src/internet-node/ipv4-end-point.h b/src/internet-node/ipv4-end-point.h index f606aa63b..abc5182a7 100644 --- a/src/internet-node/ipv4-end-point.h +++ b/src/internet-node/ipv4-end-point.h @@ -37,6 +37,8 @@ public: ~Ipv4EndPoint (); Ipv4Address GetLocalAddress (void); + void SetLocalAddress (Ipv4Address address); + uint16_t GetLocalPort (void); Ipv4Address GetPeerAddress (void); uint16_t GetPeerPort (void); diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index c1dbc2c49..96f7af1e4 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -174,11 +174,28 @@ Ipv4Impl::GetNetworkMask (uint32_t i) const { return m_ipv4->GetNetworkMask (i); } + Ipv4Address Ipv4Impl::GetAddress (uint32_t i) const { return m_ipv4->GetAddress (i); } + +Ipv4Address +Ipv4Impl::GetSourceAddress (Ipv4Address destination) const +{ + uint32_t ifIndex; + bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex); + if (result) + { + return m_ipv4->GetAddress (ifIndex); + } + else + { + return Ipv4Address::GetAny (); + } +} + uint16_t Ipv4Impl::GetMtu (uint32_t i) const { diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index 5ad9b3e0c..e7036f0d3 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -81,6 +81,8 @@ public: virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask); virtual Ipv4Mask GetNetworkMask (uint32_t t) const; virtual Ipv4Address GetAddress (uint32_t i) const; + virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const; + virtual uint16_t GetMtu (uint32_t i) const; virtual bool IsUp (uint32_t i) const; virtual void SetUp (uint32_t i); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 2326d1021..615985674 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -691,6 +691,28 @@ Ipv4L3Protocol::GetAddress (uint32_t i) const return interface->GetAddress (); } +bool +Ipv4L3Protocol::GetIfIndexForDestination ( + Ipv4Address destination, uint32_t& ifIndex) const +{ + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (" << destination << + ", " << &ifIndex << ")"); + + for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); + i != m_routingProtocols.end (); + i++) + { + NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting Source Address"); + uint32_t ifIndex; + + if ((*i).second->RequestIfIndex (destination, ifIndex)) + { + return true; + } + } + return false; +} + uint16_t Ipv4L3Protocol::GetMtu (uint32_t i) const { diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 7848bf738..c5f066314 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -182,6 +182,8 @@ public: void SetNetworkMask (uint32_t i, Ipv4Mask mask); Ipv4Mask GetNetworkMask (uint32_t t) const; Ipv4Address GetAddress (uint32_t i) const; + bool GetIfIndexForDestination (Ipv4Address destination, + uint32_t& ifIndex) const; uint16_t GetMtu (uint32_t i) const; bool IsUp (uint32_t i) const; void SetUp (uint32_t i); diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index e6e67b516..3ead3fcec 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -377,6 +377,55 @@ Ipv4StaticRouting::RequestRoute ( } } +bool +Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) +{ + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (" << destination << ", " << + &ifIndex << ")"); +// +// First, see if this is a multicast packet we have a route for. If we +// have a route, then send the packet down each of the specified interfaces. +// + if (destination.IsMulticast ()) + { + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Multicast destination"); + + Ipv4MulticastRoute *mRoute = LookupStatic(Ipv4Address::GetAny (), + destination, Ipv4RoutingProtocol::IF_INDEX_ANY); + + if (mRoute) + { + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " + "Multicast route found"); + + if (mRoute->GetNOutputInterfaces () != 1) + { + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " + "Route is to multiple interfaces. Ignoring."); + return false; + } + + ifIndex = mRoute->GetOutputInterface(0); + return true; + } + return false; // Let other routing protocols try to handle this + } +// +// See if this is a unicast packet we have a route for. +// + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Unicast destination"); + Ipv4Route *route = LookupStatic (destination); + if (route) + { + ifIndex = route->GetInterface (); + return true; + } + else + { + return false; + } +} + void Ipv4StaticRouting::DoDispose (void) { diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 76bb80c40..b63e6ef1f 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -56,6 +56,7 @@ public: Packet packet, RouteReplyCallback routeReply); + virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); void AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 1442e1d11..bb3046c68 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -26,6 +26,7 @@ #include "udp-l4-protocol.h" #include "ipv4-end-point.h" #include "ipv4-l4-demux.h" +#include "ns3/ipv4.h" NS_DEBUG_COMPONENT_DEFINE ("UdpSocket"); @@ -180,6 +181,10 @@ UdpSocket::Connect(const Address & address) m_defaultPort = transport.GetPort (); NotifyConnectionSucceeded (); m_connected = true; + + Ptr ipv4; + ipv4 = m_node->QueryInterface (Ipv4::iid); + m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); return 0; } diff --git a/src/node/ipv4.h b/src/node/ipv4.h index d56a70c70..7d28f012f 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -104,6 +104,16 @@ public: const Ipv4Header &ipHeader, Packet packet, RouteReplyCallback routeReply) = 0; + /** + * \brief Synchronously request the interface index that will be used to + * send a packet to a hypothetical destination. + * + * \param destination IP address of a hypothetical destination packet + * \param ifIndex Reference to interface index. + * \returns True if the protocol has a route, false otherwise. + */ + virtual bool RequestIfIndex (Ipv4Address destination, + uint32_t& ifIndex) = 0; static const uint32_t IF_INDEX_ANY = 0xffffffff; }; @@ -308,6 +318,12 @@ public: * \returns the address associated to the underlying ipv4 interface */ virtual Ipv4Address GetAddress (uint32_t i) const = 0; + /** + * \param destination The IP address of a hypothetical destination. + * \returns The IP address assigned to the interface that will be used + * if we were to send a packet to destination. + */ + virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; /** * \param i index of ipv4 interface * \returns the Maximum Transmission Unit (in bytes) associated From 9e698df2c034338f669dc333720bb273f593a80d Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 19:54:47 -0700 Subject: [PATCH 041/218] set source IP address in udp-socket packets --- examples/csma-multicast.cc | 16 ++-------------- examples/csma-one-subnet.cc | 1 - src/internet-node/ipv4-impl.cc | 4 +++- src/internet-node/ipv4-l3-protocol.cc | 7 +++++-- src/internet-node/ipv4-static-routing.cc | 2 ++ src/internet-node/udp-socket.cc | 6 ++++-- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 5017805aa..9d7b5f8f6 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -71,11 +71,11 @@ main (int argc, char *argv[]) DebugComponentEnable("DropTailQueue"); DebugComponentEnable("Channel"); DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("NetDevice"); DebugComponentEnable("CsmaNetDevice"); DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("PacketSocket"); DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("PacketSocket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); @@ -84,18 +84,6 @@ main (int argc, char *argv[]) DebugComponentEnable("ArpIpv4Interface"); DebugComponentEnable("Ipv4LoopbackInterface"); #endif - - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); - - DebugComponentEnable("CsmaMulticast"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("CsmaNetDevice"); // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index b7926c0db..19d9200ff 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -80,7 +80,6 @@ main (int argc, char *argv[]) DebugComponentEnable("ArpIpv4Interface"); DebugComponentEnable("Ipv4LoopbackInterface"); #endif - // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index 96f7af1e4..49a126547 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -184,8 +184,10 @@ Ipv4Impl::GetAddress (uint32_t i) const Ipv4Address Ipv4Impl::GetSourceAddress (Ipv4Address destination) const { - uint32_t ifIndex; + uint32_t ifIndex = 0xffffffff; + bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex); + if (result) { return m_ipv4->GetAddress (ifIndex); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 615985674..de1ca314b 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -703,10 +703,13 @@ Ipv4L3Protocol::GetIfIndexForDestination ( i++) { NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting Source Address"); - uint32_t ifIndex; + uint32_t ifIndexTmp; - if ((*i).second->RequestIfIndex (destination, ifIndex)) + if ((*i).second->RequestIfIndex (destination, ifIndexTmp)) { + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " + "Found ifIndex " << ifIndexTmp); + ifIndex = ifIndexTmp; return true; } } diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 3ead3fcec..9013769dd 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -406,6 +406,8 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) } ifIndex = mRoute->GetOutputInterface(0); + NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " + "Found ifIndex " << ifIndex); return true; } return false; // Let other routing protocols try to handle this diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index bb3046c68..576239964 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -174,7 +174,7 @@ UdpSocket::Close(void) int UdpSocket::Connect(const Address & address) { - NS_DEBUG("UdpSocket::Connect (" << address << ")"); + NS_DEBUG ("UdpSocket::Connect (" << address << ")"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); @@ -185,6 +185,8 @@ UdpSocket::Connect(const Address & address) Ptr ipv4; ipv4 = m_node->QueryInterface (Ipv4::iid); m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); + NS_DEBUG ("UdpSocket::Connect (): Local address is" << + m_endPoint->GetLocalAddress()); return 0; } @@ -270,4 +272,4 @@ UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) NotifyDataReceived (p, address); } -}//namespace ns3 +} //namespace ns3 From 11dc458d2a10590539c7905d1ce3589b141651d9 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 20:14:36 -0700 Subject: [PATCH 042/218] Silliness for optimized version --- examples/csma-multicast.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 9d7b5f8f6..18f39a3d7 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -193,6 +193,15 @@ main (int argc, char *argv[]) NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); +// +// A little silliness to let optimized code work while still printing all +// results in debug code (without attribute). +// + nd3 = nd3; + ifIndexNd1 = ifIndexNd1; + ifIndexNd3 = ifIndexNd3; + ifIndexNd4 = ifIndexNd4; + NS_DEBUG("Configure multicasting."); // // Now we can configure multicasting. As described above, the multicast From de083ec4db750b5fada60162b2fca809820037ee Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 13 Aug 2007 23:40:51 -0700 Subject: [PATCH 043/218] fix non-unique ethernet addresses --- examples/csma-multicast.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 18f39a3d7..a00393374 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -135,11 +135,11 @@ main (int argc, char *argv[]) Eui48Address("08:00:2e:00:00:02")); uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, - Eui48Address("08:00:2e:00:00:00")); + Eui48Address("08:00:2e:00:00:03")); uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, - Eui48Address("08:00:2e:00:00:01")); + Eui48Address("08:00:2e:00:00:04")); uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, - Eui48Address("08:00:2e:00:00:02")); + Eui48Address("08:00:2e:00:00:05")); NS_DEBUG ("nd0 = " << nd0); NS_DEBUG ("nd1 = " << nd1); From feb08acc56727b575bda96d19b9a04c4bae7deb3 Mon Sep 17 00:00:00 2001 From: George Riley Date: Fri, 24 Aug 2007 11:44:11 -0400 Subject: [PATCH 044/218] Change the protocol stack processing to pass packets by non-const reference, rather than const reference and value as was previously done. Also change the queue semantics to return the packet on a deque, rather than requiring a packet as a parameter. The problem with the original approach was that packet UID's were getting skipped. The fix handles the uid properly, and we get sequential packet uid's on the trace file. --- examples/wscript | 4 ++ samples/main-simple.cc | 3 +- src/applications/onoff-application.cc | 3 +- src/devices/csma/csma-net-device.cc | 60 ++++++++----------- src/devices/csma/csma-net-device.h | 4 +- .../point-to-point-net-device.cc | 27 ++++----- .../point-to-point-net-device.h | 2 +- src/internet-node/arp-l3-protocol.cc | 5 +- src/internet-node/arp-l3-protocol.h | 2 +- src/internet-node/ipv4-end-point.cc | 4 +- src/internet-node/ipv4-end-point.h | 6 +- src/internet-node/ipv4-l3-protocol.cc | 29 ++++----- src/internet-node/ipv4-l3-protocol.h | 12 ++-- src/internet-node/ipv4-static-routing.cc | 2 +- src/internet-node/ipv4-static-routing.h | 2 +- src/internet-node/udp-l4-protocol.cc | 2 +- src/internet-node/udp-l4-protocol.h | 2 +- src/internet-node/udp-socket.cc | 13 ++-- src/internet-node/udp-socket.h | 10 ++-- src/node/drop-tail-queue.cc | 35 ++++------- src/node/drop-tail-queue.h | 4 +- src/node/ipv4.h | 6 +- src/node/net-device.cc | 4 +- src/node/net-device.h | 8 +-- src/node/node.cc | 2 +- src/node/node.h | 4 +- src/node/packet-socket.cc | 10 ++-- src/node/packet-socket.h | 6 +- src/node/queue.cc | 42 +++++++------ src/node/queue.h | 14 +++-- src/node/socket.h | 4 +- 31 files changed, 152 insertions(+), 179 deletions(-) diff --git a/examples/wscript b/examples/wscript index e5e771555..cb0af9530 100644 --- a/examples/wscript +++ b/examples/wscript @@ -10,6 +10,10 @@ def build(bld): ['point-to-point', 'internet-node']) obj.source = 'simple-point-to-point.cc' + obj = bld.create_ns3_program('really-simple-point-to-point', + ['point-to-point', 'internet-node']) + obj.source = 'really-simple-point-to-point.cc' + obj = bld.create_ns3_program('csma-one-subnet', ['csma', 'internet-node']) obj.source = 'csma-one-subnet.cc' diff --git a/samples/main-simple.cc b/samples/main-simple.cc index 7285f4946..2039a55c3 100644 --- a/samples/main-simple.cc +++ b/samples/main-simple.cc @@ -14,7 +14,8 @@ static void GenerateTraffic (Ptr socket, uint32_t size) { std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl; - socket->Send (Packet (size)); + Packet p(size); + socket->Send (p); if (size > 0) { Simulator::Schedule (Seconds (0.5), &GenerateTraffic, socket, size - 50); diff --git a/src/applications/onoff-application.cc b/src/applications/onoff-application.cc index 32bcd7564..512c454f3 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff-application.cc @@ -206,7 +206,8 @@ void OnOffApplication::ScheduleStopEvent() void OnOffApplication::SendPacket() { NS_ASSERT (m_sendEvent.IsExpired ()); - m_socket->Send(Packet (m_pktSize)); + Packet p(m_pktSize); + m_socket->Send(p); m_totBytes += m_pktSize; m_lastStartTime = Simulator::Now(); m_residualBits = 0; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 531bf7314..610ec9b6c 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -274,13 +274,12 @@ CsmaNetDevice::DoNeedsArp (void) const bool CsmaNetDevice::SendTo ( - const Packet& packet, + Packet& packet, const Address& dest, uint16_t protocolNumber) { - Packet p = packet; - NS_DEBUG ("CsmaNetDevice::SendTo (" << &p << ")"); - NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_DEBUG ("CsmaNetDevice::SendTo (" << &packet << ")"); + NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << packet.GetUid () << ")"); NS_ASSERT (IsLinkUp ()); @@ -289,10 +288,10 @@ CsmaNetDevice::SendTo ( return false; Eui48Address destination = Eui48Address::ConvertFrom (dest); - AddHeader(p, destination, protocolNumber); + AddHeader(packet, destination, protocolNumber); // Place the packet to be sent on the send queue - if (m_queue->Enqueue(p) == false ) + if (m_queue->Enqueue(packet) == false ) { return false; } @@ -301,11 +300,10 @@ CsmaNetDevice::SendTo ( // transmission (see TransmitCompleteEvent) if (m_txMachineState == READY) { + if (m_queue->IsEmpty()) return true; // Nothing else to do // Store the next packet to be transmitted - if (m_queue->Dequeue (m_currentPkt)) - { - TransmitStart(); - } + m_currentPkt = m_queue->Dequeue(); + TransmitStart(); } return true; } @@ -389,9 +387,8 @@ CsmaNetDevice::TransmitAbort (void) m_currentPkt.GetUid () << ")"); // Try to transmit a new packet - bool found; - found = m_queue->Dequeue (m_currentPkt); - NS_ASSERT_MSG(found, "IsEmpty false but no Packet on queue?"); + if (m_queue->IsEmpty()) return; //No packet to transmit + m_currentPkt = m_queue->Dequeue (); m_backoff.ResetBackoffTime(); m_txMachineState = READY; TransmitStart (); @@ -438,18 +435,10 @@ CsmaNetDevice::TransmitReadyEvent (void) NS_ASSERT_MSG(m_txMachineState == GAP, "Must be in interframe gap"); m_txMachineState = READY; + if (m_queue->IsEmpty()) return; // No more to transmit, remain ready // Get the next packet from the queue for transmitting - if (m_queue->IsEmpty()) - { - return; - } - else - { - bool found; - found = m_queue->Dequeue (m_currentPkt); - NS_ASSERT_MSG(found, "IsEmpty false but no Packet on queue?"); - TransmitStart (); - } + m_currentPkt = m_queue->Dequeue (); + TransmitStart (); } TraceResolver * @@ -495,32 +484,31 @@ CsmaNetDevice::AddQueue (Ptr q) } void -CsmaNetDevice::Receive (const Packet& packet) +CsmaNetDevice::Receive (Packet& packet) { EthernetHeader header (false); EthernetTrailer trailer; Eui48Address broadcast; Eui48Address destination; - Packet p = packet; - NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")"); + NS_DEBUG ("CsmaNetDevice::Receive UID is (" << packet.GetUid() << ")"); // Only receive if send side of net device is enabled if (!IsReceiveEnabled()) { - m_dropTrace (p); + m_dropTrace (packet); return; } if (m_encapMode == RAW) { ForwardUp (packet, 0, GetBroadcast ()); - m_dropTrace (p); + //m_dropTrace (packet); return; } - p.RemoveTrailer(trailer); - trailer.CheckFcs(p); - p.RemoveHeader(header); + packet.RemoveTrailer(trailer); + trailer.CheckFcs(packet); + packet.RemoveHeader(header); broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); destination = Eui48Address::ConvertFrom (GetAddress ()); @@ -528,11 +516,11 @@ CsmaNetDevice::Receive (const Packet& packet) (header.GetDestination() != destination)) { // not for us. - m_dropTrace (p); + m_dropTrace (packet); return; } - m_rxTrace (p); + m_rxTrace (packet); // // protocol must be initialized to avoid a compiler warning in the RAW // case that breaks the optimized build. @@ -547,7 +535,7 @@ CsmaNetDevice::Receive (const Packet& packet) break; case LLC: { LlcSnapHeader llc; - p.RemoveHeader (llc); + packet.RemoveHeader (llc); protocol = llc.GetType (); } break; case RAW: @@ -555,7 +543,7 @@ CsmaNetDevice::Receive (const Packet& packet) break; } - ForwardUp (p, protocol, header.GetSource ()); + ForwardUp (packet, protocol, header.GetSource ()); return; } diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 441ea04cd..95b89e9fc 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -195,7 +195,7 @@ enum CsmaEncapsulationMode { * @see CsmaChannel * \param p a reference to the received packet */ - void Receive (const Packet& p); + void Receive (Packet& p); bool IsSendEnabled (void); bool IsReceiveEnabled (void); @@ -270,7 +270,7 @@ private: * \param protocolNumber -- this parameter is not used here * \return true if success, false on failure */ - virtual bool SendTo (const Packet& p, const Address& dest, uint16_t protocolNumber); + virtual bool SendTo (Packet& p, const Address& dest, uint16_t protocolNumber); /** * Start Sending a Packet Down the Wire. diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index a071f9246..2cb026062 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -117,18 +117,17 @@ void PointToPointNetDevice::SetInterframeGap(const Time& t) m_tInterframeGap = t; } -bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, +bool PointToPointNetDevice::SendTo (Packet& packet, const Address& dest, uint16_t protocolNumber) { - Packet p = packet; - NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")"); - NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_DEBUG ("PointToPointNetDevice::SendTo (" << &packet << ", " << &dest << ")"); + NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << packet.GetUid () << ")"); // GFR Comment. Why is this an assertion? Can't a link legitimately // "go down" during the simulation? Shouldn't we just wait for it // to come back up? NS_ASSERT (IsLinkUp ()); - AddHeader(p, protocolNumber); + AddHeader(packet, protocolNumber); // // This class simulates a point to point device. In the case of a serial @@ -139,16 +138,16 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, // trnsmission; otherwise we send it now. if (m_txMachineState == READY) { - return TransmitStart (p); + return TransmitStart (packet); } else { - return m_queue->Enqueue(p); + return m_queue->Enqueue(packet); } } bool -PointToPointNetDevice::TransmitStart (Packet &p) +PointToPointNetDevice::TransmitStart (Packet& p) { NS_DEBUG ("PointToPointNetDevice::TransmitStart (" << &p << ")"); NS_DEBUG ( @@ -184,8 +183,8 @@ void PointToPointNetDevice::TransmitComplete (void) // NS_ASSERT_MSG(m_txMachineState == BUSY, "Must be BUSY if transmitting"); m_txMachineState = READY; - Packet p; - if (!m_queue->Dequeue(p)) return; // Nothing to do at this point + if (m_queue->IsEmpty()) return; // Nothing to do at this point + Packet p = m_queue->Dequeue(); TransmitStart(p); } @@ -236,11 +235,9 @@ void PointToPointNetDevice::Receive (Packet& p) { NS_DEBUG ("PointToPointNetDevice::Receive (" << &p << ")"); uint16_t protocol = 0; - Packet packet = p; - - m_rxTrace (packet); - ProcessHeader(packet, protocol); - ForwardUp (packet, protocol, GetBroadcast ()); + m_rxTrace (p); + ProcessHeader(p, protocol); + ForwardUp (p, protocol, GetBroadcast ()); } Ptr PointToPointNetDevice::GetQueue(void) const diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index d8d8d3242..e985b76cd 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -211,7 +211,7 @@ private: * @param protocolNumber Protocol Number used to find protocol touse * @returns true if success, false on failure */ - virtual bool SendTo (const Packet& p, const Address& dest, + virtual bool SendTo (Packet& p, const Address& dest, uint16_t protocolNumber); /** * Start Sending a Packet Down the Wire. diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 100f1df88..041c50e14 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -84,12 +84,11 @@ ArpL3Protocol::FindCache (Ptr device) } void -ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from) +ArpL3Protocol::Receive(Ptr device, Packet& p, uint16_t protocol, const Address &from) { ArpCache *cache = FindCache (device); ArpHeader arp; - Packet packet = p; - packet.RemoveHeader (arp); + p.RemoveHeader (arp); NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << " node="<GetId ()<<", got request from " << diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index a2ea8227e..82d8dd29e 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -53,7 +53,7 @@ public: /** * \brief Recieve a packet */ - void Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from); + void Receive(Ptr device, Packet& p, uint16_t protocol, const Address &from); /** * \brief Perform an ARP lookup * \param p diff --git a/src/internet-node/ipv4-end-point.cc b/src/internet-node/ipv4-end-point.cc index 69faf523e..cdd78c303 100644 --- a/src/internet-node/ipv4-end-point.cc +++ b/src/internet-node/ipv4-end-point.cc @@ -65,7 +65,7 @@ Ipv4EndPoint::SetPeer (Ipv4Address address, uint16_t port) } void -Ipv4EndPoint::SetRxCallback (Callback callback) +Ipv4EndPoint::SetRxCallback (Callback callback) { m_rxCallback = callback; } @@ -77,7 +77,7 @@ Ipv4EndPoint::SetDestroyCallback (Callback callback) } void -Ipv4EndPoint::ForwardUp (const Packet &p, Ipv4Address saddr, uint16_t sport) +Ipv4EndPoint::ForwardUp (Packet &p, Ipv4Address saddr, uint16_t sport) { if (!m_rxCallback.IsNull ()) { diff --git a/src/internet-node/ipv4-end-point.h b/src/internet-node/ipv4-end-point.h index f606aa63b..06192d500 100644 --- a/src/internet-node/ipv4-end-point.h +++ b/src/internet-node/ipv4-end-point.h @@ -43,17 +43,17 @@ public: void SetPeer (Ipv4Address address, uint16_t port); - void SetRxCallback (Callback callback); + void SetRxCallback (Callback callback); void SetDestroyCallback (Callback callback); - void ForwardUp (const Packet &p, Ipv4Address saddr, uint16_t sport); + void ForwardUp (Packet &p, Ipv4Address saddr, uint16_t sport); private: Ipv4Address m_localAddr; uint16_t m_localPort; Ipv4Address m_peerAddr; uint16_t m_peerPort; - Callback m_rxCallback; + Callback m_rxCallback; Callback m_destroyCallback; }; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index be483dfa0..b44a0a013 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -221,7 +221,7 @@ Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, void Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, - Packet packet, + Packet& packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); @@ -310,7 +310,7 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) } void -Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) +Ipv4L3Protocol::Receive( Ptr device, Packet& p, uint16_t protocol, const Address &from) { uint32_t index = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -322,26 +322,25 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc } index++; } - Packet packet = p; Ipv4Header ipHeader; - packet.RemoveHeader (ipHeader); + p.RemoveHeader (ipHeader); if (!ipHeader.IsChecksumOk ()) { return; } - if (Forwarding (packet, ipHeader, device)) + if (Forwarding (p, ipHeader, device)) { return; } - ForwardUp (packet, ipHeader); + ForwardUp (p, ipHeader); } void -Ipv4L3Protocol::Send (Packet const &packet, +Ipv4L3Protocol::Send (Packet& packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol) @@ -365,12 +364,10 @@ Ipv4L3Protocol::Send (Packet const &packet, ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++) { Ipv4Interface *outInterface = *ifaceIter; - Packet packetCopy = packet; - - NS_ASSERT (packetCopy.GetSize () <= outInterface->GetMtu ()); - packetCopy.AddHeader (ipHeader); - m_txTrace (packetCopy, ifaceIndex); - outInterface->Send (packetCopy, destination); + NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); + packet.AddHeader (ipHeader); + m_txTrace (packet, ifaceIndex); + outInterface->Send (packet, destination); } } else @@ -391,7 +388,7 @@ Ipv4L3Protocol::Send (Packet const &packet, void Ipv4L3Protocol::SendRealOut (bool found, Ipv4Route const &route, - Packet packet, + Packet& packet, Ipv4Header const &ipHeader) { if (!found) @@ -416,7 +413,7 @@ Ipv4L3Protocol::SendRealOut (bool found, bool -Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) +Ipv4L3Protocol::Forwarding (Packet& packet, Ipv4Header &ipHeader, Ptr device) { for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -471,7 +468,7 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 2cce3efa3..8254f27e6 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -118,7 +118,7 @@ public: * - implement a per-NetDevice ARP cache * - send back arp replies on the right device */ - void Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from); + void Receive( Ptr device, Packet& p, uint16_t protocol, const Address &from); /** * \param packet packet to send @@ -129,7 +129,7 @@ public: * Higher-level layers call this method to send a packet * down the stack to the MAC and PHY layers. */ - void Send (Packet const &packet, Ipv4Address source, + void Send (Packet& packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol); @@ -151,7 +151,7 @@ public: uint32_t interface); void Lookup (Ipv4Header const &ipHeader, - Packet packet, + Packet& packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply); uint32_t GetNRoutes (void); @@ -183,10 +183,10 @@ private: void SendRealOut (bool found, Ipv4Route const &route, - Packet packet, + Packet& packet, Ipv4Header const &ipHeader); - bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); - void ForwardUp (Packet p, Ipv4Header const&ip); + bool Forwarding (Packet& packet, Ipv4Header &ipHeader, Ptr device); + void ForwardUp (Packet& p, Ipv4Header const&ip); uint32_t AddIpv4Interface (Ipv4Interface *interface); void SetupLoopback (void); TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index b70c1c1af..37e8a74df 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -210,7 +210,7 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index) bool Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, - Packet packet, + Packet& packet, RouteReplyCallback routeReply) { Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 8462f55a7..439af8cf7 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -52,7 +52,7 @@ public: Ipv4StaticRouting () : m_defaultRoute (0) {} virtual bool RequestRoute (Ipv4Header const &ipHeader, - Packet packet, + Packet& packet, RouteReplyCallback routeReply); diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index f0ef8569b..9dacbf961 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -122,7 +122,7 @@ UdpL4Protocol::Receive(Packet& packet, } void -UdpL4Protocol::Send (Packet packet, +UdpL4Protocol::Send (Packet& packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) { diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 4d7a082d4..70e2b0ccc 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -74,7 +74,7 @@ public: * \param sport The source port number * \param dport The destination port number */ - void Send (Packet packet, + void Send (Packet& packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport); /** diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index a2bde3224..45b8b82b6 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -155,7 +155,7 @@ UdpSocket::Connect(const Address & address) return 0; } int -UdpSocket::Send (const Packet &p) +UdpSocket::Send (Packet &p) { if (!m_connected) { @@ -165,7 +165,7 @@ UdpSocket::Send (const Packet &p) return DoSendTo (p, m_defaultAddress, m_defaultPort); } int -UdpSocket::DoSendTo (const Packet &p, const Address &address) +UdpSocket::DoSendTo (Packet &p, const Address &address) { InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); @@ -173,7 +173,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) return DoSendTo (p, ipv4, port); } int -UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) +UdpSocket::DoSendTo (Packet& p, Ipv4Address ipv4, uint16_t port) { if (m_endPoint == 0) { @@ -195,7 +195,7 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) return 0; } int -UdpSocket::SendTo(const Address &address, const Packet &p) +UdpSocket::SendTo(const Address &address, Packet &p) { if (m_connected) { @@ -209,7 +209,7 @@ UdpSocket::SendTo(const Address &address, const Packet &p) } void -UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) +UdpSocket::ForwardUp (Packet &packet, Ipv4Address ipv4, uint16_t port) { if (m_shutdownRecv) { @@ -217,8 +217,7 @@ UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) } Address address = InetSocketAddress (ipv4, port); - Packet p = packet; - NotifyDataReceived (p, address); + NotifyDataReceived (packet, address); } }//namespace ns3 diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index b3674f7ef..9ceec713f 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -51,8 +51,8 @@ public: virtual int ShutdownSend (void); virtual int ShutdownRecv (void); virtual int Connect(const Address &address); - virtual int Send (const Packet &p); - virtual int SendTo(const Address &address,const Packet &p); + virtual int Send (Packet &p); + virtual int SendTo(const Address &address,Packet &p); private: @@ -60,10 +60,10 @@ private: friend class Udp; // invoked by Udp class int FinishBind (void); - void ForwardUp (const Packet &p, Ipv4Address ipv4, uint16_t port); + void ForwardUp (Packet &p, Ipv4Address ipv4, uint16_t port); void Destroy (void); - int DoSendTo (const Packet &p, const Address &daddr); - int DoSendTo (const Packet &p, Ipv4Address daddr, uint16_t dport); + int DoSendTo (Packet &p, const Address &daddr); + int DoSendTo (Packet &p, Ipv4Address daddr, uint16_t dport); Ipv4EndPoint *m_endPoint; Ptr m_node; diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 74c8fde17..5b802acec 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -73,39 +73,26 @@ DropTailQueue::DoEnqueue (const Packet& p) return true; } -bool -DropTailQueue::DoDequeue (Packet& p) +Packet +DropTailQueue::DoDequeue () { - NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")"); - - if (m_packets.empty()) - { - NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty"); - return false; - } - - p = m_packets.front (); + NS_DEBUG("DropTailQueue::DoDequeue ( )"); + NS_ASSERT(!IsEmpty()); + Packet p = m_packets.front (); m_packets.pop (); NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true"); - return true; + return p; } -bool -DropTailQueue::DoPeek (Packet& p) +Packet +DropTailQueue::DoPeek () { - NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")"); + NS_DEBUG("DropTailQueue::DoPeek ( )"); + NS_ASSERT(!IsEmpty()); - if (m_packets.empty()) - { - NS_DEBUG("DropTailQueue::DoPeek (): Queue empty"); - return false; - } - - p = m_packets.front (); - - return true; + return m_packets.front (); } }; // namespace ns3 diff --git a/src/node/drop-tail-queue.h b/src/node/drop-tail-queue.h index 2e4c76461..6febe0eab 100644 --- a/src/node/drop-tail-queue.h +++ b/src/node/drop-tail-queue.h @@ -58,8 +58,8 @@ public: private: virtual bool DoEnqueue (const Packet& p); - virtual bool DoDequeue (Packet &p); - virtual bool DoPeek (Packet &p); + virtual Packet DoDequeue (); + virtual Packet DoPeek (); private: std::queue m_packets; diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 76d88faea..b4d22c520 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -46,7 +46,7 @@ class Ipv4Header; // FIXME: ipv4-header.h needs to move from module class Ipv4RoutingProtocol : public Object { public: - // void (*RouteReply) (bool found, Ipv4Route route, Packet packet, Ipv4Header const &ipHeader); + // void (*RouteReply) (bool found, Ipv4Route route, Packet& packet, Ipv4Header const &ipHeader); /** @@ -65,7 +65,7 @@ public: * inserted and consequently the protocol type has to change). * */ - typedef Callback RouteReplyCallback; + typedef Callback RouteReplyCallback; /** * \brief Asynchronously requests a route for a given packet and IP header @@ -100,7 +100,7 @@ public: * insert any extra header. */ virtual bool RequestRoute (const Ipv4Header &ipHeader, - Packet packet, + Packet& packet, RouteReplyCallback routeReply) = 0; }; diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 1ffe6d4b1..965bf78b8 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -171,7 +171,7 @@ NetDevice::DisablePointToPoint (void) // Receive packet from above bool -NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) +NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber) { if (m_isUp) { @@ -197,7 +197,7 @@ NetDevice::GetChannel (void) const // Receive packets from below bool -NetDevice::ForwardUp(const Packet& p, uint32_t param, const Address &from) +NetDevice::ForwardUp( Packet& p, uint32_t param, const Address &from) { bool retval = false; diff --git a/src/node/net-device.h b/src/node/net-device.h index 315f16033..0fb21e0fb 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -158,7 +158,7 @@ public: * * \return whether the Send operation succeeded */ - bool Send(const Packet& p, const Address& dest, uint16_t protocolNumber); + bool Send(Packet& p, const Address& dest, uint16_t protocolNumber); /** * \returns the node base class which contains this network * interface. @@ -187,7 +187,7 @@ public: * \returns true if the callback could handle the packet successfully, false * otherwise. */ - typedef Callback,const Packet &,uint16_t,const Address &> ReceiveCallback; + typedef Callback,Packet &,uint16_t,const Address &> ReceiveCallback; /** * \param cb callback to invoke whenever a packet has been received and must @@ -251,7 +251,7 @@ public: * forwards it to the higher layers by calling this method * which is responsible for passing it up to the Rx callback. */ - bool ForwardUp (const Packet& p, uint32_t param, const Address &address); + bool ForwardUp (Packet& p, uint32_t param, const Address &address); /** @@ -274,7 +274,7 @@ public: * method. When the link is Up, this method is invoked to ask * subclasses to forward packets. Subclasses MUST override this method. */ - virtual bool SendTo (const Packet& p, const Address &dest, uint16_t protocolNumber) = 0; + virtual bool SendTo (Packet& p, const Address &dest, uint16_t protocolNumber) = 0; /** * \returns true if this NetDevice needs the higher-layers * to perform ARP over it, false otherwise. diff --git a/src/node/node.cc b/src/node/node.cc index ee83e8588..5fdd50bb8 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -213,7 +213,7 @@ Node::UnregisterProtocolHandler (ProtocolHandler handler) } bool -Node::ReceiveFromDevice (Ptr device, const Packet &packet, +Node::ReceiveFromDevice (Ptr device, Packet &packet, uint16_t protocol, const Address &from) { bool found = false; diff --git a/src/node/node.h b/src/node/node.h index f4d898f53..1538350be 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -158,7 +158,7 @@ public: /** * A protocol handler */ - typedef Callback, const Packet &,uint16_t,const Address &> ProtocolHandler; + typedef Callback, Packet &,uint16_t,const Address &> ProtocolHandler; /** * \param handler the handler to register * \param protocolType the type of protocol this handler is @@ -210,7 +210,7 @@ private: */ virtual void NotifyDeviceAdded (Ptr device); - bool ReceiveFromDevice (Ptr device, const Packet &packet, + bool ReceiveFromDevice (Ptr device, Packet &packet, uint16_t protocol, const Address &from); void Construct (void); TraceResolver *CreateDevicesTraceResolver (const TraceContext &context); diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index f642eee9e..7e0095d79 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -186,7 +186,7 @@ PacketSocket::Connect(const Address &ad) } int -PacketSocket::Send (const Packet &p) +PacketSocket::Send (Packet &p) { if (m_state == STATE_OPEN || m_state == STATE_BOUND) @@ -198,7 +198,7 @@ PacketSocket::Send (const Packet &p) } int -PacketSocket::SendTo(const Address &address, const Packet &p) +PacketSocket::SendTo(const Address &address, Packet &p) { PacketSocketAddress ad; if (m_state == STATE_CLOSED) @@ -262,7 +262,7 @@ PacketSocket::SendTo(const Address &address, const Packet &p) } void -PacketSocket::ForwardUp (Ptr device, const Packet &packet, +PacketSocket::ForwardUp (Ptr device, Packet &packet, uint16_t protocol, const Address &from) { if (m_shutdownRecv) @@ -270,7 +270,7 @@ PacketSocket::ForwardUp (Ptr device, const Packet &packet, return; } - Packet p = packet; + //Packet p = packet; ? PacketSocketAddress address; address.SetPhysicalAddress (from); @@ -279,7 +279,7 @@ PacketSocket::ForwardUp (Ptr device, const Packet &packet, NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid() << " PacketSocket " << this); - NotifyDataReceived (p, address); + NotifyDataReceived (packet, address); } }//namespace ns3 diff --git a/src/node/packet-socket.h b/src/node/packet-socket.h index 8dc1b9e62..be4ade908 100644 --- a/src/node/packet-socket.h +++ b/src/node/packet-socket.h @@ -82,15 +82,15 @@ public: virtual int ShutdownSend (void); virtual int ShutdownRecv (void); virtual int Connect(const Address &address); - virtual int Send (const Packet &p); - virtual int SendTo(const Address &address,const Packet &p); + virtual int Send (Packet &p); + virtual int SendTo(const Address &address,Packet &p); private: private: void Init (void); - void ForwardUp (Ptr device, const Packet &packet, + void ForwardUp (Ptr device, Packet &packet, uint16_t protocol, const Address &from); int DoBind (const PacketSocketAddress &address); virtual void DoDispose (void); diff --git a/src/node/queue.cc b/src/node/queue.cc index 72eafed69..ad79109c0 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -49,7 +49,7 @@ QueueTraceType::IsEnqueue (void) const { return m_type == ENQUEUE; } -bool +bool QueueTraceType::IsDequeue (void) const { return m_type == DEQUEUE; @@ -122,28 +122,25 @@ Queue::Enqueue (const Packet& p) return retval; } -bool -Queue::Dequeue (Packet &p) +Packet +Queue::Dequeue () { - NS_DEBUG("Queue::Dequeue (" << &p << ")"); + NS_ASSERT(!IsEmpty()); + NS_DEBUG("Queue::Dequeue ( )"); - bool retval = DoDequeue (p); + Packet p = DoDequeue (); - if (retval) - { - m_nBytes -= p.GetSize (); - m_nPackets--; + m_nBytes -= p.GetSize (); + m_nPackets--; + + NS_ASSERT (m_nBytes >= 0); + NS_ASSERT (m_nPackets >= 0); + + NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); - NS_ASSERT (m_nBytes >= 0); - NS_ASSERT (m_nPackets >= 0); + m_traceDequeue (p); - NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); - - const Packet packet = p; - m_traceDequeue (packet); - } - - return retval; + return p; } void @@ -154,12 +151,13 @@ Queue::DequeueAll (void) NS_ASSERT (!"Don't know what to do with dequeued packets!"); } -bool -Queue::Peek (Packet &p) +Packet +Queue::Peek () { - NS_DEBUG("Queue::Peek (" << &p << ")"); + NS_ASSERT(!IsEmpty()); + NS_DEBUG("Queue::Peek ( )"); - return DoPeek (p); + return DoPeek (); } diff --git a/src/node/queue.h b/src/node/queue.h index d135fff68..915642f09 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -83,14 +83,16 @@ public: bool Enqueue (const Packet& p); /** * Remove a packet from the front of the Queue - * \return True if the operation was successful; false otherwise + * Must not be called on an empty queue. + * \return The packet removed from the queue */ - bool Dequeue (Packet &p); + Packet Dequeue (); /** * Get a copy of the item at the front of the queue without removing it - * \return True if the operation was successful; false otherwise + * Must NOT be called on an empty queue + * \return The packet at the head of the queue. */ - bool Peek (Packet &p); + Packet Peek (); /** * XXX Doesn't do anything right now, think its supposed to flush the queue @@ -163,8 +165,8 @@ public: private: virtual bool DoEnqueue (const Packet& p) = 0; - virtual bool DoDequeue (Packet &p) = 0; - virtual bool DoPeek (Packet &p) = 0; + virtual Packet DoDequeue () = 0; + virtual Packet DoPeek () = 0; protected: // called by subclasses to notify parent of packet drops. diff --git a/src/node/socket.h b/src/node/socket.h index c717ec0a5..1a28bd71d 100644 --- a/src/node/socket.h +++ b/src/node/socket.h @@ -173,7 +173,7 @@ public: * \returns -1 in case of error or the number of bytes copied in the * internal buffer and accepted for transmission. */ - virtual int Send (const Packet &p) = 0; + virtual int Send (Packet &p) = 0; /** * \brief Send data to a specified peer. @@ -182,7 +182,7 @@ public: * \returns -1 in case of error or the number of bytes copied in the * internal buffer and accepted for transmission. */ - virtual int SendTo(const Address &address,const Packet &p) = 0; + virtual int SendTo(const Address &address,Packet &p) = 0; protected: void NotifyCloseCompleted (void); From bdb079442028950e0c394e787b194a09df1bbfa2 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Fri, 24 Aug 2007 13:21:33 -0400 Subject: [PATCH 045/218] Added GPL and emacs modeline to inet-socket-address.h/cc --- src/node/inet-socket-address.cc | 21 +++++++++++++++++++++ src/node/inet-socket-address.h | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/node/inet-socket-address.cc b/src/node/inet-socket-address.cc index 58b589586..d4b7453a9 100644 --- a/src/node/inet-socket-address.cc +++ b/src/node/inet-socket-address.cc @@ -1,3 +1,24 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005 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 + * + * Author: Mathieu Lacage + */ + #include "inet-socket-address.h" #include "ns3/assert.h" diff --git a/src/node/inet-socket-address.h b/src/node/inet-socket-address.h index 0a00172ba..ec3782393 100644 --- a/src/node/inet-socket-address.h +++ b/src/node/inet-socket-address.h @@ -1,3 +1,24 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005 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 + * + * Author: Mathieu Lacage + */ + #ifndef IPV4_TRANSPORT_ADDRESS_H #define IPV4_TRANSPORT_ADDRESS_H From efd4f372b4cc30dc9c09a168ba4f5096c326d193 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Fri, 24 Aug 2007 14:00:52 -0400 Subject: [PATCH 046/218] Fixed inet-socket-address's opening IFDEF to be consistent with the filename --- src/node/inet-socket-address.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/inet-socket-address.h b/src/node/inet-socket-address.h index ec3782393..d6727342f 100644 --- a/src/node/inet-socket-address.h +++ b/src/node/inet-socket-address.h @@ -19,8 +19,8 @@ * Author: Mathieu Lacage */ -#ifndef IPV4_TRANSPORT_ADDRESS_H -#define IPV4_TRANSPORT_ADDRESS_H +#ifndef INET_SOCKET_ADDRESS_H +#define INET_SOCKET_ADDRESS_H #include "address.h" #include "ipv4-address.h" @@ -114,4 +114,4 @@ private: } // namespace ns3 -#endif /* IPV4_TRANSPORT_ADDRESS_H */ +#endif /* INET_SOCKET_ADDRESS_H */ From d7e0508a4b64f3db2d78a6ac6254d46b8635efe0 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Fri, 24 Aug 2007 16:05:17 -0400 Subject: [PATCH 047/218] Removed SConstruct file --- SConstruct | 521 ----------------------------------------------------- 1 file changed, 521 deletions(-) delete mode 100644 SConstruct diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 9c9a2567c..000000000 --- a/SConstruct +++ /dev/null @@ -1,521 +0,0 @@ -## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -import os.path -import build - -version_file = open ('VERSION', 'r') -version = version_file.readline () -version_file.close () -version = version.strip () - -ns3 = build.Ns3() -ns3.build_dir = 'build-dir' -ns3.version = version -ns3.name = 'ns3' -ns3.distname = 'ns' -ns3.doxygen_config = os.path.join('doc', 'doxygen.conf') -ns3.add_extra_dist(os.path.join('doc', 'main.txt')) -ns3.add_extra_dist ('doc/architecture.pdf') -ns3.add_extra_dist ('doc/contributing.txt') -ns3.add_extra_dist ('doc/build.txt') -ns3.add_extra_dist ('doc/codingstd.txt') -ns3.add_extra_dist ('doc/mercurial.txt') -ns3.add_extra_dist ('README') -ns3.add_extra_dist ('RELEASE_NOTES') -ns3.add_extra_dist ('AUTHORS') -ns3.add_extra_dist ('VERSION') - -ns3.add_extra_dist('doc/build-waf.txt') -ns3.add_extra_dist('ns3/_placeholder_') -for wscript in [ - "src/core/wscript", - "src/node/wscript", - "src/devices/p2p/wscript", - "src/common/wscript", - "src/applications/wscript", - "src/simulator/wscript", - "src/internet-node/wscript", - "src/wscript", - "utils/wscript", - "samples/wscript", - "examples/wscript", - "wscript", - ]: - ns3.add_extra_dist(wscript) -ns3.add_extra_dist('waf') -ns3.add_extra_dist('waf.bat') - -# -# The Core module -# -core = build.Ns3Module('core', 'src/core') -ns3.add(core) -core.add_sources([ - 'callback-test.cc', - 'debug.cc', - 'assert.cc', - 'ptr.cc', - 'object.cc', - 'test.cc', - 'random-variable.cc', - 'rng-stream.cc', - 'uid-manager.cc', - 'default-value.cc', - 'command-line.cc', - 'type-name.cc', - 'component-manager.cc', - ]) -env = Environment() -if env['PLATFORM'] == 'posix' or env['PLATFORM'] == 'darwin' or env['PLATFORM'] == 'cygwin': - core.add_external_dep('pthread') - core.add_sources([ - 'unix-system-wall-clock-ms.cc', - ]) -elif env['PLATFORM'] == 'win32': - core.add_sources([ - 'win32-system-wall-clock-ms.cc', - ]) -core.add_headers ([ - 'uid-manager.h', - 'singleton.h', -]) -core.add_inst_headers([ - 'system-wall-clock-ms.h', - 'empty.h', - 'callback.h', - 'ptr.h', - 'object.h', - 'debug.h', - 'assert.h', - 'fatal-error.h', - 'test.h', - 'random-variable.h', - 'rng-stream.h', - 'default-value.h', - 'command-line.h', - 'type-name.h', - 'component-manager.h', - ]) - -def config_core (env, config): - retval = [] - # XXX This check is primitive but it should be - # good enough for now. - if config.CheckCHeader ('stdlib.h') == 1: - retval.append ('#define HAVE_STDLIB_H 1') - retval.append ('#define HAVE_GETENV 1') - else: - retval.append ('#undef HAVE_STDLIB_H') - retval.append ('#undef HAVE_GETENV') - return retval -core.add_config (config_core) - -# -# The Simulator module -# -simu = build.Ns3Module('simulator', 'src/simulator') -ns3.add(simu) -simu.add_dep('core') -simu.add_external_dep('m') -simu.add_sources([ - 'high-precision.cc', - 'time.cc', - 'event-id.cc', - 'scheduler.cc', - 'scheduler-factory.cc', - 'scheduler-list.cc', - 'scheduler-heap.cc', - 'scheduler-map.cc', - 'event-impl.cc', - 'simulator.cc', - ]) -simu.add_headers([ - 'scheduler-heap.h', - 'scheduler-map.h', - 'scheduler-list.h' - ]) -simu.add_inst_headers([ - 'high-precision.h', - 'nstime.h', - 'event-id.h', - 'event-impl.h', - 'simulator.h', - 'scheduler.h', - 'scheduler-factory.h', - 'simulation-singleton.h', - ]) -high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') -if high_precision_as_double == 'y': - simu.add_inst_header ('high-precision-double.h') - simu.add_source ('high-precision-double.cc') -else: - simu.add_inst_headers ([ - 'high-precision-128.h', - 'cairo-wideint-private.h' - ]) - simu.add_sources ([ - 'high-precision-128.cc', - 'cairo-wideint.c', - ]) - -def config_simulator (env, config): - retval = [] - high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') - if high_precision_as_double == 'y': - retval.append ('#define USE_HIGH_PRECISION_DOUBLE 1') - else: - retval.append ('#undef USE_HIGH_PRECISION_DOUBLE') - if config.CheckCHeader ('stdint.h') == 1: - retval.append ('#define HAVE_STDINT_H 1') - elif config.CheckCHeader ('inttypes.h') == 1: - retval.append ('#define HAVE_INTTYPES_H 1') - elif config.CheckCHeader ('sys/inttypes.h') == 1: - retval.append ('#define HAVE_SYS_INT_TYPES_H 1') - return retval -simu.add_config (config_simulator) - -# -# The Common module -# -common = build.Ns3Module('common', 'src/common') -common.add_deps(['core', 'simulator']) -ns3.add(common) -common.add_sources([ - 'buffer.cc', - 'chunk.cc', - 'header.cc', - 'trailer.cc', - 'packet-printer.cc', - 'packet-metadata.cc', - 'packet.cc', - 'tags.cc', - 'pcap-writer.cc', - 'variable-tracer-test.cc', - 'trace-context.cc', - 'trace-resolver.cc', - 'callback-trace-source.cc', - 'empty-trace-resolver.cc', - 'composite-trace-resolver.cc', - 'trace-root.cc', - 'data-rate.cc', - ]) -common.add_headers ([ - ]) -common.add_inst_headers([ - 'buffer.h', - 'chunk.h', - 'header.h', - 'trailer.h', - 'tags.h', - 'packet.h', - 'packet-printer.h', - 'packet-metadata.h', - 'uv-trace-source.h', - 'sv-trace-source.h', - 'fv-trace-source.h', - 'pcap-writer.h', - 'callback-trace-source.h', - 'trace-context.h', - 'trace-resolver.h', - 'empty-trace-resolver.h', - 'composite-trace-resolver.h', - 'array-trace-resolver.h', - 'trace-root.h', - 'terminal-trace-resolver.h', - 'data-rate.h', - ]) - -# -# The Node module -# -node = build.Ns3Module ('node', 'src/node') -ns3.add (node) -node.add_deps (['core', 'common', 'simulator']) -node.add_sources ([ - 'node.cc', - 'ipv4-address.cc', - 'net-device.cc', - 'mac-address.cc', - 'llc-snap-header.cc', - 'ipv4-route.cc', - 'queue.cc', - 'drop-tail-queue.cc', - 'channel.cc', - 'node-list.cc', - 'socket.cc', - 'socket-factory.cc', - 'udp.cc', - 'ipv4.cc', - 'application.cc', - ]) -node.add_inst_headers ([ - 'node.h', - 'ipv4-address.h', - 'net-device.h', - 'mac-address.h', - 'ipv4-route.h', - 'queue.h', - 'drop-tail-queue.h', - 'llc-snap-header.h', - 'channel.h', - 'node-list.h', - 'socket.h', - 'socket-factory.h', - 'udp.h', - 'ipv4.h', - 'application.h', - ]) - -# -# The Applications module -# -applications = build.Ns3Module ('applications', 'src/applications') -ns3.add (applications) -applications.add_deps (['node']) -applications.add_sources ([ - 'onoff-application.cc', -]) -applications.add_inst_headers ([ - 'onoff-application.h', -]) - -# -# The Internet Node module -# -inode = build.Ns3Module ('internet-node', 'src/internet-node') -ns3.add (inode) -inode.add_deps (['node', 'routing']) -inode.add_sources ([ - 'internet-node.cc', - 'l3-demux.cc', - 'l3-protocol.cc', - 'ipv4-l4-demux.cc', - 'ipv4-l4-protocol.cc', - 'ipv4-header.cc', - 'udp-header.cc', - 'ipv4-checksum.cc', - 'ipv4-interface.cc', - 'ipv4-l3-protocol.cc', - 'ipv4-end-point.cc', - 'udp-l4-protocol.cc', - 'arp-header.cc', - 'arp-cache.cc', - 'arp-ipv4-interface.cc', - 'arp-l3-protocol.cc', - 'ipv4-loopback-interface.cc', - 'header-utils.cc', - 'udp-socket.cc', - 'ipv4-end-point-demux.cc', - 'arp-private.cc', - 'ipv4-impl.cc', - 'ipv4-private.cc', - 'ascii-trace.cc', - 'pcap-trace.cc', - 'udp-impl.cc', -]) -inode.add_headers ([ - 'ipv4-checksum.h', - 'arp-header.h', - 'arp-cache.h', - 'arp-l3-protocol.h', - 'ipv4-loopback-interface.h', - 'l3-demux.h', - 'header-utils.h', - 'arp-ipv4-interface.h', - 'udp-socket.h', - 'udp-l4-protocol.h', - 'arp-private.h', - 'ipv4-impl.h', - 'ipv4-private.h', - 'ipv4-l3-protocol.h', - 'l3-protocol.h', - 'ipv4-l4-protocol.h', - 'ipv4-l4-demux.h', - 'ipv4-end-point-demux.h', - 'ipv4-end-point.h', - 'ipv4-header.h', - 'ipv4-interface.h', - 'udp-header.h', - 'sgi-hashmap.h', - 'udp-impl.h', -]) -inode.add_inst_headers ([ - 'internet-node.h', - 'ascii-trace.h', - 'pcap-trace.h', - 'ipv4-header.h', - 'udp-header.h', -]) - -# -# The Point-to-point module -# -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.add_inst_headers ([ - 'p2p-net-device.h', - 'p2p-channel.h', - 'p2p-topology.h', - ]) - -# -# The Routing module -# -routing = build.Ns3Module('routing', 'src/routing') -routing.add_deps(['core', 'node']) -ns3.add(routing) -routing.add_sources([ - 'routing-environment.cc', - 'static-router.cc', - 'static-route-manager.cc', - 'static-route-manager-impl.cc', - 'candidate-queue.cc', - ]) -routing.add_headers ([ - 'candidate-queue.h', - 'static-route-manager-impl.h', - ]) -routing.add_inst_headers([ - 'routing-environment.h', - 'static-router.h', - 'static-route-manager.h', - ]) - -# utils -run_tests = build.Ns3Module('run-tests', 'utils') -ns3.add(run_tests) -run_tests.set_executable() -run_tests.add_deps(['core', 'simulator', 'common', 'routing']) -run_tests.add_source('run-tests.cc') - -bench_object = build.Ns3Module('bench-object', 'utils') -ns3.add(bench_object) -bench_object.set_executable() -bench_object.add_deps(['core']) -bench_object.add_source('bench-object.cc') - -bench_packets = build.Ns3Module('bench-packets', 'utils') -ns3.add(bench_packets) -bench_packets.set_executable() -bench_packets.add_deps (['core', 'common']) -bench_packets.add_source('bench-packets.cc') - -bench_simu = build.Ns3Module('bench-simulator', 'utils') -ns3.add(bench_simu) -bench_simu.set_executable() -bench_simu.add_dep('simulator') -bench_simu.add_source('bench-simulator.cc') - -replay_simu = build.Ns3Module('replay-simulation', 'utils') -ns3.add(replay_simu) -replay_simu.set_executable() -replay_simu.add_dep('simulator') -replay_simu.add_source('replay-simulation.cc') - - -# samples -sample_debug = build.Ns3Module('sample-debug', 'samples') -sample_debug.set_executable() -ns3.add(sample_debug) -sample_debug.add_dep('core') -sample_debug.add_source('main-debug.cc') -sample_debug.add_source('main-debug-other.cc') - -sample_packet_printer = build.Ns3Module('sample-packet-printer', 'samples') -sample_packet_printer.set_executable() -ns3.add(sample_packet_printer) -sample_packet_printer.add_deps (['common', 'internet-node']) -sample_packet_printer.add_source('main-packet-printer.cc') - -sample_callback = build.Ns3Module('sample-callback', 'samples') -sample_callback.set_executable() -ns3.add(sample_callback) -sample_callback.add_dep('core') -sample_callback.add_source('main-callback.cc') - -sample_ptr = build.Ns3Module('sample-ptr', 'samples') -sample_ptr.set_executable() -ns3.add(sample_ptr) -sample_ptr.add_dep('core') -sample_ptr.add_source('main-ptr.cc') - -sample_trace = build.Ns3Module('sample-trace', 'samples') -#ns3.add(sample_trace) -sample_trace.add_dep('common') -sample_trace.set_executable() -sample_trace.add_source('main-trace.cc') - -sample_query_interface = build.Ns3Module('sample-query-interface', 'samples') -ns3.add(sample_query_interface) -sample_query_interface.add_dep('common') -sample_query_interface.set_executable() -sample_query_interface.add_source('main-query-interface.cc') - -sample_simu = build.Ns3Module('sample-simulator', 'samples') -ns3.add(sample_simu) -sample_simu.set_executable() -sample_simu.add_dep('simulator') -sample_simu.add_source('main-simulator.cc') - -sample_packet = build.Ns3Module('sample-packet', 'samples') -ns3.add(sample_packet) -sample_packet.set_executable() -sample_packet.add_dep('common') -sample_packet.add_source('main-packet.cc') - -sample_test = build.Ns3Module('sample-test', 'samples') -sample_test.set_executable() -ns3.add(sample_test) -sample_test.add_dep('core') -sample_test.add_source('main-test.cc') - -sample_simple = build.Ns3Module('sample-simple', 'samples') -sample_simple.set_executable() -ns3.add(sample_simple) -sample_simple.add_deps(['core', 'simulator', 'node', 'internet-node', 'routing']) -sample_simple.add_source('main-simple.cc') - -sample_sp2p = build.Ns3Module('sample-simple-p2p', 'samples') -sample_sp2p.set_executable() -#n3.add(sample_sp2p) -sample_sp2p.add_deps(['core', 'simulator', 'node', 'internet-node', 'p2p']) -sample_sp2p.add_source('main-simple-p2p.cc') - -sample_default_value = build.Ns3Module('sample-default-value', 'samples') -sample_default_value.set_executable() -ns3.add(sample_default_value) -sample_default_value.add_deps(['core', 'simulator', 'node', 'p2p']) -sample_default_value.add_source('main-default-value.cc') - -sample_object = build.Ns3Module('sample-object', 'samples') -sample_object.set_executable() -ns3.add(sample_object) -sample_object.add_deps(['core']) -sample_object.add_source('main-object.cc') - -sample_component_manager = build.Ns3Module('sample-component-manager', 'samples') -sample_component_manager.set_executable() -ns3.add(sample_component_manager) -sample_component_manager.add_deps(['core']) -sample_component_manager.add_source('main-component-manager.cc') - -# examples -example_simple_p2p = build.Ns3Module('simple-p2p', 'examples') -example_simple_p2p.set_executable() -ns3.add(example_simple_p2p) -example_simple_p2p.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) -example_simple_p2p.add_source('simple-p2p.cc') - -example_static_routing = build.Ns3Module('simple-static-routing', 'examples') -example_static_routing.set_executable() -ns3.add(example_static_routing) -example_static_routing.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) -example_static_routing.add_source('simple-static-routing.cc') - -ns3.generate_dependencies() From 8506148420318b7ec87021a8c1d659a54516e18d Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 24 Aug 2007 16:57:54 -0700 Subject: [PATCH 048/218] add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob --- examples/csma-multicast.cc | 122 +++++++++++------------ src/internet-node/ipv4-impl.cc | 14 +++ src/internet-node/ipv4-impl.h | 5 + src/internet-node/ipv4-l3-protocol.cc | 105 ++++++++++++++++++- src/internet-node/ipv4-l3-protocol.h | 7 +- src/internet-node/ipv4-static-routing.cc | 54 ++++++++-- src/internet-node/ipv4-static-routing.h | 1 + src/internet-node/udp-socket.cc | 20 +++- src/node/ipv4.h | 30 ++++++ 9 files changed, 277 insertions(+), 81 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index a00393374..c22e4604c 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -84,6 +84,21 @@ main (int argc, char *argv[]) DebugComponentEnable("ArpIpv4Interface"); DebugComponentEnable("Ipv4LoopbackInterface"); #endif + + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("CsmaMulticast"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("PacketSocket"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind @@ -151,56 +166,32 @@ main (int argc, char *argv[]) // We've got the "hardware" in place. Now we need to add IP addresses. // NS_DEBUG("Assign IP Addresses."); -// -// XXX BUGBUG -// Need a better way to get the interface index. The point-to-point topology -// as implemented can't return the index since it creates interfaces on both -// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a -// method on Ipv4 to find the interface index corresponding to a given ipv4 -// address. -// -// First, assign IP addresses to the net devices and associated interfaces -// on Lan0. The AddIpv4Address method returns an Ipv4 interface index. -// Interpret ifIndexNd0 as the interface index to use to reference the -// net device we created on node zero when coming in from the Ipv4 interface. -// Net device numbers and interface indices are distinct. Interpret -// ifIndexNd2Lan0 as the interface index to use to reference the -// net device we created that connects node two to lan zero. -// - uint32_t ifIndexNd0 = CsmaIpv4Topology::AddIpv4Address (n0, nd0, - Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNd1 = CsmaIpv4Topology::AddIpv4Address (n1, nd1, - Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), + Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNd2Lan0 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, - Ipv4Address ("10.1.1.3"), Ipv4Mask ("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address ("10.1.1.2"), + Ipv4Mask ("255.255.255.0")); + +// +// We'll need these addresses later +// + Ipv4Address n2Lan0Addr ("10.1.1.3"); + Ipv4Address n2Lan1Addr ("10.1.2.1"); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, n2Lan0Addr, + Ipv4Mask ("255.255.255.0")); // // Assign IP addresses to the net devices and associated interfaces on Lan1 // - uint32_t ifIndexNd2Lan1 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, - Ipv4Address ("10.1.2.1"), Ipv4Mask ("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, n2Lan1Addr, + Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNd3 = CsmaIpv4Topology::AddIpv4Address (n3, nd1, - Ipv4Address ("10.1.2.2"), Ipv4Mask ("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n3, nd1, Ipv4Address ("10.1.2.2"), + Ipv4Mask ("255.255.255.0")); - uint32_t ifIndexNd4 = CsmaIpv4Topology::AddIpv4Address (n4, nd4, - Ipv4Address ("10.1.2.3"), Ipv4Mask ("255.255.255.0")); - - NS_DEBUG ("ifIndexNd0 = " << ifIndexNd0); - NS_DEBUG ("ifIndexNd1 = " << ifIndexNd1); - NS_DEBUG ("ifIndexNd2Lan0 = " << ifIndexNd2Lan0); - NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); - NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); - NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); -// -// A little silliness to let optimized code work while still printing all -// results in debug code (without attribute). -// - nd3 = nd3; - ifIndexNd1 = ifIndexNd1; - ifIndexNd3 = ifIndexNd3; - ifIndexNd4 = ifIndexNd4; + CsmaIpv4Topology::AddIpv4Address (n4, nd4, Ipv4Address ("10.1.2.3"), + Ipv4Mask ("255.255.255.0")); NS_DEBUG("Configure multicasting."); // @@ -216,34 +207,35 @@ main (int argc, char *argv[]) // // We are going to manually configure multicast routing. This means telling // node two that it should expect multicast data coming from IP address -// 10.1.1.1 over its IP interface connected to Lan0. These are called -// multicastSource and ifIndexNd2Lan0 respectively. When node two receives -// these packets, they should be forwarded out the interface that connects it -// to Lan1 which is called ifIndexNd2Lan1. All we need to do is to call the -// AddMulticastRoute method on node two's Ipv4 interface and provide this -// information. (Note: the vector of output interfaces is in case there are -// multiple net devices on a node). +// 10.1.1.1 originally. It should expect these data coming in over its IP +// interface connected to Lan0. When node two receives these packets, they +// should be forwarded out the interface that connects it to Lan1. +// +// We're going to need the interface indices on node two corresponding to +// these interfaces, which we call ifIndexLan0 and ifIndexLan1. The most +// general way to get these interfaces is to look them up by IP address. +// Looking back to the topology creation calls above, we saved the addresses +// assigned to the interface connecting node two to Lan0 and Lan1. Now is +// a fine time to find the interface indices on node two. // Ptr ipv4; ipv4 = n2->QueryInterface (Ipv4::iid); + uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr(n2Lan0Addr); + uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr(n2Lan1Addr); +// +// Now, we need to do is to call the AddMulticastRoute () method on node +// two's Ipv4 interface and tell it that whenever it receives a packet on +// the interface from Lan0, with the packet from the multicast source, +// destined for the multicast group, it should forward these packets down +// the interface connecting it to Lan1. (Note: the vector of output +// interfaces is in case there are multiple net devices on a node -- not +// true in this case). +// std::vector outputInterfaces (1); - outputInterfaces[0] = ifIndexNd2Lan1; + outputInterfaces[0] = ifIndexLan1; - ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexNd2Lan0, - outputInterfaces); -// -// We also need to explain to the node zero forwarding code that when it sees -// a packet destined for the multicast group it needs to send it out its -// one and only interface. The 0xffffffff in the call means that the input -// interface qualification is not applicable in this case (the packet has -// not been received over an interface, it has been created locally). -// - ipv4 = n0->QueryInterface (Ipv4::iid); - - outputInterfaces[0] = ifIndexNd0;; - - ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0xffffffff, + ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexLan0, outputInterfaces); // // As described above, node four will be the only node listening for the diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index 49a126547..8c7f9ce4b 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -136,11 +136,25 @@ Ipv4Impl::AddInterface (Ptr device) { return m_ipv4->AddInterface (device); } + uint32_t Ipv4Impl::GetNInterfaces (void) { return m_ipv4->GetNInterfaces (); } + +uint32_t +Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr) const +{ + return m_ipv4->FindInterfaceForAddr (addr); +} + +uint32_t +Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const +{ + return m_ipv4->FindInterfaceForAddr (addr, mask); +} + Ptr Ipv4Impl::GetNetDevice (uint32_t i) { diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index e7036f0d3..2f267a392 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -72,6 +72,11 @@ public: virtual uint32_t AddInterface (Ptr device); virtual uint32_t GetNInterfaces (void); + + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const; + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, + Ipv4Mask mask) const; + virtual Ptr GetNetDevice(uint32_t i); virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index de1ca314b..262c261a1 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -278,6 +278,33 @@ Ipv4L3Protocol::Lookup ( return; } + if (ipHeader.GetDestination ().IsMulticast () && + ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) + { + NS_DEBUG ("Ipv4L3Protocol::Lookup (): " + "Multicast destination with local source"); +// +// We have a multicast packet originating from the current node. We didn't +// want to force users to construct a route in order to get packets out of a +// node, so there will have been no route found and it is left to us to send +// the packet. What we'll do is to send the multicast out all of the +// interfaces on this node. +// + NS_DEBUG ("Ipv4StaticRouting::Lookup (): " + "Local source. Flooding multicast packet"); + + for (uint32_t i = 0; i < GetNInterfaces (); ++i) + { + Packet p = packet; + Ipv4Header h = ipHeader; + Ipv4Route route = + Ipv4Route::CreateHostRouteTo(h.GetDestination (), i); + NS_DEBUG ("Ipv4StaticRouting::Lookup (): " + "Send via interface " << i); + routeReply (true, route, p, h); + } + return; + } // No route found routeReply (false, Ipv4Route (), packet, ipHeader); } @@ -399,6 +426,49 @@ Ipv4L3Protocol::GetNInterfaces (void) const return m_nInterfaces; } +uint32_t +Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const +{ + NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ")"); + + uint32_t ifIndex = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++, ifIndex++) + { + if ((*i)->GetAddress () == addr) + { + return ifIndex; + } + } + + NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " + "Interface not found for IP address"); + return 0; +} + +uint32_t +Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const +{ + NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ", " << + mask << ")"); + + uint32_t ifIndex = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++, ifIndex++) + { + if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask)) + { + return ifIndex; + } + } + + NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " + "Interface not found for masked IP address"); + return 0; +} + Ipv4Interface * Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) { @@ -713,7 +783,40 @@ Ipv4L3Protocol::GetIfIndexForDestination ( return true; } } - return false; +// +// If there's no routing table entry telling us what single interface will be +// used to send a packet to this destination, we'll have to just pick one. +// If there's only one interface on this node, a good answer isn't very hard +// to come up with. Before jumping to any conclusions, remember that the +// zeroth interface is the loopback interface, so what we actually want is +// a situation where there are exactly two interfaces on the node, in which +// case interface one is the "single" interface. +// + if (GetNInterfaces () == 2) + { + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " + "One Interface. Using interface 1."); + ifIndex = 1; + return true; + } +// +// If we fall through to here, we have a node with multiple interfaces and +// no routes to guide us in determining what interface to choose. The last +// choice is to use the one set in the default route. +// + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " + "Using default route"); + Ipv4Route *route = m_staticRouting->GetDefaultRoute (); + + NS_ASSERT_MSG(route, + "Ipv4L3Protocol::GetIfIndexForDestination (): " + "Unable to determine outbound interface. No default route set"); + + ifIndex = route->GetInterface (); + + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " + "Default route specifies interface " << ifIndex); + return true; } uint16_t diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index c5f066314..2114558b3 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -174,9 +174,12 @@ public: uint32_t AddInterface (Ptr device); Ipv4Interface * GetInterface (uint32_t i) const; uint32_t GetNInterfaces (void) const; + + uint32_t FindInterfaceForAddr (Ipv4Address addr) const; + uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; - virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); - virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); + void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); void SetAddress (uint32_t i, Ipv4Address address); void SetNetworkMask (uint32_t i, Ipv4Mask mask); diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 9013769dd..cfd2a7046 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -230,6 +230,20 @@ Ipv4StaticRouting::GetNRoutes (void) n += m_networkRoutes.size (); return n; } + +Ipv4Route * +Ipv4StaticRouting::GetDefaultRoute () +{ + if (m_defaultRoute != 0) + { + return m_defaultRoute; + } + else + { + return 0; + } +} + Ipv4Route * Ipv4StaticRouting::GetRoute (uint32_t index) { @@ -331,14 +345,37 @@ Ipv4StaticRouting::RequestRoute ( NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << ipHeader.GetDestination ()); -// -// First, see if this is a multicast packet we have a route for. If we -// have a route, then send the packet down each of the specified interfaces. -// + if (ipHeader.GetDestination ().IsMulticast ()) { NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); - +// +// We have a multicast packet we're going to send. There are two distinct +// cases we need to support. The first is if the current node is the source +// of the packet. In that case, we don't want to have to consult multicast +// routing tables (nor build them) in order to send multicasts. The interface +// index (ifIndex) is Ipv4RoutingProtocol::IF_INDEX_ANY if we're the source. +// +// The second case is if the current packet has gotten to us by being +// received over one of our interfaces. In this case, ifIndex is set to the +// index over which we received the packet. For these packets, we need to +// consult the multicast routing table for a disposition. +// +// So, first let's see if we're the source. In this case, we don't consult +// the routing tables, but just return false and let the caller (up in +// ipv4-l3-protocol) flood the multicast packet out of all of its interfaces. +// We can't really do it here even if we wanted to since we have no easy way +// to get to the Ipv4 interface which we would need. +// + if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) + { + return false; + } +// +// If we fall through to this point, we have a multicast packet that has +// not originated at this node. We need to deal with forwarding. Let's +// see if we have a route, and if so go ahead and forward this puppy. +// Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), ipHeader.GetDestination (), ifIndex); @@ -349,14 +386,15 @@ Ipv4StaticRouting::RequestRoute ( for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) { Packet p = packet; + Ipv4Header h = ipHeader; Ipv4Route route = - Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), + Ipv4Route::CreateHostRouteTo(h.GetDestination (), mRoute->GetOutputInterface(i)); NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " "Send via interface " << mRoute->GetOutputInterface(i)); - routeReply (true, route, p, ipHeader); - return true; + routeReply (true, route, p, h); } + return true; } return false; // Let other routing protocols try to handle this } diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index b63e6ef1f..ac1351e1d 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -74,6 +74,7 @@ public: void SetDefaultRoute (Ipv4Address nextHop, uint32_t interface); uint32_t GetNRoutes (void); + Ipv4Route *GetDefaultRoute (void); Ipv4Route *GetRoute (uint32_t i); void RemoveRoute (uint32_t i); diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 576239964..202590aa5 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -182,10 +182,11 @@ UdpSocket::Connect(const Address & address) NotifyConnectionSucceeded (); m_connected = true; + NS_DEBUG ("UdpSocket::Connect (): Updating local address"); Ptr ipv4; ipv4 = m_node->QueryInterface (Ipv4::iid); m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); - NS_DEBUG ("UdpSocket::Connect (): Local address is" << + NS_DEBUG ("UdpSocket::Connect (): Local address is " << m_endPoint->GetLocalAddress()); return 0; } @@ -214,9 +215,9 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) } int -UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) +UdpSocket::DoSendTo (const Packet &p, Ipv4Address addr, uint16_t port) { - NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << ipv4 << ", " << + NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << addr << ", " << port << ")"); if (m_endPoint == 0) @@ -234,9 +235,16 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) return -1; } + NS_DEBUG ("UdpSocket::DoSendTo (): Finding source address"); + Ptr ipv4; + ipv4 = m_node->QueryInterface (Ipv4::iid); + + Ipv4Address source = ipv4->GetSourceAddress(m_defaultAddress); + NS_DEBUG ("UdpSocket::DoSendTo (): Source address is " << source); + NS_DEBUG("UdpSocket::DoSendTo (): Send to UDP"); - m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, - m_endPoint->GetLocalPort (), port); + m_udp->Send (p, source, addr, m_endPoint->GetLocalPort (), port); + NotifyDataSent (p.GetSize ()); return 0; } @@ -245,11 +253,13 @@ int UdpSocket::SendTo(const Address &address, const Packet &p) { NS_DEBUG("UdpSocket::SendTo (" << address << ", " << &p << ")"); +#if 0 if (m_connected) { m_errno = ERROR_ISCONN; return -1; } +#endif InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 7d28f012f..b79a29d89 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -274,6 +274,36 @@ public: */ virtual uint32_t GetNInterfaces (void) = 0; + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified IP address. + * \param addr The IP address assigned to the interface of interest. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address as a parameter and + * returns the interface index of the first interface that has been assigned + * that address. If the address is not found, this function asserts. + */ + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0; + + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified (masked) IP address. + * \param addr The IP address assigned to the interface of interest. + * \param mask The address mask to be used in address matching. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address and an IP address + * mask as parameters and returns the interface index of the first interface + * that matches the masked IP address. + */ + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, + Ipv4Mask mask) const = 0; + /** * \param i index of ipv4 interface * \returns the NetDevice associated with the ipv4 interface index From c566eebcd071930c0aa995a1adb76e23ddcf55e5 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 24 Aug 2007 17:38:49 -0700 Subject: [PATCH 049/218] semi-real multicast hardware addresses --- src/devices/csma/csma-net-device.cc | 20 ++++++++++++++++--- .../point-to-point-net-device.cc | 11 ++++++---- src/internet-node/arp-ipv4-interface.cc | 15 +++++++++++--- src/internet-node/ipv4-l3-protocol.cc | 5 +++-- src/node/net-device.cc | 11 +++++++++- src/node/net-device.h | 17 ++++++++++++++-- 6 files changed, 64 insertions(+), 15 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 531bf7314..bb1dbbd08 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -132,7 +132,7 @@ CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) m_queue = 0; EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); - EnableMulticast(); + EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); SetSendEnable (sendEnable); SetReceiveEnable (receiveEnable); @@ -500,10 +500,11 @@ CsmaNetDevice::Receive (const Packet& packet) EthernetHeader header (false); EthernetTrailer trailer; Eui48Address broadcast; + Eui48Address multicast; Eui48Address destination; Packet p = packet; - NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")"); + NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid()); // Only receive if send side of net device is enabled if (!IsReceiveEnabled()) @@ -522,12 +523,25 @@ CsmaNetDevice::Receive (const Packet& packet) trailer.CheckFcs(p); p.RemoveHeader(header); + NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " << + header.GetDestination ()); +// +// XXX BUGBUG +// +// An IP host group address is mapped to an Ethernet multicast address +// by placing the low-order 23-bits of the IP address into the low-order +// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). +// +// Need to mask off the appropriate multicast bits. +// + multicast = Eui48Address::ConvertFrom (GetMulticast ()); broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); destination = Eui48Address::ConvertFrom (GetAddress ()); if ((header.GetDestination() != broadcast) && + (header.GetDestination() != multicast) && (header.GetDestination() != destination)) { - // not for us. + NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt "); m_dropTrace (p); return; } diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index a071f9246..ada429621 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -68,11 +68,14 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, { NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")"); - // BUGBUG FIXME - // - // You _must_ support broadcast to get any sort of packet from the ARP layer. +// BUGBUG FIXME +// +// You _must_ support broadcast to get any sort of packet from the ARP layer. EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); - EnableMulticast(); +// +// Randomly pick the ethernet multicast address base +// + EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); EnablePointToPoint(); } diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index b5f87f0b6..e6012cde9 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -84,9 +84,18 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) else if (dest.IsMulticast ()) { NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast"); - // XXX BUGBUG - // Need real multicast addresses - hardwareDestination = GetDevice ()->GetBroadcast (); + NS_ASSERT_MSG(GetDevice ()->IsMulticast (), + "ArpIpv4Interface::SendTo (): Sending multicast packet over " + "non-multicast device"); +// XXX +// +// An IP host group address is mapped to an Ethernet multicast address +// by placing the low-order 23-bits of the IP address into the low-order +// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). +// +// Currently no easy way to or bit from Ipv4Address into Address +// + hardwareDestination = GetDevice ()->GetMulticast (); found = true; } else diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 262c261a1..28a612ac8 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -288,12 +288,13 @@ Ipv4L3Protocol::Lookup ( // want to force users to construct a route in order to get packets out of a // node, so there will have been no route found and it is left to us to send // the packet. What we'll do is to send the multicast out all of the -// interfaces on this node. +// interfaces on this node. Note that we start with interface 1 since we +// don't particularly want to send the packet out the loopback. // NS_DEBUG ("Ipv4StaticRouting::Lookup (): " "Local source. Flooding multicast packet"); - for (uint32_t i = 0; i < GetNInterfaces (); ++i) + for (uint32_t i = 1; i < GetNInterfaces (); ++i) { Packet p = packet; Ipv4Header h = ipHeader; diff --git a/src/node/net-device.cc b/src/node/net-device.cc index e3b9537aa..72d610924 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -113,6 +113,7 @@ NetDevice::IsBroadcast (void) const { return m_isBroadcast; } + Address const & NetDevice::GetBroadcast (void) const { @@ -139,10 +140,18 @@ NetDevice::IsMulticast (void) const return m_isMulticast; } +Address const & +NetDevice::GetMulticast (void) const +{ + NS_ASSERT (m_isMulticast); + return m_multicast; +} + void -NetDevice::EnableMulticast (void) +NetDevice::EnableMulticast (Address multicast) { m_isMulticast = true; + m_multicast = multicast; } void diff --git a/src/node/net-device.h b/src/node/net-device.h index cc93e6420..98c527e4b 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -138,10 +138,21 @@ public: * not true. */ Address const &GetBroadcast (void) const; + /** * \return value of m_isMulticast flag */ bool IsMulticast (void) const; + + /** + * \return the multicast address supported by + * this netdevice. + * + * Calling this method is invalid if IsMulticast returns + * not true. + */ + Address const &GetMulticast (void) const; + /** * \return value of m_isPointToPoint flag */ @@ -212,9 +223,10 @@ public: */ void DisableBroadcast (void); /** - * Set m_isMulticast flag to true + * Enable multicast support. This method should be + * called by subclasses from their constructor */ - void EnableMulticast (void); + void EnableMulticast (Address multicast); /** * Set m_isMulticast flag to false */ @@ -303,6 +315,7 @@ public: uint16_t m_ifIndex; Address m_address; Address m_broadcast; + Address m_multicast; uint16_t m_mtu; bool m_isUp; bool m_isBroadcast; From b9488ffdf77f283aebcb3071760885c2bfc557af Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 13:15:13 +0200 Subject: [PATCH 050/218] add image path --- doc/doxygen.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doxygen.conf b/doc/doxygen.conf index fc6fd25fa..7d6248d95 100644 --- a/doc/doxygen.conf +++ b/doc/doxygen.conf @@ -514,7 +514,7 @@ EXAMPLE_RECURSIVE = NO # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = doc # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program From 4dee2f6e92f45ccf6234145adcb7812546e15088 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 13:15:27 +0200 Subject: [PATCH 051/218] add operator << for Packet and TraceContext --- src/common/packet.cc | 6 ++++++ src/common/packet.h | 2 ++ src/core/trace-context.cc | 6 ++++++ src/core/trace-context.h | 2 ++ 4 files changed, 16 insertions(+) diff --git a/src/common/packet.cc b/src/common/packet.cc index 4c1a3b87d..966b2b879 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -199,6 +199,12 @@ Packet::Deserialize (Buffer buffer) buffer.RemoveAtStart (metadataDeserialized); } +std::ostream& operator<< (std::ostream& os, const Packet &packet) +{ + packet.Print (os); + return os; +} + } // namespace ns3 diff --git a/src/common/packet.h b/src/common/packet.h index 00c540600..f1e14cf02 100644 --- a/src/common/packet.h +++ b/src/common/packet.h @@ -328,6 +328,8 @@ private: static uint32_t m_globalUid; }; +std::ostream& operator<< (std::ostream& os, const Packet &packet); + /** * \defgroup packetperf Packet Performance * The current implementation of the byte buffers and tag list is based diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index 3082f50b5..1dbcf856e 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -231,6 +231,12 @@ TraceContext::Print (std::ostream &os) const } while (true); } +std::ostream& operator<< (std::ostream& os, const TraceContext &context) +{ + context.Print (os); + return os; +} + }//namespace ns3 #include "test.h" diff --git a/src/core/trace-context.h b/src/core/trace-context.h index d33ee2fda..78114732e 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -99,6 +99,8 @@ private: } * m_data; }; +std::ostream& operator<< (std::ostream& os, const TraceContext &context); + }//namespace ns3 namespace ns3 { From d1f9dd7bdedd4eb5ff46f7f4dbde8c7115f57b10 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 13:21:59 +0200 Subject: [PATCH 052/218] rename TraceContext::Add to AddElement and Union --- src/core/array-trace-resolver.h | 2 +- src/core/callback-trace-source.h | 2 +- src/core/composite-trace-resolver.cc | 2 +- src/core/composite-trace-resolver.h | 4 ++-- src/core/trace-context.cc | 16 ++++++++-------- src/core/trace-context.h | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index 3ba7147c5..116c875ab 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -137,7 +137,7 @@ ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, co { TraceContext tmp = context; INDEX index = j; - tmp.Add (index); + tmp.AddElement (index); Ptr obj = m_iter->Get (); obj->TraceConnect (subpath, cb, tmp); j++; diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index beeec7045..4b5f61b93 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -75,7 +75,7 @@ CallbackTraceSource::AddCallback (CallbackBase const & callback, { Callback cb; cb.Assign (callback); - m_context.Add (context); + m_context.Union (context); m_callbackList.push_back (cb); } template - */ -#include "trace-root.h" -#include "composite-trace-resolver.h" -#include "trace-context.h" - -namespace ns3 { - -void -TraceRoot::Connect (std::string path, CallbackBase const &cb) -{ - Ptr resolver = GetComposite (); - resolver->Connect (path, cb, TraceContext ()); -} -void -TraceRoot::Disconnect (std::string path, CallbackBase const &cb) -{ - Ptr resolver = GetComposite (); - resolver->Disconnect (path, cb); -} -void -TraceRoot::Register (std::string name, - Callback > createResolver) -{ - Ptr resolver = GetComposite (); - resolver->Add (name, createResolver); -} - -Ptr -TraceRoot::GetComposite (void) -{ - static CompositeTraceResolver resolver; - return &resolver; -} - -} // namespace ns3 diff --git a/src/core/trace-root.h b/src/core/trace-root.h deleted file mode 100644 index eb3ddc2ea..000000000 --- a/src/core/trace-root.h +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- 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 - * - * Author: Mathieu Lacage - */ -#ifndef TRACE_ROOT_H -#define TRACE_ROOT_H - -#include -#include "callback.h" - -/** - * \defgroup lowleveltracing Low-level tracing - * - * This low-level API is built around a few concepts: - * - There can be any number of trace source objects. Each trace source - * object can generate any number of trace events. The current - * trace source objects are: ns3::CallbackTraceSourceSource, ns3::UVTraceSource, - * ns3::SVTraceSource, and, ns3::FVTraceSource. - * - Each trace source can be connected to any number of trace sinks. - * A trace sink is a ns3::Callback with a very special signature. Its - * first argument is always a ns3::TraceContext. - * - Every trace source is uniquely identified by a ns3::TraceContext. Every - * trace sink can query a ns3::TraceContext for information. This allows - * a trace sink which is connected to multiple trace sources to identify - * from which source each event is coming from. - * - * To define new trace sources, a model author needs to instante one trace source - * object for each kind of tracing event he wants to export. The trace source objects - * currently defined are: - * - ns3::CallbackTraceSourceSource: this trace source can be used to convey any kind of - * trace event to the user. It is a functor, that is, it is a variable - * which behaves like a function which will forward every event to every - * connected trace sink (i.e., ns3::Callback). This trace source takes - * up to four arguments and forwards these 4 arguments together with the - * ns3::TraceContext which identifies this trace source to the connected - * trace sinks. - * - ns3::UVTraceSource: this trace source is used to convey key state variable - * changes to the user. It behaves like a normal integer unsigned variable: - * you can apply every normal arithmetic operator to it. It will forward - * every change in the value of the variable back to every connected trace - * sink by providing a TraceContext, the old value and the new value. - * - ns3::SVTraceSource: this is the signed integer equivalent of - * ns3::UVTraceSource. - * - ns3::FVTraceSource: this is the floating point equivalent of - * ns3::UVTraceSource and ns3::SVTraceSource. - * - * For example, to define a trace source which notifies you of a new packet - * being transmitted, you would have to: - * \code - * class MyModel - * { - * public: - * void Tx (Packet const &p); - * private: - * CallbackTraceSource m_txTrace; - * }; - * - * void - * MyModel::Tx (Packet const &p) - * { - * // trace packet tx event. - * m_txTrace (p); - * // ... send the packet for real. - * } - * \endcode - * - * Once the model author has instantiated these objects and has wired them - * in his simulation code (that is, he calls them wherever he wants to trigger - * a trace event), he needs to make these trace sources available to users - * to allow them to connect any number of trace sources to any number - * of user trace sinks. While it would be possible to make each model - * export directly each of his trace source instances and request users to - * invoke a source->Connect (callback) method to perform the connection - * explicitely, it was felt that this was a bit cumbersome to do. - * - * As such, the ``connection'' between a set of sources and a sink is - * performed through a third-party class, the TraceResolver, which - * can be used to automate the connection of multiple matching trace sources - * to a single sink. This TraceResolver works by defining a hierarchical - * tracing namespace: the root of this namespace is accessed through the - * ns3::TraceRoot class. The namespace is represented as a string made of - * multiple elements, each of which is separated from the other elements - * by the '/' character. A namespace string always starts with a '/'. - * - * By default, the current simulation models provide a '/nodes' tracing root. - * This '/nodes' namespace is structured as follows: - * \code - * /nodes/n/arp - * /nodes/n/udp - * /nodes/n/ipv4 - * /tx - * /rx - * /drop - * /interfaces/n/netdevice - * /queue/ - * /enque - * /deque - * /drop - * \endcode - * - * The 'n' element which follows the /nodes and /interfaces namespace elements - * identify a specific node and interface through their index within the - * ns3::NodeList and ns3::Ipv4 objects respectively. - * - * To connect a trace sink to a trace source identified by a namespace string, - * a user can call the ns3::TraceRoot::Connect method (the ns3::TraceRoot::Disconnect - * method does the symmetric operation). This connection method can accept - * fully-detailed namespace strings but it can also perform pattern matching - * on the user-provided namespace strings to connect multiple trace sources - * to a single trace sink in a single connection operation. - * - * The syntax of the pattern matching rules are loosely based on regular - * expressions: - * - the '*' character matches every element - * - the (a|b) construct matches element 'a' or 'b' - * - the [ss-ee] construct matches all numerical values which belong - * to the interval which includes ss and ee - * - * For example, the user could use the following to connect a single sink - * to the ipv4 tx, rx, and drop trace events: - * - * \code - * void MyTraceSink (TraceContext const &context, Packet &packet); - * TraceRoot::Connect ("/nodes/ * /ipv4/ *", MakeCallback (&MyTraceSink)); - * \endcode - * - * Of course, this code would work only if the signature of the trace sink - * is exactly equal to the signature of all the trace sources which match - * the namespace string (if one of the matching trace source does not match - * exactly, a fatal error will be triggered at runtime during the connection - * process). The ns3::TraceContext extra argument contains - * information on where the trace source is located in the namespace tree. - * In that example, if there are multiple nodes in this scenario, each - * call to the MyTraceSink function would receive a different TraceContext, - * each of which would contain a different NodeList::NodeIndex object. - * - * It is important to understand exactly what an ns3::TraceContext - * is. It is a container for a number of type instances. Each instance of - * a ns3::TraceContext contains one and only one instance of a given type. - * ns3::TraceContext::Add can be called to add a type instance into a - * TraceContext instance and ns3::TraceContext::Get can be called to get - * a copy of a type instance stored into the ns3::TraceContext. If ::Get - * cannot retrieve the requested type, a fatal error is triggered at - * runtime. The values stored into an ns3::TraceContext attached to a - * trace source are automatically determined during the namespace - * resolution process. To retrieve a value from a ns3::TraceContext, the - * code can be as simple as this: - * \code - * void MyTraceSink (TraceContext const &context, Packet &packet) - * { - * NodeList::NodeIndex index; - * context.Get (index); - * std::cout << "node id=" << NodeList::GetNode (index)->GetId () << std::endl; - * } - * \endcode - * - * The hierarchical global namespace described here is not implemented - * in a single central location: it was felt that doing this would make - * it too hard to introduce user-specific models which could hook - * automatically into the overal tracing system. If the tracing - * namespace was implemented in a single central location, every model - * author would have had to modify this central component to make - * his own model available to trace users. - * - * Instead, the handling of the namespace is distributed across every relevant - * model: every model implements only the part of the namespace it is - * really responsible for. To do this, every model is expected - * to provide an instance of a TraceResolver whose - * responsability is to recursively provide access to the trace sources - * defined in its model. Each TraceResolver instance should be a subclass - * of the TraceResolver base class which implements either the DoLookup - * or the DoConnect and DoDisconnect methods. Because implementing these - * methods can be a bit tedious, our tracing framework provides a number - * of helper template classes which should save the model author from - * having to implement his own in most cases: - * - ns3::CompositeTraceResolver: this subclass of ns3::TraceResolver can - * be used to aggregate together multiple trace sources and multiple other - * ns3::TraceResolver instances. - * - ns3::ArrayTraceResolver: this subclass of ns3::TraceResolver can be - * used to match any number of elements within an array where every element - * is identified by its index. - * - * Once you can instantiate your own ns3::TraceResolver object instance, you - * have to hook it up into the global namespace. There are two ways to do this: - * - you can hook your ns3::TraceResolver creation method as a new trace - * root by using the ns3::TraceRoot::Register method - * - you can hook your new ns3::TraceResolver creation method into the - * container of your model. This step will obvsiouly depend on which model - * contains your own model but, if you wrote a new l3 protocol, all you - * would have to do to hook into your container L3Demux class is to implement - * the pure virtual method inherited from the L3Protocol class whose name is - * ns3::L3protocol::CreateTraceResolver. - * - * So, in most cases, exporting a model's trace sources is a matter of - * implementing a method CreateTraceResolver as shown below: - * \code - * class MyModel - * { - * public: - * enum TraceType { - * TX, - * RX, - * ... - * }; - * TraceResolver *CreateTraceResolver (TraceContext const &context); - * void Tx (Packet const &p); - * private: - * CallbackTraceSource m_txTrace; - * }; - * - * TraceResolver * - * MyModel::CreateTraceResolver (TraceContext const &context) - * { - * CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - * resolver->Add ("tx", m_txTrace, MyModel::TX); - * return resolver; - * } - * void - * MyModel::Tx (Packet const &p) - * { - * m_txTrace (p); - * } - * \endcode - * - * If you really want to have fun and implement your own ns3::TraceResolver - * subclass, you need to understand the basic Connection and Disconnection - * algorithm. The code of that algorithm is wholy contained in the - * ns3::TraceResolver::Connect and ns3::TraceResolver::Disconnect methods. - * The idea is that we recursively parse the input namespace string by removing - * the first namespace element. This element is 'resolved' is calling - * the ns3::TraceResolver::DoLookup method which returns a list of - * TraceResolver instances. Each of the returned TraceResolver instance is - * then given what is left of the namespace by calling ns3::TraceResolver::Connect - * until the last namespace element is processed. At this point, we invoke - * the ns3::TraceResolver::DoConnect or ns3::TraceResolver::DoDisconnect - * methods to break the recursion. A good way to understand this algorithm - * is to trace its behavior. Let's say that you want to connect to - * '/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *'. It would generate - * the following call traces: - * - * \code - * TraceRoot::Connect ("/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * traceContext = TraceContext (); - * rootResolver = CompositeTraceResolver (traceContext); - * rootResolver->Connect ("/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * resolver = CompositeTraceResolver::DoLookup ("nodes"); - * return NodeList::CreateTraceResolver (GetContext ()); - * return ArrayTraceResolver (context); - * resolver->Connect ("/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * ArrayTraceResolver::DoLookup ("*"); - * for (i = 0; i < n_nodes; i++) - * resolver = nodes[i]->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (context); - * resolvers.add (resolver); - * return resolvers; - * for resolver in (resolvers) - * resolver->Connect ("/ipv4/interfaces/ * /netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("ipv4"); - * resolver = ipv4->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (context); - * return resolver; - * resolver->Connect ("/interfaces/ * /netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("interfaces"); - * resolver = ArrayTraceResolver (GetContext ()); - * resolver->Connect ("/ * /netdevice/queue/ *", callback); - * ArrayTraceResolver::DoLookup ("*"); - * for (i = 0; i < n_interfaces; i++) - * resolver = interfaces[i]->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver () - * resolvers.add (resolver); - * return resolvers; - * resolver->Connect ("/netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("netdevice"); - * resolver = NetDevice::CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (); - * return resolver; - * resolver->Connect ("/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("queue"); - * resolver = Queue::CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (); - * return resolver - * resolver->Connect ("*", callback); - * CompositeTraceResolver::DoLookup ("*"); - * for match in (matches) - * resolver = TerminalTraceResolver ("match"); - * resolvers.add (resolver) - * return resolvers; - * for resolver in (resolvers) - * TerminalTraceResolver->DoConnect (callback); - * \endcode - */ - -namespace ns3 { - -class CompositeTraceResolver; -class TraceResolver; -class TraceContext; -class CallbackBase; - -/** - * \brief The main class used to access tracing functionality for - * a user. - * - * \ingroup lowleveltracing - */ -class TraceRoot -{ -public: - static void Connect (std::string path, CallbackBase const &cb); - static void Disconnect (std::string path, CallbackBase const &cb); - static void Register (std::string name, - Callback > createResolver); -private: - static Ptr GetComposite (void); -}; - -}// namespace ns3 - -#endif /* TRACE_ROOT_H */ diff --git a/src/core/wscript b/src/core/wscript index ea91c7619..dacab2c32 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -49,7 +49,6 @@ def build(bld): 'callback-trace-source.cc', 'empty-trace-resolver.cc', 'composite-trace-resolver.cc', - 'trace-root.cc', ] if sys.platform == 'win32': @@ -92,6 +91,5 @@ def build(bld): 'empty-trace-resolver.h', 'composite-trace-resolver.h', 'array-trace-resolver.h', - 'trace-root.h', ] diff --git a/src/internet-node/ascii-trace.cc b/src/internet-node/ascii-trace.cc index cb48f06fc..582a37854 100644 --- a/src/internet-node/ascii-trace.cc +++ b/src/internet-node/ascii-trace.cc @@ -21,9 +21,9 @@ #include "ascii-trace.h" #include "ns3/trace-context.h" -#include "ns3/trace-root.h" #include "ns3/simulator.h" #include "ns3/node.h" +#include "ns3/node-list.h" #include "ns3/packet.h" namespace ns3 { @@ -40,15 +40,15 @@ void AsciiTrace::TraceAllQueues (void) { Packet::EnableMetadata (); - TraceRoot::Connect ("/nodes/*/devices/*/queue/*", - MakeCallback (&AsciiTrace::LogDevQueue, this)); + NodeList::Connect ("/nodes/*/devices/*/queue/*", + MakeCallback (&AsciiTrace::LogDevQueue, this)); } void AsciiTrace::TraceAllNetDeviceRx (void) { Packet::EnableMetadata (); - TraceRoot::Connect ("/nodes/*/devices/*/rx", - MakeCallback (&AsciiTrace::LogDevRx, this)); + NodeList::Connect ("/nodes/*/devices/*/rx", + MakeCallback (&AsciiTrace::LogDevRx, this)); } void diff --git a/src/internet-node/pcap-trace.cc b/src/internet-node/pcap-trace.cc index 240100fb5..dd0b39a29 100644 --- a/src/internet-node/pcap-trace.cc +++ b/src/internet-node/pcap-trace.cc @@ -22,7 +22,7 @@ #include -#include "ns3/trace-root.h" +#include "ns3/node-list.h" #include "ns3/trace-context.h" #include "ns3/callback.h" #include "ns3/pcap-writer.h" @@ -50,8 +50,8 @@ PcapTrace::~PcapTrace () void PcapTrace::TraceAllIp (void) { - TraceRoot::Connect ("/nodes/*/ipv4/(tx|rx)", - MakeCallback (&PcapTrace::LogIp, this)); + NodeList::Connect ("/nodes/*/ipv4/(tx|rx)", + MakeCallback (&PcapTrace::LogIp, this)); } PcapWriter * diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 1b74dbe86..4fd63ed81 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -20,24 +20,12 @@ * Mathieu Lacage , */ -#include "ns3/array-trace-resolver.h" -#include "ns3/trace-root.h" +#include "ns3/composite-trace-resolver.h" #include "ns3/simulator.h" #include "ns3/simulation-singleton.h" #include "node-list.h" #include "node.h" -namespace { -static class Initialization -{ -public: - Initialization () - { - ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::GetTraceResolver)); - } -} g_initialization; -} - namespace ns3 { NodeListIndex::NodeListIndex () @@ -133,9 +121,8 @@ NodeListPriv::GetNode (uint32_t n) Ptr NodeListPriv::GetTraceResolver (void) { - Ptr >resolver = - Create > (); - resolver->SetIterators (Begin (), End ()); + Ptr resolver = Create (); + resolver->AddArray ("nodes", Begin (), End (), NodeListIndex ()); return resolver; } @@ -163,17 +150,21 @@ NodeList::End (void) { return SimulationSingleton::Get ()->End (); } -Ptr -NodeList::GetTraceResolver (void) -{ - return SimulationSingleton::Get ()->GetTraceResolver (); -} Ptr NodeList::GetNode (uint32_t n) { return SimulationSingleton::Get ()->GetNode (n); } - +void +NodeList::Connect (std::string name, const CallbackBase &cb) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->Connect (name, cb, TraceContext ()); +} +void +NodeList::Disconnect (std::string name, const CallbackBase &cb) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->Disconnect (name, cb); +} }//namespace ns3 diff --git a/src/node/node-list.h b/src/node/node-list.h index 8af457b88..d40587094 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -29,8 +29,7 @@ namespace ns3 { class Node; -class TraceResolver; -class TraceContext; +class CallbackBase; class NodeListIndex : public TraceContextElement { @@ -73,19 +72,28 @@ public: * list. */ static Iterator End (void); - /** - * \param context trace context to use for trace resolver - * to create. - * \returns the requested trace resolver. The caller - * takes ownership of the returned pointer. - */ - static Ptr GetTraceResolver (void); - /** * \param n index of requested node. * \returns the Node associated to index n. */ static Ptr GetNode (uint32_t n); + /** + * \param name namespace regexp to match + * \param cb callback to connect + * + * Connect input callback to all trace sources which match + * the input namespace regexp. + */ + static void Connect (std::string name, const CallbackBase &cb); + /** + * \param name namespace regexp to match + * \param cb callback to connect + * + * Disconnect input callback from all trace sources which match + * the input namespace regexp. + */ + static void Disconnect (std::string name, const CallbackBase &cb); +private: }; }//namespace ns3 From 7a93777ac89e341b5f16b7024580b01a837fbe34 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 14:06:11 +0200 Subject: [PATCH 054/218] cleanup a bit --- src/core/trace-resolver.cc | 9 ------- src/core/trace-resolver.h | 54 ++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index b92bc785f..4d4e4078a 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -48,15 +48,6 @@ TraceResolver::Unref (void) } } - -void -TraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) -{} - -void -TraceResolver::Disconnect (std::string path, CallbackBase const &cb) -{} - std::string TraceResolver::GetElement (std::string path) { diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 78a3a0a4b..f22b73352 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -30,22 +30,14 @@ namespace ns3 { class CallbackBase; /** - * \brief the base class which is used to incremental perform trace + * \brief the base class which is used to recursively perform trace * namespace resolution. - * \ingroup lowleveltracing + * \ingroup tracing * - * This class provides a public API to the ns3::TraceRoot object: - * - ns3::TraceResolver::Connect - * - ns3::TraceResolver::Disconnect - * - * It also provides an API for its subclasses. Each subclass should - * implement one of: - * - ns3::TraceResolver::DoLookup - * - ns3::TraceResolver::DoConnect and ns3::TraceResolver::DoDisconnect - * Each subclass must also provide an ns3::TraceContext to the TraceResolver - * constructor. Finally, each subclass can access the ns3::TraceContext - * associated to this ns3::TraceResolver through the - * ns3::TraceResolver::GetContext method. + * Subclasses must implement the two pure virtal methods defined in + * this base class: + * - ns3::TraceResolver::Connect + * - ns3::TraceResolver::Disconnect. */ class TraceResolver { @@ -59,24 +51,42 @@ public: /** * \param path the namespace path to resolver * \param cb the callback to connect to the matching namespace + * \param context the context in which to store the trace context * - * This method is typically invoked by ns3::TraceRoot but advanced - * users could also conceivably call it directly if they want to - * skip the ns3::TraceRoot. + * First, extract the leading path element from the input path, and + * match this leading patch element against any terminal trace source + * contained in this trace resolver. + * Second, recursively resolve the rest of the path using other + * objects if there are any. + * If there is any TraceContextElement associated to one of the matching + * elements, it should be added to the input TraceContext. */ - virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context) = 0; /** * \param path the namespace path to resolver * \param cb the callback to disconnect in the matching namespace * - * This method is typically invoked by ns3::TraceRoot but advanced - * users could also conceivably call it directly if they want to - * skip the ns3::TraceRoot. + * This method should behave as Connect. */ - virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; protected: + /** + * \param path a namespace path + * \returns the initial element of the path. + * + * If the input path is "/foo/...", the return + * value is "foo". + */ std::string GetElement (std::string path); + /** + * \param path a namespace path + * \returns the subpath. + * + * If the input path is "/foo/bar/...", the return + * value is "/bar/...". + */ std::string GetSubpath (std::string path); +private: uint32_t m_count; }; From 36b572607e29d8b906322ffbaf6d8a7f3b70d583 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 14:59:50 +0200 Subject: [PATCH 055/218] add TraceContextElement::GetName method --- src/core/composite-trace-resolver.cc | 2 ++ src/core/trace-context-element.cc | 7 +++++++ src/core/trace-context-element.h | 13 +++++++++++++ src/devices/csma-cd/csma-cd-net-device.cc | 5 +++++ src/devices/csma-cd/csma-cd-net-device.h | 1 + .../point-to-point/point-to-point-net-device.cc | 5 +++++ .../point-to-point/point-to-point-net-device.h | 1 + src/internet-node/ipv4-l3-protocol.cc | 10 ++++++++++ src/internet-node/ipv4-l3-protocol.h | 2 ++ src/internet-node/ipv4-l4-demux.cc | 5 +++++ src/internet-node/ipv4-l4-demux.h | 1 + src/node/node-list.cc | 5 +++++ src/node/node-list.h | 1 + src/node/node.cc | 5 +++++ src/node/node.h | 1 + src/node/queue.cc | 5 +++++ src/node/queue.h | 1 + 17 files changed, 70 insertions(+) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 308544868..edf1e9c26 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -273,6 +273,7 @@ public: else if (m_sources == DOUBLEB) {os << "doubleB";} else if (m_sources == UINT16_T) {os << "uint16_t";} } + std::string GetName (void) {return "TraceSourceTest";} TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {} TraceSourceTest (enum Sources sources) :m_sources (sources) {} bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;} @@ -292,6 +293,7 @@ public: {static uint16_t uid = AllocateUid ("SubTraceSourceTest"); return uid;} void Print (std::ostream &os) {os << "subtracesource=int";} + std::string GetName (void) const {return "SubTraceSourceTest";} SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {} SubTraceSourceTest (enum Sources sources) : m_sources (sources) {} private: diff --git a/src/core/trace-context-element.cc b/src/core/trace-context-element.cc index 838250af8..24b02fd23 100644 --- a/src/core/trace-context-element.cc +++ b/src/core/trace-context-element.cc @@ -2,6 +2,13 @@ namespace ns3 { +std::string +ElementRegistry::GetName (uint16_t uid) +{ + InfoVector *vec = GetInfoVector (); + struct Info info = (*vec)[uid - 1]; + return info.getName (); +} uint32_t ElementRegistry::GetSize (uint16_t uid) { diff --git a/src/core/trace-context-element.h b/src/core/trace-context-element.h index e1c36c4d9..fa945294d 100644 --- a/src/core/trace-context-element.h +++ b/src/core/trace-context-element.h @@ -115,19 +115,24 @@ public: static uint32_t GetSize (uint16_t uid); static void Print (uint16_t uid, uint8_t *instance, std::ostream &os); + static std::string GetName (uint16_t uid); static void Destroy (uint16_t uid, uint8_t *instance); private: + typedef std::string (*GetNameCb) (void); typedef void (*PrintCb) (uint8_t *instance, std::ostream &os); typedef void (*DestroyCb) (uint8_t *instance); struct Info { uint32_t size; std::string uidString; + GetNameCb getName; PrintCb print; DestroyCb destroy; }; typedef std::vector InfoVector; static InfoVector *GetInfoVector (void); template + static std::string DoGetName (void); + template static void DoPrint (uint8_t *instance, std::ostream &os); template static void DoDestroy (uint8_t *instance); @@ -143,6 +148,13 @@ ElementRegistry::DoPrint (uint8_t *instance, std::ostream &os) obj.Print (os); } template +std::string +ElementRegistry::DoGetName (void) +{ + static T obj; + return obj.GetName (); +} +template void ElementRegistry::DoDestroy (uint8_t *instance) { @@ -169,6 +181,7 @@ ElementRegistry::AllocateUid (std::string name) struct Info info; info.size = sizeof (T); info.uidString = name; + info.getName = &ElementRegistry::DoGetName; info.print = &ElementRegistry::DoPrint; info.destroy = &ElementRegistry::DoDestroy; vec->push_back (info); diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index 82b6b7db6..6454ae724 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -59,6 +59,11 @@ CsmaCdTraceType::GetUid (void) static uint16_t uid = AllocateUid ("CsmaCdTraceType"); return uid; } +std::string +CsmaCdTraceType::GetName (void) const +{ + return "CsmaCdTraceType"; +} CsmaCdNetDevice::CsmaCdNetDevice (Ptr node) diff --git a/src/devices/csma-cd/csma-cd-net-device.h b/src/devices/csma-cd/csma-cd-net-device.h index 5de056109..9348674a2 100644 --- a/src/devices/csma-cd/csma-cd-net-device.h +++ b/src/devices/csma-cd/csma-cd-net-device.h @@ -52,6 +52,7 @@ public: CsmaCdTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetName (void) const; private: enum Type m_type; }; diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 3b94b5bcf..4d7e89e7c 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -53,6 +53,11 @@ PointToPointTraceType::GetUid (void) static uint16_t uid = AllocateUid ("PointToPointTraceType"); return uid; } +std::string +PointToPointTraceType::GetName (void) const +{ + return "PointToPointTraceType"; +} PointToPointNetDevice::PointToPointNetDevice (Ptr node, diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 5cee2cf70..9844699af 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -44,6 +44,7 @@ public: PointToPointTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetName (void) const; }; /** diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 2e3f4a421..d01034ef2 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -87,6 +87,11 @@ Ipv4L3ProtocolTraceContextElement::GetUid (void) static uint16_t uid = AllocateUid ("Ipv4L3ProtocolTraceContextElement"); return uid; } +std::string +Ipv4L3ProtocolTraceContextElement::GetName (void) const +{ + return "Ipv4L3ProtocolTraceContextElement"; +} Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex () @@ -111,6 +116,11 @@ Ipv4L3ProtocolInterfaceIndex::GetUid (void) static uint16_t uid = AllocateUid ("Ipv4L3ProtocolInterfaceIndex"); return uid; } +std::string +Ipv4L3ProtocolInterfaceIndex::GetName (void) const +{ + return "Ipv4L3ProtocolInterfaceIndex"; +} Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 0866861c0..ad9d482d2 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -59,6 +59,7 @@ public: bool IsDrop (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetName (void) const; private: enum Type m_type; }; @@ -71,6 +72,7 @@ public: uint32_t Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetName (void) const; private: uint32_t m_index; }; diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 74ee536b5..120b3f47e 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -54,6 +54,11 @@ Ipv4L4ProtocolTraceContextElement::GetUid (void) static uint16_t uid = AllocateUid ("Ipv4L4ProtocolTraceContextElement"); return uid; } +std::string +Ipv4L4ProtocolTraceContextElement::GetName (void) const +{ + return "Ipv4L4ProtocolTraceContextElement"; +} Ipv4L4Demux::Ipv4L4Demux (Ptr node) diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 4700ec697..efd91bd44 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -45,6 +45,7 @@ public: int Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetName (void) const; private: int m_protocolNumber; }; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 4fd63ed81..2276c0da3 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -50,6 +50,11 @@ NodeListIndex::Get (void) const { return m_index; } +std::string +NodeListIndex::GetName (void) const +{ + return "NodeListIndex"; +} /** diff --git a/src/node/node-list.h b/src/node/node-list.h index d40587094..6774d8ce7 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -39,6 +39,7 @@ public: void Print (std::ostream &os); static uint16_t GetUid (void); uint32_t Get (void) const; + std::string GetName (void) const; private: uint32_t m_index; }; diff --git a/src/node/node.cc b/src/node/node.cc index 031ed34ab..52231fa1b 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -52,6 +52,11 @@ NodeNetDeviceIndex::GetUid (void) static uint16_t uid = AllocateUid ("NodeNetDeviceIndex"); return uid; } +std::string +NodeNetDeviceIndex::GetName (void) const +{ + return "NodeNetDeviceIndex"; +} diff --git a/src/node/node.h b/src/node/node.h index 0066bf319..062f259c6 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -44,6 +44,7 @@ public: NodeNetDeviceIndex (uint32_t index); uint32_t Get (void) const; void Print (std::ostream &os) const; + std::string GetName (void) const; static uint16_t GetUid (void); private: uint32_t m_index; diff --git a/src/node/queue.cc b/src/node/queue.cc index 00b6f5387..10bcc1c04 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -32,6 +32,11 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue", Queue::iid, "DropTailQueue"); +std::string +QueueTraceType::GetName (void) const +{ + return "QueueTraceType"; +} uint16_t QueueTraceType::GetUid (void) { diff --git a/src/node/queue.h b/src/node/queue.h index c10795c67..f10191fad 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -52,6 +52,7 @@ public: bool IsDequeue (void) const; bool IsDrop (void) const; void Print (std::ostream &os) const; + std::string GetName (void) const; private: enum Type m_type; }; From e2ee92d07f44042903a426f3671232acc9aa4263 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 15:07:39 +0200 Subject: [PATCH 056/218] remove dead code --- src/core/empty-trace-resolver.cc | 24 --------- src/core/empty-trace-resolver.h | 52 -------------------- src/core/wscript | 2 - src/internet-node/arp-l3-protocol.cc | 1 - src/internet-node/ipv4-loopback-interface.cc | 1 - src/internet-node/udp-l4-protocol.cc | 1 - 6 files changed, 81 deletions(-) delete mode 100644 src/core/empty-trace-resolver.cc delete mode 100644 src/core/empty-trace-resolver.h diff --git a/src/core/empty-trace-resolver.cc b/src/core/empty-trace-resolver.cc deleted file mode 100644 index dc3478864..000000000 --- a/src/core/empty-trace-resolver.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- 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 - * - * Author: Mathieu Lacage - */ -#include "empty-trace-resolver.h" - -ns3::EmptyTraceResolver::EmptyTraceResolver () -{} diff --git a/src/core/empty-trace-resolver.h b/src/core/empty-trace-resolver.h deleted file mode 100644 index 1e5ddab46..000000000 --- a/src/core/empty-trace-resolver.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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 - * - * Author: Mathieu Lacage - */ -#ifndef EMPTY_TRACE_RESOLVER_H -#define EMPTY_TRACE_RESOLVER_H - -#include "trace-resolver.h" - -namespace ns3 { - -class TraceContext; - -/** - * \brief a TraceResolver instance which does not resolve anything. - * \ingroup tracing - * - * Trying to resolve against this class will yield no matches and no - * connections. Returning an instance of this class from a - * CreateTraceResolver method is a hand way of not implementing - * any Tracing code. - */ -class EmptyTraceResolver : public TraceResolver -{ -public: - /** - * \param o necessary context for this class. - * - * The only constructor exported by this class. - */ - EmptyTraceResolver (); -}; - -}//namespace ns3 - -#endif /* EMPTY_TRACE_RESOLVER_H */ diff --git a/src/core/wscript b/src/core/wscript index dacab2c32..7d913eddc 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -47,7 +47,6 @@ def build(bld): 'trace-context-element.cc', 'trace-resolver.cc', 'callback-trace-source.cc', - 'empty-trace-resolver.cc', 'composite-trace-resolver.cc', ] @@ -88,7 +87,6 @@ def build(bld): 'trace-context.h', 'trace-context-element.h', 'trace-resolver.h', - 'empty-trace-resolver.h', 'composite-trace-resolver.h', 'array-trace-resolver.h', ] diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index b4d346e60..bcc62bfe2 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -20,7 +20,6 @@ */ #include "ns3/packet.h" #include "ns3/debug.h" -#include "ns3/empty-trace-resolver.h" #include "ns3/node.h" #include "ns3/net-device.h" diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 307533d6e..d3bc45207 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -19,7 +19,6 @@ * Authors: * Mathieu Lacage , */ -#include "ns3/empty-trace-resolver.h" #include "ns3/net-device.h" #include "ns3/node.h" #include "ipv4-loopback-interface.h" diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index d9b5afe23..fc2a54dc9 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -21,7 +21,6 @@ #include "ns3/assert.h" #include "ns3/packet.h" -#include "ns3/empty-trace-resolver.h" #include "ns3/node.h" #include "udp-l4-protocol.h" From 9ddb7b2e45d8f47aa8ba089e9321613a7be792eb Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 15:34:57 +0200 Subject: [PATCH 057/218] replace enum with virtual class and subclasses --- src/core/composite-trace-resolver.cc | 106 ++++++++++++++------------- src/core/composite-trace-resolver.h | 22 ++---- 2 files changed, 62 insertions(+), 66 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index edf1e9c26..972867731 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -128,13 +128,35 @@ void CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { NS_DEBUG ("connect path="<name == id) { - OperationOne (subpath, i, cb, context, op); - DoRecursiveOperationForParent (path, cb, context, op); + operation.Do (subpath, *i); + operation.DoParent (path, m_parent); return; } } @@ -192,60 +214,40 @@ CompositeTraceResolver::DoRecursiveOperation (std::string path, { if ((*j)->name == *i) { - OperationOne (subpath, j, cb, context, op); + operation.Do (subpath, *j); break; } } } - DoRecursiveOperationForParent (path, cb, context, op); -} - -void -CompositeTraceResolver::DoRecursiveOperationForParent (std::string path, - const CallbackBase &cb, - const TraceContext &context, - enum Operation op) -{ - if (m_parent == 0) - { - return; - } - switch (op) { - case CONNECT: - m_parent->Connect (path, cb, context); - break; - case DISCONNECT: - m_parent->Disconnect (path, cb); - break; - } -} - -void -CompositeTraceResolver::OperationOne (std::string subpath, - TraceItems::const_iterator i, - const CallbackBase &cb, - const TraceContext &context, - enum Operation op) -{ - switch (op) { - case CONNECT: { - NS_DEBUG ("connect to path="<Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.AddElement (index); + Ptr obj = m_iter->Get (); + obj->GetTraceResolver ()->PrintAvailable (path, tmp, os); + j++; + } +} }//namespace ns3 diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 972867731..0c6ce941e 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -82,7 +82,14 @@ CompositeTraceResolver::DoAddSource (std::string name, {if (subpath == "") {trace->AddCallback (cb, context);}} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {if (subpath == "") {trace->RemoveCallback (cb);}} - + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + { + os << path << "/" << this->name << " ["; + TraceContext ctx = context; + ctx.Union (this->context); + ctx.PrintAvailable (os, ","); + os << "]" << std::endl; + } TraceSource *trace; } *item = new SourceCompositeItem (); item->name = name; @@ -106,9 +113,17 @@ CompositeTraceResolver::DoAddChild (std::string name, Ptr child, const T { public: virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {child->TraceConnect (subpath, cb, context);} + {child->GetTraceResolver ()->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {child->TraceDisconnect (subpath, cb);} + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + this->child->GetTraceResolver ()->PrintAvailable (path, ctx, os); + } Ptr child; } *item = new ChildCompositeItem (); @@ -249,6 +264,19 @@ CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb) } operation = DisconnectOperation (cb); DoRecursiveOperation (path, operation); } +void +CompositeTraceResolver::PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) +{ + for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) + { + NS_DEBUG ("print " << (*i)->name); + (*i)->PrintAvailable (path, context, os); + } + if (m_parent != 0) + { + m_parent->PrintAvailable (path, context, os); + } +} }//namespace ns3 diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index ca16b75b7..3be3c332c 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -91,6 +91,7 @@ public: virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os); private: class CompositeItem @@ -99,6 +100,7 @@ private: virtual ~CompositeItem () {} virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) = 0; virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) {} std::string name; TraceContext context; @@ -155,7 +157,13 @@ CompositeTraceResolver::AddArray (std::string name, {array->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {array->Disconnect (subpath, cb);} - + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + array->PrintAvailable (path, ctx, os);} Ptr > array; } *item = new ArrayCompositeItem (); item->name = name; diff --git a/src/core/object.cc b/src/core/object.cc index 73ade0d61..bd2128c7c 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -63,6 +63,7 @@ public: InterfaceIdTraceResolver (Ptr aggregate); virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os); private: Ptr ParseForInterface (std::string path); Ptr m_aggregate; @@ -91,7 +92,7 @@ InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, con Ptr interface = ParseForInterface (path); if (interface != 0) { - interface->TraceConnect (GetSubpath (path), cb, context); + interface->GetTraceResolver ()->Connect (GetSubpath (path), cb, context); } } void @@ -103,6 +104,11 @@ InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb) interface->TraceDisconnect (GetSubpath (path), cb); } } +void +InterfaceIdTraceResolver::PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) +{ + +} InterfaceId::InterfaceId (uint16_t iid) @@ -216,12 +222,7 @@ Object::AddInterface (Ptr o) void Object::TraceConnect (std::string path, const CallbackBase &cb) { - TraceConnect (path, cb, TraceContext ()); -} -void -Object::TraceConnect (std::string path, const CallbackBase &cb, const TraceContext &context) -{ - GetTraceResolver ()->Connect (path, cb, context); + GetTraceResolver ()->Connect (path, cb, TraceContext ()); } void Object::TraceDisconnect (std::string path, const CallbackBase &cb) @@ -229,7 +230,6 @@ Object::TraceDisconnect (std::string path, const CallbackBase &cb) GetTraceResolver ()->Disconnect (path, cb); } - void Object::SetInterfaceId (InterfaceId iid) { diff --git a/src/core/object.h b/src/core/object.h index 1b0825381..affaf223e 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -138,8 +138,8 @@ public: void TraceConnect (std::string path, const CallbackBase &cb); - void TraceConnect (std::string path, const CallbackBase &cb, const TraceContext &context); void TraceDisconnect (std::string path, const CallbackBase &cb); + virtual Ptr GetTraceResolver (void); protected: /** * \param iid an InterfaceId @@ -155,8 +155,6 @@ protected: * up to their parent's implementation once they are done. */ virtual void DoDispose (void); - - virtual Ptr GetTraceResolver (void); private: Ptr DoQueryInterface (InterfaceId iid) const; bool Check (void) const; diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index f22b73352..f0f61f761 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -69,6 +69,8 @@ public: * This method should behave as Connect. */ virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; + + virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) = 0; protected: /** * \param path a namespace path diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 2276c0da3..7278f2e3a 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -171,5 +171,9 @@ NodeList::Disconnect (std::string name, const CallbackBase &cb) { SimulationSingleton::Get ()->GetTraceResolver ()->Disconnect (name, cb); } - +Ptr +NodeList::GetTraceResolver (void) +{ + return SimulationSingleton::Get ()->GetTraceResolver (); +} }//namespace ns3 diff --git a/src/node/node-list.h b/src/node/node-list.h index 6774d8ce7..dfb4e4ce9 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -30,6 +30,7 @@ namespace ns3 { class Node; class CallbackBase; +class TraceResolver; class NodeListIndex : public TraceContextElement { @@ -94,6 +95,7 @@ public: * the input namespace regexp. */ static void Disconnect (std::string name, const CallbackBase &cb); + static Ptr GetTraceResolver (void); private: }; diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc new file mode 100644 index 000000000..81f283f2c --- /dev/null +++ b/utils/print-trace-sources.cc @@ -0,0 +1,23 @@ +#include "ns3/internet-node.h" +#include "ns3/ptr.h" +#include "ns3/trace-resolver.h" +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/csma-cd-net-device.h" +#include "ns3/queue.h" + +using namespace ns3; + +int main (int argc, char *argv[]) +{ + Ptr node = Create (); + + Ptr p2p = Create (node); + p2p->AddQueue (Queue::CreateDefault ()); + Ptr csma = Create (node); + csma->AddQueue (Queue::CreateDefault ()); + + NodeList::GetTraceResolver ()->PrintAvailable ("", TraceContext (), std::cout); + + return 0; +} diff --git a/utils/wscript b/utils/wscript index d64d46dc5..ebf8b356c 100644 --- a/utils/wscript +++ b/utils/wscript @@ -16,3 +16,7 @@ def build(bld): obj = bld.create_ns3_program('replay-simulation', ['simulator']) obj.source = 'replay-simulation.cc' + + obj = bld.create_ns3_program('print-trace-sources', + ['internet-node', 'csma-cd', 'point-to-point']) + obj.source = 'print-trace-sources.cc' From 1035eff97602707873f884eae7d4748edb49cc7a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 20:45:49 +0200 Subject: [PATCH 060/218] add TraceContext::IsSimilar --- src/core/trace-context.cc | 36 ++++++++++++++++++++++++++++++++++++ src/core/trace-context.h | 1 + 2 files changed, 37 insertions(+) diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index d4fa486d7..a106e27f4 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -256,6 +256,42 @@ TraceContext::PrintAvailable (std::ostream &os, std::string separator) const } while (true); } +bool +TraceContext::IsSimilar (const TraceContext &o) const +{ + if (m_data == 0 && o.m_data == 0) + { + return true; + } + if ((m_data != 0 && o.m_data == 0) || + (m_data == 0 && o.m_data != 0)) + { + return false; + } + uint8_t myCurrentUid; + uint16_t myI = 0; + uint8_t otherCurrentUid; + uint16_t otherI = 0; + do { + myCurrentUid = m_data->data[myI]; + otherCurrentUid = o.m_data->data[otherI]; + uint8_t mySize = ElementRegistry::GetSize (myCurrentUid); + uint8_t otherSize = ElementRegistry::GetSize (otherCurrentUid); + myI += 1 + mySize; + otherI += 1 + otherSize; + } while (myCurrentUid == otherCurrentUid && + myCurrentUid != 0 && + otherCurrentUid != 0); + if (myCurrentUid == 0 && otherCurrentUid == 0) + { + return true; + } + else + { + return false; + } +} + std::ostream& operator<< (std::ostream& os, const TraceContext &context) { context.Print (os); diff --git a/src/core/trace-context.h b/src/core/trace-context.h index c6f63ce99..fef2adcc6 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -81,6 +81,7 @@ public: void Print (std::ostream &os) const; void PrintAvailable (std::ostream &os, std::string separator) const; + bool IsSimilar (const TraceContext &o) const; private: friend class TraceContextTest; // used exclusively for testing code. From 51da23dbb6bbaa5d2eb1556b4816524155ee5454 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Aug 2007 20:46:10 +0200 Subject: [PATCH 061/218] add TraceResolver::CollectSources --- src/core/trace-resolver.cc | 30 ++++++++++++++++++++++++++++++ src/core/trace-resolver.h | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 4d4e4078a..3da9a088f 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -75,4 +75,34 @@ TraceResolver::GetSubpath (std::string path) return subpath; } +void +TraceResolver::SourceCollection::AddUnique (std::string path, const TraceContext &context, + std::string help) +{ + for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) + { + if (i->path == path && + i->help == help && + context.IsSimilar (i->context)) + { + return; + } + } + struct Source source; + source.path = path; + source.context = context; + source.help = help; + m_sources.push_back (source); +} +void +TraceResolver::SourceCollection::Print (std::ostream &os) const +{ + for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) + { + os << i->path << " ["; + i->context.PrintAvailable (os, " "); + os << "] " << i->help << std::endl; + } +} + }//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index f0f61f761..0fd5720f3 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -71,6 +71,26 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) = 0; + + + class SourceCollection + { + public: + void Print (std::ostream &os) const; + void AddUnique (std::string path, const TraceContext &context, + std::string help); + private: + struct Source + { + std::string path; + TraceContext context; + std::string help; + }; + typedef std::vector SourceVector; + SourceVector m_sources; + }; + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) {} protected: /** * \param path a namespace path From e3bb6008401dd9e15a3c122ef27dc32c6a8a2bd7 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 27 Aug 2007 23:46:14 -0700 Subject: [PATCH 062/218] real multicast enet addr, more source routes, default multicast route --- examples/csma-multicast.cc | 6 +- src/devices/csma/csma-channel.cc | 2 +- src/devices/csma/csma-net-device.cc | 21 +++-- src/internet-node/arp-ipv4-interface.cc | 79 ++++++++++++++-- src/internet-node/arp-ipv4-interface.h | 2 + src/internet-node/ipv4-impl.cc | 13 +++ src/internet-node/ipv4-impl.h | 4 + src/internet-node/ipv4-l3-protocol.cc | 44 +++++++-- src/internet-node/ipv4-l3-protocol.h | 5 + src/internet-node/ipv4-static-routing.cc | 114 +++++++++++++++++++++-- src/internet-node/ipv4-static-routing.h | 9 +- src/node/ipv4.h | 13 +++ 12 files changed, 275 insertions(+), 37 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index c22e4604c..504c4fc26 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -98,7 +98,6 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4Interface"); DebugComponentEnable("ArpIpv4Interface"); DebugComponentEnable("Ipv4LoopbackInterface"); - // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind @@ -200,10 +199,11 @@ main (int argc, char *argv[]) // earlier. We need to define a multicast group to send packets to. This // can be any multicast address from 224.0.0.0 through 239.255.255.255 // (avoiding the reserved routing protocol addresses). We just pick a -// convenient number. +// convenient number (225.0.0.0) and or in some bits to let us verify that +// correct Ethernet multicast addresses are constructed down in the system. // Ipv4Address multicastSource ("10.1.1.1"); - Ipv4Address multicastGroup ("225.0.0.0"); + Ipv4Address multicastGroup ("225.1.2.4"); // // We are going to manually configure multicast routing. This means telling // node two that it should expect multicast data coming from IP address diff --git a/src/devices/csma/csma-channel.cc b/src/devices/csma/csma-channel.cc index 9ba42d854..f9bb9fe48 100644 --- a/src/devices/csma/csma-channel.cc +++ b/src/devices/csma/csma-channel.cc @@ -250,7 +250,7 @@ CsmaChannel::TransmitEnd() } NS_DEBUG ("CsmaChannel::TransmitEnd (): Schedule event in " << - m_delay.GetSeconds () << "sec"); + m_delay.GetSeconds () << " sec"); Simulator::Schedule (m_delay, &CsmaChannel::PropagationCompleteEvent, diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index bb1dbbd08..ca6a693a5 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -526,20 +526,29 @@ CsmaNetDevice::Receive (const Packet& packet) NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " << header.GetDestination ()); // -// XXX BUGBUG -// // An IP host group address is mapped to an Ethernet multicast address // by placing the low-order 23-bits of the IP address into the low-order // 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). // -// Need to mask off the appropriate multicast bits. +// We are going to receive all packets destined to any multicast address, +// which means clearing the low-order 23 bits the header destination // + Eui48Address mcDest; + uint8_t mcBuf[6]; + + header.GetDestination ().CopyTo (mcBuf); + mcBuf[3] &= 0x80; + mcBuf[4] = 0; + mcBuf[5] = 0; + mcDest.CopyFrom (mcBuf); + multicast = Eui48Address::ConvertFrom (GetMulticast ()); broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); destination = Eui48Address::ConvertFrom (GetAddress ()); - if ((header.GetDestination() != broadcast) && - (header.GetDestination() != multicast) && - (header.GetDestination() != destination)) + + if ((header.GetDestination () != broadcast) && + (mcDest != multicast) && + (header.GetDestination () != destination)) { NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt "); m_dropTrace (p); diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index e6012cde9..29ccb19f2 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -61,6 +61,74 @@ ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) return resolver; } +// +// RFC 1112 says that an IP host group address is mapped to an Ethernet +// multicast address by placing the low-order 23-bits of the IP address into +// the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 +// (hex). These are completely different animals and they're encapsulated +// very nicely. Translation: This isn't going to be very pretty. +// +Address +ArpIpv4Interface::MakeMulticastAddress(Ipv4Address multicastGroup) +{ + NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (" << multicastGroup << + ")"); +// +// First, get the generic multicast address from the device. Since it is +// connected to this object, and this object is an IPV4 stack, we hope that +// it is really an Eui48Address. If it's not, then we don't know what to do. +// + Address hardwareDestination = GetDevice ()->GetMulticast (); + + NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " + "Device multicast address: " << hardwareDestination); + + Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); +// +// We now have the multicast address in an abstract 48-bit container. We +// need to pull it out so we can play with it. When we're done, we have the +// high order bits in etherBuffer[0], etc. +// + uint8_t etherBuffer[6]; + etherAddr.CopyTo (etherBuffer); +// +// If the device is playing the game correctly, the low order 23 bits of the +// multicast base address will be zero. +// + NS_ASSERT_MSG((etherBuffer[4] & 0x7f) == 0, + "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); + NS_ASSERT_MSG(etherBuffer[5] == 0, + "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); + NS_ASSERT_MSG(etherBuffer[6] == 0, + "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); +// +// Now we need to pull the raw bits out of the Ipv4 destination address. +// + uint8_t ipBuffer[4]; + multicastGroup.Serialize (ipBuffer); +// +// We need to place the low order 23 bits of the IP address into the low order +// 23 bits of the ethernet address. +// + etherBuffer[3] |= ipBuffer[1] & 0x7f; + etherBuffer[4] = ipBuffer[2]; + etherBuffer[5] = ipBuffer[3]; +// +// Now, etherBuffer has the desired ethernet multicast address. We have to +// suck these bits back into the Eui48Address; and then suck those bits back +// into the abstract hardwareAddress. +// + etherAddr.CopyFrom (etherBuffer); +// +// Implicit conversion (operator Address ()) is defined for Eui48Address, so +// use it. +// + NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " + "multicast address is " << etherAddr); + + return etherAddr; +} + void ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) { @@ -87,15 +155,8 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) NS_ASSERT_MSG(GetDevice ()->IsMulticast (), "ArpIpv4Interface::SendTo (): Sending multicast packet over " "non-multicast device"); -// XXX -// -// An IP host group address is mapped to an Ethernet multicast address -// by placing the low-order 23-bits of the IP address into the low-order -// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). -// -// Currently no easy way to or bit from Ipv4Address into Address -// - hardwareDestination = GetDevice ()->GetMulticast (); + + hardwareDestination = MakeMulticastAddress(dest); found = true; } else diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 7df522e01..dd73ff2b0 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -24,6 +24,7 @@ #include "ipv4-interface.h" #include "ns3/ptr.h" +#include "ns3/eui48-address.h" namespace ns3 { @@ -46,6 +47,7 @@ class ArpIpv4Interface : public Ipv4Interface virtual void SendTo (Packet p, Ipv4Address dest); virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); Ptr m_node; + Address MakeMulticastAddress (Ipv4Address multicastGroup); }; }//namespace ns3 diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index 8c7f9ce4b..0b557eeaf 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -105,6 +105,16 @@ Ipv4Impl::AddMulticastRoute (Ipv4Address origin, m_ipv4->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); } +void +Ipv4Impl::SetDefaultMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + m_ipv4->SetDefaultMulticastRoute (origin, group, inputInterface, + outputInterfaces); +} + uint32_t Ipv4Impl::GetNMulticastRoutes (void) const { @@ -208,6 +218,9 @@ Ipv4Impl::GetSourceAddress (Ipv4Address destination) const } else { +// +// If we can't find any address, just leave it 0.0.0.0 +// return Ipv4Address::GetAny (); } } diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index 2f267a392..8848c9f7e 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -62,6 +62,10 @@ public: uint32_t inputInterface, std::vector outputInterfaces); + virtual void SetDefaultMulticastRoute (Ipv4Address origin, + Ipv4Address group, uint32_t inputInterface, + std::vector outputInterfaces); + virtual uint32_t GetNMulticastRoutes (void) const; virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 28a612ac8..b5faf663b 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -355,6 +355,20 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, outputInterfaces); } +void +Ipv4L3Protocol::SetDefaultMulticastRoute ( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << origin << ", " << + group << ", " << inputInterface << ", " << &outputInterfaces << ")"); + + m_staticRouting->SetDefaultMulticastRoute (origin, group, inputInterface, + outputInterfaces); +} + uint32_t Ipv4L3Protocol::GetNMulticastRoutes (void) const { @@ -768,7 +782,11 @@ Ipv4L3Protocol::GetIfIndexForDestination ( { NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (" << destination << ", " << &ifIndex << ")"); - +// +// The first thing we do in trying to determine a source address is to +// consult the routing protocols. These will also check for a default route +// if one has been set. +// for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); i != m_routingProtocols.end (); i++) @@ -785,13 +803,13 @@ Ipv4L3Protocol::GetIfIndexForDestination ( } } // -// If there's no routing table entry telling us what single interface will be -// used to send a packet to this destination, we'll have to just pick one. +// If there's no routing table entry telling us what *single* interface will +// be used to send a packet to this destination, we'll have to just pick one. // If there's only one interface on this node, a good answer isn't very hard // to come up with. Before jumping to any conclusions, remember that the // zeroth interface is the loopback interface, so what we actually want is // a situation where there are exactly two interfaces on the node, in which -// case interface one is the "single" interface. +// case interface one is the "single" interface connected to the outside world. // if (GetNInterfaces () == 2) { @@ -802,11 +820,21 @@ Ipv4L3Protocol::GetIfIndexForDestination ( } // // If we fall through to here, we have a node with multiple interfaces and -// no routes to guide us in determining what interface to choose. The last -// choice is to use the one set in the default route. -// +// no routes to guide us in determining what interface to choose. Either +// no default route was found (for unicast or multicast), or in the case of a +// multicast, the default route contained multiple outbound interfaces. +// +// The fallback position is to just get the unicast default route and use +// the outgoing interface specified there. We don't want to leave the source +// address unset, so we just assert here. +// +// N.B. that in the case of a multicast with a route containing multiple +// outgoing interfaces, the source address of packets from that node will be +// set to the IP address of the interface set in the default unicast route. +// Also, in the case of a broadcast, the same will be true. +// NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " - "Using default route"); + "Using default unicast route"); Ipv4Route *route = m_staticRouting->GetDefaultRoute (); NS_ASSERT_MSG(route, diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 2114558b3..b93a2be5d 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -163,6 +163,11 @@ public: uint32_t inputInterface, std::vector outputInterfaces); + void SetDefaultMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + uint32_t GetNMulticastRoutes (void) const; Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index cfd2a7046..37790a79a 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -27,6 +27,11 @@ NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); namespace ns3 { +Ipv4StaticRouting::Ipv4StaticRouting () +: m_defaultRoute (0), m_defaultMulticastRoute (0) +{ +} + void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, @@ -95,10 +100,24 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, m_multicastRoutes.push_back (route); } +void +Ipv4StaticRouting::SetDefaultMulticastRoute( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); + *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, + inputInterface, outputInterfaces); + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = route; +} + uint32_t Ipv4StaticRouting::GetNMulticastRoutes (void) const { - return m_multicastRoutes.size (); + return m_multicastRoutes.size () + m_defaultMulticastRoute ? 1 : 0; } Ipv4MulticastRoute * @@ -106,17 +125,54 @@ Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const { NS_ASSERT_MSG(index < m_multicastRoutes.size (), "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); - - uint32_t tmp = 0; - for (MulticastRoutesCI i = m_multicastRoutes.begin (); - i != m_multicastRoutes.end (); - i++) +// +// From an external point of view the default route appears to be in slot 0 +// of the routing table. The implementation, however, puts it in a separate +// place. So, if a client asks for index 0 and we have a default multicast +// route, we have to return it from that different place +// (m_defaultMulticastRoute). +// + if (index == 0 && m_defaultMulticastRoute != 0) { - if (tmp == index) + return m_defaultMulticastRoute; + } +// +// If there is a default multicast route present, a client will just assume +// that it is in slot zero and there is one "extra" zeroth route in the table. +// To return the correct indexed entry in our list, we have to decrement the +// index to take into account the default route not being in the actual list. +// Since we fell through to here, we've taken care of the case where the +// index was zero. +// + if (m_defaultMulticastRoute != 0) + { + NS_ASSERT(index > 0); + index--; + } + + if (index < m_multicastRoutes.size ()) + { + uint32_t tmp = 0; + for (MulticastRoutesCI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) { - return *i; + if (tmp == index) + { + return *i; + } + tmp++; } - tmp++; + } + return 0; +} + +Ipv4MulticastRoute * +Ipv4StaticRouting::GetDefaultMulticastRoute () const +{ + if (m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; } return 0; } @@ -126,6 +182,9 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, Ipv4Address group, uint32_t inputInterface) { +// +// This method does not attempt to delete the multicast route. +// for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) @@ -145,6 +204,32 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, void Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) { +// +// From an external point of view the default route appears to be in slot 0 +// of the routing table. The implementation, however, puts it in a separate +// place. So, if a client asks to delete index 0 and we have a default +// multicast route set, we have to delete it from that different place +// (m_defaultMulticastRoute). +// + if (index == 0 && m_defaultMulticastRoute != 0) + { + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = 0; + } +// +// If there is a default multicast route present, a client will just assume +// that it is in slot zero and there is one "extra" zeroth route in the table. +// To return the correct indexed entry in our list, we have to decrement the +// index to take into account the default route not being in the actual list. +// Since we fell through to here, we've taken care of the case where the +// index was zero. +// + if (m_defaultMulticastRoute != 0) + { + NS_ASSERT(index > 0); + index--; + } + uint32_t tmp = 0; for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); @@ -215,6 +300,12 @@ Ipv4StaticRouting::LookupStatic ( } } } + + if (m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; + } + return 0; } @@ -492,6 +583,11 @@ Ipv4StaticRouting::DoDispose (void) { delete (*i); } + if (m_defaultMulticastRoute != 0) + { + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = 0; + } Ipv4RoutingProtocol::DoDispose (); } diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index ac1351e1d..8b0420f27 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -49,7 +49,7 @@ class Ipv4StaticRouting : public Ipv4RoutingProtocol { public: - Ipv4StaticRouting () : m_defaultRoute (0) {} + Ipv4StaticRouting (); virtual bool RequestRoute (uint32_t ifIndex, Ipv4Header const &ipHeader, @@ -83,8 +83,14 @@ public: uint32_t inputInterface, std::vector outputInterfaces); + void SetDefaultMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + uint32_t GetNMulticastRoutes (void) const; Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; void RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, @@ -114,6 +120,7 @@ private: HostRoutes m_hostRoutes; NetworkRoutes m_networkRoutes; Ipv4Route *m_defaultRoute; + Ipv4MulticastRoute *m_defaultMulticastRoute; MulticastRoutes m_multicastRoutes; }; diff --git a/src/node/ipv4.h b/src/node/ipv4.h index b79a29d89..7d386a493 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -243,6 +243,19 @@ public: Ipv4Address group, uint32_t inputInterface) = 0; + /** + * \brief Set the default static multicast route for a given multicast + * source and group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + * \param inputInterface The interface index over which the packet arrived. + * \param outputInterfaces The list of output interface indices over which + * the packet should be sent (excluding the inputInterface). + */ + virtual void SetDefaultMulticastRoute (Ipv4Address origin, + Ipv4Address group, uint32_t inputInterface, + std::vector outputInterfaces) = 0; /** * \returns the number of entries in the multicast routing table. */ From f4be5e41e559c1e32139a68e3dda022f6cac0ae7 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 09:37:10 +0200 Subject: [PATCH 063/218] replace TraceResolver::PrintAvailable with TraceResolver::CollectSources --- src/core/array-trace-resolver.h | 9 ++++-- src/core/composite-trace-resolver.cc | 34 +++++++++++++++------- src/core/composite-trace-resolver.h | 13 ++++++--- src/core/object.cc | 42 ++++++++++++++++++++++++++-- src/core/object.h | 10 ++++++- src/core/trace-context.cc | 27 +++++++++++------- src/core/trace-resolver.cc | 18 ++++++++++++ src/core/trace-resolver.h | 9 +++--- utils/print-trace-sources.cc | 4 ++- 9 files changed, 130 insertions(+), 36 deletions(-) diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index 0f76f57c9..c3f8181a6 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -62,7 +62,8 @@ public: // inherited from TraceResolver virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); private: class IteratorBase @@ -166,7 +167,8 @@ ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &cb) } template void -ArrayTraceResolver::PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) +ArrayTraceResolver::CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { path.append ("/[0-n]"); uint32_t j = 0; @@ -176,11 +178,12 @@ ArrayTraceResolver::PrintAvailable (std::string path, const TraceContext INDEX index = j; tmp.AddElement (index); Ptr obj = m_iter->Get (); - obj->GetTraceResolver ()->PrintAvailable (path, tmp, os); + obj->GetTraceResolver ()->CollectSources (path, tmp, collection); j++; } } + }//namespace ns3 #endif /* ARRAY_TRACE_RESOLVER_H */ diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 0c6ce941e..0e8f5a947 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -54,7 +54,15 @@ CompositeTraceResolver::Add (std::string name, {maker ()->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {maker ()->Disconnect (subpath, cb);} - + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + this->maker ()->CollectSources (path, ctx, collection); + } Callback > maker; } *item = new MakerCompositeItem (); item->name = name; @@ -82,13 +90,15 @@ CompositeTraceResolver::DoAddSource (std::string name, {if (subpath == "") {trace->AddCallback (cb, context);}} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {if (subpath == "") {trace->RemoveCallback (cb);}} - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { - os << path << "/" << this->name << " ["; + path.append ("/"); + path.append (this->name); TraceContext ctx = context; ctx.Union (this->context); - ctx.PrintAvailable (os, ","); - os << "]" << std::endl; + // XXX help string + collection->AddUnique (path, ctx, ""); } TraceSource *trace; } *item = new SourceCompositeItem (); @@ -116,13 +126,14 @@ CompositeTraceResolver::DoAddChild (std::string name, Ptr child, const T {child->GetTraceResolver ()->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {child->TraceDisconnect (subpath, cb);} - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { path.append ("/"); path.append (this->name); TraceContext ctx = context; ctx.Union (this->context); - this->child->GetTraceResolver ()->PrintAvailable (path, ctx, os); + this->child->GetTraceResolver ()->CollectSources (path, ctx, collection); } Ptr child; @@ -264,20 +275,23 @@ CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb) } operation = DisconnectOperation (cb); DoRecursiveOperation (path, operation); } + void -CompositeTraceResolver::PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) +CompositeTraceResolver::CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { NS_DEBUG ("print " << (*i)->name); - (*i)->PrintAvailable (path, context, os); + (*i)->CollectSources (path, context, collection); } if (m_parent != 0) { - m_parent->PrintAvailable (path, context, os); + m_parent->CollectSources (path, context, collection); } } + }//namespace ns3 #ifdef RUN_SELF_TESTS diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 3be3c332c..b65682fbb 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -91,7 +91,8 @@ public: virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); private: class CompositeItem @@ -100,7 +101,8 @@ private: virtual ~CompositeItem () {} virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) = 0; virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) {} + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) = 0; std::string name; TraceContext context; @@ -157,13 +159,16 @@ CompositeTraceResolver::AddArray (std::string name, {array->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) {array->Disconnect (subpath, cb);} - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { path.append ("/"); path.append (this->name); TraceContext ctx = context; ctx.Union (this->context); - array->PrintAvailable (path, ctx, os);} + array->CollectSources (path, ctx, collection); + } + Ptr > array; } *item = new ArrayCompositeItem (); item->name = name; diff --git a/src/core/object.cc b/src/core/object.cc index bd2128c7c..a59da10e2 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -63,7 +63,8 @@ public: InterfaceIdTraceResolver (Ptr aggregate); virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); private: Ptr ParseForInterface (std::string path); Ptr m_aggregate; @@ -105,9 +106,10 @@ InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb) } } void -InterfaceIdTraceResolver::PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) +InterfaceIdTraceResolver::CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) { - + m_aggregate->DoCollectSources (path, context, collection); } @@ -128,6 +130,12 @@ InterfaceId::LookupParent (InterfaceId iid) { return Singleton::Get ()->LookupParent (iid.m_iid); } +std::string +InterfaceId::GetName (void) const +{ + std::string name = Singleton::Get ()->LookupByUid (m_iid); + return name; +} bool operator == (const InterfaceId &a, const InterfaceId &b) { @@ -284,6 +292,34 @@ Object::MaybeDelete (void) const } while (current != end); } +void +Object::DoCollectSources (std::string path, const TraceContext &context, + TraceResolver::SourceCollection *collection) +{ + Object *current = this->m_next; + if (collection->IsFlagSet ()) + { + return; + } + collection->SetFlag (); + while (current != this) + { + NS_ASSERT (current != 0); + InterfaceId cur = current->m_iid; + while (cur != Object::iid) + { + std::string name = cur.GetName (); + std::string fullpath = path; + fullpath.append ("/$"); + fullpath.append (name); + current->GetTraceResolver ()->CollectSources (fullpath, context, collection); + cur = InterfaceId::LookupParent (cur); + } + current = current->m_next; + } + collection->ClearFlag (); +} + } // namespace ns3 diff --git a/src/core/object.h b/src/core/object.h index affaf223e..32f1806a4 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -24,10 +24,10 @@ #include #include #include "ptr.h" +#include "trace-resolver.h" namespace ns3 { -class TraceResolver; class TraceContext; class CallbackBase; @@ -60,6 +60,11 @@ public: * id is not a valid interface id. */ static InterfaceId LookupParent (InterfaceId iid); + + /** + * \returns the name of this interface. + */ + std::string GetName (void) const; ~InterfaceId (); private: InterfaceId (uint16_t iid); @@ -156,7 +161,10 @@ protected: */ virtual void DoDispose (void); private: + friend class InterfaceIdTraceResolver; Ptr DoQueryInterface (InterfaceId iid) const; + void DoCollectSources (std::string path, const TraceContext &context, + TraceResolver::SourceCollection *collection); bool Check (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index a106e27f4..d065bfa73 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -272,16 +272,23 @@ TraceContext::IsSimilar (const TraceContext &o) const uint16_t myI = 0; uint8_t otherCurrentUid; uint16_t otherI = 0; - do { - myCurrentUid = m_data->data[myI]; - otherCurrentUid = o.m_data->data[otherI]; - uint8_t mySize = ElementRegistry::GetSize (myCurrentUid); - uint8_t otherSize = ElementRegistry::GetSize (otherCurrentUid); - myI += 1 + mySize; - otherI += 1 + otherSize; - } while (myCurrentUid == otherCurrentUid && - myCurrentUid != 0 && - otherCurrentUid != 0); + + myCurrentUid = m_data->data[myI]; + otherCurrentUid = o.m_data->data[otherI]; + + while (myCurrentUid == otherCurrentUid && + myCurrentUid != 0 && + otherCurrentUid != 0 && + myI < m_data->size && + otherI < o.m_data->size) + { + uint8_t mySize = ElementRegistry::GetSize (myCurrentUid); + uint8_t otherSize = ElementRegistry::GetSize (otherCurrentUid); + myI += 1 + mySize; + otherI += 1 + otherSize; + myCurrentUid = m_data->data[myI]; + otherCurrentUid = o.m_data->data[otherI]; + } if (myCurrentUid == 0 && otherCurrentUid == 0) { return true; diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 3da9a088f..b4acde66c 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -105,4 +105,22 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const } } +void +TraceResolver::SourceCollection::SetFlag (void) +{ + m_flag = true; +} + +void +TraceResolver::SourceCollection::ClearFlag (void) +{ + m_flag = false; +} +bool +TraceResolver::SourceCollection::IsFlagSet (void) +{ + return m_flag; +} + + }//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 0fd5720f3..639ddcb85 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -70,15 +70,15 @@ public: */ virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; - virtual void PrintAvailable (std::string path, const TraceContext &context, std::ostream &os) = 0; - - class SourceCollection { public: void Print (std::ostream &os) const; void AddUnique (std::string path, const TraceContext &context, std::string help); + void SetFlag (void); + void ClearFlag (void); + bool IsFlagSet (void); private: struct Source { @@ -88,9 +88,10 @@ public: }; typedef std::vector SourceVector; SourceVector m_sources; + bool m_flag; }; virtual void CollectSources (std::string path, const TraceContext &context, - SourceCollection *collection) {} + SourceCollection *collection) = 0; protected: /** * \param path a namespace path diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc index 81f283f2c..0c3e489a0 100644 --- a/utils/print-trace-sources.cc +++ b/utils/print-trace-sources.cc @@ -17,7 +17,9 @@ int main (int argc, char *argv[]) Ptr csma = Create (node); csma->AddQueue (Queue::CreateDefault ()); - NodeList::GetTraceResolver ()->PrintAvailable ("", TraceContext (), std::cout); + TraceResolver::SourceCollection collection; + NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); + collection.Print (std::cout); return 0; } From a321dcd1c8e03e7b46b23c561da1c4b85a114e0e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 11:01:00 +0200 Subject: [PATCH 064/218] keep track of trace source help strings --- src/core/composite-trace-resolver.cc | 18 +++++++++------ src/core/composite-trace-resolver.h | 22 ++++++++----------- src/core/object.cc | 8 +++---- src/core/trace-resolver.cc | 7 ++++-- src/devices/csma-cd/csma-cd-net-device.cc | 2 ++ .../point-to-point-net-device.cc | 1 + src/internet-node/ipv4-l3-protocol.cc | 9 +++++--- src/mobility/mobility-model-notifier.cc | 3 ++- src/node/queue.cc | 9 +++++--- 9 files changed, 46 insertions(+), 33 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 0e8f5a947..959561f6e 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -73,13 +73,15 @@ CompositeTraceResolver::Add (std::string name, void CompositeTraceResolver::AddSource (std::string name, - TraceSource &trace) + std::string helpText, + TraceSource &trace) { - DoAddSource (name, trace, TraceContext ()); + DoAddSource (name, helpText, trace, TraceContext ()); } void CompositeTraceResolver::DoAddSource (std::string name, + std::string helpText, TraceSource &trace, const TraceContext &context) { @@ -98,13 +100,15 @@ CompositeTraceResolver::DoAddSource (std::string name, TraceContext ctx = context; ctx.Union (this->context); // XXX help string - collection->AddUnique (path, ctx, ""); + collection->AddUnique (path, ctx, helpText); } TraceSource *trace; + std::string helpText; } *item = new SourceCompositeItem (); item->name = name; item->context = context; item->trace = &trace; + item->helpText = helpText; AddItem (item); } @@ -397,7 +401,7 @@ Ptr CompositeTraceResolverTest::CreateSubResolver (void) { Ptr subresolver = Create (); - subresolver->AddSource ("trace-int", m_traceInt, + subresolver->AddSource ("trace-int", "test source", m_traceInt, SubTraceSourceTest (SubTraceSourceTest::INT)); return subresolver; } @@ -412,9 +416,9 @@ CompositeTraceResolverTest::RunTests (void) CompositeTraceResolver resolver; - resolver.AddSource ("trace-double-a", traceDoubleA, + resolver.AddSource ("trace-double-a", "test source", traceDoubleA, TraceSourceTest (TraceSourceTest::DOUBLEA)); - resolver.AddSource ("trace-double-b", traceDoubleB, + resolver.AddSource ("trace-double-b", "test source", traceDoubleB, TraceSourceTest (TraceSourceTest::DOUBLEB)); resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); @@ -547,7 +551,7 @@ CompositeTraceResolverTest::RunTests (void) SVTraceSource source; - resolver.AddSource ("uint16_t", source, TraceSourceTest (TraceSourceTest::UINT16_T)); + resolver.AddSource ("uint16_t", "test source", source, TraceSourceTest (TraceSourceTest::UINT16_T)); return ok; diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index b65682fbb..47fd4ca3f 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -53,7 +53,7 @@ public: * be automatically extended to contain the input context. */ template - void AddSource (std::string name, + void AddSource (std::string name, std::string helpText, TraceSource &trace, T const &context); /** * \param name name of trace source @@ -64,18 +64,8 @@ public: * resolution. */ void AddSource (std::string name, + std::string helpText, TraceSource &trace); - /** - * \param name name of child trace resolver - * \param createResolver a trace resolver constructor - * - * Add a child trace resolver to this resolver. This child - * trace resolver will match the name specified during - * namespace resolution. When this happens, the constructor - * will be invoked to create the child trace resolver. - */ - void Add (std::string name, - Callback > createResolver); void AddChild (std::string name, Ptr child); @@ -95,6 +85,7 @@ public: SourceCollection *collection); private: + friend class CompositeTraceResolverTest; class CompositeItem { public: @@ -123,8 +114,12 @@ private: const Operation &operation); void DoAddChild (std::string name, Ptr child, const TraceContext &context); void DoAddSource (std::string name, + std::string helpText, TraceSource &trace, const TraceContext &context); + void Add (std::string name, + Callback > createResolver); + CompositeTraceResolver::TraceItems m_items; Ptr m_parent; @@ -139,12 +134,13 @@ namespace ns3 { template void CompositeTraceResolver::AddSource (std::string name, + std::string helpText, TraceSource &trace, T const &context) { TraceContext ctx; ctx.AddElement (context); - DoAddSource (name, trace, ctx); + DoAddSource (name, helpText, trace, ctx); } template diff --git a/src/core/object.cc b/src/core/object.cc index a59da10e2..c2d7c389a 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -346,7 +346,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("basea-x", m_source); + resolver->AddSource ("basea-x", "test source", m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -370,7 +370,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("deriveda-x", m_sourceDerived); + resolver->AddSource ("deriveda-x", "test source", m_sourceDerived); resolver->SetParent (BaseA::GetTraceResolver ()); return resolver; } @@ -397,7 +397,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("baseb-x", m_source); + resolver->AddSource ("baseb-x", "test source", m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -421,7 +421,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("derivedb-x", m_sourceDerived); + resolver->AddSource ("derivedb-x", "test source", m_sourceDerived); resolver->SetParent (BaseB::GetTraceResolver ()); return resolver; } diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index b4acde66c..a5f5267a4 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -99,9 +99,12 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const { for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) { - os << i->path << " ["; + os << "source=" << i->path << std::endl; + os << "TraceContextElement="; i->context.PrintAvailable (os, " "); - os << "] " << i->help << std::endl; + os << std::endl; + os << i->help << std::endl; + os << std::endl; } } diff --git a/src/devices/csma-cd/csma-cd-net-device.cc b/src/devices/csma-cd/csma-cd-net-device.cc index 6454ae724..29fa3dd4a 100644 --- a/src/devices/csma-cd/csma-cd-net-device.cc +++ b/src/devices/csma-cd/csma-cd-net-device.cc @@ -460,9 +460,11 @@ CsmaCdNetDevice::GetTraceResolver (void) Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); resolver->AddSource ("rx", + "receive MAC packet", m_rxTrace, CsmaCdTraceType (CsmaCdTraceType::RX)); resolver->AddSource ("drop", + "drop MAC packet", m_dropTrace, CsmaCdTraceType (CsmaCdTraceType::DROP)); resolver->SetParent (NetDevice::GetTraceResolver ()); diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 4d7e89e7c..19cb27b7a 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -199,6 +199,7 @@ PointToPointNetDevice::GetTraceResolver (void) Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); resolver->AddSource ("rx", + "receive MAC packet", m_rxTrace, PointToPointTraceType ()); resolver->SetParent (NetDevice::GetTraceResolver ()); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index d01034ef2..b59901dc2 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -162,9 +162,12 @@ Ptr Ipv4L3Protocol::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); - resolver->AddSource ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); - resolver->AddSource ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); + resolver->AddSource ("tx", "send ipv4 packet to outgoing interface", + m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); + resolver->AddSource ("rx", "receive ipv4 packet from incoming interface", + m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); + resolver->AddSource ("drop", "drop ipv4 packet", + m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); resolver->AddArray ("interfaces", m_interfaces.begin (), m_interfaces.end (), Ipv4L3ProtocolInterfaceIndex ()); diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index ffab72953..01bad6070 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -44,7 +44,8 @@ MobilityModelNotifier::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("course-change", m_trace); + resolver->AddSource ("course-change", "speed vector changed value", + m_trace); return resolver; } diff --git a/src/node/queue.cc b/src/node/queue.cc index 10bcc1c04..7ebbf838e 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -103,9 +103,12 @@ Ptr Queue::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); - resolver->AddSource ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); - resolver->AddSource ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); + resolver->AddSource ("enqueue", "store packet in queue", + m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); + resolver->AddSource ("dequeue", "remove packet from queue", + m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); + resolver->AddSource ("drop", "drop packet from queue", + m_traceDrop, QueueTraceType (QueueTraceType::DROP)); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } From 8c6a435842aa92fc1468b22b63f66791a746bfe6 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 11:20:55 +0200 Subject: [PATCH 065/218] make sure to get to the parent during trace resolution --- src/mobility/mobility-model-notifier.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index 01bad6070..add1cb993 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -46,6 +46,7 @@ MobilityModelNotifier::GetTraceResolver (void) Create (); resolver->AddSource ("course-change", "speed vector changed value", m_trace); + resolver->SetParent (Object::GetTraceResolver ()); return resolver; } From 98c39acc7968635401909ec3a2ee33d1466e1a40 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 11:21:42 +0200 Subject: [PATCH 066/218] avoid problems with recursive use of Object::DoCollectSources --- src/core/object.cc | 28 +++++++++++++++++++++------- src/core/object.h | 1 + src/core/trace-resolver.cc | 18 ------------------ src/core/trace-resolver.h | 4 ---- 4 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index c2d7c389a..565897947 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -23,8 +23,11 @@ #include "singleton.h" #include "uid-manager.h" #include "trace-resolver.h" +#include "debug.h" #include +NS_DEBUG_COMPONENT_DEFINE ("Object"); + namespace { class IidManager : public ns3::UidManager @@ -173,6 +176,7 @@ Object::Object () : m_count (1), m_iid (Object::iid), m_disposed (false), + m_collecting (false), m_next (this) {} Object::~Object () @@ -296,15 +300,23 @@ void Object::DoCollectSources (std::string path, const TraceContext &context, TraceResolver::SourceCollection *collection) { - Object *current = this->m_next; - if (collection->IsFlagSet ()) - { - return; - } - collection->SetFlag (); + Object *current; + current = this; + do { + if (current->m_collecting) + { + return; + } + current = current->m_next; + } while (current != this); + + m_collecting = true; + + current = this->m_next; while (current != this) { NS_ASSERT (current != 0); + NS_DEBUG ("collect current=" << current); InterfaceId cur = current->m_iid; while (cur != Object::iid) { @@ -312,12 +324,14 @@ Object::DoCollectSources (std::string path, const TraceContext &context, std::string fullpath = path; fullpath.append ("/$"); fullpath.append (name); + NS_DEBUG ("collect: " << fullpath); current->GetTraceResolver ()->CollectSources (fullpath, context, collection); cur = InterfaceId::LookupParent (cur); } current = current->m_next; } - collection->ClearFlag (); + + m_collecting = false; } } // namespace ns3 diff --git a/src/core/object.h b/src/core/object.h index 32f1806a4..8661d7f8a 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -170,6 +170,7 @@ private: mutable uint32_t m_count; InterfaceId m_iid; bool m_disposed; + bool m_collecting; Object *m_next; }; diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index a5f5267a4..d0191f859 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -108,22 +108,4 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const } } -void -TraceResolver::SourceCollection::SetFlag (void) -{ - m_flag = true; -} - -void -TraceResolver::SourceCollection::ClearFlag (void) -{ - m_flag = false; -} -bool -TraceResolver::SourceCollection::IsFlagSet (void) -{ - return m_flag; -} - - }//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 639ddcb85..c3802619a 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -76,9 +76,6 @@ public: void Print (std::ostream &os) const; void AddUnique (std::string path, const TraceContext &context, std::string help); - void SetFlag (void); - void ClearFlag (void); - bool IsFlagSet (void); private: struct Source { @@ -88,7 +85,6 @@ public: }; typedef std::vector SourceVector; SourceVector m_sources; - bool m_flag; }; virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; From 3b7977bd191872a8664919a9e4eb61fdf32f332d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 11:22:01 +0200 Subject: [PATCH 067/218] document also mobility model notifier --- utils/print-trace-sources.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc index 0c3e489a0..948cf03c3 100644 --- a/utils/print-trace-sources.cc +++ b/utils/print-trace-sources.cc @@ -5,12 +5,14 @@ #include "ns3/point-to-point-net-device.h" #include "ns3/csma-cd-net-device.h" #include "ns3/queue.h" +#include "ns3/mobility-model-notifier.h" using namespace ns3; int main (int argc, char *argv[]) { Ptr node = Create (); + node->AddInterface (Create ()); Ptr p2p = Create (node); p2p->AddQueue (Queue::CreateDefault ()); From f4461e5c8574748d84f07baaea6f405379eb37a0 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 12:06:15 +0200 Subject: [PATCH 068/218] improve trace list output --- src/core/trace-resolver.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index d0191f859..683df2ab7 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -100,10 +100,10 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) { os << "source=" << i->path << std::endl; - os << "TraceContextElement="; - i->context.PrintAvailable (os, " "); - os << std::endl; - os << i->help << std::endl; + os << "TraceContext=["; + i->context.PrintAvailable (os, ","); + os << "]" << std::endl; + os << "help=\"" << i->help << "\"" << std::endl; os << std::endl; } } From 113801bd397b0e664b3848348034dbc434da2048 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 12:42:27 +0200 Subject: [PATCH 069/218] document trace source signature --- src/core/trace-doc.cc | 67 +++++++++++++++++++++++++++++++++++++++++++ src/core/trace-doc.h | 50 ++++++++++++++++++++++++++++++++ src/core/wscript | 2 ++ 3 files changed, 119 insertions(+) create mode 100644 src/core/trace-doc.cc create mode 100644 src/core/trace-doc.h diff --git a/src/core/trace-doc.cc b/src/core/trace-doc.cc new file mode 100644 index 000000000..adf3c8c27 --- /dev/null +++ b/src/core/trace-doc.cc @@ -0,0 +1,67 @@ +#include "trace-doc.h" + +namespace ns3 { + +TraceDoc::TraceDoc (std::string help) + : m_help (help) +{} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help) + : m_help (help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); + m_argVector.push_back (std::make_pair (arg2Type, arg2Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); + m_argVector.push_back (std::make_pair (arg2Type, arg2Help)); + m_argVector.push_back (std::make_pair (arg3Type, arg3Help)); +} +std::string +TraceDoc::GetHelp (void) +{ + return m_help; +} +TraceDoc::Iterator +TraceDoc::ArgsBegin (void) const +{ + return m_argVector.begin (); +} +TraceDoc::Iterator +TraceDoc::ArgsEnd (void) const +{ + return m_argVector.end (); +} + +} // namespace ns3 diff --git a/src/core/trace-doc.h b/src/core/trace-doc.h new file mode 100644 index 000000000..1ccfc0d99 --- /dev/null +++ b/src/core/trace-doc.h @@ -0,0 +1,50 @@ +#ifndef TRACE_DOC_H +#define TRACE_DOC_H + +#include +#include + +namespace ns3 { + +class TraceDoc +{ + typedef std::vector > ArgVector; +public: + typedef ArgVector::const_iterator Iterator; + + TraceDoc (std::string help); + TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help); + TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help); + TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help); + TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help); + std::string GetHelp (void); + Iterator ArgsBegin (void) const; + Iterator ArgsEnd (void) const; +private: + ArgVector m_argVector; + std::string m_help; +}; + +} // namespace ns3 + +#endif /* TRACE_DOC_H */ diff --git a/src/core/wscript b/src/core/wscript index 7d913eddc..b32bd3a9c 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -48,6 +48,7 @@ def build(bld): 'trace-resolver.cc', 'callback-trace-source.cc', 'composite-trace-resolver.cc', + 'trace-doc.cc', ] if sys.platform == 'win32': @@ -89,5 +90,6 @@ def build(bld): 'trace-resolver.h', 'composite-trace-resolver.h', 'array-trace-resolver.h', + 'trace-doc.h', ] From 98a3dc2490d9de36eeed8475584a98b73387f2f3 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 13:03:08 +0200 Subject: [PATCH 070/218] constify --- src/devices/csma/csma-net-device.h | 4 ++-- src/devices/point-to-point/point-to-point-net-device.h | 2 +- src/internet-node/ascii-trace.cc | 2 +- src/internet-node/ascii-trace.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 441ea04cd..62bbceab5 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -421,8 +421,8 @@ private: * @see class CallBackTraceSource * @see class TraceResolver */ - CallbackTraceSource m_rxTrace; - CallbackTraceSource m_dropTrace; + CallbackTraceSource m_rxTrace; + CallbackTraceSource m_dropTrace; }; diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index d8d8d3242..fa3d3b838 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -290,7 +290,7 @@ private: * @see class CallBackTraceSource * @see class TraceResolver */ - CallbackTraceSource m_rxTrace; + CallbackTraceSource m_rxTrace; /** * Default data rate. Used for all newly created p2p net devices */ diff --git a/src/internet-node/ascii-trace.cc b/src/internet-node/ascii-trace.cc index 0331bb5fd..961edd709 100644 --- a/src/internet-node/ascii-trace.cc +++ b/src/internet-node/ascii-trace.cc @@ -92,7 +92,7 @@ AsciiTrace::LogDevQueueDrop (TraceContext const &context, m_os << std::endl; } void -AsciiTrace::LogDevRx (TraceContext const &context, Packet &p) +AsciiTrace::LogDevRx (TraceContext const &context, const Packet &p) { m_os << "r " << Simulator::Now ().GetSeconds () << " "; context.Print (m_os); diff --git a/src/internet-node/ascii-trace.h b/src/internet-node/ascii-trace.h index e219afc41..084f82830 100644 --- a/src/internet-node/ascii-trace.h +++ b/src/internet-node/ascii-trace.h @@ -40,7 +40,7 @@ private: void LogDevQueueEnqueue (TraceContext const &context, const Packet &p); void LogDevQueueDequeue (TraceContext const &context, const Packet &p); void LogDevQueueDrop (TraceContext const &context, const Packet &p); - void LogDevRx (TraceContext const &context, Packet &p); + void LogDevRx (TraceContext const &context, const Packet &p); std::ofstream m_os; }; From fa3f86cbde0fa2ec259782d3f7b51d1a4e6eea34 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 13:10:18 +0200 Subject: [PATCH 071/218] document trace source signatures --- src/core/composite-trace-resolver.cc | 21 +++++++++---------- src/core/composite-trace-resolver.h | 11 +++++----- src/core/object.cc | 8 +++---- src/core/trace-doc.cc | 9 +++++++- src/core/trace-doc.h | 4 ++-- src/core/trace-resolver.cc | 17 ++++++++++----- src/core/trace-resolver.h | 8 ++++--- src/devices/csma/csma-net-device.cc | 6 ++++-- .../point-to-point-net-device.cc | 3 ++- src/internet-node/ipv4-l3-protocol.cc | 14 ++++++++++--- src/mobility/mobility-model-notifier.cc | 6 +++++- src/node/queue.cc | 12 ++++++++--- 12 files changed, 78 insertions(+), 41 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 959561f6e..0b45b7cd7 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -73,15 +73,15 @@ CompositeTraceResolver::Add (std::string name, void CompositeTraceResolver::AddSource (std::string name, - std::string helpText, + const TraceDoc &doc, TraceSource &trace) { - DoAddSource (name, helpText, trace, TraceContext ()); + DoAddSource (name, doc, trace, TraceContext ()); } void CompositeTraceResolver::DoAddSource (std::string name, - std::string helpText, + const TraceDoc &doc, TraceSource &trace, const TraceContext &context) { @@ -99,16 +99,15 @@ CompositeTraceResolver::DoAddSource (std::string name, path.append (this->name); TraceContext ctx = context; ctx.Union (this->context); - // XXX help string - collection->AddUnique (path, ctx, helpText); + collection->AddUnique (path, ctx, this->doc); } TraceSource *trace; - std::string helpText; + TraceDoc doc; } *item = new SourceCompositeItem (); item->name = name; item->context = context; item->trace = &trace; - item->helpText = helpText; + item->doc = doc; AddItem (item); } @@ -401,7 +400,7 @@ Ptr CompositeTraceResolverTest::CreateSubResolver (void) { Ptr subresolver = Create (); - subresolver->AddSource ("trace-int", "test source", m_traceInt, + subresolver->AddSource ("trace-int", TraceDoc ("test source"), m_traceInt, SubTraceSourceTest (SubTraceSourceTest::INT)); return subresolver; } @@ -416,9 +415,9 @@ CompositeTraceResolverTest::RunTests (void) CompositeTraceResolver resolver; - resolver.AddSource ("trace-double-a", "test source", traceDoubleA, + resolver.AddSource ("trace-double-a", TraceDoc ("test source"), traceDoubleA, TraceSourceTest (TraceSourceTest::DOUBLEA)); - resolver.AddSource ("trace-double-b", "test source", traceDoubleB, + resolver.AddSource ("trace-double-b", TraceDoc ("test source"), traceDoubleB, TraceSourceTest (TraceSourceTest::DOUBLEB)); resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); @@ -551,7 +550,7 @@ CompositeTraceResolverTest::RunTests (void) SVTraceSource source; - resolver.AddSource ("uint16_t", "test source", source, TraceSourceTest (TraceSourceTest::UINT16_T)); + resolver.AddSource ("uint16_t", TraceDoc ("test source"), source, TraceSourceTest (TraceSourceTest::UINT16_T)); return ok; diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 47fd4ca3f..c9b0fd1d7 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -30,6 +30,7 @@ #include "sv-trace-source.h" #include "fv-trace-source.h" #include "array-trace-resolver.h" +#include "trace-doc.h" namespace ns3 { @@ -53,7 +54,7 @@ public: * be automatically extended to contain the input context. */ template - void AddSource (std::string name, std::string helpText, + void AddSource (std::string name, const TraceDoc &doc, TraceSource &trace, T const &context); /** * \param name name of trace source @@ -64,7 +65,7 @@ public: * resolution. */ void AddSource (std::string name, - std::string helpText, + const TraceDoc &doc, TraceSource &trace); void AddChild (std::string name, Ptr child); @@ -114,7 +115,7 @@ private: const Operation &operation); void DoAddChild (std::string name, Ptr child, const TraceContext &context); void DoAddSource (std::string name, - std::string helpText, + const TraceDoc &doc, TraceSource &trace, const TraceContext &context); void Add (std::string name, @@ -134,13 +135,13 @@ namespace ns3 { template void CompositeTraceResolver::AddSource (std::string name, - std::string helpText, + const TraceDoc &doc, TraceSource &trace, T const &context) { TraceContext ctx; ctx.AddElement (context); - DoAddSource (name, helpText, trace, ctx); + DoAddSource (name, doc, trace, ctx); } template diff --git a/src/core/object.cc b/src/core/object.cc index 565897947..8b5852665 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -360,7 +360,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("basea-x", "test source", m_source); + resolver->AddSource ("basea-x", ns3::TraceDoc ("test source"), m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -384,7 +384,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("deriveda-x", "test source", m_sourceDerived); + resolver->AddSource ("deriveda-x", ns3::TraceDoc ("test source"), m_sourceDerived); resolver->SetParent (BaseA::GetTraceResolver ()); return resolver; } @@ -411,7 +411,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("baseb-x", "test source", m_source); + resolver->AddSource ("baseb-x", ns3::TraceDoc ("test source"), m_source); resolver->SetParent (Object::GetTraceResolver ()); return resolver; } @@ -435,7 +435,7 @@ public: { ns3::Ptr resolver = ns3::Create (); - resolver->AddSource ("derivedb-x", "test source", m_sourceDerived); + resolver->AddSource ("derivedb-x", ns3::TraceDoc ("test source"), m_sourceDerived); resolver->SetParent (BaseB::GetTraceResolver ()); return resolver; } diff --git a/src/core/trace-doc.cc b/src/core/trace-doc.cc index adf3c8c27..b41089d10 100644 --- a/src/core/trace-doc.cc +++ b/src/core/trace-doc.cc @@ -2,6 +2,10 @@ namespace ns3 { +TraceDoc::TraceDoc () + : m_help ("empty help") +{} + TraceDoc::TraceDoc (std::string help) : m_help (help) {} @@ -17,6 +21,7 @@ TraceDoc::TraceDoc (std::string help, std::string arg0Help, std::string arg1Type, std::string arg1Help) + : m_help (help) { m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); @@ -28,6 +33,7 @@ TraceDoc::TraceDoc (std::string help, std::string arg1Help, std::string arg2Type, std::string arg2Help) + : m_help (help) { m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); @@ -42,6 +48,7 @@ TraceDoc::TraceDoc (std::string help, std::string arg2Help, std::string arg3Type, std::string arg3Help) + : m_help (help) { m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); @@ -49,7 +56,7 @@ TraceDoc::TraceDoc (std::string help, m_argVector.push_back (std::make_pair (arg3Type, arg3Help)); } std::string -TraceDoc::GetHelp (void) +TraceDoc::GetHelp (void) const { return m_help; } diff --git a/src/core/trace-doc.h b/src/core/trace-doc.h index 1ccfc0d99..6e2ec0600 100644 --- a/src/core/trace-doc.h +++ b/src/core/trace-doc.h @@ -11,7 +11,7 @@ class TraceDoc typedef std::vector > ArgVector; public: typedef ArgVector::const_iterator Iterator; - + TraceDoc (); TraceDoc (std::string help); TraceDoc (std::string help, std::string arg0Type, @@ -37,7 +37,7 @@ public: std::string arg2Help, std::string arg3Type, std::string arg3Help); - std::string GetHelp (void); + std::string GetHelp (void) const; Iterator ArgsBegin (void) const; Iterator ArgsEnd (void) const; private: diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 683df2ab7..698a23b7d 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -76,13 +76,13 @@ TraceResolver::GetSubpath (std::string path) } void -TraceResolver::SourceCollection::AddUnique (std::string path, const TraceContext &context, - std::string help) +TraceResolver::SourceCollection::AddUnique (std::string path, + const TraceContext &context, + const TraceDoc &doc) { for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) { if (i->path == path && - i->help == help && context.IsSimilar (i->context)) { return; @@ -91,7 +91,7 @@ TraceResolver::SourceCollection::AddUnique (std::string path, const TraceContext struct Source source; source.path = path; source.context = context; - source.help = help; + source.doc = doc; m_sources.push_back (source); } void @@ -103,7 +103,14 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const os << "TraceContext=["; i->context.PrintAvailable (os, ","); os << "]" << std::endl; - os << "help=\"" << i->help << "\"" << std::endl; + os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; + os << "const TraceContext &: the trace context associated to the connected trace source." << std::endl; + uint32_t k = 0; + for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) + { + os << "argument " << k << " -- " << j->first << ": " << j->second << "." << std::endl; + k++; + } os << std::endl; } } diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index c3802619a..762717728 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -24,6 +24,7 @@ #include #include #include "trace-context.h" +#include "trace-doc.h" namespace ns3 { @@ -74,14 +75,15 @@ public: { public: void Print (std::ostream &os) const; - void AddUnique (std::string path, const TraceContext &context, - std::string help); + void AddUnique (std::string path, + const TraceContext &context, + const TraceDoc &doc); private: struct Source { std::string path; TraceContext context; - std::string help; + TraceDoc doc; }; typedef std::vector SourceVector; SourceVector m_sources; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 2b829f668..06fea4895 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -463,11 +463,13 @@ CsmaNetDevice::GetTraceResolver (void) Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); resolver->AddSource ("rx", - "receive MAC packet", + TraceDoc ("receive MAC packet", + "const Packet &", "packet received"), m_rxTrace, CsmaTraceType (CsmaTraceType::RX)); resolver->AddSource ("drop", - "drop MAC packet", + TraceDoc ("drop MAC packet", + "const Packet &", "packet dropped"), m_dropTrace, CsmaTraceType (CsmaTraceType::DROP)); resolver->SetParent (NetDevice::GetTraceResolver ()); diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 4506cd740..e6c2d8de6 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -200,7 +200,8 @@ PointToPointNetDevice::GetTraceResolver (void) Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); resolver->AddSource ("rx", - "receive MAC packet", + TraceDoc ("receive MAC packet", + "const Packet &", "packet received"), m_rxTrace, PointToPointTraceType ()); resolver->SetParent (NetDevice::GetTraceResolver ()); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index b59901dc2..2eab180d9 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -162,11 +162,19 @@ Ptr Ipv4L3Protocol::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("tx", "send ipv4 packet to outgoing interface", + resolver->AddSource ("tx", + TraceDoc ("send ipv4 packet to outgoing interface", + "const Packet &", "packet sent", + "uint32_t", "index of output ipv4 interface"), m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); - resolver->AddSource ("rx", "receive ipv4 packet from incoming interface", + resolver->AddSource ("rx", + TraceDoc ("receive ipv4 packet from incoming interface", + "const Packet &", "packet received", + "uint32_t", "index of input ipv4 interface"), m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); - resolver->AddSource ("drop", "drop ipv4 packet", + resolver->AddSource ("drop", + TraceDoc ("drop ipv4 packet", + "const Packet &", "packet dropped"), m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); resolver->AddArray ("interfaces", m_interfaces.begin (), m_interfaces.end (), diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index add1cb993..e7cb8bc3e 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -20,6 +20,7 @@ */ #include "mobility-model-notifier.h" #include "ns3/composite-trace-resolver.h" +#include "ns3/trace-doc.h" namespace ns3 { @@ -44,7 +45,10 @@ MobilityModelNotifier::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("course-change", "speed vector changed value", + resolver->AddSource ("course-change", + TraceDoc ("The value of the speed vector changed", + "Ptr", + "the mobility model whose course changed"), m_trace); resolver->SetParent (Object::GetTraceResolver ()); return resolver; diff --git a/src/node/queue.cc b/src/node/queue.cc index 7ebbf838e..809600854 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -103,11 +103,17 @@ Ptr Queue::GetTraceResolver (void) { Ptr resolver = Create (); - resolver->AddSource ("enqueue", "store packet in queue", + resolver->AddSource ("enqueue", + TraceDoc ("store packet in queue", + "const Packet &", "packet queued"), m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); - resolver->AddSource ("dequeue", "remove packet from queue", + resolver->AddSource ("dequeue", + TraceDoc ("remove packet from queue", + "const Packet &", "packet dequeued"), m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); - resolver->AddSource ("drop", "drop packet from queue", + resolver->AddSource ("drop", + TraceDoc ("drop packet from queue", + "const Packet &", "packet dropped"), m_traceDrop, QueueTraceType (QueueTraceType::DROP)); resolver->SetParent (Object::GetTraceResolver ()); return resolver; From f085b052fb51f472a6940506a36438c13ac52cf4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 13:14:43 +0200 Subject: [PATCH 072/218] api doxygen for Object base class --- src/core/object.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/core/object.h b/src/core/object.h index 8661d7f8a..8124ec991 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -141,9 +141,28 @@ public: */ void AddInterface (Ptr other); - + /** + * \param path the path to match for the callback + * \param cb callback to connect + * + * Connect the input callback to all trace sources which + * match the input path. + * + */ void TraceConnect (std::string path, const CallbackBase &cb); + /** + * \param path the path to match for the callback + * \param cb callback to disconnect + * + * Disconnect the input callback from all trace sources which + * match the input path. + */ void TraceDisconnect (std::string path, const CallbackBase &cb); + /** + * \returns the trace resolver associated to this object. + * + * This method should be rarely called by users. + */ virtual Ptr GetTraceResolver (void); protected: /** From 86084553124402bbf5d6af004505da205559b7ea Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 14:09:52 +0200 Subject: [PATCH 073/218] use the NodeList::Iterator type --- src/routing/global-routing/global-route-manager-impl.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 9ede0a134..9fd73c680 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -337,8 +337,7 @@ GlobalRouteManagerImpl::SelectRouterNodes () { NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes ()"); - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes (): " @@ -366,8 +365,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () // // Walk the list of nodes looking for the GlobalRouter Interface. // - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; @@ -448,8 +446,7 @@ GlobalRouteManagerImpl::InitializeRoutes () // // Walk the list of nodes in the system. // - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; // From 46e60cbbbba925284a9802756013a3735f0ffb03 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 14:31:53 +0200 Subject: [PATCH 074/218] use more NodeList::Iterator types --- src/routing/global-routing/global-route-manager-impl.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 9fd73c680..42c63b9b9 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1110,7 +1110,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a) // the node at the root of the SPF tree. This is the node for which we are // building the routing table. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1183,7 +1183,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) // the node at the root of the SPF tree. This is the node for which we are // building the routing table. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1274,7 +1274,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) // ID corresponding to the root vertex. This is the one we're going to write // the routing information to. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1395,7 +1395,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) // ID corresponding to the root vertex. This is the one we're going to write // the routing information to. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; From 726d99891098864bdc7ab6d2e83eb2315a2cfddd Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 14:33:53 +0200 Subject: [PATCH 075/218] constify --- src/core/composite-trace-resolver.cc | 6 ++--- src/core/composite-trace-resolver.h | 8 +++---- src/core/object.cc | 24 +++++++++---------- src/core/object.h | 10 ++++---- src/devices/csma/csma-net-device.cc | 2 +- src/devices/csma/csma-net-device.h | 2 +- .../point-to-point-net-device.cc | 2 +- .../point-to-point-net-device.h | 2 +- src/internet-node/arp-ipv4-interface.cc | 2 +- src/internet-node/arp-ipv4-interface.h | 2 +- src/internet-node/internet-node.cc | 2 +- src/internet-node/internet-node.h | 2 +- src/internet-node/ipv4-l3-protocol.cc | 2 +- src/internet-node/ipv4-l3-protocol.h | 2 +- src/internet-node/ipv4-l4-demux.cc | 2 +- src/internet-node/ipv4-l4-demux.h | 2 +- src/mobility/mobility-model-notifier.cc | 2 +- src/mobility/mobility-model-notifier.h | 2 +- src/node/node-list.cc | 12 +++++----- src/node/node-list.h | 2 +- src/node/node.cc | 2 +- src/node/node.h | 2 +- src/node/queue.cc | 2 +- src/node/queue.h | 2 +- 24 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 0b45b7cd7..5f04b2c28 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -74,7 +74,7 @@ CompositeTraceResolver::Add (std::string name, void CompositeTraceResolver::AddSource (std::string name, const TraceDoc &doc, - TraceSource &trace) + const TraceSource &trace) { DoAddSource (name, doc, trace, TraceContext ()); } @@ -82,7 +82,7 @@ CompositeTraceResolver::AddSource (std::string name, void CompositeTraceResolver::DoAddSource (std::string name, const TraceDoc &doc, - TraceSource &trace, + const TraceSource &trace, const TraceContext &context) { class SourceCompositeItem : public CompositeItem @@ -106,7 +106,7 @@ CompositeTraceResolver::DoAddSource (std::string name, } *item = new SourceCompositeItem (); item->name = name; item->context = context; - item->trace = &trace; + item->trace = const_cast (&trace); item->doc = doc; AddItem (item); } diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index c9b0fd1d7..e9ead6af0 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -55,7 +55,7 @@ public: */ template void AddSource (std::string name, const TraceDoc &doc, - TraceSource &trace, T const &context); + const TraceSource &trace, T const &context); /** * \param name name of trace source * \param trace a callback trace source @@ -66,7 +66,7 @@ public: */ void AddSource (std::string name, const TraceDoc &doc, - TraceSource &trace); + const TraceSource &trace); void AddChild (std::string name, Ptr child); @@ -116,7 +116,7 @@ private: void DoAddChild (std::string name, Ptr child, const TraceContext &context); void DoAddSource (std::string name, const TraceDoc &doc, - TraceSource &trace, + const TraceSource &trace, const TraceContext &context); void Add (std::string name, Callback > createResolver); @@ -136,7 +136,7 @@ template void CompositeTraceResolver::AddSource (std::string name, const TraceDoc &doc, - TraceSource &trace, + const TraceSource &trace, T const &context) { TraceContext ctx; diff --git a/src/core/object.cc b/src/core/object.cc index 8b5852665..56768be5d 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -63,20 +63,20 @@ namespace ns3 { class InterfaceIdTraceResolver : public TraceResolver { public: - InterfaceIdTraceResolver (Ptr aggregate); + InterfaceIdTraceResolver (Ptr aggregate); virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); private: - Ptr ParseForInterface (std::string path); - Ptr m_aggregate; + Ptr ParseForInterface (std::string path); + Ptr m_aggregate; }; -InterfaceIdTraceResolver::InterfaceIdTraceResolver (Ptr aggregate) +InterfaceIdTraceResolver::InterfaceIdTraceResolver (Ptr aggregate) : m_aggregate (aggregate) {} -Ptr +Ptr InterfaceIdTraceResolver::ParseForInterface (std::string path) { std::string element = GetElement (path); @@ -93,7 +93,7 @@ InterfaceIdTraceResolver::ParseForInterface (std::string path) void InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { - Ptr interface = ParseForInterface (path); + Ptr interface = ParseForInterface (path); if (interface != 0) { interface->GetTraceResolver ()->Connect (GetSubpath (path), cb, context); @@ -102,7 +102,7 @@ InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, con void InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb) { - Ptr interface = ParseForInterface (path); + Ptr interface = ParseForInterface (path); if (interface != 0) { interface->TraceDisconnect (GetSubpath (path), cb); @@ -232,12 +232,12 @@ Object::AddInterface (Ptr o) } void -Object::TraceConnect (std::string path, const CallbackBase &cb) +Object::TraceConnect (std::string path, const CallbackBase &cb) const { GetTraceResolver ()->Connect (path, cb, TraceContext ()); } void -Object::TraceDisconnect (std::string path, const CallbackBase &cb) +Object::TraceDisconnect (std::string path, const CallbackBase &cb) const { GetTraceResolver ()->Disconnect (path, cb); } @@ -256,7 +256,7 @@ Object::DoDispose (void) } Ptr -Object::GetTraceResolver (void) +Object::GetTraceResolver (void) const { Ptr resolver = Create (this); @@ -298,9 +298,9 @@ Object::MaybeDelete (void) const void Object::DoCollectSources (std::string path, const TraceContext &context, - TraceResolver::SourceCollection *collection) + TraceResolver::SourceCollection *collection) const { - Object *current; + const Object *current; current = this; do { if (current->m_collecting) diff --git a/src/core/object.h b/src/core/object.h index 8124ec991..ea4f091db 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -149,7 +149,7 @@ public: * match the input path. * */ - void TraceConnect (std::string path, const CallbackBase &cb); + void TraceConnect (std::string path, const CallbackBase &cb) const; /** * \param path the path to match for the callback * \param cb callback to disconnect @@ -157,13 +157,13 @@ public: * Disconnect the input callback from all trace sources which * match the input path. */ - void TraceDisconnect (std::string path, const CallbackBase &cb); + void TraceDisconnect (std::string path, const CallbackBase &cb) const; /** * \returns the trace resolver associated to this object. * * This method should be rarely called by users. */ - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; protected: /** * \param iid an InterfaceId @@ -183,13 +183,13 @@ private: friend class InterfaceIdTraceResolver; Ptr DoQueryInterface (InterfaceId iid) const; void DoCollectSources (std::string path, const TraceContext &context, - TraceResolver::SourceCollection *collection); + TraceResolver::SourceCollection *collection) const; bool Check (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; InterfaceId m_iid; bool m_disposed; - bool m_collecting; + mutable bool m_collecting; Object *m_next; }; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 06fea4895..8b11ec583 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -458,7 +458,7 @@ CsmaNetDevice::TransmitReadyEvent (void) } Ptr -CsmaNetDevice::GetTraceResolver (void) +CsmaNetDevice::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 392e8c91d..db850914e 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -212,7 +212,7 @@ protected: * (NOT TESTED) * @see class TraceResolver */ - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; /** * Get a copy of the attached Queue. diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index e6c2d8de6..d2b5e45e0 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -195,7 +195,7 @@ void PointToPointNetDevice::TransmitComplete (void) } Ptr -PointToPointNetDevice::GetTraceResolver (void) +PointToPointNetDevice::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddChild ("queue", m_queue); diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 0adc8fde0..88544b7ed 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -158,7 +158,7 @@ protected: * * @see class TraceResolver */ - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; virtual void DoDispose (void); /** * Get a copy of the attached Queue. diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 2648c5ec4..c6dff084e 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -41,7 +41,7 @@ ArpIpv4Interface::~ArpIpv4Interface () {} Ptr -ArpIpv4Interface::GetTraceResolver (void) +ArpIpv4Interface::GetTraceResolver (void) const { Ptr resolver = Create (); if (GetDevice () != 0) diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 73bf4f462..c5d36a29f 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -43,7 +43,7 @@ class ArpIpv4Interface : public Ipv4Interface virtual ~ArpIpv4Interface (); protected: - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; private: virtual void SendTo (Packet p, Ipv4Address dest); Ptr m_node; diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 7bc9cd3c8..a27288ebc 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -75,7 +75,7 @@ InternetNode::Construct (void) } Ptr -InternetNode::GetTraceResolver () +InternetNode::GetTraceResolver () const { Ptr resolver = Create (); Ptr ipv4 = QueryInterface (Ipv4L3Protocol::iid); diff --git a/src/internet-node/internet-node.h b/src/internet-node/internet-node.h index d54714a8b..0c855029e 100644 --- a/src/internet-node/internet-node.h +++ b/src/internet-node/internet-node.h @@ -42,7 +42,7 @@ public: protected: virtual void DoDispose(void); - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; private: bool ReceiveFromDevice (Ptr device, const Packet &p, uint16_t protocolNumber) const; void Construct (void); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 2eab180d9..1409cad50 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -159,7 +159,7 @@ Ipv4L3Protocol::SetupLoopback (void) } Ptr -Ipv4L3Protocol::GetTraceResolver (void) +Ipv4L3Protocol::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddSource ("tx", diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index ad9d482d2..f5e8aef04 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -171,7 +171,7 @@ public: protected: virtual void DoDispose (void); - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; private: diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 120b3f47e..b4e7e0860 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -84,7 +84,7 @@ Ipv4L4Demux::DoDispose (void) } Ptr -Ipv4L4Demux::GetTraceResolver (void) +Ipv4L4Demux::GetTraceResolver (void) const { Ptr resolver = Create (); for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index efd91bd44..40641485b 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -89,7 +89,7 @@ public: */ void Remove (Ptr protocol); protected: - Ptr GetTraceResolver (void); + Ptr GetTraceResolver (void) const; virtual void DoDispose (void); private: typedef std::list > L4List_t; diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index e7cb8bc3e..5dbb1bbc2 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -41,7 +41,7 @@ MobilityModelNotifier::Notify (Ptr position) const } Ptr -MobilityModelNotifier::GetTraceResolver (void) +MobilityModelNotifier::GetTraceResolver (void) const { Ptr resolver = Create (); diff --git a/src/mobility/mobility-model-notifier.h b/src/mobility/mobility-model-notifier.h index 0f8422d4e..1d2409f8e 100644 --- a/src/mobility/mobility-model-notifier.h +++ b/src/mobility/mobility-model-notifier.h @@ -48,7 +48,7 @@ public: */ void Notify (Ptr position) const; protected: - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; private: CallbackTraceSource > m_trace; }; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 7278f2e3a..9c3b27ce7 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -67,9 +67,9 @@ public: ~NodeListPriv (); uint32_t Add (Ptr node); - NodeList::Iterator Begin (void); - NodeList::Iterator End (void); - Ptr GetTraceResolver (void); + NodeList::Iterator Begin (void) const; + NodeList::Iterator End (void) const; + Ptr GetTraceResolver (void) const; Ptr GetNode (uint32_t n); uint32_t GetNNodes (void); @@ -101,12 +101,12 @@ NodeListPriv::Add (Ptr node) } NodeList::Iterator -NodeListPriv::Begin (void) +NodeListPriv::Begin (void) const { return m_nodes.begin (); } NodeList::Iterator -NodeListPriv::End (void) +NodeListPriv::End (void) const { return m_nodes.end (); } @@ -124,7 +124,7 @@ NodeListPriv::GetNode (uint32_t n) Ptr -NodeListPriv::GetTraceResolver (void) +NodeListPriv::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddArray ("nodes", Begin (), End (), NodeListIndex ()); diff --git a/src/node/node-list.h b/src/node/node-list.h index dfb4e4ce9..d256953c1 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -54,7 +54,7 @@ private: class NodeList { public: - typedef std::vector< Ptr >::iterator Iterator; + typedef std::vector< Ptr >::const_iterator Iterator; /** * \param node node to add diff --git a/src/node/node.cc b/src/node/node.cc index 52231fa1b..c9b304a93 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -87,7 +87,7 @@ Node::~Node () {} Ptr -Node::GetTraceResolver (void) +Node::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddArray ("devices", m_devices.begin (), m_devices.end (), NodeNetDeviceIndex ()); diff --git a/src/node/node.h b/src/node/node.h index 062f259c6..4f1c5be86 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -173,7 +173,7 @@ public: void UnregisterProtocolHandler (ProtocolHandler handler); protected: - virtual Ptr GetTraceResolver (void); + virtual Ptr GetTraceResolver (void) const; /** * The dispose method. Subclasses must override this method * and must chain up to it by calling Node::DoDispose at the diff --git a/src/node/queue.cc b/src/node/queue.cc index 809600854..74e36f3ee 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -100,7 +100,7 @@ Queue::~Queue() } Ptr -Queue::GetTraceResolver (void) +Queue::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddSource ("enqueue", diff --git a/src/node/queue.h b/src/node/queue.h index f10191fad..7b54f6e72 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -166,7 +166,7 @@ private: virtual bool DoPeek (Packet &p) = 0; protected: - Ptr GetTraceResolver (void); + Ptr GetTraceResolver (void) const; // called by subclasses to notify parent of packet drops. void Drop (const Packet& p); From 7c4e277f6d77b93348bec685a94decb7f693ad82 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 14:51:13 +0200 Subject: [PATCH 076/218] add doxygen documentation and rename TraceContext::Get to TraceContext::GetElement --- src/core/composite-trace-resolver.cc | 2 +- src/core/trace-context.cc | 32 +++++++++---------- src/core/trace-context.h | 46 ++++++++++++++++++++-------- src/core/trace-resolver.h | 15 ++++++--- src/internet-node/pcap-trace.cc | 2 +- 5 files changed, 63 insertions(+), 34 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 5f04b2c28..fb0c85d01 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -374,7 +374,7 @@ void CompositeTraceResolverTest::TraceDouble (TraceContext const &context, double v) { TraceSourceTest source; - context.Get (source); + context.GetElement (source); if (source.IsDoubleA ()) { m_gotDoubleA = true; diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index d065bfa73..e09f461ca 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -358,25 +358,25 @@ TraceContextTest::RunTests (void) { ok = false; } - ctx.Get (v0); + ctx.GetElement (v0); ctx.AddElement (v1); - ctx.Get (v1); - ctx.Get (v0); - ctx.Get (v1); + ctx.GetElement (v1); + ctx.GetElement (v0); + ctx.GetElement (v1); TraceContext copy = ctx; - ctx.Get (v0); - ctx.Get (v1); - copy.Get (v0); - copy.Get (v1); + ctx.GetElement (v0); + ctx.GetElement (v1); + copy.GetElement (v0); + copy.GetElement (v1); copy.AddElement (v2); - copy.Get (v0); - copy.Get (v1); - copy.Get (v2); + copy.GetElement (v0); + copy.GetElement (v1); + copy.GetElement (v2); ctx.AddElement (v3); - ctx.Get (v0); - ctx.Get (v1); - ctx.Get (v3); + ctx.GetElement (v0); + ctx.GetElement (v1); + ctx.GetElement (v3); if (ctx.SafeGet (v2)) { @@ -387,13 +387,13 @@ TraceContextTest::RunTests (void) ok = false; } ctx.Union (copy); - ctx.Get (v2); + ctx.GetElement (v2); if (copy.SafeGet (v3)) { ok = false; } copy.Union (ctx); - copy.Get (v3); + copy.GetElement (v3); return ok; } diff --git a/src/core/trace-context.h b/src/core/trace-context.h index fef2adcc6..13c9f15a7 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -34,8 +34,10 @@ namespace ns3 { * * Instances of this class are used to hold context * for each trace source. Each instance holds a list of - * 'contexts'. Trace sinks can lookup these contexts + * TraceContextElement. Trace sinks can lookup these contexts * from this list with the ns3::TraceContext::Get method. + * They can also ask the TraceContext for the list of + * TraceContextElements it contains with the PrintAvailable method. * * This class is implemented * using Copy On Write which means that copying unmodified @@ -54,6 +56,9 @@ public: /** * \param context add context to list of trace contexts. + * + * A copy of the input context is appended at the end of the list + * stored in this TraceContext. */ template void AddElement (T const &context); @@ -63,7 +68,7 @@ public: * * Perform the Union operation (in the sense of set theory) on the * two input lists of elements. This method is used in the - * ns3::CallbackTraceSourceSource class when multiple sinks are connected + * ns3::CallbackTraceSource class when multiple sinks are connected * to a single source to ensure that the source does not need * to store a single TraceContext instance per connected sink. * Instead, all sinks share the same TraceContext. @@ -72,15 +77,35 @@ public: /** * \param context context to get from this list of trace contexts. - * - * This method cannot fail. If the requested trace context is not - * stored in this TraceContext, then, the program will halt. + * \returns true if the requested trace context element was found + * in this TraceContext, false otherwise. */ template - void Get (T &context) const; + bool GetElement (T &context) const; + /** + * \param os a c++ STL output stream + * + * Iterate over the list of TraceContextElement stored in this + * TraceContext and invoke each of their Print method. + */ void Print (std::ostream &os) const; + /** + * \param os a c++ STL output stream + * \param separator the separator inserted between each TraceContextElement typename. + * + * Print the typename of each TraceContextElement stored in this TraceContext. + */ void PrintAvailable (std::ostream &os, std::string separator) const; + /** + * \param o another trace context + * \returns true if the input trace context contains exactly the same set of + * TraceContextElement instances, false otherwise. + * + * This method does not test for equality: the content of each matching + * TraceContextElement could be different. It merely checks that both + * trace contexts contain the same types of TraceContextElements. + */ bool IsSimilar (const TraceContext &o) const; private: friend class TraceContextTest; @@ -123,8 +148,8 @@ TraceContext::AddElement (T const &context) } } template -void -TraceContext::Get (T &context) const +bool +TraceContext::GetElement (T &context) const { TraceContextElement *parent; // if the following assignment fails, it is because the input @@ -132,10 +157,7 @@ TraceContext::Get (T &context) const parent = &context; uint8_t *data = (uint8_t *) &context; bool found = DoGet (T::GetUid (), data); - if (!found) - { - NS_FATAL_ERROR ("Type not stored in TraceContext"); - } + return found; } template bool diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 762717728..dcc0f9699 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -35,10 +35,9 @@ class CallbackBase; * namespace resolution. * \ingroup tracing * - * Subclasses must implement the two pure virtal methods defined in - * this base class: - * - ns3::TraceResolver::Connect - * - ns3::TraceResolver::Disconnect. + * Although users could conceivably implement their own trace resolver + * subclasses, doing so is complicated so, it is recommended to use + * the default implementation ns3::CompositeTraceResolver instead. */ class TraceResolver { @@ -88,6 +87,14 @@ public: typedef std::vector SourceVector; SourceVector m_sources; }; + /** + * \param path the path to the current recursive level. + * \param context the trace context associated to the current recursive level + * \param collection the collection in which to gather every trace source found. + * + * This method is invoked recursively until all trace sources have been + * stored in the output SourceCollection argument. + */ virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; protected: diff --git a/src/internet-node/pcap-trace.cc b/src/internet-node/pcap-trace.cc index dd0b39a29..3378b52c5 100644 --- a/src/internet-node/pcap-trace.cc +++ b/src/internet-node/pcap-trace.cc @@ -83,7 +83,7 @@ void PcapTrace::LogIp (TraceContext const &context, Packet const &p, uint32_t interfaceIndex) { NodeListIndex nodeIndex; - context.Get (nodeIndex); + context.GetElement (nodeIndex); PcapWriter *writer = GetStream (nodeIndex.Get (), interfaceIndex); writer->WritePacket (p); } From 69d72477cddb0e9b7d6977ac8cbd366df3a19c82 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 15:04:37 +0200 Subject: [PATCH 077/218] add some doxygen --- src/core/trace-context-element.h | 6 ++++++ src/core/trace-source.h | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/core/trace-context-element.h b/src/core/trace-context-element.h index fa945294d..4ed08c3ac 100644 --- a/src/core/trace-context-element.h +++ b/src/core/trace-context-element.h @@ -48,6 +48,7 @@ namespace ns3 { * MyContext (); * ~MyContext (); * void Print (std::ostream &os) const; + * std::string GetName (void) const; * * // the user-specific API to manipulate the context. * void SetData (uint8_t data); @@ -71,6 +72,11 @@ namespace ns3 { * { * os << "mycontext=" << (uint32_t) m_myContextData; * } + * std::string + * MyContext::GetName (void) const + * { + * return "MyContext"; + * } * void * MyContext::SetData (uint8_t data) * { diff --git a/src/core/trace-source.h b/src/core/trace-source.h index 1b4c96577..9424b9086 100644 --- a/src/core/trace-source.h +++ b/src/core/trace-source.h @@ -23,11 +23,26 @@ namespace ns3 { +/** + * \brief the base class for all trace sources + * + * Every trace source which wishes to be connectable and disconnectable with + * the TraceResolver system should derive from this base class and implement + * all three methods below. + */ class TraceSource { public: virtual ~TraceSource () {} + /** + * \param callback the callback to connect to this trace source + * \param the context associated to the input callback which should be passed + * back to the user. + */ virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; + /** + * \param callback the callback to disconnect from this trace source + */ virtual void RemoveCallback (CallbackBase const & callback) = 0; }; From f87f5e6b4f209999ad764842734e4025562a668e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 15:59:49 +0200 Subject: [PATCH 078/218] avoid method naming ambiguity in CompositeTraceResolver --- src/core/composite-trace-resolver.cc | 36 +++++++++---------- src/core/composite-trace-resolver.h | 32 ++++++++--------- src/core/object.cc | 8 ++--- src/devices/csma/csma-net-device.cc | 4 +-- .../point-to-point-net-device.cc | 4 +-- src/internet-node/arp-ipv4-interface.cc | 4 +-- src/internet-node/internet-node.cc | 4 +-- src/internet-node/ipv4-l4-demux.cc | 4 +-- src/mobility/mobility-model-notifier.cc | 2 +- src/node/node.cc | 2 +- src/node/queue.cc | 2 +- 11 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index fb0c85d01..0f4e782b8 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -38,7 +38,7 @@ CompositeTraceResolver::~CompositeTraceResolver () } void -CompositeTraceResolver::AddItem (CompositeItem *item) +CompositeTraceResolver::AddItem (ResolveItem *item) { m_items.push_back (item); } @@ -47,7 +47,7 @@ void CompositeTraceResolver::Add (std::string name, Callback > createResolver) { - class MakerCompositeItem : public CompositeItem + class MakerResolveItem : public ResolveItem { public: virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) @@ -64,7 +64,7 @@ CompositeTraceResolver::Add (std::string name, this->maker ()->CollectSources (path, ctx, collection); } Callback > maker; - } *item = new MakerCompositeItem (); + } *item = new MakerResolveItem (); item->name = name; item->context = TraceContext (); item->maker = createResolver; @@ -85,7 +85,7 @@ CompositeTraceResolver::DoAddSource (std::string name, const TraceSource &trace, const TraceContext &context) { - class SourceCompositeItem : public CompositeItem + class SourceResolveItem : public ResolveItem { public: virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) @@ -103,7 +103,7 @@ CompositeTraceResolver::DoAddSource (std::string name, } TraceSource *trace; TraceDoc doc; - } *item = new SourceCompositeItem (); + } *item = new SourceResolveItem (); item->name = name; item->context = context; item->trace = const_cast (&trace); @@ -115,20 +115,20 @@ CompositeTraceResolver::DoAddSource (std::string name, void -CompositeTraceResolver::AddChild (std::string name, Ptr child) +CompositeTraceResolver::AddComposite (std::string name, Ptr composite) { - DoAddChild (name, child, TraceContext ()); + DoAddComposite (name, composite, TraceContext ()); } void -CompositeTraceResolver::DoAddChild (std::string name, Ptr child, const TraceContext &context) +CompositeTraceResolver::DoAddComposite (std::string name, Ptr composite, const TraceContext &context) { - class ChildCompositeItem : public CompositeItem + class CompositeResolveItem : public ResolveItem { public: virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) - {child->GetTraceResolver ()->Connect (subpath, cb, context);} + {composite->GetTraceResolver ()->Connect (subpath, cb, context);} virtual void Disconnect (std::string subpath, const CallbackBase &cb) - {child->TraceDisconnect (subpath, cb);} + {composite->TraceDisconnect (subpath, cb);} virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) { @@ -136,19 +136,19 @@ CompositeTraceResolver::DoAddChild (std::string name, Ptr child, const T path.append (this->name); TraceContext ctx = context; ctx.Union (this->context); - this->child->GetTraceResolver ()->CollectSources (path, ctx, collection); + this->composite->GetTraceResolver ()->CollectSources (path, ctx, collection); } - Ptr child; - } *item = new ChildCompositeItem (); + Ptr composite; + } *item = new CompositeResolveItem (); item->name = name; item->context = context; - item->child = child; + item->composite = composite; AddItem (item); } void -CompositeTraceResolver::SetParent (Ptr resolver) +CompositeTraceResolver::SetParentResolver (Ptr resolver) { m_parent = resolver; } @@ -163,7 +163,7 @@ CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const ConnectOperation (const CallbackBase &cb, const TraceContext &context) : m_cb (cb), m_context (context) {} - virtual void Do (std::string subpath, CompositeItem *item) const + virtual void Do (std::string subpath, ResolveItem *item) const { NS_DEBUG ("connect to path="<SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } ns3::SVTraceSource m_source; @@ -385,7 +385,7 @@ public: ns3::Ptr resolver = ns3::Create (); resolver->AddSource ("deriveda-x", ns3::TraceDoc ("test source"), m_sourceDerived); - resolver->SetParent (BaseA::GetTraceResolver ()); + resolver->SetParentResolver (BaseA::GetTraceResolver ()); return resolver; } ns3::SVTraceSource m_sourceDerived; @@ -412,7 +412,7 @@ public: ns3::Ptr resolver = ns3::Create (); resolver->AddSource ("baseb-x", ns3::TraceDoc ("test source"), m_source); - resolver->SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } ns3::SVTraceSource m_source; @@ -436,7 +436,7 @@ public: ns3::Ptr resolver = ns3::Create (); resolver->AddSource ("derivedb-x", ns3::TraceDoc ("test source"), m_sourceDerived); - resolver->SetParent (BaseB::GetTraceResolver ()); + resolver->SetParentResolver (BaseB::GetTraceResolver ()); return resolver; } ns3::SVTraceSource m_sourceDerived; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 8b11ec583..413478ad3 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -461,7 +461,7 @@ Ptr CsmaNetDevice::GetTraceResolver (void) const { Ptr resolver = Create (); - resolver->AddChild ("queue", m_queue); + resolver->AddComposite ("queue", m_queue); resolver->AddSource ("rx", TraceDoc ("receive MAC packet", "const Packet &", "packet received"), @@ -472,7 +472,7 @@ CsmaNetDevice::GetTraceResolver (void) const "const Packet &", "packet dropped"), m_dropTrace, CsmaTraceType (CsmaTraceType::DROP)); - resolver->SetParent (NetDevice::GetTraceResolver ()); + resolver->SetParentResolver (NetDevice::GetTraceResolver ()); return resolver; } diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index d2b5e45e0..cee375b53 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -198,13 +198,13 @@ Ptr PointToPointNetDevice::GetTraceResolver (void) const { Ptr resolver = Create (); - resolver->AddChild ("queue", m_queue); + resolver->AddComposite ("queue", m_queue); resolver->AddSource ("rx", TraceDoc ("receive MAC packet", "const Packet &", "packet received"), m_rxTrace, PointToPointTraceType ()); - resolver->SetParent (NetDevice::GetTraceResolver ()); + resolver->SetParentResolver (NetDevice::GetTraceResolver ()); return resolver; } diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index c6dff084e..3a03c5316 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -46,9 +46,9 @@ ArpIpv4Interface::GetTraceResolver (void) const Ptr resolver = Create (); if (GetDevice () != 0) { - resolver->AddChild ("netdevice", GetDevice ()); + resolver->AddComposite ("netdevice", GetDevice ()); } - resolver->SetParent (Ipv4Interface::GetTraceResolver ()); + resolver->SetParentResolver (Ipv4Interface::GetTraceResolver ()); return resolver; } diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index a27288ebc..5a927b55f 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -79,8 +79,8 @@ InternetNode::GetTraceResolver () const { Ptr resolver = Create (); Ptr ipv4 = QueryInterface (Ipv4L3Protocol::iid); - resolver->AddChild ("ipv4", ipv4); - resolver->SetParent (Node::GetTraceResolver ()); + resolver->AddComposite ("ipv4", ipv4); + resolver->SetParentResolver (Node::GetTraceResolver ()); return resolver; } diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index b4e7e0860..a4d83d49b 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -94,9 +94,9 @@ Ipv4L4Demux::GetTraceResolver (void) const std::ostringstream oss (protValue); oss << (*i)->GetProtocolNumber (); Ipv4L4ProtocolTraceContextElement protocolNumber = (*i)->GetProtocolNumber (); - resolver->AddChild (protValue, protocol, protocolNumber); + resolver->AddComposite (protValue, protocol, protocolNumber); } - resolver->SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } void diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index 5dbb1bbc2..ebe64f3df 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -50,7 +50,7 @@ MobilityModelNotifier::GetTraceResolver (void) const "Ptr", "the mobility model whose course changed"), m_trace); - resolver->SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } diff --git a/src/node/node.cc b/src/node/node.cc index c9b304a93..ed56ca8d8 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -91,7 +91,7 @@ Node::GetTraceResolver (void) const { Ptr resolver = Create (); resolver->AddArray ("devices", m_devices.begin (), m_devices.end (), NodeNetDeviceIndex ()); - resolver->SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } diff --git a/src/node/queue.cc b/src/node/queue.cc index 74e36f3ee..2ebc6c0d1 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -115,7 +115,7 @@ Queue::GetTraceResolver (void) const TraceDoc ("drop packet from queue", "const Packet &", "packet dropped"), m_traceDrop, QueueTraceType (QueueTraceType::DROP)); - resolver->SetParent (Object::GetTraceResolver ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } From c001692cd491bac1f95555c2829df824ed64e330 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 28 Aug 2007 16:06:12 +0200 Subject: [PATCH 079/218] some doxygen additions --- src/core/composite-trace-resolver.h | 36 ++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index c0eb96bac..2a96149ca 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -45,6 +45,7 @@ public: virtual ~CompositeTraceResolver (); /** * \param name name of trace source + * \param doc the documentation associated to this trace source * \param trace a callback trace source * \param context the context associated to this trace source * @@ -58,6 +59,7 @@ public: const TraceSource &trace, T const &context); /** * \param name name of trace source + * \param doc the documentation associated to this trace source * \param trace a callback trace source * * Add a callback trace source in this resolver. This trace @@ -68,16 +70,48 @@ public: const TraceDoc &doc, const TraceSource &trace); + /** + * \param name the name of the composite element + * \param composite the composite object + * + * The input composite object will be used to resolve a connection + * of a disconnection attempt if its name matches the trace path. + * + */ void AddComposite (std::string name, Ptr composite); + /** + * \param name the name of the composite element + * \param composite the composite object + * \param contextElement the context element associated to the composite + * + * The input composite object will be used to resolve a connection + * of a disconnection attempt if its name matches the trace path. + * The contextElement will be appended to the TraceContext during connection. + */ template void AddComposite (std::string name, Ptr composite, const T &contextElement); + /** + * \param name the name of the array + * \param begin an iterator which points to the first element of the array + * \param begin an iterator which points to the last element of the array + * \param index an object which can store the index of an element in the + * array. In practice, this object should support a constructor + * whose single argument is an array index. + */ template void AddArray (std::string name, ITERATOR begin, ITERATOR end, INDEX index); - + /** + * \param parent the parent trace resolver + * + * The parent trace resolver is the trace resolver returned by the + * GetTraceResolver method of the base class of the caller. It is + * used during connection and disconnection to chain up the connect + * and disconnect calls to the parent. + */ void SetParentResolver (Ptr parent); From 6daedfe3816bedcbef57b8ee6b3cca759ae96cb5 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Tue, 28 Aug 2007 10:20:13 -0400 Subject: [PATCH 080/218] Remove references to really-simple-point-to-point, fix build --- examples/wscript | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/wscript b/examples/wscript index cb0af9530..e5e771555 100644 --- a/examples/wscript +++ b/examples/wscript @@ -10,10 +10,6 @@ def build(bld): ['point-to-point', 'internet-node']) obj.source = 'simple-point-to-point.cc' - obj = bld.create_ns3_program('really-simple-point-to-point', - ['point-to-point', 'internet-node']) - obj.source = 'really-simple-point-to-point.cc' - obj = bld.create_ns3_program('csma-one-subnet', ['csma', 'internet-node']) obj.source = 'csma-one-subnet.cc' From b7bcf71f0d7dd5ea7bb5d5bb54cac3ecb76ddbb1 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 28 Aug 2007 16:53:01 +0100 Subject: [PATCH 081/218] Build the ns3 library in the build/ root, not in build//src. --- src/wscript | 14 +++----------- wscript | 5 +++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/wscript b/src/wscript index 1e20fb75c..859021e66 100644 --- a/src/wscript +++ b/src/wscript @@ -39,11 +39,9 @@ def configure(conf): conf.sub_config('simulator') blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant())) - conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir, 'src')] - for module in all_modules: - module_path = os.path.join(blddir, 'src', module) - if Params.g_options.enable_rpath: - conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (module_path,)) + conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir)] + if Params.g_options.enable_rpath: + conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (os.path.join(blddir),)) ## Used to link the 'run-tests' program with all of ns-3 code conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules] @@ -64,12 +62,6 @@ def build(bld): bld.add_subdirs(list(all_modules)) - ## Create a single ns3 library containing all modules - lib = bld.create_obj('cpp', 'shlib') - lib.name = 'ns3' - lib.target = 'ns3' - lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES']) - class Ns3Header(Object.genobj): """A set of NS-3 header files""" diff --git a/wscript b/wscript index 48b731729..6c1ca5339 100644 --- a/wscript +++ b/wscript @@ -165,6 +165,11 @@ def build(bld): bld.add_subdirs('src') bld.add_subdirs('samples utils examples') + ## Create a single ns3 library containing all modules + lib = bld.create_obj('cpp', 'shlib') + lib.name = 'ns3' + lib.target = 'ns3' + lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES']) def shutdown(): #import UnitTest From 2e24056a6d42102ec5c2230058f30e77ff95c18b Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 28 Aug 2007 16:54:07 +0100 Subject: [PATCH 082/218] Add some tweaks to enable building under emacs. --- wscript | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wscript b/wscript index 6c1ca5339..c72b75e1e 100644 --- a/wscript +++ b/wscript @@ -145,6 +145,9 @@ def create_ns3_program(bld, name, dependencies=('simulator',)): def build(bld): + print "Entering directory `%s/build'" % Params.g_build.m_curdirnode.abspath() + Params.g_cwd_launch = Params.g_build.m_curdirnode.abspath() + bld.create_ns3_program = types.MethodType(create_ns3_program, bld) variant_name = bld.env_of_name('default')['NS3_ACTIVE_VARIANT'] From c85f578bde0f9daedc17e05063793709d4df7850 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 09:35:53 +0200 Subject: [PATCH 083/218] backout 9856d1175cbb:642d6798feaa:27dd3e15308a --- samples/main-simple.cc | 3 +- src/applications/onoff-application.cc | 3 +- src/devices/csma/csma-net-device.cc | 60 +++++++++++-------- src/devices/csma/csma-net-device.h | 4 +- .../point-to-point-net-device.cc | 27 +++++---- .../point-to-point-net-device.h | 2 +- src/internet-node/arp-l3-protocol.cc | 5 +- src/internet-node/arp-l3-protocol.h | 2 +- src/internet-node/ipv4-end-point.cc | 4 +- src/internet-node/ipv4-end-point.h | 6 +- src/internet-node/ipv4-l3-protocol.cc | 29 +++++---- src/internet-node/ipv4-l3-protocol.h | 12 ++-- src/internet-node/ipv4-static-routing.cc | 2 +- src/internet-node/ipv4-static-routing.h | 2 +- src/internet-node/udp-l4-protocol.cc | 2 +- src/internet-node/udp-l4-protocol.h | 2 +- src/internet-node/udp-socket.cc | 13 ++-- src/internet-node/udp-socket.h | 10 ++-- src/node/drop-tail-queue.cc | 35 +++++++---- src/node/drop-tail-queue.h | 4 +- src/node/ipv4.h | 6 +- src/node/net-device.cc | 4 +- src/node/net-device.h | 8 +-- src/node/node.cc | 2 +- src/node/node.h | 4 +- src/node/packet-socket.cc | 10 ++-- src/node/packet-socket.h | 6 +- src/node/queue.cc | 42 ++++++------- src/node/queue.h | 14 ++--- src/node/socket.h | 4 +- 30 files changed, 179 insertions(+), 148 deletions(-) diff --git a/samples/main-simple.cc b/samples/main-simple.cc index 2039a55c3..7285f4946 100644 --- a/samples/main-simple.cc +++ b/samples/main-simple.cc @@ -14,8 +14,7 @@ static void GenerateTraffic (Ptr socket, uint32_t size) { std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl; - Packet p(size); - socket->Send (p); + socket->Send (Packet (size)); if (size > 0) { Simulator::Schedule (Seconds (0.5), &GenerateTraffic, socket, size - 50); diff --git a/src/applications/onoff-application.cc b/src/applications/onoff-application.cc index 512c454f3..32bcd7564 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff-application.cc @@ -206,8 +206,7 @@ void OnOffApplication::ScheduleStopEvent() void OnOffApplication::SendPacket() { NS_ASSERT (m_sendEvent.IsExpired ()); - Packet p(m_pktSize); - m_socket->Send(p); + m_socket->Send(Packet (m_pktSize)); m_totBytes += m_pktSize; m_lastStartTime = Simulator::Now(); m_residualBits = 0; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 610ec9b6c..531bf7314 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -274,12 +274,13 @@ CsmaNetDevice::DoNeedsArp (void) const bool CsmaNetDevice::SendTo ( - Packet& packet, + const Packet& packet, const Address& dest, uint16_t protocolNumber) { - NS_DEBUG ("CsmaNetDevice::SendTo (" << &packet << ")"); - NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << packet.GetUid () << ")"); + Packet p = packet; + NS_DEBUG ("CsmaNetDevice::SendTo (" << &p << ")"); + NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << p.GetUid () << ")"); NS_ASSERT (IsLinkUp ()); @@ -288,10 +289,10 @@ CsmaNetDevice::SendTo ( return false; Eui48Address destination = Eui48Address::ConvertFrom (dest); - AddHeader(packet, destination, protocolNumber); + AddHeader(p, destination, protocolNumber); // Place the packet to be sent on the send queue - if (m_queue->Enqueue(packet) == false ) + if (m_queue->Enqueue(p) == false ) { return false; } @@ -300,10 +301,11 @@ CsmaNetDevice::SendTo ( // transmission (see TransmitCompleteEvent) if (m_txMachineState == READY) { - if (m_queue->IsEmpty()) return true; // Nothing else to do // Store the next packet to be transmitted - m_currentPkt = m_queue->Dequeue(); - TransmitStart(); + if (m_queue->Dequeue (m_currentPkt)) + { + TransmitStart(); + } } return true; } @@ -387,8 +389,9 @@ CsmaNetDevice::TransmitAbort (void) m_currentPkt.GetUid () << ")"); // Try to transmit a new packet - if (m_queue->IsEmpty()) return; //No packet to transmit - m_currentPkt = m_queue->Dequeue (); + bool found; + found = m_queue->Dequeue (m_currentPkt); + NS_ASSERT_MSG(found, "IsEmpty false but no Packet on queue?"); m_backoff.ResetBackoffTime(); m_txMachineState = READY; TransmitStart (); @@ -435,10 +438,18 @@ CsmaNetDevice::TransmitReadyEvent (void) NS_ASSERT_MSG(m_txMachineState == GAP, "Must be in interframe gap"); m_txMachineState = READY; - if (m_queue->IsEmpty()) return; // No more to transmit, remain ready // Get the next packet from the queue for transmitting - m_currentPkt = m_queue->Dequeue (); - TransmitStart (); + if (m_queue->IsEmpty()) + { + return; + } + else + { + bool found; + found = m_queue->Dequeue (m_currentPkt); + NS_ASSERT_MSG(found, "IsEmpty false but no Packet on queue?"); + TransmitStart (); + } } TraceResolver * @@ -484,31 +495,32 @@ CsmaNetDevice::AddQueue (Ptr q) } void -CsmaNetDevice::Receive (Packet& packet) +CsmaNetDevice::Receive (const Packet& packet) { EthernetHeader header (false); EthernetTrailer trailer; Eui48Address broadcast; Eui48Address destination; + Packet p = packet; - NS_DEBUG ("CsmaNetDevice::Receive UID is (" << packet.GetUid() << ")"); + NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")"); // Only receive if send side of net device is enabled if (!IsReceiveEnabled()) { - m_dropTrace (packet); + m_dropTrace (p); return; } if (m_encapMode == RAW) { ForwardUp (packet, 0, GetBroadcast ()); - //m_dropTrace (packet); + m_dropTrace (p); return; } - packet.RemoveTrailer(trailer); - trailer.CheckFcs(packet); - packet.RemoveHeader(header); + p.RemoveTrailer(trailer); + trailer.CheckFcs(p); + p.RemoveHeader(header); broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); destination = Eui48Address::ConvertFrom (GetAddress ()); @@ -516,11 +528,11 @@ CsmaNetDevice::Receive (Packet& packet) (header.GetDestination() != destination)) { // not for us. - m_dropTrace (packet); + m_dropTrace (p); return; } - m_rxTrace (packet); + m_rxTrace (p); // // protocol must be initialized to avoid a compiler warning in the RAW // case that breaks the optimized build. @@ -535,7 +547,7 @@ CsmaNetDevice::Receive (Packet& packet) break; case LLC: { LlcSnapHeader llc; - packet.RemoveHeader (llc); + p.RemoveHeader (llc); protocol = llc.GetType (); } break; case RAW: @@ -543,7 +555,7 @@ CsmaNetDevice::Receive (Packet& packet) break; } - ForwardUp (packet, protocol, header.GetSource ()); + ForwardUp (p, protocol, header.GetSource ()); return; } diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 0650b111a..62bbceab5 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -195,7 +195,7 @@ enum CsmaEncapsulationMode { * @see CsmaChannel * \param p a reference to the received packet */ - void Receive (Packet& p); + void Receive (const Packet& p); bool IsSendEnabled (void); bool IsReceiveEnabled (void); @@ -270,7 +270,7 @@ private: * \param protocolNumber -- this parameter is not used here * \return true if success, false on failure */ - virtual bool SendTo (Packet& p, const Address& dest, uint16_t protocolNumber); + virtual bool SendTo (const Packet& p, const Address& dest, uint16_t protocolNumber); /** * Start Sending a Packet Down the Wire. diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 2cb026062..a071f9246 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -117,17 +117,18 @@ void PointToPointNetDevice::SetInterframeGap(const Time& t) m_tInterframeGap = t; } -bool PointToPointNetDevice::SendTo (Packet& packet, const Address& dest, +bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, uint16_t protocolNumber) { - NS_DEBUG ("PointToPointNetDevice::SendTo (" << &packet << ", " << &dest << ")"); - NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << packet.GetUid () << ")"); + Packet p = packet; + NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")"); + NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << p.GetUid () << ")"); // GFR Comment. Why is this an assertion? Can't a link legitimately // "go down" during the simulation? Shouldn't we just wait for it // to come back up? NS_ASSERT (IsLinkUp ()); - AddHeader(packet, protocolNumber); + AddHeader(p, protocolNumber); // // This class simulates a point to point device. In the case of a serial @@ -138,16 +139,16 @@ bool PointToPointNetDevice::SendTo (Packet& packet, const Address& dest, // trnsmission; otherwise we send it now. if (m_txMachineState == READY) { - return TransmitStart (packet); + return TransmitStart (p); } else { - return m_queue->Enqueue(packet); + return m_queue->Enqueue(p); } } bool -PointToPointNetDevice::TransmitStart (Packet& p) +PointToPointNetDevice::TransmitStart (Packet &p) { NS_DEBUG ("PointToPointNetDevice::TransmitStart (" << &p << ")"); NS_DEBUG ( @@ -183,8 +184,8 @@ void PointToPointNetDevice::TransmitComplete (void) // NS_ASSERT_MSG(m_txMachineState == BUSY, "Must be BUSY if transmitting"); m_txMachineState = READY; - if (m_queue->IsEmpty()) return; // Nothing to do at this point - Packet p = m_queue->Dequeue(); + Packet p; + if (!m_queue->Dequeue(p)) return; // Nothing to do at this point TransmitStart(p); } @@ -235,9 +236,11 @@ void PointToPointNetDevice::Receive (Packet& p) { NS_DEBUG ("PointToPointNetDevice::Receive (" << &p << ")"); uint16_t protocol = 0; - m_rxTrace (p); - ProcessHeader(p, protocol); - ForwardUp (p, protocol, GetBroadcast ()); + Packet packet = p; + + m_rxTrace (packet); + ProcessHeader(packet, protocol); + ForwardUp (packet, protocol, GetBroadcast ()); } Ptr PointToPointNetDevice::GetQueue(void) const diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index a2c86e93a..fa3d3b838 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -211,7 +211,7 @@ private: * @param protocolNumber Protocol Number used to find protocol touse * @returns true if success, false on failure */ - virtual bool SendTo (Packet& p, const Address& dest, + virtual bool SendTo (const Packet& p, const Address& dest, uint16_t protocolNumber); /** * Start Sending a Packet Down the Wire. diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 041c50e14..100f1df88 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -84,11 +84,12 @@ ArpL3Protocol::FindCache (Ptr device) } void -ArpL3Protocol::Receive(Ptr device, Packet& p, uint16_t protocol, const Address &from) +ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from) { ArpCache *cache = FindCache (device); ArpHeader arp; - p.RemoveHeader (arp); + Packet packet = p; + packet.RemoveHeader (arp); NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << " node="<GetId ()<<", got request from " << diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index 82d8dd29e..a2ea8227e 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -53,7 +53,7 @@ public: /** * \brief Recieve a packet */ - void Receive(Ptr device, Packet& p, uint16_t protocol, const Address &from); + void Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from); /** * \brief Perform an ARP lookup * \param p diff --git a/src/internet-node/ipv4-end-point.cc b/src/internet-node/ipv4-end-point.cc index cdd78c303..69faf523e 100644 --- a/src/internet-node/ipv4-end-point.cc +++ b/src/internet-node/ipv4-end-point.cc @@ -65,7 +65,7 @@ Ipv4EndPoint::SetPeer (Ipv4Address address, uint16_t port) } void -Ipv4EndPoint::SetRxCallback (Callback callback) +Ipv4EndPoint::SetRxCallback (Callback callback) { m_rxCallback = callback; } @@ -77,7 +77,7 @@ Ipv4EndPoint::SetDestroyCallback (Callback callback) } void -Ipv4EndPoint::ForwardUp (Packet &p, Ipv4Address saddr, uint16_t sport) +Ipv4EndPoint::ForwardUp (const Packet &p, Ipv4Address saddr, uint16_t sport) { if (!m_rxCallback.IsNull ()) { diff --git a/src/internet-node/ipv4-end-point.h b/src/internet-node/ipv4-end-point.h index 06192d500..f606aa63b 100644 --- a/src/internet-node/ipv4-end-point.h +++ b/src/internet-node/ipv4-end-point.h @@ -43,17 +43,17 @@ public: void SetPeer (Ipv4Address address, uint16_t port); - void SetRxCallback (Callback callback); + void SetRxCallback (Callback callback); void SetDestroyCallback (Callback callback); - void ForwardUp (Packet &p, Ipv4Address saddr, uint16_t sport); + void ForwardUp (const Packet &p, Ipv4Address saddr, uint16_t sport); private: Ipv4Address m_localAddr; uint16_t m_localPort; Ipv4Address m_peerAddr; uint16_t m_peerPort; - Callback m_rxCallback; + Callback m_rxCallback; Callback m_destroyCallback; }; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index b44a0a013..be483dfa0 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -221,7 +221,7 @@ Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, void Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, - Packet& packet, + Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); @@ -310,7 +310,7 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) } void -Ipv4L3Protocol::Receive( Ptr device, Packet& p, uint16_t protocol, const Address &from) +Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) { uint32_t index = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -322,25 +322,26 @@ Ipv4L3Protocol::Receive( Ptr device, Packet& p, uint16_t protocol, co } index++; } + Packet packet = p; Ipv4Header ipHeader; - p.RemoveHeader (ipHeader); + packet.RemoveHeader (ipHeader); if (!ipHeader.IsChecksumOk ()) { return; } - if (Forwarding (p, ipHeader, device)) + if (Forwarding (packet, ipHeader, device)) { return; } - ForwardUp (p, ipHeader); + ForwardUp (packet, ipHeader); } void -Ipv4L3Protocol::Send (Packet& packet, +Ipv4L3Protocol::Send (Packet const &packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol) @@ -364,10 +365,12 @@ Ipv4L3Protocol::Send (Packet& packet, ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++) { Ipv4Interface *outInterface = *ifaceIter; - NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); - packet.AddHeader (ipHeader); - m_txTrace (packet, ifaceIndex); - outInterface->Send (packet, destination); + Packet packetCopy = packet; + + NS_ASSERT (packetCopy.GetSize () <= outInterface->GetMtu ()); + packetCopy.AddHeader (ipHeader); + m_txTrace (packetCopy, ifaceIndex); + outInterface->Send (packetCopy, destination); } } else @@ -388,7 +391,7 @@ Ipv4L3Protocol::Send (Packet& packet, void Ipv4L3Protocol::SendRealOut (bool found, Ipv4Route const &route, - Packet& packet, + Packet packet, Ipv4Header const &ipHeader) { if (!found) @@ -413,7 +416,7 @@ Ipv4L3Protocol::SendRealOut (bool found, bool -Ipv4L3Protocol::Forwarding (Packet& packet, Ipv4Header &ipHeader, Ptr device) +Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) { for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) @@ -468,7 +471,7 @@ Ipv4L3Protocol::Forwarding (Packet& packet, Ipv4Header &ipHeader, Ptr void -Ipv4L3Protocol::ForwardUp (Packet& p, Ipv4Header const&ip) +Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) { Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 8254f27e6..2cce3efa3 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -118,7 +118,7 @@ public: * - implement a per-NetDevice ARP cache * - send back arp replies on the right device */ - void Receive( Ptr device, Packet& p, uint16_t protocol, const Address &from); + void Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from); /** * \param packet packet to send @@ -129,7 +129,7 @@ public: * Higher-level layers call this method to send a packet * down the stack to the MAC and PHY layers. */ - void Send (Packet& packet, Ipv4Address source, + void Send (Packet const &packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol); @@ -151,7 +151,7 @@ public: uint32_t interface); void Lookup (Ipv4Header const &ipHeader, - Packet& packet, + Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply); uint32_t GetNRoutes (void); @@ -183,10 +183,10 @@ private: void SendRealOut (bool found, Ipv4Route const &route, - Packet& packet, + Packet packet, Ipv4Header const &ipHeader); - bool Forwarding (Packet& packet, Ipv4Header &ipHeader, Ptr device); - void ForwardUp (Packet& p, Ipv4Header const&ip); + bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); + void ForwardUp (Packet p, Ipv4Header const&ip); uint32_t AddIpv4Interface (Ipv4Interface *interface); void SetupLoopback (void); TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 37e8a74df..b70c1c1af 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -210,7 +210,7 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index) bool Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, - Packet& packet, + Packet packet, RouteReplyCallback routeReply) { Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 439af8cf7..8462f55a7 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -52,7 +52,7 @@ public: Ipv4StaticRouting () : m_defaultRoute (0) {} virtual bool RequestRoute (Ipv4Header const &ipHeader, - Packet& packet, + Packet packet, RouteReplyCallback routeReply); diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index 9dacbf961..f0ef8569b 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -122,7 +122,7 @@ UdpL4Protocol::Receive(Packet& packet, } void -UdpL4Protocol::Send (Packet& packet, +UdpL4Protocol::Send (Packet packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) { diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 70e2b0ccc..4d7a082d4 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -74,7 +74,7 @@ public: * \param sport The source port number * \param dport The destination port number */ - void Send (Packet& packet, + void Send (Packet packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport); /** diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 45b8b82b6..a2bde3224 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -155,7 +155,7 @@ UdpSocket::Connect(const Address & address) return 0; } int -UdpSocket::Send (Packet &p) +UdpSocket::Send (const Packet &p) { if (!m_connected) { @@ -165,7 +165,7 @@ UdpSocket::Send (Packet &p) return DoSendTo (p, m_defaultAddress, m_defaultPort); } int -UdpSocket::DoSendTo (Packet &p, const Address &address) +UdpSocket::DoSendTo (const Packet &p, const Address &address) { InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); @@ -173,7 +173,7 @@ UdpSocket::DoSendTo (Packet &p, const Address &address) return DoSendTo (p, ipv4, port); } int -UdpSocket::DoSendTo (Packet& p, Ipv4Address ipv4, uint16_t port) +UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) { if (m_endPoint == 0) { @@ -195,7 +195,7 @@ UdpSocket::DoSendTo (Packet& p, Ipv4Address ipv4, uint16_t port) return 0; } int -UdpSocket::SendTo(const Address &address, Packet &p) +UdpSocket::SendTo(const Address &address, const Packet &p) { if (m_connected) { @@ -209,7 +209,7 @@ UdpSocket::SendTo(const Address &address, Packet &p) } void -UdpSocket::ForwardUp (Packet &packet, Ipv4Address ipv4, uint16_t port) +UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) { if (m_shutdownRecv) { @@ -217,7 +217,8 @@ UdpSocket::ForwardUp (Packet &packet, Ipv4Address ipv4, uint16_t port) } Address address = InetSocketAddress (ipv4, port); - NotifyDataReceived (packet, address); + Packet p = packet; + NotifyDataReceived (p, address); } }//namespace ns3 diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index 9ceec713f..b3674f7ef 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -51,8 +51,8 @@ public: virtual int ShutdownSend (void); virtual int ShutdownRecv (void); virtual int Connect(const Address &address); - virtual int Send (Packet &p); - virtual int SendTo(const Address &address,Packet &p); + virtual int Send (const Packet &p); + virtual int SendTo(const Address &address,const Packet &p); private: @@ -60,10 +60,10 @@ private: friend class Udp; // invoked by Udp class int FinishBind (void); - void ForwardUp (Packet &p, Ipv4Address ipv4, uint16_t port); + void ForwardUp (const Packet &p, Ipv4Address ipv4, uint16_t port); void Destroy (void); - int DoSendTo (Packet &p, const Address &daddr); - int DoSendTo (Packet &p, Ipv4Address daddr, uint16_t dport); + int DoSendTo (const Packet &p, const Address &daddr); + int DoSendTo (const Packet &p, Ipv4Address daddr, uint16_t dport); Ipv4EndPoint *m_endPoint; Ptr m_node; diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 5b802acec..74c8fde17 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -73,26 +73,39 @@ DropTailQueue::DoEnqueue (const Packet& p) return true; } -Packet -DropTailQueue::DoDequeue () +bool +DropTailQueue::DoDequeue (Packet& p) { - NS_DEBUG("DropTailQueue::DoDequeue ( )"); - NS_ASSERT(!IsEmpty()); - Packet p = m_packets.front (); + NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")"); + + if (m_packets.empty()) + { + NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty"); + return false; + } + + p = m_packets.front (); m_packets.pop (); NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true"); - return p; + return true; } -Packet -DropTailQueue::DoPeek () +bool +DropTailQueue::DoPeek (Packet& p) { - NS_DEBUG("DropTailQueue::DoPeek ( )"); - NS_ASSERT(!IsEmpty()); + NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")"); - return m_packets.front (); + if (m_packets.empty()) + { + NS_DEBUG("DropTailQueue::DoPeek (): Queue empty"); + return false; + } + + p = m_packets.front (); + + return true; } }; // namespace ns3 diff --git a/src/node/drop-tail-queue.h b/src/node/drop-tail-queue.h index 6febe0eab..2e4c76461 100644 --- a/src/node/drop-tail-queue.h +++ b/src/node/drop-tail-queue.h @@ -58,8 +58,8 @@ public: private: virtual bool DoEnqueue (const Packet& p); - virtual Packet DoDequeue (); - virtual Packet DoPeek (); + virtual bool DoDequeue (Packet &p); + virtual bool DoPeek (Packet &p); private: std::queue m_packets; diff --git a/src/node/ipv4.h b/src/node/ipv4.h index b4d22c520..76d88faea 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -46,7 +46,7 @@ class Ipv4Header; // FIXME: ipv4-header.h needs to move from module class Ipv4RoutingProtocol : public Object { public: - // void (*RouteReply) (bool found, Ipv4Route route, Packet& packet, Ipv4Header const &ipHeader); + // void (*RouteReply) (bool found, Ipv4Route route, Packet packet, Ipv4Header const &ipHeader); /** @@ -65,7 +65,7 @@ public: * inserted and consequently the protocol type has to change). * */ - typedef Callback RouteReplyCallback; + typedef Callback RouteReplyCallback; /** * \brief Asynchronously requests a route for a given packet and IP header @@ -100,7 +100,7 @@ public: * insert any extra header. */ virtual bool RequestRoute (const Ipv4Header &ipHeader, - Packet& packet, + Packet packet, RouteReplyCallback routeReply) = 0; }; diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 11566a028..e3b9537aa 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -171,7 +171,7 @@ NetDevice::DisablePointToPoint (void) // Receive packet from above bool -NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber) +NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) { if (m_isUp) { @@ -197,7 +197,7 @@ NetDevice::GetChannel (void) const // Receive packets from below bool -NetDevice::ForwardUp(Packet& p, uint16_t param, const Address &from) +NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) { bool retval = false; diff --git a/src/node/net-device.h b/src/node/net-device.h index 061df3441..cc93e6420 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -158,7 +158,7 @@ public: * * \return whether the Send operation succeeded */ - bool Send(Packet& p, const Address& dest, uint16_t protocolNumber); + bool Send(const Packet& p, const Address& dest, uint16_t protocolNumber); /** * \returns the node base class which contains this network * interface. @@ -187,7 +187,7 @@ public: * \returns true if the callback could handle the packet successfully, false * otherwise. */ - typedef Callback,Packet &,uint16_t,const Address &> ReceiveCallback; + typedef Callback,const Packet &,uint16_t,const Address &> ReceiveCallback; /** * \param cb callback to invoke whenever a packet has been received and must @@ -251,7 +251,7 @@ public: * forwards it to the higher layers by calling this method * which is responsible for passing it up to the Rx callback. */ - bool ForwardUp (Packet& p, uint16_t param, const Address &address); + bool ForwardUp (const Packet& p, uint16_t param, const Address &address); /** @@ -274,7 +274,7 @@ public: * method. When the link is Up, this method is invoked to ask * subclasses to forward packets. Subclasses MUST override this method. */ - virtual bool SendTo (Packet& p, const Address &dest, uint16_t protocolNumber) = 0; + virtual bool SendTo (const Packet& p, const Address &dest, uint16_t protocolNumber) = 0; /** * \returns true if this NetDevice needs the higher-layers * to perform ARP over it, false otherwise. diff --git a/src/node/node.cc b/src/node/node.cc index 5fdd50bb8..ee83e8588 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -213,7 +213,7 @@ Node::UnregisterProtocolHandler (ProtocolHandler handler) } bool -Node::ReceiveFromDevice (Ptr device, Packet &packet, +Node::ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from) { bool found = false; diff --git a/src/node/node.h b/src/node/node.h index 1538350be..f4d898f53 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -158,7 +158,7 @@ public: /** * A protocol handler */ - typedef Callback, Packet &,uint16_t,const Address &> ProtocolHandler; + typedef Callback, const Packet &,uint16_t,const Address &> ProtocolHandler; /** * \param handler the handler to register * \param protocolType the type of protocol this handler is @@ -210,7 +210,7 @@ private: */ virtual void NotifyDeviceAdded (Ptr device); - bool ReceiveFromDevice (Ptr device, Packet &packet, + bool ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); void Construct (void); TraceResolver *CreateDevicesTraceResolver (const TraceContext &context); diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index 7e0095d79..f642eee9e 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -186,7 +186,7 @@ PacketSocket::Connect(const Address &ad) } int -PacketSocket::Send (Packet &p) +PacketSocket::Send (const Packet &p) { if (m_state == STATE_OPEN || m_state == STATE_BOUND) @@ -198,7 +198,7 @@ PacketSocket::Send (Packet &p) } int -PacketSocket::SendTo(const Address &address, Packet &p) +PacketSocket::SendTo(const Address &address, const Packet &p) { PacketSocketAddress ad; if (m_state == STATE_CLOSED) @@ -262,7 +262,7 @@ PacketSocket::SendTo(const Address &address, Packet &p) } void -PacketSocket::ForwardUp (Ptr device, Packet &packet, +PacketSocket::ForwardUp (Ptr device, const Packet &packet, uint16_t protocol, const Address &from) { if (m_shutdownRecv) @@ -270,7 +270,7 @@ PacketSocket::ForwardUp (Ptr device, Packet &packet, return; } - //Packet p = packet; ? + Packet p = packet; PacketSocketAddress address; address.SetPhysicalAddress (from); @@ -279,7 +279,7 @@ PacketSocket::ForwardUp (Ptr device, Packet &packet, NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid() << " PacketSocket " << this); - NotifyDataReceived (packet, address); + NotifyDataReceived (p, address); } }//namespace ns3 diff --git a/src/node/packet-socket.h b/src/node/packet-socket.h index be4ade908..8dc1b9e62 100644 --- a/src/node/packet-socket.h +++ b/src/node/packet-socket.h @@ -82,15 +82,15 @@ public: virtual int ShutdownSend (void); virtual int ShutdownRecv (void); virtual int Connect(const Address &address); - virtual int Send (Packet &p); - virtual int SendTo(const Address &address,Packet &p); + virtual int Send (const Packet &p); + virtual int SendTo(const Address &address,const Packet &p); private: private: void Init (void); - void ForwardUp (Ptr device, Packet &packet, + void ForwardUp (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); int DoBind (const PacketSocketAddress &address); virtual void DoDispose (void); diff --git a/src/node/queue.cc b/src/node/queue.cc index ad79109c0..72eafed69 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -49,7 +49,7 @@ QueueTraceType::IsEnqueue (void) const { return m_type == ENQUEUE; } -bool +bool QueueTraceType::IsDequeue (void) const { return m_type == DEQUEUE; @@ -122,25 +122,28 @@ Queue::Enqueue (const Packet& p) return retval; } -Packet -Queue::Dequeue () +bool +Queue::Dequeue (Packet &p) { - NS_ASSERT(!IsEmpty()); - NS_DEBUG("Queue::Dequeue ( )"); + NS_DEBUG("Queue::Dequeue (" << &p << ")"); - Packet p = DoDequeue (); + bool retval = DoDequeue (p); - m_nBytes -= p.GetSize (); - m_nPackets--; - - NS_ASSERT (m_nBytes >= 0); - NS_ASSERT (m_nPackets >= 0); - - NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); + if (retval) + { + m_nBytes -= p.GetSize (); + m_nPackets--; - m_traceDequeue (p); + NS_ASSERT (m_nBytes >= 0); + NS_ASSERT (m_nPackets >= 0); - return p; + NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); + + const Packet packet = p; + m_traceDequeue (packet); + } + + return retval; } void @@ -151,13 +154,12 @@ Queue::DequeueAll (void) NS_ASSERT (!"Don't know what to do with dequeued packets!"); } -Packet -Queue::Peek () +bool +Queue::Peek (Packet &p) { - NS_ASSERT(!IsEmpty()); - NS_DEBUG("Queue::Peek ( )"); + NS_DEBUG("Queue::Peek (" << &p << ")"); - return DoPeek (); + return DoPeek (p); } diff --git a/src/node/queue.h b/src/node/queue.h index 915642f09..d135fff68 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -83,16 +83,14 @@ public: bool Enqueue (const Packet& p); /** * Remove a packet from the front of the Queue - * Must not be called on an empty queue. - * \return The packet removed from the queue + * \return True if the operation was successful; false otherwise */ - Packet Dequeue (); + bool Dequeue (Packet &p); /** * Get a copy of the item at the front of the queue without removing it - * Must NOT be called on an empty queue - * \return The packet at the head of the queue. + * \return True if the operation was successful; false otherwise */ - Packet Peek (); + bool Peek (Packet &p); /** * XXX Doesn't do anything right now, think its supposed to flush the queue @@ -165,8 +163,8 @@ public: private: virtual bool DoEnqueue (const Packet& p) = 0; - virtual Packet DoDequeue () = 0; - virtual Packet DoPeek () = 0; + virtual bool DoDequeue (Packet &p) = 0; + virtual bool DoPeek (Packet &p) = 0; protected: // called by subclasses to notify parent of packet drops. diff --git a/src/node/socket.h b/src/node/socket.h index 1a28bd71d..c717ec0a5 100644 --- a/src/node/socket.h +++ b/src/node/socket.h @@ -173,7 +173,7 @@ public: * \returns -1 in case of error or the number of bytes copied in the * internal buffer and accepted for transmission. */ - virtual int Send (Packet &p) = 0; + virtual int Send (const Packet &p) = 0; /** * \brief Send data to a specified peer. @@ -182,7 +182,7 @@ public: * \returns -1 in case of error or the number of bytes copied in the * internal buffer and accepted for transmission. */ - virtual int SendTo(const Address &address,Packet &p) = 0; + virtual int SendTo(const Address &address,const Packet &p) = 0; protected: void NotifyCloseCompleted (void); From ecf5d12882a1369c77fff7ed88da106b267990b5 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 29 Aug 2007 12:31:17 +0100 Subject: [PATCH 084/218] New WAF, avoids the bright yellow color (hard to read on light background terminals) problem. --- waf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/waf b/waf index d4f80d72a..94a2a37a2 100755 --- a/waf +++ b/waf @@ -11,7 +11,7 @@ if 'PSYCOWAF' in os.environ: pass VERSION="1.1.1" -REVISION="1272724989" +REVISION="1420549696" INSTALL=sys.platform=='win32' and 'c:/temp' or '/usr/local' cwd = os.getcwd() @@ -334,5 +334,5 @@ except KeyboardInterrupt: Params.fatal('build interrupted') #prof.runcall(Scripting.Main) #prof.close() # ===>BEGIN WOOF<=== -#6<\%_0gSqh;d"&i4hUq"'EA+4s8;Tjs8W-!s8W-!s8W+l!!!?/+s8Ri#QQOmTF;*7jW*^\\1'ZCz!!!!q-n#&q!!"DJF2"&p-aW8SQY$K"!EWV\h!&gY=W_6RV_sr\722cZ@k5kdqqg'$4*["='$#2".3/jH9s\UR>BX?ohY0*=H[;!kmGlsVII%EnT7)!(/U>#5gO6P<#sP`m!Um]ST#;0S]:$Hk8J3V550%G+n!@)?&(e/H?7rG4)HopHecsJV&*NLld/Hf'i_/tW]OXF=:('"e7,sVH,!!!'c"B6'9h=&$=^$;/b<7!LN[75n*Zqu06hetOCfNT/9Dgh)`hX=R2Efmj*fjoK.pmJmh!ZlhGA_fKbKkV"UYb%$WeaM<&g4,qXHU?d8^JOF*%JYrh=IR.4^RKF+eA55]5<0hXk9hhme9(rh6nrgMn6Nkn!3?hPcO46ZarrBDYD60?/F#=^#"+FY%MhCpYKIuY'4`L\G(EBC%lKlo_[gcA*S!'f@;scf6;#ph"9uKijR_*D0sg5$f:Wk<&O(2&%?WII<;NeC$o1g)ql6Ep?UE"Nr&N6G4/jfDnaO=GIt<\efO_Thd*tkIJ(4`BhH+Q#Q^mriANd<)9A\4n"42=kb]#^DkT=Q+gDA3H_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3qRsaYhp[DCnh=T\DBPV*mdp:ESP3s"oeLXT*[F=5)E.Wf3gq9(u=P[m^fD_.>k%jf93>Xc,5uc9-2I(78hkZrU4LV,f)TOXi:_1LtR,gHql/7@#(WHd?l4T)J2+5i#Q<`g@R#ir)f7#,1Ogiea8f^4"F(R,3Ligi*Hg]&jeV1MCmM$rYQo%87\H9$a:ZHS+D>VEU;TaD'j$:'K3JH;bdRL2H:PTL:u%n%fA8PC99R+L]T4(8i*,GTCDgI@(SM2b/5<)D,NbN__CK!ED6H1PJDmK@;_ql4X8,oNV8Y+XBJZB=RX*ALL6?>G7fD=L$oUB5$E>TMW?g4]Yu:".Q9G_[X3dA.^&74OF2bMCu@j#(kDoJ?7'nnZVeH+UYADjMf&2#B]!bq0:ip2F]o[!t2jB&#Cde=M@6WYYu6KLOBJdR-Q5GV_'Q#l.n19YNBqa0r@o[rt^O3V]4MT!JI[!JSp"S*T4Olm,1Ok[QIZP6YrAqLWX$4mCg`p-.r,"[a^o)IEn)CW7l*T6#GR-[EB'@Id'+c)g?!i_uU5P\-j2uC3'7EK[K*bpJU*"3?^5]X(HhL\i=*/UWFYVmTX#hCGfO4M_Pm!`^T1LWZh-+Vh19+oiho\'1,jb!\@]h7IO.*dTOHfRDjnEJQp?9,a%cBm)]F'I[(<=;OeF'K!G8d-I\1JAs.7.!T[V[8N7oR5hZTB'c;2:J8HQ2.D,qKI#]ruH(/BJO=ER5Ca1O1$5gG_\^-F='!O)lt1On$cd=^@uO(s(6b1ruo2*k^WA?pU0`:5O2a:dm*Y!*-8FK3H^j%`R?an4S)fq)9b5iMdbHWAVe=oH+i)*MT-6^*ce-&QpmNJ, # ===>END WOOF<=== From 857413f1c303b5f43a08e6eaf5c26221409970c8 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 14:30:44 +0200 Subject: [PATCH 085/218] make the output of the list of existing traces more readable --- src/core/trace-resolver.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 698a23b7d..2feedd2b6 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -104,13 +104,19 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const i->context.PrintAvailable (os, ","); os << "]" << std::endl; os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; - os << "const TraceContext &: the trace context associated to the connected trace source." << std::endl; - uint32_t k = 0; + os << "argument 0 -- the trace context associated to the connected trace source." << std::endl; + uint32_t k = 2; for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) { - os << "argument " << k << " -- " << j->first << ": " << j->second << "." << std::endl; + os << "argument " << k << " -- " << j->second << "." << std::endl; k++; } + os << "void TraceSinkCallback (const TraceContext &"; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first; + } + os << ")" << std::endl; os << std::endl; } } From 4bbb3f8693ca645ba6c39234e0090f9c79987c48 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 14:30:58 +0200 Subject: [PATCH 086/218] s/lowleveltracing/tracing/ --- doc/main.txt | 4 ++-- src/core/array-trace-resolver.h | 2 +- src/core/callback-trace-source.h | 2 +- src/core/sv-trace-source.h | 2 +- src/core/trace-context.h | 2 +- src/core/uv-trace-source.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/main.txt b/doc/main.txt index 3fc144687..37e1ed92d 100644 --- a/doc/main.txt +++ b/doc/main.txt @@ -23,6 +23,7 @@ * - \ref config * - a base class for objects which need to support reference counting * and QueryInterface: ns3::Object and ns3::InterfaceId + * - a set of low-level trace facilities integrated in the ns3::Object system: \ref tracing * - a ns3::ComponentManager which can be used to manage the creation * of any object which derives from ns3::Object through an ns3::ClassId * - a smart-pointer class ns3::Ptr designed to work together with ns3::Object @@ -33,11 +34,10 @@ * ns3::Scheduler and ns3::SchedulerFactory * - a simulator class used to create, schedule and cancel events: ns3::Simulator * - * The "common" module contains: + * The "core" module contains: * - a packet class to create and manipulate simulation packets: ns3::Packet, ns3::Header, * and ns3::Trailer. This packet class also supports per-packet ns3::Tag which are * globs of data which can be attached to any packet. - * - a set of low-level trace facilities: \ref lowleveltracing * * The "node" module contains: * - a ns3::Node base class which should be subclassed by any new type of diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index c3f8181a6..0d1086447 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -31,7 +31,7 @@ namespace ns3 { /** * \brief a helper class to offer trace resolution for an array of objects. - * \ingroup lowleveltracing + * \ingroup tracing * * \class ArrayTraceResolver * diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index 4b5f61b93..d571b5739 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -32,7 +32,7 @@ namespace ns3 { /** * \brief log arbitrary number of parameters to a matching ns3::Callback - * \ingroup lowleveltracing + * \ingroup tracing * * Whenever operator () is invoked on this class, the call and its arguments * are forwarded to the internal matching ns3::Callback. diff --git a/src/core/sv-trace-source.h b/src/core/sv-trace-source.h index 7c2bd8818..23d28f988 100644 --- a/src/core/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -63,7 +63,7 @@ class UVTraceSource; /** * \brief trace variables of type "signed integer" - * \ingroup lowleveltracing + * \ingroup tracing * * This template class implements a POD type: it * behaves like any other variable of type "signed integer" diff --git a/src/core/trace-context.h b/src/core/trace-context.h index 13c9f15a7..4ca77d44f 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -30,7 +30,7 @@ namespace ns3 { /** * \brief Provide context to trace sources - * \ingroup lowleveltracing + * \ingroup tracing * * Instances of this class are used to hold context * for each trace source. Each instance holds a list of diff --git a/src/core/uv-trace-source.h b/src/core/uv-trace-source.h index 55602e614..ff248bbf4 100644 --- a/src/core/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -67,7 +67,7 @@ class SVTraceSource; /** * \brief trace variables of type "unsigned integer" - * \ingroup lowleveltracing + * \ingroup tracing * * This template class implements a POD type: it * behaves like any other variable of type "unsigned integer" From 8c451d5d21ec5a903c33f2e91ac2fb66207f007d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 14:41:21 +0200 Subject: [PATCH 087/218] improve output of list of existing traces --- src/core/trace-resolver.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index 2feedd2b6..f2bd31ea3 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -104,19 +104,19 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const i->context.PrintAvailable (os, ","); os << "]" << std::endl; os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; - os << "argument 0 -- the trace context associated to the connected trace source." << std::endl; - uint32_t k = 2; - for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) - { - os << "argument " << k << " -- " << j->second << "." << std::endl; - k++; - } os << "void TraceSinkCallback (const TraceContext &"; for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) { os << ", " << k->first; } os << ")" << std::endl; + os << "argument 1 -- the trace context associated to the connected trace source." << std::endl; + uint32_t k = 2; + for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) + { + os << "argument " << k << " -- " << j->second << "." << std::endl; + k++; + } os << std::endl; } } From 7860c93c4bfe46d2097cada3b0ba3904d4a847f8 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 14:43:31 +0200 Subject: [PATCH 088/218] add some tracing documentation --- src/core/tracing.h | 297 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 src/core/tracing.h diff --git a/src/core/tracing.h b/src/core/tracing.h new file mode 100644 index 000000000..44e4577c6 --- /dev/null +++ b/src/core/tracing.h @@ -0,0 +1,297 @@ +/** + * \defgroup tracing Tracing + * + * The flexibility of the ns-3 tracing system comes at the cost of quite + * a bit of complexity so, before trying to use the low-level aspects + * of the tracing API, it is important to focus on some basic definitions: + * + * - A trace source is an object instance which can report trace events + * to a set of listening trace sinks. + * + * - A trace sink is a user-provided callback (a function) which can + * be connected to a set of trace sources to receive the events generated + * by each trace source. + * + * - Trace context: each trace source instance is associated with a single + * trace context which can be used by each connected trace sink to + * identify the instance of the source of the event. + * + * - A trace resolver is an object which allows users to establish + * connections between a set of trace sources and a set of trace sinks. + * The trace contexts are configured during connection by the trace + * resolvers. + * + * So, what does it look like in practice ? First, let's look at trace + * sources. We have two types of trace sources: numeric, and, normal + * trace sources. Numeric trace sources behave as normal c++ integers + * or c++ floating point numbers except that they report as trace events + * each change of their value. For example: + * \code + * class MyModel + * { + * public: + * void DoSomething (void) + * { + * // use the "int" trace source just + * // like any other "int" variable. + * m_cwnd *= 2; + * m_cwnd += 4; + * if (m_cwnd > 100) + * { + * // do something. + * } + * } + * private: + * // declare an instance of a "int" trace source + * SVTraceSource m_cwnd; + * }; + * \endcode + * Normal trace sources, on the other hand, allow you to trace the + * call of arbitrary functions and methods, as shown below. They are + * typically used to track "rx", "tx", or "drop" events but could + * also be used to track route change events, or position change + * events: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet, double value) + * { + * m_doSomething (packet, value); + * // do something + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * Every type of trace source derives from the ns3::TraceSource base class. + * As of today, the set of concrete subclasses is relatively short: + * ns3::CallbackTraceSource, ns3::SvTraceSource, ns3::UvTraceSource, and, + * ns3::FvTraceSource. + * + * To receive these trace events, a user should specify a set of trace sinks. + * For example, to receive the "int" and the "something events outlined + * above, a user would declare the following functions which receive + * as an extra first argument the context of the trace source which + * generated the specific event. + * \code + * // oldValue and newValue contain the previous and new values of + * // the connected SVTraceSource trace source. + * void + * CwndTraceSink (const TraceContext &context, int64_t oldValue, int64_t newValue) + * { + * // for example, print the new value: + * std::cout << "cwnd=" << newValue << std::endl; + * } + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet, double value) + * { + * // for example, print the arguments + * std::cout << "value=" << value << ", packet " << packet << std::endl; + * } + * \endcode + * + * The hard part of this tracing framework is the "connection" step: there is a point + * in the simulation scenario where the user is expected to specify which trace sources + * should be connected to which trace sinks. There are many ways to do this: the + * users who want to could implement the "quick and dirty" way, that is, they could + * write adhoc code to connect their trace sinks to the trace sources using the + * TraceSource::AddCallback method. For example, they could patch their models to + * the following: + * \code + * class MyModel + * { + * public: + * void DoSomething (void) + * { + * // ... + * } + * SVTraceSource *GetCwndTraceSource (void) const + * { + * return &m_cwnd; + * } + * private: + * // declare an instance of a "int" trace source + * SVTraceSource m_cwnd; + * }; + * \endcode + * And, then, call directly the GetCwndTraceSource method: + * \code + * CwndTraceSink (const TraceContext &context, int64_t oldValue, int64_t newValue) + * { + * // for example, print the new value: + * std::cout << "cwnd=" << newValue << std::endl; + * } + * // create a model instance + * MyModel *model = ...; + * SVTraceSource *cwnd = model->GetCwndTraceSource (); + * // connect the trace sink to the cwnd trace source of + * // this model instance. + * cwnd->AddCallback (MakeCallback (&CwndTraceSink), + * TraceContext ()); + * \endcode + * + * The solution described above is simple to implement for a model + * author but it is hard to extend and becomes quickly cumbersome + * to use with complex models made of composite objects. TraceResolvers + * deal with these problems and offer a simple API to connect large + * sets of trace sources to a single sink (as is typical for simulations + * where users want to receive the "ipv4 rx" events from all nodes). + * + * The user-visible API to connect and disconnect trace sources to + * and from trace sinks is quite small: ns3::Object::Connect + * and ns3::Object::Disconnect both take a "namespace" regexp string + * and a callback. The input callback is connected to each trace source + * which matches the namespace regexp string. The format of the namespace + * string depends on the set of models implemented by the simulator. + * The following diagram shows a small part of the namespace exported + * by the current version of the simulator: + * + * \image html namespace-2.png ns-3 namespace + * + * In this namespace, the "rx" trace source of the PointToPointNetdevice + * index 0 within node index 3 is uniquely identified by the namespace + * string "/nodes/3/devices/0/rx". It is also possible to match all + * such "rx" trace sources with a single namespace string using + * a limited form of regular expressions: "/nodes/3/devices/* /rx" + * identifies the "rx" trace source within all NetDevices within node + * index 3. Similarly, "/nodes/* /devices/* /rx" identifies the "rx" + * trace source within all NetDevices within all nodes. It is thus + * possible to connect a single trace sink to a set of matching trace + * sources in a single operation: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * // context contains enough information to uniquely identify + * // the trace source instance. + * std::cout << "context: \"" << context << "\""; + * // packet is the per-event information conveyed from the + * // trace source to the trace sink. + * std:: cout << " packet: " << packet << std::endl; + * } + * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback (&DeviceRxSink)); + * \endcode + * Which, at runtime, is going to generate output looking like this: + * \code + * context: "nodeid=2 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * context: "nodeid=1 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * ... + * \endcode + * In the example above, we see that the ns3::TraceContext contains three + * ns3::TraceContextElement which were printed using a space separator: + * - nodeid=i + * - device=j + * - dev-rx + * + * Of course, the user could also extract each of these elements from + * the context to generate a different output: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * NodeListIndex nodeIndex; + * NodeNetDeviceIndex deviceIndex; + * context.Get (nodeIndex); + * context.Get (deviceIndex); + * std::cout << "node-index=" << nodeIndex.Get (); + * std::cout << ", device-index=" << deviceIndex.Get (); + * std::cout << ", packet: " << packet; + * std::cout << std::endl; + * } + * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback (&DeviceRxSink)); + * \endcode + * Extracting TraceContextElement objects from a TraceContext in this manner + * raises a few obvious questions: + * - how do I know which trace context elements are present in a given + * TraceContext ? + * - how are these elements added to the TraceContext ? + * + * + * + * + * Connecting trace sinks to a set of existing trace sources is nice but + * model developers also often need to be able to create new trace sources + * and hook them into the namespace resolution system. Creating new trace + * sources is pretty easy: it is a matter of instantiating a proper + * subclass of the ns3::TraceSource base class. However, hooking each + * new trace source in the overall namespace resolution system requires + * some new effort. The core requirement is that the user needs to + * subclass from the ns3::Object base class which provides the most + * basic ns3::Object::Connect, and, ns3::Object::Disconnect methods. + * These two methods are simple forwarding methods to the virtual + * ns3::Object::GetTraceResolver method which does the bulk of the work + * required to setup properly trace sources. + * + * Every subclass of the ns3::Object base class which wishes to export + * a set of trace sources and make them available through the Connect/Disconnect + * functions needs to override the ns3::Object::GetTraceResolver method. + * This method needs to return a subclass of the ns3::TraceResolver + * base class which implements the ns3::TraceResolver::Connect and + * ns3::TraceResolver::Disconnect methods. Providing an implementation + * of these two methods is a bit complicated so, a default implementation + * named CompositeTraceResolver is provided: + * \code + * class MyModel : public Object + * { + * public: + * void DoSomething (void) + * { + * // change value of m_cwnd + * } + * protected: + * virtual Ptr GetTraceResolver (void) + * { + * // create the composite resolver + * Ptr resolver = Create (); + * resolver->AddSource ("cwnd", m_cwnd); + * resolver->AddSource ("rx", m_rx); + * return resolver; + * } + * private: + * SVTraceSource m_cwnd; + * CallbackTraceSource m_rx; + * }; + * void MyTraceSink (const TraceContext &context, Packet packet) + * { + * std::cout << context << " packet: " << packet << std::endl; + * } + * object->Connect ("/.../rx", MakeCallback (&MyTraceSink)); + * \endcode + * + * The above example is enough to export a trace source as a member of the + * tracing namespace so, it would be enough to allow a user to perform a + * pair of Connect/Disconnect operations but it would not be enough to allow + * a TraceContext to contain information about these trace sources. Specifically, + * printing the content of the TraceContext as shown above would give no + * information whatsoever about the type of trace source which was connected. + * + * but it is not enough to allow the TraceContext + * stored in each TraceSource to store information about these trace sources. + * + * - A trace source: a trace source is an object instance which is a + * subclass of the ns3::TraceSource base class. Each instance + * of a trace source should be used to report a single type of + * event. For example, if you want to report ipv4 rx and tx events, + * you should use two different trace source instances. + * + * - Trace sinks: a trace sink is a callback, that is, a function, + * which is provided by the user of a model to receive the events + * reported by a set of trace sources within that model. A trace + * sink is said to be "connected" once it has been associated + * to a set of trace sources. + * + * - Trace context: each trace source instance is associated with a single + * instance of an immutable trace context. Each ns3::TraceContext stores + * a set of trace context element instances, each of which is a subclass + * of the ns3::TraceContextElement base class. Whenever a trace sink + * provided by a user is called because a trace event was reported on + * a connected trace source, the trace context associated to the + * relevant trace source is passed as an extra argument to the user's + * trace sink. + * + * - instrumentation of models is done through a set of trace source + * instances, each of which is a subclass of the ns3::TraceSource + * base class. + * + * + */ From 8c1d6c6af970cbb25d7cb801edb65316e67e396b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 15:11:29 +0200 Subject: [PATCH 089/218] add some text on trace sink signatures --- src/core/tracing.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/core/tracing.h b/src/core/tracing.h index 44e4577c6..ca017a55e 100644 --- a/src/core/tracing.h +++ b/src/core/tracing.h @@ -12,14 +12,8 @@ * be connected to a set of trace sources to receive the events generated * by each trace source. * - * - Trace context: each trace source instance is associated with a single - * trace context which can be used by each connected trace sink to - * identify the instance of the source of the event. - * * - A trace resolver is an object which allows users to establish * connections between a set of trace sources and a set of trace sinks. - * The trace contexts are configured during connection by the trace - * resolvers. * * So, what does it look like in practice ? First, let's look at trace * sources. We have two types of trace sources: numeric, and, normal @@ -71,10 +65,8 @@ * ns3::FvTraceSource. * * To receive these trace events, a user should specify a set of trace sinks. - * For example, to receive the "int" and the "something events outlined - * above, a user would declare the following functions which receive - * as an extra first argument the context of the trace source which - * generated the specific event. + * For example, to receive the "int" and the "something" events shown in the + * examples above, a user would declare the following functions: * \code * // oldValue and newValue contain the previous and new values of * // the connected SVTraceSource trace source. @@ -91,6 +83,18 @@ * std::cout << "value=" << value << ", packet " << packet << std::endl; * } * \endcode + * Each of these sink function takes, as a first argument, a reference to a + * const TraceContext object. This context object contains information which + * describes the instance of the connected trace source: that information is + * setup during the connection process and does not change afterwards + * The type and the number of the other arguments to each trace sink depends + * on the type of the connected trace source: it conveys per-event information + * from the trace source to the trace sink. For example, UVTraceSource and + * SVTraceSource trace sources require two extra arguments. The former requires + * two unsigned 64 bit integers while the latter requires two signed 64 bit + * integers. More generally, users can consult the \ref trace-source-list + * to figure out the arguments which a trace sink is required to receive + * for each trace source. * * The hard part of this tracing framework is the "connection" step: there is a point * in the simulation scenario where the user is expected to specify which trace sources From b963216e175b4f97228ee9c794db5c47e68e86ec Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:41:23 +0200 Subject: [PATCH 090/218] empty file for doxygen generation --- doc/trace-source-list.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/trace-source-list.h diff --git a/doc/trace-source-list.h b/doc/trace-source-list.h new file mode 100644 index 000000000..e69de29bb From ff3fb320b309074fd904793a1f68ba605ffbfbec Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:42:00 +0200 Subject: [PATCH 091/218] ignore empty file --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index 96ea69ce7..93984cae5 100644 --- a/.hgignore +++ b/.hgignore @@ -6,6 +6,7 @@ build .*\.sconsign doc/html.* doc/latex.* +doc/trace-source-list.h .lock-wscript .waf* waf From dcd848939302a881bf91ad25ef9b16e4a6077ec1 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:42:18 +0200 Subject: [PATCH 092/218] add trace-source-file.h to doxygen list --- doc/doxygen.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doxygen.conf b/doc/doxygen.conf index 7d6248d95..6f4b503d7 100644 --- a/doc/doxygen.conf +++ b/doc/doxygen.conf @@ -450,7 +450,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src doc/main.txt +INPUT = src doc/main.txt doc/trace-source-list.h # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp From b4de6e9379b29b8c722801aef1d7be6208b80088 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:42:55 +0200 Subject: [PATCH 093/218] add iterator to go through available list --- src/core/trace-context.cc | 91 +++++++++++++++++++++++++++++++++++++++ src/core/trace-context.h | 20 +++++++++ 2 files changed, 111 insertions(+) diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index e09f461ca..23842d00a 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -24,6 +24,72 @@ namespace ns3 { +TraceContext::Iterator & +TraceContext::Iterator::operator ++ (void) +{ + ReadOne (); + return *this; +} +TraceContext::Iterator +TraceContext::Iterator::operator ++ (int) +{ + Iterator old (*this); + ReadOne (); + return old; +} +const std::string & +TraceContext::Iterator::operator * (void) const +{ + return m_name; +} +const std::string * +TraceContext::Iterator::operator -> (void) const +{ + return &m_name; +} +TraceContext::Iterator::Iterator (uint8_t *buffer) + : m_buffer (buffer), + m_current (0) +{ + ReadOne (); +} +TraceContext::Iterator::Iterator (uint8_t *buffer, uint16_t index) + : m_buffer (buffer), + m_current (index) +{} +void +TraceContext::Iterator::ReadOne (void) +{ + if (m_buffer == 0) + { + return; + } + uint8_t uid = m_buffer[m_current]; + uint8_t size = ElementRegistry::GetSize (uid); + m_name = ElementRegistry::GetName (uid); + m_current += 1 + size; +} +bool +TraceContext::Iterator::operator != (const Iterator &o) +{ + return ! (*this == o); +} +bool +TraceContext::Iterator::operator == (const Iterator &o) +{ + if (m_buffer == 0 && o.m_buffer == 0) + { + return true; + } + if (m_buffer != 0 && o.m_buffer == 0 || + m_buffer == 0 && o.m_buffer != 0) + { + return false; + } + return m_current == o.m_current; +} + + TraceContext::TraceContext () : m_data (0) {} @@ -230,6 +296,31 @@ TraceContext::Print (std::ostream &os) const } } while (true); } +TraceContext::Iterator +TraceContext::AvailableBegin (void) const +{ + if (m_data == 0) + { + return Iterator (0); + } + return Iterator (m_data->data); +} +TraceContext::Iterator +TraceContext::AvailableEnd (void) const +{ + if (m_data == 0) + { + return Iterator (0); + } + uint8_t currentUid; + uint16_t i = 0; + do { + currentUid = m_data->data[i]; + uint8_t size = ElementRegistry::GetSize (currentUid); + i += 1 + size; + } while (i < m_data->size && currentUid != 0); + return Iterator (m_data->data, i); +} void TraceContext::PrintAvailable (std::ostream &os, std::string separator) const diff --git a/src/core/trace-context.h b/src/core/trace-context.h index 4ca77d44f..5ab3cd3c6 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -97,6 +97,26 @@ public: * Print the typename of each TraceContextElement stored in this TraceContext. */ void PrintAvailable (std::ostream &os, std::string separator) const; + class Iterator + { + public: + Iterator &operator ++ (void); + Iterator operator ++ (int); + const std::string &operator * (void) const; + const std::string *operator -> (void) const; + bool operator == (const Iterator &o); + bool operator != (const Iterator &o); + private: + friend class TraceContext; + Iterator (uint8_t *buffer); + Iterator (uint8_t *buffer, uint16_t index); + void ReadOne (void); + uint8_t *m_buffer; + uint16_t m_current; + std::string m_name; + }; + Iterator AvailableBegin (void) const; + Iterator AvailableEnd (void) const; /** * \param o another trace context * \returns true if the input trace context contains exactly the same set of From ad11ae12cb116f2085c3ec59c8f80f4e27088da7 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:43:04 +0200 Subject: [PATCH 094/218] add PrintDoxygen method --- src/core/trace-resolver.cc | 47 +++++++++++++++++++++++++++++++++++++- src/core/trace-resolver.h | 1 + 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index f2bd31ea3..ff0448ca3 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -94,7 +94,7 @@ TraceResolver::SourceCollection::AddUnique (std::string path, source.doc = doc; m_sources.push_back (source); } -void +void TraceResolver::SourceCollection::Print (std::ostream &os) const { for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) @@ -120,5 +120,50 @@ TraceResolver::SourceCollection::Print (std::ostream &os) const os << std::endl; } } +void +TraceResolver::SourceCollection::PrintDoxygen (std::ostream &os) const +{ + uint32_t z = 0; + for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) + { + os << "///" << std::endl; + os << "/// \\ingroup TraceSourceList" << std::endl; + os << "/// \\brief " << i->doc.GetHelp () << std::endl; + os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl; + uint32_t j = 2; + for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++) + { + os << "/// \\param arg" << j << " " << l->second << "." << std::endl; + j++; + } + os << "///" << std::endl; + os << "///" << std::endl; + os << "/// The path to this trace source is: " << i->path << "." << std::endl; + os << "///" << std::endl; + if (i->context.AvailableBegin () == i->context.AvailableEnd ()) + { + os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl; + } + else + { + os << "/// The following classes can be extracted from \\p arg1 with " << std::endl; + os << "/// ns3::TraceContext::GetElement:" << std::endl; + for (TraceContext::Iterator m = i->context.AvailableBegin (); m != i->context.AvailableEnd (); m++) + { + os << "/// - " << (*m) << std::endl; + } + } + os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ; + j = 2; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first << " arg" << j; + j++; + } + os << ");" << std::endl; + os << std::endl; + z++; + } +} }//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index dcc0f9699..9bf429b12 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -74,6 +74,7 @@ public: { public: void Print (std::ostream &os) const; + void PrintDoxygen (std::ostream &os) const; void AddUnique (std::string path, const TraceContext &context, const TraceDoc &doc); From a3d4b9edb48f123d5e13f56e263cd108ad6b81b0 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 29 Aug 2007 16:43:19 +0200 Subject: [PATCH 095/218] reference the proper trace source list group --- src/core/tracing.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/tracing.h b/src/core/tracing.h index ca017a55e..0612b144e 100644 --- a/src/core/tracing.h +++ b/src/core/tracing.h @@ -1,3 +1,7 @@ +/** + * \defgroup TraceSourceList List of trace sources + */ + /** * \defgroup tracing Tracing * @@ -92,7 +96,7 @@ * from the trace source to the trace sink. For example, UVTraceSource and * SVTraceSource trace sources require two extra arguments. The former requires * two unsigned 64 bit integers while the latter requires two signed 64 bit - * integers. More generally, users can consult the \ref trace-source-list + * integers. More generally, users can consult the \ref TraceSourceList * to figure out the arguments which a trace sink is required to receive * for each trace source. * From a8a76bf7847ec309e6f5300cc145c9608fb9e44c Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 29 Aug 2007 12:11:11 -0700 Subject: [PATCH 096/218] Move MakeMulticastAddress to NetDevice --- src/devices/csma/csma-net-device.cc | 64 +++++++++++++++-- src/devices/csma/csma-net-device.h | 31 ++++++++ .../point-to-point-net-device.cc | 6 +- src/internet-node/arp-ipv4-interface.cc | 70 +------------------ src/internet-node/arp-ipv4-interface.h | 1 - src/internet-node/ipv4-l3-protocol.cc | 2 + src/node/net-device.cc | 13 +++- src/node/net-device.h | 59 ++++++++++++++-- 8 files changed, 160 insertions(+), 86 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index ca6a693a5..7cdcd455c 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -19,8 +19,6 @@ * Author: Emmanuelle Laprise */ -#include -#include #include "ns3/debug.h" #include "ns3/queue.h" #include "ns3/simulator.h" @@ -60,7 +58,6 @@ CsmaTraceType::GetUid (void) return uid; } - CsmaNetDevice::CsmaNetDevice (Ptr node) : NetDevice (node, Eui48Address::Allocate ()), m_bps (DataRate (0xffffffff)) @@ -71,7 +68,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr node) } CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, - CsmaEncapsulationMode encapMode) + CsmaEncapsulationMode encapMode) : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { @@ -82,8 +79,8 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, } CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, - CsmaEncapsulationMode encapMode, - bool sendEnable, bool receiveEnable) + CsmaEncapsulationMode encapMode, + bool sendEnable, bool receiveEnable) : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { @@ -582,6 +579,61 @@ CsmaNetDevice::Receive (const Packet& packet) return; } +Address +CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const +{ + NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (" << multicastGroup << + ")"); +// +// First, get the generic multicast address. +// + Address hardwareDestination = GetMulticast (); + + NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " + "Device multicast address: " << hardwareDestination); +// +// It's our address, and we know we're playing with an EUI-48 address here +// primarily since we know that by construction, but also since the parameter +// is an Ipv4Address. +// + Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); +// +// We now have the multicast address in an abstract 48-bit container. We +// need to pull it out so we can play with it. When we're done, we have the +// high order bits in etherBuffer[0], etc. +// + uint8_t etherBuffer[6]; + etherAddr.CopyTo (etherBuffer); +// +// Now we need to pull the raw bits out of the Ipv4 destination address. +// + uint8_t ipBuffer[4]; + multicastGroup.Serialize (ipBuffer); +// +// RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 +// multicast address by placing the low-order 23-bits of the IP address into +// the low-order 23 bits of the Ethernet multicast address +// 01-00-5E-00-00-00 (hex). +// + etherBuffer[3] |= ipBuffer[1] & 0x7f; + etherBuffer[4] = ipBuffer[2]; + etherBuffer[5] = ipBuffer[3]; +// +// Now, etherBuffer has the desired ethernet multicast address. We have to +// suck these bits back into the Eui48Address, +// + etherAddr.CopyFrom (etherBuffer); +// +// Implicit conversion (operator Address ()) is defined for Eui48Address, so +// use it by just returning the EUI-48 address which is automagically converted +// to an Address. +// + NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " + "multicast address is " << etherAddr); + + return etherAddr; +} + Ptr CsmaNetDevice::GetQueue(void) const { diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 441ea04cd..b0442ac94 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -197,6 +197,37 @@ enum CsmaEncapsulationMode { */ void Receive (const Packet& p); + /** + * @brief Make and return a MAC multicast address using the provided + * multicast group + * + * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet + * multicast address by placing the low-order 23-bits of the IP address into + * the low-order 23 bits of the Ethernet multicast address + * 01-00-5E-00-00-00 (hex). + * + * This method performs the multicast address creation function appropriate + * to an EUI-48-based CSMA device. This MAC address is encapsulated in an + * abstract Address to avoid dependencies on the exact address format. + * + * A default imlementation of MakeMulticastAddress is provided, but this + * method simply NS_ASSERTS. In the case of net devices that do not support + * multicast, clients are expected to test NetDevice::IsMulticast and avoid + * attempting to map multicast packets. Subclasses of NetDevice that do + * support multicasting are expected to override this method and provide an + * implementation appropriate to the particular device. + * + * @param multicastGroup The IP address for the multicast group destination + * of the packet. + * @return The MAC multicast Address used to send packets to the provided + * multicast group. + * + * @see Ipv4Address + * @see Eui48Address + * @see Address + */ + Address MakeMulticastAddress (Ipv4Address multicastGroup) const; + bool IsSendEnabled (void); bool IsReceiveEnabled (void); diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index ada429621..ae4da905b 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -20,8 +20,6 @@ * Revised: George Riley */ -#include -#include #include "ns3/debug.h" #include "ns3/queue.h" #include "ns3/simulator.h" @@ -73,7 +71,7 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, // You _must_ support broadcast to get any sort of packet from the ARP layer. EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); // -// Randomly pick the ethernet multicast address base +// We want to allow multicast packets to flow across this link // EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); EnablePointToPoint(); @@ -214,6 +212,8 @@ bool PointToPointNetDevice::Attach (Ptr ch) m_bps = m_channel->GetDataRate (); // GFR Comment. Below is definitely wrong. Interframe gap // is unrelated to channel delay. + // -- unlesss you want to introduce a default gap which is there to avoid + // parts of multiple packets flowing on the "wire" at the same time. //m_tInterframeGap = m_channel->GetDelay (); /* diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index 29ccb19f2..63533ff58 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -61,74 +61,6 @@ ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) return resolver; } -// -// RFC 1112 says that an IP host group address is mapped to an Ethernet -// multicast address by placing the low-order 23-bits of the IP address into -// the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 -// (hex). These are completely different animals and they're encapsulated -// very nicely. Translation: This isn't going to be very pretty. -// -Address -ArpIpv4Interface::MakeMulticastAddress(Ipv4Address multicastGroup) -{ - NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (" << multicastGroup << - ")"); -// -// First, get the generic multicast address from the device. Since it is -// connected to this object, and this object is an IPV4 stack, we hope that -// it is really an Eui48Address. If it's not, then we don't know what to do. -// - Address hardwareDestination = GetDevice ()->GetMulticast (); - - NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " - "Device multicast address: " << hardwareDestination); - - Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); -// -// We now have the multicast address in an abstract 48-bit container. We -// need to pull it out so we can play with it. When we're done, we have the -// high order bits in etherBuffer[0], etc. -// - uint8_t etherBuffer[6]; - etherAddr.CopyTo (etherBuffer); -// -// If the device is playing the game correctly, the low order 23 bits of the -// multicast base address will be zero. -// - NS_ASSERT_MSG((etherBuffer[4] & 0x7f) == 0, - "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); - NS_ASSERT_MSG(etherBuffer[5] == 0, - "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); - NS_ASSERT_MSG(etherBuffer[6] == 0, - "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); -// -// Now we need to pull the raw bits out of the Ipv4 destination address. -// - uint8_t ipBuffer[4]; - multicastGroup.Serialize (ipBuffer); -// -// We need to place the low order 23 bits of the IP address into the low order -// 23 bits of the ethernet address. -// - etherBuffer[3] |= ipBuffer[1] & 0x7f; - etherBuffer[4] = ipBuffer[2]; - etherBuffer[5] = ipBuffer[3]; -// -// Now, etherBuffer has the desired ethernet multicast address. We have to -// suck these bits back into the Eui48Address; and then suck those bits back -// into the abstract hardwareAddress. -// - etherAddr.CopyFrom (etherBuffer); -// -// Implicit conversion (operator Address ()) is defined for Eui48Address, so -// use it. -// - NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " - "multicast address is " << etherAddr); - - return etherAddr; -} - void ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) { @@ -156,7 +88,7 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) "ArpIpv4Interface::SendTo (): Sending multicast packet over " "non-multicast device"); - hardwareDestination = MakeMulticastAddress(dest); + hardwareDestination = GetDevice ()->MakeMulticastAddress(dest); found = true; } else diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index dd73ff2b0..130a52256 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -47,7 +47,6 @@ class ArpIpv4Interface : public Ipv4Interface virtual void SendTo (Packet p, Ipv4Address dest); virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); Ptr m_node; - Address MakeMulticastAddress (Ipv4Address multicastGroup); }; }//namespace ns3 diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index b5faf663b..b45046783 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -504,6 +504,8 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc NS_DEBUG("Ipv4L3Protocol::Receive (" << &device << ", " << &p << ", " << protocol << ", " << from << ")"); + NS_DEBUG("Ipv4L3Protocol::Receive (): Packet from " << from); + uint32_t index = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 72d610924..4e6710758 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -140,10 +140,19 @@ NetDevice::IsMulticast (void) const return m_isMulticast; } -Address const & +Address NetDevice::GetMulticast (void) const { - NS_ASSERT (m_isMulticast); + NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " + "Invalid operation when not IsMulticast ()"); + return m_multicast; +} + +Address +NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const +{ + NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " + "Invalid operation when not IsMulticast ()"); return m_multicast; } diff --git a/src/node/net-device.h b/src/node/net-device.h index 98c527e4b..dd622ae90 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -29,6 +29,7 @@ #include "ns3/object.h" #include "ns3/ptr.h" #include "address.h" +#include "ipv4-address.h" namespace ns3 { @@ -145,13 +146,61 @@ public: bool IsMulticast (void) const; /** - * \return the multicast address supported by - * this netdevice. + * \brief Return the MAC multicast base address used when mapping multicast + * groups to MAC multicast addresses. * - * Calling this method is invalid if IsMulticast returns - * not true. + * Typically when one constructs a multicast MAC addresses, some bits from + * the IP multicast group are copied into a corresponding MAC multicast + * group. In EUI-48, for example, the low order 23 bits of the multicast + * group are copied to the MAC multicast group base address. + * + * This method allows access to the underlying MAC multicast group base + * address. It is expected that in most cases, a net device client will + * allow the net device to perform the actual construction of the multicast + * address. Use of this method is discouraged unless you have a good reason + * to perform a custom mapping. You should prefer + * NetDevice::MakeMulticastAddress which will do the RFC-specified mapping + * for the net device in question. + * + * \return The multicast address supported by this net device. + * + * \warning Calling this method is invalid if IsMulticast returns not true. + * The method NS_ASSERTs if the device is not a multicast device. + * \see NetDevice::MakeMulticastAddress */ - Address const &GetMulticast (void) const; + Address GetMulticast (void) const; + + /** + * \brief Make and return a MAC multicast address using the provided + * multicast group + * + * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet + * multicast address by placing the low-order 23-bits of the IP address into + * the low-order 23 bits of the Ethernet multicast address + * 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. + * This method performs the multicast address creation function appropriate + * to the underlying MAC address of the device. This MAC address is + * encapsulated in an abstract Address to avoid dependencies on the exact + * MAC address format. + * + * A default imlementation of MakeMulticastAddress is provided, but this + * method simply NS_ASSERTS. In the case of net devices that do not support + * multicast, clients are expected to test NetDevice::IsMulticast and avoid + * attempting to map multicast packets. Subclasses of NetDevice that do + * support multicasting are expected to override this method and provide an + * implementation appropriate to the particular device. + * + * \param multicastGroup The IP address for the multicast group destination + * of the packet. + * \return The MAC multicast Address used to send packets to the provided + * multicast group. + * + * \warning Calling this method is invalid if IsMulticast returns not true. + * \see Ipv4Address + * \see Address + * \see NetDevice::IsMulticast + */ + virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const; /** * \return value of m_isPointToPoint flag From 5c0c15bd36d96beefe46577b8a2f1692367851c1 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 13:58:15 +0200 Subject: [PATCH 097/218] move printing to client code --- src/core/trace-resolver.cc | 74 +++-------------------------------- src/core/trace-resolver.h | 14 ++++--- utils/print-trace-sources.cc | 75 +++++++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 75 deletions(-) diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index ff0448ca3..d891c94c4 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -94,76 +94,14 @@ TraceResolver::SourceCollection::AddUnique (std::string path, source.doc = doc; m_sources.push_back (source); } -void -TraceResolver::SourceCollection::Print (std::ostream &os) const +TraceResolver::SourceCollection::Iterator +TraceResolver::SourceCollection::Begin (void) const { - for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) - { - os << "source=" << i->path << std::endl; - os << "TraceContext=["; - i->context.PrintAvailable (os, ","); - os << "]" << std::endl; - os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; - os << "void TraceSinkCallback (const TraceContext &"; - for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) - { - os << ", " << k->first; - } - os << ")" << std::endl; - os << "argument 1 -- the trace context associated to the connected trace source." << std::endl; - uint32_t k = 2; - for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) - { - os << "argument " << k << " -- " << j->second << "." << std::endl; - k++; - } - os << std::endl; - } + return m_sources.begin (); } -void -TraceResolver::SourceCollection::PrintDoxygen (std::ostream &os) const +TraceResolver::SourceCollection::Iterator +TraceResolver::SourceCollection::End (void) const { - uint32_t z = 0; - for (SourceVector::const_iterator i = m_sources.begin (); i != m_sources.end (); i++) - { - os << "///" << std::endl; - os << "/// \\ingroup TraceSourceList" << std::endl; - os << "/// \\brief " << i->doc.GetHelp () << std::endl; - os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl; - uint32_t j = 2; - for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++) - { - os << "/// \\param arg" << j << " " << l->second << "." << std::endl; - j++; - } - os << "///" << std::endl; - os << "///" << std::endl; - os << "/// The path to this trace source is: " << i->path << "." << std::endl; - os << "///" << std::endl; - if (i->context.AvailableBegin () == i->context.AvailableEnd ()) - { - os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl; - } - else - { - os << "/// The following classes can be extracted from \\p arg1 with " << std::endl; - os << "/// ns3::TraceContext::GetElement:" << std::endl; - for (TraceContext::Iterator m = i->context.AvailableBegin (); m != i->context.AvailableEnd (); m++) - { - os << "/// - " << (*m) << std::endl; - } - } - os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ; - j = 2; - for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) - { - os << ", " << k->first << " arg" << j; - j++; - } - os << ");" << std::endl; - os << std::endl; - z++; - } + return m_sources.end (); } - }//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 9bf429b12..c78a6f21d 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -73,18 +73,20 @@ public: class SourceCollection { public: - void Print (std::ostream &os) const; - void PrintDoxygen (std::ostream &os) const; - void AddUnique (std::string path, - const TraceContext &context, - const TraceDoc &doc); - private: struct Source { std::string path; TraceContext context; TraceDoc doc; }; + typedef std::vector::const_iterator Iterator; + void AddUnique (std::string path, + const TraceContext &context, + const TraceDoc &doc); + + Iterator Begin (void) const; + Iterator End (void) const; + private: typedef std::vector SourceVector; SourceVector m_sources; }; diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc index 21f8eb1da..a4e3d01c9 100644 --- a/utils/print-trace-sources.cc +++ b/utils/print-trace-sources.cc @@ -9,6 +9,79 @@ using namespace ns3; +void +PrintSimpleText (const TraceResolver::SourceCollection *sources, std::ostream &os) +{ + for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++) + { + os << "source=" << i->path << std::endl; + os << "TraceContext=["; + i->context.PrintAvailable (os, ","); + os << "]" << std::endl; + os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; + os << "void TraceSinkCallback (const TraceContext &"; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first; + } + os << ")" << std::endl; + os << "argument 1 -- the trace context associated to the connected trace source." << std::endl; + uint32_t k = 2; + for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) + { + os << "argument " << k << " -- " << j->second << "." << std::endl; + k++; + } + os << std::endl; + } +} +void +PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream &os) +{ + uint32_t z = 0; + for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++) + { + os << "///" << std::endl; + os << "/// \\ingroup TraceSourceList" << std::endl; + os << "/// \\brief " << i->doc.GetHelp () << std::endl; + os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl; + uint32_t j = 2; + for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++) + { + os << "/// \\param arg" << j << " " << l->second << "." << std::endl; + j++; + } + os << "///" << std::endl; + os << "///" << std::endl; + os << "/// The path to this trace source is: " << i->path << "." << std::endl; + os << "///" << std::endl; + if (i->context.AvailableBegin () == i->context.AvailableEnd ()) + { + os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl; + } + else + { + os << "/// The following classes can be extracted from \\p arg1 with " << std::endl; + os << "/// ns3::TraceContext::GetElement:" << std::endl; + for (TraceContext::Iterator m = i->context.AvailableBegin (); m != i->context.AvailableEnd (); m++) + { + os << "/// - " << (*m) << std::endl; + } + } + os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ; + j = 2; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first << " arg" << j; + j++; + } + os << ");" << std::endl; + os << std::endl; + z++; + } +} + + int main (int argc, char *argv[]) { Ptr node = Create (); @@ -21,7 +94,7 @@ int main (int argc, char *argv[]) TraceResolver::SourceCollection collection; NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); - collection.Print (std::cout); + PrintDoxygenText (&collection, std::cout); return 0; } From 0aa3a7bfb049f324e5e71ed0613b0ab46a8d8f31 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 14:25:09 +0200 Subject: [PATCH 098/218] rewrite the TraceContext::SourceCollection::Iterator class --- src/core/trace-context.cc | 102 ++++++++++++----------------------- src/core/trace-context.h | 18 +++---- utils/print-trace-sources.cc | 6 +-- 3 files changed, 43 insertions(+), 83 deletions(-) diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index 23842d00a..4c77d741f 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -24,71 +24,51 @@ namespace ns3 { -TraceContext::Iterator & -TraceContext::Iterator::operator ++ (void) -{ - ReadOne (); - return *this; -} -TraceContext::Iterator -TraceContext::Iterator::operator ++ (int) -{ - Iterator old (*this); - ReadOne (); - return old; -} -const std::string & -TraceContext::Iterator::operator * (void) const -{ - return m_name; -} -const std::string * -TraceContext::Iterator::operator -> (void) const -{ - return &m_name; -} -TraceContext::Iterator::Iterator (uint8_t *buffer) +TraceContext::Iterator::Iterator () + : m_buffer (0), + m_size (0), + m_current (0) +{} +TraceContext::Iterator::Iterator (uint8_t *buffer, uint16_t size) : m_buffer (buffer), + m_size (size), m_current (0) { - ReadOne (); + m_uid = m_buffer[m_current]; +} +bool +TraceContext::Iterator::IsLast (void) const +{ + if (m_buffer == 0 || m_uid == 0 || m_current >= m_size) + { + return true; + } + return false; } -TraceContext::Iterator::Iterator (uint8_t *buffer, uint16_t index) - : m_buffer (buffer), - m_current (index) -{} void -TraceContext::Iterator::ReadOne (void) +TraceContext::Iterator::Next (void) { if (m_buffer == 0) { return; } - uint8_t uid = m_buffer[m_current]; - uint8_t size = ElementRegistry::GetSize (uid); - m_name = ElementRegistry::GetName (uid); - m_current += 1 + size; -} -bool -TraceContext::Iterator::operator != (const Iterator &o) -{ - return ! (*this == o); -} -bool -TraceContext::Iterator::operator == (const Iterator &o) -{ - if (m_buffer == 0 && o.m_buffer == 0) + if (m_uid == 0) { - return true; + return; } - if (m_buffer != 0 && o.m_buffer == 0 || - m_buffer == 0 && o.m_buffer != 0) + else { - return false; + uint8_t size = ElementRegistry::GetSize (m_uid); + m_current += 1 + size; } - return m_current == o.m_current; + m_uid = m_buffer[m_current]; +} +std::string +TraceContext::Iterator::Get (void) const +{ + std::string name = ElementRegistry::GetName (m_uid); + return name; } - TraceContext::TraceContext () : m_data (0) @@ -297,29 +277,13 @@ TraceContext::Print (std::ostream &os) const } while (true); } TraceContext::Iterator -TraceContext::AvailableBegin (void) const +TraceContext::Begin (void) const { if (m_data == 0) { - return Iterator (0); + return Iterator (); } - return Iterator (m_data->data); -} -TraceContext::Iterator -TraceContext::AvailableEnd (void) const -{ - if (m_data == 0) - { - return Iterator (0); - } - uint8_t currentUid; - uint16_t i = 0; - do { - currentUid = m_data->data[i]; - uint8_t size = ElementRegistry::GetSize (currentUid); - i += 1 + size; - } while (i < m_data->size && currentUid != 0); - return Iterator (m_data->data, i); + return Iterator (m_data->data, m_data->size); } void diff --git a/src/core/trace-context.h b/src/core/trace-context.h index 5ab3cd3c6..908f3ecb9 100644 --- a/src/core/trace-context.h +++ b/src/core/trace-context.h @@ -100,23 +100,19 @@ public: class Iterator { public: - Iterator &operator ++ (void); - Iterator operator ++ (int); - const std::string &operator * (void) const; - const std::string *operator -> (void) const; - bool operator == (const Iterator &o); - bool operator != (const Iterator &o); + void Next (void); + bool IsLast (void) const; + std::string Get (void) const; private: friend class TraceContext; - Iterator (uint8_t *buffer); + Iterator (); Iterator (uint8_t *buffer, uint16_t index); - void ReadOne (void); uint8_t *m_buffer; + uint16_t m_size; uint16_t m_current; - std::string m_name; + uint8_t m_uid; }; - Iterator AvailableBegin (void) const; - Iterator AvailableEnd (void) const; + Iterator Begin (void) const; /** * \param o another trace context * \returns true if the input trace context contains exactly the same set of diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc index a4e3d01c9..af7cfb755 100644 --- a/utils/print-trace-sources.cc +++ b/utils/print-trace-sources.cc @@ -55,7 +55,7 @@ PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream & os << "///" << std::endl; os << "/// The path to this trace source is: " << i->path << "." << std::endl; os << "///" << std::endl; - if (i->context.AvailableBegin () == i->context.AvailableEnd ()) + if (i->context.Begin ().IsLast ()) { os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl; } @@ -63,9 +63,9 @@ PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream & { os << "/// The following classes can be extracted from \\p arg1 with " << std::endl; os << "/// ns3::TraceContext::GetElement:" << std::endl; - for (TraceContext::Iterator m = i->context.AvailableBegin (); m != i->context.AvailableEnd (); m++) + for (TraceContext::Iterator m = i->context.Begin (); !m.IsLast (); m.Next ()) { - os << "/// - " << (*m) << std::endl; + os << "/// - " << m.Get () << std::endl; } } os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ; From c0ac2a19c61997c3ee39ad1d43d06e1b581e045c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 14:35:44 +0200 Subject: [PATCH 099/218] GetName -> GetTypeName --- doc/trace-source-list.h | 204 ++++++++++++++++++ src/core/composite-trace-resolver.cc | 4 +- src/core/trace-context-element.cc | 4 +- src/core/trace-context-element.h | 19 +- src/core/trace-context.cc | 8 +- src/devices/csma/csma-net-device.cc | 4 +- src/devices/csma/csma-net-device.h | 2 +- .../point-to-point-net-device.cc | 4 +- .../point-to-point-net-device.h | 2 +- src/internet-node/ipv4-l3-protocol.cc | 8 +- src/internet-node/ipv4-l3-protocol.h | 4 +- src/internet-node/ipv4-l4-demux.cc | 4 +- src/internet-node/ipv4-l4-demux.h | 2 +- src/node/node-list.cc | 4 +- src/node/node-list.h | 2 +- src/node/node.cc | 4 +- src/node/node.h | 2 +- src/node/queue.cc | 4 +- src/node/queue.h | 2 +- 19 files changed, 246 insertions(+), 41 deletions(-) diff --git a/doc/trace-source-list.h b/doc/trace-source-list.h index e69de29bb..c23d06ece 100644 --- a/doc/trace-source-list.h +++ b/doc/trace-source-list.h @@ -0,0 +1,204 @@ +/// +/// \ingroup TraceSourceList +/// \brief send ipv4 packet to outgoing interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet sent. +/// \param arg3 index of output ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/tx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback0 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief receive ipv4 packet from incoming interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// \param arg3 index of input ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback1 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief drop ipv4 packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback2 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief store packet in queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet queued. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/enqueue. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback3 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief remove packet from queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dequeued. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/dequeue. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback4 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief drop packet from queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback5 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief receive MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::PointToPointTraceType +void TraceSinkCallback6 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief receive MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::CsmaTraceType +void TraceSinkCallback7 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief drop MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::CsmaTraceType +void TraceSinkCallback8 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief The value of the speed vector changed +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 the mobility model whose course changed. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$MobilityModelNotifier/course-change. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +void TraceSinkCallback9 (const TraceContext & arg1, Ptr arg2); + +/// +/// \ingroup TraceSourceList +/// \brief send ipv4 packet to outgoing interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet sent. +/// \param arg3 index of output ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/tx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback10 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief receive ipv4 packet from incoming interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// \param arg3 index of input ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback11 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief drop ipv4 packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback12 (const TraceContext & arg1, const Packet & arg2); + diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 0f4e782b8..bb0aacabb 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -320,7 +320,7 @@ public: else if (m_sources == DOUBLEB) {os << "doubleB";} else if (m_sources == UINT16_T) {os << "uint16_t";} } - std::string GetName (void) {return "TraceSourceTest";} + std::string GetTypeName (void) {return "ns3::TraceSourceTest";} TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {} TraceSourceTest (enum Sources sources) :m_sources (sources) {} bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;} @@ -340,7 +340,7 @@ public: {static uint16_t uid = AllocateUid ("SubTraceSourceTest"); return uid;} void Print (std::ostream &os) {os << "subtracesource=int";} - std::string GetName (void) const {return "SubTraceSourceTest";} + std::string GetTypeName (void) const {return "ns3::SubTraceSourceTest";} SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {} SubTraceSourceTest (enum Sources sources) : m_sources (sources) {} private: diff --git a/src/core/trace-context-element.cc b/src/core/trace-context-element.cc index 24b02fd23..dee4e97f4 100644 --- a/src/core/trace-context-element.cc +++ b/src/core/trace-context-element.cc @@ -3,11 +3,11 @@ namespace ns3 { std::string -ElementRegistry::GetName (uint16_t uid) +ElementRegistry::GetTypeName (uint16_t uid) { InfoVector *vec = GetInfoVector (); struct Info info = (*vec)[uid - 1]; - return info.getName (); + return info.getTypeName (); } uint32_t ElementRegistry::GetSize (uint16_t uid) diff --git a/src/core/trace-context-element.h b/src/core/trace-context-element.h index 4ed08c3ac..2baa7e39f 100644 --- a/src/core/trace-context-element.h +++ b/src/core/trace-context-element.h @@ -48,7 +48,7 @@ namespace ns3 { * MyContext (); * ~MyContext (); * void Print (std::ostream &os) const; - * std::string GetName (void) const; + * std::string GetTypeName (void) const; * * // the user-specific API to manipulate the context. * void SetData (uint8_t data); @@ -73,8 +73,9 @@ namespace ns3 { * os << "mycontext=" << (uint32_t) m_myContextData; * } * std::string - * MyContext::GetName (void) const + * MyContext::GetTypeName (void) const * { + * // return a fully-qualified c++ type name * return "MyContext"; * } * void @@ -121,23 +122,23 @@ public: static uint32_t GetSize (uint16_t uid); static void Print (uint16_t uid, uint8_t *instance, std::ostream &os); - static std::string GetName (uint16_t uid); + static std::string GetTypeName (uint16_t uid); static void Destroy (uint16_t uid, uint8_t *instance); private: - typedef std::string (*GetNameCb) (void); + typedef std::string (*GetTypeNameCb) (void); typedef void (*PrintCb) (uint8_t *instance, std::ostream &os); typedef void (*DestroyCb) (uint8_t *instance); struct Info { uint32_t size; std::string uidString; - GetNameCb getName; + GetTypeNameCb getTypeName; PrintCb print; DestroyCb destroy; }; typedef std::vector InfoVector; static InfoVector *GetInfoVector (void); template - static std::string DoGetName (void); + static std::string DoGetTypeName (void); template static void DoPrint (uint8_t *instance, std::ostream &os); template @@ -155,10 +156,10 @@ ElementRegistry::DoPrint (uint8_t *instance, std::ostream &os) } template std::string -ElementRegistry::DoGetName (void) +ElementRegistry::DoGetTypeName (void) { static T obj; - return obj.GetName (); + return obj.GetTypeName (); } template void @@ -187,7 +188,7 @@ ElementRegistry::AllocateUid (std::string name) struct Info info; info.size = sizeof (T); info.uidString = name; - info.getName = &ElementRegistry::DoGetName; + info.getTypeName = &ElementRegistry::DoGetTypeName; info.print = &ElementRegistry::DoPrint; info.destroy = &ElementRegistry::DoDestroy; vec->push_back (info); diff --git a/src/core/trace-context.cc b/src/core/trace-context.cc index 4c77d741f..af3ac2cfa 100644 --- a/src/core/trace-context.cc +++ b/src/core/trace-context.cc @@ -66,7 +66,7 @@ TraceContext::Iterator::Next (void) std::string TraceContext::Iterator::Get (void) const { - std::string name = ElementRegistry::GetName (m_uid); + std::string name = ElementRegistry::GetTypeName (m_uid); return name; } @@ -298,7 +298,7 @@ TraceContext::PrintAvailable (std::ostream &os, std::string separator) const do { currentUid = m_data->data[i]; uint8_t size = ElementRegistry::GetSize (currentUid); - os << ElementRegistry::GetName (currentUid); + os << ElementRegistry::GetTypeName (currentUid); i += 1 + size; if (i < m_data->size && currentUid != 0) { @@ -371,8 +371,8 @@ template class Ctx : public TraceContextElement { public: - static uint16_t GetUid (void) {static uint16_t uid = AllocateUid > (GetName ()); return uid;} - static std::string GetName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();} + static uint16_t GetUid (void) {static uint16_t uid = AllocateUid > (GetTypeName ()); return uid;} + static std::string GetTypeName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();} Ctx () : m_v (0) {} Ctx (int v) : m_v (v) {} void Print (std::ostream &os) {os << N;} diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 413478ad3..a66c43018 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -60,9 +60,9 @@ CsmaTraceType::GetUid (void) return uid; } std::string -CsmaTraceType::GetName (void) const +CsmaTraceType::GetTypeName (void) const { - return "CsmaTraceType"; + return "ns3::CsmaTraceType"; } diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index db850914e..45d384a0a 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -52,7 +52,7 @@ public: CsmaTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); - std::string GetName (void) const; + std::string GetTypeName (void) const; private: enum Type m_type; }; diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index cee375b53..71853b84c 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -54,9 +54,9 @@ PointToPointTraceType::GetUid (void) return uid; } std::string -PointToPointTraceType::GetName (void) const +PointToPointTraceType::GetTypeName (void) const { - return "PointToPointTraceType"; + return "ns3::PointToPointTraceType"; } diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 88544b7ed..88357136b 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -44,7 +44,7 @@ public: PointToPointTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); - std::string GetName (void) const; + std::string GetTypeName (void) const; }; /** diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 1409cad50..05200f6c2 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -88,9 +88,9 @@ Ipv4L3ProtocolTraceContextElement::GetUid (void) return uid; } std::string -Ipv4L3ProtocolTraceContextElement::GetName (void) const +Ipv4L3ProtocolTraceContextElement::GetTypeName (void) const { - return "Ipv4L3ProtocolTraceContextElement"; + return "ns3::Ipv4L3ProtocolTraceContextElement"; } @@ -117,9 +117,9 @@ Ipv4L3ProtocolInterfaceIndex::GetUid (void) return uid; } std::string -Ipv4L3ProtocolInterfaceIndex::GetName (void) const +Ipv4L3ProtocolInterfaceIndex::GetTypeName (void) const { - return "Ipv4L3ProtocolInterfaceIndex"; + return "ns3::Ipv4L3ProtocolInterfaceIndex"; } diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index f5e8aef04..0383e8d9a 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -59,7 +59,7 @@ public: bool IsDrop (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); - std::string GetName (void) const; + std::string GetTypeName (void) const; private: enum Type m_type; }; @@ -72,7 +72,7 @@ public: uint32_t Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); - std::string GetName (void) const; + std::string GetTypeName (void) const; private: uint32_t m_index; }; diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index a4d83d49b..122d32ab8 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -55,9 +55,9 @@ Ipv4L4ProtocolTraceContextElement::GetUid (void) return uid; } std::string -Ipv4L4ProtocolTraceContextElement::GetName (void) const +Ipv4L4ProtocolTraceContextElement::GetTypeName (void) const { - return "Ipv4L4ProtocolTraceContextElement"; + return "ns3::Ipv4L4ProtocolTraceContextElement"; } diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 40641485b..11ada2ca6 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -45,7 +45,7 @@ public: int Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); - std::string GetName (void) const; + std::string GetTypeName (void) const; private: int m_protocolNumber; }; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 9c3b27ce7..3a68bf584 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -51,9 +51,9 @@ NodeListIndex::Get (void) const return m_index; } std::string -NodeListIndex::GetName (void) const +NodeListIndex::GetTypeName (void) const { - return "NodeListIndex"; + return "ns3::NodeListIndex"; } diff --git a/src/node/node-list.h b/src/node/node-list.h index d256953c1..d423d82fc 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -40,7 +40,7 @@ public: void Print (std::ostream &os); static uint16_t GetUid (void); uint32_t Get (void) const; - std::string GetName (void) const; + std::string GetTypeName (void) const; private: uint32_t m_index; }; diff --git a/src/node/node.cc b/src/node/node.cc index ed56ca8d8..171af4e2d 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -53,9 +53,9 @@ NodeNetDeviceIndex::GetUid (void) return uid; } std::string -NodeNetDeviceIndex::GetName (void) const +NodeNetDeviceIndex::GetTypeName (void) const { - return "NodeNetDeviceIndex"; + return "ns3::NodeNetDeviceIndex"; } diff --git a/src/node/node.h b/src/node/node.h index 4f1c5be86..07739ec81 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -44,7 +44,7 @@ public: NodeNetDeviceIndex (uint32_t index); uint32_t Get (void) const; void Print (std::ostream &os) const; - std::string GetName (void) const; + std::string GetTypeName (void) const; static uint16_t GetUid (void); private: uint32_t m_index; diff --git a/src/node/queue.cc b/src/node/queue.cc index 2ebc6c0d1..8ed033b66 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -33,9 +33,9 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue", std::string -QueueTraceType::GetName (void) const +QueueTraceType::GetTypeName (void) const { - return "QueueTraceType"; + return "ns3::QueueTraceType"; } uint16_t QueueTraceType::GetUid (void) diff --git a/src/node/queue.h b/src/node/queue.h index 7b54f6e72..bfe0d009e 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -52,7 +52,7 @@ public: bool IsDequeue (void) const; bool IsDrop (void) const; void Print (std::ostream &os) const; - std::string GetName (void) const; + std::string GetTypeName (void) const; private: enum Type m_type; }; From c27d67b37cbe15414f9665beb6aa27495b92ee3c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 14:42:38 +0200 Subject: [PATCH 100/218] fix dox warnings --- src/core/composite-trace-resolver.h | 2 +- src/core/trace-source.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 2a96149ca..56886d739 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -95,7 +95,7 @@ public: /** * \param name the name of the array * \param begin an iterator which points to the first element of the array - * \param begin an iterator which points to the last element of the array + * \param end an iterator which points to the last element of the array * \param index an object which can store the index of an element in the * array. In practice, this object should support a constructor * whose single argument is an array index. diff --git a/src/core/trace-source.h b/src/core/trace-source.h index 9424b9086..2a90de2ee 100644 --- a/src/core/trace-source.h +++ b/src/core/trace-source.h @@ -36,7 +36,7 @@ public: virtual ~TraceSource () {} /** * \param callback the callback to connect to this trace source - * \param the context associated to the input callback which should be passed + * \param context the context associated to the input callback which should be passed * back to the user. */ virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; From 697a3aa2b42356703d9430426f7f35da0d8d46d4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 14:54:05 +0200 Subject: [PATCH 101/218] add doxygen for each TraceSourceElement subclass --- src/devices/csma/csma-net-device.cc | 5 +++++ src/devices/csma/csma-net-device.h | 7 +++++++ .../point-to-point/point-to-point-net-device.h | 3 +++ src/internet-node/ipv4-l3-protocol.h | 18 ++++++++++++++++++ src/internet-node/ipv4-l4-demux.h | 6 ++++++ src/node/node-list.h | 6 ++++++ src/node/node.h | 6 ++++++ src/node/queue.h | 12 ++++++++++++ 8 files changed, 63 insertions(+) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index a66c43018..6b5747581 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -64,6 +64,11 @@ CsmaTraceType::GetTypeName (void) const { return "ns3::CsmaTraceType"; } +enum CsmaTraceType::Type +CsmaTraceType::Get (void) const +{ + return m_type; +} CsmaNetDevice::CsmaNetDevice (Ptr node) diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 45d384a0a..713611a2a 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -41,6 +41,9 @@ namespace ns3 { class Queue; class CsmaChannel; +/** + * \brief hold in a TraceContext the type of trace source from a CsmaNetDevice + */ class CsmaTraceType : public TraceContextElement { public: @@ -53,6 +56,10 @@ public: void Print (std::ostream &os) const; static uint16_t GetUid (void); std::string GetTypeName (void) const; + /** + * \returns the type of the trace source which generated an event. + */ + enum Type Get (void) const; private: enum Type m_type; }; diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 88357136b..a5868bea4 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -38,6 +38,9 @@ namespace ns3 { class Queue; class PointToPointChannel; +/** + * \brief hold in a TraceContext the type of trace source from a PointToPointNetDevice + */ class PointToPointTraceType : public TraceContextElement { public: diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 0383e8d9a..8eb6dbe10 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -44,6 +44,9 @@ class Node; class TraceResolver; class TraceContext; +/** + * \brief hold in a TraceContext the type of trace source used by this Ipv4L3Protocol + */ class Ipv4L3ProtocolTraceContextElement : public TraceContextElement { public: @@ -54,8 +57,17 @@ public: }; Ipv4L3ProtocolTraceContextElement (); Ipv4L3ProtocolTraceContextElement (enum Type type); + /** + * \returns true if this is a tx event, false otherwise. + */ bool IsTx (void) const; + /** + * \returns true if this is a rx event, false otherwise. + */ bool IsRx (void) const; + /** + * \returns true if this is a drop event, false otherwise. + */ bool IsDrop (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); @@ -64,11 +76,17 @@ private: enum Type m_type; }; +/** + * \brief hold in a TraceContext the index of an Ipv4Interface within the ipv4 stack of a Node + */ class Ipv4L3ProtocolInterfaceIndex : public TraceContextElement { public: Ipv4L3ProtocolInterfaceIndex (); Ipv4L3ProtocolInterfaceIndex (uint32_t index); + /** + * \returns the index of the Ipv4Interface within a Node. + */ uint32_t Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 11ada2ca6..6e1208c13 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -37,11 +37,17 @@ class Node; class TraceResolver; class TraceContext; +/** + * \brief hold in a TraceContext the protocol number of a L4 Protocol + */ class Ipv4L4ProtocolTraceContextElement : public TraceContextElement { public: Ipv4L4ProtocolTraceContextElement (); Ipv4L4ProtocolTraceContextElement (int protocolNumber); + /** + * \returns the protocol number as registered in the Ipv4L4Demux. + */ int Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); diff --git a/src/node/node-list.h b/src/node/node-list.h index d423d82fc..4a6c113bf 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -32,6 +32,9 @@ class Node; class CallbackBase; class TraceResolver; +/** + * \brief hold in a TraceContext the index of a node within a NodeList. + */ class NodeListIndex : public TraceContextElement { public: @@ -39,6 +42,9 @@ public: NodeListIndex (uint32_t index); void Print (std::ostream &os); static uint16_t GetUid (void); + /** + * \returns the index of the node within the NodeList + */ uint32_t Get (void) const; std::string GetTypeName (void) const; private: diff --git a/src/node/node.h b/src/node/node.h index 07739ec81..cd032e2e0 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -37,11 +37,17 @@ class Packet; class Address; class CompositeTraceResolver; +/** + * \brief hold in a TraceContext the index of a NetDevice within a Node + */ class NodeNetDeviceIndex : public TraceContextElement { public: NodeNetDeviceIndex (); NodeNetDeviceIndex (uint32_t index); + /** + * \returns the index of the NetDevice within its container Node. + */ uint32_t Get (void) const; void Print (std::ostream &os) const; std::string GetTypeName (void) const; diff --git a/src/node/queue.h b/src/node/queue.h index bfe0d009e..b8531c9c7 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -37,6 +37,9 @@ namespace ns3 { class StringEnumDefaultValue; +/** + * \brief hold in a TraceContext the type of a trace source + */ class QueueTraceType : public TraceContextElement { public: @@ -48,8 +51,17 @@ public: static uint16_t GetUid (void); QueueTraceType (); QueueTraceType (enum Type type); + /** + * \returns true if this is an enqueue event, false otherwise. + */ bool IsEnqueue (void) const; + /** + * \returns true if this is a dequeue event, false otherwise. + */ bool IsDequeue (void) const; + /** + * \returns true if this is a drop event, false otherwise. + */ bool IsDrop (void) const; void Print (std::ostream &os) const; std::string GetTypeName (void) const; From bbdd4f2c422e45cc14c6399cddea3341ea19ff72 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 14:57:59 +0200 Subject: [PATCH 102/218] add explanatory diagram --- doc/namespace-2.dia | 1658 +++++++++++++++++++++++++++++++++++++++++++ doc/namespace-2.png | Bin 0 -> 32010 bytes 2 files changed, 1658 insertions(+) create mode 100644 doc/namespace-2.dia create mode 100644 doc/namespace-2.png diff --git a/doc/namespace-2.dia b/doc/namespace-2.dia new file mode 100644 index 000000000..5cd5ed59e --- /dev/null +++ b/doc/namespace-2.dia @@ -0,0 +1,1658 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/devices/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #NodeList# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Node# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/nodes/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/udp# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/netdevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/ipv4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/interfaces/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/enqueue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/dequeue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/drop# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InternetNode# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #PointToPointNetDevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Ipv4L3Protocol# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Ipv4Interface# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #CsmaNetDevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/enqueue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/dequeue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/drop# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/namespace-2.png b/doc/namespace-2.png new file mode 100644 index 0000000000000000000000000000000000000000..7ea379c82a853bc3bc9d41fa5d992a6e96457777 GIT binary patch literal 32010 zcmaI8bwE_#w+A|eA|NGQ64EV5OFAkgNJw{sgwi3PAR!6}(%mf~EhQj`bcZy8ba%hy z_jiBq#=H0NhYrj+GiR@}_gd={`@DOq_!tL^0tXs-6O z^pUc{zIM@6Zus}m((k@ZBoULAHd0USjpPOei7Eg7#qVO1i&7gzL_oZBVN&Ecs;3!k z=9061w0C^Gj$3Qdvz{2YmCR>Ge6t1rwJZw}R$2j~^_wC>QVGk3(@-r))~X2?MG^za zME3rX=Jd0?xA~aMPqVc6Liqi?P$gwK{EHCngjJ-ERDx-$Lht+eE^mB&@B-CR6-y80 zBi%w4a_U)LNe9A7($u%qaEV=cJ-9{65@8#pFiY-I@#W1k%v6+c%tvpyvNMeiP>8U@ zF%gJVQX~@s@me20?i=&rGHJj8!@_ibhO`EXBrkp(M94$R6ymjf?Y|$3$XXMz84FAj z!PLV>;FHl4F0kHXYU5*Bo-peSPSPJ4xNT-O<+Cr-8%J`++?$%(7aRMfhZKQ?k8wC` z$$u7OKZ*a91c?+&Pybb6nRdpnN_flT1C>?8D&jTW_HP4PM-%g2MeWKiY1Zwkmbb+X zYzO>j&+;i2vr4}gk(A38d&%pRv#~TbQ4QOi8sJ#go)8>s6eA)cJ_5pkg|bKQdE+j^^+kCb9)PO z+|c(06P2Ge_Wo38SDxo;6rcP0{^{>u*M(U3jiTc-BbnOAmo83+cX#4yO@AiUx>j6y z%&iVD_lkFR_Zr-$k&xipoQz^m3cTrlzR%ji+Xsnx}~ruyeQ zzbZ`Te~VVxC4F^RJW|a*cV8cCWL97q#N)+_zh|{XPU8oN}8sK zr+{e8MrU;Q`TYA`Zc)TGE?OC_1u?r?tl&%In6w8!x|7ayqb_vsyp!Uv|43*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r0qjyet)Ee&fvJWvT{6je58}o)!F%Uu-yE~levEc(^p3KcS?*7zy|}ScDX036DXtF z?+h-;{8df*&vFAeD&-G9aVw7<*@5>-#=_)yT&x&Rs5)WoFUTelCoAJ8;2F*U6oPjZd^ zXM`MPBfX3t)OrQY!Wav!0S0Kk!7*Ui&~Kdj0?}E6X7}guOKnr!VZmWTgWJN*{L^s2$E$kcD$^}5pkUl|4%rt zN6kh)YO2TgT>JV}LBfgZkAIZ5Q>`qMr`VMB`9uCynVZAm-q-GB`?|;E&VsOHvm`+0 wuI&{s%_$u$M9yKqMBviEzt`ck*yA&M=Z{p)CSJS-Mk}7Y^j)cUs0T0p2M?|CwEzGB literal 0 HcmV?d00001 From 16984a935c880da3a7eb09c902299500df2ba043 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 15:14:26 +0200 Subject: [PATCH 103/218] make sure that l4 protocols are correctly registered within the tracing namespace --- src/internet-node/ipv4-l4-demux.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 122d32ab8..ae4a09e42 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -90,11 +90,10 @@ Ipv4L4Demux::GetTraceResolver (void) const for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) { Ptr protocol = *i; - std::string protValue; - std::ostringstream oss (protValue); - oss << (*i)->GetProtocolNumber (); + std::ostringstream oss; + oss << (unsigned int) (*i)->GetProtocolNumber (); Ipv4L4ProtocolTraceContextElement protocolNumber = (*i)->GetProtocolNumber (); - resolver->AddComposite (protValue, protocol, protocolNumber); + resolver->AddComposite (oss.str (), protocol, protocolNumber); } resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; From 2b39df00d1265e98b4e158aa55132d02ddba7783 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 15:20:08 +0200 Subject: [PATCH 104/218] add missing const --- src/core/object.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index 6d4779c08..85f180cf0 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -356,7 +356,7 @@ public: void BaseGenerateTrace (int16_t v) { m_source = v; } virtual void Dispose (void) {} - virtual ns3::Ptr GetTraceResolver (void) + virtual ns3::Ptr GetTraceResolver (void) const { ns3::Ptr resolver = ns3::Create (); @@ -380,7 +380,7 @@ public: virtual void Dispose (void) { BaseA::Dispose (); } - virtual ns3::Ptr GetTraceResolver (void) + virtual ns3::Ptr GetTraceResolver (void) const { ns3::Ptr resolver = ns3::Create (); @@ -407,7 +407,7 @@ public: void BaseGenerateTrace (int16_t v) { m_source = v; } virtual void Dispose (void) {} - virtual ns3::Ptr GetTraceResolver (void) + virtual ns3::Ptr GetTraceResolver (void) const { ns3::Ptr resolver = ns3::Create (); @@ -431,7 +431,7 @@ public: virtual void Dispose (void) { BaseB::Dispose (); } - virtual ns3::Ptr GetTraceResolver (void) + virtual ns3::Ptr GetTraceResolver (void) const { ns3::Ptr resolver = ns3::Create (); From f789d6741feb7fa49a603739dd1b72c23c2e8b7d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 15:45:46 +0200 Subject: [PATCH 105/218] add section on TraceContexts in tutorial --- src/core/tracing.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/core/tracing.h b/src/core/tracing.h index 0612b144e..645a1dd26 100644 --- a/src/core/tracing.h +++ b/src/core/tracing.h @@ -100,6 +100,80 @@ * to figure out the arguments which a trace sink is required to receive * for each trace source. * + * Since there is no working magic here, defining a trace sink does not connect + * it directly to a set of trace sources. To connect a trace sink, a user must call + * ns3::NodeList::Connect. The second argument is a callback to the user's trace sink. + * That callback is easy to construct: call ns3::MakeCallback and you are done. The + * first argument is a string whose format is similar to a unix path and which is + * used to uniquely identify the set of trace sources you want to connect to. + * The set of acceptable path strings is also documented in the \ref TraceSourceList. + * + * So, what does this look like from the perspective of a user ? If we wanted to + * connect to a trace source defined somewhere deep into the a set of NetDevice objects + * located in some nodes of the system, we could write the following: + * \code + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet) + * { + * // for example, print the arguments + * std::cout << "packet: " << packet << std::endl; + * } + * // connect the above sink to a matching trace source + * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback &DoSomethingTraceSink); + * \endcode + * + * The connection path string "/nodes/* /devices/* /rx" matches the "rx" trace source + * located in every netdevice located in every node. The syntax of that path string + * is loosely based on regular expressions so, a user could conceivably connect + * to the trace sources present in only one node identified by node index: + * "/nodex/3/devices/* /rx". + * + * The matching algorithm used here is very useful since it allows you to connect + * at once a large set of trace sources to a single sink but it introduces another + * problem: it becomes impossible when you receive an event in your trace sink to + * know from _which_ trace source the event is coming from. In our example, the + * trace source might be coming from the NetDevice number 2 of Node 10 or Netdevice + * number 0 of Node 5. In both cases, you might need to know which of these NetDevice + * is generating this event, if only to generate some ascii trace dump. + * + * It turns out that there are many ways to get this information. The simplest + * way to get this information is to use the builtin printing facility of + * the TraceContext object: + * \code + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet) + * { + * // for example, print the arguments + * std::cout << "context=\"" << context << "\" packet: " << packet << std::endl; + * } + * \endcode + * The above code is going to generate output which looks like the following: + * \code + * context="nodeid=2 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * context="nodeid=1 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * ... + * \endcode + * + * Another more advanced way to get information out of a TraceContext is to call its + * ns3::TraceContext::GetElement method. This method takes as its first and only + * argument an instance of the object we want to read and the list of available + * object instances we can read from a TraceContext is documented, once again, + * in the \ref TraceSourceList. For example, we could write the following to + * generate adhoc trace output: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * NodeListIndex nodeIndex; + * NodeNetDeviceIndex deviceIndex; + * context.GetElement (nodeIndex); + * context.GetElement (deviceIndex); + * std::cout << "node-index=" << nodeIndex.Get (); + * std::cout << ", device-index=" << deviceIndex.Get (); + * std::cout << ", packet: " << packet; + * std::cout << std::endl; + * } + * \endcode + * * The hard part of this tracing framework is the "connection" step: there is a point * in the simulation scenario where the user is expected to specify which trace sources * should be connected to which trace sinks. There are many ways to do this: the From 980ee2d123423a70da2dddf02eb244dcfed6c85d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 16:00:26 +0200 Subject: [PATCH 106/218] start section on registering new TraceSource objects --- src/core/tracing.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/src/core/tracing.h b/src/core/tracing.h index 645a1dd26..259ba0903 100644 --- a/src/core/tracing.h +++ b/src/core/tracing.h @@ -55,6 +55,7 @@ * public: * void DoSomething (Packet packet, double value) * { + * // report this event on packet with value * m_doSomething (packet, value); * // do something * } @@ -174,6 +175,75 @@ * } * \endcode * + * Using existing trace sources to connect them to a set of adhoc trace sinks + * is not really complicated but, setting up new trace sources which can hook + * in this automatic connection system is a bit more complicated. + * + * So far, we know that a model author can generate trace events really easily: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet, double value) + * { + * // report this event on packet with value + * m_doSomething (packet, value); + * // do something + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * + * To make these new trace sources available to the rest of the connection system, + * the first step is to make sure that your model object derives from the ns3::Object + * base class either directly (as shown below) or indirectly through another base class: + * \code + * class MyModel : public Object {...}; + * // or: + * class SomeOtherObject : public Object {...}; + * class MyModel : public SomeOtherObject {...}; + * \endcode + * + * This is pretty trivial and lays the ground for the second step: overriding the + * ns3::Object::GetTraceResolver method: + * \code + * class MyModel : public MyParent + * { + * public: + * // declare overriden method + * virtual Ptr GetTraceResolver (void) const; + * private: + * // the new trace source to export. + * CallbackTraceSource m_rxSource; + * }; + * \endcode + * + * To implement this method, you could attempt to implement a new subclass of + * the ns3::TraceResolver base class and return an instance from this method but + * this would be very hard. Instead, you should use the helper class + * ns3::CompositeTraceResolver to register your trace sources and chain up to + * your parent: + * \code + * Ptr + * MyModel::GetTraceResolver (void) const + * { + * // create an empty trace resolver + * Ptr resolver = Create (); + * // register m_rxSource + * resolver->AddSource ("rx", // the name of the trace source in the path string + * TraceDoc ("some help text to explain the purpose of this trace source", + * "Packet", // the type of the first argument to the trace source + * "the purpose of the first argument", + * "type-of-second-argument", "purpose-of-second-argument"), + * m_rxSource // the trace source itself is registered); + * // make sure we include the trace sources implemented in the parent. + * resolver->SetParentResolver (MyParent::GetTraceResolver ()); + * return resolver; + * } + * \endcode + * * The hard part of this tracing framework is the "connection" step: there is a point * in the simulation scenario where the user is expected to specify which trace sources * should be connected to which trace sinks. There are many ways to do this: the From b45836e1af06ee367b79e74207ca93317fc1e102 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 16:38:26 +0200 Subject: [PATCH 107/218] add missing requirement to doxygen --- src/core/trace-context-element.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/trace-context-element.h b/src/core/trace-context-element.h index 2baa7e39f..aba7c2598 100644 --- a/src/core/trace-context-element.h +++ b/src/core/trace-context-element.h @@ -37,6 +37,8 @@ namespace ns3 { * This method takes a c++ output stream and argument and is * expected to write an ascii string describing its content * in this output stream. + * - a public GetTypeName method which returns the fully-qualified + * c++ type name of this subclass as a string. * * A typical subclass should look like this: * \code From fb5393ef7cca621aa1fa1ad0c804f90babcd8812 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 30 Aug 2007 16:38:41 +0200 Subject: [PATCH 108/218] finish trace tutorial --- src/core/tracing.h | 342 ++++++++++++++++++++------------------------- 1 file changed, 152 insertions(+), 190 deletions(-) diff --git a/src/core/tracing.h b/src/core/tracing.h index 259ba0903..3305195cb 100644 --- a/src/core/tracing.h +++ b/src/core/tracing.h @@ -237,213 +237,175 @@ * "Packet", // the type of the first argument to the trace source * "the purpose of the first argument", * "type-of-second-argument", "purpose-of-second-argument"), - * m_rxSource // the trace source itself is registered); + * m_rxSource // the trace source itself is registered + * ); * // make sure we include the trace sources implemented in the parent. * resolver->SetParentResolver (MyParent::GetTraceResolver ()); * return resolver; * } * \endcode * - * The hard part of this tracing framework is the "connection" step: there is a point - * in the simulation scenario where the user is expected to specify which trace sources - * should be connected to which trace sinks. There are many ways to do this: the - * users who want to could implement the "quick and dirty" way, that is, they could - * write adhoc code to connect their trace sinks to the trace sources using the - * TraceSource::AddCallback method. For example, they could patch their models to - * the following: + * Once you have written that code, you must make sure that this new method GetTraceResolver + * is going to be called at some point by the tracing system. If your model is located somewhere + * deep in MAC or PHY layer, that is, it is part of a NetDevice implementation, all you + * have to do is to make sure that your model is registered as a "composite" of your NetDevice + * subclass: * \code - * class MyModel + * class MyNetDevice : public NetDevice * { * public: - * void DoSomething (void) - * { + * Ptr GetTraceResolver (void) const; + * private: + * Ptr m_model; + * }; + * + * Ptr + * MyNetDevice::GetTraceResolver (void) const + * { + * Ptr resolver = ...; + * // register other trace source + * ... + * // register now your model as a "composite" + * resolver->AddComposite ("my-model", m_model); + * // chain up to parent. + * resolver->SetParentResolver (NetDevice::GetTraceResolver ()); + * return resolver; + * } + * \endcode + * + * The code above will make your "rx" trace source appear under the + * /nodes/xx/devices/xx/my-model/rx namespace path. + * + * The last important feature which model developers need to understand + * is how to provide extra TraceContext data to trace sinks. For example, + * if your model exports many trace sources, and if a single trace sink + * is connected to all these trace sources at the same time, it might need + * to know, for each event what its event source is. So, if you have a + * TX, a RX, and a DROP trace source: + * \code + * class MyModel + * { + * private: + * CallbackTraceSource m_rxSource; + * CallbackTraceSource m_txSource; + * CallbackTraceSource m_dropSource; + * }; + * \endcode + * You would like to allow your connected trace sinks to read their + * TraceContext for the type of source: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * MyModelTraceType type; + * context.GetElement (type); + * switch (type) { + * case MyModelTraceType::RX: + * std::cout << "drop" << std::endl; + * break; + * case MyModelTraceType::TX: + * std::cout << "drop" << std::endl; + * break; + * case MyModelTraceType::DROP: + * std::cout << "drop" << std::endl; + * break; + * } + * \endcode + * or, more simply: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * // context contains MyModelTraceType so, + * // it is going to print it + * std::cout << context << std::endl; + * } + * \endcode + * + * This kind of extra information is not generated magically: model + * authors must provide to the ns3::CompositeTraceResolver that + * per-source extra information during registration to allow the + * connection system to store it safely in the user's TraceContext objects. + * + * The first step to achieve this is to define and implement a new + * subclass of the ns3::TraceContextElement base class: + * \code + * class MyModelTraceType : public TraceContextElement + * { + * public: + * enum Type { + * RX, + * TX, + * DROP + * }; + * // called from MyModel::GetTraceResolver + * MyModelTraceType (enum Type type); + * // called from trace sink + * enum Type Get (void) const; + * // needed by the tracing subsystem + * static uint16_t GetUid (void); + * // needed by the tracing subsystem to + * // print the content of a TraceContext + * void Print (std::ostream &os) const; + * // needed by the tracing subsystem to + * // generate the doxygen documentation. + * std::string GetTypeName (void) const; + * private: + * enum Type m_type; + * }; + * \endcode + * The implementation is quite straightforward: + * \code + * MyModelTraceType::MyModelTraceType (enum Type type) + * : m_type (type) + * {} + * enum Type + * MyModelTraceType::Get (void) const + * { + * return m_type; + * } + * uint16_t + * MyModelTraceType::GetUid (void) + * { + * // use protected TraceContextElement::AllocateUid method + * static uint16_t uid = AllocateUid ("ns3::MyModelTraceType"); + * return uid; + * } + * void + * MyModelTraceType::Print (std::ostream &os) const + * ( + * switch (m_type) { + * case RX: os << "rx"; break; * // ... * } - * SVTraceSource *GetCwndTraceSource (void) const - * { - * return &m_cwnd; - * } - * private: - * // declare an instance of a "int" trace source - * SVTraceSource m_cwnd; - * }; - * \endcode - * And, then, call directly the GetCwndTraceSource method: - * \code - * CwndTraceSink (const TraceContext &context, int64_t oldValue, int64_t newValue) + * ) + * std::string + * MyModelTraceType::GetTypeName (void) const * { - * // for example, print the new value: - * std::cout << "cwnd=" << newValue << std::endl; + * return "ns3::MyModelTraceType"; * } - * // create a model instance - * MyModel *model = ...; - * SVTraceSource *cwnd = model->GetCwndTraceSource (); - * // connect the trace sink to the cwnd trace source of - * // this model instance. - * cwnd->AddCallback (MakeCallback (&CwndTraceSink), - * TraceContext ()); * \endcode - * - * The solution described above is simple to implement for a model - * author but it is hard to extend and becomes quickly cumbersome - * to use with complex models made of composite objects. TraceResolvers - * deal with these problems and offer a simple API to connect large - * sets of trace sources to a single sink (as is typical for simulations - * where users want to receive the "ipv4 rx" events from all nodes). * - * The user-visible API to connect and disconnect trace sources to - * and from trace sinks is quite small: ns3::Object::Connect - * and ns3::Object::Disconnect both take a "namespace" regexp string - * and a callback. The input callback is connected to each trace source - * which matches the namespace regexp string. The format of the namespace - * string depends on the set of models implemented by the simulator. - * The following diagram shows a small part of the namespace exported - * by the current version of the simulator: - * - * \image html namespace-2.png ns-3 namespace - * - * In this namespace, the "rx" trace source of the PointToPointNetdevice - * index 0 within node index 3 is uniquely identified by the namespace - * string "/nodes/3/devices/0/rx". It is also possible to match all - * such "rx" trace sources with a single namespace string using - * a limited form of regular expressions: "/nodes/3/devices/* /rx" - * identifies the "rx" trace source within all NetDevices within node - * index 3. Similarly, "/nodes/* /devices/* /rx" identifies the "rx" - * trace source within all NetDevices within all nodes. It is thus - * possible to connect a single trace sink to a set of matching trace - * sources in a single operation: + * Once this subclass is implemented, the work is almost completed: you + * just need to pass an instance of that class as the last argument of + * the ns3::CompositeTraceResolver::AddSource method as shown below: * \code - * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * Ptr + * MyModel::GetTraceResolver (void) const * { - * // context contains enough information to uniquely identify - * // the trace source instance. - * std::cout << "context: \"" << context << "\""; - * // packet is the per-event information conveyed from the - * // trace source to the trace sink. - * std:: cout << " packet: " << packet << std::endl; + * // create an empty trace resolver + * Ptr resolver = Create (); + * // register m_rxSource + * resolver->AddSource ("rx", // the name of the trace source in the path string + * TraceDoc ("some help text to explain the purpose of this trace source", + * "Packet", // the type of the first argument to the trace source + * "the purpose of the first argument", + * "type-of-second-argument", "purpose-of-second-argument"), + * m_rxSource, // the trace source itself is registered + * // the TraceContextElement associated to this trace source. + * MyModelTraceType (MyModelTraceType::RX) + * ); + * // make sure we include the trace sources implemented in the parent. + * resolver->SetParentResolver (MyParent::GetTraceResolver ()); + * return resolver; * } - * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback (&DeviceRxSink)); * \endcode - * Which, at runtime, is going to generate output looking like this: - * \code - * context: "nodeid=2 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... - * context: "nodeid=1 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... - * ... - * \endcode - * In the example above, we see that the ns3::TraceContext contains three - * ns3::TraceContextElement which were printed using a space separator: - * - nodeid=i - * - device=j - * - dev-rx - * - * Of course, the user could also extract each of these elements from - * the context to generate a different output: - * \code - * void DeviceRxSink (const TraceContext &context, const Packet &packet) - * { - * NodeListIndex nodeIndex; - * NodeNetDeviceIndex deviceIndex; - * context.Get (nodeIndex); - * context.Get (deviceIndex); - * std::cout << "node-index=" << nodeIndex.Get (); - * std::cout << ", device-index=" << deviceIndex.Get (); - * std::cout << ", packet: " << packet; - * std::cout << std::endl; - * } - * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback (&DeviceRxSink)); - * \endcode - * Extracting TraceContextElement objects from a TraceContext in this manner - * raises a few obvious questions: - * - how do I know which trace context elements are present in a given - * TraceContext ? - * - how are these elements added to the TraceContext ? - * - * - * - * - * Connecting trace sinks to a set of existing trace sources is nice but - * model developers also often need to be able to create new trace sources - * and hook them into the namespace resolution system. Creating new trace - * sources is pretty easy: it is a matter of instantiating a proper - * subclass of the ns3::TraceSource base class. However, hooking each - * new trace source in the overall namespace resolution system requires - * some new effort. The core requirement is that the user needs to - * subclass from the ns3::Object base class which provides the most - * basic ns3::Object::Connect, and, ns3::Object::Disconnect methods. - * These two methods are simple forwarding methods to the virtual - * ns3::Object::GetTraceResolver method which does the bulk of the work - * required to setup properly trace sources. - * - * Every subclass of the ns3::Object base class which wishes to export - * a set of trace sources and make them available through the Connect/Disconnect - * functions needs to override the ns3::Object::GetTraceResolver method. - * This method needs to return a subclass of the ns3::TraceResolver - * base class which implements the ns3::TraceResolver::Connect and - * ns3::TraceResolver::Disconnect methods. Providing an implementation - * of these two methods is a bit complicated so, a default implementation - * named CompositeTraceResolver is provided: - * \code - * class MyModel : public Object - * { - * public: - * void DoSomething (void) - * { - * // change value of m_cwnd - * } - * protected: - * virtual Ptr GetTraceResolver (void) - * { - * // create the composite resolver - * Ptr resolver = Create (); - * resolver->AddSource ("cwnd", m_cwnd); - * resolver->AddSource ("rx", m_rx); - * return resolver; - * } - * private: - * SVTraceSource m_cwnd; - * CallbackTraceSource m_rx; - * }; - * void MyTraceSink (const TraceContext &context, Packet packet) - * { - * std::cout << context << " packet: " << packet << std::endl; - * } - * object->Connect ("/.../rx", MakeCallback (&MyTraceSink)); - * \endcode - * - * The above example is enough to export a trace source as a member of the - * tracing namespace so, it would be enough to allow a user to perform a - * pair of Connect/Disconnect operations but it would not be enough to allow - * a TraceContext to contain information about these trace sources. Specifically, - * printing the content of the TraceContext as shown above would give no - * information whatsoever about the type of trace source which was connected. - * - * but it is not enough to allow the TraceContext - * stored in each TraceSource to store information about these trace sources. - * - * - A trace source: a trace source is an object instance which is a - * subclass of the ns3::TraceSource base class. Each instance - * of a trace source should be used to report a single type of - * event. For example, if you want to report ipv4 rx and tx events, - * you should use two different trace source instances. - * - * - Trace sinks: a trace sink is a callback, that is, a function, - * which is provided by the user of a model to receive the events - * reported by a set of trace sources within that model. A trace - * sink is said to be "connected" once it has been associated - * to a set of trace sources. - * - * - Trace context: each trace source instance is associated with a single - * instance of an immutable trace context. Each ns3::TraceContext stores - * a set of trace context element instances, each of which is a subclass - * of the ns3::TraceContextElement base class. Whenever a trace sink - * provided by a user is called because a trace event was reported on - * a connected trace source, the trace context associated to the - * relevant trace source is passed as an extra argument to the user's - * trace sink. - * - * - instrumentation of models is done through a set of trace source - * instances, each of which is a subclass of the ns3::TraceSource - * base class. - * - * */ From 8f13030ade41bc02cc4526bf2acc5711f4e0b10c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sat, 8 Sep 2007 19:24:39 +0100 Subject: [PATCH 109/218] WAF: as suggested by George, add a bunch of helper waf scripts that call the toplevel waf script, so that it is possible to compile with ./waf from emacs regardless of which buffer you are visiting (the other alternative is to install waf system wide and run 'waf'. --- .hgignore | 2 -- examples/waf | 1 + samples/waf | 1 + src/applications/waf | 1 + src/common/waf | 1 + src/core/waf | 1 + src/devices/csma/waf | 1 + src/devices/point-to-point/waf | 1 + src/internet-node/waf | 1 + src/mobility/waf | 1 + src/node/waf | 1 + src/routing/global-routing/waf | 1 + src/simulator/waf | 1 + utils/waf | 1 + 14 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 examples/waf create mode 100755 samples/waf create mode 100755 src/applications/waf create mode 100755 src/common/waf create mode 100755 src/core/waf create mode 100755 src/devices/csma/waf create mode 100755 src/devices/point-to-point/waf create mode 100755 src/internet-node/waf create mode 100755 src/mobility/waf create mode 100755 src/node/waf create mode 100755 src/routing/global-routing/waf create mode 100755 src/simulator/waf create mode 100755 utils/waf diff --git a/.hgignore b/.hgignore index 96ea69ce7..d5b25104e 100644 --- a/.hgignore +++ b/.hgignore @@ -7,5 +7,3 @@ build doc/html.* doc/latex.* .lock-wscript -.waf* -waf diff --git a/examples/waf b/examples/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/examples/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/samples/waf b/samples/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/samples/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/src/applications/waf b/src/applications/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/applications/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/common/waf b/src/common/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/common/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/core/waf b/src/core/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/core/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/devices/csma/waf b/src/devices/csma/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/devices/csma/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/devices/point-to-point/waf b/src/devices/point-to-point/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/devices/point-to-point/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/internet-node/waf b/src/internet-node/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/internet-node/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/mobility/waf b/src/mobility/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/mobility/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/node/waf b/src/node/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/node/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/routing/global-routing/waf b/src/routing/global-routing/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/routing/global-routing/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/simulator/waf b/src/simulator/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/simulator/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/utils/waf b/utils/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/utils/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" From ff4a26f2c3bb7fe974c6f3b2bd825c532eb8f412 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 3 Sep 2007 14:55:51 -0700 Subject: [PATCH 110/218] Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function --- src/node/ipv4.cc | 47 ++++++++++ src/node/ipv4.h | 14 +++ .../global-route-manager-impl.cc | 93 ++----------------- .../global-route-manager-impl.h | 4 +- 4 files changed, 69 insertions(+), 89 deletions(-) diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index f99675e25..9578d4c8a 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -18,6 +18,9 @@ * * Author: Mathieu Lacage */ + +#include "ns3/assert.h" +#include "ns3/node.h" #include "ipv4.h" namespace ns3 { @@ -32,4 +35,48 @@ Ipv4::Ipv4 () Ipv4::~Ipv4 () {} +uint32_t +GetIfIndexByIpv4Address (Ptr node, Ipv4Address a, Ipv4Mask amask) +{ + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + NS_ASSERT_MSG (ipv4, "GetIfIndexByIpv4Address: No Ipv4 interface"); + for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) + { + if (ipv4->GetAddress (i).CombineMask(amask) == a.CombineMask(amask) ) + { + return i; + } + } + // Mapping not found + NS_ASSERT_MSG (false, "GetIfIndexByIpv4Address failed"); + return 0; +} + +bool +GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, + Ipv4Address a, Ipv4Mask amask) +{ + Ipv4Route tempRoute; + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + NS_ASSERT_MSG (ipv4, "GetIpv4RouteToDestination: No Ipv4 interface"); + for (uint32_t i = 0; i < ipv4->GetNRoutes (); i++) + { + tempRoute = ipv4->GetRoute (i); + // Host route found + if ( tempRoute.IsNetwork () == false && tempRoute.GetDest () == a ) + { + route = tempRoute; + return true; + } + else if ( tempRoute.IsNetwork () && + tempRoute.GetDestNetwork () == a.CombineMask(amask) ) + { + route = tempRoute; + return true; + } + } + return false; +} + + } // namespace ns3 diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 76d88faea..dc5e146bd 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -29,6 +29,7 @@ namespace ns3 { +class Node; class NetDevice; class Packet; class Ipv4Route; @@ -273,6 +274,19 @@ public: }; +/** + * Convenience functions (Doxygen still needed) + * + * Return the ifIndex corresponding to the Ipv4Address provided. + */ +uint32_t GetIfIndexByIpv4Address (Ptr node, + Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + +bool GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, + Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + } // namespace ns3 #endif /* IPV4_H */ diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 42c63b9b9..c2b7021c9 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1088,83 +1088,10 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) m_spfroot = 0; } -// -// XXX This should probably be a method on Ipv4 -// -// Return the interface index corresponding to a given IP address -// - uint32_t -GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a) -{ -// -// We have an IP address and a vertex ID of the root of the SPF tree. -// The question is what interface index does this address correspond to. -// The answer is a little complicated since we have to find a pointer to -// the node corresponding to the vertex ID, find the Ipv4 interface on that -// node in order to iterate the interfaces and find the one corresponding to -// the address in question. -// - Ipv4Address routerId = m_spfroot->GetVertexId (); -// -// Walk the list of nodes in the system looking for the one corresponding to -// the node at the root of the SPF tree. This is the node for which we are -// building the routing table. -// - NodeList::Iterator i = NodeList::Begin (); - for (; i != NodeList::End (); i++) - { - Ptr node = *i; - - Ptr rtr = - node->QueryInterface (GlobalRouter::iid); -// -// If the node doesn't have a GlobalRouter interface it can't be the one -// we're interested in. -// - if (rtr == 0) - { - continue; - } - - if (rtr->GetRouterId () == routerId) - { -// -// This is the node we're building the routing table for. We're going to need -// the Ipv4 interface to look for the ipv4 interface index. Since this node -// is participating in routing IP version 4 packets, it certainly must have -// an Ipv4 interface. -// - Ptr ipv4 = node->QueryInterface (Ipv4::iid); - NS_ASSERT_MSG (ipv4, - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "QI for interface failed"); -// -// Look through the interfaces on this node for one that has the IP address -// we're looking for. If we find one, return the corresponding interface -// index. -// - for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) - { - if (ipv4->GetAddress (i) == a) - { - NS_DEBUG ( - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "Interface match for " << a); - return i; - } - } - } - } -// -// Couldn't find it. -// - return 0; -} - -// -// XXX This should probably be a method on Ipv4 // // Return the interface index corresponding to a given IP address +// This is a wrapper around GetIfIndexByIpv4Address(), but we first +// have to find the right node pointer to pass to that function. // uint32_t GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) @@ -1216,17 +1143,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) // we're looking for. If we find one, return the corresponding interface // index. // - for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) - { - if (ipv4->GetAddress (i).CombineMask(amask) == - a.CombineMask(amask) ) - { - NS_DEBUG ( - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "Interface match for " << a); - return i; - } - } + return (GetIfIndexByIpv4Address (node, a, amask) ); } } // @@ -1693,6 +1610,9 @@ GlobalRouteManagerImplTest::RunTests (void) srm->DebugSPFCalculate (lsa0->GetLinkStateId ()); // node n0 Simulator::Run (); + +// XXX here we should do some verification of the routes built + Simulator::Destroy (); // This delete clears the srm, which deletes the LSDB, which clears @@ -1703,7 +1623,6 @@ GlobalRouteManagerImplTest::RunTests (void) } // Instantiate this class for the unit tests -// XXX here we should do some verification of the routes built static GlobalRouteManagerImplTest g_globalRouteManagerTest; } // namespace ns3 diff --git a/src/routing/global-routing/global-route-manager-impl.h b/src/routing/global-routing/global-route-manager-impl.h index 739e20592..923caf400 100644 --- a/src/routing/global-routing/global-route-manager-impl.h +++ b/src/routing/global-routing/global-route-manager-impl.h @@ -754,8 +754,8 @@ private: GlobalRoutingLinkRecord* prev_link); void SPFIntraAddRouter (SPFVertex* v); void SPFIntraAddTransit (SPFVertex* v); - uint32_t FindOutgoingInterfaceId (Ipv4Address a); - uint32_t FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask); + uint32_t FindOutgoingInterfaceId (Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); }; } // namespace ns3 From e8f289a7053d6ab1b12f169c4330cb7940be66d8 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 3 Sep 2007 23:32:23 -0700 Subject: [PATCH 111/218] Fold the two patches for bu6 69 together, building on the bug 65 patch --- src/internet-node/ipv4-end-point.cc | 7 ++++ src/internet-node/ipv4-end-point.h | 1 + src/internet-node/udp-socket.cc | 65 +++++++++++++++++++++++++---- src/internet-node/udp-socket.h | 1 + src/node/ipv4.cc | 5 +++ src/node/socket.h | 1 + 6 files changed, 71 insertions(+), 9 deletions(-) diff --git a/src/internet-node/ipv4-end-point.cc b/src/internet-node/ipv4-end-point.cc index 69faf523e..42cb45e37 100644 --- a/src/internet-node/ipv4-end-point.cc +++ b/src/internet-node/ipv4-end-point.cc @@ -42,6 +42,13 @@ Ipv4EndPoint::GetLocalAddress (void) { return m_localAddr; } + +void +Ipv4EndPoint::SetLocalAddress (Ipv4Address address) +{ + m_localAddr = address; +} + uint16_t Ipv4EndPoint::GetLocalPort (void) { diff --git a/src/internet-node/ipv4-end-point.h b/src/internet-node/ipv4-end-point.h index f606aa63b..dfd0e6c57 100644 --- a/src/internet-node/ipv4-end-point.h +++ b/src/internet-node/ipv4-end-point.h @@ -37,6 +37,7 @@ public: ~Ipv4EndPoint (); Ipv4Address GetLocalAddress (void); + void SetLocalAddress (Ipv4Address address); uint16_t GetLocalPort (void); Ipv4Address GetPeerAddress (void); uint16_t GetPeerPort (void); diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index a2bde3224..a9b063a2c 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -20,6 +20,8 @@ */ #include "ns3/node.h" #include "ns3/inet-socket-address.h" +#include "ns3/ipv4-route.h" +#include "ns3/ipv4.h" #include "udp-socket.h" #include "udp-l4-protocol.h" #include "ipv4-end-point.h" @@ -147,13 +149,25 @@ UdpSocket::Close(void) int UdpSocket::Connect(const Address & address) { + Ipv4Route routeToDest; InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); m_defaultPort = transport.GetPort (); + if (m_defaultAddress.IsBroadcast () ) + { + NS_ASSERT_MSG(false, "UdpSocket::Connect, can't connect to broadcast"); + } NotifyConnectionSucceeded (); m_connected = true; + if (GetIpv4RouteToDestination (m_node, routeToDest, m_defaultAddress) ) + { + uint32_t localIfIndex = routeToDest.GetInterface (); + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + m_endPoint->SetLocalAddress (ipv4->GetAddress(localIfIndex) ); + } return 0; } + int UdpSocket::Send (const Packet &p) { @@ -162,8 +176,33 @@ UdpSocket::Send (const Packet &p) m_errno = ERROR_NOTCONN; return -1; } - return DoSendTo (p, m_defaultAddress, m_defaultPort); + return DoSend (p); } + +int +UdpSocket::DoSend (const Packet &p) +{ + if (m_endPoint == 0) + { + if (Bind () == -1) + { + NS_ASSERT (m_endPoint == 0); + return -1; + } + NS_ASSERT (m_endPoint != 0); + } + if (m_shutdownSend) + { + m_errno = ERROR_SHUTDOWN; + return -1; + } + m_udp->Send (p, m_endPoint->GetLocalAddress (), m_defaultAddress, + m_endPoint->GetLocalPort (), m_defaultPort); + NotifyDataSent (p.GetSize ()); + return 0; +} + + int UdpSocket::DoSendTo (const Packet &p, const Address &address) { @@ -173,7 +212,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) return DoSendTo (p, ipv4, port); } int -UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) +UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) { if (m_endPoint == 0) { @@ -189,19 +228,27 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) m_errno = ERROR_SHUTDOWN; return -1; } - m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, + Ipv4Route routeToDest; + if (GetIpv4RouteToDestination (m_node, routeToDest, dest) ) + { + uint32_t localIfIndex = routeToDest.GetInterface (); + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + m_udp->Send (p, ipv4->GetAddress (localIfIndex), dest, m_endPoint->GetLocalPort (), port); - NotifyDataSent (p.GetSize ()); + NotifyDataSent (p.GetSize ()); + return 0; + } + else + { + m_errno = ERROR_NOROUTETOHOST; + return -1; + } return 0; } + int UdpSocket::SendTo(const Address &address, const Packet &p) { - if (m_connected) - { - m_errno = ERROR_ISCONN; - return -1; - } InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index b3674f7ef..332e679d7 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -62,6 +62,7 @@ private: int FinishBind (void); void ForwardUp (const Packet &p, Ipv4Address ipv4, uint16_t port); void Destroy (void); + int DoSend (const Packet &p); int DoSendTo (const Packet &p, const Address &daddr); int DoSendTo (const Packet &p, Ipv4Address daddr, uint16_t dport); diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index 9578d4c8a..d7c83d42a 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -74,6 +74,11 @@ GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, route = tempRoute; return true; } + else if ( tempRoute.IsDefault () ) + { + route = tempRoute; + return true; + } } return false; } diff --git a/src/node/socket.h b/src/node/socket.h index c717ec0a5..fb62fdca3 100644 --- a/src/node/socket.h +++ b/src/node/socket.h @@ -58,6 +58,7 @@ public: ERROR_AFNOSUPPORT, ERROR_INVAL, ERROR_BADF, + ERROR_NOROUTETOHOST, SOCKET_ERRNO_LAST }; From 1f4fd58674a17f3379b8bd25964c607aa6289f5f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 4 Sep 2007 15:34:04 +0200 Subject: [PATCH 112/218] move tracing tutorial to doc directory --HG-- rename : src/core/tracing.h => doc/tracing.h --- doc/doxygen.conf | 2 +- {src/core => doc}/tracing.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {src/core => doc}/tracing.h (100%) diff --git a/doc/doxygen.conf b/doc/doxygen.conf index 6f4b503d7..ac0f72a0e 100644 --- a/doc/doxygen.conf +++ b/doc/doxygen.conf @@ -450,7 +450,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src doc/main.txt doc/trace-source-list.h +INPUT = src doc/main.txt doc/trace-source-list.h doc/tracing.h # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/src/core/tracing.h b/doc/tracing.h similarity index 100% rename from src/core/tracing.h rename to doc/tracing.h From 9b75e7987b6456b8ef4149b2d654764fe42f877a Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 4 Sep 2007 14:38:40 -0700 Subject: [PATCH 113/218] piles of doxygen, changes to SetDefaultMulticastRoute plumbing --- src/internet-node/ipv4-impl.cc | 8 +- src/internet-node/ipv4-impl.h | 4 +- src/internet-node/ipv4-l3-protocol.cc | 13 +- src/internet-node/ipv4-l3-protocol.h | 5 +- src/internet-node/ipv4-static-routing.cc | 19 +- src/internet-node/ipv4-static-routing.h | 373 ++++++++++++++++++++++- src/node/ipv4.h | 67 ++-- 7 files changed, 435 insertions(+), 54 deletions(-) diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index 0b557eeaf..b105d5a41 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -106,13 +106,9 @@ Ipv4Impl::AddMulticastRoute (Ipv4Address origin, } void -Ipv4Impl::SetDefaultMulticastRoute (Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces) +Ipv4Impl::SetDefaultMulticastRoute (uint32_t outputInterface) { - m_ipv4->SetDefaultMulticastRoute (origin, group, inputInterface, - outputInterfaces); + m_ipv4->SetDefaultMulticastRoute (outputInterface); } uint32_t diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index 8848c9f7e..ab17c16f4 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -62,9 +62,7 @@ public: uint32_t inputInterface, std::vector outputInterfaces); - virtual void SetDefaultMulticastRoute (Ipv4Address origin, - Ipv4Address group, uint32_t inputInterface, - std::vector outputInterfaces); + virtual void SetDefaultMulticastRoute (uint32_t outputInterface); virtual uint32_t GetNMulticastRoutes (void) const; virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index b45046783..d93d97459 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -356,17 +356,12 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, } void -Ipv4L3Protocol::SetDefaultMulticastRoute ( - Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces) +Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface) { - NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << origin << ", " << - group << ", " << inputInterface << ", " << &outputInterfaces << ")"); + NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << outputInterface << + ")"); - m_staticRouting->SetDefaultMulticastRoute (origin, group, inputInterface, - outputInterfaces); + m_staticRouting->SetDefaultMulticastRoute (outputInterface); } uint32_t diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index b93a2be5d..fdc2456f5 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -163,10 +163,7 @@ public: uint32_t inputInterface, std::vector outputInterfaces); - void SetDefaultMulticastRoute (Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces); + void SetDefaultMulticastRoute (uint32_t onputInterface); uint32_t GetNMulticastRoutes (void) const; Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index 37790a79a..d584ce0c3 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -101,15 +101,19 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, } void -Ipv4StaticRouting::SetDefaultMulticastRoute( - Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces) +Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) { + Ipv4Address origin = Ipv4Address::GetAny (); + Ipv4Address group = Ipv4Address::GetAny (); + uint32_t inputInterface = Ipv4RoutingProtocol::IF_INDEX_ANY; + + std::vector outputInterfaces (1); + outputInterfaces[0] = outputInterface; + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, inputInterface, outputInterfaces); + delete m_defaultMulticastRoute; m_defaultMulticastRoute = route; } @@ -177,7 +181,7 @@ Ipv4StaticRouting::GetDefaultMulticastRoute () const return 0; } -void +bool Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, Ipv4Address group, uint32_t inputInterface) @@ -196,9 +200,10 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, { delete *i; m_multicastRoutes.erase (i); - return; + return true; } } + return false; } void diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 8b0420f27..76c028c2a 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -45,57 +45,418 @@ class TraceResolver; class TraceContext; +/** + * @brief Static routing protocol for IP version 4 stacks. + * + * In ns-3 we have the concept of a pluggable routing protocol. Routing + * protocols are added to a list maintained by the Ipv4L3Protocol. Every + * stack gets one routing protocol for free -- the Ipv4StaticRouting routing + * protocol is added in the constructor of the Ipv4L3Protocol (this is the + * piece of code that implements the functionality of the IP layer). + * + * The Ipv4StaticRouting class inherits from the abstract base class + * Ipv4RoutingProtocol that defines the interface methods that a routing + * protocol must support. + * + * When a packet arrives in the Ipv4L3Protocol for transmission, it comes + * either from a local source via Ipv4L3Protocol::Send or from a remote + * source via Ipv4L3Protocol::Forwarding. In both cases, a function is called + * (Ipv4L3Protocol::Lookup) to look up the routing information for the packet. + * + * The lookup function iterates through the list of routing protocols asking + * each to see if it can find a route and send the packet. A callback is + * provided during each of these calls that should be considered a pre- + * packaged send call. This is done to allow asynchronous calls into + * routing subsystems in order to support on-demand routing, for example. The + * method for requesting this operation is Ipv4StaticRouting::RequestRoute for + * the static routing protocol. + * + * Each routing protocol is also free to implement its own methods for managing + * routes which you will find below. This class manages a set of "static" or + * manually configured routes for host, network and multicast routes. + * + * @see Ipv4RoutingProtocol + * @see Ipv4L3Protocol::AddRoutingProtocol + * @see Ipv4L3Protocol::Ipv4L3Protocol + */ class Ipv4StaticRouting : public Ipv4RoutingProtocol { - public: +/** + * @brief Construct an empty Ipv4StaticRouting routing protocol, + * @internal + * + * The Ipv4StaticRouting class supports host, network and multicast routes. + * This method initializes the lists containing these routes to empty. + * + * @see Ipv4StaticRouting + */ Ipv4StaticRouting (); +/** + * @brief Request that a check for a route bw performed and if a route is found + * that the packet be sent on its way using the pre-packaged send callback. + * + * The source and destination IP addresses for the packet in question are found + * in the provided Ipv4Header. There are two major processing forks depending + * on the type of destination address. + * + * If the destination address is unicast then the routing table is consulted + * for a route to the destination and if it is found, the routeReply callback + * is executed to send the packet (with the found route). + * + * If the destination address is a multicast, then the exact processing steps + * depend on whether or not the packet has been sourced locally. This is + * determined by the parameter ifIndex. This is the interface index over which + * this packet was received. If the packet has not been received over a + * network interface, this index will be set to + * Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number). In that case, + * we want to avoid the requirement that an explicit route out of each node + * must be set, so we don't do anything here. + * + * If the packet is a multicast destination and has been received over a + * network interface, a call to this method implies that the packet is being + * forwarded. In that case, there must be an explicit route out of the node. + * A multicast route references the source address, the destination address + * (the multicast group) and the input interface in order to find a route. + * We consult the multicast routing table and, if a route is found, send the + * packet out of as many interfaces as required using the provided callback + * (think of it as a pre-packaged send call). + * + * @param ifIndex The network interface index over which the packed was + * received. If the packet is from a local source, ifIndex will be set to + * Ipv4RoutingProtocol::IF_INDEX_ANY. + * @param ipHeader the Ipv4Header containing the source and destination IP + * addresses for the packet. + * @param packet The packet to be sent if a route is found. + * @param routeReply A callback that packaged up the call to actually send the + * packet. + * @return Returns true if a route is found and the packet has been sent, + * otherwise returns false indicating that the next routing protocol should + * be consulted. In practice, the static routing protocol is the last chance + * protocol. + * + * @see Ipv4StaticRouting + * @see Ipv4RoutingProtocol + */ virtual bool RequestRoute (uint32_t ifIndex, Ipv4Header const &ipHeader, Packet packet, RouteReplyCallback routeReply); +/** + * @brief Check to see if we can determine the interface index that will be + * used if a packet is sent to this destination. + * + * This method addresses a problem in the IP stack where a destination address + * must be present and checksummed into the IP header before the actual + * interface over which the packet is sent can be determined. The answer is + * to implement a known and intentional cross-layer violation. This is the + * endpoint of a call chain that started up quite high in the stack (sockets) + * and has found its way down to the Ipv4L3Protocol which is consulting the + * routing protocols for what they would do if presented with a packet of the + * given destination. + * + * Note that the a single interface index is returned. This means that if + * the destination address is a multicast, and an explicit route is present + * that includeds multiple output interfaces, that route cannot be used. + * + * If there are multiple paths out of the node, the resolution is performed + * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more + * contextual information that is useful for making a determination. + * + * @param destination The Ipv4Address if the destination of a hypothetical + * packet. This may be a multicast group address. + * @param ifIndex A reference to the interface index over which a packet + * sent to this destination would be sent. + * @return Returns true if a route is found to the destination that involves + * a single output interface index, otherwise returns false indicating that + * the next routing protocol should be consulted. In practice, the static + * routing protocol is the last chance protocol. + * + * @see Ipv4StaticRouting + * @see Ipv4RoutingProtocol + * @see Ipv4L3Protocol + */ virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); +/** + * @brief Add a host route to the static routing table. + * + * @param dest The Ipv4Address destination for this route. + * @param nextHop The Ipv4Address of the next hop in the route. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface); +/** + * @brief Add a host route to the static routing table. + * + * @param dest The Ipv4Address destination for this route. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddHostRouteTo (Ipv4Address dest, uint32_t interface); +/** + * @brief Add a network route to the static routing table. + * + * @param network The Ipv4Address network for this route. + * @param networkmask The Ipv4Mask to extract the network. + * @param nextHop The next hop in the route to the destination network. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface); + +/** + * @brief Add a network route to the static routing table. + * + * @param network The Ipv4Address network for this route. + * @param networkmask The Ipv4Mask to extract the network. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface); + +/** + * @brief Add a default route to the static routing table. + * + * This method tells the routing system what to do in the case where a specific + * route to a destination is not found. The system forwards packets to the + * specified node in the hope that it knows better how to route the packet. + * + * If the default route is set, it is returned as the selected route from + * LookupStatic irrespective of destination address if no specific route is + * found. + * + * @param nextHop The Ipv4Address to send packets to in the hope that they + * will be forwarded correctly. + * @param interface The network interface index used to send packets. + * + * @see Ipv4Address + * @see Ipv4StaticRouting::Lookup + */ void SetDefaultRoute (Ipv4Address nextHop, uint32_t interface); + +/** + * @brief Get the number of individual unicast routes that have been added + * to the routing table. + * + * @warning The default route counts as one of the routes. + */ uint32_t GetNRoutes (void); + +/** + * @brief Get the default route from the static routing table. + * + * @return If the default route is set, a pointer to that Ipv4Route is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4Route + */ Ipv4Route *GetDefaultRoute (void); + +/** + * @brief Get a route from the static unicast routing table. + * + * Externally, the unicast static routing table appears simply as a table with + * n entries. The one sublety of note is that if a default route has been set + * it will appear as the zeroth entry in the table. This means that if you + * add only a default route, the table will have one entry that can be accessed + * either by explicity calling GetDefaultRoute () or by calling GetRoute (0). + * + * Similarly, if the default route has been set, calling RemoveRoute (0) will + * remove the default route. + * + * @param i The index (into the routing table) of the route to retrieve. If + * the default route has been set, it will occupy index zero. + * @return If route is set, a pointer to that Ipv4Route is returned, otherwise + * a zero pointer is returned. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::RemoveRoute + */ Ipv4Route *GetRoute (uint32_t i); + +/** + * @brief Remove a route from the static unicast routing table. + * + * Externally, the unicast static routing table appears simply as a table with + * n entries. The one sublety of note is that if a default route has been set + * it will appear as the zeroth entry in the table. This means that if the + * default route has been set, calling RemoveRoute (0) will remove the + * default route. + * + * @param i The index (into the routing table) of the route to remove. If + * the default route has been set, it will occupy index zero. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ void RemoveRoute (uint32_t i); +/** + * @brief Add a multicast route to the static routing table. + * + * A multicast route must specify an origin IP address -- the address of the + * node that originates packets destined for a given multicast group. This + * address may be Ipv4Address::GetAny (typically 0.0.0.0) if the multicast + * group is open, or it may specify a single IP address if the multicast + * group is closed. The route must also specify the multicast group address. + * + * For each route, the input nework interface must be specified. For + * forwarding operations, this is the interface index that you expect multicast + * packets to arrive over. If you want to specify routes off of a local node + * for given multicast groups, this index may be set to + * Ipv4RoutingProtocol::IF_INDEX_ANY. + * + * For each route, a vector of output network interfaces must also be + * specified. When the RequestRoute operation is performed, copies of a + * packet are sent out all of the specified interfaces. + * + * @param origin The Ipv4Address of the origin of packets for this route. May + * be Ipv4Address:GetAny for open groups. + * @param group The Ipv4Address of the multicast group or this route. + * @param inputInterface The input network interface index over which to + * expect packets destined for this route. May be + * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. + * @param outputInterface A vector of network interface indices used to specify + * how to send packets to the destination(s). + * + * @see Ipv4Address + */ void AddMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface, std::vector outputInterfaces); - void SetDefaultMulticastRoute (Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces); +/** + * @brief Add a default multicast route to the static routing table. + * + * This is the multicast equivalent of the unicast version SetDefaultRoute. + * We tell the routing system what to do in the case where a specific route + * to a destination multicast group is not found. The system forwards + * packets out the specified interface in the hope that "something out there" + * knows better how to route the packet. + * + * Since we're basically forwarding packets to some entity we think may know + * better what to do, we don't pay attention to subleties like origin address + * and input interface, nor do we worry about forwarding out multiple + * interfaces. If the default multicast route is set, it is returned as the + * selected route from LookupStatic irrespective of origin, multicast group or + * input interface if another specific route is not found. + * + * @param outputInterface The network interface index used to specify where + * to send packets in the case of unknown routes. + * + * @see Ipv4Address + */ + void SetDefaultMulticastRoute (uint32_t outputInterface); +/** + * @brief Get the number of individual multicast routes that have been added + * to the routing table. + * + * @warning The default multicast route counts as one of the routes. + */ uint32_t GetNMulticastRoutes (void) const; + +/** + * @brief Get a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default route has + * been set it will appear as the zeroth entry in the table. This means that + * if you add only a default route, the table will have one entry that can be + * accessed either by explicity calling GetDefaultMulticastRoute () or by + * calling GetMulticastRoute (0). + * + * Similarly, if the default route has been set, calling + * RemoveMulticastRoute (0) will remove the default route. + * + * @param i The index (into the routing table) of the multicast route to + * retrieve. If the default route has been set, it will occupy index zero. + * @return If route is set, a pointer to that Ipv4MulticastRoute is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4MulticastRoute + * @see Ipv4StaticRouting::RemoveRoute + */ Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + +/** + * @brief Get the default multicast route from the static routing table. + * + * @return If the default route is set, a pointer to that Ipv4MulticastRoute is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4Route + */ Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; - void RemoveMulticastRoute (Ipv4Address origin, +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that the default route may be removed by calling this method with + * appropriate wildcard parameters. + * + * This method causes the multicast routing table to be searched for the first + * route that matches the parameters and removes it. + * + * @param origin The IP address specified as the origin of packets for the + * route. + * @param origin The IP address specified as the multicast group addres of + * the route. + * @param inputInterfade The network interface index specified as the expected + * input interface for the route. + * @returns True if a route was found and removed, false otherwise. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ + bool RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface); +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that if the default route has been set, calling + * RemoveMulticastRoute (0) will remove the default route. + * + * @param index The index (into the multicast routing table) of the route to + * remove. If the default route has been set, it will occupy index zero. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ void RemoveMulticastRoute (uint32_t index); protected: diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 7d386a493..ff46fc268 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -104,14 +104,38 @@ public: const Ipv4Header &ipHeader, Packet packet, RouteReplyCallback routeReply) = 0; - /** - * \brief Synchronously request the interface index that will be used to - * send a packet to a hypothetical destination. - * - * \param destination IP address of a hypothetical destination packet - * \param ifIndex Reference to interface index. - * \returns True if the protocol has a route, false otherwise. - */ +/** + * \brief Synchronously check to see if we can determine the interface index + * that will be used if a packet is sent to this destination. + * + * This method addresses a problem in the IP stack where a destination address + * must be present and checksummed into the IP header before the actual + * interface over which the packet is sent can be determined. The answer is + * to implement a known and intentional cross-layer violation. This is the + * endpoint of a call chain that started up quite high in the stack (sockets) + * and has found its way down to the Ipv4L3Protocol which is consulting the + * routing protocols for what they would do if presented with a packet of the + * given destination. + * + * Note that the a single interface index is returned. This means that if + * the destination address is a multicast, and an explicit route is present + * that includeds multiple output interfaces, that route cannot be used. + * + * If there are multiple paths out of the node, the resolution is performed + * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more + * contextual information that is useful for making a determination. + * + * \param destination The Ipv4Address if the destination of a hypothetical + * packet. This may be a multicast group address. + * \param ifIndex A reference to the interface index over which a packet + * sent to this destination would be sent. + * \return Returns true if a route is found to the destination that involves + * a single output interface index, otherwise false. + * + * \see Ipv4StaticRouting + * \see Ipv4RoutingProtocol + * \see Ipv4L3Protocol + */ virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) = 0; @@ -207,11 +231,13 @@ public: * \returns the number of entries in the routing table. */ virtual uint32_t GetNRoutes (void) = 0; + /** * \param i index of route to return * \returns the route whose index is i */ virtual Ipv4Route GetRoute (uint32_t i) = 0; + /** * \param i index of route to remove from routing table. */ @@ -244,18 +270,13 @@ public: uint32_t inputInterface) = 0; /** - * \brief Set the default static multicast route for a given multicast - * source and group. + * \brief Set the default static multicast route. * - * \param origin The Ipv4 address of the multicast source. - * \param group The multicast group address. - * \param inputInterface The interface index over which the packet arrived. - * \param outputInterfaces The list of output interface indices over which - * the packet should be sent (excluding the inputInterface). + * \param outputInterface The network output interface index over which + * packets without specific routes should be sent. */ - virtual void SetDefaultMulticastRoute (Ipv4Address origin, - Ipv4Address group, uint32_t inputInterface, - std::vector outputInterfaces) = 0; + virtual void SetDefaultMulticastRoute (uint32_t outputInterface) = 0; + /** * \returns the number of entries in the multicast routing table. */ @@ -282,6 +303,7 @@ public: * make sure that it is never used during packet forwarding. */ virtual uint32_t AddInterface (Ptr device) = 0; + /** * \returns the number of interfaces added by the user. */ @@ -346,39 +368,46 @@ public: * \param address address to associate to the underlying ipv4 interface */ virtual void SetAddress (uint32_t i, Ipv4Address address) = 0; + /** * \param i index of ipv4 interface * \param mask mask to associate to the underlying ipv4 interface */ virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask) = 0; + /** * \param i index of ipv4 interface * \returns the mask associated to the underlying ipv4 interface */ virtual Ipv4Mask GetNetworkMask (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * \returns the address associated to the underlying ipv4 interface */ virtual Ipv4Address GetAddress (uint32_t i) const = 0; + /** * \param destination The IP address of a hypothetical destination. * \returns The IP address assigned to the interface that will be used * if we were to send a packet to destination. */ virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; + /** * \param i index of ipv4 interface * \returns the Maximum Transmission Unit (in bytes) associated * to the underlying ipv4 interface */ virtual uint16_t GetMtu (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * \returns true if the underlying interface is in the "up" state, * false otherwise. */ virtual bool IsUp (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * @@ -386,6 +415,7 @@ public: * considered valid during ipv4 forwarding. */ virtual void SetUp (uint32_t i) = 0; + /** * \param i index of ipv4 interface * @@ -393,7 +423,6 @@ public: * ignored during ipv4 forwarding. */ virtual void SetDown (uint32_t i) = 0; - }; } // namespace ns3 From 01e2206286ce68c7bd2ef49e4c843fba5280bce3 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 4 Sep 2007 15:10:47 -0700 Subject: [PATCH 114/218] Don't flood multicasts if no route found --- src/internet-node/ipv4-l3-protocol.cc | 34 +++++++++++++-------------- src/node/ipv4-route.cc | 17 ++++++++++++++ src/node/ipv4-route.h | 14 +++++++++++ 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index d93d97459..80fefecfe 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -284,29 +284,29 @@ Ipv4L3Protocol::Lookup ( NS_DEBUG ("Ipv4L3Protocol::Lookup (): " "Multicast destination with local source"); // -// We have a multicast packet originating from the current node. We didn't -// want to force users to construct a route in order to get packets out of a -// node, so there will have been no route found and it is left to us to send -// the packet. What we'll do is to send the multicast out all of the -// interfaces on this node. Note that we start with interface 1 since we -// don't particularly want to send the packet out the loopback. +// We have a multicast packet originating from the current node and were not +// able to send it using the usual RequestRoute process. Since the usual +// process includes trying to use a default multicast route, this means that +// there was no specific route out of the node found, and there was no default +// multicast route set. // - NS_DEBUG ("Ipv4StaticRouting::Lookup (): " - "Local source. Flooding multicast packet"); +// The fallback position is to look for a default unicast route and use that +// to get the packet off the node if we have one. +// + Ipv4Route *route = m_staticRouting->GetDefaultRoute (); - for (uint32_t i = 1; i < GetNInterfaces (); ++i) + if (route) { - Packet p = packet; - Ipv4Header h = ipHeader; - Ipv4Route route = - Ipv4Route::CreateHostRouteTo(h.GetDestination (), i); NS_DEBUG ("Ipv4StaticRouting::Lookup (): " - "Send via interface " << i); - routeReply (true, route, p, h); + "Local source. Using unicast default route for multicast packet"); + + routeReply (true, *route, packet, ipHeader); + return; } - return; } - // No route found +// +// No route found +// routeReply (false, Ipv4Route (), packet, ipHeader); } diff --git a/src/node/ipv4-route.cc b/src/node/ipv4-route.cc index 9d6a2286b..1c56c972e 100644 --- a/src/node/ipv4-route.cc +++ b/src/node/ipv4-route.cc @@ -30,6 +30,7 @@ namespace ns3 { Ipv4Route::Ipv4Route () {} + Ipv4Route::Ipv4Route (Ipv4Route const &route) : m_dest (route.m_dest), m_destNetworkMask (route.m_destNetworkMask), @@ -37,6 +38,13 @@ Ipv4Route::Ipv4Route (Ipv4Route const &route) m_interface (route.m_interface) {} +Ipv4Route::Ipv4Route (Ipv4Route const *route) + : m_dest (route->m_dest), + m_destNetworkMask (route->m_destNetworkMask), + m_gateway (route->m_gateway), + m_interface (route->m_interface) +{} + Ipv4Route::Ipv4Route (Ipv4Address dest, Ipv4Address gateway, uint32_t interface) @@ -236,6 +244,15 @@ Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const &route) { } +Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const *route) +: + m_origin (route->m_origin), + m_group (route->m_group), + m_inputInterface (route->m_inputInterface), + m_outputInterfaces (route->m_outputInterfaces) +{ +} + Ipv4MulticastRoute::Ipv4MulticastRoute ( Ipv4Address origin, Ipv4Address group, diff --git a/src/node/ipv4-route.h b/src/node/ipv4-route.h index f80a1ae00..933e3534e 100644 --- a/src/node/ipv4-route.h +++ b/src/node/ipv4-route.h @@ -37,12 +37,19 @@ public: * \brief This constructor does nothing */ Ipv4Route (); + /** * \brief Copy Constructor * \param route The route to copy */ Ipv4Route (Ipv4Route const &route); + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4Route (Ipv4Route const *route); + bool IsHost (void) const; /** * \return The IPv4 address of the destination of this route @@ -108,12 +115,19 @@ public: * \brief This constructor does nothing */ Ipv4MulticastRoute (); + /** * \brief Copy Constructor * \param route The route to copy */ Ipv4MulticastRoute (Ipv4MulticastRoute const &route); + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4MulticastRoute (Ipv4MulticastRoute const *route); + /** * \return The IPv4 address of the source of this route */ From a216cf1624fd63b41acf89c2f0d62d2a55d87753 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 4 Sep 2007 18:06:06 -0700 Subject: [PATCH 115/218] clarify use of wildcards in multicast routes versus default mulicast routes. --- examples/csma-multicast.cc | 39 +++++++- src/internet-node/ipv4-static-routing.cc | 110 ++++++++++++++++------- src/internet-node/ipv4-static-routing.h | 50 +++++++---- 3 files changed, 150 insertions(+), 49 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 504c4fc26..9b964abec 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -221,8 +221,8 @@ main (int argc, char *argv[]) Ptr ipv4; ipv4 = n2->QueryInterface (Ipv4::iid); - uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr(n2Lan0Addr); - uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr(n2Lan1Addr); + uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr); + uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr); // // Now, we need to do is to call the AddMulticastRoute () method on node // two's Ipv4 interface and tell it that whenever it receives a packet on @@ -238,6 +238,41 @@ main (int argc, char *argv[]) ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexLan0, outputInterfaces); // +// We need to specify how the source node handles multicasting. There are a +// number of ways we can deal with this, we just need to pick one. The first +// method is to add an explicit route out of the source node, just as we did +// for the forwarding node. Use this method when you want to send packets out +// multiple interfaces or send packets out different interfaces based on the +// differing multicast groups. Since the source is local, there will be no +// input interface over which packets are received, so use +// Ipv4RoutingProtocol::IF_INDEX_ANY as a wildcard. +// +// A second way is to specify a multicast route using wildcards. If you +// want to send multicasts out differing sets of interfaces based on the +// multicast group, you can use AddMulticastRoute () but specify the origin +// as a wildcard. If you want all multicasts to go out a single set of +// interfaces, you can make both the origin and group a wildcard. +// +// If you have a simple system, where the source has a single interface, this +// can be done via the SetDefaultMulticastRoute () method on the Ipv4 +// interface. This tells the system to send all multicasts out a single +// specified network interface index. +// +// A last way is to specify a (or use an existing) default unicast route. The +// multicast routing code uses the unicast default route as a multicast "route +// of last resort." this method for is also on Ipv4 and is called +// SetDefaultRoute (). +// +// Since this is a simple multicast example, we use the +// SetDefaultMulticastRoute () approach. We are going to first need the +// Ipv4 interface for node 0 which is the multicast source. We use this +// interface to find the output interface index, and tell node zero to send +// its multicast traffic out that interface. +// + ipv4 = n0->QueryInterface (Ipv4::iid); + uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource); + ipv4->SetDefaultMulticastRoute (ifIndexSrc); +// // As described above, node four will be the only node listening for the // multicast data. To enable forwarding bits up the protocol stack, we need // to tell the stack to join the multicast group. diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index d584ce0c3..c181dde29 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -289,14 +289,27 @@ Ipv4StaticRouting::LookupStatic ( Ipv4Address group, uint32_t ifIndex) { +// +// We treat the "any" address (typically 0.0.0.0) as a wildcard in our matching +// scheme. +// + Ipv4Address wildcard = Ipv4Address::GetAny (); + for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) { Ipv4MulticastRoute *route = *i; - if ( (origin == route->GetOrigin () || - origin == Ipv4Address::GetAny ()) && - group == route->GetGroup ()) +// +// We've been passed an origin address, a multicast group address and an +// interface index. We have to decide if the current route in the list is +// a match. +// +// The first case is the restrictive case where the origin, group and index +// matches. This picks up exact routes during forwarded and exact routes from +// the local node (in which case the ifIndex is a wildcard). +// + if (origin == route->GetOrigin () && group == route->GetGroup ()) { if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || ifIndex == route->GetInputInterface ()) @@ -305,7 +318,67 @@ Ipv4StaticRouting::LookupStatic ( } } } +// +// If the input interface index is not a wildcard (that means that the packet +// did not originally come from this node), we're done. We don't +// just happily forward packets we don't really know what to do with. +// Multicast storms are not generally considered a good thing. +// + if (ifIndex != Ipv4RoutingProtocol::IF_INDEX_ANY) + { + return 0; + } +// +// Now, we're going to get a litle less restricive. This only applies in the +// case where the packet in question is coming from the local node. In order +// to avoid dependencies on the order in which routes were added, we will +// actually walk the list two more times, the first time looking for routes +// with a single wildcard, and the last time looking for the first route +// with two wildcards. +// + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; +// +// Here we will ignore the origin. We know that a single source address must +// be picked for a packet, but we may want to send multicast packets out +// multiple interfaces. To support this case, a user would need to add +// a Multicast route with the route's origin set to wildcard. N.B As a +// result, packets sourced from a node with multiple interface may have a +// source IP address different from that of the interface actually used to +// send the packet. +// + if (route->GetOrigin () == wildcard && group == route->GetGroup ()) + { + return *i; + } + } +// +// Finally we want to allow users to specify a default route that specifies +// sending all multicast packets out multiple interfaces. The standard +// default multicast route is patterned after other systems and limits the +// number of outputs to one. If, however a client manually adds a multicast +// route with the origin, the multicast group and the input interface index +// all set to wildcard, she has created a default route with multiple output +// interfaces. +// + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; + if (route->GetOrigin () == wildcard && route->GetGroup () == wildcard) + { + return *i; + } + } +// +// We also allow users to specify a typical default multicast route. This +// default route is limited to specifying a single output interface. +// if (m_defaultMulticastRoute != 0) { return m_defaultMulticastRoute; @@ -445,33 +518,7 @@ Ipv4StaticRouting::RequestRoute ( if (ipHeader.GetDestination ().IsMulticast ()) { NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); -// -// We have a multicast packet we're going to send. There are two distinct -// cases we need to support. The first is if the current node is the source -// of the packet. In that case, we don't want to have to consult multicast -// routing tables (nor build them) in order to send multicasts. The interface -// index (ifIndex) is Ipv4RoutingProtocol::IF_INDEX_ANY if we're the source. -// -// The second case is if the current packet has gotten to us by being -// received over one of our interfaces. In this case, ifIndex is set to the -// index over which we received the packet. For these packets, we need to -// consult the multicast routing table for a disposition. -// -// So, first let's see if we're the source. In this case, we don't consult -// the routing tables, but just return false and let the caller (up in -// ipv4-l3-protocol) flood the multicast packet out of all of its interfaces. -// We can't really do it here even if we wanted to since we have no easy way -// to get to the Ipv4 interface which we would need. -// - if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) - { - return false; - } -// -// If we fall through to this point, we have a multicast packet that has -// not originated at this node. We need to deal with forwarding. Let's -// see if we have a route, and if so go ahead and forward this puppy. -// + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), ipHeader.GetDestination (), ifIndex); @@ -479,6 +526,7 @@ Ipv4StaticRouting::RequestRoute ( { NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " "Multicast route found"); + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) { Packet p = packet; @@ -495,7 +543,7 @@ Ipv4StaticRouting::RequestRoute ( return false; // Let other routing protocols try to handle this } // -// See if this is a unicast packet we have a route for. +// This is a unicast packet. Check to see if we have a route for it. // NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 76c028c2a..c7bf1a652 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -317,21 +317,34 @@ public: /** * @brief Add a multicast route to the static routing table. * - * A multicast route must specify an origin IP address -- the address of the - * node that originates packets destined for a given multicast group. This - * address may be Ipv4Address::GetAny (typically 0.0.0.0) if the multicast - * group is open, or it may specify a single IP address if the multicast - * group is closed. The route must also specify the multicast group address. + * A multicast route must specify an origin IP address, a multicast group and + * an input network interface index as conditions and provide a vector of + * output network interface indices over which packets matching the conditions + * are sent. * - * For each route, the input nework interface must be specified. For - * forwarding operations, this is the interface index that you expect multicast - * packets to arrive over. If you want to specify routes off of a local node - * for given multicast groups, this index may be set to - * Ipv4RoutingProtocol::IF_INDEX_ANY. + * Typically there are two main types of multicast routes: routes of the + * first kind are used during forwarding. All of the conditions must be + * exlicitly provided. The second kind of routes are used to get packets off + * of a local node. The difference is in the input interface. Routes for + * forwarding will always have an explicit input interface specified. Routes + * off of a node will always set the input interface to a wildcard specified + * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. * - * For each route, a vector of output network interfaces must also be - * specified. When the RequestRoute operation is performed, copies of a - * packet are sent out all of the specified interfaces. + * For routes off of a local node wildcards may be used in the origin and + * multicast group addresses. The wildcard used for Ipv4Adresses is that + * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage + * of a wildcard allows one to specify default behavior to varying degrees. + * + * For example, making the origin address a wildcard, but leaving the + * multicast group specific allows one (in the case of a node with multiple + * interfaces) to create different routes using different output interfaces + * for each multicast group. + * + * If the origin and multicast addresses are made wildcards, you have created + * essentially a default multicast address that can forward to multiple + * interfaces. Compare this to the actual default multicast address that is + * limited to specifying a single output interface for compatibility with + * existing functionality in other systems. * * @param origin The Ipv4Address of the origin of packets for this route. May * be Ipv4Address:GetAny for open groups. @@ -425,6 +438,12 @@ public: * This method causes the multicast routing table to be searched for the first * route that matches the parameters and removes it. * + * Wildcards may be provided to this function, but the wildcards are used to + * exacly match wildcards in the routes (see AddMulticastRoute). That is, + * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not + * remove routes with any address in the origin, but will only remove routes + * with "0.0.0.0" set as the the origin. + * * @param origin The IP address specified as the origin of packets for the * route. * @param origin The IP address specified as the multicast group addres of @@ -433,9 +452,8 @@ public: * input interface for the route. * @returns True if a route was found and removed, false otherwise. * - * @see Ipv4Route - * @see Ipv4StaticRouting::GetRoute - * @see Ipv4StaticRouting::AddRoute + * @see Ipv4MulticastRoute + * @see Ipv4StaticRouting::AddMulticastRoute */ bool RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, From 97df9062eff8b9132de3a19818d8a3a5d181ca4c Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 4 Sep 2007 21:26:54 -0700 Subject: [PATCH 116/218] Fix for bug69: set local address correctly upon UDP connect; apply correct UDP connect() semantics (that sendto cannot override addresses on a connected socket); if destination is IPv4 limited broadcast address, convert to subnet-directed broadcast and send out on each interface; provide example csma-broadcast.cc script --- examples/csma-broadcast.cc | 159 ++++++++++++++++++++++++ examples/wscript | 4 + src/internet-node/arp-ipv4-interface.cc | 5 +- src/internet-node/udp-socket.cc | 46 ++++--- src/node/ipv4-address.cc | 17 +++ src/node/ipv4-address.h | 14 +++ 6 files changed, 229 insertions(+), 16 deletions(-) create mode 100644 examples/csma-broadcast.cc diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc new file mode 100644 index 000000000..1cb9faa75 --- /dev/null +++ b/examples/csma-broadcast.cc @@ -0,0 +1,159 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// +// Example of the sending of a datagram to a broadcast address +// +// Network topology +// ============== +// | | +// n0 n1 n2 +// | | +// ========== +// +// n0 originates UDP broadcast to 255.255.255.255, which is replicated +// and received on both n1 and n2 + +#include +#include +#include +#include + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/random-variable.h" +#include "ns3/debug.h" + +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" + +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/eui48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/onoff-application.h" + + +using namespace ns3; + + +int main (int argc, char *argv[]) +{ + + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this +#if 0 + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("PacketSocket"); +#endif + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, + // and what the queue limit is + + // The below Bind command tells the queue factory which class to + // instantiate, when the queue factory is invoked in the topology code + DefaultValue::Bind ("Queue", "DropTailQueue"); + + // Allow the user to override any of the defaults and the above + // Bind()s at run-time, via command-line arguments + CommandLine::Parse (argc, argv); + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + + // We create the channels first without any IP addressing information + Ptr channel0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + // We create the channels first without any IP addressing information + Ptr channel1 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, + Eui48Address("10:54:23:54:0:50")); + uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel1, + Eui48Address("10:54:23:54:0:51")); + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, + Eui48Address("10:54:23:54:23:51")); + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel1, + Eui48Address("10:54:23:54:23:52")); + + // Later, we add IP addresses. + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex0, Ipv4Address("10.1.0.1"), Ipv4Mask("255.255.0.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n1, n1ifIndex, Ipv4Address("10.1.0.2"), Ipv4Mask("255.255.0.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex1, Ipv4Address("192.168.1.1"), Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n2, n2ifIndex, Ipv4Address("192.168.1.2"), Ipv4Mask("255.255.255.0")); + + // Create the OnOff application to send UDP datagrams of size + // 210 bytes at a rate of 448 Kb/s + // from n0 to n1 + Ptr ooff = Create ( + n0, + InetSocketAddress ("255.255.255.255", 80), + "Udp", + ConstantVariable(1), + ConstantVariable(0)); + // Start the application + ooff->Start(Seconds(1.0)); + ooff->Stop (Seconds(10.0)); + + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-broadcast.tr file + AsciiTrace asciitrace ("csma-broadcast.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); + + // Also configure some tcpdump traces; each interface will be traced + // The output files will be named + // simple-point-to-point.pcap-- + // and can be read by the "tcpdump -r" command (use "-tt" option to + // display timestamps correctly) + PcapTrace pcaptrace ("csma-broadcast.pcap"); + pcaptrace.TraceAllIp (); + + Simulator::Run (); + + Simulator::Destroy (); +} diff --git a/examples/wscript b/examples/wscript index e5e771555..56c8797b6 100644 --- a/examples/wscript +++ b/examples/wscript @@ -14,6 +14,10 @@ def build(bld): ['csma', 'internet-node']) obj.source = 'csma-one-subnet.cc' + obj = bld.create_ns3_program('csma-broadcast', + ['csma', 'internet-node']) + obj.source = 'csma-broadcast.cc' + obj = bld.create_ns3_program('csma-packet-socket', ['csma', 'internet-node']) obj.source = 'csma-packet-socket.cc' diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index efe767531..17960c3f7 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -62,8 +62,9 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); Address hardwareDestination; bool found; - - if (dest.IsBroadcast ()) + + if (dest.IsBroadcast () || + dest.IsSubnetDirectedBroadcast (GetNetworkMask ()) ) { hardwareDestination = GetDevice ()->GetBroadcast (); found = true; diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index a9b063a2c..39fd39ddb 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -153,10 +153,6 @@ UdpSocket::Connect(const Address & address) InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); m_defaultPort = transport.GetPort (); - if (m_defaultAddress.IsBroadcast () ) - { - NS_ASSERT_MSG(false, "UdpSocket::Connect, can't connect to broadcast"); - } NotifyConnectionSucceeded (); m_connected = true; if (GetIpv4RouteToDestination (m_node, routeToDest, m_defaultAddress) ) @@ -196,24 +192,31 @@ UdpSocket::DoSend (const Packet &p) m_errno = ERROR_SHUTDOWN; return -1; } - m_udp->Send (p, m_endPoint->GetLocalAddress (), m_defaultAddress, - m_endPoint->GetLocalPort (), m_defaultPort); - NotifyDataSent (p.GetSize ()); - return 0; + + return DoSendTo (p, m_defaultAddress, m_defaultPort); } int UdpSocket::DoSendTo (const Packet &p, const Address &address) { - InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); - Ipv4Address ipv4 = transport.GetIpv4 (); - uint16_t port = transport.GetPort (); - return DoSendTo (p, ipv4, port); + if (!m_connected) + { + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + Ipv4Address ipv4 = transport.GetIpv4 (); + uint16_t port = transport.GetPort (); + return DoSendTo (p, ipv4, port); + } + else + { + // connected UDP socket must use default addresses + return DoSendTo (p, m_defaultAddress, m_defaultPort); + } } int UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) { + Ipv4Route routeToDest; if (m_endPoint == 0) { if (Bind () == -1) @@ -228,8 +231,23 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) m_errno = ERROR_SHUTDOWN; return -1; } - Ipv4Route routeToDest; - if (GetIpv4RouteToDestination (m_node, routeToDest, dest) ) + // + // If dest is sent to the limited broadcast address (all ones), + // convert it to send a copy of the packet out of every interface + // + if (dest.IsBroadcast ()) + { + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) + { + Ipv4Address addri = ipv4->GetAddress (i); + Ipv4Mask maski = ipv4->GetNetworkMask (i); + m_udp->Send (p, addri, addri.GetSubnetDirectedBroadcast (maski), + m_endPoint->GetLocalPort (), port); + NotifyDataSent (p.GetSize ()); + } + } + else if (GetIpv4RouteToDestination (m_node, routeToDest, dest) ) { uint32_t localIfIndex = routeToDest.GetInterface (); Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); diff --git a/src/node/ipv4-address.cc b/src/node/ipv4-address.cc index 4e1e344c5..0b0a48f29 100644 --- a/src/node/ipv4-address.cc +++ b/src/node/ipv4-address.cc @@ -99,6 +99,11 @@ Ipv4Mask::SetHostOrder (uint32_t value) { m_mask = value; } +uint32_t +Ipv4Mask::GetInverse (void) const +{ + return ~m_mask; +} void Ipv4Mask::Print (std::ostream &os) const @@ -162,6 +167,18 @@ Ipv4Address::CombineMask (Ipv4Mask const &mask) const return Ipv4Address (GetHostOrder () & mask.GetHostOrder ()); } +Ipv4Address +Ipv4Address::GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const +{ + return Ipv4Address (GetHostOrder () | mask.GetInverse ()); +} + +bool +Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const +{ + return ( (GetHostOrder () | mask.GetInverse ()) == GetHostOrder () ); +} + bool Ipv4Address::IsBroadcast (void) const { diff --git a/src/node/ipv4-address.h b/src/node/ipv4-address.h index 6589edcf9..f473b57c0 100644 --- a/src/node/ipv4-address.h +++ b/src/node/ipv4-address.h @@ -119,6 +119,16 @@ public: * \param mask a network mask */ Ipv4Address CombineMask (Ipv4Mask const &mask) const; + /** + * \brief Generate subnet-directed broadcast address corresponding to mask + * + * The subnet-directed broadcast address has the host bits set to all + * ones. + * + * \param mask a network mask + */ + Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const; + bool IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const; static bool IsMatchingType (const Address &address); operator Address (); @@ -151,6 +161,10 @@ public: */ uint32_t GetHostOrder (void) const; void SetHostOrder (uint32_t value); + /** + * \brief Return the inverse mask in host order. + */ + uint32_t GetInverse (void) const; void Print (std::ostream &os) const; From a7a83451952ddaa87655cda594698fdf6d71b632 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 5 Sep 2007 12:08:57 +0200 Subject: [PATCH 117/218] re-organize the tutorial and use sections --- doc/tracing.h | 194 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 157 insertions(+), 37 deletions(-) diff --git a/doc/tracing.h b/doc/tracing.h index 3305195cb..720e9a334 100644 --- a/doc/tracing.h +++ b/doc/tracing.h @@ -19,6 +19,8 @@ * - A trace resolver is an object which allows users to establish * connections between a set of trace sources and a set of trace sinks. * + * \section TraceSource Generating Trace Events + * * So, what does it look like in practice ? First, let's look at trace * sources. We have two types of trace sources: numeric, and, normal * trace sources. Numeric trace sources behave as normal c++ integers @@ -53,15 +55,15 @@ * class MyModel * { * public: - * void DoSomething (Packet packet, double value) + * void DoSomething (Packet packet) * { - * // report this event on packet with value - * m_doSomething (packet, value); + * // report this event on packet + * m_doSomething (packet); * // do something * } * private: * // report every "something" function call. - * CallbackTraceSource m_doSomething; + * CallbackTraceSource m_doSomething; * }; * \endcode * Every type of trace source derives from the ns3::TraceSource base class. @@ -69,6 +71,8 @@ * ns3::CallbackTraceSource, ns3::SvTraceSource, ns3::UvTraceSource, and, * ns3::FvTraceSource. * + * \section TraceSink Receiving Trace Events + * * To receive these trace events, a user should specify a set of trace sinks. * For example, to receive the "int" and the "something" events shown in the * examples above, a user would declare the following functions: @@ -82,10 +86,10 @@ * std::cout << "cwnd=" << newValue << std::endl; * } * void - * DoSomethingTraceSink (const TraceContext &context, Packet packet, double value) + * DoSomethingTraceSink (const TraceContext &context, Packet packet) * { * // for example, print the arguments - * std::cout << "value=" << value << ", packet " << packet << std::endl; + * std::cout << "packet " << packet << std::endl; * } * \endcode * Each of these sink function takes, as a first argument, a reference to a @@ -99,7 +103,10 @@ * two unsigned 64 bit integers while the latter requires two signed 64 bit * integers. More generally, users can consult the \ref TraceSourceList * to figure out the arguments which a trace sink is required to receive - * for each trace source. + * for each trace source: a signature of the user trace sink must match + * _exactly_ the signature documented in the \ref TraceSourceList. + * + * \section TraceConnection Connecting Trace Sources to Trace Sinks * * Since there is no working magic here, defining a trace sink does not connect * it directly to a set of trace sources. To connect a trace sink, a user must call @@ -135,9 +142,14 @@ * know from _which_ trace source the event is coming from. In our example, the * trace source might be coming from the NetDevice number 2 of Node 10 or Netdevice * number 0 of Node 5. In both cases, you might need to know which of these NetDevice - * is generating this event, if only to generate some ascii trace dump. + * is generating this event, if only to generate some ascii trace dump. Another + * similar use-case is that you might have connected the same trace sink to + * multiple types of events which have the same signature: it is quite common + * to receive all tx, rx, and drop events in the same trace sink and that would be + * quite trivial to achieve with a string such as: "/nodes/* /devices/* /*" * - * It turns out that there are many ways to get this information. The simplest + * The source of a trace event can be retrieved from a trace sink using + * different means: the simplest * way to get this information is to use the builtin printing facility of * the TraceContext object: * \code @@ -175,6 +187,12 @@ * } * \endcode * + * \section TraceSourceSimpleExport A simple way to export Trace Sources + * + * XXX + * + * \section ExportingTraceSources Exporting new Trace Sources + * * Using existing trace sources to connect them to a set of adhoc trace sinks * is not really complicated but, setting up new trace sources which can hook * in this automatic connection system is a bit more complicated. @@ -184,15 +202,15 @@ * class MyModel * { * public: - * void DoSomething (Packet packet, double value) + * void DoSomething (Packet packet) * { * // report this event on packet with value - * m_doSomething (packet, value); + * m_doSomething (packet); * // do something * } * private: * // report every "something" function call. - * CallbackTraceSource m_doSomething; + * CallbackTraceSource m_doSomething; * }; * \endcode * @@ -276,12 +294,25 @@ * The code above will make your "rx" trace source appear under the * /nodes/xx/devices/xx/my-model/rx namespace path. * + * If you have implemented a new layer 3 or 4 protocol object, the process to + * export your trace sources is quite similar. You need to subclass from + * ns3::Object, override the ns3::Object::GetTraceResolver method, make + * sure you chain up to your parent's GetTraceResolver method, and, finally, + * make sure that someone calls your new GetTraceResolver method. How to accomplish + * the latter should be documented in the node's API documentation which describes + * how to implement a new layer 3 or 4 protocol object. + * + * \section AdvancedTraceContext Creating new Trace Context Elements + * * The last important feature which model developers need to understand - * is how to provide extra TraceContext data to trace sinks. For example, - * if your model exports many trace sources, and if a single trace sink - * is connected to all these trace sources at the same time, it might need - * to know, for each event what its event source is. So, if you have a - * TX, a RX, and a DROP trace source: + * is how to provide extra context information to trace sinks. For example, + * if your model exports both rx and tx trace sources which share the same + * signature, it is quite natural for a user to connect to a single trace sink + * to both of them with a trace path string such as "/nodes/* /devices/* /(rx|tx)". + * In this case, it becomes necessary to be able, from the trace sink function, + * to tell which event triggered the call to the trace sink: a rx or a tx event. + * + * That example is detailed below with a TX, a RX, and a DROP source: * \code * class MyModel * { @@ -291,42 +322,125 @@ * CallbackTraceSource m_dropSource; * }; * \endcode - * You would like to allow your connected trace sinks to read their - * TraceContext for the type of source: + * When a single sink is connected to all 3 sources here, one might want + * to write code like the following: * \code * void DeviceRxSink (const TraceContext &context, const Packet &packet) * { - * MyModelTraceType type; - * context.GetElement (type); * switch (type) { - * case MyModelTraceType::RX: - * std::cout << "drop" << std::endl; + * case RX: + * std::cout << "rx" << std::endl; * break; - * case MyModelTraceType::TX: - * std::cout << "drop" << std::endl; + * case TX: + * std::cout << "tx" << std::endl; * break; - * case MyModelTraceType::DROP: + * case DROP: * std::cout << "drop" << std::endl; * break; * } * \endcode - * or, more simply: + * + * \subsection AdvancedTraceContextSimpleSolution The simple solution + * + * The simplest way to do achieve the result shown above is to include + * in the trace source an extra explicit argument which describes the source event: + * - define a small enum with 3 values + * - change the signature of m_rxSource, m_txSource, and m_dropSource to include + * the enum + * - pass the enum value in each event + * + * The resulting code is shown below: * \code - * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * class MyModel * { - * // context contains MyModelTraceType so, - * // it is going to print it - * std::cout << context << std::endl; + * public: + * // define the trace type enum. + * enum TraceType { + * RX, + * TX, + * DROP + * }; + * private: + * // generate events + * void NotifyRxPacket (Packet p) { + * m_rxSource (p, MyModel::RX); + * } + * void NotifyTxPacket (Packet p) { + * m_rxSource (p, MyModel::TX); + * } + * void NotifyDropPacket (Packet p) { + * m_rxSource (p, MyModel::DROP); + * } + * CallbackTraceSource m_rxSource; + * CallbackTraceSource m_txSource; + * CallbackTraceSource m_dropSource; + * }; + * \endcode + * These 3 new sources can be connected easily to a new trace sink: + * \code + * void ASimpleTraceSink (const TraceContext &context, const Packet &packet, enum MyModel::TraceType type) + * { + * // here, read the "type" argument * } * \endcode * - * This kind of extra information is not generated magically: model - * authors must provide to the ns3::CompositeTraceResolver that - * per-source extra information during registration to allow the - * connection system to store it safely in the user's TraceContext objects. + * This solution works but it makes it impossible to connect a single trace sink to a set + * of trace sources which represent "rx" events in different NetDevice objects since + * each of them will define a different enum type with different values: since the + * trace sink signature must match exactly the trace source signature, it is impossible + * to connect at the same time to all "rx" events of different NetDevice. + * + * \subsection AdvancedTraceContextFancySolution The more complex and generic solution + * + * There is, hopefully, a way to get the best of both worlds, that is, to allow a + * user to connect to a lot of trace source events of the same kind but coming from different + * implementations and to allow the user to differentiate between these different + * implementations. + * + * Rather than define an adhoc enum type with a list of trace sources, you can also + * define a new ns3::TraceContextElement for your source sources. For example, if you + * define a new MyModelTraceType class which contains the type of trace, your users can + * then write trace sink code which looks like this: + * \code + * void AFancyTraceSink (const TraceContext &context, const Packet &packet) + * { + * MyModelTraceType type; + * if (context.GetElement (type)) + * { + * switch (type.Get ()) + * { + * case MyModelTraceType::RX: + * std::cout << "rx" << std::endl; + * break; + * case MyModelTraceType::TX: + * std::cout << "tx" << std::endl; + * break; + * case MyModelTraceType::DROP: + * std::cout << "drop" << std::endl; + * break; + * } + * } + * } + * \endcode + * + * Of course, since the type of trace is stored in the TraceContext, your users can + * also take the shortcut which uses the printing functionality of the TraceContext: + * \code + * void ALessFancyTraceSink (const TraceContext &context, const Packet &packet) + * { + * std::cout << "context=\"" << context << "\" packet: " << packet << std::endl; + * } + * \endcode + * which will generate something like the following when the trace source comes + * from MyModel: + * \code + * context="my-model-rx" packet: ... + * \endcode * * The first step to achieve this is to define and implement a new - * subclass of the ns3::TraceContextElement base class: + * subclass of the ns3::TraceContextElement base class. The exact list of + * public methods which must be implemented is described in the API + * documentation of the ns3::TraceContextElement class. * \code * class MyModelTraceType : public TraceContextElement * { @@ -352,7 +466,7 @@ * enum Type m_type; * }; * \endcode - * The implementation is quite straightforward: + * The implementation does not require much thinking: * \code * MyModelTraceType::MyModelTraceType (enum Type type) * : m_type (type) @@ -366,12 +480,15 @@ * MyModelTraceType::GetUid (void) * { * // use protected TraceContextElement::AllocateUid method + * // the input string is used to uniquely identify this new subclass * static uint16_t uid = AllocateUid ("ns3::MyModelTraceType"); * return uid; * } * void * MyModelTraceType::Print (std::ostream &os) const * ( + * // this method is invoked by the print function of a TraceContext + * // if it contains an instance of this TraceContextElement. * switch (m_type) { * case RX: os << "rx"; break; * // ... @@ -380,6 +497,9 @@ * std::string * MyModelTraceType::GetTypeName (void) const * { + * // This method should return a fully-qualified c++ typename + * // This method is used only for documentation purposes to + * // generate the content of the Trace Source List. * return "ns3::MyModelTraceType"; * } * \endcode From 4766ed101d848835db00fe1a36532e20bb0d5cd8 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 5 Sep 2007 12:34:53 +0200 Subject: [PATCH 118/218] add an overload of the TraceSource::AddCallback method --- src/core/trace-source.cc | 31 +++++++++++++++++++++++++++++++ src/core/trace-source.h | 7 +++++++ src/core/wscript | 1 + 3 files changed, 39 insertions(+) create mode 100644 src/core/trace-source.cc diff --git a/src/core/trace-source.cc b/src/core/trace-source.cc new file mode 100644 index 000000000..64c7d8960 --- /dev/null +++ b/src/core/trace-source.cc @@ -0,0 +1,31 @@ +/* -*- 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 + */ +#include "trace-source.h" +#include "trace-context.h" + +namespace ns3 { + +void +TraceSource::AddCallback (CallbackBase const & callback) +{ + AddCallback (callback, TraceContext ()); +} + +} // namespace ns3 diff --git a/src/core/trace-source.h b/src/core/trace-source.h index 2a90de2ee..f9ee2ddac 100644 --- a/src/core/trace-source.h +++ b/src/core/trace-source.h @@ -23,6 +23,9 @@ namespace ns3 { +class CallbackBase; +class TraceContext; + /** * \brief the base class for all trace sources * @@ -40,6 +43,10 @@ public: * back to the user. */ virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; + /** + * \param callback the callback to connect to this trace source + */ + void AddCallback (CallbackBase const & callback); /** * \param callback the callback to disconnect from this trace source */ diff --git a/src/core/wscript b/src/core/wscript index b32bd3a9c..455779fd6 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -49,6 +49,7 @@ def build(bld): 'callback-trace-source.cc', 'composite-trace-resolver.cc', 'trace-doc.cc', + 'trace-source.cc', ] if sys.platform == 'win32': From 5a06401cb8268e3af9f1584a98bac530d72d7232 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 5 Sep 2007 12:36:21 +0200 Subject: [PATCH 119/218] add missing section on simple trace connection --- doc/tracing.h | 60 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/doc/tracing.h b/doc/tracing.h index 720e9a334..f3db38481 100644 --- a/doc/tracing.h +++ b/doc/tracing.h @@ -106,11 +106,59 @@ * for each trace source: a signature of the user trace sink must match * _exactly_ the signature documented in the \ref TraceSourceList. * - * \section TraceConnection Connecting Trace Sources to Trace Sinks * - * Since there is no working magic here, defining a trace sink does not connect - * it directly to a set of trace sources. To connect a trace sink, a user must call - * ns3::NodeList::Connect. The second argument is a callback to the user's trace sink. + * \section TraceSourceSimpleExport A simple way to connect Trace Sources with Trace Sinks + * + * The crux of the complexity of the ns-3 tracing system comes from its + * flexible system used to connect trace sources to trace sinks but what is really + * nice about it is that it is not necessary to use it to setup simple traces. + * + * The simplest way to export a set of trace sources to a user, for example, + * during the early prototyping phases of a system, is to add a set of public methods + * to give to your users access to the trace source object instances you use to generate + * trace events: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet) + * { + * // report this event on packet + * m_doSomething (packet); + * // do something + * } + * CallbackTraceSource *PeekSomethingTraceSource (void) const + * { + * return &m_doSomething + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * If your users hold a pointer to an instance of MyModel, and if they want to connect + * a MySomethingSink, they can simply do the following which invokes the + * TraceSource::AddCallback method and creates a Callback object from the user's + * sink with the MakeCallback function. + * \code + * void + * MySomethingSink (const TraceContext &context, Packet packet) + * { + * // do whatever you want. + * } + * MyModel *model = ...; + * model->AddCallback (MakeCallback (&MySomethingSink)); + * \endcode + * + * The full power of the tracing system comes however from its ns3::NodeList::Connect + * method which is described in the following sections. + * + * \section TraceConnection Connecting Trace Sources to Trace Sinks + * + * If a trace source is integrated in the ns-3 trace connection facility, a user + * should call the ns3::NodeList::Connect method to establish a connection between + * a trace sink and a set of matching trace sources. The second argument to that + * method is a callback to the user's trace sink. * That callback is easy to construct: call ns3::MakeCallback and you are done. The * first argument is a string whose format is similar to a unix path and which is * used to uniquely identify the set of trace sources you want to connect to. @@ -187,10 +235,6 @@ * } * \endcode * - * \section TraceSourceSimpleExport A simple way to export Trace Sources - * - * XXX - * * \section ExportingTraceSources Exporting new Trace Sources * * Using existing trace sources to connect them to a set of adhoc trace sinks From 71070a4c0831932f276d39aea4f8b766bebe7729 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 5 Sep 2007 12:39:11 +0200 Subject: [PATCH 120/218] fix a small typo --- doc/tracing.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/tracing.h b/doc/tracing.h index f3db38481..45e7d9db5 100644 --- a/doc/tracing.h +++ b/doc/tracing.h @@ -147,7 +147,8 @@ * // do whatever you want. * } * MyModel *model = ...; - * model->AddCallback (MakeCallback (&MySomethingSink)); + * CallbackTraceSource *source = model->PeekSomethingTraceSource (); + * source->AddCallback (MakeCallback (&MySomethingSink)); * \endcode * * The full power of the tracing system comes however from its ns3::NodeList::Connect From ca69620cc6f0c4a60e274d602e112e0b310b5c6e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 5 Sep 2007 16:28:55 +0200 Subject: [PATCH 121/218] add failing test and fix for assignment to self --- src/common/packet-metadata-test.cc | 14 ++++++++++++++ src/common/packet-metadata.h | 23 +++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/common/packet-metadata-test.cc b/src/common/packet-metadata-test.cc index e3e61c45e..edca62626 100644 --- a/src/common/packet-metadata-test.cc +++ b/src/common/packet-metadata-test.cc @@ -217,6 +217,7 @@ private: template void RegisterTrailer (void); void CleanupPrints (void); + Packet DoAddHeader (Packet p); bool Check (const char *file, int line, std::list expected); @@ -430,6 +431,14 @@ PacketMetadataTest::CheckHistory (Packet p, const char *file, int line, uint32_t } \ } + +Packet +PacketMetadataTest::DoAddHeader (Packet p) +{ + ADD_HEADER (p, 10); + return p; +} + bool PacketMetadataTest::RunTests (void) { @@ -659,6 +668,11 @@ PacketMetadataTest::RunTests (void) ADD_HEADER (p, 10); CHECK_HISTORY (p, 1, 10); + p = Packet (); + ADD_HEADER (p, 10); + p = DoAddHeader (p); + CHECK_HISTORY (p, 2, 10, 10); + return ok; } diff --git a/src/common/packet-metadata.h b/src/common/packet-metadata.h index b193093f9..12223a4bb 100644 --- a/src/common/packet-metadata.h +++ b/src/common/packet-metadata.h @@ -306,24 +306,23 @@ PacketMetadata::PacketMetadata (PacketMetadata const &o) PacketMetadata & PacketMetadata::operator = (PacketMetadata const& o) { - if (m_data == o.m_data) + if (m_data != o.m_data) { - // self assignment - return *this; + // not self assignment + NS_ASSERT (m_data != 0); + m_data->m_count--; + if (m_data->m_count == 0) + { + PacketMetadata::Recycle (m_data); + } + m_data = o.m_data; + NS_ASSERT (m_data != 0); + m_data->m_count++; } - NS_ASSERT (m_data != 0); - m_data->m_count--; - if (m_data->m_count == 0) - { - PacketMetadata::Recycle (m_data); - } - m_data = o.m_data; m_head = o.m_head; m_tail = o.m_tail; m_used = o.m_used; m_packetUid = o.m_packetUid; - NS_ASSERT (m_data != 0); - m_data->m_count++; return *this; } PacketMetadata::~PacketMetadata () From 1620412fb1717ea45d7d9c6c661aab55fa421f1e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 10:04:19 +0200 Subject: [PATCH 122/218] add tests, fix the failing tests and add support for 6-arg callbacks --- src/core/callback-test.cc | 50 +++++++++++++ src/core/callback.h | 148 +++++++++++++++++++++++++++----------- 2 files changed, 155 insertions(+), 43 deletions(-) diff --git a/src/core/callback-test.cc b/src/core/callback-test.cc index 9e8cf259f..0e9811e7b 100644 --- a/src/core/callback-test.cc +++ b/src/core/callback-test.cc @@ -57,6 +57,14 @@ void *Test10 (bool *a, int const & b) return a; } +void TestFZero (void) {} +void TestFOne (int) {} +void TestFTwo (int, int) {} +void TestFThree (int, int, int) {} +void TestFFour (int, int, int, int) {} +void TestFFive (int, int, int, int, int) {} +void TestFSix (int, int, int, int, int, int) {} + class CallbackTest : public ns3::Test { private: bool m_test1; @@ -73,6 +81,22 @@ public: void Test3 (double a); int Test4 (double a, int b); void Test8 (Callback callback); + + void TestZero (void) {} + void TestOne (int) {} + void TestTwo (int, int) {} + void TestThree (int, int, int) {} + void TestFour (int, int, int, int) {} + void TestFive (int, int, int, int, int) {} + void TestSix (int, int, int, int, int, int) {} + + void TestCZero (void) const {} + void TestCOne (int) const {} + void TestCTwo (int, int) const {} + void TestCThree (int, int, int) const {} + void TestCFour (int, int, int, int) const {} + void TestCFive (int, int, int, int, int) const {} + void TestCSix (int, int, int, int, int, int) const {} }; CallbackTest::CallbackTest () @@ -110,6 +134,7 @@ CallbackTest::Test8 (Callback callback) { callback (3); } + bool CallbackTest::IsWrong (void) { @@ -216,6 +241,31 @@ CallbackTest::RunTests (void) MakeBoundCallback (&Test9, &v); MakeBoundCallback (&Test10, &v); + + MakeCallback (&CallbackTest::TestZero, this); + MakeCallback (&CallbackTest::TestOne, this); + MakeCallback (&CallbackTest::TestTwo, this); + MakeCallback (&CallbackTest::TestThree, this); + MakeCallback (&CallbackTest::TestFour, this); + MakeCallback (&CallbackTest::TestFive, this); + MakeCallback (&CallbackTest::TestSix, this); + + MakeCallback (&CallbackTest::TestCZero, this); + MakeCallback (&CallbackTest::TestCOne, this); + MakeCallback (&CallbackTest::TestCTwo, this); + MakeCallback (&CallbackTest::TestCThree, this); + MakeCallback (&CallbackTest::TestCFour, this); + MakeCallback (&CallbackTest::TestCFive, this); + MakeCallback (&CallbackTest::TestCSix, this); + + MakeCallback (&TestFZero); + MakeCallback (&TestFOne); + MakeCallback (&TestFTwo); + MakeCallback (&TestFThree); + MakeCallback (&TestFFour); + MakeCallback (&TestFFive); + MakeCallback (&TestFSix); + return ok; } diff --git a/src/core/callback.h b/src/core/callback.h index c5d3cf442..4e43a1436 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -25,6 +25,7 @@ #include "ptr.h" #include "fatal-error.h" #include "empty.h" +#include namespace ns3 { @@ -89,55 +90,62 @@ private: }; // declare the CallbackImpl class -template +template class CallbackImpl; // define CallbackImpl for 0 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (void) = 0; }; // define CallbackImpl for 1 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1) = 0; }; // define CallbackImpl for 2 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2) = 0; }; // define CallbackImpl for 3 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3) = 0; }; // define CallbackImpl for 4 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3, T4) = 0; }; // define CallbackImpl for 5 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3, T4, T5) = 0; }; +// define CallbackImpl for 6 params + template +class CallbackImpl : public CallbackImplBase { +public: + virtual ~CallbackImpl () {} + virtual R operator() (T1, T2, T3, T4, T5, T6) = 0; +}; // an impl for Functors: -template -class FunctorCallbackImpl : public CallbackImpl { +template +class FunctorCallbackImpl : public CallbackImpl { public: FunctorCallbackImpl (T const &functor) : m_functor (functor) {} @@ -160,9 +168,12 @@ public: R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) { return m_functor (a1,a2,a3,a4,a5); } + R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) { + return m_functor (a1,a2,a3,a4,a5,a6); + } virtual bool IsEqual (CallbackImplBase const *other) const { - FunctorCallbackImpl const *otherDerived = - dynamic_cast const *> (other); + FunctorCallbackImpl const *otherDerived = + dynamic_cast const *> (other); if (otherDerived == 0) { return false; @@ -178,8 +189,8 @@ private: }; // an impl for pointer to member functions -template -class MemPtrCallbackImpl : public CallbackImpl { +template +class MemPtrCallbackImpl : public CallbackImpl { public: MemPtrCallbackImpl (OBJ_PTR const&objPtr, MEM_PTR mem_ptr) : m_objPtr (objPtr), m_memPtr (mem_ptr) {} @@ -202,9 +213,12 @@ public: R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) { return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5); } + R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) { + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6); + } virtual bool IsEqual (CallbackImplBase const *other) const { - MemPtrCallbackImpl const *otherDerived = - dynamic_cast const *> (other); + MemPtrCallbackImpl const *otherDerived = + dynamic_cast const *> (other); if (otherDerived == 0) { return false; @@ -260,22 +274,22 @@ public: template + typename T5 = empty, typename T6 = empty> class Callback : public CallbackBase { public: // There are two dummy args below to ensure that this constructor is // always properly disambiguited by the c++ compiler template Callback (FUNCTOR const &functor, bool, bool) - : m_impl (Create > (functor)) + : m_impl (Create > (functor)) {} template Callback (OBJ_PTR const &objPtr, MEM_PTR mem_ptr) - : m_impl (Create > (objPtr, mem_ptr)) + : m_impl (Create > (objPtr, mem_ptr)) {} - Callback (Ptr > const &impl) + Callback (Ptr > const &impl) : m_impl (impl) {} @@ -305,6 +319,9 @@ public: R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const { return (*(PeekImpl ())) (a1,a2,a3,a4,a5); } + R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const { + return (*(PeekImpl ())) (a1,a2,a3,a4,a5,a6); + } bool IsEqual (CallbackBase const &other) const { return PeekImpl ()->IsEqual (other.PeekImpl ()); @@ -312,7 +329,7 @@ public: bool CheckType (CallbackBase const& other) const { CallbackImplBase *otherBase = other.PeekImpl (); - if (dynamic_cast *> (otherBase) != 0) + if (dynamic_cast *> (otherBase) != 0) { return true; } @@ -328,27 +345,27 @@ public: " got=" << typeid (other).name () << ", expected=" << typeid (*this).name ()); } - const Callback *goodType = static_cast *> (&other); + const Callback *goodType = static_cast *> (&other); *this = *goodType; } void Assign (Ptr other) { - CallbackImpl *impl = dynamic_cast *> (PeekPointer (other)); + CallbackImpl *impl = dynamic_cast *> (PeekPointer (other)); if (other == 0) { NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")" " got=" << typeid (other).name () << ", expected=" << typeid (*impl).name ()); } - *this = Callback (impl); + *this = Callback (impl); } virtual PtrGetImpl (void) const { return m_impl; } private: - virtual CallbackImpl *PeekImpl (void) const { + virtual CallbackImpl *PeekImpl (void) const { return PeekPointer (m_impl); } - Ptr > m_impl; + Ptr > m_impl; }; /** @@ -369,7 +386,7 @@ Callback MakeCallback (R (T::*memPtr) (void), OBJ objPtr) { return Callback (objPtr, memPtr); } template -Callback MakeCallback (R (T::*mem_ptr) () const, OBJ const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) () const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -381,11 +398,11 @@ Callback MakeCallback (R (T::*mem_ptr) () const, OBJ const objPtr) { * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ const *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -397,11 +414,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ const *const objPtr * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -413,11 +430,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ const*const o * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -429,11 +446,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ const*c * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -445,13 +462,29 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ c * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } +/** + * \ingroup MakeCallback + * \param mem_ptr class method member pointer + * \param objPtr class instance + * \return a wrapper Callback + * Build Callbacks for class method members which takes five arguments + * and potentially return a value. + */ +template +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6), OBJ objPtr) { + return Callback (objPtr, mem_ptr); +} +template +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6) const, OBJ objPtr) { + return Callback (objPtr, mem_ptr); +} /** * \ingroup MakeCallback @@ -519,6 +552,17 @@ template MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5)) { return Callback (fnPtr, true, true); } +/** + * \ingroup MakeCallback + * \param fnPtr function pointer + * \return a wrapper Callback + * Build Callbacks for functions which takes five arguments + * and potentially return a value. + */ +template +Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6)) { + return Callback (fnPtr, true, true); +} @@ -587,6 +631,17 @@ template MakeNullCallback (void) { return Callback (); } +/** + * \ingroup MakeCallback + * \overload Callback MakeNullCallback (void) + * \return a wrapper Callback + * Build a null callback which takes five arguments + * and potentially return a value. + */ +template +Callback MakeNullCallback (void) { + return Callback (); +} /* @@ -596,9 +651,10 @@ Callback MakeNullCallback (void) { */ // an impl for Bound Functors: template -class BoundFunctorCallbackImpl : public CallbackImpl { +class BoundFunctorCallbackImpl : public CallbackImpl { public: - BoundFunctorCallbackImpl (T const &functor, TX a) + template + BoundFunctorCallbackImpl (FUNCTOR functor, ARG a) : m_functor (functor), m_a (a) {} virtual ~BoundFunctorCallbackImpl () {} R operator() (void) { @@ -640,36 +696,42 @@ private: template Callback MakeBoundCallback (R (*fnPtr) (TX), TX a) { - Ptr > impl = + Ptr > impl = Create >(fnPtr, a); return Callback (impl); } template Callback MakeBoundCallback (R (*fnPtr) (TX,T1), TX a) { - Ptr > impl = + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), TX a) { - Ptr > impl = + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), TX a) { - Ptr > impl = + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), TX a) { - Ptr > impl = + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5,T6), TX a) { + Ptr > impl = + Create > (fnPtr, a); + return Callback (impl); +} }; // namespace ns3 From 8f72030a45fd88a89eefdf7216e206a68afdac4c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 11:18:35 +0200 Subject: [PATCH 123/218] an euclidian distance is always positive --- src/common/buffer.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/common/buffer.h b/src/common/buffer.h index 229a040fd..f412a419c 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -69,7 +69,7 @@ public: * to the same underlying buffer. Debug builds ensure * this with an assert. */ - inline int32_t GetDistanceFrom (Iterator const &o) const; + inline uint32_t GetDistanceFrom (Iterator const &o) const; /** * \return true if this iterator points to the end of the byte array. @@ -502,13 +502,21 @@ Buffer::Iterator::Prev (uint32_t delta) NS_ASSERT (m_current >= delta); m_current -= delta; } -int32_t +uint32_t Buffer::Iterator::GetDistanceFrom (Iterator const &o) const { NS_ASSERT (m_data == o.m_data); int32_t start = m_current; int32_t end = o.m_current; - return end - start; + int32_t diff = end - start; + if (diff < 0) + { + return -diff; + } + else + { + return diff; + } } bool From 8dfdf4f1ecf71a33dfe9a472bf58606ffa8f2cca Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 12:33:22 +0200 Subject: [PATCH 124/218] add bound callback tests and make them work --- src/core/callback-test.cc | 29 +++++++++++++++++++++++++++ src/core/callback.h | 42 +++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/core/callback-test.cc b/src/core/callback-test.cc index 0e9811e7b..4fb062321 100644 --- a/src/core/callback-test.cc +++ b/src/core/callback-test.cc @@ -65,6 +65,13 @@ void TestFFour (int, int, int, int) {} void TestFFive (int, int, int, int, int) {} void TestFSix (int, int, int, int, int, int) {} +void TestFROne (int &) {} +void TestFRTwo (int &, int &) {} +void TestFRThree (int &, int &, int &) {} +void TestFRFour (int &, int &, int &, int &) {} +void TestFRFive (int &, int &, int &, int &, int &) {} +void TestFRSix (int &, int &, int &, int &, int &, int &) {} + class CallbackTest : public ns3::Test { private: bool m_test1; @@ -266,6 +273,28 @@ CallbackTest::RunTests (void) MakeCallback (&TestFFive); MakeCallback (&TestFSix); + MakeCallback (&TestFROne); + MakeCallback (&TestFRTwo); + MakeCallback (&TestFRThree); + MakeCallback (&TestFRFour); + MakeCallback (&TestFRFive); + MakeCallback (&TestFRSix); + + + MakeBoundCallback (&TestFOne, 1); + MakeBoundCallback (&TestFTwo, 1); + MakeBoundCallback (&TestFThree, 1); + MakeBoundCallback (&TestFFour, 1); + MakeBoundCallback (&TestFFive, 1); + + MakeBoundCallback (&TestFROne, 1); + MakeBoundCallback (&TestFRTwo, 1); + MakeBoundCallback (&TestFRThree, 1); + MakeBoundCallback (&TestFRFour, 1); + MakeBoundCallback (&TestFRFive, 1); + + + return ok; } diff --git a/src/core/callback.h b/src/core/callback.h index 4e43a1436..ff04de447 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -25,7 +25,7 @@ #include "ptr.h" #include "fatal-error.h" #include "empty.h" -#include +#include "type-traits.h" namespace ns3 { @@ -691,47 +691,51 @@ public: } private: T m_functor; - TX m_a; + typename TypeTraits::ReferencedType m_a; }; -template -Callback MakeBoundCallback (R (*fnPtr) (TX), TX a) { +template +Callback MakeBoundCallback (R (*fnPtr) (TX), ARG a) { Ptr > impl = Create >(fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1), TX a) { +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), TX a) { +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), TX a) { +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3), ARG a) { + Ptr > impl = + Create > (fnPtr, a); + return Callback (impl); +} +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } - -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), TX a) { +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5,T6), TX a) { - Ptr > impl = - Create > (fnPtr, a); - return Callback (impl); -} }; // namespace ns3 From e463d9dcfbd0afc62c661a891822e146568063db Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 12:56:31 +0200 Subject: [PATCH 125/218] add support for NodeList::ConnectPrinterToAll --- examples/simple-point-to-point.cc | 3 + src/core/array-trace-resolver.h | 16 +++++ src/core/callback-trace-source.cc | 7 ++- src/core/callback-trace-source.h | 94 ++++++++++++++++++++++++++++ src/core/composite-trace-resolver.cc | 31 +++++++++ src/core/composite-trace-resolver.h | 8 +++ src/core/fv-trace-source.h | 3 + src/core/object.cc | 31 +++++++++ src/core/object.h | 1 + src/core/sv-trace-source.h | 3 + src/core/trace-resolver.h | 2 + src/core/trace-source.h | 3 + src/core/uv-trace-source.h | 5 +- src/node/node-list.cc | 5 ++ src/node/node-list.h | 1 + 15 files changed, 210 insertions(+), 3 deletions(-) diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4e7657cdb..91a1f45e1 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -64,6 +64,7 @@ #include "ns3/ipv4-route.h" #include "ns3/point-to-point-topology.h" #include "ns3/onoff-application.h" +#include "ns3/node-list.h" using namespace ns3; @@ -178,6 +179,8 @@ int main (int argc, char *argv[]) asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); + NodeList::ConnectPrinterToAll (std::cout); + // Also configure some tcpdump traces; each interface will be traced // The output files will be named // simple-point-to-point.pcap-- diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index 0d1086447..d5bc2ca32 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -64,6 +64,7 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); private: class IteratorBase @@ -183,6 +184,21 @@ ArrayTraceResolver::CollectSources (std::string path, const TraceContext } } +template +void +ArrayTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +{ + uint32_t j = 0; + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.AddElement (index); + Ptr obj = m_iter->Get (); + obj->GetTraceResolver ()->ConnectPrinterToAll (os, tmp); + j++; + } +} }//namespace ns3 diff --git a/src/core/callback-trace-source.cc b/src/core/callback-trace-source.cc index aa686c14d..02298520e 100644 --- a/src/core/callback-trace-source.cc +++ b/src/core/callback-trace-source.cc @@ -19,6 +19,9 @@ * Author: Mathieu Lacage */ #include "callback-trace-source.h" + +#ifdef RUN_SELF_TESTS + #include "test.h" namespace ns3 { @@ -93,6 +96,6 @@ CallbackTraceSourceTest::RunTests (void) CallbackTraceSourceTest g_callbackTraceTest; - - }//namespace ns3 + +#endif /* RUN_SELF_TESTS */ diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h index d571b5739..2e302cdc2 100644 --- a/src/core/callback-trace-source.h +++ b/src/core/callback-trace-source.h @@ -44,6 +44,7 @@ public: CallbackTraceSource (); virtual void AddCallback (CallbackBase const & callback, TraceContext const & context); virtual void RemoveCallback (CallbackBase const & callback); + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context); void operator() (void) const; void operator() (T1 a1) const; void operator() (T1 a1, T2 a2) const; @@ -62,6 +63,92 @@ private: namespace ns3 { +namespace internal { + +template +class TraceSinkPrint; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2, T3 a3, T4 a4) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\" arg3=\"" << a3 << "\" arg4=\"" << a4 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2, T3 a3) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\" arg3=\"" << a3 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\"" << std::endl; + } +}; + +template <> +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context) + { + *os << "context=\"" << context << std::endl; + } +}; + +} // namespace internal + + template CallbackTraceSource::CallbackTraceSource () @@ -99,6 +186,13 @@ CallbackTraceSource::RemoveCallback (CallbackBase const & callback) template void +CallbackTraceSource::ConnectPrinter (std::ostream &os, const TraceContext &context) +{ + AddCallback (ns3::internal::TraceSinkPrint::Make (os), context); +} +template +void CallbackTraceSource::operator() (void) const { for (typename CallbackList::const_iterator i = m_callbackList.begin (); diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index bb0aacabb..377da45b5 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -63,6 +63,12 @@ CompositeTraceResolver::Add (std::string name, ctx.Union (this->context); this->maker ()->CollectSources (path, ctx, collection); } + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->maker ()->ConnectPrinterToAll (os, ctx); + } Callback > maker; } *item = new MakerResolveItem (); item->name = name; @@ -101,6 +107,12 @@ CompositeTraceResolver::DoAddSource (std::string name, ctx.Union (this->context); collection->AddUnique (path, ctx, this->doc); } + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->trace->ConnectPrinter (os, ctx); + } TraceSource *trace; TraceDoc doc; } *item = new SourceResolveItem (); @@ -138,6 +150,12 @@ CompositeTraceResolver::DoAddComposite (std::string name, Ptr composite, ctx.Union (this->context); this->composite->GetTraceResolver ()->CollectSources (path, ctx, collection); } + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->composite->GetTraceResolver ()->ConnectPrinterToAll (os, ctx); + } Ptr composite; } *item = new CompositeResolveItem (); @@ -293,6 +311,19 @@ CompositeTraceResolver::CollectSources (std::string path, const TraceContext &co m_parent->CollectSources (path, context, collection); } } +void +CompositeTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +{ + for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) + { + NS_DEBUG ("print " << (*i)->name); + (*i)->ConnectPrinterToAll (os, context); + } + if (m_parent != 0) + { + m_parent->ConnectPrinterToAll (os, context); + } +} }//namespace ns3 diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index 56886d739..c0612151f 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -120,6 +120,7 @@ private: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); friend class CompositeTraceResolverTest; class ResolveItem { @@ -129,6 +130,7 @@ private: virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) = 0; std::string name; TraceContext context; @@ -199,6 +201,12 @@ CompositeTraceResolver::AddArray (std::string name, ctx.Union (this->context); array->CollectSources (path, ctx, collection); } + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + array->ConnectPrinterToAll (os, ctx); + } Ptr > array; } *item = new ArrayResolveItem (); diff --git a/src/core/fv-trace-source.h b/src/core/fv-trace-source.h index 5b9f44df4..c0f816dbb 100644 --- a/src/core/fv-trace-source.h +++ b/src/core/fv-trace-source.h @@ -46,6 +46,9 @@ public: virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); + } protected: void notify (double oldVal, double newVal) { if (oldVal != newVal) diff --git a/src/core/object.cc b/src/core/object.cc index 85f180cf0..ce87c0f63 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -68,6 +68,7 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); private: Ptr ParseForInterface (std::string path); Ptr m_aggregate; @@ -114,6 +115,11 @@ InterfaceIdTraceResolver::CollectSources (std::string path, const TraceContext & { m_aggregate->DoCollectSources (path, context, collection); } +void +InterfaceIdTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +{ + m_aggregate->DoConnectPrinterToAll (os, context); +} InterfaceId::InterfaceId (uint16_t iid) @@ -333,6 +339,31 @@ Object::DoCollectSources (std::string path, const TraceContext &context, m_collecting = false; } +void +Object::DoConnectPrinterToAll (std::ostream &os, const TraceContext &context) const +{ + const Object *current; + current = this; + do { + if (current->m_collecting) + { + return; + } + current = current->m_next; + } while (current != this); + + m_collecting = true; + + current = this->m_next; + while (current != this) + { + NS_ASSERT (current != 0); + current->GetTraceResolver ()->ConnectPrinterToAll (os, context); + current = current->m_next; + } + + m_collecting = false; +} } // namespace ns3 diff --git a/src/core/object.h b/src/core/object.h index ea4f091db..9cc5a0f68 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -184,6 +184,7 @@ private: Ptr DoQueryInterface (InterfaceId iid) const; void DoCollectSources (std::string path, const TraceContext &context, TraceResolver::SourceCollection *collection) const; + void DoConnectPrinterToAll (std::ostream &os, const TraceContext &context) const; bool Check (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; diff --git a/src/core/sv-trace-source.h b/src/core/sv-trace-source.h index 23d28f988..8cbb2447b 100644 --- a/src/core/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -46,6 +46,9 @@ public: virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); + } protected: void Notify (int64_t oldVal, int64_t newVal) { if (oldVal != newVal) diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index c78a6f21d..f3e0d101a 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -100,6 +100,8 @@ public: */ virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; + + virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) = 0; protected: /** * \param path a namespace path diff --git a/src/core/trace-source.h b/src/core/trace-source.h index f9ee2ddac..9a35a80ad 100644 --- a/src/core/trace-source.h +++ b/src/core/trace-source.h @@ -21,6 +21,8 @@ #ifndef TRACE_SOURCE_H #define TRACE_SOURCE_H +#include + namespace ns3 { class CallbackBase; @@ -51,6 +53,7 @@ public: * \param callback the callback to disconnect from this trace source */ virtual void RemoveCallback (CallbackBase const & callback) = 0; + virtual void ConnectPrinter (std::ostream &os, TraceContext const &context) = 0; }; } // namespace ns3 diff --git a/src/core/uv-trace-source.h b/src/core/uv-trace-source.h index ff248bbf4..0fe84c826 100644 --- a/src/core/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -47,7 +47,10 @@ public: m_callback.AddCallback (callback, context); } virtual void RemoveCallback (CallbackBase const & callback) { - m_callback.RemoveCallback (callback); + m_callback.RemoveCallback (callback); + } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); } protected: diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 3a68bf584..95a009bbb 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -171,6 +171,11 @@ NodeList::Disconnect (std::string name, const CallbackBase &cb) { SimulationSingleton::Get ()->GetTraceResolver ()->Disconnect (name, cb); } +void +NodeList::ConnectPrinterToAll (std::ostream &os) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->ConnectPrinterToAll (os, TraceContext ()); +} Ptr NodeList::GetTraceResolver (void) { diff --git a/src/node/node-list.h b/src/node/node-list.h index 4a6c113bf..02c638bbf 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -101,6 +101,7 @@ public: * the input namespace regexp. */ static void Disconnect (std::string name, const CallbackBase &cb); + static void ConnectPrinterToAll (std::ostream &os); static Ptr GetTraceResolver (void); private: }; From 17baffee33b61df6eb8cf55176764c4aab43173f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 13:32:29 +0200 Subject: [PATCH 126/218] rename ConnectPrinterToAll to TraceAll --- examples/simple-point-to-point.cc | 2 +- src/core/array-trace-resolver.h | 6 +++--- src/core/composite-trace-resolver.cc | 16 ++++++++-------- src/core/composite-trace-resolver.h | 8 ++++---- src/core/object.cc | 10 +++++----- src/core/object.h | 2 +- src/core/trace-resolver.h | 2 +- src/node/node-list.cc | 4 ++-- src/node/node-list.h | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 91a1f45e1..852d9c420 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -179,7 +179,7 @@ int main (int argc, char *argv[]) asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); - NodeList::ConnectPrinterToAll (std::cout); + NodeList::TraceAll (std::cout); // Also configure some tcpdump traces; each interface will be traced // The output files will be named diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h index d5bc2ca32..ecbc63d5d 100644 --- a/src/core/array-trace-resolver.h +++ b/src/core/array-trace-resolver.h @@ -64,7 +64,7 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); + virtual void TraceAll (std::ostream &os, const TraceContext &context); private: class IteratorBase @@ -186,7 +186,7 @@ ArrayTraceResolver::CollectSources (std::string path, const TraceContext template void -ArrayTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +ArrayTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) { uint32_t j = 0; for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) @@ -195,7 +195,7 @@ ArrayTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceCon INDEX index = j; tmp.AddElement (index); Ptr obj = m_iter->Get (); - obj->GetTraceResolver ()->ConnectPrinterToAll (os, tmp); + obj->GetTraceResolver ()->TraceAll (os, tmp); j++; } } diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc index 377da45b5..bf59054f2 100644 --- a/src/core/composite-trace-resolver.cc +++ b/src/core/composite-trace-resolver.cc @@ -63,11 +63,11 @@ CompositeTraceResolver::Add (std::string name, ctx.Union (this->context); this->maker ()->CollectSources (path, ctx, collection); } - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + virtual void TraceAll (std::ostream &os, const TraceContext &context) { TraceContext ctx = context; ctx.Union (this->context); - this->maker ()->ConnectPrinterToAll (os, ctx); + this->maker ()->TraceAll (os, ctx); } Callback > maker; } *item = new MakerResolveItem (); @@ -107,7 +107,7 @@ CompositeTraceResolver::DoAddSource (std::string name, ctx.Union (this->context); collection->AddUnique (path, ctx, this->doc); } - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + virtual void TraceAll (std::ostream &os, const TraceContext &context) { TraceContext ctx = context; ctx.Union (this->context); @@ -150,11 +150,11 @@ CompositeTraceResolver::DoAddComposite (std::string name, Ptr composite, ctx.Union (this->context); this->composite->GetTraceResolver ()->CollectSources (path, ctx, collection); } - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + virtual void TraceAll (std::ostream &os, const TraceContext &context) { TraceContext ctx = context; ctx.Union (this->context); - this->composite->GetTraceResolver ()->ConnectPrinterToAll (os, ctx); + this->composite->GetTraceResolver ()->TraceAll (os, ctx); } Ptr composite; @@ -312,16 +312,16 @@ CompositeTraceResolver::CollectSources (std::string path, const TraceContext &co } } void -CompositeTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +CompositeTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) { for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { NS_DEBUG ("print " << (*i)->name); - (*i)->ConnectPrinterToAll (os, context); + (*i)->TraceAll (os, context); } if (m_parent != 0) { - m_parent->ConnectPrinterToAll (os, context); + m_parent->TraceAll (os, context); } } diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h index c0612151f..ceca4044a 100644 --- a/src/core/composite-trace-resolver.h +++ b/src/core/composite-trace-resolver.h @@ -120,7 +120,7 @@ private: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); + virtual void TraceAll (std::ostream &os, const TraceContext &context); friend class CompositeTraceResolverTest; class ResolveItem { @@ -130,7 +130,7 @@ private: virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) = 0; + virtual void TraceAll (std::ostream &os, const TraceContext &context) = 0; std::string name; TraceContext context; @@ -201,11 +201,11 @@ CompositeTraceResolver::AddArray (std::string name, ctx.Union (this->context); array->CollectSources (path, ctx, collection); } - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) + virtual void TraceAll (std::ostream &os, const TraceContext &context) { TraceContext ctx = context; ctx.Union (this->context); - array->ConnectPrinterToAll (os, ctx); + array->TraceAll (os, ctx); } Ptr > array; diff --git a/src/core/object.cc b/src/core/object.cc index ce87c0f63..27ac31917 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -68,7 +68,7 @@ public: virtual void Disconnect (std::string path, CallbackBase const &cb); virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection); - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context); + virtual void TraceAll (std::ostream &os, const TraceContext &context); private: Ptr ParseForInterface (std::string path); Ptr m_aggregate; @@ -116,9 +116,9 @@ InterfaceIdTraceResolver::CollectSources (std::string path, const TraceContext & m_aggregate->DoCollectSources (path, context, collection); } void -InterfaceIdTraceResolver::ConnectPrinterToAll (std::ostream &os, const TraceContext &context) +InterfaceIdTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) { - m_aggregate->DoConnectPrinterToAll (os, context); + m_aggregate->DoTraceAll (os, context); } @@ -340,7 +340,7 @@ Object::DoCollectSources (std::string path, const TraceContext &context, m_collecting = false; } void -Object::DoConnectPrinterToAll (std::ostream &os, const TraceContext &context) const +Object::DoTraceAll (std::ostream &os, const TraceContext &context) const { const Object *current; current = this; @@ -358,7 +358,7 @@ Object::DoConnectPrinterToAll (std::ostream &os, const TraceContext &context) co while (current != this) { NS_ASSERT (current != 0); - current->GetTraceResolver ()->ConnectPrinterToAll (os, context); + current->GetTraceResolver ()->TraceAll (os, context); current = current->m_next; } diff --git a/src/core/object.h b/src/core/object.h index 9cc5a0f68..36aa3a384 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -184,7 +184,7 @@ private: Ptr DoQueryInterface (InterfaceId iid) const; void DoCollectSources (std::string path, const TraceContext &context, TraceResolver::SourceCollection *collection) const; - void DoConnectPrinterToAll (std::ostream &os, const TraceContext &context) const; + void DoTraceAll (std::ostream &os, const TraceContext &context) const; bool Check (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index f3e0d101a..3db2b42c3 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -101,7 +101,7 @@ public: virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; - virtual void ConnectPrinterToAll (std::ostream &os, const TraceContext &context) = 0; + virtual void TraceAll (std::ostream &os, const TraceContext &context) = 0; protected: /** * \param path a namespace path diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 95a009bbb..1accfa2be 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -172,9 +172,9 @@ NodeList::Disconnect (std::string name, const CallbackBase &cb) SimulationSingleton::Get ()->GetTraceResolver ()->Disconnect (name, cb); } void -NodeList::ConnectPrinterToAll (std::ostream &os) +NodeList::TraceAll (std::ostream &os) { - SimulationSingleton::Get ()->GetTraceResolver ()->ConnectPrinterToAll (os, TraceContext ()); + SimulationSingleton::Get ()->GetTraceResolver ()->TraceAll (os, TraceContext ()); } Ptr NodeList::GetTraceResolver (void) diff --git a/src/node/node-list.h b/src/node/node-list.h index 02c638bbf..dc0e69d8c 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -101,7 +101,7 @@ public: * the input namespace regexp. */ static void Disconnect (std::string name, const CallbackBase &cb); - static void ConnectPrinterToAll (std::ostream &os); + static void TraceAll (std::ostream &os); static Ptr GetTraceResolver (void); private: }; From 054e06daa9635a32c5ade0adfbe6cc49eee0b853 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 6 Sep 2007 18:19:22 +0200 Subject: [PATCH 127/218] move include to implementation file --- src/node/packet-socket-factory.cc | 1 + src/node/packet-socket-factory.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/packet-socket-factory.cc b/src/node/packet-socket-factory.cc index 3cd403a1a..74d74a8f4 100644 --- a/src/node/packet-socket-factory.cc +++ b/src/node/packet-socket-factory.cc @@ -20,6 +20,7 @@ */ #include "packet-socket-factory.h" #include "node.h" +#include "packet-socket.h" namespace ns3 { diff --git a/src/node/packet-socket-factory.h b/src/node/packet-socket-factory.h index 0f052ce6e..7d7468052 100644 --- a/src/node/packet-socket-factory.h +++ b/src/node/packet-socket-factory.h @@ -22,7 +22,6 @@ #define PACKET_SOCKET_FACTORY_H #include "socket-factory.h" -#include "packet-socket.h" namespace ns3 { From 11571be661a5c379697ae7f99fe2853bb4807973 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 6 Sep 2007 15:57:53 -0700 Subject: [PATCH 128/218] readme file includes APIs --- README.multicast-routing | 213 ++++++++++++++++++++++++ src/internet-node/ipv4-static-routing.h | 17 +- 2 files changed, 223 insertions(+), 7 deletions(-) create mode 100644 README.multicast-routing diff --git a/README.multicast-routing b/README.multicast-routing new file mode 100644 index 000000000..a5afda564 --- /dev/null +++ b/README.multicast-routing @@ -0,0 +1,213 @@ +Static multicast routing overview +-------------------------------- + +This is brief documentation of a proposal to add static multicast +routing to ns-3. + +This extension allows the simulation user to: + +- manually add an Ipv4 multicast route to a router +- specify a default outgoing interface for multicast sources (hosts) in + various ways +- allow a multicast receiver (hosts) to join a multicast group, to enable + reception of that group's datagrams + +1. Code location: + +- http://code.nsnam.org/craigdo/ns-3-mc + +- the main source code is found in src/internet-node/ipv4-static-routing.{cc,h} + +also touched are: +- src/internet-node/ipv4-l3-protocol.cc (forwarding methods for the + static routing API) +- src/node/net-device.cc (provides virtual NetDevice::MakeMulticastAddress) +- src/arp-ipv4-interface.cc (calls NetDevice::MakeMulticastAddress) +- src/devices/csma/csma-net-device.cc (handles multicast addressing and + reception). +- src/devices/point-to-point/point-to-point-net-device.cc (implements required + virtual methods. +- src/internet-node/ (several files have added tracing) + +- an example script is in examples/csma-multicast.cc + +2. API: + +The API for adding a multicast route is: + +/** + * @brief Add a multicast route to the static routing table. + * + * A multicast route must specify an origin IP address, a multicast group and + * an input network interface index as conditions and provide a vector of + * output network interface indices over which packets matching the conditions + * are sent. + * + * Typically there are two main types of multicast routes: routes of the + * first kind are used during forwarding. All of the conditions must be + * exlicitly provided. The second kind of routes are used to get packets off + * of a local node. The difference is in the input interface. Routes for + * forwarding will always have an explicit input interface specified. Routes + * off of a node will always set the input interface to a wildcard specified + * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. + * + * For routes off of a local node wildcards may be used in the origin and + * multicast group addresses. The wildcard used for Ipv4Adresses is that + * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage + * of a wildcard allows one to specify default behavior to varying degrees. + * + * For example, making the origin address a wildcard, but leaving the + * multicast group specific allows one (in the case of a node with multiple + * interfaces) to create different routes using different output interfaces + * for each multicast group. + * + * If the origin and multicast addresses are made wildcards, you have created + * essentially a default multicast address that can forward to multiple + * interfaces. Compare this to the actual default multicast address that is + * limited to specifying a single output interface for compatibility with + * existing functionality in other systems. + * + * @param origin The Ipv4Address of the origin of packets for this route. May + * be Ipv4Address:GetAny for open groups. + * @param group The Ipv4Address of the multicast group or this route. + * @param inputInterface The input network interface index over which to + * expect packets destined for this route. May be + * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. + * @param outputInterface A vector of network interface indices used to specify + * how to send packets to the destination(s). + * + * @see Ipv4Address + */ + Ipv4::AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) + +To remove a route, one uses: + +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that the default route may be removed by calling this method with + * appropriate wildcard parameters. + * + * This method causes the multicast routing table to be searched for the first + * route that matches the parameters and removes it. + * + * Wildcards may be provided to this function, but the wildcards are used to + * exacly match wildcards in the routes (see AddMulticastRoute). That is, + * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not + * remove routes with any address in the origin, but will only remove routes + * with "0.0.0.0" set as the the origin. + * + * @param origin The IP address specified as the origin of packets for the + * route. + * @param origin The IP address specified as the multicast group addres of + * the route. + * @param inputInterfade The network interface index specified as the expected + * input interface for the route. + * @returns True if a route was found and removed, false otherwise. + * + * @see Ipv4MulticastRoute + * @see Ipv4StaticRouting::AddMulticastRoute + */ + Ipv4::RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, + uint32_t inputInterface) + +For compatibility, and to provide simplicity, one can set a default multicast +route for a host originating data: + +/** + * @brief Add a default multicast route to the static routing table. + * + * This is the multicast equivalent of the unicast version SetDefaultRoute. + * We tell the routing system what to do in the case where a specific route + * to a destination multicast group is not found. The system forwards + * packets out the specified interface in the hope that "something out there" + * knows better how to route the packet. This method is only used in + * initially sending packets off of a host. The default multicast route is + * not consulted during forwarding -- exact routes must be specified using + * AddMulticastRoute for that case. + * + * Since we're basically sending packets to some entity we think may know + * better what to do, we don't pay attention to "subtleties" like origin + * address, nor do we worry about forwarding out multiple interfaces. If the + * default multicast route is set, it is returned as the selected route from + * LookupStatic irrespective of origin or multicast group if another specific + * route is not found. + * + * @param outputInterface The network interface index used to specify where + * to send packets in the case of unknown routes. + * + * @see Ipv4Address + */ + Ipv4::SetDefaultMulticastRoute (uint32_t outputInterface) + +For a host wanting to receive multicast data, the following function is used +to join each multicast group. + + /** + * \brief Join a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + Ipv4::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); + +To stop receiving multicast data, the following function is used: + + /** + * \brief Leave a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + +There are new lookup functions implemented in Ipv4: + + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified IP address. + * \param addr The IP address assigned to the interface of interest. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address as a parameter and + * returns the interface index of the first interface that has been assigned + * that address. If the address is not found, this function asserts. + */ + Ipv4::FindInterfaceForAddr (Ipv4Address addr) const; + + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified (masked) IP address. + * \param addr The IP address assigned to the interface of interest. + * \param mask The address mask to be used in address matching. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address and an IP address + * mask as parameters and returns the interface index of the first interface + * that matches the masked IP address. + */ + Ipv4::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; + +Also, there are various methods to lookup and iterate the static multicast +routes of a node, in the Ipv4StaticRouting class. + +3. Dependencies: + +- fix for bug 69 (source Ipv4 address is set correctly for UDP) +- fix for OnOffApplication that receives data + +4. Open issues or features not included + +- choose source interface on a per-group basis when a host is multihomed diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index c7bf1a652..764d0016b 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -369,14 +369,17 @@ public: * We tell the routing system what to do in the case where a specific route * to a destination multicast group is not found. The system forwards * packets out the specified interface in the hope that "something out there" - * knows better how to route the packet. + * knows better how to route the packet. This method is only used in + * initially sending packets off of a host. The default multicast route is + * not consulted during forwarding -- exact routes must be specified using + * AddMulticastRoute for that case. * - * Since we're basically forwarding packets to some entity we think may know - * better what to do, we don't pay attention to subleties like origin address - * and input interface, nor do we worry about forwarding out multiple - * interfaces. If the default multicast route is set, it is returned as the - * selected route from LookupStatic irrespective of origin, multicast group or - * input interface if another specific route is not found. + * Since we're basically sending packets to some entity we think may know + * better what to do, we don't pay attention to "subtleties" like origin + * address, nor do we worry about forwarding out multiple interfaces. If the + * default multicast route is set, it is returned as the selected route from + * LookupStatic irrespective of origin or multicast group if another specific + * route is not found. * * @param outputInterface The network interface index used to specify where * to send packets in the case of unknown routes. From 16f4b9d73d9c136af977543f2ca9d1fd7359013c Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 6 Sep 2007 16:24:17 -0700 Subject: [PATCH 129/218] monster changeset --- README.multicast-routing | 28 +- changeset.txt | 12278 +++++++++++++++++++++++++++++++++++++ 2 files changed, 12303 insertions(+), 3 deletions(-) create mode 100644 changeset.txt diff --git a/README.multicast-routing b/README.multicast-routing index a5afda564..2fe30532e 100644 --- a/README.multicast-routing +++ b/README.multicast-routing @@ -6,7 +6,7 @@ routing to ns-3. This extension allows the simulation user to: -- manually add an Ipv4 multicast route to a router +- manually add Ipv4 multicast routes to a router - specify a default outgoing interface for multicast sources (hosts) in various ways - allow a multicast receiver (hosts) to join a multicast group, to enable @@ -29,7 +29,7 @@ also touched are: virtual methods. - src/internet-node/ (several files have added tracing) -- an example script is in examples/csma-multicast.cc +- a heavily commented example script is in examples/csma-multicast.cc 2. API: @@ -114,9 +114,31 @@ To remove a route, one uses: * @see Ipv4MulticastRoute * @see Ipv4StaticRouting::AddMulticastRoute */ - Ipv4::RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, + Ipv4::RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, uint32_t inputInterface) +For symmetry with the unicast routing interface, a method is provided to +remove routes by index: + +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that if the default route has been set, calling + * RemoveMulticastRoute (0) will remove the default route. + * + * @param index The index (into the multicast routing table) of the route to + * remove. If the default route has been set, it will occupy index zero. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ + void RemoveMulticastRoute (uint32_t index); + For compatibility, and to provide simplicity, one can set a default multicast route for a host originating data: diff --git a/changeset.txt b/changeset.txt new file mode 100644 index 000000000..837107a48 --- /dev/null +++ b/changeset.txt @@ -0,0 +1,12278 @@ +searching for changes +changeset: 1278:a8f3d01d4a2c +user: Craig Dowell +date: Sun Aug 12 13:59:49 2007 -0700 +summary: untested multicast support + +diff -r c26bf0511078 -r a8f3d01d4a2c examples/csma-multicast.cc +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/examples/csma-multicast.cc Sun Aug 12 13:59:49 2007 -0700 +@@ -0,0 +1,173 @@ ++/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ ++/* ++ * 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 ++ */ ++ ++// Network topology ++// ++// n0 n1 n2 n3 ++// | | | | ++// ===================== ++// ++// - CBR/UDP flows from n0 to n1, and from n3 to n0 ++// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. ++// (i.e., DataRate of 448,000 bps) ++// - DropTail queues ++// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" ++ ++#include ++#include ++#include ++#include ++ ++#include "ns3/command-line.h" ++#include "ns3/default-value.h" ++#include "ns3/ptr.h" ++#include "ns3/random-variable.h" ++#include "ns3/debug.h" ++ ++#include "ns3/simulator.h" ++#include "ns3/nstime.h" ++#include "ns3/data-rate.h" ++ ++#include "ns3/ascii-trace.h" ++#include "ns3/pcap-trace.h" ++#include "ns3/internet-node.h" ++#include "ns3/csma-channel.h" ++#include "ns3/csma-net-device.h" ++#include "ns3/csma-topology.h" ++#include "ns3/csma-ipv4-topology.h" ++#include "ns3/eui48-address.h" ++#include "ns3/ipv4-address.h" ++#include "ns3/inet-socket-address.h" ++#include "ns3/ipv4.h" ++#include "ns3/socket.h" ++#include "ns3/ipv4-route.h" ++#include "ns3/onoff-application.h" ++ ++using namespace ns3; ++ ++int ++main (int argc, char *argv[]) ++{ ++ // Users may find it convenient to turn on explicit debugging ++ // for selected modules; the below lines suggest how to do this ++#if 0 ++ DebugComponentEnable("CsmaNetDevice"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("NetDevice"); ++ DebugComponentEnable("Channel"); ++ DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("PacketSocket"); ++#endif ++ ++ // Set up some default values for the simulation. Use the Bind() ++ // technique to tell the system what subclass of Queue to use, ++ // and what the queue limit is ++ ++ // The below Bind command tells the queue factory which class to ++ // instantiate, when the queue factory is invoked in the topology code ++ DefaultValue::Bind ("Queue", "DropTailQueue"); ++ ++ // Allow the user to override any of the defaults and the above ++ // Bind()s at run-time, via command-line arguments ++ CommandLine::Parse (argc, argv); ++ ++ // Here, we will explicitly create four nodes. In more sophisticated ++ // topologies, we could configure a node factory. ++ Ptr n0 = Create (); ++ Ptr n1 = Create (); ++ Ptr n2 = Create (); ++ Ptr n3 = Create (); ++ ++ // We create the channels first without any IP addressing information ++ Ptr channel0 = ++ CsmaTopology::CreateCsmaChannel( ++ DataRate(5000000), MilliSeconds(2)); ++ ++ uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, ++ Eui48Address("10:54:23:54:23:50")); ++ uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, ++ Eui48Address("10:54:23:54:23:51")); ++ uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, ++ Eui48Address("10:54:23:54:23:52")); ++ uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, ++ Eui48Address("10:54:23:54:23:53")); ++ ++ // Later, we add IP addresses. ++ CsmaIpv4Topology::AddIpv4Address ( ++ n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); ++ ++ // Configure multicasting ++ Ipv4Address multicastSource ("10.1.1.1"); ++ Ipv4Address multicastGroup ("225.0.0.0"); ++ ++ Ptr ipv4; ++ ipv4 = n0->QueryInterface (Ipv4::iid); ++ ++ std::vector outputInterfaces (1); ++ outputInterfaces[0] = n0ifIndex; ++ ++ ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, ++ outputInterfaces); ++ ++ ipv4 = n1->QueryInterface (Ipv4::iid); ++ ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ ++ ipv4 = n2->QueryInterface (Ipv4::iid); ++ ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ ++ ipv4 = n3->QueryInterface (Ipv4::iid); ++ ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ ++ // Create the OnOff application to send UDP datagrams of size ++ // 210 bytes at a rate of 448 Kb/s ++ // from n0 to n1 ++ Ptr ooff = Create ( ++ n0, ++ InetSocketAddress (multicastGroup, 80), ++ "Udp", ++ ConstantVariable(1), ++ ConstantVariable(0)); ++ // Start the application ++ ooff->Start(Seconds(1.0)); ++ ooff->Stop (Seconds(10.0)); ++ ++ // Configure tracing of all enqueue, dequeue, and NetDevice receive events ++ // Trace output will be sent to the csma-one-subnet.tr file ++ AsciiTrace asciitrace ("csma-one-subnet.tr"); ++ asciitrace.TraceAllNetDeviceRx (); ++ asciitrace.TraceAllQueues (); ++ ++ // Also configure some tcpdump traces; each interface will be traced ++ // The output files will be named ++ // simple-point-to-point.pcap-- ++ // and can be read by the "tcpdump -r" command (use "-tt" option to ++ // display timestamps correctly) ++ PcapTrace pcaptrace ("csma-one-subnet.pcap"); ++ pcaptrace.TraceAllIp (); ++ ++ Simulator::Run (); ++ ++ Simulator::Destroy (); ++} +diff -r c26bf0511078 -r a8f3d01d4a2c examples/wscript +--- a/examples/wscript Fri Aug 10 13:49:41 2007 -0700 ++++ b/examples/wscript Sun Aug 12 13:59:49 2007 -0700 +@@ -17,3 +17,8 @@ def build(bld): + obj = bld.create_ns3_program('csma-packet-socket', + ['csma', 'internet-node']) + obj.source = 'csma-packet-socket.cc' ++ ++ obj = bld.create_ns3_program('csma-multicast', ++ ['csma', 'internet-node']) ++ obj.source = 'csma-multicast.cc' ++ +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Sun Aug 12 13:59:49 2007 -0700 +@@ -95,6 +95,42 @@ Ipv4Impl::RemoveRoute (uint32_t i) + { + return m_ipv4->RemoveRoute (i); + } ++ ++void ++Ipv4Impl::AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ m_ipv4->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); ++} ++ ++uint32_t ++Ipv4Impl::GetNMulticastRoutes (void) const ++{ ++ return m_ipv4->GetNMulticastRoutes (); ++} ++ ++Ipv4MulticastRoute ++Ipv4Impl::GetMulticastRoute (uint32_t i) const ++{ ++ return *m_ipv4->GetMulticastRoute (i); ++} ++ ++void ++Ipv4Impl::RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface) ++{ ++ m_ipv4->RemoveMulticastRoute (origin, group, inputInterface); ++} ++ ++void ++Ipv4Impl::RemoveMulticastRoute (uint32_t i) ++{ ++ return m_ipv4->RemoveMulticastRoute (i); ++} ++ + uint32_t + Ipv4Impl::AddInterface (Ptr device) + { +@@ -112,6 +148,18 @@ Ipv4Impl::GetNetDevice (uint32_t i) + } + + void ++Ipv4Impl::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) ++{ ++ m_ipv4->JoinMulticastGroup(origin, group); ++} ++ ++void ++Ipv4Impl::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) ++{ ++ m_ipv4->LeaveMulticastGroup(origin, group); ++} ++ ++void + Ipv4Impl::SetAddress (uint32_t i, Ipv4Address address) + { + m_ipv4->SetAddress (i, address); +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-impl.h +--- a/src/internet-node/ipv4-impl.h Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-impl.h Sun Aug 12 13:59:49 2007 -0700 +@@ -55,9 +55,27 @@ public: + virtual uint32_t GetNRoutes (void); + virtual Ipv4Route GetRoute (uint32_t i); + virtual void RemoveRoute (uint32_t i); ++ ++ ++ virtual void AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces); ++ ++ virtual uint32_t GetNMulticastRoutes (void) const; ++ virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; ++ ++ virtual void RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface); ++ virtual void RemoveMulticastRoute (uint32_t i); ++ + virtual uint32_t AddInterface (Ptr device); + virtual uint32_t GetNInterfaces (void); + virtual Ptr GetNetDevice(uint32_t i); ++ ++ virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + + virtual void SetAddress (uint32_t i, Ipv4Address address); + virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask); +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 13:59:49 2007 -0700 +@@ -17,6 +17,7 @@ + // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + // + // Author: George F. Riley ++// Craig Dowell + // + + #include "ns3/packet.h" +@@ -131,7 +132,8 @@ void + void + Ipv4L3Protocol::DoDispose (void) + { +- for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) ++ for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); ++ i != m_interfaces.end (); i++) + { + delete (*i); + } +@@ -224,12 +226,15 @@ Ipv4L3Protocol::Lookup (Ipv4Header const + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) + { +- for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); +- rprotoIter != m_routingProtocols.end (); rprotoIter++) ++ for (Ipv4RoutingProtocolList::const_iterator rprotoIter = ++ m_routingProtocols.begin (); ++ rprotoIter != m_routingProtocols.end (); ++ rprotoIter++) + { + if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) + return; + } ++ + // No route found + routeReply (false, Ipv4Route (), packet, ipHeader); + } +@@ -261,6 +266,41 @@ Ipv4L3Protocol::RemoveRoute (uint32_t in + m_staticRouting->RemoveRoute (index); + } + ++void ++Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ m_staticRouting->AddMulticastRoute (origin, group, inputInterface, ++ outputInterfaces); ++} ++ ++uint32_t ++Ipv4L3Protocol::GetNMulticastRoutes (void) const ++{ ++ return m_staticRouting->GetNMulticastRoutes (); ++} ++ ++Ipv4MulticastRoute * ++Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const ++{ ++ return m_staticRouting->GetMulticastRoute (index); ++} ++ ++void ++Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface) ++{ ++ m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); ++} ++ ++void ++Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) ++{ ++ m_staticRouting->RemoveMulticastRoute (index); ++} + + uint32_t + Ipv4L3Protocol::AddInterface (Ptr device) +@@ -463,12 +503,28 @@ Ipv4L3Protocol::Forwarding (Packet const + } + ipHeader.SetTtl (ipHeader.GetTtl () - 1); + +- NS_DEBUG ("not for me -- forwarding."); ++ NS_DEBUG ("forwarding."); + Lookup (ipHeader, packet, + MakeCallback (&Ipv4L3Protocol::SendRealOut, this)); ++// ++// If this is a to a multicast address and this node is a member of the ++// indicated group we need to return false so the multicast is forwarded up. ++// Note that we may have just forwarded this packet too. ++// ++ for (Ipv4MulticastGroupList::const_iterator i = m_multicastGroups.begin (); ++ i != m_multicastGroups.end (); i++) ++ { ++ if ((*i).first.IsEqual (ipHeader.GetSource ()) && ++ (*i).second.IsEqual (ipHeader.GetDestination ())) ++ { ++ NS_DEBUG ("for me 5"); ++ return false; ++ } ++ } ++ ++ NS_DEBUG ("not for me."); + return true; + } +- + + void + Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) +@@ -476,6 +532,28 @@ Ipv4L3Protocol::ForwardUp (Packet p, Ipv + Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); + Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); + protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); ++} ++ ++void ++Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) ++{ ++ m_multicastGroups.push_back( ++ std::pair (origin, group)); ++} ++ ++void ++Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) ++{ ++ for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); ++ i != m_multicastGroups.end (); ++ i++) ++ { ++ if ((*i).first.IsEqual(origin) && (*i).second.IsEqual(group)) ++ { ++ m_multicastGroups.erase (i); ++ return; ++ } ++ } + } + + void +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Sun Aug 12 13:59:49 2007 -0700 +@@ -158,11 +158,26 @@ public: + Ipv4Route *GetRoute (uint32_t i); + void RemoveRoute (uint32_t i); + ++ void AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces); ++ ++ uint32_t GetNMulticastRoutes (void) const; ++ Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; ++ ++ void RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface); ++ void RemoveMulticastRoute (uint32_t i); ++ + uint32_t AddInterface (Ptr device); + Ipv4Interface * GetInterface (uint32_t i) const; + uint32_t GetNInterfaces (void) const; +- + ++ virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ + void SetAddress (uint32_t i, Ipv4Address address); + void SetNetworkMask (uint32_t i, Ipv4Mask mask); + Ipv4Mask GetNetworkMask (uint32_t t) const; +@@ -192,7 +207,10 @@ private: + TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; + + typedef std::list Ipv4InterfaceList; +- typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; ++ typedef std::list > ++ Ipv4MulticastGroupList; ++ typedef std::list > > ++ Ipv4RoutingProtocolList; + + Ipv4InterfaceList m_interfaces; + uint32_t m_nInterfaces; +@@ -206,6 +224,7 @@ private: + Ipv4RoutingProtocolList m_routingProtocols; + + Ptr m_staticRouting; ++ Ipv4MulticastGroupList m_multicastGroups; + }; + + } // Namespace ns3 +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Sun Aug 12 13:59:49 2007 -0700 +@@ -18,10 +18,10 @@ + // + // Author: George F. Riley + // Gustavo Carneiro ++// Craig Dowell + + #include "ipv4-static-routing.h" + #include "ns3/packet.h" +- + + namespace ns3 { + +@@ -77,6 +77,83 @@ Ipv4StaticRouting::SetDefaultRoute (Ipv4 + m_defaultRoute = route; + } + ++void ++Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); ++ *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, ++ inputInterface, outputInterfaces); ++ m_multicastRoutes.push_back (route); ++} ++ ++uint32_t ++Ipv4StaticRouting::GetNMulticastRoutes (void) const ++{ ++ return m_multicastRoutes.size (); ++} ++ ++Ipv4MulticastRoute * ++Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const ++{ ++ NS_ASSERT_MSG(index < m_multicastRoutes.size (), ++ "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); ++ ++ uint32_t tmp = 0; ++ for (MulticastRoutesCI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ if (tmp == index) ++ { ++ return *i; ++ } ++ tmp++; ++ } ++ return 0; ++} ++ ++void ++Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface) ++{ ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ Ipv4MulticastRoute *route = *i; ++ if (origin == route->GetOrigin () && ++ group == route->GetGroup () && ++ inputInterface == route->GetInputInterface ()) ++ { ++ delete *i; ++ m_multicastRoutes.erase (i); ++ return; ++ } ++ } ++} ++ ++void ++Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) ++{ ++ uint32_t tmp = 0; ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ if (tmp == index) ++ { ++ delete *i; ++ m_multicastRoutes.erase (i); ++ return; ++ } ++ tmp++; ++ } ++} ++ + Ipv4Route * + Ipv4StaticRouting::LookupStatic (Ipv4Address dest) + { +@@ -106,6 +183,25 @@ Ipv4StaticRouting::LookupStatic (Ipv4Add + { + NS_ASSERT (m_defaultRoute->IsDefault ()); + return m_defaultRoute; ++ } ++ return 0; ++} ++ ++Ipv4MulticastRoute * ++Ipv4StaticRouting::LookupStatic ( ++ Ipv4Address origin, ++ Ipv4Address group) ++{ ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ Ipv4MulticastRoute *route = *i; ++ if (origin == route->GetOrigin () && ++ group == route->GetGroup ()) ++ { ++ return *i; ++ } + } + return 0; + } +@@ -213,6 +309,27 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + Packet packet, + RouteReplyCallback routeReply) + { ++// ++// First, see if this is a multicast packet we have a route for. If we ++// have a route, then send the packet down each of the specified interfaces. ++// ++ Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), ++ ipHeader.GetDestination ()); ++ if (mRoute) ++ { ++ for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) ++ { ++ Packet p = packet; ++ Ipv4Route route = ++ Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), ++ mRoute->GetOutputInterface(i)); ++ routeReply (true, route, p, ipHeader); ++ return true; ++ } ++ } ++// ++// See if this is a unicast packet we have a route for. ++// + Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); + if (route != 0) + { +@@ -246,8 +363,13 @@ Ipv4StaticRouting::DoDispose (void) + delete m_defaultRoute; + m_defaultRoute = 0; + } ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i = m_multicastRoutes.erase (i)) ++ { ++ delete (*i); ++ } + Ipv4RoutingProtocol::DoDispose (); + } + +- + }//namespace ns3 +diff -r c26bf0511078 -r a8f3d01d4a2c src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Sun Aug 12 13:59:49 2007 -0700 +@@ -75,6 +75,20 @@ public: + Ipv4Route *GetRoute (uint32_t i); + void RemoveRoute (uint32_t i); + ++ void AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces); ++ ++ uint32_t GetNMulticastRoutes (void) const; ++ Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; ++ ++ void RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface); ++ ++ void RemoveMulticastRoute (uint32_t index); ++ + protected: + void DoDispose (void); + +@@ -86,14 +100,18 @@ private: + typedef std::list::const_iterator NetworkRoutesCI; + typedef std::list::iterator NetworkRoutesI; + ++ typedef std::list MulticastRoutes; ++ typedef std::list::const_iterator MulticastRoutesCI; ++ typedef std::list::iterator MulticastRoutesI; ++ + Ipv4Route *LookupStatic (Ipv4Address dest); ++ Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group); + + HostRoutes m_hostRoutes; + NetworkRoutes m_networkRoutes; + Ipv4Route *m_defaultRoute; ++ MulticastRoutes m_multicastRoutes; + }; +- +- + + } // Namespace ns3 + +diff -r c26bf0511078 -r a8f3d01d4a2c src/node/ipv4-route.cc +--- a/src/node/ipv4-route.cc Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/node/ipv4-route.cc Sun Aug 12 13:59:49 2007 -0700 +@@ -137,7 +137,6 @@ Ipv4Route::GetInterface (void) const + return m_interface; + } + +- + Ipv4Route + Ipv4Route::CreateHostRouteTo (Ipv4Address dest, + Ipv4Address nextHop, +@@ -220,4 +219,99 @@ std::ostream& operator<< (std::ostream& + return os; + } + ++/***************************************************** ++ * Ipv4MulticastRoute ++ *****************************************************/ ++ ++Ipv4MulticastRoute::Ipv4MulticastRoute () ++{ ++} ++ ++Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const &route) ++: ++ m_origin (route.m_origin), ++ m_group (route.m_group), ++ m_inputInterface (route.m_inputInterface), ++ m_outputInterfaces (route.m_outputInterfaces) ++{ ++} ++ ++Ipv4MulticastRoute::Ipv4MulticastRoute ( ++ Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ m_origin = origin; ++ m_group = group; ++ m_inputInterface = inputInterface; ++ m_outputInterfaces = outputInterfaces; ++} ++ ++Ipv4Address ++Ipv4MulticastRoute::GetOrigin (void) const ++{ ++ return m_origin; ++} ++ ++Ipv4Address ++Ipv4MulticastRoute::GetGroup (void) const ++{ ++ return m_group; ++} ++ ++uint32_t ++Ipv4MulticastRoute::GetInputInterface (void) const ++{ ++ return m_inputInterface; ++} ++ ++uint32_t ++Ipv4MulticastRoute::GetNOutputInterfaces (void) const ++{ ++ return m_outputInterfaces.size (); ++} ++ ++uint32_t ++Ipv4MulticastRoute::GetOutputInterface (uint32_t n) const ++{ ++ NS_ASSERT_MSG(n < m_outputInterfaces.size (), ++ "Ipv4MulticastRoute::GetOutputInterface (): index out of bounds"); ++ ++ return m_outputInterfaces[n]; ++} ++ ++std::vector ++Ipv4MulticastRoute::GetOutputInterfaces (void) const ++{ ++ return m_outputInterfaces; ++} ++ ++Ipv4MulticastRoute ++Ipv4MulticastRoute::CreateMulticastRoute ( ++ Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ return Ipv4MulticastRoute (origin, group, inputInterface, outputInterfaces); ++} ++ ++std::ostream& ++operator<< (std::ostream& os, Ipv4MulticastRoute const& route) ++{ ++ os << "origin=" << route.GetOrigin () << ++ ", group=" << route.GetGroup () << ++ ", input interface=" << route.GetInputInterface () << ++ ", output interfaces="; ++ ++ for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i) ++ { ++ os << route.GetOutputInterface (i) << " "; ++ ++ } ++ ++ return os; ++} ++ + }//namespace ns3 +diff -r c26bf0511078 -r a8f3d01d4a2c src/node/ipv4-route.h +--- a/src/node/ipv4-route.h Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/node/ipv4-route.h Sun Aug 12 13:59:49 2007 -0700 +@@ -22,6 +22,7 @@ + #define IPV4_ROUTE_H + + #include ++#include + #include + + #include "ipv4-address.h" +@@ -98,6 +99,67 @@ private: + + std::ostream& operator<< (std::ostream& os, Ipv4Route const& route); + ++/** ++ * \brief A record of an IPv4 multicast route ++ */ ++class Ipv4MulticastRoute { ++public: ++ /** ++ * \brief This constructor does nothing ++ */ ++ Ipv4MulticastRoute (); ++ /** ++ * \brief Copy Constructor ++ * \param route The route to copy ++ */ ++ Ipv4MulticastRoute (Ipv4MulticastRoute const &route); ++ ++ /** ++ * \return The IPv4 address of the source of this route ++ */ ++ Ipv4Address GetOrigin (void) const; ++ ++ /** ++ * \return The IPv4 address of the multicast group of this route ++ */ ++ Ipv4Address GetGroup (void) const; ++ ++ /** ++ * \return The IPv4 address of the input interface of this route ++ */ ++ uint32_t GetInputInterface (void) const; ++ ++ /** ++ * \return The number of output interfaces of this route ++ */ ++ uint32_t GetNOutputInterfaces (void) const; ++ ++ /** ++ * \return A specified output interface. ++ */ ++ uint32_t GetOutputInterface (uint32_t n) const; ++ ++ /** ++ * \return A vector of all of the output interfaces of this route. ++ */ ++ std::vector GetOutputInterfaces (void) const; ++ ++ static Ipv4MulticastRoute CreateMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, uint32_t inputInterface, ++ std::vector outputInterfaces); ++ ++private: ++ Ipv4MulticastRoute (Ipv4Address origin, Ipv4Address group, ++ uint32_t inputInterface, std::vector outputInterfaces); ++ ++ Ipv4Address m_origin; ++ Ipv4Address m_group; ++ uint32_t m_inputInterface; ++ std::vector m_outputInterfaces; ++}; ++ ++std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoute const& route); ++ + }//namespace ns3 + + #endif /* IPV4_ROUTE_H */ +diff -r c26bf0511078 -r a8f3d01d4a2c src/node/ipv4.h +--- a/src/node/ipv4.h Fri Aug 10 13:49:41 2007 -0700 ++++ b/src/node/ipv4.h Sun Aug 12 13:59:49 2007 -0700 +@@ -202,7 +202,49 @@ public: + * \param i index of route to remove from routing table. + */ + virtual void RemoveRoute (uint32_t i) = 0; ++ ++ /** ++ * \brief Add a static multicast route for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ * \param inputInterface The interface index over which the packet arrived. ++ * \param outputInterfaces The list of output interface indices over which ++ * the packet should be sent (excluding the inputInterface). ++ */ ++ virtual void AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) = 0; ++ /** ++ * \brief Remove a static multicast route for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ * \param inputInterface The interface index over which the packet arrived. ++ */ ++ virtual void RemoveMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface) = 0; + ++ /** ++ * \returns the number of entries in the multicast routing table. ++ */ ++ virtual uint32_t GetNMulticastRoutes (void) const = 0; ++ ++ /** ++ * \param i index of route to return ++ * \returns the route whose index is i ++ */ ++ virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const = 0; ++ ++ /** ++ * \param i index of route to remove from routing table. ++ */ ++ virtual void RemoveMulticastRoute (uint32_t i) = 0; ++ + /** + * \param device device to add to the list of ipv4 interfaces + * which can be used as output interfaces during packet forwarding. +@@ -225,6 +267,24 @@ public: + virtual Ptr GetNetDevice (uint32_t i) = 0; + + /** ++ * \brief Join a multicast group for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ */ ++ virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; ++ ++ /** ++ * \brief Leave a multicast group for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ */ ++ virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; ++ ++ /** + * \param i index of ipv4 interface + * \param address address to associate to the underlying ipv4 interface + */ + +changeset: 1279:31cb0668defd +user: Craig Dowell +date: Sun Aug 12 15:51:12 2007 -0700 +summary: debug prints to make validation easier + +diff -r a8f3d01d4a2c -r 31cb0668defd examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/examples/csma-multicast.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -58,19 +58,36 @@ + + using namespace ns3; + ++NS_DEBUG_COMPONENT_DEFINE ("Me"); ++ + int + main (int argc, char *argv[]) + { + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this + #if 0 ++ DebugComponentEnable("Me"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("PacketSocket"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); + #endif ++ ++ DebugComponentEnable("Me"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("CsmaNetDevice"); ++ DebugComponentEnable("CsmaChannel"); + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, +@@ -86,16 +103,19 @@ main (int argc, char *argv[]) + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. ++ NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + ++ NS_DEBUG("Create channels."); + // We create the channels first without any IP addressing information + Ptr channel0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + ++ NS_DEBUG("Build Topology."); + uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, + Eui48Address("10:54:23:54:23:50")); + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, +@@ -106,6 +126,8 @@ main (int argc, char *argv[]) + Eui48Address("10:54:23:54:23:53")); + + // Later, we add IP addresses. ++ NS_DEBUG("Assign IP Addresses."); ++ + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); + +@@ -119,6 +141,7 @@ main (int argc, char *argv[]) + n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); + + // Configure multicasting ++ NS_DEBUG("Configure multicasting."); + Ipv4Address multicastSource ("10.1.1.1"); + Ipv4Address multicastGroup ("225.0.0.0"); + +@@ -142,7 +165,8 @@ main (int argc, char *argv[]) + + // Create the OnOff application to send UDP datagrams of size + // 210 bytes at a rate of 448 Kb/s +- // from n0 to n1 ++ // from n0 to the multicast group ++ NS_DEBUG("Create Applications."); + Ptr ooff = Create ( + n0, + InetSocketAddress (multicastGroup, 80), +@@ -155,7 +179,8 @@ main (int argc, char *argv[]) + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-one-subnet.tr file +- AsciiTrace asciitrace ("csma-one-subnet.tr"); ++ NS_DEBUG("Configure Tracing."); ++ AsciiTrace asciitrace ("csma-multicast.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); + +@@ -164,10 +189,11 @@ main (int argc, char *argv[]) + // simple-point-to-point.pcap-- + // and can be read by the "tcpdump -r" command (use "-tt" option to + // display timestamps correctly) +- PcapTrace pcaptrace ("csma-one-subnet.pcap"); ++ PcapTrace pcaptrace ("csma-multicast.pcap"); + pcaptrace.TraceAllIp (); + ++ NS_DEBUG("Run Simulation."); + Simulator::Run (); +- + Simulator::Destroy (); ++ NS_DEBUG("Done."); + } +diff -r a8f3d01d4a2c -r 31cb0668defd src/applications/onoff-application.cc +--- a/src/applications/onoff-application.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/src/applications/onoff-application.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -22,6 +22,7 @@ + // George F. Riley, Georgia Tech, Spring 2007 + // Adapted from ApplicationOnOff in GTNetS. + ++#include "ns3/debug.h" + #include "ns3/address.h" + #include "ns3/node.h" + #include "ns3/nstime.h" +@@ -34,6 +35,8 @@ + #include "ns3/packet.h" + #include "onoff-application.h" + ++NS_DEBUG_COMPONENT_DEFINE ("OnOffApplication"); ++ + using namespace std; + + namespace ns3 { +@@ -95,30 +98,37 @@ OnOffApplication::Construct (Ptr n + m_iid = iid; + } + +- + OnOffApplication::~OnOffApplication() +-{} ++{ ++ NS_DEBUG("OnOffApplication::~OnOffApplication()"); ++} + + void + OnOffApplication::SetMaxBytes(uint32_t maxBytes) + { ++ NS_DEBUG("OnOffApplication::SetMaxBytes(" << maxBytes << ")"); + m_maxBytes = maxBytes; + } + + void + OnOffApplication::SetDefaultRate (const DataRate &rate) + { ++ NS_DEBUG("OnOffApplication::SetDefaultRate(" << &rate << ")"); + g_defaultRate.SetValue (rate); + } ++ + void + OnOffApplication::SetDefaultSize (uint32_t size) + { ++ NS_DEBUG("OnOffApplication::SetDefaultSize(" << size << ")"); + g_defaultSize.SetValue (size); + } + + void + OnOffApplication::DoDispose (void) + { ++ NS_DEBUG("OnOffApplication::DoDispose()"); ++ + m_socket = 0; + delete m_onTime; + delete m_offTime; +@@ -130,10 +140,11 @@ OnOffApplication::DoDispose (void) + Application::DoDispose (); + } + +- + // Application Methods +-void OnOffApplication::StartApplication() // Called at time specified by Start +-{ ++void OnOffApplication::StartApplication() // Called at time specified by Start ++{ ++ NS_DEBUG("OnOffApplication::StartApplication()"); ++ + // Create the socket if not already + if (!m_socket) + { +@@ -151,8 +162,10 @@ void OnOffApplication::StartApplication( + ScheduleStartEvent(); + } + +-void OnOffApplication::StopApplication() // Called at time specified by Stop +-{ ++void OnOffApplication::StopApplication() // Called at time specified by Stop ++{ ++ NS_DEBUG("OnOffApplication::StopApplication()"); ++ + if (m_sendEvent.IsRunning ()) + { // Cancel the pending send packet event + // Calculate residual bits since last packet sent +@@ -166,17 +179,23 @@ void OnOffApplication::StopApplication() + // Event handlers + void OnOffApplication::StartSending() + { ++ NS_DEBUG("OnOffApplication::StartSending ()"); ++ + ScheduleNextTx(); // Schedule the send packet event + } + + void OnOffApplication::StopSending() + { ++ NS_DEBUG("OnOffApplication::StopSending ()"); ++ + Simulator::Cancel(m_sendEvent); + } + + // Private helpers + void OnOffApplication::ScheduleNextTx() + { ++ NS_DEBUG("OnOffApplication::ScheduleNextTx ()"); ++ + if (m_totBytes < m_maxBytes) + { + uint32_t bits = m_pktSize * 8 - m_residualBits; +@@ -192,12 +211,16 @@ void OnOffApplication::ScheduleNextTx() + + void OnOffApplication::ScheduleStartEvent() + { // Schedules the event to start sending data (switch to the "On" state) ++ NS_DEBUG("OnOffApplication::ScheduleStartEvent ()"); ++ + Time offInterval = Seconds(m_offTime->GetValue()); + m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); + } + + void OnOffApplication::ScheduleStopEvent() + { // Schedules the event to stop sending data (switch to "Off" state) ++ NS_DEBUG("OnOffApplication::ScheduleStopEvent ()"); ++ + Time onInterval = Seconds(m_onTime->GetValue()); + Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this); + } +@@ -205,6 +228,8 @@ void OnOffApplication::ScheduleStopEvent + + void OnOffApplication::SendPacket() + { ++ NS_DEBUG("OnOffApplication::SendPacket ()"); ++ + NS_ASSERT (m_sendEvent.IsExpired ()); + m_socket->Send(Packet (m_pktSize)); + m_totBytes += m_pktSize; +@@ -215,6 +240,8 @@ void OnOffApplication::SendPacket() + + void OnOffApplication::ConnectionSucceeded(Ptr) + { ++ NS_DEBUG("OnOffApplication::ConnectionSucceeded ()"); ++ + m_connected = true; + ScheduleStartEvent(); + } +diff -r a8f3d01d4a2c -r 31cb0668defd src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -17,7 +17,6 @@ + // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + // + // Author: George F. Riley +-// Craig Dowell + // + + #include "ns3/packet.h" +@@ -121,17 +120,24 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr + m_identification (0), + m_node (node) + { ++ NS_DEBUG("Ipv4L3Protocol::Ipv4L3Protocol ()"); ++ + SetInterfaceId (Ipv4L3Protocol::iid); + m_staticRouting = Create (); + AddRoutingProtocol (m_staticRouting, 0); + SetupLoopback (); + } ++ + Ipv4L3Protocol::~Ipv4L3Protocol () +-{} ++{ ++ NS_DEBUG("Ipv4L3Protocol::~Ipv4L3Protocol ()"); ++} + + void + Ipv4L3Protocol::DoDispose (void) + { ++ NS_DEBUG("Ipv4L3Protocol::DoDispose ()"); ++ + for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); + i != m_interfaces.end (); i++) + { +@@ -147,6 +153,8 @@ void + void + Ipv4L3Protocol::SetupLoopback (void) + { ++ NS_DEBUG("Ipv4L3Protocol::SetupLoopback ()"); ++ + Ipv4LoopbackInterface * interface = new Ipv4LoopbackInterface (m_node); + interface->SetAddress (Ipv4Address::GetLoopback ()); + interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); +@@ -158,6 +166,8 @@ TraceResolver * + TraceResolver * + Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) + { ++ NS_DEBUG("Ipv4L3Protocol::CreateTraceResolver ()"); ++ + CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); + resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); +@@ -170,6 +180,8 @@ TraceResolver * + TraceResolver * + Ipv4L3Protocol::InterfacesCreateTraceResolver (TraceContext const &context) const + { ++ NS_DEBUG("Ipv4L3Protocol::InterfacesCreateTraceResolver ()"); ++ + ArrayTraceResolver *resolver = + new ArrayTraceResolver + (context, +@@ -181,6 +193,7 @@ void + void + Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl) + { ++ NS_DEBUG("Ipv4L3Protocol::SetDefaultTtl ()"); + m_defaultTtl = ttl; + } + +@@ -190,20 +203,28 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Addr + Ipv4Address nextHop, + uint32_t interface) + { ++ NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << nextHop << ++ ", " << interface << ")"); + m_staticRouting->AddHostRouteTo (dest, nextHop, interface); + } ++ + void + Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, + uint32_t interface) + { ++ NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << ++ interface << ")"); + m_staticRouting->AddHostRouteTo (dest, interface); + } ++ + void + Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, + Ipv4Mask networkMask, + Ipv4Address nextHop, + uint32_t interface) + { ++ NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << ++ networkMask << ", " << nextHop << ", " << interface << ")"); + m_staticRouting->AddNetworkRouteTo (network, networkMask, nextHop, interface); + } + void +@@ -211,26 +232,33 @@ Ipv4L3Protocol::AddNetworkRouteTo (Ipv4A + Ipv4Mask networkMask, + uint32_t interface) + { ++ NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << ++ networkMask << ", " << interface << ")"); + m_staticRouting->AddNetworkRouteTo (network, networkMask, interface); + } + void + Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, + uint32_t interface) + { ++ NS_DEBUG("Ipv4L3Protocol::SetDefaultRoute (" << nextHop << ", " << ++ interface << ")"); + m_staticRouting->SetDefaultRoute (nextHop, interface); + } +- + + void + Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) + { ++ NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << ", " << &packet << ++ &routeReply << ")"); ++ + for (Ipv4RoutingProtocolList::const_iterator rprotoIter = + m_routingProtocols.begin (); + rprotoIter != m_routingProtocols.end (); + rprotoIter++) + { ++ NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting route"); + if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) + return; + } +@@ -243,6 +271,8 @@ Ipv4L3Protocol::AddRoutingProtocol (Ptr< + Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, + int priority) + { ++ NS_DEBUG("Ipv4L3Protocol::AddRoutingProtocol (" << &routingProtocol << ++ ", " << priority << ")"); + m_routingProtocols.push_back + (std::pair > (-priority, routingProtocol)); + m_routingProtocols.sort (); +@@ -251,18 +281,21 @@ uint32_t + uint32_t + Ipv4L3Protocol::GetNRoutes (void) + { ++ NS_DEBUG("Ipv4L3Protocol::GetNRoutes ()"); + return m_staticRouting->GetNRoutes (); + } + + Ipv4Route * + Ipv4L3Protocol::GetRoute (uint32_t index) + { ++ NS_DEBUG("Ipv4L3Protocol::GetRoute ()"); + return m_staticRouting->GetRoute (index); + } + + void + Ipv4L3Protocol::RemoveRoute (uint32_t index) + { ++ NS_DEBUG("Ipv4L3Protocol::RemoveRoute (" << index << ")"); + m_staticRouting->RemoveRoute (index); + } + +@@ -272,6 +305,9 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4A + uint32_t inputInterface, + std::vector outputInterfaces) + { ++ NS_DEBUG("Ipv4L3Protocol::AddMulticastRoute (" << origin << ", " << ++ group << ", " << inputInterface << ", " << &outputInterfaces << ")"); ++ + m_staticRouting->AddMulticastRoute (origin, group, inputInterface, + outputInterfaces); + } +@@ -279,12 +315,14 @@ uint32_t + uint32_t + Ipv4L3Protocol::GetNMulticastRoutes (void) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetNMulticastRoutes ()"); + return m_staticRouting->GetNMulticastRoutes (); + } + + Ipv4MulticastRoute * + Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetMulticastRoute (" << index << ")"); + return m_staticRouting->GetMulticastRoute (index); + } + +@@ -293,32 +331,40 @@ Ipv4L3Protocol::RemoveMulticastRoute (Ip + Ipv4Address group, + uint32_t inputInterface) + { ++ NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << origin << ", " << ++ group << ", " << inputInterface << ")"); + m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); + } + + void + Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) + { ++ NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << index << ")"); + m_staticRouting->RemoveMulticastRoute (index); + } + + uint32_t + Ipv4L3Protocol::AddInterface (Ptr device) + { ++ NS_DEBUG("Ipv4L3Protocol::AddInterface (" << &device << ")"); + Ipv4Interface *interface = new ArpIpv4Interface (m_node, device); + return AddIpv4Interface (interface); + } ++ + uint32_t + Ipv4L3Protocol::AddIpv4Interface (Ipv4Interface *interface) + { ++ NS_DEBUG("Ipv4L3Protocol::AddIpv4Interface (" << interface << ")"); + uint32_t index = m_nInterfaces; + m_interfaces.push_back (interface); + m_nInterfaces++; + return index; + } ++ + Ipv4Interface * + Ipv4L3Protocol::GetInterface (uint32_t index) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetInterface (" << index << ")"); + uint32_t tmp = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + { +@@ -330,15 +376,18 @@ Ipv4L3Protocol::GetInterface (uint32_t i + } + return 0; + } ++ + uint32_t + Ipv4L3Protocol::GetNInterfaces (void) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetNInterface ()"); + return m_nInterfaces; + } + + Ipv4Interface * + Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) + { ++ NS_DEBUG("Ipv4L3Protocol::FindInterfaceForDevice (" << &device << ")"); + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + { + if ((*i)->GetDevice () == device) +@@ -352,6 +401,9 @@ void + void + Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) + { ++ NS_DEBUG("Ipv4L3Protocol::Receive (" << &device << ", " << &p << ", " << ++ protocol << ", " << from << ")"); ++ + uint32_t index = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + { +@@ -386,6 +438,9 @@ Ipv4L3Protocol::Send (Packet const &pack + Ipv4Address destination, + uint8_t protocol) + { ++ NS_DEBUG("Ipv4L3Protocol::Send (" << &packet << ", " << source << ", " << ++ ", " << destination << ", " << protocol << ")"); ++ + Ipv4Header ipHeader; + + ipHeader.SetSource (source); +@@ -434,6 +489,9 @@ Ipv4L3Protocol::SendRealOut (bool found, + Packet packet, + Ipv4Header const &ipHeader) + { ++ NS_DEBUG("Ipv4L3Protocol::SendRealOut (" << found << ", " << &route << ++ ", " << &packet << &ipHeader << ")"); ++ + if (!found) + { + NS_DEBUG ("no route to host. drop."); +@@ -458,6 +516,9 @@ bool + bool + Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) + { ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (" << &packet << ", " << &ipHeader << ++ ", " << device << ")"); ++ + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); i++) + { +@@ -529,6 +590,7 @@ void + void + Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) + { ++ NS_DEBUG("Ipv4L3Protocol::ForwardUp (" << &p << ", " << &ip << ")"); + Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); + Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); + protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); +@@ -537,6 +599,8 @@ void + void + Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) + { ++ NS_DEBUG("Ipv4L3Protocol::JoinMulticastGroup (" << origin << ", " << ++ group << ")"); + m_multicastGroups.push_back( + std::pair (origin, group)); + } +@@ -544,6 +608,9 @@ void + void + Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) + { ++ NS_DEBUG("Ipv4L3Protocol::LeaveMulticastGroup (" << origin << ", " << ++ group << ")"); ++ + for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); + i != m_multicastGroups.end (); + i++) +@@ -559,42 +626,55 @@ void + void + Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) + { ++ NS_DEBUG("Ipv4L3Protocol::SetAddress (" << i << ", " << address << ")"); + Ipv4Interface *interface = GetInterface (i); + interface->SetAddress (address); + } ++ + void + Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) + { ++ NS_DEBUG("Ipv4L3Protocol::SetNetworkMask (" << i << ", " << mask << ")"); + Ipv4Interface *interface = GetInterface (i); + interface->SetNetworkMask (mask); + } ++ + Ipv4Mask + Ipv4L3Protocol::GetNetworkMask (uint32_t i) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetNetworkMask (" << i << ")"); + Ipv4Interface *interface = GetInterface (i); + return interface->GetNetworkMask (); + } ++ + Ipv4Address + Ipv4L3Protocol::GetAddress (uint32_t i) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetAddress (" << i << ")"); + Ipv4Interface *interface = GetInterface (i); + return interface->GetAddress (); + } ++ + uint16_t + Ipv4L3Protocol::GetMtu (uint32_t i) const + { ++ NS_DEBUG("Ipv4L3Protocol::GetMtu (" << i << ")"); + Ipv4Interface *interface = GetInterface (i); + return interface->GetMtu (); + } ++ + bool + Ipv4L3Protocol::IsUp (uint32_t i) const + { ++ NS_DEBUG("Ipv4L3Protocol::IsUp (" << i << ")"); + Ipv4Interface *interface = GetInterface (i); + return interface->IsUp (); + } ++ + void + Ipv4L3Protocol::SetUp (uint32_t i) + { ++ NS_DEBUG("Ipv4L3Protocol::SetUp (" << i << ")"); + Ipv4Interface *interface = GetInterface (i); + interface->SetUp (); + +@@ -608,9 +688,11 @@ Ipv4L3Protocol::SetUp (uint32_t i) + interface->GetNetworkMask (), i); + } + } ++ + void + Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) + { ++ NS_DEBUG("Ipv4L3Protocol::SetDown (" << ifaceIndex << ")"); + Ipv4Interface *interface = GetInterface (ifaceIndex); + interface->SetDown (); + +diff -r a8f3d01d4a2c -r 31cb0668defd src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -18,10 +18,12 @@ + // + // Author: George F. Riley + // Gustavo Carneiro +-// Craig Dowell +- ++ ++#include "ns3/debug.h" + #include "ipv4-static-routing.h" + #include "ns3/packet.h" ++ ++NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); + + namespace ns3 { + +@@ -31,10 +33,12 @@ Ipv4StaticRouting::AddHostRouteTo (Ipv4A + Ipv4Address nextHop, + uint32_t interface) + { ++ + Ipv4Route *route = new Ipv4Route (); + *route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface); + m_hostRoutes.push_back (route); + } ++ + void + Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, + uint32_t interface) +@@ -43,6 +47,7 @@ Ipv4StaticRouting::AddHostRouteTo (Ipv4A + *route = Ipv4Route::CreateHostRouteTo (dest, interface); + m_hostRoutes.push_back (route); + } ++ + void + Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, + Ipv4Mask networkMask, +@@ -56,6 +61,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ip + interface); + m_networkRoutes.push_back (route); + } ++ + void + Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, + Ipv4Mask networkMask, +@@ -67,6 +73,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ip + interface); + m_networkRoutes.push_back (route); + } ++ + void + Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, + uint32_t interface) +@@ -197,7 +204,8 @@ Ipv4StaticRouting::LookupStatic ( + i++) + { + Ipv4MulticastRoute *route = *i; +- if (origin == route->GetOrigin () && ++ if ( (origin == route->GetOrigin () || ++ origin == Ipv4Address::GetAny ()) && + group == route->GetGroup ()) + { + return *i; +@@ -309,6 +317,15 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + Packet packet, + RouteReplyCallback routeReply) + { ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << ++ &packet << ", " << &routeReply << ")"); ++ ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): source = " << ++ ipHeader.GetSource ()); ++ ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << ++ ipHeader.GetDestination ()); ++ + // + // First, see if this is a multicast packet we have a route for. If we + // have a route, then send the packet down each of the specified interfaces. +diff -r a8f3d01d4a2c -r 31cb0668defd src/internet-node/udp-l4-protocol.cc +--- a/src/internet-node/udp-l4-protocol.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/src/internet-node/udp-l4-protocol.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -19,6 +19,7 @@ + * Author: Mathieu Lacage + */ + ++#include "ns3/debug.h" + #include "ns3/assert.h" + #include "ns3/packet.h" + #include "ns3/empty-trace-resolver.h" +@@ -31,6 +32,8 @@ + #include "ipv4-l3-protocol.h" + #include "udp-socket.h" + ++NS_DEBUG_COMPONENT_DEFINE ("UdpL4Protocol"); ++ + namespace ns3 { + + /* see http://www.iana.org/assignments/protocol-numbers */ +@@ -40,20 +43,26 @@ UdpL4Protocol::UdpL4Protocol (Ptr + : Ipv4L4Protocol (PROT_NUMBER, 2), + m_node (node), + m_endPoints (new Ipv4EndPointDemux ()) +-{} ++{ ++ NS_DEBUG("UdpL4Protocol::UdpL4Protocol ()"); ++} + + UdpL4Protocol::~UdpL4Protocol () +-{} ++{ ++ NS_DEBUG("UdpL4Protocol::~UdpL4Protocol ()"); ++} + + TraceResolver * + UdpL4Protocol::CreateTraceResolver (TraceContext const &context) + { ++ NS_DEBUG("UdpL4Protocol::CreateTraceResolver ()"); + return new EmptyTraceResolver (context); + } + + void + UdpL4Protocol::DoDispose (void) + { ++ NS_DEBUG("UdpL4Protocol::DoDispose ()"); + if (m_endPoints != 0) + { + delete m_endPoints; +@@ -66,6 +75,7 @@ Ptr + Ptr + UdpL4Protocol::CreateSocket (void) + { ++ NS_DEBUG("UdpL4Protocol::CreateSocket ()"); + Ptr socket = Create (m_node, this); + return socket; + } +@@ -73,27 +83,36 @@ Ipv4EndPoint * + Ipv4EndPoint * + UdpL4Protocol::Allocate (void) + { ++ NS_DEBUG("UdpL4Protocol::Allocate ()"); + return m_endPoints->Allocate (); + } ++ + Ipv4EndPoint * + UdpL4Protocol::Allocate (Ipv4Address address) + { ++ NS_DEBUG("UdpL4Protocol::Allocate (" << address << ")"); + return m_endPoints->Allocate (address); + } ++ + Ipv4EndPoint * + UdpL4Protocol::Allocate (uint16_t port) + { ++ NS_DEBUG("UdpL4Protocol::Allocate (" << port << ")"); + return m_endPoints->Allocate (port); + } ++ + Ipv4EndPoint * + UdpL4Protocol::Allocate (Ipv4Address address, uint16_t port) + { ++ NS_DEBUG("UdpL4Protocol::Allocate (" << address << ", " << port << ")"); + return m_endPoints->Allocate (address, port); + } + Ipv4EndPoint * + UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, + Ipv4Address peerAddress, uint16_t peerPort) + { ++ NS_DEBUG("UdpL4Protocol::Allocate (" << localAddress << ", " << localPort << ++ ", " << peerAddress << ", " << peerPort << ")"); + return m_endPoints->Allocate (localAddress, localPort, + peerAddress, peerPort); + } +@@ -101,6 +120,7 @@ void + void + UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) + { ++ NS_DEBUG("UdpL4Protocol::Deallocate (" << endPoint << ")"); + m_endPoints->DeAllocate (endPoint); + } + +@@ -109,6 +129,9 @@ UdpL4Protocol::Receive(Packet& packet, + Ipv4Address const &source, + Ipv4Address const &destination) + { ++ NS_DEBUG("UdpL4Protocol::Receive (" << &packet << ", " << source << ++ ", " << destination << ")"); ++ + UdpHeader udpHeader; + packet.RemoveHeader (udpHeader); + Ipv4EndPointDemux::EndPoints endPoints = +@@ -126,6 +149,9 @@ UdpL4Protocol::Send (Packet packet, + Ipv4Address saddr, Ipv4Address daddr, + uint16_t sport, uint16_t dport) + { ++ NS_DEBUG("UdpL4Protocol::Send (" << &packet << ", " << saddr << ++ ", " << daddr << ", " << sport << ", " << dport << ")"); ++ + UdpHeader udpHeader; + udpHeader.SetDestination (dport); + udpHeader.SetSource (sport); +@@ -139,6 +165,7 @@ UdpL4Protocol::Send (Packet packet, + Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); + if (ipv4 != 0) + { ++ NS_DEBUG("UdpL4Protocol::Send (): Sending to IP"); + ipv4->Send (packet, saddr, daddr, PROT_NUMBER); + } + } +diff -r a8f3d01d4a2c -r 31cb0668defd src/internet-node/udp-socket.cc +--- a/src/internet-node/udp-socket.cc Sun Aug 12 13:59:49 2007 -0700 ++++ b/src/internet-node/udp-socket.cc Sun Aug 12 15:51:12 2007 -0700 +@@ -18,12 +18,16 @@ + * + * Author: Mathieu Lacage + */ ++ ++#include "ns3/debug.h" + #include "ns3/node.h" + #include "ns3/inet-socket-address.h" + #include "udp-socket.h" + #include "udp-l4-protocol.h" + #include "ipv4-end-point.h" + #include "ipv4-l4-demux.h" ++ ++NS_DEBUG_COMPONENT_DEFINE ("UdpSocket"); + + namespace ns3 { + +@@ -35,9 +39,14 @@ UdpSocket::UdpSocket (Ptr node, Pt + m_shutdownSend (false), + m_shutdownRecv (false), + m_connected (false) +-{} ++{ ++ NS_DEBUG("UdpSocket::UdpSocket ()"); ++} ++ + UdpSocket::~UdpSocket () + { ++ NS_DEBUG("UdpSocket::~UdpSocket ()"); ++ + m_node = 0; + if (m_endPoint != 0) + { +@@ -60,25 +69,32 @@ enum Socket::SocketErrno + enum Socket::SocketErrno + UdpSocket::GetErrno (void) const + { ++ NS_DEBUG("UdpSocket::GetErrno ()"); ++ + return m_errno; + } + + Ptr + UdpSocket::GetNode (void) const + { ++ NS_DEBUG("UdpSocket::GetNode ()"); + return m_node; + } + + void + UdpSocket::Destroy (void) + { ++ NS_DEBUG("UdpSocket::Destroy ()"); + m_node = 0; + m_endPoint = 0; + m_udp = 0; + } ++ + int + UdpSocket::FinishBind (void) + { ++ NS_DEBUG("UdpSocket::FinishBind ()"); ++ + if (m_endPoint == 0) + { + return -1; +@@ -91,14 +107,20 @@ int + int + UdpSocket::Bind (void) + { ++ NS_DEBUG("UdpSocket::Bind ()"); ++ + m_endPoint = m_udp->Allocate (); + return FinishBind (); + } ++ + int + UdpSocket::Bind (const Address &address) + { ++ NS_DEBUG("UdpSocket::Bind (" << address << ")"); ++ + if (!InetSocketAddress::IsMatchingType (address)) + { ++ NS_DEBUG("UdpSocket::Bind (): Not IsMatchingType"); + return ERROR_INVAL; + } + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); +@@ -127,12 +149,15 @@ int + int + UdpSocket::ShutdownSend (void) + { ++ NS_DEBUG("UdpSocket::ShutDownSend ()"); + m_shutdownSend = true; + return 0; + } ++ + int + UdpSocket::ShutdownRecv (void) + { ++ NS_DEBUG("UdpSocket::ShutDownRecv ()"); + m_shutdownRecv = false; + return 0; + } +@@ -140,6 +165,7 @@ int + int + UdpSocket::Close(void) + { ++ NS_DEBUG("UdpSocket::Close ()"); + NotifyCloseCompleted (); + return 0; + } +@@ -147,6 +173,8 @@ int + int + UdpSocket::Connect(const Address & address) + { ++ NS_DEBUG("UdpSocket::Connect (" << address << ")"); ++ + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + m_defaultAddress = transport.GetIpv4 (); + m_defaultPort = transport.GetPort (); +@@ -154,9 +182,12 @@ UdpSocket::Connect(const Address & addre + m_connected = true; + return 0; + } ++ + int + UdpSocket::Send (const Packet &p) + { ++ NS_DEBUG("UdpSocket::Send (" << &p << ")"); ++ + if (!m_connected) + { + m_errno = ERROR_NOTCONN; +@@ -164,17 +195,23 @@ UdpSocket::Send (const Packet &p) + } + return DoSendTo (p, m_defaultAddress, m_defaultPort); + } ++ + int + UdpSocket::DoSendTo (const Packet &p, const Address &address) + { ++ NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << address << ")"); + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + Ipv4Address ipv4 = transport.GetIpv4 (); + uint16_t port = transport.GetPort (); + return DoSendTo (p, ipv4, port); + } ++ + int + UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) + { ++ NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << ipv4 << ", " << ++ port << ")"); ++ + if (m_endPoint == 0) + { + if (Bind () == -1) +@@ -189,14 +226,18 @@ UdpSocket::DoSendTo (const Packet &p, Ip + m_errno = ERROR_SHUTDOWN; + return -1; + } ++ ++ NS_DEBUG("UdpSocket::DoSendTo (): Send to UDP"); + m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, + m_endPoint->GetLocalPort (), port); + NotifyDataSent (p.GetSize ()); + return 0; + } ++ + int + UdpSocket::SendTo(const Address &address, const Packet &p) + { ++ NS_DEBUG("UdpSocket::SendTo (" << address << ", " << &p << ")"); + if (m_connected) + { + m_errno = ERROR_ISCONN; +@@ -211,6 +252,9 @@ void + void + UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) + { ++ NS_DEBUG("UdpSocket::ForwardUp (" << &packet << ", " << ipv4 << ", " << ++ port << ")"); ++ + if (m_shutdownRecv) + { + return; + +changeset: 1280:25fa26a6533e +user: Craig Dowell +date: Sun Aug 12 22:41:24 2007 -0700 +summary: many debug prints + +diff -r 31cb0668defd -r 25fa26a6533e examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/examples/csma-multicast.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -67,17 +67,23 @@ main (int argc, char *argv[]) + // for selected modules; the below lines suggest how to do this + #if 0 + DebugComponentEnable("Me"); +- DebugComponentEnable("CsmaNetDevice"); +- DebugComponentEnable("Ipv4L3Protocol"); +- DebugComponentEnable("NetDevice"); ++ DebugComponentEnable("Object"); ++ DebugComponentEnable("Queue"); ++ DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("CsmaNetDevice"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("NetDevice"); + DebugComponentEnable("PacketSocket"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); + #endif + + DebugComponentEnable("Me"); +@@ -88,6 +94,9 @@ main (int argc, char *argv[]) + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, +diff -r 31cb0668defd -r 25fa26a6533e examples/csma-one-subnet.cc +--- a/examples/csma-one-subnet.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/examples/csma-one-subnet.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -58,23 +58,47 @@ + #include "ns3/ipv4-route.h" + #include "ns3/onoff-application.h" + +- + using namespace ns3; + ++NS_DEBUG_COMPONENT_DEFINE ("Me"); + +-int main (int argc, char *argv[]) ++int ++main (int argc, char *argv[]) + { +- + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this + #if 0 ++ DebugComponentEnable("Me"); ++ DebugComponentEnable("Object"); ++ DebugComponentEnable("Queue"); ++ DebugComponentEnable("DropTailQueue"); ++ DebugComponentEnable("Channel"); ++ DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); +- DebugComponentEnable("Channel"); ++ DebugComponentEnable("PacketSocket"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); ++#endif ++ ++ DebugComponentEnable("Me"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("CsmaChannel"); +- DebugComponentEnable("PacketSocket"); +-#endif ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, +@@ -90,16 +114,19 @@ int main (int argc, char *argv[]) + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. ++ NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + // We create the channels first without any IP addressing information ++ NS_DEBUG("Create channels."); + Ptr channel0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + ++ NS_DEBUG("Build Topology."); + uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, + Eui48Address("10:54:23:54:23:50")); + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, +@@ -110,6 +137,7 @@ int main (int argc, char *argv[]) + Eui48Address("10:54:23:54:23:53")); + + // Later, we add IP addresses. ++ NS_DEBUG("Assign IP Addresses."); + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); + +@@ -125,6 +153,7 @@ int main (int argc, char *argv[]) + // Create the OnOff application to send UDP datagrams of size + // 210 bytes at a rate of 448 Kb/s + // from n0 to n1 ++ NS_DEBUG("Create Applications."); + Ptr ooff = Create ( + n0, + InetSocketAddress ("10.1.1.2", 80), +@@ -148,6 +177,7 @@ int main (int argc, char *argv[]) + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-one-subnet.tr file ++ NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("csma-one-subnet.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +@@ -160,7 +190,8 @@ int main (int argc, char *argv[]) + PcapTrace pcaptrace ("csma-one-subnet.pcap"); + pcaptrace.TraceAllIp (); + ++ NS_DEBUG("Run Simulation."); + Simulator::Run (); +- + Simulator::Destroy (); ++ NS_DEBUG("Done."); + } +diff -r 31cb0668defd -r 25fa26a6533e examples/simple-point-to-point.cc +--- a/examples/simple-point-to-point.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/examples/simple-point-to-point.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -38,11 +38,7 @@ + // - Tracing of queues and packet receptions to file + // "simple-point-to-point.tr" + +-#include +-#include +-#include +-#include +- ++#include "ns3/debug.h" + #include "ns3/command-line.h" + #include "ns3/default-value.h" + #include "ns3/ptr.h" +@@ -67,19 +63,46 @@ + + using namespace ns3; + +-int main (int argc, char *argv[]) ++NS_DEBUG_COMPONENT_DEFINE ("Me"); ++ ++int ++main (int argc, char *argv[]) + { + + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this + #if 0 ++ DebugComponentEnable("Me"); + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("PointToPointChannel"); + DebugComponentEnable("PointToPointNetDevice"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("NetDevice"); ++ DebugComponentEnable("PacketSocket"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); + #endif ++ ++ DebugComponentEnable("Me"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("PointToPointChannel"); ++ DebugComponentEnable("PointToPointNetDevice"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, +@@ -100,12 +123,14 @@ int main (int argc, char *argv[]) + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. ++ NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + // We create the channels first without any IP addressing information ++ NS_DEBUG("Create channels."); + Ptr channel0 = + PointToPointTopology::AddPointToPointLink ( + n0, n2, DataRate(5000000), MilliSeconds(2)); +@@ -119,6 +144,7 @@ int main (int argc, char *argv[]) + n2, n3, DataRate(1500000), MilliSeconds(10)); + + // Later, we add IP addresses. ++ NS_DEBUG("Assign IP Addresses."); + PointToPointTopology::AddIpv4Addresses ( + channel0, n0, Ipv4Address("10.1.1.1"), + n2, Ipv4Address("10.1.1.2")); +@@ -135,13 +161,14 @@ int main (int argc, char *argv[]) + // NetDevice creation, IP Address assignment, and routing) are + // separated because there may be a need to postpone IP Address + // assignment (emulation) or modify to use dynamic routing ++ NS_DEBUG("Add Static Routes."); + PointToPointTopology::AddIpv4Routes(n0, n2, channel0); + PointToPointTopology::AddIpv4Routes(n1, n2, channel1); + PointToPointTopology::AddIpv4Routes(n2, n3, channel2); + +- + // Create the OnOff application to send UDP datagrams of size + // 210 bytes at a rate of 448 Kb/s ++ NS_DEBUG("Create Applications."); + Ptr ooff = Create ( + n0, + InetSocketAddress ("10.1.3.2", 80), +@@ -165,6 +192,7 @@ int main (int argc, char *argv[]) + + // Here, finish off packet routing configuration + // This will likely set by some global StaticRouting object in the future ++ NS_DEBUG("Set Default Routes."); + Ptr ipv4; + ipv4 = n0->QueryInterface (Ipv4::iid); + ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1); +@@ -173,6 +201,7 @@ int main (int argc, char *argv[]) + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the simple-point-to-point.tr file ++ NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("simple-point-to-point.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); +@@ -185,7 +214,8 @@ int main (int argc, char *argv[]) + PcapTrace pcaptrace ("simple-point-to-point.pcap"); + pcaptrace.TraceAllIp (); + +- Simulator::Run (); +- ++ NS_DEBUG("Run Simulation."); ++ Simulator::Run (); + Simulator::Destroy (); ++ NS_DEBUG("Done."); + } +diff -r 31cb0668defd -r 25fa26a6533e src/devices/csma/csma-ipv4-topology.cc +--- a/src/devices/csma/csma-ipv4-topology.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/devices/csma/csma-ipv4-topology.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -36,15 +36,15 @@ namespace ns3 { + + uint32_t + CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, +- Ptr ch, +- Eui48Address addr) ++ Ptr ch, ++ Eui48Address addr) + { + Ptr q = Queue::CreateDefault (); + + // assume full-duplex + Ptr nd0 = Create (n1, addr, +- ns3::CsmaNetDevice::IP_ARP, +- true, true); ++ ns3::CsmaNetDevice::IP_ARP, ++ true, true); + nd0->AddQueue(q); + nd0->Attach (ch); + return nd0->GetIfIndex (); +@@ -53,51 +53,50 @@ CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, +- Ptr ch, +- Eui48Address addr) ++ Ptr ch, ++ Eui48Address addr) + { + Ptr q = Queue::CreateDefault (); + + Ptr nd0 = Create (n1, addr, +- ns3::CsmaNetDevice::LLC, +- true, false); ++ ns3::CsmaNetDevice::LLC, ++ true, false); + nd0->AddQueue(q); + nd0->Attach (ch); + + Ptr nd1 = Create (n1, addr, +- ns3::CsmaNetDevice::LLC, +- false, true); ++ ns3::CsmaNetDevice::LLC, ++ false, true); + nd1->AddQueue(q); + nd1->Attach (ch); + } + + void + CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, +- Ptr ch, +- Eui48Address addr) ++ Ptr ch, ++ Eui48Address addr) + { + Ptr q = Queue::CreateDefault (); + + Ptr nd0 = Create (n1, addr, +- ns3::CsmaNetDevice::RAW, +- true, false); ++ ns3::CsmaNetDevice::RAW, ++ true, false); + nd0->AddQueue(q); + nd0->Attach (ch); + + Ptr nd1 = Create (n1, addr, +- ns3::CsmaNetDevice::RAW, +- false, true); ++ ns3::CsmaNetDevice::RAW, ++ false, true); + nd1->AddQueue(q); + nd1->Attach (ch); + } + + void + CsmaIpv4Topology::AddIpv4Address(Ptr n1, +- int ndNum, +- const Ipv4Address& addr1, +- const Ipv4Mask& netmask1) ++ int ndNum, ++ const Ipv4Address& addr1, ++ const Ipv4Mask& netmask1) + { +- + // Duplex link is assumed to be subnetted as a /30 + // May run this unnumbered in the future? + Ipv4Mask netmask(netmask1); +@@ -110,7 +109,6 @@ CsmaIpv4Topology::AddIpv4Address(PtrSetAddress (index1, addr1); + ip1->SetNetworkMask (index1, netmask); + ip1->SetUp (index1); +- + } + + void +@@ -133,7 +131,7 @@ CsmaIpv4Topology::AddIpv4Routes ( + found = true; + } + } +- NS_ASSERT(found); ++ NS_ASSERT (found); + + uint32_t index2 = 0; + found = false; +@@ -145,7 +143,7 @@ CsmaIpv4Topology::AddIpv4Routes ( + found = true; + } + } +- NS_ASSERT(found); ++ NS_ASSERT (found); + + ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); + ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); +diff -r 31cb0668defd -r 25fa26a6533e src/internet-node/arp-ipv4-interface.cc +--- a/src/internet-node/arp-ipv4-interface.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -31,18 +31,26 @@ + #include "ipv4-l3-protocol.h" + #include "arp-l3-protocol.h" + ++NS_DEBUG_COMPONENT_DEFINE ("ArpIpv4Interface"); ++ + namespace ns3 { + + ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) + : Ipv4Interface (device), + m_node (node) +-{} ++{ ++ NS_DEBUG ("ArpIpv4Interface::ArpIpv4Interface ()"); ++} ++ + ArpIpv4Interface::~ArpIpv4Interface () +-{} ++{ ++ NS_DEBUG ("ArpIpv4Interface::~ArpIpv4Interface ()"); ++} + + TraceResolver * + ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) + { ++ NS_DEBUG ("ArpIpv4Interface::DoCreateTraceResolver ()"); + CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + if (GetDevice () != 0) + { +@@ -56,31 +64,41 @@ void + void + ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) + { ++ NS_DEBUG ("ArpIpv4Interface::SendTo (" << &p << ", " << dest << ")"); ++ + NS_ASSERT (GetDevice () != 0); + if (GetDevice ()->NeedsArp ()) + { +- Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): Needs ARP"); ++ Ptr arp = ++ m_node->QueryInterface (ArpL3Protocol::iid); + Address hardwareDestination; + bool found; + + if (dest.IsBroadcast ()) + { ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): IsBroadcast"); + hardwareDestination = GetDevice ()->GetBroadcast (); + found = true; + } + else + { ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup"); + found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination); + } + + if (found) + { +- GetDevice ()->Send (p, hardwareDestination, Ipv4L3Protocol::PROT_NUMBER); ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): Address Resolved. Send."); ++ GetDevice ()->Send (p, hardwareDestination, ++ Ipv4L3Protocol::PROT_NUMBER); + } + } + else + { +- GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4L3Protocol::PROT_NUMBER); ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): Doesn't need ARP"); ++ GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), ++ Ipv4L3Protocol::PROT_NUMBER); + } + } + +diff -r 31cb0668defd -r 25fa26a6533e src/internet-node/ipv4-interface.cc +--- a/src/internet-node/ipv4-interface.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/internet-node/ipv4-interface.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -22,6 +22,9 @@ + #include "ipv4-interface.h" + #include "ns3/ipv4-address.h" + #include "ns3/net-device.h" ++#include "ns3/debug.h" ++ ++NS_DEBUG_COMPONENT_DEFINE ("Ipv4Interface"); + + namespace ns3 { + +@@ -34,56 +37,72 @@ Ipv4Interface::Ipv4Interface (Ptr nd) + : m_netdevice (nd), + m_ifup(false) +-{} ++{ ++ NS_DEBUG ("Ipv4Interface::Ipv4Interface (" << &nd << ")"); ++} + + Ipv4Interface::~Ipv4Interface () +-{} ++{ ++ NS_DEBUG ("Ipv4Interface::~Ipv4Interface ()"); ++} + + Ptr + Ipv4Interface::GetDevice (void) const + { ++ NS_DEBUG ("Ipv4Interface::GetDevice ()"); + return m_netdevice; + } + + TraceResolver * + Ipv4Interface::CreateTraceResolver (TraceContext const &context) + { ++ NS_DEBUG ("Ipv4Interface::CreateTraceResolver (" << &context << ")"); + return DoCreateTraceResolver (context); + } + + void + Ipv4Interface::SetAddress (Ipv4Address a) + { ++ NS_DEBUG ("Ipv4Interface::SetAddress (" << a << ")"); + m_address = a; + } ++ + void + Ipv4Interface::SetNetworkMask (Ipv4Mask mask) + { ++ NS_DEBUG ("Ipv4Interface::SetMask (" << mask << ")"); + m_netmask = mask; + } + + Ipv4Address + Ipv4Interface::GetBroadcast (void) const + { ++ NS_DEBUG ("Ipv4Interface::GetBroadcast ()"); ++ + uint32_t mask = m_netmask.GetHostOrder (); + uint32_t address = m_address.GetHostOrder (); + Ipv4Address broadcast = Ipv4Address (address | (~mask)); + return broadcast; + } ++ + Ipv4Mask + Ipv4Interface::GetNetworkMask (void) const + { ++ NS_DEBUG ("Ipv4Interface::GetNetworkMask ()"); + return m_netmask; + } ++ + Ipv4Address + Ipv4Interface::GetAddress (void) const + { ++ NS_DEBUG ("Ipv4Interface::Address ()"); + return m_address; + } + + uint16_t + Ipv4Interface::GetMtu (void) const + { ++ NS_DEBUG ("Ipv4Interface::GetMtu ()"); + if (m_netdevice == 0) + { + uint32_t mtu = (1<<16) - 1; +@@ -92,32 +111,36 @@ Ipv4Interface::GetMtu (void) const + return m_netdevice->GetMtu (); + } + +- /** +- * These are IP interface states and may be distinct from +- * NetDevice states, such as found in real implementations +- * (where the device may be down but IP interface state is still up). +- */ ++/** ++ * These are IP interface states and may be distinct from ++ * NetDevice states, such as found in real implementations ++ * (where the device may be down but IP interface state is still up). ++ */ + bool + Ipv4Interface::IsUp (void) const + { ++ NS_DEBUG ("Ipv4Interface::IsUp ()"); + return m_ifup; + } + + bool + Ipv4Interface::IsDown (void) const + { ++ NS_DEBUG ("Ipv4Interface::IsDown ()"); + return !m_ifup; + } + + void + Ipv4Interface::SetUp (void) + { ++ NS_DEBUG ("Ipv4Interface::SetUp ()"); + m_ifup = true; + } + + void + Ipv4Interface::SetDown (void) + { ++ NS_DEBUG ("Ipv4Interface::SetDown ()"); + m_ifup = false; + } + +@@ -125,7 +148,10 @@ void + void + Ipv4Interface::Send(Packet p, Ipv4Address dest) + { ++ NS_DEBUG ("Ipv4Interface::Send ()"); ++ + if (IsUp()) { ++ NS_DEBUG ("Ipv4Interface::Send (): SendTo ()"); + SendTo(p, dest); + } + } +diff -r 31cb0668defd -r 25fa26a6533e src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -494,24 +494,31 @@ Ipv4L3Protocol::SendRealOut (bool found, + + if (!found) + { +- NS_DEBUG ("no route to host. drop."); ++ NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): No route to host. Drop."); + m_dropTrace (packet); + return; + } ++ ++ NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send via interface " << ++ route.GetInterface ()); ++ + packet.AddHeader (ipHeader); + Ipv4Interface *outInterface = GetInterface (route.GetInterface ()); + NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); + m_txTrace (packet, route.GetInterface ()); + if (route.IsGateway ()) + { ++ NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to gateway " << ++ route.GetGateway ()); + outInterface->Send (packet, route.GetGateway ()); + } + else + { ++ NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to destination " << ++ ipHeader.GetDestination ()); + outInterface->Send (packet, ipHeader.GetDestination ()); + } + } +- + + bool + Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) +@@ -524,7 +531,8 @@ Ipv4L3Protocol::Forwarding (Packet const + { + if ((*i)->GetAddress ().IsEqual (ipHeader.GetDestination ())) + { +- NS_DEBUG ("for me 1"); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "For me (destination match)"); + return false; + } + } +@@ -537,7 +545,8 @@ Ipv4L3Protocol::Forwarding (Packet const + { + if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ())) + { +- NS_DEBUG ("for me 2"); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "For me (interface broadcast address)"); + return false; + } + break; +@@ -546,25 +555,30 @@ Ipv4L3Protocol::Forwarding (Packet const + + if (ipHeader.GetDestination ().IsBroadcast ()) + { +- NS_DEBUG ("for me 3"); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "For me (Ipv4Addr broadcast address)"); + return false; + } ++ + if (ipHeader.GetDestination ().IsEqual (Ipv4Address::GetAny ())) + { +- NS_DEBUG ("for me 4"); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "For me (Ipv4Addr any address)"); + return false; + } ++ + if (ipHeader.GetTtl () == 1) + { + // Should send ttl expired here + // XXX +- NS_DEBUG ("not for me -- ttl expired. drop."); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "Not for me (TTL expired). Drop"); + m_dropTrace (packet); + return true; + } + ipHeader.SetTtl (ipHeader.GetTtl () - 1); + +- NS_DEBUG ("forwarding."); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): Forwarding packet."); + Lookup (ipHeader, packet, + MakeCallback (&Ipv4L3Protocol::SendRealOut, this)); + // +@@ -578,12 +592,13 @@ Ipv4L3Protocol::Forwarding (Packet const + if ((*i).first.IsEqual (ipHeader.GetSource ()) && + (*i).second.IsEqual (ipHeader.GetDestination ())) + { +- NS_DEBUG ("for me 5"); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): " ++ "For me (Joined multicast group)"); + return false; + } + } + +- NS_DEBUG ("not for me."); ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (): Not for me."); + return true; + } + +diff -r 31cb0668defd -r 25fa26a6533e src/internet-node/ipv4-loopback-interface.cc +--- a/src/internet-node/ipv4-loopback-interface.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/internet-node/ipv4-loopback-interface.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -19,6 +19,8 @@ + * Authors: + * Mathieu Lacage , + */ ++ ++#include "ns3/debug.h" + #include "ns3/empty-trace-resolver.h" + #include "ns3/net-device.h" + #include "ns3/node.h" +@@ -26,26 +28,40 @@ + #include "ipv4-loopback-interface.h" + #include "ipv4-l3-protocol.h" + ++NS_DEBUG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); ++ + namespace ns3 { + + Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) + : Ipv4Interface (0), + m_node (node) +-{} ++{ ++ NS_DEBUG("Ipv4LoopbackInterface::Ipv4LoopbackInterface ()"); ++} ++ + Ipv4LoopbackInterface::~Ipv4LoopbackInterface () +-{} ++{ ++ NS_DEBUG("Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()"); ++} + + TraceResolver * + Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context) + { ++ NS_DEBUG("Ipv4LoopbackInterface::DoCreateTraceResolver ()"); + return new EmptyTraceResolver (context); + } + + void + Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) + { +- Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); +- ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, Eui48Address ("ff:ff:ff:ff:ff:ff")); ++ NS_DEBUG("Ipv4LoopbackInterface::SendTo (" << &packet << ", " << ++ dest << ")"); ++ ++ Ptr ipv4 = ++ m_node->QueryInterface (Ipv4L3Protocol::iid); ++ ++ ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, ++ Eui48Address ("ff:ff:ff:ff:ff:ff")); + } + + }//namespace ns3 +diff -r 31cb0668defd -r 25fa26a6533e src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Sun Aug 12 15:51:12 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Sun Aug 12 22:41:24 2007 -0700 +@@ -26,7 +26,6 @@ NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRo + NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); + + namespace ns3 { +- + + void + Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, +@@ -325,7 +324,6 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << + ipHeader.GetDestination ()); +- + // + // First, see if this is a multicast packet we have a route for. If we + // have a route, then send the packet down each of the specified interfaces. +@@ -334,12 +332,15 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + ipHeader.GetDestination ()); + if (mRoute) + { ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast route"); + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; + Ipv4Route route = + Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), + mRoute->GetOutputInterface(i)); ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " ++ "Send via interface " << mRoute->GetOutputInterface(i)); + routeReply (true, route, p, ipHeader); + return true; + } +@@ -347,6 +348,7 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + // + // See if this is a unicast packet we have a route for. + // ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast route"); + Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); + if (route != 0) + { + +changeset: 1283:3760d52ef5d1 +parent: 1280:25fa26a6533e +parent: 1282:03ab1b7ad2d0 +user: Craig Dowell +date: Sun Aug 12 22:43:25 2007 -0700 +summary: branch merge + +diff -r 25fa26a6533e -r 3760d52ef5d1 examples/mixed-global-routing.cc +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/examples/mixed-global-routing.cc Sun Aug 12 22:43:25 2007 -0700 +@@ -0,0 +1,199 @@ ++/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ ++/* ++ * 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 ++ * ++ */ ++ ++// This script exercises global routing code in a mixed point-to-point ++// and csma/cd environment ++// ++// Network topology ++// ++// n0 ++// \ p-p ++// \ (shared csma/cd) ++// n2 -------------------------n3 ++// / | | ++// / p-p n4 n5 ---------- n6 ++// n1 p-p ++// ++// - CBR/UDP flows from n0 to n6 ++// - Tracing of queues and packet receptions to file "mixed-global-routing.tr" ++ ++#include ++#include ++#include ++#include ++ ++#include "ns3/debug.h" ++ ++#include "ns3/command-line.h" ++#include "ns3/default-value.h" ++#include "ns3/ptr.h" ++#include "ns3/random-variable.h" ++ ++#include "ns3/simulator.h" ++#include "ns3/nstime.h" ++#include "ns3/data-rate.h" ++ ++#include "ns3/ascii-trace.h" ++#include "ns3/pcap-trace.h" ++#include "ns3/internet-node.h" ++#include "ns3/point-to-point-channel.h" ++#include "ns3/point-to-point-net-device.h" ++#include "ns3/csma-channel.h" ++#include "ns3/csma-net-device.h" ++#include "ns3/csma-topology.h" ++#include "ns3/csma-ipv4-topology.h" ++#include "ns3/eui48-address.h" ++#include "ns3/ipv4-address.h" ++#include "ns3/ipv4.h" ++#include "ns3/socket.h" ++#include "ns3/inet-socket-address.h" ++#include "ns3/ipv4-route.h" ++#include "ns3/point-to-point-topology.h" ++#include "ns3/onoff-application.h" ++#include "ns3/global-route-manager.h" ++ ++using namespace ns3; ++ ++int main (int argc, char *argv[]) ++{ ++ ++ // Users may find it convenient to turn on explicit debugging ++ // for selected modules; the below lines suggest how to do this ++#if 0 ++ DebugComponentEnable ("Object"); ++ DebugComponentEnable ("Queue"); ++ DebugComponentEnable ("DropTailQueue"); ++ DebugComponentEnable ("Channel"); ++ DebugComponentEnable ("PointToPointChannel"); ++ DebugComponentEnable ("PointToPointNetDevice"); ++ DebugComponentEnable ("GlobalRouter"); ++ DebugComponentEnable ("GlobalRouteManager"); ++#endif ++ ++ // Set up some default values for the simulation. Use the Bind () ++ // technique to tell the system what subclass of Queue to use, ++ // and what the queue limit is ++ ++ // The below DefaultValue::Bind command tells the queue factory which ++ // class to instantiate, when the queue factory is invoked in the ++ // topology code ++ DefaultValue::Bind ("Queue", "DropTailQueue"); ++ ++ DefaultValue::Bind ("OnOffApplicationPacketSize", "210"); ++ DefaultValue::Bind ("OnOffApplicationDataRate", "448kb/s"); ++ ++ //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30); ++ ++ // Allow the user to override any of the defaults and the above ++ // Bind ()s at run-time, via command-line arguments ++ CommandLine::Parse (argc, argv); ++ ++ Ptr n0 = Create (); ++ Ptr n1 = Create (); ++ Ptr n2 = Create (); ++ Ptr n3 = Create (); ++ Ptr n4 = Create (); ++ Ptr n5 = Create (); ++ Ptr n6 = Create (); ++ ++ // We create the channels first without any IP addressing information ++ Ptr channel0 = ++ PointToPointTopology::AddPointToPointLink ( ++ n0, n2, DataRate (5000000), MilliSeconds (2)); ++ ++ Ptr channel1 = ++ PointToPointTopology::AddPointToPointLink ( ++ n1, n2, DataRate (5000000), MilliSeconds (2)); ++ ++ Ptr channel2 = ++ PointToPointTopology::AddPointToPointLink ( ++ n5, n6, DataRate (1500000), MilliSeconds (10)); ++ ++ // We create the channels first without any IP addressing information ++ Ptr channelc0 = ++ CsmaTopology::CreateCsmaChannel( ++ DataRate(5000000), MilliSeconds(2)); ++ ++ uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channelc0, ++ Eui48Address("10:54:23:54:23:50")); ++ uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channelc0, ++ Eui48Address("10:54:23:54:23:51")); ++ uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n4, channelc0, ++ Eui48Address("10:54:23:54:23:52")); ++ uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n5, channelc0, ++ Eui48Address("10:54:23:54:23:53")); ++ ++ // Later, we add IP addresses. ++ PointToPointTopology::AddIpv4Addresses ( ++ channel0, n0, Ipv4Address ("10.1.1.1"), ++ n2, Ipv4Address ("10.1.1.2")); ++ ++ PointToPointTopology::AddIpv4Addresses ( ++ channel1, n1, Ipv4Address ("10.1.2.1"), ++ n2, Ipv4Address ("10.1.2.2")); ++ ++ PointToPointTopology::AddIpv4Addresses ( ++ channel2, n5, Ipv4Address ("10.1.3.1"), ++ n6, Ipv4Address ("10.1.3.2")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n2, n2ifIndex, Ipv4Address("10.250.1.1"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n3, n3ifIndex, Ipv4Address("10.250.1.2"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n4, n4ifIndex, Ipv4Address("10.250.1.3"), Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address ( ++ n5, n5ifIndex, Ipv4Address("10.250.1.4"), Ipv4Mask("255.255.255.0")); ++ ++ // Create router nodes, initialize routing database and set up the routing ++ // tables in the nodes. ++ GlobalRouteManager::PopulateRoutingTables (); ++ ++ // Create the OnOff application to send UDP datagrams of size ++ // 210 bytes at a rate of 448 Kb/s ++ Ptr ooff = Create ( ++ n0, ++ InetSocketAddress ("10.1.3.2", 80), ++ "Udp", ++ ConstantVariable (1), ++ ConstantVariable (0), ++ DataRate("300bps"), ++ 50); ++ // Start the application ++ ooff->Start (Seconds (1.0)); ++ ooff->Stop (Seconds (10.0)); ++ ++ // Configure tracing of all enqueue, dequeue, and NetDevice receive events ++ // Trace output will be sent to the simple-global-routing.tr file ++ AsciiTrace asciitrace ("mixed-global-routing.tr"); ++ asciitrace.TraceAllQueues (); ++ asciitrace.TraceAllNetDeviceRx (); ++ ++ // Also configure some tcpdump traces; each interface will be traced ++ // The output files will be named simple-p2p.pcap-- ++ // and can be read by the "tcpdump -r" command (use "-tt" option to ++ // display timestamps correctly) ++ PcapTrace pcaptrace ("mixed-global-routing.pcap"); ++ pcaptrace.TraceAllIp (); ++ ++ Simulator::Run (); ++ ++ Simulator::Destroy (); ++} +diff -r 25fa26a6533e -r 3760d52ef5d1 examples/wscript +--- a/examples/wscript Sun Aug 12 22:41:24 2007 -0700 ++++ b/examples/wscript Sun Aug 12 22:43:25 2007 -0700 +@@ -22,3 +22,6 @@ def build(bld): + ['csma', 'internet-node']) + obj.source = 'csma-multicast.cc' + ++ obj = bld.create_ns3_program( 'mixed-global-routing', ++ ['point-to-point', 'internet-node', 'global-routing' , 'csma-cd']) ++ obj.source = 'mixed-global-routing.cc' +diff -r 25fa26a6533e -r 3760d52ef5d1 src/devices/csma/csma-net-device.cc +--- a/src/devices/csma/csma-net-device.cc Sun Aug 12 22:41:24 2007 -0700 ++++ b/src/devices/csma/csma-net-device.cc Sun Aug 12 22:43:25 2007 -0700 +@@ -133,7 +133,6 @@ CsmaNetDevice::Init(bool sendEnable, boo + + EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); + EnableMulticast(); +- EnablePointToPoint(); + + SetSendEnable (sendEnable); + SetReceiveEnable (receiveEnable); +diff -r 25fa26a6533e -r 3760d52ef5d1 src/routing/global-routing/global-route-manager-impl.cc +--- a/src/routing/global-routing/global-route-manager-impl.cc Sun Aug 12 22:41:24 2007 -0700 ++++ b/src/routing/global-routing/global-route-manager-impl.cc Sun Aug 12 22:43:25 2007 -0700 +@@ -48,8 +48,7 @@ SPFVertex::SPFVertex () : + { + } + +-SPFVertex::SPFVertex (GlobalRouterLSA* lsa) : +- m_vertexType (VertexRouter), ++SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : + m_vertexId (lsa->GetLinkStateId ()), + m_lsa (lsa), + m_distanceFromRoot (SPF_INFINITY), +@@ -58,6 +57,16 @@ SPFVertex::SPFVertex (GlobalRouterLSA* l + m_parent (0), + m_children () + { ++ if (lsa->GetLSType () == GlobalRoutingLSA::RouterLSA) ++ { ++ NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexRouter"); ++ m_vertexType = SPFVertex::VertexRouter; ++ } ++ else if (lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA) ++ { ++ NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexNetwork"); ++ m_vertexType = SPFVertex::VertexNetwork; ++ } + } + + SPFVertex::~SPFVertex () +@@ -99,12 +108,12 @@ SPFVertex::GetVertexId (void) const + } + + void +-SPFVertex::SetLSA (GlobalRouterLSA* lsa) ++SPFVertex::SetLSA (GlobalRoutingLSA* lsa) + { + m_lsa = lsa; + } + +- GlobalRouterLSA* ++ GlobalRoutingLSA* + SPFVertex::GetLSA (void) const + { + return m_lsa; +@@ -210,7 +219,7 @@ GlobalRouteManagerLSDB::~GlobalRouteMana + for (i= m_database.begin (); i!= m_database.end (); i++) + { + NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ():free LSA"); +- GlobalRouterLSA* temp = i->second; ++ GlobalRoutingLSA* temp = i->second; + delete temp; + } + NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB (): clear map"); +@@ -225,19 +234,19 @@ GlobalRouteManagerLSDB::Initialize () + LSDBMap_t::iterator i; + for (i= m_database.begin (); i!= m_database.end (); i++) + { +- GlobalRouterLSA* temp = i->second; +- temp->SetStatus (GlobalRouterLSA::LSA_SPF_NOT_EXPLORED); ++ GlobalRoutingLSA* temp = i->second; ++ temp->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); + } + } + + void +-GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRouterLSA* lsa) ++GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa) + { + NS_DEBUG ("GlobalRouteManagerLSDB::Insert ()"); + m_database.insert (LSDBPair_t (addr, lsa)); + } + +- GlobalRouterLSA* ++ GlobalRoutingLSA* + GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const + { + NS_DEBUG ("GlobalRouteManagerLSDB::GetLSA ()"); +@@ -252,6 +261,31 @@ GlobalRouteManagerLSDB::GetLSA (Ipv4Addr + return i->second; + } + } ++ return 0; ++} ++ ++ GlobalRoutingLSA* ++GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const ++{ ++ NS_DEBUG ("GlobalRouteManagerLSDB::GetLSAByLinkData ()"); ++// ++// Look up an LSA by its address. ++// ++ LSDBMap_t::const_iterator i; ++ for (i= m_database.begin (); i!= m_database.end (); i++) ++ { ++ GlobalRoutingLSA* temp = i->second; ++// Iterate among temp's Link Records ++ for (uint32_t j = 0; j < temp->GetNLinkRecords (); j++) ++ { ++ GlobalRoutingLinkRecord *lr = temp->GetLinkRecord (j); ++ if ( lr->GetLinkType () == GlobalRoutingLinkRecord::TransitNetwork && ++ lr->GetLinkData () == addr) ++ { ++ return temp; ++ } ++ } ++ } + return 0; + } + +@@ -359,13 +393,12 @@ GlobalRouteManagerImpl::BuildGlobalRouti + + for (uint32_t j = 0; j < numLSAs; ++j) + { +- GlobalRouterLSA* lsa = new GlobalRouterLSA (); ++ GlobalRoutingLSA* lsa = new GlobalRoutingLSA (); + // + // This is the call to actually fetch a Link State Advertisement from the + // router. + // + rtr->GetLSA (j, *lsa); +- NS_DEBUG ("LSA " << j); + NS_DEBUG (*lsa); + // + // Write the newly discovered link state advertisement to the database. +@@ -453,52 +486,86 @@ GlobalRouteManagerImpl::SPFNext (SPFVert + GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) + { + SPFVertex* w = 0; +- GlobalRouterLSA* w_lsa = 0; ++ GlobalRoutingLSA* w_lsa = 0; ++ GlobalRoutingLinkRecord *l = 0; + uint32_t distance = 0; ++ uint32_t numRecordsInVertex = 0; + + NS_DEBUG ("GlobalRouteManagerImpl::SPFNext ()"); +-// +-// Always true for now, since all our LSAs are RouterLSAs. +-// +- if (v->GetVertexType () == SPFVertex::VertexRouter) +- { +- if (true) ++ ++// V points to a Router-LSA or Network-LSA ++// Loop over the links in router LSA or attached routers in Network LSA ++ if (v->GetVertexType () == SPFVertex::VertexRouter) ++ { ++ numRecordsInVertex = v->GetLSA ()->GetNLinkRecords (); ++ } ++ if (v->GetVertexType () == SPFVertex::VertexNetwork) ++ { ++ numRecordsInVertex = v->GetLSA ()->GetNAttachedRouters (); ++ } ++ ++ for (uint32_t i = 0; i < numRecordsInVertex; i++) ++ { ++// Get w_lsa: In case of V is Router-LSA ++ if (v->GetVertexType () == SPFVertex::VertexRouter) + { + NS_DEBUG ("SPFNext: Examining " << v->GetVertexId () << "'s " << + v->GetLSA ()->GetNLinkRecords () << " link records"); +-// +-// Walk the list of link records in the link state advertisement associated +-// with the "current" router (represented by vertex ). +-// +- for (uint32_t i = 0; i < v->GetLSA ()->GetNLinkRecords (); ++i) +- { + // + // (a) If this is a link to a stub network, examine the next link in V's LSA. + // Links to stub networks will be considered in the second stage of the + // shortest path calculation. + // +- GlobalRouterLinkRecord *l = v->GetLSA ()->GetLinkRecord (i); +- if (l->GetLinkType () == GlobalRouterLinkRecord::StubNetwork) +- { +- NS_DEBUG ("SPFNext: Found a Stub record to " << +- l->GetLinkId ()); +- continue; +- } ++ l = v->GetLSA ()->GetLinkRecord (i); ++ if (l->GetLinkType () == GlobalRoutingLinkRecord::StubNetwork) ++ { ++ NS_DEBUG ("SPFNext: Found a Stub record to " << ++ l->GetLinkId ()); ++ continue; ++ } + // + // (b) Otherwise, W is a transit vertex (router or transit network). Look up + // the vertex W's LSA (router-LSA or network-LSA) in Area A's link state + // database. + // +- if (l->GetLinkType () == GlobalRouterLinkRecord::PointToPoint) +- { ++ if (l->GetLinkType () == GlobalRoutingLinkRecord::PointToPoint) ++ { + // + // Lookup the link state advertisement of the new link -- we call it in + // the link state database. + // +- w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); +- NS_ASSERT (w_lsa); +- NS_DEBUG ("SPFNext: Found a P2P record from " << +- v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); ++ w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); ++ NS_ASSERT (w_lsa); ++ NS_DEBUG ("SPFNext: Found a P2P record from " << ++ v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); ++ } ++ else if (l->GetLinkType () == ++ GlobalRoutingLinkRecord::TransitNetwork) ++ { ++ w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); ++ NS_ASSERT (w_lsa); ++ NS_DEBUG ("SPFNext: Found a Transit record from " << ++ v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); ++ } ++ else ++ { ++ NS_ASSERT_MSG (0, "illegal Link Type"); ++ } ++ } ++// Get w_lsa: In case of V is Network-LSA ++ if (v->GetVertexType () == SPFVertex::VertexNetwork) ++ { ++ w_lsa = m_lsdb->GetLSAByLinkData ++ (v->GetLSA ()->GetAttachedRouter (i)); ++ if (!w_lsa) ++ { ++ continue; ++ } ++ NS_DEBUG ("SPFNext: Found a Network LSA from " << ++ v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); ++ } ++ ++// Note: w_lsa at this point may be either RouterLSA or NetworkLSA + // + // (c) If vertex W is already on the shortest-path tree, examine the next + // link in the LSA. +@@ -506,57 +573,56 @@ GlobalRouteManagerImpl::SPFNext (SPFVert + // If the link is to a router that is already in the shortest path first tree + // then we have it covered -- ignore it. + // +- if (w_lsa->GetStatus () == +- GlobalRouterLSA::LSA_SPF_IN_SPFTREE) +- { +- NS_DEBUG ("SPFNext: Skipping-> LSA "<< +- w_lsa->GetLinkStateId () << " already in SPF tree"); +- continue; +- } +-// +-// The link is to a router we haven't dealt with yet. ++ if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_IN_SPFTREE) ++ { ++ NS_DEBUG ("SPFNext: Skipping-> LSA "<< ++ w_lsa->GetLinkStateId () << " already in SPF tree"); ++ continue; ++ } + // + // (d) Calculate the link state cost D of the resulting path from the root to + // vertex W. D is equal to the sum of the link state cost of the (already + // calculated) shortest path to vertex V and the advertised cost of the link + // between vertices V and W. + // +- distance = v->GetDistanceFromRoot () + l->GetMetric (); +- +- NS_DEBUG ("SPFNext: Considering w_lsa " << +- w_lsa->GetLinkStateId ()); +- +- if (w_lsa->GetStatus () == +- GlobalRouterLSA::LSA_SPF_NOT_EXPLORED) +- { +-// +-// If we haven't yet considered the link represented by we have to create +-// a new SPFVertex to represent it. +-// +- w = new SPFVertex (w_lsa); +-// ++ if (v->GetLSA ()->GetLSType () == GlobalRoutingLSA::RouterLSA) ++ { ++ distance = v->GetDistanceFromRoot () + l->GetMetric (); ++ } ++ else ++ { ++ distance = v->GetDistanceFromRoot (); ++ } ++ ++ NS_DEBUG ("SPFNext: Considering w_lsa " << w_lsa->GetLinkStateId ()); ++ ++// Is there already vertex w in candidate list? ++ if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) ++ { ++ ++// prepare vertex w ++ w = new SPFVertex (w_lsa); ++// Calculate nexthop to w + // We need to figure out how to actually get to the new router represented + // by . This will (among other things) find the next hop address to send + // packets destined for this network to, and also find the outbound interface + // used to forward the packets. + // +- if (SPFNexthopCalculation (v, w, l, distance)) +- { +- w_lsa->SetStatus ( +- GlobalRouterLSA::LSA_SPF_CANDIDATE); ++ if (SPFNexthopCalculation (v, w, l, distance)) ++ { ++ w_lsa->SetStatus (GlobalRoutingLSA::LSA_SPF_CANDIDATE); + // + // Push this new vertex onto the priority queue (ordered by distance from the + // root node). + // +- candidate.Push (w); +- NS_DEBUG ("SPFNext: Pushing " << +- w->GetVertexId () << ", parent vertexId: " << +- v->GetVertexId ()); +- } +- } +- } else if (w_lsa->GetStatus () == +- GlobalRouterLSA::LSA_SPF_CANDIDATE) +- { ++ candidate.Push (w); ++ NS_DEBUG ("SPFNext: Pushing " << ++ w->GetVertexId () << ", parent vertexId: " << ++ v->GetVertexId ()); ++ } ++ } ++ else if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_CANDIDATE) ++ { + // + // We have already considered the link represented by . What wse have to + // do now is to decide if this new router represents a route with a shorter +@@ -564,23 +630,23 @@ GlobalRouteManagerImpl::SPFNext (SPFVert + // + // So, locate the vertex in the candidate queue and take a look at the + // distance. +- w = candidate.Find (w_lsa->GetLinkStateId ()); +- if (w->GetDistanceFromRoot () < distance) +- { ++ w = candidate.Find (w_lsa->GetLinkStateId ()); ++ if (w->GetDistanceFromRoot () < distance) ++ { + // + // This is not a shorter path, so don't do anything. + // +- continue; +- } +- else if (w->GetDistanceFromRoot () == distance) +- { ++ continue; ++ } ++ else if (w->GetDistanceFromRoot () == distance) ++ { + // + // This path is one with an equal cost. Do nothing for now -- we're not doing + // equal-cost multipath cases yet. + // +- } +- else +- { ++ } ++ else ++ { + // + // this path represents a new, lower-cost path to (the vertex we found in + // the current link record of the link state advertisement of the current root +@@ -589,27 +655,26 @@ GlobalRouteManagerImpl::SPFNext (SPFVert + // N.B. the nexthop_calculation is conditional, if it finds a valid nexthop + // it will call spf_add_parents, which will flush the old parents + // +- if (SPFNexthopCalculation (v, w, l, distance)) +- { ++ if (SPFNexthopCalculation (v, w, l, distance)) ++ { + // + // If we've changed the cost to get to the vertex represented by , we + // must reorder the priority queue keyed to that cost. + // +- candidate.Reorder (); +- } +- } +- } // point-to-point +- } // for loop +- } +- } ++ candidate.Reorder (); ++ } ++ } // new lower cost path found ++ } // end W is already on the candidate list ++ } // end loop over the links in V's LSA + } + + // + // This method is derived from quagga ospf_next_hop_calculation() 16.1.1. + // +-// Calculate the next hop IP address and the outgoing interface required to +-// get packets from the root through (parent) to vertex (destination), +-// over a given distance. ++// Calculate nexthop from root through V (parent) to vertex W (destination) ++// with given distance from root->W. ++// ++// As appropriate, set w's parent, distance, and nexthop information + // + // For now, this is greatly simplified from the quagga code + // +@@ -617,10 +682,19 @@ GlobalRouteManagerImpl::SPFNexthopCalcul + GlobalRouteManagerImpl::SPFNexthopCalculation ( + SPFVertex* v, + SPFVertex* w, +- GlobalRouterLinkRecord* l, ++ GlobalRoutingLinkRecord* l, + uint32_t distance) + { + NS_DEBUG ("GlobalRouteManagerImpl::SPFNexthopCalculation ()"); ++ ++// If w is a NetworkVertex, l should be null ++/* ++ if (w->GetVertexType () == SPFVertex::VertexNetwork && l) ++ { ++ NS_ASSERT_MSG(0, "Error: SPFNexthopCalculation parameter problem"); ++ } ++*/ ++ + // + // The vertex m_spfroot is a distinguished vertex representing the node at + // the root of the calculations. That is, it is the node for which we are +@@ -669,7 +743,8 @@ GlobalRouteManagerImpl::SPFNexthopCalcul + // return the link record describing the link from to . Think of it as + // SPFGetLink. + // +- GlobalRouterLinkRecord *linkRemote = 0; ++ NS_ASSERT(l); ++ GlobalRoutingLinkRecord *linkRemote = 0; + linkRemote = SPFGetNextLink (w, v, linkRemote); + // + // At this point, is the Global Router Link Record describing the point- +@@ -695,6 +770,56 @@ GlobalRouteManagerImpl::SPFNexthopCalcul + v->GetVertexId () << " to " << w->GetVertexId () << + " goes through next hop " << w->GetNextHop () << + " via outgoing interface " << w->GetOutgoingInterfaceId ()); ++ } // end W is a router vertes ++ else ++ { ++ NS_ASSERT (w->GetVertexType () == SPFVertex::VertexNetwork); ++// W is a directly connected network; no next hop is required ++ GlobalRoutingLSA* w_lsa = w->GetLSA (); ++ NS_ASSERT (w_lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA); ++// Find outgoing interface ID for this network ++ w->SetOutgoingInterfaceId ( ++ FindOutgoingInterfaceId (w_lsa->GetLinkStateId (), ++ w_lsa->GetNetworkLSANetworkMask () )); ++ w->SetDistanceFromRoot (distance); ++ w->SetParent (v); ++ NS_DEBUG ("SPFNexthopCalculation: Next hop from " << ++ v->GetVertexId () << " to network " << w->GetVertexId () << ++ " via outgoing interface " << w->GetOutgoingInterfaceId ()); ++ return 1; ++ } ++ } // end v is the root ++ else if (v->GetVertexType () == SPFVertex::VertexNetwork) ++ { ++// See if any of v's parents are the root ++ if (v->GetParent () == m_spfroot) ++ { ++// 16.1.1 para 5. ...the parent vertex is a network that ++// directly connects the calculating router to the destination ++// router. The list of next hops is then determined by ++// examining the destination's router-LSA... ++ NS_ASSERT (w->GetVertexType () == SPFVertex::VertexRouter); ++ GlobalRoutingLinkRecord *linkRemote = 0; ++ while ((linkRemote = SPFGetNextLink (w, v, linkRemote))) ++ { ++/* ...For each link in the router-LSA that points back to the ++ * parent network, the link's Link Data field provides the IP ++ * address of a next hop router. The outgoing interface to ++ * use can then be derived from the next hop IP address (or ++ * it can be inherited from the parent network). ++ */ ++ w->SetNextHop(linkRemote->GetLinkData ()); ++ w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ()); ++ NS_DEBUG ("SPFNexthopCalculation: Next hop from " << ++ v->GetVertexId () << " to " << w->GetVertexId () << ++ " goes through next hop " << w->GetNextHop () << ++ " via outgoing interface " << w->GetOutgoingInterfaceId ()); ++ } ++ } ++ else ++ { ++ w->SetNextHop (v->GetNextHop ()); ++ w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ()); + } + } + else +@@ -736,19 +861,17 @@ GlobalRouteManagerImpl::SPFNexthopCalcul + // to . If prev_link is not NULL, we return a Global Router Link Record + // representing a possible *second* link from to . + // +-// BUGBUG FIXME: This seems to be a bug. Shouldn't this function look for +-// any link records after pre_link and not just after the first? +-// +- GlobalRouterLinkRecord* ++ GlobalRoutingLinkRecord* + GlobalRouteManagerImpl::SPFGetNextLink ( + SPFVertex* v, + SPFVertex* w, +- GlobalRouterLinkRecord* prev_link) ++ GlobalRoutingLinkRecord* prev_link) + { + NS_DEBUG ("GlobalRouteManagerImpl::SPFGetNextLink ()"); + + bool skip = true; +- GlobalRouterLinkRecord* l; ++ bool found_prev_link = false; ++ GlobalRoutingLinkRecord* l; + // + // If prev_link is 0, we are really looking for the first link, not the next + // link. +@@ -756,6 +879,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( + if (prev_link == 0) + { + skip = false; ++ found_prev_link = true; + } + // + // Iterate through the Global Router Link Records advertised by the vertex +@@ -765,10 +889,6 @@ GlobalRouteManagerImpl::SPFGetNextLink ( + for (uint32_t i = 0; i < v->GetLSA ()->GetNLinkRecords (); ++i) + { + l = v->GetLSA ()->GetLinkRecord (i); +- if (l->GetLinkType () != GlobalRouterLinkRecord::PointToPoint) +- { +- continue; +- } + // + // The link ID of a link record representing a point-to-point link is set to + // the router ID of the neighboring router -- the router to which the link +@@ -777,8 +897,16 @@ GlobalRouteManagerImpl::SPFGetNextLink ( + // We're just checking to see if the link is actually the link from to + // . + // +- if (l->GetLinkId () == w->GetVertexId ()) { +- NS_DEBUG ("SPFGetNextLink: Found matching link l: linkId = " << ++ if (l->GetLinkId () == w->GetVertexId ()) ++ { ++ if (!found_prev_link) ++ { ++ NS_DEBUG ("SPFGetNextLink: Skipping links before prev_link found"); ++ found_prev_link = true; ++ continue; ++ } ++ ++ NS_DEBUG ("SPFGetNextLink: Found matching link l: linkId = " << + l->GetLinkId () << " linkData = " << l->GetLinkData ()); + // + // If skip is false, don't (not too surprisingly) skip the link found -- it's +@@ -849,7 +977,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ip + // + m_spfroot= v; + v->SetDistanceFromRoot (0); +- v->GetLSA ()->SetStatus (GlobalRouterLSA::LSA_SPF_IN_SPFTREE); ++ v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE); + + for (;;) + { +@@ -894,7 +1022,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ip + // Update the status field of the vertex to indicate that it is in the SPF + // tree. + // +- v->GetLSA ()->SetStatus (GlobalRouterLSA::LSA_SPF_IN_SPFTREE); ++ v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE); + // + // The current vertex has a parent pointer. By calling this rather oddly + // named method (blame quagga) we add the current vertex to the list of +@@ -932,7 +1060,18 @@ GlobalRouteManagerImpl::SPFCalculate (Ip + // through its point-to-point links, adding a *host* route to the local IP + // address (at the side) for each of those links. + // +- SPFIntraAddRouter (v); ++ if (v->GetVertexType () == SPFVertex::VertexRouter) ++ { ++ SPFIntraAddRouter (v); ++ } ++ else if (v->GetVertexType () == SPFVertex::VertexNetwork) ++ { ++ SPFIntraAddTransit (v); ++ } ++ else ++ { ++ NS_ASSERT_MSG(0, "illegal SPFVertex type"); ++ } + // + // RFC2328 16.1. (5). + // +@@ -1026,6 +1165,80 @@ GlobalRouteManagerImpl::FindOutgoingInte + } + + // ++// XXX This should probably be a method on Ipv4 ++// ++// Return the interface index corresponding to a given IP address ++// ++ uint32_t ++GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) ++{ ++// ++// We have an IP address and a vertex ID of the root of the SPF tree. ++// The question is what interface index does this address correspond to. ++// The answer is a little complicated since we have to find a pointer to ++// the node corresponding to the vertex ID, find the Ipv4 interface on that ++// node in order to iterate the interfaces and find the one corresponding to ++// the address in question. ++// ++ Ipv4Address routerId = m_spfroot->GetVertexId (); ++// ++// Walk the list of nodes in the system looking for the one corresponding to ++// the node at the root of the SPF tree. This is the node for which we are ++// building the routing table. ++// ++ std::vector >::iterator i = NodeList::Begin (); ++ for (; i != NodeList::End (); i++) ++ { ++ Ptr node = *i; ++ ++ Ptr rtr = ++ node->QueryInterface (GlobalRouter::iid); ++// ++// If the node doesn't have a GlobalRouter interface it can't be the one ++// we're interested in. ++// ++ if (rtr == 0) ++ { ++ continue; ++ } ++ ++ if (rtr->GetRouterId () == routerId) ++ { ++// ++// This is the node we're building the routing table for. We're going to need ++// the Ipv4 interface to look for the ipv4 interface index. Since this node ++// is participating in routing IP version 4 packets, it certainly must have ++// an Ipv4 interface. ++// ++ Ptr ipv4 = node->QueryInterface (Ipv4::iid); ++ NS_ASSERT_MSG (ipv4, ++ "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " ++ "QI for interface failed"); ++// ++// Look through the interfaces on this node for one that has the IP address ++// we're looking for. If we find one, return the corresponding interface ++// index. ++// ++ for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) ++ { ++ if (ipv4->GetAddress (i).CombineMask(amask) == ++ a.CombineMask(amask) ) ++ { ++ NS_DEBUG ( ++ "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " ++ "Interface match for " << a); ++ return i; ++ } ++ } ++ } ++ } ++// ++// Couldn't find it. ++// ++ return 0; ++} ++ ++// + // This method is derived from quagga ospf_intra_add_router () + // + // This is where we are actually going to add the host routes to the routing +@@ -1109,7 +1322,7 @@ GlobalRouteManagerImpl::SPFIntraAddRoute + // Link Records corresponding to links off of that vertex / node. We're going + // to be interested in the records corresponding to point-to-point links. + // +- GlobalRouterLSA *lsa = v->GetLSA (); ++ GlobalRoutingLSA *lsa = v->GetLSA (); + NS_ASSERT_MSG (lsa, + "GlobalRouteManagerImpl::SPFIntraAddRouter (): " + "Expected valid LSA in SPFVertex* v"); +@@ -1128,8 +1341,8 @@ GlobalRouteManagerImpl::SPFIntraAddRoute + // + // We are only concerned about point-to-point links + // +- GlobalRouterLinkRecord *lr = lsa->GetLinkRecord (j); +- if (lr->GetLinkType () != GlobalRouterLinkRecord::PointToPoint) ++ GlobalRoutingLinkRecord *lr = lsa->GetLinkRecord (j); ++ if (lr->GetLinkType () != GlobalRoutingLinkRecord::PointToPoint) + { + continue; + } +@@ -1161,6 +1374,91 @@ GlobalRouteManagerImpl::SPFIntraAddRoute + return; + } + } ++} ++ void ++GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) ++{ ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit ()"); ++ ++ NS_ASSERT_MSG (m_spfroot, ++ "GlobalRouteManagerImpl::SPFIntraAddTransit (): Root pointer not set"); ++// ++// The root of the Shortest Path First tree is the router to which we are ++// going to write the actual routing table entries. The vertex corresponding ++// to this router has a vertex ID which is the router ID of that node. We're ++// going to use this ID to discover which node it is that we're actually going ++// to update. ++// ++ Ipv4Address routerId = m_spfroot->GetVertexId (); ++ ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "Vertex ID = " << routerId); ++// ++// We need to walk the list of nodes looking for the one that has the router ++// ID corresponding to the root vertex. This is the one we're going to write ++// the routing information to. ++// ++ std::vector >::iterator i = NodeList::Begin (); ++ for (; i != NodeList::End (); i++) ++ { ++ Ptr node = *i; ++// ++// The router ID is accessible through the GlobalRouter interface, so we need ++// to QI for that interface. If there's no GlobalRouter interface, the node ++// in question cannot be the router we want, so we continue. ++// ++ Ptr rtr = ++ node->QueryInterface (GlobalRouter::iid); ++ ++ if (rtr == 0) ++ { ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "No GlobalRouter interface on node " << node->GetId ()); ++ continue; ++ } ++// ++// If the router ID of the current node is equal to the router ID of the ++// root of the SPF tree, then this node is the one for which we need to ++// write the routing tables. ++// ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "Considering router " << rtr->GetRouterId ()); ++ ++ if (rtr->GetRouterId () == routerId) ++ { ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "setting routes for node " << node->GetId ()); ++// ++// Routing information is updated using the Ipv4 interface. We need to QI ++// for that interface. If the node is acting as an IP version 4 router, it ++// should absolutely have an Ipv4 interface. ++// ++ Ptr ipv4 = node->QueryInterface (Ipv4::iid); ++ NS_ASSERT_MSG (ipv4, ++ "GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "QI for interface failed"); ++// ++// Get the Global Router Link State Advertisement from the vertex we're ++// adding the routes to. The LSA will have a number of attached Global Router ++// Link Records corresponding to links off of that vertex / node. We're going ++// to be interested in the records corresponding to point-to-point links. ++// ++ GlobalRoutingLSA *lsa = v->GetLSA (); ++ NS_ASSERT_MSG (lsa, ++ "GlobalRouteManagerImpl::SPFIntraAddTransit (): " ++ "Expected valid LSA in SPFVertex* v"); ++ Ipv4Mask tempmask = lsa->GetNetworkLSANetworkMask (); ++ Ipv4Address tempip = lsa->GetLinkStateId (); ++ tempip = tempip.CombineMask (tempmask); ++ ipv4->AddNetworkRouteTo (tempip, tempmask, v->GetNextHop (), ++ v->GetOutgoingInterfaceId ()); ++ NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddNetwork (): " ++ " Node " << node->GetId () << ++ " add network route to " << tempip << ++ " using next hop " << v->GetNextHop () << ++ " via interface " << v->GetOutgoingInterfaceId ()); ++ } ++ } + } + + // Derived from quagga ospf_vertex_add_parents () +@@ -1275,81 +1573,81 @@ GlobalRouteManagerImplTest::RunTests (vo + // link2: 10.1.3.1/30, 10.1.3.2/30 + // + // Router 0 +- GlobalRouterLinkRecord* lr0 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr0 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.2", // router ID 0.0.0.2 + "10.1.1.1", // local ID + 1); // metric + +- GlobalRouterLinkRecord* lr1 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr1 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.1.1", + "255.255.255.252", + 1); + +- GlobalRouterLSA* lsa0 = new GlobalRouterLSA (); ++ GlobalRoutingLSA* lsa0 = new GlobalRoutingLSA (); + lsa0->SetLinkStateId ("0.0.0.0"); + lsa0->SetAdvertisingRouter ("0.0.0.0"); + lsa0->AddLinkRecord (lr0); + lsa0->AddLinkRecord (lr1); + + // Router 1 +- GlobalRouterLinkRecord* lr2 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr2 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.2", + "10.1.2.1", + 1); + +- GlobalRouterLinkRecord* lr3 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr3 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.2.1", + "255.255.255.252", + 1); + +- GlobalRouterLSA* lsa1 = new GlobalRouterLSA (); ++ GlobalRoutingLSA* lsa1 = new GlobalRoutingLSA (); + lsa1->SetLinkStateId ("0.0.0.1"); + lsa1->SetAdvertisingRouter ("0.0.0.1"); + lsa1->AddLinkRecord (lr2); + lsa1->AddLinkRecord (lr3); + + // Router 2 +- GlobalRouterLinkRecord* lr4 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr4 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.0", + "10.1.1.2", + 1); + +- GlobalRouterLinkRecord* lr5 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr5 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.1.2", + "255.255.255.252", + 1); + +- GlobalRouterLinkRecord* lr6 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr6 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.1", + "10.1.2.2", + 1); + +- GlobalRouterLinkRecord* lr7 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr7 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.2.2", + "255.255.255.252", + 1); + +- GlobalRouterLinkRecord* lr8 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr8 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.3", + "10.1.3.2", + 1); + +- GlobalRouterLinkRecord* lr9 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr9 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.3.2", + "255.255.255.252", + 1); + +- GlobalRouterLSA* lsa2 = new GlobalRouterLSA (); ++ GlobalRoutingLSA* lsa2 = new GlobalRoutingLSA (); + lsa2->SetLinkStateId ("0.0.0.2"); + lsa2->SetAdvertisingRouter ("0.0.0.2"); + lsa2->AddLinkRecord (lr4); +@@ -1360,19 +1658,19 @@ GlobalRouteManagerImplTest::RunTests (vo + lsa2->AddLinkRecord (lr9); + + // Router 3 +- GlobalRouterLinkRecord* lr10 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::PointToPoint, ++ GlobalRoutingLinkRecord* lr10 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::PointToPoint, + "0.0.0.2", + "10.1.2.1", + 1); + +- GlobalRouterLinkRecord* lr11 = new GlobalRouterLinkRecord ( +- GlobalRouterLinkRecord::StubNetwork, ++ GlobalRoutingLinkRecord* lr11 = new GlobalRoutingLinkRecord ( ++ GlobalRoutingLinkRecord::StubNetwork, + "10.1.2.1", + "255.255.255.252", + 1); + +- GlobalRouterLSA* lsa3 = new GlobalRouterLSA (); ++ GlobalRoutingLSA* lsa3 = new GlobalRoutingLSA (); + lsa3->SetLinkStateId ("0.0.0.3"); + lsa3->SetAdvertisingRouter ("0.0.0.3"); + lsa3->AddLinkRecord (lr10); +diff -r 25fa26a6533e -r 3760d52ef5d1 src/routing/global-routing/global-route-manager-impl.h +--- a/src/routing/global-routing/global-route-manager-impl.h Sun Aug 12 22:41:24 2007 -0700 ++++ b/src/routing/global-routing/global-route-manager-impl.h Sun Aug 12 22:43:25 2007 -0700 +@@ -102,10 +102,10 @@ public: + * + * @see SPFVertex::SPFVertex () + * @see VertexType +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @param lsa The Link State Advertisement used for finding initial values. + */ +- SPFVertex(GlobalRouterLSA* lsa); ++ SPFVertex(GlobalRoutingLSA* lsa); + + /** + * @brief Destroy an SPFVertex (Shortest Path First Vertex). +@@ -181,12 +181,12 @@ public: + * @internal + * + * @see GlobalRouter +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @see GlobalRouter::DiscoverLSAs () +- * @returns A pointer to the GlobalRouterLSA found by the router represented ++ * @returns A pointer to the GlobalRoutingLSA found by the router represented + * by this SPFVertex object. + */ +- GlobalRouterLSA* GetLSA (void) const; ++ GlobalRoutingLSA* GetLSA (void) const; + + /** + * @brief Set the Global Router Link State Advertisement returned by the +@@ -196,13 +196,13 @@ public: + * + * @see SPFVertex::GetLSA () + * @see GlobalRouter +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @see GlobalRouter::DiscoverLSAs () + * @warning Ownership of the LSA is transferred to the "this" SPFVertex. You + * must not delete the LSA after calling this method. +- * @param lsa A pointer to the GlobalRouterLSA. +- */ +- void SetLSA (GlobalRouterLSA* lsa); ++ * @param lsa A pointer to the GlobalRoutingLSA. ++ */ ++ void SetLSA (GlobalRoutingLSA* lsa); + + /** + * @brief Get the distance from the root vertex to "this" SPFVertex object. +@@ -283,8 +283,8 @@ public: + * SPFVertex." + * + * @see GlobalRouter +- * @see GlobalRouterLSA +- * @see GlobalRouterLinkRecord ++ * @see GlobalRoutingLSA ++ * @see GlobalRoutingLinkRecord + * @returns The interface index to use when forwarding packets to the host + * or network represented by "this" SPFVertex. + */ +@@ -325,8 +325,8 @@ public: + * by "this" SPFVertex. + * + * @see GlobalRouter +- * @see GlobalRouterLSA +- * @see GlobalRouterLinkRecord ++ * @see GlobalRoutingLSA ++ * @see GlobalRoutingLinkRecord + * @param id The interface index to use when forwarding packets to the host or + * network represented by "this" SPFVertex. + */ +@@ -368,8 +368,8 @@ public: + * by 'this' SPFVertex." + * + * @see GlobalRouter +- * @see GlobalRouterLSA +- * @see GlobalRouterLinkRecord ++ * @see GlobalRoutingLSA ++ * @see GlobalRoutingLinkRecord + * @returns The IP address to use when forwarding packets to the host + * or network represented by "this" SPFVertex. + */ +@@ -411,8 +411,8 @@ public: + * host represented by 'this' SPFVertex." + * + * @see GlobalRouter +- * @see GlobalRouterLSA +- * @see GlobalRouterLinkRecord ++ * @see GlobalRoutingLSA ++ * @see GlobalRoutingLinkRecord + * @param nextHop The IP address to use when forwarding packets to the host + * or network represented by "this" SPFVertex. + */ +@@ -543,7 +543,7 @@ private: + private: + VertexType m_vertexType; + Ipv4Address m_vertexId; +- GlobalRouterLSA* m_lsa; ++ GlobalRoutingLSA* m_lsa; + uint32_t m_distanceFromRoot; + uint32_t m_rootOif; + Ipv4Address m_nextHop; +@@ -604,33 +604,47 @@ public: + * State Database. + * @internal + * +- * The IPV4 address and the GlobalRouterLSA given as parameters are converted ++ * The IPV4 address and the GlobalRoutingLSA given as parameters are converted + * to an STL pair and are inserted into the database map. + * +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @see Ipv4Address + * @param addr The IP address associated with the LSA. Typically the Router + * ID. + * @param lsa A pointer to the Link State Advertisement for the router. + */ +- void Insert(Ipv4Address addr, GlobalRouterLSA* lsa); ++ void Insert(Ipv4Address addr, GlobalRoutingLSA* lsa); + + /** + * @brief Look up the Link State Advertisement associated with the given +- * IP Address. ++ * link state ID (address). + * @internal + * + * The database map is searched for the given IPV4 address and corresponding +- * GlobalRouterLSA is returned. +- * +- * @see GlobalRouterLSA ++ * GlobalRoutingLSA is returned. ++ * ++ * @see GlobalRoutingLSA + * @see Ipv4Address + * @param addr The IP address associated with the LSA. Typically the Router + * ID. + * @returns A pointer to the Link State Advertisement for the router specified + * by the IP address addr. + */ +- GlobalRouterLSA* GetLSA (Ipv4Address addr) const; ++ GlobalRoutingLSA* GetLSA (Ipv4Address addr) const; ++/** ++ * @brief Look up the Link State Advertisement associated with the given ++ * link state ID (address). This is a variation of the GetLSA call ++ * to allow the LSA to be found by matching addr with the LinkData field ++ * of the TransitNetwork link record. ++ * @internal ++ * ++ * @see GetLSA ++ * @param addr The IP address associated with the LSA. Typically the Router ++ * @returns A pointer to the Link State Advertisement for the router specified ++ * by the IP address addr. ++ * ID. ++ */ ++ GlobalRoutingLSA* GetLSAByLinkData (Ipv4Address addr) const; + + /** + * @brief Set all LSA flags to an initialized state, for SPF computation +@@ -641,14 +655,14 @@ public: + * prior to each SPF calculation to reset the state of the SPFVertex structures + * that will reference the LSAs during the calculation. + * +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @see SPFVertex + */ + void Initialize (); + + private: +- typedef std::map LSDBMap_t; +- typedef std::pair LSDBPair_t; ++ typedef std::map LSDBMap_t; ++ typedef std::pair LSDBPair_t; + + LSDBMap_t m_database; + /** +@@ -734,12 +748,14 @@ private: + void SPFCalculate (Ipv4Address root); + void SPFNext (SPFVertex*, CandidateQueue&); + int SPFNexthopCalculation (SPFVertex* v, SPFVertex* w, +- GlobalRouterLinkRecord* l, uint32_t distance); ++ GlobalRoutingLinkRecord* l, uint32_t distance); + void SPFVertexAddParent (SPFVertex* v); +- GlobalRouterLinkRecord* SPFGetNextLink (SPFVertex* v, SPFVertex* w, +- GlobalRouterLinkRecord* prev_link); ++ GlobalRoutingLinkRecord* SPFGetNextLink (SPFVertex* v, SPFVertex* w, ++ GlobalRoutingLinkRecord* prev_link); + void SPFIntraAddRouter (SPFVertex* v); ++ void SPFIntraAddTransit (SPFVertex* v); + uint32_t FindOutgoingInterfaceId (Ipv4Address a); ++ uint32_t FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask); + }; + + } // namespace ns3 +diff -r 25fa26a6533e -r 3760d52ef5d1 src/routing/global-routing/global-router-interface.cc +--- a/src/routing/global-routing/global-router-interface.cc Sun Aug 12 22:41:24 2007 -0700 ++++ b/src/routing/global-routing/global-router-interface.cc Sun Aug 12 22:43:25 2007 -0700 +@@ -28,21 +28,21 @@ namespace ns3 { + + // --------------------------------------------------------------------------- + // +-// GlobalRouterLinkRecord Implementation ++// GlobalRoutingLinkRecord Implementation + // + // --------------------------------------------------------------------------- + +-GlobalRouterLinkRecord::GlobalRouterLinkRecord () ++GlobalRoutingLinkRecord::GlobalRoutingLinkRecord () + : + m_linkId ("0.0.0.0"), + m_linkData ("0.0.0.0"), + m_linkType (Unknown), + m_metric (0) + { +- NS_DEBUG("GlobalRouterLinkRecord::GlobalRouterLinkRecord ()"); +-} +- +-GlobalRouterLinkRecord::GlobalRouterLinkRecord ( ++ NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ()"); ++} ++ ++GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( + LinkType linkType, + Ipv4Address linkId, + Ipv4Address linkData, +@@ -53,116 +53,126 @@ GlobalRouterLinkRecord::GlobalRouterLink + m_linkType (linkType), + m_metric (metric) + { +- NS_DEBUG("GlobalRouterLinkRecord::GlobalRouterLinkRecord (" << ++ NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (" << + linkType << ", " << linkId << ", " << linkData << ", " << metric << ")"); + } + +-GlobalRouterLinkRecord::~GlobalRouterLinkRecord () +-{ +- NS_DEBUG("GlobalRouterLinkRecord::~GlobalRouterLinkRecord ()"); ++GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord () ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()"); + } + + Ipv4Address +-GlobalRouterLinkRecord::GetLinkId (void) const +-{ +- NS_DEBUG("GlobalRouterLinkRecord::GetLinkId ()"); ++GlobalRoutingLinkRecord::GetLinkId (void) const ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::GetLinkId ()"); + return m_linkId; + } + + void +-GlobalRouterLinkRecord::SetLinkId (Ipv4Address addr) +-{ +- NS_DEBUG("GlobalRouterLinkRecord::SetLinkId ()"); ++GlobalRoutingLinkRecord::SetLinkId (Ipv4Address addr) ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::SetLinkId ()"); + m_linkId = addr; + } + + Ipv4Address +-GlobalRouterLinkRecord::GetLinkData (void) const +-{ +- NS_DEBUG("GlobalRouterLinkRecord::GetLinkData ()"); ++GlobalRoutingLinkRecord::GetLinkData (void) const ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::GetLinkData ()"); + return m_linkData; + } + + void +-GlobalRouterLinkRecord::SetLinkData (Ipv4Address addr) +-{ +- NS_DEBUG("GlobalRouterLinkRecord::SetLinkData ()"); ++GlobalRoutingLinkRecord::SetLinkData (Ipv4Address addr) ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::SetLinkData ()"); + m_linkData = addr; + } + +- GlobalRouterLinkRecord::LinkType +-GlobalRouterLinkRecord::GetLinkType (void) const +-{ +- NS_DEBUG("GlobalRouterLinkRecord::GetLinkType ()"); ++ GlobalRoutingLinkRecord::LinkType ++GlobalRoutingLinkRecord::GetLinkType (void) const ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::GetLinkType ()"); + return m_linkType; + } + + void +-GlobalRouterLinkRecord::SetLinkType ( +- GlobalRouterLinkRecord::LinkType linkType) +-{ +- NS_DEBUG("GlobalRouterLinkRecord::SetLinkType ()"); ++GlobalRoutingLinkRecord::SetLinkType ( ++ GlobalRoutingLinkRecord::LinkType linkType) ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::SetLinkType ()"); + m_linkType = linkType; + } + + uint32_t +-GlobalRouterLinkRecord::GetMetric (void) const +-{ +- NS_DEBUG("GlobalRouterLinkRecord::GetMetric ()"); ++GlobalRoutingLinkRecord::GetMetric (void) const ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::GetMetric ()"); + return m_metric; + } + + void +-GlobalRouterLinkRecord::SetMetric (uint32_t metric) +-{ +- NS_DEBUG("GlobalRouterLinkRecord::SetMetric ()"); ++GlobalRoutingLinkRecord::SetMetric (uint32_t metric) ++{ ++ NS_DEBUG("GlobalRoutingLinkRecord::SetMetric ()"); + m_metric = metric; + } + + // --------------------------------------------------------------------------- + // +-// GlobalRouterLSA Implementation ++// GlobalRoutingLSA Implementation + // + // --------------------------------------------------------------------------- + +-GlobalRouterLSA::GlobalRouterLSA() ++GlobalRoutingLSA::GlobalRoutingLSA() + : ++ m_lsType (GlobalRoutingLSA::Unknown), + m_linkStateId("0.0.0.0"), + m_advertisingRtr("0.0.0.0"), + m_linkRecords(), +- m_status(GlobalRouterLSA::LSA_SPF_NOT_EXPLORED) +-{ +- NS_DEBUG("GlobalRouterLSA::GlobalRouterLSA ()"); +-} +- +-GlobalRouterLSA::GlobalRouterLSA ( +- GlobalRouterLSA::SPFStatus status, ++ m_networkLSANetworkMask("0.0.0.0"), ++ m_attachedRouters(), ++ m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) ++{ ++ NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA ()"); ++} ++ ++GlobalRoutingLSA::GlobalRoutingLSA ( ++ GlobalRoutingLSA::SPFStatus status, + Ipv4Address linkStateId, + Ipv4Address advertisingRtr) + : ++ m_lsType (GlobalRoutingLSA::Unknown), + m_linkStateId(linkStateId), + m_advertisingRtr(advertisingRtr), + m_linkRecords(), ++ m_networkLSANetworkMask("0.0.0.0"), ++ m_attachedRouters(), + m_status(status) + { +- NS_DEBUG("GlobalRouterLSA::GlobalRouterLSA (" << status << ", " << ++ NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA (" << status << ", " << + linkStateId << ", " << advertisingRtr << ")"); + } + +-GlobalRouterLSA::GlobalRouterLSA (GlobalRouterLSA& lsa) +- : m_linkStateId(lsa.m_linkStateId), m_advertisingRtr(lsa.m_advertisingRtr), ++GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) ++ : m_lsType(lsa.m_lsType), m_linkStateId(lsa.m_linkStateId), ++ m_advertisingRtr(lsa.m_advertisingRtr), ++ m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), + m_status(lsa.m_status) + { + NS_ASSERT_MSG(IsEmpty(), +- "GlobalRouterLSA::GlobalRouterLSA (): Non-empty LSA in constructor"); ++ "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); + CopyLinkRecords (lsa); + } + +- GlobalRouterLSA& +-GlobalRouterLSA::operator= (const GlobalRouterLSA& lsa) +-{ ++ GlobalRoutingLSA& ++GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) ++{ ++ m_lsType = lsa.m_lsType; + m_linkStateId = lsa.m_linkStateId; + m_advertisingRtr = lsa.m_advertisingRtr; ++ m_networkLSANetworkMask = lsa.m_networkLSANetworkMask, + m_status = lsa.m_status; + + ClearLinkRecords (); +@@ -171,14 +181,14 @@ GlobalRouterLSA::operator= (const Global + } + + void +-GlobalRouterLSA::CopyLinkRecords (const GlobalRouterLSA& lsa) ++GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) + { + for (ListOfLinkRecords_t::const_iterator i = lsa.m_linkRecords.begin (); + i != lsa.m_linkRecords.end (); + i++) + { +- GlobalRouterLinkRecord *pSrc = *i; +- GlobalRouterLinkRecord *pDst = new GlobalRouterLinkRecord; ++ GlobalRoutingLinkRecord *pSrc = *i; ++ GlobalRoutingLinkRecord *pDst = new GlobalRoutingLinkRecord; + + pDst->SetLinkType (pSrc->GetLinkType ()); + pDst->SetLinkId (pSrc->GetLinkId ()); +@@ -187,48 +197,50 @@ GlobalRouterLSA::CopyLinkRecords (const + m_linkRecords.push_back(pDst); + pDst = 0; + } +-} +- +-GlobalRouterLSA::~GlobalRouterLSA() +-{ +- NS_DEBUG("GlobalRouterLSA::~GlobalRouterLSA ()"); ++ ++ m_attachedRouters = lsa.m_attachedRouters; ++} ++ ++GlobalRoutingLSA::~GlobalRoutingLSA() ++{ ++ NS_DEBUG("GlobalRoutingLSA::~GlobalRoutingLSA ()"); + ClearLinkRecords (); + } + + void +-GlobalRouterLSA::ClearLinkRecords(void) ++GlobalRoutingLSA::ClearLinkRecords(void) + { + for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin (); + i != m_linkRecords.end (); + i++) + { +- NS_DEBUG("GlobalRouterLSA::ClearLinkRecords (): free link record"); +- +- GlobalRouterLinkRecord *p = *i; ++ NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords (): free link record"); ++ ++ GlobalRoutingLinkRecord *p = *i; + delete p; + p = 0; + + *i = 0; + } +- NS_DEBUG("GlobalRouterLSA::ClearLinkRecords(): clear list"); ++ NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords(): clear list"); + m_linkRecords.clear(); + } + + uint32_t +-GlobalRouterLSA::AddLinkRecord (GlobalRouterLinkRecord* lr) ++GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) + { + m_linkRecords.push_back (lr); + return m_linkRecords.size (); + } + + uint32_t +-GlobalRouterLSA::GetNLinkRecords (void) const ++GlobalRoutingLSA::GetNLinkRecords (void) const + { + return m_linkRecords.size (); + } + +- GlobalRouterLinkRecord * +-GlobalRouterLSA::GetLinkRecord (uint32_t n) const ++ GlobalRoutingLinkRecord * ++GlobalRoutingLSA::GetLinkRecord (uint32_t n) const + { + uint32_t j = 0; + for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); +@@ -240,70 +252,146 @@ GlobalRouterLSA::GetLinkRecord (uint32_t + return *i; + } + } +- NS_ASSERT_MSG(false, "GlobalRouterLSA::GetLinkRecord (): invalid index"); ++ NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetLinkRecord (): invalid index"); + return 0; + } + + bool +-GlobalRouterLSA::IsEmpty (void) const ++GlobalRoutingLSA::IsEmpty (void) const + { + return m_linkRecords.size () == 0; + } + ++ GlobalRoutingLSA::LSType ++GlobalRoutingLSA::GetLSType (void) const ++{ ++ return m_lsType; ++} ++ ++ void ++GlobalRoutingLSA::SetLSType (GlobalRoutingLSA::LSType typ) ++{ ++ m_lsType = typ; ++} ++ + Ipv4Address +-GlobalRouterLSA::GetLinkStateId (void) const ++GlobalRoutingLSA::GetLinkStateId (void) const + { + return m_linkStateId; + } + + void +-GlobalRouterLSA::SetLinkStateId (Ipv4Address addr) ++GlobalRoutingLSA::SetLinkStateId (Ipv4Address addr) + { + m_linkStateId = addr; + } + + Ipv4Address +-GlobalRouterLSA::GetAdvertisingRouter (void) const ++GlobalRoutingLSA::GetAdvertisingRouter (void) const + { + return m_advertisingRtr; + } + + void +-GlobalRouterLSA::SetAdvertisingRouter (Ipv4Address addr) ++GlobalRoutingLSA::SetAdvertisingRouter (Ipv4Address addr) + { + m_advertisingRtr = addr; + } + +- GlobalRouterLSA::SPFStatus +-GlobalRouterLSA::GetStatus (void) const ++ void ++GlobalRoutingLSA::SetNetworkLSANetworkMask (Ipv4Mask mask) ++{ ++ m_networkLSANetworkMask = mask; ++} ++ ++ Ipv4Mask ++GlobalRoutingLSA::GetNetworkLSANetworkMask (void) const ++{ ++ return m_networkLSANetworkMask; ++} ++ ++ GlobalRoutingLSA::SPFStatus ++GlobalRoutingLSA::GetStatus (void) const + { + return m_status; + } + +- void +-GlobalRouterLSA::SetStatus (GlobalRouterLSA::SPFStatus status) ++ uint32_t ++GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) ++{ ++ m_attachedRouters.push_back (addr); ++ return m_attachedRouters.size (); ++} ++ ++ uint32_t ++GlobalRoutingLSA::GetNAttachedRouters (void) const ++{ ++ return m_attachedRouters.size (); ++} ++ ++ Ipv4Address ++GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const ++{ ++ uint32_t j = 0; ++ for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin (); ++ i != m_attachedRouters.end (); ++ i++, j++) ++ { ++ if (j == n) ++ { ++ return *i; ++ } ++ } ++ NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); ++ return Ipv4Address("0.0.0.0"); ++} ++ ++ void ++GlobalRoutingLSA::SetStatus (GlobalRoutingLSA::SPFStatus status) + { + m_status = status; + } + + void +-GlobalRouterLSA::Print (std::ostream &os) const +-{ +- os << "m_linkStateId = " << m_linkStateId << std::endl << ++GlobalRoutingLSA::Print (std::ostream &os) const ++{ ++ os << "m_lsType = " << m_lsType << std::endl << ++ "m_linkStateId = " << m_linkStateId << std::endl << + "m_advertisingRtr = " << m_advertisingRtr << std::endl; + +- for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); +- i != m_linkRecords.end (); +- i++) +- { +- GlobalRouterLinkRecord *p = *i; ++ if (m_lsType == GlobalRoutingLSA::RouterLSA) ++ { ++ for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); ++ i != m_linkRecords.end (); ++ i++) ++ { ++ GlobalRoutingLinkRecord *p = *i; ++ os << "----------" << std::endl; ++ os << "m_linkId = " << p->GetLinkId () << std::endl; ++ os << "m_linkData = " << p->GetLinkData () << std::endl; ++ } ++ } ++ else if (m_lsType == GlobalRoutingLSA::NetworkLSA) ++ { + os << "----------" << std::endl; +- os << "m_linkId = " << p->GetLinkId () << std::endl; +- os << "m_linkData = " << p->GetLinkData () << std::endl; +- } +-} +- +-std::ostream& operator<< (std::ostream& os, GlobalRouterLSA& lsa) ++ os << "m_networkLSANetworkMask = " << m_networkLSANetworkMask ++ << std::endl; ++ for ( ListOfAttachedRouters_t::const_iterator i = ++ m_attachedRouters.begin (); ++ i != m_attachedRouters.end (); ++ i++) ++ { ++ Ipv4Address p = *i; ++ os << "attachedRouter = " << p << std::endl; ++ } ++ } ++ else ++ { ++ NS_ASSERT_MSG(0, "Illegal LSA LSType: " << m_lsType); ++ } ++} ++ ++std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa) + { + lsa.Print (os); + return os; +@@ -350,7 +438,7 @@ GlobalRouter::ClearLSAs () + { + NS_DEBUG("GlobalRouter::ClearLSAs (): free LSA"); + +- GlobalRouterLSA *p = *i; ++ GlobalRoutingLSA *p = *i; + delete p; + p = 0; + +@@ -373,11 +461,16 @@ GlobalRouter::GetRouterId (void) const + uint32_t + GlobalRouter::DiscoverLSAs (void) + { +- NS_DEBUG("GlobalRouter::DiscoverLSAs ()"); ++ NS_DEBUG("GlobalRouter::DiscoverLSAs () for node " << m_node->GetId () ); + NS_ASSERT_MSG(m_node, + "GlobalRouter::DiscoverLSAs (): interface not set"); + + ClearLSAs (); ++ ++// While building the router-LSA, keep a list of those NetDevices for ++// which I am the designated router and need to later build a NetworkLSA ++ std::list > listOfDRInterfaces; ++ + // + // We're aggregated to a node. We need to ask the node for a pointer to its + // Ipv4 interface. This is where the information regarding the attached +@@ -387,116 +480,250 @@ GlobalRouter::DiscoverLSAs (void) + NS_ASSERT_MSG(ipv4Local, + "GlobalRouter::DiscoverLSAs (): QI for interface failed"); + // +-// We are, for now at least, only going to report RouterLSAs in this method. +-// What this means is that there is going to be one advertisement with some +-// number of link records. This means that GetNumLSAs will actually always +-// return exactly one. +-// +- GlobalRouterLSA *pLSA = new GlobalRouterLSA; ++// Each node originates a Router-LSA ++// ++ GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; ++ pLSA->SetLSType (GlobalRoutingLSA::RouterLSA); + pLSA->SetLinkStateId (m_routerId); + pLSA->SetAdvertisingRouter (m_routerId); +- pLSA->SetStatus (GlobalRouterLSA::LSA_SPF_NOT_EXPLORED); ++ pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); + // + // We need to ask the node for the number of net devices attached. This isn't + // necessarily equal to the number of links to adjacent nodes (other routers) + // as the number of devices may include those for stub networks (e.g., +-// ethernets, etc.). So we have to walk through the list of net devices and +-// pay attention to those that are directly connected to another router through +-// a point-to-point channel. ++// ethernets, etc.). + // + uint32_t numDevices = m_node->GetNDevices(); + NS_DEBUG("GlobalRouter::DiscoverLSAs (): numDevices = " << numDevices); +-// +-// Loop through the devices looking for those connected to a point-to-point +-// channel. +-// + for (uint32_t i = 0; i < numDevices; ++i) + { + Ptr ndLocal = m_node->GetDevice(i); + +- if (!ndLocal->IsPointToPoint ()) +- { +- NS_DEBUG("GlobalRouter::DiscoverLSAs (): non-point-to-point device"); +- continue; +- } +- +- NS_DEBUG("GlobalRouter::DiscoverLSAs (): Point-to-point device"); ++ if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () ) ++ { ++ NS_DEBUG("GlobalRouter::DiscoverLSAs (): broadcast link"); ++ GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; ++// ++// We need to determine whether we are on a transit or stub network ++// If we find at least one more router on this channel, we are a transit ++// + // + // Now, we have to find the Ipv4 interface whose netdevice is the one we + // just found. This is still the IP on the local side of the channel. There + // is a function to do this used down in the guts of the stack, but it's not + // exported so we had to whip up an equivalent. + // +- uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); +-// +-// Now that we have the Ipv4 interface index, we can get the address and mask +-// we need. +-// +- Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); +- Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); +- NS_DEBUG("Working with local address " << addrLocal); ++ uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); ++ Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); ++ Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); ++ NS_DEBUG("Working with local address " << addrLocal); + // + // Now, we're going to walk over to the remote net device on the other end of + // the point-to-point channel we now know we have. This is where our adjacent + // router (to use OSPF lingo) is running. + // +- Ptr ch = ndLocal->GetChannel(); +- Ptr ndRemote = GetAdjacent(ndLocal, ch); ++ Ptr ch = ndLocal->GetChannel(); ++ uint32_t nDevices = ch->GetNDevices(); ++ if (nDevices == 1) ++ { ++ // This is a stub broadcast interface ++ NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA stub broadcast link"); ++ // XXX in future, need to consider if >1 includes other routers ++ plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); ++ // Link ID is IP network number of attached network ++ plr->SetLinkId (addrLocal.CombineMask(maskLocal)); ++ // Link Data is network mask; convert to Ipv4Address ++ Ipv4Address maskLocalAddr; ++ maskLocalAddr.Set(maskLocal.GetHostOrder ()); ++ plr->SetLinkData (maskLocalAddr); ++ // Cost is interface's configured output cost (NOTYET) ++ plr->SetMetric (1); ++ pLSA->AddLinkRecord(plr); ++ plr = 0; ++ continue; ++ } ++ else ++ { ++ NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Broadcast link"); ++ // multiple routers on a broadcast interface ++ // lowest IP address is designated router ++ plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork); ++ // Link ID is IP interface address of designated router ++ Ipv4Address desigRtr = ++ FindDesignatedRouterForLink (m_node, ndLocal); ++ if (desigRtr == addrLocal) ++ { ++ listOfDRInterfaces.push_back (ndLocal); ++ NS_DEBUG("GlobalRouter::DiscoverLSAs (): " << ++ m_node->GetId () << " is a DR"); ++ } ++ plr->SetLinkId (desigRtr); ++ // Link Data is router's own IP address ++ plr->SetLinkData (addrLocal); ++ // Cost is interface's configured output cost (NOTYET) ++ plr->SetMetric (1); ++ pLSA->AddLinkRecord (plr); ++ plr = 0; ++ continue; ++ } ++ } ++ else if (ndLocal->IsPointToPoint () ) ++ { ++ NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Point-to-point device"); ++// ++// Now, we have to find the Ipv4 interface whose netdevice is the one we ++// just found. This is still the IP on the local side of the channel. There ++// is a function to do this used down in the guts of the stack, but it's not ++// exported so we had to whip up an equivalent. ++// ++ uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); ++// ++// Now that we have the Ipv4 interface index, we can get the address and mask ++// we need. ++// ++ Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); ++ Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); ++ NS_DEBUG("Working with local address " << addrLocal); ++// ++// Now, we're going to walk over to the remote net device on the other end of ++// the point-to-point channel we now know we have. This is where our adjacent ++// router (to use OSPF lingo) is running. ++// ++ Ptr ch = ndLocal->GetChannel(); ++ Ptr ndRemote = GetAdjacent(ndLocal, ch); + // + // The adjacent net device is aggregated to a node. We need to ask that net + // device for its node, then ask that node for its Ipv4 interface. + // +- Ptr nodeRemote = ndRemote->GetNode(); +- Ptr ipv4Remote = nodeRemote->QueryInterface (Ipv4::iid); +- NS_ASSERT_MSG(ipv4Remote, +- "GlobalRouter::DiscoverLSAs (): QI for remote failed"); ++ Ptr nodeRemote = ndRemote->GetNode(); ++ Ptr ipv4Remote = nodeRemote->QueryInterface (Ipv4::iid); ++ NS_ASSERT_MSG(ipv4Remote, ++ "GlobalRouter::DiscoverLSAs (): QI for remote failed"); + // + // Per the OSPF spec, we're going to need the remote router ID, so we might as + // well get it now. + // +- Ptr srRemote = +- nodeRemote->QueryInterface (GlobalRouter::iid); +- NS_ASSERT_MSG(srRemote, +- "GlobalRouter::DiscoverLSAs (): QI for remote failed"); +- Ipv4Address rtrIdRemote = srRemote->GetRouterId(); +- NS_DEBUG("Working with remote router " << rtrIdRemote); ++ Ptr srRemote = ++ nodeRemote->QueryInterface (GlobalRouter::iid); ++ NS_ASSERT_MSG(srRemote, ++ "GlobalRouter::DiscoverLSAs():QI for remote failed"); ++ Ipv4Address rtrIdRemote = srRemote->GetRouterId(); ++ NS_DEBUG("Working with remote router " << rtrIdRemote); + // + // Now, just like we did above, we need to get the IP interface index for the + // net device on the other end of the point-to-point channel. + // +- uint32_t ifIndexRemote = FindIfIndexForDevice(nodeRemote, ndRemote); ++ uint32_t ifIndexRemote = FindIfIndexForDevice(nodeRemote, ndRemote); + // + // Now that we have the Ipv4 interface, we can get the (remote) address and + // mask we need. + // +- Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote); +- Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote); +- NS_DEBUG("Working with remote address " << addrRemote); ++ Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote); ++ Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote); ++ NS_DEBUG("Working with remote address " << addrRemote); + // + // Now we can fill out the link records for this link. There are always two + // link records; the first is a point-to-point record describing the link and + // the second is a stub network record with the network number. + // +- GlobalRouterLinkRecord *plr = new GlobalRouterLinkRecord; +- plr->SetLinkType (GlobalRouterLinkRecord::PointToPoint); +- plr->SetLinkId (rtrIdRemote); +- plr->SetLinkData (addrLocal); +- pLSA->AddLinkRecord(plr); +- plr = 0; +- +- plr = new GlobalRouterLinkRecord; +- plr->SetLinkType (GlobalRouterLinkRecord::StubNetwork); +- plr->SetLinkId (addrRemote); +- plr->SetLinkData (Ipv4Address(maskRemote.GetHostOrder())); // Frown +- pLSA->AddLinkRecord(plr); +- plr = 0; ++ GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; ++ plr->SetLinkType (GlobalRoutingLinkRecord::PointToPoint); ++ plr->SetLinkId (rtrIdRemote); ++ plr->SetLinkData (addrLocal); ++ pLSA->AddLinkRecord (plr); ++ plr = 0; ++ ++ plr = new GlobalRoutingLinkRecord; ++ plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); ++ plr->SetLinkId (addrRemote); ++ plr->SetLinkData (Ipv4Address(maskRemote.GetHostOrder())); // Frown ++ pLSA->AddLinkRecord (plr); ++ plr = 0; ++ } ++ else ++ { ++ NS_ASSERT_MSG(0, "GlobalRouter::DiscoverLSAs (): unknown link type"); ++ } ++ + } + // + // The LSA goes on a list of LSAs in case we want to begin exporting other + // kinds of advertisements (than Router LSAs). + m_LSAs.push_back (pLSA); + NS_DEBUG(*pLSA); ++ ++ ++// Now, determine whether we need to build a NetworkLSA ++ if (listOfDRInterfaces.size () > 0) ++ { ++ for (std::list >::iterator i = listOfDRInterfaces.begin (); ++ i != listOfDRInterfaces.end (); i++) ++ { ++// Build one NetworkLSA for each interface that is a DR ++ Ptr ndLocal = *i; ++ uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); ++ Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); ++ Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); ++ ++ GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; ++ pLSA->SetLSType (GlobalRoutingLSA::NetworkLSA); ++ pLSA->SetLinkStateId (addrLocal); ++ pLSA->SetAdvertisingRouter (m_routerId); ++ pLSA->SetNetworkLSANetworkMask (maskLocal); ++ pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); ++// Build list of AttachedRouters ++ Ptr ch = ndLocal->GetChannel(); ++ uint32_t nDevices = ch->GetNDevices(); ++ NS_ASSERT (nDevices); ++ for (uint32_t i = 0; i < nDevices; i++) ++ { ++ Ptr tempNd = ch->GetDevice (i); ++ NS_ASSERT (tempNd); ++ Ptr tempNode = tempNd->GetNode (); ++ uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd); ++ Ptr tempIpv4 = tempNode->QueryInterface (Ipv4::iid); ++ NS_ASSERT (tempIpv4); ++ Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex); ++ pLSA->AddAttachedRouter (tempAddr); ++ } ++ m_LSAs.push_back (pLSA); ++ NS_DEBUG(*pLSA); ++ } ++ } ++ + return m_LSAs.size (); ++} ++ ++ Ipv4Address ++GlobalRouter::FindDesignatedRouterForLink (Ptr node, ++ Ptr ndLocal) const ++{ ++ uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal); ++ Ptr ipv4Local = m_node->QueryInterface (Ipv4::iid); ++ NS_ASSERT (ipv4Local); ++ Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); ++ Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); ++ ++ Ptr ch = ndLocal->GetChannel(); ++ uint32_t nDevices = ch->GetNDevices(); ++ NS_ASSERT (nDevices); ++ Ipv4Address lowest = addrLocal; ++ // iterate all NetDevices and return the lowest numbered IP address ++ for (uint32_t i = 0; i < nDevices; i++) ++ { ++ Ptr tempNd = ch->GetDevice (i); ++ NS_ASSERT (tempNd); ++ Ptr tempNode = tempNd->GetNode (); ++ uint32_t tempIfIndex = FindIfIndexForDevice (tempNode, tempNd); ++ Ptr tempIpv4 = tempNode->QueryInterface (Ipv4::iid); ++ NS_ASSERT (tempIpv4); ++ Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex); ++ if (tempAddr < addrLocal) ++ { ++ addrLocal = tempAddr; ++ } ++ } ++ return addrLocal; + } + + uint32_t +@@ -510,7 +737,7 @@ GlobalRouter::GetNumLSAs (void) const + // Get the nth link state advertisement from this router. + // + bool +-GlobalRouter::GetLSA (uint32_t n, GlobalRouterLSA &lsa) const ++GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const + { + NS_ASSERT_MSG(lsa.IsEmpty(), "GlobalRouter::GetLSA (): Must pass empty LSA"); + // +@@ -525,7 +752,7 @@ GlobalRouter::GetLSA (uint32_t n, Global + { + if (j == n) + { +- GlobalRouterLSA *p = *i; ++ GlobalRoutingLSA *p = *i; + lsa = *p; + return true; + } +diff -r 25fa26a6533e -r 3760d52ef5d1 src/routing/global-routing/global-router-interface.h +--- a/src/routing/global-routing/global-router-interface.h Sun Aug 12 22:41:24 2007 -0700 ++++ b/src/routing/global-routing/global-router-interface.h Sun Aug 12 22:43:25 2007 -0700 +@@ -31,16 +31,16 @@ namespace ns3 { + /** + * @brief A single link record for a link state advertisement. + * +- * The GlobalRouterLinkRecord is modeled after the OSPF link record field of ++ * The GlobalRoutingLinkRecord is modeled after the OSPF link record field of + * a Link State Advertisement. Right now we will only see two types of link + * records corresponding to a stub network and a point-to-point link (channel). + */ +-class GlobalRouterLinkRecord ++class GlobalRoutingLinkRecord + { + public: + /** + * @enum LinkType +- * @brief Enumeration of the possible types of Global Router Link Records. ++ * @brief Enumeration of the possible types of Global Routing Link Records. + * + * These values are defined in the OSPF spec. We currently only use + * PointToPoint and StubNetwork types. +@@ -54,16 +54,16 @@ public: + }; + + /** +- * @brief Construct an empty ("uninitialized") Global Router Link Record. ++ * @brief Construct an empty ("uninitialized") Global Routing Link Record. + * + * The Link ID and Link Data Ipv4 addresses are set to "0.0.0.0"; + * The Link Type is set to Unknown; + * The metric is set to 0. + */ +- GlobalRouterLinkRecord (); +- +-/** +- * Construct an initialized Global Router Link Record. ++ GlobalRoutingLinkRecord (); ++ ++/** ++ * Construct an initialized Global Routing Link Record. + * + * @param linkType The type of link record to construct. + * @param linkId The link ID for the record. +@@ -73,21 +73,21 @@ public: + * @see SetLinkId + * @see SetLinkData + */ +- GlobalRouterLinkRecord ( ++ GlobalRoutingLinkRecord ( + LinkType linkType, + Ipv4Address linkId, + Ipv4Address linkData, + uint32_t metric); + + /** +- * @brief Destroy a Global Router Link Record. ++ * @brief Destroy a Global Routing Link Record. + * + * Currently does nothing. Here as a placeholder only. + */ +- ~GlobalRouterLinkRecord (); +- +-/** +- * Get the Link ID field of the Global Router Link Record. ++ ~GlobalRoutingLinkRecord (); ++ ++/** ++ * Get the Link ID field of the Global Routing Link Record. + * + * For an OSPF type 1 link (PointToPoint) the Link ID will be the Router ID + * of the neighboring router. +@@ -100,7 +100,7 @@ public: + Ipv4Address GetLinkId(void) const; + + /** +- * @brief Set the Link ID field of the Global Router Link Record. ++ * @brief Set the Link ID field of the Global Routing Link Record. + * + * For an OSPF type 1 link (PointToPoint) the Link ID must be the Router ID + * of the neighboring router. +@@ -113,7 +113,7 @@ public: + void SetLinkId(Ipv4Address addr); + + /** +- * @brief Get the Link Data field of the Global Router Link Record. ++ * @brief Get the Link Data field of the Global Routing Link Record. + * + * For an OSPF type 1 link (PointToPoint) the Link Data will be the IP + * address of the node of the local side of the link. +@@ -126,7 +126,7 @@ public: + Ipv4Address GetLinkData(void) const; + + /** +- * @brief Set the Link Data field of the Global Router Link Record. ++ * @brief Set the Link Data field of the Global Routing Link Record. + * + * For an OSPF type 1 link (PointToPoint) the Link Data must be the IP + * address of the node of the local side of the link. +@@ -139,29 +139,29 @@ public: + void SetLinkData(Ipv4Address addr); + + /** +- * @brief Get the Link Type field of the Global Router Link Record. ++ * @brief Get the Link Type field of the Global Routing Link Record. + * + * The Link Type describes the kind of link a given record represents. The + * values are defined by OSPF. + * + * @see LinkType +- * @returns The LinkType of the current Global Router Link Record. ++ * @returns The LinkType of the current Global Routing Link Record. + */ + LinkType GetLinkType(void) const; + + /** +- * @brief Set the Link Type field of the Global Router Link Record. ++ * @brief Set the Link Type field of the Global Routing Link Record. + * + * The Link Type describes the kind of link a given record represents. The + * values are defined by OSPF. + * + * @see LinkType +- * @param linkType The new LinkType for the current Global Router Link Record. ++ * @param linkType The new LinkType for the current Global Routing Link Record. + */ + void SetLinkType(LinkType linkType); + + /** +- * @brief Get the Metric Data field of the Global Router Link Record. ++ * @brief Get the Metric Data field of the Global Routing Link Record. + * + * The metric is an abstract cost associated with forwarding a packet across + * a link. A sum of metrics must have a well-defined meaning. That is, you +@@ -169,12 +169,12 @@ public: + * two hops relate to the cost of sending a packet); rather you should use + * something like delay. + * +- * @returns The metric field of the Global Router Link Record. ++ * @returns The metric field of the Global Routing Link Record. + */ + uint32_t GetMetric(void) const; + + /** +- * @brief Set the Metric Data field of the Global Router Link Record. ++ * @brief Set the Metric Data field of the Global Routing Link Record. + * + * The metric is an abstract cost associated with forwarding a packet across + * a link. A sum of metrics must have a well-defined meaning. That is, you +@@ -182,7 +182,7 @@ public: + * two hops relate to the cost of sending a packet); rather you should use + * something like delay. + * +- * @param metric The new metric for the current Global Router Link Record. ++ * @param metric The new metric for the current Global Routing Link Record. + */ + void SetMetric(uint32_t metric); + +@@ -211,7 +211,7 @@ private: + Ipv4Address m_linkData; // for links to RouterLSA, + + /** +- * The type of the Global Router Link Record. Defined in the OSPF spec. ++ * The type of the Global Routing Link Record. Defined in the OSPF spec. + * We currently only use PointToPoint and StubNetwork types. + */ + LinkType m_linkType; +@@ -236,12 +236,24 @@ private: + * combined with a list of Link Records. Since it's global, there's + * no need for age or sequence number. See RFC 2328, Appendix A. + */ +-class GlobalRouterLSA ++class GlobalRoutingLSA + { + public: + /** ++ * @enum LSType ++ * @brief corresponds to LS type field of RFC 2328 OSPF LSA header ++ */ ++ enum LSType { ++ Unknown = 0, /**< Uninitialized Type */ ++ RouterLSA, ++ NetworkLSA, ++ SummaryLSA, ++ SummaryLSA_ASBR, ++ ASExternalLSAs ++ }; ++/** + * @enum SPFStatus +- * @brief Enumeration of the possible values of the status flag in the Router ++ * @brief Enumeration of the possible values of the status flag in the Routing + * Link State Advertisements. + */ + enum SPFStatus { +@@ -249,17 +261,16 @@ public: + LSA_SPF_CANDIDATE, /**< Vertex is in the SPF candidate queue */ + LSA_SPF_IN_SPFTREE /**< Vertex is in the SPF tree */ + }; +- +-/** +- * @brief Create a blank Global Router Link State Advertisement. ++/** ++ * @brief Create a blank Global Routing Link State Advertisement. + * + * On completion Ipv4Address variables initialized to 0.0.0.0 and the + * list of Link State Records is empty. + */ +- GlobalRouterLSA(); +- +-/** +- * @brief Create an initialized Global Router Link State Advertisement. ++ GlobalRoutingLSA(); ++ ++/** ++ * @brief Create an initialized Global Routing Link State Advertisement. + * + * On completion the list of Link State Records is empty. + * +@@ -267,42 +278,42 @@ public: + * @param linkStateId The Ipv4Address for the link state ID field. + * @param advertisingRtr The Ipv4Address for the advertising router field. + */ +- GlobalRouterLSA(SPFStatus status, Ipv4Address linkStateId, ++ GlobalRoutingLSA(SPFStatus status, Ipv4Address linkStateId, + Ipv4Address advertisingRtr); + + /** +- * @brief Copy constructor for a Global Router Link State Advertisement. ++ * @brief Copy constructor for a Global Routing Link State Advertisement. + * + * Takes a piece of memory and constructs a semantically identical copy of + * the given LSA. + * + * @param lsa The existing LSA to be used as the source. + */ +- GlobalRouterLSA (GlobalRouterLSA& lsa); +- +-/** +- * @brief Destroy an existing Global Router Link State Advertisement. +- * +- * Any Global Router Link Records present in the list are freed. +- */ +- ~GlobalRouterLSA(); +- +-/** +- * @brief Assignment operator for a Global Router Link State Advertisement. +- * +- * Takes an existing Global Router Link State Advertisement and overwrites ++ GlobalRoutingLSA (GlobalRoutingLSA& lsa); ++ ++/** ++ * @brief Destroy an existing Global Routing Link State Advertisement. ++ * ++ * Any Global Routing Link Records present in the list are freed. ++ */ ++ ~GlobalRoutingLSA(); ++ ++/** ++ * @brief Assignment operator for a Global Routing Link State Advertisement. ++ * ++ * Takes an existing Global Routing Link State Advertisement and overwrites + * it to make a semantically identical copy of a given prototype LSA. + * +- * If there are any Global Router Link Records present in the existing ++ * If there are any Global Routing Link Records present in the existing + * LSA, they are freed before the assignment happens. + * + * @param lsa The existing LSA to be used as the source. + * @returns Reference to the overwritten LSA. + */ +- GlobalRouterLSA& operator= (const GlobalRouterLSA& lsa); +- +-/** +- * @brief Copy any Global Router Link Records in a given Global Router Link ++ GlobalRoutingLSA& operator= (const GlobalRoutingLSA& lsa); ++ ++/** ++ * @brief Copy any Global Routing Link Records in a given Global Routing Link + * State Advertisement to the current LSA. + * + * Existing Link Records are not deleted -- this is a concatenation of Link +@@ -311,57 +322,66 @@ public: + * @see ClearLinkRecords () + * @param lsa The LSA to copy the Link Records from. + */ +- void CopyLinkRecords (const GlobalRouterLSA& lsa); +- +-/** +- * @brief Add a given Global Router Link Record to the LSA. +- * +- * @param lr The Global Router Link Record to be added. ++ void CopyLinkRecords (const GlobalRoutingLSA& lsa); ++ ++/** ++ * @brief Add a given Global Routing Link Record to the LSA. ++ * ++ * @param lr The Global Routing Link Record to be added. + * @returns The number of link records in the list. + */ +- uint32_t AddLinkRecord (GlobalRouterLinkRecord* lr); +- +-/** +- * @brief Return the number of Global Router Link Records in the LSA. ++ uint32_t AddLinkRecord (GlobalRoutingLinkRecord* lr); ++ ++/** ++ * @brief Return the number of Global Routing Link Records in the LSA. + * + * @returns The number of link records in the list. + */ + uint32_t GetNLinkRecords (void) const; + + /** +- * @brief Return a pointer to the specified Global Router Link Record. ++ * @brief Return a pointer to the specified Global Routing Link Record. + * + * @param n The LSA number desired. + * @returns The number of link records in the list. + */ +- GlobalRouterLinkRecord* GetLinkRecord (uint32_t n) const; +- +-/** +- * @brief Release all of the Global Router Link Records present in the Global +- * Router Link State Advertisement and make the list of link records empty. ++ GlobalRoutingLinkRecord* GetLinkRecord (uint32_t n) const; ++ ++/** ++ * @brief Release all of the Global Routing Link Records present in the Global ++ * Routing Link State Advertisement and make the list of link records empty. + */ + void ClearLinkRecords(void); + + /** +- * @brief Check to see if the list of Global Router Link Records present in the +- * Global Router Link State Advertisement is empty. ++ * @brief Check to see if the list of Global Routing Link Records present in the ++ * Global Routing Link State Advertisement is empty. + * + * @returns True if the list is empty, false otherwise. + */ + bool IsEmpty(void) const; + + /** +- * @brief Print the contents of the Global Router Link State Advertisement and +- * any Global Router Link Records present in the list. Quite verbose. ++ * @brief Print the contents of the Global Routing Link State Advertisement and ++ * any Global Routing Link Records present in the list. Quite verbose. + */ + void Print (std::ostream &os) const; ++ ++/** ++ * @brief Return the LSType field of the LSA ++ */ ++ LSType GetLSType (void) const; ++/** ++ * @brief Set the LS type field of the LSA ++ */ ++ void SetLSType (LSType typ); + + /** + * @brief Get the Link State ID as defined by the OSPF spec. We always set it + * to the router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + * @returns The Ipv4Address stored as the link state ID. + */ + Ipv4Address GetLinkStateId (void) const; +@@ -371,7 +391,7 @@ public: + * to the router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + */ + void SetLinkStateId (Ipv4Address addr); + +@@ -380,7 +400,7 @@ public: + * set it to the router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + * @returns The Ipv4Address stored as the advetising router. + */ + Ipv4Address GetAdvertisingRouter (void) const; +@@ -390,9 +410,46 @@ public: + * set it to the router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + */ + void SetAdvertisingRouter (Ipv4Address rtr); ++ ++/** ++ * @brief For a Network LSA, set the Network Mask field that precedes ++ * the list of attached routers. ++ */ ++ void SetNetworkLSANetworkMask (Ipv4Mask mask); ++ ++/** ++ * @brief For a Network LSA, get the Network Mask field that precedes ++ * the list of attached routers. ++ * ++ * @returns the NetworkLSANetworkMask ++ */ ++ Ipv4Mask GetNetworkLSANetworkMask (void) const; ++ ++/** ++ * @brief Add an attached router to the list in the NetworkLSA ++ * ++ * @param address The Ipv4Address of the interface on the network link ++ * @returns The number of addresses in the list. ++ */ ++ uint32_t AddAttachedRouter (Ipv4Address addr); ++ ++/** ++ * @brief Return the number of attached routers listed in the NetworkLSA ++ * ++ * @returns The number of attached routers. ++ */ ++ uint32_t GetNAttachedRouters (void) const; ++ ++/** ++ * @brief Return an Ipv4Address corresponding to the specified attached router ++ * ++ * @param n The attached router number desired (number in the list). ++ * @returns The Ipv4Address of the requested router ++ */ ++ Ipv4Address GetAttachedRouter (uint32_t n) const; + + /** + * @brief Get the SPF status of the advertisement. +@@ -411,11 +468,16 @@ public: + + private: + /** ++ * The type of the LSA. Each LSA type has a separate advertisement ++ * format. ++ */ ++ LSType m_lsType; ++/** + * The Link State ID is defined by the OSPF spec. We always set it to the + * router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + */ + Ipv4Address m_linkStateId; + +@@ -424,14 +486,14 @@ private: + * the router ID of the router making the advertisement. + * + * @see RoutingEnvironment::AllocateRouterId () +- * @see GlobalRouter::GetRouterId () ++ * @see GlobalRouting::GetRouterId () + */ + Ipv4Address m_advertisingRtr; + + /** + * A convenience typedef to avoid too much writers cramp. + */ +- typedef std::list ListOfLinkRecords_t; ++ typedef std::list ListOfLinkRecords_t; + + /** + * Each Link State Advertisement contains a number of Link Records that +@@ -441,9 +503,29 @@ private: + * m_linkRecords is an STL list container to hold the Link Records that have + * been discovered and prepared for the advertisement. + * +- * @see GlobalRouter::DiscoverLSAs () ++ * @see GlobalRouting::DiscoverLSAs () + */ + ListOfLinkRecords_t m_linkRecords; ++ ++/** ++ * Each Network LSA contains the network mask of the attached network ++ */ ++ Ipv4Mask m_networkLSANetworkMask; ++ ++/** ++ * A convenience typedef to avoid too much writers cramp. ++ */ ++ typedef std::list ListOfAttachedRouters_t; ++ ++/** ++ * Each Network LSA contains a list of attached routers ++ * ++ * m_attachedRouters is an STL list container to hold the addresses that have ++ * been discovered and prepared for the advertisement. ++ * ++ * @see GlobalRouting::DiscoverLSAs () ++ */ ++ ListOfAttachedRouters_t m_attachedRouters; + + /** + * This is a tristate flag used internally in the SPF computation to mark +@@ -454,7 +536,7 @@ private: + SPFStatus m_status; + }; + +-std::ostream& operator<< (std::ostream& os, GlobalRouterLSA& lsa); ++std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa); + + /** + * @brief An interface aggregated to a node to provide global routing info +@@ -496,7 +578,7 @@ public: + + /** + * @brief Walk the connected channels, discover the adjacent routers and build +- * the associated number of Global Router Link State Advertisements that ++ * the associated number of Global Routing Link State Advertisements that + * this router can export. + * + * This is a fairly expensive operation in that every time it is called +@@ -507,14 +589,14 @@ public: + * advertisements after a network topology change by calling DiscoverLSAs + * and then by reading those advertisements. + * +- * @see GlobalRouterLSA ++ * @see GlobalRoutingLSA + * @see GlobalRouter::GetLSA () +- * @returns The number of Global Router Link State Advertisements. ++ * @returns The number of Global Routing Link State Advertisements. + */ + uint32_t DiscoverLSAs (void); + + /** +- * @brief Get the Number of Global Router Link State Advertisements that this ++ * @brief Get the Number of Global Routing Link State Advertisements that this + * router can export. + * + * To get meaningful information you must have previously called DiscoverLSAs. +@@ -522,19 +604,19 @@ public: + * GetLSA () to retrieve the actual advertisement. + * + * @see GlobalRouterLSA +- * @see GlobalRouter::DiscoverLSAs () +- * @see GlobalRouter::GetLSA () +- * @returns The number of Global Router Link State Advertisements. ++ * @see GlobalRouting::DiscoverLSAs () ++ * @see GlobalRouting::GetLSA () ++ * @returns The number of Global Routing Link State Advertisements. + */ + uint32_t GetNumLSAs (void) const; + + /** +- * @brief Get a Global Router Link State Advertisements that this router has ++ * @brief Get a Global Routing Link State Advertisements that this router has + * said that it can export. + * + * This is a fairly inexpensive expensive operation in that the hard work +- * was done in GetNumLSAs. We just copy the indicated Global Router Link +- * State Advertisement into the requested GlobalRouterLSA object. ++ * was done in GetNumLSAs. We just copy the indicated Global Routing Link ++ * State Advertisement into the requested GlobalRoutingLSA object. + * + * You must call GlobalRouter::GetNumLSAs before calling this method in + * order to discover the adjacent routers and build the advertisements. +@@ -542,13 +624,13 @@ public: + * The parameter n (requested LSA number) must be in the range 0 to + * GetNumLSAs() - 1. + * +- * @see GlobalRouterLSA +- * @see GlobalRouter::GetNumLSAs () ++ * @see GlobalRoutingLSA ++ * @see GlobalRouting::GetNumLSAs () + * @param n The index number of the LSA you want to read. +- * @param lsa The GlobalRouterLSA class to receive the LSA information. ++ * @param lsa The GlobalRoutingLSA class to receive the LSA information. + * @returns The number of Global Router Link State Advertisements. + */ +- bool GetLSA (uint32_t n, GlobalRouterLSA &lsa) const; ++ bool GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const; + + private: + virtual ~GlobalRouter (); +@@ -556,10 +638,12 @@ private: + + Ptr GetAdjacent(Ptr nd, Ptr ch) const; + uint32_t FindIfIndexForDevice(Ptr node, Ptr nd) const; ++ Ipv4Address FindDesignatedRouterForLink (Ptr node, ++ Ptr ndLocal) const; + + Ptr m_node; + +- typedef std::list ListOfLSAs_t; ++ typedef std::list ListOfLSAs_t; + ListOfLSAs_t m_LSAs; + + Ipv4Address m_routerId; + +changeset: 1284:3aef7d7a71c2 +user: Craig Dowell +date: Mon Aug 13 12:08:01 2007 -0700 +summary: more multicast plumbing + +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -65,7 +65,7 @@ main (int argc, char *argv[]) + { + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this +-#if 0 ++#if 0 + DebugComponentEnable("Me"); + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); +@@ -87,16 +87,9 @@ main (int argc, char *argv[]) + #endif + + DebugComponentEnable("Me"); +- DebugComponentEnable("OnOffApplication"); +- DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("UdpL4Protocol"); +- DebugComponentEnable("Ipv4L3Protocol"); +- DebugComponentEnable("Ipv4StaticRouting"); +- DebugComponentEnable("CsmaNetDevice"); +- DebugComponentEnable("CsmaChannel"); +- DebugComponentEnable("Ipv4Interface"); +- DebugComponentEnable("ArpIpv4Interface"); +- DebugComponentEnable("Ipv4LoopbackInterface"); + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, +@@ -125,29 +118,47 @@ main (int argc, char *argv[]) + DataRate(5000000), MilliSeconds(2)); + + NS_DEBUG("Build Topology."); +- uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, +- Eui48Address("10:54:23:54:23:50")); +- uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, +- Eui48Address("10:54:23:54:23:51")); +- uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, +- Eui48Address("10:54:23:54:23:52")); +- uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, +- Eui48Address("10:54:23:54:23:53")); ++ uint32_t netDeviceNumberNode0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, ++ channel0, Eui48Address("10:54:23:54:23:50")); ++ uint32_t netDeviceNumberNode1 = CsmaIpv4Topology::AddIpv4CsmaNode (n1, ++ channel0, Eui48Address("10:54:23:54:23:51")); ++ uint32_t netDeviceNumberNode2 = CsmaIpv4Topology::AddIpv4CsmaNode (n2, ++ channel0, Eui48Address("10:54:23:54:23:52")); ++ uint32_t netDeviceNumberNode3 = CsmaIpv4Topology::AddIpv4CsmaNode (n3, ++ channel0, Eui48Address("10:54:23:54:23:53")); ++ ++ NS_DEBUG ("netDeviceNumberNode0 = " << netDeviceNumberNode0); ++ NS_DEBUG ("netDeviceNumberNode1 = " << netDeviceNumberNode1); ++ NS_DEBUG ("netDeviceNumberNode2 = " << netDeviceNumberNode2); ++ NS_DEBUG ("netDeviceNumberNode3 = " << netDeviceNumberNode3); + + // Later, we add IP addresses. + NS_DEBUG("Assign IP Addresses."); +- +- CsmaIpv4Topology::AddIpv4Address ( +- n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); +- +- CsmaIpv4Topology::AddIpv4Address ( +- n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); +- +- CsmaIpv4Topology::AddIpv4Address ( +- n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); ++ // XXX BUGBUG ++ // Need a better way to get the interface index. The point-to-point topology ++ // as implemented can't return the index since it creates interfaces on both ++ // sides (i.e., AddIpv4Addresses, not AddIpv4Address). Need a method on ++ // Ipv4 to find the interface index corresponding to a given ipv4 address. ++ uint32_t ifIndexNode0 = CsmaIpv4Topology::AddIpv4Address (n0, ++ netDeviceNumberNode0, Ipv4Address ("10.1.1.1"), ++ Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNode1 = CsmaIpv4Topology::AddIpv4Address (n1, ++ netDeviceNumberNode1, Ipv4Address ("10.1.1.2"), ++ Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNode2 = CsmaIpv4Topology::AddIpv4Address (n2, ++ netDeviceNumberNode2, Ipv4Address ("10.1.1.3"), ++ Ipv4Mask ("255.255.255.0")); + +- CsmaIpv4Topology::AddIpv4Address ( +- n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); ++ uint32_t ifIndexNode3 = CsmaIpv4Topology::AddIpv4Address (n3, ++ netDeviceNumberNode3, Ipv4Address ("10.1.1.4"), ++ Ipv4Mask ("255.255.255.0")); ++ ++ NS_DEBUG ("ifIndexNode0 = " << ifIndexNode0); ++ NS_DEBUG ("ifIndexNode1 = " << ifIndexNode1); ++ NS_DEBUG ("ifIndexNode2 = " << ifIndexNode2); ++ NS_DEBUG ("ifIndexNode3 = " << ifIndexNode3); + + // Configure multicasting + NS_DEBUG("Configure multicasting."); +@@ -158,22 +169,21 @@ main (int argc, char *argv[]) + ipv4 = n0->QueryInterface (Ipv4::iid); + + std::vector outputInterfaces (1); +- outputInterfaces[0] = n0ifIndex; ++ outputInterfaces[0] = ifIndexNode0; + + ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, + outputInterfaces); + + ipv4 = n1->QueryInterface (Ipv4::iid); +- ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + + ipv4 = n2->QueryInterface (Ipv4::iid); +- ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); + + ipv4 = n3->QueryInterface (Ipv4::iid); +- ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +- +- // Create the OnOff application to send UDP datagrams of size +- // 210 bytes at a rate of 448 Kb/s ++ // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++ ++ // Create the OnOff application to send UDP datagrams + // from n0 to the multicast group + NS_DEBUG("Create Applications."); + Ptr ooff = Create ( +@@ -181,10 +191,12 @@ main (int argc, char *argv[]) + InetSocketAddress (multicastGroup, 80), + "Udp", + ConstantVariable(1), +- ConstantVariable(0)); ++ ConstantVariable(0), ++ DataRate ("128b/s"), ++ 128); + // Start the application +- ooff->Start(Seconds(1.0)); +- ooff->Stop (Seconds(10.0)); ++ ooff->Start(Seconds(1.)); ++ ooff->Stop (Seconds(10.)); + + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-one-subnet.tr file +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/applications/onoff-application.cc +--- a/src/applications/onoff-application.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/applications/onoff-application.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -199,9 +199,12 @@ void OnOffApplication::ScheduleNextTx() + if (m_totBytes < m_maxBytes) + { + uint32_t bits = m_pktSize * 8 - m_residualBits; ++ NS_DEBUG("OnOffApplication::ScheduleNextTx (): bits = " << bits); + Time nextTime(Seconds (bits / + static_cast(m_cbrRate.GetBitRate()))); // Time till next packet +- m_sendEvent = Simulator::Schedule(nextTime, &OnOffApplication::SendPacket, this); ++ NS_DEBUG("OnOffApplication::ScheduleNextTx (): nextTime = " << nextTime); ++ m_sendEvent = Simulator::Schedule(nextTime, ++ &OnOffApplication::SendPacket, this); + } + else + { // All done, cancel any pending events +@@ -214,6 +217,8 @@ void OnOffApplication::ScheduleStartEven + NS_DEBUG("OnOffApplication::ScheduleStartEvent ()"); + + Time offInterval = Seconds(m_offTime->GetValue()); ++ NS_DEBUG("OnOffApplication::ScheduleStartEvent (): " ++ "start at " << offInterval); + m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); + } + +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/devices/csma/csma-ipv4-topology.cc +--- a/src/devices/csma/csma-ipv4-topology.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/devices/csma/csma-ipv4-topology.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -91,24 +91,22 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr + nd1->Attach (ch); + } + +-void +-CsmaIpv4Topology::AddIpv4Address(Ptr n1, +- int ndNum, +- const Ipv4Address& addr1, +- const Ipv4Mask& netmask1) ++uint32_t ++CsmaIpv4Topology::AddIpv4Address( ++ Ptr node, ++ uint32_t netDeviceNumber, ++ const Ipv4Address address, ++ const Ipv4Mask mask) + { +- // Duplex link is assumed to be subnetted as a /30 +- // May run this unnumbered in the future? +- Ipv4Mask netmask(netmask1); ++ Ptr nd = node->GetDevice(netDeviceNumber); + +- Ptr nd1 = n1->GetDevice(ndNum); ++ Ptr ipv4 = node->QueryInterface (Ipv4::iid); ++ uint32_t ifIndex = ipv4->AddInterface (nd); + +- Ptr ip1 = n1->QueryInterface (Ipv4::iid); +- uint32_t index1 = ip1->AddInterface (nd1); +- +- ip1->SetAddress (index1, addr1); +- ip1->SetNetworkMask (index1, netmask); +- ip1->SetUp (index1); ++ ipv4->SetAddress (ifIndex, address); ++ ipv4->SetNetworkMask (ifIndex, mask); ++ ipv4->SetUp (ifIndex); ++ return ifIndex; + } + + void +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/devices/csma/csma-ipv4-topology.h +--- a/src/devices/csma/csma-ipv4-topology.h Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/devices/csma/csma-ipv4-topology.h Mon Aug 13 12:08:01 2007 -0700 +@@ -94,18 +94,23 @@ public: + + + /** +- * \param n1 Node +- * \param ndNum NetDevice number with which to associate address +- * \param addr1 Ipv4 Address for ndNum of n1 +- * \param network network mask for ndNum of node n1 ++ * \brief Create an Ipv4 interface for a net device and assign an ++ * Ipv4Address to that interface. ++ * ++ * \param node The node to which to add the new address and corresponding ++ * interface. ++ * \param netDeviceNumber The NetDevice index number with which to associate ++ * the address. ++ * \param address The Ipv4 Address for the interface. ++ * \param network The network mask for the interface + * + * Add an Ipv4Address to the Ipv4 interface associated with the +- * ndNum CsmaIpv4NetDevices on the provided +- * CsmaIpv4Channel ++ * ndNum CsmaIpv4NetDevices on the provided CsmaIpv4Channel + */ +- static void AddIpv4Address(Ptr n1, int ndNum, +- const Ipv4Address& addr1, +- const Ipv4Mask& netmask1); ++ static uint32_t AddIpv4Address(Ptr node, ++ uint32_t netDeviceNumber, ++ const Ipv4Address address, ++ const Ipv4Mask mask); + + /** + * \param nd1 Node +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/internet-node/arp-ipv4-interface.cc +--- a/src/internet-node/arp-ipv4-interface.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -81,6 +81,14 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4 + hardwareDestination = GetDevice ()->GetBroadcast (); + found = true; + } ++ else if (dest.IsMulticast ()) ++ { ++ NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast"); ++ // XXX BUGBUG ++ // Need real multicast addresses ++ hardwareDestination = GetDevice ()->GetBroadcast (); ++ found = true; ++ } + else + { + NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup"); +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -246,12 +246,26 @@ Ipv4L3Protocol::SetDefaultRoute (Ipv4Add + } + + void +-Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, +- Packet packet, +- Ipv4RoutingProtocol::RouteReplyCallback routeReply) +-{ +- NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << ", " << &packet << +- &routeReply << ")"); ++Ipv4L3Protocol::Lookup ( ++ Ipv4Header const &ipHeader, ++ Packet packet, ++ Ipv4RoutingProtocol::RouteReplyCallback routeReply) ++{ ++ NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << ++ ", " << &packet << &routeReply << ")"); ++ ++ Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply); ++} ++ ++void ++Ipv4L3Protocol::Lookup ( ++ uint32_t ifIndex, ++ Ipv4Header const &ipHeader, ++ Packet packet, ++ Ipv4RoutingProtocol::RouteReplyCallback routeReply) ++{ ++ NS_DEBUG("Ipv4L3Protocol::Lookup (" << ifIndex << ", " << &ipHeader << ++ ", " << &packet << &routeReply << ")"); + + for (Ipv4RoutingProtocolList::const_iterator rprotoIter = + m_routingProtocols.begin (); +@@ -259,7 +273,8 @@ Ipv4L3Protocol::Lookup (Ipv4Header const + rprotoIter++) + { + NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting route"); +- if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) ++ if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet, ++ routeReply)) + return; + } + +@@ -405,7 +420,9 @@ Ipv4L3Protocol::Receive( Ptr + protocol << ", " << from << ")"); + + uint32_t index = 0; +- for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) ++ for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); ++ i != m_interfaces.end (); ++ i++) + { + if ((*i)->GetDevice () == device) + { +@@ -423,7 +440,7 @@ Ipv4L3Protocol::Receive( Ptr + return; + } + +- if (Forwarding (packet, ipHeader, device)) ++ if (Forwarding (index, packet, ipHeader, device)) + { + return; + } +@@ -521,10 +538,14 @@ Ipv4L3Protocol::SendRealOut (bool found, + } + + bool +-Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) +-{ +- NS_DEBUG("Ipv4L3Protocol::Forwarding (" << &packet << ", " << &ipHeader << +- ", " << device << ")"); ++Ipv4L3Protocol::Forwarding ( ++ uint32_t ifIndex, ++ Packet const &packet, ++ Ipv4Header &ipHeader, ++ Ptr device) ++{ ++ NS_DEBUG("Ipv4L3Protocol::Forwarding (" << ifIndex << ", " << &packet << ++ ", " << &ipHeader << ", " << device << ")"); + + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); i++) +@@ -579,7 +600,7 @@ Ipv4L3Protocol::Forwarding (Packet const + ipHeader.SetTtl (ipHeader.GetTtl () - 1); + + NS_DEBUG("Ipv4L3Protocol::Forwarding (): Forwarding packet."); +- Lookup (ipHeader, packet, ++ Lookup (ifIndex, ipHeader, packet, + MakeCallback (&Ipv4L3Protocol::SendRealOut, this)); + // + // If this is a to a multicast address and this node is a member of the +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Mon Aug 13 12:08:01 2007 -0700 +@@ -195,12 +195,19 @@ protected: + virtual void DoDispose (void); + + private: ++ void Lookup (uint32_t ifIndex, ++ Ipv4Header const &ipHeader, ++ Packet packet, ++ Ipv4RoutingProtocol::RouteReplyCallback routeReply); + + void SendRealOut (bool found, + Ipv4Route const &route, + Packet packet, + Ipv4Header const &ipHeader); +- bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); ++ bool Forwarding (uint32_t ifIndex, ++ Packet const &packet, ++ Ipv4Header &ipHeader, ++ Ptr device); + void ForwardUp (Packet p, Ipv4Header const&ip); + uint32_t AddIpv4Interface (Ipv4Interface *interface); + void SetupLoopback (void); +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -196,7 +196,8 @@ Ipv4MulticastRoute * + Ipv4MulticastRoute * + Ipv4StaticRouting::LookupStatic ( + Ipv4Address origin, +- Ipv4Address group) ++ Ipv4Address group, ++ uint32_t ifIndex) + { + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); +@@ -207,7 +208,11 @@ Ipv4StaticRouting::LookupStatic ( + origin == Ipv4Address::GetAny ()) && + group == route->GetGroup ()) + { +- return *i; ++ if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || ++ ifIndex == route->GetInputInterface ()) ++ { ++ return *i; ++ } + } + } + return 0; +@@ -312,9 +317,11 @@ Ipv4StaticRouting::RemoveRoute (uint32_t + } + + bool +-Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, +- Packet packet, +- RouteReplyCallback routeReply) ++Ipv4StaticRouting::RequestRoute ( ++ uint32_t ifIndex, ++ Ipv4Header const &ipHeader, ++ Packet packet, ++ RouteReplyCallback routeReply) + { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << + &packet << ", " << &routeReply << ")"); +@@ -328,27 +335,35 @@ Ipv4StaticRouting::RequestRoute (Ipv4Hea + // First, see if this is a multicast packet we have a route for. If we + // have a route, then send the packet down each of the specified interfaces. + // +- Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), +- ipHeader.GetDestination ()); +- if (mRoute) +- { +- NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast route"); +- for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) +- { +- Packet p = packet; +- Ipv4Route route = +- Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), +- mRoute->GetOutputInterface(i)); ++ if (ipHeader.GetDestination ().IsMulticast ()) ++ { ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); ++ ++ Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), ++ ipHeader.GetDestination (), ifIndex); ++ ++ if (mRoute) ++ { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " +- "Send via interface " << mRoute->GetOutputInterface(i)); +- routeReply (true, route, p, ipHeader); +- return true; +- } ++ "Multicast route found"); ++ for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) ++ { ++ Packet p = packet; ++ Ipv4Route route = ++ Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), ++ mRoute->GetOutputInterface(i)); ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " ++ "Send via interface " << mRoute->GetOutputInterface(i)); ++ routeReply (true, route, p, ipHeader); ++ return true; ++ } ++ } ++ return false; // Let other routing protocols try to handle this + } + // + // See if this is a unicast packet we have a route for. + // +- NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast route"); ++ NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); + Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); + if (route != 0) + { +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Mon Aug 13 12:08:01 2007 -0700 +@@ -51,7 +51,8 @@ public: + public: + Ipv4StaticRouting () : m_defaultRoute (0) {} + +- virtual bool RequestRoute (Ipv4Header const &ipHeader, ++ virtual bool RequestRoute (uint32_t ifIndex, ++ Ipv4Header const &ipHeader, + Packet packet, + RouteReplyCallback routeReply); + +@@ -105,7 +106,8 @@ private: + typedef std::list::iterator MulticastRoutesI; + + Ipv4Route *LookupStatic (Ipv4Address dest); +- Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group); ++ Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group, ++ uint32_t ifIndex); + + HostRoutes m_hostRoutes; + NetworkRoutes m_networkRoutes; +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/node/ipv4-address.cc +--- a/src/node/ipv4-address.cc Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/node/ipv4-address.cc Mon Aug 13 12:08:01 2007 -0700 +@@ -171,8 +171,11 @@ bool + bool + Ipv4Address::IsMulticast (void) const + { +- // XXX +- return false; ++// ++// Multicast addresses are defined as ranging from 224.0.0.0 through ++// 239.255.255.255 (which is E0000000 through EFFFFFFF in hex). ++// ++ return (m_address >= 0xe0000000 && m_address <= 0xefffffff); + } + + uint32_t +diff -r 3760d52ef5d1 -r 3aef7d7a71c2 src/node/ipv4.h +--- a/src/node/ipv4.h Sun Aug 12 22:43:25 2007 -0700 ++++ b/src/node/ipv4.h Mon Aug 13 12:08:01 2007 -0700 +@@ -70,6 +70,7 @@ public: + /** + * \brief Asynchronously requests a route for a given packet and IP header + * ++ * \param ifIndex The interface index on which the packet was received. + * \param ipHeader IP header of the packet + * \param packet packet that is being sent or forwarded + * \param routeReply callback that will receive the route reply +@@ -99,9 +100,12 @@ public: + * immediately after the IP header, although most routing do not + * insert any extra header. + */ +- virtual bool RequestRoute (const Ipv4Header &ipHeader, ++ virtual bool RequestRoute (uint32_t ifIndex, ++ const Ipv4Header &ipHeader, + Packet packet, + RouteReplyCallback routeReply) = 0; ++ ++ static const uint32_t IF_INDEX_ANY = 0xffffffff; + }; + + /** + +changeset: 1285:a6fb891b59fd +user: Craig Dowell +date: Mon Aug 13 14:58:06 2007 -0700 +summary: cleanup. more complex multicast example + +diff -r 3aef7d7a71c2 -r a6fb891b59fd examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Mon Aug 13 12:08:01 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 14:58:06 2007 -0700 +@@ -16,31 +16,27 @@ + + // Network topology + // +-// n0 n1 n2 n3 +-// | | | | +-// ===================== +-// +-// - CBR/UDP flows from n0 to n1, and from n3 to n0 +-// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. +-// (i.e., DataRate of 448,000 bps) +-// - DropTail queues +-// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" +- +-#include +-#include +-#include +-#include ++// Lan1 ++// =========== ++// | | | ++// n0 n1 n2 n3 n4 ++// | | | ++// =========== ++// Lan0 ++// ++// - Multicast source is at node n0; ++// - Multicast forwarded by node n2 onto LAN1; ++// - Nodes n0, n1, n2, n3, and n4 receive the multicast frame. ++// - Node n4 listens for the data (actual listener not yet implementted) + + #include "ns3/command-line.h" + #include "ns3/default-value.h" + #include "ns3/ptr.h" + #include "ns3/random-variable.h" + #include "ns3/debug.h" +- + #include "ns3/simulator.h" + #include "ns3/nstime.h" + #include "ns3/data-rate.h" +- + #include "ns3/ascii-trace.h" + #include "ns3/pcap-trace.h" + #include "ns3/internet-node.h" +@@ -58,15 +54,18 @@ + + using namespace ns3; + +-NS_DEBUG_COMPONENT_DEFINE ("Me"); ++NS_DEBUG_COMPONENT_DEFINE ("CsmaMulticast"); + + int + main (int argc, char *argv[]) + { +- // Users may find it convenient to turn on explicit debugging +- // for selected modules; the below lines suggest how to do this ++// ++// Users may find it convenient to turn on explicit debugging ++// for selected modules; the below lines suggest how to do this ++// + #if 0 +- DebugComponentEnable("Me"); ++ DebugComponentEnable("CsmaMulticast"); ++ + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); +@@ -86,105 +85,182 @@ main (int argc, char *argv[]) + DebugComponentEnable("Ipv4LoopbackInterface"); + #endif + +- DebugComponentEnable("Me"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); ++ ++ DebugComponentEnable("CsmaMulticast"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("CsmaNetDevice"); +- DebugComponentEnable("UdpL4Protocol"); +- +- // Set up some default values for the simulation. Use the Bind() +- // technique to tell the system what subclass of Queue to use, +- // and what the queue limit is +- +- // The below Bind command tells the queue factory which class to +- // instantiate, when the queue factory is invoked in the topology code ++// ++// Set up default values for the simulation. Use the DefaultValue::Bind() ++// technique to tell the system what subclass of Queue to use. The Bind ++// command command tells the queue factory which class to instantiate when the ++// queue factory is invoked in the topology code ++// + DefaultValue::Bind ("Queue", "DropTailQueue"); +- +- // Allow the user to override any of the defaults and the above +- // Bind()s at run-time, via command-line arguments ++// ++// Allow the user to override any of the defaults and the above Bind() at ++// run-time, via command-line arguments ++// + CommandLine::Parse (argc, argv); +- +- // Here, we will explicitly create four nodes. In more sophisticated +- // topologies, we could configure a node factory. ++// ++// Explicitly create the nodes required by the topology (shown above). ++// + NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); ++ Ptr n4 = Create (); + + NS_DEBUG("Create channels."); +- // We create the channels first without any IP addressing information +- Ptr channel0 = ++// ++// Explicitly create the channels required by the topology (shown above). ++// ++ Ptr lan0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + ++ Ptr lan1 = ++ CsmaTopology::CreateCsmaChannel( ++ DataRate(5000000), MilliSeconds(2)); ++ + NS_DEBUG("Build Topology."); +- uint32_t netDeviceNumberNode0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, +- channel0, Eui48Address("10:54:23:54:23:50")); +- uint32_t netDeviceNumberNode1 = CsmaIpv4Topology::AddIpv4CsmaNode (n1, +- channel0, Eui48Address("10:54:23:54:23:51")); +- uint32_t netDeviceNumberNode2 = CsmaIpv4Topology::AddIpv4CsmaNode (n2, +- channel0, Eui48Address("10:54:23:54:23:52")); +- uint32_t netDeviceNumberNode3 = CsmaIpv4Topology::AddIpv4CsmaNode (n3, +- channel0, Eui48Address("10:54:23:54:23:53")); +- +- NS_DEBUG ("netDeviceNumberNode0 = " << netDeviceNumberNode0); +- NS_DEBUG ("netDeviceNumberNode1 = " << netDeviceNumberNode1); +- NS_DEBUG ("netDeviceNumberNode2 = " << netDeviceNumberNode2); +- NS_DEBUG ("netDeviceNumberNode3 = " << netDeviceNumberNode3); +- +- // Later, we add IP addresses. ++// ++// Now fill out the topology by creating the net devices required to connect ++// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will ++// create a net device, add a MAC address (in memory of the pink flamingo) and ++// connect the net device to a nodes and also to a channel. the ++// AddIpv4CsmaNetDevice method returns a net device index for the net device ++// created on the node. Interpret nd0 as the net device we created for node ++// zero. Interpret nd2Lan0 as the net device we created for node two to ++// connect to Lan0. ++// ++ uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan0, ++ Eui48Address("08:00:2e:00:00:00")); ++ uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan0, ++ Eui48Address("08:00:2e:00:00:01")); ++ uint32_t nd2Lan0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan0, ++ Eui48Address("08:00:2e:00:00:02")); ++ ++ uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, ++ Eui48Address("08:00:2e:00:00:00")); ++ uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, ++ Eui48Address("08:00:2e:00:00:01")); ++ uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, ++ Eui48Address("08:00:2e:00:00:02")); ++ ++ NS_DEBUG ("nd0 = " << nd0); ++ NS_DEBUG ("nd1 = " << nd1); ++ NS_DEBUG ("nd2Lan0 = " << nd2Lan0); ++ NS_DEBUG ("nd2Lan1 = " << nd2Lan1); ++ NS_DEBUG ("nd3 = " << nd3); ++ NS_DEBUG ("nd4 = " << nd3); ++// ++// We've got the "hardware" in place. Now we need to add IP addresses. ++// + NS_DEBUG("Assign IP Addresses."); +- // XXX BUGBUG +- // Need a better way to get the interface index. The point-to-point topology +- // as implemented can't return the index since it creates interfaces on both +- // sides (i.e., AddIpv4Addresses, not AddIpv4Address). Need a method on +- // Ipv4 to find the interface index corresponding to a given ipv4 address. +- uint32_t ifIndexNode0 = CsmaIpv4Topology::AddIpv4Address (n0, +- netDeviceNumberNode0, Ipv4Address ("10.1.1.1"), +- Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNode1 = CsmaIpv4Topology::AddIpv4Address (n1, +- netDeviceNumberNode1, Ipv4Address ("10.1.1.2"), +- Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNode2 = CsmaIpv4Topology::AddIpv4Address (n2, +- netDeviceNumberNode2, Ipv4Address ("10.1.1.3"), +- Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNode3 = CsmaIpv4Topology::AddIpv4Address (n3, +- netDeviceNumberNode3, Ipv4Address ("10.1.1.4"), +- Ipv4Mask ("255.255.255.0")); +- +- NS_DEBUG ("ifIndexNode0 = " << ifIndexNode0); +- NS_DEBUG ("ifIndexNode1 = " << ifIndexNode1); +- NS_DEBUG ("ifIndexNode2 = " << ifIndexNode2); +- NS_DEBUG ("ifIndexNode3 = " << ifIndexNode3); +- +- // Configure multicasting ++// ++// XXX BUGBUG ++// Need a better way to get the interface index. The point-to-point topology ++// as implemented can't return the index since it creates interfaces on both ++// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a ++// method on Ipv4 to find the interface index corresponding to a given ipv4 ++// address. ++// ++// First, assign IP addresses to the net devices and associated interfaces ++// on Lan0. The AddIpv4Address method returns an Ipv4 interface index. ++// Interpret ifIndexNd0 as the interface index to use to reference the ++// net device we created on node zero when coming in from the Ipv4 interface. ++// Net device numbers and interface indices are distinct. Interpret ++// ifIndexNd2Lan0 as the interface index to use to reference the ++// net device we created that connects node two to lan zero. ++// ++ uint32_t ifIndexNd0 = CsmaIpv4Topology::AddIpv4Address (n0, nd0, ++ Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNd1 = CsmaIpv4Topology::AddIpv4Address (n1, nd1, ++ Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNd2Lan0 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, ++ Ipv4Address ("10.1.1.3"), Ipv4Mask ("255.255.255.0")); ++// ++// Assign IP addresses to the net devices and associated interfaces on Lan1 ++// ++ uint32_t ifIndexNd2Lan1 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, ++ Ipv4Address ("10.1.2.1"), Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNd3 = CsmaIpv4Topology::AddIpv4Address (n3, nd1, ++ Ipv4Address ("10.1.2.2"), Ipv4Mask ("255.255.255.0")); ++ ++ uint32_t ifIndexNd4 = CsmaIpv4Topology::AddIpv4Address (n4, nd4, ++ Ipv4Address ("10.1.2.3"), Ipv4Mask ("255.255.255.0")); ++ ++ NS_DEBUG ("ifIndexNd0 = " << ifIndexNd0); ++ NS_DEBUG ("ifIndexNd1 = " << ifIndexNd1); ++ NS_DEBUG ("ifIndexNd2Lan0 = " << ifIndexNd2Lan0); ++ NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); ++ NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); ++ NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); + NS_DEBUG("Configure multicasting."); ++// ++// Now we can configure multicasting. As described above, the multicast ++// source is at node zero, which we assigned the IP address of 10.1.1.1 ++// earlier. We need to define a multicast group to send packets to. This ++// can be any multicast address from 224.0.0.0 through 239.255.255.255 ++// (avoiding the reserved routing protocol addresses). We just pick a ++// convenient number. ++// + Ipv4Address multicastSource ("10.1.1.1"); + Ipv4Address multicastGroup ("225.0.0.0"); +- ++// ++// We are going to manually configure multicast routing. This means telling ++// node two that it should expect multicast data coming from IP address ++// 10.1.1.1 over its IP interface connected to Lan0. These are called ++// multicastSource and ifIndexNd2Lan0 respectively. When node two receives ++// these packets, they should be forwarded out the interface that connects it ++// to Lan1 which is called ifIndexNd2Lan1. All we need to do is to call the ++// AddMulticastRoute method on node two's Ipv4 interface and provide this ++// information. (Note: the vector of output interfaces is in case there are ++// multiple net devices on a node). ++// + Ptr ipv4; ++ ipv4 = n2->QueryInterface (Ipv4::iid); ++ ++ std::vector outputInterfaces (1); ++ outputInterfaces[0] = ifIndexNd2Lan1; ++ ++ ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexNd2Lan0, ++ outputInterfaces); ++// ++// We also need to explain to the node zero forwarding code that when it sees ++// a packet destined for the multicast group it needs to send it out its ++// one and only interface. The 0xffffffff in the call means that the input ++// interface qualification is not applicable in this case (the packet has ++// not been received over an interface, it has been created locally). ++// + ipv4 = n0->QueryInterface (Ipv4::iid); + +- std::vector outputInterfaces (1); +- outputInterfaces[0] = ifIndexNode0; +- +- ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0, ++ outputInterfaces[0] = ifIndexNd0;; ++ ++ ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0xffffffff, + outputInterfaces); +- +- ipv4 = n1->QueryInterface (Ipv4::iid); +- // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +- +- ipv4 = n2->QueryInterface (Ipv4::iid); +- // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +- +- ipv4 = n3->QueryInterface (Ipv4::iid); +- // ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +- +- // Create the OnOff application to send UDP datagrams +- // from n0 to the multicast group ++// ++// As described above, node four will be the only node listening for the ++// multicast data. To enable forwarding bits up the protocol stack, we need ++// to tell the stack to join the multicast group. ++// ++ ipv4 = n4->QueryInterface (Ipv4::iid); ++ ipv4->JoinMulticastGroup (multicastSource, multicastGroup); ++// ++// Create an OnOff application to send UDP datagrams from node zero to the ++// multicast group (node four will be listening). ++// + NS_DEBUG("Create Applications."); + Ptr ooff = Create ( + n0, +@@ -192,27 +268,33 @@ main (int argc, char *argv[]) + "Udp", + ConstantVariable(1), + ConstantVariable(0), +- DataRate ("128b/s"), ++ DataRate ("255b/s"), + 128); +- // Start the application ++// ++// Tell the application when to start and stop. ++// + ooff->Start(Seconds(1.)); + ooff->Stop (Seconds(10.)); +- +- // Configure tracing of all enqueue, dequeue, and NetDevice receive events +- // Trace output will be sent to the csma-one-subnet.tr file ++// ++// Configure tracing of all enqueue, dequeue, and NetDevice receive events. ++// Trace output will be sent to the file "csma-multicast.tr" ++// + NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("csma-multicast.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +- +- // Also configure some tcpdump traces; each interface will be traced +- // The output files will be named +- // simple-point-to-point.pcap-- +- // and can be read by the "tcpdump -r" command (use "-tt" option to +- // display timestamps correctly) ++// ++// Also configure some tcpdump traces; each interface will be traced. ++// The output files will be named: ++// csma-multicast.pcap-- ++// and can be read by the "tcpdump -r" command (use "-tt" option to ++// display timestamps correctly) ++// + PcapTrace pcaptrace ("csma-multicast.pcap"); + pcaptrace.TraceAllIp (); +- ++// ++// Now, do the actual simulation. ++// + NS_DEBUG("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); +diff -r 3aef7d7a71c2 -r a6fb891b59fd examples/csma-one-subnet.cc +--- a/examples/csma-one-subnet.cc Mon Aug 13 12:08:01 2007 -0700 ++++ b/examples/csma-one-subnet.cc Mon Aug 13 14:58:06 2007 -0700 +@@ -14,35 +14,25 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-// Port of ns-2/tcl/ex/simple.tcl to ns-3 +-// + // Network topology + // + // n0 n1 n2 n3 + // | | | | +-// ===================== +-// +-// - CBR/UDP flows from n0 to n1, and from n3 to n0 +-// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. +-// (i.e., DataRate of 448,000 bps) ++// ================= ++// LAN ++// ++// - CBR/UDP flows from n0 to n1 and from n3 to n0 + // - DropTail queues + // - Tracing of queues and packet receptions to file "csma-one-subnet.tr" +- +-#include +-#include +-#include +-#include + + #include "ns3/command-line.h" + #include "ns3/default-value.h" + #include "ns3/ptr.h" + #include "ns3/random-variable.h" + #include "ns3/debug.h" +- + #include "ns3/simulator.h" + #include "ns3/nstime.h" + #include "ns3/data-rate.h" +- + #include "ns3/ascii-trace.h" + #include "ns3/pcap-trace.h" + #include "ns3/internet-node.h" +@@ -60,15 +50,18 @@ + + using namespace ns3; + +-NS_DEBUG_COMPONENT_DEFINE ("Me"); ++NS_DEBUG_COMPONENT_DEFINE ("CsmaOneSubnet"); + + int + main (int argc, char *argv[]) + { +- // Users may find it convenient to turn on explicit debugging +- // for selected modules; the below lines suggest how to do this ++// ++// Users may find it convenient to turn on explicit debugging ++// for selected modules; the below lines suggest how to do this ++// + #if 0 +- DebugComponentEnable("Me"); ++ DebugComponentEnable("CsmaOneSubnet"); ++ + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); +@@ -88,71 +81,90 @@ main (int argc, char *argv[]) + DebugComponentEnable("Ipv4LoopbackInterface"); + #endif + +- DebugComponentEnable("Me"); +- DebugComponentEnable("OnOffApplication"); +- DebugComponentEnable("UdpSocket"); +- DebugComponentEnable("UdpL4Protocol"); +- DebugComponentEnable("Ipv4L3Protocol"); +- DebugComponentEnable("Ipv4StaticRouting"); +- DebugComponentEnable("CsmaNetDevice"); +- DebugComponentEnable("CsmaChannel"); +- DebugComponentEnable("Ipv4Interface"); +- DebugComponentEnable("ArpIpv4Interface"); +- DebugComponentEnable("Ipv4LoopbackInterface"); +- +- // Set up some default values for the simulation. Use the Bind() +- // technique to tell the system what subclass of Queue to use, +- // and what the queue limit is +- +- // The below Bind command tells the queue factory which class to +- // instantiate, when the queue factory is invoked in the topology code ++// ++// Set up default values for the simulation. Use the DefaultValue::Bind() ++// technique to tell the system what subclass of Queue to use. The Bind ++// command command tells the queue factory which class to instantiate when the ++// queue factory is invoked in the topology code ++// + DefaultValue::Bind ("Queue", "DropTailQueue"); +- +- // Allow the user to override any of the defaults and the above +- // Bind()s at run-time, via command-line arguments ++// ++// Allow the user to override any of the defaults and the above Bind() at ++// run-time, via command-line arguments ++// + CommandLine::Parse (argc, argv); +- +- // Here, we will explicitly create four nodes. In more sophisticated +- // topologies, we could configure a node factory. ++// ++// Explicitly create the nodes required by the topology (shown above). ++// + NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + +- // We create the channels first without any IP addressing information + NS_DEBUG("Create channels."); +- Ptr channel0 = +- CsmaTopology::CreateCsmaChannel( +- DataRate(5000000), MilliSeconds(2)); ++// ++// Explicitly create the channels required by the topology (shown above). ++// ++ Ptr lan = CsmaTopology::CreateCsmaChannel( ++ DataRate(5000000), MilliSeconds(2)); + + NS_DEBUG("Build Topology."); +- uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, +- Eui48Address("10:54:23:54:23:50")); +- uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, +- Eui48Address("10:54:23:54:23:51")); +- uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, +- Eui48Address("10:54:23:54:23:52")); +- uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, +- Eui48Address("10:54:23:54:23:53")); +- +- // Later, we add IP addresses. ++// ++// Now fill out the topology by creating the net devices required to connect ++// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will ++// create a net device, add a MAC address (in memory of the pink flamingo) and ++// connect the net device to a nodes and also to a channel. the ++// AddIpv4CsmaNetDevice method returns a net device index for the net device ++// created on the node. Interpret nd0 as the net device we created for node ++// zero. ++// ++ uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, ++ Eui48Address("08:00:2e:00:00:00")); ++ ++ uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, ++ Eui48Address("08:00:2e:00:00:01")); ++ ++ uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, ++ Eui48Address("08:00:2e:00:00:02")); ++ ++ uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, ++ Eui48Address("08:00:2e:00:00:03")); ++ ++ NS_DEBUG ("nd0 = " << nd0); ++ NS_DEBUG ("nd1 = " << nd1); ++ NS_DEBUG ("nd2 = " << nd2); ++ NS_DEBUG ("nd3 = " << nd3); ++// ++// We've got the "hardware" in place. Now we need to add IP addresses. ++// + NS_DEBUG("Assign IP Addresses."); +- CsmaIpv4Topology::AddIpv4Address ( +- n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); +- +- CsmaIpv4Topology::AddIpv4Address ( +- n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); +- +- CsmaIpv4Topology::AddIpv4Address ( +- n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); ++// ++// XXX BUGBUG ++// Need a better way to get the interface index. The point-to-point topology ++// as implemented can't return the index since it creates interfaces on both ++// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a ++// method on Ipv4 to find the interface index corresponding to a given ipv4 ++// address. ++// ++// Assign IP addresses to the net devices and associated interfaces ++// on the lan. The AddIpv4Address method returns an Ipv4 interface index ++// which we do not need here. ++// ++ CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address("10.1.1.1"), ++ Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address("10.1.1.2"), ++ Ipv4Mask("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address("10.1.1.3"), ++ Ipv4Mask("255.255.255.0")); + +- CsmaIpv4Topology::AddIpv4Address ( +- n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); +- +- // Create the OnOff application to send UDP datagrams of size +- // 210 bytes at a rate of 448 Kb/s +- // from n0 to n1 ++ CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), ++ Ipv4Mask("255.255.255.0")); ++// ++// Create an OnOff application to send UDP datagrams from node zero to node 1. ++// + NS_DEBUG("Create Applications."); + Ptr ooff = Create ( + n0, +@@ -160,36 +172,43 @@ main (int argc, char *argv[]) + "Udp", + ConstantVariable(1), + ConstantVariable(0)); +- // Start the application ++// ++// Tell the application when to start and stop. ++// + ooff->Start(Seconds(1.0)); + ooff->Stop (Seconds(10.0)); +- +- // Create a similar flow from n3 to n0, starting at time 1.1 seconds ++// ++// Create a similar flow from n3 to n0, starting at time 1.1 seconds ++// + ooff = Create ( + n3, + InetSocketAddress ("10.1.1.1", 80), + "Udp", + ConstantVariable(1), + ConstantVariable(0)); +- // Start the application ++ + ooff->Start(Seconds(1.1)); + ooff->Stop (Seconds(10.0)); +- +- // Configure tracing of all enqueue, dequeue, and NetDevice receive events +- // Trace output will be sent to the csma-one-subnet.tr file +- NS_DEBUG("Configure Tracing."); ++// ++// Configure tracing of all enqueue, dequeue, and NetDevice receive events. ++// Trace output will be sent to the file "csma-one-subnet.tr" ++// ++ NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("csma-one-subnet.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +- +- // Also configure some tcpdump traces; each interface will be traced +- // The output files will be named +- // simple-point-to-point.pcap-- +- // and can be read by the "tcpdump -r" command (use "-tt" option to +- // display timestamps correctly) ++// ++// Also configure some tcpdump traces; each interface will be traced. ++// The output files will be named: ++// csma-one-subnet.pcap-- ++// and can be read by the "tcpdump -r" command (use "-tt" option to ++// display timestamps correctly) ++// + PcapTrace pcaptrace ("csma-one-subnet.pcap"); + pcaptrace.TraceAllIp (); +- ++// ++// Now, do the actual simulation. ++// + NS_DEBUG("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); +diff -r 3aef7d7a71c2 -r a6fb891b59fd examples/mixed-global-routing.cc +--- a/examples/mixed-global-routing.cc Mon Aug 13 12:08:01 2007 -0700 ++++ b/examples/mixed-global-routing.cc Mon Aug 13 14:58:06 2007 -0700 +@@ -128,13 +128,13 @@ int main (int argc, char *argv[]) + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + +- uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channelc0, ++ uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0, + Eui48Address("10:54:23:54:23:50")); +- uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channelc0, ++ uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0, + Eui48Address("10:54:23:54:23:51")); +- uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n4, channelc0, ++ uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, channelc0, + Eui48Address("10:54:23:54:23:52")); +- uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n5, channelc0, ++ uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, channelc0, + Eui48Address("10:54:23:54:23:53")); + + // Later, we add IP addresses. +diff -r 3aef7d7a71c2 -r a6fb891b59fd src/devices/csma/csma-ipv4-topology.cc +--- a/src/devices/csma/csma-ipv4-topology.cc Mon Aug 13 12:08:01 2007 -0700 ++++ b/src/devices/csma/csma-ipv4-topology.cc Mon Aug 13 14:58:06 2007 -0700 +@@ -35,19 +35,20 @@ namespace ns3 { + namespace ns3 { + + uint32_t +-CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, +- Ptr ch, +- Eui48Address addr) ++CsmaIpv4Topology::AddIpv4CsmaNetDevice( ++ Ptr node, ++ Ptr channel, ++ Eui48Address addr) + { + Ptr q = Queue::CreateDefault (); + + // assume full-duplex +- Ptr nd0 = Create (n1, addr, +- ns3::CsmaNetDevice::IP_ARP, +- true, true); +- nd0->AddQueue(q); +- nd0->Attach (ch); +- return nd0->GetIfIndex (); ++ Ptr nd = Create (node, addr, ++ ns3::CsmaNetDevice::IP_ARP, true, true); ++ ++ nd->AddQueue(q); ++ nd->Attach (channel); ++ return nd->GetIfIndex (); + } + + +diff -r 3aef7d7a71c2 -r a6fb891b59fd src/devices/csma/csma-ipv4-topology.h +--- a/src/devices/csma/csma-ipv4-topology.h Mon Aug 13 12:08:01 2007 -0700 ++++ b/src/devices/csma/csma-ipv4-topology.h Mon Aug 13 14:58:06 2007 -0700 +@@ -61,9 +61,9 @@ public: + * + * \return ifIndex of the device + */ +- static uint32_t AddIpv4CsmaNode( Ptr n1, +- Ptr ch, +- Eui48Address addr); ++ static uint32_t AddIpv4CsmaNetDevice(Ptr node, ++ Ptr channel, ++ Eui48Address addr); + + /** + * \param n1 Node to be attached to the Csma channel + +changeset: 1286:2b63aafb050b +user: Craig Dowell +date: Mon Aug 13 16:21:39 2007 -0700 +summary: set source address in socket + +diff -r a6fb891b59fd -r 2b63aafb050b examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -123,12 +123,10 @@ main (int argc, char *argv[]) + // Explicitly create the channels required by the topology (shown above). + // + Ptr lan0 = +- CsmaTopology::CreateCsmaChannel( +- DataRate(5000000), MilliSeconds(2)); ++ CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); + + Ptr lan1 = +- CsmaTopology::CreateCsmaChannel( +- DataRate(5000000), MilliSeconds(2)); ++ CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); + + NS_DEBUG("Build Topology."); + // +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-end-point.cc +--- a/src/internet-node/ipv4-end-point.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-end-point.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -42,6 +42,13 @@ Ipv4EndPoint::GetLocalAddress (void) + { + return m_localAddr; + } ++ ++void ++Ipv4EndPoint::SetLocalAddress (Ipv4Address address) ++{ ++ m_localAddr = address; ++} ++ + uint16_t + Ipv4EndPoint::GetLocalPort (void) + { +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-end-point.h +--- a/src/internet-node/ipv4-end-point.h Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-end-point.h Mon Aug 13 16:21:39 2007 -0700 +@@ -37,6 +37,8 @@ public: + ~Ipv4EndPoint (); + + Ipv4Address GetLocalAddress (void); ++ void SetLocalAddress (Ipv4Address address); ++ + uint16_t GetLocalPort (void); + Ipv4Address GetPeerAddress (void); + uint16_t GetPeerPort (void); +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -174,11 +174,28 @@ Ipv4Impl::GetNetworkMask (uint32_t i) co + { + return m_ipv4->GetNetworkMask (i); + } ++ + Ipv4Address + Ipv4Impl::GetAddress (uint32_t i) const + { + return m_ipv4->GetAddress (i); + } ++ ++Ipv4Address ++Ipv4Impl::GetSourceAddress (Ipv4Address destination) const ++{ ++ uint32_t ifIndex; ++ bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex); ++ if (result) ++ { ++ return m_ipv4->GetAddress (ifIndex); ++ } ++ else ++ { ++ return Ipv4Address::GetAny (); ++ } ++} ++ + uint16_t + Ipv4Impl::GetMtu (uint32_t i) const + { +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-impl.h +--- a/src/internet-node/ipv4-impl.h Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-impl.h Mon Aug 13 16:21:39 2007 -0700 +@@ -81,6 +81,8 @@ public: + virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask); + virtual Ipv4Mask GetNetworkMask (uint32_t t) const; + virtual Ipv4Address GetAddress (uint32_t i) const; ++ virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const; ++ + virtual uint16_t GetMtu (uint32_t i) const; + virtual bool IsUp (uint32_t i) const; + virtual void SetUp (uint32_t i); +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -691,6 +691,28 @@ Ipv4L3Protocol::GetAddress (uint32_t i) + return interface->GetAddress (); + } + ++bool ++Ipv4L3Protocol::GetIfIndexForDestination ( ++ Ipv4Address destination, uint32_t& ifIndex) const ++{ ++ NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (" << destination << ++ ", " << &ifIndex << ")"); ++ ++ for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); ++ i != m_routingProtocols.end (); ++ i++) ++ { ++ NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting Source Address"); ++ uint32_t ifIndex; ++ ++ if ((*i).second->RequestIfIndex (destination, ifIndex)) ++ { ++ return true; ++ } ++ } ++ return false; ++} ++ + uint16_t + Ipv4L3Protocol::GetMtu (uint32_t i) const + { +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Mon Aug 13 16:21:39 2007 -0700 +@@ -182,6 +182,8 @@ public: + void SetNetworkMask (uint32_t i, Ipv4Mask mask); + Ipv4Mask GetNetworkMask (uint32_t t) const; + Ipv4Address GetAddress (uint32_t i) const; ++ bool GetIfIndexForDestination (Ipv4Address destination, ++ uint32_t& ifIndex) const; + uint16_t GetMtu (uint32_t i) const; + bool IsUp (uint32_t i) const; + void SetUp (uint32_t i); +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -377,6 +377,55 @@ Ipv4StaticRouting::RequestRoute ( + } + } + ++bool ++Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) ++{ ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (" << destination << ", " << ++ &ifIndex << ")"); ++// ++// First, see if this is a multicast packet we have a route for. If we ++// have a route, then send the packet down each of the specified interfaces. ++// ++ if (destination.IsMulticast ()) ++ { ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Multicast destination"); ++ ++ Ipv4MulticastRoute *mRoute = LookupStatic(Ipv4Address::GetAny (), ++ destination, Ipv4RoutingProtocol::IF_INDEX_ANY); ++ ++ if (mRoute) ++ { ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " ++ "Multicast route found"); ++ ++ if (mRoute->GetNOutputInterfaces () != 1) ++ { ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " ++ "Route is to multiple interfaces. Ignoring."); ++ return false; ++ } ++ ++ ifIndex = mRoute->GetOutputInterface(0); ++ return true; ++ } ++ return false; // Let other routing protocols try to handle this ++ } ++// ++// See if this is a unicast packet we have a route for. ++// ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Unicast destination"); ++ Ipv4Route *route = LookupStatic (destination); ++ if (route) ++ { ++ ifIndex = route->GetInterface (); ++ return true; ++ } ++ else ++ { ++ return false; ++ } ++} ++ + void + Ipv4StaticRouting::DoDispose (void) + { +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Mon Aug 13 16:21:39 2007 -0700 +@@ -56,6 +56,7 @@ public: + Packet packet, + RouteReplyCallback routeReply); + ++ virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); + + void AddHostRouteTo (Ipv4Address dest, + Ipv4Address nextHop, +diff -r a6fb891b59fd -r 2b63aafb050b src/internet-node/udp-socket.cc +--- a/src/internet-node/udp-socket.cc Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/internet-node/udp-socket.cc Mon Aug 13 16:21:39 2007 -0700 +@@ -26,6 +26,7 @@ + #include "udp-l4-protocol.h" + #include "ipv4-end-point.h" + #include "ipv4-l4-demux.h" ++#include "ns3/ipv4.h" + + NS_DEBUG_COMPONENT_DEFINE ("UdpSocket"); + +@@ -180,6 +181,10 @@ UdpSocket::Connect(const Address & addre + m_defaultPort = transport.GetPort (); + NotifyConnectionSucceeded (); + m_connected = true; ++ ++ Ptr ipv4; ++ ipv4 = m_node->QueryInterface (Ipv4::iid); ++ m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); + return 0; + } + +diff -r a6fb891b59fd -r 2b63aafb050b src/node/ipv4.h +--- a/src/node/ipv4.h Mon Aug 13 14:58:06 2007 -0700 ++++ b/src/node/ipv4.h Mon Aug 13 16:21:39 2007 -0700 +@@ -104,6 +104,16 @@ public: + const Ipv4Header &ipHeader, + Packet packet, + RouteReplyCallback routeReply) = 0; ++ /** ++ * \brief Synchronously request the interface index that will be used to ++ * send a packet to a hypothetical destination. ++ * ++ * \param destination IP address of a hypothetical destination packet ++ * \param ifIndex Reference to interface index. ++ * \returns True if the protocol has a route, false otherwise. ++ */ ++ virtual bool RequestIfIndex (Ipv4Address destination, ++ uint32_t& ifIndex) = 0; + + static const uint32_t IF_INDEX_ANY = 0xffffffff; + }; +@@ -309,6 +319,12 @@ public: + */ + virtual Ipv4Address GetAddress (uint32_t i) const = 0; + /** ++ * \param destination The IP address of a hypothetical destination. ++ * \returns The IP address assigned to the interface that will be used ++ * if we were to send a packet to destination. ++ */ ++ virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; ++ /** + * \param i index of ipv4 interface + * \returns the Maximum Transmission Unit (in bytes) associated + * to the underlying ipv4 interface + +changeset: 1287:a70de165a25a +user: Craig Dowell +date: Mon Aug 13 19:54:47 2007 -0700 +summary: set source IP address in udp-socket packets + +diff -r 2b63aafb050b -r a70de165a25a examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -71,11 +71,11 @@ main (int argc, char *argv[]) + DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("NetDevice"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); +- DebugComponentEnable("NetDevice"); ++ DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("PacketSocket"); +- DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); +@@ -84,18 +84,6 @@ main (int argc, char *argv[]) + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + #endif +- +- DebugComponentEnable("UdpSocket"); +- DebugComponentEnable("UdpL4Protocol"); +- DebugComponentEnable("Ipv4L3Protocol"); +- DebugComponentEnable("Ipv4StaticRouting"); +- DebugComponentEnable("Ipv4Interface"); +- DebugComponentEnable("ArpIpv4Interface"); +- DebugComponentEnable("Ipv4LoopbackInterface"); +- +- DebugComponentEnable("CsmaMulticast"); +- DebugComponentEnable("CsmaChannel"); +- DebugComponentEnable("CsmaNetDevice"); + // + // Set up default values for the simulation. Use the DefaultValue::Bind() + // technique to tell the system what subclass of Queue to use. The Bind +diff -r 2b63aafb050b -r a70de165a25a examples/csma-one-subnet.cc +--- a/examples/csma-one-subnet.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/examples/csma-one-subnet.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -80,7 +80,6 @@ main (int argc, char *argv[]) + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + #endif +- + // + // Set up default values for the simulation. Use the DefaultValue::Bind() + // technique to tell the system what subclass of Queue to use. The Bind +diff -r 2b63aafb050b -r a70de165a25a src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -184,8 +184,10 @@ Ipv4Address + Ipv4Address + Ipv4Impl::GetSourceAddress (Ipv4Address destination) const + { +- uint32_t ifIndex; ++ uint32_t ifIndex = 0xffffffff; ++ + bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex); ++ + if (result) + { + return m_ipv4->GetAddress (ifIndex); +diff -r 2b63aafb050b -r a70de165a25a src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -703,10 +703,13 @@ Ipv4L3Protocol::GetIfIndexForDestination + i++) + { + NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting Source Address"); +- uint32_t ifIndex; +- +- if ((*i).second->RequestIfIndex (destination, ifIndex)) +- { ++ uint32_t ifIndexTmp; ++ ++ if ((*i).second->RequestIfIndex (destination, ifIndexTmp)) ++ { ++ NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " ++ "Found ifIndex " << ifIndexTmp); ++ ifIndex = ifIndexTmp; + return true; + } + } +diff -r 2b63aafb050b -r a70de165a25a src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -406,6 +406,8 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4A + } + + ifIndex = mRoute->GetOutputInterface(0); ++ NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " ++ "Found ifIndex " << ifIndex); + return true; + } + return false; // Let other routing protocols try to handle this +diff -r 2b63aafb050b -r a70de165a25a src/internet-node/udp-socket.cc +--- a/src/internet-node/udp-socket.cc Mon Aug 13 16:21:39 2007 -0700 ++++ b/src/internet-node/udp-socket.cc Mon Aug 13 19:54:47 2007 -0700 +@@ -174,7 +174,7 @@ int + int + UdpSocket::Connect(const Address & address) + { +- NS_DEBUG("UdpSocket::Connect (" << address << ")"); ++ NS_DEBUG ("UdpSocket::Connect (" << address << ")"); + + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + m_defaultAddress = transport.GetIpv4 (); +@@ -185,6 +185,8 @@ UdpSocket::Connect(const Address & addre + Ptr ipv4; + ipv4 = m_node->QueryInterface (Ipv4::iid); + m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); ++ NS_DEBUG ("UdpSocket::Connect (): Local address is" << ++ m_endPoint->GetLocalAddress()); + return 0; + } + +@@ -270,4 +272,4 @@ UdpSocket::ForwardUp (const Packet &pack + NotifyDataReceived (p, address); + } + +-}//namespace ns3 ++} //namespace ns3 + +changeset: 1288:9f9fe7919c89 +user: Craig Dowell +date: Mon Aug 13 20:14:36 2007 -0700 +summary: Silliness for optimized version + +diff -r a70de165a25a -r 9f9fe7919c89 examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Mon Aug 13 19:54:47 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 20:14:36 2007 -0700 +@@ -193,6 +193,15 @@ main (int argc, char *argv[]) + NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); + NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); + NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); ++// ++// A little silliness to let optimized code work while still printing all ++// results in debug code (without attribute). ++// ++ nd3 = nd3; ++ ifIndexNd1 = ifIndexNd1; ++ ifIndexNd3 = ifIndexNd3; ++ ifIndexNd4 = ifIndexNd4; ++ + NS_DEBUG("Configure multicasting."); + // + // Now we can configure multicasting. As described above, the multicast + +changeset: 1289:1d32949ae397 +user: Craig Dowell +date: Mon Aug 13 23:40:51 2007 -0700 +summary: fix non-unique ethernet addresses + +diff -r 9f9fe7919c89 -r 1d32949ae397 examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Mon Aug 13 20:14:36 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 13 23:40:51 2007 -0700 +@@ -135,11 +135,11 @@ main (int argc, char *argv[]) + Eui48Address("08:00:2e:00:00:02")); + + uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, +- Eui48Address("08:00:2e:00:00:00")); ++ Eui48Address("08:00:2e:00:00:03")); + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, +- Eui48Address("08:00:2e:00:00:01")); ++ Eui48Address("08:00:2e:00:00:04")); + uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, +- Eui48Address("08:00:2e:00:00:02")); ++ Eui48Address("08:00:2e:00:00:05")); + + NS_DEBUG ("nd0 = " << nd0); + NS_DEBUG ("nd1 = " << nd1); + +changeset: 1299:2cc09d5a04c4 +parent: 1289:1d32949ae397 +parent: 1298:8bbad559c665 +user: Craig Dowell +date: Mon Aug 20 13:40:15 2007 -0700 +summary: branch merge + +diff -r 1d32949ae397 -r 2cc09d5a04c4 .hgtags +--- a/.hgtags Mon Aug 13 23:40:51 2007 -0700 ++++ b/.hgtags Mon Aug 20 13:40:15 2007 -0700 +@@ -3,3 +3,4 @@ 0dc81e76166c56aaae64da48b673b62155943aad + 0dc81e76166c56aaae64da48b673b62155943aad packet-history-working + 38099dd26e9467b8f49f8632f22789858149a6e7 release ns-3.0.3 + 5701e60bf01a8ac1308945e69001e0cc07948faf release ns-3.0.4 ++08046b6aef37932507696a2f2f427b42d693781e release ns-3.0.5 +diff -r 1d32949ae397 -r 2cc09d5a04c4 AUTHORS +--- a/AUTHORS Mon Aug 13 23:40:51 2007 -0700 ++++ b/AUTHORS Mon Aug 20 13:40:15 2007 -0700 +@@ -3,4 +3,5 @@ Craig Dowell (craigdo@ee.washington.edu) + Craig Dowell (craigdo@ee.washington.edu) + Tom Henderson (tomhend@u.washington.edu) + Mathieu Lacage (mathieu.lacage@sophia.inria.fr) ++Emmanuelle Laprise (emmmanuelle.laprise@bluekazoo.ca) + George F. Riley (riley@ece.gatech.edu) +diff -r 1d32949ae397 -r 2cc09d5a04c4 RELEASE_NOTES +--- a/RELEASE_NOTES Mon Aug 13 23:40:51 2007 -0700 ++++ b/RELEASE_NOTES Mon Aug 20 13:40:15 2007 -0700 +@@ -3,12 +3,16 @@ + + This file contains ns-3 release notes (most recent releases first). + +-Release 3.0.5 (2007/08/XX) ++Release 3.0.5 (2007/08/15) + ======================== + +- - Add CSMA/CD model (Emmanuelle Laprise) +- - Modularize ipv4 routing support (Gustavo Carneiro) +- - Add mobility framework and basic mobility models ++ - Refactoring to support win32-based unix environments (Cygwin, mingw) ++ - "Packet socket" for allowing applications to access NetDevices directly ++ - Generalized, polymorphic Address class ++ - Add CSMA NetDevice model (from Emmanuelle Laprise) ++ - Modularize IPv4 routing support (from Gustavo Carneiro) ++ - Add mobility framework and basic mobility models ++ - Global unicast centralized routing + + Release 3.0.4 (2007/07/15) + ======================== +diff -r 1d32949ae397 -r 2cc09d5a04c4 VERSION +--- a/VERSION Mon Aug 13 23:40:51 2007 -0700 ++++ b/VERSION Mon Aug 20 13:40:15 2007 -0700 +@@ -1,1 +1,1 @@ 3.0.4 +-3.0.4 ++3.0.5 +diff -r 1d32949ae397 -r 2cc09d5a04c4 doc/release_steps.txt +--- a/doc/release_steps.txt Mon Aug 13 23:40:51 2007 -0700 ++++ b/doc/release_steps.txt Mon Aug 20 13:40:15 2007 -0700 +@@ -5,23 +5,20 @@ 1. prepare the source files + - revise and check in RELEASE_NOTES + - update and check in VERSION to the latest release number + 2. make a new "architecture.pdf" document and place it in the doc/ directory +-3. add current version of waf script from subversion: +- - svn checkout http://waf.googlecode.com/svn/tags/ns3/ waf +- - build waf script and put it into top of ns-3-dev +-4. cd ns-3-dev; ./waf configure; ./waf dist +-5. test tarball on release platforms (run-tests and simple-p2p) +-6. tag ns-3-dev with "release ns-3.0.X" ++3. cd ns-3-dev; ./waf configure; ./waf dist ++4. test tarball on release platforms (waf check and maybe some other scripts) ++5. tag ns-3-dev with "release ns-3.0.X" + - hg tag "release ns-3.0.x" + - hg push +-7. clone the tagged ns-3-dev and place it on the repository ++6. clone the tagged ns-3-dev and place it on the repository + - ssh code.nsnam.org; sudo; su code; + - cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.0.x + - cd /home/code/repos/ns-3.0.x/.hg and edit the hgrc appropriately +-8. upload "ns-3.0.x.tar.bz2" to the releases/ directory on the server +-9. update web page ++7. upload "ns-3.0.x.tar.bz2" to the releases/ directory on the server ++8. update web page + - add link to news.html + - update download.html + - update roadmap.html + - build and update Doxygen directory on the server + - update and upload software architecture document (PDF, HTML) +-10. announce to ns-developers, with summary of release notes ++9. announce to ns-developers, with summary of release notes +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/devices/csma/csma-net-device.h +--- a/src/devices/csma/csma-net-device.h Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/devices/csma/csma-net-device.h Mon Aug 20 13:40:15 2007 -0700 +@@ -99,8 +99,23 @@ enum CsmaEncapsulationMode { + * + * \param node the Node to which this device is connected. + * \param addr The source MAC address of the net device. ++ * \param pktType the type of encapsulation + */ + CsmaNetDevice (Ptr node, Eui48Address addr, CsmaEncapsulationMode pktType); ++ ++ /** ++ * Construct a CsmaNetDevice ++ * ++ * This is the constructor for the CsmaNetDevice. It takes as a ++ * parameter the Node to which this device is connected. Ownership of the ++ * Node pointer is not implied and the node must not be deleted. ++ * ++ * \param node the Node to which this device is connected. ++ * \param addr The source MAC address of the net device. ++ * \param pktType the type of encapsulation ++ * \param sendEnable whether this device is able to send ++ * \param receiveEnable whether this device is able to receive ++ */ + CsmaNetDevice (Ptr node, Eui48Address addr, + CsmaEncapsulationMode pktType, + bool sendEnable, bool receiveEnable); +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/devices/point-to-point/point-to-point-net-device.h +--- a/src/devices/point-to-point/point-to-point-net-device.h Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/devices/point-to-point/point-to-point-net-device.h Mon Aug 20 13:40:15 2007 -0700 +@@ -175,7 +175,6 @@ protected: + virtual Ptr DoGetChannel(void) const; + /** + * Set a new default data rate +- * @param Data rate to set for new default + */ + static void SetDefaultRate(const DataRate&); + +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/internet-node/ascii-trace.cc +--- a/src/internet-node/ascii-trace.cc Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/internet-node/ascii-trace.cc Mon Aug 20 13:40:15 2007 -0700 +@@ -25,6 +25,7 @@ + #include "ns3/simulator.h" + #include "ns3/node.h" + #include "ns3/packet.h" ++#include "ns3/queue.h" + + namespace ns3 { + +@@ -40,8 +41,12 @@ AsciiTrace::TraceAllQueues (void) + AsciiTrace::TraceAllQueues (void) + { + Packet::EnableMetadata (); +- TraceRoot::Connect ("/nodes/*/devices/*/queue/*", +- MakeCallback (&AsciiTrace::LogDevQueue, this)); ++ TraceRoot::Connect ("/nodes/*/devices/*/queue/enqueue", ++ MakeCallback (&AsciiTrace::LogDevQueueEnqueue, this)); ++ TraceRoot::Connect ("/nodes/*/devices/*/queue/dequeue", ++ MakeCallback (&AsciiTrace::LogDevQueueDequeue, this)); ++ TraceRoot::Connect ("/nodes/*/devices/*/queue/drop", ++ MakeCallback (&AsciiTrace::LogDevQueueDrop, this)); + } + void + AsciiTrace::TraceAllNetDeviceRx (void) +@@ -52,8 +57,34 @@ AsciiTrace::TraceAllNetDeviceRx (void) + } + + void +-AsciiTrace::LogDevQueue (TraceContext const &context, Packet const &packet) ++AsciiTrace::LogDevQueueEnqueue (TraceContext const &context, ++ Packet const &packet) + { ++ m_os << "+ "; ++ m_os << Simulator::Now ().GetSeconds () << " "; ++ context.Print (m_os); ++ m_os << " pkt-uid=" << packet.GetUid () << " "; ++ packet.Print (m_os); ++ m_os << std::endl; ++} ++ ++void ++AsciiTrace::LogDevQueueDequeue (TraceContext const &context, ++ Packet const &packet) ++{ ++ m_os << "- "; ++ m_os << Simulator::Now ().GetSeconds () << " "; ++ context.Print (m_os); ++ m_os << " pkt-uid=" << packet.GetUid () << " "; ++ packet.Print (m_os); ++ m_os << std::endl; ++} ++ ++void ++AsciiTrace::LogDevQueueDrop (TraceContext const &context, ++ Packet const &packet) ++{ ++ m_os << "d "; + m_os << Simulator::Now ().GetSeconds () << " "; + context.Print (m_os); + m_os << " pkt-uid=" << packet.GetUid () << " "; +@@ -63,7 +94,7 @@ void + void + AsciiTrace::LogDevRx (TraceContext const &context, Packet &p) + { +- m_os << Simulator::Now ().GetSeconds () << " "; ++ m_os << "r " << Simulator::Now ().GetSeconds () << " "; + context.Print (m_os); + m_os << " pkt-uid=" << p.GetUid () << " "; + p.Print (m_os); +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/internet-node/ascii-trace.h +--- a/src/internet-node/ascii-trace.h Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/internet-node/ascii-trace.h Mon Aug 20 13:40:15 2007 -0700 +@@ -37,7 +37,9 @@ public: + void TraceAllQueues (void); + void TraceAllNetDeviceRx (void); + private: +- void LogDevQueue (TraceContext const &context, const Packet &p); ++ void LogDevQueueEnqueue (TraceContext const &context, const Packet &p); ++ void LogDevQueueDequeue (TraceContext const &context, const Packet &p); ++ void LogDevQueueDrop (TraceContext const &context, const Packet &p); + void LogDevRx (TraceContext const &context, Packet &p); + std::ofstream m_os; + }; +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/node/socket.h +--- a/src/node/socket.h Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/node/socket.h Mon Aug 20 13:40:15 2007 -0700 +@@ -170,7 +170,6 @@ public: + /** + * \brief Send data (or dummy data) to the remote host + * \param p packet to send +- * \param dataSent Data sent callback. + * \returns -1 in case of error or the number of bytes copied in the + * internal buffer and accepted for transmission. + */ +@@ -180,7 +179,6 @@ public: + * \brief Send data to a specified peer. + * \param address IP Address of remote host + * \param p packet to send +- * \param dataSent Data sent callback. + * \returns -1 in case of error or the number of bytes copied in the + * internal buffer and accepted for transmission. + */ +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/routing/global-routing/global-route-manager-impl.cc +--- a/src/routing/global-routing/global-route-manager-impl.cc Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/routing/global-routing/global-route-manager-impl.cc Mon Aug 20 13:40:15 2007 -0700 +@@ -1586,6 +1586,7 @@ GlobalRouteManagerImplTest::RunTests (vo + 1); + + GlobalRoutingLSA* lsa0 = new GlobalRoutingLSA (); ++ lsa0->SetLSType (GlobalRoutingLSA::RouterLSA); + lsa0->SetLinkStateId ("0.0.0.0"); + lsa0->SetAdvertisingRouter ("0.0.0.0"); + lsa0->AddLinkRecord (lr0); +@@ -1605,6 +1606,7 @@ GlobalRouteManagerImplTest::RunTests (vo + 1); + + GlobalRoutingLSA* lsa1 = new GlobalRoutingLSA (); ++ lsa1->SetLSType (GlobalRoutingLSA::RouterLSA); + lsa1->SetLinkStateId ("0.0.0.1"); + lsa1->SetAdvertisingRouter ("0.0.0.1"); + lsa1->AddLinkRecord (lr2); +@@ -1648,6 +1650,7 @@ GlobalRouteManagerImplTest::RunTests (vo + 1); + + GlobalRoutingLSA* lsa2 = new GlobalRoutingLSA (); ++ lsa2->SetLSType (GlobalRoutingLSA::RouterLSA); + lsa2->SetLinkStateId ("0.0.0.2"); + lsa2->SetAdvertisingRouter ("0.0.0.2"); + lsa2->AddLinkRecord (lr4); +@@ -1671,6 +1674,7 @@ GlobalRouteManagerImplTest::RunTests (vo + 1); + + GlobalRoutingLSA* lsa3 = new GlobalRoutingLSA (); ++ lsa3->SetLSType (GlobalRoutingLSA::RouterLSA); + lsa3->SetLinkStateId ("0.0.0.3"); + lsa3->SetAdvertisingRouter ("0.0.0.3"); + lsa3->AddLinkRecord (lr10); +diff -r 1d32949ae397 -r 2cc09d5a04c4 src/routing/global-routing/global-router-interface.h +--- a/src/routing/global-routing/global-router-interface.h Mon Aug 13 23:40:51 2007 -0700 ++++ b/src/routing/global-routing/global-router-interface.h Mon Aug 20 13:40:15 2007 -0700 +@@ -431,7 +431,7 @@ public: + /** + * @brief Add an attached router to the list in the NetworkLSA + * +- * @param address The Ipv4Address of the interface on the network link ++ * @param addr The Ipv4Address of the interface on the network link + * @returns The number of addresses in the list. + */ + uint32_t AddAttachedRouter (Ipv4Address addr); + +changeset: 1311:4743aef86605 +parent: 1299:2cc09d5a04c4 +parent: 1310:394c16278532 +user: Craig Dowell +date: Fri Aug 24 13:29:51 2007 -0700 +summary: merge with trunk + +diff -r 2cc09d5a04c4 -r 4743aef86605 SConstruct +--- a/SConstruct Mon Aug 20 13:40:15 2007 -0700 ++++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +@@ -1,521 +0,0 @@ +-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- +- +-import os.path +-import build +- +-version_file = open ('VERSION', 'r') +-version = version_file.readline () +-version_file.close () +-version = version.strip () +- +-ns3 = build.Ns3() +-ns3.build_dir = 'build-dir' +-ns3.version = version +-ns3.name = 'ns3' +-ns3.distname = 'ns' +-ns3.doxygen_config = os.path.join('doc', 'doxygen.conf') +-ns3.add_extra_dist(os.path.join('doc', 'main.txt')) +-ns3.add_extra_dist ('doc/architecture.pdf') +-ns3.add_extra_dist ('doc/contributing.txt') +-ns3.add_extra_dist ('doc/build.txt') +-ns3.add_extra_dist ('doc/codingstd.txt') +-ns3.add_extra_dist ('doc/mercurial.txt') +-ns3.add_extra_dist ('README') +-ns3.add_extra_dist ('RELEASE_NOTES') +-ns3.add_extra_dist ('AUTHORS') +-ns3.add_extra_dist ('VERSION') +- +-ns3.add_extra_dist('doc/build-waf.txt') +-ns3.add_extra_dist('ns3/_placeholder_') +-for wscript in [ +- "src/core/wscript", +- "src/node/wscript", +- "src/devices/p2p/wscript", +- "src/common/wscript", +- "src/applications/wscript", +- "src/simulator/wscript", +- "src/internet-node/wscript", +- "src/wscript", +- "utils/wscript", +- "samples/wscript", +- "examples/wscript", +- "wscript", +- ]: +- ns3.add_extra_dist(wscript) +-ns3.add_extra_dist('waf') +-ns3.add_extra_dist('waf.bat') +- +-# +-# The Core module +-# +-core = build.Ns3Module('core', 'src/core') +-ns3.add(core) +-core.add_sources([ +- 'callback-test.cc', +- 'debug.cc', +- 'assert.cc', +- 'ptr.cc', +- 'object.cc', +- 'test.cc', +- 'random-variable.cc', +- 'rng-stream.cc', +- 'uid-manager.cc', +- 'default-value.cc', +- 'command-line.cc', +- 'type-name.cc', +- 'component-manager.cc', +- ]) +-env = Environment() +-if env['PLATFORM'] == 'posix' or env['PLATFORM'] == 'darwin' or env['PLATFORM'] == 'cygwin': +- core.add_external_dep('pthread') +- core.add_sources([ +- 'unix-system-wall-clock-ms.cc', +- ]) +-elif env['PLATFORM'] == 'win32': +- core.add_sources([ +- 'win32-system-wall-clock-ms.cc', +- ]) +-core.add_headers ([ +- 'uid-manager.h', +- 'singleton.h', +-]) +-core.add_inst_headers([ +- 'system-wall-clock-ms.h', +- 'empty.h', +- 'callback.h', +- 'ptr.h', +- 'object.h', +- 'debug.h', +- 'assert.h', +- 'fatal-error.h', +- 'test.h', +- 'random-variable.h', +- 'rng-stream.h', +- 'default-value.h', +- 'command-line.h', +- 'type-name.h', +- 'component-manager.h', +- ]) +- +-def config_core (env, config): +- retval = [] +- # XXX This check is primitive but it should be +- # good enough for now. +- if config.CheckCHeader ('stdlib.h') == 1: +- retval.append ('#define HAVE_STDLIB_H 1') +- retval.append ('#define HAVE_GETENV 1') +- else: +- retval.append ('#undef HAVE_STDLIB_H') +- retval.append ('#undef HAVE_GETENV') +- return retval +-core.add_config (config_core) +- +-# +-# The Simulator module +-# +-simu = build.Ns3Module('simulator', 'src/simulator') +-ns3.add(simu) +-simu.add_dep('core') +-simu.add_external_dep('m') +-simu.add_sources([ +- 'high-precision.cc', +- 'time.cc', +- 'event-id.cc', +- 'scheduler.cc', +- 'scheduler-factory.cc', +- 'scheduler-list.cc', +- 'scheduler-heap.cc', +- 'scheduler-map.cc', +- 'event-impl.cc', +- 'simulator.cc', +- ]) +-simu.add_headers([ +- 'scheduler-heap.h', +- 'scheduler-map.h', +- 'scheduler-list.h' +- ]) +-simu.add_inst_headers([ +- 'high-precision.h', +- 'nstime.h', +- 'event-id.h', +- 'event-impl.h', +- 'simulator.h', +- 'scheduler.h', +- 'scheduler-factory.h', +- 'simulation-singleton.h', +- ]) +-high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') +-if high_precision_as_double == 'y': +- simu.add_inst_header ('high-precision-double.h') +- simu.add_source ('high-precision-double.cc') +-else: +- simu.add_inst_headers ([ +- 'high-precision-128.h', +- 'cairo-wideint-private.h' +- ]) +- simu.add_sources ([ +- 'high-precision-128.cc', +- 'cairo-wideint.c', +- ]) +- +-def config_simulator (env, config): +- retval = [] +- high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') +- if high_precision_as_double == 'y': +- retval.append ('#define USE_HIGH_PRECISION_DOUBLE 1') +- else: +- retval.append ('#undef USE_HIGH_PRECISION_DOUBLE') +- if config.CheckCHeader ('stdint.h') == 1: +- retval.append ('#define HAVE_STDINT_H 1') +- elif config.CheckCHeader ('inttypes.h') == 1: +- retval.append ('#define HAVE_INTTYPES_H 1') +- elif config.CheckCHeader ('sys/inttypes.h') == 1: +- retval.append ('#define HAVE_SYS_INT_TYPES_H 1') +- return retval +-simu.add_config (config_simulator) +- +-# +-# The Common module +-# +-common = build.Ns3Module('common', 'src/common') +-common.add_deps(['core', 'simulator']) +-ns3.add(common) +-common.add_sources([ +- 'buffer.cc', +- 'chunk.cc', +- 'header.cc', +- 'trailer.cc', +- 'packet-printer.cc', +- 'packet-metadata.cc', +- 'packet.cc', +- 'tags.cc', +- 'pcap-writer.cc', +- 'variable-tracer-test.cc', +- 'trace-context.cc', +- 'trace-resolver.cc', +- 'callback-trace-source.cc', +- 'empty-trace-resolver.cc', +- 'composite-trace-resolver.cc', +- 'trace-root.cc', +- 'data-rate.cc', +- ]) +-common.add_headers ([ +- ]) +-common.add_inst_headers([ +- 'buffer.h', +- 'chunk.h', +- 'header.h', +- 'trailer.h', +- 'tags.h', +- 'packet.h', +- 'packet-printer.h', +- 'packet-metadata.h', +- 'uv-trace-source.h', +- 'sv-trace-source.h', +- 'fv-trace-source.h', +- 'pcap-writer.h', +- 'callback-trace-source.h', +- 'trace-context.h', +- 'trace-resolver.h', +- 'empty-trace-resolver.h', +- 'composite-trace-resolver.h', +- 'array-trace-resolver.h', +- 'trace-root.h', +- 'terminal-trace-resolver.h', +- 'data-rate.h', +- ]) +- +-# +-# The Node module +-# +-node = build.Ns3Module ('node', 'src/node') +-ns3.add (node) +-node.add_deps (['core', 'common', 'simulator']) +-node.add_sources ([ +- 'node.cc', +- 'ipv4-address.cc', +- 'net-device.cc', +- 'mac-address.cc', +- 'llc-snap-header.cc', +- 'ipv4-route.cc', +- 'queue.cc', +- 'drop-tail-queue.cc', +- 'channel.cc', +- 'node-list.cc', +- 'socket.cc', +- 'socket-factory.cc', +- 'udp.cc', +- 'ipv4.cc', +- 'application.cc', +- ]) +-node.add_inst_headers ([ +- 'node.h', +- 'ipv4-address.h', +- 'net-device.h', +- 'mac-address.h', +- 'ipv4-route.h', +- 'queue.h', +- 'drop-tail-queue.h', +- 'llc-snap-header.h', +- 'channel.h', +- 'node-list.h', +- 'socket.h', +- 'socket-factory.h', +- 'udp.h', +- 'ipv4.h', +- 'application.h', +- ]) +- +-# +-# The Applications module +-# +-applications = build.Ns3Module ('applications', 'src/applications') +-ns3.add (applications) +-applications.add_deps (['node']) +-applications.add_sources ([ +- 'onoff-application.cc', +-]) +-applications.add_inst_headers ([ +- 'onoff-application.h', +-]) +- +-# +-# The Internet Node module +-# +-inode = build.Ns3Module ('internet-node', 'src/internet-node') +-ns3.add (inode) +-inode.add_deps (['node', 'routing']) +-inode.add_sources ([ +- 'internet-node.cc', +- 'l3-demux.cc', +- 'l3-protocol.cc', +- 'ipv4-l4-demux.cc', +- 'ipv4-l4-protocol.cc', +- 'ipv4-header.cc', +- 'udp-header.cc', +- 'ipv4-checksum.cc', +- 'ipv4-interface.cc', +- 'ipv4-l3-protocol.cc', +- 'ipv4-end-point.cc', +- 'udp-l4-protocol.cc', +- 'arp-header.cc', +- 'arp-cache.cc', +- 'arp-ipv4-interface.cc', +- 'arp-l3-protocol.cc', +- 'ipv4-loopback-interface.cc', +- 'header-utils.cc', +- 'udp-socket.cc', +- 'ipv4-end-point-demux.cc', +- 'arp-private.cc', +- 'ipv4-impl.cc', +- 'ipv4-private.cc', +- 'ascii-trace.cc', +- 'pcap-trace.cc', +- 'udp-impl.cc', +-]) +-inode.add_headers ([ +- 'ipv4-checksum.h', +- 'arp-header.h', +- 'arp-cache.h', +- 'arp-l3-protocol.h', +- 'ipv4-loopback-interface.h', +- 'l3-demux.h', +- 'header-utils.h', +- 'arp-ipv4-interface.h', +- 'udp-socket.h', +- 'udp-l4-protocol.h', +- 'arp-private.h', +- 'ipv4-impl.h', +- 'ipv4-private.h', +- 'ipv4-l3-protocol.h', +- 'l3-protocol.h', +- 'ipv4-l4-protocol.h', +- 'ipv4-l4-demux.h', +- 'ipv4-end-point-demux.h', +- 'ipv4-end-point.h', +- 'ipv4-header.h', +- 'ipv4-interface.h', +- 'udp-header.h', +- 'sgi-hashmap.h', +- 'udp-impl.h', +-]) +-inode.add_inst_headers ([ +- 'internet-node.h', +- 'ascii-trace.h', +- 'pcap-trace.h', +- 'ipv4-header.h', +- 'udp-header.h', +-]) +- +-# +-# The Point-to-point module +-# +-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.add_inst_headers ([ +- 'p2p-net-device.h', +- 'p2p-channel.h', +- 'p2p-topology.h', +- ]) +- +-# +-# The Routing module +-# +-routing = build.Ns3Module('routing', 'src/routing') +-routing.add_deps(['core', 'node']) +-ns3.add(routing) +-routing.add_sources([ +- 'routing-environment.cc', +- 'static-router.cc', +- 'static-route-manager.cc', +- 'static-route-manager-impl.cc', +- 'candidate-queue.cc', +- ]) +-routing.add_headers ([ +- 'candidate-queue.h', +- 'static-route-manager-impl.h', +- ]) +-routing.add_inst_headers([ +- 'routing-environment.h', +- 'static-router.h', +- 'static-route-manager.h', +- ]) +- +-# utils +-run_tests = build.Ns3Module('run-tests', 'utils') +-ns3.add(run_tests) +-run_tests.set_executable() +-run_tests.add_deps(['core', 'simulator', 'common', 'routing']) +-run_tests.add_source('run-tests.cc') +- +-bench_object = build.Ns3Module('bench-object', 'utils') +-ns3.add(bench_object) +-bench_object.set_executable() +-bench_object.add_deps(['core']) +-bench_object.add_source('bench-object.cc') +- +-bench_packets = build.Ns3Module('bench-packets', 'utils') +-ns3.add(bench_packets) +-bench_packets.set_executable() +-bench_packets.add_deps (['core', 'common']) +-bench_packets.add_source('bench-packets.cc') +- +-bench_simu = build.Ns3Module('bench-simulator', 'utils') +-ns3.add(bench_simu) +-bench_simu.set_executable() +-bench_simu.add_dep('simulator') +-bench_simu.add_source('bench-simulator.cc') +- +-replay_simu = build.Ns3Module('replay-simulation', 'utils') +-ns3.add(replay_simu) +-replay_simu.set_executable() +-replay_simu.add_dep('simulator') +-replay_simu.add_source('replay-simulation.cc') +- +- +-# samples +-sample_debug = build.Ns3Module('sample-debug', 'samples') +-sample_debug.set_executable() +-ns3.add(sample_debug) +-sample_debug.add_dep('core') +-sample_debug.add_source('main-debug.cc') +-sample_debug.add_source('main-debug-other.cc') +- +-sample_packet_printer = build.Ns3Module('sample-packet-printer', 'samples') +-sample_packet_printer.set_executable() +-ns3.add(sample_packet_printer) +-sample_packet_printer.add_deps (['common', 'internet-node']) +-sample_packet_printer.add_source('main-packet-printer.cc') +- +-sample_callback = build.Ns3Module('sample-callback', 'samples') +-sample_callback.set_executable() +-ns3.add(sample_callback) +-sample_callback.add_dep('core') +-sample_callback.add_source('main-callback.cc') +- +-sample_ptr = build.Ns3Module('sample-ptr', 'samples') +-sample_ptr.set_executable() +-ns3.add(sample_ptr) +-sample_ptr.add_dep('core') +-sample_ptr.add_source('main-ptr.cc') +- +-sample_trace = build.Ns3Module('sample-trace', 'samples') +-#ns3.add(sample_trace) +-sample_trace.add_dep('common') +-sample_trace.set_executable() +-sample_trace.add_source('main-trace.cc') +- +-sample_query_interface = build.Ns3Module('sample-query-interface', 'samples') +-ns3.add(sample_query_interface) +-sample_query_interface.add_dep('common') +-sample_query_interface.set_executable() +-sample_query_interface.add_source('main-query-interface.cc') +- +-sample_simu = build.Ns3Module('sample-simulator', 'samples') +-ns3.add(sample_simu) +-sample_simu.set_executable() +-sample_simu.add_dep('simulator') +-sample_simu.add_source('main-simulator.cc') +- +-sample_packet = build.Ns3Module('sample-packet', 'samples') +-ns3.add(sample_packet) +-sample_packet.set_executable() +-sample_packet.add_dep('common') +-sample_packet.add_source('main-packet.cc') +- +-sample_test = build.Ns3Module('sample-test', 'samples') +-sample_test.set_executable() +-ns3.add(sample_test) +-sample_test.add_dep('core') +-sample_test.add_source('main-test.cc') +- +-sample_simple = build.Ns3Module('sample-simple', 'samples') +-sample_simple.set_executable() +-ns3.add(sample_simple) +-sample_simple.add_deps(['core', 'simulator', 'node', 'internet-node', 'routing']) +-sample_simple.add_source('main-simple.cc') +- +-sample_sp2p = build.Ns3Module('sample-simple-p2p', 'samples') +-sample_sp2p.set_executable() +-#n3.add(sample_sp2p) +-sample_sp2p.add_deps(['core', 'simulator', 'node', 'internet-node', 'p2p']) +-sample_sp2p.add_source('main-simple-p2p.cc') +- +-sample_default_value = build.Ns3Module('sample-default-value', 'samples') +-sample_default_value.set_executable() +-ns3.add(sample_default_value) +-sample_default_value.add_deps(['core', 'simulator', 'node', 'p2p']) +-sample_default_value.add_source('main-default-value.cc') +- +-sample_object = build.Ns3Module('sample-object', 'samples') +-sample_object.set_executable() +-ns3.add(sample_object) +-sample_object.add_deps(['core']) +-sample_object.add_source('main-object.cc') +- +-sample_component_manager = build.Ns3Module('sample-component-manager', 'samples') +-sample_component_manager.set_executable() +-ns3.add(sample_component_manager) +-sample_component_manager.add_deps(['core']) +-sample_component_manager.add_source('main-component-manager.cc') +- +-# examples +-example_simple_p2p = build.Ns3Module('simple-p2p', 'examples') +-example_simple_p2p.set_executable() +-ns3.add(example_simple_p2p) +-example_simple_p2p.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) +-example_simple_p2p.add_source('simple-p2p.cc') +- +-example_static_routing = build.Ns3Module('simple-static-routing', 'examples') +-example_static_routing.set_executable() +-ns3.add(example_static_routing) +-example_static_routing.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) +-example_static_routing.add_source('simple-static-routing.cc') +- +-ns3.generate_dependencies() +diff -r 2cc09d5a04c4 -r 4743aef86605 examples/simple-point-to-point.cc +--- a/examples/simple-point-to-point.cc Mon Aug 20 13:40:15 2007 -0700 ++++ b/examples/simple-point-to-point.cc Fri Aug 24 13:29:51 2007 -0700 +@@ -71,6 +71,7 @@ main (int argc, char *argv[]) + + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this ++ // remember to add #include "ns3/debug.h" before enabling these + #if 0 + DebugComponentEnable("Me"); + DebugComponentEnable("Object"); +diff -r 2cc09d5a04c4 -r 4743aef86605 src/applications/onoff-application.h +--- a/src/applications/onoff-application.h Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/applications/onoff-application.h Fri Aug 24 13:29:51 2007 -0700 +@@ -28,13 +28,13 @@ + #include "ns3/application.h" + #include "ns3/event-id.h" + #include "ns3/ptr.h" ++#include "ns3/data-rate.h" + + namespace ns3 { + + class Address; + class RandomVariable; + class Socket; +-class DataRate; + + /** + * \brief Generate traffic to a single destination according to an +diff -r 2cc09d5a04c4 -r 4743aef86605 src/mobility/mobility-model.cc +--- a/src/mobility/mobility-model.cc Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/mobility/mobility-model.cc Fri Aug 24 13:29:51 2007 -0700 +@@ -52,9 +52,9 @@ MobilityModel::Set (const Position &posi + } + + double +-MobilityModel::GetDistanceFrom (const MobilityModel &other) const ++MobilityModel::GetDistanceFrom (Ptr other) const + { +- Position oPosition = other.DoGet (); ++ Position oPosition = other->DoGet (); + Position position = DoGet (); + return CalculateDistance (position, oPosition); + } +diff -r 2cc09d5a04c4 -r 4743aef86605 src/mobility/mobility-model.h +--- a/src/mobility/mobility-model.h Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/mobility/mobility-model.h Fri Aug 24 13:29:51 2007 -0700 +@@ -57,7 +57,7 @@ public: + * \param position a reference to another mobility model + * \returns the distance between the two objects. Unit is meters. + */ +- double GetDistanceFrom (const MobilityModel &position) const; ++ double GetDistanceFrom (Ptr position) const; + protected: + /** + * Must be invoked by subclasses when the course of the +diff -r 2cc09d5a04c4 -r 4743aef86605 src/node/inet-socket-address.cc +--- a/src/node/inet-socket-address.cc Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/node/inet-socket-address.cc Fri Aug 24 13:29:51 2007 -0700 +@@ -1,3 +1,24 @@ ++/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ ++/* ++ * Copyright (c) 2005 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 ++ * ++ * Author: Mathieu Lacage ++ */ ++ + #include "inet-socket-address.h" + #include "ns3/assert.h" + +diff -r 2cc09d5a04c4 -r 4743aef86605 src/node/inet-socket-address.h +--- a/src/node/inet-socket-address.h Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/node/inet-socket-address.h Fri Aug 24 13:29:51 2007 -0700 +@@ -1,5 +1,26 @@ +-#ifndef IPV4_TRANSPORT_ADDRESS_H +-#define IPV4_TRANSPORT_ADDRESS_H ++/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ ++/* ++ * Copyright (c) 2005 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 ++ * ++ * Author: Mathieu Lacage ++ */ ++ ++#ifndef INET_SOCKET_ADDRESS_H ++#define INET_SOCKET_ADDRESS_H + + #include "address.h" + #include "ipv4-address.h" +@@ -93,4 +114,4 @@ private: + } // namespace ns3 + + +-#endif /* IPV4_TRANSPORT_ADDRESS_H */ ++#endif /* INET_SOCKET_ADDRESS_H */ +diff -r 2cc09d5a04c4 -r 4743aef86605 src/node/net-device.cc +--- a/src/node/net-device.cc Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/node/net-device.cc Fri Aug 24 13:29:51 2007 -0700 +@@ -197,7 +197,7 @@ NetDevice::GetChannel (void) const + + // Receive packets from below + bool +-NetDevice::ForwardUp(const Packet& p, uint32_t param, const Address &from) ++NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) + { + bool retval = false; + +diff -r 2cc09d5a04c4 -r 4743aef86605 src/node/net-device.h +--- a/src/node/net-device.h Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/node/net-device.h Fri Aug 24 13:29:51 2007 -0700 +@@ -251,7 +251,7 @@ public: + * forwards it to the higher layers by calling this method + * which is responsible for passing it up to the Rx callback. + */ +- bool ForwardUp (const Packet& p, uint32_t param, const Address &address); ++ bool ForwardUp (const Packet& p, uint16_t param, const Address &address); + + + /** +diff -r 2cc09d5a04c4 -r 4743aef86605 src/simulator/simulator.cc +--- a/src/simulator/simulator.cc Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/simulator/simulator.cc Fri Aug 24 13:29:51 2007 -0700 +@@ -539,13 +539,14 @@ public: + public: + SimulatorTests (); + // only here for testing of Ptr<> +- void Ref (void); +- void Unref (void); ++ void Ref (void) const; ++ void Unref (void) const; + virtual ~SimulatorTests (); + virtual bool RunTests (void); + private: + uint64_t NowUs (); + bool RunOneTest (void); ++ void RunTestsConst (void) const; + void A (int a); + void B (int b); + void C (int c); +@@ -566,6 +567,24 @@ private: + void cbaz3 (const int &, const int &, const int &); + void cbaz4 (const int &, const int &, const int &, const int &); + void cbaz5 (const int &, const int &, const int &, const int &, const int &); ++ ++ void bar0c (void) const; ++ void bar1c (int) const; ++ void bar2c (int, int) const; ++ void bar3c (int, int, int) const; ++ void bar4c (int, int, int, int) const; ++ void bar5c (int, int, int, int, int) const; ++ void baz1c (int &) const; ++ void baz2c (int &, int &) const; ++ void baz3c (int &, int &, int &) const; ++ void baz4c (int &, int &, int &, int &) const; ++ void baz5c (int &, int &, int &, int &, int &) const; ++ void cbaz1c (const int &) const; ++ void cbaz2c (const int &, const int &) const; ++ void cbaz3c (const int &, const int &, const int &) const; ++ void cbaz4c (const int &, const int &, const int &, const int &) const; ++ void cbaz5c (const int &, const int &, const int &, const int &, const int &) const; ++ + void destroy (void); + + bool m_b; +@@ -583,10 +602,10 @@ SimulatorTests::~SimulatorTests () + SimulatorTests::~SimulatorTests () + {} + void +-SimulatorTests::Ref (void) +-{} +-void +-SimulatorTests::Unref (void) ++SimulatorTests::Ref (void) const ++{} ++void ++SimulatorTests::Unref (void) const + {} + uint64_t + SimulatorTests::NowUs (void) +@@ -687,6 +706,57 @@ SimulatorTests::cbaz4 (const int &, cons + {} + void + SimulatorTests::cbaz5 (const int &, const int &, const int &, const int &, const int &) ++{} ++ ++void ++SimulatorTests::bar0c (void) const ++{} ++void ++SimulatorTests::bar1c (int) const ++{} ++void ++SimulatorTests::bar2c (int, int) const ++{} ++void ++SimulatorTests::bar3c (int, int, int) const ++{} ++void ++SimulatorTests::bar4c (int, int, int, int) const ++{} ++void ++SimulatorTests::bar5c (int, int, int, int, int) const ++{} ++ ++void ++SimulatorTests::baz1c (int &) const ++{} ++void ++SimulatorTests::baz2c (int &, int &) const ++{} ++void ++SimulatorTests::baz3c (int &, int &, int &) const ++{} ++void ++SimulatorTests::baz4c (int &, int &, int &, int &) const ++{} ++void ++SimulatorTests::baz5c (int &, int &, int &, int &, int &) const ++{} ++ ++void ++SimulatorTests::cbaz1c (const int &) const ++{} ++void ++SimulatorTests::cbaz2c (const int &, const int &) const ++{} ++void ++SimulatorTests::cbaz3c (const int &, const int &, const int &) const ++{} ++void ++SimulatorTests::cbaz4c (const int &, const int &, const int &, const int &) const ++{} ++void ++SimulatorTests::cbaz5c (const int &, const int &, const int &, const int &, const int &) const + {} + + bool +@@ -723,6 +793,80 @@ SimulatorTests::RunOneTest (void) + } + return ok; + } ++void ++SimulatorTests::RunTestsConst (void) const ++{ ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar0c, this); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar1c, this, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar2c, this, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar3c, this, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar4c, this, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar5c, this, 0, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar0c, Ptr (this)); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar1c, Ptr (this), 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar2c, Ptr (this), 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar3c, Ptr (this), 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar4c, Ptr (this), 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar5c, Ptr (this), 0, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz1c, this, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz2c, this, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz3c, this, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz4c, this, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar0c, this); ++ Simulator::ScheduleNow (&SimulatorTests::bar1c, this, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar2c, this, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar3c, this, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::cbaz1c, this, 0); ++ Simulator::ScheduleNow (&SimulatorTests::cbaz2c, this, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::cbaz3c, this, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::cbaz4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::cbaz5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar0c, Ptr (this)); ++ Simulator::ScheduleNow (&SimulatorTests::bar1c, Ptr (this), 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar2c, Ptr (this), 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar3c, Ptr (this), 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar4c, Ptr (this), 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::bar5c, Ptr (this), 0, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar0c, this); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar1c, this, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar2c, this, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar3c, this, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::cbaz1c, this, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::cbaz2c, this, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::cbaz3c, this, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::cbaz4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::cbaz5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar0c, Ptr (this)); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar1c, Ptr (this), 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar2c, Ptr (this), 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar3c, Ptr (this), 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar4c, Ptr (this), 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::bar5c, Ptr (this), 0, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz1c, this, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz2c, this, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz3c, this, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz4c, this, 0, 0, 0, 0); ++ Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::baz1c, this, 0); ++ Simulator::ScheduleNow (&SimulatorTests::baz2c, this, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::baz3c, this, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::baz4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleNow (&SimulatorTests::baz5c, this, 0, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::baz1c, this, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::baz2c, this, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::baz3c, this, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::baz4c, this, 0, 0, 0, 0); ++ Simulator::ScheduleDestroy (&SimulatorTests::baz5c, this, 0, 0, 0, 0, 0); ++ ++ Simulator::Run (); ++ Simulator::Destroy (); ++} ++ + bool + SimulatorTests::RunTests (void) + { +@@ -870,6 +1014,8 @@ SimulatorTests::RunTests (void) + Simulator::ScheduleDestroy (&SimulatorTests::baz5, this, 0, 0, 0, 0, 0); + #endif + ++ RunTestsConst (); ++ + EventId nowId = Simulator::ScheduleNow (&foo0); + m_destroyId = Simulator::ScheduleDestroy (&SimulatorTests::destroy, this); + if (m_destroyId.IsExpired ()) +diff -r 2cc09d5a04c4 -r 4743aef86605 src/simulator/simulator.h +--- a/src/simulator/simulator.h Mon Aug 20 13:40:15 2007 -0700 ++++ b/src/simulator/simulator.h Fri Aug 24 13:29:51 2007 -0700 +@@ -163,8 +163,8 @@ public: + * @param obj the object on which to invoke the member method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (void), OBJ obj); ++ template ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj); + /** + * @param time the relative expiration time of the event. + * @param mem_ptr member method pointer to invoke +@@ -172,8 +172,8 @@ public: + * @param a1 the first argument to pass to the invoked method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1), OBJ obj, T1 a1); ++ template ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1); + /** + * @param time the relative expiration time of the event. + * @param mem_ptr member method pointer to invoke +@@ -182,8 +182,8 @@ public: + * @param a2 the second argument to pass to the invoked method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); ++ template ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2); + /** + * @param time the relative expiration time of the event. + * @param mem_ptr member method pointer to invoke +@@ -193,10 +193,9 @@ public: + * @param a3 the third argument to pass to the invoked method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3); + /** + * @param time the relative expiration time of the event. + * @param mem_ptr member method pointer to invoke +@@ -207,10 +206,9 @@ public: + * @param a4 the fourth argument to pass to the invoked method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); + /** + * @param time the relative expiration time of the event. + * @param mem_ptr member method pointer to invoke +@@ -222,10 +220,9 @@ public: + * @param a5 the fifth argument to pass to the invoked method + * @returns an id for the scheduled event. + */ +- template +- static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, ++ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, + T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + /** + * @param time the relative expiration time of the event. +@@ -295,27 +292,25 @@ public: + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method + */ +- template +- static EventId ScheduleNow (void (T::*mem_ptr) (void), OBJ obj); +- /** +- * @param mem_ptr member method pointer to invoke +- * @param obj the object on which to invoke the member method +- * @param a1 the first argument to pass to the invoked method +- */ +- template ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj); ++ /** ++ * @param mem_ptr member method pointer to invoke ++ * @param obj the object on which to invoke the member method ++ * @param a1 the first argument to pass to the invoked method ++ */ ++ template +- static EventId ScheduleNow (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method + * @param a1 the first argument to pass to the invoked method + * @param a2 the second argument to pass to the invoked method + */ +- template +- static EventId ScheduleNow (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -323,10 +318,9 @@ public: + * @param a2 the second argument to pass to the invoked method + * @param a3 the third argument to pass to the invoked method + */ +- template +- static EventId ScheduleNow (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -335,11 +329,10 @@ public: + * @param a3 the third argument to pass to the invoked method + * @param a4 the fourth argument to pass to the invoked method + */ +- template +- static EventId ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4); ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -349,11 +342,10 @@ public: + * @param a4 the fourth argument to pass to the invoked method + * @param a5 the fifth argument to pass to the invoked method + */ +- template +- static EventId ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); ++ static EventId ScheduleNow (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + /** + * @param f the function to invoke + */ +@@ -414,27 +406,25 @@ public: + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method + */ +- template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (void), OBJ obj); +- /** +- * @param mem_ptr member method pointer to invoke +- * @param obj the object on which to invoke the member method +- * @param a1 the first argument to pass to the invoked method +- */ +- template ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj); ++ /** ++ * @param mem_ptr member method pointer to invoke ++ * @param obj the object on which to invoke the member method ++ * @param a1 the first argument to pass to the invoked method ++ */ ++ template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method + * @param a1 the first argument to pass to the invoked method + * @param a2 the second argument to pass to the invoked method + */ +- template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -442,10 +432,9 @@ public: + * @param a2 the second argument to pass to the invoked method + * @param a3 the third argument to pass to the invoked method + */ +- template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -454,11 +443,10 @@ public: + * @param a3 the third argument to pass to the invoked method + * @param a4 the fourth argument to pass to the invoked method + */ +- template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4); ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4); + /** + * @param mem_ptr member method pointer to invoke + * @param obj the object on which to invoke the member method +@@ -468,11 +456,10 @@ public: + * @param a4 the fourth argument to pass to the invoked method + * @param a5 the fifth argument to pass to the invoked method + */ +- template +- static EventId ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); ++ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + /** + * @param f the function to invoke + */ +@@ -569,29 +556,24 @@ private: + Simulator (); + ~Simulator (); + +- template +- static Ptr MakeEvent (void (T::*mem_ptr) (void), OBJ obj); +- template ++ static Ptr MakeEvent (MEM mem_ptr, OBJ obj); ++ template +- static Ptr MakeEvent (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); +- template MakeEvent (MEM mem_ptr, OBJ obj, T1 a1); ++ template +- static Ptr MakeEvent (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); +- template MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2); ++ template +- static Ptr MakeEvent (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); +- template MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3); ++ template +- static Ptr MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); +- template MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); ++ template +- static Ptr MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); ++ static Ptr MakeEvent (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + static Ptr MakeEvent (void (*f) (void)); + template +@@ -649,14 +631,13 @@ struct EventMemberImplObjTraits + } + }; + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (void), OBJ obj) ++template ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj) + { + // zero argument version + class EventMemberImpl0 : public EventImpl { + public: +- typedef void (T::*F)(void); +- EventMemberImpl0 (OBJ obj, F function) ++ EventMemberImpl0 (OBJ obj, MEM function) + : m_obj (obj), + m_function (function) + {} +@@ -666,22 +647,20 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + } * ev = new EventMemberImpl0 (obj, mem_ptr); + return Ptr (ev, false); + } + + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj, T1 a1) + { + // one argument version + class EventMemberImpl1 : public EventImpl { + public: +- typedef void (T::*F)(U1); +- EventMemberImpl1 (OBJ obj, F function, T1 a1) ++ EventMemberImpl1 (OBJ obj, MEM function, T1 a1) + : m_obj (obj), + m_function (function), + m_a1 (a1) +@@ -693,23 +672,20 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (m_a1); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + typename TypeTraits::ReferencedType m_a1; + } *ev = new EventMemberImpl1 (obj, mem_ptr, a1); + return Ptr (ev, false); + } + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) + { + // two argument version + class EventMemberImpl2 : public EventImpl { + public: +- typedef void (T::*F)(U1, U2); +- +- EventMemberImpl2 (OBJ obj, F function, T1 a1, T2 a2) ++ EventMemberImpl2 (OBJ obj, MEM function, T1 a1, T2 a2) + : m_obj (obj), + m_function (function), + m_a1 (a1), +@@ -722,24 +698,21 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (m_a1, m_a2); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + } *ev = new EventMemberImpl2 (obj, mem_ptr, a1, a2); + return Ptr (ev, false); + } + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) + { + // three argument version + class EventMemberImpl3 : public EventImpl { + public: +- typedef void (T::*F)(U1,U2,U3); +- +- EventMemberImpl3 (OBJ obj, F function, T1 a1, T2 a2, T3 a3) ++ EventMemberImpl3 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3) + : m_obj (obj), + m_function (function), + m_a1 (a1), +@@ -753,7 +726,7 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (m_a1, m_a2, m_a3); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; +@@ -761,17 +734,14 @@ Ptr Simulator::MakeEvent (voi + return Ptr (ev, false); + } + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) + { + // four argument version + class EventMemberImpl4 : public EventImpl { + public: +- typedef void (T::*F)(U1, U2, U3, U4); +- +- EventMemberImpl4 (OBJ obj, F function, T1 a1, T2 a2, T3 a3, T4 a4) ++ EventMemberImpl4 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4) + : m_obj (obj), + m_function (function), + m_a1 (a1), +@@ -786,7 +756,7 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (m_a1, m_a2, m_a3, m_a4); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; +@@ -795,18 +765,15 @@ Ptr Simulator::MakeEvent (voi + return Ptr (ev, false); + } + +-template +-Ptr Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) ++Ptr Simulator::MakeEvent (MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + // five argument version + class EventMemberImpl5 : public EventImpl { + public: +- typedef void (T::*F)(U1, U2, U3, U4, U5); +- +- EventMemberImpl5 (OBJ obj, F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) ++ EventMemberImpl5 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + : m_obj (obj), + m_function (function), + m_a1 (a1), +@@ -822,7 +789,7 @@ Ptr Simulator::MakeEvent (voi + (EventMemberImplObjTraits::GetReference (m_obj).*m_function) (m_a1, m_a2, m_a3, m_a4, m_a5); + } + OBJ m_obj; +- F m_function; ++ MEM m_function; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; +@@ -975,50 +942,45 @@ Ptr Simulator::MakeEvent (voi + return Ptr (ev, false); + } + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (void), OBJ obj) ++template ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj) + { + return Schedule (time, MakeEvent (mem_ptr, obj)); + } + + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1), OBJ obj, T1 a1) ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1) + { + return Schedule (time, MakeEvent (mem_ptr, obj, a1)); + } + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2) + { + return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2)); + } + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) + { + return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3)); + } + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) + { + return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); + } + +-template +-EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, +- T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) ++EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, ++ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); + } +@@ -1060,55 +1022,50 @@ EventId Simulator::Schedule (Time const + + + +-template +-EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (void), OBJ obj) ++template ++EventId ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj) + { + return ScheduleNow (MakeEvent (mem_ptr, obj)); + } + + +-template + EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1) + { + return ScheduleNow (MakeEvent (mem_ptr, obj, a1)); + } + +-template + EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) + { + return ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2)); + } + +-template + EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) + { + return ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3)); + } + +-template + EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) + { + return ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); + } + +-template + EventId +-Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, ++Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, + T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + return ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); +@@ -1156,55 +1113,50 @@ Simulator::ScheduleNow (void (*f) (U1,U2 + + + +-template +-EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (void), OBJ obj) ++template ++EventId ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj)); + } + + +-template + EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj, a1)); + } + +-template + EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2)); + } + +-template + EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3)); + } + +-template + EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); + } + +-template + EventId +-Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, ++Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, + T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + return ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); +diff -r 2cc09d5a04c4 -r 4743aef86605 wscript +--- a/wscript Mon Aug 20 13:40:15 2007 -0700 ++++ b/wscript Fri Aug 24 13:29:51 2007 -0700 +@@ -37,7 +37,7 @@ def set_options(opt): + + opt.add_option('-d', '--debug-level', + action='callback', +- type=str, dest='debug_level', default='debug', ++ type="string", dest='debug_level', default='debug', + help=('Specify the debug level, does nothing if CFLAGS is set' + ' in the environment. [Allowed Values: debug, optimized].' + ' WARNING: this option only has effect ' + +changeset: 1312:c77745b2731c +user: Craig Dowell +date: Fri Aug 24 16:57:54 2007 -0700 +summary: add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob + +diff -r 4743aef86605 -r c77745b2731c examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Fri Aug 24 13:29:51 2007 -0700 ++++ b/examples/csma-multicast.cc Fri Aug 24 16:57:54 2007 -0700 +@@ -84,6 +84,21 @@ main (int argc, char *argv[]) + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + #endif ++ ++ DebugComponentEnable("Channel"); ++ DebugComponentEnable("CsmaChannel"); ++ DebugComponentEnable("CsmaMulticast"); ++ DebugComponentEnable("CsmaNetDevice"); ++ DebugComponentEnable("OnOffApplication"); ++ DebugComponentEnable("PacketSocket"); ++ DebugComponentEnable("UdpSocket"); ++ DebugComponentEnable("UdpL4Protocol"); ++ DebugComponentEnable("Ipv4L3Protocol"); ++ DebugComponentEnable("Ipv4StaticRouting"); ++ DebugComponentEnable("Ipv4Interface"); ++ DebugComponentEnable("ArpIpv4Interface"); ++ DebugComponentEnable("Ipv4LoopbackInterface"); ++ + // + // Set up default values for the simulation. Use the DefaultValue::Bind() + // technique to tell the system what subclass of Queue to use. The Bind +@@ -151,56 +166,32 @@ main (int argc, char *argv[]) + // We've got the "hardware" in place. Now we need to add IP addresses. + // + NS_DEBUG("Assign IP Addresses."); +-// +-// XXX BUGBUG +-// Need a better way to get the interface index. The point-to-point topology +-// as implemented can't return the index since it creates interfaces on both +-// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +-// method on Ipv4 to find the interface index corresponding to a given ipv4 +-// address. +-// +-// First, assign IP addresses to the net devices and associated interfaces +-// on Lan0. The AddIpv4Address method returns an Ipv4 interface index. +-// Interpret ifIndexNd0 as the interface index to use to reference the +-// net device we created on node zero when coming in from the Ipv4 interface. +-// Net device numbers and interface indices are distinct. Interpret +-// ifIndexNd2Lan0 as the interface index to use to reference the +-// net device we created that connects node two to lan zero. +-// +- uint32_t ifIndexNd0 = CsmaIpv4Topology::AddIpv4Address (n0, nd0, +- Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNd1 = CsmaIpv4Topology::AddIpv4Address (n1, nd1, +- Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNd2Lan0 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, +- Ipv4Address ("10.1.1.3"), Ipv4Mask ("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), ++ Ipv4Mask ("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address ("10.1.1.2"), ++ Ipv4Mask ("255.255.255.0")); ++ ++// ++// We'll need these addresses later ++// ++ Ipv4Address n2Lan0Addr ("10.1.1.3"); ++ Ipv4Address n2Lan1Addr ("10.1.2.1"); ++ ++ CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, n2Lan0Addr, ++ Ipv4Mask ("255.255.255.0")); + // + // Assign IP addresses to the net devices and associated interfaces on Lan1 + // +- uint32_t ifIndexNd2Lan1 = CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, +- Ipv4Address ("10.1.2.1"), Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNd3 = CsmaIpv4Topology::AddIpv4Address (n3, nd1, +- Ipv4Address ("10.1.2.2"), Ipv4Mask ("255.255.255.0")); +- +- uint32_t ifIndexNd4 = CsmaIpv4Topology::AddIpv4Address (n4, nd4, +- Ipv4Address ("10.1.2.3"), Ipv4Mask ("255.255.255.0")); +- +- NS_DEBUG ("ifIndexNd0 = " << ifIndexNd0); +- NS_DEBUG ("ifIndexNd1 = " << ifIndexNd1); +- NS_DEBUG ("ifIndexNd2Lan0 = " << ifIndexNd2Lan0); +- NS_DEBUG ("ifIndexNd2Lan1 = " << ifIndexNd2Lan1); +- NS_DEBUG ("ifIndexNd3 = " << ifIndexNd3); +- NS_DEBUG ("ifIndexNd4 = " << ifIndexNd4); +-// +-// A little silliness to let optimized code work while still printing all +-// results in debug code (without attribute). +-// +- nd3 = nd3; +- ifIndexNd1 = ifIndexNd1; +- ifIndexNd3 = ifIndexNd3; +- ifIndexNd4 = ifIndexNd4; ++ CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, n2Lan1Addr, ++ Ipv4Mask ("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n3, nd1, Ipv4Address ("10.1.2.2"), ++ Ipv4Mask ("255.255.255.0")); ++ ++ CsmaIpv4Topology::AddIpv4Address (n4, nd4, Ipv4Address ("10.1.2.3"), ++ Ipv4Mask ("255.255.255.0")); + + NS_DEBUG("Configure multicasting."); + // +@@ -216,34 +207,35 @@ main (int argc, char *argv[]) + // + // We are going to manually configure multicast routing. This means telling + // node two that it should expect multicast data coming from IP address +-// 10.1.1.1 over its IP interface connected to Lan0. These are called +-// multicastSource and ifIndexNd2Lan0 respectively. When node two receives +-// these packets, they should be forwarded out the interface that connects it +-// to Lan1 which is called ifIndexNd2Lan1. All we need to do is to call the +-// AddMulticastRoute method on node two's Ipv4 interface and provide this +-// information. (Note: the vector of output interfaces is in case there are +-// multiple net devices on a node). ++// 10.1.1.1 originally. It should expect these data coming in over its IP ++// interface connected to Lan0. When node two receives these packets, they ++// should be forwarded out the interface that connects it to Lan1. ++// ++// We're going to need the interface indices on node two corresponding to ++// these interfaces, which we call ifIndexLan0 and ifIndexLan1. The most ++// general way to get these interfaces is to look them up by IP address. ++// Looking back to the topology creation calls above, we saved the addresses ++// assigned to the interface connecting node two to Lan0 and Lan1. Now is ++// a fine time to find the interface indices on node two. + // + Ptr ipv4; + ipv4 = n2->QueryInterface (Ipv4::iid); + ++ uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr(n2Lan0Addr); ++ uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr(n2Lan1Addr); ++// ++// Now, we need to do is to call the AddMulticastRoute () method on node ++// two's Ipv4 interface and tell it that whenever it receives a packet on ++// the interface from Lan0, with the packet from the multicast source, ++// destined for the multicast group, it should forward these packets down ++// the interface connecting it to Lan1. (Note: the vector of output ++// interfaces is in case there are multiple net devices on a node -- not ++// true in this case). ++// + std::vector outputInterfaces (1); +- outputInterfaces[0] = ifIndexNd2Lan1; +- +- ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexNd2Lan0, +- outputInterfaces); +-// +-// We also need to explain to the node zero forwarding code that when it sees +-// a packet destined for the multicast group it needs to send it out its +-// one and only interface. The 0xffffffff in the call means that the input +-// interface qualification is not applicable in this case (the packet has +-// not been received over an interface, it has been created locally). +-// +- ipv4 = n0->QueryInterface (Ipv4::iid); +- +- outputInterfaces[0] = ifIndexNd0;; +- +- ipv4->AddMulticastRoute (multicastSource, multicastGroup, 0xffffffff, ++ outputInterfaces[0] = ifIndexLan1; ++ ++ ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexLan0, + outputInterfaces); + // + // As described above, node four will be the only node listening for the +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Fri Aug 24 16:57:54 2007 -0700 +@@ -136,11 +136,25 @@ Ipv4Impl::AddInterface (Ptr d + { + return m_ipv4->AddInterface (device); + } ++ + uint32_t + Ipv4Impl::GetNInterfaces (void) + { + return m_ipv4->GetNInterfaces (); + } ++ ++uint32_t ++Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr) const ++{ ++ return m_ipv4->FindInterfaceForAddr (addr); ++} ++ ++uint32_t ++Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const ++{ ++ return m_ipv4->FindInterfaceForAddr (addr, mask); ++} ++ + Ptr + Ipv4Impl::GetNetDevice (uint32_t i) + { +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-impl.h +--- a/src/internet-node/ipv4-impl.h Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-impl.h Fri Aug 24 16:57:54 2007 -0700 +@@ -72,6 +72,11 @@ public: + + virtual uint32_t AddInterface (Ptr device); + virtual uint32_t GetNInterfaces (void); ++ ++ virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const; ++ virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, ++ Ipv4Mask mask) const; ++ + virtual Ptr GetNetDevice(uint32_t i); + + virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Fri Aug 24 16:57:54 2007 -0700 +@@ -278,6 +278,33 @@ Ipv4L3Protocol::Lookup ( + return; + } + ++ if (ipHeader.GetDestination ().IsMulticast () && ++ ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) ++ { ++ NS_DEBUG ("Ipv4L3Protocol::Lookup (): " ++ "Multicast destination with local source"); ++// ++// We have a multicast packet originating from the current node. We didn't ++// want to force users to construct a route in order to get packets out of a ++// node, so there will have been no route found and it is left to us to send ++// the packet. What we'll do is to send the multicast out all of the ++// interfaces on this node. ++// ++ NS_DEBUG ("Ipv4StaticRouting::Lookup (): " ++ "Local source. Flooding multicast packet"); ++ ++ for (uint32_t i = 0; i < GetNInterfaces (); ++i) ++ { ++ Packet p = packet; ++ Ipv4Header h = ipHeader; ++ Ipv4Route route = ++ Ipv4Route::CreateHostRouteTo(h.GetDestination (), i); ++ NS_DEBUG ("Ipv4StaticRouting::Lookup (): " ++ "Send via interface " << i); ++ routeReply (true, route, p, h); ++ } ++ return; ++ } + // No route found + routeReply (false, Ipv4Route (), packet, ipHeader); + } +@@ -397,6 +424,49 @@ Ipv4L3Protocol::GetNInterfaces (void) co + { + NS_DEBUG("Ipv4L3Protocol::GetNInterface ()"); + return m_nInterfaces; ++} ++ ++uint32_t ++Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const ++{ ++ NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ")"); ++ ++ uint32_t ifIndex = 0; ++ for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); ++ i != m_interfaces.end (); ++ i++, ifIndex++) ++ { ++ if ((*i)->GetAddress () == addr) ++ { ++ return ifIndex; ++ } ++ } ++ ++ NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " ++ "Interface not found for IP address"); ++ return 0; ++} ++ ++uint32_t ++Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const ++{ ++ NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ", " << ++ mask << ")"); ++ ++ uint32_t ifIndex = 0; ++ for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); ++ i != m_interfaces.end (); ++ i++, ifIndex++) ++ { ++ if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask)) ++ { ++ return ifIndex; ++ } ++ } ++ ++ NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " ++ "Interface not found for masked IP address"); ++ return 0; + } + + Ipv4Interface * +@@ -713,7 +783,40 @@ Ipv4L3Protocol::GetIfIndexForDestination + return true; + } + } +- return false; ++// ++// If there's no routing table entry telling us what single interface will be ++// used to send a packet to this destination, we'll have to just pick one. ++// If there's only one interface on this node, a good answer isn't very hard ++// to come up with. Before jumping to any conclusions, remember that the ++// zeroth interface is the loopback interface, so what we actually want is ++// a situation where there are exactly two interfaces on the node, in which ++// case interface one is the "single" interface. ++// ++ if (GetNInterfaces () == 2) ++ { ++ NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " ++ "One Interface. Using interface 1."); ++ ifIndex = 1; ++ return true; ++ } ++// ++// If we fall through to here, we have a node with multiple interfaces and ++// no routes to guide us in determining what interface to choose. The last ++// choice is to use the one set in the default route. ++// ++ NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " ++ "Using default route"); ++ Ipv4Route *route = m_staticRouting->GetDefaultRoute (); ++ ++ NS_ASSERT_MSG(route, ++ "Ipv4L3Protocol::GetIfIndexForDestination (): " ++ "Unable to determine outbound interface. No default route set"); ++ ++ ifIndex = route->GetInterface (); ++ ++ NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " ++ "Default route specifies interface " << ifIndex); ++ return true; + } + + uint16_t +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Fri Aug 24 16:57:54 2007 -0700 +@@ -174,9 +174,12 @@ public: + uint32_t AddInterface (Ptr device); + Ipv4Interface * GetInterface (uint32_t i) const; + uint32_t GetNInterfaces (void) const; ++ ++ uint32_t FindInterfaceForAddr (Ipv4Address addr) const; ++ uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; + +- virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); +- virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + + void SetAddress (uint32_t i, Ipv4Address address); + void SetNetworkMask (uint32_t i, Ipv4Mask mask); +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Fri Aug 24 16:57:54 2007 -0700 +@@ -230,6 +230,20 @@ Ipv4StaticRouting::GetNRoutes (void) + n += m_networkRoutes.size (); + return n; + } ++ ++Ipv4Route * ++Ipv4StaticRouting::GetDefaultRoute () ++{ ++ if (m_defaultRoute != 0) ++ { ++ return m_defaultRoute; ++ } ++ else ++ { ++ return 0; ++ } ++} ++ + Ipv4Route * + Ipv4StaticRouting::GetRoute (uint32_t index) + { +@@ -331,14 +345,37 @@ Ipv4StaticRouting::RequestRoute ( + + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << + ipHeader.GetDestination ()); +-// +-// First, see if this is a multicast packet we have a route for. If we +-// have a route, then send the packet down each of the specified interfaces. +-// ++ + if (ipHeader.GetDestination ().IsMulticast ()) + { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); +- ++// ++// We have a multicast packet we're going to send. There are two distinct ++// cases we need to support. The first is if the current node is the source ++// of the packet. In that case, we don't want to have to consult multicast ++// routing tables (nor build them) in order to send multicasts. The interface ++// index (ifIndex) is Ipv4RoutingProtocol::IF_INDEX_ANY if we're the source. ++// ++// The second case is if the current packet has gotten to us by being ++// received over one of our interfaces. In this case, ifIndex is set to the ++// index over which we received the packet. For these packets, we need to ++// consult the multicast routing table for a disposition. ++// ++// So, first let's see if we're the source. In this case, we don't consult ++// the routing tables, but just return false and let the caller (up in ++// ipv4-l3-protocol) flood the multicast packet out of all of its interfaces. ++// We can't really do it here even if we wanted to since we have no easy way ++// to get to the Ipv4 interface which we would need. ++// ++ if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) ++ { ++ return false; ++ } ++// ++// If we fall through to this point, we have a multicast packet that has ++// not originated at this node. We need to deal with forwarding. Let's ++// see if we have a route, and if so go ahead and forward this puppy. ++// + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), + ipHeader.GetDestination (), ifIndex); + +@@ -349,14 +386,15 @@ Ipv4StaticRouting::RequestRoute ( + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; ++ Ipv4Header h = ipHeader; + Ipv4Route route = +- Ipv4Route::CreateHostRouteTo(ipHeader.GetDestination (), ++ Ipv4Route::CreateHostRouteTo(h.GetDestination (), + mRoute->GetOutputInterface(i)); + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " + "Send via interface " << mRoute->GetOutputInterface(i)); +- routeReply (true, route, p, ipHeader); +- return true; +- } ++ routeReply (true, route, p, h); ++ } ++ return true; + } + return false; // Let other routing protocols try to handle this + } +diff -r 4743aef86605 -r c77745b2731c src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Fri Aug 24 16:57:54 2007 -0700 +@@ -74,6 +74,7 @@ public: + void SetDefaultRoute (Ipv4Address nextHop, + uint32_t interface); + uint32_t GetNRoutes (void); ++ Ipv4Route *GetDefaultRoute (void); + Ipv4Route *GetRoute (uint32_t i); + void RemoveRoute (uint32_t i); + +diff -r 4743aef86605 -r c77745b2731c src/internet-node/udp-socket.cc +--- a/src/internet-node/udp-socket.cc Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/internet-node/udp-socket.cc Fri Aug 24 16:57:54 2007 -0700 +@@ -182,10 +182,11 @@ UdpSocket::Connect(const Address & addre + NotifyConnectionSucceeded (); + m_connected = true; + ++ NS_DEBUG ("UdpSocket::Connect (): Updating local address"); + Ptr ipv4; + ipv4 = m_node->QueryInterface (Ipv4::iid); + m_endPoint->SetLocalAddress (ipv4->GetSourceAddress(m_defaultAddress)); +- NS_DEBUG ("UdpSocket::Connect (): Local address is" << ++ NS_DEBUG ("UdpSocket::Connect (): Local address is " << + m_endPoint->GetLocalAddress()); + return 0; + } +@@ -214,9 +215,9 @@ UdpSocket::DoSendTo (const Packet &p, co + } + + int +-UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) +-{ +- NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << ipv4 << ", " << ++UdpSocket::DoSendTo (const Packet &p, Ipv4Address addr, uint16_t port) ++{ ++ NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << addr << ", " << + port << ")"); + + if (m_endPoint == 0) +@@ -234,9 +235,16 @@ UdpSocket::DoSendTo (const Packet &p, Ip + return -1; + } + ++ NS_DEBUG ("UdpSocket::DoSendTo (): Finding source address"); ++ Ptr ipv4; ++ ipv4 = m_node->QueryInterface (Ipv4::iid); ++ ++ Ipv4Address source = ipv4->GetSourceAddress(m_defaultAddress); ++ NS_DEBUG ("UdpSocket::DoSendTo (): Source address is " << source); ++ + NS_DEBUG("UdpSocket::DoSendTo (): Send to UDP"); +- m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, +- m_endPoint->GetLocalPort (), port); ++ m_udp->Send (p, source, addr, m_endPoint->GetLocalPort (), port); ++ + NotifyDataSent (p.GetSize ()); + return 0; + } +@@ -245,11 +253,13 @@ UdpSocket::SendTo(const Address &address + UdpSocket::SendTo(const Address &address, const Packet &p) + { + NS_DEBUG("UdpSocket::SendTo (" << address << ", " << &p << ")"); ++#if 0 + if (m_connected) + { + m_errno = ERROR_ISCONN; + return -1; + } ++#endif + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + Ipv4Address ipv4 = transport.GetIpv4 (); + uint16_t port = transport.GetPort (); +diff -r 4743aef86605 -r c77745b2731c src/node/ipv4.h +--- a/src/node/ipv4.h Fri Aug 24 13:29:51 2007 -0700 ++++ b/src/node/ipv4.h Fri Aug 24 16:57:54 2007 -0700 +@@ -275,6 +275,36 @@ public: + virtual uint32_t GetNInterfaces (void) = 0; + + /** ++ * \brief Find and return the interface ID of the interface that has been ++ * assigned the specified IP address. ++ * \param addr The IP address assigned to the interface of interest. ++ * \returns The index of the ipv4 interface with the given address. ++ * ++ * Each IP interface has an IP address associated with it. It is often ++ * useful to search the list of interfaces for one that corresponds to ++ * a known IP Address. This call takes an IP address as a parameter and ++ * returns the interface index of the first interface that has been assigned ++ * that address. If the address is not found, this function asserts. ++ */ ++ virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0; ++ ++ /** ++ * \brief Find and return the interface ID of the interface that has been ++ * assigned the specified (masked) IP address. ++ * \param addr The IP address assigned to the interface of interest. ++ * \param mask The address mask to be used in address matching. ++ * \returns The index of the ipv4 interface with the given address. ++ * ++ * Each IP interface has an IP address associated with it. It is often ++ * useful to search the list of interfaces for one that corresponds to ++ * a known IP Address. This call takes an IP address and an IP address ++ * mask as parameters and returns the interface index of the first interface ++ * that matches the masked IP address. ++ */ ++ virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, ++ Ipv4Mask mask) const = 0; ++ ++ /** + * \param i index of ipv4 interface + * \returns the NetDevice associated with the ipv4 interface index + */ + +changeset: 1313:d6f8a7546e7f +user: Craig Dowell +date: Fri Aug 24 17:38:49 2007 -0700 +summary: semi-real multicast hardware addresses + +diff -r c77745b2731c -r d6f8a7546e7f src/devices/csma/csma-net-device.cc +--- a/src/devices/csma/csma-net-device.cc Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/devices/csma/csma-net-device.cc Fri Aug 24 17:38:49 2007 -0700 +@@ -132,7 +132,7 @@ CsmaNetDevice::Init(bool sendEnable, boo + m_queue = 0; + + EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); +- EnableMulticast(); ++ EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); + + SetSendEnable (sendEnable); + SetReceiveEnable (receiveEnable); +@@ -500,10 +500,11 @@ CsmaNetDevice::Receive (const Packet& pa + EthernetHeader header (false); + EthernetTrailer trailer; + Eui48Address broadcast; ++ Eui48Address multicast; + Eui48Address destination; + Packet p = packet; + +- NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")"); ++ NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid()); + + // Only receive if send side of net device is enabled + if (!IsReceiveEnabled()) +@@ -522,12 +523,25 @@ CsmaNetDevice::Receive (const Packet& pa + trailer.CheckFcs(p); + p.RemoveHeader(header); + ++ NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " << ++ header.GetDestination ()); ++// ++// XXX BUGBUG ++// ++// An IP host group address is mapped to an Ethernet multicast address ++// by placing the low-order 23-bits of the IP address into the low-order ++// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). ++// ++// Need to mask off the appropriate multicast bits. ++// ++ multicast = Eui48Address::ConvertFrom (GetMulticast ()); + broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); + destination = Eui48Address::ConvertFrom (GetAddress ()); + if ((header.GetDestination() != broadcast) && ++ (header.GetDestination() != multicast) && + (header.GetDestination() != destination)) + { +- // not for us. ++ NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt "); + m_dropTrace (p); + return; + } +diff -r c77745b2731c -r d6f8a7546e7f src/devices/point-to-point/point-to-point-net-device.cc +--- a/src/devices/point-to-point/point-to-point-net-device.cc Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/devices/point-to-point/point-to-point-net-device.cc Fri Aug 24 17:38:49 2007 -0700 +@@ -68,11 +68,14 @@ PointToPointNetDevice::PointToPointNetDe + { + NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")"); + +- // BUGBUG FIXME +- // +- // You _must_ support broadcast to get any sort of packet from the ARP layer. ++// BUGBUG FIXME ++// ++// You _must_ support broadcast to get any sort of packet from the ARP layer. + EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); +- EnableMulticast(); ++// ++// Randomly pick the ethernet multicast address base ++// ++ EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); + EnablePointToPoint(); + } + +diff -r c77745b2731c -r d6f8a7546e7f src/internet-node/arp-ipv4-interface.cc +--- a/src/internet-node/arp-ipv4-interface.cc Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.cc Fri Aug 24 17:38:49 2007 -0700 +@@ -84,9 +84,18 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4 + else if (dest.IsMulticast ()) + { + NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast"); +- // XXX BUGBUG +- // Need real multicast addresses +- hardwareDestination = GetDevice ()->GetBroadcast (); ++ NS_ASSERT_MSG(GetDevice ()->IsMulticast (), ++ "ArpIpv4Interface::SendTo (): Sending multicast packet over " ++ "non-multicast device"); ++// XXX ++// ++// An IP host group address is mapped to an Ethernet multicast address ++// by placing the low-order 23-bits of the IP address into the low-order ++// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). ++// ++// Currently no easy way to or bit from Ipv4Address into Address ++// ++ hardwareDestination = GetDevice ()->GetMulticast (); + found = true; + } + else +diff -r c77745b2731c -r d6f8a7546e7f src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Fri Aug 24 17:38:49 2007 -0700 +@@ -288,12 +288,13 @@ Ipv4L3Protocol::Lookup ( + // want to force users to construct a route in order to get packets out of a + // node, so there will have been no route found and it is left to us to send + // the packet. What we'll do is to send the multicast out all of the +-// interfaces on this node. ++// interfaces on this node. Note that we start with interface 1 since we ++// don't particularly want to send the packet out the loopback. + // + NS_DEBUG ("Ipv4StaticRouting::Lookup (): " + "Local source. Flooding multicast packet"); + +- for (uint32_t i = 0; i < GetNInterfaces (); ++i) ++ for (uint32_t i = 1; i < GetNInterfaces (); ++i) + { + Packet p = packet; + Ipv4Header h = ipHeader; +diff -r c77745b2731c -r d6f8a7546e7f src/node/net-device.cc +--- a/src/node/net-device.cc Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/node/net-device.cc Fri Aug 24 17:38:49 2007 -0700 +@@ -113,6 +113,7 @@ NetDevice::IsBroadcast (void) const + { + return m_isBroadcast; + } ++ + Address const & + NetDevice::GetBroadcast (void) const + { +@@ -139,10 +140,18 @@ NetDevice::IsMulticast (void) const + return m_isMulticast; + } + +-void +-NetDevice::EnableMulticast (void) ++Address const & ++NetDevice::GetMulticast (void) const ++{ ++ NS_ASSERT (m_isMulticast); ++ return m_multicast; ++} ++ ++void ++NetDevice::EnableMulticast (Address multicast) + { + m_isMulticast = true; ++ m_multicast = multicast; + } + + void +diff -r c77745b2731c -r d6f8a7546e7f src/node/net-device.h +--- a/src/node/net-device.h Fri Aug 24 16:57:54 2007 -0700 ++++ b/src/node/net-device.h Fri Aug 24 17:38:49 2007 -0700 +@@ -138,10 +138,21 @@ public: + * not true. + */ + Address const &GetBroadcast (void) const; ++ + /** + * \return value of m_isMulticast flag + */ + bool IsMulticast (void) const; ++ ++ /** ++ * \return the multicast address supported by ++ * this netdevice. ++ * ++ * Calling this method is invalid if IsMulticast returns ++ * not true. ++ */ ++ Address const &GetMulticast (void) const; ++ + /** + * \return value of m_isPointToPoint flag + */ +@@ -212,9 +223,10 @@ public: + */ + void DisableBroadcast (void); + /** +- * Set m_isMulticast flag to true +- */ +- void EnableMulticast (void); ++ * Enable multicast support. This method should be ++ * called by subclasses from their constructor ++ */ ++ void EnableMulticast (Address multicast); + /** + * Set m_isMulticast flag to false + */ +@@ -303,6 +315,7 @@ public: + uint16_t m_ifIndex; + Address m_address; + Address m_broadcast; ++ Address m_multicast; + uint16_t m_mtu; + bool m_isUp; + bool m_isBroadcast; + +changeset: 1314:bb5cf98c0c64 +user: Craig Dowell +date: Mon Aug 27 23:46:14 2007 -0700 +summary: real multicast enet addr, more source routes, default multicast route + +diff -r d6f8a7546e7f -r bb5cf98c0c64 examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/examples/csma-multicast.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -98,7 +98,6 @@ main (int argc, char *argv[]) + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); +- + // + // Set up default values for the simulation. Use the DefaultValue::Bind() + // technique to tell the system what subclass of Queue to use. The Bind +@@ -200,10 +199,11 @@ main (int argc, char *argv[]) + // earlier. We need to define a multicast group to send packets to. This + // can be any multicast address from 224.0.0.0 through 239.255.255.255 + // (avoiding the reserved routing protocol addresses). We just pick a +-// convenient number. ++// convenient number (225.0.0.0) and or in some bits to let us verify that ++// correct Ethernet multicast addresses are constructed down in the system. + // + Ipv4Address multicastSource ("10.1.1.1"); +- Ipv4Address multicastGroup ("225.0.0.0"); ++ Ipv4Address multicastGroup ("225.1.2.4"); + // + // We are going to manually configure multicast routing. This means telling + // node two that it should expect multicast data coming from IP address +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/devices/csma/csma-channel.cc +--- a/src/devices/csma/csma-channel.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/devices/csma/csma-channel.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -250,7 +250,7 @@ CsmaChannel::TransmitEnd() + } + + NS_DEBUG ("CsmaChannel::TransmitEnd (): Schedule event in " << +- m_delay.GetSeconds () << "sec"); ++ m_delay.GetSeconds () << " sec"); + + Simulator::Schedule (m_delay, + &CsmaChannel::PropagationCompleteEvent, +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/devices/csma/csma-net-device.cc +--- a/src/devices/csma/csma-net-device.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/devices/csma/csma-net-device.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -526,20 +526,29 @@ CsmaNetDevice::Receive (const Packet& pa + NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " << + header.GetDestination ()); + // +-// XXX BUGBUG +-// + // An IP host group address is mapped to an Ethernet multicast address + // by placing the low-order 23-bits of the IP address into the low-order + // 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). + // +-// Need to mask off the appropriate multicast bits. +-// ++// We are going to receive all packets destined to any multicast address, ++// which means clearing the low-order 23 bits the header destination ++// ++ Eui48Address mcDest; ++ uint8_t mcBuf[6]; ++ ++ header.GetDestination ().CopyTo (mcBuf); ++ mcBuf[3] &= 0x80; ++ mcBuf[4] = 0; ++ mcBuf[5] = 0; ++ mcDest.CopyFrom (mcBuf); ++ + multicast = Eui48Address::ConvertFrom (GetMulticast ()); + broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); + destination = Eui48Address::ConvertFrom (GetAddress ()); +- if ((header.GetDestination() != broadcast) && +- (header.GetDestination() != multicast) && +- (header.GetDestination() != destination)) ++ ++ if ((header.GetDestination () != broadcast) && ++ (mcDest != multicast) && ++ (header.GetDestination () != destination)) + { + NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt "); + m_dropTrace (p); +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/arp-ipv4-interface.cc +--- a/src/internet-node/arp-ipv4-interface.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -61,6 +61,74 @@ ArpIpv4Interface::DoCreateTraceResolver + return resolver; + } + ++// ++// RFC 1112 says that an IP host group address is mapped to an Ethernet ++// multicast address by placing the low-order 23-bits of the IP address into ++// the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 ++// (hex). These are completely different animals and they're encapsulated ++// very nicely. Translation: This isn't going to be very pretty. ++// ++Address ++ArpIpv4Interface::MakeMulticastAddress(Ipv4Address multicastGroup) ++{ ++ NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (" << multicastGroup << ++ ")"); ++// ++// First, get the generic multicast address from the device. Since it is ++// connected to this object, and this object is an IPV4 stack, we hope that ++// it is really an Eui48Address. If it's not, then we don't know what to do. ++// ++ Address hardwareDestination = GetDevice ()->GetMulticast (); ++ ++ NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " ++ "Device multicast address: " << hardwareDestination); ++ ++ Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); ++// ++// We now have the multicast address in an abstract 48-bit container. We ++// need to pull it out so we can play with it. When we're done, we have the ++// high order bits in etherBuffer[0], etc. ++// ++ uint8_t etherBuffer[6]; ++ etherAddr.CopyTo (etherBuffer); ++// ++// If the device is playing the game correctly, the low order 23 bits of the ++// multicast base address will be zero. ++// ++ NS_ASSERT_MSG((etherBuffer[4] & 0x7f) == 0, ++ "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); ++ NS_ASSERT_MSG(etherBuffer[5] == 0, ++ "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); ++ NS_ASSERT_MSG(etherBuffer[6] == 0, ++ "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); ++// ++// Now we need to pull the raw bits out of the Ipv4 destination address. ++// ++ uint8_t ipBuffer[4]; ++ multicastGroup.Serialize (ipBuffer); ++// ++// We need to place the low order 23 bits of the IP address into the low order ++// 23 bits of the ethernet address. ++// ++ etherBuffer[3] |= ipBuffer[1] & 0x7f; ++ etherBuffer[4] = ipBuffer[2]; ++ etherBuffer[5] = ipBuffer[3]; ++// ++// Now, etherBuffer has the desired ethernet multicast address. We have to ++// suck these bits back into the Eui48Address; and then suck those bits back ++// into the abstract hardwareAddress. ++// ++ etherAddr.CopyFrom (etherBuffer); ++// ++// Implicit conversion (operator Address ()) is defined for Eui48Address, so ++// use it. ++// ++ NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " ++ "multicast address is " << etherAddr); ++ ++ return etherAddr; ++} ++ + void + ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) + { +@@ -87,15 +155,8 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4 + NS_ASSERT_MSG(GetDevice ()->IsMulticast (), + "ArpIpv4Interface::SendTo (): Sending multicast packet over " + "non-multicast device"); +-// XXX +-// +-// An IP host group address is mapped to an Ethernet multicast address +-// by placing the low-order 23-bits of the IP address into the low-order +-// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). +-// +-// Currently no easy way to or bit from Ipv4Address into Address +-// +- hardwareDestination = GetDevice ()->GetMulticast (); ++ ++ hardwareDestination = MakeMulticastAddress(dest); + found = true; + } + else +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/arp-ipv4-interface.h +--- a/src/internet-node/arp-ipv4-interface.h Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.h Mon Aug 27 23:46:14 2007 -0700 +@@ -24,6 +24,7 @@ + + #include "ipv4-interface.h" + #include "ns3/ptr.h" ++#include "ns3/eui48-address.h" + + namespace ns3 { + +@@ -46,6 +47,7 @@ class ArpIpv4Interface : public Ipv4Inte + virtual void SendTo (Packet p, Ipv4Address dest); + virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); + Ptr m_node; ++ Address MakeMulticastAddress (Ipv4Address multicastGroup); + }; + + }//namespace ns3 +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -105,6 +105,16 @@ Ipv4Impl::AddMulticastRoute (Ipv4Address + m_ipv4->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); + } + ++void ++Ipv4Impl::SetDefaultMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ m_ipv4->SetDefaultMulticastRoute (origin, group, inputInterface, ++ outputInterfaces); ++} ++ + uint32_t + Ipv4Impl::GetNMulticastRoutes (void) const + { +@@ -208,6 +218,9 @@ Ipv4Impl::GetSourceAddress (Ipv4Address + } + else + { ++// ++// If we can't find any address, just leave it 0.0.0.0 ++// + return Ipv4Address::GetAny (); + } + } +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-impl.h +--- a/src/internet-node/ipv4-impl.h Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-impl.h Mon Aug 27 23:46:14 2007 -0700 +@@ -62,6 +62,10 @@ public: + uint32_t inputInterface, + std::vector outputInterfaces); + ++ virtual void SetDefaultMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, uint32_t inputInterface, ++ std::vector outputInterfaces); ++ + virtual uint32_t GetNMulticastRoutes (void) const; + virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; + +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -352,6 +352,20 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4A + group << ", " << inputInterface << ", " << &outputInterfaces << ")"); + + m_staticRouting->AddMulticastRoute (origin, group, inputInterface, ++ outputInterfaces); ++} ++ ++void ++Ipv4L3Protocol::SetDefaultMulticastRoute ( ++ Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << origin << ", " << ++ group << ", " << inputInterface << ", " << &outputInterfaces << ")"); ++ ++ m_staticRouting->SetDefaultMulticastRoute (origin, group, inputInterface, + outputInterfaces); + } + +@@ -768,7 +782,11 @@ Ipv4L3Protocol::GetIfIndexForDestination + { + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (" << destination << + ", " << &ifIndex << ")"); +- ++// ++// The first thing we do in trying to determine a source address is to ++// consult the routing protocols. These will also check for a default route ++// if one has been set. ++// + for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); + i != m_routingProtocols.end (); + i++) +@@ -785,13 +803,13 @@ Ipv4L3Protocol::GetIfIndexForDestination + } + } + // +-// If there's no routing table entry telling us what single interface will be +-// used to send a packet to this destination, we'll have to just pick one. ++// If there's no routing table entry telling us what *single* interface will ++// be used to send a packet to this destination, we'll have to just pick one. + // If there's only one interface on this node, a good answer isn't very hard + // to come up with. Before jumping to any conclusions, remember that the + // zeroth interface is the loopback interface, so what we actually want is + // a situation where there are exactly two interfaces on the node, in which +-// case interface one is the "single" interface. ++// case interface one is the "single" interface connected to the outside world. + // + if (GetNInterfaces () == 2) + { +@@ -802,11 +820,21 @@ Ipv4L3Protocol::GetIfIndexForDestination + } + // + // If we fall through to here, we have a node with multiple interfaces and +-// no routes to guide us in determining what interface to choose. The last +-// choice is to use the one set in the default route. +-// ++// no routes to guide us in determining what interface to choose. Either ++// no default route was found (for unicast or multicast), or in the case of a ++// multicast, the default route contained multiple outbound interfaces. ++// ++// The fallback position is to just get the unicast default route and use ++// the outgoing interface specified there. We don't want to leave the source ++// address unset, so we just assert here. ++// ++// N.B. that in the case of a multicast with a route containing multiple ++// outgoing interfaces, the source address of packets from that node will be ++// set to the IP address of the interface set in the default unicast route. ++// Also, in the case of a broadcast, the same will be true. ++// + NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " +- "Using default route"); ++ "Using default unicast route"); + Ipv4Route *route = m_staticRouting->GetDefaultRoute (); + + NS_ASSERT_MSG(route, +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Mon Aug 27 23:46:14 2007 -0700 +@@ -163,6 +163,11 @@ public: + uint32_t inputInterface, + std::vector outputInterfaces); + ++ void SetDefaultMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces); ++ + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Mon Aug 27 23:46:14 2007 -0700 +@@ -26,6 +26,11 @@ NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRo + NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); + + namespace ns3 { ++ ++Ipv4StaticRouting::Ipv4StaticRouting () ++: m_defaultRoute (0), m_defaultMulticastRoute (0) ++{ ++} + + void + Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, +@@ -95,10 +100,24 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv + m_multicastRoutes.push_back (route); + } + ++void ++Ipv4StaticRouting::SetDefaultMulticastRoute( ++ Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++{ ++ Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); ++ *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, ++ inputInterface, outputInterfaces); ++ delete m_defaultMulticastRoute; ++ m_defaultMulticastRoute = route; ++} ++ + uint32_t + Ipv4StaticRouting::GetNMulticastRoutes (void) const + { +- return m_multicastRoutes.size (); ++ return m_multicastRoutes.size () + m_defaultMulticastRoute ? 1 : 0; + } + + Ipv4MulticastRoute * +@@ -106,17 +125,54 @@ Ipv4StaticRouting::GetMulticastRoute (ui + { + NS_ASSERT_MSG(index < m_multicastRoutes.size (), + "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); +- +- uint32_t tmp = 0; +- for (MulticastRoutesCI i = m_multicastRoutes.begin (); +- i != m_multicastRoutes.end (); +- i++) +- { +- if (tmp == index) +- { +- return *i; +- } +- tmp++; ++// ++// From an external point of view the default route appears to be in slot 0 ++// of the routing table. The implementation, however, puts it in a separate ++// place. So, if a client asks for index 0 and we have a default multicast ++// route, we have to return it from that different place ++// (m_defaultMulticastRoute). ++// ++ if (index == 0 && m_defaultMulticastRoute != 0) ++ { ++ return m_defaultMulticastRoute; ++ } ++// ++// If there is a default multicast route present, a client will just assume ++// that it is in slot zero and there is one "extra" zeroth route in the table. ++// To return the correct indexed entry in our list, we have to decrement the ++// index to take into account the default route not being in the actual list. ++// Since we fell through to here, we've taken care of the case where the ++// index was zero. ++// ++ if (m_defaultMulticastRoute != 0) ++ { ++ NS_ASSERT(index > 0); ++ index--; ++ } ++ ++ if (index < m_multicastRoutes.size ()) ++ { ++ uint32_t tmp = 0; ++ for (MulticastRoutesCI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ if (tmp == index) ++ { ++ return *i; ++ } ++ tmp++; ++ } ++ } ++ return 0; ++} ++ ++Ipv4MulticastRoute * ++Ipv4StaticRouting::GetDefaultMulticastRoute () const ++{ ++ if (m_defaultMulticastRoute != 0) ++ { ++ return m_defaultMulticastRoute; + } + return 0; + } +@@ -126,6 +182,9 @@ Ipv4StaticRouting::RemoveMulticastRoute( + Ipv4Address group, + uint32_t inputInterface) + { ++// ++// This method does not attempt to delete the multicast route. ++// + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) +@@ -145,6 +204,32 @@ void + void + Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) + { ++// ++// From an external point of view the default route appears to be in slot 0 ++// of the routing table. The implementation, however, puts it in a separate ++// place. So, if a client asks to delete index 0 and we have a default ++// multicast route set, we have to delete it from that different place ++// (m_defaultMulticastRoute). ++// ++ if (index == 0 && m_defaultMulticastRoute != 0) ++ { ++ delete m_defaultMulticastRoute; ++ m_defaultMulticastRoute = 0; ++ } ++// ++// If there is a default multicast route present, a client will just assume ++// that it is in slot zero and there is one "extra" zeroth route in the table. ++// To return the correct indexed entry in our list, we have to decrement the ++// index to take into account the default route not being in the actual list. ++// Since we fell through to here, we've taken care of the case where the ++// index was zero. ++// ++ if (m_defaultMulticastRoute != 0) ++ { ++ NS_ASSERT(index > 0); ++ index--; ++ } ++ + uint32_t tmp = 0; + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); +@@ -215,6 +300,12 @@ Ipv4StaticRouting::LookupStatic ( + } + } + } ++ ++ if (m_defaultMulticastRoute != 0) ++ { ++ return m_defaultMulticastRoute; ++ } ++ + return 0; + } + +@@ -492,6 +583,11 @@ Ipv4StaticRouting::DoDispose (void) + { + delete (*i); + } ++ if (m_defaultMulticastRoute != 0) ++ { ++ delete m_defaultMulticastRoute; ++ m_defaultMulticastRoute = 0; ++ } + Ipv4RoutingProtocol::DoDispose (); + } + +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Mon Aug 27 23:46:14 2007 -0700 +@@ -49,7 +49,7 @@ class Ipv4StaticRouting : public Ipv4Rou + { + + public: +- Ipv4StaticRouting () : m_defaultRoute (0) {} ++ Ipv4StaticRouting (); + + virtual bool RequestRoute (uint32_t ifIndex, + Ipv4Header const &ipHeader, +@@ -83,8 +83,14 @@ public: + uint32_t inputInterface, + std::vector outputInterfaces); + ++ void SetDefaultMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces); ++ + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; ++ Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; + + void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, +@@ -114,6 +120,7 @@ private: + HostRoutes m_hostRoutes; + NetworkRoutes m_networkRoutes; + Ipv4Route *m_defaultRoute; ++ Ipv4MulticastRoute *m_defaultMulticastRoute; + MulticastRoutes m_multicastRoutes; + }; + +diff -r d6f8a7546e7f -r bb5cf98c0c64 src/node/ipv4.h +--- a/src/node/ipv4.h Fri Aug 24 17:38:49 2007 -0700 ++++ b/src/node/ipv4.h Mon Aug 27 23:46:14 2007 -0700 +@@ -244,6 +244,19 @@ public: + uint32_t inputInterface) = 0; + + /** ++ * \brief Set the default static multicast route for a given multicast ++ * source and group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ * \param inputInterface The interface index over which the packet arrived. ++ * \param outputInterfaces The list of output interface indices over which ++ * the packet should be sent (excluding the inputInterface). ++ */ ++ virtual void SetDefaultMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, uint32_t inputInterface, ++ std::vector outputInterfaces) = 0; ++ /** + * \returns the number of entries in the multicast routing table. + */ + virtual uint32_t GetNMulticastRoutes (void) const = 0; + +changeset: 1315:580ed7a4dd1e +user: Craig Dowell +date: Wed Aug 29 12:11:11 2007 -0700 +summary: Move MakeMulticastAddress to NetDevice + +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/devices/csma/csma-net-device.cc +--- a/src/devices/csma/csma-net-device.cc Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/devices/csma/csma-net-device.cc Wed Aug 29 12:11:11 2007 -0700 +@@ -19,8 +19,6 @@ + * Author: Emmanuelle Laprise + */ + +-#include +-#include + #include "ns3/debug.h" + #include "ns3/queue.h" + #include "ns3/simulator.h" +@@ -60,7 +58,6 @@ CsmaTraceType::GetUid (void) + return uid; + } + +- + CsmaNetDevice::CsmaNetDevice (Ptr node) + : NetDevice (node, Eui48Address::Allocate ()), + m_bps (DataRate (0xffffffff)) +@@ -71,7 +68,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr + } + + CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, +- CsmaEncapsulationMode encapMode) ++ CsmaEncapsulationMode encapMode) + : NetDevice(node, addr), + m_bps (DataRate (0xffffffff)) + { +@@ -82,8 +79,8 @@ CsmaNetDevice::CsmaNetDevice (Ptr + } + + CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, +- CsmaEncapsulationMode encapMode, +- bool sendEnable, bool receiveEnable) ++ CsmaEncapsulationMode encapMode, ++ bool sendEnable, bool receiveEnable) + : NetDevice(node, addr), + m_bps (DataRate (0xffffffff)) + { +@@ -582,6 +579,61 @@ CsmaNetDevice::Receive (const Packet& pa + return; + } + ++Address ++CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const ++{ ++ NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (" << multicastGroup << ++ ")"); ++// ++// First, get the generic multicast address. ++// ++ Address hardwareDestination = GetMulticast (); ++ ++ NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " ++ "Device multicast address: " << hardwareDestination); ++// ++// It's our address, and we know we're playing with an EUI-48 address here ++// primarily since we know that by construction, but also since the parameter ++// is an Ipv4Address. ++// ++ Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); ++// ++// We now have the multicast address in an abstract 48-bit container. We ++// need to pull it out so we can play with it. When we're done, we have the ++// high order bits in etherBuffer[0], etc. ++// ++ uint8_t etherBuffer[6]; ++ etherAddr.CopyTo (etherBuffer); ++// ++// Now we need to pull the raw bits out of the Ipv4 destination address. ++// ++ uint8_t ipBuffer[4]; ++ multicastGroup.Serialize (ipBuffer); ++// ++// RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 ++// multicast address by placing the low-order 23-bits of the IP address into ++// the low-order 23 bits of the Ethernet multicast address ++// 01-00-5E-00-00-00 (hex). ++// ++ etherBuffer[3] |= ipBuffer[1] & 0x7f; ++ etherBuffer[4] = ipBuffer[2]; ++ etherBuffer[5] = ipBuffer[3]; ++// ++// Now, etherBuffer has the desired ethernet multicast address. We have to ++// suck these bits back into the Eui48Address, ++// ++ etherAddr.CopyFrom (etherBuffer); ++// ++// Implicit conversion (operator Address ()) is defined for Eui48Address, so ++// use it by just returning the EUI-48 address which is automagically converted ++// to an Address. ++// ++ NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " ++ "multicast address is " << etherAddr); ++ ++ return etherAddr; ++} ++ + Ptr + CsmaNetDevice::GetQueue(void) const + { +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/devices/csma/csma-net-device.h +--- a/src/devices/csma/csma-net-device.h Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/devices/csma/csma-net-device.h Wed Aug 29 12:11:11 2007 -0700 +@@ -197,6 +197,37 @@ enum CsmaEncapsulationMode { + */ + void Receive (const Packet& p); + ++ /** ++ * @brief Make and return a MAC multicast address using the provided ++ * multicast group ++ * ++ * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet ++ * multicast address by placing the low-order 23-bits of the IP address into ++ * the low-order 23 bits of the Ethernet multicast address ++ * 01-00-5E-00-00-00 (hex). ++ * ++ * This method performs the multicast address creation function appropriate ++ * to an EUI-48-based CSMA device. This MAC address is encapsulated in an ++ * abstract Address to avoid dependencies on the exact address format. ++ * ++ * A default imlementation of MakeMulticastAddress is provided, but this ++ * method simply NS_ASSERTS. In the case of net devices that do not support ++ * multicast, clients are expected to test NetDevice::IsMulticast and avoid ++ * attempting to map multicast packets. Subclasses of NetDevice that do ++ * support multicasting are expected to override this method and provide an ++ * implementation appropriate to the particular device. ++ * ++ * @param multicastGroup The IP address for the multicast group destination ++ * of the packet. ++ * @return The MAC multicast Address used to send packets to the provided ++ * multicast group. ++ * ++ * @see Ipv4Address ++ * @see Eui48Address ++ * @see Address ++ */ ++ Address MakeMulticastAddress (Ipv4Address multicastGroup) const; ++ + bool IsSendEnabled (void); + bool IsReceiveEnabled (void); + +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/devices/point-to-point/point-to-point-net-device.cc +--- a/src/devices/point-to-point/point-to-point-net-device.cc Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/devices/point-to-point/point-to-point-net-device.cc Wed Aug 29 12:11:11 2007 -0700 +@@ -20,8 +20,6 @@ + * Revised: George Riley + */ + +-#include +-#include + #include "ns3/debug.h" + #include "ns3/queue.h" + #include "ns3/simulator.h" +@@ -73,7 +71,7 @@ PointToPointNetDevice::PointToPointNetDe + // You _must_ support broadcast to get any sort of packet from the ARP layer. + EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); + // +-// Randomly pick the ethernet multicast address base ++// We want to allow multicast packets to flow across this link + // + EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); + EnablePointToPoint(); +@@ -214,6 +212,8 @@ bool PointToPointNetDevice::Attach (Ptr< + m_bps = m_channel->GetDataRate (); + // GFR Comment. Below is definitely wrong. Interframe gap + // is unrelated to channel delay. ++ // -- unlesss you want to introduce a default gap which is there to avoid ++ // parts of multiple packets flowing on the "wire" at the same time. + //m_tInterframeGap = m_channel->GetDelay (); + + /* +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/internet-node/arp-ipv4-interface.cc +--- a/src/internet-node/arp-ipv4-interface.cc Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.cc Wed Aug 29 12:11:11 2007 -0700 +@@ -61,74 +61,6 @@ ArpIpv4Interface::DoCreateTraceResolver + return resolver; + } + +-// +-// RFC 1112 says that an IP host group address is mapped to an Ethernet +-// multicast address by placing the low-order 23-bits of the IP address into +-// the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 +-// (hex). These are completely different animals and they're encapsulated +-// very nicely. Translation: This isn't going to be very pretty. +-// +-Address +-ArpIpv4Interface::MakeMulticastAddress(Ipv4Address multicastGroup) +-{ +- NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (" << multicastGroup << +- ")"); +-// +-// First, get the generic multicast address from the device. Since it is +-// connected to this object, and this object is an IPV4 stack, we hope that +-// it is really an Eui48Address. If it's not, then we don't know what to do. +-// +- Address hardwareDestination = GetDevice ()->GetMulticast (); +- +- NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " +- "Device multicast address: " << hardwareDestination); +- +- Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); +-// +-// We now have the multicast address in an abstract 48-bit container. We +-// need to pull it out so we can play with it. When we're done, we have the +-// high order bits in etherBuffer[0], etc. +-// +- uint8_t etherBuffer[6]; +- etherAddr.CopyTo (etherBuffer); +-// +-// If the device is playing the game correctly, the low order 23 bits of the +-// multicast base address will be zero. +-// +- NS_ASSERT_MSG((etherBuffer[4] & 0x7f) == 0, +- "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); +- NS_ASSERT_MSG(etherBuffer[5] == 0, +- "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); +- NS_ASSERT_MSG(etherBuffer[6] == 0, +- "ArpIpv4Interface::SendTo (): Expected low order bits zeroed"); +-// +-// Now we need to pull the raw bits out of the Ipv4 destination address. +-// +- uint8_t ipBuffer[4]; +- multicastGroup.Serialize (ipBuffer); +-// +-// We need to place the low order 23 bits of the IP address into the low order +-// 23 bits of the ethernet address. +-// +- etherBuffer[3] |= ipBuffer[1] & 0x7f; +- etherBuffer[4] = ipBuffer[2]; +- etherBuffer[5] = ipBuffer[3]; +-// +-// Now, etherBuffer has the desired ethernet multicast address. We have to +-// suck these bits back into the Eui48Address; and then suck those bits back +-// into the abstract hardwareAddress. +-// +- etherAddr.CopyFrom (etherBuffer); +-// +-// Implicit conversion (operator Address ()) is defined for Eui48Address, so +-// use it. +-// +- NS_DEBUG ("ArpIpv4Interface::MakeMulticastAddress (): " +- "multicast address is " << etherAddr); +- +- return etherAddr; +-} +- + void + ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) + { +@@ -156,7 +88,7 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4 + "ArpIpv4Interface::SendTo (): Sending multicast packet over " + "non-multicast device"); + +- hardwareDestination = MakeMulticastAddress(dest); ++ hardwareDestination = GetDevice ()->MakeMulticastAddress(dest); + found = true; + } + else +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/internet-node/arp-ipv4-interface.h +--- a/src/internet-node/arp-ipv4-interface.h Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/internet-node/arp-ipv4-interface.h Wed Aug 29 12:11:11 2007 -0700 +@@ -47,7 +47,6 @@ class ArpIpv4Interface : public Ipv4Inte + virtual void SendTo (Packet p, Ipv4Address dest); + virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); + Ptr m_node; +- Address MakeMulticastAddress (Ipv4Address multicastGroup); + }; + + }//namespace ns3 +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Wed Aug 29 12:11:11 2007 -0700 +@@ -503,6 +503,8 @@ Ipv4L3Protocol::Receive( Ptr + { + NS_DEBUG("Ipv4L3Protocol::Receive (" << &device << ", " << &p << ", " << + protocol << ", " << from << ")"); ++ ++ NS_DEBUG("Ipv4L3Protocol::Receive (): Packet from " << from); + + uint32_t index = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/node/net-device.cc +--- a/src/node/net-device.cc Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/node/net-device.cc Wed Aug 29 12:11:11 2007 -0700 +@@ -140,10 +140,19 @@ NetDevice::IsMulticast (void) const + return m_isMulticast; + } + +-Address const & ++Address + NetDevice::GetMulticast (void) const + { +- NS_ASSERT (m_isMulticast); ++ NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " ++ "Invalid operation when not IsMulticast ()"); ++ return m_multicast; ++} ++ ++Address ++NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const ++{ ++ NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " ++ "Invalid operation when not IsMulticast ()"); + return m_multicast; + } + +diff -r bb5cf98c0c64 -r 580ed7a4dd1e src/node/net-device.h +--- a/src/node/net-device.h Mon Aug 27 23:46:14 2007 -0700 ++++ b/src/node/net-device.h Wed Aug 29 12:11:11 2007 -0700 +@@ -29,6 +29,7 @@ + #include "ns3/object.h" + #include "ns3/ptr.h" + #include "address.h" ++#include "ipv4-address.h" + + namespace ns3 { + +@@ -145,13 +146,61 @@ public: + bool IsMulticast (void) const; + + /** +- * \return the multicast address supported by +- * this netdevice. +- * +- * Calling this method is invalid if IsMulticast returns +- * not true. +- */ +- Address const &GetMulticast (void) const; ++ * \brief Return the MAC multicast base address used when mapping multicast ++ * groups to MAC multicast addresses. ++ * ++ * Typically when one constructs a multicast MAC addresses, some bits from ++ * the IP multicast group are copied into a corresponding MAC multicast ++ * group. In EUI-48, for example, the low order 23 bits of the multicast ++ * group are copied to the MAC multicast group base address. ++ * ++ * This method allows access to the underlying MAC multicast group base ++ * address. It is expected that in most cases, a net device client will ++ * allow the net device to perform the actual construction of the multicast ++ * address. Use of this method is discouraged unless you have a good reason ++ * to perform a custom mapping. You should prefer ++ * NetDevice::MakeMulticastAddress which will do the RFC-specified mapping ++ * for the net device in question. ++ * ++ * \return The multicast address supported by this net device. ++ * ++ * \warning Calling this method is invalid if IsMulticast returns not true. ++ * The method NS_ASSERTs if the device is not a multicast device. ++ * \see NetDevice::MakeMulticastAddress ++ */ ++ Address GetMulticast (void) const; ++ ++ /** ++ * \brief Make and return a MAC multicast address using the provided ++ * multicast group ++ * ++ * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet ++ * multicast address by placing the low-order 23-bits of the IP address into ++ * the low-order 23 bits of the Ethernet multicast address ++ * 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. ++ * This method performs the multicast address creation function appropriate ++ * to the underlying MAC address of the device. This MAC address is ++ * encapsulated in an abstract Address to avoid dependencies on the exact ++ * MAC address format. ++ * ++ * A default imlementation of MakeMulticastAddress is provided, but this ++ * method simply NS_ASSERTS. In the case of net devices that do not support ++ * multicast, clients are expected to test NetDevice::IsMulticast and avoid ++ * attempting to map multicast packets. Subclasses of NetDevice that do ++ * support multicasting are expected to override this method and provide an ++ * implementation appropriate to the particular device. ++ * ++ * \param multicastGroup The IP address for the multicast group destination ++ * of the packet. ++ * \return The MAC multicast Address used to send packets to the provided ++ * multicast group. ++ * ++ * \warning Calling this method is invalid if IsMulticast returns not true. ++ * \see Ipv4Address ++ * \see Address ++ * \see NetDevice::IsMulticast ++ */ ++ virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const; + + /** + * \return value of m_isPointToPoint flag + +changeset: 1316:7c81b4e2617d +user: Craig Dowell +date: Tue Sep 04 14:38:40 2007 -0700 +summary: piles of doxygen, changes to SetDefaultMulticastRoute plumbing + +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-impl.cc +--- a/src/internet-node/ipv4-impl.cc Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-impl.cc Tue Sep 04 14:38:40 2007 -0700 +@@ -106,13 +106,9 @@ Ipv4Impl::AddMulticastRoute (Ipv4Address + } + + void +-Ipv4Impl::SetDefaultMulticastRoute (Ipv4Address origin, +- Ipv4Address group, +- uint32_t inputInterface, +- std::vector outputInterfaces) +-{ +- m_ipv4->SetDefaultMulticastRoute (origin, group, inputInterface, +- outputInterfaces); ++Ipv4Impl::SetDefaultMulticastRoute (uint32_t outputInterface) ++{ ++ m_ipv4->SetDefaultMulticastRoute (outputInterface); + } + + uint32_t +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-impl.h +--- a/src/internet-node/ipv4-impl.h Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-impl.h Tue Sep 04 14:38:40 2007 -0700 +@@ -62,9 +62,7 @@ public: + uint32_t inputInterface, + std::vector outputInterfaces); + +- virtual void SetDefaultMulticastRoute (Ipv4Address origin, +- Ipv4Address group, uint32_t inputInterface, +- std::vector outputInterfaces); ++ virtual void SetDefaultMulticastRoute (uint32_t outputInterface); + + virtual uint32_t GetNMulticastRoutes (void) const; + virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const; +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Tue Sep 04 14:38:40 2007 -0700 +@@ -356,17 +356,12 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4A + } + + void +-Ipv4L3Protocol::SetDefaultMulticastRoute ( +- Ipv4Address origin, +- Ipv4Address group, +- uint32_t inputInterface, +- std::vector outputInterfaces) +-{ +- NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << origin << ", " << +- group << ", " << inputInterface << ", " << &outputInterfaces << ")"); +- +- m_staticRouting->SetDefaultMulticastRoute (origin, group, inputInterface, +- outputInterfaces); ++Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface) ++{ ++ NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << outputInterface << ++ ")"); ++ ++ m_staticRouting->SetDefaultMulticastRoute (outputInterface); + } + + uint32_t +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-l3-protocol.h +--- a/src/internet-node/ipv4-l3-protocol.h Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.h Tue Sep 04 14:38:40 2007 -0700 +@@ -163,10 +163,7 @@ public: + uint32_t inputInterface, + std::vector outputInterfaces); + +- void SetDefaultMulticastRoute (Ipv4Address origin, +- Ipv4Address group, +- uint32_t inputInterface, +- std::vector outputInterfaces); ++ void SetDefaultMulticastRoute (uint32_t onputInterface); + + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Tue Sep 04 14:38:40 2007 -0700 +@@ -101,15 +101,19 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv + } + + void +-Ipv4StaticRouting::SetDefaultMulticastRoute( +- Ipv4Address origin, +- Ipv4Address group, +- uint32_t inputInterface, +- std::vector outputInterfaces) +-{ ++Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) ++{ ++ Ipv4Address origin = Ipv4Address::GetAny (); ++ Ipv4Address group = Ipv4Address::GetAny (); ++ uint32_t inputInterface = Ipv4RoutingProtocol::IF_INDEX_ANY; ++ ++ std::vector outputInterfaces (1); ++ outputInterfaces[0] = outputInterface; ++ + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); + *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, + inputInterface, outputInterfaces); ++ + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = route; + } +@@ -177,7 +181,7 @@ Ipv4StaticRouting::GetDefaultMulticastRo + return 0; + } + +-void ++bool + Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +@@ -196,9 +200,10 @@ Ipv4StaticRouting::RemoveMulticastRoute( + { + delete *i; + m_multicastRoutes.erase (i); +- return; +- } +- } ++ return true; ++ } ++ } ++ return false; + } + + void +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Tue Sep 04 14:38:40 2007 -0700 +@@ -45,57 +45,418 @@ class TraceContext; + class TraceContext; + + ++/** ++ * @brief Static routing protocol for IP version 4 stacks. ++ * ++ * In ns-3 we have the concept of a pluggable routing protocol. Routing ++ * protocols are added to a list maintained by the Ipv4L3Protocol. Every ++ * stack gets one routing protocol for free -- the Ipv4StaticRouting routing ++ * protocol is added in the constructor of the Ipv4L3Protocol (this is the ++ * piece of code that implements the functionality of the IP layer). ++ * ++ * The Ipv4StaticRouting class inherits from the abstract base class ++ * Ipv4RoutingProtocol that defines the interface methods that a routing ++ * protocol must support. ++ * ++ * When a packet arrives in the Ipv4L3Protocol for transmission, it comes ++ * either from a local source via Ipv4L3Protocol::Send or from a remote ++ * source via Ipv4L3Protocol::Forwarding. In both cases, a function is called ++ * (Ipv4L3Protocol::Lookup) to look up the routing information for the packet. ++ * ++ * The lookup function iterates through the list of routing protocols asking ++ * each to see if it can find a route and send the packet. A callback is ++ * provided during each of these calls that should be considered a pre- ++ * packaged send call. This is done to allow asynchronous calls into ++ * routing subsystems in order to support on-demand routing, for example. The ++ * method for requesting this operation is Ipv4StaticRouting::RequestRoute for ++ * the static routing protocol. ++ * ++ * Each routing protocol is also free to implement its own methods for managing ++ * routes which you will find below. This class manages a set of "static" or ++ * manually configured routes for host, network and multicast routes. ++ * ++ * @see Ipv4RoutingProtocol ++ * @see Ipv4L3Protocol::AddRoutingProtocol ++ * @see Ipv4L3Protocol::Ipv4L3Protocol ++ */ + class Ipv4StaticRouting : public Ipv4RoutingProtocol + { +- + public: ++/** ++ * @brief Construct an empty Ipv4StaticRouting routing protocol, ++ * @internal ++ * ++ * The Ipv4StaticRouting class supports host, network and multicast routes. ++ * This method initializes the lists containing these routes to empty. ++ * ++ * @see Ipv4StaticRouting ++ */ + Ipv4StaticRouting (); + ++/** ++ * @brief Request that a check for a route bw performed and if a route is found ++ * that the packet be sent on its way using the pre-packaged send callback. ++ * ++ * The source and destination IP addresses for the packet in question are found ++ * in the provided Ipv4Header. There are two major processing forks depending ++ * on the type of destination address. ++ * ++ * If the destination address is unicast then the routing table is consulted ++ * for a route to the destination and if it is found, the routeReply callback ++ * is executed to send the packet (with the found route). ++ * ++ * If the destination address is a multicast, then the exact processing steps ++ * depend on whether or not the packet has been sourced locally. This is ++ * determined by the parameter ifIndex. This is the interface index over which ++ * this packet was received. If the packet has not been received over a ++ * network interface, this index will be set to ++ * Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number). In that case, ++ * we want to avoid the requirement that an explicit route out of each node ++ * must be set, so we don't do anything here. ++ * ++ * If the packet is a multicast destination and has been received over a ++ * network interface, a call to this method implies that the packet is being ++ * forwarded. In that case, there must be an explicit route out of the node. ++ * A multicast route references the source address, the destination address ++ * (the multicast group) and the input interface in order to find a route. ++ * We consult the multicast routing table and, if a route is found, send the ++ * packet out of as many interfaces as required using the provided callback ++ * (think of it as a pre-packaged send call). ++ * ++ * @param ifIndex The network interface index over which the packed was ++ * received. If the packet is from a local source, ifIndex will be set to ++ * Ipv4RoutingProtocol::IF_INDEX_ANY. ++ * @param ipHeader the Ipv4Header containing the source and destination IP ++ * addresses for the packet. ++ * @param packet The packet to be sent if a route is found. ++ * @param routeReply A callback that packaged up the call to actually send the ++ * packet. ++ * @return Returns true if a route is found and the packet has been sent, ++ * otherwise returns false indicating that the next routing protocol should ++ * be consulted. In practice, the static routing protocol is the last chance ++ * protocol. ++ * ++ * @see Ipv4StaticRouting ++ * @see Ipv4RoutingProtocol ++ */ + virtual bool RequestRoute (uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + RouteReplyCallback routeReply); + ++/** ++ * @brief Check to see if we can determine the interface index that will be ++ * used if a packet is sent to this destination. ++ * ++ * This method addresses a problem in the IP stack where a destination address ++ * must be present and checksummed into the IP header before the actual ++ * interface over which the packet is sent can be determined. The answer is ++ * to implement a known and intentional cross-layer violation. This is the ++ * endpoint of a call chain that started up quite high in the stack (sockets) ++ * and has found its way down to the Ipv4L3Protocol which is consulting the ++ * routing protocols for what they would do if presented with a packet of the ++ * given destination. ++ * ++ * Note that the a single interface index is returned. This means that if ++ * the destination address is a multicast, and an explicit route is present ++ * that includeds multiple output interfaces, that route cannot be used. ++ * ++ * If there are multiple paths out of the node, the resolution is performed ++ * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more ++ * contextual information that is useful for making a determination. ++ * ++ * @param destination The Ipv4Address if the destination of a hypothetical ++ * packet. This may be a multicast group address. ++ * @param ifIndex A reference to the interface index over which a packet ++ * sent to this destination would be sent. ++ * @return Returns true if a route is found to the destination that involves ++ * a single output interface index, otherwise returns false indicating that ++ * the next routing protocol should be consulted. In practice, the static ++ * routing protocol is the last chance protocol. ++ * ++ * @see Ipv4StaticRouting ++ * @see Ipv4RoutingProtocol ++ * @see Ipv4L3Protocol ++ */ + virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); + ++/** ++ * @brief Add a host route to the static routing table. ++ * ++ * @param dest The Ipv4Address destination for this route. ++ * @param nextHop The Ipv4Address of the next hop in the route. ++ * @param interface The network interface index used to send packets to the ++ * destination. ++ * ++ * @see Ipv4Address ++ */ + void AddHostRouteTo (Ipv4Address dest, + Ipv4Address nextHop, + uint32_t interface); ++/** ++ * @brief Add a host route to the static routing table. ++ * ++ * @param dest The Ipv4Address destination for this route. ++ * @param interface The network interface index used to send packets to the ++ * destination. ++ * ++ * @see Ipv4Address ++ */ + void AddHostRouteTo (Ipv4Address dest, + uint32_t interface); + ++/** ++ * @brief Add a network route to the static routing table. ++ * ++ * @param network The Ipv4Address network for this route. ++ * @param networkmask The Ipv4Mask to extract the network. ++ * @param nextHop The next hop in the route to the destination network. ++ * @param interface The network interface index used to send packets to the ++ * destination. ++ * ++ * @see Ipv4Address ++ */ + void AddNetworkRouteTo (Ipv4Address network, + Ipv4Mask networkMask, + Ipv4Address nextHop, + uint32_t interface); ++ ++/** ++ * @brief Add a network route to the static routing table. ++ * ++ * @param network The Ipv4Address network for this route. ++ * @param networkmask The Ipv4Mask to extract the network. ++ * @param interface The network interface index used to send packets to the ++ * destination. ++ * ++ * @see Ipv4Address ++ */ + void AddNetworkRouteTo (Ipv4Address network, + Ipv4Mask networkMask, + uint32_t interface); ++ ++/** ++ * @brief Add a default route to the static routing table. ++ * ++ * This method tells the routing system what to do in the case where a specific ++ * route to a destination is not found. The system forwards packets to the ++ * specified node in the hope that it knows better how to route the packet. ++ * ++ * If the default route is set, it is returned as the selected route from ++ * LookupStatic irrespective of destination address if no specific route is ++ * found. ++ * ++ * @param nextHop The Ipv4Address to send packets to in the hope that they ++ * will be forwarded correctly. ++ * @param interface The network interface index used to send packets. ++ * ++ * @see Ipv4Address ++ * @see Ipv4StaticRouting::Lookup ++ */ + void SetDefaultRoute (Ipv4Address nextHop, + uint32_t interface); ++ ++/** ++ * @brief Get the number of individual unicast routes that have been added ++ * to the routing table. ++ * ++ * @warning The default route counts as one of the routes. ++ */ + uint32_t GetNRoutes (void); ++ ++/** ++ * @brief Get the default route from the static routing table. ++ * ++ * @return If the default route is set, a pointer to that Ipv4Route is ++ * returned, otherwise a zero pointer is returned. ++ * ++ * @see Ipv4Route ++ */ + Ipv4Route *GetDefaultRoute (void); ++ ++/** ++ * @brief Get a route from the static unicast routing table. ++ * ++ * Externally, the unicast static routing table appears simply as a table with ++ * n entries. The one sublety of note is that if a default route has been set ++ * it will appear as the zeroth entry in the table. This means that if you ++ * add only a default route, the table will have one entry that can be accessed ++ * either by explicity calling GetDefaultRoute () or by calling GetRoute (0). ++ * ++ * Similarly, if the default route has been set, calling RemoveRoute (0) will ++ * remove the default route. ++ * ++ * @param i The index (into the routing table) of the route to retrieve. If ++ * the default route has been set, it will occupy index zero. ++ * @return If route is set, a pointer to that Ipv4Route is returned, otherwise ++ * a zero pointer is returned. ++ * ++ * @see Ipv4Route ++ * @see Ipv4StaticRouting::RemoveRoute ++ */ + Ipv4Route *GetRoute (uint32_t i); ++ ++/** ++ * @brief Remove a route from the static unicast routing table. ++ * ++ * Externally, the unicast static routing table appears simply as a table with ++ * n entries. The one sublety of note is that if a default route has been set ++ * it will appear as the zeroth entry in the table. This means that if the ++ * default route has been set, calling RemoveRoute (0) will remove the ++ * default route. ++ * ++ * @param i The index (into the routing table) of the route to remove. If ++ * the default route has been set, it will occupy index zero. ++ * ++ * @see Ipv4Route ++ * @see Ipv4StaticRouting::GetRoute ++ * @see Ipv4StaticRouting::AddRoute ++ */ + void RemoveRoute (uint32_t i); + ++/** ++ * @brief Add a multicast route to the static routing table. ++ * ++ * A multicast route must specify an origin IP address -- the address of the ++ * node that originates packets destined for a given multicast group. This ++ * address may be Ipv4Address::GetAny (typically 0.0.0.0) if the multicast ++ * group is open, or it may specify a single IP address if the multicast ++ * group is closed. The route must also specify the multicast group address. ++ * ++ * For each route, the input nework interface must be specified. For ++ * forwarding operations, this is the interface index that you expect multicast ++ * packets to arrive over. If you want to specify routes off of a local node ++ * for given multicast groups, this index may be set to ++ * Ipv4RoutingProtocol::IF_INDEX_ANY. ++ * ++ * For each route, a vector of output network interfaces must also be ++ * specified. When the RequestRoute operation is performed, copies of a ++ * packet are sent out all of the specified interfaces. ++ * ++ * @param origin The Ipv4Address of the origin of packets for this route. May ++ * be Ipv4Address:GetAny for open groups. ++ * @param group The Ipv4Address of the multicast group or this route. ++ * @param inputInterface The input network interface index over which to ++ * expect packets destined for this route. May be ++ * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. ++ * @param outputInterface A vector of network interface indices used to specify ++ * how to send packets to the destination(s). ++ * ++ * @see Ipv4Address ++ */ + void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + +- void SetDefaultMulticastRoute (Ipv4Address origin, +- Ipv4Address group, +- uint32_t inputInterface, +- std::vector outputInterfaces); +- ++/** ++ * @brief Add a default multicast route to the static routing table. ++ * ++ * This is the multicast equivalent of the unicast version SetDefaultRoute. ++ * We tell the routing system what to do in the case where a specific route ++ * to a destination multicast group is not found. The system forwards ++ * packets out the specified interface in the hope that "something out there" ++ * knows better how to route the packet. ++ * ++ * Since we're basically forwarding packets to some entity we think may know ++ * better what to do, we don't pay attention to subleties like origin address ++ * and input interface, nor do we worry about forwarding out multiple ++ * interfaces. If the default multicast route is set, it is returned as the ++ * selected route from LookupStatic irrespective of origin, multicast group or ++ * input interface if another specific route is not found. ++ * ++ * @param outputInterface The network interface index used to specify where ++ * to send packets in the case of unknown routes. ++ * ++ * @see Ipv4Address ++ */ ++ void SetDefaultMulticastRoute (uint32_t outputInterface); ++ ++/** ++ * @brief Get the number of individual multicast routes that have been added ++ * to the routing table. ++ * ++ * @warning The default multicast route counts as one of the routes. ++ */ + uint32_t GetNMulticastRoutes (void) const; ++ ++/** ++ * @brief Get a route from the static multicast routing table. ++ * ++ * Externally, the multicast static routing table appears simply as a table ++ * with n entries. The one sublety of note is that if a default route has ++ * been set it will appear as the zeroth entry in the table. This means that ++ * if you add only a default route, the table will have one entry that can be ++ * accessed either by explicity calling GetDefaultMulticastRoute () or by ++ * calling GetMulticastRoute (0). ++ * ++ * Similarly, if the default route has been set, calling ++ * RemoveMulticastRoute (0) will remove the default route. ++ * ++ * @param i The index (into the routing table) of the multicast route to ++ * retrieve. If the default route has been set, it will occupy index zero. ++ * @return If route is set, a pointer to that Ipv4MulticastRoute is ++ * returned, otherwise a zero pointer is returned. ++ * ++ * @see Ipv4MulticastRoute ++ * @see Ipv4StaticRouting::RemoveRoute ++ */ + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; ++ ++/** ++ * @brief Get the default multicast route from the static routing table. ++ * ++ * @return If the default route is set, a pointer to that Ipv4MulticastRoute is ++ * returned, otherwise a zero pointer is returned. ++ * ++ * @see Ipv4Route ++ */ + Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; + +- void RemoveMulticastRoute (Ipv4Address origin, ++/** ++ * @brief Remove a route from the static multicast routing table. ++ * ++ * Externally, the multicast static routing table appears simply as a table ++ * with n entries. The one sublety of note is that if a default multicast ++ * route has been set it will appear as the zeroth entry in the table. This ++ * means that the default route may be removed by calling this method with ++ * appropriate wildcard parameters. ++ * ++ * This method causes the multicast routing table to be searched for the first ++ * route that matches the parameters and removes it. ++ * ++ * @param origin The IP address specified as the origin of packets for the ++ * route. ++ * @param origin The IP address specified as the multicast group addres of ++ * the route. ++ * @param inputInterfade The network interface index specified as the expected ++ * input interface for the route. ++ * @returns True if a route was found and removed, false otherwise. ++ * ++ * @see Ipv4Route ++ * @see Ipv4StaticRouting::GetRoute ++ * @see Ipv4StaticRouting::AddRoute ++ */ ++ bool RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + ++/** ++ * @brief Remove a route from the static multicast routing table. ++ * ++ * Externally, the multicast static routing table appears simply as a table ++ * with n entries. The one sublety of note is that if a default multicast ++ * route has been set it will appear as the zeroth entry in the table. This ++ * means that if the default route has been set, calling ++ * RemoveMulticastRoute (0) will remove the default route. ++ * ++ * @param index The index (into the multicast routing table) of the route to ++ * remove. If the default route has been set, it will occupy index zero. ++ * ++ * @see Ipv4Route ++ * @see Ipv4StaticRouting::GetRoute ++ * @see Ipv4StaticRouting::AddRoute ++ */ + void RemoveMulticastRoute (uint32_t index); + + protected: +diff -r 580ed7a4dd1e -r 7c81b4e2617d src/node/ipv4.h +--- a/src/node/ipv4.h Wed Aug 29 12:11:11 2007 -0700 ++++ b/src/node/ipv4.h Tue Sep 04 14:38:40 2007 -0700 +@@ -104,14 +104,38 @@ public: + const Ipv4Header &ipHeader, + Packet packet, + RouteReplyCallback routeReply) = 0; +- /** +- * \brief Synchronously request the interface index that will be used to +- * send a packet to a hypothetical destination. +- * +- * \param destination IP address of a hypothetical destination packet +- * \param ifIndex Reference to interface index. +- * \returns True if the protocol has a route, false otherwise. +- */ ++/** ++ * \brief Synchronously check to see if we can determine the interface index ++ * that will be used if a packet is sent to this destination. ++ * ++ * This method addresses a problem in the IP stack where a destination address ++ * must be present and checksummed into the IP header before the actual ++ * interface over which the packet is sent can be determined. The answer is ++ * to implement a known and intentional cross-layer violation. This is the ++ * endpoint of a call chain that started up quite high in the stack (sockets) ++ * and has found its way down to the Ipv4L3Protocol which is consulting the ++ * routing protocols for what they would do if presented with a packet of the ++ * given destination. ++ * ++ * Note that the a single interface index is returned. This means that if ++ * the destination address is a multicast, and an explicit route is present ++ * that includeds multiple output interfaces, that route cannot be used. ++ * ++ * If there are multiple paths out of the node, the resolution is performed ++ * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more ++ * contextual information that is useful for making a determination. ++ * ++ * \param destination The Ipv4Address if the destination of a hypothetical ++ * packet. This may be a multicast group address. ++ * \param ifIndex A reference to the interface index over which a packet ++ * sent to this destination would be sent. ++ * \return Returns true if a route is found to the destination that involves ++ * a single output interface index, otherwise false. ++ * ++ * \see Ipv4StaticRouting ++ * \see Ipv4RoutingProtocol ++ * \see Ipv4L3Protocol ++ */ + virtual bool RequestIfIndex (Ipv4Address destination, + uint32_t& ifIndex) = 0; + +@@ -207,11 +231,13 @@ public: + * \returns the number of entries in the routing table. + */ + virtual uint32_t GetNRoutes (void) = 0; ++ + /** + * \param i index of route to return + * \returns the route whose index is i + */ + virtual Ipv4Route GetRoute (uint32_t i) = 0; ++ + /** + * \param i index of route to remove from routing table. + */ +@@ -244,18 +270,13 @@ public: + uint32_t inputInterface) = 0; + + /** +- * \brief Set the default static multicast route for a given multicast +- * source and group. +- * +- * \param origin The Ipv4 address of the multicast source. +- * \param group The multicast group address. +- * \param inputInterface The interface index over which the packet arrived. +- * \param outputInterfaces The list of output interface indices over which +- * the packet should be sent (excluding the inputInterface). +- */ +- virtual void SetDefaultMulticastRoute (Ipv4Address origin, +- Ipv4Address group, uint32_t inputInterface, +- std::vector outputInterfaces) = 0; ++ * \brief Set the default static multicast route. ++ * ++ * \param outputInterface The network output interface index over which ++ * packets without specific routes should be sent. ++ */ ++ virtual void SetDefaultMulticastRoute (uint32_t outputInterface) = 0; ++ + /** + * \returns the number of entries in the multicast routing table. + */ +@@ -282,6 +303,7 @@ public: + * make sure that it is never used during packet forwarding. + */ + virtual uint32_t AddInterface (Ptr device) = 0; ++ + /** + * \returns the number of interfaces added by the user. + */ +@@ -346,39 +368,46 @@ public: + * \param address address to associate to the underlying ipv4 interface + */ + virtual void SetAddress (uint32_t i, Ipv4Address address) = 0; ++ + /** + * \param i index of ipv4 interface + * \param mask mask to associate to the underlying ipv4 interface + */ + virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask) = 0; ++ + /** + * \param i index of ipv4 interface + * \returns the mask associated to the underlying ipv4 interface + */ + virtual Ipv4Mask GetNetworkMask (uint32_t i) const = 0; ++ + /** + * \param i index of ipv4 interface + * \returns the address associated to the underlying ipv4 interface + */ + virtual Ipv4Address GetAddress (uint32_t i) const = 0; ++ + /** + * \param destination The IP address of a hypothetical destination. + * \returns The IP address assigned to the interface that will be used + * if we were to send a packet to destination. + */ + virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; ++ + /** + * \param i index of ipv4 interface + * \returns the Maximum Transmission Unit (in bytes) associated + * to the underlying ipv4 interface + */ + virtual uint16_t GetMtu (uint32_t i) const = 0; ++ + /** + * \param i index of ipv4 interface + * \returns true if the underlying interface is in the "up" state, + * false otherwise. + */ + virtual bool IsUp (uint32_t i) const = 0; ++ + /** + * \param i index of ipv4 interface + * +@@ -386,6 +415,7 @@ public: + * considered valid during ipv4 forwarding. + */ + virtual void SetUp (uint32_t i) = 0; ++ + /** + * \param i index of ipv4 interface + * +@@ -393,7 +423,6 @@ public: + * ignored during ipv4 forwarding. + */ + virtual void SetDown (uint32_t i) = 0; +- + }; + + } // namespace ns3 + +changeset: 1317:3fba36666488 +user: Craig Dowell +date: Tue Sep 04 15:10:47 2007 -0700 +summary: Don't flood multicasts if no route found + +diff -r 7c81b4e2617d -r 3fba36666488 src/internet-node/ipv4-l3-protocol.cc +--- a/src/internet-node/ipv4-l3-protocol.cc Tue Sep 04 14:38:40 2007 -0700 ++++ b/src/internet-node/ipv4-l3-protocol.cc Tue Sep 04 15:10:47 2007 -0700 +@@ -284,29 +284,29 @@ Ipv4L3Protocol::Lookup ( + NS_DEBUG ("Ipv4L3Protocol::Lookup (): " + "Multicast destination with local source"); + // +-// We have a multicast packet originating from the current node. We didn't +-// want to force users to construct a route in order to get packets out of a +-// node, so there will have been no route found and it is left to us to send +-// the packet. What we'll do is to send the multicast out all of the +-// interfaces on this node. Note that we start with interface 1 since we +-// don't particularly want to send the packet out the loopback. +-// +- NS_DEBUG ("Ipv4StaticRouting::Lookup (): " +- "Local source. Flooding multicast packet"); +- +- for (uint32_t i = 1; i < GetNInterfaces (); ++i) +- { +- Packet p = packet; +- Ipv4Header h = ipHeader; +- Ipv4Route route = +- Ipv4Route::CreateHostRouteTo(h.GetDestination (), i); ++// We have a multicast packet originating from the current node and were not ++// able to send it using the usual RequestRoute process. Since the usual ++// process includes trying to use a default multicast route, this means that ++// there was no specific route out of the node found, and there was no default ++// multicast route set. ++// ++// The fallback position is to look for a default unicast route and use that ++// to get the packet off the node if we have one. ++// ++ Ipv4Route *route = m_staticRouting->GetDefaultRoute (); ++ ++ if (route) ++ { + NS_DEBUG ("Ipv4StaticRouting::Lookup (): " +- "Send via interface " << i); +- routeReply (true, route, p, h); +- } +- return; +- } +- // No route found ++ "Local source. Using unicast default route for multicast packet"); ++ ++ routeReply (true, *route, packet, ipHeader); ++ return; ++ } ++ } ++// ++// No route found ++// + routeReply (false, Ipv4Route (), packet, ipHeader); + } + +diff -r 7c81b4e2617d -r 3fba36666488 src/node/ipv4-route.cc +--- a/src/node/ipv4-route.cc Tue Sep 04 14:38:40 2007 -0700 ++++ b/src/node/ipv4-route.cc Tue Sep 04 15:10:47 2007 -0700 +@@ -30,11 +30,19 @@ namespace ns3 { + + Ipv4Route::Ipv4Route () + {} ++ + Ipv4Route::Ipv4Route (Ipv4Route const &route) + : m_dest (route.m_dest), + m_destNetworkMask (route.m_destNetworkMask), + m_gateway (route.m_gateway), + m_interface (route.m_interface) ++{} ++ ++Ipv4Route::Ipv4Route (Ipv4Route const *route) ++ : m_dest (route->m_dest), ++ m_destNetworkMask (route->m_destNetworkMask), ++ m_gateway (route->m_gateway), ++ m_interface (route->m_interface) + {} + + Ipv4Route::Ipv4Route (Ipv4Address dest, +@@ -236,6 +244,15 @@ Ipv4MulticastRoute::Ipv4MulticastRoute ( + { + } + ++Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const *route) ++: ++ m_origin (route->m_origin), ++ m_group (route->m_group), ++ m_inputInterface (route->m_inputInterface), ++ m_outputInterfaces (route->m_outputInterfaces) ++{ ++} ++ + Ipv4MulticastRoute::Ipv4MulticastRoute ( + Ipv4Address origin, + Ipv4Address group, +diff -r 7c81b4e2617d -r 3fba36666488 src/node/ipv4-route.h +--- a/src/node/ipv4-route.h Tue Sep 04 14:38:40 2007 -0700 ++++ b/src/node/ipv4-route.h Tue Sep 04 15:10:47 2007 -0700 +@@ -37,11 +37,18 @@ public: + * \brief This constructor does nothing + */ + Ipv4Route (); ++ + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4Route (Ipv4Route const &route); ++ ++ /** ++ * \brief Copy Constructor ++ * \param route The route to copy ++ */ ++ Ipv4Route (Ipv4Route const *route); + + bool IsHost (void) const; + /** +@@ -108,11 +115,18 @@ public: + * \brief This constructor does nothing + */ + Ipv4MulticastRoute (); ++ + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4MulticastRoute (Ipv4MulticastRoute const &route); ++ ++ /** ++ * \brief Copy Constructor ++ * \param route The route to copy ++ */ ++ Ipv4MulticastRoute (Ipv4MulticastRoute const *route); + + /** + * \return The IPv4 address of the source of this route + +changeset: 1318:f9bc98cbe5fe +user: Craig Dowell +date: Tue Sep 04 18:06:06 2007 -0700 +summary: clarify use of wildcards in multicast routes versus default mulicast routes. + +diff -r 3fba36666488 -r f9bc98cbe5fe examples/csma-multicast.cc +--- a/examples/csma-multicast.cc Tue Sep 04 15:10:47 2007 -0700 ++++ b/examples/csma-multicast.cc Tue Sep 04 18:06:06 2007 -0700 +@@ -221,8 +221,8 @@ main (int argc, char *argv[]) + Ptr ipv4; + ipv4 = n2->QueryInterface (Ipv4::iid); + +- uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr(n2Lan0Addr); +- uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr(n2Lan1Addr); ++ uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr); ++ uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr); + // + // Now, we need to do is to call the AddMulticastRoute () method on node + // two's Ipv4 interface and tell it that whenever it receives a packet on +@@ -237,6 +237,41 @@ main (int argc, char *argv[]) + + ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexLan0, + outputInterfaces); ++// ++// We need to specify how the source node handles multicasting. There are a ++// number of ways we can deal with this, we just need to pick one. The first ++// method is to add an explicit route out of the source node, just as we did ++// for the forwarding node. Use this method when you want to send packets out ++// multiple interfaces or send packets out different interfaces based on the ++// differing multicast groups. Since the source is local, there will be no ++// input interface over which packets are received, so use ++// Ipv4RoutingProtocol::IF_INDEX_ANY as a wildcard. ++// ++// A second way is to specify a multicast route using wildcards. If you ++// want to send multicasts out differing sets of interfaces based on the ++// multicast group, you can use AddMulticastRoute () but specify the origin ++// as a wildcard. If you want all multicasts to go out a single set of ++// interfaces, you can make both the origin and group a wildcard. ++// ++// If you have a simple system, where the source has a single interface, this ++// can be done via the SetDefaultMulticastRoute () method on the Ipv4 ++// interface. This tells the system to send all multicasts out a single ++// specified network interface index. ++// ++// A last way is to specify a (or use an existing) default unicast route. The ++// multicast routing code uses the unicast default route as a multicast "route ++// of last resort." this method for is also on Ipv4 and is called ++// SetDefaultRoute (). ++// ++// Since this is a simple multicast example, we use the ++// SetDefaultMulticastRoute () approach. We are going to first need the ++// Ipv4 interface for node 0 which is the multicast source. We use this ++// interface to find the output interface index, and tell node zero to send ++// its multicast traffic out that interface. ++// ++ ipv4 = n0->QueryInterface (Ipv4::iid); ++ uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource); ++ ipv4->SetDefaultMulticastRoute (ifIndexSrc); + // + // As described above, node four will be the only node listening for the + // multicast data. To enable forwarding bits up the protocol stack, we need +diff -r 3fba36666488 -r f9bc98cbe5fe src/internet-node/ipv4-static-routing.cc +--- a/src/internet-node/ipv4-static-routing.cc Tue Sep 04 15:10:47 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.cc Tue Sep 04 18:06:06 2007 -0700 +@@ -289,14 +289,27 @@ Ipv4StaticRouting::LookupStatic ( + Ipv4Address group, + uint32_t ifIndex) + { ++// ++// We treat the "any" address (typically 0.0.0.0) as a wildcard in our matching ++// scheme. ++// ++ Ipv4Address wildcard = Ipv4Address::GetAny (); ++ + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; +- if ( (origin == route->GetOrigin () || +- origin == Ipv4Address::GetAny ()) && +- group == route->GetGroup ()) ++// ++// We've been passed an origin address, a multicast group address and an ++// interface index. We have to decide if the current route in the list is ++// a match. ++// ++// The first case is the restrictive case where the origin, group and index ++// matches. This picks up exact routes during forwarded and exact routes from ++// the local node (in which case the ifIndex is a wildcard). ++// ++ if (origin == route->GetOrigin () && group == route->GetGroup ()) + { + if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || + ifIndex == route->GetInputInterface ()) +@@ -305,7 +318,67 @@ Ipv4StaticRouting::LookupStatic ( + } + } + } +- ++// ++// If the input interface index is not a wildcard (that means that the packet ++// did not originally come from this node), we're done. We don't ++// just happily forward packets we don't really know what to do with. ++// Multicast storms are not generally considered a good thing. ++// ++ if (ifIndex != Ipv4RoutingProtocol::IF_INDEX_ANY) ++ { ++ return 0; ++ } ++// ++// Now, we're going to get a litle less restricive. This only applies in the ++// case where the packet in question is coming from the local node. In order ++// to avoid dependencies on the order in which routes were added, we will ++// actually walk the list two more times, the first time looking for routes ++// with a single wildcard, and the last time looking for the first route ++// with two wildcards. ++// ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ Ipv4MulticastRoute *route = *i; ++// ++// Here we will ignore the origin. We know that a single source address must ++// be picked for a packet, but we may want to send multicast packets out ++// multiple interfaces. To support this case, a user would need to add ++// a Multicast route with the route's origin set to wildcard. N.B As a ++// result, packets sourced from a node with multiple interface may have a ++// source IP address different from that of the interface actually used to ++// send the packet. ++// ++ if (route->GetOrigin () == wildcard && group == route->GetGroup ()) ++ { ++ return *i; ++ } ++ } ++// ++// Finally we want to allow users to specify a default route that specifies ++// sending all multicast packets out multiple interfaces. The standard ++// default multicast route is patterned after other systems and limits the ++// number of outputs to one. If, however a client manually adds a multicast ++// route with the origin, the multicast group and the input interface index ++// all set to wildcard, she has created a default route with multiple output ++// interfaces. ++// ++ for (MulticastRoutesI i = m_multicastRoutes.begin (); ++ i != m_multicastRoutes.end (); ++ i++) ++ { ++ Ipv4MulticastRoute *route = *i; ++ ++ if (route->GetOrigin () == wildcard && route->GetGroup () == wildcard) ++ { ++ return *i; ++ } ++ } ++// ++// We also allow users to specify a typical default multicast route. This ++// default route is limited to specifying a single output interface. ++// + if (m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; +@@ -445,33 +518,7 @@ Ipv4StaticRouting::RequestRoute ( + if (ipHeader.GetDestination ().IsMulticast ()) + { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); +-// +-// We have a multicast packet we're going to send. There are two distinct +-// cases we need to support. The first is if the current node is the source +-// of the packet. In that case, we don't want to have to consult multicast +-// routing tables (nor build them) in order to send multicasts. The interface +-// index (ifIndex) is Ipv4RoutingProtocol::IF_INDEX_ANY if we're the source. +-// +-// The second case is if the current packet has gotten to us by being +-// received over one of our interfaces. In this case, ifIndex is set to the +-// index over which we received the packet. For these packets, we need to +-// consult the multicast routing table for a disposition. +-// +-// So, first let's see if we're the source. In this case, we don't consult +-// the routing tables, but just return false and let the caller (up in +-// ipv4-l3-protocol) flood the multicast packet out of all of its interfaces. +-// We can't really do it here even if we wanted to since we have no easy way +-// to get to the Ipv4 interface which we would need. +-// +- if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) +- { +- return false; +- } +-// +-// If we fall through to this point, we have a multicast packet that has +-// not originated at this node. We need to deal with forwarding. Let's +-// see if we have a route, and if so go ahead and forward this puppy. +-// ++ + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), + ipHeader.GetDestination (), ifIndex); + +@@ -479,6 +526,7 @@ Ipv4StaticRouting::RequestRoute ( + { + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " + "Multicast route found"); ++ + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; +@@ -495,7 +543,7 @@ Ipv4StaticRouting::RequestRoute ( + return false; // Let other routing protocols try to handle this + } + // +-// See if this is a unicast packet we have a route for. ++// This is a unicast packet. Check to see if we have a route for it. + // + NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); + Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); +diff -r 3fba36666488 -r f9bc98cbe5fe src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Tue Sep 04 15:10:47 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Tue Sep 04 18:06:06 2007 -0700 +@@ -317,21 +317,34 @@ public: + /** + * @brief Add a multicast route to the static routing table. + * +- * A multicast route must specify an origin IP address -- the address of the +- * node that originates packets destined for a given multicast group. This +- * address may be Ipv4Address::GetAny (typically 0.0.0.0) if the multicast +- * group is open, or it may specify a single IP address if the multicast +- * group is closed. The route must also specify the multicast group address. +- * +- * For each route, the input nework interface must be specified. For +- * forwarding operations, this is the interface index that you expect multicast +- * packets to arrive over. If you want to specify routes off of a local node +- * for given multicast groups, this index may be set to +- * Ipv4RoutingProtocol::IF_INDEX_ANY. +- * +- * For each route, a vector of output network interfaces must also be +- * specified. When the RequestRoute operation is performed, copies of a +- * packet are sent out all of the specified interfaces. ++ * A multicast route must specify an origin IP address, a multicast group and ++ * an input network interface index as conditions and provide a vector of ++ * output network interface indices over which packets matching the conditions ++ * are sent. ++ * ++ * Typically there are two main types of multicast routes: routes of the ++ * first kind are used during forwarding. All of the conditions must be ++ * exlicitly provided. The second kind of routes are used to get packets off ++ * of a local node. The difference is in the input interface. Routes for ++ * forwarding will always have an explicit input interface specified. Routes ++ * off of a node will always set the input interface to a wildcard specified ++ * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. ++ * ++ * For routes off of a local node wildcards may be used in the origin and ++ * multicast group addresses. The wildcard used for Ipv4Adresses is that ++ * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage ++ * of a wildcard allows one to specify default behavior to varying degrees. ++ * ++ * For example, making the origin address a wildcard, but leaving the ++ * multicast group specific allows one (in the case of a node with multiple ++ * interfaces) to create different routes using different output interfaces ++ * for each multicast group. ++ * ++ * If the origin and multicast addresses are made wildcards, you have created ++ * essentially a default multicast address that can forward to multiple ++ * interfaces. Compare this to the actual default multicast address that is ++ * limited to specifying a single output interface for compatibility with ++ * existing functionality in other systems. + * + * @param origin The Ipv4Address of the origin of packets for this route. May + * be Ipv4Address:GetAny for open groups. +@@ -425,6 +438,12 @@ public: + * This method causes the multicast routing table to be searched for the first + * route that matches the parameters and removes it. + * ++ * Wildcards may be provided to this function, but the wildcards are used to ++ * exacly match wildcards in the routes (see AddMulticastRoute). That is, ++ * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not ++ * remove routes with any address in the origin, but will only remove routes ++ * with "0.0.0.0" set as the the origin. ++ * + * @param origin The IP address specified as the origin of packets for the + * route. + * @param origin The IP address specified as the multicast group addres of +@@ -433,9 +452,8 @@ public: + * input interface for the route. + * @returns True if a route was found and removed, false otherwise. + * +- * @see Ipv4Route +- * @see Ipv4StaticRouting::GetRoute +- * @see Ipv4StaticRouting::AddRoute ++ * @see Ipv4MulticastRoute ++ * @see Ipv4StaticRouting::AddMulticastRoute + */ + bool RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + +changeset: 1319:f136fc719267 +tag: tip +user: Craig Dowell +date: Thu Sep 06 15:57:53 2007 -0700 +summary: readme file includes APIs + +diff -r f9bc98cbe5fe -r f136fc719267 README.multicast-routing +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/README.multicast-routing Thu Sep 06 15:57:53 2007 -0700 +@@ -0,0 +1,213 @@ ++Static multicast routing overview ++-------------------------------- ++ ++This is brief documentation of a proposal to add static multicast ++routing to ns-3. ++ ++This extension allows the simulation user to: ++ ++- manually add an Ipv4 multicast route to a router ++- specify a default outgoing interface for multicast sources (hosts) in ++ various ways ++- allow a multicast receiver (hosts) to join a multicast group, to enable ++ reception of that group's datagrams ++ ++1. Code location: ++ ++- http://code.nsnam.org/craigdo/ns-3-mc ++ ++- the main source code is found in src/internet-node/ipv4-static-routing.{cc,h} ++ ++also touched are: ++- src/internet-node/ipv4-l3-protocol.cc (forwarding methods for the ++ static routing API) ++- src/node/net-device.cc (provides virtual NetDevice::MakeMulticastAddress) ++- src/arp-ipv4-interface.cc (calls NetDevice::MakeMulticastAddress) ++- src/devices/csma/csma-net-device.cc (handles multicast addressing and ++ reception). ++- src/devices/point-to-point/point-to-point-net-device.cc (implements required ++ virtual methods. ++- src/internet-node/ (several files have added tracing) ++ ++- an example script is in examples/csma-multicast.cc ++ ++2. API: ++ ++The API for adding a multicast route is: ++ ++/** ++ * @brief Add a multicast route to the static routing table. ++ * ++ * A multicast route must specify an origin IP address, a multicast group and ++ * an input network interface index as conditions and provide a vector of ++ * output network interface indices over which packets matching the conditions ++ * are sent. ++ * ++ * Typically there are two main types of multicast routes: routes of the ++ * first kind are used during forwarding. All of the conditions must be ++ * exlicitly provided. The second kind of routes are used to get packets off ++ * of a local node. The difference is in the input interface. Routes for ++ * forwarding will always have an explicit input interface specified. Routes ++ * off of a node will always set the input interface to a wildcard specified ++ * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. ++ * ++ * For routes off of a local node wildcards may be used in the origin and ++ * multicast group addresses. The wildcard used for Ipv4Adresses is that ++ * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage ++ * of a wildcard allows one to specify default behavior to varying degrees. ++ * ++ * For example, making the origin address a wildcard, but leaving the ++ * multicast group specific allows one (in the case of a node with multiple ++ * interfaces) to create different routes using different output interfaces ++ * for each multicast group. ++ * ++ * If the origin and multicast addresses are made wildcards, you have created ++ * essentially a default multicast address that can forward to multiple ++ * interfaces. Compare this to the actual default multicast address that is ++ * limited to specifying a single output interface for compatibility with ++ * existing functionality in other systems. ++ * ++ * @param origin The Ipv4Address of the origin of packets for this route. May ++ * be Ipv4Address:GetAny for open groups. ++ * @param group The Ipv4Address of the multicast group or this route. ++ * @param inputInterface The input network interface index over which to ++ * expect packets destined for this route. May be ++ * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. ++ * @param outputInterface A vector of network interface indices used to specify ++ * how to send packets to the destination(s). ++ * ++ * @see Ipv4Address ++ */ ++ Ipv4::AddMulticastRoute (Ipv4Address origin, ++ Ipv4Address group, ++ uint32_t inputInterface, ++ std::vector outputInterfaces) ++ ++To remove a route, one uses: ++ ++/** ++ * @brief Remove a route from the static multicast routing table. ++ * ++ * Externally, the multicast static routing table appears simply as a table ++ * with n entries. The one sublety of note is that if a default multicast ++ * route has been set it will appear as the zeroth entry in the table. This ++ * means that the default route may be removed by calling this method with ++ * appropriate wildcard parameters. ++ * ++ * This method causes the multicast routing table to be searched for the first ++ * route that matches the parameters and removes it. ++ * ++ * Wildcards may be provided to this function, but the wildcards are used to ++ * exacly match wildcards in the routes (see AddMulticastRoute). That is, ++ * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not ++ * remove routes with any address in the origin, but will only remove routes ++ * with "0.0.0.0" set as the the origin. ++ * ++ * @param origin The IP address specified as the origin of packets for the ++ * route. ++ * @param origin The IP address specified as the multicast group addres of ++ * the route. ++ * @param inputInterfade The network interface index specified as the expected ++ * input interface for the route. ++ * @returns True if a route was found and removed, false otherwise. ++ * ++ * @see Ipv4MulticastRoute ++ * @see Ipv4StaticRouting::AddMulticastRoute ++ */ ++ Ipv4::RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, ++ uint32_t inputInterface) ++ ++For compatibility, and to provide simplicity, one can set a default multicast ++route for a host originating data: ++ ++/** ++ * @brief Add a default multicast route to the static routing table. ++ * ++ * This is the multicast equivalent of the unicast version SetDefaultRoute. ++ * We tell the routing system what to do in the case where a specific route ++ * to a destination multicast group is not found. The system forwards ++ * packets out the specified interface in the hope that "something out there" ++ * knows better how to route the packet. This method is only used in ++ * initially sending packets off of a host. The default multicast route is ++ * not consulted during forwarding -- exact routes must be specified using ++ * AddMulticastRoute for that case. ++ * ++ * Since we're basically sending packets to some entity we think may know ++ * better what to do, we don't pay attention to "subtleties" like origin ++ * address, nor do we worry about forwarding out multiple interfaces. If the ++ * default multicast route is set, it is returned as the selected route from ++ * LookupStatic irrespective of origin or multicast group if another specific ++ * route is not found. ++ * ++ * @param outputInterface The network interface index used to specify where ++ * to send packets in the case of unknown routes. ++ * ++ * @see Ipv4Address ++ */ ++ Ipv4::SetDefaultMulticastRoute (uint32_t outputInterface) ++ ++For a host wanting to receive multicast data, the following function is used ++to join each multicast group. ++ ++ /** ++ * \brief Join a multicast group for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ */ ++ Ipv4::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ ++To stop receiving multicast data, the following function is used: ++ ++ /** ++ * \brief Leave a multicast group for a given multicast source and ++ * group. ++ * ++ * \param origin The Ipv4 address of the multicast source. ++ * \param group The multicast group address. ++ */ ++ LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); ++ ++There are new lookup functions implemented in Ipv4: ++ ++ /** ++ * \brief Find and return the interface ID of the interface that has been ++ * assigned the specified IP address. ++ * \param addr The IP address assigned to the interface of interest. ++ * \returns The index of the ipv4 interface with the given address. ++ * ++ * Each IP interface has an IP address associated with it. It is often ++ * useful to search the list of interfaces for one that corresponds to ++ * a known IP Address. This call takes an IP address as a parameter and ++ * returns the interface index of the first interface that has been assigned ++ * that address. If the address is not found, this function asserts. ++ */ ++ Ipv4::FindInterfaceForAddr (Ipv4Address addr) const; ++ ++ /** ++ * \brief Find and return the interface ID of the interface that has been ++ * assigned the specified (masked) IP address. ++ * \param addr The IP address assigned to the interface of interest. ++ * \param mask The address mask to be used in address matching. ++ * \returns The index of the ipv4 interface with the given address. ++ * ++ * Each IP interface has an IP address associated with it. It is often ++ * useful to search the list of interfaces for one that corresponds to ++ * a known IP Address. This call takes an IP address and an IP address ++ * mask as parameters and returns the interface index of the first interface ++ * that matches the masked IP address. ++ */ ++ Ipv4::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; ++ ++Also, there are various methods to lookup and iterate the static multicast ++routes of a node, in the Ipv4StaticRouting class. ++ ++3. Dependencies: ++ ++- fix for bug 69 (source Ipv4 address is set correctly for UDP) ++- fix for OnOffApplication that receives data ++ ++4. Open issues or features not included ++ ++- choose source interface on a per-group basis when a host is multihomed +diff -r f9bc98cbe5fe -r f136fc719267 src/internet-node/ipv4-static-routing.h +--- a/src/internet-node/ipv4-static-routing.h Tue Sep 04 18:06:06 2007 -0700 ++++ b/src/internet-node/ipv4-static-routing.h Thu Sep 06 15:57:53 2007 -0700 +@@ -369,14 +369,17 @@ public: + * We tell the routing system what to do in the case where a specific route + * to a destination multicast group is not found. The system forwards + * packets out the specified interface in the hope that "something out there" +- * knows better how to route the packet. +- * +- * Since we're basically forwarding packets to some entity we think may know +- * better what to do, we don't pay attention to subleties like origin address +- * and input interface, nor do we worry about forwarding out multiple +- * interfaces. If the default multicast route is set, it is returned as the +- * selected route from LookupStatic irrespective of origin, multicast group or +- * input interface if another specific route is not found. ++ * knows better how to route the packet. This method is only used in ++ * initially sending packets off of a host. The default multicast route is ++ * not consulted during forwarding -- exact routes must be specified using ++ * AddMulticastRoute for that case. ++ * ++ * Since we're basically sending packets to some entity we think may know ++ * better what to do, we don't pay attention to "subtleties" like origin ++ * address, nor do we worry about forwarding out multiple interfaces. If the ++ * default multicast route is set, it is returned as the selected route from ++ * LookupStatic irrespective of origin or multicast group if another specific ++ * route is not found. + * + * @param outputInterface The network interface index used to specify where + * to send packets in the case of unknown routes. + From ad03ea20ce5d13e186f00c500bf7ecdefb9b213f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 08:34:46 +0200 Subject: [PATCH 130/218] move inline code from header to .cc file prior to rework of Buffer --- src/common/buffer.cc | 384 ++++++++++++++++++++++++++++++++++--- src/common/buffer.h | 436 ++++--------------------------------------- 2 files changed, 402 insertions(+), 418 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 196bb4889..9d2f66687 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1,7 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005,2006 INRIA - * All rights reserved. + * Copyright (c) 2005,2006,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 @@ -20,10 +19,11 @@ */ #include "buffer.h" #include "ns3/assert.h" +#include "ns3/debug.h" #include -//#define TRACE(x) std::cout << x << std::endl; -#define TRACE(x) + +NS_DEBUG_COMPONENT_DEFINE ("Packet"); namespace ns3 { @@ -133,6 +133,350 @@ Buffer::Create (void) namespace ns3 { +Buffer::Buffer () + : m_data (Buffer::Create ()), + m_zeroAreaSize (0), + m_start (m_maxTotalAddStart), + m_size (0) +{ + if (m_start > m_data->m_size) + { + m_start = 0; + } + NS_ASSERT (m_start <= m_data->m_size); +} + +Buffer::Buffer (uint32_t dataSize) + : m_data (Buffer::Create ()), + m_zeroAreaSize (dataSize), + m_start (m_maxTotalAddStart), + m_size (0) +{ + if (m_start > m_data->m_size) + { + m_start = 0; + } + NS_ASSERT (m_start <= m_data->m_size); +} + + +Buffer::Buffer (Buffer const&o) + : m_data (o.m_data), + m_zeroAreaSize (o.m_zeroAreaSize), + m_start (o.m_start), + m_size (o.m_size) +{ + m_data->m_count++; + NS_ASSERT (m_start <= m_data->m_size); +} + +Buffer & +Buffer::operator = (Buffer const&o) +{ + if (m_data != o.m_data) + { + // not assignment to self. + m_data->m_count--; + if (m_data->m_count == 0) + { + Recycle (m_data); + } + m_data = o.m_data; + m_data->m_count++; + } + m_zeroAreaSize = o.m_zeroAreaSize; + m_start = o.m_start; + m_size = o.m_size; + NS_ASSERT (m_start <= m_data->m_size); + return *this; +} + +Buffer::~Buffer () +{ + m_data->m_count--; + if (m_data->m_count == 0) + { + Recycle (m_data); + } +} + + +uint8_t * +Buffer::GetStart (void) const +{ + return m_data->m_data + m_start; +} + +uint32_t +Buffer::GetSize (void) const +{ + return m_size + m_zeroAreaSize; +} + +Buffer::Iterator +Buffer::Begin (void) const +{ + return Buffer::Iterator (this, 0); +} +Buffer::Iterator +Buffer::End (void) const +{ + return Buffer::Iterator (this, GetSize ()); +} + + +Buffer::Iterator::Iterator () + : m_zeroStart (0), + m_zeroEnd (0), + m_dataEnd (0), + m_current (0), + m_data (0) +{} +Buffer::Iterator::Iterator (Buffer const*buffer, uint32_t current) + : m_zeroStart (buffer->m_data->m_initialStart-buffer->m_start), + m_zeroEnd (m_zeroStart+buffer->m_zeroAreaSize), + m_dataEnd (buffer->GetSize ()), + m_current (current), + m_data (buffer->m_data->m_data+buffer->m_start) +{} + +void +Buffer::Iterator::Next (void) +{ + NS_ASSERT (m_current + 1 <= m_dataEnd); + m_current++; +} +void +Buffer::Iterator::Prev (void) +{ + NS_ASSERT (m_current >= 1); + m_current--; +} +void +Buffer::Iterator::Next (uint32_t delta) +{ + NS_ASSERT (m_current + delta <= m_dataEnd); + m_current += delta; +} +void +Buffer::Iterator::Prev (uint32_t delta) +{ + NS_ASSERT (m_current >= delta); + m_current -= delta; +} +uint32_t +Buffer::Iterator::GetDistanceFrom (Iterator const &o) const +{ + NS_ASSERT (m_data == o.m_data); + int32_t start = m_current; + int32_t end = o.m_current; + int32_t diff = end - start; + if (diff < 0) + { + return -diff; + } + else + { + return diff; + } +} + +bool +Buffer::Iterator::IsEnd (void) const +{ + return m_current == m_dataEnd; +} +bool +Buffer::Iterator::IsStart (void) const +{ + return m_current == 0; +} + +uint32_t +Buffer::Iterator::GetIndex (uint32_t n) +{ + NS_ASSERT ( + (m_current + n <= m_dataEnd) && + ((m_current + n <= m_zeroStart) || + (m_current >= m_zeroEnd) || + m_zeroStart == m_zeroEnd) + ); + uint32_t index; + if (m_current < m_zeroStart) + { + index = m_current; + } + else + { + index = m_current - (m_zeroEnd-m_zeroStart); + } + return index; +} + + +void +Buffer::Iterator::Write (Iterator start, Iterator end) +{ + NS_ASSERT (start.m_data == end.m_data); + NS_ASSERT (start.m_current <= end.m_current); + NS_ASSERT (start.m_zeroStart == end.m_zeroStart); + NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd); + NS_ASSERT (m_data != start.m_data); + uint32_t size = end.m_current - start.m_current; + uint8_t *src = start.m_data + start.GetIndex (size); + uint8_t *dest = m_data + GetIndex (size); + memcpy (dest, src, size); + m_current += size; +} + +void +Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) +{ + uint8_t *current = m_data + GetIndex (len); + memset (current, data, len); + m_current += len; +} +void +Buffer::Iterator::WriteU8 (uint8_t data) +{ + m_data[GetIndex (1)] = data; + m_current++; +} +void +Buffer::Iterator::WriteU16 (uint16_t data) +{ + uint16_t *buffer = (uint16_t *)(m_data + GetIndex (2)); + *buffer = data; + m_current += 2; +} +void +Buffer::Iterator::WriteU32 (uint32_t data) +{ + uint32_t *buffer = (uint32_t *)(m_data + GetIndex (4)); + *buffer = data; + m_current += 4; +} +void +Buffer::Iterator::WriteU64 (uint64_t data) +{ + uint64_t *buffer = (uint64_t *)(m_data + GetIndex (8)); + *buffer = data; + m_current += 8; +} +void +Buffer::Iterator::WriteHtonU16 (uint16_t data) +{ + uint8_t *current = m_data + GetIndex (2); + *(current+0) = (data >> 8) & 0xff; + *(current+1) = (data >> 0) & 0xff; + m_current += 2; +} +void +Buffer::Iterator::WriteHtonU32 (uint32_t data) +{ + uint8_t *current = m_data + GetIndex (4); + *(current+0) = (data >> 24) & 0xff; + *(current+1) = (data >> 16) & 0xff; + *(current+2) = (data >> 8) & 0xff; + *(current+3) = (data >> 0) & 0xff; + m_current += 4; +} +void +Buffer::Iterator::WriteHtonU64 (uint64_t data) +{ + uint8_t *current = m_data + GetIndex (8); + *(current+0) = (data >> 56) & 0xff; + *(current+1) = (data >> 48) & 0xff; + *(current+2) = (data >> 40) & 0xff; + *(current+3) = (data >> 32) & 0xff; + *(current+4) = (data >> 24) & 0xff; + *(current+5) = (data >> 16) & 0xff; + *(current+6) = (data >> 8) & 0xff; + *(current+7) = (data >> 0) & 0xff; + m_current += 8; +} +void +Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) +{ + uint8_t *current = m_data + GetIndex (size); + memcpy (current, buffer, size); + m_current += size; +} + +uint8_t +Buffer::Iterator::ReadU8 (void) +{ + uint8_t data = m_data[GetIndex(1)]; + m_current++; + return data; +} +uint16_t +Buffer::Iterator::ReadU16 (void) +{ + uint16_t *buffer = reinterpret_cast(m_data + GetIndex (2)); + m_current += 2; + return *buffer; +} +uint32_t +Buffer::Iterator::ReadU32 (void) +{ + uint32_t *buffer = reinterpret_cast(m_data + GetIndex (4)); + m_current += 4; + return *buffer; +} +uint64_t +Buffer::Iterator::ReadU64 (void) +{ + uint64_t *buffer = reinterpret_cast(m_data + GetIndex (8)); + m_current += 8; + return *buffer; +} +uint16_t +Buffer::Iterator::ReadNtohU16 (void) +{ + uint8_t *current = m_data + GetIndex (2); + uint16_t retval = 0; + retval |= static_cast (current[0]) << 8; + retval |= static_cast (current[1]) << 0; + m_current += 2; + return retval; +} +uint32_t +Buffer::Iterator::ReadNtohU32 (void) +{ + uint8_t *current = m_data + GetIndex (4); + uint32_t retval = 0; + retval |= static_cast (current[0]) << 24; + retval |= static_cast (current[1]) << 16; + retval |= static_cast (current[2]) << 8; + retval |= static_cast (current[3]) << 0; + m_current += 4; + return retval; +} +uint64_t +Buffer::Iterator::ReadNtohU64 (void) +{ + uint8_t *current = m_data + GetIndex (8); + uint64_t retval = 0; + retval |= static_cast (current[0]) << 56; + retval |= static_cast (current[1]) << 48; + retval |= static_cast (current[2]) << 40; + retval |= static_cast (current[3]) << 32; + retval |= static_cast (current[4]) << 24; + retval |= static_cast (current[5]) << 16; + retval |= static_cast (current[6]) << 8; + retval |= static_cast (current[7]) << 0; + m_current += 8; + return retval; +} +void +Buffer::Iterator::Read (uint8_t *buffer, uint16_t size) +{ + uint8_t *current = m_data + GetIndex (size); + memcpy (buffer, current, size); + m_current += size; +} + void Buffer::AddAtStart (uint32_t start) { @@ -202,9 +546,9 @@ Buffer::AddAtStart (uint32_t start) { m_maxTotalAddStart = addedAtStart; } - TRACE ("start add="< m_data->m_size) - { - m_start = 0; - } - NS_ASSERT (m_start <= m_data->m_size); -} - -Buffer::Buffer (uint32_t dataSize) - : m_data (Buffer::Create ()), - m_zeroAreaSize (dataSize), - m_start (m_maxTotalAddStart), - m_size (0) -{ - if (m_start > m_data->m_size) - { - m_start = 0; - } - NS_ASSERT (m_start <= m_data->m_size); -} - - -Buffer::Buffer (Buffer const&o) - : m_data (o.m_data), - m_zeroAreaSize (o.m_zeroAreaSize), - m_start (o.m_start), - m_size (o.m_size) -{ - m_data->m_count++; - NS_ASSERT (m_start <= m_data->m_size); -} - -Buffer & -Buffer::operator = (Buffer const&o) -{ - if (m_data != o.m_data) - { - // not assignment to self. - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); - } - m_data = o.m_data; - m_data->m_count++; - } - m_zeroAreaSize = o.m_zeroAreaSize; - m_start = o.m_start; - m_size = o.m_size; - NS_ASSERT (m_start <= m_data->m_size); - return *this; -} - -Buffer::~Buffer () -{ - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); - } -} - - -uint8_t * -Buffer::GetStart (void) const -{ - return m_data->m_data + m_start; -} - -uint32_t -Buffer::GetSize (void) const -{ - return m_size + m_zeroAreaSize; -} - -Buffer::Iterator -Buffer::Begin (void) const -{ - return Buffer::Iterator (this, 0); -} -Buffer::Iterator -Buffer::End (void) const -{ - return Buffer::Iterator (this, GetSize ()); -} - - -Buffer::Iterator::Iterator () - : m_zeroStart (0), - m_zeroEnd (0), - m_dataEnd (0), - m_current (0), - m_data (0) -{} -Buffer::Iterator::Iterator (Buffer const*buffer, uint32_t current) - : m_zeroStart (buffer->m_data->m_initialStart-buffer->m_start), - m_zeroEnd (m_zeroStart+buffer->m_zeroAreaSize), - m_dataEnd (buffer->GetSize ()), - m_current (current), - m_data (buffer->m_data->m_data+buffer->m_start) -{} - -void -Buffer::Iterator::Next (void) -{ - NS_ASSERT (m_current + 1 <= m_dataEnd); - m_current++; -} -void -Buffer::Iterator::Prev (void) -{ - NS_ASSERT (m_current >= 1); - m_current--; -} -void -Buffer::Iterator::Next (uint32_t delta) -{ - NS_ASSERT (m_current + delta <= m_dataEnd); - m_current += delta; -} -void -Buffer::Iterator::Prev (uint32_t delta) -{ - NS_ASSERT (m_current >= delta); - m_current -= delta; -} -uint32_t -Buffer::Iterator::GetDistanceFrom (Iterator const &o) const -{ - NS_ASSERT (m_data == o.m_data); - int32_t start = m_current; - int32_t end = o.m_current; - int32_t diff = end - start; - if (diff < 0) - { - return -diff; - } - else - { - return diff; - } -} - -bool -Buffer::Iterator::IsEnd (void) const -{ - return m_current == m_dataEnd; -} -bool -Buffer::Iterator::IsStart (void) const -{ - return m_current == 0; -} - -uint32_t -Buffer::Iterator::GetIndex (uint32_t n) -{ - NS_ASSERT ( - (m_current + n <= m_dataEnd) && - ((m_current + n <= m_zeroStart) || - (m_current >= m_zeroEnd) || - m_zeroStart == m_zeroEnd) - ); - uint32_t index; - if (m_current < m_zeroStart) - { - index = m_current; - } - else - { - index = m_current - (m_zeroEnd-m_zeroStart); - } - return index; -} - - -void -Buffer::Iterator::Write (Iterator start, Iterator end) -{ - NS_ASSERT (start.m_data == end.m_data); - NS_ASSERT (start.m_current <= end.m_current); - NS_ASSERT (start.m_zeroStart == end.m_zeroStart); - NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd); - NS_ASSERT (m_data != start.m_data); - uint32_t size = end.m_current - start.m_current; - uint8_t *src = start.m_data + start.GetIndex (size); - uint8_t *dest = m_data + GetIndex (size); - memcpy (dest, src, size); - m_current += size; -} - -void -Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) -{ - uint8_t *current = m_data + GetIndex (len); - memset (current, data, len); - m_current += len; -} -void -Buffer::Iterator::WriteU8 (uint8_t data) -{ - m_data[GetIndex (1)] = data; - m_current++; -} -void -Buffer::Iterator::WriteU16 (uint16_t data) -{ - uint16_t *buffer = (uint16_t *)(m_data + GetIndex (2)); - *buffer = data; - m_current += 2; -} -void -Buffer::Iterator::WriteU32 (uint32_t data) -{ - uint32_t *buffer = (uint32_t *)(m_data + GetIndex (4)); - *buffer = data; - m_current += 4; -} -void -Buffer::Iterator::WriteU64 (uint64_t data) -{ - uint64_t *buffer = (uint64_t *)(m_data + GetIndex (8)); - *buffer = data; - m_current += 8; -} -void -Buffer::Iterator::WriteHtonU16 (uint16_t data) -{ - uint8_t *current = m_data + GetIndex (2); - *(current+0) = (data >> 8) & 0xff; - *(current+1) = (data >> 0) & 0xff; - m_current += 2; -} -void -Buffer::Iterator::WriteHtonU32 (uint32_t data) -{ - uint8_t *current = m_data + GetIndex (4); - *(current+0) = (data >> 24) & 0xff; - *(current+1) = (data >> 16) & 0xff; - *(current+2) = (data >> 8) & 0xff; - *(current+3) = (data >> 0) & 0xff; - m_current += 4; -} -void -Buffer::Iterator::WriteHtonU64 (uint64_t data) -{ - uint8_t *current = m_data + GetIndex (8); - *(current+0) = (data >> 56) & 0xff; - *(current+1) = (data >> 48) & 0xff; - *(current+2) = (data >> 40) & 0xff; - *(current+3) = (data >> 32) & 0xff; - *(current+4) = (data >> 24) & 0xff; - *(current+5) = (data >> 16) & 0xff; - *(current+6) = (data >> 8) & 0xff; - *(current+7) = (data >> 0) & 0xff; - m_current += 8; -} -void -Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) -{ - uint8_t *current = m_data + GetIndex (size); - memcpy (current, buffer, size); - m_current += size; -} - -uint8_t -Buffer::Iterator::ReadU8 (void) -{ - uint8_t data = m_data[GetIndex(1)]; - m_current++; - return data; -} -uint16_t -Buffer::Iterator::ReadU16 (void) -{ - uint16_t *buffer = reinterpret_cast(m_data + GetIndex (2)); - m_current += 2; - return *buffer; -} -uint32_t -Buffer::Iterator::ReadU32 (void) -{ - uint32_t *buffer = reinterpret_cast(m_data + GetIndex (4)); - m_current += 4; - return *buffer; -} -uint64_t -Buffer::Iterator::ReadU64 (void) -{ - uint64_t *buffer = reinterpret_cast(m_data + GetIndex (8)); - m_current += 8; - return *buffer; -} -uint16_t -Buffer::Iterator::ReadNtohU16 (void) -{ - uint8_t *current = m_data + GetIndex (2); - uint16_t retval = 0; - retval |= static_cast (current[0]) << 8; - retval |= static_cast (current[1]) << 0; - m_current += 2; - return retval; -} -uint32_t -Buffer::Iterator::ReadNtohU32 (void) -{ - uint8_t *current = m_data + GetIndex (4); - uint32_t retval = 0; - retval |= static_cast (current[0]) << 24; - retval |= static_cast (current[1]) << 16; - retval |= static_cast (current[2]) << 8; - retval |= static_cast (current[3]) << 0; - m_current += 4; - return retval; -} -uint64_t -Buffer::Iterator::ReadNtohU64 (void) -{ - uint8_t *current = m_data + GetIndex (8); - uint64_t retval = 0; - retval |= static_cast (current[0]) << 56; - retval |= static_cast (current[1]) << 48; - retval |= static_cast (current[2]) << 40; - retval |= static_cast (current[3]) << 32; - retval |= static_cast (current[4]) << 24; - retval |= static_cast (current[5]) << 16; - retval |= static_cast (current[6]) << 8; - retval |= static_cast (current[7]) << 0; - m_current += 8; - return retval; -} -void -Buffer::Iterator::Read (uint8_t *buffer, uint16_t size) -{ - uint8_t *current = m_data + GetIndex (size); - memcpy (buffer, current, size); - m_current += size; -} - -}; // namespace ns3 - +} // namespace ns3 #endif /* BUFFER_H */ From 0d27a9fdbf04846d4b2ec1861488b7238b33c519 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 17:39:18 +0200 Subject: [PATCH 131/218] small typo --- src/common/buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 9d2f66687..dae960ee2 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -23,7 +23,7 @@ #include -NS_DEBUG_COMPONENT_DEFINE ("Packet"); +NS_DEBUG_COMPONENT_DEFINE ("Buffer"); namespace ns3 { From 31a0d9eaf49c93db751843f21fb2aae508d8b159 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 18:45:00 +0200 Subject: [PATCH 132/218] add a m_dataStart member in Buffer::Iterator --- src/common/buffer.cc | 32 ++++++++++++++++++++++---------- src/common/buffer.h | 5 ++++- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index dae960ee2..e30dc7b39 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -216,15 +216,14 @@ Buffer::GetSize (void) const Buffer::Iterator Buffer::Begin (void) const { - return Buffer::Iterator (this, 0); + return Buffer::Iterator (this); } Buffer::Iterator Buffer::End (void) const { - return Buffer::Iterator (this, GetSize ()); + return Buffer::Iterator (this, false); } - Buffer::Iterator::Iterator () : m_zeroStart (0), m_zeroEnd (0), @@ -232,13 +231,26 @@ Buffer::Iterator::Iterator () m_current (0), m_data (0) {} -Buffer::Iterator::Iterator (Buffer const*buffer, uint32_t current) - : m_zeroStart (buffer->m_data->m_initialStart-buffer->m_start), - m_zeroEnd (m_zeroStart+buffer->m_zeroAreaSize), - m_dataEnd (buffer->GetSize ()), - m_current (current), - m_data (buffer->m_data->m_data+buffer->m_start) -{} +Buffer::Iterator::Iterator (Buffer const*buffer) +{ + Construct (buffer); + m_current = m_dataStart; +} +Buffer::Iterator::Iterator (Buffer const*buffer, bool dummy) +{ + Construct (buffer); + m_current = m_dataEnd; +} + +void +Buffer::Iterator::Construct (const Buffer *buffer) +{ + m_zeroStart = buffer->m_data->m_initialStart-buffer->m_start; + m_zeroEnd = m_zeroStart+buffer->m_zeroAreaSize; + m_dataStart = 0; + m_dataEnd = buffer->GetSize (); + m_data = buffer->m_data->m_data+buffer->m_start; +} void Buffer::Iterator::Next (void) diff --git a/src/common/buffer.h b/src/common/buffer.h index 4fac7835e..9a68c53ff 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -237,10 +237,13 @@ public: void Read (uint8_t *buffer, uint16_t size); private: friend class Buffer; - Iterator (Buffer const*buffer, uint32_t m_current); + Iterator (Buffer const*buffer); + Iterator (Buffer const*buffer, bool); + void Construct (const Buffer *buffer); uint32_t GetIndex (uint32_t n); uint32_t m_zeroStart; uint32_t m_zeroEnd; + uint32_t m_dataStart; uint32_t m_dataEnd; uint32_t m_current; uint8_t *m_data; From afa078f27ab3ceaba8a2939a4c718e7cc889935b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 18:49:47 +0200 Subject: [PATCH 133/218] simplify Iterator::GetDistanceFrom method --- src/common/buffer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index e30dc7b39..8bef1500e 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -280,9 +280,7 @@ uint32_t Buffer::Iterator::GetDistanceFrom (Iterator const &o) const { NS_ASSERT (m_data == o.m_data); - int32_t start = m_current; - int32_t end = o.m_current; - int32_t diff = end - start; + int32_t diff = m_current - o.m_current; if (diff < 0) { return -diff; From fea6bd90fb88eb523630f72b7f20c915974d2737 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 19:22:20 +0200 Subject: [PATCH 134/218] rewrite Iterator::WriteU8 --- src/common/buffer.cc | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 8bef1500e..659a20c46 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -227,6 +227,7 @@ Buffer::End (void) const Buffer::Iterator::Iterator () : m_zeroStart (0), m_zeroEnd (0), + m_dataStart (0), m_dataEnd (0), m_current (0), m_data (0) @@ -299,7 +300,7 @@ Buffer::Iterator::IsEnd (void) const bool Buffer::Iterator::IsStart (void) const { - return m_current == 0; + return m_current == m_dataStart; } uint32_t @@ -342,15 +343,36 @@ Buffer::Iterator::Write (Iterator start, Iterator end) void Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) { - uint8_t *current = m_data + GetIndex (len); - memset (current, data, len); - m_current += len; + for (uint32_t i = 0; i < len; i++) + { + WriteU8 (data); + } } void Buffer::Iterator::WriteU8 (uint8_t data) { - m_data[GetIndex (1)] = data; - m_current++; + if (m_current < m_dataStart) + { + // XXX trying to write outside of data area + } + else if (m_current < m_zeroStart) + { + m_data[m_current] = data; + m_current++; + } + else if (m_current < m_zeroEnd) + { + // XXX trying to write in zero area + } + else if (m_current < m_dataEnd) + { + m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; + m_current++; + } + else + { + // XXX trying to write outside of data area + } } void Buffer::Iterator::WriteU16 (uint16_t data) From 6ef554f198baae7ffbd986534049419b8ecbb306 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 19:39:47 +0200 Subject: [PATCH 135/218] re-implement all Iterator::Write and Iterator::Read methods --- src/common/buffer.cc | 217 +++++++++++++++++++++++++++++-------------- src/common/buffer.h | 2 +- 2 files changed, 150 insertions(+), 69 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 659a20c46..7fca3f140 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -354,6 +354,7 @@ Buffer::Iterator::WriteU8 (uint8_t data) if (m_current < m_dataStart) { // XXX trying to write outside of data area + NS_ASSERT (false); } else if (m_current < m_zeroStart) { @@ -363,6 +364,7 @@ Buffer::Iterator::WriteU8 (uint8_t data) else if (m_current < m_zeroEnd) { // XXX trying to write in zero area + NS_ASSERT (false); } else if (m_current < m_dataEnd) { @@ -372,141 +374,220 @@ Buffer::Iterator::WriteU8 (uint8_t data) else { // XXX trying to write outside of data area + NS_ASSERT (false); } } void Buffer::Iterator::WriteU16 (uint16_t data) { - uint16_t *buffer = (uint16_t *)(m_data + GetIndex (2)); - *buffer = data; - m_current += 2; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); } void Buffer::Iterator::WriteU32 (uint32_t data) { - uint32_t *buffer = (uint32_t *)(m_data + GetIndex (4)); - *buffer = data; - m_current += 4; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); } void Buffer::Iterator::WriteU64 (uint64_t data) { - uint64_t *buffer = (uint64_t *)(m_data + GetIndex (8)); - *buffer = data; - m_current += 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); } void Buffer::Iterator::WriteHtonU16 (uint16_t data) { - uint8_t *current = m_data + GetIndex (2); - *(current+0) = (data >> 8) & 0xff; - *(current+1) = (data >> 0) & 0xff; - m_current += 2; + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); } void Buffer::Iterator::WriteHtonU32 (uint32_t data) { - uint8_t *current = m_data + GetIndex (4); - *(current+0) = (data >> 24) & 0xff; - *(current+1) = (data >> 16) & 0xff; - *(current+2) = (data >> 8) & 0xff; - *(current+3) = (data >> 0) & 0xff; - m_current += 4; + WriteU8 ((data >> 24) & 0xff); + WriteU8 ((data >> 16) & 0xff); + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); } void Buffer::Iterator::WriteHtonU64 (uint64_t data) { - uint8_t *current = m_data + GetIndex (8); - *(current+0) = (data >> 56) & 0xff; - *(current+1) = (data >> 48) & 0xff; - *(current+2) = (data >> 40) & 0xff; - *(current+3) = (data >> 32) & 0xff; - *(current+4) = (data >> 24) & 0xff; - *(current+5) = (data >> 16) & 0xff; - *(current+6) = (data >> 8) & 0xff; - *(current+7) = (data >> 0) & 0xff; - m_current += 8; + WriteU8 ((data >> 56) & 0xff); + WriteU8 ((data >> 48) & 0xff); + WriteU8 ((data >> 40) & 0xff); + WriteU8 ((data >> 32) & 0xff); + WriteU8 ((data >> 24) & 0xff); + WriteU8 ((data >> 16) & 0xff); + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); } void Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) { - uint8_t *current = m_data + GetIndex (size); - memcpy (current, buffer, size); - m_current += size; + for (uint32_t i = 0; i < size; i++) + { + WriteU8 (buffer[i]); + } } uint8_t Buffer::Iterator::ReadU8 (void) { - uint8_t data = m_data[GetIndex(1)]; - m_current++; - return data; + if (m_current < m_dataStart) + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + else if (m_current < m_zeroStart) + { + uint8_t data = m_data[m_current]; + m_current++; + return data; + } + else if (m_current < m_zeroEnd) + { + m_current++; + return 0; + } + else if (m_current < m_dataEnd) + { + uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; + m_current++; + return data; + } + else + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + // to quiet compiler. + return 0; } uint16_t Buffer::Iterator::ReadU16 (void) { - uint16_t *buffer = reinterpret_cast(m_data + GetIndex (2)); - m_current += 2; - return *buffer; + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint16_t data = byte1; + data <<= 8; + data |= byte0; + + return data; } uint32_t Buffer::Iterator::ReadU32 (void) { - uint32_t *buffer = reinterpret_cast(m_data + GetIndex (4)); - m_current += 4; - return *buffer; + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint8_t byte2 = ReadU8 (); + uint8_t byte3 = ReadU8 (); + uint32_t data = byte3; + data <<= 8; + data |= byte2; + data <<= 8; + data |= byte1; + data <<= 8; + data |= byte0; + return data; } uint64_t Buffer::Iterator::ReadU64 (void) { - uint64_t *buffer = reinterpret_cast(m_data + GetIndex (8)); - m_current += 8; - return *buffer; + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint8_t byte2 = ReadU8 (); + uint8_t byte3 = ReadU8 (); + uint8_t byte4 = ReadU8 (); + uint8_t byte5 = ReadU8 (); + uint8_t byte6 = ReadU8 (); + uint8_t byte7 = ReadU8 (); + uint32_t data = byte7; + data <<= 8; + data |= byte6; + data <<= 8; + data |= byte5; + data <<= 8; + data |= byte4; + data <<= 8; + data |= byte3; + data <<= 8; + data |= byte2; + data <<= 8; + data |= byte1; + data <<= 8; + data |= byte0; + + return data; } uint16_t Buffer::Iterator::ReadNtohU16 (void) { - uint8_t *current = m_data + GetIndex (2); uint16_t retval = 0; - retval |= static_cast (current[0]) << 8; - retval |= static_cast (current[1]) << 0; - m_current += 2; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); return retval; } uint32_t Buffer::Iterator::ReadNtohU32 (void) { - uint8_t *current = m_data + GetIndex (4); uint32_t retval = 0; - retval |= static_cast (current[0]) << 24; - retval |= static_cast (current[1]) << 16; - retval |= static_cast (current[2]) << 8; - retval |= static_cast (current[3]) << 0; - m_current += 4; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); return retval; } uint64_t Buffer::Iterator::ReadNtohU64 (void) { - uint8_t *current = m_data + GetIndex (8); uint64_t retval = 0; - retval |= static_cast (current[0]) << 56; - retval |= static_cast (current[1]) << 48; - retval |= static_cast (current[2]) << 40; - retval |= static_cast (current[3]) << 32; - retval |= static_cast (current[4]) << 24; - retval |= static_cast (current[5]) << 16; - retval |= static_cast (current[6]) << 8; - retval |= static_cast (current[7]) << 0; - m_current += 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); return retval; } void -Buffer::Iterator::Read (uint8_t *buffer, uint16_t size) +Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) { - uint8_t *current = m_data + GetIndex (size); - memcpy (buffer, current, size); - m_current += size; + for (uint32_t i = 0; i < size; i++) + { + buffer[i] = ReadU8 (); + } } void diff --git a/src/common/buffer.h b/src/common/buffer.h index 9a68c53ff..f9b002978 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -234,7 +234,7 @@ public: * input buffer and avance the Iterator by the number of * bytes read. */ - void Read (uint8_t *buffer, uint16_t size); + void Read (uint8_t *buffer, uint32_t size); private: friend class Buffer; Iterator (Buffer const*buffer); From 93b705090aba9812aefc578913d519df82fee4a5 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 19:47:06 +0200 Subject: [PATCH 136/218] get rid of GetIndex --- src/common/buffer.cc | 40 ++++++++++------------------------------ src/common/buffer.h | 1 - 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 7fca3f140..10ee49c4f 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -246,11 +246,11 @@ Buffer::Iterator::Iterator (Buffer const*buffer, bool dummy) void Buffer::Iterator::Construct (const Buffer *buffer) { - m_zeroStart = buffer->m_data->m_initialStart-buffer->m_start; + m_zeroStart = buffer->m_data->m_initialStart; m_zeroEnd = m_zeroStart+buffer->m_zeroAreaSize; - m_dataStart = 0; - m_dataEnd = buffer->GetSize (); - m_data = buffer->m_data->m_data+buffer->m_start; + m_dataStart = buffer->m_start; + m_dataEnd = buffer->m_start + buffer->GetSize (); + m_data = buffer->m_data->m_data; } void @@ -303,28 +303,6 @@ Buffer::Iterator::IsStart (void) const return m_current == m_dataStart; } -uint32_t -Buffer::Iterator::GetIndex (uint32_t n) -{ - NS_ASSERT ( - (m_current + n <= m_dataEnd) && - ((m_current + n <= m_zeroStart) || - (m_current >= m_zeroEnd) || - m_zeroStart == m_zeroEnd) - ); - uint32_t index; - if (m_current < m_zeroStart) - { - index = m_current; - } - else - { - index = m_current - (m_zeroEnd-m_zeroStart); - } - return index; -} - - void Buffer::Iterator::Write (Iterator start, Iterator end) { @@ -334,10 +312,12 @@ Buffer::Iterator::Write (Iterator start, Iterator end) NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd); NS_ASSERT (m_data != start.m_data); uint32_t size = end.m_current - start.m_current; - uint8_t *src = start.m_data + start.GetIndex (size); - uint8_t *dest = m_data + GetIndex (size); - memcpy (dest, src, size); - m_current += size; + Iterator cur = start; + for (uint32_t i = 0; i < size; i++) + { + uint8_t data = cur.ReadU8 (); + WriteU8 (data); + } } void diff --git a/src/common/buffer.h b/src/common/buffer.h index f9b002978..f4f2956a5 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -240,7 +240,6 @@ public: Iterator (Buffer const*buffer); Iterator (Buffer const*buffer, bool); void Construct (const Buffer *buffer); - uint32_t GetIndex (uint32_t n); uint32_t m_zeroStart; uint32_t m_zeroEnd; uint32_t m_dataStart; From 0ae584ac4f70c415f9c7e6eb2586161a3fa0a2e8 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 19:50:40 +0200 Subject: [PATCH 137/218] add failing testcase --- src/common/buffer.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 10ee49c4f..71a557536 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1122,6 +1122,10 @@ BufferTest::RunTests (void) i.Prev (100); i.WriteU8 (1, 100); + buffer = Buffer (10); + buffer.Begin ().WriteU8 (1); + ENSURE_WRITTEN_BYTES (buffer, 10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + // Bug #54 { const uint32_t actualSize = 72602; From b4000f27682a84fa52451001509938b2b7f4f589 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 7 Sep 2007 19:51:46 +0200 Subject: [PATCH 138/218] add testcase --- src/common/buffer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 71a557536..743e19224 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1123,6 +1123,7 @@ BufferTest::RunTests (void) i.WriteU8 (1, 100); buffer = Buffer (10); + ENSURE_WRITTEN_BYTES (buffer, 10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); buffer.Begin ().WriteU8 (1); ENSURE_WRITTEN_BYTES (buffer, 10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); From d0e9ce2bdf02928dbeb599c6e879a0bea869e466 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sun, 9 Sep 2007 10:38:22 +0200 Subject: [PATCH 139/218] Buffer::m_size -> Buffer::m_end --- src/common/buffer.cc | 126 +++++++++++++++++++++---------------------- src/common/buffer.h | 2 +- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 743e19224..e11ce838d 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -137,26 +137,26 @@ Buffer::Buffer () : m_data (Buffer::Create ()), m_zeroAreaSize (0), m_start (m_maxTotalAddStart), - m_size (0) + m_end (0) { - if (m_start > m_data->m_size) + if (m_end > m_data->m_size) { - m_start = 0; + m_end = 0; } - NS_ASSERT (m_start <= m_data->m_size); + NS_ASSERT (m_end <= m_data->m_size); } Buffer::Buffer (uint32_t dataSize) : m_data (Buffer::Create ()), m_zeroAreaSize (dataSize), m_start (m_maxTotalAddStart), - m_size (0) + m_end (0) { - if (m_start > m_data->m_size) + if (m_end > m_data->m_size) { - m_start = 0; + m_end = 0; } - NS_ASSERT (m_start <= m_data->m_size); + NS_ASSERT (m_end <= m_data->m_size); } @@ -164,7 +164,7 @@ Buffer::Buffer (Buffer const&o) : m_data (o.m_data), m_zeroAreaSize (o.m_zeroAreaSize), m_start (o.m_start), - m_size (o.m_size) + m_end (o.m_end) { m_data->m_count++; NS_ASSERT (m_start <= m_data->m_size); @@ -186,7 +186,7 @@ Buffer::operator = (Buffer const&o) } m_zeroAreaSize = o.m_zeroAreaSize; m_start = o.m_start; - m_size = o.m_size; + m_end = o.m_end; NS_ASSERT (m_start <= m_data->m_size); return *this; } @@ -210,7 +210,7 @@ Buffer::GetStart (void) const uint32_t Buffer::GetSize (void) const { - return m_size + m_zeroAreaSize; + return m_end + m_zeroAreaSize; } Buffer::Iterator @@ -579,23 +579,23 @@ Buffer::AddAtStart (uint32_t start) { /* enough space in the buffer and not dirty. */ m_start -= start; - m_size += start; + m_end += start; } - else if (m_size + start <= m_data->m_size && !isDirty) + else if (m_end + start <= m_data->m_size && !isDirty) { /* enough space but need to move data around to fit new data */ - memmove (m_data->m_data + start, GetStart (), m_size); + memmove (m_data->m_data + start, GetStart (), m_end); NS_ASSERT (start > m_start); m_data->m_initialStart += start - m_start; m_start = 0; - m_size += start; + m_end += start; } else if (m_start < start) { /* not enough space in buffer */ - uint32_t newSize = m_size + start; + uint32_t newSize = m_end + start; struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0); - memcpy (newData->m_data + start, GetStart (), m_size); + memcpy (newData->m_data + start, GetStart (), m_end); newData->m_initialStart = m_data->m_initialStart + start; m_data->m_count--; if (m_data->m_count == 0) @@ -604,14 +604,14 @@ Buffer::AddAtStart (uint32_t start) } m_data = newData; m_start = 0; - m_size = newSize; + m_end = newSize; } else { /* enough space in the buffer but it is dirty ! */ NS_ASSERT (isDirty); struct Buffer::BufferData *newData = Buffer::Create (); - memcpy (newData->m_data + m_start, GetStart (), m_size); + memcpy (newData->m_data + m_start, GetStart (), m_end); newData->m_initialStart = m_data->m_initialStart; m_data->m_count--; if (m_data->m_count == 0) @@ -620,11 +620,11 @@ Buffer::AddAtStart (uint32_t start) } m_data = newData; m_start -= start; - m_size += start; + m_end += start; } // update dirty area m_data->m_dirtyStart = m_start; - m_data->m_dirtySize = m_size; + m_data->m_dirtySize = m_end; // update m_maxTotalAddStart uint32_t addedAtStart; if (m_data->m_initialStart > m_start) @@ -639,7 +639,7 @@ Buffer::AddAtStart (uint32_t start) { m_maxTotalAddStart = addedAtStart; } - NS_DEBUG ("start add="< n, + const Address &local, + std::string iid, + bool quiet) + : Application(n) +{ + Construct (n, local, iid, quiet); +} + +void +PacketSink::Construct (Ptr n, + const Address &local, + std::string iid, + bool quiet) +{ + m_socket = 0; + m_local = local; + m_iid = iid; + m_quiet = quiet; +} + +PacketSink::~PacketSink() +{} + +void +PacketSink::SetQuiet() +{ + m_quiet = true; +} + +void +PacketSink::DoDispose (void) +{ + m_socket = 0; + + // chain up + Application::DoDispose (); +} + + +// Application Methods +void PacketSink::StartApplication() // Called at time specified by Start +{ + // Create the socket if not already + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName (m_iid); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (m_local); + } + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&PacketSink::Receive, this)); +} + +void PacketSink::StopApplication() // Called at time specified by Stop +{ + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + + } +} + +// This callback body suggested by Joe Kopena's wiki +void PacketSink::Receive(Ptr socket, const Packet &packet, + const Address &from) +{ + if (!m_quiet) + { + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_DEBUG_UNCOND ( __PRETTY_FUNCTION__ << ": Received " << + packet.GetSize() << " bytes from " << address.GetIpv4() << " [" + << address << "]---'" << packet.PeekData() << "'"); + } + } +} + +} // Namespace ns3 diff --git a/src/applications/packet-sink.h b/src/applications/packet-sink.h new file mode 100644 index 000000000..dc3c7d41e --- /dev/null +++ b/src/applications/packet-sink.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +// +// Copyright (c) 2006 Georgia Tech Research Corporation +// +// 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 +// +// + +#ifndef __packet_sink_h__ +#define __packet_sink_h__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +/** + * \brief Receive and consume traffic generated to an IP address and port + * + * This Application can be used as a receiver for packets generated by + * traffic sourcing applications such as OnOffApplication. The constructor + * specifies the Address (IP address and port) and the transport protocol + * to use. A virtual Receive () method is installed as a callback on + * the receiving socket. By default, it prints out the size of packets + * and their address. + */ +class PacketSink : public Application +{ +public: + /** + * \param n node associated to this application + * \param local local ip address + * \param iid + * \param ontime on time random variable + * \param offtime off time random variable + */ + PacketSink (Ptr n, + const Address &local, + std::string iid, bool quiet=false); + + virtual ~PacketSink (); + + /** + * \brief Turn off the logging output for the receive callback + */ + void SetQuiet (void); + +protected: + virtual void DoDispose (void); +private: + // inherited from Application base class. + virtual void StartApplication (void); // Called at time specified by Start + virtual void StopApplication (void); // Called at time specified by Stop + + void Construct (Ptr n, + const Address &local, + std::string iid, + bool quiet); + + virtual void Receive (Ptr socket, const Packet& packet, const Address& from); + + Ptr m_socket; // Associated socket + Address m_local; // Local address to bind to + std::string m_iid; // Protocol name (e.g., "Udp") + bool m_quiet; // Governs whether receive callback is quiet + +}; + +} // namespace ns3 + +#endif + diff --git a/src/applications/wscript b/src/applications/wscript index 02aa11f7f..760f76e18 100644 --- a/src/applications/wscript +++ b/src/applications/wscript @@ -4,9 +4,11 @@ def build(bld): obj = bld.create_ns3_module('applications', ['node']) obj.source = [ 'onoff-application.cc', + 'packet-sink.cc', ] headers = bld.create_obj('ns3header') headers.source = [ 'onoff-application.h', + 'packet-sink.h', ] From d35101559328ae7d65bcf58450285ea5241a2965 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sun, 9 Sep 2007 23:24:31 -0700 Subject: [PATCH 142/218] adapt some example scripts to use the new PacketSink --- examples/simple-global-routing.cc | 22 ++++++++++++++++++++++ examples/simple-point-to-point.cc | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 75879be23..882e94e53 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -65,6 +65,7 @@ #include "ns3/ipv4-route.h" #include "ns3/point-to-point-topology.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" #include "ns3/global-route-manager.h" using namespace ns3; @@ -151,6 +152,17 @@ int main (int argc, char *argv[]) ooff->Start (Seconds (1.0)); ooff->Stop (Seconds (10.0)); + // Create a packet sink to receive these packets + // The last argument "true" disables output from the Receive callback + Ptr sink = Create ( + n3, + InetSocketAddress (Ipv4Address::GetAny (), 80), + "Udp", + true); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, @@ -162,6 +174,16 @@ int main (int argc, char *argv[]) ooff->Start (Seconds (1.1)); ooff->Stop (Seconds (10.0)); + // Create a packet sink to receive these packets + sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), 80), + "Udp", + true); + // Start the sink + sink->Start (Seconds (1.1)); + sink->Stop (Seconds (10.0)); + // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-global-routing.tr file AsciiTrace asciitrace ("simple-global-routing.tr"); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4e7657cdb..4e92ad460 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -64,6 +64,7 @@ #include "ns3/ipv4-route.h" #include "ns3/point-to-point-topology.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" using namespace ns3; @@ -153,6 +154,15 @@ int main (int argc, char *argv[]) ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); + // Create an optional packet sink to receive these packets + Ptr sink = Create ( + n3, + InetSocketAddress (Ipv4Address::GetAny (), 80), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, @@ -164,6 +174,16 @@ int main (int argc, char *argv[]) ooff->Start(Seconds(1.1)); ooff->Stop (Seconds(10.0)); + // Create a packet sink to receive these packets + sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), 80), + "Udp"); + // Start the sink + sink->Start (Seconds (1.1)); + sink->Stop (Seconds (10.0)); + sink->SetQuiet (); // disable output from the Receive callback + // Here, finish off packet routing configuration // This will likely set by some global StaticRouting object in the future Ptr ipv4; From 4adacf7e23d0aa4edb1ece12ded3234cfe05af46 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 08:53:55 +0200 Subject: [PATCH 143/218] Added tag buffer-working-before-breaking for changeset 267e2ebc28e4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index aac74dfcf..68f54ead8 100644 --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,4 @@ 38099dd26e9467b8f49f8632f22789858149a6e7 release ns-3.0.3 5701e60bf01a8ac1308945e69001e0cc07948faf release ns-3.0.4 08046b6aef37932507696a2f2f427b42d693781e release ns-3.0.5 +267e2ebc28e4e4ae2f579e1cfc29902acade0c34 buffer-working-before-breaking From 4ff7d59d0cdc6e2715fac62f920f938045611925 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 08:54:11 +0200 Subject: [PATCH 144/218] add Buffer::m_zeroAreaStart --- src/common/buffer.cc | 39 ++++++++++++++++++++++++++------------- src/common/buffer.h | 1 + 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index ffb3ac5b9..39d538e4e 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -135,6 +135,7 @@ namespace ns3 { Buffer::Buffer () : m_data (Buffer::Create ()), + m_zeroAreaStart (m_data->m_initialStart), m_zeroAreaSize (0), m_start (m_maxTotalAddStart), m_end (m_maxTotalAddStart) @@ -148,6 +149,7 @@ Buffer::Buffer () Buffer::Buffer (uint32_t dataSize) : m_data (Buffer::Create ()), + m_zeroAreaStart (m_data->m_initialStart), m_zeroAreaSize (dataSize), m_start (m_maxTotalAddStart), m_end (m_maxTotalAddStart) @@ -162,6 +164,7 @@ Buffer::Buffer (uint32_t dataSize) Buffer::Buffer (Buffer const&o) : m_data (o.m_data), + m_zeroAreaStart (o.m_zeroAreaStart), m_zeroAreaSize (o.m_zeroAreaSize), m_start (o.m_start), m_end (o.m_end) @@ -184,6 +187,7 @@ Buffer::operator = (Buffer const&o) m_data = o.m_data; m_data->m_count++; } + m_zeroAreaStart = o.m_zeroAreaStart; m_zeroAreaSize = o.m_zeroAreaSize; m_start = o.m_start; m_end = o.m_end; @@ -568,7 +572,7 @@ Buffer::AddAtStart (uint32_t start) { NS_ASSERT (m_start <= m_data->m_initialStart); bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart; - if (m_start >= start && !isDirty) + if (m_start >= start && !isDirty) { /* enough space in the buffer and not dirty. * To add: |..| @@ -577,7 +581,7 @@ Buffer::AddAtStart (uint32_t start) */ m_start -= start; } - else if (m_end + start <= m_data->m_size && !isDirty) + else if (m_end + start <= m_data->m_size && !isDirty) { /* enough space but need to move data around to fit new data * To add: |.......| @@ -589,6 +593,7 @@ Buffer::AddAtStart (uint32_t start) m_data->m_initialStart += start - m_start; m_start = 0; m_end += start; + m_zeroAreaStart += start - m_start; } else if (m_start < start) { @@ -609,6 +614,7 @@ Buffer::AddAtStart (uint32_t start) m_data = newData; m_start = 0; m_end = newSize; + m_zeroAreaStart += start; } else { @@ -678,6 +684,7 @@ Buffer::AddAtEnd (uint32_t end) m_data->m_initialStart -= m_start - newStart; m_start = newStart; m_end = m_data->m_size; + m_zeroAreaStart -= m_start - newStart; } else if (m_start + m_end + end > m_data->m_size) { @@ -698,6 +705,7 @@ Buffer::AddAtEnd (uint32_t end) m_data = newData; m_start = 0; m_end = newSize; + m_zeroAreaStart -= m_start; } else { @@ -757,8 +765,8 @@ Buffer::RemoveAtStart (uint32_t start) } else { - NS_ASSERT (m_data->m_initialStart >= m_start); - uint32_t zeroStart = m_data->m_initialStart - m_start; + NS_ASSERT (m_zeroAreaStart >= m_start); + uint32_t zeroStart = m_zeroAreaStart - m_start; uint32_t zeroEnd = zeroStart + m_zeroAreaSize; uint32_t dataEnd = m_end - m_start + m_zeroAreaSize; if (start <= zeroStart) @@ -773,6 +781,7 @@ Buffer::RemoveAtStart (uint32_t start) */ m_start += zeroStart; uint32_t zeroDelta = start - zeroStart; + m_zeroAreaStart += zeroDelta; m_zeroAreaSize -= zeroDelta; NS_ASSERT (zeroDelta <= start); } @@ -782,12 +791,14 @@ Buffer::RemoveAtStart (uint32_t start) * of end of buffer */ m_start += start - m_zeroAreaSize; + m_zeroAreaStart = m_start; m_zeroAreaSize = 0; } else { /* remove all buffer */ m_start = m_end; + m_zeroAreaStart = m_end; m_zeroAreaSize = 0; } } @@ -812,8 +823,8 @@ Buffer::RemoveAtEnd (uint32_t end) } else { - NS_ASSERT (m_data->m_initialStart >= m_start); - uint32_t zeroStart = m_data->m_initialStart - m_start; + NS_ASSERT (m_zeroAreaStart >= m_start); + uint32_t zeroStart = m_zeroAreaStart - m_start; uint32_t zeroEnd = zeroStart + m_zeroAreaSize; uint32_t dataEnd = m_end - m_start + m_zeroAreaSize; NS_ASSERT (zeroStart <= m_end - m_start); @@ -821,6 +832,7 @@ Buffer::RemoveAtEnd (uint32_t end) if (dataEnd <= end) { /* remove all buffer */ + m_zeroAreaStart = m_start; m_zeroAreaSize = 0; m_end = m_start; } @@ -829,14 +841,15 @@ Buffer::RemoveAtEnd (uint32_t end) /* remove end of buffer, zero area, part of start of buffer */ NS_ASSERT (end >= m_zeroAreaSize); m_end -= end - m_zeroAreaSize; + m_zeroAreaStart = m_end; m_zeroAreaSize = 0; } else if (dataEnd - zeroEnd <= end) { /* remove end of buffer, part of zero area */ uint32_t zeroDelta = end - (dataEnd - zeroEnd); - m_zeroAreaSize -= zeroDelta; m_end -= end - zeroDelta; + m_zeroAreaSize -= zeroDelta; } else { @@ -852,7 +865,7 @@ Buffer::RemoveAtEnd (uint32_t end) Buffer Buffer::CreateFragment (uint32_t start, uint32_t length) const { - uint32_t zeroStart = m_data->m_initialStart - m_start; + uint32_t zeroStart = m_zeroAreaStart - m_start; uint32_t zeroEnd = zeroStart + m_zeroAreaSize; if (m_zeroAreaSize != 0 && start + length > zeroStart && @@ -871,19 +884,19 @@ Buffer::CreateFullCopy (void) const { if (m_zeroAreaSize != 0) { - NS_ASSERT (m_data->m_initialStart >= m_start); - NS_ASSERT (m_end - m_start >= (m_data->m_initialStart - m_start)); + NS_ASSERT (m_zeroAreaStart >= m_start); + NS_ASSERT (m_end - m_start >= (m_zeroAreaStart - m_start)); Buffer tmp; tmp.AddAtStart (m_zeroAreaSize); tmp.Begin ().WriteU8 (0, m_zeroAreaSize); - uint32_t dataStart = m_data->m_initialStart - m_start; + uint32_t dataStart = m_zeroAreaStart - m_start; tmp.AddAtStart (dataStart); tmp.Begin ().Write (m_data->m_data+m_start, dataStart); - uint32_t dataEnd = m_end - m_start - (m_data->m_initialStart - m_start); + uint32_t dataEnd = m_end - m_start - (m_zeroAreaStart - m_start); tmp.AddAtEnd (dataEnd); Buffer::Iterator i = tmp.End (); i.Prev (dataEnd); - i.Write (m_data->m_data+m_data->m_initialStart,dataEnd); + i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); return tmp; } return *this; diff --git a/src/common/buffer.h b/src/common/buffer.h index 0702b71ec..0304df87f 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -354,6 +354,7 @@ private: static uint32_t m_maxTotalAddEnd; struct BufferData *m_data; + uint32_t m_zeroAreaStart; uint32_t m_zeroAreaSize; uint32_t m_start; uint32_t m_end; From b53bc02aef1d70e0b76fb4b25af1dd808445a054 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 16:45:52 +0200 Subject: [PATCH 145/218] rewrite the buffer code extensively --- src/common/buffer.cc | 564 +++++++++++++++++++------------------------ src/common/buffer.h | 30 +-- 2 files changed, 260 insertions(+), 334 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 39d538e4e..abb5933f0 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -20,162 +20,193 @@ #include "buffer.h" #include "ns3/assert.h" #include "ns3/debug.h" - #include NS_DEBUG_COMPONENT_DEFINE ("Buffer"); +#define DEBUG_INTERNAL_STATE(y) \ +NS_DEBUG (y << "start="<m_initialStart), - m_zeroAreaSize (0), - m_start (m_maxTotalAddStart), - m_end (m_maxTotalAddStart) { - if (m_end > m_data->m_size) - { - m_end = 0; - } - NS_ASSERT (m_end <= m_data->m_size); + Initialize (0); } Buffer::Buffer (uint32_t dataSize) - : m_data (Buffer::Create ()), - m_zeroAreaStart (m_data->m_initialStart), - m_zeroAreaSize (dataSize), - m_start (m_maxTotalAddStart), - m_end (m_maxTotalAddStart) { - if (m_end > m_data->m_size) - { - m_end = 0; - } - NS_ASSERT (m_end <= m_data->m_size); + Initialize (dataSize); } +bool +Buffer::CheckInternalState (void) const +{ + bool offsetsOk = + m_start <= m_zeroAreaStart && + m_zeroAreaStart <= m_zeroAreaEnd && + m_zeroAreaEnd <= m_end; + bool dirtyOk = + m_start >= m_data->m_dirtyStart && + m_end <= m_data->m_dirtyEnd; + bool maxZeroOk = m_maxZeroAreaStart <= m_end; + bool internalSizeOk = m_end - (m_zeroAreaEnd - m_zeroAreaStart) <= m_data->m_size && + m_start <= m_data->m_size && + m_zeroAreaStart <= m_data->m_size; + + NS_ASSERT (offsetsOk); + NS_ASSERT (dirtyOk); + NS_ASSERT (maxZeroOk); + NS_ASSERT (internalSizeOk); + + return m_data->m_count > 0 && offsetsOk && dirtyOk && + maxZeroOk && internalSizeOk; +} + +void +Buffer::Initialize (uint32_t zeroSize) +{ + m_data = Buffer::Create (0); + m_start = std::min (m_data->m_size, g_recommendedStart); + m_zeroAreaStart = m_start; + m_zeroAreaEnd = m_zeroAreaStart + zeroSize; + m_end = m_zeroAreaEnd; + m_maxZeroAreaStart = m_zeroAreaStart; + m_data->m_dirtyStart = m_start; + m_data->m_dirtyEnd = m_end; + NS_ASSERT (CheckInternalState ()); +} Buffer::Buffer (Buffer const&o) : m_data (o.m_data), + m_maxZeroAreaStart (o.m_zeroAreaStart), m_zeroAreaStart (o.m_zeroAreaStart), - m_zeroAreaSize (o.m_zeroAreaSize), + m_zeroAreaEnd (o.m_zeroAreaEnd), m_start (o.m_start), m_end (o.m_end) { m_data->m_count++; - NS_ASSERT (m_start <= m_data->m_size); + NS_ASSERT (CheckInternalState ()); } Buffer & Buffer::operator = (Buffer const&o) { + NS_ASSERT (CheckInternalState ()); if (m_data != o.m_data) { // not assignment to self. @@ -187,16 +218,19 @@ Buffer::operator = (Buffer const&o) m_data = o.m_data; m_data->m_count++; } + g_recommendedStart = std::max (g_recommendedStart, m_maxZeroAreaStart); + m_maxZeroAreaStart = o.m_maxZeroAreaStart; m_zeroAreaStart = o.m_zeroAreaStart; - m_zeroAreaSize = o.m_zeroAreaSize; + m_zeroAreaEnd = o.m_zeroAreaEnd; m_start = o.m_start; m_end = o.m_end; - NS_ASSERT (m_start <= m_data->m_size); + NS_ASSERT (CheckInternalState ()); return *this; } Buffer::~Buffer () { + g_recommendedStart = std::max (g_recommendedStart, m_maxZeroAreaStart); m_data->m_count--; if (m_data->m_count == 0) { @@ -207,17 +241,20 @@ Buffer::~Buffer () uint32_t Buffer::GetSize (void) const { - return (m_end - m_start) + m_zeroAreaSize; + NS_ASSERT (CheckInternalState ()); + return m_end - m_start; } Buffer::Iterator Buffer::Begin (void) const { + NS_ASSERT (CheckInternalState ()); return Buffer::Iterator (this); } Buffer::Iterator Buffer::End (void) const { + NS_ASSERT (CheckInternalState ()); return Buffer::Iterator (this, false); } @@ -243,10 +280,10 @@ Buffer::Iterator::Iterator (Buffer const*buffer, bool dummy) void Buffer::Iterator::Construct (const Buffer *buffer) { - m_zeroStart = buffer->m_data->m_initialStart; - m_zeroEnd = m_zeroStart+buffer->m_zeroAreaSize; + m_zeroStart = buffer->m_zeroAreaStart; + m_zeroEnd = buffer->m_zeroAreaEnd; m_dataStart = buffer->m_start; - m_dataEnd = buffer->m_start + buffer->GetSize (); + m_dataEnd = buffer->m_end; m_data = buffer->m_data->m_data; } @@ -567,11 +604,23 @@ Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) } } +uint32_t +Buffer::GetInternalSize (void) const +{ + return m_zeroAreaStart - m_start + m_end - m_zeroAreaEnd; +} +uint32_t +Buffer::GetInternalEnd (void) const +{ + return m_end - (m_zeroAreaEnd - m_zeroAreaStart); +} + void Buffer::AddAtStart (uint32_t start) { - NS_ASSERT (m_start <= m_data->m_initialStart); + NS_ASSERT (CheckInternalState ()); bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart; + NS_ASSERT (isDirty || (!isDirty && m_start == m_data->m_dirtyStart)); if (m_start >= start && !isDirty) { /* enough space in the buffer and not dirty. @@ -581,88 +630,55 @@ Buffer::AddAtStart (uint32_t start) */ m_start -= start; } - else if (m_end + start <= m_data->m_size && !isDirty) +#if 0 + // the following is an optimization + else if (m_start >= start) { - /* enough space but need to move data around to fit new data - * To add: |.......| - * Before: |*****---------***| - * After: |.......---------*| - */ - memmove (m_data->m_data + start, m_data->m_data + m_start, m_end - m_start); - NS_ASSERT (start > m_start); - m_data->m_initialStart += start - m_start; - m_start = 0; - m_end += start; - m_zeroAreaStart += start - m_start; - } - else if (m_start < start) - { - /* not enough space in buffer - * To add: |..........| - * Before: |*****---------***| - * After: |..........---------| - */ - uint32_t newSize = m_end - m_start + start; - struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0); - memcpy (newData->m_data + start, m_data->m_data + m_start, m_end - m_start); - newData->m_initialStart = m_data->m_initialStart + start; + struct BufferData *newData = Buffer::Create (m_data->m_size); + memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; - if (m_data->m_count == 0) + if (m_data->m_count == 0) { - Buffer::Deallocate (m_data); - } - m_data = newData; - m_start = 0; - m_end = newSize; - m_zeroAreaStart += start; - } - else - { - /* enough space in the buffer but it is dirty ! - * To add: |...| - * Before: |****-------***| - * After: |*...-------***| - */ - NS_ASSERT (isDirty); - struct Buffer::BufferData *newData = Buffer::Create (); - memcpy (newData->m_data + m_start, m_data->m_data + m_start, m_end - m_start); - newData->m_initialStart = m_data->m_initialStart; - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); + Buffer::Recycle (m_data); } m_data = newData; + m_start -= start; + } +#endif + else + { + NS_ASSERT (m_start < start); + uint32_t newSize = GetInternalSize () + start; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data + start, m_data->m_data + m_start, GetInternalSize ()); + m_data->m_count--; + if (m_data->m_count == 0) + { + Buffer::Recycle (m_data); + } + m_data = newData; + + int32_t delta = start - m_start; + m_start = 0; + m_zeroAreaStart += delta; + m_zeroAreaEnd += delta; + m_end += delta; + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); } // update dirty area m_data->m_dirtyStart = m_start; - m_data->m_dirtySize = m_end - m_start; - // update m_maxTotalAddStart - uint32_t addedAtStart; - if (m_data->m_initialStart > m_start) - { - addedAtStart = m_data->m_initialStart - m_start; - } - else - { - addedAtStart = 0; - } - if (addedAtStart > m_maxTotalAddStart) - { - m_maxTotalAddStart = addedAtStart; - } - NS_DEBUG ("start add="<m_initialStart); - bool isDirty = m_data->m_count > 1 && - m_end < m_data->m_dirtyStart + m_data->m_dirtySize; - if (m_end + end <= m_data->m_size && !isDirty) + NS_ASSERT (CheckInternalState ()); + bool isDirty = m_data->m_count > 1 && m_end < m_data->m_dirtyEnd; + NS_ASSERT (isDirty || (!isDirty && m_end == m_data->m_dirtyEnd)); + if (GetInternalEnd () + end <= m_data->m_size && !isDirty) { /* enough space in buffer and not dirty * Add: |...| @@ -671,203 +687,126 @@ Buffer::AddAtEnd (uint32_t end) */ m_end += end; } - else if (m_end + end <= m_data->m_size && !isDirty) +#if 0 + // this is an optimization + else if (GetInternalEnd () + end > m_data->m_size) { - /* enough space but need to move data around to fit the extra data - * Add: |...| - * Before: |**-----**| - * After: |*-----...| - */ - uint32_t newStart = m_data->m_size - (m_end - m_start + end); - NS_ASSERT (newStart < m_start); - memmove (m_data->m_data + newStart, m_data->m_data + m_start, m_end - m_start); - m_data->m_initialStart -= m_start - newStart; - m_start = newStart; - m_end = m_data->m_size; - m_zeroAreaStart -= m_start - newStart; - } - else if (m_start + m_end + end > m_data->m_size) - { - /* not enough space in buffer - * Add: |.......| - * Before: |***------**| - * After: |------.......| - */ - uint32_t newSize = m_end - m_start + end; - struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0); - memcpy (newData->m_data, m_data->m_data + m_start, m_end - m_start); - newData->m_initialStart = m_data->m_initialStart - m_start; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; if (m_data->m_count == 0) { - Buffer::Deallocate (m_data); + Buffer::Recycle (m_data); } m_data = newData; - m_start = 0; - m_end = newSize; - m_zeroAreaStart -= m_start; - } - else + + m_end += end; + } +#endif + else { - /* enough space in the buffer but it is dirty ! - * Add: |...| - * Before: |**-----*****| - * After: |**-----...**| - */ - NS_ASSERT (isDirty); - struct Buffer::BufferData *newData = Buffer::Create (); - memcpy (newData->m_data + m_start, m_data->m_data + m_start, m_end - m_start); - newData->m_initialStart = m_data->m_initialStart; + uint32_t newSize = GetInternalSize () + end; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; - if (m_data->m_count == 0) + if (m_data->m_count == 0) { - Recycle (m_data); + Buffer::Recycle (m_data); } m_data = newData; + + + m_zeroAreaStart -= m_start; + m_zeroAreaEnd -= m_start; + m_end -= m_start; + m_start = 0; + m_end += end; } // update dirty area m_data->m_dirtyStart = m_start; - m_data->m_dirtySize = m_end; - // update m_maxTotalAddEnd - uint32_t endLoc = m_end; - uint32_t addedAtEnd; - if (m_data->m_initialStart < endLoc) - { - addedAtEnd = endLoc - m_data->m_initialStart; - } - else - { - addedAtEnd = 0; - } - if (addedAtEnd > m_maxTotalAddEnd) - { - m_maxTotalAddEnd = addedAtEnd; - } - NS_DEBUG ("end add="<= m_start); - uint32_t zeroStart = m_zeroAreaStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaSize; - uint32_t dataEnd = m_end - m_start + m_zeroAreaSize; - if (start <= zeroStart) - { - /* only remove start of buffer - */ - m_start += start; - } - else if (start <= zeroEnd) - { - /* remove start of buffer _and_ start of zero area - */ - m_start += zeroStart; - uint32_t zeroDelta = start - zeroStart; - m_zeroAreaStart += zeroDelta; - m_zeroAreaSize -= zeroDelta; - NS_ASSERT (zeroDelta <= start); - } - else if (start <= dataEnd) - { - /* remove start of buffer, complete zero area, and part - * of end of buffer - */ - m_start += start - m_zeroAreaSize; - m_zeroAreaStart = m_start; - m_zeroAreaSize = 0; - } - else - { - /* remove all buffer */ - m_start = m_end; - m_zeroAreaStart = m_end; - m_zeroAreaSize = 0; - } + /* remove all buffer */ + m_start = m_end; + m_zeroAreaStart = m_end; + m_zeroAreaEnd = m_end; } - NS_DEBUG ("start remove="< m_zeroAreaEnd) { - if ((m_end - m_start) <= end) - { - m_end = m_start; - } - else - { - m_end -= end; - } - } - else - { - NS_ASSERT (m_zeroAreaStart >= m_start); - uint32_t zeroStart = m_zeroAreaStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaSize; - uint32_t dataEnd = m_end - m_start + m_zeroAreaSize; - NS_ASSERT (zeroStart <= m_end - m_start); - NS_ASSERT (zeroEnd <= m_end - m_start + m_zeroAreaSize); - if (dataEnd <= end) - { - /* remove all buffer */ - m_zeroAreaStart = m_start; - m_zeroAreaSize = 0; - m_end = m_start; - } - else if (dataEnd - zeroStart <= end) - { - /* remove end of buffer, zero area, part of start of buffer */ - NS_ASSERT (end >= m_zeroAreaSize); - m_end -= end - m_zeroAreaSize; - m_zeroAreaStart = m_end; - m_zeroAreaSize = 0; - } - else if (dataEnd - zeroEnd <= end) - { - /* remove end of buffer, part of zero area */ - uint32_t zeroDelta = end - (dataEnd - zeroEnd); - m_end -= end - zeroDelta; - m_zeroAreaSize -= zeroDelta; - } - else - { - /* remove part of end of buffer */ - m_end -= end; - } + /* remove part of end of buffer */ + m_end = newEnd; } - NS_DEBUG ("end remove="< zeroStart && start <= zeroEnd) { @@ -882,13 +821,13 @@ Buffer::CreateFragment (uint32_t start, uint32_t length) const Buffer Buffer::CreateFullCopy (void) const { - if (m_zeroAreaSize != 0) + if (m_zeroAreaEnd != 0) { NS_ASSERT (m_zeroAreaStart >= m_start); NS_ASSERT (m_end - m_start >= (m_zeroAreaStart - m_start)); Buffer tmp; - tmp.AddAtStart (m_zeroAreaSize); - tmp.Begin ().WriteU8 (0, m_zeroAreaSize); + tmp.AddAtStart (m_zeroAreaEnd); + tmp.Begin ().WriteU8 (0, m_zeroAreaEnd); uint32_t dataStart = m_zeroAreaStart - m_start; tmp.AddAtStart (dataStart); tmp.Begin ().Write (m_data->m_data+m_start, dataStart); @@ -927,6 +866,7 @@ Buffer::PeekData (void) const #include "ns3/random-variable.h" #include + namespace ns3 { class BufferTest: public Test { diff --git a/src/common/buffer.h b/src/common/buffer.h index 0304df87f..0aebc63e6 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -329,33 +329,19 @@ public: Buffer (uint32_t dataSize); ~Buffer (); private: - struct BufferData { - uint32_t m_count; - uint32_t m_size; - uint32_t m_initialStart; - uint32_t m_dirtyStart; - uint32_t m_dirtySize; - uint8_t m_data[1]; - }; - class BufferDataList : public std::vector - { - public: - ~BufferDataList (); - }; void TransformIntoRealBuffer (void) const; - static void Recycle (struct Buffer::BufferData *data); - static struct Buffer::BufferData *Create (void); - static struct Buffer::BufferData *Allocate (uint32_t size, uint32_t start); - static void Deallocate (struct Buffer::BufferData *data); - - static BufferDataList m_freeList; - static uint32_t m_maxTotalAddStart; - static uint32_t m_maxTotalAddEnd; + bool CheckInternalState (void) const; + void Initialize (uint32_t zeroSize); + uint32_t GetInternalSize (void) const; + uint32_t GetInternalEnd (void) const; + static void Recycle (struct BufferData *data); + static struct BufferData *Create (uint32_t size); struct BufferData *m_data; + uint32_t m_maxZeroAreaStart; uint32_t m_zeroAreaStart; - uint32_t m_zeroAreaSize; + uint32_t m_zeroAreaEnd; uint32_t m_start; uint32_t m_end; }; From c16118d6b5fb69e042a326c98c34d9e797b6acd9 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 16:55:03 +0200 Subject: [PATCH 146/218] improve debugging output --- src/common/packet.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/packet.cc b/src/common/packet.cc index 5159f3e2c..a64855148 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -243,7 +243,7 @@ PacketTest::RunTests (void) packet.GetSize ()); if (msg != "hello world") { - Failure () << "expected size 'hello world', got " << msg << std::endl; + Failure () << "expected 'hello world', got '" << msg << "'" << std::endl; ok = false; } From 9b5f9664162ff0c98d2d533c60201da4ba63f8ab Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 16:55:26 +0200 Subject: [PATCH 147/218] add state checking and fix Buffer::CreateFullCopy --- src/common/buffer.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index abb5933f0..a4d8b3686 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -804,6 +804,7 @@ Buffer::RemoveAtEnd (uint32_t end) Buffer Buffer::CreateFragment (uint32_t start, uint32_t length) const { + NS_ASSERT (CheckInternalState ()); uint32_t zeroStart = m_zeroAreaStart - m_start; uint32_t zeroEnd = zeroStart + m_zeroAreaEnd; if (m_zeroAreaEnd != 0 && @@ -815,44 +816,49 @@ Buffer::CreateFragment (uint32_t start, uint32_t length) const Buffer tmp = *this; tmp.RemoveAtStart (start); tmp.RemoveAtEnd (GetSize () - (start + length)); + NS_ASSERT (CheckInternalState ()); return tmp; } Buffer Buffer::CreateFullCopy (void) const { + NS_ASSERT (CheckInternalState ()); if (m_zeroAreaEnd != 0) { - NS_ASSERT (m_zeroAreaStart >= m_start); - NS_ASSERT (m_end - m_start >= (m_zeroAreaStart - m_start)); Buffer tmp; - tmp.AddAtStart (m_zeroAreaEnd); - tmp.Begin ().WriteU8 (0, m_zeroAreaEnd); + tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart); + tmp.Begin ().WriteU8 (0, m_zeroAreaEnd - m_zeroAreaStart); uint32_t dataStart = m_zeroAreaStart - m_start; tmp.AddAtStart (dataStart); tmp.Begin ().Write (m_data->m_data+m_start, dataStart); - uint32_t dataEnd = m_end - m_start - (m_zeroAreaStart - m_start); + uint32_t dataEnd = m_end - m_zeroAreaEnd; tmp.AddAtEnd (dataEnd); Buffer::Iterator i = tmp.End (); i.Prev (dataEnd); - i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); + i.Write (m_data->m_data+m_zeroAreaEnd,dataEnd); return tmp; } + NS_ASSERT (CheckInternalState ()); return *this; } void Buffer::TransformIntoRealBuffer (void) const { + NS_ASSERT (CheckInternalState ()); Buffer tmp = CreateFullCopy (); *const_cast (this) = tmp; + NS_ASSERT (CheckInternalState ()); } uint8_t const* Buffer::PeekData (void) const { + NS_ASSERT (CheckInternalState ()); TransformIntoRealBuffer (); + NS_ASSERT (CheckInternalState ()); return m_data->m_data + m_start; } From 07c4a22756bfa4f8c43d2482d8d0e357825933d4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 16:57:25 +0200 Subject: [PATCH 148/218] max zero area start can be bigger than m_end if data is removed from end of buffer --- src/common/buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index a4d8b3686..163367373 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -163,7 +163,7 @@ Buffer::CheckInternalState (void) const bool dirtyOk = m_start >= m_data->m_dirtyStart && m_end <= m_data->m_dirtyEnd; - bool maxZeroOk = m_maxZeroAreaStart <= m_end; + bool maxZeroOk = m_maxZeroAreaStart <= m_data->m_size; bool internalSizeOk = m_end - (m_zeroAreaEnd - m_zeroAreaStart) <= m_data->m_size && m_start <= m_data->m_size && m_zeroAreaStart <= m_data->m_size; From 96d324b16b4a038c0ced85152465a367bb5dff67 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 17:43:33 +0200 Subject: [PATCH 149/218] CreateFullCopy: the data area at the end of the buffer starts at m_zeroAreaStart. AddAtStart: the assert should be used only when the optimization is enabled. --- src/common/buffer.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 163367373..b98e38e02 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -645,10 +645,13 @@ Buffer::AddAtStart (uint32_t start) m_start -= start; } -#endif else { NS_ASSERT (m_start < start); +#else + else + { +#endif uint32_t newSize = GetInternalSize () + start; struct BufferData *newData = Buffer::Create (newSize); memcpy (newData->m_data + start, m_data->m_data + m_start, GetInternalSize ()); @@ -836,7 +839,7 @@ Buffer::CreateFullCopy (void) const tmp.AddAtEnd (dataEnd); Buffer::Iterator i = tmp.End (); i.Prev (dataEnd); - i.Write (m_data->m_data+m_zeroAreaEnd,dataEnd); + i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); return tmp; } NS_ASSERT (CheckInternalState ()); From d2ed77dfb6d919dee68725769b8c9943aff56717 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 17:55:39 +0200 Subject: [PATCH 150/218] it is possible to zeroAreaStart to be bigger than the data buffer size --- src/common/buffer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index b98e38e02..bf4e91053 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -163,18 +163,16 @@ Buffer::CheckInternalState (void) const bool dirtyOk = m_start >= m_data->m_dirtyStart && m_end <= m_data->m_dirtyEnd; - bool maxZeroOk = m_maxZeroAreaStart <= m_data->m_size; bool internalSizeOk = m_end - (m_zeroAreaEnd - m_zeroAreaStart) <= m_data->m_size && m_start <= m_data->m_size && m_zeroAreaStart <= m_data->m_size; NS_ASSERT (offsetsOk); NS_ASSERT (dirtyOk); - NS_ASSERT (maxZeroOk); NS_ASSERT (internalSizeOk); return m_data->m_count > 0 && offsetsOk && dirtyOk && - maxZeroOk && internalSizeOk; + internalSizeOk; } void From a8407e9a2953c4a41a56f94d15c88a591b690d3f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 18:43:29 +0200 Subject: [PATCH 151/218] update carefully m_maxZeroAreaSize and update correctly m_end and m_zeroAreaEnd in RemoveAtStart --- src/common/buffer.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index bf4e91053..7dbb15bf9 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -665,8 +665,8 @@ Buffer::AddAtStart (uint32_t start) m_zeroAreaStart += delta; m_zeroAreaEnd += delta; m_end += delta; - m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); // update dirty area m_data->m_dirtyStart = m_start; m_data->m_dirtyEnd = m_end; @@ -724,6 +724,7 @@ Buffer::AddAtEnd (uint32_t end) m_end += end; } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); // update dirty area m_data->m_dirtyStart = m_start; m_data->m_dirtyEnd = m_end; @@ -746,25 +747,32 @@ Buffer::RemoveAtStart (uint32_t start) { /* remove start of buffer _and_ start of zero area */ - m_start = newStart; - m_zeroAreaStart = newStart; + uint32_t delta = newStart - m_zeroAreaStart; + m_start = m_zeroAreaStart; + m_zeroAreaEnd -= delta; + m_end -= delta; } else if (newStart <= m_end) { /* remove start of buffer, complete zero area, and part * of end of buffer */ - m_start = newStart; - m_zeroAreaStart = newStart; - m_zeroAreaEnd = newStart; + NS_ASSERT (m_end >= start); + uint32_t zeroSize = m_zeroAreaEnd - m_zeroAreaStart; + m_start = newStart - zeroSize; + m_end -= zeroSize; + m_zeroAreaStart = m_start; + m_zeroAreaEnd = m_start; } else { /* remove all buffer */ + m_end -= m_zeroAreaEnd - m_zeroAreaStart; m_start = m_end; - m_zeroAreaStart = m_end; m_zeroAreaEnd = m_end; + m_zeroAreaStart = m_end; } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); DEBUG_INTERNAL_STATE ("rem start=" << start << ", "); NS_ASSERT (CheckInternalState ()); } @@ -798,6 +806,7 @@ Buffer::RemoveAtEnd (uint32_t end) m_zeroAreaEnd = m_start; m_zeroAreaStart = m_start; } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); DEBUG_INTERNAL_STATE ("rem end=" << end << ", "); NS_ASSERT (CheckInternalState ()); } From 31c8e95361aa3a62ccbac8eb19a953799919edda Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 18:49:00 +0200 Subject: [PATCH 152/218] fix buggy assert --- src/common/buffer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 7dbb15bf9..2c38d2035 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -618,7 +618,6 @@ Buffer::AddAtStart (uint32_t start) { NS_ASSERT (CheckInternalState ()); bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart; - NS_ASSERT (isDirty || (!isDirty && m_start == m_data->m_dirtyStart)); if (m_start >= start && !isDirty) { /* enough space in the buffer and not dirty. @@ -626,6 +625,7 @@ Buffer::AddAtStart (uint32_t start) * Before: |*****---------***| * After: |***..---------***| */ + NS_ASSERT (m_data->m_count == 1 || m_start == m_data->m_dirtyStart); m_start -= start; } #if 0 @@ -678,7 +678,6 @@ Buffer::AddAtEnd (uint32_t end) { NS_ASSERT (CheckInternalState ()); bool isDirty = m_data->m_count > 1 && m_end < m_data->m_dirtyEnd; - NS_ASSERT (isDirty || (!isDirty && m_end == m_data->m_dirtyEnd)); if (GetInternalEnd () + end <= m_data->m_size && !isDirty) { /* enough space in buffer and not dirty @@ -686,6 +685,7 @@ Buffer::AddAtEnd (uint32_t end) * Before: |**----*****| * After: |**----...**| */ + NS_ASSERT (m_data->m_count == 1 || m_end == m_data->m_dirtyEnd); m_end += end; } #if 0 From d90633ba7cf117d333c0b75047fdb9cd223ffc76 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 10 Sep 2007 18:52:48 +0200 Subject: [PATCH 153/218] we handle gustavo's testcase now. Fix for bug 72 --- src/common/packet-metadata-test.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/packet-metadata-test.cc b/src/common/packet-metadata-test.cc index edca62626..ac4d1f994 100644 --- a/src/common/packet-metadata-test.cc +++ b/src/common/packet-metadata-test.cc @@ -673,6 +673,13 @@ PacketMetadataTest::RunTests (void) p = DoAddHeader (p); CHECK_HISTORY (p, 2, 10, 10); + p = Packet (10); + ADD_HEADER (p, 8); + ADD_TRAILER (p, 8); + ADD_TRAILER (p, 8); + p.RemoveAtStart (8+10+8); + CHECK_HISTORY (p, 1, 8); + return ok; } From 6961ddf5b51edff80a8a25ef9352557f23ef6a83 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 10 Sep 2007 15:57:33 -0700 Subject: [PATCH 154/218] name changes missed --- examples/csma-broadcast.cc | 8 ++++---- src/internet-node/udp-socket.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index 1cb9faa75..effbcc310 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -103,13 +103,13 @@ int main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); - uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, + uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, Eui48Address("10:54:23:54:0:50")); - uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel1, + uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, Eui48Address("10:54:23:54:0:51")); - uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0, Eui48Address("10:54:23:54:23:51")); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel1, + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1, Eui48Address("10:54:23:54:23:52")); // Later, we add IP addresses. diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 01de3e989..1183ce7d9 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -255,7 +255,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) int UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) { - NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << addr << ", " << + NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << dest << ", " << port << ")"); Ipv4Route routeToDest; From 2aea02f088f5fdc97f6c14e40cfb41250bdde6f9 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 08:27:15 +0200 Subject: [PATCH 155/218] ignore waf crap --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index d5b25104e..6754560cf 100644 --- a/.hgignore +++ b/.hgignore @@ -7,3 +7,4 @@ build doc/html.* doc/latex.* .lock-wscript +.waf* From 1b7b89472da0f572f6854c65426f85cc9bec0dcf Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 08:27:27 +0200 Subject: [PATCH 156/218] re-enable packet benchmarking --- utils/bench-packets.cc | 35 +++++++++++++++++++++++++---------- utils/wscript | 3 +++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index a6986d272..29c1044e4 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -32,12 +32,15 @@ class BenchHeader : public Header public: BenchHeader (); bool IsOk (void) const; + + static uint32_t GetUid (void); + + std::string GetName (void) const; + void Print (std::ostream &os) const; + uint32_t GetSerializedSize (void) const; + void Serialize (Buffer::Iterator start) const; + uint32_t Deserialize (Buffer::Iterator start); private: - virtual std::string DoGetName (void) const; - virtual void PrintTo (std::ostream &os) const; - virtual uint32_t GetSerializedSize (void) const; - virtual void SerializeTo (Buffer::Iterator start) const; - virtual uint32_t DeserializeFrom (Buffer::Iterator start); bool m_ok; }; @@ -53,9 +56,19 @@ BenchHeader::IsOk (void) const return m_ok; } +template +uint32_t +BenchHeader::GetUid (void) +{ + std::ostringstream oss; + oss << "BenchHeader" << N; + static uint32_t uid = AllocateUid > (oss.str ()); + return uid; +} + template std::string -BenchHeader::DoGetName (void) const +BenchHeader::GetName (void) const { std::ostringstream oss; oss << N; @@ -64,7 +77,7 @@ BenchHeader::DoGetName (void) const template void -BenchHeader::PrintTo (std::ostream &os) const +BenchHeader::Print (std::ostream &os) const { NS_ASSERT (false); } @@ -76,13 +89,13 @@ BenchHeader::GetSerializedSize (void) const } template void -BenchHeader::SerializeTo (Buffer::Iterator start) const +BenchHeader::Serialize (Buffer::Iterator start) const { start.WriteU8 (N, N); } template uint32_t -BenchHeader::DeserializeFrom (Buffer::Iterator start) +BenchHeader::Deserialize (Buffer::Iterator start) { m_ok = true; for (int i = 0; i < N; i++) @@ -156,6 +169,7 @@ benchPtrC (uint32_t n) } } +#if 0 static void benchPrint (uint32_t n) { @@ -171,6 +185,7 @@ benchPrint (uint32_t n) p.Print (std::cerr, printer); } } +#endif static void @@ -205,7 +220,7 @@ int main (int argc, char *argv[]) runBench (&benchPtrC, n, "c"); Packet::EnableMetadata (); - runBench (&benchPrint, n, "print"); + //runBench (&benchPrint, n, "print"); PacketMetadata::SetOptOne (false); runBench (&benchPtrA, n, "meta-a"); runBench (&benchPtrB, n, "meta-b"); diff --git a/utils/wscript b/utils/wscript index d64d46dc5..464d974f1 100644 --- a/utils/wscript +++ b/utils/wscript @@ -14,5 +14,8 @@ def build(bld): obj = bld.create_ns3_program('bench-simulator', ['simulator']) obj.source = 'bench-simulator.cc' + obj = bld.create_ns3_program('bench-packets', ['common']) + obj.source = 'bench-packets.cc' + obj = bld.create_ns3_program('replay-simulation', ['simulator']) obj.source = 'replay-simulation.cc' From 3c1447b99fd0d6d3c0e53969a66a7d266e58f6f9 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 10:35:56 +0200 Subject: [PATCH 157/218] avoid allocating strings all the time. --- utils/bench-packets.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index 29c1044e4..e16c17b02 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -35,7 +35,7 @@ public: static uint32_t GetUid (void); - std::string GetName (void) const; + static std::string GetName (void); void Print (std::ostream &os) const; uint32_t GetSerializedSize (void) const; void Serialize (Buffer::Iterator start) const; @@ -60,18 +60,16 @@ template uint32_t BenchHeader::GetUid (void) { - std::ostringstream oss; - oss << "BenchHeader" << N; - static uint32_t uid = AllocateUid > (oss.str ()); + static uint32_t uid = AllocateUid > (GetName ()); return uid; } template std::string -BenchHeader::GetName (void) const +BenchHeader::GetName (void) { std::ostringstream oss; - oss << N; + oss << "BenchHeader" << N; return oss.str (); } From 45e4fb9322960d724fb5b5939c3fa8b55df96e10 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 11 Sep 2007 11:04:06 +0100 Subject: [PATCH 158/218] Update and fix (entries are searched regexps, not globs) the hg ignored files list. --- .hgignore | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.hgignore b/.hgignore index 6754560cf..c19d9d91a 100644 --- a/.hgignore +++ b/.hgignore @@ -1,10 +1,10 @@ -.*.orig$ -.*\.o$ -.*~$ -build-dir -build -.*\.sconsign -doc/html.* -doc/latex.* -.lock-wscript -.waf* +\.rej$ +\.orig$ +\.o$ +~$ +^build-dir +^build +^doc/html +^doc/latex +^\.lock-wscript +^\.waf From b6e429bffff0181fe417eb2883dc7b0118109e2f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 12:42:37 +0200 Subject: [PATCH 159/218] add a few missing doxygen method documentations --- src/core/trace-doc.h | 71 ++++++++++++++++++++++++++++++++++----- src/core/trace-resolver.h | 31 +++++++++++++++++ src/node/node-list.h | 22 +++++++++++- 3 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/core/trace-doc.h b/src/core/trace-doc.h index 6e2ec0600..e3236826a 100644 --- a/src/core/trace-doc.h +++ b/src/core/trace-doc.h @@ -6,39 +6,92 @@ namespace ns3 { +/** + * \brief describe the signature of a trace source + */ class TraceDoc { typedef std::vector > ArgVector; public: typedef ArgVector::const_iterator Iterator; TraceDoc (); + /** + * \param help a description of the purpose of the trace source + */ TraceDoc (std::string help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + */ TraceDoc (std::string help, - std::string arg0Type, - std::string arg0Help); - TraceDoc (std::string help, - std::string arg0Type, - std::string arg0Help, std::string arg1Type, std::string arg1Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + */ TraceDoc (std::string help, - std::string arg0Type, - std::string arg0Help, std::string arg1Type, std::string arg1Help, std::string arg2Type, std::string arg2Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + * \param arg3Type the fully-qualified typename of the third argument of the trace source + * \param arg3Help the purpose of the third argument of the trace source + */ TraceDoc (std::string help, - std::string arg0Type, - std::string arg0Help, std::string arg1Type, std::string arg1Help, std::string arg2Type, std::string arg2Help, std::string arg3Type, std::string arg3Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + * \param arg3Type the fully-qualified typename of the third argument of the trace source + * \param arg3Help the purpose of the third argument of the trace source + * \param arg4Type the fully-qualified typename of the fourth argument of the trace source + * \param arg4Help the purpose of the fourth argument of the trace source + */ + TraceDoc (std::string help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help, + std::string arg4Type, + std::string arg4Help); + /** + * \returns the help string associated to this trace source + */ std::string GetHelp (void) const; + /** + * \returns an iterator which points to the first descriptor of the trace source. + * + * Each descriptor is a pair of strings. The first one describes the type of the argument + * while the second one describeds the purpose of the argument. + */ Iterator ArgsBegin (void) const; + /** + * \returns an iterator which points to the last descriptor of the trace source. + * + * Each descriptor is a pair of strings. The first one describes the type of the argument + * while the second one describeds the purpose of the argument. + */ Iterator ArgsEnd (void) const; private: ArgVector m_argVector; diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h index 3db2b42c3..027beb5c1 100644 --- a/src/core/trace-resolver.h +++ b/src/core/trace-resolver.h @@ -70,13 +70,28 @@ public: */ virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; + /** + * \brief hold a list of trace sources + */ class SourceCollection { public: + /** + * \brief describe a single trace source + */ struct Source { + /** + * The trace path associated to this trace source + */ std::string path; + /** + * The trace context associated to this trace source + */ TraceContext context; + /** + * Document the signature of this trace source + */ TraceDoc doc; }; typedef std::vector::const_iterator Iterator; @@ -84,7 +99,15 @@ public: const TraceContext &context, const TraceDoc &doc); + /** + * \returns an iterator which points to the first element of the set of + * trace sources collected in this SourceCollection object. + */ Iterator Begin (void) const; + /** + * \returns an iterator which points to the last element of the set of + * trace sources collected in this SourceCollection object. + */ Iterator End (void) const; private: typedef std::vector SourceVector; @@ -101,6 +124,14 @@ public: virtual void CollectSources (std::string path, const TraceContext &context, SourceCollection *collection) = 0; + /** + * \param os the output stream to which ascii output should be written. + * \param context the context associated to the current recursive level. + * + * This method is invoked recursively until each trace source has been + * connected to a trace sink which can output an ascii representation + * of each trace event on the output stream specified. + */ virtual void TraceAll (std::ostream &os, const TraceContext &context) = 0; protected: /** diff --git a/src/node/node-list.h b/src/node/node-list.h index dc0e69d8c..ef3ee6348 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -91,6 +91,8 @@ public: * * Connect input callback to all trace sources which match * the input namespace regexp. + * A tutorial which explains how to use this method can be + * found in the \ref tracing section. */ static void Connect (std::string name, const CallbackBase &cb); /** @@ -101,9 +103,27 @@ public: * the input namespace regexp. */ static void Disconnect (std::string name, const CallbackBase &cb); + /** + * \param os the output stream on which the content of each trace event should be + * dumped in ascii format. + * + * Enable _every_ trace source accessible from the NodeList and write to the + * output stream an ascii representation of each trace event. + * This method is very useful to get quick-and-dirty trace output from a + * simulation. + * More fancy tracing output could be generated with the ns3::NodeList::Connect + * method as explained in the \ref tracing section. + */ static void TraceAll (std::ostream &os); + /** + * \returns the trace resolver used by the ns3::NodeList::Connect, + * ns3::NodeList::Disconnect, and, ns3::NodeList::TraceAll methods. + * + * Using this method directly is not really recommended. Instead, users + * should use one of the three methods ns3::NodeList::Connect, + * ns3::NodeList::Disconnect, or, ns3::NodeList::TraceAll methods. + */ static Ptr GetTraceResolver (void); -private: }; }//namespace ns3 From 2f0b3d686bf2499da087402f47bd857f70ac4c7b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 13:47:17 +0200 Subject: [PATCH 160/218] print some statistics about free list efficiency --- src/common/buffer.cc | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 2c38d2035..9e93e0b38 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -29,7 +29,8 @@ NS_DEBUG (y << "start="<m_count > 1 && m_end < m_data->m_dirtyEnd; + if (GetInternalEnd () + end <= m_data->m_size && !isDirty) + { + /* enough space in buffer and not dirty + * Add: |...| + * Before: |**----*****| + * After: |**----...**| + */ + NS_ASSERT (m_data->m_count == 1 || m_end == m_data->m_dirtyEnd); + m_end += end; + + g_nAddNoRealloc++; + } +#if 0 + // this is an optimization + else if (GetInternalEnd () + end > m_data->m_size) + { + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); + m_data->m_count--; + if (m_data->m_count == 0) + { + Buffer::Recycle (m_data); + } + m_data = newData; + + m_end += end; + } +#endif + else + { + uint32_t newSize = GetInternalSize () + end; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data, m_data->m_data + m_start, GetInternalSize ()); + m_data->m_count--; + if (m_data->m_count == 0) + { + Buffer::Recycle (m_data); + } + m_data = newData; + + + m_zeroAreaStart -= m_start; + m_zeroAreaEnd -= m_start; + m_end -= m_start; + m_start = 0; + + m_end += end; + + g_nAddRealloc++; + } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); + // update dirty area + m_data->m_dirtyStart = m_start; + m_data->m_dirtyEnd = m_end; + DEBUG_INTERNAL_STATE ("add end=" << end << ", "); + NS_ASSERT (CheckInternalState ()); +} + +void +Buffer::RemoveAtStart (uint32_t start) +{ + NS_ASSERT (CheckInternalState ()); + uint32_t newStart = m_start + start; + if (newStart <= m_zeroAreaStart) + { + /* only remove start of buffer + */ + m_start = newStart; + } + else if (newStart <= m_zeroAreaEnd) + { + /* remove start of buffer _and_ start of zero area + */ + uint32_t delta = newStart - m_zeroAreaStart; + m_start = m_zeroAreaStart; + m_zeroAreaEnd -= delta; + m_end -= delta; + } + else if (newStart <= m_end) + { + /* remove start of buffer, complete zero area, and part + * of end of buffer + */ + NS_ASSERT (m_end >= start); + uint32_t zeroSize = m_zeroAreaEnd - m_zeroAreaStart; + m_start = newStart - zeroSize; + m_end -= zeroSize; + m_zeroAreaStart = m_start; + m_zeroAreaEnd = m_start; + } + else + { + /* remove all buffer */ + m_end -= m_zeroAreaEnd - m_zeroAreaStart; + m_start = m_end; + m_zeroAreaEnd = m_end; + m_zeroAreaStart = m_end; + } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); + DEBUG_INTERNAL_STATE ("rem start=" << start << ", "); + NS_ASSERT (CheckInternalState ()); +} +void +Buffer::RemoveAtEnd (uint32_t end) +{ + NS_ASSERT (CheckInternalState ()); + uint32_t newEnd = m_end - std::min (end, m_end - m_start); + if (newEnd > m_zeroAreaEnd) + { + /* remove part of end of buffer */ + m_end = newEnd; + } + else if (newEnd > m_zeroAreaStart) + { + /* remove end of buffer, part of zero area */ + m_end = newEnd; + m_zeroAreaEnd = newEnd; + } + else if (newEnd > m_start) + { + /* remove end of buffer, zero area, part of start of buffer */ + m_end = newEnd; + m_zeroAreaEnd = newEnd; + m_zeroAreaStart = newEnd; + } + else + { + /* remove all buffer */ + m_end = m_start; + m_zeroAreaEnd = m_start; + m_zeroAreaStart = m_start; + } + m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); + DEBUG_INTERNAL_STATE ("rem end=" << end << ", "); + NS_ASSERT (CheckInternalState ()); +} + +Buffer +Buffer::CreateFragment (uint32_t start, uint32_t length) const +{ + NS_ASSERT (CheckInternalState ()); + uint32_t zeroStart = m_zeroAreaStart - m_start; + uint32_t zeroEnd = zeroStart + m_zeroAreaEnd; + if (m_zeroAreaEnd != 0 && + start + length > zeroStart && + start <= zeroEnd) + { + TransformIntoRealBuffer (); + } + Buffer tmp = *this; + tmp.RemoveAtStart (start); + tmp.RemoveAtEnd (GetSize () - (start + length)); + NS_ASSERT (CheckInternalState ()); + return tmp; +} + +Buffer +Buffer::CreateFullCopy (void) const +{ + NS_ASSERT (CheckInternalState ()); + if (m_zeroAreaEnd != 0) + { + Buffer tmp; + tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart); + tmp.Begin ().WriteU8 (0, m_zeroAreaEnd - m_zeroAreaStart); + uint32_t dataStart = m_zeroAreaStart - m_start; + tmp.AddAtStart (dataStart); + tmp.Begin ().Write (m_data->m_data+m_start, dataStart); + uint32_t dataEnd = m_end - m_zeroAreaEnd; + tmp.AddAtEnd (dataEnd); + Buffer::Iterator i = tmp.End (); + i.Prev (dataEnd); + i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); + return tmp; + } + NS_ASSERT (CheckInternalState ()); + return *this; +} + +void +Buffer::TransformIntoRealBuffer (void) const +{ + NS_ASSERT (CheckInternalState ()); + Buffer tmp = CreateFullCopy (); + *const_cast (this) = tmp; + NS_ASSERT (CheckInternalState ()); +} + + +uint8_t const* +Buffer::PeekData (void) const +{ + NS_ASSERT (CheckInternalState ()); + TransformIntoRealBuffer (); + NS_ASSERT (CheckInternalState ()); + return m_data->m_data + m_start; +} + +/****************************************************** + * The buffer iterator below. + ******************************************************/ + + Buffer::Iterator::Iterator () : m_zeroStart (0), m_zeroEnd (0), @@ -627,284 +909,6 @@ Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) } } -uint32_t -Buffer::GetInternalSize (void) const -{ - return m_zeroAreaStart - m_start + m_end - m_zeroAreaEnd; -} -uint32_t -Buffer::GetInternalEnd (void) const -{ - return m_end - (m_zeroAreaEnd - m_zeroAreaStart); -} - -void -Buffer::AddAtStart (uint32_t start) -{ - NS_ASSERT (CheckInternalState ()); - bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart; - if (m_start >= start && !isDirty) - { - /* enough space in the buffer and not dirty. - * To add: |..| - * Before: |*****---------***| - * After: |***..---------***| - */ - NS_ASSERT (m_data->m_count == 1 || m_start == m_data->m_dirtyStart); - m_start -= start; - g_nAddNoRealloc++; - } -#if 0 - // the following is an optimization - else if (m_start >= start) - { - struct BufferData *newData = Buffer::Create (m_data->m_size); - memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); - m_data->m_count--; - if (m_data->m_count == 0) - { - Buffer::Recycle (m_data); - } - m_data = newData; - - m_start -= start; - } - else - { - NS_ASSERT (m_start < start); -#else - else - { -#endif - uint32_t newSize = GetInternalSize () + start; - struct BufferData *newData = Buffer::Create (newSize); - memcpy (newData->m_data + start, m_data->m_data + m_start, GetInternalSize ()); - m_data->m_count--; - if (m_data->m_count == 0) - { - Buffer::Recycle (m_data); - } - m_data = newData; - - int32_t delta = start - m_start; - m_start = 0; - m_zeroAreaStart += delta; - m_zeroAreaEnd += delta; - m_end += delta; - - g_nAddRealloc++; - } - m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); - // update dirty area - m_data->m_dirtyStart = m_start; - m_data->m_dirtyEnd = m_end; - DEBUG_INTERNAL_STATE ("add start=" << start << ", "); - NS_ASSERT (CheckInternalState ()); -} -void -Buffer::AddAtEnd (uint32_t end) -{ - NS_ASSERT (CheckInternalState ()); - bool isDirty = m_data->m_count > 1 && m_end < m_data->m_dirtyEnd; - if (GetInternalEnd () + end <= m_data->m_size && !isDirty) - { - /* enough space in buffer and not dirty - * Add: |...| - * Before: |**----*****| - * After: |**----...**| - */ - NS_ASSERT (m_data->m_count == 1 || m_end == m_data->m_dirtyEnd); - m_end += end; - - g_nAddNoRealloc++; - } -#if 0 - // this is an optimization - else if (GetInternalEnd () + end > m_data->m_size) - { - struct BufferData *newData = Buffer::Create (newSize); - memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); - m_data->m_count--; - if (m_data->m_count == 0) - { - Buffer::Recycle (m_data); - } - m_data = newData; - - m_end += end; - } -#endif - else - { - uint32_t newSize = GetInternalSize () + end; - struct BufferData *newData = Buffer::Create (newSize); - memcpy (newData->m_data, m_data->m_data + m_start, GetInternalSize ()); - m_data->m_count--; - if (m_data->m_count == 0) - { - Buffer::Recycle (m_data); - } - m_data = newData; - - - m_zeroAreaStart -= m_start; - m_zeroAreaEnd -= m_start; - m_end -= m_start; - m_start = 0; - - m_end += end; - - g_nAddRealloc++; - } - m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); - // update dirty area - m_data->m_dirtyStart = m_start; - m_data->m_dirtyEnd = m_end; - DEBUG_INTERNAL_STATE ("add end=" << end << ", "); - NS_ASSERT (CheckInternalState ()); -} - -void -Buffer::RemoveAtStart (uint32_t start) -{ - NS_ASSERT (CheckInternalState ()); - uint32_t newStart = m_start + start; - if (newStart <= m_zeroAreaStart) - { - /* only remove start of buffer - */ - m_start = newStart; - } - else if (newStart <= m_zeroAreaEnd) - { - /* remove start of buffer _and_ start of zero area - */ - uint32_t delta = newStart - m_zeroAreaStart; - m_start = m_zeroAreaStart; - m_zeroAreaEnd -= delta; - m_end -= delta; - } - else if (newStart <= m_end) - { - /* remove start of buffer, complete zero area, and part - * of end of buffer - */ - NS_ASSERT (m_end >= start); - uint32_t zeroSize = m_zeroAreaEnd - m_zeroAreaStart; - m_start = newStart - zeroSize; - m_end -= zeroSize; - m_zeroAreaStart = m_start; - m_zeroAreaEnd = m_start; - } - else - { - /* remove all buffer */ - m_end -= m_zeroAreaEnd - m_zeroAreaStart; - m_start = m_end; - m_zeroAreaEnd = m_end; - m_zeroAreaStart = m_end; - } - m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); - DEBUG_INTERNAL_STATE ("rem start=" << start << ", "); - NS_ASSERT (CheckInternalState ()); -} -void -Buffer::RemoveAtEnd (uint32_t end) -{ - NS_ASSERT (CheckInternalState ()); - uint32_t newEnd = m_end - std::min (end, m_end - m_start); - if (newEnd > m_zeroAreaEnd) - { - /* remove part of end of buffer */ - m_end = newEnd; - } - else if (newEnd > m_zeroAreaStart) - { - /* remove end of buffer, part of zero area */ - m_end = newEnd; - m_zeroAreaEnd = newEnd; - } - else if (newEnd > m_start) - { - /* remove end of buffer, zero area, part of start of buffer */ - m_end = newEnd; - m_zeroAreaEnd = newEnd; - m_zeroAreaStart = newEnd; - } - else - { - /* remove all buffer */ - m_end = m_start; - m_zeroAreaEnd = m_start; - m_zeroAreaStart = m_start; - } - m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart); - DEBUG_INTERNAL_STATE ("rem end=" << end << ", "); - NS_ASSERT (CheckInternalState ()); -} - -Buffer -Buffer::CreateFragment (uint32_t start, uint32_t length) const -{ - NS_ASSERT (CheckInternalState ()); - uint32_t zeroStart = m_zeroAreaStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaEnd; - if (m_zeroAreaEnd != 0 && - start + length > zeroStart && - start <= zeroEnd) - { - TransformIntoRealBuffer (); - } - Buffer tmp = *this; - tmp.RemoveAtStart (start); - tmp.RemoveAtEnd (GetSize () - (start + length)); - NS_ASSERT (CheckInternalState ()); - return tmp; -} - -Buffer -Buffer::CreateFullCopy (void) const -{ - NS_ASSERT (CheckInternalState ()); - if (m_zeroAreaEnd != 0) - { - Buffer tmp; - tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart); - tmp.Begin ().WriteU8 (0, m_zeroAreaEnd - m_zeroAreaStart); - uint32_t dataStart = m_zeroAreaStart - m_start; - tmp.AddAtStart (dataStart); - tmp.Begin ().Write (m_data->m_data+m_start, dataStart); - uint32_t dataEnd = m_end - m_zeroAreaEnd; - tmp.AddAtEnd (dataEnd); - Buffer::Iterator i = tmp.End (); - i.Prev (dataEnd); - i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); - return tmp; - } - NS_ASSERT (CheckInternalState ()); - return *this; -} - -void -Buffer::TransformIntoRealBuffer (void) const -{ - NS_ASSERT (CheckInternalState ()); - Buffer tmp = CreateFullCopy (); - *const_cast (this) = tmp; - NS_ASSERT (CheckInternalState ()); -} - - -uint8_t const* -Buffer::PeekData (void) const -{ - NS_ASSERT (CheckInternalState ()); - TransformIntoRealBuffer (); - NS_ASSERT (CheckInternalState ()); - return m_data->m_data + m_start; -} - - } // namespace ns3 From 02427aaa6bb8e11f67c4b0f666dee6cf4ae08939 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 14:10:02 +0200 Subject: [PATCH 162/218] optimize Buffer::WriteU8 --- src/common/buffer.cc | 29 ----------------------------- src/common/buffer.h | 28 +++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 471263c08..baf850707 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -668,35 +668,6 @@ Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) } } void -Buffer::Iterator::WriteU8 (uint8_t data) -{ - if (m_current < m_dataStart) - { - // XXX trying to write outside of data area - NS_ASSERT (false); - } - else if (m_current < m_zeroStart) - { - m_data[m_current] = data; - m_current++; - } - else if (m_current < m_zeroEnd) - { - // XXX trying to write in zero area - NS_ASSERT (false); - } - else if (m_current < m_dataEnd) - { - m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; - m_current++; - } - else - { - // XXX trying to write outside of data area - NS_ASSERT (false); - } -} -void Buffer::Iterator::WriteU16 (uint16_t data) { WriteU8 (data & 0xff); diff --git a/src/common/buffer.h b/src/common/buffer.h index 0aebc63e6..78d4e1b54 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -87,7 +87,7 @@ public: * Write the data in buffer and avance the iterator position * by one byte. */ - void WriteU8 (uint8_t data); + inline void WriteU8 (uint8_t data); /** * \param data data to write in buffer * \param len number of times data must be written in buffer @@ -346,6 +346,32 @@ private: uint32_t m_end; }; +} // namespace ns3 + +#include "ns3/assert.h" + +namespace ns3 { + +void +Buffer::Iterator::WriteU8 (uint8_t data) +{ + NS_ASSERT (m_current >= m_dataStart && + !(m_current >= m_zeroStart && m_current <= m_zeroEnd) && + m_current <= m_dataEnd); + + if (m_current < m_zeroStart) + { + m_data[m_current] = data; + m_current++; + } + else + { + m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; + m_current++; + } +} + + } // namespace ns3 #endif /* BUFFER_H */ From 453cabce61e311dca449141c5d7f1030a7989e49 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 11 Sep 2007 13:33:06 +0100 Subject: [PATCH 163/218] WAF: remove redundant -Wall (was appearing twice) --- wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wscript b/wscript index c72b75e1e..d24ab8a21 100644 --- a/wscript +++ b/wscript @@ -114,7 +114,7 @@ def configure(conf): if (os.path.basename(conf.env['CXX']).startswith("g++") and 'CXXFLAGS' not in os.environ): - variant_env.append_value('CXXFLAGS', ['-Wall', '-Werror']) + variant_env.append_value('CXXFLAGS', ['-Werror']) if 'debug' in Params.g_options.debug_level.lower(): variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') From 1d93856b45053ce04ce0a0cc8d83b91eb0d1a3a9 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 11 Sep 2007 13:37:23 +0100 Subject: [PATCH 164/218] WAF: fix debug level to be 'ultradebug' by default, instead of 'debug'. --- wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wscript b/wscript index d24ab8a21..982e79652 100644 --- a/wscript +++ b/wscript @@ -37,7 +37,7 @@ def set_options(opt): opt.add_option('-d', '--debug-level', action='callback', - type="string", dest='debug_level', default='debug', + type="string", dest='debug_level', default='ultradebug', help=('Specify the debug level, does nothing if CFLAGS is set' ' in the environment. [Allowed Values: debug, optimized].' ' WARNING: this option only has effect ' From 5a396fcca6ef6af4517dc506b45f585bd2244699 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 14:56:10 +0200 Subject: [PATCH 165/218] optimize Buffer::WriteU8 variants --- src/common/buffer.cc | 73 +++++++++++++++++++++++++++++++++++++++----- src/common/buffer.h | 38 ++++++++++++++++++++--- 2 files changed, 98 insertions(+), 13 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index baf850707..cb219c2b8 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -642,6 +642,28 @@ Buffer::Iterator::IsStart (void) const return m_current == m_dataStart; } +bool +Buffer::Iterator::CheckNoZero (uint32_t start, uint32_t end) const +{ + bool ok = true; + for (uint32_t i = start; i < end; i++) + { + if (!Check (i)) + { + ok = false; + } + } + return ok; +} +bool +Buffer::Iterator::Check (uint32_t i) const +{ + return i >= m_dataStart && + !(i >= m_zeroStart && i <= m_zeroEnd) && + i <= m_dataEnd; +} + + void Buffer::Iterator::Write (Iterator start, Iterator end) { @@ -659,14 +681,6 @@ Buffer::Iterator::Write (Iterator start, Iterator end) } } -void -Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) -{ - for (uint32_t i = 0; i < len; i++) - { - WriteU8 (data); - } -} void Buffer::Iterator::WriteU16 (uint16_t data) { @@ -880,6 +894,49 @@ Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) } } +#ifndef BUFFER_USE_INLINE + +void +Buffer::Iterator::WriteU8 (uint8_t data) +{ + if (m_current < m_dataStart) + { + // XXX trying to write outside of data area + NS_ASSERT (false); + } + else if (m_current < m_zeroStart) + { + m_data[m_current] = data; + m_current++; + } + else if (m_current < m_zeroEnd) + { + // XXX trying to write in zero area + NS_ASSERT (false); + } + else if (m_current < m_dataEnd) + { + m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; + m_current++; + } + else + { + // XXX trying to write outside of data area + NS_ASSERT (false); + } +} + +void +Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) +{ + for (uint32_t i = 0; i < len; i++) + { + WriteU8 (data); + } +} + +#endif /* BUFFER_USE_INLINE */ + } // namespace ns3 diff --git a/src/common/buffer.h b/src/common/buffer.h index 78d4e1b54..779504873 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -23,6 +23,13 @@ #include #include +#define BUFFER_USE_INLINE +#ifdef BUFFER_USE_INLINE +#define BUFFER_INLINE inline +#else +#define BUFFER_INLINE +#endif + namespace ns3 { /** @@ -87,7 +94,7 @@ public: * Write the data in buffer and avance the iterator position * by one byte. */ - inline void WriteU8 (uint8_t data); + BUFFER_INLINE void WriteU8 (uint8_t data); /** * \param data data to write in buffer * \param len number of times data must be written in buffer @@ -95,7 +102,7 @@ public: * Write the data in buffer len times and avance the iterator position * by len byte. */ - void WriteU8 (uint8_t data, uint32_t len); + BUFFER_INLINE void WriteU8 (uint8_t data, uint32_t len); /** * \param data data to write in buffer * @@ -240,6 +247,9 @@ public: Iterator (Buffer const*buffer); Iterator (Buffer const*buffer, bool); void Construct (const Buffer *buffer); + bool CheckNoZero (uint32_t start, uint32_t end) const; + bool Check (uint32_t i) const; + uint32_t m_zeroStart; uint32_t m_zeroEnd; uint32_t m_dataStart; @@ -348,6 +358,8 @@ private: } // namespace ns3 +#ifdef BUFFER_USE_INLINE + #include "ns3/assert.h" namespace ns3 { @@ -355,9 +367,7 @@ namespace ns3 { void Buffer::Iterator::WriteU8 (uint8_t data) { - NS_ASSERT (m_current >= m_dataStart && - !(m_current >= m_zeroStart && m_current <= m_zeroEnd) && - m_current <= m_dataEnd); + NS_ASSERT (Check (m_current)); if (m_current < m_zeroStart) { @@ -371,7 +381,25 @@ Buffer::Iterator::WriteU8 (uint8_t data) } } +void +Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) +{ + NS_ASSERT (CheckNotZero (m_current, m_current + len)); + if (m_current <= m_zeroStart) + { + memset (&(m_data[m_current]), data, len); + m_current += len; + } + else + { + uint8_t *buffer = &m_data[m_current - (m_zeroEnd-m_zeroStart)]; + memset (buffer, data, len); + m_current += len; + } +} } // namespace ns3 +#endif /* BUFFER_USE_INLINE */ + #endif /* BUFFER_H */ From f873d50d1fc38636a6d2c487180b7c3687bda2fa Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 11 Sep 2007 15:06:27 +0200 Subject: [PATCH 166/218] optimize Iterator::ReadU8 --- src/common/buffer.cc | 67 ++++++++++++++++++++++---------------------- src/common/buffer.h | 28 +++++++++++++++++- 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index cb219c2b8..9f90e683b 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -753,39 +753,6 @@ Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) } } -uint8_t -Buffer::Iterator::ReadU8 (void) -{ - if (m_current < m_dataStart) - { - // XXX trying to read from outside of data area - NS_ASSERT (false); - } - else if (m_current < m_zeroStart) - { - uint8_t data = m_data[m_current]; - m_current++; - return data; - } - else if (m_current < m_zeroEnd) - { - m_current++; - return 0; - } - else if (m_current < m_dataEnd) - { - uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; - m_current++; - return data; - } - else - { - // XXX trying to read from outside of data area - NS_ASSERT (false); - } - // to quiet compiler. - return 0; -} uint16_t Buffer::Iterator::ReadU16 (void) { @@ -935,6 +902,40 @@ Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) } } +uint8_t +Buffer::Iterator::ReadU8 (void) +{ + if (m_current < m_dataStart) + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + else if (m_current < m_zeroStart) + { + uint8_t data = m_data[m_current]; + m_current++; + return data; + } + else if (m_current < m_zeroEnd) + { + m_current++; + return 0; + } + else if (m_current < m_dataEnd) + { + uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; + m_current++; + return data; + } + else + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + // to quiet compiler. + return 0; +} + #endif /* BUFFER_USE_INLINE */ } // namespace ns3 diff --git a/src/common/buffer.h b/src/common/buffer.h index 779504873..80de0f7fd 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -184,7 +184,7 @@ public: * Read data and advance the Iterator by the number of bytes * read. */ - uint8_t ReadU8 (void); + BUFFER_INLINE uint8_t ReadU8 (void); /** * \return the two bytes read in the buffer. * @@ -398,6 +398,32 @@ Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) } } +uint8_t +Buffer::Iterator::ReadU8 (void) +{ + NS_ASSERT (m_current >= m_dataStart && + m_current <= m_dataEnd); + + if (m_current < m_zeroStart) + { + uint8_t data = m_data[m_current]; + m_current++; + return data; + } + else if (m_current < m_zeroEnd) + { + m_current++; + return 0; + } + else + { + uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; + m_current++; + return data; + } +} + + } // namespace ns3 #endif /* BUFFER_USE_INLINE */ From 7b39115a9aa733416989dc9f0a8c3652cfcab83e Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 11 Sep 2007 14:44:23 +0100 Subject: [PATCH 167/218] WAF: in optimized builds, replace -O2 with -O3 --- wscript | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wscript b/wscript index 982e79652..5904c5ad2 100644 --- a/wscript +++ b/wscript @@ -129,6 +129,13 @@ def configure(conf): if flag.startswith('-g'): variant_env.append_value('CXXFLAGS', flag) + ## in optimized builds, replace -O2 with -O3 + if 'optimized' in Params.g_options.debug_level.lower(): + lst = variant_env['CXXFLAGS'] + for i, flag in enumerate(lst): + if flag == '-O2': + lst[i] = '-O3' + if sys.platform == 'win32': if os.path.basename(conf.env['CXX']).startswith("g++"): variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") From 8979d595a3d2a2b8bd1601b8932628fbc2d5fefb Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 11 Sep 2007 15:09:00 +0100 Subject: [PATCH 168/218] Use NS_DEBUG instead of NS_DEBUG_UNCOND in PacketSink code. --- src/applications/packet-sink.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/packet-sink.cc b/src/applications/packet-sink.cc index 4ed54ab50..2f767303e 100644 --- a/src/applications/packet-sink.cc +++ b/src/applications/packet-sink.cc @@ -29,6 +29,8 @@ using namespace std; namespace ns3 { +NS_DEBUG_COMPONENT_DEFINE ("PacketSink"); + // Constructors PacketSink::PacketSink (Ptr n, @@ -106,7 +108,7 @@ void PacketSink::Receive(Ptr socket, const Packet &packet, if (InetSocketAddress::IsMatchingType (from)) { InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_DEBUG_UNCOND ( __PRETTY_FUNCTION__ << ": Received " << + NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << packet.GetSize() << " bytes from " << address.GetIpv4() << " [" << address << "]---'" << packet.PeekData() << "'"); } From 3ec50ec14873bb203b0ada18f8a83cbe2a1f5d84 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 11 Sep 2007 18:29:26 -0700 Subject: [PATCH 169/218] socket update broke multicast --- examples/csma-multicast.cc | 13 ---------- src/internet-node/ipv4-impl.cc | 6 +++++ src/internet-node/ipv4-impl.h | 2 ++ src/internet-node/udp-socket.cc | 24 ++++++++++++------- src/node/ipv4.cc | 22 +++++++++++------ src/node/ipv4.h | 22 +++++++++++------ .../global-route-manager-impl.cc | 2 +- 7 files changed, 55 insertions(+), 36 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 9b964abec..801e8ea51 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -85,19 +85,6 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4LoopbackInterface"); #endif - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("CsmaMulticast"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind diff --git a/src/internet-node/ipv4-impl.cc b/src/internet-node/ipv4-impl.cc index b105d5a41..a67c6a4e8 100644 --- a/src/internet-node/ipv4-impl.cc +++ b/src/internet-node/ipv4-impl.cc @@ -201,6 +201,12 @@ Ipv4Impl::GetAddress (uint32_t i) const return m_ipv4->GetAddress (i); } +bool +Ipv4Impl::GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const +{ + return m_ipv4->GetIfIndexForDestination (dest, ifIndex); +} + Ipv4Address Ipv4Impl::GetSourceAddress (Ipv4Address destination) const { diff --git a/src/internet-node/ipv4-impl.h b/src/internet-node/ipv4-impl.h index ab17c16f4..1f4a79f5c 100644 --- a/src/internet-node/ipv4-impl.h +++ b/src/internet-node/ipv4-impl.h @@ -89,6 +89,8 @@ public: virtual Ipv4Mask GetNetworkMask (uint32_t t) const; virtual Ipv4Address GetAddress (uint32_t i) const; virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const; + virtual bool GetIfIndexForDestination (Ipv4Address dest, + uint32_t &ifIndex) const; virtual uint16_t GetMtu (uint32_t i) const; virtual bool IsUp (uint32_t i) const; diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 1183ce7d9..6f123bed5 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -186,11 +186,13 @@ UdpSocket::Connect(const Address & address) NS_DEBUG ("UdpSocket::Connect (): Updating local address"); - if (GetIpv4RouteToDestination (m_node, routeToDest, m_defaultAddress) ) + uint32_t localIfIndex; + + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + + if (ipv4->GetIfIndexForDestination (m_defaultAddress, localIfIndex)) { - uint32_t localIfIndex = routeToDest.GetInterface (); - Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); - m_endPoint->SetLocalAddress (ipv4->GetAddress(localIfIndex) ); + m_endPoint->SetLocalAddress (ipv4->GetAddress(localIfIndex)); } NS_DEBUG ("UdpSocket::Connect (): Local address is " << @@ -240,6 +242,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) if (!m_connected) { + NS_DEBUG("UdpSocket::DoSendTo (): Not connected"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); @@ -248,6 +251,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) else { // connected UDP socket must use default addresses + NS_DEBUG("UdpSocket::DoSendTo (): Connected"); return DoSendTo (p, m_defaultAddress, m_defaultPort); } } @@ -274,13 +278,17 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) m_errno = ERROR_SHUTDOWN; return -1; } + + uint32_t localIfIndex; + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + // // If dest is sent to the limited broadcast address (all ones), // convert it to send a copy of the packet out of every interface // if (dest.IsBroadcast ()) { - Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + NS_DEBUG("UdpSocket::DoSendTo (): Limited broadcast"); for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) { Ipv4Address addri = ipv4->GetAddress (i); @@ -290,10 +298,9 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) NotifyDataSent (p.GetSize ()); } } - else if (GetIpv4RouteToDestination (m_node, routeToDest, dest) ) + else if (ipv4->GetIfIndexForDestination(dest, localIfIndex)) { - uint32_t localIfIndex = routeToDest.GetInterface (); - Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + NS_DEBUG("UdpSocket::DoSendTo (): Route exists"); m_udp->Send (p, ipv4->GetAddress (localIfIndex), dest, m_endPoint->GetLocalPort (), port); NotifyDataSent (p.GetSize ()); @@ -301,6 +308,7 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) } else { + NS_DEBUG("UdpSocket::DoSendTo (): ERROR_NOROUTETOHOST"); m_errno = ERROR_NOROUTETOHOST; return -1; } diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index d7c83d42a..f8a852149 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -36,10 +36,10 @@ Ipv4::~Ipv4 () {} uint32_t -GetIfIndexByIpv4Address (Ptr node, Ipv4Address a, Ipv4Mask amask) +Ipv4::GetIfIndexByAddress (Ptr node, Ipv4Address a, Ipv4Mask amask) { Ptr ipv4 = node->QueryInterface (Ipv4::iid); - NS_ASSERT_MSG (ipv4, "GetIfIndexByIpv4Address: No Ipv4 interface"); + NS_ASSERT_MSG (ipv4, "Ipv4::GetIfIndexByAddress: No Ipv4 interface"); for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) { if (ipv4->GetAddress (i).CombineMask(amask) == a.CombineMask(amask) ) @@ -48,17 +48,26 @@ GetIfIndexByIpv4Address (Ptr node, Ipv4Address a, Ipv4Mask amask) } } // Mapping not found - NS_ASSERT_MSG (false, "GetIfIndexByIpv4Address failed"); + NS_ASSERT_MSG (false, "Ipv4::GetIfIndexByAddress failed"); return 0; } +// +// XXX BUGBUG I don't think this is really the right approach here. The call +// to GetRoute () filters down into Ipv4L3Protocol where it translates into +// a call into the Ipv4 static routing package. This bypasses any other +// routing packages. At a minimum, the name is misleading. +// bool -GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, - Ipv4Address a, Ipv4Mask amask) +Ipv4::GetRouteToDestination ( + Ptr node, + Ipv4Route& route, + Ipv4Address a, + Ipv4Mask amask) { Ipv4Route tempRoute; Ptr ipv4 = node->QueryInterface (Ipv4::iid); - NS_ASSERT_MSG (ipv4, "GetIpv4RouteToDestination: No Ipv4 interface"); + NS_ASSERT_MSG (ipv4, "Ipv4::GetRouteToDestination: No Ipv4 interface"); for (uint32_t i = 0; i < ipv4->GetNRoutes (); i++) { tempRoute = ipv4->GetRoute (i); @@ -83,5 +92,4 @@ GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, return false; } - } // namespace ns3 diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 1cdc08d6f..ba4868a4a 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -105,6 +105,7 @@ public: const Ipv4Header &ipHeader, Packet packet, RouteReplyCallback routeReply) = 0; + /** * \brief Synchronously check to see if we can determine the interface index * that will be used if a packet is sent to this destination. @@ -395,6 +396,15 @@ public: */ virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; + /** + * \param destination The IP address of a hypothetical destination. + * \param ifIndex filled in with the interface index that will be used to + * send a packet to the hypothetical destination. + * \returns True if a single interface can be identified, false otherwise. + */ + virtual bool GetIfIndexForDestination (Ipv4Address dest, + uint32_t &ifIndex) const = 0; + /** * \param i index of ipv4 interface * \returns the Maximum Transmission Unit (in bytes) associated @@ -424,20 +434,18 @@ public: * ignored during ipv4 forwarding. */ virtual void SetDown (uint32_t i) = 0; -}; /** * Convenience functions (Doxygen still needed) * * Return the ifIndex corresponding to the Ipv4Address provided. */ -uint32_t GetIfIndexByIpv4Address (Ptr node, - Ipv4Address a, - Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + static uint32_t GetIfIndexByAddress (Ptr node, Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); -bool GetIpv4RouteToDestination (Ptr node, Ipv4Route& route, - Ipv4Address a, - Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + static bool GetRouteToDestination (Ptr node, Ipv4Route& route, + Ipv4Address a, Ipv4Mask amask = Ipv4Mask("255.255.255.255")); +}; } // namespace ns3 diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 10f07ca85..4e8f19f51 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1143,7 +1143,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) // we're looking for. If we find one, return the corresponding interface // index. // - return (GetIfIndexByIpv4Address (node, a, amask) ); + return (Ipv4::GetIfIndexByAddress (node, a, amask) ); } } // From b222f4f2229fe7ef4790b67922f53ed8e424960d Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 11 Sep 2007 19:09:49 -0700 Subject: [PATCH 170/218] integrating broadcast with multicast and sockets with multiple interfaces required default route for disambiguation --- examples/csma-broadcast.cc | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index effbcc310..b372fa201 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -66,13 +66,24 @@ int main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this -#if 0 - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); +#if 1 + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); DebugComponentEnable("Channel"); DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("OnOffApplication"); DebugComponentEnable("PacketSocket"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); #endif // Set up some default values for the simulation. Use the Bind() @@ -125,6 +136,18 @@ int main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address ( n2, n2ifIndex, Ipv4Address("192.168.1.2"), Ipv4Mask("255.255.255.0")); + // XXX Is this the right thing to do? + // + // The OnOff application uses a connected socket. This socket needs to be + // able to figure out which interface to use as the source address for + // packets. When there's one interface, this isn't too hard, but node zero + // has two interfaces, and limited broadcasts will be sent out both of those + // interfaces. We need to provide some way to disambiguate the choice. + // If we supply a default route, the specified interface will be chosen. + + Ptr ipv4 = n0->QueryInterface (Ipv4::iid); + ipv4->SetDefaultRoute ("192.168.1.3", n0ifIndex0); + // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s // from n0 to n1 From 31ecd22d426783a4a4fdff53171744f52ac889ce Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 11 Sep 2007 19:11:03 -0700 Subject: [PATCH 171/218] turn off debugging flags --- examples/csma-broadcast.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index b372fa201..b032f0aea 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -66,7 +66,7 @@ int main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this -#if 1 +#if 0 DebugComponentEnable("Object"); DebugComponentEnable("Queue"); DebugComponentEnable("DropTailQueue"); From cbd776b43b5701cb420e24d18568253167151e79 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 11 Sep 2007 19:40:50 -0700 Subject: [PATCH 172/218] variable unused in optimized build -- fixed via attribute --- examples/csma-multicast.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 801e8ea51..6bae090ff 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -137,7 +137,8 @@ main (int argc, char *argv[]) uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, Eui48Address("08:00:2e:00:00:03")); - uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, + uint32_t nd3 __attribute__ ((unused)) = + CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, Eui48Address("08:00:2e:00:00:04")); uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, Eui48Address("08:00:2e:00:00:05")); From 1018d8c8cc1e4e34eb80a0ea60ba6f8f90a15aec Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 11 Sep 2007 22:40:04 -0700 Subject: [PATCH 173/218] Remove m_quiet variable, fix copyright --- examples/simple-global-routing.cc | 6 +-- examples/simple-point-to-point.cc | 1 - src/applications/packet-sink.cc | 67 ++++++++++++---------------- src/applications/packet-sink.h | 73 +++++++++++++++---------------- 4 files changed, 67 insertions(+), 80 deletions(-) diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 882e94e53..bcfc01d17 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -157,8 +157,7 @@ int main (int argc, char *argv[]) Ptr sink = Create ( n3, InetSocketAddress (Ipv4Address::GetAny (), 80), - "Udp", - true); + "Udp"); // Start the sink sink->Start (Seconds (1.0)); sink->Stop (Seconds (10.0)); @@ -178,8 +177,7 @@ int main (int argc, char *argv[]) sink = Create ( n1, InetSocketAddress (Ipv4Address::GetAny (), 80), - "Udp", - true); + "Udp"); // Start the sink sink->Start (Seconds (1.1)); sink->Stop (Seconds (10.0)); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4e92ad460..6c733fef8 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -182,7 +182,6 @@ int main (int argc, char *argv[]) // Start the sink sink->Start (Seconds (1.1)); sink->Stop (Seconds (10.0)); - sink->SetQuiet (); // disable output from the Receive callback // Here, finish off packet routing configuration // This will likely set by some global StaticRouting object in the future diff --git a/src/applications/packet-sink.cc b/src/applications/packet-sink.cc index 2f767303e..2ca60bfb3 100644 --- a/src/applications/packet-sink.cc +++ b/src/applications/packet-sink.cc @@ -1,20 +1,22 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2006 Georgia Tech Research Corporation -// -// 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 -// +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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: Tom Henderson (tomhend@u.washington.edu) + */ #include "ns3/address.h" #include "ns3/debug.h" #include "ns3/inet-socket-address.h" @@ -35,34 +37,25 @@ NS_DEBUG_COMPONENT_DEFINE ("PacketSink"); PacketSink::PacketSink (Ptr n, const Address &local, - std::string iid, - bool quiet) + std::string iid) : Application(n) { - Construct (n, local, iid, quiet); + Construct (n, local, iid); } void PacketSink::Construct (Ptr n, const Address &local, - std::string iid, - bool quiet) + std::string iid) { m_socket = 0; m_local = local; m_iid = iid; - m_quiet = quiet; } PacketSink::~PacketSink() {} -void -PacketSink::SetQuiet() -{ - m_quiet = true; -} - void PacketSink::DoDispose (void) { @@ -99,19 +92,17 @@ void PacketSink::StopApplication() // Called at time specified by Stop } } -// This callback body suggested by Joe Kopena's wiki +// This LOG output inspired by the application on Joseph Kopena's wiki void PacketSink::Receive(Ptr socket, const Packet &packet, const Address &from) { - if (!m_quiet) + if (InetSocketAddress::IsMatchingType (from)) { - if (InetSocketAddress::IsMatchingType (from)) - { - InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << - packet.GetSize() << " bytes from " << address.GetIpv4() << " [" - << address << "]---'" << packet.PeekData() << "'"); - } + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << + packet.GetSize() << " bytes from " << address.GetIpv4() << " [" + << address << "]---'" << packet.PeekData() << "'"); + // TODO: Add a tracing source here } } diff --git a/src/applications/packet-sink.h b/src/applications/packet-sink.h index dc3c7d41e..8af7b3ab5 100644 --- a/src/applications/packet-sink.h +++ b/src/applications/packet-sink.h @@ -1,21 +1,22 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2006 Georgia Tech Research Corporation -// -// 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 -// -// +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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: Tom Henderson (tomhend@u.washington.edu) + */ #ifndef __packet_sink_h__ #define __packet_sink_h__ @@ -33,34 +34,34 @@ class Packet; /** * \brief Receive and consume traffic generated to an IP address and port * - * This Application can be used as a receiver for packets generated by - * traffic sourcing applications such as OnOffApplication. The constructor - * specifies the Address (IP address and port) and the transport protocol - * to use. A virtual Receive () method is installed as a callback on - * the receiving socket. By default, it prints out the size of packets - * and their address. + * This application was written to complement OnOffApplication, but it + * is more general so a PacketSink name was selected. Functionally it is + * important to use in multicast situations, so that reception of the layer-2 + * multicast frames of interest are enabled, but it is also useful for + * unicast as an example of how you can write something simple to receive + * packets at the application layer. Also, if an IP stack generates + * ICMP Port Unreachable errors, receiving applications will be needed. + * + * The constructor specifies the Address (IP address and port) and the + * transport protocol to use. A virtual Receive () method is installed + * as a callback on the receiving socket. By default, when logging is + * enabled, it prints out the size of packets and their address, but + * we intend to also add a tracing source to Receive() at a later date. */ class PacketSink : public Application { public: /** * \param n node associated to this application - * \param local local ip address - * \param iid - * \param ontime on time random variable - * \param offtime off time random variable + * \param local local address to bind to + * \param iid string to identify transport protocol of interest */ PacketSink (Ptr n, const Address &local, - std::string iid, bool quiet=false); + std::string iid); virtual ~PacketSink (); - /** - * \brief Turn off the logging output for the receive callback - */ - void SetQuiet (void); - protected: virtual void DoDispose (void); private: @@ -70,15 +71,13 @@ private: void Construct (Ptr n, const Address &local, - std::string iid, - bool quiet); + std::string iid); virtual void Receive (Ptr socket, const Packet& packet, const Address& from); Ptr m_socket; // Associated socket Address m_local; // Local address to bind to std::string m_iid; // Protocol name (e.g., "Udp") - bool m_quiet; // Governs whether receive callback is quiet }; From ba44ef3df27776a40807b092f154380d7b27f8a2 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 11 Sep 2007 22:46:29 -0700 Subject: [PATCH 174/218] Copyrights/licenses for routing code --- src/routing/global-routing/candidate-queue.cc | 4 ++++ src/routing/global-routing/candidate-queue.h | 4 ++++ src/routing/global-routing/global-route-manager-impl.cc | 9 +++++++++ src/routing/global-routing/global-route-manager-impl.h | 5 +++++ src/routing/global-routing/global-route-manager.cc | 5 +++++ src/routing/global-routing/global-route-manager.h | 5 +++++ src/routing/global-routing/global-router-interface.cc | 5 +++++ src/routing/global-routing/global-router-interface.h | 5 +++++ 8 files changed, 42 insertions(+) diff --git a/src/routing/global-routing/candidate-queue.cc b/src/routing/global-routing/candidate-queue.cc index 67bec63b1..ffade0a31 100644 --- a/src/routing/global-routing/candidate-queue.cc +++ b/src/routing/global-routing/candidate-queue.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,8 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) */ #include "ns3/debug.h" diff --git a/src/routing/global-routing/candidate-queue.h b/src/routing/global-routing/candidate-queue.h index 09b3a5c22..605ca40b2 100644 --- a/src/routing/global-routing/candidate-queue.h +++ b/src/routing/global-routing/candidate-queue.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,8 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) */ #ifndef CANDIDATE_QUEUE_H diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 10f07ca85..d7a5278d0 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1,5 +1,8 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada + * * 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; @@ -12,6 +15,12 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) + * + * Kunihiro Ishigura, Toshiaki Takada (GNU Zebra) are attributed authors + * of the quagga 0.99.7/src/ospfd/ospf_spf.c code which was ported here */ #include diff --git a/src/routing/global-routing/global-route-manager-impl.h b/src/routing/global-routing/global-route-manager-impl.h index 923caf400..55d4099f6 100644 --- a/src/routing/global-routing/global-route-manager-impl.h +++ b/src/routing/global-routing/global-route-manager-impl.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTE_MANAGER_IMPL_H diff --git a/src/routing/global-routing/global-route-manager.cc b/src/routing/global-routing/global-route-manager.cc index c166da015..ed2d0bfef 100644 --- a/src/routing/global-routing/global-route-manager.cc +++ b/src/routing/global-routing/global-route-manager.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/assert.h" diff --git a/src/routing/global-routing/global-route-manager.h b/src/routing/global-routing/global-route-manager.h index 7562da67d..333aff78c 100644 --- a/src/routing/global-routing/global-route-manager.h +++ b/src/routing/global-routing/global-route-manager.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTE_MANAGER_H diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index c057f9ddf..bf1b68a29 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/debug.h" diff --git a/src/routing/global-routing/global-router-interface.h b/src/routing/global-routing/global-router-interface.h index b6558eb20..cf3f94166 100644 --- a/src/routing/global-routing/global-router-interface.h +++ b/src/routing/global-routing/global-router-interface.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTER_INTERFACE_H From 5314de9ac0d94be8d05793a8b20d6fd512b05ebd Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 11 Sep 2007 23:38:18 -0700 Subject: [PATCH 175/218] turn off DEBUG on simple-point-to-point --- examples/simple-point-to-point.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 2ff783b06..4b9de40f4 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -94,18 +94,6 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4LoopbackInterface"); #endif - DebugComponentEnable("Me"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("PointToPointChannel"); - DebugComponentEnable("PointToPointNetDevice"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); - // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is From 2a69609cdb364ac159c3ec6f9fd3ece569dbce67 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 12 Sep 2007 09:34:38 +0200 Subject: [PATCH 176/218] fix copyright statements --- src/mobility/grid-topology.cc | 1 - src/mobility/grid-topology.h | 1 - src/mobility/hierarchical-mobility-model.cc | 1 - src/mobility/hierarchical-mobility-model.h | 1 - src/mobility/mobility-model-notifier.cc | 1 - src/mobility/mobility-model-notifier.h | 1 - src/mobility/mobility-model.cc | 1 - src/mobility/mobility-model.h | 1 - src/mobility/position.cc | 19 +++++++++++++++++++ src/mobility/position.h | 18 ++++++++++++++++++ src/mobility/random-position.cc | 19 +++++++++++++++++++ src/mobility/random-position.h | 18 ++++++++++++++++++ src/mobility/rectangle-default-value.cc | 1 - src/mobility/rectangle-default-value.h | 1 - src/mobility/rectangle.cc | 1 - src/mobility/rectangle.h | 1 - src/mobility/speed.cc | 19 +++++++++++++++++++ src/mobility/speed.h | 18 ++++++++++++++++++ src/mobility/static-mobility-model.cc | 3 +-- src/mobility/static-mobility-model.h | 1 - src/mobility/static-speed-helper.cc | 19 +++++++++++++++++++ src/mobility/static-speed-helper.h | 18 ++++++++++++++++++ src/mobility/static-speed-mobility-model.cc | 1 - src/mobility/static-speed-mobility-model.h | 1 - 24 files changed, 149 insertions(+), 17 deletions(-) diff --git a/src/mobility/grid-topology.cc b/src/mobility/grid-topology.cc index fbf7d2511..625cb49ae 100644 --- a/src/mobility/grid-topology.cc +++ b/src/mobility/grid-topology.cc @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/grid-topology.h b/src/mobility/grid-topology.h index 93457503d..75ea42535 100644 --- a/src/mobility/grid-topology.h +++ b/src/mobility/grid-topology.h @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/hierarchical-mobility-model.cc b/src/mobility/hierarchical-mobility-model.cc index 046f98056..00f4643c2 100644 --- a/src/mobility/hierarchical-mobility-model.cc +++ b/src/mobility/hierarchical-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/hierarchical-mobility-model.h b/src/mobility/hierarchical-mobility-model.h index 16be7820b..44623244d 100644 --- a/src/mobility/hierarchical-mobility-model.h +++ b/src/mobility/hierarchical-mobility-model.h @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index ebe64f3df..4b87dd066 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/mobility-model-notifier.h b/src/mobility/mobility-model-notifier.h index 1d2409f8e..e3616b904 100644 --- a/src/mobility/mobility-model-notifier.h +++ b/src/mobility/mobility-model-notifier.h @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/mobility-model.cc b/src/mobility/mobility-model.cc index 808c5f4dd..50965d800 100644 --- a/src/mobility/mobility-model.cc +++ b/src/mobility/mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,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 diff --git a/src/mobility/mobility-model.h b/src/mobility/mobility-model.h index 5d0e6ee4a..07fd171ea 100644 --- a/src/mobility/mobility-model.h +++ b/src/mobility/mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,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 diff --git a/src/mobility/position.cc b/src/mobility/position.cc index 802fe3bb7..2418cb61e 100644 --- a/src/mobility/position.cc +++ b/src/mobility/position.cc @@ -1,3 +1,22 @@ +/* -*- 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 + */ #include "position.h" #include diff --git a/src/mobility/position.h b/src/mobility/position.h index d34fadfb2..08ab9a134 100644 --- a/src/mobility/position.h +++ b/src/mobility/position.h @@ -1,4 +1,22 @@ /* -*- 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 + */ #ifndef POSITION_H #define POSITION_H diff --git a/src/mobility/random-position.cc b/src/mobility/random-position.cc index 93a3d825e..5e821cfc0 100644 --- a/src/mobility/random-position.cc +++ b/src/mobility/random-position.cc @@ -1,3 +1,22 @@ +/* -*- 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 + */ #include "random-position.h" #include "ns3/random-variable.h" #include "ns3/default-value.h" diff --git a/src/mobility/random-position.h b/src/mobility/random-position.h index 8fcc54a6d..04a5b6890 100644 --- a/src/mobility/random-position.h +++ b/src/mobility/random-position.h @@ -1,4 +1,22 @@ /* -*- 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 + */ #ifndef RANDOM_POSITION_H #define RANDOM_POSITION_H diff --git a/src/mobility/rectangle-default-value.cc b/src/mobility/rectangle-default-value.cc index 1526f5a8e..389a696d0 100644 --- a/src/mobility/rectangle-default-value.cc +++ b/src/mobility/rectangle-default-value.cc @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/rectangle-default-value.h b/src/mobility/rectangle-default-value.h index 047e7bbb6..bc35b7440 100644 --- a/src/mobility/rectangle-default-value.h +++ b/src/mobility/rectangle-default-value.h @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/rectangle.cc b/src/mobility/rectangle.cc index 34e23e58b..5ae589b8c 100644 --- a/src/mobility/rectangle.cc +++ b/src/mobility/rectangle.cc @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/rectangle.h b/src/mobility/rectangle.h index a53f641d6..df519b545 100644 --- a/src/mobility/rectangle.h +++ b/src/mobility/rectangle.h @@ -1,7 +1,6 @@ /* -*- 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 diff --git a/src/mobility/speed.cc b/src/mobility/speed.cc index 3f97ded7c..c6abd0c1d 100644 --- a/src/mobility/speed.cc +++ b/src/mobility/speed.cc @@ -1,3 +1,22 @@ +/* -*- 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 + */ #include "speed.h" namespace ns3 { diff --git a/src/mobility/speed.h b/src/mobility/speed.h index 317fc4333..d64b1e63b 100644 --- a/src/mobility/speed.h +++ b/src/mobility/speed.h @@ -1,4 +1,22 @@ /* -*- 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 + */ #ifndef SPEED_H #define SPEED_H diff --git a/src/mobility/static-mobility-model.cc b/src/mobility/static-mobility-model.cc index e6d68f5c3..5142b8178 100644 --- a/src/mobility/static-mobility-model.cc +++ b/src/mobility/static-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2006 INRIA - * All rights reserved. + * Copyright (c) 2006,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 diff --git a/src/mobility/static-mobility-model.h b/src/mobility/static-mobility-model.h index d70890cc0..a1215c08a 100644 --- a/src/mobility/static-mobility-model.h +++ b/src/mobility/static-mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,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 diff --git a/src/mobility/static-speed-helper.cc b/src/mobility/static-speed-helper.cc index b46f88721..82a3dd029 100644 --- a/src/mobility/static-speed-helper.cc +++ b/src/mobility/static-speed-helper.cc @@ -1,3 +1,22 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,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 + */ #include "ns3/simulator.h" #include "ns3/rectangle.h" #include "static-speed-helper.h" diff --git a/src/mobility/static-speed-helper.h b/src/mobility/static-speed-helper.h index 8737f2edd..24e1c6237 100644 --- a/src/mobility/static-speed-helper.h +++ b/src/mobility/static-speed-helper.h @@ -1,4 +1,22 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,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 + */ #ifndef STATIC_SPEED_HELPER_H #define STATIC_SPEED_HELPER_H diff --git a/src/mobility/static-speed-mobility-model.cc b/src/mobility/static-speed-mobility-model.cc index d4cfc9873..3f0dd3229 100644 --- a/src/mobility/static-speed-mobility-model.cc +++ b/src/mobility/static-speed-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006, 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 diff --git a/src/mobility/static-speed-mobility-model.h b/src/mobility/static-speed-mobility-model.h index 74f5b51f9..85d4793d7 100644 --- a/src/mobility/static-speed-mobility-model.h +++ b/src/mobility/static-speed-mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006, 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 From 77b9e6aa85b8a6fadcd8173a30a000f64150a64f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 12 Sep 2007 10:11:57 +0200 Subject: [PATCH 177/218] fix non-optimized build --- src/common/buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buffer.h b/src/common/buffer.h index 80de0f7fd..80d49f731 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -384,7 +384,7 @@ Buffer::Iterator::WriteU8 (uint8_t data) void Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) { - NS_ASSERT (CheckNotZero (m_current, m_current + len)); + NS_ASSERT (CheckNoZero (m_current, m_current + len)); if (m_current <= m_zeroStart) { memset (&(m_data[m_current]), data, len); From 09a917d2e1d2c79a91dff90323e20341d2cff7d6 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 12 Sep 2007 11:16:18 +0200 Subject: [PATCH 178/218] add 'internal' documentation, cleanup a bit --- src/common/buffer.cc | 79 +++++++++++++++++++++++++++--------- src/common/buffer.h | 95 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 155 insertions(+), 19 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 9f90e683b..06af758ce 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -29,16 +29,49 @@ NS_DEBUG (y << "start="< @@ -56,33 +89,33 @@ static void BufferDeallocate (struct BufferData *data); namespace ns3 { +#ifdef BUFFER_HEURISTICS static uint32_t g_recommendedStart = 0; static uint64_t g_nAddNoRealloc = 0; static uint64_t g_nAddRealloc = 0; static BufferDataList g_freeList; -#ifdef USE_FREE_LIST static uint32_t g_maxSize = 0; static uint64_t g_nAllocs = 0; static uint64_t g_nCreates = 0; -#endif /* USE_FREE_LIST */ +#endif /* BUFFER_HEURISTICS */ BufferDataList::~BufferDataList () { #ifdef PRINT_STATS -#ifdef USE_FREE_LIST +#ifdef BUFFER_HEURISTICS double efficiency; efficiency = g_nAllocs; efficiency /= g_nCreates; std::cout <<"buffer free list efficiency="<= m_dataStart && - !(i >= m_zeroStart && i <= m_zeroEnd) && + !(i >= m_zeroStart && i < m_zeroEnd) && i <= m_dataEnd; } diff --git a/src/common/buffer.h b/src/common/buffer.h index 80d49f731..e9e374e55 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -23,7 +23,10 @@ #include #include -#define BUFFER_USE_INLINE +//#define BUFFER_HEURISTICS 1 +#define BUFFER_USE_INLINE 1 + + #ifdef BUFFER_USE_INLINE #define BUFFER_INLINE inline #else @@ -42,6 +45,51 @@ namespace ns3 { * by creating new Buffers of the maximum size ever used. * The correct maximum size is learned at runtime during use by * recording the maximum size of each packet. + * + * \internal + * The implementation of the Buffer class uses a COW (Copy On Write) + * technique to ensure that the underlying data buffer which holds + * the data bytes is shared among a lot of Buffer instances despite + * data being added or removed from them. + * + * When multiple Buffer instances hold a reference to the same + * underlying BufferData object, they must be able to detect when + * the operation they want to perform should trigger a copy of the + * BufferData. If the BufferData::m_count field is one, it means that + * there exist only one instance of Buffer which references the + * BufferData instance so, it is safe to modify it. It is also + * safe to modify the content of a BufferData if the modification + * falls outside of the "dirty area" defined by the BufferData. + * In every other case, the BufferData must be copied before + * being modified. + * + * To understand the way the Buffer::Add and Buffer::Remove methods + * work, you first need to understand the "virtual offsets" used to + * keep track of the content of buffers. Each Buffer instance + * contains real data bytes in its BufferData instance but it also + * contains "virtual zero data" which typically is used to represent + * application-level payload. No memory is allocated to store the + * zero bytes of application-level payload unless the user fragments + * a Buffer: this application-level payload is kept track of with + * a pair of integers which describe where in the buffer content + * the "virtual zero area" starts and ends. + * + * ***: unused bytes + * xxx: bytes "added" at the front of the zero area + * ...: bytes "added" at the back of the zero area + * 000: virtual zero bytes + * + * Real byte buffer: |********xxxxxxxxxxxx.........*****| + * |--------^ m_start + * |-------------------^ m_zeroAreaStart + * |-----------------------------^ m_end - (m_zeroAreaEnd - m_zeroAreaStart) + * virtual byte buffer: |xxxxxxxxxxxx0000000000000.........| + * |--------^ m_start + * |--------------------^ m_zeroAreaStart + * |---------------------------------^ m_zeroAreaEnd + * |------------------------------------------^ m_end + * + * A simple state invariant is that m_start <= m_zeroStart <= m_zeroEnd <= m_end */ class Buffer { public: @@ -250,11 +298,29 @@ public: bool CheckNoZero (uint32_t start, uint32_t end) const; bool Check (uint32_t i) const; + /* offset in virtual bytes from the start of the data buffer to the + * start of the "virtual zero area". + */ uint32_t m_zeroStart; + /* offset in virtual bytes from the start of the data buffer to the + * end of the "virtual zero area". + */ uint32_t m_zeroEnd; + /* offset in virtual bytes from the start of the data buffer to the + * start of the data which can be read by this iterator + */ uint32_t m_dataStart; + /* offset in virtual bytes from the start of the data buffer to the + * end of the data which can be read by this iterator + */ uint32_t m_dataEnd; + /* offset in virtual bytes from the start of the data buffer to the + * current position represented by this iterator. + */ uint32_t m_current; + /* a pointer to the underlying byte buffer. All offsets are relative + * to this pointer. + */ uint8_t *m_data; }; @@ -348,11 +414,38 @@ private: static void Recycle (struct BufferData *data); static struct BufferData *Create (uint32_t size); + /* This structure is described in the buffer.cc file. + */ struct BufferData *m_data; +#ifdef BUFFER_HEURISTICS + /* keep track of the maximum value of m_zeroAreaStart across + * the lifetime of a Buffer instance. This variable is used + * purely as a source of information for the heuristics which + * decide on the position of the zero area in new buffers. + * It is read from the Buffer destructor to update the global + * heuristic data and these global heuristic data are used from + * the Buffer constructor to choose an initial value for + * m_zeroAreaStart. + * It is possible to disable all these heuristics by undefining the + * BUFFER_HEURISTICS macro at the top of buffer.h + */ uint32_t m_maxZeroAreaStart; +#endif /* BUFFER_HEURISTICS */ + /* offset to the start of the virtual zero area from the start + * of m_data->m_data + */ uint32_t m_zeroAreaStart; + /* offset to the end of the virtual zero area from the start + * of m_data->m_data + */ uint32_t m_zeroAreaEnd; + /* offset to the start of the data referenced by this Buffer + * instance from the start of m_data->m_data + */ uint32_t m_start; + /* offset to the end of the data referenced by this Buffer + * instance from the start of m_data->m_data + */ uint32_t m_end; }; From 2d6ad3cd087e4b82ab251b57160aaca0772460b3 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 12 Sep 2007 11:22:05 +0200 Subject: [PATCH 179/218] enable buffer heuristics --- src/common/buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buffer.h b/src/common/buffer.h index e9e374e55..a6a8f51db 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -23,7 +23,7 @@ #include #include -//#define BUFFER_HEURISTICS 1 +#define BUFFER_HEURISTICS 1 #define BUFFER_USE_INLINE 1 From 7432de4aadbc3f4ebe37b9044f630570e6444f5f Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 12 Sep 2007 11:39:46 +0200 Subject: [PATCH 180/218] rename Euixx to Macxx --HG-- rename : src/node/eui48-address.cc => src/node/mac48-address.cc rename : src/node/eui48-address.h => src/node/mac48-address.h rename : src/node/eui64-address.cc => src/node/mac64-address.cc rename : src/node/eui64-address.h => src/node/mac64-address.h --- examples/csma-broadcast.cc | 10 +++--- examples/csma-multicast.cc | 14 ++++---- examples/csma-one-subnet.cc | 10 +++--- examples/csma-packet-socket.cc | 2 +- examples/mixed-global-routing.cc | 10 +++--- src/devices/csma/csma-ipv4-topology.cc | 6 ++-- src/devices/csma/csma-ipv4-topology.h | 6 ++-- src/devices/csma/csma-net-device.cc | 36 +++++++++---------- src/devices/csma/csma-net-device.h | 10 +++--- .../point-to-point-net-device.cc | 8 ++--- src/internet-node/arp-ipv4-interface.h | 1 - src/internet-node/ipv4-loopback-interface.cc | 6 ++-- src/node/address-utils.cc | 4 +-- src/node/address-utils.h | 6 ++-- src/node/ethernet-header.cc | 8 ++--- src/node/ethernet-header.h | 14 ++++---- .../{eui48-address.cc => mac48-address.cc} | 36 +++++++++---------- src/node/{eui48-address.h => mac48-address.h} | 24 ++++++------- .../{eui64-address.cc => mac64-address.cc} | 36 +++++++++---------- src/node/{eui64-address.h => mac64-address.h} | 24 ++++++------- src/node/packet-socket-address.h | 6 ++-- src/node/wscript | 8 ++--- 22 files changed, 142 insertions(+), 143 deletions(-) rename src/node/{eui48-address.cc => mac48-address.cc} (81%) rename src/node/{eui48-address.h => mac48-address.h} (80%) rename src/node/{eui64-address.cc => mac64-address.cc} (81%) rename src/node/{eui64-address.h => mac64-address.h} (80%) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index b032f0aea..e3930f2e4 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -49,7 +49,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4.h" @@ -115,13 +115,13 @@ int main (int argc, char *argv[]) DataRate(5000000), MilliSeconds(2)); uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, - Eui48Address("10:54:23:54:0:50")); + Mac48Address("10:54:23:54:0:50")); uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, - Eui48Address("10:54:23:54:0:51")); + Mac48Address("10:54:23:54:0:51")); uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0, - Eui48Address("10:54:23:54:23:51")); + Mac48Address("10:54:23:54:23:51")); uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1, - Eui48Address("10:54:23:54:23:52")); + Mac48Address("10:54:23:54:23:52")); // Later, we add IP addresses. CsmaIpv4Topology::AddIpv4Address ( diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 6bae090ff..3973c6038 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -44,7 +44,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4.h" @@ -129,19 +129,19 @@ main (int argc, char *argv[]) // connect to Lan0. // uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan0, - Eui48Address("08:00:2e:00:00:00")); + Mac48Address("08:00:2e:00:00:00")); uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan0, - Eui48Address("08:00:2e:00:00:01")); + Mac48Address("08:00:2e:00:00:01")); uint32_t nd2Lan0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan0, - Eui48Address("08:00:2e:00:00:02")); + Mac48Address("08:00:2e:00:00:02")); uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, - Eui48Address("08:00:2e:00:00:03")); + Mac48Address("08:00:2e:00:00:03")); uint32_t nd3 __attribute__ ((unused)) = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, - Eui48Address("08:00:2e:00:00:04")); + Mac48Address("08:00:2e:00:00:04")); uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, - Eui48Address("08:00:2e:00:00:05")); + Mac48Address("08:00:2e:00:00:05")); NS_DEBUG ("nd0 = " << nd0); NS_DEBUG ("nd1 = " << nd1); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 19d9200ff..3e5196bbb 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -40,7 +40,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4.h" @@ -119,16 +119,16 @@ main (int argc, char *argv[]) // zero. // uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, - Eui48Address("08:00:2e:00:00:00")); + Mac48Address("08:00:2e:00:00:00")); uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, - Eui48Address("08:00:2e:00:00:01")); + Mac48Address("08:00:2e:00:00:01")); uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, - Eui48Address("08:00:2e:00:00:02")); + Mac48Address("08:00:2e:00:00:02")); uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, - Eui48Address("08:00:2e:00:00:03")); + Mac48Address("08:00:2e:00:00:03")); NS_DEBUG ("nd0 = " << nd0); NS_DEBUG ("nd1 = " << nd1); diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index 9db207fbe..ef1c33357 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -48,7 +48,7 @@ #include "ns3/internet-node.h" #include "ns3/csma-channel.h" #include "ns3/csma-net-device.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/packet-socket-address.h" #include "ns3/socket.h" #include "ns3/onoff-application.h" diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index 07dcdcaad..d8038eaeb 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -56,7 +56,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/ipv4.h" #include "ns3/socket.h" @@ -129,13 +129,13 @@ int main (int argc, char *argv[]) DataRate(5000000), MilliSeconds(2)); uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0, - Eui48Address("10:54:23:54:23:50")); + Mac48Address("10:54:23:54:23:50")); uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0, - Eui48Address("10:54:23:54:23:51")); + Mac48Address("10:54:23:54:23:51")); uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, channelc0, - Eui48Address("10:54:23:54:23:52")); + Mac48Address("10:54:23:54:23:52")); uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, channelc0, - Eui48Address("10:54:23:54:23:53")); + Mac48Address("10:54:23:54:23:53")); // Later, we add IP addresses. PointToPointTopology::AddIpv4Addresses ( diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 80aa1c10a..dd4d03700 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -38,7 +38,7 @@ uint32_t CsmaIpv4Topology::AddIpv4CsmaNetDevice( Ptr node, Ptr channel, - Eui48Address addr) + Mac48Address addr) { Ptr q = Queue::CreateDefault (); @@ -55,7 +55,7 @@ CsmaIpv4Topology::AddIpv4CsmaNetDevice( void CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, Ptr ch, - Eui48Address addr) + Mac48Address addr) { Ptr q = Queue::CreateDefault (); @@ -75,7 +75,7 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, void CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, Ptr ch, - Eui48Address addr) + Mac48Address addr) { Ptr q = Queue::CreateDefault (); diff --git a/src/devices/csma/csma-ipv4-topology.h b/src/devices/csma/csma-ipv4-topology.h index 8ee60a9df..415ea6257 100644 --- a/src/devices/csma/csma-ipv4-topology.h +++ b/src/devices/csma/csma-ipv4-topology.h @@ -63,7 +63,7 @@ public: */ static uint32_t AddIpv4CsmaNetDevice(Ptr node, Ptr channel, - Eui48Address addr); + Mac48Address addr); /** * \param n1 Node to be attached to the Csma channel @@ -76,7 +76,7 @@ public: */ static void AddIpv4RawCsmaNode( Ptr n1, Ptr ch, - Eui48Address addr); + Mac48Address addr); /** * \param n1 Node to be attached to the Csma channel @@ -89,7 +89,7 @@ public: */ static void AddIpv4LlcCsmaNode( Ptr n1, Ptr ch, - Eui48Address addr); + Mac48Address addr); diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 015b69913..1d15f2b9b 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -69,7 +69,7 @@ CsmaTraceType::Get (void) const } CsmaNetDevice::CsmaNetDevice (Ptr node) - : NetDevice (node, Eui48Address::Allocate ()), + : NetDevice (node, Mac48Address::Allocate ()), m_bps (DataRate (0xffffffff)) { NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); @@ -77,7 +77,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr node) Init(true, true); } -CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, +CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode encapMode) : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) @@ -88,7 +88,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, Init(true, true); } -CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, +CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode encapMode, bool sendEnable, bool receiveEnable) : NetDevice(node, addr), @@ -138,8 +138,8 @@ CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) m_channel = 0; m_queue = 0; - EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); - EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); + EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); + EnableMulticast (Mac48Address ("01:00:5e:00:00:00")); SetSendEnable (sendEnable); SetReceiveEnable (receiveEnable); @@ -192,7 +192,7 @@ CsmaNetDevice::SetBackoffParams (Time slotTime, uint32_t minSlots, m_backoff.m_maxRetries = maxRetries; } void -CsmaNetDevice::AddHeader (Packet& p, Eui48Address dest, +CsmaNetDevice::AddHeader (Packet& p, Mac48Address dest, uint16_t protocolNumber) { if (m_encapMode == RAW) @@ -201,7 +201,7 @@ CsmaNetDevice::AddHeader (Packet& p, Eui48Address dest, } EthernetHeader header (false); EthernetTrailer trailer; - Eui48Address source = Eui48Address::ConvertFrom (GetAddress ()); + Mac48Address source = Mac48Address::ConvertFrom (GetAddress ()); header.SetSource(source); header.SetDestination(dest); @@ -295,7 +295,7 @@ CsmaNetDevice::SendTo ( if (!IsSendEnabled()) return false; - Eui48Address destination = Eui48Address::ConvertFrom (dest); + Mac48Address destination = Mac48Address::ConvertFrom (dest); AddHeader(p, destination, protocolNumber); // Place the packet to be sent on the send queue @@ -509,9 +509,9 @@ CsmaNetDevice::Receive (const Packet& packet) { EthernetHeader header (false); EthernetTrailer trailer; - Eui48Address broadcast; - Eui48Address multicast; - Eui48Address destination; + Mac48Address broadcast; + Mac48Address multicast; + Mac48Address destination; Packet p = packet; NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid()); @@ -543,7 +543,7 @@ CsmaNetDevice::Receive (const Packet& packet) // We are going to receive all packets destined to any multicast address, // which means clearing the low-order 23 bits the header destination // - Eui48Address mcDest; + Mac48Address mcDest; uint8_t mcBuf[6]; header.GetDestination ().CopyTo (mcBuf); @@ -552,9 +552,9 @@ CsmaNetDevice::Receive (const Packet& packet) mcBuf[5] = 0; mcDest.CopyFrom (mcBuf); - multicast = Eui48Address::ConvertFrom (GetMulticast ()); - broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); - destination = Eui48Address::ConvertFrom (GetAddress ()); + multicast = Mac48Address::ConvertFrom (GetMulticast ()); + broadcast = Mac48Address::ConvertFrom (GetBroadcast ()); + destination = Mac48Address::ConvertFrom (GetAddress ()); if ((header.GetDestination () != broadcast) && (mcDest != multicast) && @@ -609,7 +609,7 @@ CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const // primarily since we know that by construction, but also since the parameter // is an Ipv4Address. // - Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination); + Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination); // // We now have the multicast address in an abstract 48-bit container. We // need to pull it out so we can play with it. When we're done, we have the @@ -633,11 +633,11 @@ CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const etherBuffer[5] = ipBuffer[3]; // // Now, etherBuffer has the desired ethernet multicast address. We have to -// suck these bits back into the Eui48Address, +// suck these bits back into the Mac48Address, // etherAddr.CopyFrom (etherBuffer); // -// Implicit conversion (operator Address ()) is defined for Eui48Address, so +// Implicit conversion (operator Address ()) is defined for Mac48Address, so // use it by just returning the EUI-48 address which is automagically converted // to an Address. // diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 3c161cbf7..bbe5259ed 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -34,7 +34,7 @@ #include "ns3/data-rate.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" namespace ns3 { @@ -109,7 +109,7 @@ enum CsmaEncapsulationMode { * \param addr The source MAC address of the net device. * \param pktType the type of encapsulation */ - CsmaNetDevice (Ptr node, Eui48Address addr, CsmaEncapsulationMode pktType); + CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode pktType); /** * Construct a CsmaNetDevice @@ -124,7 +124,7 @@ enum CsmaEncapsulationMode { * \param sendEnable whether this device is able to send * \param receiveEnable whether this device is able to receive */ - CsmaNetDevice (Ptr node, Eui48Address addr, + CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode pktType, bool sendEnable, bool receiveEnable); /** @@ -231,7 +231,7 @@ enum CsmaEncapsulationMode { * multicast group. * * @see Ipv4Address - * @see Eui48Address + * @see Mac48Address * @see Address */ Address MakeMulticastAddress (Ipv4Address multicastGroup) const; @@ -279,7 +279,7 @@ protected: * \param protocolNumber In some protocols, identifies the type of * payload contained in this packet. */ - void AddHeader (Packet& p, Eui48Address dest, + void AddHeader (Packet& p, Mac48Address dest, uint16_t protocolNumber); /** * Removes, from a packet of data, all headers and trailers that diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index be7153074..322511467 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -24,7 +24,7 @@ #include "ns3/queue.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/llc-snap-header.h" #include "point-to-point-net-device.h" #include "point-to-point-channel.h" @@ -61,7 +61,7 @@ PointToPointTraceType::GetTypeName (void) const PointToPointNetDevice::PointToPointNetDevice (Ptr node, const DataRate& rate) : - NetDevice(node, Eui48Address::Allocate ()), + NetDevice(node, Mac48Address::Allocate ()), m_txMachineState (READY), m_bps (rate), m_tInterframeGap (Seconds(0)), @@ -74,11 +74,11 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, // BUGBUG FIXME // // You _must_ support broadcast to get any sort of packet from the ARP layer. - EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); + EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); // // We want to allow multicast packets to flow across this link // - EnableMulticast (Eui48Address ("01:00:5e:00:00:00")); + EnableMulticast (Mac48Address ("01:00:5e:00:00:00")); EnablePointToPoint(); } diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index ac4fc0e30..c5d36a29f 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -24,7 +24,6 @@ #include "ipv4-interface.h" #include "ns3/ptr.h" -#include "ns3/eui48-address.h" namespace ns3 { diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index a4e8b6bfb..ae158a9fe 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -23,7 +23,7 @@ #include "ns3/debug.h" #include "ns3/net-device.h" #include "ns3/node.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ipv4-loopback-interface.h" #include "ipv4-l3-protocol.h" @@ -52,8 +52,8 @@ Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); - ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, - Eui48Address ("ff:ff:ff:ff:ff:ff")); + ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER, + Mac48Address ("ff:ff:ff:ff:ff:ff")); } }//namespace ns3 diff --git a/src/node/address-utils.cc b/src/node/address-utils.cc index 08c5b1736..da436e4cd 100644 --- a/src/node/address-utils.cc +++ b/src/node/address-utils.cc @@ -32,7 +32,7 @@ void WriteTo (Buffer::Iterator &i, const Address &ad) ad.CopyTo (mac); i.Write (mac, ad.GetLength ()); } -void WriteTo (Buffer::Iterator &i, Eui48Address ad) +void WriteTo (Buffer::Iterator &i, Mac48Address ad) { uint8_t mac[6]; ad.CopyTo (mac); @@ -49,7 +49,7 @@ void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len) i.Read (mac, len); ad.CopyFrom (mac, len); } -void ReadFrom (Buffer::Iterator &i, Eui48Address &ad) +void ReadFrom (Buffer::Iterator &i, Mac48Address &ad) { uint8_t mac[6]; i.Read (mac, 6); diff --git a/src/node/address-utils.h b/src/node/address-utils.h index 1403c544a..db9f08064 100644 --- a/src/node/address-utils.h +++ b/src/node/address-utils.h @@ -24,17 +24,17 @@ #include "ns3/buffer.h" #include "ipv4-address.h" #include "address.h" -#include "eui48-address.h" +#include "mac48-address.h" namespace ns3 { void WriteTo (Buffer::Iterator &i, Ipv4Address ad); void WriteTo (Buffer::Iterator &i, const Address &ad); -void WriteTo (Buffer::Iterator &i, Eui48Address ad); +void WriteTo (Buffer::Iterator &i, Mac48Address ad); void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad); void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len); -void ReadFrom (Buffer::Iterator &i, Eui48Address &ad); +void ReadFrom (Buffer::Iterator &i, Mac48Address &ad); }; diff --git a/src/node/ethernet-header.cc b/src/node/ethernet-header.cc index 88803b4f5..7a4671012 100644 --- a/src/node/ethernet-header.cc +++ b/src/node/ethernet-header.cc @@ -73,22 +73,22 @@ EthernetHeader::GetPreambleSfd (void) const } void -EthernetHeader::SetSource (Eui48Address source) +EthernetHeader::SetSource (Mac48Address source) { m_source = source; } -Eui48Address +Mac48Address EthernetHeader::GetSource (void) const { return m_source; } void -EthernetHeader::SetDestination (Eui48Address dst) +EthernetHeader::SetDestination (Mac48Address dst) { m_destination = dst; } -Eui48Address +Mac48Address EthernetHeader::GetDestination (void) const { return m_destination; diff --git a/src/node/ethernet-header.h b/src/node/ethernet-header.h index b1b3d1998..f0c653722 100644 --- a/src/node/ethernet-header.h +++ b/src/node/ethernet-header.h @@ -24,7 +24,7 @@ #include "ns3/header.h" #include -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" namespace ns3 { @@ -69,11 +69,11 @@ public: /** * \param source The source address of this packet */ - void SetSource (Eui48Address source); + void SetSource (Mac48Address source); /** * \param destination The destination address of this packet. */ - void SetDestination (Eui48Address destination); + void SetDestination (Mac48Address destination); /** * \param preambleSfd The value that the preambleSfd field should take */ @@ -89,11 +89,11 @@ public: /** * \return The source address of this packet */ - Eui48Address GetSource (void) const; + Mac48Address GetSource (void) const; /** * \return The destination address of this packet */ - Eui48Address GetDestination (void) const; + Mac48Address GetDestination (void) const; /** * \return The value of the PreambleSfd field */ @@ -119,8 +119,8 @@ private: bool m_enPreambleSfd; uint64_t m_preambleSfd; /// Value of the Preamble/SFD fields uint16_t m_lengthType; /// Length or type of the packet - Eui48Address m_source; /// Source address - Eui48Address m_destination; /// Destination address + Mac48Address m_source; /// Source address + Mac48Address m_destination; /// Destination address }; }; // namespace ns3 diff --git a/src/node/eui48-address.cc b/src/node/mac48-address.cc similarity index 81% rename from src/node/eui48-address.cc rename to src/node/mac48-address.cc index d197a0e52..998bb2b11 100644 --- a/src/node/eui48-address.cc +++ b/src/node/mac48-address.cc @@ -17,7 +17,7 @@ * * Author: Mathieu Lacage */ -#include "eui48-address.h" +#include "mac48-address.h" #include "address.h" #include "ns3/assert.h" #include @@ -45,11 +45,11 @@ AsciiToLowCase (char c) } -Eui48Address::Eui48Address () +Mac48Address::Mac48Address () { memset (m_address, 0, 6); } -Eui48Address::Eui48Address (const char *str) +Mac48Address::Mac48Address (const char *str) { int i = 0; while (*str != 0 && i < 6) @@ -80,44 +80,44 @@ Eui48Address::Eui48Address (const char *str) NS_ASSERT (i == 6); } void -Eui48Address::CopyFrom (const uint8_t buffer[6]) +Mac48Address::CopyFrom (const uint8_t buffer[6]) { memcpy (m_address, buffer, 6); } void -Eui48Address::CopyTo (uint8_t buffer[6]) const +Mac48Address::CopyTo (uint8_t buffer[6]) const { memcpy (buffer, m_address, 6); } bool -Eui48Address::IsMatchingType (const Address &address) +Mac48Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 6); } -Eui48Address::operator Address () +Mac48Address::operator Address () { return ConvertTo (); } Address -Eui48Address::ConvertTo (void) const +Mac48Address::ConvertTo (void) const { return Address (GetType (), m_address, 6); } -Eui48Address -Eui48Address::ConvertFrom (const Address &address) +Mac48Address +Mac48Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 6)); - Eui48Address retval; + Mac48Address retval; address.CopyTo (retval.m_address); return retval; } -Eui48Address -Eui48Address::Allocate (void) +Mac48Address +Mac48Address::Allocate (void) { static uint64_t id = 0; id++; - Eui48Address address; + Mac48Address address; address.m_address[0] = (id >> 40) & 0xff; address.m_address[1] = (id >> 32) & 0xff; address.m_address[2] = (id >> 24) & 0xff; @@ -127,13 +127,13 @@ Eui48Address::Allocate (void) return address; } uint8_t -Eui48Address::GetType (void) +Mac48Address::GetType (void) { static uint8_t type = Address::Register (); return type; } -bool operator == (const Eui48Address &a, const Eui48Address &b) +bool operator == (const Mac48Address &a, const Mac48Address &b) { uint8_t ada[6]; uint8_t adb[6]; @@ -141,12 +141,12 @@ bool operator == (const Eui48Address &a, const Eui48Address &b) b.CopyTo (adb); return memcmp (ada, adb, 6) == 0; } -bool operator != (const Eui48Address &a, const Eui48Address &b) +bool operator != (const Mac48Address &a, const Mac48Address &b) { return ! (a == b); } -std::ostream& operator<< (std::ostream& os, const Eui48Address & address) +std::ostream& operator<< (std::ostream& os, const Mac48Address & address) { uint8_t ad[6]; address.CopyTo (ad); diff --git a/src/node/eui48-address.h b/src/node/mac48-address.h similarity index 80% rename from src/node/eui48-address.h rename to src/node/mac48-address.h index bd778a444..1a290dad3 100644 --- a/src/node/eui48-address.h +++ b/src/node/mac48-address.h @@ -32,16 +32,16 @@ class Address; * * This class can contain 48 bit IEEE addresses. */ -class Eui48Address +class Mac48Address { public: - Eui48Address (); + Mac48Address (); /** - * \param str a string representing the new Eui48Address + * \param str a string representing the new Mac48Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ - Eui48Address (const char *str); + Mac48Address (const char *str); /** * \param buffer address in network order @@ -64,21 +64,21 @@ public: operator Address (); /** * \param address a polymorphic address - * \returns a new Eui48Address from the polymorphic address + * \returns a new Mac48Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an - * Eui48Address. + * Mac48Address. */ - static Eui48Address ConvertFrom (const Address &address); + static Mac48Address ConvertFrom (const Address &address); /** * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** - * Allocate a new Eui48Address. + * Allocate a new Mac48Address. */ - static Eui48Address Allocate (void); + static Mac48Address Allocate (void); private: /** * \returns a new Address instance @@ -90,9 +90,9 @@ private: uint8_t m_address[6]; }; -bool operator == (const Eui48Address &a, const Eui48Address &b); -bool operator != (const Eui48Address &a, const Eui48Address &b); -std::ostream& operator<< (std::ostream& os, const Eui48Address & address); +bool operator == (const Mac48Address &a, const Mac48Address &b); +bool operator != (const Mac48Address &a, const Mac48Address &b); +std::ostream& operator<< (std::ostream& os, const Mac48Address & address); } // namespace ns3 diff --git a/src/node/eui64-address.cc b/src/node/mac64-address.cc similarity index 81% rename from src/node/eui64-address.cc rename to src/node/mac64-address.cc index 9cbbba381..b6056a4ed 100644 --- a/src/node/eui64-address.cc +++ b/src/node/mac64-address.cc @@ -17,7 +17,7 @@ * * Author: Mathieu Lacage */ -#include "eui64-address.h" +#include "mac64-address.h" #include "address.h" #include "ns3/assert.h" #include @@ -45,11 +45,11 @@ AsciiToLowCase (char c) } -Eui64Address::Eui64Address () +Mac64Address::Mac64Address () { memset (m_address, 0, 8); } -Eui64Address::Eui64Address (const char *str) +Mac64Address::Mac64Address (const char *str) { int i = 0; while (*str != 0 && i < 8) @@ -80,45 +80,45 @@ Eui64Address::Eui64Address (const char *str) NS_ASSERT (i == 6); } void -Eui64Address::CopyFrom (const uint8_t buffer[8]) +Mac64Address::CopyFrom (const uint8_t buffer[8]) { memcpy (m_address, buffer, 8); } void -Eui64Address::CopyTo (uint8_t buffer[8]) const +Mac64Address::CopyTo (uint8_t buffer[8]) const { memcpy (buffer, m_address, 8); } bool -Eui64Address::IsMatchingType (const Address &address) +Mac64Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 8); } -Eui64Address::operator Address () +Mac64Address::operator Address () { return ConvertTo (); } -Eui64Address -Eui64Address::ConvertFrom (const Address &address) +Mac64Address +Mac64Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 8)); - Eui64Address retval; + Mac64Address retval; address.CopyTo (retval.m_address); return retval; } Address -Eui64Address::ConvertTo (void) const +Mac64Address::ConvertTo (void) const { return Address (GetType (), m_address, 8); } -Eui64Address -Eui64Address::Allocate (void) +Mac64Address +Mac64Address::Allocate (void) { static uint64_t id = 0; id++; - Eui64Address address; + Mac64Address address; address.m_address[0] = (id >> 56) & 0xff; address.m_address[1] = (id >> 48) & 0xff; address.m_address[2] = (id >> 40) & 0xff; @@ -130,13 +130,13 @@ Eui64Address::Allocate (void) return address; } uint8_t -Eui64Address::GetType (void) +Mac64Address::GetType (void) { static uint8_t type = Address::Register (); return type; } -bool operator == (const Eui64Address &a, const Eui64Address &b) +bool operator == (const Mac64Address &a, const Mac64Address &b) { uint8_t ada[8]; uint8_t adb[8]; @@ -144,12 +144,12 @@ bool operator == (const Eui64Address &a, const Eui64Address &b) b.CopyTo (adb); return memcmp (ada, adb, 8) == 0; } -bool operator != (const Eui64Address &a, const Eui64Address &b) +bool operator != (const Mac64Address &a, const Mac64Address &b) { return ! (a == b); } -std::ostream& operator<< (std::ostream& os, const Eui64Address & address) +std::ostream& operator<< (std::ostream& os, const Mac64Address & address) { uint8_t ad[8]; address.CopyTo (ad); diff --git a/src/node/eui64-address.h b/src/node/mac64-address.h similarity index 80% rename from src/node/eui64-address.h rename to src/node/mac64-address.h index 98b930057..f304af6a1 100644 --- a/src/node/eui64-address.h +++ b/src/node/mac64-address.h @@ -32,16 +32,16 @@ class Address; * * This class can contain 64 bit IEEE addresses. */ -class Eui64Address +class Mac64Address { public: - Eui64Address (); + Mac64Address (); /** - * \param str a string representing the new Eui64Address + * \param str a string representing the new Mac64Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ - Eui64Address (const char *str); + Mac64Address (const char *str); /** * \param buffer address in network order @@ -63,21 +63,21 @@ public: operator Address (); /** * \param address a polymorphic address - * \returns a new Eui64Address from the polymorphic address + * \returns a new Mac64Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an - * Eui64Address. + * Mac64Address. */ - static Eui64Address ConvertFrom (const Address &address); + static Mac64Address ConvertFrom (const Address &address); /** * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** - * Allocate a new Eui64Address. + * Allocate a new Mac64Address. */ - static Eui64Address Allocate (void); + static Mac64Address Allocate (void); private: /** * \returns a new Address instance @@ -89,9 +89,9 @@ private: uint8_t m_address[8]; }; -bool operator == (const Eui64Address &a, const Eui64Address &b); -bool operator != (const Eui64Address &a, const Eui64Address &b); -std::ostream& operator<< (std::ostream& os, const Eui64Address & address); +bool operator == (const Mac64Address &a, const Mac64Address &b); +bool operator != (const Mac64Address &a, const Mac64Address &b); +std::ostream& operator<< (std::ostream& os, const Mac64Address & address); } // namespace ns3 diff --git a/src/node/packet-socket-address.h b/src/node/packet-socket-address.h index e280db8df..87f254e8c 100644 --- a/src/node/packet-socket-address.h +++ b/src/node/packet-socket-address.h @@ -22,8 +22,8 @@ #include "ns3/ptr.h" #include "address.h" -#include "eui48-address.h" -#include "eui64-address.h" +#include "mac48-address.h" +#include "mac64-address.h" #include "net-device.h" namespace ns3 { @@ -54,7 +54,7 @@ class PacketSocketAddress /** * \param address a polymorphic address * - * Convert a polymorphic address to an Eui48Address instance. + * Convert a polymorphic address to an Mac48Address instance. * The conversion performs a type check. */ static PacketSocketAddress ConvertFrom (const Address &address); diff --git a/src/node/wscript b/src/node/wscript index b9fd9552a..c491b8b0e 100644 --- a/src/node/wscript +++ b/src/node/wscript @@ -4,8 +4,8 @@ def build(bld): node = bld.create_ns3_module('node', ['core', 'common', 'simulator']) node.source = [ 'address.cc', - 'eui48-address.cc', - 'eui64-address.cc', + 'mac48-address.cc', + 'mac64-address.cc', 'inet-socket-address.cc', 'packet-socket-address.cc', 'node.cc', @@ -32,8 +32,8 @@ def build(bld): headers = bld.create_obj('ns3header') headers.source = [ 'address.h', - 'eui48-address.h', - 'eui64-address.h', + 'mac48-address.h', + 'mac64-address.h', 'inet-socket-address.h', 'packet-socket-address.h', 'node.h', From 77ca76e8e997dc80ed246e2cedaabf35013eb7dd Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 12 Sep 2007 15:23:25 -0700 Subject: [PATCH 181/218] start of udp echo applications --HG-- rename : src/applications/onoff-application.cc => src/applications/onoff/onoff-application.cc rename : src/applications/onoff-application.h => src/applications/onoff/onoff-application.h rename : src/applications/packet-sink.cc => src/applications/packet-sink/packet-sink.cc rename : src/applications/packet-sink.h => src/applications/packet-sink/packet-sink.h --- examples/udp-echo.cc | 200 ++++++++++++++++++ examples/wscript | 4 + samples/wscript | 2 +- .../{ => onoff}/onoff-application.cc | 0 .../{ => onoff}/onoff-application.h | 0 src/applications/{ => onoff}/wscript | 8 +- .../{ => packet-sink}/packet-sink.cc | 0 .../{ => packet-sink}/packet-sink.h | 0 src/applications/packet-sink/wscript | 12 ++ src/applications/udp-echo/udp-echo-client.cc | 192 +++++++++++++++++ src/applications/udp-echo/udp-echo-client.h | 70 ++++++ src/applications/udp-echo/wscript | 12 ++ src/applications/waf | 1 - src/internet-node/wscript | 2 +- src/wscript | 4 +- 15 files changed, 498 insertions(+), 9 deletions(-) create mode 100644 examples/udp-echo.cc rename src/applications/{ => onoff}/onoff-application.cc (100%) rename src/applications/{ => onoff}/onoff-application.h (100%) rename src/applications/{ => onoff}/wscript (66%) rename src/applications/{ => packet-sink}/packet-sink.cc (100%) rename src/applications/{ => packet-sink}/packet-sink.h (100%) create mode 100644 src/applications/packet-sink/wscript create mode 100644 src/applications/udp-echo/udp-echo-client.cc create mode 100644 src/applications/udp-echo/udp-echo-client.h create mode 100644 src/applications/udp-echo/wscript delete mode 100755 src/applications/waf diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc new file mode 100644 index 000000000..5a0280695 --- /dev/null +++ b/examples/udp-echo.cc @@ -0,0 +1,200 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Network topology +// +// n0 n1 n2 n3 +// | | | | +// ================= +// LAN +// +// - CBR/UDP flows from n0 to n1 and from n3 to n0 +// - DropTail queues +// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/debug.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/eui48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/udp-echo-client.h" + +using namespace ns3; + +NS_DEBUG_COMPONENT_DEFINE ("UdpEcho"); + +int +main (int argc, char *argv[]) +{ +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// +#if 1 + DebugComponentEnable("CsmaOneSubnet"); + + DebugComponentEnable("Object"); + DebugComponentEnable("Queue"); + DebugComponentEnable("DropTailQueue"); + DebugComponentEnable("Channel"); + DebugComponentEnable("CsmaChannel"); + DebugComponentEnable("CsmaNetDevice"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("NetDevice"); + DebugComponentEnable("PacketSocket"); + DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("UdpSocket"); + DebugComponentEnable("UdpL4Protocol"); + DebugComponentEnable("Ipv4L3Protocol"); + DebugComponentEnable("Ipv4StaticRouting"); + DebugComponentEnable("Ipv4Interface"); + DebugComponentEnable("ArpIpv4Interface"); + DebugComponentEnable("Ipv4LoopbackInterface"); + DebugComponentEnable("UdpEchoClient"); +#endif +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// + DefaultValue::Bind ("Queue", "DropTailQueue"); +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// + CommandLine::Parse (argc, argv); +// +// Explicitly create the nodes required by the topology (shown above). +// + NS_DEBUG("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + NS_DEBUG("Create channels."); +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan = CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + NS_DEBUG("Build Topology."); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + Eui48Address("08:00:2e:00:00:00")); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + Eui48Address("08:00:2e:00:00:01")); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + Eui48Address("08:00:2e:00:00:02")); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + Eui48Address("08:00:2e:00:00:03")); + + NS_DEBUG ("nd0 = " << nd0); + NS_DEBUG ("nd1 = " << nd1); + NS_DEBUG ("nd2 = " << nd2); + NS_DEBUG ("nd3 = " << nd3); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// + NS_DEBUG("Assign IP Addresses."); +// +// XXX BUGBUG +// Need a better way to get the interface index. The point-to-point topology +// as implemented can't return the index since it creates interfaces on both +// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +// method on Ipv4 to find the interface index corresponding to a given ipv4 +// address. +// +// Assign IP addresses to the net devices and associated interfaces +// on the lan. The AddIpv4Address method returns an Ipv4 interface index +// which we do not need here. +// + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address("10.1.1.1"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address("10.1.1.2"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address("10.1.1.3"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), + Ipv4Mask("255.255.255.0")); +// +// Create a UdpEchoClient application to send UDP datagrams from node zero to +// node 1. +// + NS_DEBUG("Create Applications."); + Ptr client = Create (n0,"10.1.1.2", 80, + 1, Seconds(1.), 1024); +// +// Tell the application when to start and stop. +// + client->Start(Seconds(1.0)); + client->Stop (Seconds(10.0)); +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "csma-one-subnet.tr" +// + NS_DEBUG("Configure Tracing."); + AsciiTrace asciitrace ("csma-one-subnet.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// csma-one-subnet.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// + PcapTrace pcaptrace ("csma-one-subnet.pcap"); + pcaptrace.TraceAllIp (); +// +// Now, do the actual simulation. +// + NS_DEBUG("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); + NS_DEBUG("Done."); +} diff --git a/examples/wscript b/examples/wscript index 0c887cad0..a1f16e29b 100644 --- a/examples/wscript +++ b/examples/wscript @@ -14,6 +14,10 @@ def build(bld): ['csma', 'internet-node']) obj.source = 'csma-one-subnet.cc' + obj = bld.create_ns3_program('udp-echo', + ['csma', 'internet-node']) + obj.source = 'udp-echo.cc' + obj = bld.create_ns3_program('csma-broadcast', ['csma', 'internet-node']) obj.source = 'csma-broadcast.cc' diff --git a/samples/wscript b/samples/wscript index d8733131a..e89fbe9b8 100644 --- a/samples/wscript +++ b/samples/wscript @@ -26,7 +26,7 @@ def build(bld): obj.source = 'main-test.cc' obj = bld.create_ns3_program('main-simple', - ['node', 'internet-node', 'applications']) + ['node', 'internet-node', 'onoff']) obj.source = 'main-simple.cc' obj = bld.create_ns3_program('main-default-value', diff --git a/src/applications/onoff-application.cc b/src/applications/onoff/onoff-application.cc similarity index 100% rename from src/applications/onoff-application.cc rename to src/applications/onoff/onoff-application.cc diff --git a/src/applications/onoff-application.h b/src/applications/onoff/onoff-application.h similarity index 100% rename from src/applications/onoff-application.h rename to src/applications/onoff/onoff-application.h diff --git a/src/applications/wscript b/src/applications/onoff/wscript similarity index 66% rename from src/applications/wscript rename to src/applications/onoff/wscript index 760f76e18..c1bfe4c52 100644 --- a/src/applications/wscript +++ b/src/applications/onoff/wscript @@ -1,14 +1,12 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - obj = bld.create_ns3_module('applications', ['node']) - obj.source = [ + module = bld.create_ns3_module('onoff', ['core']) + module.source = [ 'onoff-application.cc', - 'packet-sink.cc', ] - headers = bld.create_obj('ns3header') headers.source = [ 'onoff-application.h', - 'packet-sink.h', ] + diff --git a/src/applications/packet-sink.cc b/src/applications/packet-sink/packet-sink.cc similarity index 100% rename from src/applications/packet-sink.cc rename to src/applications/packet-sink/packet-sink.cc diff --git a/src/applications/packet-sink.h b/src/applications/packet-sink/packet-sink.h similarity index 100% rename from src/applications/packet-sink.h rename to src/applications/packet-sink/packet-sink.h diff --git a/src/applications/packet-sink/wscript b/src/applications/packet-sink/wscript new file mode 100644 index 000000000..332b6e4a1 --- /dev/null +++ b/src/applications/packet-sink/wscript @@ -0,0 +1,12 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + module = bld.create_ns3_module('packet-sink', ['node']) + module.source = [ + 'packet-sink.cc', + ] + headers = bld.create_obj('ns3header') + headers.source = [ + 'packet-sink.h', + ] + diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc new file mode 100644 index 000000000..317a91065 --- /dev/null +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -0,0 +1,192 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ +#include "ns3/debug.h" +#include "ns3/ipv4-address.h" +#include "ns3/nstime.h" +#include "ns3/inet-socket-address.h" +#include "ns3/socket.h" +#include "ns3/simulator.h" +#include "ns3/socket-factory.h" +#include "ns3/packet.h" + +#include "udp-echo-client.h" + +#if 0 +int sock; /* Socket descriptor */ +struct sockaddr_in echoServAddr; /* Echo server address */ +struct sockaddr_in fromAddr; /* Source address of echo */ +unsigned short echoServPort; /* Echo server port */ +unsigned int fromSize; /* In-out of address size for recvfrom() */ +char *servIP; /* IP address of server */ +char *echoString; /* String to send to echo server */ +char echoBuffer[ECHOMAX+1]; /* Buffer for receiving echoed string */ +int echoStringLen; /* Length of string to echo */ +int respStringLen; /* Length of received response */ + +if ((echoStringLen = strlen(echoString)) > ECHOMAX) /* Check input length */ + DieWithError("Echo word too long"); + +if (argc == 4) + echoServPort = atoi(argv[3]); /* Use given port, if any */ + else + echoServPort = 7; /* 7 is the well-known port for the echo service */ + +/* Create a datagram/UDP socket */ +if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) + DieWithError("socket() failed"); + +/* Construct the server address structure */ +memset(&echoServAddr, 0, sizeof(echoServAddr)); /* Zero out structure */ +echoServAddr.sin_family = AF_INET; /* Internet addr family */ +echoServAddr.sin_addr.s_addr = inet_addr(servIP); /* Server IP address */ +echoServAddr.sin_port = htons(echoServPort); /* Server port */ + +/* Send the string to the server */ +if (sendto(sock, echoString, echoStringLen, 0, (struct sockaddr *) + &echoServAddr, sizeof(echoServAddr)) != echoStringLen) + DieWithError("sendto() sent a different number of bytes than expected"); + +/* Recv a response */ +fromSize = sizeof(fromAddr); +if ((respStringLen = recvfrom(sock, echoBuffer, ECHOMAX, 0, + (struct sockaddr *) &fromAddr, &fromSize)) != echoStringLen) + DieWithError("recvfrom() failed"); + +if (echoServAddr.sin_addr.s_addr != fromAddr.sin_addr.s_addr) + { + fprintf(stderr,"Error: received a packet from unknown source.\n"); + exit(1); + } + +/* null-terminate the received data */ +echoBuffer[respStringLen] = '\0'; +printf("Received: %s\n", echoBuffer); /* Print the echoed arg */ + +close(sock); +exit(0); +#endif + +namespace ns3 { + +NS_DEBUG_COMPONENT_DEFINE ("UdpEchoClient"); + +UdpEchoClient::UdpEchoClient ( + Ptr n, + Ipv4Address serverAddress, + uint16_t serverPort, + uint32_t count, + Time interval, + uint32_t size) +: + Application(n) +{ + NS_DEBUG ("UdpEchoClient::UdpEchoClient (" << n << ", " << serverAddress << + ", " << serverPort << ", " << count << ", " << interval << + ", " << size << ")"); + + Construct (n, serverAddress, serverPort, count, interval, size); +} + +UdpEchoClient::~UdpEchoClient() +{ + NS_DEBUG ("UdpEchoClient::~UdpEchoClient ()"); +} + +void +UdpEchoClient::Construct ( + Ptr n, + Ipv4Address serverAddress, + uint16_t serverPort, + uint32_t count, + Time interval, + uint32_t size) +{ + NS_DEBUG ("UdpEchoClient::Construct (" << n << ", " << serverAddress << + ", " << serverPort << ", " << count << ", " << interval << + ", " << size << ")"); + + m_node = n; + m_serverAddress = serverAddress; + m_serverPort = serverPort; + m_count = count; + m_interval = interval; + m_size = size; + + m_sent = 0; + m_socket = 0; + m_peer = InetSocketAddress (serverAddress, serverPort); + m_sendEvent = EventId (); +} + +void +UdpEchoClient::DoDispose (void) +{ + NS_DEBUG ("UdpEchoClient::DoDispose ()"); + Application::DoDispose (); +} + +void +UdpEchoClient::StartApplication (void) +{ + NS_DEBUG ("UdpEchoClient::StartApplication ()"); + + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName ("Udp"); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (); + m_socket->Connect (m_peer); + } + + StopApplication (); + ScheduleTransmit (Seconds(0.)); +} + +void +UdpEchoClient::StopApplication () +{ + NS_DEBUG ("UdpEchoClient::StopApplication ()"); +} + +void +UdpEchoClient::ScheduleTransmit (Time dt) +{ + NS_DEBUG ("UdpEchoClient::ScheduleTransmit (" << dt << ")"); + m_sendEvent = Simulator::Schedule(dt, &UdpEchoClient::Send, this); +} + +void +UdpEchoClient::Send (void) +{ + NS_DEBUG ("UdpEchoClient::Send ()"); + + NS_ASSERT (m_sendEvent.IsExpired ()); + + Packet p (m_size); + m_socket->Send (p); + ++m_sent; + + if (m_sent < m_count) + { + ScheduleTransmit (m_interval); + } +} + +} // Namespace ns3 diff --git a/src/applications/udp-echo/udp-echo-client.h b/src/applications/udp-echo/udp-echo-client.h new file mode 100644 index 000000000..7c5f2478a --- /dev/null +++ b/src/applications/udp-echo/udp-echo-client.h @@ -0,0 +1,70 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ + +#ifndef __UDP_ECHO_CLIENT_H__ +#define __UDP_ECHO_CLIENT_H__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +class UdpEchoClient : public Application +{ +public: + UdpEchoClient (Ptr n, Ipv4Address serverAddr, uint16_t serverPort, + uint32_t count, Time interval, uint32_t size); + + virtual ~UdpEchoClient (); + +protected: + virtual void DoDispose (void); + +private: + void Construct (Ptr n, Ipv4Address serverAddr, uint16_t serverPort, + uint32_t count, Time interval, uint32_t size); + + virtual void StartApplication (void); + virtual void StopApplication (void); + + void ScheduleTransmit (Time dt); + void Send (void); + + Ptr m_node; + Ipv4Address m_serverAddress; + uint16_t m_serverPort; + uint32_t m_count; + Time m_interval; + uint32_t m_size; + + uint32_t m_sent; + Ptr m_socket; + Address m_peer; + EventId m_sendEvent; + +}; + +} // namespace ns3 + +#endif // __UDP_ECHO_CLIENT_H__ + diff --git a/src/applications/udp-echo/wscript b/src/applications/udp-echo/wscript new file mode 100644 index 000000000..00cbaa3c5 --- /dev/null +++ b/src/applications/udp-echo/wscript @@ -0,0 +1,12 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + module = bld.create_ns3_module('udp-echo', ['internet-node']) + module.source = [ + 'udp-echo-client.cc', + ] + headers = bld.create_obj('ns3header') + headers.source = [ + 'udp-echo-client.h', + ] + diff --git a/src/applications/waf b/src/applications/waf deleted file mode 100755 index 3dcf598bc..000000000 --- a/src/applications/waf +++ /dev/null @@ -1 +0,0 @@ -exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/internet-node/wscript b/src/internet-node/wscript index a5f5ec6ef..3bb60d1bb 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -2,7 +2,7 @@ def build(bld): - obj = bld.create_ns3_module('internet-node', ['node', 'applications']) + obj = bld.create_ns3_module('internet-node', ['node']) obj.source = [ 'internet-node.cc', 'ipv4-l4-demux.cc', diff --git a/src/wscript b/src/wscript index 859021e66..27c0154c9 100644 --- a/src/wscript +++ b/src/wscript @@ -18,7 +18,9 @@ all_modules = ( 'internet-node', 'devices/point-to-point', 'devices/csma', - 'applications', + 'applications/onoff', + 'applications/packet-sink', + 'applications/udp-echo', 'routing/global-routing', 'mobility', ) From d4538de6f6b7651867dd1055394caa22edb2799b Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 12 Sep 2007 16:20:07 -0700 Subject: [PATCH 182/218] server half --- examples/udp-echo.cc | 25 ++-- src/applications/onoff/waf | 1 + src/applications/packet-sink/waf | 1 + src/applications/udp-echo/udp-echo-server.cc | 120 +++++++++++++++++++ src/applications/udp-echo/udp-echo-server.h | 61 ++++++++++ src/applications/udp-echo/waf | 1 + src/applications/udp-echo/wscript | 2 + 7 files changed, 204 insertions(+), 7 deletions(-) create mode 100755 src/applications/onoff/waf create mode 100755 src/applications/packet-sink/waf create mode 100644 src/applications/udp-echo/udp-echo-server.cc create mode 100644 src/applications/udp-echo/udp-echo-server.h create mode 100755 src/applications/udp-echo/waf diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 5a0280695..b59c2b5a8 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -23,7 +23,7 @@ // // - CBR/UDP flows from n0 to n1 and from n3 to n0 // - DropTail queues -// - Tracing of queues and packet receptions to file "csma-one-subnet.tr" +// - Tracing of queues and packet receptions to file "udp-echo.tr" #include "ns3/command-line.h" #include "ns3/default-value.h" @@ -46,6 +46,7 @@ #include "ns3/socket.h" #include "ns3/ipv4-route.h" #include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" using namespace ns3; @@ -161,12 +162,13 @@ main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); + + NS_DEBUG("Create Applications."); // // Create a UdpEchoClient application to send UDP datagrams from node zero to // node 1. // - NS_DEBUG("Create Applications."); - Ptr client = Create (n0,"10.1.1.2", 80, + Ptr client = Create (n0, "10.1.1.2", 80, 1, Seconds(1.), 1024); // // Tell the application when to start and stop. @@ -174,21 +176,30 @@ main (int argc, char *argv[]) client->Start(Seconds(1.0)); client->Stop (Seconds(10.0)); // +// Create a UdpEchoServer application on node 1. +// + Ptr server = Create (n0, "0.0.0.0", 80); +// +// Tell the application when to start and stop. +// + server->Start(Seconds(0.)); + server->Stop (Seconds(10.0)); +// // Configure tracing of all enqueue, dequeue, and NetDevice receive events. -// Trace output will be sent to the file "csma-one-subnet.tr" +// Trace output will be sent to the file "udp-echo.tr" // NS_DEBUG("Configure Tracing."); - AsciiTrace asciitrace ("csma-one-subnet.tr"); + AsciiTrace asciitrace ("udp-echo.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); // // Also configure some tcpdump traces; each interface will be traced. // The output files will be named: -// csma-one-subnet.pcap-- +// udp-echo.pcap-- // and can be read by the "tcpdump -r" command (use "-tt" option to // display timestamps correctly) // - PcapTrace pcaptrace ("csma-one-subnet.pcap"); + PcapTrace pcaptrace ("udp-echo.pcap"); pcaptrace.TraceAllIp (); // // Now, do the actual simulation. diff --git a/src/applications/onoff/waf b/src/applications/onoff/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/onoff/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/packet-sink/waf b/src/applications/packet-sink/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/packet-sink/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/udp-echo/udp-echo-server.cc b/src/applications/udp-echo/udp-echo-server.cc new file mode 100644 index 000000000..26958b80f --- /dev/null +++ b/src/applications/udp-echo/udp-echo-server.cc @@ -0,0 +1,120 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ +#include "ns3/debug.h" +#include "ns3/ipv4-address.h" +#include "ns3/nstime.h" +#include "ns3/inet-socket-address.h" +#include "ns3/socket.h" +#include "ns3/simulator.h" +#include "ns3/socket-factory.h" +#include "ns3/packet.h" + +#include "udp-echo-server.h" + +namespace ns3 { + +NS_DEBUG_COMPONENT_DEFINE ("UdpEchoServer"); + +UdpEchoServer::UdpEchoServer ( + Ptr n, + Ipv4Address clientAddress, + uint16_t clientPort) +: + Application(n) +{ + NS_DEBUG ("UdpEchoServer::UdpEchoServer (" << n << ", " << clientAddress << + ", " << clientPort << ")"); + + Construct (n, clientAddress, clientPort); +} + +UdpEchoServer::~UdpEchoServer() +{ + NS_DEBUG ("UdpEchoServer::~UdpEchoServer ()"); +} + +void +UdpEchoServer::Construct ( + Ptr n, + Ipv4Address clientAddress, + uint16_t clientPort) +{ + NS_DEBUG ("UdpEchoServer::Construct (" << n << ", " << clientAddress << + ", " << clientPort << ")"); + + m_node = n; + m_clientAddress = clientAddress; + m_clientPort = clientPort; + + m_socket = 0; + m_client = InetSocketAddress (clientAddress, clientPort); +} + +void +UdpEchoServer::DoDispose (void) +{ + NS_DEBUG ("UdpEchoServer::DoDispose ()"); + Application::DoDispose (); +} + +void +UdpEchoServer::StartApplication (void) +{ + NS_DEBUG ("UdpEchoServer::StartApplication ()"); + + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName ("Udp"); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (m_client); + } + + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&UdpEchoServer::Receive, this)); +} + +void +UdpEchoServer::StopApplication () +{ + NS_DEBUG ("UdpEchoServer::StopApplication ()"); + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + } +} + +void UdpEchoServer::Receive( + Ptr socket, + const Packet &packet, + const Address &from) +{ + NS_DEBUG ("UdpEchoServer::Receive (" << socket << ", " << packet << + ", " << from << ")"); + + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_DEBUG ("UdpEchoServer::Receive(): Received " << + packet.GetSize() << " bytes from " << address.GetIpv4()); + } +} + +} // Namespace ns3 diff --git a/src/applications/udp-echo/udp-echo-server.h b/src/applications/udp-echo/udp-echo-server.h new file mode 100644 index 000000000..d9de1221f --- /dev/null +++ b/src/applications/udp-echo/udp-echo-server.h @@ -0,0 +1,61 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ + +#ifndef __UDP_ECHO_SERVER_H__ +#define __UDP_ECHO_SERVER_H__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +class UdpEchoServer : public Application +{ +public: + UdpEchoServer (Ptr n, Ipv4Address clientAddr, uint16_t clientPort); + virtual ~UdpEchoServer (); + +protected: + virtual void DoDispose (void); + +private: + void Construct (Ptr n, Ipv4Address clientAddr, uint16_t clientPort); + + virtual void StartApplication (void); + virtual void StopApplication (void); + + void Receive(Ptr socket, const Packet &packet, + const Address &from); + + Ptr m_node; + Ipv4Address m_clientAddress; + uint16_t m_clientPort; + + Ptr m_socket; + Address m_client; +}; + +} // namespace ns3 + +#endif // __UDP_ECHO_SERVER_H__ + diff --git a/src/applications/udp-echo/waf b/src/applications/udp-echo/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/udp-echo/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/udp-echo/wscript b/src/applications/udp-echo/wscript index 00cbaa3c5..f6416980a 100644 --- a/src/applications/udp-echo/wscript +++ b/src/applications/udp-echo/wscript @@ -4,9 +4,11 @@ def build(bld): module = bld.create_ns3_module('udp-echo', ['internet-node']) module.source = [ 'udp-echo-client.cc', + 'udp-echo-server.cc', ] headers = bld.create_obj('ns3header') headers.source = [ 'udp-echo-client.h', + 'udp-echo-server.h', ] From 93ea657400e739f4c21e57fa2e557d0aa68596fe Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 12 Sep 2007 16:24:31 -0700 Subject: [PATCH 183/218] log rides along for free --- src/core/log.cc | 269 +++++++++++++++++++++++++++++++++++++++++++++++ src/core/log.h | 167 +++++++++++++++++++++++++++++ src/core/wscript | 2 + 3 files changed, 438 insertions(+) create mode 100644 src/core/log.cc create mode 100644 src/core/log.h diff --git a/src/core/log.cc b/src/core/log.cc new file mode 100644 index 000000000..fa1c6f6f9 --- /dev/null +++ b/src/core/log.cc @@ -0,0 +1,269 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,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 + */ +#include +#include +#include +#include "log.h" +#include "assert.h" +#include "ns3/core-config.h" +#include "fatal-error.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +namespace ns3 { + +typedef std::list > ComponentList; +typedef std::list >::iterator ComponentListI; + +static +ComponentList *GetComponentList (void) +{ + static ComponentList components; + return &components; +} + +void +LogComponentEnableEnvVar (void) +{ + static bool isFirstLog = true; + if (!isFirstLog) + { + return; + } +#ifdef HAVE_GETENV + char *envVar = getenv("NS_LOG"); + if (envVar == 0) + { + isFirstLog = false; + return; + } + std::string env = envVar; + if (env == "print-list") + { + LogComponentPrintList (); + isFirstLog = false; + return; + } + bool allFound = true; + std::string::size_type cur = 0; + std::string::size_type next = 0; + while (true) + { + next = env.find_first_of (";", cur); + std::string tmp = std::string (env, cur, next); + { + /* The following code is a workaround for a bug in the g++ + * c++ string library. Its goal is to remove any trailing ';' + * from the string even though there should not be any in + * it. This code should be safe even if the bug is not there. + */ + std::string::size_type trailing = tmp.find_first_of (";"); + tmp = tmp.substr (0, trailing); + } + if (tmp.size () == 0) + { + break; + } + std::string::size_type equal = tmp.find ("="); + std::string component; + int level; + if (equal == std::string::npos) + { + component = tmp; + level = LOG_LEVEL_DEBUG; + } + else + { + component = tmp.substr (0, equal); + std::string::size_type cur_lev; + std::string::size_type next_lev = equal; + do + { + cur_lev = next_lev + 1; + next_lev = tmp.find ("|", cur_lev); + std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); + if (lev == "debug") + { + level |= LOG_LEVEL_DEBUG; + } + else if (lev == "func") + { + level |= LOG_LEVEL_FUNCTION; + } + else if (lev == "param") + { + level |= LOG_LEVEL_PARAM; + } + else if (lev == "warn") + { + level |= LOG_LEVEL_WARN; + } + else if (lev == "error") + { + level |= LOG_LEVEL_ERROR; + } + } while (next_lev != std::string::npos); + } + bool found = false; + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (component) == 0) + { + found = true; + + i->second->Enable ((enum LogLevel)level); + break; + } + } + if (!found) + { + allFound = false; + } + if (next == std::string::npos) + { + break; + } + cur = next + 1; + if (cur >= env.size ()) + { + break; + } + } + if (allFound) + { + isFirstLog = false; + } + +#endif +} + + +LogComponent::LogComponent (char const * name) + : m_levels (0) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + NS_ASSERT (i->first != name); + } + components->push_back (std::make_pair (name, this)); +} +bool +LogComponent::IsEnabled (enum LogLevel level) const +{ + LogComponentEnableEnvVar (); + return (level & m_levels) == 1; +} +bool +LogComponent::IsNoneEnabled (void) const +{ + return m_levels == 0; +} +void +LogComponent::Enable (enum LogLevel level) +{ + m_levels |= level; +} +void +LogComponent::Disable (enum LogLevel level) +{ + m_levels &= ~level; +} + +void +LogComponentEnable (char const *name, enum LogLevel level) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (name) == 0) + { + i->second->Enable (level); + break; + } + } +} +void +LogComponentDisable (char const *name, enum LogLevel level) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (name) == 0) + { + i->second->Disable (level); + break; + } + } +} + + +void +LogComponentPrintList (void) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + std::cout << i->first << "="; + if (i->second->IsNoneEnabled ()) + { + std::cout << "0" << std::endl; + continue; + } + if (i->second->IsEnabled (LOG_LEVEL_DEBUG)) + { + std::cout << "debug"; + } + if (i->second->IsEnabled (LOG_LEVEL_FUNCTION)) + { + std::cout << "|func"; + } + if (i->second->IsEnabled (LOG_LEVEL_PARAM)) + { + std::cout << "|param"; + } + if (i->second->IsEnabled (LOG_LEVEL_WARN)) + { + std::cout << "|warn"; + } + if (i->second->IsEnabled (LOG_LEVEL_ERROR)) + { + std::cout << "|error"; + } + std::cout << std::endl; + } +} + +} // namespace ns3 + + diff --git a/src/core/log.h b/src/core/log.h new file mode 100644 index 000000000..3745164c8 --- /dev/null +++ b/src/core/log.h @@ -0,0 +1,167 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,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 + */ +#ifndef LOG_H +#define LOG_H + +#include +#include + +/** + * \defgroup logging Logging + * \brief Logging functions and macros + * + * LOG functionality: macros which allow developers to + * send information out on screen. All logging messages + * are disabled by default. To enable selected logging + * messages, use the ns3::LogComponentEnable + * function. + * + * Alternatively, you can use the NS_LOG + * environment variable to define a ';'-separated list of + * logging components to enable. For example, NS_LOG=a;b;c;DAFD;GH + * would enable the components 'a', 'b', 'c', 'DAFD', and, 'GH'. + * + * For each component, the "debug" log level is enabled by default + * but more components can be enabled selectively with the following + * syntax: NS_LOG='Component1=func|param|warn;Component2=error|debug' + * This example would enable the 'func', 'param', and 'warn' log + * levels for 'Component1' and the 'error' and 'debug' log levels + * for 'Component2'. + * + * The list of available log components can be printed on stdout + * with the NS_LOG=print-list syntax. + */ + +/** + * \ingroup logging + * \param name a string + * + * Define a Log component with a specific name. This macro + * should be used at the top of every file in which you want + * to use the NS_LOG macro. This macro defines a new + * "log component" which can be later selectively enabled + * or disabled with the ns3::LogComponentEnable and + * ns3::LogComponentDisable functions or with the NS_LOG + * environment variable. + */ +#define NS_LOG_COMPONENT_DEFINE(name) \ + static ns3::LogComponent g_log = ns3::LogComponent (name) + +/** + * \ingroup logging + * \param msg message to output + * + * Generate logging output in the "log component" of the + * current file. i.e., every call to NS_LOG from within + * a file implicitely generates out within the component + * defined with the NS_LOG_COMPONENT_DEFINE macro in the + * same file. + */ +#define NS_LOG(level,msg) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << msg << std::endl; \ + } \ + } \ + while (false) + +#define NS_LOG_DEBUG(msg) \ + NS_LOG (ns3::LOG_LEVEL_DEBUG,msg) + +#define NS_LOG_FUNCTION \ + NS_LOG (ns3::LOG_LEVEL_FUNCTION, __PRETTY_PRINT__) + +#define NS_LOG_PARAM(msg) \ + NS_LOG (ns3::LOG_LEVEL_PARAM,msg) + +#define NS_LOG_WARN(msg) \ + NS_LOG (ns3::LOG_LEVEL_WARN,msg) + +#define NS_LOG_ERROR(msg) \ + NS_LOG (ns3::LOG_LEVEL_ERROR,msg) + +#define NS_LOG_UNCOND(msg) \ + do \ + { \ + std::clog << msg << std::endl; \ + } \ + while (false) + + + +namespace ns3 { + +enum LogLevel { + LOG_LEVEL_DEBUG = 1<<0, + LOG_LEVEL_FUNCTION = 1<<1, + LOG_LEVEL_PARAM = 1<<2, + LOG_LEVEL_WARN = 1<<3, + LOG_LEVEL_ERROR = 1<<4, + LOG_LEVEL_LAST = 1<<31 +}; + +/** + * \param name a log component name + * \ingroup logging + * + * Enable the logging output associated with that log component. + * The logging output can be later disabled with a call + * to ns3::LogComponentDisable. + */ +void LogComponentEnable (char const *name, enum LogLevel level); + +/** + * \param name a log component name + * \ingroup logging + * + * Disable the logging output associated with that log component. + * The logging output can be later re-enabled with a call + * to ns3::LogComponentEnable. + */ +void LogComponentDisable (char const *name, enum LogLevel level); + +/** + * \ingroup logging + * + * Print the list of logging messages available. + * The output of this function can be obtained by setting + * the NS_LOG environment variable to the special value + * 'print-list'. + * + * For example: NS_LOG=print-list + */ +void LogComponentPrintList (void); + +class LogComponent { +public: + LogComponent (char const *name); + bool IsEnabled (enum LogLevel level) const; + bool IsNoneEnabled (void) const; + void Enable (enum LogLevel level); + void Disable (enum LogLevel level); +private: + uint32_t m_levels; +}; + +} // namespace ns3 + +#endif /* LOG_H */ diff --git a/src/core/wscript b/src/core/wscript index 455779fd6..5806f254b 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -30,6 +30,7 @@ def build(bld): core.source = [ 'callback-test.cc', 'debug.cc', + 'log.cc', 'breakpoint.cc', 'ptr.cc', 'object.cc', @@ -69,6 +70,7 @@ def build(bld): 'ptr.h', 'object.h', 'debug.h', + 'log.h', 'assert.h', 'breakpoint.h', 'fatal-error.h', From e08d0036ad680574708567b7007f57b1dbf4232e Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 12 Sep 2007 16:54:21 -0700 Subject: [PATCH 184/218] working one way echo app --- examples/csma-broadcast.cc | 1 + examples/csma-multicast.cc | 1 + examples/csma-one-subnet.cc | 1 + examples/simple-point-to-point.cc | 1 + examples/udp-echo.cc | 30 ++++++---- src/applications/udp-echo/udp-echo-client.cc | 59 +------------------ src/node/socket.cc | 61 ++++++++++++++++---- 7 files changed, 76 insertions(+), 78 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index b032f0aea..c0ad09770 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -77,6 +77,7 @@ int main (int argc, char *argv[]) DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("OnOffApplication"); DebugComponentEnable("PacketSocket"); + DebugComponentEnable("Socket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 6bae090ff..df1c51f01 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -76,6 +76,7 @@ main (int argc, char *argv[]) DebugComponentEnable("Ipv4L3Protocol"); DebugComponentEnable("OnOffApplication"); DebugComponentEnable("PacketSocket"); + DebugComponentEnable("Socket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 19d9200ff..ef3496a12 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -72,6 +72,7 @@ main (int argc, char *argv[]) DebugComponentEnable("NetDevice"); DebugComponentEnable("PacketSocket"); DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("Socket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4b9de40f4..91214f53a 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -85,6 +85,7 @@ main (int argc, char *argv[]) DebugComponentEnable("NetDevice"); DebugComponentEnable("PacketSocket"); DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("Socket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index b59c2b5a8..7e169dc8a 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -59,8 +59,8 @@ main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this // -#if 1 - DebugComponentEnable("CsmaOneSubnet"); +#if 0 + DebugComponentEnable("UdpEcho"); DebugComponentEnable("Object"); DebugComponentEnable("Queue"); @@ -72,6 +72,7 @@ main (int argc, char *argv[]) DebugComponentEnable("NetDevice"); DebugComponentEnable("PacketSocket"); DebugComponentEnable("OnOffApplication"); + DebugComponentEnable("Socket"); DebugComponentEnable("UdpSocket"); DebugComponentEnable("UdpL4Protocol"); DebugComponentEnable("Ipv4L3Protocol"); @@ -80,7 +81,12 @@ main (int argc, char *argv[]) DebugComponentEnable("ArpIpv4Interface"); DebugComponentEnable("Ipv4LoopbackInterface"); DebugComponentEnable("UdpEchoClient"); + DebugComponentEnable("UdpEchoServer"); #endif + + DebugComponentEnable("UdpEcho"); + DebugComponentEnable("UdpEchoClient"); + DebugComponentEnable("UdpEchoServer"); // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind @@ -165,6 +171,15 @@ main (int argc, char *argv[]) NS_DEBUG("Create Applications."); // +// Create a UdpEchoServer application on node 1. +// + Ptr server = Create (n1, "0.0.0.0", 80); +// +// Tell the application when to start and stop. +// + server->Start(Seconds(1.)); + server->Stop (Seconds(10.0)); +// // Create a UdpEchoClient application to send UDP datagrams from node zero to // node 1. // @@ -173,18 +188,9 @@ main (int argc, char *argv[]) // // Tell the application when to start and stop. // - client->Start(Seconds(1.0)); + client->Start(Seconds(2.0)); client->Stop (Seconds(10.0)); // -// Create a UdpEchoServer application on node 1. -// - Ptr server = Create (n0, "0.0.0.0", 80); -// -// Tell the application when to start and stop. -// - server->Start(Seconds(0.)); - server->Stop (Seconds(10.0)); -// // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "udp-echo.tr" // diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc index 317a91065..8bcd1c8ed 100644 --- a/src/applications/udp-echo/udp-echo-client.cc +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -23,64 +23,8 @@ #include "ns3/simulator.h" #include "ns3/socket-factory.h" #include "ns3/packet.h" - #include "udp-echo-client.h" -#if 0 -int sock; /* Socket descriptor */ -struct sockaddr_in echoServAddr; /* Echo server address */ -struct sockaddr_in fromAddr; /* Source address of echo */ -unsigned short echoServPort; /* Echo server port */ -unsigned int fromSize; /* In-out of address size for recvfrom() */ -char *servIP; /* IP address of server */ -char *echoString; /* String to send to echo server */ -char echoBuffer[ECHOMAX+1]; /* Buffer for receiving echoed string */ -int echoStringLen; /* Length of string to echo */ -int respStringLen; /* Length of received response */ - -if ((echoStringLen = strlen(echoString)) > ECHOMAX) /* Check input length */ - DieWithError("Echo word too long"); - -if (argc == 4) - echoServPort = atoi(argv[3]); /* Use given port, if any */ - else - echoServPort = 7; /* 7 is the well-known port for the echo service */ - -/* Create a datagram/UDP socket */ -if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - DieWithError("socket() failed"); - -/* Construct the server address structure */ -memset(&echoServAddr, 0, sizeof(echoServAddr)); /* Zero out structure */ -echoServAddr.sin_family = AF_INET; /* Internet addr family */ -echoServAddr.sin_addr.s_addr = inet_addr(servIP); /* Server IP address */ -echoServAddr.sin_port = htons(echoServPort); /* Server port */ - -/* Send the string to the server */ -if (sendto(sock, echoString, echoStringLen, 0, (struct sockaddr *) - &echoServAddr, sizeof(echoServAddr)) != echoStringLen) - DieWithError("sendto() sent a different number of bytes than expected"); - -/* Recv a response */ -fromSize = sizeof(fromAddr); -if ((respStringLen = recvfrom(sock, echoBuffer, ECHOMAX, 0, - (struct sockaddr *) &fromAddr, &fromSize)) != echoStringLen) - DieWithError("recvfrom() failed"); - -if (echoServAddr.sin_addr.s_addr != fromAddr.sin_addr.s_addr) - { - fprintf(stderr,"Error: received a packet from unknown source.\n"); - exit(1); - } - -/* null-terminate the received data */ -echoBuffer[respStringLen] = '\0'; -printf("Received: %s\n", echoBuffer); /* Print the echoed arg */ - -close(sock); -exit(0); -#endif - namespace ns3 { NS_DEBUG_COMPONENT_DEFINE ("UdpEchoClient"); @@ -183,6 +127,9 @@ UdpEchoClient::Send (void) m_socket->Send (p); ++m_sent; + NS_DEBUG ("UdpEchoClient::Send (): Sent " << m_size << " bytes to " << + m_serverAddress); + if (m_sent < m_count) { ScheduleTransmit (m_interval); diff --git a/src/node/socket.cc b/src/node/socket.cc index 58f83947f..efb28002a 100644 --- a/src/node/socket.cc +++ b/src/node/socket.cc @@ -19,83 +19,114 @@ * Authors: George F. Riley * Mathieu Lacage */ -#include "socket.h" + +#include "ns3/debug.h" #include "ns3/packet.h" +#include "socket.h" + +NS_DEBUG_COMPONENT_DEFINE ("Socket"); namespace ns3 { Socket::~Socket () -{} +{ + NS_DEBUG("Socket::~Socket ()"); +} void Socket::SetCloseCallback (Callback > closeCompleted) { + NS_DEBUG("Socket::SetCloseCallback ()"); m_closeCompleted = closeCompleted; } + void -Socket::SetConnectCallback (Callback > connectionSucceeded, - Callback > connectionFailed, - Callback > halfClose) +Socket::SetConnectCallback ( + Callback > connectionSucceeded, + Callback > connectionFailed, + Callback > halfClose) { + NS_DEBUG("Socket::SetConnectCallback ()"); m_connectionSucceeded = connectionSucceeded; m_connectionFailed = connectionFailed; m_halfClose = halfClose; } + void -Socket::SetAcceptCallback (Callback, const Address &> connectionRequest, - Callback, const Address&> newConnectionCreated, - Callback > closeRequested) +Socket::SetAcceptCallback ( + Callback, const Address &> connectionRequest, + Callback, const Address&> newConnectionCreated, + Callback > closeRequested) { + NS_DEBUG("Socket::SetAcceptCallback ()"); m_connectionRequest = connectionRequest; m_newConnectionCreated = newConnectionCreated; m_closeRequested = closeRequested; } + void Socket::SetSendCallback (Callback, uint32_t> dataSent) { + NS_DEBUG("Socket::SetSendCallback ()"); m_dataSent = dataSent; } + void Socket::SetRecvCallback (Callback, const Packet &,const Address&> receivedData) { + NS_DEBUG("Socket::SetRecvCallback ()"); m_receivedData = receivedData; } void Socket::NotifyCloseCompleted (void) { + NS_DEBUG("Socket::NotifyCloseCompleted ()"); + if (!m_closeCompleted.IsNull ()) { m_closeCompleted (this); } } + void Socket::NotifyConnectionSucceeded (void) { + NS_DEBUG("Socket::NotifyConnectionSucceeded ()"); + if (!m_connectionSucceeded.IsNull ()) { m_connectionSucceeded (this); } } + void Socket::NotifyConnectionFailed (void) { + NS_DEBUG("Socket::NotifyConnectionFailed ()"); + if (!m_connectionFailed.IsNull ()) { m_connectionFailed (this); } } + void Socket::NotifyHalfClose (void) { + NS_DEBUG("Socket::NotifyHalfClose ()"); + if (!m_halfClose.IsNull ()) { m_halfClose (this); } } + bool Socket::NotifyConnectionRequest (const Address &from) { + NS_DEBUG("Socket::NotifyConnectionRequest ()"); + if (!m_connectionRequest.IsNull ()) { return m_connectionRequest (this, from); @@ -106,39 +137,49 @@ Socket::NotifyConnectionRequest (const Address &from) return false; } } + void Socket::NotifyNewConnectionCreated (Ptr socket, const Address &from) { + NS_DEBUG("Socket::NotifyNewConnectionCreated ()"); + if (!m_newConnectionCreated.IsNull ()) { m_newConnectionCreated (socket, from); } } + void Socket::NotifyCloseRequested (void) { + NS_DEBUG("Socket::NotifyCloseRequested ()"); + if (!m_closeRequested.IsNull ()) { m_closeRequested (this); } } + void Socket::NotifyDataSent (uint32_t size) { + NS_DEBUG("Socket::NotifyDataSent ()"); + if (!m_dataSent.IsNull ()) { m_dataSent (this, size); } } + void Socket::NotifyDataReceived (const Packet &p, const Address &from) { + NS_DEBUG("Socket::NotifyDataReceived ()"); + if (!m_receivedData.IsNull ()) { m_receivedData (this, p, from); } } - - }//namespace ns3 From ffbd9e222d65d51ad05166140cd2a62527c5272e Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Wed, 12 Sep 2007 21:32:26 -0700 Subject: [PATCH 185/218] change NS_DEBUG component name in simple-point-to-point.cc --- examples/simple-point-to-point.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4b9de40f4..5d039b54b 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -64,7 +64,7 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("Me"); +NS_DEBUG_COMPONENT_DEFINE ("SimplePointToPoint"); int main (int argc, char *argv[]) @@ -74,7 +74,7 @@ main (int argc, char *argv[]) // for selected modules; the below lines suggest how to do this // remember to add #include "ns3/debug.h" before enabling these #if 0 - DebugComponentEnable("Me"); + DebugComponentEnable("SimplePointToPoint"); DebugComponentEnable("Object"); DebugComponentEnable("Queue"); DebugComponentEnable("DropTailQueue"); From 8ef44e3dab4418d0834b0417544b2f3ca1fb23bb Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 10:52:41 -0700 Subject: [PATCH 186/218] finish up basic echo apps --- examples/udp-echo.cc | 37 ++++++++++---------- src/applications/udp-echo/udp-echo-client.cc | 30 +++++++++++++++- src/applications/udp-echo/udp-echo-client.h | 2 ++ src/applications/udp-echo/udp-echo-server.cc | 29 +++++++-------- src/applications/udp-echo/udp-echo-server.h | 12 +++---- 5 files changed, 69 insertions(+), 41 deletions(-) diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 7e169dc8a..fb91c3247 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -21,7 +21,7 @@ // ================= // LAN // -// - CBR/UDP flows from n0 to n1 and from n3 to n0 +// - UDP flows from n0 to n1 and back // - DropTail queues // - Tracing of queues and packet receptions to file "udp-echo.tr" @@ -136,11 +136,6 @@ main (int argc, char *argv[]) uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, Eui48Address("08:00:2e:00:00:03")); - - NS_DEBUG ("nd0 = " << nd0); - NS_DEBUG ("nd1 = " << nd1); - NS_DEBUG ("nd2 = " << nd2); - NS_DEBUG ("nd3 = " << nd3); // // We've got the "hardware" in place. Now we need to add IP addresses. // @@ -171,25 +166,29 @@ main (int argc, char *argv[]) NS_DEBUG("Create Applications."); // -// Create a UdpEchoServer application on node 1. +// Create a UdpEchoServer application on node one. // - Ptr server = Create (n1, "0.0.0.0", 80); -// -// Tell the application when to start and stop. -// - server->Start(Seconds(1.)); - server->Stop (Seconds(10.0)); + uint16_t port = 80; + + Ptr server = Create (n1, port); // // Create a UdpEchoClient application to send UDP datagrams from node zero to -// node 1. +// node one. // - Ptr client = Create (n0, "10.1.1.2", 80, - 1, Seconds(1.), 1024); + uint32_t packetSize = 1024; + uint32_t maxPacketCount = 1; + Time interPacketInterval = Seconds (1.); + + Ptr client = Create (n0, "10.1.1.2", port, + maxPacketCount, interPacketInterval, packetSize); // -// Tell the application when to start and stop. +// Tell the applications when to start and stop. // - client->Start(Seconds(2.0)); - client->Stop (Seconds(10.0)); + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); // // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "udp-echo.tr" diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc index 8bcd1c8ed..065b8bed1 100644 --- a/src/applications/udp-echo/udp-echo-client.cc +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -99,7 +99,9 @@ UdpEchoClient::StartApplication (void) m_socket->Connect (m_peer); } - StopApplication (); + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&UdpEchoClient::Receive, this)); + ScheduleTransmit (Seconds(0.)); } @@ -107,6 +109,14 @@ void UdpEchoClient::StopApplication () { NS_DEBUG ("UdpEchoClient::StopApplication ()"); + + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + } + + Simulator::Cancel(m_sendEvent); } void @@ -136,4 +146,22 @@ UdpEchoClient::Send (void) } } +void +UdpEchoClient::Receive( + Ptr socket, + const Packet &packet, + const Address &from) +{ + NS_DEBUG ("UdpEchoClient::Receive (" << socket << ", " << packet << + ", " << from << ")"); + + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_DEBUG ("UdpEchoClient::Receive(): Received " << + packet.GetSize() << " bytes from " << address.GetIpv4()); + } +} + + } // Namespace ns3 diff --git a/src/applications/udp-echo/udp-echo-client.h b/src/applications/udp-echo/udp-echo-client.h index 7c5f2478a..91914287d 100644 --- a/src/applications/udp-echo/udp-echo-client.h +++ b/src/applications/udp-echo/udp-echo-client.h @@ -50,6 +50,8 @@ private: void ScheduleTransmit (Time dt); void Send (void); + void Receive(Ptr socket, const Packet &packet, const Address &from); + Ptr m_node; Ipv4Address m_serverAddress; uint16_t m_serverPort; diff --git a/src/applications/udp-echo/udp-echo-server.cc b/src/applications/udp-echo/udp-echo-server.cc index 26958b80f..8f51f9f1c 100644 --- a/src/applications/udp-echo/udp-echo-server.cc +++ b/src/applications/udp-echo/udp-echo-server.cc @@ -15,6 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "ns3/debug.h" #include "ns3/ipv4-address.h" #include "ns3/nstime.h" @@ -32,15 +33,14 @@ NS_DEBUG_COMPONENT_DEFINE ("UdpEchoServer"); UdpEchoServer::UdpEchoServer ( Ptr n, - Ipv4Address clientAddress, - uint16_t clientPort) + uint16_t port) : Application(n) { - NS_DEBUG ("UdpEchoServer::UdpEchoServer (" << n << ", " << clientAddress << - ", " << clientPort << ")"); + NS_DEBUG ("UdpEchoServer::UdpEchoServer (" << n << ", " << + port << ")"); - Construct (n, clientAddress, clientPort); + Construct (n, port); } UdpEchoServer::~UdpEchoServer() @@ -51,18 +51,15 @@ UdpEchoServer::~UdpEchoServer() void UdpEchoServer::Construct ( Ptr n, - Ipv4Address clientAddress, - uint16_t clientPort) + uint16_t port) { - NS_DEBUG ("UdpEchoServer::Construct (" << n << ", " << clientAddress << - ", " << clientPort << ")"); + NS_DEBUG ("UdpEchoServer::Construct (" << n << ", " << port << ")"); m_node = n; - m_clientAddress = clientAddress; - m_clientPort = clientPort; + m_port = port; m_socket = 0; - m_client = InetSocketAddress (clientAddress, clientPort); + m_local = InetSocketAddress (Ipv4Address::GetAny (), port); } void @@ -83,7 +80,7 @@ UdpEchoServer::StartApplication (void) Ptr socketFactory = GetNode ()->QueryInterface (iid); m_socket = socketFactory->CreateSocket (); - m_socket->Bind (m_client); + m_socket->Bind (m_local); } m_socket->SetRecvCallback((Callback, const Packet &, @@ -101,7 +98,8 @@ UdpEchoServer::StopApplication () } } -void UdpEchoServer::Receive( +void +UdpEchoServer::Receive( Ptr socket, const Packet &packet, const Address &from) @@ -114,6 +112,9 @@ void UdpEchoServer::Receive( InetSocketAddress address = InetSocketAddress::ConvertFrom (from); NS_DEBUG ("UdpEchoServer::Receive(): Received " << packet.GetSize() << " bytes from " << address.GetIpv4()); + + NS_DEBUG ("UdpEchoServer::Receive (): Echoing packet"); + socket->SendTo (from, packet); } } diff --git a/src/applications/udp-echo/udp-echo-server.h b/src/applications/udp-echo/udp-echo-server.h index d9de1221f..597fef8fe 100644 --- a/src/applications/udp-echo/udp-echo-server.h +++ b/src/applications/udp-echo/udp-echo-server.h @@ -32,27 +32,25 @@ class Packet; class UdpEchoServer : public Application { public: - UdpEchoServer (Ptr n, Ipv4Address clientAddr, uint16_t clientPort); + UdpEchoServer (Ptr n, uint16_t clientPort); virtual ~UdpEchoServer (); protected: virtual void DoDispose (void); private: - void Construct (Ptr n, Ipv4Address clientAddr, uint16_t clientPort); + void Construct (Ptr n, uint16_t clientPort); virtual void StartApplication (void); virtual void StopApplication (void); - void Receive(Ptr socket, const Packet &packet, - const Address &from); + void Receive(Ptr socket, const Packet &packet, const Address &from); Ptr m_node; - Ipv4Address m_clientAddress; - uint16_t m_clientPort; + uint16_t m_port; Ptr m_socket; - Address m_client; + Address m_local; }; } // namespace ns3 From 14218405f0d92dfe8baa7fd9fa9a851fd6e1c96e Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 11:04:47 -0700 Subject: [PATCH 187/218] add tutorial directory and hello-simulator --- examples/udp-echo.cc | 10 +++++----- tutorial/hello-simulator.cc | 29 +++++++++++++++++++++++++++++ tutorial/waf | 1 + tutorial/wscript | 6 ++++++ wscript | 2 +- 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 tutorial/hello-simulator.cc create mode 100755 tutorial/waf create mode 100644 tutorial/wscript diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index fb91c3247..8f5569ba0 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -39,7 +39,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4.h" @@ -126,16 +126,16 @@ main (int argc, char *argv[]) // zero. // uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, - Eui48Address("08:00:2e:00:00:00")); + Mac48Address("08:00:2e:00:00:00")); uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, - Eui48Address("08:00:2e:00:00:01")); + Mac48Address("08:00:2e:00:00:01")); uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, - Eui48Address("08:00:2e:00:00:02")); + Mac48Address("08:00:2e:00:00:02")); uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, - Eui48Address("08:00:2e:00:00:03")); + Mac48Address("08:00:2e:00:00:03")); // // We've got the "hardware" in place. Now we need to add IP addresses. // diff --git a/tutorial/hello-simulator.cc b/tutorial/hello-simulator.cc new file mode 100644 index 000000000..c9c18cac6 --- /dev/null +++ b/tutorial/hello-simulator.cc @@ -0,0 +1,29 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/debug.h" + +using namespace ns3; + +NS_DEBUG_COMPONENT_DEFINE ("HelloSimulator"); + +int +main (int argc, char *argv[]) +{ + DebugComponentEnable("HelloSimulator"); + + NS_DEBUG("Hello Simulator"); +} diff --git a/tutorial/waf b/tutorial/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/tutorial/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/tutorial/wscript b/tutorial/wscript new file mode 100644 index 000000000..abd2df7b9 --- /dev/null +++ b/tutorial/wscript @@ -0,0 +1,6 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' diff --git a/wscript b/wscript index 5904c5ad2..9e54f7050 100644 --- a/wscript +++ b/wscript @@ -173,7 +173,7 @@ def build(bld): # process subfolders from here bld.add_subdirs('src') - bld.add_subdirs('samples utils examples') + bld.add_subdirs('samples utils examples tutorial') ## Create a single ns3 library containing all modules lib = bld.create_obj('cpp', 'shlib') From efb6e24f785f15ecc2e9902647c33498542f9d75 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 12:37:30 -0700 Subject: [PATCH 188/218] sorting out logging --- src/core/log.cc | 71 ++++++++++++++++++++++++++----------- src/core/log.h | 61 +++++++++++++++++-------------- tutorial/hello-simulator.cc | 8 ++--- 3 files changed, 89 insertions(+), 51 deletions(-) diff --git a/src/core/log.cc b/src/core/log.cc index fa1c6f6f9..64a288289 100644 --- a/src/core/log.cc +++ b/src/core/log.cc @@ -101,11 +101,23 @@ LogComponentEnableEnvVar (void) cur_lev = next_lev + 1; next_lev = tmp.find ("|", cur_lev); std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); - if (lev == "debug") + if (lev == "error") + { + level |= LOG_LEVEL_ERROR; + } + else if (lev == "warn") + { + level |= LOG_LEVEL_WARN; + } + else if (lev == "debug") { level |= LOG_LEVEL_DEBUG; } - else if (lev == "func") + else if (lev == "info") + { + level |= LOG_LEVEL_INFO; + } + else if (lev == "function") { level |= LOG_LEVEL_FUNCTION; } @@ -113,13 +125,13 @@ LogComponentEnableEnvVar (void) { level |= LOG_LEVEL_PARAM; } - else if (lev == "warn") + else if (lev == "logic") { - level |= LOG_LEVEL_WARN; + level |= LOG_LEVEL_LOGIC; } - else if (lev == "error") + else if (lev == "all") { - level |= LOG_LEVEL_ERROR; + level |= LOG_LEVEL_ALL; } } while (next_lev != std::string::npos); } @@ -159,7 +171,6 @@ LogComponentEnableEnvVar (void) #endif } - LogComponent::LogComponent (char const * name) : m_levels (0) { @@ -172,22 +183,28 @@ LogComponent::LogComponent (char const * name) } components->push_back (std::make_pair (name, this)); } + bool LogComponent::IsEnabled (enum LogLevel level) const { LogComponentEnableEnvVar (); - return (level & m_levels) == 1; +// return (level & m_levels) ? 1 : 0; + + return m_levels >= level; } + bool LogComponent::IsNoneEnabled (void) const { return m_levels == 0; } + void LogComponent::Enable (enum LogLevel level) { m_levels |= level; } + void LogComponent::Disable (enum LogLevel level) { @@ -209,6 +226,7 @@ LogComponentEnable (char const *name, enum LogLevel level) } } } + void LogComponentDisable (char const *name, enum LogLevel level) { @@ -225,7 +243,6 @@ LogComponentDisable (char const *name, enum LogLevel level) } } - void LogComponentPrintList (void) { @@ -240,25 +257,37 @@ LogComponentPrintList (void) std::cout << "0" << std::endl; continue; } - if (i->second->IsEnabled (LOG_LEVEL_DEBUG)) + if (i->second->IsEnabled (LOG_LEVEL_ERROR)) { - std::cout << "debug"; - } - if (i->second->IsEnabled (LOG_LEVEL_FUNCTION)) - { - std::cout << "|func"; - } - if (i->second->IsEnabled (LOG_LEVEL_PARAM)) - { - std::cout << "|param"; + std::cout << "error"; } if (i->second->IsEnabled (LOG_LEVEL_WARN)) { std::cout << "|warn"; } - if (i->second->IsEnabled (LOG_LEVEL_ERROR)) + if (i->second->IsEnabled (LOG_LEVEL_DEBUG)) { - std::cout << "|error"; + std::cout << "|debug"; + } + if (i->second->IsEnabled (LOG_LEVEL_INFO)) + { + std::cout << "|info"; + } + if (i->second->IsEnabled (LOG_LEVEL_FUNCTION)) + { + std::cout << "|function"; + } + if (i->second->IsEnabled (LOG_LEVEL_PARAM)) + { + std::cout << "|param"; + } + if (i->second->IsEnabled (LOG_LEVEL_LOGIC)) + { + std::cout << "|logic"; + } + if (i->second->IsEnabled (LOG_LEVEL_ALL)) + { + std::cout << "|all"; } std::cout << std::endl; } diff --git a/src/core/log.h b/src/core/log.h index 3745164c8..28d075565 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -74,7 +74,7 @@ * defined with the NS_LOG_COMPONENT_DEFINE macro in the * same file. */ -#define NS_LOG(level,msg) \ +#define NS_LOG(level, msg) \ do \ { \ if (g_log.IsEnabled (level)) \ @@ -84,39 +84,48 @@ } \ while (false) -#define NS_LOG_DEBUG(msg) \ - NS_LOG (ns3::LOG_LEVEL_DEBUG,msg) - -#define NS_LOG_FUNCTION \ - NS_LOG (ns3::LOG_LEVEL_FUNCTION, __PRETTY_PRINT__) - -#define NS_LOG_PARAM(msg) \ - NS_LOG (ns3::LOG_LEVEL_PARAM,msg) +#define NS_LOG_ERROR(msg) \ + NS_LOG(ns3::LOG_LEVEL_ERROR, msg) #define NS_LOG_WARN(msg) \ - NS_LOG (ns3::LOG_LEVEL_WARN,msg) + NS_LOG(ns3::LOG_LEVEL_WARN, msg) -#define NS_LOG_ERROR(msg) \ - NS_LOG (ns3::LOG_LEVEL_ERROR,msg) +#define NS_LOG_DEBUG(msg) \ + NS_LOG(ns3::LOG_LEVEL_DEBUG, msg) -#define NS_LOG_UNCOND(msg) \ - do \ - { \ - std::clog << msg << std::endl; \ - } \ +#define NS_LOG_INFO(msg) \ + NS_LOG(ns3::LOG_LEVEL_INFO, msg) + +#define NS_LOG_FUNCTION(msg) \ + NS_LOG(ns3::LOG_LEVEL_FUNCTION, msg) + +#define NS_LOG_PARAM(msg) \ + NS_LOG(ns3::LOG_LEVEL_PARAM, msg) + +#define NS_LOG_LOGIC(msg) \ + NS_LOG(ns3::LOG_LEVEL_LOGIC, msg) + +#define NS_LOG_ALL(msg) \ + NS_LOG(ns3::LOG_LEVEL_ALL, msg) + +#define NS_LOG_UNCOND(msg) \ + do \ + { \ + std::clog << msg << std::endl; \ + } \ while (false) - - namespace ns3 { enum LogLevel { - LOG_LEVEL_DEBUG = 1<<0, - LOG_LEVEL_FUNCTION = 1<<1, - LOG_LEVEL_PARAM = 1<<2, - LOG_LEVEL_WARN = 1<<3, - LOG_LEVEL_ERROR = 1<<4, - LOG_LEVEL_LAST = 1<<31 + LOG_LEVEL_ERROR = 1<<0, // serious error messages only + LOG_LEVEL_WARN = 1<<1, // add warning messages + LOG_LEVEL_DEBUG = 1<<2, // add rare ad-hoc debug messages + LOG_LEVEL_INFO = 1<<3, // add informational messages (e.g., banners) + LOG_LEVEL_FUNCTION = 1<<4, // add function tracing + LOG_LEVEL_PARAM = 1<<5, // add parameters to functions + LOG_LEVEL_LOGIC = 1<<6, // add control flow tracing within functions + LOG_LEVEL_ALL = 1<<30 // print everything }; /** @@ -159,7 +168,7 @@ public: void Enable (enum LogLevel level); void Disable (enum LogLevel level); private: - uint32_t m_levels; + int32_t m_levels; }; } // namespace ns3 diff --git a/tutorial/hello-simulator.cc b/tutorial/hello-simulator.cc index c9c18cac6..84ac0914e 100644 --- a/tutorial/hello-simulator.cc +++ b/tutorial/hello-simulator.cc @@ -14,16 +14,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("HelloSimulator"); +NS_LOG_COMPONENT_DEFINE ("HelloSimulator"); int main (int argc, char *argv[]) { - DebugComponentEnable("HelloSimulator"); + LogComponentEnable ("HelloSimulator", LOG_LEVEL_INFO); - NS_DEBUG("Hello Simulator"); + NS_LOG_INFO ("Hello Simulator"); } From a6ce4afe48f4a9a5ce366b199cd5b9d7a7b72f9b Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 17:47:42 -0700 Subject: [PATCH 189/218] checkpoint debug to log --- examples/csma-broadcast.cc | 62 +++-- examples/csma-multicast.cc | 77 ++--- examples/csma-one-subnet.cc | 66 +++-- examples/csma-packet-socket.cc | 43 ++- examples/mixed-global-routing.cc | 48 +++- examples/simple-global-routing.cc | 54 ++-- examples/simple-point-to-point.cc | 66 ++--- examples/udp-echo.cc | 67 +++-- samples/main-channel.cc | 50 ++-- samples/main-default-value.cc | 8 +- samples/main-query-interface.cc | 16 +- samples/main-tw.cc | 4 +- src/applications/onoff/onoff-application.cc | 49 ++-- src/applications/packet-sink/packet-sink.cc | 10 +- src/applications/udp-echo/udp-echo-client.cc | 33 +-- src/applications/udp-echo/udp-echo-server.cc | 30 +- src/common/buffer.cc | 16 +- src/common/packet-metadata.cc | 30 +- src/core/composite-trace-resolver.cc | 16 +- src/core/fatal-error.h | 5 +- src/core/log.h | 32 ++- src/core/object.cc | 8 +- src/core/random-variable-default-value.cc | 12 +- src/core/trace-resolver.cc | 6 +- src/devices/csma/csma-channel.cc | 77 ++--- src/devices/csma/csma-ipv4-topology.cc | 1 - src/devices/csma/csma-net-device.cc | 128 +++++---- src/devices/csma/csma-topology.cc | 1 - .../point-to-point/point-to-point-channel.cc | 35 ++- .../point-to-point-net-device.cc | 63 +++-- .../point-to-point/point-to-point-topology.cc | 2 +- src/internet-node/ipv4-end-point-demux.cc | 84 +++--- src/internet-node/ipv4-header.cc | 6 +- src/internet-node/ipv4-interface.cc | 40 +-- src/internet-node/ipv4-l3-protocol.cc | 263 ++++++++++-------- src/internet-node/ipv4-loopback-interface.cc | 12 +- src/internet-node/ipv4-static-routing.cc | 67 +++-- src/internet-node/udp-l4-protocol.cc | 43 +-- src/internet-node/udp-socket.cc | 68 ++--- 39 files changed, 969 insertions(+), 729 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index 06625559b..84efdd4f1 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -36,7 +36,7 @@ #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" @@ -57,36 +57,40 @@ #include "ns3/ipv4-route.h" #include "ns3/onoff-application.h" - using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("CsmaBroadcastExample"); -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { - // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("Socket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); -#endif + LogComponentEnable ("CsmaBroadcastExample", LOG_LEVEL_INFO); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -101,11 +105,13 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); @@ -115,6 +121,7 @@ int main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); + NS_LOG_INFO ("Build Topology."); uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, Mac48Address("10:54:23:54:0:50")); uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, @@ -125,6 +132,7 @@ int main (int argc, char *argv[]) Mac48Address("10:54:23:54:23:52")); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); CsmaIpv4Topology::AddIpv4Address ( n0, n0ifIndex0, Ipv4Address("10.1.0.1"), Ipv4Mask("255.255.0.0")); @@ -152,6 +160,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s // from n0 to n1 + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("255.255.255.255", 80), @@ -162,7 +171,7 @@ int main (int argc, char *argv[]) ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); - + NS_LOG_INFO ("Configure Tracing."); // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-broadcast.tr file AsciiTrace asciitrace ("csma-broadcast.tr"); @@ -177,7 +186,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("csma-broadcast.pcap"); pcaptrace.TraceAllIp (); - Simulator::Run (); - + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 6f5cf7abc..5ca1d79d5 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -33,7 +33,7 @@ #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" @@ -54,7 +54,7 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("CsmaMulticast"); +NS_LOG_COMPONENT_DEFINE ("CsmaMulticastExample"); int main (int argc, char *argv[]) @@ -64,28 +64,30 @@ main (int argc, char *argv[]) // for selected modules; the below lines suggest how to do this // #if 0 - DebugComponentEnable("CsmaMulticast"); + LogComponentEnable ("CsmaMulticastExample", LOG_LEVEL_INFO); - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("Socket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif - // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind @@ -101,14 +103,14 @@ main (int argc, char *argv[]) // // Explicitly create the nodes required by the topology (shown above). // - NS_DEBUG("Create nodes."); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); Ptr n4 = Create (); - NS_DEBUG("Create channels."); + NS_LOG_INFO ("Create channels."); // // Explicitly create the channels required by the topology (shown above). // @@ -118,7 +120,7 @@ main (int argc, char *argv[]) Ptr lan1 = CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); - NS_DEBUG("Build Topology."); + NS_LOG_INFO ("Build Topology."); // // Now fill out the topology by creating the net devices required to connect // the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will @@ -144,17 +146,16 @@ main (int argc, char *argv[]) uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, Mac48Address("08:00:2e:00:00:05")); - NS_DEBUG ("nd0 = " << nd0); - NS_DEBUG ("nd1 = " << nd1); - NS_DEBUG ("nd2Lan0 = " << nd2Lan0); - NS_DEBUG ("nd2Lan1 = " << nd2Lan1); - NS_DEBUG ("nd3 = " << nd3); - NS_DEBUG ("nd4 = " << nd3); + NS_LOG_INFO ("nd0 = " << nd0); + NS_LOG_INFO ("nd1 = " << nd1); + NS_LOG_INFO ("nd2Lan0 = " << nd2Lan0); + NS_LOG_INFO ("nd2Lan1 = " << nd2Lan1); + NS_LOG_INFO ("nd3 = " << nd3); + NS_LOG_INFO ("nd4 = " << nd3); // // We've got the "hardware" in place. Now we need to add IP addresses. // - NS_DEBUG("Assign IP Addresses."); - + NS_LOG_INFO ("Assign IP Addresses."); CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); @@ -181,7 +182,7 @@ main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address (n4, nd4, Ipv4Address ("10.1.2.3"), Ipv4Mask ("255.255.255.0")); - NS_DEBUG("Configure multicasting."); + NS_LOG_INFO ("Configure multicasting."); // // Now we can configure multicasting. As described above, the multicast // source is at node zero, which we assigned the IP address of 10.1.1.1 @@ -272,7 +273,7 @@ main (int argc, char *argv[]) // Create an OnOff application to send UDP datagrams from node zero to the // multicast group (node four will be listening). // - NS_DEBUG("Create Applications."); + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress (multicastGroup, 80), @@ -290,7 +291,7 @@ main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "csma-multicast.tr" // - NS_DEBUG("Configure Tracing."); + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("csma-multicast.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); @@ -306,8 +307,8 @@ main (int argc, char *argv[]) // // Now, do the actual simulation. // - NS_DEBUG("Run Simulation."); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); Simulator::Destroy (); - NS_DEBUG("Done."); + NS_LOG_INFO ("Done."); } diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 8179555a9..dfc41a88e 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -29,7 +29,7 @@ #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" @@ -50,7 +50,7 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("CsmaOneSubnet"); +NS_LOG_COMPONENT_DEFINE ("CsmaOneSubnetExample"); int main (int argc, char *argv[]) @@ -60,26 +60,29 @@ main (int argc, char *argv[]) // for selected modules; the below lines suggest how to do this // #if 0 - DebugComponentEnable("CsmaOneSubnet"); + LogComponentEnable ("CsmaOneSubnetExample", LOG_LEVEL_INFO); - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("Socket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif // // Set up default values for the simulation. Use the DefaultValue::Bind() @@ -96,20 +99,20 @@ main (int argc, char *argv[]) // // Explicitly create the nodes required by the topology (shown above). // - NS_DEBUG("Create nodes."); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); - NS_DEBUG("Create channels."); + NS_LOG_INFO ("Create channels."); // // Explicitly create the channels required by the topology (shown above). // Ptr lan = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); - NS_DEBUG("Build Topology."); + NS_LOG_INFO ("Build Topology."); // // Now fill out the topology by creating the net devices required to connect // the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will @@ -130,15 +133,10 @@ main (int argc, char *argv[]) uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, Mac48Address("08:00:2e:00:00:03")); - - NS_DEBUG ("nd0 = " << nd0); - NS_DEBUG ("nd1 = " << nd1); - NS_DEBUG ("nd2 = " << nd2); - NS_DEBUG ("nd3 = " << nd3); // // We've got the "hardware" in place. Now we need to add IP addresses. // - NS_DEBUG("Assign IP Addresses."); + NS_LOG_INFO ("Assign IP Addresses."); // // XXX BUGBUG // Need a better way to get the interface index. The point-to-point topology @@ -165,7 +163,7 @@ main (int argc, char *argv[]) // // Create an OnOff application to send UDP datagrams from node zero to node 1. // - NS_DEBUG("Create Applications."); + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.1.2", 80), @@ -193,7 +191,7 @@ main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "csma-one-subnet.tr" // - NS_DEBUG("Configure Tracing."); + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("csma-one-subnet.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); @@ -209,8 +207,8 @@ main (int argc, char *argv[]) // // Now, do the actual simulation. // - NS_DEBUG("Run Simulation."); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); Simulator::Destroy (); - NS_DEBUG("Done."); + NS_LOG_INFO ("Done."); } diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index ef1c33357..fde9a8f0b 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -37,7 +37,7 @@ #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" @@ -56,6 +56,8 @@ using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); + static Ptr CreateCsmaDevice (Ptr node, Ptr channel) { @@ -66,28 +68,56 @@ CreateCsmaDevice (Ptr node, Ptr channel) return device; } - -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { +#if 0 + LogComponentEnable ("CsmaPacketSocketExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif + CommandLine::Parse (argc, argv); // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // create the shared medium used by all csma devices. + NS_LOG_INFO ("Create channels."); Ptr channel = Create (DataRate(5000000), MilliSeconds(2)); // use a helper function to connect our nodes to the shared channel. + NS_LOG_INFO ("Build Topology."); Ptr n0If = CreateCsmaDevice (n0, channel); Ptr n1If = CreateCsmaDevice (n1, channel); Ptr n2If = CreateCsmaDevice (n2, channel); Ptr n3If = CreateCsmaDevice (n3, channel); - // create the address which identifies n1 from n0 PacketSocketAddress n0ToN1; n0ToN1.SetSingleDevice (n0If->GetIfIndex ()); // set outgoing interface for outgoing packets @@ -103,6 +133,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send raw datagrams of size // 210 bytes at a rate of 448 Kb/s // from n0 to n1 + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, n0ToN1, @@ -126,11 +157,13 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-packet-socket.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("csma-packet-socket.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index d8038eaeb..ba2901a65 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -36,7 +36,7 @@ #include #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" @@ -68,22 +68,39 @@ using namespace ns3; -int main (int argc, char *argv[]) +NS_LOG_COMPONENT_DEFINE ("MixedGlobalRoutingExample"); + +int +main (int argc, char *argv[]) { // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - DebugComponentEnable ("Object"); - DebugComponentEnable ("Queue"); - DebugComponentEnable ("DropTailQueue"); - DebugComponentEnable ("Channel"); - DebugComponentEnable ("PointToPointChannel"); - DebugComponentEnable ("PointToPointNetDevice"); - DebugComponentEnable ("GlobalRouter"); - DebugComponentEnable ("GlobalRouteManager"); -#endif + LogComponentEnable ("MixedGlobalRoutingExample", LOG_LEVEL_INFO); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif // Set up some default values for the simulation. Use the Bind () // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -102,6 +119,7 @@ int main (int argc, char *argv[]) // Bind ()s at run-time, via command-line arguments CommandLine::Parse (argc, argv); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); @@ -111,6 +129,7 @@ int main (int argc, char *argv[]) Ptr n6 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate (5000000), MilliSeconds (2)); @@ -128,6 +147,7 @@ int main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); + NS_LOG_INFO ("Build Topology."); uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0, Mac48Address("10:54:23:54:23:50")); uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0, @@ -138,6 +158,7 @@ int main (int argc, char *argv[]) Mac48Address("10:54:23:54:23:53")); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address ("10.1.1.1"), n2, Ipv4Address ("10.1.1.2")); @@ -168,6 +189,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.3.2", 80), @@ -182,6 +204,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-global-routing.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("mixed-global-routing.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -193,7 +216,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("mixed-global-routing.pcap"); pcaptrace.TraceAllIp (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index bcfc01d17..8c6bd9db6 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -42,7 +42,7 @@ #include #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" @@ -70,25 +70,41 @@ using namespace ns3; -int main (int argc, char *argv[]) -{ +NS_LOG_COMPONENT_DEFINE ("SimpleGlobalRoutingExample"); +int +main (int argc, char *argv[]) +{ // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - DebugComponentEnable ("Object"); - DebugComponentEnable ("Queue"); - DebugComponentEnable ("DropTailQueue"); - DebugComponentEnable ("Channel"); - DebugComponentEnable ("PointToPointChannel"); - DebugComponentEnable ("PointToPointNetDevice"); - DebugComponentEnable ("GlobalRouter"); - DebugComponentEnable ("GlobalRouteMaager"); -#endif + LogComponentEnable ("SimpleGlobalRoutingExample", LOG_LEVEL_INFO); - // Set up some default values for the simulation. Use the DefaultValue::Bind () - // technique to tell the system what subclass of Queue to use, - // and what the queue limit is + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif + // Set up some default values for the simulation. Use the + // DefaultValue::Bind () technique to tell the system what subclass of + // Queue to use, and what the queue limit is // The below Bind command tells the queue factory which class to // instantiate, when the queue factory is invoked in the topology code @@ -105,12 +121,14 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate (5000000), MilliSeconds (2)); @@ -124,6 +142,7 @@ int main (int argc, char *argv[]) n2, n3, DataRate (1500000), MilliSeconds (10)); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address ("10.1.1.1"), n2, Ipv4Address ("10.1.1.2")); @@ -142,6 +161,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.3.2", 80), @@ -184,6 +204,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-global-routing.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-global-routing.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -195,9 +216,10 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("simple-global-routing.pcap"); pcaptrace.TraceAllIp (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); return 0; } diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 91b9f2a89..c4cfef038 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -38,7 +38,7 @@ // - Tracing of queues and packet receptions to file // "simple-point-to-point.tr" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" @@ -64,35 +64,37 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("SimplePointToPoint"); +NS_LOG_COMPONENT_DEFINE ("SimplePointToPointExample"); int main (int argc, char *argv[]) { - // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this - // remember to add #include "ns3/debug.h" before enabling these #if 0 - DebugComponentEnable("SimplePointToPoint"); - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("PointToPointChannel"); - DebugComponentEnable("PointToPointNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("Socket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); + LogComponentEnable ("SimplePointToPointExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif // Set up some default values for the simulation. Use the Bind() @@ -114,14 +116,14 @@ main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. - NS_DEBUG("Create nodes."); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information - NS_DEBUG("Create channels."); + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate(5000000), MilliSeconds(2)); @@ -135,7 +137,7 @@ main (int argc, char *argv[]) n2, n3, DataRate(1500000), MilliSeconds(10)); // Later, we add IP addresses. - NS_DEBUG("Assign IP Addresses."); + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address("10.1.1.1"), n2, Ipv4Address("10.1.1.2")); @@ -152,14 +154,14 @@ main (int argc, char *argv[]) // NetDevice creation, IP Address assignment, and routing) are // separated because there may be a need to postpone IP Address // assignment (emulation) or modify to use dynamic routing - NS_DEBUG("Add Static Routes."); + NS_LOG_INFO ("Add Static Routes."); PointToPointTopology::AddIpv4Routes(n0, n2, channel0); PointToPointTopology::AddIpv4Routes(n1, n2, channel1); PointToPointTopology::AddIpv4Routes(n2, n3, channel2); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s - NS_DEBUG("Create Applications."); + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, InetSocketAddress ("10.1.3.2", 80), @@ -201,7 +203,7 @@ main (int argc, char *argv[]) // Here, finish off packet routing configuration // This will likely set by some global StaticRouting object in the future - NS_DEBUG("Set Default Routes."); + NS_LOG_INFO ("Set Default Routes."); Ptr ipv4; ipv4 = n0->QueryInterface (Ipv4::iid); ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1); @@ -210,7 +212,7 @@ main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-point-to-point.tr file - NS_DEBUG("Configure Tracing."); + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-point-to-point.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -223,8 +225,8 @@ main (int argc, char *argv[]) PcapTrace pcaptrace ("simple-point-to-point.pcap"); pcaptrace.TraceAllIp (); - NS_DEBUG("Run Simulation."); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); Simulator::Destroy (); - NS_DEBUG("Done."); + NS_LOG_INFO ("Done."); } diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 8f5569ba0..70fcf4895 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -28,7 +28,7 @@ #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" @@ -50,7 +50,7 @@ using namespace ns3; -NS_DEBUG_COMPONENT_DEFINE ("UdpEcho"); +NS_LOG_COMPONENT_DEFINE ("UdpEchoExample"); int main (int argc, char *argv[]) @@ -60,33 +60,30 @@ main (int argc, char *argv[]) // for selected modules; the below lines suggest how to do this // #if 0 - DebugComponentEnable("UdpEcho"); + LogComponentEnable ("UdpEchoExample", LOG_LEVEL_INFO); - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("PacketSocket"); - DebugComponentEnable("OnOffApplication"); - DebugComponentEnable("Socket"); - DebugComponentEnable("UdpSocket"); - DebugComponentEnable("UdpL4Protocol"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("Ipv4StaticRouting"); - DebugComponentEnable("Ipv4Interface"); - DebugComponentEnable("ArpIpv4Interface"); - DebugComponentEnable("Ipv4LoopbackInterface"); - DebugComponentEnable("UdpEchoClient"); - DebugComponentEnable("UdpEchoServer"); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif - - DebugComponentEnable("UdpEcho"); - DebugComponentEnable("UdpEchoClient"); - DebugComponentEnable("UdpEchoServer"); // // Set up default values for the simulation. Use the DefaultValue::Bind() // technique to tell the system what subclass of Queue to use. The Bind @@ -102,20 +99,20 @@ main (int argc, char *argv[]) // // Explicitly create the nodes required by the topology (shown above). // - NS_DEBUG("Create nodes."); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); - NS_DEBUG("Create channels."); + NS_LOG_INFO ("Create channels."); // // Explicitly create the channels required by the topology (shown above). // Ptr lan = CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); - NS_DEBUG("Build Topology."); + NS_LOG_INFO ("Build Topology."); // // Now fill out the topology by creating the net devices required to connect // the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will @@ -139,7 +136,7 @@ main (int argc, char *argv[]) // // We've got the "hardware" in place. Now we need to add IP addresses. // - NS_DEBUG("Assign IP Addresses."); + NS_LOG_INFO ("Assign IP Addresses."); // // XXX BUGBUG // Need a better way to get the interface index. The point-to-point topology @@ -164,7 +161,7 @@ main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); - NS_DEBUG("Create Applications."); + NS_LOG_INFO ("Create Applications."); // // Create a UdpEchoServer application on node one. // @@ -193,7 +190,7 @@ main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "udp-echo.tr" // - NS_DEBUG("Configure Tracing."); + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("udp-echo.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); @@ -209,8 +206,8 @@ main (int argc, char *argv[]) // // Now, do the actual simulation. // - NS_DEBUG("Run Simulation."); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); Simulator::Destroy (); - NS_DEBUG("Done."); + NS_LOG_INFO ("Done."); } diff --git a/samples/main-channel.cc b/samples/main-channel.cc index 250a354c8..99ceb04ec 100644 --- a/samples/main-channel.cc +++ b/samples/main-channel.cc @@ -18,7 +18,7 @@ */ #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/packet.h" #include "ns3/drop-tail.h" @@ -27,6 +27,8 @@ using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("ChannelSample"); + // =========================================================================== // Cook up a simplistic Internet Node // =========================================================================== @@ -48,19 +50,19 @@ protected: FakeInternetNode::FakeInternetNode () { - NS_DEBUG_UNCOND("FakeInternetNode::FakeInternetNode ()"); + NS_LOG_FUNCTION; } FakeInternetNode::~FakeInternetNode () { - NS_DEBUG_UNCOND("FakeInternetNode::~FakeInternetNode ()"); + NS_LOG_FUNCTION; } void FakeInternetNode::Doit (void) { - NS_DEBUG_UNCOND("FakeInternetNode::Doit ()"); - NS_DEBUG_UNCOND("FakeInternetNode::Doit (): **** Send outbound packet"); + NS_LOG_FUNCTION; + NS_LOG_INFO ("**** Send outbound packet"); Packet p; m_dtqOutbound.Enqueue(p); @@ -70,9 +72,9 @@ FakeInternetNode::Doit (void) bool FakeInternetNode::UpperDoSendUp (Packet &p) { - NS_DEBUG_UNCOND("FakeInternetNode::UpperDoSendUp (" << &p << ")"); - - NS_DEBUG_UNCOND("FakeInternetNode::UpperDoSendUp (): **** Receive inbound packet"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_INFO ("**** Receive inbound packet"); m_dtqInbound.Enqueue(p); return m_dtqInbound.Dequeue(p); } @@ -80,7 +82,8 @@ FakeInternetNode::UpperDoSendUp (Packet &p) bool FakeInternetNode::UpperDoPull (Packet &p) { - NS_DEBUG_UNCOND("FakeInternetNode::DoPull (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return m_dtqOutbound.Dequeue(p); } @@ -107,29 +110,29 @@ protected: FakePhysicalLayer::FakePhysicalLayer () { - NS_DEBUG_UNCOND("FakePhysicalLayer::FakePhysicalLayer ()"); + NS_LOG_FUNCTION; } FakePhysicalLayer::~FakePhysicalLayer () { - NS_DEBUG_UNCOND("FakePhysicalLayer::~FakePhysicalLayer ()"); + NS_LOG_FUNCTION; } bool FakePhysicalLayer::LowerDoNotify (LayerConnectorUpper *upper) { - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify ()"); + NS_LOG_FUNCTION; Packet p; - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify (): Starting pull"); + NS_LOG_LOGIC ("Starting pull"); NS_ASSERT(m_upperPartner); m_upperPartner->UpperPull(p); m_dtqOutbound.Enqueue(p); - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify (): Got bits, Notify lower"); + NS_LOG_LOGIC ("Got bits, Notify lower"); NS_ASSERT(m_lowerPartner); return m_lowerPartner->LowerNotify(this); @@ -138,7 +141,8 @@ FakePhysicalLayer::LowerDoNotify (LayerConnectorUpper *upper) bool FakePhysicalLayer::UpperDoSendUp (Packet &p) { - NS_DEBUG_UNCOND("FakePhysicalLayer::UpperDoSendUp (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); NS_ASSERT(m_upperPartner); return m_upperPartner->UpperSendUp(p); @@ -147,7 +151,8 @@ FakePhysicalLayer::UpperDoSendUp (Packet &p) bool FakePhysicalLayer::UpperDoPull (Packet &p) { - NS_DEBUG_UNCOND("FakePhysicalLayer::DoPull (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return m_dtqOutbound.Dequeue(p); } @@ -164,24 +169,17 @@ public: FakeChannel::FakeChannel () { - NS_DEBUG_UNCOND("FakeChannel::FakeChannel ()"); + NS_LOG_FUNCTION; } FakeChannel::~FakeChannel () { - NS_DEBUG_UNCOND("FakeChannel::~FakeChannel ()"); + NS_LOG_FUNCTION; } int main (int argc, char *argv[]) { - NS_DEBUG_UNCOND("Channel Hackorama"); - -#if 0 - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("LayerConnector"); - DebugComponentEnable("Channel"); -#endif + NS_LOG_INFO ("Channel Hackorama"); FakeInternetNode node1, node2, node3, node4; FakePhysicalLayer phys1, phys2, phys3, phys4; diff --git a/samples/main-default-value.cc b/samples/main-default-value.cc index f125a7181..dcaa8a83a 100644 --- a/samples/main-default-value.cc +++ b/samples/main-default-value.cc @@ -3,7 +3,7 @@ #include #include "ns3/default-value.h" #include "ns3/command-line.h" -#include "ns3/debug.h" +#include "ns3/log.h" using namespace ns3; @@ -76,9 +76,9 @@ int main (int argc, char* argv[]) DefaultValue::Bind("testInt1", "57"); TestClass* testclass = new TestClass (); - NS_DEBUG_UNCOND("TestBool1 default value (" << testclass->m_testBool1 << ")"); - NS_DEBUG_UNCOND("TestInt1 default value (" << testclass->m_testInt1 << ")"); - NS_DEBUG_UNCOND("TestInt2 default value (" << testclass->m_testInt2 << ")"); + NS_LOG_UNCOND("TestBool1 default value (" << testclass->m_testBool1 << ")"); + NS_LOG_UNCOND("TestInt1 default value (" << testclass->m_testInt1 << ")"); + NS_LOG_UNCOND("TestInt2 default value (" << testclass->m_testInt2 << ")"); delete testclass; return 0; diff --git a/samples/main-query-interface.cc b/samples/main-query-interface.cc index 20da36ff3..db23a5000 100644 --- a/samples/main-query-interface.cc +++ b/samples/main-query-interface.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/object.h" #include "ns3/component-manager.h" @@ -79,10 +79,11 @@ private: void AnInterface::methodA (void) { + NS_LOG_FUNCTION; // pre-dispatch asserts - NS_DEBUG_UNCOND("AnInterface pre-condition::methodA"); + NS_LOG_LOGIC ("pre-condition"); domethodA (); - NS_DEBUG_UNCOND("AnInterface post-condition::methodA\n"); + NS_LOG_LOGIC ("post-condition"); // post-dispatch asserts } @@ -114,12 +115,13 @@ private: void AnImplementation::methodImpl (void) { - NS_DEBUG_UNCOND("AnImplementation::methodImpl\n"); + NS_LOG_FUNCTION; } AnImplementation::AnImplementation (void) { + NS_LOG_FUNCTION; // enable our interface SetInterfaceId (AnImplementation::iid); } @@ -127,7 +129,7 @@ AnImplementation::AnImplementation (void) void AnImplementation::domethodA () { - NS_DEBUG_UNCOND("AnImplementation::domethodA"); + NS_LOG_FUNCTION; } // @@ -201,7 +203,7 @@ ANewImplementation::ANewImplementation (void) void ANewImplementation::methodImpl (void) { - NS_DEBUG_UNCOND("ANewImplementation::methodImpl\n"); + NS_LOG_FUNCTION; } const InterfaceId ANewImplementation::iid = @@ -238,7 +240,7 @@ AnExtendedImplementation::AnExtendedImplementation (void) void AnExtendedImplementation::methodExtendedImpl (void) { - NS_DEBUG_UNCOND("AnExtendedImplementation::methodExtendedImpl\n"); + NS_LOG_FUNCTION; } const InterfaceId AnExtendedImplementation::iid = diff --git a/samples/main-tw.cc b/samples/main-tw.cc index c4e1ff1f4..4fcb8b94b 100644 --- a/samples/main-tw.cc +++ b/samples/main-tw.cc @@ -18,14 +18,14 @@ */ #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/trace-writer.h" using namespace ns3; int main (int argc, char *argv[]) { - NS_DEBUG_UNCOND("TraceWriter Test") + NS_LOG_UNCOND("TraceWriter Test") TraceWriter writer1; writer1.Open("trace-writer-test.txt"); diff --git a/src/applications/onoff/onoff-application.cc b/src/applications/onoff/onoff-application.cc index 9df4274bc..29f3d9d04 100644 --- a/src/applications/onoff/onoff-application.cc +++ b/src/applications/onoff/onoff-application.cc @@ -22,7 +22,7 @@ // George F. Riley, Georgia Tech, Spring 2007 // Adapted from ApplicationOnOff in GTNetS. -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/address.h" #include "ns3/node.h" #include "ns3/nstime.h" @@ -35,7 +35,7 @@ #include "ns3/packet.h" #include "onoff-application.h" -NS_DEBUG_COMPONENT_DEFINE ("OnOffApplication"); +NS_LOG_COMPONENT_DEFINE ("OnOffApplication"); using namespace std; @@ -73,8 +73,8 @@ OnOffApplication::OnOffApplication(Ptr n, : Application(n), m_cbrRate (rate) { - Construct (n, remote, iid, - ontime, offtime, size); + NS_LOG_FUNCTION; + Construct (n, remote, iid, ontime, offtime, size); } void @@ -85,6 +85,8 @@ OnOffApplication::Construct (Ptr n, const RandomVariable& offTime, uint32_t size) { + NS_LOG_FUNCTION; + m_socket = 0; m_peer = remote; m_connected = false; @@ -100,34 +102,37 @@ OnOffApplication::Construct (Ptr n, OnOffApplication::~OnOffApplication() { - NS_DEBUG("OnOffApplication::~OnOffApplication()"); + NS_LOG_FUNCTION; } void OnOffApplication::SetMaxBytes(uint32_t maxBytes) { - NS_DEBUG("OnOffApplication::SetMaxBytes(" << maxBytes << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << maxBytes << ")"); m_maxBytes = maxBytes; } void OnOffApplication::SetDefaultRate (const DataRate &rate) { - NS_DEBUG("OnOffApplication::SetDefaultRate(" << &rate << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &rate << ")"); g_defaultRate.SetValue (rate); } void OnOffApplication::SetDefaultSize (uint32_t size) { - NS_DEBUG("OnOffApplication::SetDefaultSize(" << size << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << size << ")"); g_defaultSize.SetValue (size); } void OnOffApplication::DoDispose (void) { - NS_DEBUG("OnOffApplication::DoDispose()"); + NS_LOG_FUNCTION; m_socket = 0; delete m_onTime; @@ -143,7 +148,7 @@ OnOffApplication::DoDispose (void) // Application Methods void OnOffApplication::StartApplication() // Called at time specified by Start { - NS_DEBUG("OnOffApplication::StartApplication()"); + NS_LOG_FUNCTION; // Create the socket if not already if (!m_socket) @@ -164,7 +169,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Start void OnOffApplication::StopApplication() // Called at time specified by Stop { - NS_DEBUG("OnOffApplication::StopApplication()"); + NS_LOG_FUNCTION; if (m_sendEvent.IsRunning ()) { // Cancel the pending send packet event @@ -179,14 +184,14 @@ void OnOffApplication::StopApplication() // Called at time specified by Stop // Event handlers void OnOffApplication::StartSending() { - NS_DEBUG("OnOffApplication::StartSending ()"); + NS_LOG_FUNCTION; ScheduleNextTx(); // Schedule the send packet event } void OnOffApplication::StopSending() { - NS_DEBUG("OnOffApplication::StopSending ()"); + NS_LOG_FUNCTION; Simulator::Cancel(m_sendEvent); } @@ -194,15 +199,15 @@ void OnOffApplication::StopSending() // Private helpers void OnOffApplication::ScheduleNextTx() { - NS_DEBUG("OnOffApplication::ScheduleNextTx ()"); + NS_LOG_FUNCTION; if (m_totBytes < m_maxBytes) { uint32_t bits = m_pktSize * 8 - m_residualBits; - NS_DEBUG("OnOffApplication::ScheduleNextTx (): bits = " << bits); + NS_LOG_LOGIC ("bits = " << bits); Time nextTime(Seconds (bits / static_cast(m_cbrRate.GetBitRate()))); // Time till next packet - NS_DEBUG("OnOffApplication::ScheduleNextTx (): nextTime = " << nextTime); + NS_LOG_LOGIC ("nextTime = " << nextTime); m_sendEvent = Simulator::Schedule(nextTime, &OnOffApplication::SendPacket, this); } @@ -214,17 +219,16 @@ void OnOffApplication::ScheduleNextTx() void OnOffApplication::ScheduleStartEvent() { // Schedules the event to start sending data (switch to the "On" state) - NS_DEBUG("OnOffApplication::ScheduleStartEvent ()"); + NS_LOG_FUNCTION; Time offInterval = Seconds(m_offTime->GetValue()); - NS_DEBUG("OnOffApplication::ScheduleStartEvent (): " - "start at " << offInterval); + NS_LOG_LOGIC ("start at " << offInterval); m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); } void OnOffApplication::ScheduleStopEvent() { // Schedules the event to stop sending data (switch to "Off" state) - NS_DEBUG("OnOffApplication::ScheduleStopEvent ()"); + NS_LOG_FUNCTION; Time onInterval = Seconds(m_onTime->GetValue()); Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this); @@ -233,7 +237,7 @@ void OnOffApplication::ScheduleStopEvent() void OnOffApplication::SendPacket() { - NS_DEBUG("OnOffApplication::SendPacket ()"); + NS_LOG_FUNCTION; NS_ASSERT (m_sendEvent.IsExpired ()); m_socket->Send(Packet (m_pktSize)); @@ -245,7 +249,7 @@ void OnOffApplication::SendPacket() void OnOffApplication::ConnectionSucceeded(Ptr) { - NS_DEBUG("OnOffApplication::ConnectionSucceeded ()"); + NS_LOG_FUNCTION; m_connected = true; ScheduleStartEvent(); @@ -253,6 +257,7 @@ void OnOffApplication::ConnectionSucceeded(Ptr) void OnOffApplication::ConnectionFailed(Ptr) { + NS_LOG_FUNCTION; cout << "OnOffApplication, Connection Failed" << endl; } diff --git a/src/applications/packet-sink/packet-sink.cc b/src/applications/packet-sink/packet-sink.cc index 2ca60bfb3..503e0cbff 100644 --- a/src/applications/packet-sink/packet-sink.cc +++ b/src/applications/packet-sink/packet-sink.cc @@ -18,7 +18,7 @@ * Author: Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/address.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/inet-socket-address.h" #include "ns3/node.h" #include "ns3/socket.h" @@ -31,7 +31,7 @@ using namespace std; namespace ns3 { -NS_DEBUG_COMPONENT_DEFINE ("PacketSink"); +NS_LOG_COMPONENT_DEFINE ("PacketSinkApplication"); // Constructors @@ -99,9 +99,9 @@ void PacketSink::Receive(Ptr socket, const Packet &packet, if (InetSocketAddress::IsMatchingType (from)) { InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << - packet.GetSize() << " bytes from " << address.GetIpv4() << " [" - << address << "]---'" << packet.PeekData() << "'"); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4() << " [" << address << "]---'" << + packet.PeekData() << "'"); // TODO: Add a tracing source here } } diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc index 065b8bed1..a5489ef2c 100644 --- a/src/applications/udp-echo/udp-echo-client.cc +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/ipv4-address.h" #include "ns3/nstime.h" #include "ns3/inet-socket-address.h" @@ -27,7 +27,7 @@ namespace ns3 { -NS_DEBUG_COMPONENT_DEFINE ("UdpEchoClient"); +NS_LOG_COMPONENT_DEFINE ("UdpEchoClientApplication"); UdpEchoClient::UdpEchoClient ( Ptr n, @@ -39,7 +39,8 @@ UdpEchoClient::UdpEchoClient ( : Application(n) { - NS_DEBUG ("UdpEchoClient::UdpEchoClient (" << n << ", " << serverAddress << + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << serverAddress << ", " << serverPort << ", " << count << ", " << interval << ", " << size << ")"); @@ -48,7 +49,7 @@ UdpEchoClient::UdpEchoClient ( UdpEchoClient::~UdpEchoClient() { - NS_DEBUG ("UdpEchoClient::~UdpEchoClient ()"); + NS_LOG_FUNCTION; } void @@ -60,7 +61,8 @@ UdpEchoClient::Construct ( Time interval, uint32_t size) { - NS_DEBUG ("UdpEchoClient::Construct (" << n << ", " << serverAddress << + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << serverAddress << ", " << serverPort << ", " << count << ", " << interval << ", " << size << ")"); @@ -80,14 +82,14 @@ UdpEchoClient::Construct ( void UdpEchoClient::DoDispose (void) { - NS_DEBUG ("UdpEchoClient::DoDispose ()"); + NS_LOG_FUNCTION; Application::DoDispose (); } void UdpEchoClient::StartApplication (void) { - NS_DEBUG ("UdpEchoClient::StartApplication ()"); + NS_LOG_FUNCTION; if (!m_socket) { @@ -108,7 +110,7 @@ UdpEchoClient::StartApplication (void) void UdpEchoClient::StopApplication () { - NS_DEBUG ("UdpEchoClient::StopApplication ()"); + NS_LOG_FUNCTION; if (!m_socket) { @@ -122,14 +124,14 @@ UdpEchoClient::StopApplication () void UdpEchoClient::ScheduleTransmit (Time dt) { - NS_DEBUG ("UdpEchoClient::ScheduleTransmit (" << dt << ")"); + NS_LOG_FUNCTION; m_sendEvent = Simulator::Schedule(dt, &UdpEchoClient::Send, this); } void UdpEchoClient::Send (void) { - NS_DEBUG ("UdpEchoClient::Send ()"); + NS_LOG_FUNCTION; NS_ASSERT (m_sendEvent.IsExpired ()); @@ -137,8 +139,7 @@ UdpEchoClient::Send (void) m_socket->Send (p); ++m_sent; - NS_DEBUG ("UdpEchoClient::Send (): Sent " << m_size << " bytes to " << - m_serverAddress); + NS_LOG_INFO ("Sent " << m_size << " bytes to " << m_serverAddress); if (m_sent < m_count) { @@ -152,14 +153,14 @@ UdpEchoClient::Receive( const Packet &packet, const Address &from) { - NS_DEBUG ("UdpEchoClient::Receive (" << socket << ", " << packet << - ", " << from << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")"); if (InetSocketAddress::IsMatchingType (from)) { InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_DEBUG ("UdpEchoClient::Receive(): Received " << - packet.GetSize() << " bytes from " << address.GetIpv4()); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4()); } } diff --git a/src/applications/udp-echo/udp-echo-server.cc b/src/applications/udp-echo/udp-echo-server.cc index 8f51f9f1c..11654ed8d 100644 --- a/src/applications/udp-echo/udp-echo-server.cc +++ b/src/applications/udp-echo/udp-echo-server.cc @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/ipv4-address.h" #include "ns3/nstime.h" #include "ns3/inet-socket-address.h" @@ -29,7 +29,7 @@ namespace ns3 { -NS_DEBUG_COMPONENT_DEFINE ("UdpEchoServer"); +NS_LOG_COMPONENT_DEFINE ("UdpEchoServerApplication"); UdpEchoServer::UdpEchoServer ( Ptr n, @@ -37,15 +37,15 @@ UdpEchoServer::UdpEchoServer ( : Application(n) { - NS_DEBUG ("UdpEchoServer::UdpEchoServer (" << n << ", " << - port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << port << ")"); Construct (n, port); } UdpEchoServer::~UdpEchoServer() { - NS_DEBUG ("UdpEchoServer::~UdpEchoServer ()"); + NS_LOG_FUNCTION; } void @@ -53,7 +53,8 @@ UdpEchoServer::Construct ( Ptr n, uint16_t port) { - NS_DEBUG ("UdpEchoServer::Construct (" << n << ", " << port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << port << ")"); m_node = n; m_port = port; @@ -65,14 +66,14 @@ UdpEchoServer::Construct ( void UdpEchoServer::DoDispose (void) { - NS_DEBUG ("UdpEchoServer::DoDispose ()"); + NS_LOG_FUNCTION; Application::DoDispose (); } void UdpEchoServer::StartApplication (void) { - NS_DEBUG ("UdpEchoServer::StartApplication ()"); + NS_LOG_FUNCTION; if (!m_socket) { @@ -90,7 +91,8 @@ UdpEchoServer::StartApplication (void) void UdpEchoServer::StopApplication () { - NS_DEBUG ("UdpEchoServer::StopApplication ()"); + NS_LOG_FUNCTION; + if (!m_socket) { m_socket->SetRecvCallback((Callback, const Packet &, @@ -104,16 +106,16 @@ UdpEchoServer::Receive( const Packet &packet, const Address &from) { - NS_DEBUG ("UdpEchoServer::Receive (" << socket << ", " << packet << - ", " << from << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")"); if (InetSocketAddress::IsMatchingType (from)) { InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_DEBUG ("UdpEchoServer::Receive(): Received " << - packet.GetSize() << " bytes from " << address.GetIpv4()); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4()); - NS_DEBUG ("UdpEchoServer::Receive (): Echoing packet"); + NS_LOG_LOGIC ("Echoing packet"); socket->SendTo (from, packet); } } diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 06af758ce..6154df7d3 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -19,13 +19,13 @@ */ #include "buffer.h" #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include -NS_DEBUG_COMPONENT_DEFINE ("Buffer"); +NS_LOG_COMPONENT_DEFINE ("Buffer"); -#define DEBUG_INTERNAL_STATE(y) \ -NS_DEBUG (y << "start="<m_dirtyStart = m_start; m_data->m_dirtyEnd = m_end; - DEBUG_INTERNAL_STATE ("add end=" << end << ", "); + LOG_INTERNAL_STATE ("add end=" << end << ", "); NS_ASSERT (CheckInternalState ()); } @@ -502,7 +502,7 @@ Buffer::RemoveAtStart (uint32_t start) m_zeroAreaStart = m_end; } HEURISTICS (m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart)); - DEBUG_INTERNAL_STATE ("rem start=" << start << ", "); + LOG_INTERNAL_STATE ("rem start=" << start << ", "); NS_ASSERT (CheckInternalState ()); } void @@ -536,7 +536,7 @@ Buffer::RemoveAtEnd (uint32_t end) m_zeroAreaStart = m_start; } HEURISTICS (m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart)); - DEBUG_INTERNAL_STATE ("rem end=" << end << ", "); + LOG_INTERNAL_STATE ("rem end=" << end << ", "); NS_ASSERT (CheckInternalState ()); } diff --git a/src/common/packet-metadata.cc b/src/common/packet-metadata.cc index 4229e15f8..812e9a9dc 100644 --- a/src/common/packet-metadata.cc +++ b/src/common/packet-metadata.cc @@ -21,12 +21,12 @@ #include #include "ns3/assert.h" #include "ns3/fatal-error.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "packet-metadata.h" #include "buffer.h" #include "chunk-registry.h" -NS_DEBUG_COMPONENT_DEFINE ("PacketMetadata"); +NS_LOG_COMPONENT_DEFINE ("PacketMetadata"); namespace ns3 { @@ -610,7 +610,7 @@ PacketMetadata::ReadItems (uint16_t current, struct PacketMetadata::Data * PacketMetadata::Create (uint32_t size) { - NS_DEBUG ("create size="< resolver) void CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) { - NS_DEBUG ("connect path="<name); + NS_LOG_LOGIC ("print " << (*i)->name); (*i)->CollectSources (path, context, collection); } if (m_parent != 0) @@ -316,7 +316,7 @@ CompositeTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) { for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) { - NS_DEBUG ("print " << (*i)->name); + NS_LOG_LOGIC ("print " << (*i)->name); (*i)->TraceAll (os, context); } if (m_parent != 0) diff --git a/src/core/fatal-error.h b/src/core/fatal-error.h index 2c83de580..6dcf049b8 100644 --- a/src/core/fatal-error.h +++ b/src/core/fatal-error.h @@ -32,9 +32,8 @@ * * When this macro is hit at runtime, the user-specified * error message is output and the program is halted by calling - * the NS_DEBUG_BREAKPOINT macro. This macro is enabled - * unconditionally in all builds, including debug and optimized - * builds. + * the NS_BREAKPOINT macro. This macro is enabled unconditionally + * in all builds, including debug and optimized builds. */ #define NS_FATAL_ERROR(msg) \ do \ diff --git a/src/core/log.h b/src/core/log.h index 28d075565..f6e8f45a2 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -74,16 +74,28 @@ * defined with the NS_LOG_COMPONENT_DEFINE macro in the * same file. */ -#define NS_LOG(level, msg) \ - do \ - { \ - if (g_log.IsEnabled (level)) \ - { \ - std::clog << msg << std::endl; \ - } \ - } \ +#define NS_LOG(level, msg) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << __PRETTY_FUNCTION__ << " ==> " << \ + msg << std::endl; \ + } \ + } \ while (false) +#define NS_LOG_F(level) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << __PRETTY_FUNCTION__ << std::endl;\ + } \ + } \ + while (false) + + #define NS_LOG_ERROR(msg) \ NS_LOG(ns3::LOG_LEVEL_ERROR, msg) @@ -96,8 +108,8 @@ #define NS_LOG_INFO(msg) \ NS_LOG(ns3::LOG_LEVEL_INFO, msg) -#define NS_LOG_FUNCTION(msg) \ - NS_LOG(ns3::LOG_LEVEL_FUNCTION, msg) +#define NS_LOG_FUNCTION \ + NS_LOG_F(ns3::LOG_LEVEL_FUNCTION) #define NS_LOG_PARAM(msg) \ NS_LOG(ns3::LOG_LEVEL_PARAM, msg) diff --git a/src/core/object.cc b/src/core/object.cc index 27ac31917..1c6d58772 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -23,10 +23,10 @@ #include "singleton.h" #include "uid-manager.h" #include "trace-resolver.h" -#include "debug.h" +#include "log.h" #include -NS_DEBUG_COMPONENT_DEFINE ("Object"); +NS_LOG_COMPONENT_DEFINE ("Object"); namespace { @@ -322,7 +322,7 @@ Object::DoCollectSources (std::string path, const TraceContext &context, while (current != this) { NS_ASSERT (current != 0); - NS_DEBUG ("collect current=" << current); + NS_LOG_LOGIC ("collect current=" << current); InterfaceId cur = current->m_iid; while (cur != Object::iid) { @@ -330,7 +330,7 @@ Object::DoCollectSources (std::string path, const TraceContext &context, std::string fullpath = path; fullpath.append ("/$"); fullpath.append (name); - NS_DEBUG ("collect: " << fullpath); + NS_LOG_LOGIC("collect: " << fullpath); current->GetTraceResolver ()->CollectSources (fullpath, context, collection); cur = InterfaceId::LookupParent (cur); } diff --git a/src/core/random-variable-default-value.cc b/src/core/random-variable-default-value.cc index 14fdfa5a3..58597c545 100644 --- a/src/core/random-variable-default-value.cc +++ b/src/core/random-variable-default-value.cc @@ -19,9 +19,9 @@ * Author: Mathieu Lacage */ #include "random-variable-default-value.h" -#include "debug.h" +#include "log.h" -NS_DEBUG_COMPONENT_DEFINE ("RandomVariableDefaultValue"); +NS_LOG_COMPONENT_DEFINE ("RandomVariableDefaultValue"); namespace ns3 { @@ -75,12 +75,12 @@ RandomVariableDefaultValue::Parse (const std::string &value, double constant = ReadAsDouble (v, ok); if (mustCreate) { - NS_DEBUG ("create Constant constant=" << constant); + NS_LOG_LOGIC ("create Constant constant=" << constant); *pVariable = new ConstantVariable (constant); } else { - NS_DEBUG ("parse Constant constant=" << constant); + NS_LOG_LOGIC ("parse Constant constant=" << constant); } return ok; } @@ -99,12 +99,12 @@ RandomVariableDefaultValue::Parse (const std::string &value, maxVal = ReadAsDouble (max, ok); if (mustCreate) { - NS_DEBUG ("create Uniform min=" << min << ", max=" << max); + NS_LOG_LOGIC ("create Uniform min=" << min << ", max=" << max); *pVariable = new UniformVariable (minVal, maxVal); } else { - NS_DEBUG ("parse Uniform min=" << min << ", max=" << max); + NS_LOG_LOGIC ("parse Uniform min=" << min << ", max=" << max); } return ok; } diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc index d891c94c4..6569e206d 100644 --- a/src/core/trace-resolver.cc +++ b/src/core/trace-resolver.cc @@ -19,9 +19,9 @@ * Author: Mathieu Lacage */ #include "trace-resolver.h" -#include "debug.h" +#include "log.h" -NS_DEBUG_COMPONENT_DEFINE ("TraceResolver"); +NS_LOG_COMPONENT_DEFINE ("TraceResolver"); namespace ns3 { @@ -43,7 +43,7 @@ TraceResolver::Unref (void) m_count--; if (m_count == 0) { - NS_DEBUG ("delete "< device) { - NS_DEBUG("CsmaChannel::Attach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); CsmaDeviceRec rec(device); @@ -106,7 +109,8 @@ CsmaChannel::Attach(Ptr device) bool CsmaChannel::Reattach(Ptr device) { - NS_DEBUG("CsmaChannel::Reattach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); std::vector::iterator it; @@ -131,7 +135,9 @@ CsmaChannel::Reattach(Ptr device) bool CsmaChannel::Reattach(uint32_t deviceId) { - NS_DEBUG("CsmaChannel::Reattach (" << deviceId << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << deviceId << ")"); + if (deviceId < m_deviceList.size()) { return false; @@ -151,22 +157,23 @@ CsmaChannel::Reattach(uint32_t deviceId) bool CsmaChannel::Detach(uint32_t deviceId) { - NS_DEBUG("CsmaChannel::Detach (" << deviceId << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << deviceId << ")"); if (deviceId < m_deviceList.size()) { if (!m_deviceList[deviceId].active) { - NS_DEBUG("CsmaChannel::Detach Device is already detached (" - << deviceId << ")"); + NS_LOG_WARN ("CsmaChannel::Detach Device is already detached (" << + deviceId << ")"); return false; } m_deviceList[deviceId].active = false; if ((m_state == TRANSMITTING) && (m_currentSrc == deviceId)) { - NS_DEBUG("CsmaChannel::Detach Device is currently" - << "transmitting (" << deviceId << ")"); + NS_LOG_WARN ("CsmaChannel::Detach Device is currently" << + "transmitting (" << deviceId << ")"); // Here we will need to place a warning in the packet } @@ -181,7 +188,8 @@ CsmaChannel::Detach(uint32_t deviceId) bool CsmaChannel::Detach(Ptr device) { - NS_DEBUG("CsmaChannel::Detach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); std::vector::iterator it; @@ -199,25 +207,23 @@ CsmaChannel::Detach(Ptr device) bool CsmaChannel::TransmitStart(Packet& p, uint32_t srcId) { - NS_DEBUG ("CsmaChannel::TransmitStart (" << &p << ", " << srcId - << ")"); - NS_DEBUG ("CsmaChannel::TransmitStart (): UID is " << - p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << srcId << ")"); + NS_LOG_INFO ("UID is " << p.GetUid () << ")"); if (m_state != IDLE) { - NS_DEBUG("CsmaChannel::TransmitStart (): state is not IDLE"); + NS_LOG_WARN ("state is not IDLE"); return false; } if (!IsActive(srcId)) { - NS_DEBUG("CsmaChannel::TransmitStart (): ERROR: Seclected " - << "source is not currently attached to network"); + NS_LOG_ERROR ("Seclected source is not currently attached to network"); return false; } - NS_DEBUG("CsmaChannel::TransmitStart (): switch to TRANSMITTING"); + NS_LOG_LOGIC ("switch to TRANSMITTING"); m_currentPkt = p; m_currentSrc = srcId; m_state = TRANSMITTING; @@ -233,10 +239,9 @@ CsmaChannel::IsActive(uint32_t deviceId) bool CsmaChannel::TransmitEnd() { - NS_DEBUG("CsmaChannel::TransmitEnd (" << &m_currentPkt << ", " - << m_currentSrc << ")"); - NS_DEBUG("CsmaChannel::TransmitEnd (): UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &m_currentPkt << ", " << m_currentSrc << ")"); + NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")"); NS_ASSERT(m_state == TRANSMITTING); m_state = PROPAGATING; @@ -244,13 +249,12 @@ CsmaChannel::TransmitEnd() bool retVal = true; if (!IsActive(m_currentSrc)) { - NS_DEBUG("CsmaChannel::TransmitEnd (): ERROR: Seclected source " - << "was detached before the end of the transmission"); + NS_LOG_ERROR ("Seclected source was detached before the end of the" + "transmission"); retVal = false; } - NS_DEBUG ("CsmaChannel::TransmitEnd (): Schedule event in " << - m_delay.GetSeconds () << " sec"); + NS_LOG_LOGIC ("Schedule event in " << m_delay.GetSeconds () << " sec"); Simulator::Schedule (m_delay, &CsmaChannel::PropagationCompleteEvent, @@ -261,14 +265,13 @@ CsmaChannel::TransmitEnd() void CsmaChannel::PropagationCompleteEvent() { - NS_DEBUG("CsmaChannel::PropagationCompleteEvent (" - << &m_currentPkt << ")"); - NS_DEBUG ("CsmaChannel::PropagationCompleteEvent (): UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &m_currentPkt << ")"); + NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")"); NS_ASSERT(m_state == PROPAGATING); - NS_DEBUG ("CsmaChannel::PropagationCompleteEvent (): Receive"); + NS_LOG_LOGIC ("Receive"); std::vector::iterator it; for (it = m_deviceList.begin(); it < m_deviceList.end(); it++) diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index dd4d03700..750860f4d 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -20,7 +20,6 @@ #include #include "ns3/assert.h" -#include "ns3/debug.h" #include "ns3/fatal-error.h" #include "ns3/nstime.h" #include "ns3/internet-node.h" diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 1d15f2b9b..e4fd05a1b 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -19,7 +19,7 @@ * Author: Emmanuelle Laprise */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/queue.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" @@ -29,16 +29,22 @@ #include "ns3/ethernet-trailer.h" #include "ns3/llc-snap-header.h" -NS_DEBUG_COMPONENT_DEFINE ("CsmaNetDevice"); +NS_LOG_COMPONENT_DEFINE ("CsmaNetDevice"); namespace ns3 { CsmaTraceType::CsmaTraceType (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + CsmaTraceType::CsmaTraceType () : m_type (RX) -{} +{ + NS_LOG_FUNCTION; +} + void CsmaTraceType::Print (std::ostream &os) const { @@ -51,20 +57,26 @@ CsmaTraceType::Print (std::ostream &os) const break; } } + uint16_t CsmaTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("CsmaTraceType"); return uid; } + std::string CsmaTraceType::GetTypeName (void) const { + NS_LOG_FUNCTION; return "ns3::CsmaTraceType"; } + enum CsmaTraceType::Type CsmaTraceType::Get (void) const { + NS_LOG_FUNCTION; return m_type; } @@ -72,7 +84,8 @@ CsmaNetDevice::CsmaNetDevice (Ptr node) : NetDevice (node, Mac48Address::Allocate ()), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = IP_ARP; Init(true, true); } @@ -82,7 +95,8 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = encapMode; Init(true, true); @@ -94,7 +108,8 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = encapMode; Init(sendEnable, receiveEnable); @@ -102,13 +117,14 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, CsmaNetDevice::~CsmaNetDevice() { - NS_DEBUG ("CsmaNetDevice::~CsmaNetDevice ()"); + NS_LOG_FUNCTION; m_queue = 0; } void CsmaNetDevice::DoDispose () { + NS_LOG_FUNCTION; m_channel = 0; NetDevice::DoDispose (); } @@ -125,7 +141,8 @@ CsmaNetDevice::DoDispose () CsmaNetDevice& CsmaNetDevice::operator= (const CsmaNetDevice nd) { - NS_DEBUG ("CsmaNetDevice::operator= (" << &nd << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &nd << ")"); return *this; } */ @@ -133,6 +150,7 @@ CsmaNetDevice::operator= (const CsmaNetDevice nd) void CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) { + NS_LOG_FUNCTION; m_txMachineState = READY; m_tInterframeGap = Seconds(0); m_channel = 0; @@ -148,53 +166,63 @@ CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) void CsmaNetDevice::SetSendEnable (bool sendEnable) { + NS_LOG_FUNCTION; m_sendEnable = sendEnable; } void CsmaNetDevice::SetReceiveEnable (bool receiveEnable) { + NS_LOG_FUNCTION; m_receiveEnable = receiveEnable; } + bool CsmaNetDevice::IsSendEnabled (void) { + NS_LOG_FUNCTION; return (m_sendEnable); } bool CsmaNetDevice::IsReceiveEnabled (void) { + NS_LOG_FUNCTION; return (m_receiveEnable); } void CsmaNetDevice::SetDataRate (DataRate bps) { + NS_LOG_FUNCTION; m_bps = bps; } void CsmaNetDevice::SetInterframeGap (Time t) { + NS_LOG_FUNCTION; m_tInterframeGap = t; } void CsmaNetDevice::SetBackoffParams (Time slotTime, uint32_t minSlots, - uint32_t maxSlots, uint32_t ceiling, - uint32_t maxRetries) + uint32_t maxSlots, uint32_t ceiling, + uint32_t maxRetries) { + NS_LOG_FUNCTION; m_backoff.m_slotTime = slotTime; m_backoff.m_minSlots = minSlots; m_backoff.m_maxSlots = maxSlots; m_backoff.m_ceiling = ceiling; m_backoff.m_maxRetries = maxRetries; } + void CsmaNetDevice::AddHeader (Packet& p, Mac48Address dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; if (m_encapMode == RAW) { return; @@ -228,9 +256,11 @@ CsmaNetDevice::AddHeader (Packet& p, Mac48Address dest, trailer.CalcFcs(p); p.AddTrailer(trailer); } + bool CsmaNetDevice::ProcessHeader (Packet& p, uint16_t & param) { + NS_LOG_FUNCTION; if (m_encapMode == RAW) { return true; @@ -269,6 +299,7 @@ CsmaNetDevice::ProcessHeader (Packet& p, uint16_t & param) bool CsmaNetDevice::DoNeedsArp (void) const { + NS_LOG_FUNCTION; if ((m_encapMode == IP_ARP) || (m_encapMode == LLC)) { return true; @@ -285,9 +316,10 @@ CsmaNetDevice::SendTo ( const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; Packet p = packet; - NS_DEBUG ("CsmaNetDevice::SendTo (" << &p << ")"); - NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_LOG_LOGIC ("p=" << &p); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); NS_ASSERT (IsLinkUp ()); @@ -320,9 +352,9 @@ CsmaNetDevice::SendTo ( void CsmaNetDevice::TransmitStart () { - NS_DEBUG ("CsmaNetDevice::TransmitStart (" << &m_currentPkt << ")"); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): UID is " - << m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("m_currentPkt=" << &m_currentPkt); + NS_LOG_LOGIC ("UID is " << m_currentPkt.GetUid ()); // // This function is called to start the process of transmitting a packet. // We need to tell the channel that we've started wiggling the wire and @@ -349,9 +381,8 @@ CsmaNetDevice::TransmitStart () m_backoff.IncrNumRetries(); Time backoffTime = m_backoff.GetBackoffTime(); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " - << "Channel busy, backing off for " - << backoffTime.GetSeconds () << "sec"); + NS_LOG_LOGIC ("Channel busy, backing off for " << + backoffTime.GetSeconds () << " sec"); Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, @@ -364,18 +395,16 @@ CsmaNetDevice::TransmitStart () m_txMachineState = BUSY; Time tEvent = Seconds (m_bps.CalculateTxTime(m_currentPkt.GetSize())); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " << - "Schedule TransmitCompleteEvent in " << - tEvent.GetSeconds () << "sec"); + NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << + tEvent.GetSeconds () << "sec"); Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, this); if (!m_channel->TransmitStart (m_currentPkt, m_deviceId)) { - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " << - "Channel transmit start did not work at " << - tEvent.GetSeconds () << "sec"); + NS_LOG_WARN ("Channel transmit start did not work at " << + tEvent.GetSeconds () << "sec"); m_txMachineState = READY; } else @@ -390,10 +419,8 @@ CsmaNetDevice::TransmitStart () void CsmaNetDevice::TransmitAbort (void) { - NS_DEBUG ("CsmaNetDevice::TransmitAbort ()"); - - NS_DEBUG ("CsmaNetDevice::TransmitAbort (): Pkt UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt.GetUid () << ")"); // Try to transmit a new packet bool found; @@ -407,7 +434,7 @@ CsmaNetDevice::TransmitAbort (void) void CsmaNetDevice::TransmitCompleteEvent (void) { - NS_DEBUG ("CsmaNetDevice::TransmitCompleteEvent ()"); + NS_LOG_FUNCTION; // // This function is called to finish the process of transmitting a packet. // We need to tell the channel that we've stopped wiggling the wire and @@ -419,13 +446,10 @@ CsmaNetDevice::TransmitCompleteEvent (void) NS_ASSERT(m_channel->GetState() == TRANSMITTING); m_txMachineState = GAP; - NS_DEBUG ("CsmaNetDevice::TransmitCompleteEvent (): Pkt UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt.GetUid () << ")"); m_channel->TransmitEnd (); - NS_DEBUG ( - "CsmaNetDevice::TransmitCompleteEvent (): " << - "Schedule TransmitReadyEvent in " + NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds () << "sec"); Simulator::Schedule (m_tInterframeGap, @@ -436,7 +460,7 @@ CsmaNetDevice::TransmitCompleteEvent (void) void CsmaNetDevice::TransmitReadyEvent (void) { - NS_DEBUG ("CsmaNetDevice::TransmitReadyEvent ()"); + NS_LOG_FUNCTION; // // This function is called to enable the transmitter after the interframe // gap has passed. If there are pending transmissions, we use this opportunity @@ -462,6 +486,7 @@ CsmaNetDevice::TransmitReadyEvent (void) Ptr CsmaNetDevice::GetTraceResolver (void) const { + NS_LOG_FUNCTION; Ptr resolver = Create (); resolver->AddComposite ("queue", m_queue); resolver->AddSource ("rx", @@ -481,7 +506,8 @@ CsmaNetDevice::GetTraceResolver (void) const bool CsmaNetDevice::Attach (Ptr ch) { - NS_DEBUG ("CsmaNetDevice::Attach (" << &ch << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ch << ")"); m_channel = ch; @@ -499,7 +525,8 @@ CsmaNetDevice::Attach (Ptr ch) void CsmaNetDevice::AddQueue (Ptr q) { - NS_DEBUG ("CsmaNetDevice::AddQueue (" << q << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << q << ")"); m_queue = q; } @@ -507,6 +534,8 @@ CsmaNetDevice::AddQueue (Ptr q) void CsmaNetDevice::Receive (const Packet& packet) { + NS_LOG_FUNCTION; + EthernetHeader header (false); EthernetTrailer trailer; Mac48Address broadcast; @@ -514,7 +543,7 @@ CsmaNetDevice::Receive (const Packet& packet) Mac48Address destination; Packet p = packet; - NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid()); + NS_LOG_LOGIC ("UID is " << p.GetUid()); // Only receive if send side of net device is enabled if (!IsReceiveEnabled()) @@ -533,8 +562,7 @@ CsmaNetDevice::Receive (const Packet& packet) trailer.CheckFcs(p); p.RemoveHeader(header); - NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " << - header.GetDestination ()); + NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); // // An IP host group address is mapped to an Ethernet multicast address // by placing the low-order 23-bits of the IP address into the low-order @@ -560,7 +588,7 @@ CsmaNetDevice::Receive (const Packet& packet) (mcDest != multicast) && (header.GetDestination () != destination)) { - NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt "); + NS_LOG_LOGIC ("Dropping pkt "); m_dropTrace (p); return; } @@ -595,15 +623,14 @@ CsmaNetDevice::Receive (const Packet& packet) Address CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const { - NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (" << multicastGroup << - ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << multicastGroup << ")"); // // First, get the generic multicast address. // Address hardwareDestination = GetMulticast (); - NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " - "Device multicast address: " << hardwareDestination); + NS_LOG_LOGIC ("Device multicast address: " << hardwareDestination); // // It's our address, and we know we're playing with an EUI-48 address here // primarily since we know that by construction, but also since the parameter @@ -641,8 +668,7 @@ CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const // use it by just returning the EUI-48 address which is automagically converted // to an Address. // - NS_DEBUG ("CsmaNetDevice::MakeMulticastAddress (): " - "multicast address is " << etherAddr); + NS_LOG_LOGIC ("multicast address is " << etherAddr); return etherAddr; } @@ -650,13 +676,15 @@ CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const Ptr CsmaNetDevice::GetQueue(void) const { - return m_queue; + NS_LOG_FUNCTION; + return m_queue; } Ptr CsmaNetDevice::DoGetChannel(void) const { - return m_channel; + NS_LOG_FUNCTION; + return m_channel; } } // namespace ns3 diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc index 27e4e9e29..48a96ec2a 100644 --- a/src/devices/csma/csma-topology.cc +++ b/src/devices/csma/csma-topology.cc @@ -22,7 +22,6 @@ // Topology helper for Csma channels in ns3. #include "ns3/assert.h" -#include "ns3/debug.h" #include "ns3/queue.h" #include "csma-channel.h" diff --git a/src/devices/point-to-point/point-to-point-channel.cc b/src/devices/point-to-point/point-to-point-channel.cc index ae78010cf..858338fa2 100644 --- a/src/devices/point-to-point/point-to-point-channel.cc +++ b/src/devices/point-to-point/point-to-point-channel.cc @@ -23,9 +23,9 @@ #include "point-to-point-net-device.h" #include "ns3/packet.h" #include "ns3/simulator.h" -#include "ns3/debug.h" +#include "ns3/log.h" -NS_DEBUG_COMPONENT_DEFINE ("PointToPointChannel"); +NS_LOG_COMPONENT_DEFINE ("PointToPointChannel"); namespace ns3 { @@ -39,7 +39,7 @@ PointToPointChannel::PointToPointChannel() m_delay (Seconds(0)), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel ()"); + NS_LOG_FUNCTION; } PointToPointChannel::PointToPointChannel( @@ -51,8 +51,9 @@ PointToPointChannel::PointToPointChannel( m_delay (delay), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel (" << Channel::GetName() - << ", " << bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << Channel::GetName() << ", " << bps.GetBitRate() << + ", " << delay << ")"); } PointToPointChannel::PointToPointChannel( @@ -65,14 +66,16 @@ PointToPointChannel::PointToPointChannel( m_delay (delay), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel (" << name << ", " << - bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ", " << bps.GetBitRate() << ", " << + delay << ")"); } - void +void PointToPointChannel::Attach(Ptr device) { - NS_DEBUG("PointToPointChannel::Attach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted"); NS_ASSERT(device != 0); @@ -90,14 +93,14 @@ PointToPointChannel::Attach(Ptr device) } } -bool PointToPointChannel::TransmitStart(Packet& p, +bool +PointToPointChannel::TransmitStart(Packet& p, Ptr src, const Time& txTime) { - NS_DEBUG ("PointToPointChannel::TransmitStart (" << &p << ", " << src << - ")"); - NS_DEBUG ("PointToPointChannel::TransmitStart (): UID is " << - p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << src << ")"); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); NS_ASSERT(m_link[0].m_state != INITIALIZING); NS_ASSERT(m_link[1].m_state != INITIALIZING); @@ -116,12 +119,14 @@ bool PointToPointChannel::TransmitStart(Packet& p, uint32_t PointToPointChannel::GetNDevices (void) const { + NS_LOG_FUNCTION; return m_nDevices; } Ptr PointToPointChannel::GetDevice (uint32_t i) const { + NS_LOG_FUNCTION; NS_ASSERT(i < 2); return m_link[i].m_src; } @@ -129,12 +134,14 @@ PointToPointChannel::GetDevice (uint32_t i) const const DataRate& PointToPointChannel::GetDataRate (void) { + NS_LOG_FUNCTION; return m_bps; } const Time& PointToPointChannel::GetDelay (void) { + NS_LOG_FUNCTION; return m_delay; } diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 322511467..20140386c 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -20,7 +20,7 @@ * Revised: George Riley */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/queue.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" @@ -29,7 +29,7 @@ #include "point-to-point-net-device.h" #include "point-to-point-channel.h" -NS_DEBUG_COMPONENT_DEFINE ("PointToPointNetDevice"); +NS_LOG_COMPONENT_DEFINE ("PointToPointNetDevice"); namespace ns3 { @@ -39,21 +39,27 @@ DataRateDefaultValue PointToPointNetDevice::g_defaultRate( DataRate ("10Mb/s")); PointToPointTraceType::PointToPointTraceType () -{} +{ + NS_LOG_FUNCTION; +} void PointToPointTraceType::Print (std::ostream &os) const { os << "dev-rx"; } + uint16_t PointToPointTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("PointToPointTraceType"); return uid; } + std::string PointToPointTraceType::GetTypeName (void) const { + NS_LOG_FUNCTION; return "ns3::PointToPointTraceType"; } @@ -69,11 +75,13 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, m_queue (0), m_rxTrace () { - NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")"); - -// BUGBUG FIXME + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); +// +// XXX BUGBUG // // You _must_ support broadcast to get any sort of packet from the ARP layer. +// EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); // // We want to allow multicast packets to flow across this link @@ -84,13 +92,14 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, PointToPointNetDevice::~PointToPointNetDevice() { - NS_DEBUG ("PointToPointNetDevice::~PointToPointNetDevice ()"); + NS_LOG_FUNCTION; m_queue = 0; } void PointToPointNetDevice::AddHeader(Packet& p, uint16_t protocolNumber) { + NS_LOG_FUNCTION; LlcSnapHeader llc; llc.SetType (protocolNumber); p.AddHeader (llc); @@ -99,6 +108,7 @@ PointToPointNetDevice::AddHeader(Packet& p, uint16_t protocolNumber) bool PointToPointNetDevice::ProcessHeader(Packet& p, uint16_t& param) { + NS_LOG_FUNCTION; LlcSnapHeader llc; p.RemoveHeader (llc); @@ -109,26 +119,30 @@ PointToPointNetDevice::ProcessHeader(Packet& p, uint16_t& param) void PointToPointNetDevice::DoDispose() { + NS_LOG_FUNCTION; m_channel = 0; NetDevice::DoDispose (); } void PointToPointNetDevice::SetDataRate(const DataRate& bps) { + NS_LOG_FUNCTION; m_bps = bps; } void PointToPointNetDevice::SetInterframeGap(const Time& t) { + NS_LOG_FUNCTION; m_tInterframeGap = t; } bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; Packet p = packet; - NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")"); - NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_LOG_LOGIC ("p=" << &p << ", dest=" << &dest); + NS_LOG_LOGIC ("UID is " << p.GetUid ()); // GFR Comment. Why is this an assertion? Can't a link legitimately // "go down" during the simulation? Shouldn't we just wait for it @@ -156,9 +170,9 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, bool PointToPointNetDevice::TransmitStart (Packet &p) { - NS_DEBUG ("PointToPointNetDevice::TransmitStart (" << &p << ")"); - NS_DEBUG ( - "PointToPointNetDevice::TransmitStart (): UID is " << p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); // // This function is called to start the process of transmitting a packet. // We need to tell the channel that we've started wiggling the wire and @@ -169,8 +183,7 @@ PointToPointNetDevice::TransmitStart (Packet &p) Time txTime = Seconds (m_bps.CalculateTxTime(p.GetSize())); Time txCompleteTime = txTime + m_tInterframeGap; - NS_DEBUG ("PointToPointNetDevice::TransmitStart (): " << - "Schedule TransmitCompleteEvent in " << + NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec"); // Schedule the tx complete event Simulator::Schedule (txCompleteTime, @@ -181,7 +194,7 @@ PointToPointNetDevice::TransmitStart (Packet &p) void PointToPointNetDevice::TransmitComplete (void) { - NS_DEBUG ("PointToPointNetDevice::TransmitCompleteEvent ()"); + NS_LOG_FUNCTION; // // This function is called to finish the process of transmitting a packet. // We need to tell the channel that we've stopped wiggling the wire and @@ -198,6 +211,7 @@ void PointToPointNetDevice::TransmitComplete (void) Ptr PointToPointNetDevice::GetTraceResolver (void) const { + NS_LOG_FUNCTION; Ptr resolver = Create (); resolver->AddComposite ("queue", m_queue); resolver->AddSource ("rx", @@ -209,9 +223,11 @@ PointToPointNetDevice::GetTraceResolver (void) const return resolver; } -bool PointToPointNetDevice::Attach (Ptr ch) +bool +PointToPointNetDevice::Attach (Ptr ch) { - NS_DEBUG ("PointToPointNetDevice::Attach (" << &ch << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ch << ")"); m_channel = ch; @@ -237,14 +253,16 @@ bool PointToPointNetDevice::Attach (Ptr ch) void PointToPointNetDevice::AddQueue (Ptr q) { - NS_DEBUG ("PointToPointNetDevice::AddQueue (" << q << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << q << ")"); m_queue = q; } void PointToPointNetDevice::Receive (Packet& p) { - NS_DEBUG ("PointToPointNetDevice::Receive (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); uint16_t protocol = 0; Packet packet = p; @@ -255,16 +273,19 @@ void PointToPointNetDevice::Receive (Packet& p) Ptr PointToPointNetDevice::GetQueue(void) const { - return m_queue; + NS_LOG_FUNCTION; + return m_queue; } Ptr PointToPointNetDevice::DoGetChannel(void) const { - return m_channel; + NS_LOG_FUNCTION; + return m_channel; } bool PointToPointNetDevice::DoNeedsArp (void) const { + NS_LOG_FUNCTION; return false; } diff --git a/src/devices/point-to-point/point-to-point-topology.cc b/src/devices/point-to-point/point-to-point-topology.cc index 5a9558419..4c99eaf88 100644 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ b/src/devices/point-to-point/point-to-point-topology.cc @@ -24,7 +24,7 @@ #include #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/fatal-error.h" #include "ns3/nstime.h" #include "ns3/internet-node.h" diff --git a/src/internet-node/ipv4-end-point-demux.cc b/src/internet-node/ipv4-end-point-demux.cc index 6d310e133..d17c450d8 100644 --- a/src/internet-node/ipv4-end-point-demux.cc +++ b/src/internet-node/ipv4-end-point-demux.cc @@ -21,18 +21,21 @@ #include "ipv4-end-point-demux.h" #include "ipv4-end-point.h" -#include "ns3/debug.h" +#include "ns3/log.h" namespace ns3{ -NS_DEBUG_COMPONENT_DEFINE ("Ipv4EndPointDemux"); +NS_LOG_COMPONENT_DEFINE ("Ipv4EndPointDemux"); Ipv4EndPointDemux::Ipv4EndPointDemux () : m_ephemeral (1025) -{} +{ + NS_LOG_FUNCTION; +} Ipv4EndPointDemux::~Ipv4EndPointDemux () { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { Ipv4EndPoint *endPoint = *i; @@ -44,6 +47,7 @@ Ipv4EndPointDemux::~Ipv4EndPointDemux () bool Ipv4EndPointDemux::LookupPortLocal (uint16_t port) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == port) @@ -57,6 +61,7 @@ Ipv4EndPointDemux::LookupPortLocal (uint16_t port) bool Ipv4EndPointDemux::LookupLocal (Ipv4Address addr, uint16_t port) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == port && @@ -71,44 +76,49 @@ Ipv4EndPointDemux::LookupLocal (Ipv4Address addr, uint16_t port) Ipv4EndPoint * Ipv4EndPointDemux::Allocate (void) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ()"); + NS_LOG_FUNCTION; uint16_t port = AllocateEphemeralPort (); if (port == 0) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ephemeral port allocation failed."); + NS_LOG_WARN ("Ephemeral port allocation failed."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (Ipv4Address::GetAny (), port); m_endPoints.push_back (endPoint); return endPoint; } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (address=" << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ")"); uint16_t port = AllocateEphemeralPort (); if (port == 0) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ephemeral port allocation failed."); + NS_LOG_WARN ("Ephemeral port allocation failed."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); return endPoint; } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (uint16_t port) { + NS_LOG_FUNCTION; return Allocate (Ipv4Address::GetAny (), port); } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address, uint16_t port) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (address=" << address - << ", port=" << port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ", " << port << ")"); if (LookupLocal (address, port)) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate duplicate address/port; failing."); + NS_LOG_WARN ("Duplicate address/port; failing."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); @@ -120,10 +130,11 @@ Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (localAddress=" << localAddress - << ", localPort=" << localPort - << ", peerAddress=" << peerAddress - << ", peerPort=" << peerPort << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(localAddress=" << localAddress + << ", localPort=" << localPort + << ", peerAddress=" << peerAddress + << ", peerPort=" << peerPort << ")"); for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == localPort && @@ -131,7 +142,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, (*i)->GetPeerPort () == peerPort && (*i)->GetPeerAddress () == peerAddress) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate: no way we can allocate this end-point."); + NS_LOG_WARN ("No way we can allocate this end-point."); /* no way we can allocate this end-point. */ return 0; } @@ -145,6 +156,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, void Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if (*i == endPoint) @@ -156,7 +168,6 @@ Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) } } - /* * If we have an exact match, we return it. * Otherwise, if we find a generic match, we return it. @@ -166,40 +177,42 @@ Ipv4EndPointDemux::EndPoints Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport) { + NS_LOG_FUNCTION; uint32_t genericity = 3; Ipv4EndPoint *generic = 0; EndPoints retval; - NS_DEBUG ("Ipv4EndPointDemux::Lookup (daddr=" << daddr << ", dport=" << dport - << ", saddr=" << saddr << ", sport=" << sport - << ")"); + NS_LOG_PARAM ("(daddr=" << daddr << ", dport=" << dport + << ", saddr=" << saddr << ", sport=" << sport << ")"); + for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { - NS_DEBUG ("Ipv4EndPointDemux::Lookup against " << - (*i)->GetLocalAddress () - << ":" << - (*i)->GetLocalPort () - << " " << - (*i)->GetPeerAddress () - << ":" - << (*i)->GetPeerPort ()); + NS_LOG_LOGIC ("Ipv4EndPointDemux::Lookup against " << + (*i)->GetLocalAddress () + << ":" << + (*i)->GetLocalPort () + << " " << + (*i)->GetPeerAddress () + << ":" + << (*i)->GetPeerPort ()); + if ((*i)->GetLocalPort () != dport) { continue; } - NS_DEBUG ("Ipv4EndPointDemux::Lookup local address matches: " - << bool ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ())); - NS_DEBUG ("Ipv4EndPointDemux::Lookup peer port matches: " - << bool ((*i)->GetPeerPort () == sport || sport == 0)); - NS_DEBUG ("Ipv4EndPointDemux::Lookup peer address matches: " - << bool ((*i)->GetPeerAddress () == saddr || - (*i)->GetPeerAddress () == Ipv4Address::GetAny ())); + NS_LOG_LOGIC ("Local address matches: " << + bool ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ())); + NS_LOG_LOGIC ("Peer port matches: " << + bool ((*i)->GetPeerPort () == sport || sport == 0)); + NS_LOG_LOGIC ("Peer address matches: " << + bool ((*i)->GetPeerAddress () == saddr || + (*i)->GetPeerAddress () == Ipv4Address::GetAny ())); if ( ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ()) && ((*i)->GetPeerPort () == sport || (*i)->GetPeerPort () == 0) && ((*i)->GetPeerAddress () == saddr || (*i)->GetPeerAddress () == Ipv4Address::GetAny ())) { - NS_DEBUG ("Ipv4EndPointDemux::Lookup MATCH"); + NS_LOG_LOGIC ("MATCH"); /* this is an exact match. */ retval.push_back (*i); } @@ -228,6 +241,7 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, uint16_t Ipv4EndPointDemux::AllocateEphemeralPort (void) { + NS_LOG_FUNCTION; uint16_t port = m_ephemeral; do { diff --git a/src/internet-node/ipv4-header.cc b/src/internet-node/ipv4-header.cc index 83750632d..2fd8fc059 100644 --- a/src/internet-node/ipv4-header.cc +++ b/src/internet-node/ipv4-header.cc @@ -20,11 +20,11 @@ */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/header.h" #include "ipv4-header.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4Header"); +NS_LOG_COMPONENT_DEFINE ("Ipv4Header"); namespace ns3 { @@ -271,7 +271,7 @@ Ipv4Header::Serialize (Buffer::Iterator start) const uint8_t *data = start.PeekData (); uint16_t checksum = UtilsChecksumCalculate (0, data, GetSize ()); checksum = UtilsChecksumComplete (checksum); - NS_DEBUG ("checksum=" < nd) : m_netdevice (nd), m_ifup(false) { - NS_DEBUG ("Ipv4Interface::Ipv4Interface (" << &nd << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &nd << ")"); } Ipv4Interface::~Ipv4Interface () { - NS_DEBUG ("Ipv4Interface::~Ipv4Interface ()"); + NS_LOG_FUNCTION; } void Ipv4Interface::DoDispose (void) { + NS_LOG_FUNCTION; m_netdevice = 0; Object::DoDispose (); } @@ -57,29 +59,30 @@ Ipv4Interface::DoDispose (void) Ptr Ipv4Interface::GetDevice (void) const { - NS_DEBUG ("Ipv4Interface::GetDevice ()"); + NS_LOG_FUNCTION; return m_netdevice; } void Ipv4Interface::SetAddress (Ipv4Address a) { - NS_DEBUG ("Ipv4Interface::SetAddress (" << a << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << a << ")"); m_address = a; } void Ipv4Interface::SetNetworkMask (Ipv4Mask mask) { - NS_DEBUG ("Ipv4Interface::SetMask (" << mask << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << mask << ")"); m_netmask = mask; } Ipv4Address Ipv4Interface::GetBroadcast (void) const { - NS_DEBUG ("Ipv4Interface::GetBroadcast ()"); - + NS_LOG_FUNCTION; uint32_t mask = m_netmask.GetHostOrder (); uint32_t address = m_address.GetHostOrder (); Ipv4Address broadcast = Ipv4Address (address | (~mask)); @@ -89,21 +92,21 @@ Ipv4Interface::GetBroadcast (void) const Ipv4Mask Ipv4Interface::GetNetworkMask (void) const { - NS_DEBUG ("Ipv4Interface::GetNetworkMask ()"); + NS_LOG_FUNCTION; return m_netmask; } Ipv4Address Ipv4Interface::GetAddress (void) const { - NS_DEBUG ("Ipv4Interface::Address ()"); + NS_LOG_FUNCTION; return m_address; } uint16_t Ipv4Interface::GetMtu (void) const { - NS_DEBUG ("Ipv4Interface::GetMtu ()"); + NS_LOG_FUNCTION; if (m_netdevice == 0) { uint32_t mtu = (1<<16) - 1; @@ -120,28 +123,28 @@ Ipv4Interface::GetMtu (void) const bool Ipv4Interface::IsUp (void) const { - NS_DEBUG ("Ipv4Interface::IsUp ()"); + NS_LOG_FUNCTION; return m_ifup; } bool Ipv4Interface::IsDown (void) const { - NS_DEBUG ("Ipv4Interface::IsDown ()"); + NS_LOG_FUNCTION; return !m_ifup; } void Ipv4Interface::SetUp (void) { - NS_DEBUG ("Ipv4Interface::SetUp ()"); + NS_LOG_FUNCTION; m_ifup = true; } void Ipv4Interface::SetDown (void) { - NS_DEBUG ("Ipv4Interface::SetDown ()"); + NS_LOG_FUNCTION; m_ifup = false; } @@ -149,10 +152,9 @@ Ipv4Interface::SetDown (void) void Ipv4Interface::Send(Packet p, Ipv4Address dest) { - NS_DEBUG ("Ipv4Interface::Send ()"); - + NS_LOG_FUNCTION; if (IsUp()) { - NS_DEBUG ("Ipv4Interface::Send (): SendTo ()"); + NS_LOG_LOGIC ("SendTo"); SendTo(p, dest); } } diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 1c211edf1..50fd2e39a 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -20,7 +20,7 @@ // #include "ns3/packet.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" #include "ns3/callback.h" #include "ns3/ipv4-address.h" @@ -36,7 +36,7 @@ #include "arp-ipv4-interface.h" #include "ipv4-l4-demux.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4L3Protocol"); +NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol"); namespace ns3 { @@ -45,28 +45,41 @@ const uint16_t Ipv4L3Protocol::PROT_NUMBER = 0x0800; Ipv4L3ProtocolTraceContextElement::Ipv4L3ProtocolTraceContextElement () : m_type (TX) -{} +{ + NS_LOG_FUNCTION; +} + Ipv4L3ProtocolTraceContextElement::Ipv4L3ProtocolTraceContextElement (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + bool Ipv4L3ProtocolTraceContextElement::IsTx (void) const { + NS_LOG_FUNCTION; return m_type == TX; } + bool Ipv4L3ProtocolTraceContextElement::IsRx (void) const { + NS_LOG_FUNCTION; return m_type == RX; } + bool Ipv4L3ProtocolTraceContextElement::IsDrop (void) const { + NS_LOG_FUNCTION; return m_type == DROP; } + void Ipv4L3ProtocolTraceContextElement::Print (std::ostream &os) const { + NS_LOG_FUNCTION; os << "ipv4="; switch (m_type) { @@ -81,44 +94,59 @@ Ipv4L3ProtocolTraceContextElement::Print (std::ostream &os) const break; } } + uint16_t Ipv4L3ProtocolTraceContextElement::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("Ipv4L3ProtocolTraceContextElement"); return uid; } + std::string Ipv4L3ProtocolTraceContextElement::GetTypeName (void) const { + NS_LOG_FUNCTION; return "ns3::Ipv4L3ProtocolTraceContextElement"; } - Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex () : m_index (0) -{} +{ + NS_LOG_FUNCTION; +} + Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex (uint32_t index) : m_index (index) -{} +{ + NS_LOG_FUNCTION; +} + uint32_t Ipv4L3ProtocolInterfaceIndex::Get (void) const { + NS_LOG_FUNCTION; return m_index; } + void Ipv4L3ProtocolInterfaceIndex::Print (std::ostream &os) const { os << "ipv4-interface=" << m_index; } + uint16_t Ipv4L3ProtocolInterfaceIndex::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("Ipv4L3ProtocolInterfaceIndex"); return uid; } + std::string Ipv4L3ProtocolInterfaceIndex::GetTypeName (void) const { + NS_LOG_FUNCTION; return "ns3::Ipv4L3ProtocolInterfaceIndex"; } @@ -129,8 +157,7 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) m_identification (0), m_node (node) { - NS_DEBUG("Ipv4L3Protocol::Ipv4L3Protocol ()"); - + NS_LOG_FUNCTION; SetInterfaceId (Ipv4L3Protocol::iid); m_staticRouting = Create (); AddRoutingProtocol (m_staticRouting, 0); @@ -139,14 +166,13 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) Ipv4L3Protocol::~Ipv4L3Protocol () { - NS_DEBUG("Ipv4L3Protocol::~Ipv4L3Protocol ()"); + NS_LOG_FUNCTION; } void Ipv4L3Protocol::DoDispose (void) { - NS_DEBUG("Ipv4L3Protocol::DoDispose ()"); - + NS_LOG_FUNCTION; m_interfaces.clear (); m_node = 0; m_staticRouting->Dispose (); @@ -157,7 +183,7 @@ Ipv4L3Protocol::DoDispose (void) void Ipv4L3Protocol::SetupLoopback (void) { - NS_DEBUG("Ipv4L3Protocol::SetupLoopback ()"); + NS_LOG_FUNCTION; Ptr interface = Create (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); @@ -170,7 +196,7 @@ Ipv4L3Protocol::SetupLoopback (void) Ptr Ipv4L3Protocol::GetTraceResolver (void) const { - NS_DEBUG("Ipv4L3Protocol::GetTraceResolver ()"); + NS_LOG_FUNCTION; Ptr resolver = Create (); resolver->AddSource ("tx", @@ -196,7 +222,7 @@ Ipv4L3Protocol::GetTraceResolver (void) const void Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl) { - NS_DEBUG("Ipv4L3Protocol::SetDefaultTtl ()"); + NS_LOG_FUNCTION; m_defaultTtl = ttl; } @@ -206,8 +232,8 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { - NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << nextHop << - ", " << interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << dest << ", " << nextHop << ", " << interface << ")"); m_staticRouting->AddHostRouteTo (dest, nextHop, interface); } @@ -215,8 +241,8 @@ void Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, uint32_t interface) { - NS_DEBUG("Ipv4L3Protocol::AddHostRouteTo (" << dest << ", " << - interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << dest << ", " << interface << ")"); m_staticRouting->AddHostRouteTo (dest, interface); } @@ -226,25 +252,29 @@ Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Address nextHop, uint32_t interface) { - NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << - networkMask << ", " << nextHop << ", " << interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << nextHop << + ", " << interface << ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, nextHop, interface); } + void Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface) { - NS_DEBUG("Ipv4L3Protocol::AddNetworkRouteTo (" << network << ", " << - networkMask << ", " << interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << interface << + ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, interface); } + void Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) { - NS_DEBUG("Ipv4L3Protocol::SetDefaultRoute (" << nextHop << ", " << - interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << nextHop << ", " << interface << ")"); m_staticRouting->SetDefaultRoute (nextHop, interface); } @@ -254,8 +284,8 @@ Ipv4L3Protocol::Lookup ( Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { - NS_DEBUG("Ipv4L3Protocol::Lookup (" << &ipHeader << - ", " << &packet << &routeReply << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ipHeader << ", " << &packet << &routeReply << ")"); Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply); } @@ -267,15 +297,16 @@ Ipv4L3Protocol::Lookup ( Packet packet, Ipv4RoutingProtocol::RouteReplyCallback routeReply) { - NS_DEBUG("Ipv4L3Protocol::Lookup (" << ifIndex << ", " << &ipHeader << - ", " << &packet << &routeReply << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << ", " << &ipHeader << ", " << &packet << + &routeReply << ")"); for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); rprotoIter++) { - NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting route"); + NS_LOG_LOGIC ("Requesting route"); if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet, routeReply)) return; @@ -284,8 +315,7 @@ Ipv4L3Protocol::Lookup ( if (ipHeader.GetDestination ().IsMulticast () && ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) { - NS_DEBUG ("Ipv4L3Protocol::Lookup (): " - "Multicast destination with local source"); + NS_LOG_LOGIC ("Multicast destination with local source"); // // We have a multicast packet originating from the current node and were not // able to send it using the usual RequestRoute process. Since the usual @@ -300,8 +330,8 @@ Ipv4L3Protocol::Lookup ( if (route) { - NS_DEBUG ("Ipv4StaticRouting::Lookup (): " - "Local source. Using unicast default route for multicast packet"); + NS_LOG_LOGIC ("Local source. Using unicast default route for " + "multicast packet"); routeReply (true, *route, packet, ipHeader); return; @@ -317,8 +347,8 @@ void Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, int priority) { - NS_DEBUG("Ipv4L3Protocol::AddRoutingProtocol (" << &routingProtocol << - ", " << priority << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &routingProtocol << ", " << priority << ")"); m_routingProtocols.push_back (std::pair > (-priority, routingProtocol)); m_routingProtocols.sort (); @@ -327,21 +357,22 @@ Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, uint32_t Ipv4L3Protocol::GetNRoutes (void) { - NS_DEBUG("Ipv4L3Protocol::GetNRoutes ()"); + NS_LOG_FUNCTION; return m_staticRouting->GetNRoutes (); } Ipv4Route * Ipv4L3Protocol::GetRoute (uint32_t index) { - NS_DEBUG("Ipv4L3Protocol::GetRoute ()"); + NS_LOG_FUNCTION; return m_staticRouting->GetRoute (index); } void Ipv4L3Protocol::RemoveRoute (uint32_t index) { - NS_DEBUG("Ipv4L3Protocol::RemoveRoute (" << index << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM("(" << index << ")"); m_staticRouting->RemoveRoute (index); } @@ -351,8 +382,9 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, uint32_t inputInterface, std::vector outputInterfaces) { - NS_DEBUG("Ipv4L3Protocol::AddMulticastRoute (" << origin << ", " << - group << ", " << inputInterface << ", " << &outputInterfaces << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface << + ", " << &outputInterfaces << ")"); m_staticRouting->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); @@ -361,8 +393,8 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, void Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface) { - NS_DEBUG("Ipv4L3Protocol::SetDefaultMulticastRoute (" << outputInterface << - ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << outputInterface << ")"); m_staticRouting->SetDefaultMulticastRoute (outputInterface); } @@ -370,14 +402,15 @@ Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface) uint32_t Ipv4L3Protocol::GetNMulticastRoutes (void) const { - NS_DEBUG("Ipv4L3Protocol::GetNMulticastRoutes ()"); + NS_LOG_FUNCTION; return m_staticRouting->GetNMulticastRoutes (); } Ipv4MulticastRoute * Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const { - NS_DEBUG("Ipv4L3Protocol::GetMulticastRoute (" << index << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); return m_staticRouting->GetMulticastRoute (index); } @@ -386,22 +419,25 @@ Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface) { - NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << origin << ", " << - group << ", " << inputInterface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface << + ")"); m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); } void Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) { - NS_DEBUG("Ipv4L3Protocol::RemoveMulticastRoute (" << index << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); m_staticRouting->RemoveMulticastRoute (index); } uint32_t Ipv4L3Protocol::AddInterface (Ptr device) { - NS_DEBUG("Ipv4L3Protocol::AddInterface (" << &device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ")"); Ptr interface = Create (m_node, device); return AddIpv4Interface (interface); } @@ -409,7 +445,8 @@ Ipv4L3Protocol::AddInterface (Ptr device) uint32_t Ipv4L3Protocol::AddIpv4Interface (Ptrinterface) { - NS_DEBUG("Ipv4L3Protocol::AddIpv4Interface (" << interface << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << interface << ")"); uint32_t index = m_nInterfaces; m_interfaces.push_back (interface); m_nInterfaces++; @@ -419,7 +456,8 @@ Ipv4L3Protocol::AddIpv4Interface (Ptrinterface) Ptr Ipv4L3Protocol::GetInterface (uint32_t index) const { - NS_DEBUG("Ipv4L3Protocol::GetInterface (" << index << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); uint32_t tmp = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -435,14 +473,15 @@ Ipv4L3Protocol::GetInterface (uint32_t index) const uint32_t Ipv4L3Protocol::GetNInterfaces (void) const { - NS_DEBUG("Ipv4L3Protocol::GetNInterface ()"); + NS_LOG_FUNCTION; return m_nInterfaces; } uint32_t Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const { - NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << addr << ")"); uint32_t ifIndex = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); @@ -463,8 +502,8 @@ Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const uint32_t Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const { - NS_DEBUG("Ipv4L3Protocol::FindInterfaceForAddr (" << addr << ", " << - mask << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << addr << ", " << mask << ")"); uint32_t ifIndex = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); @@ -485,7 +524,8 @@ Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const Ptr Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) { - NS_DEBUG("Ipv4L3Protocol::FindInterfaceForDevice (" << &device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ")"); for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { if ((*i)->GetDevice () == device) @@ -499,10 +539,11 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) void Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) { - NS_DEBUG("Ipv4L3Protocol::Receive (" << &device << ", " << &p << ", " << - protocol << ", " << from << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ", " << &p << ", " << protocol << ", " << + from << ")"); - NS_DEBUG("Ipv4L3Protocol::Receive (): Packet from " << from); + NS_LOG_LOGIC ("Packet from " << from); uint32_t index = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); @@ -530,6 +571,7 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc return; } + NS_LOG_LOGIC ("Forward up"); ForwardUp (packet, ipHeader); } @@ -540,8 +582,9 @@ Ipv4L3Protocol::Send (Packet const &packet, Ipv4Address destination, uint8_t protocol) { - NS_DEBUG("Ipv4L3Protocol::Send (" << &packet << ", " << source << ", " << - ", " << destination << ", " << protocol << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << ", " << + destination << ", " << protocol << ")"); Ipv4Header ipHeader; @@ -591,18 +634,18 @@ Ipv4L3Protocol::SendRealOut (bool found, Packet packet, Ipv4Header const &ipHeader) { - NS_DEBUG("Ipv4L3Protocol::SendRealOut (" << found << ", " << &route << - ", " << &packet << &ipHeader << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << found << ", " << &route << ", " << &packet << + &ipHeader << ")"); if (!found) { - NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): No route to host. Drop."); + NS_LOG_WARN ("No route to host. Drop."); m_dropTrace (packet); return; } - NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send via interface " << - route.GetInterface ()); + NS_LOG_LOGIC ("Send via interface " << route.GetInterface ()); packet.AddHeader (ipHeader); Ptr outInterface = GetInterface (route.GetInterface ()); @@ -610,14 +653,12 @@ Ipv4L3Protocol::SendRealOut (bool found, m_txTrace (packet, route.GetInterface ()); if (route.IsGateway ()) { - NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to gateway " << - route.GetGateway ()); + NS_LOG_LOGIC ("Send to gateway " << route.GetGateway ()); outInterface->Send (packet, route.GetGateway ()); } else { - NS_DEBUG ("Ipv4L3Protocol::SendRealOut (): Send to destination " << - ipHeader.GetDestination ()); + NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestination ()); outInterface->Send (packet, ipHeader.GetDestination ()); } } @@ -629,16 +670,16 @@ Ipv4L3Protocol::Forwarding ( Ipv4Header &ipHeader, Ptr device) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (" << ifIndex << ", " << &packet << - ", " << &ipHeader << ", " << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << ", " << &packet << ", " << &ipHeader << + ", " << device << ")"); for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { if ((*i)->GetAddress ().IsEqual (ipHeader.GetDestination ())) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "For me (destination match)"); + NS_LOG_LOGIC ("For me (destination match)"); return false; } } @@ -651,8 +692,7 @@ Ipv4L3Protocol::Forwarding ( { if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ())) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "For me (interface broadcast address)"); + NS_LOG_LOGIC ("For me (interface broadcast address)"); return false; } break; @@ -661,15 +701,13 @@ Ipv4L3Protocol::Forwarding ( if (ipHeader.GetDestination ().IsBroadcast ()) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "For me (Ipv4Addr broadcast address)"); + NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)"); return false; } if (ipHeader.GetDestination ().IsEqual (Ipv4Address::GetAny ())) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "For me (Ipv4Addr any address)"); + NS_LOG_LOGIC ("For me (Ipv4Addr any address)"); return false; } @@ -677,14 +715,13 @@ Ipv4L3Protocol::Forwarding ( { // Should send ttl expired here // XXX - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "Not for me (TTL expired). Drop"); + NS_LOG_LOGIC ("Not for me (TTL expired). Drop"); m_dropTrace (packet); return true; } ipHeader.SetTtl (ipHeader.GetTtl () - 1); - NS_DEBUG("Ipv4L3Protocol::Forwarding (): Forwarding packet."); + NS_LOG_LOGIC ("Forwarding packet."); Lookup (ifIndex, ipHeader, packet, MakeCallback (&Ipv4L3Protocol::SendRealOut, this)); // @@ -698,20 +735,21 @@ Ipv4L3Protocol::Forwarding ( if ((*i).first.IsEqual (ipHeader.GetSource ()) && (*i).second.IsEqual (ipHeader.GetDestination ())) { - NS_DEBUG("Ipv4L3Protocol::Forwarding (): " - "For me (Joined multicast group)"); + NS_LOG_LOGIC ("For me (Joined multicast group)"); return false; } } - NS_DEBUG("Ipv4L3Protocol::Forwarding (): Not for me."); + NS_LOG_LOGIC("Not for me."); return true; } void Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) { - NS_DEBUG("Ipv4L3Protocol::ForwardUp (" << &p << ", " << &ip << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << &ip << ")"); + Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); @@ -720,8 +758,8 @@ Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) void Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) { - NS_DEBUG("Ipv4L3Protocol::JoinMulticastGroup (" << origin << ", " << - group << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ")"); m_multicastGroups.push_back( std::pair (origin, group)); } @@ -729,8 +767,8 @@ Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) void Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) { - NS_DEBUG("Ipv4L3Protocol::LeaveMulticastGroup (" << origin << ", " << - group << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ")"); for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); i != m_multicastGroups.end (); @@ -747,7 +785,8 @@ Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) void Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) { - NS_DEBUG("Ipv4L3Protocol::SetAddress (" << i << ", " << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ", " << address << ")"); Ptr interface = GetInterface (i); interface->SetAddress (address); } @@ -755,7 +794,8 @@ Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) void Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) { - NS_DEBUG("Ipv4L3Protocol::SetNetworkMask (" << i << ", " << mask << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ", " << mask << ")"); Ptr interface = GetInterface (i); interface->SetNetworkMask (mask); } @@ -763,7 +803,8 @@ Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) Ipv4Mask Ipv4L3Protocol::GetNetworkMask (uint32_t i) const { - NS_DEBUG("Ipv4L3Protocol::GetNetworkMask (" << i << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); Ptr interface = GetInterface (i); return interface->GetNetworkMask (); } @@ -771,7 +812,8 @@ Ipv4L3Protocol::GetNetworkMask (uint32_t i) const Ipv4Address Ipv4L3Protocol::GetAddress (uint32_t i) const { - NS_DEBUG("Ipv4L3Protocol::GetAddress (" << i << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); Ptr interface = GetInterface (i); return interface->GetAddress (); } @@ -780,8 +822,8 @@ bool Ipv4L3Protocol::GetIfIndexForDestination ( Ipv4Address destination, uint32_t& ifIndex) const { - NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (" << destination << - ", " << &ifIndex << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")"); // // The first thing we do in trying to determine a source address is to // consult the routing protocols. These will also check for a default route @@ -791,13 +833,12 @@ Ipv4L3Protocol::GetIfIndexForDestination ( i != m_routingProtocols.end (); i++) { - NS_DEBUG("Ipv4L3Protocol::Lookup (): Requesting Source Address"); + NS_LOG_LOGIC ("Requesting Source Address"); uint32_t ifIndexTmp; if ((*i).second->RequestIfIndex (destination, ifIndexTmp)) { - NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " - "Found ifIndex " << ifIndexTmp); + NS_LOG_LOGIC ("Found ifIndex " << ifIndexTmp); ifIndex = ifIndexTmp; return true; } @@ -813,8 +854,7 @@ Ipv4L3Protocol::GetIfIndexForDestination ( // if (GetNInterfaces () == 2) { - NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " - "One Interface. Using interface 1."); + NS_LOG_LOGIC ("One Interface. Using interface 1."); ifIndex = 1; return true; } @@ -833,8 +873,7 @@ Ipv4L3Protocol::GetIfIndexForDestination ( // set to the IP address of the interface set in the default unicast route. // Also, in the case of a broadcast, the same will be true. // - NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " - "Using default unicast route"); + NS_LOG_LOGIC ("Using default unicast route"); Ipv4Route *route = m_staticRouting->GetDefaultRoute (); NS_ASSERT_MSG(route, @@ -843,15 +882,15 @@ Ipv4L3Protocol::GetIfIndexForDestination ( ifIndex = route->GetInterface (); - NS_DEBUG("Ipv4L3Protocol::GetIfIndexForDestination (): " - "Default route specifies interface " << ifIndex); + NS_LOG_LOGIC ("Default route specifies interface " << ifIndex); return true; } uint16_t Ipv4L3Protocol::GetMtu (uint32_t i) const { - NS_DEBUG("Ipv4L3Protocol::GetMtu (" << i << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); Ptr interface = GetInterface (i); return interface->GetMtu (); } @@ -859,7 +898,8 @@ Ipv4L3Protocol::GetMtu (uint32_t i) const bool Ipv4L3Protocol::IsUp (uint32_t i) const { - NS_DEBUG("Ipv4L3Protocol::IsUp (" << i << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); Ptr interface = GetInterface (i); return interface->IsUp (); } @@ -867,7 +907,8 @@ Ipv4L3Protocol::IsUp (uint32_t i) const void Ipv4L3Protocol::SetUp (uint32_t i) { - NS_DEBUG("Ipv4L3Protocol::SetUp (" << i << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); Ptr interface = GetInterface (i); interface->SetUp (); @@ -885,7 +926,8 @@ Ipv4L3Protocol::SetUp (uint32_t i) void Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) { - NS_DEBUG("Ipv4L3Protocol::SetDown (" << ifaceIndex << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifaceIndex << ")"); Ptr interface = GetInterface (ifaceIndex); interface->SetDown (); @@ -907,5 +949,4 @@ Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) } } - }//namespace ns3 diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index ae158a9fe..eb59a662d 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -20,14 +20,14 @@ * Mathieu Lacage , */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/net-device.h" #include "ns3/node.h" #include "ns3/mac48-address.h" #include "ipv4-loopback-interface.h" #include "ipv4-l3-protocol.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); +NS_LOG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); namespace ns3 { @@ -35,19 +35,19 @@ Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) : Ipv4Interface (0), m_node (node) { - NS_DEBUG("Ipv4LoopbackInterface::Ipv4LoopbackInterface ()"); + NS_LOG_FUNCTION; } Ipv4LoopbackInterface::~Ipv4LoopbackInterface () { - NS_DEBUG("Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()"); + NS_LOG_FUNCTION; } void Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) { - NS_DEBUG("Ipv4LoopbackInterface::SendTo (" << &packet << ", " << - dest << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << dest << ")"); Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index c181dde29..6b7d8671d 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -19,17 +19,18 @@ // Author: George F. Riley // Gustavo Carneiro -#include "ns3/debug.h" +#include "ns3/log.h" #include "ipv4-static-routing.h" #include "ns3/packet.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4StaticRouting"); +NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting"); namespace ns3 { Ipv4StaticRouting::Ipv4StaticRouting () : m_defaultRoute (0), m_defaultMulticastRoute (0) { + NS_LOG_FUNCTION; } void @@ -37,7 +38,7 @@ Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { - + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface); m_hostRoutes.push_back (route); @@ -47,6 +48,7 @@ void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateHostRouteTo (dest, interface); m_hostRoutes.push_back (route); @@ -58,6 +60,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateNetworkRouteTo (network, networkMask, @@ -71,6 +74,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateNetworkRouteTo (network, networkMask, @@ -82,6 +86,7 @@ void Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateDefaultRoute (nextHop, interface); delete m_defaultRoute; @@ -94,6 +99,7 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, uint32_t inputInterface, std::vector outputInterfaces) { + NS_LOG_FUNCTION; Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, inputInterface, outputInterfaces); @@ -103,6 +109,7 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, void Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) { + NS_LOG_FUNCTION; Ipv4Address origin = Ipv4Address::GetAny (); Ipv4Address group = Ipv4Address::GetAny (); uint32_t inputInterface = Ipv4RoutingProtocol::IF_INDEX_ANY; @@ -121,12 +128,14 @@ Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) uint32_t Ipv4StaticRouting::GetNMulticastRoutes (void) const { + NS_LOG_FUNCTION; return m_multicastRoutes.size () + m_defaultMulticastRoute ? 1 : 0; } Ipv4MulticastRoute * Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const { + NS_LOG_FUNCTION; NS_ASSERT_MSG(index < m_multicastRoutes.size (), "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); // @@ -174,6 +183,7 @@ Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const Ipv4MulticastRoute * Ipv4StaticRouting::GetDefaultMulticastRoute () const { + NS_LOG_FUNCTION; if (m_defaultMulticastRoute != 0) { return m_defaultMulticastRoute; @@ -186,9 +196,7 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, Ipv4Address group, uint32_t inputInterface) { -// -// This method does not attempt to delete the multicast route. -// + NS_LOG_FUNCTION; for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) @@ -209,6 +217,7 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, void Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) { + NS_LOG_FUNCTION; // // From an external point of view the default route appears to be in slot 0 // of the routing table. The implementation, however, puts it in a separate @@ -253,6 +262,7 @@ Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) Ipv4Route * Ipv4StaticRouting::LookupStatic (Ipv4Address dest) { + NS_LOG_FUNCTION; for (HostRoutesCI i = m_hostRoutes.begin (); i != m_hostRoutes.end (); i++) @@ -289,6 +299,7 @@ Ipv4StaticRouting::LookupStatic ( Ipv4Address group, uint32_t ifIndex) { + NS_LOG_FUNCTION; // // We treat the "any" address (typically 0.0.0.0) as a wildcard in our matching // scheme. @@ -390,6 +401,7 @@ Ipv4StaticRouting::LookupStatic ( uint32_t Ipv4StaticRouting::GetNRoutes (void) { + NS_LOG_FUNCTION; uint32_t n = 0; if (m_defaultRoute != 0) { @@ -403,6 +415,7 @@ Ipv4StaticRouting::GetNRoutes (void) Ipv4Route * Ipv4StaticRouting::GetDefaultRoute () { + NS_LOG_FUNCTION; if (m_defaultRoute != 0) { return m_defaultRoute; @@ -416,6 +429,7 @@ Ipv4StaticRouting::GetDefaultRoute () Ipv4Route * Ipv4StaticRouting::GetRoute (uint32_t index) { + NS_LOG_FUNCTION; if (index == 0 && m_defaultRoute != 0) { return m_defaultRoute; @@ -457,6 +471,7 @@ Ipv4StaticRouting::GetRoute (uint32_t index) void Ipv4StaticRouting::RemoveRoute (uint32_t index) { + NS_LOG_FUNCTION; if (index == 0 && m_defaultRoute != 0) { delete m_defaultRoute; @@ -506,26 +521,24 @@ Ipv4StaticRouting::RequestRoute ( Packet packet, RouteReplyCallback routeReply) { - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (" << &ipHeader << ", " << - &packet << ", " << &routeReply << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << &ipHeader << ", " << &packet << ", " << + &routeReply << ")"); - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): source = " << - ipHeader.GetSource ()); + NS_LOG_LOGIC ("source = " << ipHeader.GetSource ()); - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): destination = " << - ipHeader.GetDestination ()); + NS_LOG_LOGIC ("destination = " << ipHeader.GetDestination ()); if (ipHeader.GetDestination ().IsMulticast ()) { - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Multicast destination"); + NS_LOG_LOGIC ("Multicast destination"); Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), ipHeader.GetDestination (), ifIndex); if (mRoute) { - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " - "Multicast route found"); + NS_LOG_LOGIC ("Multicast route found"); for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) { @@ -534,8 +547,8 @@ Ipv4StaticRouting::RequestRoute ( Ipv4Route route = Ipv4Route::CreateHostRouteTo(h.GetDestination (), mRoute->GetOutputInterface(i)); - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): " - "Send via interface " << mRoute->GetOutputInterface(i)); + NS_LOG_LOGIC ( "Send via interface " << + mRoute->GetOutputInterface(i)); routeReply (true, route, p, h); } return true; @@ -545,7 +558,7 @@ Ipv4StaticRouting::RequestRoute ( // // This is a unicast packet. Check to see if we have a route for it. // - NS_DEBUG ("Ipv4StaticRouting::RequestRoute (): Unicast destination"); + NS_LOG_LOGIC ("Unicast destination"); Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); if (route != 0) { @@ -562,34 +575,31 @@ Ipv4StaticRouting::RequestRoute ( bool Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) { - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (" << destination << ", " << - &ifIndex << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")"); // // First, see if this is a multicast packet we have a route for. If we // have a route, then send the packet down each of the specified interfaces. // if (destination.IsMulticast ()) { - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Multicast destination"); + NS_LOG_LOGIC ("Multicast destination"); Ipv4MulticastRoute *mRoute = LookupStatic(Ipv4Address::GetAny (), destination, Ipv4RoutingProtocol::IF_INDEX_ANY); if (mRoute) { - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " - "Multicast route found"); + NS_LOG_LOGIC ("Multicast route found"); if (mRoute->GetNOutputInterfaces () != 1) { - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " - "Route is to multiple interfaces. Ignoring."); + NS_LOG_LOGIC ("Route is to multiple interfaces. Ignoring."); return false; } ifIndex = mRoute->GetOutputInterface(0); - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): " - "Found ifIndex " << ifIndex); + NS_LOG_LOGIC ("Found ifIndex " << ifIndex); return true; } return false; // Let other routing protocols try to handle this @@ -597,7 +607,7 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) // // See if this is a unicast packet we have a route for. // - NS_DEBUG ("Ipv4StaticRouting::RequestIfIndex (): Unicast destination"); + NS_LOG_LOGIC ("Unicast destination"); Ipv4Route *route = LookupStatic (destination); if (route) { @@ -613,6 +623,7 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) void Ipv4StaticRouting::DoDispose (void) { + NS_LOG_FUNCTION; for (HostRoutesI i = m_hostRoutes.begin (); i != m_hostRoutes.end (); i = m_hostRoutes.erase (i)) diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index adf462f05..8d7bd395f 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/packet.h" #include "ns3/node.h" @@ -31,7 +31,7 @@ #include "ipv4-l3-protocol.h" #include "udp-socket.h" -NS_DEBUG_COMPONENT_DEFINE ("UdpL4Protocol"); +NS_LOG_COMPONENT_DEFINE ("UdpL4Protocol"); namespace ns3 { @@ -43,18 +43,18 @@ UdpL4Protocol::UdpL4Protocol (Ptr node) m_node (node), m_endPoints (new Ipv4EndPointDemux ()) { - NS_DEBUG("UdpL4Protocol::UdpL4Protocol ()"); + NS_LOG_FUNCTION; } UdpL4Protocol::~UdpL4Protocol () { - NS_DEBUG("UdpL4Protocol::~UdpL4Protocol ()"); + NS_LOG_FUNCTION; } void UdpL4Protocol::DoDispose (void) { - NS_DEBUG("UdpL4Protocol::DoDispose ()"); + NS_LOG_FUNCTION; if (m_endPoints != 0) { delete m_endPoints; @@ -67,7 +67,7 @@ UdpL4Protocol::DoDispose (void) Ptr UdpL4Protocol::CreateSocket (void) { - NS_DEBUG("UdpL4Protocol::CreateSocket ()"); + NS_LOG_FUNCTION; Ptr socket = Create (m_node, this); return socket; } @@ -75,36 +75,40 @@ UdpL4Protocol::CreateSocket (void) Ipv4EndPoint * UdpL4Protocol::Allocate (void) { - NS_DEBUG("UdpL4Protocol::Allocate ()"); + NS_LOG_FUNCTION; return m_endPoints->Allocate (); } Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address) { - NS_DEBUG("UdpL4Protocol::Allocate (" << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ")"); return m_endPoints->Allocate (address); } Ipv4EndPoint * UdpL4Protocol::Allocate (uint16_t port) { - NS_DEBUG("UdpL4Protocol::Allocate (" << port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << port << ")"); return m_endPoints->Allocate (port); } Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address, uint16_t port) { - NS_DEBUG("UdpL4Protocol::Allocate (" << address << ", " << port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ", " << port << ")"); return m_endPoints->Allocate (address, port); } Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) { - NS_DEBUG("UdpL4Protocol::Allocate (" << localAddress << ", " << localPort << - ", " << peerAddress << ", " << peerPort << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << localAddress << ", " << localPort << ", " << + peerAddress << ", " << peerPort << ")"); return m_endPoints->Allocate (localAddress, localPort, peerAddress, peerPort); } @@ -112,7 +116,8 @@ UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, void UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) { - NS_DEBUG("UdpL4Protocol::Deallocate (" << endPoint << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << endPoint << ")"); m_endPoints->DeAllocate (endPoint); } @@ -121,8 +126,9 @@ UdpL4Protocol::Receive(Packet& packet, Ipv4Address const &source, Ipv4Address const &destination) { - NS_DEBUG("UdpL4Protocol::Receive (" << &packet << ", " << source << - ", " << destination << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << destination << + ")"); UdpHeader udpHeader; packet.RemoveHeader (udpHeader); @@ -141,8 +147,9 @@ UdpL4Protocol::Send (Packet packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) { - NS_DEBUG("UdpL4Protocol::Send (" << &packet << ", " << saddr << - ", " << daddr << ", " << sport << ", " << dport << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << saddr << ", " << daddr << ", " << + sport << ", " << dport << ")"); UdpHeader udpHeader; udpHeader.SetDestination (dport); @@ -157,7 +164,7 @@ UdpL4Protocol::Send (Packet packet, Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); if (ipv4 != 0) { - NS_DEBUG("UdpL4Protocol::Send (): Sending to IP"); + NS_LOG_LOGIC ("Sending to IP"); ipv4->Send (packet, saddr, daddr, PROT_NUMBER); } } diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 6f123bed5..9212614fa 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4-route.h" @@ -30,7 +30,7 @@ #include "ipv4-l4-demux.h" #include "ns3/ipv4.h" -NS_DEBUG_COMPONENT_DEFINE ("UdpSocket"); +NS_LOG_COMPONENT_DEFINE ("UdpSocket"); namespace ns3 { @@ -43,12 +43,12 @@ UdpSocket::UdpSocket (Ptr node, Ptr udp) m_shutdownRecv (false), m_connected (false) { - NS_DEBUG("UdpSocket::UdpSocket ()"); + NS_LOG_FUNCTION; } UdpSocket::~UdpSocket () { - NS_DEBUG("UdpSocket::~UdpSocket ()"); + NS_LOG_FUNCTION; m_node = 0; if (m_endPoint != 0) @@ -72,22 +72,21 @@ UdpSocket::~UdpSocket () enum Socket::SocketErrno UdpSocket::GetErrno (void) const { - NS_DEBUG("UdpSocket::GetErrno ()"); - + NS_LOG_FUNCTION; return m_errno; } Ptr UdpSocket::GetNode (void) const { - NS_DEBUG("UdpSocket::GetNode ()"); + NS_LOG_FUNCTION; return m_node; } void UdpSocket::Destroy (void) { - NS_DEBUG("UdpSocket::Destroy ()"); + NS_LOG_FUNCTION; m_node = 0; m_endPoint = 0; m_udp = 0; @@ -96,8 +95,7 @@ UdpSocket::Destroy (void) int UdpSocket::FinishBind (void) { - NS_DEBUG("UdpSocket::FinishBind ()"); - + NS_LOG_FUNCTION; if (m_endPoint == 0) { return -1; @@ -110,8 +108,7 @@ UdpSocket::FinishBind (void) int UdpSocket::Bind (void) { - NS_DEBUG("UdpSocket::Bind ()"); - + NS_LOG_FUNCTION; m_endPoint = m_udp->Allocate (); return FinishBind (); } @@ -119,11 +116,12 @@ UdpSocket::Bind (void) int UdpSocket::Bind (const Address &address) { - NS_DEBUG("UdpSocket::Bind (" << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM("(" << address << ")"); if (!InetSocketAddress::IsMatchingType (address)) { - NS_DEBUG("UdpSocket::Bind (): Not IsMatchingType"); + NS_LOG_ERROR ("Not IsMatchingType"); return ERROR_INVAL; } InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -152,7 +150,7 @@ UdpSocket::Bind (const Address &address) int UdpSocket::ShutdownSend (void) { - NS_DEBUG("UdpSocket::ShutDownSend ()"); + NS_LOG_FUNCTION; m_shutdownSend = true; return 0; } @@ -160,7 +158,7 @@ UdpSocket::ShutdownSend (void) int UdpSocket::ShutdownRecv (void) { - NS_DEBUG("UdpSocket::ShutDownRecv ()"); + NS_LOG_FUNCTION; m_shutdownRecv = false; return 0; } @@ -168,7 +166,7 @@ UdpSocket::ShutdownRecv (void) int UdpSocket::Close(void) { - NS_DEBUG("UdpSocket::Close ()"); + NS_LOG_FUNCTION; NotifyCloseCompleted (); return 0; } @@ -176,7 +174,8 @@ UdpSocket::Close(void) int UdpSocket::Connect(const Address & address) { - NS_DEBUG ("UdpSocket::Connect (" << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ")"); Ipv4Route routeToDest; InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); @@ -184,7 +183,7 @@ UdpSocket::Connect(const Address & address) NotifyConnectionSucceeded (); m_connected = true; - NS_DEBUG ("UdpSocket::Connect (): Updating local address"); + NS_LOG_LOGIC ("Updating local address"); uint32_t localIfIndex; @@ -195,8 +194,7 @@ UdpSocket::Connect(const Address & address) m_endPoint->SetLocalAddress (ipv4->GetAddress(localIfIndex)); } - NS_DEBUG ("UdpSocket::Connect (): Local address is " << - m_endPoint->GetLocalAddress()); + NS_LOG_LOGIC ("Local address is " << m_endPoint->GetLocalAddress()); return 0; } @@ -204,7 +202,8 @@ UdpSocket::Connect(const Address & address) int UdpSocket::Send (const Packet &p) { - NS_DEBUG("UdpSocket::Send (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (!m_connected) { @@ -217,6 +216,7 @@ UdpSocket::Send (const Packet &p) int UdpSocket::DoSend (const Packet &p) { + NS_LOG_FUNCTION; if (m_endPoint == 0) { if (Bind () == -1) @@ -238,11 +238,12 @@ UdpSocket::DoSend (const Packet &p) int UdpSocket::DoSendTo (const Packet &p, const Address &address) { - NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << address << ")"); if (!m_connected) { - NS_DEBUG("UdpSocket::DoSendTo (): Not connected"); + NS_LOG_LOGIC ("Not connected"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); @@ -251,7 +252,7 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) else { // connected UDP socket must use default addresses - NS_DEBUG("UdpSocket::DoSendTo (): Connected"); + NS_LOG_LOGIC ("Connected"); return DoSendTo (p, m_defaultAddress, m_defaultPort); } } @@ -259,8 +260,8 @@ UdpSocket::DoSendTo (const Packet &p, const Address &address) int UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) { - NS_DEBUG("UdpSocket::DoSendTo (" << &p << ", " << dest << ", " << - port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << dest << ", " << port << ")"); Ipv4Route routeToDest; @@ -288,7 +289,7 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) // if (dest.IsBroadcast ()) { - NS_DEBUG("UdpSocket::DoSendTo (): Limited broadcast"); + NS_LOG_LOGIC ("Limited broadcast"); for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) { Ipv4Address addri = ipv4->GetAddress (i); @@ -300,7 +301,7 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) } else if (ipv4->GetIfIndexForDestination(dest, localIfIndex)) { - NS_DEBUG("UdpSocket::DoSendTo (): Route exists"); + NS_LOG_LOGIC ("Route exists"); m_udp->Send (p, ipv4->GetAddress (localIfIndex), dest, m_endPoint->GetLocalPort (), port); NotifyDataSent (p.GetSize ()); @@ -308,7 +309,7 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) } else { - NS_DEBUG("UdpSocket::DoSendTo (): ERROR_NOROUTETOHOST"); + NS_LOG_ERROR ("ERROR_NOROUTETOHOST"); m_errno = ERROR_NOROUTETOHOST; return -1; } @@ -319,7 +320,8 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) int UdpSocket::SendTo(const Address &address, const Packet &p) { - NS_DEBUG("UdpSocket::SendTo (" << address << ", " << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ", " << &p << ")"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); @@ -329,8 +331,8 @@ UdpSocket::SendTo(const Address &address, const Packet &p) void UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) { - NS_DEBUG("UdpSocket::ForwardUp (" << &packet << ", " << ipv4 << ", " << - port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << ipv4 << ", " << port << ")"); if (m_shutdownRecv) { From 611d0d35f17a5c08d38d3843a90301b3bec99da9 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 21:36:32 -0700 Subject: [PATCH 190/218] debug to log --- src/internet-node/arp-ipv4-interface.cc | 25 +-- src/internet-node/arp-l3-protocol.cc | 45 +++-- src/node/channel.cc | 18 +- src/node/drop-tail-queue.cc | 33 ++-- src/node/ethernet-header.cc | 4 +- src/node/ethernet-trailer.cc | 8 +- src/node/ipv4-address.cc | 6 +- src/node/net-device.cc | 46 ++++- src/node/packet-socket.cc | 31 +++- src/node/queue.cc | 87 ++++++---- src/node/socket.cc | 43 ++--- src/routing/global-routing/candidate-queue.cc | 34 ++-- .../global-route-manager-impl.cc | 163 +++++++++--------- .../global-routing/global-route-manager.cc | 5 +- .../global-routing/global-router-interface.cc | 117 ++++++++----- 15 files changed, 378 insertions(+), 287 deletions(-) diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index ed8ef584c..8d80c5711 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -21,7 +21,7 @@ */ #include "ns3/packet.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" #include "ns3/node.h" #include "ns3/net-device.h" @@ -31,7 +31,7 @@ #include "ipv4-l3-protocol.h" #include "arp-l3-protocol.h" -NS_DEBUG_COMPONENT_DEFINE ("ArpIpv4Interface"); +NS_LOG_COMPONENT_DEFINE ("ArpIpv4Interface"); namespace ns3 { @@ -39,18 +39,18 @@ ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) : Ipv4Interface (device), m_node (node) { - NS_DEBUG ("ArpIpv4Interface::ArpIpv4Interface ()"); + NS_LOG_FUNCTION; } ArpIpv4Interface::~ArpIpv4Interface () { - NS_DEBUG ("ArpIpv4Interface::~ArpIpv4Interface ()"); + NS_LOG_FUNCTION; } Ptr ArpIpv4Interface::GetTraceResolver (void) const { - NS_DEBUG ("ArpIpv4Interface::DoCreateTraceResolver ()"); + NS_LOG_FUNCTION; Ptr resolver = Create (); if (GetDevice () != 0) { @@ -63,12 +63,13 @@ ArpIpv4Interface::GetTraceResolver (void) const void ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) { - NS_DEBUG ("ArpIpv4Interface::SendTo (" << &p << ", " << dest << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << dest << ")"); NS_ASSERT (GetDevice () != 0); if (GetDevice ()->NeedsArp ()) { - NS_DEBUG ("ArpIpv4Interface::SendTo (): Needs ARP"); + NS_LOG_LOGIC ("Needs ARP"); Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); Address hardwareDestination; @@ -77,13 +78,13 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) if (dest.IsBroadcast () || dest.IsSubnetDirectedBroadcast (GetNetworkMask ()) ) { - NS_DEBUG ("ArpIpv4Interface::SendTo (): IsBroadcast"); + NS_LOG_LOGIC ("IsBroadcast"); hardwareDestination = GetDevice ()->GetBroadcast (); found = true; } else if (dest.IsMulticast ()) { - NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast"); + NS_LOG_LOGIC ("IsMulticast"); NS_ASSERT_MSG(GetDevice ()->IsMulticast (), "ArpIpv4Interface::SendTo (): Sending multicast packet over " "non-multicast device"); @@ -93,20 +94,20 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) } else { - NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup"); + NS_LOG_LOGIC ("ARP Lookup"); found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination); } if (found) { - NS_DEBUG ("ArpIpv4Interface::SendTo (): Address Resolved. Send."); + NS_LOG_LOGIC ("Address Resolved. Send."); GetDevice ()->Send (p, hardwareDestination, Ipv4L3Protocol::PROT_NUMBER); } } else { - NS_DEBUG ("ArpIpv4Interface::SendTo (): Doesn't need ARP"); + NS_LOG_LOGIC ("Doesn't need ARP"); GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4L3Protocol::PROT_NUMBER); } diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index bcc62bfe2..e32e07fde 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "ns3/packet.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node.h" #include "ns3/net-device.h" @@ -29,7 +29,7 @@ #include "arp-cache.h" #include "ipv4-interface.h" -NS_DEBUG_COMPONENT_DEFINE ("ArpL3Protocol"); +NS_LOG_COMPONENT_DEFINE ("ArpL3Protocol"); namespace ns3 { @@ -39,15 +39,19 @@ const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806; ArpL3Protocol::ArpL3Protocol (Ptr node) : m_node (node) { + NS_LOG_FUNCTION; SetInterfaceId (ArpL3Protocol::iid); } ArpL3Protocol::~ArpL3Protocol () -{} +{ + NS_LOG_FUNCTION; +} void ArpL3Protocol::DoDispose (void) { + NS_LOG_FUNCTION; for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++) { delete *i; @@ -60,6 +64,7 @@ ArpL3Protocol::DoDispose (void) ArpCache * ArpL3Protocol::FindCache (Ptr device) { + NS_LOG_FUNCTION; for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++) { if ((*i)->GetDevice () == device) @@ -79,12 +84,13 @@ ArpL3Protocol::FindCache (Ptr device) void ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from) { + NS_LOG_FUNCTION; ArpCache *cache = FindCache (device); ArpHeader arp; Packet packet = p; packet.RemoveHeader (arp); - NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << + NS_LOG_LOGIC ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << " node="<GetId ()<<", got request from " << arp.GetSourceIpv4Address () << " for address " << arp.GetDestinationIpv4Address () << "; we have address " << @@ -93,7 +99,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol if (arp.IsRequest () && arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ()) { - NS_DEBUG ("node="<GetId () <<", got request from " << + NS_LOG_LOGIC ("node="<GetId () <<", got request from " << arp.GetSourceIpv4Address () << " -- send reply"); SendArpReply (cache, arp.GetSourceIpv4Address (), arp.GetSourceHardwareAddress ()); @@ -108,7 +114,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol { if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<<", got reply from " << + NS_LOG_LOGIC ("node="<GetId ()<<", got reply from " << arp.GetSourceIpv4Address () << " for waiting entry -- flush"); Address from_mac = arp.GetSourceHardwareAddress (); @@ -119,7 +125,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol { // ignore this reply which might well be an attempt // at poisening my arp cache. - NS_DEBUG ("node="<GetId ()<<", got reply from " << + NS_LOG_LOGIC("node="<GetId ()<<", got reply from " << arp.GetSourceIpv4Address () << " for non-waiting entry -- drop"); // XXX report packet as dropped. @@ -127,13 +133,13 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol } else { - NS_DEBUG ("node="<GetId ()<<", got reply for unknown entry -- drop"); + NS_LOG_LOGIC ("node="<GetId ()<<", got reply for unknown entry -- drop"); // XXX report packet as dropped. } } else { - NS_DEBUG ("node="<GetId ()<<", got request from " << + NS_LOG_LOGIC ("node="<GetId ()<<", got request from " << arp.GetSourceIpv4Address () << " for unknown address " << arp.GetDestinationIpv4Address () << " -- drop"); } @@ -143,6 +149,7 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, Ptr device, Address *hardwareDestination) { + NS_LOG_FUNCTION; ArpCache *cache = FindCache (device); ArpCache::Entry *entry = cache->Lookup (destination); if (entry != 0) @@ -151,21 +158,21 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, { if (entry->IsDead ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", dead entry for " << destination << " expired -- send arp request"); entry->MarkWaitReply (packet); SendArpRequest (cache, destination); } else if (entry->IsAlive ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", alive entry for " << destination << " expired -- send arp request"); entry->MarkWaitReply (packet); SendArpRequest (cache, destination); } else if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", wait reply for " << destination << " expired -- drop"); entry->MarkDead (); // XXX report packet as 'dropped' @@ -175,20 +182,20 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, { if (entry->IsDead ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", dead entry for " << destination << " valid -- drop"); // XXX report packet as 'dropped' } else if (entry->IsAlive ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", alive entry for " << destination << " valid -- send"); *hardwareDestination = entry->GetMacAddress (); return true; } else if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", wait reply for " << destination << " valid -- drop previous"); Packet old = entry->UpdateWaitReply (packet); // XXX report 'old' packet as 'dropped' @@ -199,7 +206,7 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, else { // This is our first attempt to transmit data to this destination. - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", no entry for " << destination << " -- send arp request"); entry = cache->Add (destination); entry->MarkWaitReply (packet); @@ -211,8 +218,9 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, void ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to) { + NS_LOG_FUNCTION; ArpHeader arp; - NS_DEBUG ("ARP: sending request from node "<GetId ()<< + NS_LOG_LOGIC ("ARP: sending request from node "<GetId ()<< " || src: " << cache->GetDevice ()->GetAddress () << " / " << cache->GetInterface ()->GetAddress () << " || dst: " << cache->GetDevice ()->GetBroadcast () << @@ -229,8 +237,9 @@ ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to) void ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac) { + NS_LOG_FUNCTION; ArpHeader arp; - NS_DEBUG ("ARP: sending reply from node "<GetId ()<< + NS_LOG_LOGIC ("ARP: sending reply from node "<GetId ()<< "|| src: " << cache->GetDevice ()->GetAddress () << " / " << cache->GetInterface ()->GetAddress () << " || dst: " << toMac << " / " << toIp); diff --git a/src/node/channel.cc b/src/node/channel.cc index 25db07984..e809b6dbc 100644 --- a/src/node/channel.cc +++ b/src/node/channel.cc @@ -14,16 +14,12 @@ * 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: Craig Dowell - * - * Thu Feb 15 14:50:46 PST 2007 craigdo: Created. */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "channel.h" -NS_DEBUG_COMPONENT_DEFINE ("Channel"); +NS_LOG_COMPONENT_DEFINE ("Channel"); namespace ns3 { @@ -32,31 +28,35 @@ const InterfaceId Channel::iid = MakeInterfaceId ("Channel", Object::iid); Channel::Channel () : m_name("Channel") { + NS_LOG_FUNCTION; SetInterfaceId (Channel::iid); - NS_DEBUG("Channel::Channel ()"); } Channel::Channel (std::string name) : m_name(name) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ")"); SetInterfaceId (Channel::iid); - NS_DEBUG("Channel::Channel (" << name << ")"); } Channel::~Channel () { - NS_DEBUG("Channel::~Channel ()"); + NS_LOG_FUNCTION; } void Channel::SetName(std::string name) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ")"); m_name = name; } std::string Channel::GetName(void) { + NS_LOG_FUNCTION; return m_name; } diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 74c8fde17..8b5ceea79 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -17,10 +17,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "drop-tail-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("DropTailQueue"); +NS_LOG_COMPONENT_DEFINE ("DropTailQueue"); namespace ns3 { @@ -33,38 +33,39 @@ DropTailQueue::DropTailQueue () : m_packets (), m_maxPackets(DTQ_NPACKETS_MAX_DEFAULT) { - NS_DEBUG("DropTailQueue::DropTailQueue ()"); + NS_LOG_FUNCTION; } DropTailQueue::~DropTailQueue () { - NS_DEBUG("DropTailQueue::~DropTailQueue ()"); + NS_LOG_FUNCTION; } void DropTailQueue::SetMaxPackets (uint32_t npackets) { - NS_DEBUG("DropTailQueue::SetMaxPackets (" << npackets << ")"); - + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << npackets << ")"); m_maxPackets = npackets; } uint32_t DropTailQueue::GetMaxPackets (void) { - NS_DEBUG("DropTailQueue::GetMaxPackets () <= " << m_maxPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_maxPackets); return m_maxPackets; } bool DropTailQueue::DoEnqueue (const Packet& p) { - NS_DEBUG("DropTailQueue::DoEnqueue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.size () >= m_maxPackets) { - NS_DEBUG("DropTailQueue::DoEnqueue (): Queue full -- droppping pkt"); + NS_LOG_LOGIC ("Queue full -- droppping pkt"); Drop (p); return false; } @@ -76,18 +77,19 @@ DropTailQueue::DoEnqueue (const Packet& p) bool DropTailQueue::DoDequeue (Packet& p) { - NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.empty()) { - NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty"); + NS_LOG_LOGIC ("Queue empty"); return false; } p = m_packets.front (); m_packets.pop (); - NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true"); + NS_LOG_LOGIC ("Popped " << &p); return true; } @@ -95,11 +97,12 @@ DropTailQueue::DoDequeue (Packet& p) bool DropTailQueue::DoPeek (Packet& p) { - NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.empty()) { - NS_DEBUG("DropTailQueue::DoPeek (): Queue empty"); + NS_LOG_LOGIC ("Queue empty"); return false; } diff --git a/src/node/ethernet-header.cc b/src/node/ethernet-header.cc index 7a4671012..ce2241f50 100644 --- a/src/node/ethernet-header.cc +++ b/src/node/ethernet-header.cc @@ -22,12 +22,12 @@ #include #include #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/header.h" #include "ethernet-header.h" #include "address-utils.h" -NS_DEBUG_COMPONENT_DEFINE ("EthernetHeader"); +NS_LOG_COMPONENT_DEFINE ("EthernetHeader"); namespace ns3 { diff --git a/src/node/ethernet-trailer.cc b/src/node/ethernet-trailer.cc index 6fdb5a845..049fe24d0 100644 --- a/src/node/ethernet-trailer.cc +++ b/src/node/ethernet-trailer.cc @@ -20,11 +20,11 @@ */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/trailer.h" #include "ethernet-trailer.h" -NS_DEBUG_COMPONENT_DEFINE ("EthernetTrailer"); +NS_LOG_COMPONENT_DEFINE ("EthernetTrailer"); namespace ns3 { @@ -62,7 +62,7 @@ EthernetTrailer::CheckFcs (const Packet& p) const { return true; } else { - NS_DEBUG("FCS calculation is not yet enabled" << std::endl); + NS_LOG_WARN ("FCS calculation is not yet enabled"); return false; } } @@ -70,7 +70,7 @@ EthernetTrailer::CheckFcs (const Packet& p) const void EthernetTrailer::CalcFcs (const Packet& p) { - NS_DEBUG("FCS calculation is not yet enabled" << std::endl); + NS_LOG_WARN ("FCS calculation is not yet enabled"); } void diff --git a/src/node/ipv4-address.cc b/src/node/ipv4-address.cc index 0b0a48f29..b36892c50 100644 --- a/src/node/ipv4-address.cc +++ b/src/node/ipv4-address.cc @@ -18,12 +18,12 @@ * * Author: Mathieu Lacage */ -#include "ns3/debug.h" + +#include "ns3/log.h" #include "ipv4-address.h" #include "ns3/assert.h" -NS_DEBUG_COMPONENT_DEFINE("Ipv4Address"); - +NS_LOG_COMPONENT_DEFINE("Ipv4Address"); namespace ns3 { diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 0e8223f60..888243c0f 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -22,15 +22,13 @@ #include #include "ns3/assert.h" #include "ns3/object.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/trace-resolver.h" - - #include "channel.h" #include "net-device.h" #include "node.h" -NS_DEBUG_COMPONENT_DEFINE ("NetDevice"); +NS_LOG_COMPONENT_DEFINE ("NetDevice"); namespace ns3 { @@ -47,22 +45,27 @@ NetDevice::NetDevice(Ptr node, const Address& addr) : m_isMulticast (false), m_isPointToPoint (false) { + NS_LOG_FUNCTION; SetInterfaceId (NetDevice::iid); m_node->AddDevice (this); } NetDevice::~NetDevice () -{} +{ + NS_LOG_FUNCTION; +} Address NetDevice::GetAddress (void) const { + NS_LOG_FUNCTION; return m_address; } bool NetDevice::SetMtu (const uint16_t mtu) { + NS_LOG_FUNCTION; m_mtu = mtu; return true; } @@ -70,54 +73,63 @@ NetDevice::SetMtu (const uint16_t mtu) uint16_t NetDevice::GetMtu (void) const { + NS_LOG_FUNCTION; return m_mtu; } void NetDevice::SetName(const std::string name) { + NS_LOG_FUNCTION; m_name = name; } std::string NetDevice::GetName(void) const { + NS_LOG_FUNCTION; return m_name; } void NetDevice::SetIfIndex(uint32_t index) { + NS_LOG_FUNCTION; m_ifIndex = index; } uint32_t NetDevice::GetIfIndex(void) const { + NS_LOG_FUNCTION; return m_ifIndex; } bool NetDevice::IsLinkUp (void) const { + NS_LOG_FUNCTION; return m_isUp; } void NetDevice::SetLinkChangeCallback (Callback callback) { + NS_LOG_FUNCTION; m_linkChangeCallback = callback; } bool NetDevice::IsBroadcast (void) const { + NS_LOG_FUNCTION; return m_isBroadcast; } Address const & NetDevice::GetBroadcast (void) const { + NS_LOG_FUNCTION; NS_ASSERT (m_isBroadcast); return m_broadcast; } @@ -125,6 +137,7 @@ NetDevice::GetBroadcast (void) const void NetDevice::EnableBroadcast (Address broadcast) { + NS_LOG_FUNCTION; m_isBroadcast = true; m_broadcast = broadcast; } @@ -132,18 +145,21 @@ NetDevice::EnableBroadcast (Address broadcast) void NetDevice::DisableBroadcast (void) { + NS_LOG_FUNCTION; m_isBroadcast = false; } bool NetDevice::IsMulticast (void) const { + NS_LOG_FUNCTION; return m_isMulticast; } Address NetDevice::GetMulticast (void) const { + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " "Invalid operation when not IsMulticast ()"); return m_multicast; @@ -152,6 +168,7 @@ NetDevice::GetMulticast (void) const Address NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const { + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " "Invalid operation when not IsMulticast ()"); return m_multicast; @@ -160,6 +177,7 @@ NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const void NetDevice::EnableMulticast (Address multicast) { + NS_LOG_FUNCTION; m_isMulticast = true; m_multicast = multicast; } @@ -167,24 +185,28 @@ NetDevice::EnableMulticast (Address multicast) void NetDevice::DisableMulticast (void) { + NS_LOG_FUNCTION; m_isMulticast = false; } bool NetDevice::IsPointToPoint (void) const { + NS_LOG_FUNCTION; return m_isPointToPoint; } void NetDevice::EnablePointToPoint (void) { + NS_LOG_FUNCTION; m_isPointToPoint = true; } void NetDevice::DisablePointToPoint (void) { + NS_LOG_FUNCTION; m_isPointToPoint = false; } @@ -192,6 +214,7 @@ NetDevice::DisablePointToPoint (void) bool NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; if (m_isUp) { return SendTo(p, dest, protocolNumber); @@ -205,6 +228,7 @@ NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) Ptr NetDevice::GetChannel (void) const { + NS_LOG_FUNCTION; return DoGetChannel (); } @@ -212,10 +236,10 @@ NetDevice::GetChannel (void) const bool NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) { + NS_LOG_FUNCTION; bool retval = false; - NS_DEBUG ("NetDevice::ForwardUp: UID is " << p.GetUid() - << " device is: " << GetName()); + NS_LOG_LOGIC ("UID is " << p.GetUid() << " device is: " << GetName()); if (!m_receiveCallback.IsNull ()) { @@ -223,7 +247,7 @@ NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) } else { - NS_DEBUG ("NetDevice::Receive call back is NULL"); + NS_LOG_WARN ("NetDevice::Receive call back is NULL"); } return retval; @@ -232,6 +256,7 @@ NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) void NetDevice::NotifyLinkUp (void) { + NS_LOG_FUNCTION; m_isUp = true; if (!m_linkChangeCallback.IsNull ()) { @@ -242,6 +267,7 @@ NetDevice::NotifyLinkUp (void) void NetDevice::NotifyLinkDown (void) { + NS_LOG_FUNCTION; m_isUp = false; if (!m_linkChangeCallback.IsNull ()) { @@ -252,24 +278,28 @@ NetDevice::NotifyLinkDown (void) Ptr NetDevice::GetNode (void) const { + NS_LOG_FUNCTION; return m_node; } bool NetDevice::NeedsArp (void) const { + NS_LOG_FUNCTION; return DoNeedsArp (); } void NetDevice::SetReceiveCallback (ReceiveCallback cb) { + NS_LOG_FUNCTION; m_receiveCallback = cb; } void NetDevice::DoDispose() { + NS_LOG_FUNCTION; m_node = 0; } diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index f642eee9e..448b84334 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -21,22 +21,24 @@ #include "packet-socket.h" #include "packet-socket-address.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node.h" -NS_DEBUG_COMPONENT_DEFINE ("PacketSocket"); +NS_LOG_COMPONENT_DEFINE ("PacketSocket"); namespace ns3 { PacketSocket::PacketSocket (Ptr node) : m_node (node) { + NS_LOG_FUNCTION; Init(); } void PacketSocket::Init() { + NS_LOG_FUNCTION; m_state = STATE_OPEN; m_shutdownSend = false; m_shutdownRecv = false; @@ -44,37 +46,45 @@ PacketSocket::Init() } PacketSocket::~PacketSocket () -{} +{ + NS_LOG_FUNCTION; +} void PacketSocket::DoDispose (void) { + NS_LOG_FUNCTION; m_device = 0; } enum Socket::SocketErrno PacketSocket::GetErrno (void) const { + NS_LOG_FUNCTION; return m_errno; } Ptr PacketSocket::GetNode (void) const { + NS_LOG_FUNCTION; return m_node; } int PacketSocket::Bind (void) { + NS_LOG_FUNCTION; PacketSocketAddress address; address.SetProtocol (0); address.SetAllDevices (); return DoBind (address); } + int PacketSocket::Bind (const Address &address) -{ +{ + NS_LOG_FUNCTION; if (!PacketSocketAddress::IsMatchingType (address)) { m_errno = ERROR_INVAL; @@ -87,6 +97,7 @@ PacketSocket::Bind (const Address &address) int PacketSocket::DoBind (const PacketSocketAddress &address) { + NS_LOG_FUNCTION; if (m_state == STATE_BOUND || m_state == STATE_CONNECTED) { @@ -119,6 +130,7 @@ PacketSocket::DoBind (const PacketSocketAddress &address) int PacketSocket::ShutdownSend (void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -127,9 +139,11 @@ PacketSocket::ShutdownSend (void) m_shutdownSend = true; return 0; } + int PacketSocket::ShutdownRecv (void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -138,9 +152,11 @@ PacketSocket::ShutdownRecv (void) m_shutdownRecv = false; return 0; } + int PacketSocket::Close(void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -154,6 +170,7 @@ PacketSocket::Close(void) int PacketSocket::Connect(const Address &ad) { + NS_LOG_FUNCTION; PacketSocketAddress address; if (m_state == STATE_CLOSED) { @@ -188,6 +205,7 @@ PacketSocket::Connect(const Address &ad) int PacketSocket::Send (const Packet &p) { + NS_LOG_FUNCTION; if (m_state == STATE_OPEN || m_state == STATE_BOUND) { @@ -200,6 +218,7 @@ PacketSocket::Send (const Packet &p) int PacketSocket::SendTo(const Address &address, const Packet &p) { + NS_LOG_FUNCTION; PacketSocketAddress ad; if (m_state == STATE_CLOSED) { @@ -265,6 +284,7 @@ void PacketSocket::ForwardUp (Ptr device, const Packet &packet, uint16_t protocol, const Address &from) { + NS_LOG_FUNCTION; if (m_shutdownRecv) { return; @@ -277,8 +297,7 @@ PacketSocket::ForwardUp (Ptr device, const Packet &packet, address.SetSingleDevice (device->GetIfIndex ()); address.SetProtocol (protocol); - NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid() - << " PacketSocket " << this); + NS_LOG_LOGIC ("UID is " << packet.GetUid() << " PacketSocket " << this); NotifyDataReceived (p, address); } diff --git a/src/node/queue.cc b/src/node/queue.cc index 8ed033b66..a2eec08ae 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -17,13 +17,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" #include "ns3/default-value.h" #include "ns3/component-manager.h" #include "queue.h" -NS_DEBUG_COMPONENT_DEFINE ("Queue"); +NS_LOG_COMPONENT_DEFINE ("Queue"); namespace ns3 { @@ -35,33 +35,48 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue", std::string QueueTraceType::GetTypeName (void) const { + NS_LOG_FUNCTION; return "ns3::QueueTraceType"; } + uint16_t QueueTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("QueueTraceType"); return uid; } + QueueTraceType::QueueTraceType () : m_type (QueueTraceType::ENQUEUE) -{} +{ + NS_LOG_FUNCTION; +} + QueueTraceType::QueueTraceType (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + bool QueueTraceType::IsEnqueue (void) const { + NS_LOG_FUNCTION; return m_type == ENQUEUE; } + bool QueueTraceType::IsDequeue (void) const { + NS_LOG_FUNCTION; return m_type == DEQUEUE; } + bool QueueTraceType::IsDrop (void) const { + NS_LOG_FUNCTION; return m_type == DROP; } @@ -90,18 +105,19 @@ Queue::Queue() : m_nTotalDroppedBytes(0), m_nTotalDroppedPackets(0) { + NS_LOG_FUNCTION; SetInterfaceId (Queue::iid); - NS_DEBUG("Queue::Queue ()"); } Queue::~Queue() { - NS_DEBUG("Queue::~Queue ()"); + NS_LOG_FUNCTION; } Ptr Queue::GetTraceResolver (void) const { + NS_LOG_FUNCTION; Ptr resolver = Create (); resolver->AddSource ("enqueue", TraceDoc ("store packet in queue", @@ -122,9 +138,9 @@ Queue::GetTraceResolver (void) const bool Queue::Enqueue (const Packet& p) { - NS_DEBUG("Queue::Enqueue (" << &p << ")"); - - NS_DEBUG("Queue::Enqueue (): m_traceEnqueue (p)"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_LOGIC ("m_traceEnqueue (p)"); m_traceEnqueue (p); @@ -140,7 +156,8 @@ Queue::Enqueue (const Packet& p) bool Queue::Dequeue (Packet &p) { - NS_DEBUG("Queue::Dequeue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); bool retval = DoDequeue (p); @@ -152,7 +169,7 @@ Queue::Dequeue (Packet &p) NS_ASSERT (m_nBytes >= 0); NS_ASSERT (m_nPackets >= 0); - NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); + NS_LOG_LOGIC("m_traceDequeue (p)"); const Packet packet = p; m_traceDequeue (packet); @@ -164,16 +181,15 @@ Queue::Dequeue (Packet &p) void Queue::DequeueAll (void) { - NS_DEBUG("Queue::DequeueAll ()"); - - NS_ASSERT (!"Don't know what to do with dequeued packets!"); + NS_LOG_FUNCTION; + NS_ASSERT_MSG (0, "Don't know what to do with dequeued packets!"); } bool Queue::Peek (Packet &p) { - NS_DEBUG("Queue::Peek (" << &p << ")"); - + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return DoPeek (p); } @@ -181,66 +197,63 @@ Queue::Peek (Packet &p) uint32_t Queue::GetNPackets (void) { - NS_DEBUG("Queue::GetNPackets () <= " << m_nPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nPackets); return m_nPackets; } uint32_t Queue::GetNBytes (void) { - NS_DEBUG("Queue::GetNBytes () <= " << m_nBytes); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC (" returns " << m_nBytes); return m_nBytes; } - bool Queue::IsEmpty (void) { - NS_DEBUG("Queue::IsEmpty () <= " << (m_nPackets == 0)); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns" << (m_nPackets == 0)); return m_nPackets == 0; } uint32_t Queue::GetTotalReceivedBytes (void) { - NS_DEBUG("Queue::GetTotalReceivedBytes () <= " << m_nTotalReceivedBytes); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC("returns " << m_nTotalReceivedBytes); return m_nTotalReceivedBytes; } uint32_t Queue::GetTotalReceivedPackets (void) { - NS_DEBUG("Queue::GetTotalReceivedPackets () <= " << m_nTotalReceivedPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nTotalReceivedPackets); return m_nTotalReceivedPackets; } uint32_t Queue:: GetTotalDroppedBytes (void) { - NS_DEBUG( - "Queue::GetTotalDroppedBytes () <= " << m_nTotalDroppedBytes - ); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nTotalDroppedBytes); return m_nTotalDroppedBytes; } uint32_t Queue::GetTotalDroppedPackets (void) { - NS_DEBUG( - "Queue::GetTotalDroppedPackets () <= " << m_nTotalDroppedPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC("returns " << m_nTotalDroppedPackets); return m_nTotalDroppedPackets; } void Queue::ResetStatistics (void) { - NS_DEBUG("Queue::ResetStatistics ()"); - + NS_LOG_FUNCTION; m_nTotalReceivedBytes = 0; m_nTotalReceivedPackets = 0; m_nTotalDroppedBytes = 0; @@ -250,18 +263,20 @@ Queue::ResetStatistics (void) void Queue::Drop (const Packet& p) { - NS_DEBUG("Queue::Drop (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); m_nTotalDroppedPackets++; m_nTotalDroppedBytes += p.GetSize (); - NS_DEBUG("Queue::Drop (): m_traceDrop (p)"); + NS_LOG_LOGIC ("m_traceDrop (p)"); m_traceDrop (p); } Ptr Queue::CreateDefault (void) { + NS_LOG_FUNCTION; ClassId classId = g_classIdDefaultValue.GetValue (); Ptr queue = ComponentManager::Create (classId, Queue::iid); return queue; diff --git a/src/node/socket.cc b/src/node/socket.cc index efb28002a..48623abbe 100644 --- a/src/node/socket.cc +++ b/src/node/socket.cc @@ -20,23 +20,23 @@ * Mathieu Lacage */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/packet.h" #include "socket.h" -NS_DEBUG_COMPONENT_DEFINE ("Socket"); +NS_LOG_COMPONENT_DEFINE ("Socket"); namespace ns3 { Socket::~Socket () { - NS_DEBUG("Socket::~Socket ()"); + NS_LOG_FUNCTION; } void Socket::SetCloseCallback (Callback > closeCompleted) { - NS_DEBUG("Socket::SetCloseCallback ()"); + NS_LOG_FUNCTION; m_closeCompleted = closeCompleted; } @@ -46,7 +46,7 @@ Socket::SetConnectCallback ( Callback > connectionFailed, Callback > halfClose) { - NS_DEBUG("Socket::SetConnectCallback ()"); + NS_LOG_FUNCTION; m_connectionSucceeded = connectionSucceeded; m_connectionFailed = connectionFailed; m_halfClose = halfClose; @@ -58,7 +58,7 @@ Socket::SetAcceptCallback ( Callback, const Address&> newConnectionCreated, Callback > closeRequested) { - NS_DEBUG("Socket::SetAcceptCallback ()"); + NS_LOG_FUNCTION; m_connectionRequest = connectionRequest; m_newConnectionCreated = newConnectionCreated; m_closeRequested = closeRequested; @@ -67,22 +67,21 @@ Socket::SetAcceptCallback ( void Socket::SetSendCallback (Callback, uint32_t> dataSent) { - NS_DEBUG("Socket::SetSendCallback ()"); + NS_LOG_FUNCTION; m_dataSent = dataSent; } void Socket::SetRecvCallback (Callback, const Packet &,const Address&> receivedData) { - NS_DEBUG("Socket::SetRecvCallback ()"); + NS_LOG_FUNCTION; m_receivedData = receivedData; } void Socket::NotifyCloseCompleted (void) { - NS_DEBUG("Socket::NotifyCloseCompleted ()"); - + NS_LOG_FUNCTION; if (!m_closeCompleted.IsNull ()) { m_closeCompleted (this); @@ -92,8 +91,7 @@ Socket::NotifyCloseCompleted (void) void Socket::NotifyConnectionSucceeded (void) { - NS_DEBUG("Socket::NotifyConnectionSucceeded ()"); - + NS_LOG_FUNCTION; if (!m_connectionSucceeded.IsNull ()) { m_connectionSucceeded (this); @@ -103,8 +101,7 @@ Socket::NotifyConnectionSucceeded (void) void Socket::NotifyConnectionFailed (void) { - NS_DEBUG("Socket::NotifyConnectionFailed ()"); - + NS_LOG_FUNCTION; if (!m_connectionFailed.IsNull ()) { m_connectionFailed (this); @@ -114,8 +111,7 @@ Socket::NotifyConnectionFailed (void) void Socket::NotifyHalfClose (void) { - NS_DEBUG("Socket::NotifyHalfClose ()"); - + NS_LOG_FUNCTION; if (!m_halfClose.IsNull ()) { m_halfClose (this); @@ -125,8 +121,7 @@ Socket::NotifyHalfClose (void) bool Socket::NotifyConnectionRequest (const Address &from) { - NS_DEBUG("Socket::NotifyConnectionRequest ()"); - + NS_LOG_FUNCTION; if (!m_connectionRequest.IsNull ()) { return m_connectionRequest (this, from); @@ -141,8 +136,7 @@ Socket::NotifyConnectionRequest (const Address &from) void Socket::NotifyNewConnectionCreated (Ptr socket, const Address &from) { - NS_DEBUG("Socket::NotifyNewConnectionCreated ()"); - + NS_LOG_FUNCTION; if (!m_newConnectionCreated.IsNull ()) { m_newConnectionCreated (socket, from); @@ -152,8 +146,7 @@ Socket::NotifyNewConnectionCreated (Ptr socket, const Address &from) void Socket::NotifyCloseRequested (void) { - NS_DEBUG("Socket::NotifyCloseRequested ()"); - + NS_LOG_FUNCTION; if (!m_closeRequested.IsNull ()) { m_closeRequested (this); @@ -163,8 +156,7 @@ Socket::NotifyCloseRequested (void) void Socket::NotifyDataSent (uint32_t size) { - NS_DEBUG("Socket::NotifyDataSent ()"); - + NS_LOG_FUNCTION; if (!m_dataSent.IsNull ()) { m_dataSent (this, size); @@ -174,8 +166,7 @@ Socket::NotifyDataSent (uint32_t size) void Socket::NotifyDataReceived (const Packet &p, const Address &from) { - NS_DEBUG("Socket::NotifyDataReceived ()"); - + NS_LOG_FUNCTION; if (!m_receivedData.IsNull ()) { m_receivedData (this, p, from); diff --git a/src/routing/global-routing/candidate-queue.cc b/src/routing/global-routing/candidate-queue.cc index ffade0a31..e6d3b552e 100644 --- a/src/routing/global-routing/candidate-queue.cc +++ b/src/routing/global-routing/candidate-queue.cc @@ -14,35 +14,32 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "candidate-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("CandidateQueue"); +NS_LOG_COMPONENT_DEFINE ("CandidateQueue"); namespace ns3 { CandidateQueue::CandidateQueue() : m_candidates () { - NS_DEBUG("CandidateQueue::CandidateQueue ()"); + NS_LOG_FUNCTION; } CandidateQueue::~CandidateQueue() { - NS_DEBUG("CandidateQueue::~CandidateQueue ()"); + NS_LOG_FUNCTION; Clear (); } void CandidateQueue::Clear (void) { - NS_DEBUG("CandidateQueue::Clear ()"); - + NS_LOG_FUNCTION; while (!m_candidates.empty ()) { SPFVertex *p = Pop (); @@ -54,7 +51,8 @@ CandidateQueue::Clear (void) void CandidateQueue::Push (SPFVertex *vNew) { - NS_DEBUG("CandidateQueue::Push (" << vNew << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << vNew << ")"); CandidateList_t::iterator i = m_candidates.begin (); @@ -72,8 +70,7 @@ CandidateQueue::Push (SPFVertex *vNew) SPFVertex * CandidateQueue::Pop (void) { - NS_DEBUG("CandidateQueue::Pop ()"); - + NS_LOG_FUNCTION; if (m_candidates.empty ()) { return 0; @@ -87,8 +84,7 @@ CandidateQueue::Pop (void) SPFVertex * CandidateQueue::Top (void) const { - NS_DEBUG("CandidateQueue::Top ()"); - + NS_LOG_FUNCTION; if (m_candidates.empty ()) { return 0; @@ -100,24 +96,21 @@ CandidateQueue::Top (void) const bool CandidateQueue::Empty (void) const { - NS_DEBUG("CandidateQueue::Empty ()"); - + NS_LOG_FUNCTION; return m_candidates.empty (); } uint32_t CandidateQueue::Size (void) const { - NS_DEBUG("CandidateQueue::Size ()"); - + NS_LOG_FUNCTION; return m_candidates.size (); } SPFVertex * CandidateQueue::Find (const Ipv4Address addr) const { - NS_DEBUG("CandidateQueue::Find ()"); - + NS_LOG_FUNCTION; CandidateList_t::const_iterator i = m_candidates.begin (); for (; i != m_candidates.end (); i++) @@ -135,8 +128,7 @@ CandidateQueue::Find (const Ipv4Address addr) const void CandidateQueue::Reorder (void) { - NS_DEBUG("CandidateQueue::Reorder ()"); - + NS_LOG_FUNCTION; std::list temp; while (!m_candidates.empty ()) { diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 951ead2aa..88d9def84 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Authors: Craig Dowell (craigdo@ee.washington.edu) - * Tom Henderson (tomhend@u.washington.edu) + * Authors: Tom Henderson (tomhend@u.washington.edu) * * Kunihiro Ishigura, Toshiaki Takada (GNU Zebra) are attributed authors * of the quagga 0.99.7/src/ospfd/ospf_spf.c code which was ported here @@ -28,14 +27,14 @@ #include #include "ns3/assert.h" #include "ns3/fatal-error.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node-list.h" #include "ns3/ipv4.h" #include "global-router-interface.h" #include "global-route-manager-impl.h" #include "candidate-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("GlobalRouteManager"); +NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager"); namespace ns3 { @@ -55,6 +54,7 @@ SPFVertex::SPFVertex () : m_parent (0), m_children () { + NS_LOG_FUNCTION; } SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : @@ -66,20 +66,22 @@ SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : m_parent (0), m_children () { + NS_LOG_FUNCTION; if (lsa->GetLSType () == GlobalRoutingLSA::RouterLSA) { - NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexRouter"); + NS_LOG_LOGIC ("Setting m_vertexType to VertexRouter"); m_vertexType = SPFVertex::VertexRouter; } else if (lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA) { - NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexNetwork"); + NS_LOG_LOGIC ("Setting m_vertexType to VertexNetwork"); m_vertexType = SPFVertex::VertexNetwork; } } SPFVertex::~SPFVertex () { + NS_LOG_FUNCTION; for ( ListOfSPFVertex_t::iterator i = m_children.begin (); i != m_children.end (); i++) @@ -95,96 +97,112 @@ SPFVertex::~SPFVertex () void SPFVertex::SetVertexType (SPFVertex::VertexType type) { + NS_LOG_FUNCTION; m_vertexType = type; } SPFVertex::VertexType SPFVertex::GetVertexType (void) const { + NS_LOG_FUNCTION; return m_vertexType; } void SPFVertex::SetVertexId (Ipv4Address id) { + NS_LOG_FUNCTION; m_vertexId = id; } Ipv4Address SPFVertex::GetVertexId (void) const { + NS_LOG_FUNCTION; return m_vertexId; } void SPFVertex::SetLSA (GlobalRoutingLSA* lsa) { + NS_LOG_FUNCTION; m_lsa = lsa; } GlobalRoutingLSA* SPFVertex::GetLSA (void) const { + NS_LOG_FUNCTION; return m_lsa; } void SPFVertex::SetDistanceFromRoot (uint32_t distance) { + NS_LOG_FUNCTION; m_distanceFromRoot = distance; } uint32_t SPFVertex::GetDistanceFromRoot (void) const { + NS_LOG_FUNCTION; return m_distanceFromRoot; } void SPFVertex::SetOutgoingInterfaceId (uint32_t id) { + NS_LOG_FUNCTION; m_rootOif = id; } uint32_t SPFVertex::GetOutgoingInterfaceId (void) const { + NS_LOG_FUNCTION; return m_rootOif; } void SPFVertex::SetNextHop (Ipv4Address nextHop) { + NS_LOG_FUNCTION; m_nextHop = nextHop; } Ipv4Address SPFVertex::GetNextHop (void) const { + NS_LOG_FUNCTION; return m_nextHop; } void SPFVertex::SetParent (SPFVertex* parent) { + NS_LOG_FUNCTION; m_parent = parent; } SPFVertex* SPFVertex::GetParent (void) const { + NS_LOG_FUNCTION; return m_parent; } uint32_t SPFVertex::GetNChildren (void) const { + NS_LOG_FUNCTION; return m_children.size (); } SPFVertex* SPFVertex::GetChild (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfSPFVertex_t::const_iterator i = m_children.begin (); @@ -203,6 +221,7 @@ SPFVertex::GetChild (uint32_t n) const uint32_t SPFVertex::AddChild (SPFVertex* child) { + NS_LOG_FUNCTION; m_children.push_back (child); return m_children.size (); } @@ -217,29 +236,27 @@ GlobalRouteManagerLSDB::GlobalRouteManagerLSDB () : m_database () { - NS_DEBUG ("GlobalRouteManagerLSDB::GlobalRouteManagerLSDB ()"); + NS_LOG_FUNCTION; } GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB () { - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()"); - + NS_LOG_FUNCTION; LSDBMap_t::iterator i; for (i= m_database.begin (); i!= m_database.end (); i++) { - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ():free LSA"); + NS_LOG_LOGIC ("free LSA"); GlobalRoutingLSA* temp = i->second; delete temp; } - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB (): clear map"); + NS_LOG_LOGIC ("clear map"); m_database.clear (); } void GlobalRouteManagerLSDB::Initialize () { - NS_DEBUG ("GlobalRouteManagerLSDB::Initialize ()"); - + NS_LOG_FUNCTION; LSDBMap_t::iterator i; for (i= m_database.begin (); i!= m_database.end (); i++) { @@ -251,14 +268,14 @@ GlobalRouteManagerLSDB::Initialize () void GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa) { - NS_DEBUG ("GlobalRouteManagerLSDB::Insert ()"); + NS_LOG_FUNCTION; m_database.insert (LSDBPair_t (addr, lsa)); } GlobalRoutingLSA* GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const { - NS_DEBUG ("GlobalRouteManagerLSDB::GetLSA ()"); + NS_LOG_FUNCTION; // // Look up an LSA by its address. // @@ -276,7 +293,7 @@ GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const GlobalRoutingLSA* GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const { - NS_DEBUG ("GlobalRouteManagerLSDB::GetLSAByLinkData ()"); + NS_LOG_FUNCTION; // // Look up an LSA by its address. // @@ -308,14 +325,13 @@ GlobalRouteManagerImpl::GlobalRouteManagerImpl () : m_spfroot (0) { - NS_DEBUG ("GlobalRouteManagerImpl::GlobalRoutemanagerImpl ()"); + NS_LOG_FUNCTION; m_lsdb = new GlobalRouteManagerLSDB (); } GlobalRouteManagerImpl::~GlobalRouteManagerImpl () { - NS_DEBUG ("GlobalRouteManagerImpl::~GlobalRouteManagerImpl ()"); - + NS_LOG_FUNCTION; if (m_lsdb) { delete m_lsdb; @@ -325,8 +341,7 @@ GlobalRouteManagerImpl::~GlobalRouteManagerImpl () void GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb) { - NS_DEBUG ("GlobalRouteManagerImpl::DebugUseLsdb ()"); - + NS_LOG_FUNCTION; if (m_lsdb) { delete m_lsdb; @@ -344,14 +359,12 @@ GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb) void GlobalRouteManagerImpl::SelectRouterNodes () { - NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes ()"); - + NS_LOG_FUNCTION; for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; - NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes (): " - "Adding GlobalRouter interface to node " << - node->GetId ()); + NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << + node->GetId ()); Ptr globalRouter = Create (node); node->AddInterface (globalRouter); @@ -370,7 +383,7 @@ GlobalRouteManagerImpl::SelectRouterNodes () void GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () { - NS_DEBUG ("GlobalRouteManagerImpl::BuildGlobalRoutingDatabase()"); + NS_LOG_FUNCTION; // // Walk the list of nodes looking for the GlobalRouter Interface. // @@ -396,7 +409,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () // found. // uint32_t numLSAs = rtr->DiscoverLSAs (); - NS_DEBUG ("Discover LSAs: Found " << numLSAs << " LSAs"); + NS_LOG_LOGIC ("Found " << numLSAs << " LSAs"); for (uint32_t j = 0; j < numLSAs; ++j) { @@ -406,7 +419,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () // router. // rtr->GetLSA (j, *lsa); - NS_DEBUG (*lsa); + NS_LOG_LOGIC (*lsa); // // Write the newly discovered link state advertisement to the database. // @@ -451,7 +464,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () void GlobalRouteManagerImpl::InitializeRoutes () { - NS_DEBUG ("GlobalRouteManagerImpl::InitializeRoutes ()"); + NS_LOG_FUNCTION; // // Walk the list of nodes in the system. // @@ -491,16 +504,17 @@ GlobalRouteManagerImpl::InitializeRoutes () void GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { + NS_LOG_FUNCTION; + SPFVertex* w = 0; GlobalRoutingLSA* w_lsa = 0; GlobalRoutingLinkRecord *l = 0; uint32_t distance = 0; uint32_t numRecordsInVertex = 0; - - NS_DEBUG ("GlobalRouteManagerImpl::SPFNext ()"); - +// // V points to a Router-LSA or Network-LSA // Loop over the links in router LSA or attached routers in Network LSA +// if (v->GetVertexType () == SPFVertex::VertexRouter) { numRecordsInVertex = v->GetLSA ()->GetNLinkRecords (); @@ -515,7 +529,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // Get w_lsa: In case of V is Router-LSA if (v->GetVertexType () == SPFVertex::VertexRouter) { - NS_DEBUG ("SPFNext: Examining " << v->GetVertexId () << "'s " << + NS_LOG_LOGIC ("Examining " << v->GetVertexId () << "'s " << v->GetLSA ()->GetNLinkRecords () << " link records"); // // (a) If this is a link to a stub network, examine the next link in V's LSA. @@ -525,8 +539,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) l = v->GetLSA ()->GetLinkRecord (i); if (l->GetLinkType () == GlobalRoutingLinkRecord::StubNetwork) { - NS_DEBUG ("SPFNext: Found a Stub record to " << - l->GetLinkId ()); + NS_LOG_LOGIC ("Found a Stub record to " << l->GetLinkId ()); continue; } // @@ -542,7 +555,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); NS_ASSERT (w_lsa); - NS_DEBUG ("SPFNext: Found a P2P record from " << + NS_LOG_LOGIC ("Found a P2P record from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } else if (l->GetLinkType () == @@ -550,7 +563,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); NS_ASSERT (w_lsa); - NS_DEBUG ("SPFNext: Found a Transit record from " << + NS_LOG_LOGIC ("Found a Transit record from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } else @@ -567,7 +580,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { continue; } - NS_DEBUG ("SPFNext: Found a Network LSA from " << + NS_LOG_LOGIC ("Found a Network LSA from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } @@ -581,7 +594,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_IN_SPFTREE) { - NS_DEBUG ("SPFNext: Skipping-> LSA "<< + NS_LOG_LOGIC ("Skipping -> LSA "<< w_lsa->GetLinkStateId () << " already in SPF tree"); continue; } @@ -600,7 +613,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) distance = v->GetDistanceFromRoot (); } - NS_DEBUG ("SPFNext: Considering w_lsa " << w_lsa->GetLinkStateId ()); + NS_LOG_LOGIC ("Considering w_lsa " << w_lsa->GetLinkStateId ()); // Is there already vertex w in candidate list? if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) @@ -622,7 +635,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // root node). // candidate.Push (w); - NS_DEBUG ("SPFNext: Pushing " << + NS_LOG_LOGIC ("Pushing " << w->GetVertexId () << ", parent vertexId: " << v->GetVertexId ()); } @@ -691,8 +704,8 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( GlobalRoutingLinkRecord* l, uint32_t distance) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFNexthopCalculation ()"); - + NS_LOG_FUNCTION; +// // If w is a NetworkVertex, l should be null /* if (w->GetVertexType () == SPFVertex::VertexNetwork && l) @@ -772,7 +785,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( w->SetOutgoingInterfaceId ( FindOutgoingInterfaceId (l->GetLinkData ())); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to " << w->GetVertexId () << " goes through next hop " << w->GetNextHop () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); @@ -789,7 +802,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( w_lsa->GetNetworkLSANetworkMask () )); w->SetDistanceFromRoot (distance); w->SetParent (v); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to network " << w->GetVertexId () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); return 1; @@ -816,7 +829,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( */ w->SetNextHop(linkRemote->GetLinkData ()); w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ()); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to " << w->GetVertexId () << " goes through next hop " << w->GetNextHop () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); @@ -873,7 +886,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( SPFVertex* w, GlobalRoutingLinkRecord* prev_link) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFGetNextLink ()"); + NS_LOG_FUNCTION; bool skip = true; bool found_prev_link = false; @@ -907,12 +920,12 @@ GlobalRouteManagerImpl::SPFGetNextLink ( { if (!found_prev_link) { - NS_DEBUG ("SPFGetNextLink: Skipping links before prev_link found"); + NS_LOG_LOGIC ("Skipping links before prev_link found"); found_prev_link = true; continue; } - NS_DEBUG ("SPFGetNextLink: Found matching link l: linkId = " << + NS_LOG_LOGIC ("Found matching link l: linkId = " << l->GetLinkId () << " linkData = " << l->GetLinkData ()); // // If skip is false, don't (not too surprisingly) skip the link found -- it's @@ -923,7 +936,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( // if (skip == false) { - NS_DEBUG ("SPFGetNextLink: Returning the found link"); + NS_LOG_LOGIC ("Returning the found link"); return l; } else @@ -933,7 +946,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( // Setting skip to false gets us the next point-to-point global router link // record in the LSA from . // - NS_DEBUG ("SPFGetNextLink: Skipping the found link"); + NS_LOG_LOGIC ("Skipping the found link"); skip = false; continue; } @@ -948,7 +961,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( void GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root) { - NS_DEBUG ("GlobalRouteManagerImpl::DebugSPFCalculate ()"); + NS_LOG_FUNCTION; SPFCalculate (root); } @@ -956,8 +969,8 @@ GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root) void GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFCalculate (): " - "root = " << root); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << root << ")"); SPFVertex *v; // @@ -1023,7 +1036,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) // the candidate list. // v = candidate.Pop (); - NS_DEBUG ("SPFCalculate: Popped vertex " << v->GetVertexId ()); + NS_LOG_LOGIC ("Popped vertex " << v->GetVertexId ()); // // Update the status field of the vertex to indicate that it is in the SPF // tree. @@ -1105,6 +1118,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) uint32_t GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) { + NS_LOG_FUNCTION; // // We have an IP address and a vertex ID of the root of the SPF tree. // The question is what interface index does this address correspond to. @@ -1180,7 +1194,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) void GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter ()"); + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFIntraAddRouter (): Root pointer not set"); @@ -1193,8 +1207,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) // Ipv4Address routerId = m_spfroot->GetVertexId (); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "Vertex ID = " << routerId); + NS_LOG_LOGIC ("Vertex ID = " << routerId); // // We need to walk the list of nodes looking for the one that has the router // ID corresponding to the root vertex. This is the one we're going to write @@ -1214,8 +1227,8 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) if (rtr == 0) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "No GlobalRouter interface on node " << node->GetId ()); + NS_LOG_LOGIC ("No GlobalRouter interface on node " << + node->GetId ()); continue; } // @@ -1223,13 +1236,11 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) // root of the SPF tree, then this node is the one for which we need to // write the routing tables. // - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "Considering router " << rtr->GetRouterId ()); + NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ()); if (rtr->GetRouterId () == routerId) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "setting routes for node " << node->GetId ()); + NS_LOG_LOGIC ("Setting routes for node " << node->GetId ()); // // Routing information is updated using the Ipv4 interface. We need to QI // for that interface. If the node is acting as an IP version 4 router, it @@ -1270,8 +1281,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) continue; } - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - " Node " << node->GetId () << + NS_LOG_LOGIC (" Node " << node->GetId () << " add route to " << lr->GetLinkData () << " using next hop " << v->GetNextHop () << " via interface " << v->GetOutgoingInterfaceId ()); @@ -1301,7 +1311,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) void GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit ()"); + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFIntraAddTransit (): Root pointer not set"); @@ -1314,8 +1324,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) // Ipv4Address routerId = m_spfroot->GetVertexId (); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "Vertex ID = " << routerId); + NS_LOG_LOGIC ("Vertex ID = " << routerId); // // We need to walk the list of nodes looking for the one that has the router // ID corresponding to the root vertex. This is the one we're going to write @@ -1335,8 +1344,8 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) if (rtr == 0) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "No GlobalRouter interface on node " << node->GetId ()); + NS_LOG_LOGIC ("No GlobalRouter interface on node " << + node->GetId ()); continue; } // @@ -1344,13 +1353,11 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) // root of the SPF tree, then this node is the one for which we need to // write the routing tables. // - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "Considering router " << rtr->GetRouterId ()); + NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ()); if (rtr->GetRouterId () == routerId) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "setting routes for node " << node->GetId ()); + NS_LOG_LOGIC ("setting routes for node " << node->GetId ()); // // Routing information is updated using the Ipv4 interface. We need to QI // for that interface. If the node is acting as an IP version 4 router, it @@ -1375,8 +1382,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) tempip = tempip.CombineMask (tempmask); ipv4->AddNetworkRouteTo (tempip, tempmask, v->GetNextHop (), v->GetOutgoingInterfaceId ()); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddNetwork (): " - " Node " << node->GetId () << + NS_LOG_LOGIC ("Node " << node->GetId () << " add network route to " << tempip << " using next hop " << v->GetNextHop () << " via interface " << v->GetOutgoingInterfaceId ()); @@ -1398,6 +1404,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) void GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) { + NS_LOG_FUNCTION; v->GetParent ()->AddChild (v); } diff --git a/src/routing/global-routing/global-route-manager.cc b/src/routing/global-routing/global-route-manager.cc index ed2d0bfef..4349f0df8 100644 --- a/src/routing/global-routing/global-route-manager.cc +++ b/src/routing/global-routing/global-route-manager.cc @@ -15,12 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Authors: Craig Dowell (craigdo@ee.washington.edu) - * Tom Henderson (tomhend@u.washington.edu) + * Author: Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulation-singleton.h" #include "global-route-manager.h" #include "global-route-manager-impl.h" diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index bf1b68a29..2819b7a24 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -15,11 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Authors: Craig Dowell (craigdo@ee.washington.edu) - * Tom Henderson (tomhend@u.washington.edu) + * Authors: Tom Henderson (tomhend@u.washington.edu) */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/channel.h" #include "ns3/net-device.h" @@ -27,7 +26,7 @@ #include "ns3/ipv4.h" #include "global-router-interface.h" -NS_DEBUG_COMPONENT_DEFINE ("GlobalRouter"); +NS_LOG_COMPONENT_DEFINE ("GlobalRouter"); namespace ns3 { @@ -44,7 +43,7 @@ GlobalRoutingLinkRecord::GlobalRoutingLinkRecord () m_linkType (Unknown), m_metric (0) { - NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ()"); + NS_LOG_FUNCTION; } GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( @@ -58,47 +57,48 @@ GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( m_linkType (linkType), m_metric (metric) { - NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (" << - linkType << ", " << linkId << ", " << linkData << ", " << metric << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << linkType << ", " << linkId << ", " << linkData << + ", " << metric << ")"); } GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord () { - NS_DEBUG("GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()"); + NS_LOG_FUNCTION; } Ipv4Address GlobalRoutingLinkRecord::GetLinkId (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkId ()"); + NS_LOG_FUNCTION; return m_linkId; } void GlobalRoutingLinkRecord::SetLinkId (Ipv4Address addr) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkId ()"); + NS_LOG_FUNCTION; m_linkId = addr; } Ipv4Address GlobalRoutingLinkRecord::GetLinkData (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkData ()"); + NS_LOG_FUNCTION; return m_linkData; } void GlobalRoutingLinkRecord::SetLinkData (Ipv4Address addr) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkData ()"); + NS_LOG_FUNCTION; m_linkData = addr; } GlobalRoutingLinkRecord::LinkType GlobalRoutingLinkRecord::GetLinkType (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkType ()"); + NS_LOG_FUNCTION; return m_linkType; } @@ -106,21 +106,21 @@ GlobalRoutingLinkRecord::GetLinkType (void) const GlobalRoutingLinkRecord::SetLinkType ( GlobalRoutingLinkRecord::LinkType linkType) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkType ()"); + NS_LOG_FUNCTION; m_linkType = linkType; } uint32_t GlobalRoutingLinkRecord::GetMetric (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetMetric ()"); + NS_LOG_FUNCTION; return m_metric; } void GlobalRoutingLinkRecord::SetMetric (uint32_t metric) { - NS_DEBUG("GlobalRoutingLinkRecord::SetMetric ()"); + NS_LOG_FUNCTION; m_metric = metric; } @@ -140,7 +140,7 @@ GlobalRoutingLSA::GlobalRoutingLSA() m_attachedRouters(), m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) { - NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA ()"); + NS_LOG_FUNCTION; } GlobalRoutingLSA::GlobalRoutingLSA ( @@ -156,8 +156,9 @@ GlobalRoutingLSA::GlobalRoutingLSA ( m_attachedRouters(), m_status(status) { - NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA (" << status << ", " << - linkStateId << ", " << advertisingRtr << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << status << ", " << linkStateId << ", " << + advertisingRtr << ")"); } GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) @@ -166,6 +167,7 @@ GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), m_status(lsa.m_status) { + NS_LOG_FUNCTION; NS_ASSERT_MSG(IsEmpty(), "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); CopyLinkRecords (lsa); @@ -174,6 +176,7 @@ GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) GlobalRoutingLSA& GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) { + NS_LOG_FUNCTION; m_lsType = lsa.m_lsType; m_linkStateId = lsa.m_linkStateId; m_advertisingRtr = lsa.m_advertisingRtr; @@ -188,6 +191,7 @@ GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) void GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) { + NS_LOG_FUNCTION; for (ListOfLinkRecords_t::const_iterator i = lsa.m_linkRecords.begin (); i != lsa.m_linkRecords.end (); i++) @@ -208,18 +212,19 @@ GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) GlobalRoutingLSA::~GlobalRoutingLSA() { - NS_DEBUG("GlobalRoutingLSA::~GlobalRoutingLSA ()"); + NS_LOG_FUNCTION; ClearLinkRecords (); } void GlobalRoutingLSA::ClearLinkRecords(void) { + NS_LOG_FUNCTION; for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); i++) { - NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords (): free link record"); + NS_LOG_LOGIC ("Free link record"); GlobalRoutingLinkRecord *p = *i; delete p; @@ -227,13 +232,14 @@ GlobalRoutingLSA::ClearLinkRecords(void) *i = 0; } - NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords(): clear list"); + NS_LOG_LOGIC ("Clear list"); m_linkRecords.clear(); } uint32_t GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) { + NS_LOG_FUNCTION; m_linkRecords.push_back (lr); return m_linkRecords.size (); } @@ -241,12 +247,14 @@ GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) uint32_t GlobalRoutingLSA::GetNLinkRecords (void) const { + NS_LOG_FUNCTION; return m_linkRecords.size (); } GlobalRoutingLinkRecord * GlobalRoutingLSA::GetLinkRecord (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); @@ -264,66 +272,77 @@ GlobalRoutingLSA::GetLinkRecord (uint32_t n) const bool GlobalRoutingLSA::IsEmpty (void) const { + NS_LOG_FUNCTION; return m_linkRecords.size () == 0; } GlobalRoutingLSA::LSType GlobalRoutingLSA::GetLSType (void) const { + NS_LOG_FUNCTION; return m_lsType; } void GlobalRoutingLSA::SetLSType (GlobalRoutingLSA::LSType typ) { + NS_LOG_FUNCTION; m_lsType = typ; } Ipv4Address GlobalRoutingLSA::GetLinkStateId (void) const { + NS_LOG_FUNCTION; return m_linkStateId; } void GlobalRoutingLSA::SetLinkStateId (Ipv4Address addr) { + NS_LOG_FUNCTION; m_linkStateId = addr; } Ipv4Address GlobalRoutingLSA::GetAdvertisingRouter (void) const { + NS_LOG_FUNCTION; return m_advertisingRtr; } void GlobalRoutingLSA::SetAdvertisingRouter (Ipv4Address addr) { + NS_LOG_FUNCTION; m_advertisingRtr = addr; } void GlobalRoutingLSA::SetNetworkLSANetworkMask (Ipv4Mask mask) { + NS_LOG_FUNCTION; m_networkLSANetworkMask = mask; } Ipv4Mask GlobalRoutingLSA::GetNetworkLSANetworkMask (void) const { + NS_LOG_FUNCTION; return m_networkLSANetworkMask; } GlobalRoutingLSA::SPFStatus GlobalRoutingLSA::GetStatus (void) const { + NS_LOG_FUNCTION; return m_status; } uint32_t GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) { + NS_LOG_FUNCTION; m_attachedRouters.push_back (addr); return m_attachedRouters.size (); } @@ -331,12 +350,14 @@ GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) uint32_t GlobalRoutingLSA::GetNAttachedRouters (void) const { + NS_LOG_FUNCTION; return m_attachedRouters.size (); } Ipv4Address GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin (); i != m_attachedRouters.end (); @@ -347,13 +368,15 @@ GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const return *i; } } - NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); + NS_ASSERT_MSG(false, + "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); return Ipv4Address("0.0.0.0"); } void GlobalRoutingLSA::SetStatus (GlobalRoutingLSA::SPFStatus status) { + NS_LOG_FUNCTION; m_status = status; } @@ -414,20 +437,21 @@ const InterfaceId GlobalRouter::iid = GlobalRouter::GlobalRouter (Ptr node) : m_node(node), m_LSAs() { - NS_DEBUG("GlobalRouter::GlobalRouter ()"); + NS_LOG_FUNCTION; SetInterfaceId (GlobalRouter::iid); m_routerId.Set(GlobalRouteManager::AllocateRouterId ()); } GlobalRouter::~GlobalRouter () { - NS_DEBUG("GlobalRouter::~GlobalRouter ()"); + NS_LOG_FUNCTION; ClearLSAs(); } void GlobalRouter::DoDispose () { + NS_LOG_FUNCTION; m_node = 0; Object::DoDispose (); } @@ -435,13 +459,12 @@ GlobalRouter::DoDispose () void GlobalRouter::ClearLSAs () { - NS_DEBUG("GlobalRouter::ClearLSAs ()"); - + NS_LOG_FUNCTION; for ( ListOfLSAs_t::iterator i = m_LSAs.begin (); i != m_LSAs.end (); i++) { - NS_DEBUG("GlobalRouter::ClearLSAs (): free LSA"); + NS_LOG_LOGIC ("Free LSA"); GlobalRoutingLSA *p = *i; delete p; @@ -449,13 +472,14 @@ GlobalRouter::ClearLSAs () *i = 0; } - NS_DEBUG("GlobalRouter::ClearLSAs (): clear list"); + NS_LOG_LOGIC ("Clear list"); m_LSAs.clear(); } Ipv4Address GlobalRouter::GetRouterId (void) const { + NS_LOG_FUNCTION; return m_routerId; } @@ -466,7 +490,8 @@ GlobalRouter::GetRouterId (void) const uint32_t GlobalRouter::DiscoverLSAs (void) { - NS_DEBUG("GlobalRouter::DiscoverLSAs () for node " << m_node->GetId () ); + NS_LOG_FUNCTION; + NS_LOG_LOGIC("For node " << m_node->GetId () ); NS_ASSERT_MSG(m_node, "GlobalRouter::DiscoverLSAs (): interface not set"); @@ -499,14 +524,14 @@ GlobalRouter::DiscoverLSAs (void) // ethernets, etc.). // uint32_t numDevices = m_node->GetNDevices(); - NS_DEBUG("GlobalRouter::DiscoverLSAs (): numDevices = " << numDevices); + NS_LOG_LOGIC ("numDevices = " << numDevices); for (uint32_t i = 0; i < numDevices; ++i) { Ptr ndLocal = m_node->GetDevice(i); if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () ) { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): broadcast link"); + NS_LOG_LOGIC ("Broadcast link"); GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; // // We need to determine whether we are on a transit or stub network @@ -521,7 +546,7 @@ GlobalRouter::DiscoverLSAs (void) uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); - NS_DEBUG("Working with local address " << addrLocal); + NS_LOG_LOGIC ("Working with local address " << addrLocal); // // Now, we're going to walk over to the remote net device on the other end of // the point-to-point channel we now know we have. This is where our adjacent @@ -532,7 +557,7 @@ GlobalRouter::DiscoverLSAs (void) if (nDevices == 1) { // This is a stub broadcast interface - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA stub broadcast link"); + NS_LOG_LOGIC("Router-LSA stub broadcast link"); // XXX in future, need to consider if >1 includes other routers plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // Link ID is IP network number of attached network @@ -549,7 +574,7 @@ GlobalRouter::DiscoverLSAs (void) } else { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Broadcast link"); + NS_LOG_LOGIC ("Router-LSA Broadcast link"); // multiple routers on a broadcast interface // lowest IP address is designated router plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork); @@ -559,8 +584,7 @@ GlobalRouter::DiscoverLSAs (void) if (desigRtr == addrLocal) { listOfDRInterfaces.push_back (ndLocal); - NS_DEBUG("GlobalRouter::DiscoverLSAs (): " << - m_node->GetId () << " is a DR"); + NS_LOG_LOGIC (m_node->GetId () << " is a DR"); } plr->SetLinkId (desigRtr); // Link Data is router's own IP address @@ -574,7 +598,7 @@ GlobalRouter::DiscoverLSAs (void) } else if (ndLocal->IsPointToPoint () ) { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Point-to-point device"); + NS_LOG_LOGIC ("Router-LSA Point-to-point device"); // // Now, we have to find the Ipv4 interface whose netdevice is the one we // just found. This is still the IP on the local side of the channel. There @@ -588,7 +612,7 @@ GlobalRouter::DiscoverLSAs (void) // Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); - NS_DEBUG("Working with local address " << addrLocal); + NS_LOG_LOGIC ("Working with local address " << addrLocal); // // Now, we're going to walk over to the remote net device on the other end of // the point-to-point channel we now know we have. This is where our adjacent @@ -613,7 +637,7 @@ GlobalRouter::DiscoverLSAs (void) NS_ASSERT_MSG(srRemote, "GlobalRouter::DiscoverLSAs():QI for remote failed"); Ipv4Address rtrIdRemote = srRemote->GetRouterId(); - NS_DEBUG("Working with remote router " << rtrIdRemote); + NS_LOG_LOGIC ("Working with remote router " << rtrIdRemote); // // Now, just like we did above, we need to get the IP interface index for the // net device on the other end of the point-to-point channel. @@ -625,7 +649,7 @@ GlobalRouter::DiscoverLSAs (void) // Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote); Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote); - NS_DEBUG("Working with remote address " << addrRemote); + NS_LOG_LOGIC ("Working with remote address " << addrRemote); // // Now we can fill out the link records for this link. There are always two // link records; the first is a point-to-point record describing the link and @@ -655,8 +679,7 @@ GlobalRouter::DiscoverLSAs (void) // The LSA goes on a list of LSAs in case we want to begin exporting other // kinds of advertisements (than Router LSAs). m_LSAs.push_back (pLSA); - NS_DEBUG(*pLSA); - + NS_LOG_LOGIC (*pLSA); // Now, determine whether we need to build a NetworkLSA if (listOfDRInterfaces.size () > 0) @@ -692,7 +715,7 @@ GlobalRouter::DiscoverLSAs (void) pLSA->AddAttachedRouter (tempAddr); } m_LSAs.push_back (pLSA); - NS_DEBUG(*pLSA); + NS_LOG_LOGIC (*pLSA); } } @@ -734,7 +757,7 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr node, uint32_t GlobalRouter::GetNumLSAs (void) const { - NS_DEBUG("GlobalRouter::GetNumLSAs ()"); + NS_LOG_FUNCTION; return m_LSAs.size (); } @@ -744,6 +767,7 @@ GlobalRouter::GetNumLSAs (void) const bool GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const { + NS_LOG_FUNCTION; NS_ASSERT_MSG(lsa.IsEmpty(), "GlobalRouter::GetLSA (): Must pass empty LSA"); // // All of the work was done in GetNumLSAs. All we have to do here is to @@ -773,7 +797,7 @@ GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const Ptr GlobalRouter::GetAdjacent(Ptr nd, Ptr ch) const { - + NS_LOG_FUNCTION; NS_ASSERT_MSG(ch->GetNDevices() == 2, "GlobalRouter::GetAdjacent (): Channel with other than two devices"); // @@ -809,6 +833,7 @@ GlobalRouter::GetAdjacent(Ptr nd, Ptr ch) const uint32_t GlobalRouter::FindIfIndexForDevice(Ptr node, Ptr nd) const { + NS_LOG_FUNCTION; Ptr ipv4 = node->QueryInterface (Ipv4::iid); NS_ASSERT_MSG(ipv4, "QI for interface failed"); for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i ) From 37f939cef718ddac34e515ce1b026be14b0d71d9 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Thu, 13 Sep 2007 22:17:29 -0700 Subject: [PATCH 191/218] disable log unless debug build --- src/core/log.cc | 5 ++- src/core/log.h | 74 ++++++++++++++++++++++++++++++------- src/node/queue.cc | 2 +- tutorial/hello-simulator.cc | 4 +- wscript | 1 + 5 files changed, 69 insertions(+), 17 deletions(-) diff --git a/src/core/log.cc b/src/core/log.cc index 64a288289..fc7576cfa 100644 --- a/src/core/log.cc +++ b/src/core/log.cc @@ -17,6 +17,9 @@ * * Author: Mathieu Lacage */ + +#ifdef NS3_LOG_ENABLE + #include #include #include @@ -295,4 +298,4 @@ LogComponentPrintList (void) } // namespace ns3 - +#endif // NS3_LOG_ENABLE diff --git a/src/core/log.h b/src/core/log.h index f6e8f45a2..1ab45080d 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -17,8 +17,9 @@ * * Author: Mathieu Lacage */ -#ifndef LOG_H -#define LOG_H + +#ifndef __LOG_H__ +#define __LOG_H__ #include #include @@ -61,9 +62,18 @@ * ns3::LogComponentDisable functions or with the NS_LOG * environment variable. */ + +#ifdef NS3_LOG_ENABLE + #define NS_LOG_COMPONENT_DEFINE(name) \ static ns3::LogComponent g_log = ns3::LogComponent (name) +#else + +#define NS_LOG_COMPONENT_DEFINE(name) + +#endif + /** * \ingroup logging * \param msg message to output @@ -74,15 +84,18 @@ * defined with the NS_LOG_COMPONENT_DEFINE macro in the * same file. */ -#define NS_LOG(level, msg) \ - do \ - { \ - if (g_log.IsEnabled (level)) \ - { \ - std::clog << __PRETTY_FUNCTION__ << " ==> " << \ - msg << std::endl; \ - } \ - } \ + +#ifdef NS3_LOG_ENABLE + +#define NS_LOG(level, msg) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << __PRETTY_FUNCTION__ << " ==> " << \ + msg << std::endl; \ + } \ + } \ while (false) #define NS_LOG_F(level) \ @@ -95,7 +108,6 @@ } \ while (false) - #define NS_LOG_ERROR(msg) \ NS_LOG(ns3::LOG_LEVEL_ERROR, msg) @@ -127,8 +139,26 @@ } \ while (false) +#else + +#define NS_LOG(level, msg) +#define NS_LOG_F(level) +#define NS_LOG_ERROR(msg) +#define NS_LOG_WARN(msg) +#define NS_LOG_DEBUG(msg) +#define NS_LOG_INFO(msg) +#define NS_LOG_FUNCTION +#define NS_LOG_PARAM(msg) +#define NS_LOG_LOGIC(msg) +#define NS_LOG_ALL(msg) +#define NS_LOG_UNCOND(msg) + +#endif + namespace ns3 { +#ifdef NS3_LOG_ENABLE + enum LogLevel { LOG_LEVEL_ERROR = 1<<0, // serious error messages only LOG_LEVEL_WARN = 1<<1, // add warning messages @@ -140,6 +170,8 @@ enum LogLevel { LOG_LEVEL_ALL = 1<<30 // print everything }; +#endif + /** * \param name a log component name * \ingroup logging @@ -148,7 +180,11 @@ enum LogLevel { * The logging output can be later disabled with a call * to ns3::LogComponentDisable. */ +#ifdef NS3_LOG_ENABLE void LogComponentEnable (char const *name, enum LogLevel level); +#else +#define LogComponentEnable(a,b) +#endif /** * \param name a log component name @@ -158,7 +194,11 @@ void LogComponentEnable (char const *name, enum LogLevel level); * The logging output can be later re-enabled with a call * to ns3::LogComponentEnable. */ +#ifdef NS3_LOG_ENABLE void LogComponentDisable (char const *name, enum LogLevel level); +#else +#define LogComponentDisable(a,b) +#endif /** * \ingroup logging @@ -170,7 +210,13 @@ void LogComponentDisable (char const *name, enum LogLevel level); * * For example: NS_LOG=print-list */ +#ifdef NS3_LOG_ENABLE void LogComponentPrintList (void); +#else +#define LogComponentPrintList() +#endif + +#ifdef NS3_LOG_ENABLE class LogComponent { public: @@ -183,6 +229,8 @@ private: int32_t m_levels; }; +#endif + } // namespace ns3 -#endif /* LOG_H */ +#endif // __LOG_H__ diff --git a/src/node/queue.cc b/src/node/queue.cc index a2eec08ae..4a622c2b0 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -214,7 +214,7 @@ bool Queue::IsEmpty (void) { NS_LOG_FUNCTION; - NS_LOG_LOGIC ("returns" << (m_nPackets == 0)); + NS_LOG_LOGIC ("returns " << (m_nPackets == 0)); return m_nPackets == 0; } diff --git a/tutorial/hello-simulator.cc b/tutorial/hello-simulator.cc index 84ac0914e..735d98130 100644 --- a/tutorial/hello-simulator.cc +++ b/tutorial/hello-simulator.cc @@ -16,10 +16,10 @@ #include "ns3/log.h" -using namespace ns3; - NS_LOG_COMPONENT_DEFINE ("HelloSimulator"); +using namespace ns3; + int main (int argc, char *argv[]) { diff --git a/wscript b/wscript index 9e54f7050..1e8fd84e2 100644 --- a/wscript +++ b/wscript @@ -119,6 +119,7 @@ def configure(conf): if 'debug' in Params.g_options.debug_level.lower(): variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') + variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') ## In optimized builds we still want debugging symbols, e.g. for ## profiling, and at least partially usable stack traces. From 64363a62311c2d508d6885a98e1517ed147e74fa Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 14 Sep 2007 09:57:53 -0700 Subject: [PATCH 192/218] allow discrete levels --- src/core/log.cc | 68 ++++++++++++++++++++++++--------- src/core/log.h | 47 +++++++++++++++-------- src/mobility/random-position.cc | 6 +-- 3 files changed, 83 insertions(+), 38 deletions(-) diff --git a/src/core/log.cc b/src/core/log.cc index fc7576cfa..6f5bd6acf 100644 --- a/src/core/log.cc +++ b/src/core/log.cc @@ -92,7 +92,7 @@ LogComponentEnableEnvVar (void) if (equal == std::string::npos) { component = tmp; - level = LOG_LEVEL_DEBUG; + level = LOG_DEBUG; } else { @@ -106,33 +106,65 @@ LogComponentEnableEnvVar (void) std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); if (lev == "error") { - level |= LOG_LEVEL_ERROR; + level |= LOG_ERROR; } else if (lev == "warn") { - level |= LOG_LEVEL_WARN; + level |= LOG_WARN; } else if (lev == "debug") { - level |= LOG_LEVEL_DEBUG; + level |= LOG_DEBUG; } else if (lev == "info") { - level |= LOG_LEVEL_INFO; + level |= LOG_INFO; } else if (lev == "function") { - level |= LOG_LEVEL_FUNCTION; + level |= LOG_FUNCTION; } else if (lev == "param") { - level |= LOG_LEVEL_PARAM; + level |= LOG_PARAM; } else if (lev == "logic") { - level |= LOG_LEVEL_LOGIC; + level |= LOG_LOGIC; } else if (lev == "all") + { + level |= LOG_ALL; + } + else if (lev == "errorlevel") + { + level |= LOG_LEVEL_ERROR; + } + else if (lev == "warnlevel") + { + level |= LOG_LEVEL_WARN; + } + else if (lev == "debuglevel") + { + level |= LOG_LEVEL_DEBUG; + } + else if (lev == "infolevel") + { + level |= LOG_LEVEL_INFO; + } + else if (lev == "functionlevel") + { + level |= LOG_LEVEL_FUNCTION; + } + else if (lev == "paramlevel") + { + level |= LOG_LEVEL_PARAM; + } + else if (lev == "logiclevel") + { + level |= LOG_LEVEL_LOGIC; + } + else if (lev == "alllevel") { level |= LOG_LEVEL_ALL; } @@ -191,9 +223,7 @@ bool LogComponent::IsEnabled (enum LogLevel level) const { LogComponentEnableEnvVar (); -// return (level & m_levels) ? 1 : 0; - - return m_levels >= level; + return (level & m_levels) ? 1 : 0; } bool @@ -260,35 +290,35 @@ LogComponentPrintList (void) std::cout << "0" << std::endl; continue; } - if (i->second->IsEnabled (LOG_LEVEL_ERROR)) + if (i->second->IsEnabled (LOG_ERROR)) { std::cout << "error"; } - if (i->second->IsEnabled (LOG_LEVEL_WARN)) + if (i->second->IsEnabled (LOG_WARN)) { std::cout << "|warn"; } - if (i->second->IsEnabled (LOG_LEVEL_DEBUG)) + if (i->second->IsEnabled (LOG_DEBUG)) { std::cout << "|debug"; } - if (i->second->IsEnabled (LOG_LEVEL_INFO)) + if (i->second->IsEnabled (LOG_INFO)) { std::cout << "|info"; } - if (i->second->IsEnabled (LOG_LEVEL_FUNCTION)) + if (i->second->IsEnabled (LOG_FUNCTION)) { std::cout << "|function"; } - if (i->second->IsEnabled (LOG_LEVEL_PARAM)) + if (i->second->IsEnabled (LOG_PARAM)) { std::cout << "|param"; } - if (i->second->IsEnabled (LOG_LEVEL_LOGIC)) + if (i->second->IsEnabled (LOG_LOGIC)) { std::cout << "|logic"; } - if (i->second->IsEnabled (LOG_LEVEL_ALL)) + if (i->second->IsEnabled (LOG_ALL)) { std::cout << "|all"; } diff --git a/src/core/log.h b/src/core/log.h index 1ab45080d..267419bf5 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -109,28 +109,28 @@ while (false) #define NS_LOG_ERROR(msg) \ - NS_LOG(ns3::LOG_LEVEL_ERROR, msg) + NS_LOG(ns3::LOG_ERROR, msg) #define NS_LOG_WARN(msg) \ - NS_LOG(ns3::LOG_LEVEL_WARN, msg) + NS_LOG(ns3::LOG_WARN, msg) #define NS_LOG_DEBUG(msg) \ - NS_LOG(ns3::LOG_LEVEL_DEBUG, msg) + NS_LOG(ns3::LOG_DEBUG, msg) #define NS_LOG_INFO(msg) \ - NS_LOG(ns3::LOG_LEVEL_INFO, msg) + NS_LOG(ns3::LOG_INFO, msg) #define NS_LOG_FUNCTION \ - NS_LOG_F(ns3::LOG_LEVEL_FUNCTION) + NS_LOG_F(ns3::LOG_FUNCTION) #define NS_LOG_PARAM(msg) \ - NS_LOG(ns3::LOG_LEVEL_PARAM, msg) + NS_LOG(ns3::LOG_PARAM, msg) #define NS_LOG_LOGIC(msg) \ - NS_LOG(ns3::LOG_LEVEL_LOGIC, msg) + NS_LOG(ns3::LOG_LOGIC, msg) #define NS_LOG_ALL(msg) \ - NS_LOG(ns3::LOG_LEVEL_ALL, msg) + NS_LOG(ns3::LOG_ALL, msg) #define NS_LOG_UNCOND(msg) \ do \ @@ -160,14 +160,29 @@ namespace ns3 { #ifdef NS3_LOG_ENABLE enum LogLevel { - LOG_LEVEL_ERROR = 1<<0, // serious error messages only - LOG_LEVEL_WARN = 1<<1, // add warning messages - LOG_LEVEL_DEBUG = 1<<2, // add rare ad-hoc debug messages - LOG_LEVEL_INFO = 1<<3, // add informational messages (e.g., banners) - LOG_LEVEL_FUNCTION = 1<<4, // add function tracing - LOG_LEVEL_PARAM = 1<<5, // add parameters to functions - LOG_LEVEL_LOGIC = 1<<6, // add control flow tracing within functions - LOG_LEVEL_ALL = 1<<30 // print everything + LOG_ERROR = 0x0001, // serious error messages only + LOG_LEVEL_ERROR = 0x0001, + + LOG_WARN = 0x0002, // warning messages + LOG_LEVEL_WARN = 0x0003, + + LOG_DEBUG = 0x0004, // rare ad-hoc debug messages + LOG_LEVEL_DEBUG = 0x0007, + + LOG_INFO = 0x0008, // informational messages (e.g., banners) + LOG_LEVEL_INFO = 0x000f, + + LOG_FUNCTION = 0x0010, // function tracing + LOG_LEVEL_FUNCTION = 0x001f, + + LOG_PARAM = 0x0020, // parameters to functions + LOG_LEVEL_PARAM = 0x003f, + + LOG_LOGIC = 0x0040, // control flow tracing within functions + LOG_LEVEL_LOGIC = 0x007f, + + LOG_ALL = 0x4000, // print everything + LOG_LEVEL_ALL = 0x7fff }; #endif diff --git a/src/mobility/random-position.cc b/src/mobility/random-position.cc index 5e821cfc0..4e2a79f69 100644 --- a/src/mobility/random-position.cc +++ b/src/mobility/random-position.cc @@ -21,10 +21,10 @@ #include "ns3/random-variable.h" #include "ns3/default-value.h" #include "ns3/random-variable-default-value.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include -NS_DEBUG_COMPONENT_DEFINE ("RandomPosition"); +NS_LOG_COMPONENT_DEFINE ("RandomPosition"); namespace ns3 { @@ -127,7 +127,7 @@ RandomDiscPosition::Get (void) const double rho = m_rho->GetValue (); double x = m_x + std::cos (theta) * rho; double y = m_y + std::sin (theta) * rho; - NS_DEBUG ("Disc position x=" << x << ", y=" << y); + NS_LOG_DEBUG ("Disc position x=" << x << ", y=" << y); return Position (x, y, 0.0); } From 4430148c5cfb2d6a1d0a1c8d851779e60051399e Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 14:42:31 -0700 Subject: [PATCH 193/218] Enable enqueue/dequeue tracing for point-to-point links --- examples/csma-multicast.cc | 3 +++ examples/simple-point-to-point.cc | 2 +- src/devices/point-to-point/point-to-point-net-device.cc | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 5ca1d79d5..2d70a7ba4 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -63,6 +63,9 @@ main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this // + +NS_LOG_ALL(""); + #if 0 LogComponentEnable ("CsmaMulticastExample", LOG_LEVEL_INFO); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index c4cfef038..720f241a3 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -214,8 +214,8 @@ main (int argc, char *argv[]) // Trace output will be sent to the simple-point-to-point.tr file NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-point-to-point.tr"); - asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); // Also configure some tcpdump traces; each interface will be traced // The output files will be named diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 20140386c..ce3a253eb 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -156,9 +156,12 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, // // // If there's a transmission in progress, we enque the packet for later -// trnsmission; otherwise we send it now. +// transmission; otherwise we send it now. if (m_txMachineState == READY) { +// We still enqueue and dequeue it to hit the tracing hooks + m_queue->Enqueue (p); + m_queue->Dequeue (p); return TransmitStart (p); } else From fc44a66e9bd72ebc1b860999ba76aea6d0c27c56 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 14:52:09 -0700 Subject: [PATCH 194/218] Revert accidental tweaks of example files (not intended for checkin) --- examples/csma-multicast.cc | 3 --- examples/simple-point-to-point.cc | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 2d70a7ba4..5ca1d79d5 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -63,9 +63,6 @@ main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this // - -NS_LOG_ALL(""); - #if 0 LogComponentEnable ("CsmaMulticastExample", LOG_LEVEL_INFO); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 720f241a3..c4cfef038 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -214,8 +214,8 @@ main (int argc, char *argv[]) // Trace output will be sent to the simple-point-to-point.tr file NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-point-to-point.tr"); - asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); // Also configure some tcpdump traces; each interface will be traced // The output files will be named From f434261a96f73d097039913b00666c8096c533d8 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 14:55:18 -0700 Subject: [PATCH 195/218] Remove temporary module documentation --- README.multicast-routing | 235 --------------------------------------- 1 file changed, 235 deletions(-) delete mode 100644 README.multicast-routing diff --git a/README.multicast-routing b/README.multicast-routing deleted file mode 100644 index 2fe30532e..000000000 --- a/README.multicast-routing +++ /dev/null @@ -1,235 +0,0 @@ -Static multicast routing overview --------------------------------- - -This is brief documentation of a proposal to add static multicast -routing to ns-3. - -This extension allows the simulation user to: - -- manually add Ipv4 multicast routes to a router -- specify a default outgoing interface for multicast sources (hosts) in - various ways -- allow a multicast receiver (hosts) to join a multicast group, to enable - reception of that group's datagrams - -1. Code location: - -- http://code.nsnam.org/craigdo/ns-3-mc - -- the main source code is found in src/internet-node/ipv4-static-routing.{cc,h} - -also touched are: -- src/internet-node/ipv4-l3-protocol.cc (forwarding methods for the - static routing API) -- src/node/net-device.cc (provides virtual NetDevice::MakeMulticastAddress) -- src/arp-ipv4-interface.cc (calls NetDevice::MakeMulticastAddress) -- src/devices/csma/csma-net-device.cc (handles multicast addressing and - reception). -- src/devices/point-to-point/point-to-point-net-device.cc (implements required - virtual methods. -- src/internet-node/ (several files have added tracing) - -- a heavily commented example script is in examples/csma-multicast.cc - -2. API: - -The API for adding a multicast route is: - -/** - * @brief Add a multicast route to the static routing table. - * - * A multicast route must specify an origin IP address, a multicast group and - * an input network interface index as conditions and provide a vector of - * output network interface indices over which packets matching the conditions - * are sent. - * - * Typically there are two main types of multicast routes: routes of the - * first kind are used during forwarding. All of the conditions must be - * exlicitly provided. The second kind of routes are used to get packets off - * of a local node. The difference is in the input interface. Routes for - * forwarding will always have an explicit input interface specified. Routes - * off of a node will always set the input interface to a wildcard specified - * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. - * - * For routes off of a local node wildcards may be used in the origin and - * multicast group addresses. The wildcard used for Ipv4Adresses is that - * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage - * of a wildcard allows one to specify default behavior to varying degrees. - * - * For example, making the origin address a wildcard, but leaving the - * multicast group specific allows one (in the case of a node with multiple - * interfaces) to create different routes using different output interfaces - * for each multicast group. - * - * If the origin and multicast addresses are made wildcards, you have created - * essentially a default multicast address that can forward to multiple - * interfaces. Compare this to the actual default multicast address that is - * limited to specifying a single output interface for compatibility with - * existing functionality in other systems. - * - * @param origin The Ipv4Address of the origin of packets for this route. May - * be Ipv4Address:GetAny for open groups. - * @param group The Ipv4Address of the multicast group or this route. - * @param inputInterface The input network interface index over which to - * expect packets destined for this route. May be - * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. - * @param outputInterface A vector of network interface indices used to specify - * how to send packets to the destination(s). - * - * @see Ipv4Address - */ - Ipv4::AddMulticastRoute (Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces) - -To remove a route, one uses: - -/** - * @brief Remove a route from the static multicast routing table. - * - * Externally, the multicast static routing table appears simply as a table - * with n entries. The one sublety of note is that if a default multicast - * route has been set it will appear as the zeroth entry in the table. This - * means that the default route may be removed by calling this method with - * appropriate wildcard parameters. - * - * This method causes the multicast routing table to be searched for the first - * route that matches the parameters and removes it. - * - * Wildcards may be provided to this function, but the wildcards are used to - * exacly match wildcards in the routes (see AddMulticastRoute). That is, - * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not - * remove routes with any address in the origin, but will only remove routes - * with "0.0.0.0" set as the the origin. - * - * @param origin The IP address specified as the origin of packets for the - * route. - * @param origin The IP address specified as the multicast group addres of - * the route. - * @param inputInterfade The network interface index specified as the expected - * input interface for the route. - * @returns True if a route was found and removed, false otherwise. - * - * @see Ipv4MulticastRoute - * @see Ipv4StaticRouting::AddMulticastRoute - */ - Ipv4::RemoveMulticastRoute (Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface) - -For symmetry with the unicast routing interface, a method is provided to -remove routes by index: - -/** - * @brief Remove a route from the static multicast routing table. - * - * Externally, the multicast static routing table appears simply as a table - * with n entries. The one sublety of note is that if a default multicast - * route has been set it will appear as the zeroth entry in the table. This - * means that if the default route has been set, calling - * RemoveMulticastRoute (0) will remove the default route. - * - * @param index The index (into the multicast routing table) of the route to - * remove. If the default route has been set, it will occupy index zero. - * - * @see Ipv4Route - * @see Ipv4StaticRouting::GetRoute - * @see Ipv4StaticRouting::AddRoute - */ - void RemoveMulticastRoute (uint32_t index); - -For compatibility, and to provide simplicity, one can set a default multicast -route for a host originating data: - -/** - * @brief Add a default multicast route to the static routing table. - * - * This is the multicast equivalent of the unicast version SetDefaultRoute. - * We tell the routing system what to do in the case where a specific route - * to a destination multicast group is not found. The system forwards - * packets out the specified interface in the hope that "something out there" - * knows better how to route the packet. This method is only used in - * initially sending packets off of a host. The default multicast route is - * not consulted during forwarding -- exact routes must be specified using - * AddMulticastRoute for that case. - * - * Since we're basically sending packets to some entity we think may know - * better what to do, we don't pay attention to "subtleties" like origin - * address, nor do we worry about forwarding out multiple interfaces. If the - * default multicast route is set, it is returned as the selected route from - * LookupStatic irrespective of origin or multicast group if another specific - * route is not found. - * - * @param outputInterface The network interface index used to specify where - * to send packets in the case of unknown routes. - * - * @see Ipv4Address - */ - Ipv4::SetDefaultMulticastRoute (uint32_t outputInterface) - -For a host wanting to receive multicast data, the following function is used -to join each multicast group. - - /** - * \brief Join a multicast group for a given multicast source and - * group. - * - * \param origin The Ipv4 address of the multicast source. - * \param group The multicast group address. - */ - Ipv4::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); - -To stop receiving multicast data, the following function is used: - - /** - * \brief Leave a multicast group for a given multicast source and - * group. - * - * \param origin The Ipv4 address of the multicast source. - * \param group The multicast group address. - */ - LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); - -There are new lookup functions implemented in Ipv4: - - /** - * \brief Find and return the interface ID of the interface that has been - * assigned the specified IP address. - * \param addr The IP address assigned to the interface of interest. - * \returns The index of the ipv4 interface with the given address. - * - * Each IP interface has an IP address associated with it. It is often - * useful to search the list of interfaces for one that corresponds to - * a known IP Address. This call takes an IP address as a parameter and - * returns the interface index of the first interface that has been assigned - * that address. If the address is not found, this function asserts. - */ - Ipv4::FindInterfaceForAddr (Ipv4Address addr) const; - - /** - * \brief Find and return the interface ID of the interface that has been - * assigned the specified (masked) IP address. - * \param addr The IP address assigned to the interface of interest. - * \param mask The address mask to be used in address matching. - * \returns The index of the ipv4 interface with the given address. - * - * Each IP interface has an IP address associated with it. It is often - * useful to search the list of interfaces for one that corresponds to - * a known IP Address. This call takes an IP address and an IP address - * mask as parameters and returns the interface index of the first interface - * that matches the masked IP address. - */ - Ipv4::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; - -Also, there are various methods to lookup and iterate the static multicast -routes of a node, in the Ipv4StaticRouting class. - -3. Dependencies: - -- fix for bug 69 (source Ipv4 address is set correctly for UDP) -- fix for OnOffApplication that receives data - -4. Open issues or features not included - -- choose source interface on a per-group basis when a host is multihomed From 926228e2525b965e1aa2731587d93745cea6901b Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 15:46:04 -0700 Subject: [PATCH 196/218] remove local address setting from UdpSocket::Connect() --- src/internet-node/udp-socket.cc | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 9212614fa..9f4f6744d 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -183,19 +183,6 @@ UdpSocket::Connect(const Address & address) NotifyConnectionSucceeded (); m_connected = true; - NS_LOG_LOGIC ("Updating local address"); - - uint32_t localIfIndex; - - Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); - - if (ipv4->GetIfIndexForDestination (m_defaultAddress, localIfIndex)) - { - m_endPoint->SetLocalAddress (ipv4->GetAddress(localIfIndex)); - } - - NS_LOG_LOGIC ("Local address is " << m_endPoint->GetLocalAddress()); - return 0; } From d4f4fdd202d46269a60d234ef505d6368308b138 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 15:57:49 -0700 Subject: [PATCH 197/218] add PacketSinks, change port number to UDP discard port, fix comment on onoff-application, delete logic for setting a default route --- examples/csma-broadcast.cc | 47 +++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index 84efdd4f1..acd09e07b 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -24,8 +24,8 @@ // | | // ========== // -// n0 originates UDP broadcast to 255.255.255.255, which is replicated -// and received on both n1 and n2 +// n0 originates UDP broadcast to 255.255.255.255/discard port, which +// is replicated and received on both n1 and n2 #include #include @@ -56,6 +56,7 @@ #include "ns3/socket.h" #include "ns3/ipv4-route.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" using namespace ns3; @@ -87,10 +88,10 @@ main (int argc, char *argv[]) LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + // Enable the below logging command to see the packets being received LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif + // Set up some default values for the simulation. Use the Bind() // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -145,31 +146,41 @@ main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address ( n2, n2ifIndex, Ipv4Address("192.168.1.2"), Ipv4Mask("255.255.255.0")); - // XXX Is this the right thing to do? - // - // The OnOff application uses a connected socket. This socket needs to be - // able to figure out which interface to use as the source address for - // packets. When there's one interface, this isn't too hard, but node zero - // has two interfaces, and limited broadcasts will be sent out both of those - // interfaces. We need to provide some way to disambiguate the choice. - // If we supply a default route, the specified interface will be chosen. - - Ptr ipv4 = n0->QueryInterface (Ipv4::iid); - ipv4->SetDefaultRoute ("192.168.1.3", n0ifIndex0); + // RFC 863 discard port indicates packet should be thrown away + // by the system. We allow this silent discard to be overridden + // by the PacketSink application. + uint16_t discard_port = 9; // Create the OnOff application to send UDP datagrams of size - // 210 bytes at a rate of 448 Kb/s - // from n0 to n1 + // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, - InetSocketAddress ("255.255.255.255", 80), + InetSocketAddress ("255.255.255.255", discard_port), "Udp", ConstantVariable(1), ConstantVariable(0)); // Start the application ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); + + // Create an optional packet sink to receive these packets + Ptr sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), discard_port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + + // Create an optional packet sink to receive these packets + sink = Create ( + n2, + InetSocketAddress (Ipv4Address::GetAny (), discard_port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); NS_LOG_INFO ("Configure Tracing."); // Configure tracing of all enqueue, dequeue, and NetDevice receive events From fd07fd46c21ad886b071d910c9d6b96ba2a5b353 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 16:11:36 -0700 Subject: [PATCH 198/218] change ephemeral port range to 49152-65535 (IANA recommendation) --- src/internet-node/ipv4-end-point-demux.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/internet-node/ipv4-end-point-demux.cc b/src/internet-node/ipv4-end-point-demux.cc index d17c450d8..20dc0d271 100644 --- a/src/internet-node/ipv4-end-point-demux.cc +++ b/src/internet-node/ipv4-end-point-demux.cc @@ -28,7 +28,7 @@ namespace ns3{ NS_LOG_COMPONENT_DEFINE ("Ipv4EndPointDemux"); Ipv4EndPointDemux::Ipv4EndPointDemux () - : m_ephemeral (1025) + : m_ephemeral (49152) { NS_LOG_FUNCTION; } @@ -246,9 +246,9 @@ Ipv4EndPointDemux::AllocateEphemeralPort (void) do { port++; - if (port > 5000) + if (port == 65535) { - port = 1024; + port = 49152; } if (!LookupPortLocal (port)) { From 2d6485b277d60cf03a81356e2b3a8c826bf8fd60 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 16:17:10 -0700 Subject: [PATCH 199/218] change port number used by example scripts to 'discard' or 'echo' instead of '80' --- examples/csma-broadcast.cc | 10 +++++----- examples/csma-multicast.cc | 5 ++++- examples/csma-one-subnet.cc | 5 +++-- examples/mixed-global-routing.cc | 3 ++- examples/simple-global-routing.cc | 9 +++++---- examples/simple-point-to-point.cc | 9 +++++---- examples/udp-echo.cc | 2 +- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index acd09e07b..06775e26d 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -146,17 +146,17 @@ main (int argc, char *argv[]) CsmaIpv4Topology::AddIpv4Address ( n2, n2ifIndex, Ipv4Address("192.168.1.2"), Ipv4Mask("255.255.255.0")); - // RFC 863 discard port indicates packet should be thrown away + // RFC 863 discard port ("9") indicates packet should be thrown away // by the system. We allow this silent discard to be overridden // by the PacketSink application. - uint16_t discard_port = 9; + uint16_t port = 9; // Create the OnOff application to send UDP datagrams of size // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, - InetSocketAddress ("255.255.255.255", discard_port), + InetSocketAddress ("255.255.255.255", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -167,7 +167,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets Ptr sink = Create ( n1, - InetSocketAddress (Ipv4Address::GetAny (), discard_port), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.0)); @@ -176,7 +176,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets sink = Create ( n2, - InetSocketAddress (Ipv4Address::GetAny (), discard_port), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.0)); diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 5ca1d79d5..3e8551a13 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -274,9 +274,12 @@ main (int argc, char *argv[]) // multicast group (node four will be listening). // NS_LOG_INFO ("Create Applications."); + + uint16_t port = 9; // Discard port (RFC 863) + Ptr ooff = Create ( n0, - InetSocketAddress (multicastGroup, 80), + InetSocketAddress (multicastGroup, port), "Udp", ConstantVariable(1), ConstantVariable(0), diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index dfc41a88e..76918cbb7 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -164,9 +164,10 @@ main (int argc, char *argv[]) // Create an OnOff application to send UDP datagrams from node zero to node 1. // NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.1.2", 80), + InetSocketAddress ("10.1.1.2", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -180,7 +181,7 @@ main (int argc, char *argv[]) // ooff = Create ( n3, - InetSocketAddress ("10.1.1.1", 80), + InetSocketAddress ("10.1.1.1", port), "Udp", ConstantVariable(1), ConstantVariable(0)); diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index ba2901a65..e5eb8dd97 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -190,9 +190,10 @@ main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable (1), ConstantVariable (0), diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 8c6bd9db6..362ca7af3 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -162,9 +162,10 @@ main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable (1), ConstantVariable (0)); @@ -176,7 +177,7 @@ main (int argc, char *argv[]) // The last argument "true" disables output from the Receive callback Ptr sink = Create ( n3, - InetSocketAddress (Ipv4Address::GetAny (), 80), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.0)); @@ -185,7 +186,7 @@ main (int argc, char *argv[]) // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, - InetSocketAddress ("10.1.2.1", 80), + InetSocketAddress ("10.1.2.1", port), "Udp", ConstantVariable (1), ConstantVariable (0)); @@ -196,7 +197,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets sink = Create ( n1, - InetSocketAddress (Ipv4Address::GetAny (), 80), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.1)); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index c4cfef038..5bbde9bca 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -162,9 +162,10 @@ main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -175,7 +176,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets Ptr sink = Create ( n3, - InetSocketAddress (Ipv4Address::GetAny (), 80), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.0)); @@ -184,7 +185,7 @@ main (int argc, char *argv[]) // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, - InetSocketAddress ("10.1.2.1", 80), + InetSocketAddress ("10.1.2.1", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -195,7 +196,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets sink = Create ( n1, - InetSocketAddress (Ipv4Address::GetAny (), 80), + InetSocketAddress (Ipv4Address::GetAny (), port), "Udp"); // Start the sink sink->Start (Seconds (1.1)); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 70fcf4895..8eebef638 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -165,7 +165,7 @@ main (int argc, char *argv[]) // // Create a UdpEchoServer application on node one. // - uint16_t port = 80; + uint16_t port = 9; // well-known echo port number Ptr server = Create (n1, port); // From 00e9e4c170467ccd22b5c06e9c7f72780ec93673 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 14 Sep 2007 16:23:49 -0700 Subject: [PATCH 200/218] Add PacketSink to receive multicast --- examples/csma-multicast.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index 3e8551a13..942485f50 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -51,6 +51,7 @@ #include "ns3/socket.h" #include "ns3/ipv4-route.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" using namespace ns3; @@ -87,6 +88,7 @@ main (int argc, char *argv[]) LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); #endif // // Set up default values for the simulation. Use the DefaultValue::Bind() @@ -277,6 +279,8 @@ main (int argc, char *argv[]) uint16_t port = 9; // Discard port (RFC 863) + // Configure a multicast packet generator that generates a packet + // every few seconds Ptr ooff = Create ( n0, InetSocketAddress (multicastGroup, port), @@ -290,6 +294,18 @@ main (int argc, char *argv[]) // ooff->Start(Seconds(1.)); ooff->Stop (Seconds(10.)); + + // Create an optional packet sink to receive these packets + // If you enable logging on this (above) it will print a log statement + // for every packet received + Ptr sink = Create ( + n4, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + // // Configure tracing of all enqueue, dequeue, and NetDevice receive events. // Trace output will be sent to the file "csma-multicast.tr" From 3cbce20a243387a386906604a6623abacf6a34f5 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 15 Sep 2007 13:52:59 -0700 Subject: [PATCH 201/218] release notes for 3.0.6 --- RELEASE_NOTES | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 85a5f2d6e..e429e5fec 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -3,6 +3,13 @@ This file contains ns-3 release notes (most recent releases first). +Release 3.0.6 (2007/09/15) +======================== + - Static multicast IPv4 routing + - Logging overhaul (NS_LOG macros) + - Refactoring of tracing subsystem + - Tutorial document started + Release 3.0.5 (2007/08/15) ======================== From 313dd538485cb75e15795bafb037606e3b29b7dd Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 15 Sep 2007 13:56:21 -0700 Subject: [PATCH 202/218] bump version number --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index eca690e73..818bd47ab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.5 +3.0.6 From 6c1a715320e41f41a1a6e35b9e0882284da7153b Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 15 Sep 2007 14:07:35 -0700 Subject: [PATCH 203/218] Added tag release ns-3.0.6 for changeset 606df29888e7 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 68f54ead8..35f08ab9c 100644 --- a/.hgtags +++ b/.hgtags @@ -5,3 +5,4 @@ 5701e60bf01a8ac1308945e69001e0cc07948faf release ns-3.0.4 08046b6aef37932507696a2f2f427b42d693781e release ns-3.0.5 267e2ebc28e4e4ae2f579e1cfc29902acade0c34 buffer-working-before-breaking +606df29888e7573b825fc891a002f0757166b616 release ns-3.0.6 From 3b1b774105f7e55ed1da2d016d5ea0867a376430 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 21 Sep 2007 15:54:00 +0100 Subject: [PATCH 204/218] Add a couple of Udp socket unit tests: unicast (passing) and broadcast (failing, bug #51). --- src/internet-node/udp-socket.cc | 129 ++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 9f4f6744d..965ef8756 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -332,3 +332,132 @@ UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) } } //namespace ns3 + + +#ifdef RUN_SELF_TESTS + +#include "ns3/test.h" +#include "ns3/internet-node.h" +#include "ns3/socket-factory.h" +#include "ns3/udp.h" +#include "ns3/simulator.h" +#include "ns3/point-to-point-channel.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/drop-tail-queue.h" +#include + +namespace ns3 { + +class UdpSocketTest: public Test +{ + Packet m_receivedPacket; + Packet m_receivedPacket2; + +public: + virtual bool RunTests (void); + UdpSocketTest (); + + void ReceivePacket (Ptr socket, const Packet &packet, const Address &from); + void ReceivePacket2 (Ptr socket, const Packet &packet, const Address &from); +}; + + +UdpSocketTest::UdpSocketTest () + : Test ("UdpSocket") {} + + +void UdpSocketTest::ReceivePacket (Ptr socket, const Packet &packet, const Address &from) +{ + m_receivedPacket = packet; +} + +void UdpSocketTest::ReceivePacket2 (Ptr socket, const Packet &packet, const Address &from) +{ + m_receivedPacket2 = packet; +} + +bool +UdpSocketTest::RunTests (void) +{ + bool result = true; + + // Create topology + + // Receiver Node + Ptr rxNode = Create (); + Ptr rxDev = Create (rxNode); + rxDev->AddQueue(Create ()); + Ptr ipv4 = rxNode->QueryInterface (Ipv4::iid); + uint32_t netdev_idx = ipv4->AddInterface (rxDev); + ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1")); + ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U)); + ipv4->SetUp (netdev_idx); + + // Sender Node + Ptr txNode = Create (); + Ptr txDev = Create (txNode); + txDev->AddQueue(Create ()); + ipv4 = txNode->QueryInterface (Ipv4::iid); + netdev_idx = ipv4->AddInterface (txDev); + ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2")); + ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U)); + ipv4->SetUp (netdev_idx); + + // link the two nodes + Ptr channel = Create (); + rxDev->Attach (channel); + txDev->Attach (channel); + + + // Create the UDP sockets + Ptr socketFactory = rxNode->QueryInterface (Udp::iid); + Ptr rxSocket = socketFactory->CreateSocket (); + NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (1234)), 0); + rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this)); + + socketFactory = txNode->QueryInterface (Udp::iid); + Ptr txSocket = socketFactory->CreateSocket (); + + // ------ Now the tests ------------ + + // Unicast test + m_receivedPacket = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("10.0.0.1"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + + + // Simple broadcast test + + m_receivedPacket = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + + // Broadcast test with multiple receiving sockets + + // When receiving broadcast packets, all sockets sockets bound to + // the address/port should receive a copy of the same packet. + Ptr rxSocket2 = socketFactory->CreateSocket (); + rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this)); + NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("10.0.0.1"), 1234)), 0); + + m_receivedPacket = Packet (); + m_receivedPacket2 = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + NS_TEST_ASSERT_EQUAL (m_receivedPacket2.GetSize (), 123); + + return result; +} + + +static UdpSocketTest gUdpSocketTest; + +}; // namespace ns3 + +#endif /* RUN_SELF_TESTS */ From c887d8b48a1fa2241059ee093b012df97b0c98b3 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 21 Sep 2007 15:57:20 +0100 Subject: [PATCH 205/218] Fix a small error in the unit test added recently (though it doesn't change the result) --- src/internet-node/udp-socket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 965ef8756..5ee7b8646 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -441,7 +441,7 @@ UdpSocketTest::RunTests (void) // When receiving broadcast packets, all sockets sockets bound to // the address/port should receive a copy of the same packet. Ptr rxSocket2 = socketFactory->CreateSocket (); - rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this)); + rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket2, this)); NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("10.0.0.1"), 1234)), 0); m_receivedPacket = Packet (); From d225ef79393e17091a09aa09994f06ba62a91e65 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 21 Sep 2007 17:57:06 +0100 Subject: [PATCH 206/218] Use NS_TEST_* macros for simulator unit tests --- src/simulator/simulator.cc | 62 ++++++++++++++------------------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 6ee0340fd..5002cec81 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -762,7 +762,7 @@ SimulatorTests::cbaz5c (const int &, const int &, const int &, const int &, cons bool SimulatorTests::RunOneTest (void) { - bool ok = true; + bool result = true; m_a = true; m_b = false; m_c = true; @@ -772,26 +772,16 @@ SimulatorTests::RunOneTest (void) Simulator::Schedule (MicroSeconds (11), &SimulatorTests::B, this, 2); m_idC = Simulator::Schedule (MicroSeconds (12), &SimulatorTests::C, this, 3); - if (m_idC.IsExpired ()) - { - ok = false; - } - if (a.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!m_idC.IsExpired ()); + NS_TEST_ASSERT (!a.IsExpired ()); Simulator::Cancel (a); - if (!a.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (a.IsExpired ()); Simulator::Run (); - - if (!m_a || !m_b || !m_c || !m_d) - { - ok = false; - } - return ok; + NS_TEST_ASSERT (m_a); + NS_TEST_ASSERT (m_b); + NS_TEST_ASSERT (m_c); + NS_TEST_ASSERT (m_d); + return result; } void SimulatorTests::RunTestsConst (void) const @@ -870,24 +860,26 @@ SimulatorTests::RunTestsConst (void) const bool SimulatorTests::RunTests (void) { - bool ok = true; + bool result = true; + + Simulator::Run (); // flush out any pending events before running our tests Simulator::SetLinkedList (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); Simulator::SetBinaryHeap (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); Simulator::SetStdMap (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); @@ -1018,36 +1010,26 @@ SimulatorTests::RunTests (void) EventId nowId = Simulator::ScheduleNow (&foo0); m_destroyId = Simulator::ScheduleDestroy (&SimulatorTests::destroy, this); - if (m_destroyId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!m_destroyId.IsExpired ()); Simulator::Run (); m_destroy = false; Simulator::Destroy (); - if (!m_destroy) - { - ok = false; - } + NS_TEST_ASSERT (m_destroy); EventId anId = Simulator::ScheduleNow (&foo0); EventId anotherId = anId; - if (anId.IsExpired () || anotherId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!(anId.IsExpired () || anotherId.IsExpired ())); + Simulator::Remove (anId); - if (!anId.IsExpired () || !anotherId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (anId.IsExpired ()); + NS_TEST_ASSERT (anotherId.IsExpired ()); Simulator::Run (); Simulator::Destroy (); - return ok; + return result; } SimulatorTests gSimulatorTests; From b32284c17b03c119d755bf914d93401b217cbb93 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 21 Sep 2007 18:04:53 +0100 Subject: [PATCH 207/218] Call Simulator::Destroy () before running simulator unit tests, to force time to start from zero (some tests check for absolute times) --- src/simulator/simulator.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 5002cec81..e00f548b5 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -862,8 +862,7 @@ SimulatorTests::RunTests (void) { bool result = true; - Simulator::Run (); // flush out any pending events before running our tests - + Simulator::Destroy (); Simulator::SetLinkedList (); if (!RunOneTest ()) { From af2a06374f47c32cfc94bd6b3325d1fadfb53913 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 21 Sep 2007 18:07:54 +0100 Subject: [PATCH 208/218] Remove a redundant log message --- src/internet-node/ipv4-end-point-demux.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/internet-node/ipv4-end-point-demux.cc b/src/internet-node/ipv4-end-point-demux.cc index 20dc0d271..83708c6b9 100644 --- a/src/internet-node/ipv4-end-point-demux.cc +++ b/src/internet-node/ipv4-end-point-demux.cc @@ -187,15 +187,6 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { - NS_LOG_LOGIC ("Ipv4EndPointDemux::Lookup against " << - (*i)->GetLocalAddress () - << ":" << - (*i)->GetLocalPort () - << " " << - (*i)->GetPeerAddress () - << ":" - << (*i)->GetPeerPort ()); - if ((*i)->GetLocalPort () != dport) { continue; From e077a600803bf3693772ad00098da53f6bdc8672 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 24 Sep 2007 11:00:08 +0100 Subject: [PATCH 209/218] Fix a regression in handling of broadcast packets and UDP sockets (closes bug #51). --- src/internet-node/ipv4-end-point-demux.cc | 32 ++++++++++++++++++----- src/internet-node/ipv4-end-point-demux.h | 4 ++- src/internet-node/ipv4-l3-protocol.cc | 11 +++++--- src/internet-node/ipv4-l3-protocol.h | 2 +- src/internet-node/ipv4-l4-protocol.h | 5 +++- src/internet-node/udp-l4-protocol.cc | 7 ++--- src/internet-node/udp-l4-protocol.h | 3 ++- src/internet-node/udp-socket.cc | 14 +++++----- 8 files changed, 54 insertions(+), 24 deletions(-) diff --git a/src/internet-node/ipv4-end-point-demux.cc b/src/internet-node/ipv4-end-point-demux.cc index 83708c6b9..8ad8c6a3f 100644 --- a/src/internet-node/ipv4-end-point-demux.cc +++ b/src/internet-node/ipv4-end-point-demux.cc @@ -85,6 +85,7 @@ Ipv4EndPointDemux::Allocate (void) } Ipv4EndPoint *endPoint = new Ipv4EndPoint (Ipv4Address::GetAny (), port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } @@ -92,7 +93,7 @@ Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address) { NS_LOG_FUNCTION; - NS_LOG_PARAM ("(" << address << ")"); + NS_LOG_PARAM ("(" << this << ", " << address << ")"); uint16_t port = AllocateEphemeralPort (); if (port == 0) { @@ -101,6 +102,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address address) } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } @@ -115,7 +117,7 @@ Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address, uint16_t port) { NS_LOG_FUNCTION; - NS_LOG_PARAM ("(" << address << ", " << port << ")"); + NS_LOG_PARAM ("(" << this << ", " << address << ", " << port << ")"); if (LookupLocal (address, port)) { NS_LOG_WARN ("Duplicate address/port; failing."); @@ -123,6 +125,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address address, uint16_t port) } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } @@ -150,6 +153,9 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4EndPoint *endPoint = new Ipv4EndPoint (localAddress, localPort); endPoint->SetPeer (peerAddress, peerPort); m_endPoints.push_back (endPoint); + + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); + return endPoint; } @@ -175,7 +181,8 @@ Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) */ Ipv4EndPointDemux::EndPoints Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, - Ipv4Address saddr, uint16_t sport) + Ipv4Address saddr, uint16_t sport, + Ptr incomingInterface) { NS_LOG_FUNCTION; uint32_t genericity = 3; @@ -187,19 +194,32 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { + NS_LOG_DEBUG ("Looking at endpoint dport=" << (*i)->GetLocalPort () + << " daddr=" << (*i)->GetLocalAddress () + << " sport=" << (*i)->GetPeerPort () + << " saddr=" << (*i)->GetPeerAddress ()); if ((*i)->GetLocalPort () != dport) { + NS_LOG_LOGIC ("Skipping endpoint " << &(*i) + << " because endpoint dport " + << (*i)->GetLocalPort () + << " does not match packet dport " << dport); continue; } + bool isBroadcast = + (daddr.IsBroadcast () || + daddr.IsSubnetDirectedBroadcast (incomingInterface->GetNetworkMask ())); + NS_LOG_DEBUG ("dest addr " << daddr << " broadcast? " << isBroadcast); + NS_LOG_LOGIC ("Local address matches: " << - bool ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ())); + bool ((*i)->GetLocalAddress () == daddr || isBroadcast)); NS_LOG_LOGIC ("Peer port matches: " << - bool ((*i)->GetPeerPort () == sport || sport == 0)); + bool ((*i)->GetPeerPort () == sport || (*i)->GetPeerPort () == 0)); NS_LOG_LOGIC ("Peer address matches: " << bool ((*i)->GetPeerAddress () == saddr || (*i)->GetPeerAddress () == Ipv4Address::GetAny ())); - if ( ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ()) + if ( ((*i)->GetLocalAddress () == daddr || isBroadcast) && ((*i)->GetPeerPort () == sport || (*i)->GetPeerPort () == 0) && ((*i)->GetPeerAddress () == saddr || (*i)->GetPeerAddress () == Ipv4Address::GetAny ())) { diff --git a/src/internet-node/ipv4-end-point-demux.h b/src/internet-node/ipv4-end-point-demux.h index e45a6267b..5ffff86bd 100644 --- a/src/internet-node/ipv4-end-point-demux.h +++ b/src/internet-node/ipv4-end-point-demux.h @@ -25,6 +25,7 @@ #include #include #include "ns3/ipv4-address.h" +#include "ipv4-interface.h" namespace ns3 { @@ -43,7 +44,8 @@ public: EndPoints Lookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, - uint16_t sport); + uint16_t sport, + Ptr incomingInterface); Ipv4EndPoint *Allocate (void); Ipv4EndPoint *Allocate (Ipv4Address address); diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index 50fd2e39a..4691b977a 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -546,11 +546,13 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc NS_LOG_LOGIC ("Packet from " << from); uint32_t index = 0; + Ptr ipv4Interface; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { - if ((*i)->GetDevice () == device) + ipv4Interface = *i; + if (ipv4Interface->GetDevice () == device) { m_rxTrace (p, index); break; @@ -572,7 +574,7 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc } NS_LOG_LOGIC ("Forward up"); - ForwardUp (packet, ipHeader); + ForwardUp (packet, ipHeader, ipv4Interface); } @@ -745,14 +747,15 @@ Ipv4L3Protocol::Forwarding ( } void -Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip) +Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip, + Ptr incomingInterface) { NS_LOG_FUNCTION; NS_LOG_PARAM ("(" << &p << ", " << &ip << ")"); Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); - protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); + protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface); } void diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 001852571..bea82707e 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -227,7 +227,7 @@ private: Packet const &packet, Ipv4Header &ipHeader, Ptr device); - void ForwardUp (Packet p, Ipv4Header const&ip); + void ForwardUp (Packet p, Ipv4Header const&ip, Ptr incomingInterface); uint32_t AddIpv4Interface (Ptr interface); void SetupLoopback (void); diff --git a/src/internet-node/ipv4-l4-protocol.h b/src/internet-node/ipv4-l4-protocol.h index e54dfcc97..6f1dad714 100644 --- a/src/internet-node/ipv4-l4-protocol.h +++ b/src/internet-node/ipv4-l4-protocol.h @@ -26,6 +26,7 @@ #define IPV4_L4_PROTOCOL_H #include "ns3/object.h" +#include "ipv4-interface.h" namespace ns3 { @@ -59,13 +60,15 @@ public: * \param p packet to forward up * \param source source address of packet received * \param destination address of packet received + * \param incomingInterface the Ipv4Interface on which the packet arrived * * Called from lower-level layers to send the packet up * in the stack. */ virtual void Receive(Packet& p, Ipv4Address const &source, - Ipv4Address const &destination) = 0; + Ipv4Address const &destination, + Ptr incomingInterface) = 0; protected: virtual void DoDispose (void); private: diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index 8d7bd395f..cbf8cbf52 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -123,8 +123,9 @@ UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) void UdpL4Protocol::Receive(Packet& packet, - Ipv4Address const &source, - Ipv4Address const &destination) + Ipv4Address const &source, + Ipv4Address const &destination, + Ptr interface) { NS_LOG_FUNCTION; NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << destination << @@ -134,7 +135,7 @@ UdpL4Protocol::Receive(Packet& packet, packet.RemoveHeader (udpHeader); Ipv4EndPointDemux::EndPoints endPoints = m_endPoints->Lookup (destination, udpHeader.GetDestination (), - source, udpHeader.GetSource ()); + source, udpHeader.GetSource (), interface); for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin (); endPoint != endPoints.end (); endPoint++) { diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 46fe62761..10502e10c 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -85,7 +85,8 @@ public: // inherited from Ipv4L4Protocol virtual void Receive(Packet& p, Ipv4Address const &source, - Ipv4Address const &destination); + Ipv4Address const &destination, + Ptr interface); protected: virtual void DoDispose (void); private: diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 5ee7b8646..e890f87ec 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -410,13 +410,13 @@ UdpSocketTest::RunTests (void) // Create the UDP sockets - Ptr socketFactory = rxNode->QueryInterface (Udp::iid); - Ptr rxSocket = socketFactory->CreateSocket (); - NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (1234)), 0); + Ptr rxSocketFactory = rxNode->QueryInterface (Udp::iid); + Ptr rxSocket = rxSocketFactory->CreateSocket (); + NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 1234)), 0); rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this)); - socketFactory = txNode->QueryInterface (Udp::iid); - Ptr txSocket = socketFactory->CreateSocket (); + Ptr txSocketFactory = txNode->QueryInterface (Udp::iid); + Ptr txSocket = txSocketFactory->CreateSocket (); // ------ Now the tests ------------ @@ -440,9 +440,9 @@ UdpSocketTest::RunTests (void) // When receiving broadcast packets, all sockets sockets bound to // the address/port should receive a copy of the same packet. - Ptr rxSocket2 = socketFactory->CreateSocket (); + Ptr rxSocket2 = rxSocketFactory->CreateSocket (); rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket2, this)); - NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("10.0.0.1"), 1234)), 0); + NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0"), 1234)), 0); m_receivedPacket = Packet (); m_receivedPacket2 = Packet (); From 160262120e52b6e374c2153cfe0e7bac04fb1590 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 24 Sep 2007 16:11:43 +0100 Subject: [PATCH 210/218] Check for the common error of enabling packet metadata in the middle of a simulation, and give appropriate advice in this case. Closes #78. --- src/common/packet-metadata.cc | 16 ++++++++++++++++ src/common/packet-metadata.h | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/src/common/packet-metadata.cc b/src/common/packet-metadata.cc index 812e9a9dc..04adfdc18 100644 --- a/src/common/packet-metadata.cc +++ b/src/common/packet-metadata.cc @@ -31,6 +31,7 @@ NS_LOG_COMPONENT_DEFINE ("PacketMetadata"); namespace ns3 { bool PacketMetadata::m_enable = false; +bool PacketMetadata::m_metadataSkipped = false; uint32_t PacketMetadata::m_maxSize = 0; uint16_t PacketMetadata::m_chunkUid = 0; PacketMetadata::DataFreeList PacketMetadata::m_freeList; @@ -47,6 +48,13 @@ PacketMetadata::DataFreeList::~DataFreeList () void PacketMetadata::Enable (void) { + NS_ASSERT_MSG (!m_metadataSkipped, + "Error: attempting to enable the packet metadata " + "subsystem too late in the simulation, which is not allowed.\n" + "A common cause for this problem is to enable ASCII tracing " + "after sending any packets. One way to fix this problem is " + "to call ns3::PacketMetadata::Enable () near the beginning of" + " the program, before any packets are sent."); m_enable = true; } @@ -686,6 +694,7 @@ PacketMetadata::DoAddHeader (uint32_t uid, uint32_t size) { if (!m_enable) { + m_metadataSkipped = true; return; } struct PacketMetadata::SmallItem item; @@ -703,6 +712,7 @@ PacketMetadata::DoRemoveHeader (uint32_t uid, uint32_t size) { if (!m_enable) { + m_metadataSkipped = true; return; } struct PacketMetadata::SmallItem item; @@ -738,6 +748,7 @@ PacketMetadata::DoAddTrailer (uint32_t uid, uint32_t size) { if (!m_enable) { + m_metadataSkipped = true; return; } struct PacketMetadata::SmallItem item; @@ -755,6 +766,7 @@ PacketMetadata::DoRemoveTrailer (uint32_t uid, uint32_t size) { if (!m_enable) { + m_metadataSkipped = true; return; } struct PacketMetadata::SmallItem item; @@ -790,6 +802,7 @@ PacketMetadata::AddAtEnd (PacketMetadata const&o) { if (!m_enable) { + m_metadataSkipped = true; return; } if (m_tail == 0xffff) @@ -846,6 +859,7 @@ PacketMetadata::AddPaddingAtEnd (uint32_t end) { if (!m_enable) { + m_metadataSkipped = true; return; } } @@ -854,6 +868,7 @@ PacketMetadata::RemoveAtStart (uint32_t start) { if (!m_enable) { + m_metadataSkipped = true; return; } NS_ASSERT (m_data != 0); @@ -910,6 +925,7 @@ PacketMetadata::RemoveAtEnd (uint32_t end) { if (!m_enable) { + m_metadataSkipped = true; return; } NS_ASSERT (m_data != 0); diff --git a/src/common/packet-metadata.h b/src/common/packet-metadata.h index 12223a4bb..e4e058907 100644 --- a/src/common/packet-metadata.h +++ b/src/common/packet-metadata.h @@ -234,6 +234,12 @@ private: static DataFreeList m_freeList; static bool m_enable; + + // set to true when adding metadata to a packet is skipped because + // m_enable is false; used to detect enabling of metadata in the + // middle of a simulation, which isn't allowed. + static bool m_metadataSkipped; + static uint32_t m_maxSize; static uint16_t m_chunkUid; From 761f51db97538be68741350296c360a9a74362b0 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 24 Sep 2007 18:54:14 +0100 Subject: [PATCH 211/218] Need to enable packet metadata early, else we trigger an assertion. --- utils/run-tests.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/run-tests.cc b/utils/run-tests.cc index 774e88c1f..f99f560c3 100644 --- a/utils/run-tests.cc +++ b/utils/run-tests.cc @@ -20,10 +20,13 @@ */ #include "ns3/test.h" +#include "ns3/packet-metadata.h" + int main (int argc, char *argv[]) { #ifdef RUN_SELF_TESTS + ns3::PacketMetadata::Enable (); ns3::TestManager::EnableVerbose (); bool success = ns3::TestManager::RunTests (); if (!success) From 66e77dbb85fc821f6a133ac989fde56818b111e8 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 24 Sep 2007 13:28:27 -0700 Subject: [PATCH 212/218] add tutorial files --- tutorial/tutorial-1.cc | 91 ++++++++++++++++++++++++++++++++++++++++++ tutorial/wscript-1 | 10 +++++ 2 files changed, 101 insertions(+) create mode 100644 tutorial/tutorial-1.cc create mode 100644 tutorial/wscript-1 diff --git a/tutorial/tutorial-1.cc b/tutorial/tutorial-1.cc new file mode 100644 index 000000000..fdd60e921 --- /dev/null +++ b/tutorial/tutorial-1.cc @@ -0,0 +1,91 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + Mac48Address("08:00:2e:00:00:00")); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + Mac48Address("08:00:2e:00:00:01")); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + Mac48Address("08:00:2e:00:00:02")); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + Mac48Address("08:00:2e:00:00:03")); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address ("10.1.1.2"), + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address ("10.1.1.3"), + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address ("10.1.1.4"), + Ipv4Mask ("255.255.255.0")); + + uint32_t packetSize = 1024; + uint16_t port = 7; + uint32_t maxPacketCount = 1; + Time interPacketInterval = Seconds (1.); + + Ptr client = Create (n0, "10.1.1.2", port, + maxPacketCount, interPacketInterval, packetSize); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/wscript-1 b/tutorial/wscript-1 new file mode 100644 index 000000000..724d86fb7 --- /dev/null +++ b/tutorial/wscript-1 @@ -0,0 +1,10 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' From f3931cde636103c9dff931f75e00665040b24df5 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 26 Sep 2007 18:09:19 +0100 Subject: [PATCH 213/218] Add a couple of NS_LOG_PARAM calls for debugging. --HG-- extra : transplant_source : %CF4%25%BB%7B%7D%08A%99%B99%F4C%CB%9D%B3%1B%1B%D1%B4 --- src/common/packet-metadata.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/packet-metadata.cc b/src/common/packet-metadata.cc index 04adfdc18..fe4ad4fe0 100644 --- a/src/common/packet-metadata.cc +++ b/src/common/packet-metadata.cc @@ -697,6 +697,8 @@ PacketMetadata::DoAddHeader (uint32_t uid, uint32_t size) m_metadataSkipped = true; return; } + NS_LOG_PARAM ("(uid=" << uid << ", size=" << size << ")"); + struct PacketMetadata::SmallItem item; item.next = m_head; item.prev = 0xffff; @@ -715,6 +717,7 @@ PacketMetadata::DoRemoveHeader (uint32_t uid, uint32_t size) m_metadataSkipped = true; return; } + NS_LOG_PARAM ("(uid=" << uid << ", size=" << size << ")"); struct PacketMetadata::SmallItem item; struct PacketMetadata::ExtraItem extraItem; uint32_t read = ReadItems (m_head, &item, &extraItem); From 180383fc4124808306c5b5403e43b1c04c74ad0e Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 26 Sep 2007 19:55:09 -0700 Subject: [PATCH 214/218] tutorial files --- tutorial/tutorial-1.cc | 28 +++------ tutorial/tutorial-2.cc | 86 ++++++++++++++++++++++++++ tutorial/tutorial-3.cc | 90 +++++++++++++++++++++++++++ tutorial/tutorial-4.cc | 137 +++++++++++++++++++++++++++++++++++++++++ tutorial/wscript | 16 +++++ tutorial/wscript-0 | 6 ++ tutorial/wscript-2 | 14 +++++ tutorial/wscript-3 | 18 ++++++ tutorial/wscript-4 | 22 +++++++ 9 files changed, 398 insertions(+), 19 deletions(-) create mode 100644 tutorial/tutorial-2.cc create mode 100644 tutorial/tutorial-3.cc create mode 100644 tutorial/tutorial-4.cc create mode 100644 tutorial/wscript-0 create mode 100644 tutorial/wscript-2 create mode 100644 tutorial/wscript-3 create mode 100644 tutorial/wscript-4 diff --git a/tutorial/tutorial-1.cc b/tutorial/tutorial-1.cc index fdd60e921..972a753bb 100644 --- a/tutorial/tutorial-1.cc +++ b/tutorial/tutorial-1.cc @@ -47,36 +47,26 @@ main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, - Mac48Address("08:00:2e:00:00:00")); + "08:00:2e:00:00:00"); uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, - Mac48Address("08:00:2e:00:00:01")); + "08:00:2e:00:00:01"); uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, - Mac48Address("08:00:2e:00:00:02")); + "08:00:2e:00:00:02"); uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, - Mac48Address("08:00:2e:00:00:03")); + "08:00:2e:00:00:03"); - CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), - Ipv4Mask ("255.255.255.0")); + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); - CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address ("10.1.1.2"), - Ipv4Mask ("255.255.255.0")); - - CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address ("10.1.1.3"), - Ipv4Mask ("255.255.255.0")); - - CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address ("10.1.1.4"), - Ipv4Mask ("255.255.255.0")); - - uint32_t packetSize = 1024; uint16_t port = 7; - uint32_t maxPacketCount = 1; - Time interPacketInterval = Seconds (1.); Ptr client = Create (n0, "10.1.1.2", port, - maxPacketCount, interPacketInterval, packetSize); + 1, Seconds(1.), 1024); Ptr server = Create (n1, port); diff --git a/tutorial/tutorial-2.cc b/tutorial/tutorial-2.cc new file mode 100644 index 000000000..e8f9f07cb --- /dev/null +++ b/tutorial/tutorial-2.cc @@ -0,0 +1,86 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.1.2", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/tutorial-3.cc b/tutorial/tutorial-3.cc new file mode 100644 index 000000000..1e68275ac --- /dev/null +++ b/tutorial/tutorial-3.cc @@ -0,0 +1,90 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.1.2", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + PcapTrace pcaptrace ("tutorial.pcap"); + pcaptrace.TraceAllIp (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/tutorial-4.cc b/tutorial/tutorial-4.cc new file mode 100644 index 000000000..173aa202c --- /dev/null +++ b/tutorial/tutorial-4.cc @@ -0,0 +1,137 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/point-to-point-channel.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/csma-net-device.h" +#include "ns3/point-to-point-topology.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/global-route-manager.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +// Network topology +// +// point to point +// +--------------+ +// | | +// n0 n1 n2 n3 n4 n5 n6 n7 +// | | | | | | | | +// ================ ================ +// lan0 lan1 +// +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr n4 = Create (); + Ptr n5 = Create (); + Ptr n6 = Create (); + Ptr n7 = Create (); + + Ptr lan1 = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan1, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan1, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + Ptr lan2 = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan2, + "08:00:2e:00:00:04"); + + uint32_t nd5 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, lan2, + "08:00:2e:00:00:05"); + + uint32_t nd6 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n6, lan2, + "08:00:2e:00:00:06"); + + uint32_t nd7 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n7, lan2, + "08:00:2e:00:00:07"); + + CsmaIpv4Topology::AddIpv4Address (n4, nd4, "10.1.2.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n5, nd5, "10.1.2.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n6, nd6, "10.1.2.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0"); + + Ptr link = PointToPointTopology::AddPointToPointLink ( + n3, n4, DataRate (500000), MilliSeconds (20)); + + PointToPointTopology::AddIpv4Addresses (link, n3, "10.1.3.1", + n4, "10.1.3.2"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.2.4", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n7, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial-4.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + PcapTrace pcaptrace ("tutorial-4.pcap"); + pcaptrace.TraceAllIp (); + + GlobalRouteManager::PopulateRoutingTables (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/wscript b/tutorial/wscript index abd2df7b9..965b8196e 100644 --- a/tutorial/wscript +++ b/tutorial/wscript @@ -4,3 +4,19 @@ def build(bld): obj = bld.create_ns3_program('hello-simulator', ['core']) obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' + + obj = bld.create_ns3_program('tutorial-4', + ['core']) + obj.source = 'tutorial-4.cc' diff --git a/tutorial/wscript-0 b/tutorial/wscript-0 new file mode 100644 index 000000000..abd2df7b9 --- /dev/null +++ b/tutorial/wscript-0 @@ -0,0 +1,6 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' diff --git a/tutorial/wscript-2 b/tutorial/wscript-2 new file mode 100644 index 000000000..64ddd44dd --- /dev/null +++ b/tutorial/wscript-2 @@ -0,0 +1,14 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' diff --git a/tutorial/wscript-3 b/tutorial/wscript-3 new file mode 100644 index 000000000..1021c3aa9 --- /dev/null +++ b/tutorial/wscript-3 @@ -0,0 +1,18 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' diff --git a/tutorial/wscript-4 b/tutorial/wscript-4 new file mode 100644 index 000000000..965b8196e --- /dev/null +++ b/tutorial/wscript-4 @@ -0,0 +1,22 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' + + obj = bld.create_ns3_program('tutorial-4', + ['core']) + obj.source = 'tutorial-4.cc' From ad6f943bd8364826a306c5771bcf7ba19cdaa571 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 27 Sep 2007 12:40:01 +0100 Subject: [PATCH 215/218] WAF: update to WAF trunk to get bug fixes and smaller script. --- waf | 95 ++++++++++++++++++++++++++++++++++++++------------------- wscript | 5 ++- 2 files changed, 65 insertions(+), 35 deletions(-) diff --git a/waf b/waf index 94a2a37a2..ab9fa0776 100755 --- a/waf +++ b/waf @@ -1,6 +1,34 @@ #! /usr/bin/env python # encoding: utf-8 -# Thomas Nagy, 2005 (ita) +# Thomas Nagy, 2005, 2006, 2007 (ita) + +""" +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +""" import os, sys if 'PSYCOWAF' in os.environ: @@ -10,8 +38,8 @@ if 'PSYCOWAF' in os.environ: except: pass -VERSION="1.1.1" -REVISION="1420549696" +VERSION="1.2.0" +REVISION="1894439586" INSTALL=sys.platform=='win32' and 'c:/temp' or '/usr/local' cwd = os.getcwd() @@ -274,13 +302,11 @@ else: Utils.set_main_module(os.path.join(candidate, 'wscript')) if build_dir_override: - try: + d = getattr(Utils.g_module, 'blddir', None) + if d: # test if user has set the blddir in wscript. - blddir = Utils.g_module.blddir - msg = 'Overriding build directory %s with %s' % (blddir, build_dir_override) + msg = 'Overriding build directory %s with %s' % (d, build_dir_override) Params.niceprint(msg, 'WARNING', 'waf') - except: - pass Utils.g_module.blddir = build_dir_override # fetch the custom command-line options recursively and in a procedural way @@ -291,40 +317,44 @@ opt_obj.parse_args() # use the parser results if Params.g_commands['dist']: # try to use the user-defined dist function first, fallback to the waf scheme - try: - Utils.g_module.dist() - sys.exit(0) - except AttributeError: - pass - try: appname = Utils.g_module.APPNAME - except: appname = 'noname' + fun = getattr(Utils.g_module, 'dist', None) + if fun: fun(); sys.exit(0) - try: - get_version = Utils.g_module.get_version - except AttributeError: - try: - version = Utils.g_module.VERSION - except AttributeError: - version = '1.0' - else: - version = get_version() + appname = getattr(Utils.g_module, 'APPNAME', 'noname') + + get_version = getattr(Utils.g_module, 'get_version', None) + if get_version: version = get_version() + else: version = getattr(Utils.g_module, 'VERSION', None) + if not version: version = '1.0' from Scripting import Dist Dist(appname, version) sys.exit(0) elif Params.g_commands['distclean']: # try to use the user-defined distclean first, fallback to the waf scheme - try: - Utils.g_module.distclean() - sys.exit(0) - except AttributeError: - pass + fun = getattr(Utils.g_module, 'distclean', None) + if fun: fun(); sys.exit(0) from Scripting import DistClean DistClean() sys.exit(0) +elif Params.g_commands['distcheck']: + # try to use the user-defined dist function first, fallback to the waf scheme + fun = getattr(Utils.g_module, 'dist', None) + if fun: fun(); sys.exit(0) -try: Utils.g_module.init() -except AttributeError: pass + appname = getattr(Utils.g_module, 'APPNAME', 'noname') + + get_version = getattr(Utils.g_module, 'get_version', None) + if get_version: version = get_version() + else: version = getattr(Utils.g_module, 'VERSION', None) + if not version: version = '1.0' + + from Scripting import DistCheck + DistCheck(appname, version) + sys.exit(0) + +fun=getattr(Utils.g_module, 'init', None) +if fun: fun() import Scripting try: Scripting.Main() @@ -333,6 +363,7 @@ except KeyboardInterrupt: Params.fatal('build interrupted') #prof=hotshot.Profile("/tmp/proftest.txt") #prof.runcall(Scripting.Main) #prof.close() + # ===>BEGIN WOOF<=== -#6<\%_0gSqh;d#""QRi4MNW9%Ys8;Tjs8W-!s8W-!s8W*A!!!?/+s:iT#QPE@+:JNalM^0u7E&7,zzU5BWbz!oq"M1#9$/UR'Q@h2E0$HX4Xf:2NWkAtYU?>A0Z5XLk)fl$_aFmsXWhU_,Lb16eF=;LtY_;4@7:GM-3XH_GC2j>#5d`0]WUYfGLm@uTQ\8/5QGJZ:^!al1hiXX4Z1]3!!bahTQJ6W5j?(>6<:;j),Tb;_rq(S"]4Tp^n;;I($KLb"*XME*kPRs*a8a2mA3[.1[C%gSaknoQEB!KJ-V"e78sKLqQ7f<[g/oQpRq#,Vr%IVd/!*kI"26_!32kCX@/ja$DLgq@fQK/-iaSS!!!!";/3L+=0I&?f7!+ek.8]W)APb35bL",pV+k_pMdk@?LdFY3?)DUUjT#DH7:>M`,MT5>M/qVQ)JWr&9p34.AoCg76^f"/EJ?[LOSc!G2QpN!kMlQ5PB>Qe9%Xo[YKlb;dNP`]gkf@ssK;9s,dbO;"NT3MhD^$AIlhY2:7flm,"G4"[>Y<&9$D@`gThd^jnZ_MkF;8&MfhT_KQmgJI5!mpgHlFYZOZqC'b^!'!4K5Y]WkSeBG<@%rN>Lj:QF;+aoG>u01g@k+Y`YU:#VlpC;Vn7Acp27T:*mH>2S\UodkG^QSWW;eD-_iLEpYGS9D;0"0)e=XTS%GZeH+R"qG6Vro=)?^%<8/(-0o!<.!:A;%gu=t9pWoEpgV1/+h`#2J>>)ZQbs<_*Sb@9_n8e[!qoO3!";6&f\`o3cnr@F4mWY5$95Q*D:)19M*#1*/qjW`(cF0ohH"Sbcj?;r*gO8fKJ^K*SY2=G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)@ji_]P2L@(m(gM#Y[/Je_[/ep6#"R&KB3@GcLU^X9KfL`.?;>La_dFaB7kHr=%Om%`O<2h_UWfQ4amWc\7ueB0\X#c^Di(ta>mC,chD,@gXe;A=eUMTrN^hZ3NWg\RmNrcb!I"kTrhe*]6c]rmjp`<7jRChf#oS]g;[OBR:_:Qcp&9RWOc?@=j5CLioB"bUP?)tg_sK,eLhYRL2qABc6G'<2FaVfbLmm9^&<4kB6tF=Y`Cd$6A(+Ai>clQ*+8rE+pA5i$6:;I(",("FM5Kti7okQ"J>'K-*V&X,"=PKg]V:^6^TXA)Ve*rX5E.4isp?PNZZ$MagcSU7:p?=;IKZHF@6'G-rPr@#XL4DYTYP!6jdo#\-IPCMA2acN[+R%;nki0!<7;<5ED1X`"4XO*CsOdl-&Sk!5>K8O"R;3!*Xj0qIOG&5d/6PjV.TqPQR0`J[E$V<,6FP$Ad%]ai7?IW7HL#P;*tf^QnEO5Q$T>ebcXfahfg?<<)L"\'Dom>jL5JEpr[2[9B]8\a)mY_dUE0&Bn4*3%gs36G'"HohHeg8;U+hQZ&H"_=%"Cde6i2Ki#QMcuO\QT93P\61!! # ===>END WOOF<=== diff --git a/wscript b/wscript index 1e8fd84e2..68f100e83 100644 --- a/wscript +++ b/wscript @@ -20,7 +20,7 @@ APPNAME = 'ns' srcdir = '.' blddir = 'build' -def dist_hook(srcdir, blddir): +def dist_hook(): shutil.rmtree("doc/html", True) shutil.rmtree("doc/latex", True) @@ -85,8 +85,7 @@ def set_options(opt): def configure(conf): - if not conf.check_tool('compiler_cxx'): - Params.fatal("No suitable compiler found") + conf.check_tool('compiler_cxx') # create the second environment, set the variant and set its name variant_env = conf.env.copy() From 46bad620ff94f15682ef0fd3ab2421ad8d2cdfe7 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 27 Sep 2007 12:44:29 +0100 Subject: [PATCH 216/218] WAF: set env['INCLUDEDIR'] to PREFIX/include so that ns3 headers get installed on 'waf install' (also shuts up the warnings in waf distcheck) --- wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wscript b/wscript index 68f100e83..a02db75da 100644 --- a/wscript +++ b/wscript @@ -95,6 +95,8 @@ def configure(conf): else: variant_name = debug_level + variant_env['INCLUDEDIR'] = os.path.join(variant_env['PREFIX'], 'include') + if Params.g_options.enable_gcov: variant_name += '-gcov' variant_env.append_value('CCFLAGS', '-fprofile-arcs') From 9729a0f7ce7fdf6b016baaed85e92c73540b5924 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 28 Sep 2007 17:13:20 +0100 Subject: [PATCH 217/218] Fix infinite loop in CommandLine::Parse when trying to ignore a badly formed parameter. --HG-- extra : transplant_source : %80I%9Ch%9E%8E%D7%C3%8B1I%EC%A6M%CD-%CC%10%5Ef --- src/core/command-line.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/command-line.cc b/src/core/command-line.cc index 481c925b4..d66ce53da 100644 --- a/src/core/command-line.cc +++ b/src/core/command-line.cc @@ -85,9 +85,7 @@ CommandLine::PrintHelp (void) void CommandLine::Parse (int argc, char *argv[]) { - argc--; - argv++; - while (argc > 0) + for (argc--, argv++; argc > 0; argc--, argv++) { // remove "--" or "-" heading. std::string param = *argv; @@ -142,8 +140,6 @@ CommandLine::Parse (int argc, char *argv[]) continue; } } - argc--; - argv++; } } From 3c4e32ca5933cf7508dd2f8b8afcfb258ce77188 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 1 Oct 2007 14:33:17 +0100 Subject: [PATCH 218/218] Make Object::QueryInterface and AddInterface check for the aggregate refcount instead of the object refcount, reason explained in a comment near Object::CheckLoose. Add the same check also to TraceConnect/Disconnect and GetTraceResolver. --- src/core/object.cc | 35 ++++++++++++++++++++++++++++++----- src/core/object.h | 1 + 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index 1c6d58772..1049b6cab 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -192,7 +192,7 @@ Object::~Object () Ptr Object::DoQueryInterface (InterfaceId iid) const { - NS_ASSERT (Check ()); + NS_ASSERT (CheckLoose ()); const Object *currentObject = this; do { NS_ASSERT (currentObject != 0); @@ -227,24 +227,26 @@ Object::AddInterface (Ptr o) { NS_ASSERT (!m_disposed); NS_ASSERT (!o->m_disposed); - NS_ASSERT (Check ()); - NS_ASSERT (o->Check ()); + NS_ASSERT (CheckLoose ()); + NS_ASSERT (o->CheckLoose ()); Object *other = PeekPointer (o); Object *next = m_next; m_next = other->m_next; other->m_next = next; - NS_ASSERT (Check ()); - NS_ASSERT (o->Check ()); + NS_ASSERT (CheckLoose ()); + NS_ASSERT (o->CheckLoose ()); } void Object::TraceConnect (std::string path, const CallbackBase &cb) const { + NS_ASSERT (CheckLoose ()); GetTraceResolver ()->Connect (path, cb, TraceContext ()); } void Object::TraceDisconnect (std::string path, const CallbackBase &cb) const { + NS_ASSERT (CheckLoose ()); GetTraceResolver ()->Disconnect (path, cb); } @@ -264,6 +266,7 @@ Object::DoDispose (void) Ptr Object::GetTraceResolver (void) const { + NS_ASSERT (CheckLoose ()); Ptr resolver = Create (this); return resolver; @@ -275,6 +278,28 @@ Object::Check (void) const return (m_count > 0); } +/* In some cases, when an event is scheduled against a subclass of + * Object, and if no one owns a reference directly to this object, the + * object is alive, has a refcount of zero and the method ran when the + * event expires runs against the raw pointer which means that we are + * manipulating an object with a refcount of zero. So, instead we + * check the aggregate reference count. + */ +bool +Object::CheckLoose (void) const +{ + uint32_t refcount = 0; + const Object *current = this; + do + { + refcount += current->m_count; + current = current->m_next; + } + while (current != this); + + return (refcount > 0); +} + void Object::MaybeDelete (void) const { diff --git a/src/core/object.h b/src/core/object.h index 36aa3a384..34ce9fe38 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -186,6 +186,7 @@ private: TraceResolver::SourceCollection *collection) const; void DoTraceAll (std::ostream &os, const TraceContext &context) const; bool Check (void) const; + bool CheckLoose (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; InterfaceId m_iid;