create new tag
, view all tags

Adding a Simple Routing Table

At this point, I assume you have reached the the end of Tic Toc Tutorials. They leave at this point: messages are delivered to destinations by nodes simply checking to see if a particular message is destined for themselves, and if not, forwarding them out to a randomly selected interface in the hope that they will reach their destination eventually. Store-and-forward type packet-switched networks are somewhat more deterministic. To make our simulation more like a real network we will add a rudimentary routing table to each node.

In this exercise routing tables will be pre-calculated and entered as parameters in the omnetpp.ini file. Each node will store an array that says which gate to send a message out for a specified destination node.

We use the routing tables by replacing the random gate code in the function forward_message() with the following lines:

   // Gate selection from the routing table.
   TicTocMsg13 *ttmsg = check_and_cast<TicTocMsg13 *> (msg);
   int k = rt[ttmsg->getDestination()];
When a message arrives at a node that is not its destination, it is forwarded via the gate specified in the routing table rather than via a random gate.

Here are the files required to run this simulation:

(Thanks to BrettPentland for suggesting and implementing this part of the tutorial.)

Topic revision: r1 - 2013-03-10 - AhmetSekercioglu
This site is powered by the TWiki collaboration platformCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback