[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] using filter,can any body find the error in this code?




>Date: Fri, 12 Jan 2001 15:11:47 -0800 (PST)
>From: noorbakh <[email protected]>
>To: Tarik Alj <[email protected]>
>cc: [email protected]
>Subject: Re: [ns] using filter,can any body find the error in this code?
>MIME-Version: 1.0
>
>
>Hi 
>
>My problem is in the filter part,becasue it doesn't do any filtering.

not necessarily, if you are using deprecated stuff, then the filter might be not 
properly connected to the other objects. Seems like you need to dig the code, 
sorry.

>also there is no syntax error in this code,but a logic error.
>do you know how to use filter command for filtering packets?
>
>thanks
>Eaman
>
>
>On Wed, 10 Jan 2001, Tarik Alj wrote:
>
>> first you are using deprecated stuff : Agent/CBR should be 
>> Application/Traffic/CBR and should run over an Agent/UDP.
>> 
>> second I would look into :
>> $n4 attach $filter
>> 
>> and
>> 
>> $filter set offset_ [PktHdr_offset PacketHeader/Common size_]
>> 
>> is the syntax there correct, considering your code is deprecated?
>> 
>> You might want to change your Null agents for LossMonitors so you could 
easily  
>> check wether they receive packets at all, that's "equivalent" to trace-all 
>> thought.
>> 
>> Last you could run gdb and see what happens...
>> 
>> >Date: Wed, 10 Jan 2001 10:22:32 -0800 (PST)
>> >From: noorbakh <[email protected]>
>> >To: [email protected]
>> >cc: [email protected]
>> >Subject: [ns] using filter,can any body find the error in this code?
>> >MIME-Version: 1.0
>> >
>> >
>> >hello every body,
>> >
>> >we used this peace of code in NS for filtering some packets but it
>> >doesn't work properly, can anybody say what is the problem with that?
>> >it doesn't filter any of the packets.
>> >
>> >thank you
>> >Eaman
>> >
>> >
>> >#Create a simulator object
>> >set ns [new Simulator]
>> >
>> >#Open the nam trace file
>> >set nf [open out.nam w]
>> >$ns namtrace-all $nf
>> >#Define a 'finish' procedur
>> >proc finish {} {
>> >        global ns nf f1 
>> >        $ns flush-trace
>> >	#Close the trace file
>> >        #close $nf
>> >	#close $f1
>> >	#Execute nam on the trace file
>> >	#exec nam out.nam &
>> >	$ns flush-trace
>> >        exit 
>> >}
>> >
>> >$ns trace-all [open output.tr w]
>> >
>> >set n0 [$ns node] 
>> >set n4 [$ns node] 
>> >set n5 [$ns node] 
>> >set n6 [$ns node]
>> >set n7 [$ns node]
>> >
>> >$ns duplex-link $n0 $n4 1Mb 100ms DropTail
>> >$ns duplex-link $n4 $n5 1Mb 100ms DropTail
>> >$ns duplex-link $n4 $n6 1Mb 100ms DropTail
>> >$ns duplex-link $n5 $n7 1Mb 100ms DropTail
>> >
>> >
>> >
>> >set null1 [new Agent/Null]
>> >$ns attach-agent $n6 $null1
>> >
>> >
>> >set filter [new Filter/Field]
>> >	$n4 attach $filter
>> >	$filter target $n5
>> >	$filter filter-target $null1
>> >	$filter set offset_ [PktHdr_offset PacketHeader/Common size_]
>> >	$filter set match_ 100
>> >	
>> >
>> >
>> >  set cbr0 [new Agent/CBR]
>> >  $cbr0 set packetsize_ 100
>> >  $cbr0 set interval_ 0.1
>> >  $ns attach-agent $n0 $cbr0
>> >  set null0 [new Agent/Null]
>> >  $ns attach-agent $n7 $null0
>> >  $ns connect $cbr0 $null0
>> >  $ns at 0 "$cbr0 start"
>> >  $cbr0 set fid_ 1  
>> >
>> >
>> >$ns at 10.0 "finish"
>> >$ns run
>> 
>> -Tarik 										
>> 
>> 
>> 
>> 												
>> 
>> 
>> 
>> 

-Tarik