Index: applis/eperftool/receiver.c
===================================================================
--- applis/eperftool/receiver.c	(revision 1757)
+++ applis/eperftool/receiver.c	(working copy)
@@ -36,7 +36,6 @@
 
 #include "eperftool.h"
 
-
 of_status_t
 init_receiver (void)
 {
@@ -46,6 +45,16 @@
 	if ((avail_symb = (char**)calloc(tot_nb_encoding_symbols, sizeof(char*))) == NULL) {
 		goto no_mem;
 	}
+	
+#ifdef ELLISM
+/* modified (ellism) */
+	// allocate memory for the per-packet stats
+	if ((pkt_stats_tab = (pkt_stats_t *)calloc(tot_nb_encoding_symbols, sizeof(pkt_stats_t))) == NULL) {
+		goto no_mem;
+	}
+/* end modification */
+#endif
+	
 #if 0
 	/*
 	 * allocate the table containing the various symbols of a block. This table
@@ -72,12 +81,29 @@
 	//UINT32	k;		/* k parameter for a given block. Warning, the last block might be shorter */
 	//UINT32	n;		/* n parameter for a given block. Warning, the last block might be shorter */
 	//UINT32	esi;		/* Encoding Symbol ID */
-	//UINT32	i;
+	UINT32		i;
 	UINT32		tot_nb_recvd_symbols;	/* total number of source/repair symbols received so far */
 	UINT32		tot_nb_decoded_blocks;	/* total number of blocks that have been successfuly decoded so far */
 	UINT32		new_symb_idx;	/* index of the new symbol just received in the orig_symb[] table */
 	symbol_cb_t	*new_symb_cb;	/* pointer to the symbol just received */
 
+#ifdef ELLISM
+/* modified (ellism) */
+	UINT32			tot_nb_lost_source_symbols = 0;
+	UINT32			tot_nb_recovered_source_symbols = 0;
+	UINT32 			tot_nb_unrecovered_source_symbols = 0;
+	
+	
+	// define structures to count num received src symbols, repair symbols per block
+	// there's tot_nb_blocks blocks, so create array of this size
+	block_stats_t block_stats[tot_nb_blocks];
+	memset(block_stats, 0, sizeof(block_stats_t)*tot_nb_blocks);
+	for (i = 0; i < tot_nb_blocks; i++) {
+		block_stats[i].PRLR = -1;
+	}
+/* end modification */
+#endif
+
 	tot_nb_recvd_symbols = 0;
 	tot_nb_decoded_blocks = 0;
 #ifdef WIN32
@@ -93,15 +119,39 @@
 		/* a new symbol is available... */
 		tot_nb_recvd_symbols++;
 		blk = &blk_cb_tab[new_symb_cb->sbn];
+
+#ifdef ELLISM
+/* modified (ellism) */
+		// if we haven't seen this block yet, record start time
+		if (block_stats[blk->sbn].seen == 0) {
+			block_stats[blk->sbn].seen = 1;
+			gettimeofday(&(block_stats[blk->sbn].start_time), NULL);
+		}
+/* end modification */
+#endif
+
 		if (new_symb_cb->esi < blk->k) {
 			new_symb_idx = blk->first_src_symbol_idx + new_symb_cb->esi;
 			OF_TRACE_LVL(1, ("receive_and_decode: new source symbol available (sbn=%d, esi=%d)\n",
 				new_symb_cb->sbn, new_symb_cb->esi))
+#ifdef ELLISM
+/* modified (ellism) */
+			// count new source symbol
+			block_stats[blk->sbn].src_symbols_received++;
+/* end modification */
+#endif
 		} else {
 			new_symb_idx = blk->first_repair_symbol_idx + (new_symb_cb->esi - blk->k);
 			OF_TRACE_LVL(1, ("receive_and_decode: new repair symbol available (sbn=%d, esi=%d)\n",
 				new_symb_cb->sbn, new_symb_cb->esi))
+#ifdef ELLISM
+/* modified (ellism) */
+			// count new repair symbol
+			block_stats[blk->sbn].rep_symbols_received++;
+/* end modification */
+#endif
 		}
+
 		if (blk->is_decoded) {
 			/* block already decoded, ignore */
 			continue;
@@ -148,12 +198,35 @@
 			OF_PRINT_ERROR(("receive_and_decode: ERROR: of_decode_with_new_symbol() failed\n"))
 			goto error;
 		}
+
 		/* check if completed if we received nb_source packets or more */
 		if ((blk->nb_symbols_received >= blk->k) && (of_is_decoding_complete(blk->ses) == true)) {
 			/*
 			 * done, at least for this block...
 			 */
 			tot_nb_decoded_blocks++;
+
+#ifdef ELLISM
+/* modified (ellism) */
+//			gettimeofday(&tv1, NULL);
+			block_stats[blk->sbn].PRLR = 0;
+			block_stats[blk->sbn].effectiveness = 1;
+			block_stats[blk->sbn].decoded = 1;
+			block_stats[blk->sbn].src_symbols_lost = blk->k - block_stats[blk->sbn].src_symbols_received;
+			block_stats[blk->sbn].src_symbols_unrecovered = 0;
+			block_stats[blk->sbn].rep_symbols_needed = block_stats[blk->sbn].rep_symbols_received;
+			
+			// update pkt_stats_tab with repaired pkts
+			// delay = (src block size - posn in src block) + num repair symbols recvd
+			// i.e., works for repair packets right after source packets
+			for (i = blk->first_src_symbol_idx; i < (blk->first_src_symbol_idx + blk->k); i++) {
+				if ((pkt_stats_tab[i].type == 's') && (pkt_stats_tab[i].status == 1)) {
+					pkt_stats_tab[i].status = 2;
+					pkt_stats_tab[i].delay = (blk->k - pkt_stats_tab[i].posn_in_blk) + block_stats[blk->sbn].rep_symbols_received;
+				}
+			}
+/* end modification */
+#endif
 			OF_TRACE_LVL(1, ("receive_and_decode: block sbn=%d decoded, total of %d blocks decoded after receiving %d symbols\n",
 					blk->sbn, tot_nb_blocks, tot_nb_recvd_symbols))
 			/* get a copy of the source symbols, those received (that we already know)
@@ -177,7 +250,9 @@
 				break;
 			}
 		}
-	}
+	} /* end get_next_symbol_received() loop */
+	
+	
 	if (tot_nb_decoded_blocks < tot_nb_blocks) {
 		/*
 		 * one or several blocks have not been decoded... Let's try to finish decoding
@@ -194,7 +269,23 @@
 				continue;
 			}
 			ASSERT(blk->ses);
+
 			if (of_finish_decoding(blk->ses) != OF_STATUS_OK) {
+#ifdef ELLISM
+/* modified (ellism) */
+				// block not decoded => PRLR = (num_lost_src_symbs / total_num_src_symbs)
+				block_stats[blk->sbn].src_symbols_lost = blk->k - block_stats[blk->sbn].src_symbols_received;
+			
+				 /* might actually be fewer than this, if some of the packets were
+				  * recovered; in this case, effectiveness = #repaired / #src pkts lost
+				  */
+				block_stats[blk->sbn].src_symbols_unrecovered = block_stats[blk->sbn].src_symbols_lost;
+				block_stats[blk->sbn].effectiveness = 0.0;
+				block_stats[blk->sbn].rep_symbols_needed = block_stats[blk->sbn].rep_symbols_received;
+				
+				block_stats[blk->sbn].PRLR = block_stats[blk->sbn].src_symbols_unrecovered / (double)blk->k;
+/* end modification */
+#endif
 				OF_PRINT_ERROR(("ERROR: of_finish_decoding() failed\n"))
 				if (of_release_codec_instance(blk->ses) != OF_STATUS_OK) {
 					OF_PRINT_ERROR(("ERROR: of_release_codec_instance() failed\n"))
@@ -208,6 +299,26 @@
 				 * done, at least for this block...
 				 */
 				tot_nb_decoded_blocks++;
+#ifdef ELLISM
+/* modified (ellism) */
+				block_stats[blk->sbn].PRLR = 0; // all decoded => PRLR = 0%
+				block_stats[blk->sbn].effectiveness = 1;
+				block_stats[blk->sbn].decoded = 1;
+				block_stats[blk->sbn].src_symbols_unrecovered = 0;
+				block_stats[blk->sbn].src_symbols_lost = blk->k - block_stats[blk->sbn].src_symbols_received;
+				block_stats[blk->sbn].rep_symbols_needed = block_stats[blk->sbn].rep_symbols_received;
+
+				// update pkt_stats_tab with repaired pkts
+				// delay = (src block size - posn in src block) + num repair symbols recvd
+				// i.e., works for repair packets right after source packets				
+				for (i = blk->first_src_symbol_idx; i < (blk->first_src_symbol_idx + blk->k); i++) {
+					if ((pkt_stats_tab[i].type == 's') && (pkt_stats_tab[i].status == 1)) {
+						pkt_stats_tab[i].status = 3;
+						pkt_stats_tab[i].delay = (blk->k - pkt_stats_tab[i].posn_in_blk) + block_stats[blk->sbn].rep_symbols_received;
+					}
+				}
+/* end modification */
+#endif
 				OF_TRACE_LVL(1, ("receive_and_decode: block sbn=%d decoded after calling of_finish_decoding()\n", sbn))
 				/* get a copy of the source symbols, those received (that we already know)
 				 * and those decoded */
@@ -215,6 +326,7 @@
 					OF_PRINT_ERROR(("ERROR: of_release_codec_instance() failed\n"))
 					goto error;
 				}
+				
 				/* then release the codec */
 				if (of_release_codec_instance(blk->ses) != OF_STATUS_OK) {
 					OF_PRINT_ERROR(("ERROR: of_release_codec_instance() failed\n"))
@@ -232,6 +344,8 @@
 			}
 		}
 	}
+	
+	
 	if (tot_nb_decoded_blocks == tot_nb_blocks) {
 		/* decoding successful */
 #ifdef WIN32
@@ -284,6 +398,31 @@
 			tot_nb_recvd_symbols, (double)tot_nb_recvd_symbols / (double)tot_nb_source_symbols))
 	}
 
+#ifdef ELLISM
+/* modified (ellism) */
+	// output PRLRs / delays for each block
+	for (i = 0; i < tot_nb_blocks; i++) {
+		
+		fprintf(stdout, "OUTPUT:block %4d  decoded=%d  PRLR %7.3f %%  src=%d  rep=%d  effectiveness %7.3f %%  FECrequired %d\n", i, block_stats[i].decoded, block_stats[i].PRLR*100, block_stats[i].src_symbols_received, block_stats[i].rep_symbols_received, block_stats[i].effectiveness*100, block_stats[i].rep_symbols_needed);
+		
+		// count num unrecovered src symbols in all blocks
+		if (!block_stats[i].decoded) {
+			tot_nb_unrecovered_source_symbols += block_stats[i].src_symbols_unrecovered;
+		}
+		tot_nb_lost_source_symbols += block_stats[i].src_symbols_lost;
+	}
+	
+	tot_nb_recovered_source_symbols = tot_nb_lost_source_symbols - tot_nb_unrecovered_source_symbols;
+	fprintf(stdout, "OUTPUT:overall  PRLR %7.3f %%  effectiveness %7.3f %%  unrecovered=%d recovered=%d total=%d\n", ((double)tot_nb_unrecovered_source_symbols) / tot_nb_source_symbols * 100, ((double)tot_nb_recovered_source_symbols) / tot_nb_lost_source_symbols * 100, tot_nb_unrecovered_source_symbols, tot_nb_recovered_source_symbols, tot_nb_source_symbols);
+	
+	// output per-packet delay stats
+	for (i = 0; i < tot_nb_encoding_symbols; i++) {
+		printf("OUTPUT:packet %d  delay %d  (status=%d)\n", i, pkt_stats_tab[i].delay, pkt_stats_tab[i].status);
+	}
+	
+/* end modification */
+#endif
+
 	/*
 	 * Close and free everything.
 	 */
@@ -334,6 +473,11 @@
 	free(orig_symb);
 	free(blk_cb_tab);
 	free(symb_cb_tab);
+#ifdef ELLISM
+/* modified (ellism) */
+	free(pkt_stats_tab);
+/* end modification */
+#endif
 	return OF_STATUS_ERROR;
 }
 
Index: applis/eperftool/sender.c
===================================================================
--- applis/eperftool/sender.c	(revision 1757)
+++ applis/eperftool/sender.c	(working copy)
@@ -59,7 +59,6 @@
 	UINT32		tmp_max_k;	/* temporary value for max_k */
 	UINT32		max_n_4_any_blk;/* maximum n value for any block */
 
-
 #ifdef WIN32
 	QueryPerformanceCounter(&tv0);
 	OF_PRINT(("init_start=%lI64f\n", (double)tv0.QuadPart/(double)freq.QuadPart))
@@ -88,6 +87,7 @@
 		OF_PRINT_ERROR(("init_sender: ERROR: of_get_control_parameter() failed\n"))
 		goto error;
 	}
+
 	if (of_release_codec_instance(ses) != OF_STATUS_OK) {
 		OF_PRINT_ERROR(("init_sender: ERROR: of_release_codec_instance() failed\n"))
 		goto error;
@@ -102,6 +102,13 @@
  	tmp_max_k = (UINT32)floor((double)max_n * code_rate);
 	max_k = min(tmp_max_k, max_k);
 	max_n = min((UINT32)((double)max_k / code_rate), max_n);
+
+#ifdef ELLISM
+/* modified (ellism) */
+	max_k = min(max_k, max_block_size); // limit block size based on command-line preference
+/* end modification */
+#endif
+	
 	/* we can now compute the required blocking structure */
 	of_compute_blocking_struct(max_k, object_size, symbol_size, &bs);
 	tot_nb_blocks = bs.nb_blocks;
@@ -115,6 +122,12 @@
 	ASSERT(tot_nb_encoding_symbols <= tot_nb_source_symbols + tot_nb_repair_symbols);
 	tot_nb_repair_symbols = tot_nb_encoding_symbols - tot_nb_source_symbols;
 
+#ifdef ELLISM
+/* modified (ellism) */
+	fprintf(stdout, "Parameters: tot_nb_source_symbols = %d | tot_nb_repair_symbols = %d | overhead = %.3f | numblocks = %d | large block size = %d | small block size = %d\n", tot_nb_source_symbols, tot_nb_repair_symbols, (double)tot_nb_repair_symbols/(double)tot_nb_source_symbols, tot_nb_blocks, bs.A_large, bs.A_small);
+/* end modification */
+#endif
+
 	OF_PRINT_LVL(1, ("Blocking_struct:\n\ttot_nb_source_symbols=%d, tot_nb_repair_symbols=%d, tot_nb_encoding_symbols=%d, code_rate=%.3f\n\tI=%d, tot_nb_blocks=%d, A_large=%d, A_small=%d\n",
 		tot_nb_source_symbols, tot_nb_repair_symbols, tot_nb_encoding_symbols, code_rate,
 		bs.I, tot_nb_blocks, bs.A_large, bs.A_small))
Index: applis/eperftool/globals.c
===================================================================
--- applis/eperftool/globals.c	(revision 1757)
+++ applis/eperftool/globals.c	(working copy)
@@ -58,6 +58,13 @@
 /** The object size, when considered globally. */
 UINT32	object_size	= DFLT_TOT_NB_SOURCE * DFLT_SYMBOL_SZ;
 
+#ifdef ELLISM
+/* modified (ellism) */
+/** The max block size, needed to adjust parameters like in paper. */
+UINT32	max_block_size = 16;
+/* end modification */
+#endif
+
 /** The target code rate, equal to k/n for a given block. */
 double	code_rate	= (double)DFLT_TOT_NB_SOURCE / (double)(DFLT_TOT_NB_SOURCE + DFLT_TOT_NB_REPAIR);
 double	fec_ratio	= (double)(DFLT_TOT_NB_SOURCE + DFLT_TOT_NB_REPAIR) / (double)DFLT_TOT_NB_SOURCE;
@@ -98,6 +105,12 @@
 UINT32	loss_model 	= 0;
 UINT32	tx_simul_loss	= 0;	/* number of simulated losses */
 
+#ifdef ELLISM
+/* modified (ellism) */
+/** Filename that contains the loss trace. */
+char	*loss_trace_file_name = NULL;
+/* end modification */
+#endif
 
 double	p_loss_when_ok 	= P_LOSS_WHEN_OK;
 double	p_success_when_losses	= P_SUCCESS_WHEN_LOSSES;
@@ -126,7 +139,6 @@
 UINT32			tot_nb_blocks;
 UINT32			k_for_this_blk;
 
-
 /**
  * orig_symb: table of all symbols (source/repair), in sequential order, with
  * 	all source symbols first, followed by all repair symbols. Each entry
@@ -177,3 +189,13 @@
  */
 symbol_cb_t	*symb_cb_tab;
 
+
+#ifdef ELLISM
+/* modified (ellism) */
+/**
+ * Table containing stats on each of the source packets.
+ * Each entry describes the status of the associated source packet.
+ */
+pkt_stats_t *pkt_stats_tab;
+/* end modification */
+#endif
Index: applis/eperftool/command_line.c
===================================================================
--- applis/eperftool/command_line.c	(revision 1757)
+++ applis/eperftool/command_line.c	(working copy)
@@ -70,6 +70,11 @@
 	printf("    -symb_sz=<n>\n");
 	printf("                set the symbol size to n (default %d)\n", DFLT_SYMBOL_SZ);
 	printf("    -obj_sz=<n> set object size to n bytes\n");
+#ifdef ELLISM
+/* modified (ellism) */
+	printf("    -block_sz=<n> set max block size to n symbols\n");
+/* end modification */
+#endif
 	printf("\n");
 	printf("GENERAL PURPOSE OPTIONS:\n");
 	printf("    -h[elp]     this help\n");
@@ -110,6 +115,11 @@
 	printf("                                  of losses (rather than probability)\n");
 	printf("                  -loss=4         simulate losses by randomly choosing one packet\n");
 	printf("                                  out of all each step (overwrites transmission type)\n");
+#ifdef ELLISM
+/* modified (ellism) */	
+	printf("                  -loss=5:<file>  simulate losses by reading the specified loss trace\n");
+/* end modification */
+#endif
 	printf("    -tx_type=<n>\n");
 	printf("                set the transmission type:\n");
 	printf("                  0: randomly send all source + repair symbols (default)\n");
@@ -123,6 +133,11 @@
 	printf("                  8: simulate broadcast tx + unicast repair: send all repair randomly, subject\n");
 	printf("                     to packet losses, then send the first <rx_src_nb> source packets sequentially,\n");
 	printf("		     not, subject to any loss (3G connection)\n");
+#ifdef ELLISM
+/* modified (ellism) */	
+	printf("                  9: send each source block, followed by its repair packets\n");
+/* end modification */
+#endif
 	//printf("                  9: Send source and repair symbol in an interleaved way\n");
 	printf("    -seed=<n>   sets the global PRNG seed to n (to reproduce experiments).\n");
 	printf("                   Guaranties the same matrix is created (LDPC-*), the same transmission order is\n");
@@ -155,7 +170,13 @@
 of_status_t	parse_command_line (int argc, char *argv[])
 {
 	int	c;
+#ifdef ELLISM
+/* modified (ellism) */
+	char *OptList = "b:c:k:r:l:s:t:u:v:h:o:m:n:";
+/* end modification */
+#else
 	char *OptList = "c:k:r:l:s:t:u:v:h:o:m:n:";
+#endif
 #if defined(WIN32)
 	char *optarg = NULL;
 #endif
@@ -170,6 +191,16 @@
 #endif
 	{
 		switch (c) {
+#ifdef ELLISM
+/* modified (ellism) */
+		case 'b':
+			if (!strncmp(optarg, "lock_sz=", 1) && isdigit((int)*(optarg + 8))) {
+				max_block_size	= atoi(optarg + 8);
+			}
+			break;
+/* end modification */
+#endif
+			
 		case 'c':
 			if (!strncmp(optarg, "odec=", 5) && isdigit((int)*(optarg + 5))) {
 				codec_id = (of_codec_id_t)atoi(optarg + 5);
@@ -232,6 +263,19 @@
 				nb_loss		= atoi(optarg + 6);
 			} else if (!strncmp(optarg, "oss=4", 5)) {
 				loss_model=4;
+
+#ifdef ELLISM
+/* modified (ellism) */
+			} else if (!strncmp(optarg, "oss=5:", 6)) {
+				loss_model	= 5;
+
+				char	tmp_str[1024];
+				strncpy(tmp_str, optarg+6, sizeof(tmp_str));
+				loss_trace_file_name = (char*)malloc(sizeof(tmp_str));
+				strncpy(loss_trace_file_name, tmp_str, sizeof(tmp_str));
+/* end modification */
+#endif
+				
 			} else if (!strncmp(optarg, "dpc_N1=", 7) && isdigit((int)*(optarg + 7))) {
 				ldpc_N1 = atoi(optarg + 7);
 			} else {
@@ -239,6 +283,7 @@
 				return OF_STATUS_FATAL_ERROR;
 			}
 			break;
+
 #ifdef READ_MATRIX_FILE
 		case 'm':
 			if (!strncmp(optarg, "atrix_file=", 11) ) {
@@ -249,6 +294,7 @@
 				ldpc_matrix_file_name = (char*)malloc(sizeof(tmp_str));
 				strncpy(ldpc_matrix_file_name, tmp_str, sizeof(tmp_str));
 				updated_matrix_file = true;
+
 			} else {
 				OF_PRINT_ERROR(("bad argument -m%s\n", optarg))
 				return OF_STATUS_FATAL_ERROR;
@@ -431,11 +477,18 @@
 			OF_PRINT(("transmission_type=sequentially_send_all_repair_symbols_first_then_src_symbols\n"))
 			break;
 		case 6:
-			OF_PRINT(("transmission_type=sequentially_send_all_src_symbols_first_then_randomly_src_symbols\n"))
+/* modified (ellism) */
+			// fixing typo in output here
+			OF_PRINT(("transmission_type=sequentially_send_all_src_symbols_first_then_randomly_repair_symbols\n"))
 			break;
+/* end modification */
 		case 7:
 			OF_PRINT(("transmission_type=sequentially_send_all_repair_symbols_first_then_randomly_src_symbols\n"))
 			break;
+			
+		case 9:
+			OF_PRINT(("transmission_type=sequentially_send_all_source_packets_for_block_then_repair_packets_for_block\n"))
+			break;
 	}
 	/* Warning: the tot_nb_encoding_symbols depends on the * blocking structure, which means
 	 * it will probably change... */
Index: applis/eperftool/globals.h
===================================================================
--- applis/eperftool/globals.h	(revision 1757)
+++ applis/eperftool/globals.h	(working copy)
@@ -57,6 +57,13 @@
 /** The object size, when considered globally. */
 extern UINT32	object_size;
 
+#ifdef ELLISM
+/* modified (ellism) */
+/** The max block size, needed to adjust parameters like in paper. */
+extern UINT32	max_block_size;
+/* end modification */
+#endif
+
 /** The target code rate, equal to k/n for a given block. */
 extern double	code_rate;
 extern double	fec_ratio;
@@ -109,6 +116,12 @@
 /** number of simulated losses */
 extern UINT32	tx_simul_loss;
 
+#ifdef ELLISM
+/* modified (ellism) */
+/** Filename that contains the loss trace. */
+extern char	*loss_trace_file_name;
+/* end modification */
+#endif
 
 extern double	p_loss_when_ok;
 extern double	p_success_when_losses;
@@ -138,7 +151,6 @@
 extern UINT32			max_n;
 extern UINT32			tot_nb_blocks;
 
-
 /* valgrind profiling requires including vg_profile.c */
 //#include "vg_profile.c"
 
@@ -192,6 +204,15 @@
  */
 extern symbol_cb_t	*symb_cb_tab;
 
+#ifdef ELLISM
+/* modified (ellism) */
+/**
+ * Table containing stats on each of the source packets.
+ * Each entry describes the status of the associated source packet.
+ */
+extern pkt_stats_t *pkt_stats_tab;
+/* end modification */
+#endif
 
 #endif	/* } GLOBALS_H */
 
Index: applis/eperftool/tx_simulator.c
===================================================================
--- applis/eperftool/tx_simulator.c	(revision 1757)
+++ applis/eperftool/tx_simulator.c	(working copy)
@@ -48,6 +48,12 @@
 
 static bool*	create_loss_array_from_markov_model	(UINT32 size);
 
+#ifdef ELLISM
+/* modified (ellism) */
+static bool*	create_loss_array_from_loss_trace (UINT32 size, char *loss_trace);
+/* end modification */
+#endif
+
 /** This table gives the order in which transmissions take place. */
 static UINT32*	tx_order_tab = NULL;
 
@@ -116,6 +122,13 @@
 	case 4:
 		is_lost_tab = create_loss_array_from_erasure_nb(max_decoding_steps, 0);
 		break;
+#ifdef ELLISM
+/* modified (ellism) */
+	case 5:
+		is_lost_tab = create_loss_array_from_loss_trace(max_decoding_steps, loss_trace_file_name);
+		break;
+/* end modification */
+#endif
 	default:
 		OF_PRINT_ERROR(("loss model (%d) is not supported\n", loss_model))
 		goto error;
@@ -165,9 +178,41 @@
 	static UINT32		next_idx = 0;
 	symbol_cb_t		*symb;
 
+#ifdef ELLISM
+/* modified (ellism) */
+	block_cb_t		*blk;		/* temporary pointer within the blk_cb_tab[] */
+	static UINT32  	 pkt_stats_src_idx = 0;
+	static UINT32  	 pkt_stats_rep_idx = 0;
+/* end modification */
+#endif
+
 	while (next_idx < max_decoding_steps) {
 		if (is_lost_tab[next_idx] == true) {
 			/* this symbol is lost, switch to the next one */
+
+#ifdef ELLISM
+/* modified (ellism) */
+			// want to count record packet status, if it's a source packet
+			symb = &(symb_cb_tab[tx_order_tab[next_idx]]);
+			blk = &blk_cb_tab[symb->sbn];
+			
+			if (symb->esi < blk->k) { // if a source pkt
+				pkt_stats_tab[pkt_stats_src_idx].type = 's';
+				pkt_stats_tab[pkt_stats_src_idx].blk = symb->sbn;
+				pkt_stats_tab[pkt_stats_src_idx].posn_in_blk = symb->esi;
+				pkt_stats_tab[pkt_stats_src_idx].status = 1;
+				pkt_stats_src_idx++;
+				
+			} else { // if a repair pkt
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].type = 'r';
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].blk = symb->sbn;
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].posn_in_blk = symb->esi;
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].status = 1;
+				pkt_stats_rep_idx++;
+			}
+/* end modification */
+#endif
+
 			next_idx++;
 			continue;
 		} else {
@@ -180,6 +225,26 @@
 			{
 				symb = &(symb_cb_tab[tx_order_tab[next_idx]]);
 			}
+#ifdef ELLISM
+/* modified (ellism) */
+			// want to count record packet status, if it's a source packet
+			symb = &(symb_cb_tab[tx_order_tab[next_idx]]);
+			blk = &blk_cb_tab[symb->sbn];
+
+			if (symb->esi < blk->k) { // if a source pkt
+				pkt_stats_tab[pkt_stats_src_idx].type = 's';
+				pkt_stats_tab[pkt_stats_src_idx].blk = symb->sbn;
+				pkt_stats_tab[pkt_stats_src_idx].posn_in_blk = symb->esi;
+				pkt_stats_src_idx++;
+				
+			} else { // if a repair pkt
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].type = 'r';
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].blk = symb->sbn;
+				pkt_stats_tab[tot_nb_source_symbols+pkt_stats_rep_idx].posn_in_blk = symb->esi;
+				pkt_stats_rep_idx++;
+			}
+/* end modification */
+#endif
 			OF_TRACE_LVL(1, ("%s: next_idx: %u, tx_order_tab: %u, symb esi: %u, sbn: %u\n",
 				__FUNCTION__, next_idx, tx_order_tab[next_idx], symb->esi, symb->sbn))
 			next_idx++;
@@ -387,8 +452,62 @@
 		}
 		free(src_idx);
 		break;
+	}
+
+#ifdef ELLISM
+/* modified (ellism) */
+	// introducing the TX_MODE_SRC_BLOCK_THEN_REPAIR transmission mode
+	case TX_MODE_SRC_BLOCK_THEN_REPAIR: {
+		UINT32  block;
+		UINT32  src_symb_in_block;
+		UINT32  rep_symb_in_block;
+		UINT32  k_for_this_blk;
+		UINT32  r_for_this_blk;
+		UINT32  tx_order_idx;
+		UINT32  src_pkt_idx;
+		UINT32  rep_pkt_idx;
+		
+		/* ensure correct num steps for get_next_symbol_received() */
+		max_steps = tot_nb_encoding_symbols;
+		
+		OF_TRACE_LVL(1, ("Send source block, followed by repair symbols for that block\n"))
+		tx_order_idx = 0;
+		src_pkt_idx = 0;                     /* starts at zero */
+		rep_pkt_idx = tot_nb_source_symbols; /* starts at end of src pkts */
+		
+		/* loop over each repair block */
+		for (block = 0; block < bs.nb_blocks; block++) {
+		
+			/* get number of source and repair symbols for the block */
+			if (block < (UINT32)bs.I) {
+				k_for_this_blk = bs.A_large;
+				r_for_this_blk = ceil((double)tot_nb_repair_symbols / (double)bs.nb_blocks);
+			} else {
+				k_for_this_blk = bs.A_small;
+				r_for_this_blk = floor((double)tot_nb_repair_symbols / (double)bs.nb_blocks);
+			}
+			
+			/* assign source symbols, then repair symbols into transmission order */
+			/* source packets are first in symb_cb_tab */
+			for (src_symb_in_block = 1; src_symb_in_block <= k_for_this_blk; src_symb_in_block++) {
+				array[tx_order_idx] = src_pkt_idx;
+				tx_order_idx++;
+				src_pkt_idx++;
+			}
+			/* repair packets come after all source symbols in symb_cb_tab */
+			for (rep_symb_in_block = 1; rep_symb_in_block <= r_for_this_blk; rep_symb_in_block++) {
+				array[tx_order_idx] = rep_pkt_idx;
+				tx_order_idx++;
+				rep_pkt_idx++;
+			}
 		}
+	break;
+	}
+/* end modification */
+#endif
 
+
+// uncomment to re-introduce the TX_MODE_PKT_INTERLEAVING transmission mode
 #if 0
 	case TX_MODE_PKT_INTERLEAVING:
 		OF_TRACE_LVL(1, ("Send source and repair symbol in an interleaved way...\n"))
@@ -419,6 +538,7 @@
 		}
 		break;
 #endif
+ 
 	default:
 		OF_PRINT_ERROR(("ERROR: transmission mode %d not supported!\n", tx_mode))
 		goto error;
@@ -542,7 +662,51 @@
 	return array;
 }
 
+#ifdef ELLISM
+/* modified (ellism) */
+/**
+ * Read loss_trace, and use to fill array of loss values of the given size 
+ * and allocated by this function.
+ */
+bool*
+create_loss_array_from_loss_trace (UINT32	size,
+				   char	*loss_trace)
+{
+	bool*	is_lost_array;		/* array that will designate the erasures */
+	UINT32	actual_loss_nb;
+	UINT32	i;
+	UINT32	j;
+	FILE*	loss_trace_file;
 
+	/* need to ensure that size is not larger than length of loss trace;
+	 * ideally, size and length will be the same?
+	 */
+	is_lost_array = (bool*) calloc(size, sizeof(bool));
+
+	loss_trace_file = fopen(loss_trace, "r");
+	if (loss_trace_file == NULL) {
+		OF_PRINT_ERROR(("create_loss_array_from_loss_trace: ERROR could not read file ``%s''\n",
+				loss_trace))
+	}
+				
+	/* read loss trace into array */				
+	for (i = 0; i < size; i++) {
+		int val = -1;
+		fscanf(loss_trace_file, "%d\n", &val);
+		if (val == 1) {
+			is_lost_array[i] = true;
+		} else if (val == EOF) {
+			OF_PRINT_ERROR(("create_loss_array_from_loss_trace: WARNING end-of-file reached\n"))
+		}
+	}
+	
+	fclose(loss_trace_file);
+	return is_lost_array;
+}
+/* end modification */
+#endif
+
+
 #if 0
 int
 loss_oracle (double	p)
Index: applis/eperftool/eperftool.h
===================================================================
--- applis/eperftool/eperftool.h	(revision 1757)
+++ applis/eperftool/eperftool.h	(working copy)
@@ -82,11 +82,11 @@
 	TX_MODE_INVERSE_SEQUENTIAL,
 	TX_MODE_SEQUENTIAL_SRC_THEN_RANDOM_REPAIR,
 	TX_MODE_SEQUENTIAL_REPAIR_THEN_RANDOM_SRC,
-	TX_MODE_SIMUL_BCAST_WITH_UNICAST_REPAIR
+	TX_MODE_SIMUL_BCAST_WITH_UNICAST_REPAIR,
+	TX_MODE_SRC_BLOCK_THEN_REPAIR
 	//TX_MODE_PKT_INTERLEAVING
 } tx_mode_t;
 
-
 /**
  * Control block describing a block within the object.
  */
@@ -126,6 +126,37 @@
 } symbol_cb_t;
 
 
+/* modified (ellism) */
+#ifndef ELLISM
+#define ELLISM
+
+typedef struct block_stats {
+	char			seen;
+	char			decoded;
+	struct timeval	start_time;
+	struct timeval	end_time;	
+	struct timeval	time_diff;
+	UINT32 			src_symbols_received;
+	UINT32 			rep_symbols_received;
+	UINT32			src_symbols_lost;
+	UINT32			src_symbols_unrecovered;
+	UINT32 			rep_symbols_needed;
+	double 			PRLR;
+	double 			effectiveness;
+} block_stats_t;
+
+typedef struct packet_stats {
+	char 			type;
+	char 			status;
+	UINT32 			delay;
+	UINT32 			blk;
+	UINT32			posn_in_blk;
+} pkt_stats_t;
+
+#endif
+/* end modification */
+
+
 #include "globals.h"
 #include "codec_instance_mgmt.h"
