next up previous contents index
Next: 5.2 Node Methods: Configuring Up: 5. Nodes and Packet Previous: 5. Nodes and Packet

   
5.1 Simulator Methods: Creating the Topology

The basic primitive for acquiring 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 node is as shown in Figure 5.1.
  
Figure 5.1: Structure of an Unicast Node
node

The address of an agent in a node is 16 bits wide: the higher 8 bits define the node id_, the lower 8 bits identify the individual agent at the node. This limits the number of nodes in a simulation to 256 nodes. If the user needs to create a topology larger than 256 nodes, then they should first expand the address space before creating any nodes, as

        $ns set-address-format expanded
This expands the address space to 30 bits, the higher 22 of which are used to assign node numbers. NOTE: Starting from release 2.1b6, the above is no longer necessary; is using 32-bit integers for both address and port. Therefore, the above restriction of 256 nodes is no longer applicable.

By default, nodes in 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]
<<<<<<< nodes.tex NOTE: the old way of enabling multicast, e.g., Simulator set EnableMcast_ 1, is no longer needed. ======= NOTE: the old way of enabling multicast, e.g., Simulator set EnableMcast_ 1, is no longer needed. >>>>>>> 1.8 The internal structure of a typical multicast node is shown in Figure 5.2.
  
Figure 5.2: Internal Structure of a Multicast Node
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. This implies that, by default, a multicast simulation is restricted to 128 nodes.


next up previous contents index
Next: 5.2 Node Methods: Configuring Up: 5. Nodes and Packet Previous: 5. Nodes and Packet

2000-08-24