#****f* annotations.tcl/roundRect
# NAME
# roundRect -- Draw a rounded rectangle in the canvas.
-# Called from drawRect procedure
+# Called from drawRect procedure
# SYNOPSIS
# roundRect $w $x0 $y0 $x3 $y3 $radius $args
# FUNCTION
frame $wi.lab -borderwidth 4
label $wi.lab.name_label -text "Text for top of rectangle:"
entry $wi.lab.name -bg white -width 16 \
- -validate focus -invcmd "focusAndFlash %W"
+ -validate focus -invcmd "focusAndFlash %W"
$wi.lab.name insert 0 $label
pack $wi.lab.name $wi.lab.name_label -side right -padx 4 -pady 4
pack $wi.lab -side top
set font [list "$fontfamily" $fontsize]
set effects [lindex [lsearch -inline [set $text] "effects *"] 1]
set newtext [.c create text $x $y -text $label -anchor w \
- -font "$font $effects" -justify left -fill $color \
- -tags "text $text"]
+ -font "$font $effects" -justify left -fill $color \
+ -tags "text $text"]
.c addtag text withtag $newtext
.c raise $text background
set color $defTextColor
}
button $wi.prop.format.fg -text "Color" -command \
- "popupColor fg $wi.text false"
+ "popupColor fg $wi.text false"
checkbutton $wi.prop.format.bold -text "Bold" -variable textBold \
-command [list fontupdate $wi.text bold]
checkbutton $wi.prop.format.italic -text "Italic" -variable textItalic \
-command [list fontupdate $wi.text underline]
if {$textBold == 1} { $wi.prop.format.bold select
- } else { $wi.prop.format.bold deselect }
+ } else { $wi.prop.format.bold deselect }
if {$textItalic == 1} { $wi.prop.format.italic select
- } else { $wi.prop.format.italic deselect }
+ } else { $wi.prop.format.italic deselect }
if {$textUnderline == 1} { $wi.prop.format.underline select
- } else { $wi.prop.format.underline deselect }
+ } else { $wi.prop.format.underline deselect }
pack $wi.prop.format.label \
$wi.prop.format.fg \
-# $Id: cfgparse.tcl,v 1.31 2007/07/19 01:17:05 marko Exp $
+# $Id: cfgparse.tcl,v 1.32 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2005 University of Zagreb, Croatia. All rights reserved.
#
global node_list link_list canvas_list
global showIfNames showNodeLabels showLinkLabels
global showIfIPaddrs showIfIPv6addrs
- global showIPsecConfig
+ global showIPsecConfig
foreach node $node_list {
global $node
dumpputs $method $dest "node $node \{"
foreach element $lnode {
if { "[lindex $element 0]" == "network-config" } {
- dumpputs $method $dest " network-config \{"
- foreach line [lindex $element 1] {
- dumpputs $method $dest " $line"
- }
- dumpputs $method $dest " \}"
+ dumpputs $method $dest " network-config \{"
+ foreach line [lindex $element 1] {
+ dumpputs $method $dest " $line"
+ }
+ dumpputs $method $dest " \}"
} elseif { "[lindex $element 0]" == "custom-config" } {
- dumpputs $method $dest " custom-config \{"
- foreach line [lindex $element 1] {
- if { $line != {} } {
- set str [lindex $line 0]
- if { $str == "custom-config" } {
- dumpputs $method $dest " config \{"
- foreach element [lindex $line 1] {
- dumpputs $method $dest " $element"
- }
- dumpputs $method $dest " \}"
- } else {
- dumpputs $method $dest " $line"
- }
- }
+ dumpputs $method $dest " custom-config \{"
+ foreach line [lindex $element 1] {
+ if { $line != {} } {
+ set str [lindex $line 0]
+ if { $str == "custom-config" } {
+ dumpputs $method $dest " config \{"
+ foreach element [lindex $line 1] {
+ dumpputs $method $dest " $element"
+ }
+ dumpputs $method $dest " \}"
+ } else {
+ dumpputs $method $dest " $line"
}
- dumpputs $method $dest " \}"
- } elseif { "[lindex $element 0]" == "ipsec-config" } {
- dumpputs $method $dest " ipsec-config \{"
- foreach line [lindex $element 1] {
- if { $line != {} } {
- dumpputs $method $dest " $line"
- }
}
- dumpputs $method $dest " \}"
- } else {
- dumpputs $method $dest " $element"
+ }
+ dumpputs $method $dest " \}"
+ } elseif { "[lindex $element 0]" == "ipsec-config" } {
+ dumpputs $method $dest " ipsec-config \{"
+ foreach line [lindex $element 1] {
+ if { $line != {} } {
+ dumpputs $method $dest " $line"
+ }
+ }
+ dumpputs $method $dest " \}"
+ } else {
+ dumpputs $method $dest " $element"
}
}
dumpputs $method $dest "\}"
upvar 0 $link llink
dumpputs $method $dest "link $link \{"
foreach element $llink {
- dumpputs $method $dest " $element"
+ dumpputs $method $dest " $element"
}
dumpputs $method $dest "\}"
dumpputs $method $dest ""
upvar 0 $canvas lcanvas
dumpputs $method $dest "canvas $canvas \{"
foreach element $lcanvas {
- dumpputs $method $dest " $element"
+ dumpputs $method $dest " $element"
}
dumpputs $method $dest "\}"
dumpputs $method $dest ""
global node_list link_list canvas_list
global showIfNames showNodeLabels showLinkLabels
global showIfIPaddrs showIfIPv6addrs
- global showIPsecConfig
+ global showIPsecConfig
# Cleanup first
set node_list {}
lappend canvas_list $object
}
if {"$class" == "option"} {
- # for future use
+ # for future use
lappend prefs $object
}
continue
}
set value [lindex $line 1]
- set line [lreplace $line 0 1]
+ set line [lreplace $line 0 1]
- if {"$class" == "node"} {
+ if {"$class" == "node"} {
switch -exact -- $field {
type {
lappend $object "type $value"
foreach zline [split $value {
}] {
if { [string index "$zline" 0] == " " } {
- set zline [string replace "$zline" 0 0]
+ set zline [string replace "$zline" 0 0]
}
lappend cfg $zline
- }
+ }
set cfg [lrange $cfg 1 [expr {[llength $cfg] - 2}]]
- lappend $object "custom-config {$cfg}"
+ lappend $object "custom-config {$cfg}"
+ }
+ ipsec-enabled {
+ lappend $object "ipsec-enabled $value"
}
- ipsec-enabled {
- lappend $object "ipsec-enabled $value"
- }
ipsec-config {
set cfg ""
-
+
foreach zline [split $value {
}] {
if { [string index "$zline" 0] == " " } {
- set zline [string replace "$zline" 0 0]
+ set zline [string replace "$zline" 0 0]
}
lappend cfg $zline
}
set cfg [lrange $cfg 1 [expr {[llength $cfg] - 2}]]
- lappend $object "ipsec-config {$cfg}"
+ lappend $object "ipsec-config {$cfg}"
}
iconcoords {
lappend $object "iconcoords {$value}"
} elseif {"$class" == "option"} {
switch -exact -- $field {
interface_names {
- if { $value == "no" } {
- set showIfNames 0
- } elseif { $value == "yes" } {
- set showIfNames 1
- }
+ if { $value == "no" } {
+ set showIfNames 0
+ } elseif { $value == "yes" } {
+ set showIfNames 1
+ }
}
ip_addresses {
- if { $value == "no" } {
- set showIfIPaddrs 0
- } elseif { $value == "yes" } {
- set showIfIPaddrs 1
- }
+ if { $value == "no" } {
+ set showIfIPaddrs 0
+ } elseif { $value == "yes" } {
+ set showIfIPaddrs 1
+ }
}
ipv6_addresses {
- if { $value == "no" } {
- set showIfIPv6addrs 0
- } elseif { $value == "yes" } {
- set showIfIPv6addrs 1
- }
+ if { $value == "no" } {
+ set showIfIPv6addrs 0
+ } elseif { $value == "yes" } {
+ set showIfIPv6addrs 1
+ }
}
node_labels {
- if { $value == "no" } {
- set showNodeLabels 0
- } elseif { $value == "yes" } {
- set showNodeLabels 1
- }
+ if { $value == "no" } {
+ set showNodeLabels 0
+ } elseif { $value == "yes" } {
+ set showNodeLabels 1
+ }
}
link_labels {
- if { $value == "no" } {
- set showLinkLabels 0
- } elseif { $value == "yes" } {
- set showLinkLabels 1
- }
+ if { $value == "no" } {
+ set showLinkLabels 0
+ } elseif { $value == "yes" } {
+ set showLinkLabels 1
+ }
}
ipsec_configs {
- if { $value == "no" } {
- set showIPsecConfig 0
- } elseif { $value == "yes" } {
- set showIPsecConfig 1
- }
+ if { $value == "no" } {
+ set showIPsecConfig 0
+ } elseif { $value == "yes" } {
+ set showIPsecConfig 1
+ }
}
}
- }
+ }
}
}
set class ""
-# $Id: editor.tcl,v 1.67 2007/07/19 01:17:05 marko Exp $
+# $Id: editor.tcl,v 1.68 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
set labelstr1 [getNodeName $node];
set labelstr2 [getNodePartition $node];
set l [format "%s\n%s" $labelstr1 $labelstr2];
- set label [.c create text $x $y -fill blue \
+ set label [.c create text $x $y -fill blue \
-text "$l" \
-tags "nodelabel $node"]
} else {
.button3menu.connect add cascade -label "Selected" \
-menu .button3menu.connect.selected
.button3menu.connect.selected add command \
- -label "Chain" -command "P \[selectedRealNodes\]"
+ -label "Chain" -command "P \[selectedRealNodes\]"
.button3menu.connect.selected add command \
- -label "Star" \
- -command "Kb \[lindex \[selectedRealNodes\] 0\] \
- \[lrange \[selectedNodes\] 1 end\]"
+ -label "Star" \
+ -command "Kb \[lindex \[selectedRealNodes\] 0\] \
+ \[lrange \[selectedNodes\] 1 end\]"
.button3menu.connect.selected add command \
- -label "Cycle" -command "C \[selectedRealNodes\]"
+ -label "Cycle" -command "C \[selectedRealNodes\]"
.button3menu.connect.selected add command \
- -label "Clique" -command "K \[selectedRealNodes\]"
+ -label "Clique" -command "K \[selectedRealNodes\]"
.button3menu.connect add separator
foreach canvas $canvas_list {
destroy .button3menu.connect.$canvas
set ifoperstate [subst $[subst ifoper$ifc]]
set oldifoperstate [getIfcOperState $target $ifc]
if { $ifoperstate != $oldifoperstate } {
- setIfcOperState $target $ifc $ifoperstate
- set changed 1
+ setIfcOperState $target $ifc $ifoperstate
+ set changed 1
}
#
set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get]
set oldipaddr [getIfcIPv4addr $target $ifc]
if { $ipaddr != $oldipaddr } {
- setIfcIPv4addr $target $ifc $ipaddr
- set changed 1
+ setIfcIPv4addr $target $ifc $ipaddr
+ set changed 1
}
set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get]
set oldipaddr [getIfcIPv6addr $target $ifc]
if { $ipaddr != $oldipaddr } {
- setIfcIPv6addr $target $ifc $ipaddr
- set changed 1
+ setIfcIPv6addr $target $ifc $ipaddr
+ set changed 1
}
set mtu [$wi.if$ifc.label.mtuv get]
set oldmtu [getIfcMTU $target $ifc]
if { $mtu != $oldmtu } {
- setIfcMTU $target $ifc $mtu
- set changed 1
+ setIfcMTU $target $ifc $mtu
+ set changed 1
}
}
set text [$wi.statrt.cfg.text get $i.0 $i.end]
set rtentry [lrange [split [string trim $text]] 0 2]
if { $rtentry == "" } {
- break
+ break
}
set dst [lindex $rtentry 0]
set gw [lindex $rtentry 1]
set metric [lindex $rtentry 2]
- if { [string is integer $metric] != 1 || \
- $metric > 65535 } {
- break
+ if { [string is integer $metric] != 1 || $metric > 65535 } {
+ break
}
if { [checkIPv4Net $dst] == 1 } {
- if { [checkIPv4Addr $gw] == 1 } {
- lappend newIPv4statrtes \
- [string trim "$dst $gw $metric"]
- } else {
- break
- }
+ if { [checkIPv4Addr $gw] == 1 } {
+ lappend newIPv4statrtes [string trim "$dst $gw $metric"]
+ } else {
+ break
+ }
} elseif { [checkIPv6Net $dst] == 1 } {
- if { [checkIPv6Addr $gw] == 1 } {
- lappend newIPv6statrtes \
- [string trim "$dst $gw $metric"]
- } else {
- break
- }
+ if { [checkIPv6Addr $gw] == 1 } {
+ lappend newIPv6statrtes [string trim "$dst $gw $metric"]
+ } else {
+ break
+ }
} else {
- break
+ break
}
incr i
}
set changed 1
}
- if { $showIPsecConfig == 0 } {
- set ipsecEnabled 0
- }
+ if { $showIPsecConfig == 0 } {
+ set ipsecEnabled 0
+ }
set oldipsecenabled [getIpsecEnabled $target]
if {$oldipsecenabled != $ipsecEnabled} {
setIpsecEnabled $target $ipsecEnabled
setNodeCPUConf $target [list $newcpuconf]
set changed 1
}
- }
+ } # XXX node
}
#
if { $changed == 1 && $oper_mode == "exec" } {
execSetLinkParams $eid $target
}
- }
+ } # XXX link
}
if { $changed == 1 } {
redrawAll
}
-
-
-#****f* editor.tcl/configRemoteHosts
-# NAME
-# configRemoteHosts -- configure remote hosts
-# SYNOPSIS
-# configRemoteHosts
-# FUNCTION
-# This function opens a remote host configuration dialog
-# box.
-#****
-proc configRemoteHosts {} {
- global exec_hosts
- global remote_exec old_remote_exec editor_only
- global active_host active_ssh
-
- set old_remote_exec $remote_exec
-
- if { $remote_exec } {
- set state normal
- } else {
- set state disabled
- }
-
- set wi .popup
- catch {destroy $wi}
- toplevel $wi
-
- wm transient $wi .
- wm resizable $wi 0 0
- wm title $wi "Remote host(s) configuration"
-
- labelframe $wi.select -pady 2 -text "Experiment running:" \
- -padx 2 -borderwidth 2
-
- radiobutton $wi.select.remote -text "remotely" \
- -command "enable_disable $wi"\
- -variable remote_exec -value true
- radiobutton $wi.select.local -text "locally" \
- -command "enable_disable $wi"\
- -variable remote_exec -value false
- checkbutton $wi.select.editor -text "edit mode only" \
- -command "enable_disable $wi"\
- -variable editor_only -onvalue true -offvalue false
- pack $wi.select.local $wi.select.remote $wi.select.editor -side left
-
- labelframe $wi.hosts -pady 2 -text "Remote hosts:" -padx 2
-
- frame $wi.hosts.labels -borderwidth 2
- label $wi.hosts.labels.label -text "Id" -anchor w
- frame $wi.hosts.address -borderwidth 2
- label $wi.hosts.address.label -text "IP address" -anchor w
- frame $wi.hosts.ports -borderwidth 2
- label $wi.hosts.ports.label -text "Port" -anchor w
- frame $wi.hosts.monitors -borderwidth 2
- label $wi.hosts.monitors.label -text "Monitor port" -anchor w
- frame $wi.hosts.active -borderwidth 2
- label $wi.hosts.active.label -text "Active" -anchor w
-# frame $wi.hosts.weight -borderwidth 2
-# label $wi.hosts.weight.label -text "Load (%)" -anchor w
- frame $wi.hosts.ssh -borderwidth 2
- label $wi.hosts.ssh.label -text "ssh" -anchor w
- frame $wi.hosts.userName -borderwidth 2
- label $wi.hosts.userName.label -text "User name" -anchor w
-
- set i 0
- foreach host_elem $exec_hosts {
-
- eval label $wi.hosts.labels.v$i -text "$i. " -anchor e
-
- eval entry $wi.hosts.address.v$i -bg white -width 15 \
- -validate focus -invcmd "focusAndFlash"
- $wi.hosts.address.v$i insert 0 [lindex $host_elem 0]
-
- eval entry $wi.hosts.ports.v$i -bg white -width 5 \
- -validate focus -invcmd "focusAndFlash"
- $wi.hosts.ports.v$i insert 0 [lindex $host_elem 1]
-
- eval entry $wi.hosts.monitors.v$i -bg white -width 5 \
- -validate focus -invcmd "focusAndFlash"
- $wi.hosts.monitors.v$i insert 0 [lindex $host_elem 2]
-
- eval checkbutton $wi.hosts.active.v$i \
- -variable active_host($i) -onvalue true -offvalue false
-
-# eval entry $wi.hosts.weight.v$i -bg white -width 5 \
-# -validate focus -invcmd "focusAndFlash"
-# $wi.hosts.weight.v$i insert 0 [lindex $host_elem 4]
-
- eval checkbutton $wi.hosts.ssh.v$i \
- -variable active_ssh($i) -onvalue true -offvalue false
- # -command {
- # if { active_ssh(0) } {
- # eval $wi.hosts.userName.v$i -configure state normal
- # } else {
- # eval $wi.hosts.userName.v$i -configure state disabled
- # }
- # }
-
- eval entry $wi.hosts.userName.v$i -bg white -width 5 \
- -validate focus -invcmd "focusAndFlash"
- $wi.hosts.userName.v$i insert 0 [lindex $host_elem 5]
-
- incr i
- }
-
- foreach j [list labels address ports monitors active ssh userName] {
- eval pack $wi.hosts.$j.label -side top -padx 4 -pady 2 -fill x
- set n [llength $exec_hosts]
- for {set i 0} {$i < $n} {incr i} {
- eval pack $wi.hosts.$j.v$i -side top -padx 4 -pady 2 -fill x
- }
- }
- pack $wi.hosts.labels $wi.hosts.address $wi.hosts.ports \
- $wi.hosts.monitors $wi.hosts.active \
- $wi.hosts.ssh $wi.hosts.userName -side left -fill x
- pack $wi.select $wi.hosts -side top -fill x -padx 4
-
- frame $wi.butt -borderwidth 4
- button $wi.butt.apply -text "Apply" -command \
- "configRemoteHostsApply $wi; destroy $wi"
- focus $wi.butt.apply
- button $wi.butt.cancel -text "Cancel" -command \
- "set remote_exec $old_remote_exec; destroy $wi"
- pack $wi.butt.cancel $wi.butt.apply -side right
- pack $wi.butt -side bottom
-
- enable_disable $wi
-
- after 100 {
- grab .popup
- }
- ;# Apply and Cancel explicitly destroy $wi
- vwait forever
-}
-
-
-#****f* editor.tcl/configRemoteHostsApply
-# NAME
-# configRemoteHostsApply -- configure remote hosts apply
-# SYNOPSIS
-# configRemoteHostsApply $wi
-# FUNCTION
-# This function is called when clicking on the apply button
-# in remote hosts configuration dialog box.
-#****
-proc configRemoteHostsApply { wi } {
- global exec_hosts
- global active_host active_ssh
- global remote_exec editor_only
- global execSock monSock exec_sockets_opened
-
- set n [llength $exec_hosts]
- set exec_hosts []
- set at_least_one_up false
- for {set i 0} {$i < $n} {incr i} {
- set ent [list [$wi.hosts.address.v$i get] \
- [$wi.hosts.ports.v$i get] \
- [$wi.hosts.monitors.v$i get]\
- $active_host($i) \
- $active_ssh($i)\
- [$wi.hosts.userName.v$i get]]
- lappend exec_hosts $ent
- if { $active_host($i) } { set at_least_one_up true }
- }
- if { $remote_exec && ! $at_least_one_up } {
- set editor_only true
- .menubar.experiment entryconfigure "Execute" -state disabled
- }
-# catch { unset exec_sock monitor_sock } message
-# set exec_sockets_opened false
- destroy $wi
-}
-
-
-#****f* editor.tcl/enable_disable
-# NAME
-# enable_disable
-# SYNOPSIS
-# enable_disable $wi
-# FUNCTION
-# Enables or disables the hosts entries in the remote host
-# configuration dialog box.
-#****
-proc enable_disable { wi } {
- global exec_hosts
- global remote_exec editor_only
-
- set i 0
-
- if { ! $remote_exec || $editor_only } {
- set state disabled
- } else {
- set state normal
- }
-
- if { $editor_only } {
- .menubar.experiment entryconfigure "Execute" -state disabled
- } else {
- .menubar.experiment entryconfigure "Execute" -state normal
- }
-
- foreach host_elem $exec_hosts {
- eval $wi.hosts.address.v$i configure -state $state
- eval $wi.hosts.ports.v$i configure -state $state
- eval $wi.hosts.monitors.v$i configure -state $state
- #eval $wi.hosts.weight.v$i configure -state $state
- eval $wi.hosts.ssh.v$i configure -state $state
- eval $wi.hosts.userName.v$i configure -state $state
- incr i
- }
-}
-
-
proc zoom { dir } {
global zoom
-# $Id: exec.tcl,v 1.50 2007/07/19 02:33:14 marko Exp $
+# $Id: exec.tcl,v 1.51 2007/07/19 03:14:13 marko Exp $
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
#****
proc l3node.start { eid node } {
global remote_exec execSock
+ global viewcustomid
set node_id "$eid\_$node"
nexec vimage $node_id ifconfig $ifc mtu $mtu
}
- global viewcustomid
set check [info exists viewcustomid]
if { $check == 0 } {
set viewcustomid generic
}
if { [getCustomEnabled $node] == true } {
- set customCfg ""
+ set customCfg ""
set customCfgList ""
- set customCfgList [getCustomConfig $node]
- foreach element $customCfgList {
- set cid [lindex [lsearch -inline $element "custom-config-id *"] 1]
- if { $cid == $viewcustomid } {
- set customCfg $element
- }
- }
+ set customCfgList [getCustomConfig $node]
+ foreach element $customCfgList {
+ set cid [lindex [lsearch -inline $element "custom-config-id *"] 1]
+ if { $cid == $viewcustomid } {
+ set customCfg $element
+ }
+ }
if { $customCfg == "" } {
- set customCfg [lindex $customCfgList 0]
+ set customCfg [lindex $customCfgList 0]
}
set bootcmd [getConfig $customCfg "custom-command"]
set bootcfg ""
}
- set ipsecCfg ""
+ set ipsecCfg ""
if { [getIpsecEnabled $node] == true } {
set setkeycfg [ipsecCfggen $node]
set setkeyFileId [open /tmp/$node_id/setkey.conf w+]
}
close $setkeyFileId
- set error ""
- set errorstr ""
+ set errorstr ""
set error [catch "nexec vimage $node_id setkey -f \
/tmp/$node_id/setkey.conf" errorstr]
- if { $error == "1" } {
- setkeyError $node_id $errorstr
- }
+ if { $error == "1" } {
+ setkeyError $node_id $errorstr
+ }
}
if { $bootcmd == "" || $bootcfg =="" } {
nexec close_conf_file
}
- catch "nexec vimage $node_id $bootcmd /tmp/$node_id/boot.conf &"
+ catch "nexec vimage $node_id $bootcmd /tmp/$node_id/boot.conf &"
}
#****f* exec.tcl/l3node.shutdown
-# $Id: exec_server.tcl,v 1.5 2007/07/19 01:17:05 marko Exp $
+# $Id: exec_server.tcl,v 1.6 2007/07/19 03:14:13 marko Exp $
#! /usr/local/bin/tclsh8.4
#######
} else {
catch {puts $fileId $line} odg
if { $debug_output && ($odg != "") } {
- puts "$server_port/puts greska: $odg"
+ puts "$server_port/puts greska: $odg"
}
}
} else {
-# $Id: filemgmt.tcl,v 1.10 2007/07/19 02:33:14 marko Exp $
+# $Id: filemgmt.tcl,v 1.11 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
if { $currentFile == "" } {
set selectedFile [tk_getSaveFile -filetypes $fileTypes -initialfile\
- untitled -defaultextension .imn]
+ untitled -defaultextension .imn]
saveFile $selectedFile
} else {
saveFile $currentFile
-# $Id: imunes.tcl,v 1.22 2007/07/19 01:17:05 marko Exp $
+# $Id: imunes.tcl,v 1.23 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
# List can be overwritten in config file .imunesrc
#*****
-# IP port monitor_port
+# IP port monitor_port
set exec_hosts [list \
[list 192.168.1.100 2547 2548 false ] \
[list 10.0.0.1 1234 5678 false ] \
-# $Id: ipv4.tcl,v 1.12 2007/07/19 01:17:05 marko Exp $
+# $Id: ipv4.tcl,v 1.13 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2005 University of Zagreb, Croatia. All rights reserved.
#
foreach ifc [ifcList $node] {
set ipnet [lrange [split [getIfcIPv4addr $node $ifc] .] 0 2]
if {[lsearch $ipnets $ipnet] == -1} {
- lappend ipnets $ipnet
+ lappend ipnets $ipnet
}
}
}
for { set i 0 } { $i <= 255 } { incr i } {
for { set j 0 } { $j <= 255 } { incr j } {
if {[lsearch $ipnets "10 $i $j"] == -1} {
- set ipnet "10.$i.$j"
- return $ipnet
+ set ipnet "10.$i.$j"
+ return $ipnet
}
}
}
-# $Id: ipv6.tcl,v 1.10 2007/07/19 01:17:05 marko Exp $
+# $Id: ipv6.tcl,v 1.11 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2005 University of Zagreb, Croatia. All rights reserved.
#
foreach ifc [ifcList $node] {
set ipnet [lrange [split [getIfcIPv6addr $node $ifc] :] 0 1]
if {[lsearch $ipnets $ipnet] == -1} {
- lappend ipnets $ipnet
+ lappend ipnets $ipnet
}
}
}
set word [lindex $wordlist $i]
if { $word == "" } {
if { $doublec == "true" } {
- return 0
+ return 0
}
set doublec true
}
if { [string length $word] > 4 } {
if { $i == $wordcnt } {
- return [checkIPv4Addr $word]
+ return [checkIPv4Addr $word]
} else {
- return 0
+ return 0
}
}
if { [string is xdigit $word] == 0 } {
-# $Id: linkcfg.tcl,v 1.16 2007/07/19 01:17:05 marko Exp $
+# $Id: linkcfg.tcl,v 1.17 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
if { [[typemodel $node].layer] == "NETWORK" } {
set ifcs [ifcList $node]
foreach ifc $ifcs {
- autoIPv4defaultroute $node $ifc
+ autoIPv4defaultroute $node $ifc
}
}
}
-# $Id: nodecfg.tcl,v 1.18 2007/07/19 01:17:05 marko Exp $
+# $Id: nodecfg.tcl,v 1.19 2007/07/19 03:14:13 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
global $node
set customCfgList {}
- set customcmd ""
- set customcfg ""
- set customcmd [lsearch -inline [set $node] "custom-command *"]
- set customcmdval [lindex $customcmd 1]
- set customcfg [lsearch -inline [set $node] "custom-config *"]
- set customcfgval [lindex $customcfg 1]
- if { $customcmd != "" } {
- set customid [list custom-config-id generic]
- set customcmd [list custom-command $customcmdval]
- set customcfg [list config $customcfgval]
- set customCfgList [list [list $customid $customcmd $customcfg]]
-
- } else {
- set values [lsearch -all -inline [set $node] "custom-config *"]
- foreach val $values {
- lappend customCfgList [lindex $val 1]
+ set customcmd ""
+ set customcfg ""
+ set customcmd [lsearch -inline [set $node] "custom-command *"]
+ set customcmdval [lindex $customcmd 1]
+ set customcfg [lsearch -inline [set $node] "custom-config *"]
+ set customcfgval [lindex $customcfg 1]
+ if { $customcmd != "" } {
+ set customid [list custom-config-id generic]
+ set customcmd [list custom-command $customcmdval]
+ set customcfg [list config $customcfgval]
+ set customCfgList [list [list $customid $customcmd $customcfg]]
+ } else {
+ set values [lsearch -all -inline [set $node] "custom-config *"]
+ foreach val $values {
+ lappend customCfgList [lindex $val 1]
}
- }
+ }
- return $customCfgList
+ return $customCfgList
}
#****f* nodecfg.tcl/setCustomConfig
# For input node this procedure sets custom configuration section.
# INPUTS
# * node_id -- node id
-# * id -- custom-config id
-# * cmd -- custom command
+# * id -- custom-config id
+# * cmd -- custom command
# * cfg -- custom configuration section
-# * delete -- if delete is set to 1, setCustomConfig is invoked
-# to delete custom-config with custom-config-id $id
-# *
+# * delete -- if delete is set to 1, setCustomConfig is invoked
+# to delete custom-config with custom-config-id $id
+# *
#****
proc setCustomConfig { node id cmd cfg delete } {
- global viewcustomid
+ global viewcustomid
global $node
- set i [lsearch [set $node] "custom-command *"]
- if { $i != "-1" } {
- set $node [lreplace [set $node] $i $i]
- set j [lsearch [set $node] "custom-config *"]
- set $node [lreplace [set $node] $j $j]
- }
+ set i [lsearch [set $node] "custom-command *"]
+ if { $i != "-1" } {
+ set $node [lreplace [set $node] $i $i]
+ set j [lsearch [set $node] "custom-config *"]
+ set $node [lreplace [set $node] $j $j]
+ }
- set indices [lsearch -all [set $node] "custom-config *"]
- foreach i $indices {
- set tmp [lindex [set $node] $i]
- set customCfg [lindex $tmp 1]
- set cid [lindex [lsearch -inline $customCfg \
- "custom-config-id *"] 1]
- if { $cid == $id } {
- set $node [lreplace [set $node] $i $i]
- }
+ set indices [lsearch -all [set $node] "custom-config *"]
+ foreach i $indices {
+ set tmp [lindex [set $node] $i]
+ set customCfg [lindex $tmp 1]
+ set cid [lindex [lsearch -inline $customCfg "custom-config-id *"] 1]
+ if { $cid == $id } {
+ set $node [lreplace [set $node] $i $i]
}
-
- if { $delete == 0 } {
- if { $cfg != {} && $cmd != {} && $id != {} } {
- set newid [list custom-config-id $id]
- set viewcustomid [lindex $newid 1]
- set newcmd [list custom-command $cmd]
- set newcfg [list config $cfg]
- lappend $node [ list custom-config \
- [list $newid $newcmd $newcfg] ]
}
+
+ if { $delete == 0 } {
+ if { $cfg != {} && $cmd != {} && $id != {} } {
+ set newid [list custom-config-id $id]
+ set viewcustomid [lindex $newid 1]
+ set newcmd [list custom-command $cmd]
+ set newcfg [list config $cfg]
+ lappend $node [ list custom-config [list $newid $newcmd $newcfg] ]
}
+ }
}
#****f* nodecfg.tcl/deleteCustomConfig
# SYNOPSIS
# deleteCustomConfig $w $node $id $cmd $cfg $delete
# FUNCTION
-# Delete specified custom-config element and invokes
-# editStartupCfg function.
+# Delete specified custom-config element and invokes
+# editStartupCfg function.
# INPUTS
# * all the inputs are equivalent to the inputs in the
-# * setCustomConfig function
+# * setCustomConfig function
#****
proc deleteCustomConfig { w node id cmd cfg delete } {
- global viewcustomid
+ global viewcustomid
- setCustomConfig $node $viewcustomid {} {} 1
- destroy $w
- editStartupCfg $node 1
+ setCustomConfig $node $viewcustomid {} {} 1
+ destroy $w
+ editStartupCfg $node 1
}
#****f* nodecfg.tcl/netconfFetchSection
foreach line [netconfFetchSection $node "interface $ifc"] {
if { [lindex $line 0] == "shutdown" } {
return "down"
-
}
}
return "up"