Open “src/dsdv/model/dsdv-routing-protocol.h” and add “Ptr
class RoutingProtocol : public Ipv4RoutingProtocol { public: .... virtual void DoDispose (); PtrroutingStream; ...
Then in “src/dsdv/model/dsdv-routing-protocol.cc” at line 250 add the new function:
void RoutingProtocol::PrintRoutingTable (Ptr stream) const { *stream->GetStream () << "Node: " << m_ipv4->GetObject()->GetId () << " Time: " << Simulator::Now ().GetSeconds () << "s "; m_routingTable.Print (stream); }
Create output file by adding these lines in RoutingProtocol::Start() function:
void RoutingProtocol::Start () { std::ostringstream temp; temp << "dsdv-routing-tables_" << m_ipv4->GetObject()->GetId() << ".txt"; routingStream = Create (temp.str(), std::ios::out);
Finally call print routing table each time when DSDV tables are exchanged by adding code in "src/dsdv/model/dsdv-routing-protocol.cc" on line 785:
void RoutingProtocol::SendTriggeredUpdate () { ... this->PrintRoutingTable (routingStream); ... }
You should find .txt files in your NS3 root directory with routing tables.