aodv: Update NS_LOG print format for ns3::Time
Also fixed issue in which AodvRoutingProtocol::PrintRoutingTable () was not using the provided Time::Unit to format the routing table entry lifetimes.
This commit is contained in:
@@ -343,7 +343,7 @@ RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit
|
||||
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
|
||||
<< ", AODV Routing table" << std::endl;
|
||||
|
||||
m_routingTable.Print (stream);
|
||||
m_routingTable.Print (stream, unit);
|
||||
*stream->GetStream () << std::endl;
|
||||
}
|
||||
|
||||
@@ -1106,7 +1106,7 @@ RoutingProtocol::ScheduleRreqRetry (Ipv4Address dst)
|
||||
retry = m_netTraversalTime * (1 << backoffFactor);
|
||||
}
|
||||
m_addressReqTimer[dst].Schedule (retry);
|
||||
NS_LOG_LOGIC ("Scheduled RREQ retry in " << retry.GetSeconds () << " seconds");
|
||||
NS_LOG_LOGIC ("Scheduled RREQ retry in " << retry.As (Time::S));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1959,8 +1959,8 @@ RoutingProtocol::SendRerrWhenNoRouteToForward (Ipv4Address dst,
|
||||
// Just make sure that the RerrRateLimit timer is running and will expire
|
||||
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ());
|
||||
// discard the packet and return
|
||||
NS_LOG_LOGIC ("RerrRateLimit reached at " << Simulator::Now ().GetSeconds () << " with timer delay left "
|
||||
<< m_rerrRateLimitTimer.GetDelayLeft ().GetSeconds ()
|
||||
NS_LOG_LOGIC ("RerrRateLimit reached at " << Simulator::Now ().As (Time::S) << " with timer delay left "
|
||||
<< m_rerrRateLimitTimer.GetDelayLeft ().As (Time::S)
|
||||
<< "; suppressing RERR");
|
||||
return;
|
||||
}
|
||||
@@ -2021,8 +2021,8 @@ RoutingProtocol::SendRerrMessage (Ptr<Packet> packet, std::vector<Ipv4Address> p
|
||||
// Just make sure that the RerrRateLimit timer is running and will expire
|
||||
NS_ASSERT (m_rerrRateLimitTimer.IsRunning ());
|
||||
// discard the packet and return
|
||||
NS_LOG_LOGIC ("RerrRateLimit reached at " << Simulator::Now ().GetSeconds () << " with timer delay left "
|
||||
<< m_rerrRateLimitTimer.GetDelayLeft ().GetSeconds ()
|
||||
NS_LOG_LOGIC ("RerrRateLimit reached at " << Simulator::Now ().As (Time::S) << " with timer delay left "
|
||||
<< m_rerrRateLimitTimer.GetDelayLeft ().As (Time::S)
|
||||
<< "; suppressing RERR");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ RoutingTableEntry::GetPrecursors (std::vector<Ipv4Address> & prec) const
|
||||
void
|
||||
RoutingTableEntry::Invalidate (Time badLinkLifetime)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << badLinkLifetime.GetSeconds ());
|
||||
NS_LOG_FUNCTION (this << badLinkLifetime.As (Time::S));
|
||||
if (m_flag == INVALID)
|
||||
{
|
||||
return;
|
||||
@@ -171,7 +171,7 @@ RoutingTableEntry::Invalidate (Time badLinkLifetime)
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream) const
|
||||
RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream, Time::Unit unit /* = Time::S */) const
|
||||
{
|
||||
std::ostream* os = stream->GetStream ();
|
||||
*os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway ()
|
||||
@@ -197,7 +197,7 @@ RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream) const
|
||||
*os << "\t";
|
||||
*os << std::setiosflags (std::ios::fixed) <<
|
||||
std::setiosflags (std::ios::left) << std::setprecision (2) <<
|
||||
std::setw (14) << (m_lifeTime - Simulator::Now ()).GetSeconds ();
|
||||
std::setw (14) << (m_lifeTime - Simulator::Now ()).As (unit);
|
||||
*os << "\t" << m_hops << "\n";
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ RoutingTable::Purge (std::map<Ipv4Address, RoutingTableEntry> &table) const
|
||||
bool
|
||||
RoutingTable::MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTimeout)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << neighbor << blacklistTimeout.GetSeconds ());
|
||||
NS_LOG_FUNCTION (this << neighbor << blacklistTimeout.As (Time::S));
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator i =
|
||||
m_ipv4AddressEntry.find (neighbor);
|
||||
if (i == m_ipv4AddressEntry.end ())
|
||||
@@ -464,7 +464,7 @@ RoutingTable::MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTime
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTable::Print (Ptr<OutputStreamWrapper> stream) const
|
||||
RoutingTable::Print (Ptr<OutputStreamWrapper> stream, Time::Unit unit /* = Time::S */) const
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry> table = m_ipv4AddressEntry;
|
||||
Purge (table);
|
||||
@@ -473,7 +473,7 @@ RoutingTable::Print (Ptr<OutputStreamWrapper> stream) const
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
|
||||
table.begin (); i != table.end (); ++i)
|
||||
{
|
||||
i->second.Print (stream);
|
||||
i->second.Print (stream, unit);
|
||||
}
|
||||
*stream->GetStream () << "\n";
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
* Print packet to trace file
|
||||
* \param stream The output stream
|
||||
*/
|
||||
void Print (Ptr<OutputStreamWrapper> stream) const;
|
||||
void Print (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
|
||||
|
||||
private:
|
||||
/// Valid Destination Sequence Number flag
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
* Print routing table
|
||||
* \param stream the output stream
|
||||
*/
|
||||
void Print (Ptr<OutputStreamWrapper> stream) const;
|
||||
void Print (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
|
||||
|
||||
private:
|
||||
/// The routing table
|
||||
|
||||
Reference in New Issue
Block a user