File: filter.tcl

package info (click to toggle)
ns2 2.35%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,864 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 818; awk: 525; csh: 355
file content (38 lines) | stat: -rwxr-xr-x 624 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/tclsh


if { $argc != 1} {
   puts "usage: bw.tcl <tcpdump ASCII file> "
   exit
} else {
  set arg [split $argv " " ]
  set tfile [lindex $arg 0]
}

set fi [open $tfile r ]
while {[gets $fi line] >= 0} {

  set flag  [lindex $line 0]
  set startTime  [lindex $line 1]

  set size [lindex $line 5]

  set src [lindex $line 8]
  set dst [lindex $line 9]

  set s [split $src "."]
  set sip [lindex $s 0]

  set d [split $dst "."]
  set dip [lindex $d 0]

if { $flag == "+"} {
  if { $sip == 9 || $dip == 9} {
     if { $size == 1000 } {
        set size 1500
     }
     puts "$startTime $size"
  }
}
}
close $fi