proc spoofcontrol { a } { global n ns global ftp1s global packets_to_send global r amount_sent global spoofing set event_type [lindex $a 0] set simtimenow [lindex $a 1] set type [lindex $a 4] set flowid [lindex $a 7] set packetnum [lindex $a 10] if { !($r($packetnum)) } { if { (($event_type == "r")&&($type=="tcp")&&($flowid=="0")) } { set r($packetnum) 1 for {set i 0} {$i <= $n} {incr i 1} { if { !($r($i)) } break } set packets_to_send [expr $i-$amount_sent] $ns at [expr $simtimenow+(0.001)] "$ftp1s producemore $packets_to_send" incr amount_sent $packets_to_send } } }