proc CHD:badTcpHost { checkValue warnTextVar } { global tcl_platform upvar $warnTextVar warnText set tcpAddrPttn {^[0-9]+.[0-9]+.[0-9]+.[0-9]+$} if [regexp $tcpAddrPttn $checkValue] { return 0 } set nslook "" if {[regexp -nocase -- {Windows} $tcl_platform(os)] } { catch {set nslook [exec nslookup $checkValue 2>NUL]} } else { catch {set nslook [exec nslookup $checkValue 2>/dev/null]} } set nscheck "can't find $checkValue" if { [regexp -nocase -- {Windows} $tcl_platform(os)] || [regexp -nocase -- {AIX} $tcl_platform(os)] || [regexp -nocase -- {HP-UX} $tcl_platform(os)] } { if { [lsearch [listTcpHosts] $checkValue] < 0 && ![regexp -- $checkValue $nslook]} { set warnText "cannot find host '$checkValue'" return 1 }} else { if { [lsearch [listTcpHosts] $checkValue] < 0 && [regexp -- $nscheck $nslook] } { set warnText "cannot find host '$checkValue'" return 1 } } return 0}
proc CHD:badTcpHost { checkValue warnTextVar } { global tcl_platform upvar $warnTextVar warnText set tcpAddrPttn {^[0-9]+.[0-9]+.[0-9]+.[0-9]+$} if [regexp $tcpAddrPttn $checkValue] { return 0 } elseif { [string tolower $checkValue] eq "localhost" } { #puts "CHD:badTcpHost: LOCALHOST - return 0" return 0 } set nslook "" if {[regexp -nocase -- {Windows} $tcl_platform(os)] } { catch {set nslook [exec nslookup $checkValue 2>NUL]} } else { catch {set nslook [exec nslookup $checkValue 2>/dev/null]} } set nscheck "can't find $checkValue" if { [regexp -nocase -- {Windows} $tcl_platform(os)] || [regexp -nocase -- {AIX} $tcl_platform(os)] || [regexp -nocase -- {HP-UX} $tcl_platform(os)] } { if { [lsearch [listTcpHosts] $checkValue] < 0 && ![regexp -- $checkValue $nslook]} { set warnText "cannot find host '$checkValue'" return 1 } } else { if { [lsearch [listTcpHosts] $checkValue] < 0 && [regexp -- $nscheck $nslook] } { set warnText "cannot find host '$checkValue'" return 1 } } return 0}
} elseif { [string tolower $checkValue] eq "localhost" } { #puts "CHD:badTcpHost: LOCALHOST - return 0" return 0 }
proc NCFG:reload { config } { global __CRMC_SKIP_HOST_ARRAY_CHECK__ global _ncfg_ConnData _ncfg_ProcessData _ncfg_ProcessConns _ncfg_Version global _ncfg_GroupConns _ncfg_TypeCounts if { ! [info exists __CRMC_SKIP_HOST_ARRAY_CHECK__] } { set __CRMC_SKIP_HOST_ARRAY_CHECK__ 0 } # Remove, initialize the array catch { unset _ncfg_ConnData _ncfg_ProcessData _ncfg_ProcessConns } set _ncfg_ConnData(bogusKey) {} unset _ncfg_ConnData(bogusKey) set _ncfg_ProcessData(bogusKey) {} unset _ncfg_ProcessData(bogusKey) set _ncfg_ProcessConns(bogusKey) {} unset _ncfg_ProcessConns(bogusKey) set _ncfg_GroupConns(bogusKey) {} unset _ncfg_GroupConns(bogusKey) set _ncfg_TypeCounts(external) 0 set _ncfg_TypeCounts(vendor) 0 if { [catch {set ncf [open $config r]} msg] } { error $msg } if {[uplevel #0 {info exists EuroBinary}]} { fconfigure $ncf -encoding binary -eofchar {} } set minvers 3.0 set maxvers 3.10 if [getNetVersion $ncf _ncfg_Version] { # Check the lower and upper bounds of compatible versions if { $_ncfg_Version $maxvers } { set errMsg "$config is version $_ncfg_Version; " append errMsg "versions $minvers through $maxvers are supported." error $errMsg } } else { error "Unable to fetch version from $config." } # Now process the data in the file while { [lgets $ncf line] >= 0 } { if { [lempty $line] } continue lassign $line type name config switch -exact -- $type { protocol { if { [info exists _ncfg_ConnData($name)] } { close $ncf error "Duplicate NetConfig host entry: $name" } set _ncfg_ConnData($name) $config ;# Store conn data # Prepare the process to name mapping if { [keylget config PROCESSNAME procName] == 0 } { close $ncf error "PROCESSNAME missing for entry: $name" } lappend _ncfg_ProcessConns($procName) $name # Fetch the thread's CloverleafGateway type and # update the count. If the thread is untyped, assume # vendor (vendor threads are more likely to be # license limited than external threads). # N.B.: this is _different_ than # engine/protocols/ProtocolThreadData.c # PR-2839: use $gwtype to not clobber $type if { [keylget config GATEWAYTHREADTYPE gwtype] == 0 } { set gwtype vendor } if { [string compare $gwtype external] && [string compare $gwtype vendor] } { close $ncf error "$name: bogus GATEWAYTHREADTYPE '$gwtype'" } incr _ncfg_TypeCounts($gwtype) # Add a protocol connection to all its groups if [cequal $type protocol] { if { [keylget config GROUPS groups] == 0 } { close $ncf error "GROUPS missing for entry: $name" } foreach grp $groups { lappend _ncfg_GroupConns($grp) $name } } } process { if { [info exists _ncfg_ProcessData($name)] } { close $ncf error "Duplicate NetConfig process entry: $name" } set _ncfg_ProcessData($name) $config ;# Store process data } default { # Just ignore everything else } } } # check the processes for errors set verifyWarnList "" if {[catch {checkProcessArray verifyWarnList _ncfg_ProcessData} msg]} { puts stderr "nNetConfig Error: $msgn" } if { ! $__CRMC_SKIP_HOST_ARRAY_CHECK__ } { # check the threads for errors if {[catch {checkHostArray verifyWarnList _ncfg_ConnData} msg]} { puts stderr "nNetConfig Error: $msgn" } } close $ncf}