TWiki home TWiki > Simulation > SimulationWebHome > Tutorials > AddingASimpleRoutingTable TWiki webs:
Main | TWiki | Know | Sandbox
Simulation . { Changes | Index | Search | Go }

Step 13: Adding a Routing Table

Thus far messages have been delivered to destinations by nodes simply checking to see if the 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 AddingASimpleRoutingTable . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More }
Revision r1.2 - 11 Aug 2011 - 01:54 GMT - AhmetSekercioglu
Parents: SimulationWebHome > Tutorials
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.