Skip to first unread message

sathvik kote

unread,
Jun 20, 2020, 12:51:10 PM6/20/20
to ns-3-users
Hi,

I will dive right into the problem. I was working with AODV protocol and was introducing few modifications to the existing protocol. Aodv has routing table which is filled with routing table entries. I have a small modification with this part. I have added a new property(I will call the new property X) to the routing table entry. X is a variable of routing table instance. Along with this I have two functions getX and setX. This is the introduction to the problem.

Now I have scenario where I have to update the value of variable X of a particular routing table entry while the protocol is running. To do so, I am fetching the particular entry and calling a setX function. But the value of the X in the entry is not being changed for some reason. The code used is

for (std::map<Ipv4Address, RoutingTableEntry::iterator i = table.begin(); i != table.end(); i++)
{
     i->second.SetX(value);
}

But the value is not being changed. 

I was using Update function which already exists in the protocol. But I learnt that some of the values of a entry get changed when I do that which is introducing errors into my program. I don't want other values to change except X. 

If anyone worked in similar areas. anyone with expertise please help me. This will help me complete my work I have been stuck for quite some time now. Please help.

Thank you in advance.

Tom Henderson

unread,
Jun 20, 2020, 2:38:34 PM6/20/20
to ns-3-...@googlegroups.com, sathvik kote
Here is how I would start to debug this.

I assume you have a new method, something like 'RoutingTable::UpdateX()'
Can you confirm via NS_LOG, gdb debugging, and/or the insertion of a
customized print statement, that it is entered?

Next, within your for loop, I would possibly put a print statement to
convince myself that the for loop is being run:

for (std::map<Ipv4Address, RoutingTableEntry::iterator i =
table.begin(); i != table.end(); i++)
{
std::cout << Simulator::Now ().GetSeconds () << " " <<
rt.GetDestination() << " " << it->first << " " it->second << " Setting X
to " << value << std::endl;
i->second.SetX (value);
}

- Tom

sathvik kote

unread,
Jun 21, 2020, 9:31:25 AM6/21/20
to ns-3-users
I have done debugging with all types of logging. I have no issue with that. May be with the example it may be clear.
Suppose I have one routing table entry.
[destination1, vaild, interface1, hops1, ........., x1 ].

This is my instance within the routing table. Then I get this instance in above mentioned way in a variable say i.
i = instance1.

Now I have a statement. i->setX(x2);

But the instance doesn't change. If I collect the instance again in the same for loop and check for value of X. It will be x1 for sure. 

SheikhMuhammadSaleh Farooqui

unread,
Jun 21, 2020, 6:37:31 PM6/21/20
to ns-3-...@googlegroups.com
Hi,
I am also working on the same protocol but my work is little different then your as I am analysing the perform out of it.
Can help me run simulation for the same protocol which I am finding my self In trouble.
Thanks 

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/4d45815a-43ac-40ae-90bf-8777913b72cao%40googlegroups.com.

Jay Vivarekar

unread,
Jun 22, 2020, 12:08:10 AM6/22/20
to ns-3-users
Hi.
I think you should debug your code and set a breakpoint at your setX call. From thereon single step and make sure the variable of your interest is being actually set. This is the only solution possible I feel based on the information you have given. A paste of your code could maybe help to come up with any other solutions.
Hope this helps.
-Jay

Hemant Saini

unread,
Jun 24, 2020, 9:07:53 PM6/24/20
to ns-3-...@googlegroups.com
Pl attach the code and also specify what actually u r in trouble and what you want to improve

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/3a201998-75ab-4e94-a300-ae4cfa306aefo%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages