Index: address.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/address.cc,v
retrieving revision 1.14
diff -r1.14 address.cc
155c155,159
< 		sprintf(temp, "%d.", a);
---
> 		if (i < levels_)
> 			sprintf(temp, "%d.", a);
> 		else
> 			sprintf(temp, "%d", a);
> 		
162a167,214
> 
> char *Address::get_subnetaddr(int address)
> {
> 	int a;
> 	char temp[SMALL_LEN];
> 	char str[SMALL_LEN];
> 	char *addrstr;
> 
> 	if (levels_ > 1) {
> 		str[0] = '\0';
> 		for (int i=1; i < levels_; i++) {
> 			a = address >> NodeShift_[i];
> 			a = a & NodeMask_[i];
> 			if (i < (levels_-1))
> 				sprintf(temp, "%d.", a);
> 			else
> 				sprintf(temp, "%d", a);
> 			strcat(str, temp);
> 		}
> 		addrstr = new char[strlen(str)+1];
> 		strcpy(addrstr, str);
> 		printf("Subnet_addr - %s\n",addrstr);
> 		return(addrstr);
> 	}
> 	return NULL;
> 	
> }
> 
> 
> int Address::get_nodeaddr(int address)
> {
> 	int a;
> 	char *temp;
> 	
> 	temp = print_nodeaddr(address);
> 	a = str2addr(temp);
> 	delete temp;
> 	return a;
> }
> 
> 
> int Address::get_lastaddr(int address)
> {
>  	int a;
>  	a = address >> NodeShift_[levels_];
>  	a = a & NodeMask_[levels_];
>  	return a;
>  }
Index: address.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/address.h,v
retrieving revision 1.8
diff -r1.8 address.h
49c49,57
< 	int str2addr(const char *str) const;
---
> 	char *get_subnetaddr(int address);
> 	int   get_lastaddr(int address);
> 	int   get_nodeaddr(int address);
> 	int   str2addr(const char *str) const;
> 
> 	inline int portshift() {return PortShift_;}
> 	inline int portmask() {return PortMask_;}
> 	inline int nodeshift() {return NodeShift_[levels_];}
> 	inline int nodemask() {return NodeMask_[levels_];}
Index: arp.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/arp.cc,v
retrieving revision 1.4
diff -r1.4 arp.cc
56c56
< 
---
> #include <address.h>
102c102
< 
---
> 	off_mac_ = hdr_mac::offset_;
104c104
< 	bind("off_mac_", &off_mac_);
---
> 	//bind("off_mac_", &off_mac_);
133c133
<         fprintf(stderr, "%d - %s\n", node_->index(), __FUNCTION__);
---
>         fprintf(stderr, "%d - %s\n", node_->address(), __FUNCTION__);
198c198
< 	int src = node_->index(); // this host's IP addr
---
> 	int src = node_->address(); // this host's IP addr
266c266
< 		node_->index(), __FUNCTION__, ah->arp_op,
---
> 		node_->address(), __FUNCTION__, ah->arp_op,
289a290,293
> 		// XXXHACK for now: 
> 		// Future work: separate port-id from IP address ??
> 		int dst = Address::instance().get_nodeaddr(ih->dst());
> 		
291c295
<                     ih->dst() == ah->arp_spa) ||
---
>                     dst == ah->arp_spa) ||
308c312
< 		ah->arp_tpa == node_->index()) {
---
> 		ah->arp_tpa == node_->address()) {
315a320
> 		ch->direction_ = -1; // send this pkt down
Index: channel.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/channel.cc,v
retrieving revision 1.27
diff -r1.27 channel.cc
55a56,59
> #include "ip.h"
> #include "dsr/hdr_sr.h"
> 
> 
153c157,159
< 
---
> 	struct hdr_sr *srh = HDR_SR(p);
> 	struct hdr_ip *iph = HDR_IP(p);
> 	
166a173,175
> 		hdr_sr *newsrh =  HDR_SR(newp);
> 		hdr_ip *newiph =  HDR_IP(newp);
> 		
222c231
< 			tmnode->index(), rmnode->index(), s.clock());
---
> 			tmnode->address(), rmnode->address(), s.clock());
Index: cmu-trace.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/cmu-trace.cc,v
retrieving revision 1.6
diff -r1.6 cmu-trace.cc
85,86c85,86
< 
< 	bind("off_mac_", &off_mac_);
---
> 	off_mac_ = hdr_mac::offset_;
> 	//bind("off_mac_", &off_mac_);
Index: god.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/god.cc,v
retrieving revision 1.3
diff -r1.3 god.cc
144,145c144,145
<                         assert(i > 0 && i < num_nodes);
<                         assert(j > 0 && j < num_nodes);
---
>                         assert(i >= 0 && i < num_nodes);
>                         assert(j >= 0 && j < num_nodes);
Index: ll.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/ll.cc,v
retrieving revision 1.35
diff -r1.35 ll.cc
45a46
> #include <dsr/hdr_sr.h>
137a139,140
> 	//struct hdr_sr *hsr = HDR_SR(p);
> 	
146c149,150
< 		if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
---
> 		//if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
> 		if(ch->ptype_ == PT_ARP)
162c166,168
< 	nsaddr_t dst = ih->dst();
---
> 	// XXX HACK for now - Padma, 03/99.
> 	nsaddr_t dst = (nsaddr_t)Address::instance().get_nodeaddr(ih->dst());
> 	//nsaddr_t dst = ih->dst();
Index: mac-802_11.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac-802_11.cc,v
retrieving revision 1.26
diff -r1.26 mac-802_11.cc
52,54d51
< /* ======================================================================
<    Macros
<    ====================================================================== */
73,74c70,73
<                 assert(HDR_MAC802_11(p)->dh_fc.fc_type == MAC_Type_Control); \
<                 assert(HDR_MAC802_11(p)->dh_fc.fc_subtype == MAC_Subtype_ACK);\
---
>                 struct hdr_mac802_11 *dh = HDR_MAC802_11(p);                  \
>                                                                         \
>                 assert(dh->dh_fc.fc_type == MAC_Type_Control);          \
>                 assert(dh->dh_fc.fc_subtype == MAC_Subtype_ACK);        \
90c89
< 										downtarget_->recv(p, this);                                     \
---
>         downtarget_->recv(p->copy(), this);                             \
111a111,112
> 
> 
525a527,531
> 	//if (mhBackoff_.busy() != 0)
> 	//{
> 	//	printf("deferHandler:mhBackoff_ busy!\n");
> 	//	return;
> 	//}
631c637
< 
---
> 							  
661c667
< 		fprintf(stderr, "Invalid MAC Control subtype\n");
---
> 		fprintf(stderr, "check_pktCTRL:Invalid MAC Control subtype\n");
674a681,682
> 	
> 	
680a689
> 	//struct hdr_cmn *ch = HDR_CMN(pktRTS_);
698c707
< 		fprintf(stderr, "Invalid MAC Control subtype\n");
---
> 		fprintf(stderr, "check_pktRTS:Invalid MAC Control subtype\n");
713c722
< 
---
> 	
720c729
<        	//int len = HDR_CMN(pktTx_)->size();
---
>        	int len = HDR_CMN(pktTx_)->size();
737c746,747
< 			timeout = ACKTimeout(netif_->txtime(pktTx_));
---
> 			//timeout = ACKTimeout(netif_->txtime(pktTx_))+5;
> 			timeout = ACKTimeout(len) + 10;
744c754,756
< 		fprintf(stderr, "Invalid MAC Control subtype\n");
---
> 		fprintf(stderr, "check_pktTx:Invalid MAC Control subtype\n");
> 		//printf("pktRTS:%x, pktCTS/ACK:%x, pktTx:%x\n",pktRTS_, pktCTRL_,pktTx_);
> 		
763a776
> 	//struct hdr_mac802_11 *mh = HDR_MAC802_11(p);
786c799
< 	ch->direction() = -1;
---
> 	//ch->direction() = -1;
791,800c804,824
< 	rf->rf_fc.fc_type	= MAC_Type_Control;
< 	rf->rf_fc.fc_subtype	= MAC_Subtype_RTS;
< 	rf->rf_fc.fc_to_ds	= 0;
< 	rf->rf_fc.fc_from_ds	= 0;
< 	rf->rf_fc.fc_more_frag	= 0;
< 	rf->rf_fc.fc_retry	= 0;
< 	rf->rf_fc.fc_pwr_mgt	= 0;
< 	rf->rf_fc.fc_more_data	= 0;
< 	rf->rf_fc.fc_wep	= 0;
< 	rf->rf_fc.fc_order	= 0;
---
>  	rf->rf_fc.fc_type	= MAC_Type_Control;
>  	rf->rf_fc.fc_subtype	= MAC_Subtype_RTS;
>  	rf->rf_fc.fc_to_ds	= 0;
>  	rf->rf_fc.fc_from_ds	= 0;
>  	rf->rf_fc.fc_more_frag	= 0;
>  	rf->rf_fc.fc_retry	= 0;
>  	rf->rf_fc.fc_pwr_mgt	= 0;
>  	rf->rf_fc.fc_more_data	= 0;
>  	rf->rf_fc.fc_wep	= 0;
>  	rf->rf_fc.fc_order	= 0;
> 	// mh->dh_fc.fc_protocol_version = MAC_ProtocolVersion;
> // 	mh->dh_fc.fc_type	= MAC_Type_Control;
> // 	mh->dh_fc.fc_subtype	= MAC_Subtype_RTS;
> // 	mh->dh_fc.fc_to_ds	= 0;
> // 	mh->dh_fc.fc_from_ds	= 0;
> // 	mh->dh_fc.fc_more_frag	= 0;
> // 	mh->dh_fc.fc_retry	= 0;
> // 	mh->dh_fc.fc_pwr_mgt	= 0;
> // 	mh->dh_fc.fc_more_data	= 0;
> // 	mh->dh_fc.fc_wep	= 0;
> // 	mh->dh_fc.fc_order	= 0;
820a845
> 	//struct hdr_mac802_11 *mh = HDR_MAC802_11(p);
829c854
< 	ch->direction() = -1;
---
> 	//ch->direction() = -1;
835,842c860,868
< 	cf->cf_fc.fc_to_ds	= 0;
< 	cf->cf_fc.fc_from_ds	= 0;
< 	cf->cf_fc.fc_more_frag	= 0;
< 	cf->cf_fc.fc_retry	= 0;
< 	cf->cf_fc.fc_pwr_mgt	= 0;
< 	cf->cf_fc.fc_more_data	= 0;
< 	cf->cf_fc.fc_wep	= 0;
< 	cf->cf_fc.fc_order	= 0;
---
>  	cf->cf_fc.fc_to_ds	= 0;
>  	cf->cf_fc.fc_from_ds	= 0;
>  	cf->cf_fc.fc_more_frag	= 0;
>  	cf->cf_fc.fc_retry	= 0;
>  	cf->cf_fc.fc_pwr_mgt	= 0;
>  	cf->cf_fc.fc_more_data	= 0;
>  	cf->cf_fc.fc_wep	= 0;
>  	cf->cf_fc.fc_order	= 0;
> 	
846a873
> 	//STORE4BYTE(&dst, (mh->dh_da));
851a879
> 	
859a888
> 	//struct hdr_mac802_11 *mh = HDR_MAC802_11(p);
868c897
< 	ch->direction() = -1;
---
> 	//ch->direction() = -1;
873,882c902,911
< 	af->af_fc.fc_type	= MAC_Type_Control;
< 	af->af_fc.fc_subtype	= MAC_Subtype_ACK;
< 	af->af_fc.fc_to_ds	= 0;
< 	af->af_fc.fc_from_ds	= 0;
< 	af->af_fc.fc_more_frag	= 0;
< 	af->af_fc.fc_retry	= 0;
< 	af->af_fc.fc_pwr_mgt	= 0;
< 	af->af_fc.fc_more_data	= 0;
< 	af->af_fc.fc_wep	= 0;
< 	af->af_fc.fc_order	= 0;
---
>  	af->af_fc.fc_type	= MAC_Type_Control;
>  	af->af_fc.fc_subtype	= MAC_Subtype_ACK;
>  	af->af_fc.fc_to_ds	= 0;
>  	af->af_fc.fc_from_ds	= 0;
>  	af->af_fc.fc_more_frag	= 0;
>  	af->af_fc.fc_retry	= 0;
>  	af->af_fc.fc_pwr_mgt	= 0;
>  	af->af_fc.fc_more_data	= 0;
>  	af->af_fc.fc_wep	= 0;
>  	af->af_fc.fc_order	= 0;
907a937,938
> 	//printf(".....p = %x, mac-subtype-%d\n",p,dh->dh_fc.fc_subtype);
> 	
922a954
> 	
931a964
> 
959c992
< 
---
> 		//printf("(%d)....discarding RTS:%x\n",index_,pktRTS_);
965a999
> 		//printf("(%d)...retxing RTS:%x\n",index_,pktRTS_);
967,968c1001,1002
< 
< 		rf = (struct rts_frame*)pktRTS_->access(off_mac_);
---
> 		
> 		rf = (struct rts_frame*)pktRTS_->access(hdr_mac::offset_);
979a1014
> 
1036c1071
< 
---
> 		//printf("(%d)DATA discarded: count exceeded\n",index_);
1046a1082
> 		//printf("(%d)retxing data:%x..sendRTS..\n",index_,pktTx_);
1099c1135,1137
< 
---
> 	//hdr_mac802_11 *mh = HDR_MAC802_11(p);
> 	//u_int32_t dst = ETHER_ADDR(mh->dh_da);
> 	//u_int32_t src = ETHER_ADDR(mh->dh_sa);
1169a1208,1211
> 	// XXX debug
> 	//struct cts_frame *cf = (struct cts_frame*)pktRx_->access(hdr_mac::offset_);
> 	//u_int32_t src = ETHER_ADDR(mh->dh_sa);
> 	
1215c1257
<         /* tap out */
---
>         /* tap out - */
1217c1259,1260
<             MAC_Subtype_Data == subtype) tap_->tap(pktRx_);
---
>             MAC_Subtype_Data == subtype ) 
> 		tap_->tap(pktRx_);
1255c1298
< 			fprintf(stderr, "Invalid MAC Control Subtype %x\n",
---
> 			fprintf(stderr,"recvTimer1:Invalid MAC Control Subtype %x\n",
1270c1313
< 			fprintf(stderr, "Invalid MAC Data Subtype %x\n",
---
> 			fprintf(stderr, "recv_timer2:Invalid MAC Data Subtype %x\n",
1277c1320
< 		fprintf(stderr, "Invalid MAC Type %x\n", subtype);
---
> 		fprintf(stderr, "recv_timer3:Invalid MAC Type %x\n", subtype);
1331c1374,1377
< 
---
> 	// debug
> 	//struct hdr_mac802_11 *mh = HDR_MAC802_11(pktTx_);
> 	//printf("(%d):recvCTS:pktTx_-%x,mac-subtype-%d & pktCTS_:%x\n",index_,pktTx_,mh->dh_fc.fc_subtype,p);
> 	
1380a1427
> 				//printf("(%d): RECVING DATA!\n",index_);
1385a1433
> 				//printf("(%d)..discard DATA\n",index_);
1431a1480
> 	
1435,1436c1484,1485
< 		discard(p, DROP_MAC_INVALID_STATE);
< 		return;
---
> 	discard(p, DROP_MAC_INVALID_STATE);
> 	return;
1438c1487
< 
---
> 	//printf("(%d)...................recving ACK:%x\n",index_,p);
Index: mac-802_11.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac-802_11.h,v
retrieving revision 1.13
diff -r1.13 mac-802_11.h
41a42
> #include "marshall.h"
Index: mac-timers.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac-timers.cc,v
retrieving revision 1.3
diff -r1.3 mac-timers.cc
74c74,75
< 
---
> 	if (busy_ != 0)
> 		{ printf("busy is not zero!");}
Index: mac.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac.cc,v
retrieving revision 1.32
diff -r1.32 mac.cc
86c86
< static int MacIndex = 1;
---
> static int MacIndex = 0;
91a92
> 	off_mac_ = hdr_mac::offset_;
93c94
< 	bind("off_mac_", &off_mac_);
---
> 	//bind("off_mac_", &off_mac_);
Index: mobilenode.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mobilenode.cc,v
retrieving revision 1.5
diff -r1.5 mobilenode.cc
60c60
< static int	MobileNodeIndex = 1;
---
> //static int	MobileNodeIndex = 0;
86c86
< 		node->index(), s.clock());
---
> 		node->address(), s.clock());
98c98
<                 node->index_, __PRETTY_FUNCTION__);
---
>                 node->address_, __PRETTY_FUNCTION__);
117c117
< 	index_ = MobileNodeIndex++;
---
>         // address_ = MobileNodeIndex++;
139c139
< 		Tcl& tcl = Tcl::instance();
---
> 		//Tcl& tcl = Tcl::instance();
141,144c141,144
< 		if(strcmp(argv[1], "id") == 0) {
< 			tcl.resultf("%d", index_);
< 			return TCL_OK;
< 		}
---
> 		// if(strcmp(argv[1], "id") == 0) {
> // 			tcl.resultf("%d", address_);
> // 			return TCL_OK;
> // 		}
153c153
<                                 index_, __PRETTY_FUNCTION__);
---
>                                 address_, __PRETTY_FUNCTION__);
192c192
<                             index_, __FUNCTION__);
---
>                             address_, __FUNCTION__);
212c212
< 	fprintf(stdout, "Index: %d\n", index_);
---
> 	fprintf(stdout, "Index: %d\n", address_);
238c238
<                 index_, __PRETTY_FUNCTION__);
---
>                 address_, __PRETTY_FUNCTION__);
255c255
< 		s.clock(), index_, X, Y, Z, destX, destY, speed);
---
> 		s.clock(), address_, X, Y, Z, destX, destY, speed);
297c297
< 			fprintf(stderr, "Adjust position of node %d\n",index_);
---
> 			fprintf(stderr, "Adjust position of node %d\n",address_);
332c332
<   fprintf(stderr, "%d - %s: calling log_movement()\n", index_, __FUNCTION__);
---
>   fprintf(stderr, "%d - %s: calling log_movement()\n", address_, __FUNCTION__);
361c361
< 		index_, X, Y, Z, now);
---
> 		address_, X, Y, Z, now);
394c394
<                 index_, __FUNCTION__);
---
>                 address_, __FUNCTION__);
Index: mobilenode.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mobilenode.h,v
retrieving revision 1.3
diff -r1.3 mobilenode.h
92c92
< 	inline int index() { return index_; }
---
> 	//inline int index() { return index_; }
134c134
< 	int		index_;		// unique identifier
---
> 	//int		index_;		// unique identifier
Index: node.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/node.cc,v
retrieving revision 1.6
diff -r1.6 node.cc
40a41
> #include <address.h>
53c54
< Node::Node(void)
---
> Node::Node(void) : address_(-1)
60a62,68
> 	if (argc == 2) {
> 		Tcl& tcl = Tcl::instance();
> 		if(strcmp(argv[1], "address?") == 0) {
> 			tcl.resultf("%d", address_);
>  			return TCL_OK;
>  		}
> 	}
67a76,79
> 			return TCL_OK;
> 		}else if (strcmp(argv[1], "addr") == 0) {
> 			address_ = Address::instance().\
> 				str2addr(argv[2]);
Index: node.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/node.h,v
retrieving revision 1.5
diff -r1.5 node.h
59c59,61
< 	//apparently the subclasses cannot access private variable of the superclass 
---
> 	inline int address() { return address_;}
> 
> protected:
61,62c63
<  private:
< 	//struct if_head ifhead_;
---
> 	int address_;
Index: packet.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/packet.h,v
retrieving revision 1.59
diff -r1.59 packet.h
48c48
< 
---
> #include "dsr/hdr_sr.h"
58a59,60
> #define HDR_SR(p)       ((struct hdr_sr*)(p)->access(hdr_sr::offset_))
> 
195c197
<        //void init();            // initialize pkts getting freed.
---
> 	static void init(Packet*);     // initialize pkt hdr 
353c355
< 		bzero(p->bits_, hdrlen_);
---
> 		//bzero(p->bits_, hdrlen_);
354a357
> 	init(p);
355a359,361
> 	(HDR_CMN(p))->direction() = -1;
> 	/* setting all direction of pkts to be downward as default; 
> 	   until channel changes it to +1 (upward) */
380a387,392
> inline void Packet::init(Packet* p)
> {
> 	bzero(p->bits_, hdrlen_);
> }
> 
> 
391a404
> 			init(p);
394d406
< 			//init();
Index: phy.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/phy.cc,v
retrieving revision 1.5
diff -r1.5 phy.cc
45a46
> #include <dsr/hdr_sr.h>
100a102,103
> 	struct hdr_sr *hsr = HDR_SR(p);
> 	
Index: wireless-phy.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/wireless-phy.h,v
retrieving revision 1.2
diff -r1.2 wireless-phy.h
82,83c82,83
<   Modulation *modulation_;	// Modulation Scheme
<   MobileNode* node_;
---
>   Modulation *modulation_;	// Modulation Schem
>   MobileNode* node_;         // Mobile Node to which interface is attached .
Index: dsr/cache_stats.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/cache_stats.h,v
retrieving revision 1.1
diff -r1.1 cache_stats.h
4c4
< #include<cmu/dsr/routecache.h>
---
> #include<dsr/routecache.h>
Index: dsr/dsragent.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/dsragent.cc,v
retrieving revision 1.5
diff -r1.5 dsragent.cc
62a63
> #include <address.h>
414c415
<       if (strcasecmp(argv[1], "ip-addr") == 0) 
---
>       if (strcasecmp(argv[1], "addr") == 0) 
416c417,419
< 	 net_id = ID(atoi(argv[2]), ::IP);
---
>          int temp;
> 	 temp = Address::instance().str2addr(argv[2]);
> 	 net_id = ID(temp, ::IP);
484,485c487,488
<   p.dest = ID(iph->dst(),::IP);
<   p.src = ID(iph->src(),::IP);
---
>   p.dest = ID((Address::instance().get_nodeaddr(iph->dst())),::IP);
>   p.src = ID((Address::instance().get_nodeaddr(iph->src())),::IP);
489c492
<   if (!srh->valid())
---
>   if (srh->valid() != 1)
500,504c503,509
<   else if (p.dest == net_id || p.dest == IP_broadcast)
<     { // this packet is intended for us
<       handlePacketReceipt(p);
<       goto done;
<     }
---
>   else if (srh->valid() == 1) 
>     {
>        if (p.dest == net_id || p.dest == IP_broadcast)
> 	      { // this packet is intended for us
> 		      handlePacketReceipt(p);
> 		      goto done;
> 	      }
521,522c526,532
< 
< 
---
>   }
>   else {
> 	  // some invalid pkt has reached here
> 	  fprintf(stderr,"dsragent: Error-received Invalid pkt!\n");
> 	  Packet::free(p.pkt);
> 	  p.pkt =0; // drop silently
>   }
574c584,585
< 
---
>   hdr_ip *iph = HDR_IP(p.pkt);
>   
605a617,621
>   // set pkt address format as the dmux expects 
>   int mask = Address::instance().portmask();
>   int shift = Address::instance().portshift();
>   iph->dst() = ((iph->dport() & mask) << shift) | ((~(mask) << shift) & \
> 						   iph->dst());
655,656c671,673
<   hdr_sr *srh =  (hdr_sr*)p.pkt->access(off_sr_);
<   assert (srh->route_request());
---
> 
> 	hdr_sr *srh =  (hdr_sr*)p.pkt->access(off_sr_);
> 	assert (srh->route_request());
833c850
<   iph->src() = p.src.addr;
---
>   iph->src() = p.src.addr << Address::instance().nodeshift();
835c852
<   iph->dst() = p.dest.addr;
---
>   iph->dst() = p.dest.addr << Address::instance().nodeshift();
895c912,914
< 
---
>   // set direction of pkt to -1 , i.e downward
>   cmnh->direction_ = -1;
>   
916c935
<   assert(cmnh->direction() == -1);
---
>   //assert(cmnh->direction() == -1);
967c986
<   iph->dst() = p.dest.getNSAddr_t();
---
>   iph->dst() = (p.dest.getNSAddr_t()) << Address::instance().nodeshift();
969c988
<   iph->src() = net_id.getNSAddr_t();
---
>   iph->src() = (net_id.getNSAddr_t()) << Address::instance().nodeshift();
984c1003,1004
<   iph->dst() = p.dest.getNSAddr_t();
---
>   iph->dst() = (p.dest.getNSAddr_t()) << \
> 	  Address::instance().nodeshift();
986c1006,1007
<   iph->src() = net_id.getNSAddr_t();
---
>   iph->src() = (net_id.getNSAddr_t()) << \
> 	  Address::instance().nodeshift();
991c1012
< 
---
>   
1083c1104
<   new_iph->dst() = p_copy.dest.addr;
---
>   new_iph->dst() = (p_copy.dest.addr) << Address::instance().nodeshift();
1085c1106
<   new_iph->src() = p_copy.src.addr;
---
>   new_iph->src() = (p_copy.src.addr) << Address::instance().nodeshift();
1273c1294
<   new_iph->dst() = p_copy.dest.addr;
---
>   new_iph->dst() = (p_copy.dest.addr) << Address::instance().nodeshift();
1275c1296
<   new_iph->src() = p_copy.src.addr;
---
>   new_iph->src() = (p_copy.src.addr) << Address::instance().nodeshift();
1295c1316
<   if (!srh->valid()) return;	// can't do anything with it
---
>   if (srh->valid() != 1) return;	// can't do anything with it
1303,1304c1324,1325
<   p.dest = ID(iph->dst(),::IP);
<   p.src = ID(iph->src(),::IP);
---
>   p.dest = ID((Address::instance().get_nodeaddr(iph->dst())),::IP);
>   p.src = ID((Address::instance().get_nodeaddr(iph->src())),::IP);
1451c1472
<   new_iph->dst() = p_copy.dest.addr;
---
>   new_iph->dst() = (p_copy.dest.addr) << Address::instance().nodeshift();
1453c1474
<   new_iph->src() = p_copy.src.addr;
---
>   new_iph->src() = (p_copy.src.addr) << Address::instance().nodeshift();
1528,1529c1549,1550
<   p.dest = ID(iph->dst(),::IP);
<   p.src = ID(iph->src(),::IP);
---
>   p.dest = ID((Address::instance().get_nodeaddr(iph->dst())),::IP);
>   p.src = ID((Address::instance().get_nodeaddr(iph->src())),::IP);
1536c1557
<   if (ID(iph->src(),::IP) == net_id)
---
>   if (p.src == net_id)
1762c1783
<   iph->dst() = deadlink->tell_addr;
---
>   iph->dst() = (deadlink->tell_addr) << Address::instance().nodeshift();
1764c1785
<   iph->src() = net_id.addr;
---
>   iph->src() = (net_id.addr) << Address::instance().nodeshift();
Index: dsr/mobicache.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/mobicache.cc,v
retrieving revision 1.2
diff -r1.2 mobicache.cc
53c53
< #include <cmu/dsr/cache_stats.h>
---
> #include <dsr/cache_stats.h>
Index: dsr/path.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/path.cc,v
retrieving revision 1.3
diff -r1.3 path.cc
142c142
<   if (!srh->valid_)
---
>   if (srh->valid_ != 1)
151a152,154
>   // debug 
>   if (len > MAX_SR_LEN) {
> 	  printf("len - %d, MAX_SR_LEN - %d\n",len, MAX_SR_LEN);
152a156
>   }
Index: dsr/path.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/path.h,v
retrieving revision 1.3
diff -r1.3 path.h
113,131c113,136
<   ~Path();
< 
<   void fillSR(struct hdr_sr *srh);
< 
<   inline ID& next() {assert(cur_index < len); return path[cur_index++];}
<   inline void resetIterator() {  cur_index = 0;}
<   inline void reset() {len = 0; cur_index = 0;}
< 
<   inline void setIterator(int i) {assert(i>=0 && i<len); cur_index = i;}
<   inline void setLength(int l) {assert(l>=0 && l<=MAX_SR_LEN); len = l;}
<   inline ID& operator[] (int n) const {  
<     assert(n < len && n >= 0);
<     return path[n];}
<   void operator=(const Path& rhs);
<   bool operator==(const Path& rhs);
<   inline void appendToPath(const ID& id) { 
<     assert(len < MAX_SR_LEN); 
<     path[len++] = id;}
<   void appendPath(Path& p);
---
> 	~Path();
> 	
> 	void fillSR(struct hdr_sr *srh);
> 	
> 	inline ID& next() {assert(cur_index < len); return path[cur_index++];}
> 	inline void resetIterator() {  cur_index = 0;}
> 	inline void reset() {len = 0; cur_index = 0;}
> 	
> 	inline void setIterator(int i) {assert(i>=0 && i<len); cur_index = i;}
> 	inline void setLength(int l) {assert(l>=0 && l<=MAX_SR_LEN); len = l;}
> 	ID& operator[] (int n) const {  
> 		//debug 
> 		if (n >= len || n < 0) {
> 			printf("..........n-%d,len-%d\n",n,len);
> 		}
> 		//assert(n < len && n >= 0);
> 		return path[n];
> 	}
> 	void operator=(const Path& rhs);
> 	bool operator==(const Path& rhs);
> 	inline void appendToPath(const ID& id) { 
> 		assert(len < MAX_SR_LEN); 
> 		path[len++] = id;}
> 	void appendPath(Path& p);
Index: dsr/routecache.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/dsr/routecache.h,v
retrieving revision 1.2
diff -r1.2 routecache.h
58c58
< #include <cmu/dsr/cache_stats.h>
---
> #include <dsr/cache_stats.h>
Index: indep-utils/cmu-scen-gen/setdest/setdest.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/indep-utils/cmu-scen-gen/setdest/setdest.cc,v
retrieving revision 1.3
diff -r1.3 setdest.cc
180,181c180
< 			//NODES = atoi(optarg) + 1;
< 			NODES = atoi(optarg) ;
---
> 			NODES = atoi(optarg) + 1;
216c215
< 		NODES , PAUSE, MAXSPEED, MAXX, MAXY);
---
> 		NODES - 1, PAUSE, MAXSPEED, MAXX, MAXY);
224c223
< 		for(i = 0; i < NODES; i++) {
---
> 		for(i = 1; i < NODES; i++) {
228c227
< 		for(i = 0; i < NODES; i++) {
---
> 		for(i = 1; i < NODES; i++) {
232c231
< 		for(i = 0; i < NODES; i++) {
---
> 		for(i = 1; i < NODES; i++) {
294,295c293,294
< 	//if(index == 0)
< 	//return;
---
> 	if(index == 0)
> 		return;
325c324
< 	for(i = 0; i < NODES; i++) {
---
> 	for(i = 1; i < NODES; i++) {
563c562
< 	for(i = 0; i < NODES; i++) {
---
> 	for(i = 1; i < NODES; i++) {
580c579
< 	for(i = 0; i < NODES; i++) {
---
> 	for(i = 1; i < NODES; i++) {
593,594c592,593
< 	for(i = 0; i < NODES; i++) {
< 		for(j = 0; j < NODES; j++) {
---
> 	for(i = 1; i < NODES; i++) {
> 		for(j = i; j < NODES; j++) {
611,613c610,612
< 	for(i = 0; i < NODES; i++) {
< 		for(j = 0; j < NODES; j++) {
< 			for(k = 0; k < NODES; k++) {
---
> 	for(i = 1; i < NODES; i++) {
> 		for(j = 1; j < NODES; j++) {
> 			for(k = 1; k < NODES; k++) {
620,621c619,620
< 	for(i = 0; i < NODES; i++)
< 		for(j = 0; j < NODES; j++) {
---
> 	for(i = 1; i < NODES; i++)
> 		for(j = 1; j < NODES; j++) {
637c636
< 	for(i = 0; i < NODES; i++) {
---
> 	for(i = 1; i < NODES; i++) {
680c679
< 	for(i = 0; i < NODES; i++) {
---
> 	for(i = 1; i < NODES; i++) {
682c681
< 		for(j = 0; j < NODES; j++)
---
> 		for(j = 1; j < NODES; j++)
699c698
< 	for(i = 0; i < NODES; i++)
---
> 	for(i = 1; i < NODES; i++)
Index: tcl/ex/wireless.tcl
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/tcl/ex/wireless.tcl,v
retrieving revision 1.2
diff -r1.2 wireless.tcl
49,52c49,52
< set opt(x)		0	;# X dimension of the topography
< set opt(y)		0		;# Y dimension of the topography
< set opt(cp)		"../mobility/scene/cbr-50-20-4-512" ;# connection pattern file
< set opt(sc)		"../mobility/scene/scen-670x670-50-600-20-2" ;# scenario file
---
> set opt(x)		670	;# X dimension of the topography
> set opt(y)		670		;# Y dimension of the topography
> set opt(cp)		"../mobility/scene/cbr-50-10-4-512"
> set opt(sc)		"../mobility/scene/scen-670X670-50-600-20-0"
57c57
< set opt(stop)		10.0		;# simulation time
---
> set opt(stop)		1000.0		;# simulation time
59c59
< set opt(rp)             dsdv            ;# routing protocol script
---
> set opt(rp)             dsr            ;# routing protocol script
165c165
< 	for {set i 1} {$i <= $opt(nn)} {incr i} {
---
> 	for {set i 0} {$i < $opt(nn)} {incr i} {
245c245
< 	for {set i 1} {$i <= $opt(nn) } {incr i} {
---
> 	for {set i 0} {$i < $opt(nn) } {incr i} {
249c249
< 	for {set i 1} {$i <= $opt(nn) } {incr i} {
---
> 	for {set i 0} {$i < $opt(nn) } {incr i} {
271c271
< for {set i 1} {$i <= $opt(nn) } {incr i} {
---
> for {set i 0} {$i < $opt(nn) } {incr i} {
Index: tcl/mobility/dsr.tcl
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/tcl/mobility/dsr.tcl,v
retrieving revision 1.4
diff -r1.4 dsr.tcl
91,92c91,95
< 	$dsr_agent_ ip-addr [$self id]
< 
---
> 	# setup address (supports hier-address) for dsragent
> 	$dsr_agent_ addr $address_
> 	# set up IP address
> 	$self addr $address_
> 	
