12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 15<strong>The</strong> (Revised) Addressing Structure in NSThis chapter describes the internals of the revised addressing form<strong>at</strong> implemented in <strong>ns</strong>. <strong>The</strong> chapter co<strong>ns</strong>ists of five sectio<strong>ns</strong>.We describe the APIs th<strong>at</strong> can be used for alloc<strong>at</strong>ing bits to the <strong>ns</strong> addressing structure. <strong>The</strong> address space as describedin chapter 3, can be thought of a contiguous field of n bits, where n may vary as per the address requirement of the simul<strong>at</strong>ion.<strong>The</strong> default value of n is 16 (as defined by MAXADDRSIZE_). <strong>The</strong> maximum value of n is set to 32 (defined asMAXADDRSIZE_). <strong>The</strong>se default <strong>and</strong> maximum address sizes are defined in ~<strong>ns</strong>//tcl/lib/<strong>ns</strong>-default.tcl.<strong>The</strong> address space co<strong>ns</strong>ists of 2 parts, the node-id <strong>and</strong> the port-id. <strong>The</strong> higher bits are assigned as the node’s address or id_<strong>and</strong> remaining lower bits are assigned to form port-id or the identific<strong>at</strong>ion of the agent <strong>at</strong>tached to the node. Of the higherbits, 1 bit is assigned for multicast. <strong>The</strong> address space co<strong>ns</strong>ists of 32 bits <strong>and</strong> port id space co<strong>ns</strong>ists of 32 bits as well. <strong>The</strong>higher 32 bits for node-id, the MSB for multicast <strong>and</strong> the lower 32 bits for port-id. Additionally, the address space mayalso be set in hierarchical form<strong>at</strong>, co<strong>ns</strong>isting of multiple levels of addressing hierarchy. We shall be describing the APIs forsetting address structure in different form<strong>at</strong>s as described above as well as exp<strong>and</strong>ing the address space. <strong>The</strong> procedures <strong>and</strong>functio<strong>ns</strong> described in this chapter can be found in ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-address.tcl, address.cc <strong>and</strong> address.h.15.1 <strong>The</strong> Default Address Form<strong>at</strong><strong>The</strong> default settings alloc<strong>at</strong>es 32 lower bits for port-id, 1 higher bit for mcast <strong>and</strong> the rest 32 higher bits for node-id. <strong>The</strong>procedure to set the address form<strong>at</strong> in default mode is called during initialis<strong>at</strong>ion of the simul<strong>at</strong>or as:# <strong>The</strong> preambleset <strong>ns</strong> [new Simul<strong>at</strong>or];# initialise the simul<strong>at</strong>ionIt can also be called explicitly set as:$<strong>ns</strong> set-address-form<strong>at</strong> def15.2 <strong>The</strong> Hierarchical Address Form<strong>at</strong><strong>The</strong>re are two optio<strong>ns</strong> for setting an address to hierarchical form<strong>at</strong>, the default <strong>and</strong> the specified.141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!