This chapter describes the internals of the revised addressing format implemented in . The chapter consists of five sections. We describe the APIs that can be used for allocating bits to the ns addressing structure. The address space as described in chapter 3, can be thought of a contiguous field of n bits, where n may vary as per the address requirement of the simulation. The default value of n is 16 (as defined by MAXADDRSIZE_). The maximum value of n is set to 32 (defined as MAXADDRSIZE_). These default and maximum address sizes are defined in /tcl/lib/ns-default.tcl.
The address space consists of 2 parts, the node-id and the port-id. The higher bits are assigned as the node's address or id_ and remaining lower bits are assigned to form port-id or the identification of the agent attached to the node. Of the higher bits, 1 bit is assigned for multicast. The default settings allow 7 higher bits for node-id, the MSB for multicast and the lower remaining 8 bits for port-id. Naturally this limits the simulation to 128 nodes. This address space may be expanded to accomodate larger number of nodes in the simulation. The port-id may also be expanded to suppprt higher number of agents. Additionally, the address space may also be set in hierarchical format, consisting of multiple levels of addressing hierarchy. We shall be describing the APIs for setting address structure in different formats as described above as well as expanding the address space. The procedures and functions described in this chapter can be found in tcl/lib/ns-address.tcl, address.cc and address.h.