--- ../ns-2.1b8-ref/tfrc.cc	Fri Mar  2 06:15:28 2001
+++ tfrc.cc	Thu Jun 20 16:36:53 2002
@@ -41,6 +41,9 @@
 #include "formula.h"
 #include "flags.h"
 
+//AG
+#include "lib-atp.h"
+
 int hdr_tfrc::offset_;
 int hdr_tfrc_ack::offset_;
 
@@ -433,6 +436,10 @@
 		tfrch->UrgentFlag=UrgentFlag;
 		tfrch->round_id=round_id;
 		ndatapack_++;
+
+		//AG
+		atp_set_ttl(p, Scheduler::instance().clock() + t_rtxcur_); 
+
 		send(p, 0);
 	}
 }
--- ../ns-2.1b8-ref/tfrc-sink.cc	Mon Apr 23 04:53:19 2001
+++ tfrc-sink.cc	Thu Jun 20 16:40:42 2002
@@ -41,6 +41,9 @@
 #include "formula-with-inverse.h"
 #include "flags.h"
 
+//AG
+#include "lib-atp.h"
+
 static class TfrcSinkClass : public TclClass {
 public:
   	TfrcSinkClass() : TclClass("Agent/TFRCSink") {}
@@ -341,6 +344,8 @@
 		last_report_sent = now; 
 		rcvd_since_last_report = 0;
 		losses_since_last_report = 0;
+		//AG FIXME first rtt is zero until measured
+		atp_set_ttl(pkt, Scheduler::instance().clock() + rtt_ + 3); 
 		send(pkt, 0);
 	}
 }
--- ../ns-2.1b8-ref/udp.cc	Fri Sep  1 06:04:08 2000
+++ udp.cc	Thu Jun 20 16:29:29 2002
@@ -25,6 +25,9 @@
 #include "rtp.h"
 #include "random.h"
 
+//AG
+#include "lib-atp.h"
+
 static class UdpAgentClass : public TclClass {
 public:
 	UdpAgentClass() : TclClass("Agent/UDP") {}
@@ -70,6 +73,7 @@
 		// add "beginning of talkspurt" labels (tcl/ex/test-rcvr.tcl)
 		if (flags && (0 ==strcmp(flags, "NEW_BURST")))
 			rh->flags() |= RTP_M;
+//		atp_set_ttl(p, (u_int32_t)local_time+LIFETIME);
 		target_->recv(p);
 	}
 	n = nbytes % size_;
@@ -84,8 +88,21 @@
 		// add "beginning of talkspurt" labels (tcl/ex/test-rcvr.tcl)
 		if (flags && (0 == strcmp(flags, "NEW_BURST")))
 			rh->flags() |= RTP_M;
+//		atp_set_ttl(p, (u_int32_t)local_time+LIFETIME);
 		target_->recv(p);
 	}
 	idle();
 }
 
+//AG
+void UdpAgent::recv(Packet *p, Handler *h)
+{
+// printf("UDP received!\n");
+ atp_log_ttl(p);
+ Packet::free(p);
+}
+
+UdpAgent::~UdpAgent()
+{
+ atp_log_ttl(NULL);
+}
--- ../ns-2.1b8-ref/udp.h	Fri Sep  1 06:04:08 2000
+++ udp.h	Tue Oct 16 18:16:27 2001
@@ -32,8 +32,10 @@
 class UdpAgent : public Agent {
 public:
 	UdpAgent();
+	~UdpAgent();
 	UdpAgent(packet_t);
 	virtual void sendmsg(int nbytes, const char *flags = 0);
+	void recv(Packet *, Handler*); //AG
 protected:
 	int seqno_;
 };
--- ../ns-2.1b8-ref/trace.cc	Mon May 21 22:27:32 2001
+++ trace.cc	Wed Oct 17 16:58:37 2001
@@ -170,6 +170,7 @@
 	hdr_rtp *rh = hdr_rtp::access(p);
         hdr_rap *raph = hdr_rap::access(p);
 	hdr_tfrc *tfrch = hdr_tfrc::access(p);
+	hdr_tfrc_ack *tfrch_ack = hdr_tfrc_ack::access(p); 
 	packet_t t = th->ptype();
 	int seqno;
 
@@ -184,6 +185,8 @@
 		seqno = tcph->seqno();
 	else if (t == PT_TFRC)
 		seqno = tfrch->seqno;
+	else if (t == PT_TFRC_ACK)
+                seqno = tfrch_ack->seqno;
 	else
 		seqno = -1;
  	return seqno;

