Introduction
This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes:
- What are they, their purposes, their relationship,
- How to configure them conceptually, and
- Using $ns node, how a default classifier, namely “classifier_”, is created and put in a node.
So far, what we have looks like the figure below. In the previous post, I discussed how the blue block (classifier_) is inserted in to a node.
This post focuses on how two yellow blocks are placed into a node.
The purposes of routing modules rtnotif_ and ptnotif_
Again, a routing module acts as a single point of management for all relevant classifiers in a node. It is an entry point which propagates commands for all related classifiers. From the above figure, a node has 2 default routing modules, which have different purposes.
- rtnotif_: propagates routing information for all attached classifiers.
- ptnotif_: propagates transport layer bridging information for all attached classifiers.
In the following, I will use the notation as indicated in the previous post. Please have a look to refresh your memory.
Structure
Both the routing modules are created using “$ns node”. As in the previous post, I will divide the statement “$ns node” into three parts:
- Part I. $ns node
- Part II. Constructor of Class Node
- Part III. Inserting Routing Modules and Classifiers
Part III. Inserting Routing Modules and Classifiers
If you recall, this part carries out the last step in the part II:
$mod register $self
where $mod is the base routing module, and $self is the Node instance that we are working on. This means NS2 executes the following instproc
- [f_RT] RtModule/Base::register {node} -> $self next $node
Instproc register of class RtModule
There are 2 related steps within instproc RtModule::register, i.e.,
- [f_RT] RtModule::register { node } -> $node route-notify $self -> $node port-notify $self
- [f_NT] Node::route-notify{module}: Insert a routing module $module in the node we are working on. The name of this routing module is $rtnotif_, which propagates routing information for all related (address) classifiers:
- -> if {$rtnotif_ == ""} { set rtnotif_ $module } If $rtnotif_ does not exists, store the input routing module (namely $module) in the instvar $rtnotif_ of the node we are working on. -> else { $rtnotif_ route-notify $module }
- Otherwise, invoke OTcl commands (defined in C++) which concatenates $module to the end of the routing module chain whose head routing module is $rtnotif_.
- [f_NT] Node::port-notify{module}: Insert a routing module $module in the node we are working on. The name of this routing module is $ptnotif_, which propagates transport layer bridge information for all related (port) classifiers.
- -> lappend ptnotif_ $module which stores the input routing module (namely $module) as the last entry of the list of routing module $ptnotif_. Note, a data type 'list' in Tcl is similar to 'array' in C++.
Again, another long post, isn't it. But look at the above figure. We have added two more yellow blocks into a node. There are still few more to go. So stay tune!
==============================================================
For more information about incorporating new modules into NS2, see Chapter 2 in the following book from Springer:
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009.
You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm
No comments:
Post a Comment