ns-allinone-2.35/queue/red.cc
Packet*
REDQueue::pickPacketToDrop() 
{
	int victim;

	if (drop_front_)
		victim = min(1, q_->length()-1);
	else if (drop_rand_)
		victim = Random::integer(q_->length());
	else			/* default is drop_tail_ */
		victim = q_->length() - 1;

	return(q_->lookup(victim)); 
}
/*
 * Pick packet to drop. Having a separate function do this is convenient for
 * supporting derived classes that use the standard RED algorithm to compute
 * average queue size but use a different algorithm for choosing the victim.
 */
Pick packet to drop. Having a separate function do this is convenient for
supporting derived classes that use the standard RED algorithm to compute
average queue size but use a different algorithm for choosing the victim.
Pick packet to drop . Having a separate function do this is convenient for supporting derived classes that use the standard RED algorithm to compute average queue size but use a different algorithm for choosing the victim .
Packet*
REDQueue::pickPacketToDrop() 
{
	int victim;
	if (drop_front_)
		victim = min(1, q_->length()-1);
	else if (drop_rand_)
		victim = Random::integer(q_->length());
	else			
		victim = q_->length() - 1;
	return(q_->lookup(victim)); 
}
Packet * REDQueue :: pickPacketToDrop ( ) { int victim ; if ( drop_front_ ) victim = min ( 1 , q_ -> length ( ) - 1 ) ; else if ( drop_rand_ ) victim = Random :: integer ( q_ -> length ( ) ) ; else victim = q_ -> length ( ) - 1 ; return ( q_ -> lookup ( victim ) ) ; }
Pick packet to drop.
Pick packet to drop .
/* default is drop_tail_ */