4 wm title .stimulus "Setting Stimulus Prameters"
15 You can select to generate packet with sequential packet length or
16 random packet length. If you choise random packet length, the length of
17 generated packet will be a random value between the "Packet begin length"
18 to the "Packet end length". "Total Gen Packet number"is used to set the
19 number of packet will be generated as stimulus
20 As well, you can select "sequence" mode . The first Packet will be
21 generated with "Packet begin length",and the next Packet length will be
22 "Packet begin length" pluse one untile the packet length reach the value
23 of "Packet end length". Packet in each length will be generated according
24 to the value of "Packet number per length" }
27 if {[catch {open ../data/config.ini r} fileid]} {
36 scan $content "%d,%d,%d,%d,%d" StartLength EndLength PacketNumber Random Broadcast
41 label .stimulus.f1.lb -text "Packet begin length:"
42 entry .stimulus.f1.en -textvariable StartLength
43 pack .stimulus.f1 -fill x
44 pack .stimulus.f1.en .stimulus.f1.lb -side right
47 label .stimulus.f2.lb -text "Packet end length:"
48 entry .stimulus.f2.en -textvariable EndLength
49 pack .stimulus.f2 -fill x
50 pack .stimulus.f2.en .stimulus.f2.lb -side right
54 label .stimulus.f3.lb -text "Packet number per length:"
55 entry .stimulus.f3.en -textvariable PacketNumber
56 pack .stimulus.f3 -fill x
57 pack .stimulus.f3.en .stimulus.f3.lb -side right
60 radiobutton .stimulus.f4.1 -text "Sequence" -variable Random -value 0 \
61 -command {.stimulus.f3.lb config -text "Packet number per length:"}
62 radiobutton .stimulus.f4.2 -text "Random" -variable Random -value 1 \
63 -command {.stimulus.f3.lb config -text "Total Gen Packet number:"}
64 pack .stimulus.f4 -fill x
65 pack .stimulus.f4.1 .stimulus.f4.2 -side right
68 checkbutton .stimulus.f5.1 -text "Broadcast" -variable Broadcast
69 pack .stimulus.f5 -fill x
70 pack .stimulus.f5.1 -side right
73 button .stimulus.f20.1 -text "Save" -width 10 \
74 -command { set fileid [open ../data/config.ini w 0600]
75 puts $fileid "$StartLength,$EndLength,$PacketNumber,$Random,$Broadcast"
79 button .stimulus.f20.2 -text "Save as" -command {sti_save_as $StartLength $EndLength $PacketNumber $Random $Broadcast} -width 10
80 button .stimulus.f20.3 -text "Cancel" -command {destroy .stimulus} -width 10
81 button .stimulus.f20.4 -text "Help" -width 10 -command {print_help $help_string}
82 pack .stimulus.f20 -fill x
83 pack .stimulus.f20.1 .stimulus.f20.2 .stimulus.f20.3 .stimulus.f20.4 -side left
86 proc sti_save_as {StartLength EndLength PacketNumber Random Broadcast} {
90 tkwait window .fileSelectWindow
91 if {$fileselect(canceled)==1} {
93 } elseif {$fileselect(selectedfile)==""} {
94 warning_message "file have not been selected!"
96 set fileid [open $fileselect(selectedfile) w 0600]
97 puts $fileid "$StartLength,$EndLength,$PacketNumber,$Random,$Broadcast"