Modify a field in the routing table

153 views
Skip to first unread message

Maroua

unread,
Apr 8, 2016, 9:21:44 AM4/8/16
to ns-3-users
Hi everyone,
I want to modify the routing table. 
here is my code :
Ptr<Node> node = this->GetObject<Node> ();
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
Ptr<Ipv4RoutingProtocol> rProto = ipv4->GetRoutingProtocol ();
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (&std::cout);
rProto->RoutingTable().DeleteRoute ("192.168.1.7");
rProto->PrintRoutingTable(routingStream);
erreur: ‘class ns3::Ipv4RoutingProtocol’ has no member named ‘RoutingTable’
I couldn't alter the table.
Can anybody provide me an idea or a suggest? 
Thank you in advance.

Maroua

unread,
Apr 11, 2016, 7:30:52 AM4/11/16
to ns-3-users
Hi all
No answer has come tthat effect yet.
If it is not possible to change in the routing tables.Doeanyone know?  because I lost a lot of time searching without result.

Tommaso Pecorella

unread,
Apr 11, 2016, 9:00:51 AM4/11/16
to ns-3-users
Hi Maroua,

no offense, but you'll not receive any answer until you'll post a meaningful question.
Please read the posting guidelines.

Thanks,

T.

Maroua

unread,
Apr 11, 2016, 9:21:41 AM4/11/16
to ns-3-users
hi,
I want to modify the routing table at the transport layer (udp-l4-protocol.cc). I use the DSDV protocol. 
I got the Ipv4 object and the routing protocol(DSDV) as shown in the code below. But i was unable to change in the routing table !! ( Delete the route for example). 
here is my code (the code written in blue and the red text indicates the error) :

Konstantinos

unread,
Apr 11, 2016, 9:34:03 AM4/11/16
to ns-3-users
Hi Maroua,

First of all, the error you got is very simple to understand and it's plain programming.
See some comments inline:


On Monday, April 11, 2016 at 2:21:41 PM UTC+1, Maroua wrote:
hi,
I want to modify the routing table at the transport layer (udp-l4-protocol.cc). I use the DSDV protocol. 
I got the Ipv4 object and the routing protocol(DSDV) as shown in the code below. But i was unable to change in the routing table !! ( Delete the route for example). 
here is my code (the code written in blue and the red text indicates the error) :
Ptr<Node> node = this->GetObject<Node> ();
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
Ptr<Ipv4RoutingProtocol> rProto = ipv4->GetRoutingProtocol ();

Here you got a reference to the Ipv4RoutingProtocol object (the base class) not the DSDV. 
If you do not understand the difference, I would suggest to study a C++ primer on inheritance. 
 
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (&std::cout);
rProto->RoutingTable().DeleteRoute ("192.168.1.7");

The error is here, there is no member function called RoutingTable(). 
There is a class ns3::dsdv::RoutingTable but there is no public API to access it. 
I have comment on this on another thread, you need to change that.

Maroua

unread,
Apr 11, 2016, 9:56:16 AM4/11/16
to ns-3-users
Thank you very much for your answer 
I know that the error is in this line of code : Proto->RoutingTable().DeleteRoute ("192.168.1.7");
The routing table function are all private!!  how can i use it in this case???
How can i change this line to becomes functional???
Please help me.

Konstantinos

unread,
Apr 11, 2016, 10:52:32 AM4/11/16
to ns-3-users
I told you the solution... make a public API to get access to the routing table. 
For example have a look at the API of Ipv4StaticRouting
Reply all
Reply to author
Forward
0 new messages