Implementing a Routing Agent with convenient manually configured routing table (static routing)

[ Back to Network Simulator 2 for Wireless ]


Outline

1. Agent and Connector

Connector is the most basic class of ns, and it has "target_" , and will handle "recv", "send" and "drop" activities.
Basically, a routing agent is going to override "recv" function of agent.
The default behavior of "recv" in agent is to calling the "app_" 's "recv" function. However, as routing agent is usually not dependent on application. It has to override the virtual "recv" function.

2. Routing Table Class.

Routing table is a class that store routing table entries. Each entry should have dst, next-hop and metric. Often, it has sequence number to determine if it is a newer routing message. However, for fixed routing, this is unnecessary.
So we define two new classes:
class FixRTable;   // routing table
class fixrt_ent;  // routing table entry
Packet queue is used to store those packets with dst but have no good routes. This is not necessary for fix Routing.
So, The router does not need to have queues for each neighbors,  we remove  IP layer queues in "PacketQueue" member
variable in class "fixrt_ent".

3. Routing Agent Class.

The most important task for a routing agent is to detect link and refresh routing table with special routing signaling
messages such as periodic Advertisements. However, in fix routing, there is not such a burden. Only two things,
1) Start-up function, called in the command "start-fixrt". In this function, we call makeRoutingtable function. routing information will be "fscanf" from a file
and adding to the tables. Here, we are going to use "fscanf" to read three parameters. "int32" "int32 ""uint16", to represent
dst, hop, metric. The filename must be specified . Different nodes read different sections of the routing table file.
The specical format of this file is:

<src><dst> <next-hop><number of hops>
0 3 1 3
.......

So, only the src addr is equal to myaddr will be read.
The generation of routing table could be easily implemented by an algorithm from topology file. In topology file, we only has a topo file show all edges connecting two nodes. such as:

0 1 1
1 2 1
....

Ref: Simulation with Topology in D-LSMA.

2) Packets Forwarding according to the routing table, also need to handle "broadcast" packets.
"Forwarding" means determining the next-hop of the packet, once this field of the header is set, it is done.

The interface to MAC has two aspects:
1) packets going to mac with next-hop set, ready for layer 2 transmission.
2) once link of loss is detected, the MAC will "callback" (inform) routing agent to do correspondingly.  In this Fix Routing Agent,
this would be dummy. we do nothing in "mac_callback" function.

4. Interface (Linkage) to Otcl

When a wireless node is created, its default routing agent is specified in the arguments, in /tcl/lib/ns-lib.tcl. the
"create-wireless-node" procedure will checking the routing protocol type, here we can adding a new type as "FixRT"
in the "switch" block, also add "set ragent [$self create-fixrt-agent $node]", the "create-fixrt-agent" procedure is also
need to be defined. In this procedure, a  "$self at 0.0 "$ragent start-fixrt"  " will be given to the routing agent. Therefore,
we have to initialize routing table in the start-fixrt command.

After this, all packets will come in the "recv" function entry, and just routing according to the table.

5. Benefits of Using Fix Route Routing


When, FIXRT, instead of DSDV, AODV, DSR , is used as a Routing protocol used for a wireless node, it is
the most efficient routing protocol if the route is pre-calculated in an optimal way, Thus, it stands an upper bound of
performance in the routing protocol,  when nodes are not moving.
When nodes are mobile, we are not adaptive change routing table, so performance is not optimal.

The other big benefits is that Routing messages are suppressed, and link loss are also ignored. So, it provides a baisc and fair
platform for comparing MAC protocol performance with the "ALWAYS SAME" route.!!!
This is important because Routing protocol depends on MAC to propagate routing messages, If MAC is modified, the routing path
could also be changed and the performance comparison is no longer accurate!

APPENDIX

Routing Table for 4*4 grid

0----1-----2-----3
|       |       |       |
4----5-----6-----7
|       |       |       |
8----9-----10---11
|       |       |        |
12--13---14----15

0 1 1 1
0 2 1 2
...
14 11 3 4
14 12 3 3
14 13 3 5


Sourcecode:

There are two classes implemented. So, 4 files;
2006/12/18 15:43 2006/12/18 15:43
TAG
Trackback address :: http://4ellene.net/tt/trackback/1083
  1. Xanax drug test.

    Tracked from Xanax. 2008/08/04 11:23  삭제

    Xanax overdose. Xanax xr crushed. Generic xanax 2 mg no prescription. Ativan xanax valuim trial pack.

Comments List

  1. dress my babe 2008/05/23 07:06

  2. hardcore alien hentai 2008/05/23 07:43

Write a comment.

[로그인][오픈아이디란?]