[Sumover-dev] [svn commit] r4384 - in vic/branches/cc: rtp

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Tue Feb 10 19:22:01 GMT 2009


Author: soohyunc
Date: Tue Feb 10 19:22:01 2009
New Revision: 4384

Modified:
   vic/branches/cc/cc/tfwc_rcvr.cpp
   vic/branches/cc/cc/tfwc_rcvr.h
   vic/branches/cc/cc/tfwc_sndr.cpp
   vic/branches/cc/cc/tfwc_sndr.h
   vic/branches/cc/rtp/session.cpp

Log:
TfwcSndr and TfwcRcvr's reception methods modified. Before we change AckVec, it
was an integer type, but after changing it is now an array type. Therefore, the
XR  report's main reception path should've been changed accordingly.

This includes changing parse_xr_records() in rtp/session.cpp, and
tfwc_sndr_recv() and tfwc_rcvr_recv() in sender/receiver respectively.

To-do: AckVec re-constructing routine in TfwcSndr (more precisely, gen_seqvec()
method should be re-written.)



Modified: vic/branches/cc/cc/tfwc_rcvr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.cpp	Tue Feb 10 19:22:01 2009
@@ -59,8 +59,11 @@
 }
 
 void TfwcRcvr::tfwc_rcvr_recv(u_int16_t type, u_int16_t seqno, 
-				u_int16_t ackofack, u_int32_t ts) 
+				u_int32_t *chunk, int num_chunks) 
 {
+	// retrived ackofack
+	u_int16_t ackofack = chunk[num_chunks-1] >> 16;
+
 	// variables
 	int numLoss		= 0;	// number of packet loss count
 	int diffNumElm	= 0;	// difference of AckVec elements (curr vs. prev)
@@ -147,7 +150,7 @@
 		prevNumVec_ = currNumVec_;
 	}
 	else if (type == XR_BT_2) {
-		UNUSED(ts);	
+		ts_echo_ = chunk[num_chunks-1];
 	}
 }
 

Modified: vic/branches/cc/cc/tfwc_rcvr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.h	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.h	Tue Feb 10 19:22:01 2009
@@ -42,7 +42,7 @@
 public:
 	TfwcRcvr();
 	void tfwc_rcvr_recv(u_int16_t type, u_int16_t seqno, 
-			u_int16_t ackofack, u_int32_t ts);
+			u_int32_t *chunk, int num_chunks);
 
 protected:
 	// AckVec clone

Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Tue Feb 10 19:22:01 2009
@@ -84,6 +84,7 @@
 	g_ = 0.01;
 	k_ = 4;
 	ts_ = 0.0;
+	ts_echo_ = 0.0;
 
 	is_tfwc_on_ = false;
 	is_first_loss_seen_ = false;
@@ -119,13 +120,11 @@
  * main TFWC reception path
  */
 void TfwcSndr::tfwc_sndr_recv(u_int16_t type, u_int16_t begin, u_int16_t end,
-		u_int16_t ackv, u_int32_t ts_echo)
+		u_int32_t *chunk, int num_chunks)
 {
 	// retrieve ackvec
 	if (type == XR_BT_1) {
-		UNUSED(ts_echo);
-		nakp_++;		// number of ackvec packet received
-		//ackv_ = ackv;	// store ackvec
+		nakp_++;		// number of ack packet received
 
 		// get start/end seqno that this XR chunk reports
 		begins_ = begin;
@@ -134,8 +133,29 @@
 		// just acked seqno (head seqno of this ackvec)
 		jacked_ = ends_ - 1;
 
+		// declared AckVec
+		ackv_ = (u_int16_t *) malloc (sizeof(u_int16_t) * num_chunks);
+
+		// clone AckVec from Vic application
+		for (int i = 1; i <= num_chunks; i++) {
+			bool odd = true;
+			int j = i/2 + 1;
+
+			if (i%2 == 0) {
+				odd = false;
+				j -= 1;
+			}
+
+			// clone AckVec array from the received chunk
+			if (odd) {
+				ackv_[i] = chunk[j] >> 16;	
+			} else {
+				ackv_[i] = chunk[j] & 0x0000FFFF;
+			}
+		}
+
 		// generate seqno vec
-		gen_seqvec(begins_, ends_, jacked_, ackv);
+		//gen_seqvec(begins_, ends_, jacked_, ackv);
 		print_seqvec(begins_, ends_);
 
 		// generate margin vector
@@ -172,15 +192,14 @@
 	// retrieve ts echo
 	else if (type == XR_BT_3) {
 		ntep_++;		// number of ts echo packet received
-		/*
-		   ts_echo_ = ts_echo;
-		   debug_msg(" ts echo:	%d\n", ts_echo_);
 
-		   tao_ = 1e-6 * (double)(tfwc_sndr_now() - ts_echo_);
+		ts_echo_ = chunk[num_chunks - 1];
+		debug_msg(" ts echo:	%d\n", ts_echo_);
+
+		tao_ = 1e-6 * (double)(tfwc_sndr_now() - ts_echo_);
 
 		// update RTT
-		update_rtt(tao_);
-		*/
+		//update_rtt(tao_);
 	}
 }
 

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Tue Feb 10 19:22:01 2009
@@ -62,7 +62,7 @@
 
 	// main reception path (XR packet)
 	void tfwc_sndr_recv(u_int16_t type, u_int16_t begin, u_int16_t end,
-			u_int16_t ackv, u_int32_t ts_echo);
+			u_int32_t *chunk, int num_chunks);
 
 	// return current data packet's seqno
 	inline u_int16_t tfwc_sndr_get_seqno() { return seqno_; }
@@ -156,13 +156,14 @@
 	}
 
 	int mvec_[DUPACKS]; // margin vec (simulatinmg TCP 3 dupacks)
-	u_int16_t ackv_;	// received AckVec (from TfwcRcvr)
+	u_int16_t *ackv_;	// received AckVec (from TfwcRcvr)
 	u_int32_t pvec_;	// sent packet list
 	u_int16_t aoa_;		// ack of ack
 	u_int32_t t_now_;	// the time when the data packet sent
 	u_int32_t t_ts_;		// time stamp (u_int32_t type)
 	u_int32_t t_ts_echo_;	// echo time stamp from the receiver
 	double ts_;			// time stamp (double type)
+	double ts_echo_;	// time stamp echo (double type)
 	double now_;		// real-time now
 	double tao_;		// sampled RTT
 private:

Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp	(original)
+++ vic/branches/cc/rtp/session.cpp	Tue Feb 10 19:22:01 2009
@@ -699,6 +699,9 @@
 			ent[2] <<= 16;
 
 			//debug_msg("	SeqNo:		%d\n", tfwc_sndr_get_seqno());
+		}
+		else if (bt == XR_BT_3) {
+			/*XXX*/
 		} 
 	} 
 	// i am an RTP data receiver, so i convey ackvec information
@@ -755,6 +758,9 @@
 				}
 			}
 		}
+		else if (bt == XR_BT_3) {
+			/*XXX*/
+		} 
 	} // end of if (am_i_sender())
 
 	++xr;
@@ -1239,44 +1245,40 @@
 	UNUSED(ep);
 	UNUSED(addr);
 
-	// XR block flags
+	// XR block flags and length
 	u_int16_t flags = xr->xr_flags;
+	u_int16_t xrlen	= xr->xr_len;
+
+	// XR repport block
+	u_int32_t *rb = (u_int32_t *) malloc(xrlen);
 	
-	// parse XR information (begin, end, chunk)
-	//u_int16_t begin	= ntohs(xr->begin_seq);
-	//u_int16_t end	= ntohs(xr->end_seq);
-	//u_int16_t chunk	= ntohs(xr->chunk);
-	u_int16_t begin;
-	u_int16_t end;
-	u_int16_t chunk;
+	// parse XR information (xrssrc, begin, end)
+	u_int32_t xrssrc = rb[0]; UNUSED(xrssrc);
+	u_int16_t begin = rb[1] >> 16;
+	u_int16_t end = rb[1] & 0x0000FFFF;
+
+	// declare chunks
+	int num_chunks = 0; 
+	u_int32_t *chunk;
+
+	num_chunks = xrlen - 3;	
+	chunk = (u_int32_t *) malloc(sizeof(u_int32_t) * num_chunks);
+
+	// parse chunks information (AckVec)
+	for (int i = 0; i < num_chunks; i++)
+		chunk[i] = rb[i+2];
 
 	// i am an RTP data sender, so do the sender stuffs
 	if (am_i_sender()) {
-		// parse AckVec and ts echo from XR report block
-		if (flags == XR_BT_1) {
-			// this XR conveys AckVec from data receiver
-			tfwc_sndr_recv(flags, begin, end, chunk, 0);
-		} 
-		else if (flags == XR_BT_3) {
-			// this XR conveys ts echo
-			tfwc_sndr_recv(flags, begin, end, 0, chunk);
-		}
-
+		// parse XR chunks
+		tfwc_sndr_recv(flags, begin, end, chunk, num_chunks);
 		// we need to call Transmitter::output(pb) to make Ack driven
 		cc_output();
 	}
 	// i am an RTP data receiver, so do the receiver stuffs
 	else {
-		// parse seqno, ackofack, and timestamp from XR report block
-		if(flags == XR_BT_1) {
-			// this is XR conveys seqno and ackofack from data sender
-			tfwc_rcvr_recv(flags, begin, chunk, 0);
-		}
-		else if(flags == XR_BT_3) {
-			// this is XR conveys timestamp
-			tfwc_rcvr_recv(flags, 0, 0, chunk);
-		}
-
+		// parse XR chunks
+		tfwc_rcvr_recv(flags, begin, chunk, num_chunks);
 		// send receiver side XR report
 		ch_[0].send_ackv();
 		//ch_[0].send_ts_echo();



More information about the Sumover-dev mailing list