'encoding UTF-8 Do not remove or change this line!
'**************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'**************************************************************
'*
'* short description : Tools to ease working with private environment
'*
'\******************************************************************************
function hGetPrivateHttpServer( _proxy as string, _port as string ) as boolean
'///
Retrieve the name and port for a private http server
'///Function parameters:
'///
'///+- Fully qualified server name incl. domain (string)
'///
'///+- The string comes without a protocol part (no http://)
'///
'///+- Server port (string)
'///
'///+- Please remember limits for integer data type
'///
'///
'///Returns:
'///
'///+- Error condition (boolean)
'///
'///+- "TRUE": Data was retrieved successfully
'///+- "FALSE": Any error
'///
'///
use "global\tools\includes\optional\t_key_tools.inc"
const CFN = "hGetPrivateHttpServer::"
dim cFile as string
dim cDataSet( 100 ) as string
dim iErr as integer
'///Description:
'///
'///+- Get the source file
cFile = hGetPrivateInputFile( false )
printlog( CFN & "Using input file: " & cFile )
'///+- Retrieve the information from the datafile
iErr = hGetDataFileSection( cFile, cDataSet(), "http_proxy", "", "" )
if ( iErr = 0 ) then
hGetPrivateHttpServer() = false
exit function
endif
'///+- Extract the proxy name
_proxy = hGetValueForKeyAsString( cDataSet(), "name" )
'///+- Append the domain
_proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
'///+- Get the port
_port = hGetValueForKeyAsString( cDataSet() , "port" )
'///+- Print a log
printlog( CFN & _proxy & ":" & _port )
'///
hGetPrivateHttpServer() = true
end function
'*******************************************************************************
function hGetPrivateFtpServer( _proxy as string, _port as string ) as boolean
'///Retrieve the name and port for a private ftp server
'///Function parameters:
'///
'///+- Fully qualified server name incl. domain (string)
'///
'///+- The string comes without a protocol part (no ftp://)
'///
'///+- Server port (string)
'///
'///+- Please remember limits for integer data type
'///
'///
'///Returns:
'///
'///+- Error condition (boolean)
'///
'///+- "TRUE": Data was retrieved successfully
'///+- "FALSE": Any error
'///
'///
use "global\tools\includes\optional\t_key_tools.inc"
const CFN = "hGetPrivateFtpServer::"
dim cFile as string
dim cDataSet( 100 ) as string
dim iErr as integer
'///Description:
'///
'///+- Get the source file
cFile = hGetPrivateInputFile( false )
printlog( CFN & "Using input file: " & cFile )
'///+- Retrieve the information from the datafile
iErr = hGetDataFileSection( cFile, cDataSet(), "ftp_proxy", "", "" )
if ( iErr = 0 ) then
hGetPrivateFtpServer() = false
exit function
endif
'///+- Extract the proxy name
_proxy = hGetValueForKeyAsString( cDataSet(), "name" )
'///+- Append the domain
_proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
'///+- Get the port
_port = hGetValueForKeyAsString( cDataSet() , "port" )
'///+- Print a log
printlog( CFN & _proxy & ":" & _port )
'///
hGetPrivateFtpServer() = true
end function
'*******************************************************************************
function hGetPrivateSocksServer( _proxy as string, _port as string ) as boolean
'///Retrieve the name and port for a private socks server
'///Function parameters:
'///
'///+- Fully qualified server name incl. domain (string)
'///+- Server port (string)
'///
'///+- Please remember limits for integer data type
'///
'///
'///Returns:
'///
'///+- Error condition (boolean)
'///
'///+- "TRUE": Data was retrieved successfully
'///+- "FALSE": Any error
'///
'///
use "global\tools\includes\optional\t_key_tools.inc"
const CFN = "hGetPrivateSocksServer::"
dim brc as boolean 'a multi purpose boolean returnvalue
dim cFile as string
dim cDataSet( 100 ) as string
dim iErr as integer
'///Description:
'///
'///+- Get the source file
cFile = hGetPrivateInputFile( false )
'///+- Retrieve the information from the datafile
iErr = hGetDataFileSection( cFile, cDataSet(), "socks", "", "" )
if ( iErr = 0 ) then
hGetPrivateSocksServer() = false
exit function
endif
'///+- Extract the proxy name
_proxy = hGetValueForKeyAsString( cDataSet(), "name" )
'///+- Append the domain
_proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
'///+- Get the port
_port = hGetValueForKeyAsString( cDataSet() , "port" )
'///+- Print a log
printlog( CFN & _proxy & ":" & _port )
'///
hGetPrivateSocksServer() = true
end function
'*******************************************************************************
function hGetPrivateInputPath( bVerbose as boolean ) as string
'///Switch the private input path from ../inc/ to ../input/
'/// This is part of the effort to allow usage of private data such as
'///+ servernames, paths, login names etc. within a Local Area Network (LAN).
'/// If you have to maintain data of any sort that may not get out to the
'///+ public you will want to put your data into this directory.
'///Input Value:
'///
'///+- Toggle verbosity (boolean)
'///
'///+- "TRUE": Print path
'///+- "FALSE": Do not print path
'///
'///
'///Return Value:
'///
'///+- Path to the private input directory (string)
'///
'///+- Function is not supposed to fail
'///+- Fully qualified path to the input directory including last pathseparator
'///
'///
const CFN = "hGetPrivateInputPath::"
dim cPrivateInputPath as string
'///Description:
'///
'///+- Get the ../inc-path from global variable (assuming path is valid)
cPrivateInputPath = gTesttoolPath & gPrivateEnvironmentLocation
'///+- Append input/ (platform specific)
cPrivateInputPath = cPrivateInputPath & "input/"
cPrivateInputPath = convertpath( cPrivateInputPath )
'///+- Print the resulting path to the log
if ( bVerbose ) then
printlog( CFN & "Private input directory is: " & cPrivateInputPath )
endif
hGetPrivateInputPath() = cPrivateInputPath
'///
end function
'*******************************************************************************
function hGetPrivateInputFile( bVerbose as boolean ) as string
'///Retrieve the fully qualified path to the datafile
'///Input:
'///
'///+- Toggle verbosity (boolean)
'///
'///+- "TRUE": Print path
'///+- "FALSE": Do not print path
'///
'///
'///Returns:
'///
'///+- Fully qualified path to the datafile (string)
'///
const CFN = "hGetPrivateInputFile::"
dim brc as boolean 'a multi purpose boolean returnvalue
dim cFile as string
'///Description:
'///
'///+- Append pathseparator and filename to input path
cFile = hGetPrivateInputPath( false ) & "framework_network.txt"
'///+- Print path and filename to the log
if ( bVerbose ) then
printlog( CFN & "Private datafile is: " & cFile )
endif
'///
hGetPrivateInputFile() = cFile
end function