MobileNode is the basic Node object with added functionalities like movement, ability to transmit and receive on a channel that allows it to be used to create mobile, wireless simulation environments. The class MobileNode is derived from the base class Node. MobileNode is a split object. The mobility features including node movement, periodic position updates, maintaining topology boundary etc are implemented in C++ while plumbing of network components within MobileNode itself (like classifiers, dmux , LL, Mac, Channel etc) have been implemented in Otcl. The functions and procedures described in this subsection can be found in mobilenode.{cc,h}, tcl/lib/ns-mobilenode.tcl, tcl/mobility/dsdv.tcl, tcl/mobility/dsr.tcl, tcl/mobility/tora.tcl. Example scripts can be found in tcl/ex/wireless-test.tcl and tcl/ex/wireless.tcl. While the first example uses a small topology of 3 nodes, the second example runs over a topology of 50 nodes. These scripts can be run simply by typing
$ns tcl/ex/wireless.tcl (or /wireless-test.tcl)
The four ad-hoc routing protocols that are currently supported are Destination Sequence Distance Vector (DSDV), Dynamic Source Routing (DSR), Temporally ordered Routing Algorithm (TORA) and Adhoc On-demand Distance Vector (AODV). The APIs for creating a mobilenode depends on which routing protocol it would be using. Hence the primitive to create a mobilenode is
set mnode [$opt(rp)-create-mobile-node $id]where $opt(rp) defines "dsdv", "aodv", "tora" or "dsr" and id is the index for the mobilenode.
The above procedure creates a mobilenode (split)object, creates a routing
agent as specified, creates the network stack consisting of a link layer,
interface queue, mac layer, and a network interface with an antenna,
interconnects these components and con
nects the stack to the channel. The mobilenode now looks like the
schematic in Figure 15.1.
The mobilenode structure used for DSR routing is slightly different from
the mobilenode described above. The class SRNode is derived from class
MobileNode. SRNode doesnot use address demux or classifiers and all
packets received by the node are handed dow
n to the DSR routing agent by default. The DSR routing agent either
receives pkts for itself by handing it over to the port dmux or forwards
pkts as per source routes in the pkt hdr or sends out route requests and
route replies for fresh packets. Details
on DSR routing agent may be found in section 15.1.4. The schematic
model for a SRNode is shown in Figure 15.2.