5.1 Node Basics

The basic primitive for creating a node is

    set ns [new Simulator]
    $ns \fcnref{\textbf{node}}{../ns-2/ns-lib.tcl}{Simulator::node}
The instance procedure node constructs a node out of more simple classifier objectsSectionsec:node:classifiers. The Node itself is a standalone class in OTcl. However, most of the components of the node are themselves TclObjects. The typical structure of a (unicast) node is as shown in Figure 5.1. This simple structure consists of two TclObjects: an address classifer (classifer_) and a port classifier (dmux_). The function of these classifiers is to distribute incoming packets to the correct agent or outgoing link.
Figure 5.1: Structure of a Unicast Node. Notice that entry_ is simply a label variable instead of a real object, e.g., the classifier_.
\includegraphics{node}

All nodes contain at least the following components:

By default, nodes in ns are constructed for unicast simulations. In order to enable multicast simulation, the simulation should be created with an option ``-multicast on'', e.g.:

        set ns [new Simulator -multicast on]
The internal structure of a typical multicast node is shown in Figure 5.2.
Figure 5.2: Internal Structure of a Multicast Node.
\includegraphics{mcastNode}

When a simulation uses multicast routing, the highest bit of the address indicates whether the particular address is a multicast address or an unicast address. If the bit is 0, the address represents a unicast address, else the address represents a multicast address.

Tom Henderson 2011-11-05