ns-allinone-2.35/queue/red.cc
REDQueue::REDQueue(const char * trace) : link_(NULL), de_drop_(NULL), EDTrace(NULL), tchan_(0), idle_(1), idletime_(0.0)
{
	initParams();
	
	//	printf("Making trace type %s\n", trace);
	if (strlen(trace) >=20) {
		printf("trace type too long - allocate more space to traceType in red.h and recompile\n");
		exit(0);
	}
	strcpy(traceType, trace);
	bind_bool("bytes_", &edp_.bytes);	    // boolean: use bytes?
	bind_bool("queue_in_bytes_", &qib_);	    // boolean: q in bytes?
	//	_RENAMED("queue-in-bytes_", "queue_in_bytes_");

	bind("thresh_", &edp_.th_min_pkts);		    // minthresh
	bind("thresh_queue_", &edp_.th_min);
	bind("maxthresh_", &edp_.th_max_pkts);	    // maxthresh
	bind("maxthresh_queue_", &edp_.th_max);
	bind("mean_pktsize_", &edp_.mean_pktsize);  // avg pkt size
	bind("idle_pktsize_", &edp_.idle_pktsize);  // avg pkt size for idles
	bind("q_weight_", &edp_.q_w);		    // for EWMA
	bind("adaptive_", &edp_.adaptive);          // 1 for adaptive red
	bind("cautious_", &edp_.cautious);          // 1 for cautious marking
	bind("alpha_", &edp_.alpha); 	  	    // adaptive red param
	bind("beta_", &edp_.beta);                  // adaptive red param
	bind("interval_", &edp_.interval);	    // adaptive red param
	bind("feng_adaptive_",&edp_.feng_adaptive); // adaptive red variant
	bind("targetdelay_", &edp_.targetdelay);    // target delay
	bind("top_", &edp_.top);		    // maximum for max_p	
	bind("bottom_", &edp_.bottom);		    // minimum for max_p	
	bind_bool("wait_", &edp_.wait);
	bind("linterm_", &edp_.max_p_inv);
	bind("mark_p_", &edp_.mark_p);
	bind_bool("use_mark_p_", &edp_.use_mark_p);
	bind_bool("setbit_", &edp_.setbit);	    // mark instead of drop
	bind_bool("gentle_", &edp_.gentle);         // increase the packet
						    // drop prob. slowly
						    // when ave queue
						    // exceeds maxthresh

	bind_bool("summarystats_", &summarystats_);
	bind_bool("drop_tail_", &drop_tail_);	    // drop last pkt
	//	_RENAMED("drop-tail_", "drop_tail_");

	bind_bool("drop_front_", &drop_front_);	    // drop first pkt
	//	_RENAMED("drop-front_", "drop_front_");
	
	bind_bool("drop_rand_", &drop_rand_);	    // drop pkt at random
	//	_RENAMED("drop-rand_", "drop_rand_");

	bind_bool("ns1_compat_", &ns1_compat_);	    // ns-1 compatibility
	//	_RENAMED("ns1-compat_", "ns1_compat_");

	bind("ave_", &edv_.v_ave);		    // average queue sie
	bind("prob1_", &edv_.v_prob1);		    // dropping probability
	bind("curq_", &curq_);			    // current queue size
	bind("cur_max_p_", &edv_.cur_max_p);        // current max_p
	

	q_ = new PacketQueue();			    // underlying queue
	pq_ = q_;
	//reset();
#ifdef notdef
	print_edp();
	print_edv();
#endif
	
}
/*
 * modified to enable instantiation with special Trace objects - ratul
 */
modified to enable instantiation with special Trace objects - ratul
modified to enable instantiation with special Trace objects - ratul
REDQueue::REDQueue(const char * trace) : link_(NULL), de_drop_(NULL), EDTrace(NULL), tchan_(0), idle_(1), idletime_(0.0)
{
	initParams();
	if (strlen(trace) >=20) {
		printf("trace type too long - allocate more space to traceType in red.h and recompile\n");
		exit(0);
	}
	strcpy(traceType, trace);
	bind_bool("bytes_", &edp_.bytes);	    
	bind_bool("queue_in_bytes_", &qib_);	    
	bind("thresh_", &edp_.th_min_pkts);		    
	bind("thresh_queue_", &edp_.th_min);
	bind("maxthresh_", &edp_.th_max_pkts);	    
	bind("maxthresh_queue_", &edp_.th_max);
	bind("mean_pktsize_", &edp_.mean_pktsize);  
	bind("idle_pktsize_", &edp_.idle_pktsize);   for idles
	bind("q_weight_", &edp_.q_w);		    
	bind("adaptive_", &edp_.adaptive);          
	bind("cautious_", &edp_.cautious);          
	bind("alpha_", &edp_.alpha); 	  	    
	bind("beta_", &edp_.beta);                  
	bind("interval_", &edp_.interval);	    
	bind("feng_adaptive_",&edp_.feng_adaptive); 
	bind("targetdelay_", &edp_.targetdelay);    
	bind("top_", &edp_.top);		    
	bind("bottom_", &edp_.bottom);		    
	bind_bool("wait_", &edp_.wait);
	bind("linterm_", &edp_.max_p_inv);
	bind("mark_p_", &edp_.mark_p);
	bind_bool("use_mark_p_", &edp_.use_mark_p);
	bind_bool("setbit_", &edp_.setbit);	    
	bind_bool("gentle_", &edp_.gentle);         
	bind_bool("summarystats_", &summarystats_);
	bind_bool("drop_tail_", &drop_tail_);	    
	bind_bool("drop_front_", &drop_front_);	    
	bind_bool("drop_rand_", &drop_rand_);	    
	bind_bool("ns1_compat_", &ns1_compat_);	    
	bind("ave_", &edv_.v_ave);		    
	bind("prob1_", &edv_.v_prob1);		    
	bind("curq_", &curq_);			    
	bind("cur_max_p_", &edv_.cur_max_p);        
	q_ = new PacketQueue();			    
	pq_ = q_;
#ifdef notdef
	print_edp();
	print_edv();
#endif
}
REDQueue :: REDQueue ( const char * trace ) : link_ ( NULL ) , de_drop_ ( NULL ) , EDTrace ( NULL ) , tchan_ ( 0 ) , idle_ ( 1 ) , idletime_ ( 0.0 ) { initParams ( ) ; if ( strlen ( trace ) >= 20 ) { printf ( " \n " ) ; exit ( 0 ) ; } strcpy ( traceType , trace ) ; bind_bool ( " " , & edp_ . bytes ) ; bind_bool ( " " , & qib_ ) ; bind ( " " , & edp_ . th_min_pkts ) ; bind ( " " , & edp_ . th_min ) ; bind ( " " , & edp_ . th_max_pkts ) ; bind ( " " , & edp_ . th_max ) ; bind ( " " , & edp_ . mean_pktsize ) ; bind ( " " , & edp_ . idle_pktsize ) ; bind ( " " , & edp_ . q_w ) ; bind ( " " , & edp_ . adaptive ) ; bind ( " " , & edp_ . cautious ) ; bind ( " " , & edp_ . alpha ) ; bind ( " " , & edp_ . beta ) ; bind ( " " , & edp_ . interval ) ; bind ( " " , & edp_ . feng_adaptive ) ; bind ( " " , & edp_ . targetdelay ) ; bind ( " " , & edp_ . top ) ; bind ( " " , & edp_ . bottom ) ; bind_bool ( " " , & edp_ . wait ) ; bind ( " " , & edp_ . max_p_inv ) ; bind ( " " , & edp_ . mark_p ) ; bind_bool ( " " , & edp_ . use_mark_p ) ; bind_bool ( " " , & edp_ . setbit ) ; bind_bool ( " " , & edp_ . gentle ) ; bind_bool ( " " , & summarystats_ ) ; bind_bool ( " " , & drop_tail_ ) ; bind_bool ( " " , & drop_front_ ) ; bind_bool ( " " , & drop_rand_ ) ; bind_bool ( " " , & ns1_compat_ ) ; bind ( " " , & edv_ . v_ave ) ; bind ( " " , & edv_ . v_prob1 ) ; bind ( " " , & curq_ ) ; bind ( " " , & edv_ . cur_max_p ) ; q_ = new PacketQueue ( ) ; pq_ = q_ ; #ifdef notdef print_edp ( ) ; print_edv ( ) ; #endif }
modified to enable instantiation with special Trace objects - ratul
modified to enable instantiation with special Trace objects - ratul
//	printf("Making trace type %s\n", trace); // boolean: use bytes? // boolean: q in bytes? //	_RENAMED("queue-in-bytes_", "queue_in_bytes_"); // minthresh // maxthresh // avg pkt size // avg pkt size for idles // for EWMA // 1 for adaptive red // 1 for cautious marking // adaptive red param // adaptive red param // adaptive red param // adaptive red variant // target delay // maximum for max_p	 // minimum for max_p	 // mark instead of drop // increase the packet // drop prob. slowly // when ave queue // exceeds maxthresh // drop last pkt //	_RENAMED("drop-tail_", "drop_tail_"); // drop first pkt //	_RENAMED("drop-front_", "drop_front_"); // drop pkt at random //	_RENAMED("drop-rand_", "drop_rand_"); // ns-1 compatibility //	_RENAMED("ns1-compat_", "ns1_compat_"); // average queue sie // dropping probability // current queue size // current max_p // underlying queue //reset();