routing: (fixes #2527) Extend PrintRoutingTable to specify the time unit for the report.
--- a/CHANGES.html Sat Nov 05 01:18:51 2016 +0100
+++ b/CHANGES.html Sat Nov 05 02:38:15 2016 +0100
@@ -54,6 +54,10 @@
<h1>Changes from ns-3.26 to ns-3.27</h1>
<h2>New API:</h2>
<ul>
+<li>Function <b>PrintRoutingTable</b> has been extended to add an optional Time::Units
+ parameter to specify the time units used on the report. The new parameter is
+ optional and if not specified defaults to the previous behavior (Time::S).
+</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
--- a/RELEASE_NOTES Sat Nov 05 01:18:51 2016 +0100
+++ b/RELEASE_NOTES Sat Nov 05 02:38:15 2016 +0100
@@ -26,12 +26,11 @@
----------
- Bug 2007 - uan: Remove deprecation on SetRxThresholdDb
- Bug 2450 - LogDistancePropagationLossModel is not continuous
-- Bug 2477 - DCF manager assert
- Bug 2492 - uan: Make use of RxGain attribute in UanPhyGen class
- Bug 2511 - HT Greenfield is not working
- Bug 2521 - Include ipv6-option.h in wscript
-- Bug 2529 - Missing trace when Block ACK timeout is triggered or when missing MPDUs are announced by a Block ACK response
-- Bug 2532 - Inconsistencies between 802.11n MCS and NSS value reported in TXVECTOR
+- Bug 2527 - PrintRoutingTable extended to add an optional Time::Units parameter
+- Bug 2530 - Rename aodv::SetBalckListTimeout to aodv::SetBlackListTimeout
Known issues
------------
--- a/src/aodv/model/aodv-routing-protocol.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/aodv/model/aodv-routing-protocol.cc Sat Nov 05 02:38:15 2016 +0100
@@ -318,11 +318,11 @@
}
void
-RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << "; Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << "; Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", AODV Routing table" << std::endl;
m_routingTable.Print (stream);
--- a/src/aodv/model/aodv-routing-protocol.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/aodv/model/aodv-routing-protocol.h Sat Nov 05 02:38:15 2016 +0100
@@ -71,8 +71,8 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
-
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
+
// Handle protocol parameters
Time GetMaxQueueTime () const { return m_maxQueueTime; }
void SetMaxQueueTime (Time t);
--- a/src/click/model/ipv4-click-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/click/model/ipv4-click-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -557,7 +557,7 @@
}
void
-Ipv4ClickRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv4ClickRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
}
--- a/src/click/model/ipv4-click-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/click/model/ipv4-click-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -255,7 +255,7 @@
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
--- a/src/dsdv/model/dsdv-routing-protocol.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/dsdv/model/dsdv-routing-protocol.cc Sat Nov 05 02:38:15 2016 +0100
@@ -229,11 +229,11 @@
}
void
-RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", DSDV Routing table" << std::endl;
m_routingTable.Print (stream);
--- a/src/dsdv/model/dsdv-routing-protocol.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/dsdv/model/dsdv-routing-protocol.h Sat Nov 05 02:38:15 2016 +0100
@@ -68,7 +68,7 @@
Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, UnicastForwardCallback ucb,
MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
--- a/src/internet/helper/ipv4-routing-helper.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/helper/ipv4-routing-helper.cc Sat Nov 05 02:38:15 2016 +0100
@@ -36,59 +36,59 @@
}
void
-Ipv4RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
- Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, node, stream);
+ Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, node, stream, unit);
}
}
void
-Ipv4RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
- Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream);
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
}
void
-Ipv4RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
- Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, node, stream);
+ Simulator::Schedule (printTime, &Ipv4RoutingHelper::Print, node, stream, unit);
}
void
-Ipv4RoutingHelper::PrintRoutingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
- Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream);
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
void
-Ipv4RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
if (ipv4)
{
Ptr<Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol ();
NS_ASSERT (rp);
- rp->PrintRoutingTable (stream);
+ rp->PrintRoutingTable (stream, unit);
}
}
void
-Ipv4RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv4RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
if (ipv4)
{
Ptr<Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol ();
NS_ASSERT (rp);
- rp->PrintRoutingTable (stream);
- Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream);
+ rp->PrintRoutingTable (stream, unit);
+ Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
}
--- a/src/internet/helper/ipv4-routing-helper.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/helper/ipv4-routing-helper.h Sat Nov 05 02:38:15 2016 +0100
@@ -69,47 +69,51 @@
* \brief prints the routing tables of all nodes at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object, for all nodes at the
* specified time; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of all nodes at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object, for all nodes at the
* specified time interval; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of a node at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
* at the specified time; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of a node at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
* at the specified interval; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the neighbor cache of all nodes at a particular time.
@@ -190,24 +194,26 @@
* \brief prints the routing tables of a node.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object;
* the output format is routing protocol-specific.
*/
- static void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of a node at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
* at the specified interval; the output format is routing protocol-specific.
*/
- static void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the neighbor cache of a node.
--- a/src/internet/helper/ipv6-routing-helper.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/helper/ipv6-routing-helper.cc Sat Nov 05 02:38:15 2016 +0100
@@ -36,59 +36,59 @@
}
void
-Ipv6RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
- Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, node, stream);
+ Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, node, stream, unit);
}
}
void
-Ipv6RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
- Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream);
+ Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
}
void
-Ipv6RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
- Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, node, stream);
+ Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, node, stream, unit);
}
void
-Ipv6RoutingHelper::PrintRoutingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::PrintRoutingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
- Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream);
+ Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
void
-Ipv6RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
if (ipv6)
{
Ptr<Ipv6RoutingProtocol> rp = ipv6->GetRoutingProtocol ();
NS_ASSERT (rp);
- rp->PrintRoutingTable (stream);
+ rp->PrintRoutingTable (stream, unit);
}
}
void
-Ipv6RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream)
+Ipv6RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit)
{
Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
if (ipv6)
{
Ptr<Ipv6RoutingProtocol> rp = ipv6->GetRoutingProtocol ();
NS_ASSERT (rp);
- rp->PrintRoutingTable (stream);
- Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream);
+ rp->PrintRoutingTable (stream, unit);
+ Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream, unit);
}
}
--- a/src/internet/helper/ipv6-routing-helper.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/helper/ipv6-routing-helper.h Sat Nov 05 02:38:15 2016 +0100
@@ -70,47 +70,51 @@
* \brief prints the routing tables of all nodes at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for all nodes at the
* specified time; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream);;
+ static void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of all nodes at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for all nodes at the
* specified time interval; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of a node at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
* at the specified time; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the routing tables of a node at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
* at the specified interval; the output format is routing protocol-specific.
*/
- static void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
/**
* \brief prints the neighbor cache of all nodes at a particular time.
@@ -191,24 +195,26 @@
* \brief prints the routing tables of a node.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object;
* the output format is routing protocol-specific.
*/
- static void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit);
/**
* \brief prints the routing tables of a node at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
+ * \param unit The time unit to be used in the report
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
* at the specified interval; the output format is routing protocol-specific.
*/
- static void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream);
+ static void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit);
/**
* \brief prints the neighbor cache of a node.
--- a/src/internet/model/ipv4-global-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-global-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -398,14 +398,14 @@
// Formatted like output of "route -n" command
void
-Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Ipv4GlobalRouting table" << std::endl;
if (GetNRoutes () > 0)
--- a/src/internet/model/ipv4-global-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-global-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -98,7 +98,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
/**
* \brief Add a host route to the global routing table.
--- a/src/internet/model/ipv4-list-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-list-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -70,18 +70,18 @@
}
void
-Ipv4ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv4ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Ipv4ListRouting table" << std::endl;
for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
i != m_routingProtocols.end (); i++)
{
*stream->GetStream () << " Priority: " << (*i).first << " Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
- (*i).second->PrintRoutingTable (stream);
+ (*i).second->PrintRoutingTable (stream, unit);
}
}
--- a/src/internet/model/ipv4-list-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-list-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -22,6 +22,7 @@
#include <list>
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/simulator.h"
+#include "ns3/nstime.h"
namespace ns3 {
@@ -88,7 +89,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
protected:
virtual void DoDispose (void);
--- a/src/internet/model/ipv4-routing-protocol.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-routing-protocol.h Sat Nov 05 02:38:15 2016 +0100
@@ -26,6 +26,7 @@
#include "ns3/ipv4-interface-address.h"
#include "ipv4.h"
#include "ns3/output-stream-wrapper.h"
+#include "ns3/nstime.h"
namespace ns3 {
@@ -165,9 +166,11 @@
/**
* \brief Print the Routing Table entries
*
- * \param stream the ostream the Routing table is printed to
+ * \param stream The ostream the Routing table is printed to
+ * \param unit The time unit to be used in the report
*/
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const = 0;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const = 0;
+
};
} // namespace ns3
--- a/src/internet/model/ipv4-static-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-static-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -690,14 +690,14 @@
}
// Formatted like output of "route -n" command
void
-Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Ipv4StaticRouting table" << std::endl;
if (GetNRoutes () > 0)
--- a/src/internet/model/ipv4-static-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv4-static-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -85,7 +85,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
/**
* \brief Add a network route to the static routing table.
--- a/src/internet/model/ipv6-list-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv6-list-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -210,19 +210,19 @@
}
void
-Ipv6ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv6ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this);
*stream->GetStream () << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Ipv6ListRouting table" << std::endl;
for (Ipv6RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
i != m_routingProtocols.end (); i++)
{
*stream->GetStream () << " Priority: " << (*i).first << " Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
- (*i).second->PrintRoutingTable (stream);
+ (*i).second->PrintRoutingTable (stream, unit);
}
}
--- a/src/internet/model/ipv6-list-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv6-list-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -98,13 +98,7 @@
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void SetIpv6 (Ptr<Ipv6> ipv6);
-
- /**
- * \brief Print the Routing Table entries
- *
- * \param stream the ostream the Routing table is printed to
- */
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
protected:
/**
--- a/src/internet/model/ipv6-routing-protocol.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv6-routing-protocol.h Sat Nov 05 02:38:15 2016 +0100
@@ -30,6 +30,7 @@
#include "ipv6-interface-address.h"
#include "ipv6.h"
#include "ns3/output-stream-wrapper.h"
+#include "ns3/nstime.h"
namespace ns3 {
@@ -191,9 +192,11 @@
/**
* \brief Print the Routing Table entries
*
- * \param stream the ostream the Routing table is printed to
+ * \param stream The ostream the Routing table is printed to
+ * \param unit The time unit to be used in the report
*/
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const = 0;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const = 0;
+
};
} // namespace ns3
--- a/src/internet/model/ipv6-static-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv6-static-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -79,14 +79,14 @@
// Formatted like output of "route -n" command
void
-Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Ipv6StaticRouting table" << std::endl;
if (GetNRoutes () > 0)
--- a/src/internet/model/ipv6-static-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ipv6-static-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -237,13 +237,7 @@
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void SetIpv6 (Ptr<Ipv6> ipv6);
-
- /**
- * \brief Print the Routing Table entries
- *
- * \param stream the ostream the Routing table is printed to
- */
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
protected:
/**
--- a/src/internet/model/rip.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/rip.cc Sat Nov 05 02:38:15 2016 +0100
@@ -482,15 +482,15 @@
}
}
-void Rip::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+void Rip::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", IPv4 RIP table" << std::endl;
if (!m_routes.empty ())
--- a/src/internet/model/rip.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/rip.h Sat Nov 05 02:38:15 2016 +0100
@@ -194,7 +194,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
/**
* Split Horizon strategy type. See \RFC{2453}.
--- a/src/internet/model/ripng.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ripng.cc Sat Nov 05 02:38:15 2016 +0100
@@ -466,15 +466,15 @@
}
}
-void RipNg::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+void RipNg::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", IPv6 RIPng table" << std::endl;
if (!m_routes.empty ())
--- a/src/internet/model/ripng.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/model/ripng.h Sat Nov 05 02:38:15 2016 +0100
@@ -199,7 +199,7 @@
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop,
uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void SetIpv6 (Ptr<Ipv6> ipv6);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
/**
* Split Horizon strategy type. See \RFC{2080}.
--- a/src/internet/test/ipv4-list-routing-test-suite.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/test/ipv4-list-routing-test-suite.cc Sat Nov 05 02:38:15 2016 +0100
@@ -34,7 +34,7 @@
void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void SetIpv4 (Ptr<Ipv4> ipv4) {}
- void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {}
+ void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const {}
};
class Ipv4BRouting : public Ipv4RoutingProtocol {
@@ -48,7 +48,7 @@
void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
void SetIpv4 (Ptr<Ipv4> ipv4) {}
- void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {}
+ void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const {}
};
class Ipv4ListRoutingNegativeTestCase : public TestCase
--- a/src/internet/test/ipv6-list-routing-test-suite.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/internet/test/ipv6-list-routing-test-suite.cc Sat Nov 05 02:38:15 2016 +0100
@@ -38,7 +38,7 @@
GetZero ()) {}
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
void SetIpv6 (Ptr<Ipv6> ipv6) {}
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {};
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const {};
};
class Ipv6BRouting : public Ipv6RoutingProtocol {
@@ -55,7 +55,7 @@
GetZero ()) {}
void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
void SetIpv6 (Ptr<Ipv6> ipv6) {}
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const {};
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const {};
};
class Ipv6ListRoutingNegativeTestCase : public TestCase
--- a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc Sat Nov 05 02:38:15 2016 +0100
@@ -696,7 +696,7 @@
}
void
-Ipv4NixVectorRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+Ipv4NixVectorRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
CheckCacheStateAndFlush ();
@@ -704,8 +704,8 @@
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", Nix Routing" << std::endl;
*os << "NixCache:" << std::endl;
--- a/src/nix-vector-routing/model/ipv4-nix-vector-routing.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/nix-vector-routing/model/ipv4-nix-vector-routing.h Sat Nov 05 02:38:15 2016 +0100
@@ -31,6 +31,7 @@
#include "ns3/ipv4-route.h"
#include "ns3/nix-vector.h"
#include "ns3/bridge-net-device.h"
+#include "ns3/nstime.h"
namespace ns3 {
@@ -158,8 +159,8 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
-
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
+
/*
* Flushes routing caches if required.
*/
--- a/src/olsr/model/olsr-routing-protocol.cc Sat Nov 05 01:18:51 2016 +0100
+++ b/src/olsr/model/olsr-routing-protocol.cc Sat Nov 05 02:38:15 2016 +0100
@@ -251,13 +251,13 @@
}
void
-RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
+RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit) const
{
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
- << ", Time: " << Now ().As (Time::S)
- << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
+ << ", Time: " << Now ().As (unit)
+ << ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
<< ", OLSR Routing table" << std::endl;
*os << "Destination\t\tNextHop\t\tInterface\tDistance\n";
@@ -283,7 +283,7 @@
if (m_hnaRoutingTable->GetNRoutes () > 0)
{
*os << " HNA Routing Table: ";
- m_hnaRoutingTable->PrintRoutingTable (stream);
+ m_hnaRoutingTable->PrintRoutingTable (stream, unit);
}
else
{
--- a/src/olsr/model/olsr-routing-protocol.h Sat Nov 05 01:18:51 2016 +0100
+++ b/src/olsr/model/olsr-routing-protocol.h Sat Nov 05 02:38:15 2016 +0100
@@ -310,7 +310,7 @@
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
+ virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
void DoDispose ();