/******************************************************************************* * * Name: GetConnectionParameters * * Purpose: Receive the command line to be used to initialize the VisIt engine. * * Author: Jeremy Meredith, B Division, Lawrence Livermore National Laboratory * * Modifications: * *******************************************************************************/ static int GetConnectionParameters(int desc) { char buf[2000] = ""; char *tmpbuf; char *nxtbuf; int i; engine_argv = (char**)malloc(sizeof(char*) * 100); if (parallelRank == 0) { /* Receive the ARGV over the socket */ engine_argc = 0; tmpbuf = buf; while (1) { nxtbuf = ReceiveContinuousLineFromSocket(tmpbuf, 2000, desc); if (strlen(tmpbuf) == 0) break; engine_argv[engine_argc] = strdup(tmpbuf); engine_argc++; tmpbuf = nxtbuf; } /* Broadcast them to the other processors if needed */ if (isParallel) { BroadcastInt(&engine_argc, 0); for (i = 0 ; i < engine_argc; i++) { int len = strlen(engine_argv[i]); BroadcastInt(&len, 0); BroadcastString(engine_argv[i], len+1, 0); } } } else { /* Receive the ARGV */ BroadcastInt(&engine_argc, 0); for (i = 0 ; i < engine_argc; i++) { int len; BroadcastInt(&len, 0); BroadcastString(buf, len+1, 0); engine_argv[i] = strdup(buf); } } return TRUE; }
/******************************************************************************* * * Name: VerifySecurityKeys * * Purpose: Receive a security key over the socket and compare it to ours, * sending the result of the comparison back to the client. * * Author: Jeremy Meredith, B Division, Lawrence Livermore National Laboratory * * Modifications: * *******************************************************************************/ static int VerifySecurityKeys(int desc) { int securityKeyLen; int offeredKeyLen; char offeredKey[2000] = ""; if (parallelRank == 0) { /* The first thing the VCL sends is the key */ ReceiveSingleLineFromSocket(offeredKey, 2000, desc); if (isParallel) { /* Broadcast the known key */ securityKeyLen = strlen(securityKey); BroadcastInt(&securityKeyLen, 0); BroadcastString(securityKey, securityKeyLen+1, 0); /* Broadcast the received key */ offeredKeyLen = strlen(offeredKey); BroadcastInt(&offeredKeyLen, 0); BroadcastString(offeredKey, offeredKeyLen+1, 0); } /* Make sure the keys match, and send a response */ if (strcmp(securityKey, offeredKey) != 0) { SendStringOverSocket("failure\n", desc); return FALSE; } else { SendStringOverSocket("success\n", desc); } } else { /* Receive the security keys and make sure they match */ BroadcastInt(&securityKeyLen, 0); BroadcastString(securityKey, securityKeyLen+1, 0); BroadcastInt(&offeredKeyLen, 0); BroadcastString(offeredKey, offeredKeyLen+1, 0); if (strcmp(securityKey, offeredKey) != 0) { /* Error: keys didn't match */ return FALSE; } } return TRUE; }
void SimEngineManager::ReadDataObjectString(avtDataObjectReader_p rdr, SimEngineManager::DOString &dos) { #if defined(PARALLEL) && defined(TEMPORARILY_FORCE_SAME_DATA_IN_VIEWER) BroadcastInt(dos.size); if(!PAR_UIProcess()) dos.buffer = new char[dos.size]; MPI_Bcast(dos.buffer, dos.size, MPI_CHAR, 0, VISIT_MPI_COMM); #endif rdr->Read(dos.size, dos.buffer); }