Commit 69995493 authored by whitlocb's avatar whitlocb

Merged the RC to the trunk. Fixed Windows API in a header file.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7068 18c085ea-50e0-402c-830e-de6fd14e8384
parent 328b25ce
......@@ -1750,10 +1750,6 @@ RemoteProcess::SecureShellArgs() const
// 7 (on UNIX) or 10 (on Windows). Particularly on Windows, users were
// still having problems.
//
// Brad Whitlock, Mon Apr 27 16:24:08 PDT 2009
// Pass port mapping information to the launched process in case it needs
// that information when we're doing SSH tunnelling.
//
// ****************************************************************************
void
......@@ -1937,20 +1933,6 @@ RemoteProcess::CreateCommandLine(stringVector &args, const std::string &rHost,
char tmp[20];
sprintf(tmp, "%d", portTunnelMap[listenPortNum]);
args.push_back(tmp);
// Send the port mapping to the remote process so it can use the
// mapping to help forward ports itself.
std::map<int,int>::const_iterator it;
std::string portmap;
for(it = portTunnelMap.begin(); it != portTunnelMap.end(); ++it)
{
sprintf(tmp, "%d:%d", it->first, it->second);
portmap += tmp;
portmap += ",";
}
portmap = portmap.substr(0,portmap.size()-1);
args.push_back("-portmap");
args.push_back(portmap);
}
else
#endif
......
......@@ -41,21 +41,21 @@
// ************************************************************************* //
#ifndef ENV_H
#define ENV_H
#include <utility_exports.h>
#include <misc_exports.h>
#include <string>
namespace Environment {
/// Obtains a value from the environment.
std::string UTILITY_API get(const char *);
std::string MISC_API get(const char *);
/// Predicate to determine whether a variable is defined.
bool UTILITY_API exists(const char *);
bool MISC_API exists(const char *);
/// Sets a value in the enviroment. Overwrites any existing value.
void UTILITY_API set(const char *k, const char *v);
void MISC_API set(const char *k, const char *v);
/// Removes the given key from the environment.
void UTILITY_API unset(const char *);
void MISC_API unset(const char *);
};
#endif
......@@ -267,13 +267,10 @@ LauncherApplication::Instance()
// Brad Whitlock, Wed Nov 21 11:13:20 PST 2007
// Added support for forwarding child output.
//
// Brad Whitlock, Mon Apr 27 16:25:34 PST 2009
// I added portMap.
//
// ****************************************************************************
LauncherApplication::LauncherApplication() : parent(), xfer(), quitRPC(),
keepAliveRPC(), launchRPC(), portMap(), childOutput()
keepAliveRPC(), launchRPC(), childOutput()
{
quitExecutor = 0;
keepAliveExecutor = 0;
......@@ -354,40 +351,6 @@ LauncherApplication::Execute(int *argc, char **argv[])
MainLoop();
}
// ****************************************************************************
// Method: LauncherApplication::FillPortMap
//
// Purpose:
// Processes the -portmap command line argument.
//
// Arguments:
// argc : The number of command line arguments.
// argv : The command line arguments.
//
// Programmer: Brad Whitlock
// Creation: Mon Apr 27 16:25:34 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
LauncherApplication::FillPortMap(const std::string &arg)
{
portMap.clear();
stringVector v = SplitValues(arg, ',');
for(int i = 0; i < v.size(); ++i)
{
int p0, p1;
if(sscanf(v[i].c_str(), "%d:%d", &p0, &p1) == 2)
{
debug1 << "Port map: " << p0 << " maps to viewer's port " << p1 << endl;
portMap[p0] = p1;
}
}
}
// ****************************************************************************
// Method: LauncherApplication::ProcessArguments
//
......@@ -406,9 +369,6 @@ LauncherApplication::FillPortMap(const std::string &arg)
// Added detection of the SSH tunneling argument. This is how
// the client tells us the SSH port forwarding is in effect.
//
// Brad Whitlock, Mon Apr 27 16:25:34 PST 2009
// I added code to populate portMap.
//
// ****************************************************************************
void
......@@ -430,11 +390,6 @@ LauncherApplication::ProcessArguments(int *argcp, char **argvp[])
{
useSSHTunneling = true;
}
else if (arg == "-portmap")
{
FillPortMap(argv[i+1]);
++i;
}
}
}
......@@ -790,8 +745,8 @@ LauncherApplication::ProcessInput()
// Backing out SSH tunneling on Panther (MacOS X 10.3)
//
// Brad Whitlock, Mon Apr 27 16:31:23 PST 2009
// I added code to map oldlocalport which often comes unaltered from the
// viewer. We use the tunnelled port map to determine its real port number.
// I changed the routine so the check for setting up the bridge is passed
// in rather than calculated in here from launch arguments.
//
// ****************************************************************************
#if defined(PANTHERHACK)
......@@ -799,7 +754,7 @@ LauncherApplication::ProcessInput()
#else
void
LauncherApplication::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs,
bool doBridge, bool mapPort)
bool doBridge)
{
const char *mName="LauncherApplication::SetupGatewaySocketBridgeIfNeeded: ";
......@@ -857,10 +812,7 @@ LauncherApplication::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs,
// fork and start the socket bridge
int *ports = new int[2];
ports[0] = newlocalport;
if(mapPort && portMap.find(oldlocalport) != portMap.end())
ports[1] = portMap[oldlocalport];
else
ports[1] = oldlocalport;
ports[1] = oldlocalport;
#ifdef _WIN32
_beginthread(CreateSocketBridge, 0, (void*)ports);
#else
......@@ -958,7 +910,7 @@ LauncherApplication::LaunchProcess(const stringVector &origLaunchArgs)
}
}
bool doBridge = launching_parallel && launching_engine;
SetupGatewaySocketBridgeIfNeeded(launchArgs, doBridge, false/*right?*/);
SetupGatewaySocketBridgeIfNeeded(launchArgs, doBridge);
#endif
std::string remoteProgram(launchArgs[0]);
......@@ -1201,7 +1153,7 @@ LauncherApplication::ConnectSimulation(const stringVector &origLaunchArgs,
// launching a parallel engine. SSH port forwarding
// is typically restricted to forwarding from localhost
// which doesn't work if we're on a compute node.
SetupGatewaySocketBridgeIfNeeded(launchArgs, true, true);
SetupGatewaySocketBridgeIfNeeded(launchArgs, true);
debug1 << mName << "AFTER Socket Bridge: launchArgs={";
for(int i = 0; i < launchArgs.size(); ++i)
......
......@@ -83,7 +83,7 @@
// Added support for forwarding child process output to the client.
//
// Brad Whitlock, Mon Apr 27 16:25:34 PST 2009
// I added portMap so we can use it to tunnel simulation data connections.
// I changed the code so we can tunnel simulation data connections.
//
// ****************************************************************************
......@@ -110,8 +110,7 @@ protected:
void TerminateConnectionRequest(int, char **);
#else
void TerminateConnectionRequest(int, char **);
void SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs, bool, bool);
void FillPortMap(const std::string &arg);
void SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs, bool);
#endif
static void AlarmHandler(int);
static void DeadChildHandler(int);
......@@ -132,7 +131,6 @@ private:
RPCExecutor<LaunchRPC> *launchExecutor;
RPCExecutor<ConnectSimRPC> *connectSimExecutor;
std::map<int,int> portMap;
bool useSSHTunneling;
bool keepGoing;
int timeout;
......
......@@ -660,6 +660,9 @@ ViewerEngineManager::CreateEngine(const EngineKey &ek,
// Brad Whitlock, Tue Apr 29 13:23:21 PDT 2008
// Support for internationalization.
//
// Brad Whitlock, Tue Apr 28 09:32:04 PDT 2009
// Pass the SSH tunneling option to the launcher callback.
//
// ****************************************************************************
bool
......@@ -726,7 +729,8 @@ ViewerEngineManager::ConnectSim(const EngineKey &ek,
//
typedef struct {
string h; int p; string k;
ViewerConnectionProgressDialog *d;} SimData;
ViewerConnectionProgressDialog *d;
bool tunnel;} SimData;
SimData simData;
// The windows compiler can't accept non aggregate types in an
// initializer list so initialize them like this:
......@@ -734,6 +738,7 @@ ViewerEngineManager::ConnectSim(const EngineKey &ek,
simData.p = simPort;
simData.k = simSecurityKey;
simData.d = SetupConnectionProgressWindow(newEngine.proxy, ek.HostName());
GetSSHTunnelOptions(ek.HostName(), simData.tunnel);
newEngine.proxy->Create(ek.HostName(), chd, clientHostName,
manualSSHPort, sshPort, useTunneling,
......
......@@ -58,6 +58,7 @@
#include <DebugStream.h>
#include <avtCallback.h>
#include <Utility.h>
//
// Global variables.
......@@ -944,7 +945,8 @@ ViewerServerManager::SimConnectThroughLauncher(const std::string &remoteHost,
// progress window.
typedef struct {
string h; int p; string k;
ViewerConnectionProgressDialog *d;} SimData;
ViewerConnectionProgressDialog *d;
bool tunnel;} SimData;
SimData *simData = (SimData*)data;
// Search the args list and see if we've supplied the path to
......@@ -967,7 +969,12 @@ ViewerServerManager::SimConnectThroughLauncher(const std::string &remoteHost,
cancelled = true;
else
{
launchers[remoteHost].launcher->ConnectSimulation(args,
// If we're doing SSH tunneling, change the arguments here.
stringVector args2(args);
if(simData->tunnel)
ConvertArgsToTunneledValues(GetPortTunnelMap(remoteHost), args2);
launchers[remoteHost].launcher->ConnectSimulation(args2,
simData->h, simData->p, simData->k);
// Indicate success.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment