View | Details | Raw Unified | Return to bug 963
Collapse All | Expand All

(-)a/src/routing/aodv/aodv-routing-protocol.cc (+7 lines)
 Lines 246-251    Link Here 
246
}
246
}
247
247
248
void
248
void
249
RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream)
250
{
251
  *stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId () << " Time: " << Simulator::Now().GetSeconds () << "s ";
252
  m_routingTable.Print (stream);
253
}
254
255
void
249
RoutingProtocol::Start ()
256
RoutingProtocol::Start ()
250
{
257
{
251
  NS_LOG_FUNCTION (this);
258
  NS_LOG_FUNCTION (this);
(-)a/src/routing/aodv/aodv-routing-protocol.h (-1 / +3 lines)
 Lines 34-39    Link Here 
34
#include "aodv-neighbor.h"
34
#include "aodv-neighbor.h"
35
#include "aodv-dpd.h"
35
#include "aodv-dpd.h"
36
#include "ns3/node.h"
36
#include "ns3/node.h"
37
#include "ns3/output-stream-wrapper.h"
37
#include "ns3/ipv4-routing-protocol.h"
38
#include "ns3/ipv4-routing-protocol.h"
38
#include "ns3/ipv4-interface.h"
39
#include "ns3/ipv4-interface.h"
39
#include "ns3/ipv4-l3-protocol.h"
40
#include "ns3/ipv4-l3-protocol.h"
 Lines 58-64    Link Here 
58
  RoutingProtocol ();
59
  RoutingProtocol ();
59
  virtual ~RoutingProtocol();
60
  virtual ~RoutingProtocol();
60
  virtual void DoDispose ();
61
  virtual void DoDispose ();
61
  
62
  void PrintRoutingTable (Ptr<OutputStreamWrapper> stream);
63
62
  ///\name From Ipv4RoutingProtocol
64
  ///\name From Ipv4RoutingProtocol
63
  //\{
65
  //\{
64
  Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
66
  Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
(-)a/src/routing/aodv/aodv-rtable.cc (-11 / +12 lines)
 Lines 155-183    Link Here 
155
}
155
}
156
156
157
void
157
void
158
RoutingTableEntry::Print (std::ostream & os) const
158
RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream) const
159
{
159
{
160
  os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway ()
160
  std::ostream* os = stream->GetStream (); 
161
  *os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway ()
161
      << "\t" << m_iface.GetLocal () << "\t";
162
      << "\t" << m_iface.GetLocal () << "\t";
162
  switch (m_flag)
163
  switch (m_flag)
163
    {
164
    {
164
    case VALID:
165
    case VALID:
165
      {
166
      {
166
        os << "UP";
167
        *os << "UP";
167
        break;
168
        break;
168
      }
169
      }
169
    case INVALID:
170
    case INVALID:
170
      {
171
      {
171
        os << "DOWN";
172
        *os << "DOWN";
172
        break;
173
        break;
173
      }
174
      }
174
    case IN_SEARCH:
175
    case IN_SEARCH:
175
      {
176
      {
176
        os << "IN_SEARCH";
177
        *os << "IN_SEARCH";
177
        break;
178
        break;
178
      }
179
      }
179
    }
180
    }
180
  os << "\t" << (m_lifeTime - Simulator::Now ()).GetSeconds () << "\t"
181
  *os << "\t" << (m_lifeTime - Simulator::Now ()).GetSeconds () << "\t"
181
      << m_hops << "\n";
182
      << m_hops << "\n";
182
}
183
}
183
184
 Lines 397-413    Link Here 
397
}
398
}
398
399
399
void
400
void
400
RoutingTable::Print (std::ostream &os)
401
RoutingTable::Print (Ptr<OutputStreamWrapper> stream)
401
{
402
{
402
  Purge ();
403
  Purge ();
403
  os << "\nAODV Routing table\n"
404
  *stream->GetStream () << "AODV Routing table\n"
404
      << "Destination\tGateway\t\tInterface\tFlag\tExpire\tHops\n";
405
      << "Destination\tGateway\t\tInterface\tFlag\tExpire\t\tHops\n";
405
  for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
406
  for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
406
      m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i)
407
      m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i)
407
    {
408
    {
408
      i->second.Print (os);
409
      i->second.Print (stream);
409
    }
410
    }
410
  os << "\n";
411
  *stream->GetStream () << "\n";
411
}
412
}
412
413
413
}
414
}
(-)a/src/routing/aodv/aodv-rtable.h (-2 / +3 lines)
 Lines 36-41    Link Here 
36
#include "ns3/ipv4-route.h"
36
#include "ns3/ipv4-route.h"
37
#include "ns3/timer.h"
37
#include "ns3/timer.h"
38
#include "ns3/net-device.h"
38
#include "ns3/net-device.h"
39
#include "ns3/output-stream-wrapper.h"
39
40
40
namespace ns3 {
41
namespace ns3 {
41
namespace aodv {
42
namespace aodv {
 Lines 140-146    Link Here 
140
  {
141
  {
141
    return (m_ipv4Route->GetDestination () == dst);
142
    return (m_ipv4Route->GetDestination () == dst);
142
  }
143
  }
143
  void Print(std::ostream & os) const;
144
  void Print (Ptr<OutputStreamWrapper> stream) const;
144
145
145
private:
146
private:
146
  /// Valid Destination Sequence Number flag
147
  /// Valid Destination Sequence Number flag
 Lines 242-248    Link Here 
242
   */
243
   */
243
  bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout);
244
  bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout);
244
  /// Print routing table
245
  /// Print routing table
245
  void Print(std::ostream &os);
246
  void Print (Ptr<OutputStreamWrapper> stream);
246
247
247
private:
248
private:
248
  std::map<Ipv4Address, RoutingTableEntry> m_ipv4AddressEntry;
249
  std::map<Ipv4Address, RoutingTableEntry> m_ipv4AddressEntry;

Return to bug 963