16.4 Lists of changes for merging code developed in older version of ns (2.1b5 or later) into the current version (2.1b8)

The CMU-wireless model developed by David Johnhson's Monarch project was merged into ns around 1998-99 in what was then the ns-2.1b5 version. Since then the ns versions used by Monarch and by us here at ISI have forked quite a bit. Recently we ported a newer version of DSR developed by the Monarch group back into ns and in the process have created a list of changes that were required to be made for the merge. Hopefully this list will be helpful for those who have been working on older versions of ns from around that time or or later, to have their stuff merged in to the current version of ns-2.1b8.

The following lists of changes are required for merging the cmu version of ns (2.1b5) in to current version of 2.1b8. Each change is followed by a brief explanation for why the change was made.

Methods for accessing pkt hdrs have changed from
(hdr_sr *)p-access(off_sr)
to a static access method defined for each hdr, as
hdr_sr::access(p)
where for class hdr_sr a static method access() is defined as
 inline static hdr\_sr* access(const Packet* p) {
		 return (hdr\_sr*)p-\>access(offset\_); 
 }
why: This change avoids using casts everywhere.

As the method for accessing hdrs have changed, there is no need to explicitly bind the hdr offset values. This is now done while establishing tcl linkage for the individual hdr classes. so lines like
bind("off_SR_", &off_sr_);
bind("off_ll_", &off_ll_);
bind("off_mac_", &off_mac_);
bind("off_ip_", &off_ip_);
should be removed.

AF_ enumerations replaced by NS_AF_ as in
enum ns_af_enum NS_AF_NONE, NS_AF_ILINK, NS_AF_INET ;
why: This avoids header clashes between ns and the OS.

The ip hdr (dst/src) address fields that used be integers are now defined as structures called ns_addr_t. ns_addr_t has 2 members address_ and port_ that are both defined as int. Hence lines like
iph-src() should change to
iph-saddr() & iph-sport();
Also lines like
dst_ = (IP_BROADCAST 8) | RT_PORT
should be replaced by
dst_.addr_ = IP_BROADCAST;
dst_.port_ = RT_PORT;
Why: This extension supports 32bit addressing.

The addrs_ member for hdr_sr class has a separate function for returning its value . Thus need to call hsr.addrs() instead of hsr.addrs.
why: addrs_ is now a private variable which is accessed by public function addrs().

All includes that had absolute paths by using were replaced by "". Thus
cmu/dsr/dsragent.h
was changed to
"cmu/dsr/dsragent.h"

The tcl command "ip-addr" was changed to "addr".
Other new tcl commands like "node", "port-dmux" and "trace-target" were added.
why: Part of support for mobileIP and wired-cum-wireless simulations.

Need to convert address in string format into int format; so use
Address::instance().str2addr(argv[2])
instead of
atoi(argv[2])
why: This is required for supporting hier-addressing/routing.

The array packet_names[] has changed to packet_info.name()
why: In order to remove a bunch of #defines for pkt types, an enumeration called packet_t now describes all packet types in ns. class p_info was created that now describes an array name_ that has replaced packet_names array used previously.

Have to explicitly set direction of new pkts to DOWN before sending them down to the LL.
why: A variable direction_ in hdr_cmn is now used. This is used in the lower layers like LL, mac, phy etc to determine the direction of the pkt flow. All incoming pkts are marked as UP by channel, which should be remarked as DOWN by agents before sending them out into the network again.

Instead of logtarget-buffer, should now call logtarget-pt_-buffer.
why: This change reflects support for eventtracing. Tracing has evolved into two types, packet tracing and event tracing. Class Trace essentially supports packet tracing. However in addition to the basic tracing properties that it derives from a BaseTrace class, pkt-tracing also requires to inherit some of the Connector class properties as well. Hence pt_, a basetrace object represents the pure tracing functionalities required for a trace object.

The parameter used to describe the reason a pkt was dropped used to be an integer. This was changed to char*. Hence needed to define different pkt-drop reasons in string formats.
Why: Allows greater expandibility and flexibility.

linkHead changed to dsrLinkHead.
why: name clashed with linkHead used elsewhere in ns.

The older cmu model used an incoming_ flag added in all pkts to figure out direction of pkt flow in the lower layers like ll, mac etc. Later this was replaced by a variable called direction_ added in cmn_hdr. direction value can be set to UP, DOWN or NONE. all pkts created with a DOWN dir by default.
why: Both these flags were being used which is not really reqd. so incoming_ flag has been replaced with direction_.

Tom Henderson 2011-11-05