Index: tcp/tfrc.cc
===================================================================
RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/tcp/tfrc.cc,v
retrieving revision 1.36
diff -u -r1.36 tfrc.cc
--- tcp/tfrc.cc	28 Jan 2003 19:50:52 -0000	1.36
+++ tcp/tfrc.cc	10 Nov 2003 22:24:50 -0000
@@ -88,6 +88,7 @@
 	bind("ssmult_", &ssmult_);
 	bind("bval_", &bval_);
 	bind("ca_", &ca_);
+	bind("ho_", &ho_); //AG
 	bind_bool("printStatus_", &printStatus_);
 	bind_bool("conservative_", &conservative_);
 	bind_bool("ecn_", &ecn_);
@@ -151,6 +152,10 @@
 			stop();
 			return TCL_OK;
 		}
+		if (strcmp(argv[1],"ho")==0) { //AG
+                        ho_=1;
+                        return TCL_OK;
+                } 
 	}
   	if ((argc == 3) && (SndrType_ == 1)) {
 		// or do we need an FTP type app? 
@@ -359,6 +364,7 @@
 				decrease_rate ();		
 		}
 	}
+//AG	printf("%5.2f %d\n", now, seqno_ - nck->seqno);
 	if (printStatus_) {
 		printf("time: %5.2f rate: %5.2f\n", now, rate_);
 		double packetrate = rate_ * rtt_ / size_;
@@ -420,10 +426,17 @@
 	double mult = (now-last_change_)/rtt_ ;
 	if (mult > 2) mult = 2 ;
 
-	rate_ = rate_ + (size_/rtt_)*mult ;
-	double maximumrate = (maxrate_>size_/rtt_)?maxrate_:size_/rtt_ ;
-	maximumrate = (maximumrate>rcvrate)?rcvrate:maximumrate;
-	rate_ = (rate_ > maximumrate)?maximumrate:rate_ ;
+	if (ho_) {//AG
+                rate_= rcvrate;
+                rate_ = (rate_ > maxrate_)?maxrate_:rate_ ;
+                printf("tfrc:cc ho_ %d\n", conservative_);
+        }
+        else {	
+		rate_ = rate_ + (size_/rtt_)*mult ;
+		double maximumrate = (maxrate_>size_/rtt_)?maxrate_:size_/rtt_ ;
+		maximumrate = (maximumrate>rcvrate)?rcvrate:maximumrate;
+		rate_ = (rate_ > maximumrate)?maximumrate:rate_ ;
+	}
 	
         rate_change_ = CONG_AVOID;  
         last_change_ = now;
Index: tcp/tfrc.h
===================================================================
RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/tcp/tfrc.h,v
retrieving revision 1.22
diff -u -r1.22 tfrc.h
--- tcp/tfrc.h	22 Dec 2002 20:45:33 -0000	1.22
+++ tcp/tfrc.h	10 Nov 2003 22:24:50 -0000
@@ -166,6 +166,8 @@
 
 	int ca_; //Enable Sqrt(RTT) based congestion avoidance mode
 
+	int ho_; //AG: sets transmit rate directly to computed rate
+
 	/* TCP variables for tracking RTT */
 	int t_srtt_; 
 	int t_rtt_;
Index: tcp/tfrc-sink.cc
===================================================================
RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/tcp/tfrc-sink.cc,v
retrieving revision 1.37
diff -u -r1.37 tfrc-sink.cc
--- tcp/tfrc-sink.cc	17 Dec 2002 00:37:58 -0000	1.37
+++ tcp/tfrc-sink.cc	10 Nov 2003 22:24:50 -0000
@@ -91,6 +91,8 @@
 	tsvec_ = NULL;
 	lossvec_ = NULL;
 
+	ho_time_=-1000; //AG
+
 	// used by WALI and EWMA
 	last_sample = 0;
 
@@ -369,6 +371,16 @@
 		last_report_sent = now; 
 		rcvd_since_last_report = 0;
 		losses_since_last_report = 0;
+
+		if (ho_time_ + 3*rtt_ > now) { //AG
+                        if (ho_rate_ > est_thput()) {
+                                tfrc_ackh->flost=0.001;
+                                tfrc_ackh->losses = 0;
+				// rtt_=0.1;
+				// flost=0;
+                                adjust_history(0);
+                                
+				tfrc_ackh->rate_since_last_report = ho_rate_/(2*2*8*psize_);
+                        } else {
+                                tfrc_ackh->flost = 0.5;
+                                tfrc_ackh->rate_since_last_report=ho_rate_/(2*2*2*8*psize_);
+                        }
+                        printf("in loss tweak, rate=%f\n", tfrc_ackh->rate_since_last_report);
+                }
 		send(pkt, 0);
 	}
 }
@@ -376,6 +394,12 @@
 int TfrcSinkAgent::command(int argc, const char*const* argv) 
 {
 	if (argc == 3) {
+		if (strcmp(argv[1], "ho") == 0) { //AG
+                        ho_time_ = Scheduler::instance().clock();
+                        ho_rate_ = atoi(argv[2]);
+                        printf("%f %f\n", ho_time_, ho_rate_);
+                        return (TCL_OK);
+                }
 		if (strcmp(argv[1], "weights") == 0) {
 			/* 
 			 * weights is a string of numbers, seperated by + signs
Index: tcp/tfrc-sink.h
===================================================================
RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/tcp/tfrc-sink.h,v
retrieving revision 1.20
diff -u -r1.20 tfrc-sink.h
--- tcp/tfrc-sink.h	17 Dec 2002 00:37:58 -0000	1.20
+++ tcp/tfrc-sink.h	10 Nov 2003 22:24:50 -0000
@@ -134,6 +134,8 @@
 	int lastloss_round_id ; // round_id for start of loss event
 	int round_id ;		// round_id of last new, in-order packet
 	double lastloss; 	// when last loss occured
+	double ho_time_;        // AG: when handover last occured
+	double ho_rate_;        // transmission rate after handover
 
 	// WALI specific
 	int numsamples ;
Index: tcl/lib/ns-default.tcl
===================================================================
RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/tcl/lib/ns-default.tcl,v
retrieving revision 1.326
diff -u -r1.326 ns-default.tcl
--- tcl/lib/ns-default.tcl	28 Oct 2003 22:47:10 -0000	1.326
+++ tcl/lib/ns-default.tcl	10 Nov 2003 22:24:50 -0000
@@ -983,6 +983,7 @@
 Agent/TFRC set ssmult_ 2 ; 	# Rate of increase during slow-start:
 Agent/TFRC set bval_ 1 ;	# Value of B for TCP formula
 Agent/TFRC set ca_ 1 ; 	 	# Enable Sqrt(RTT) congestion avoidance
+Agent/TFRC set ho_ 0 ;          # AG
 Agent/TFRC set printStatus_ 0 
 Agent/TFRC set maxHeavyRounds_ 1; # Number of rounds for sending rate allowed
 				  #  to be greater than twice receiving rate.

