1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: private_environment.inc,v $
13 '* last change: $Author: jsk $ $Date: 2008-06-20 08:03:54 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Tools to ease working with private environment
38 '\******************************************************************************
40 function hGetPrivateHttpServer( _proxy as string, _port as string ) as boolean
43 '///<h3>Retrieve the name and port for a private http server</h3><br>
45 '///<u>Function parameters:</u><br>
48 '///+<li>Fully qualified server name incl. domain (string)</li>
50 '///+<li>The string comes without a protocol part (no http://)</li>
53 '///+<li>Server port (string)</li>
55 '///+<li>Please remember limits for integer data type</li>
61 '///<u>Returns:</u><br>
64 '///+<li>Error condition (boolean)</li>
66 '///+<li>"TRUE": Data was retrieved successfully</li>
67 '///+<li>"FALSE": Any error </li>
71 use "global\tools\includes\optional\t_key_tools.inc"
73 const CFN = "hGetPrivateHttpServer::"
75 dim cDataSet( 100 ) as string
78 '///<u>Description:</u>
80 '///+<li>Get the source file</li>
81 cFile = hGetPrivateInputFile( false )
82 printlog( CFN & "Using input file: " & cFile )
84 '///+<li>Retrieve the information from the datafile</li>
85 iErr = hGetDataFileSection( cFile, cDataSet(), "http_proxy", "", "" )
87 hGetPrivateHttpServer() = false
91 '///+<li>Extract the proxy name</li>
92 _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
94 '///+<li>Append the domain</li>
95 _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
97 '///+<li>Get the port</li>
98 _port = hGetValueForKeyAsString( cDataSet() , "port" )
100 '///+<li>Print a log</li>
101 printlog( CFN & _proxy & ":" & _port )
104 hGetPrivateHttpServer() = true
108 '*******************************************************************************
110 function hGetPrivateFtpServer( _proxy as string, _port as string ) as boolean
113 '///<h3>Retrieve the name and port for a private ftp server</h3><br>
115 '///<u>Function parameters:</u><br>
118 '///+<li>Fully qualified server name incl. domain (string)</li>
120 '///+<li>The string comes without a protocol part (no ftp://)</li>
123 '///+<li>Server port (string)</li>
125 '///+<li>Please remember limits for integer data type</li>
131 '///<u>Returns:</u><br>
134 '///+<li>Error condition (boolean)</li>
136 '///+<li>"TRUE": Data was retrieved successfully</li>
137 '///+<li>"FALSE": Any error </li>
141 use "global\tools\includes\optional\t_key_tools.inc"
143 const CFN = "hGetPrivateFtpServer::"
145 dim cDataSet( 100 ) as string
148 '///<u>Description:</u>
150 '///+<li>Get the source file</li>
151 cFile = hGetPrivateInputFile( false )
152 printlog( CFN & "Using input file: " & cFile )
154 '///+<li>Retrieve the information from the datafile</li>
155 iErr = hGetDataFileSection( cFile, cDataSet(), "ftp_proxy", "", "" )
157 hGetPrivateFtpServer() = false
161 '///+<li>Extract the proxy name</li>
162 _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
164 '///+<li>Append the domain</li>
165 _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
167 '///+<li>Get the port</li>
168 _port = hGetValueForKeyAsString( cDataSet() , "port" )
170 '///+<li>Print a log</li>
171 printlog( CFN & _proxy & ":" & _port )
174 hGetPrivateFtpServer() = true
178 '*******************************************************************************
180 function hGetPrivateSocksServer( _proxy as string, _port as string ) as boolean
183 '///<h3>Retrieve the name and port for a private socks server</h3><br>
185 '///<u>Function parameters:</u><br>
188 '///+<li>Fully qualified server name incl. domain (string)</li>
190 '///+<li>Server port (string)</li>
192 '///+<li>Please remember limits for integer data type</li>
198 '///<u>Returns:</u><br>
201 '///+<li>Error condition (boolean)</li>
203 '///+<li>"TRUE": Data was retrieved successfully</li>
204 '///+<li>"FALSE": Any error </li>
208 use "global\tools\includes\optional\t_key_tools.inc"
210 const CFN = "hGetPrivateSocksServer::"
211 dim brc as boolean 'a multi purpose boolean returnvalue
213 dim cDataSet( 100 ) as string
216 '///<u>Description:</u>
218 '///+<li>Get the source file</li>
219 cFile = hGetPrivateInputFile( false )
221 '///+<li>Retrieve the information from the datafile</li>
222 iErr = hGetDataFileSection( cFile, cDataSet(), "socks", "", "" )
224 hGetPrivateSocksServer() = false
228 '///+<li>Extract the proxy name</li>
229 _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
231 '///+<li>Append the domain</li>
232 _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
234 '///+<li>Get the port</li>
235 _port = hGetValueForKeyAsString( cDataSet() , "port" )
237 '///+<li>Print a log</li>
238 printlog( CFN & _proxy & ":" & _port )
241 hGetPrivateSocksServer() = true
245 '*******************************************************************************
247 function hGetPrivateInputPath( bVerbose as boolean ) as string
250 '///<h3>Switch the private input path from ../inc/ to ../input/</h3>
252 '/// This is part of the effort to allow usage of private data such as
253 '///+ servernames, paths, login names etc. within a Local Area Network (LAN).
254 '/// If you have to maintain data of any sort that may not get out to the
255 '///+ public you will want to put your data into this directory.<br><br>
257 '///<u>Input Value:</u><br>
259 '///+<li>Toggle verbosity (boolean)</li>
261 '///+<li>"TRUE": Print path</li>
262 '///+<li>"FALSE": Do not print path</li>
266 '///<u>Return Value:</u><br>
268 '///+<li>Path to the private input directory (string)</li>
270 '///+<li>Function is not supposed to fail</li>
271 '///+<li>Fully qualified path to the input directory including last pathseparator</li>
275 const CFN = "hGetPrivateInputPath::"
276 dim cPrivateInputPath as string
278 '///<u>Description:</u>
280 '///+<li>Get the ../inc-path from global variable (assuming path is valid)</li>
281 cPrivateInputPath = gTesttoolPath & gPrivateEnvironmentLocation
283 '///+<li>Append input/ (platform specific)</li>
284 cPrivateInputPath = cPrivateInputPath & "input/"
285 cPrivateInputPath = convertpath( cPrivateInputPath )
287 '///+<li>Print the resulting path to the log</li>
289 printlog( CFN & "Private input directory is: " & cPrivateInputPath )
292 hGetPrivateInputPath() = cPrivateInputPath
297 '*******************************************************************************
299 function hGetPrivateInputFile( bVerbose as boolean ) as string
302 '///<h3>Retrieve the fully qualified path to the datafile</h3><br>
306 '///+<li>Toggle verbosity (boolean)</li>
308 '///+<li>"TRUE": Print path</li>
309 '///+<li>"FALSE": Do not print path</li>
317 '///+<li>Fully qualified path to the datafile (string)</li>
320 const CFN = "hGetPrivateInputFile::"
321 dim brc as boolean 'a multi purpose boolean returnvalue
324 '///<u>Description:</u>
326 '///+<li>Append pathseparator and filename to input path</li>
327 cFile = hGetPrivateInputPath( false ) & "framework_network.txt"
329 '///+<li>Print path and filename to the log</li>
331 printlog( CFN & "Private datafile is: " & cFile )
336 hGetPrivateInputFile() = cFile