Commit 25ff2aec authored by hkrishna's avatar hkrishna

Updates to PySide and PyQt infrastructure, added remote connecting capability,...

Updates to PySide and PyQt infrastructure, added remote connecting capability, and modifications to make UV-CDAT work

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@19411 18c085ea-50e0-402c-830e-de6fd14e8384
parent bfa71de6
......@@ -50,27 +50,29 @@ ELSE (WIN32)
MESSAGE(STATUS "Installing R directory ${VISIT_INSTALLED_VERSION_LIB}")
#copy to dev branch..
FILE(COPY ${VISIT_R_DIR}
DESTINATION ${CMAKE_BINARY_DIR}/lib/r_support/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
#set up installation..
INSTALL(DIRECTORY ${VISIT_R_DIR}
DESTINATION ${VISIT_INSTALLED_VERSION_LIB}/r_support/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel)
IF(VISIT_R_SKIP_INSTALL)
MESSAGE("Skipping installation of R libraries")
ELSE(VISIT_R_SKIP_INSTALL)
FILE(COPY ${VISIT_R_DIR}
DESTINATION ${CMAKE_BINARY_DIR}/lib/r_support/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
#set up installation..
INSTALL(DIRECTORY ${VISIT_R_DIR}
DESTINATION ${VISIT_INSTALLED_VERSION_LIB}/r_support/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
CONFIGURATIONS "";None;Debug;Release;RelWithDebInfo;MinSizeRel)
ENDIF(VISIT_R_SKIP_INSTALL)
ENDIF (WIN32)
SET(HAVE_LIB_R 1)
......@@ -78,11 +78,15 @@ INCLUDE(${VISIT_SOURCE_DIR}/CMake/ThirdPartyInstallLibrary.cmake)
# We rely on FindVTK to set it to the right value.
SET(VTK_USE_MANGLED_MESA OFF CACHE INTERNAL "Set a cache variable that FindVTK can override")
IF(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
SET(VTK_DIR ${VISIT_VTK_DIR}/lib/vtk-5.8)
ELSE(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
SET(VTK_DIR ${VISIT_VTK_DIR}/lib)
ENDIF(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
IF(EXISTS ${VISIT_VTK_DIR}/VTKConfig.cmake)
SET(VTK_DIR ${VISIT_VTK_DIR})
ELSE(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.10)
IF(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
SET(VTK_DIR ${VISIT_VTK_DIR}/lib/vtk-5.8)
ELSE(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
SET(VTK_DIR ${VISIT_VTK_DIR}/lib)
ENDIF(EXISTS ${VISIT_VTK_DIR}/lib/vtk-5.8)
ENDIF(EXISTS ${VISIT_VTK_DIR}/VTKConfig.cmake)
MESSAGE(STATUS "Checking for VTK in ${VTK_DIR}")
INCLUDE(${CMAKE_ROOT}/Modules/FindVTK.cmake)
......
......@@ -1622,9 +1622,17 @@ ENDIF(VISIT_STATIC)
# Override the OPENGL_glu_LIBRARY returned by CMake on the Mac because the
# AGL framework does NOT contain gluTess functions. We want to instead use
# Mesa's GLU functions.
IF(APPLE AND NOT VISIT_DBIO_ONLY)
SET(OPENGL_glu_LIBRARY ${MESA_LIBRARY_DIR}/libMesaGLU${VISIT_PLUGIN_EXTENSION} CACHE INTERNAL "AGL lib for OSX")
ENDIF(APPLE AND NOT VISIT_DBIO_ONLY)
IF(VISIT_MESA_DIR)
IF(APPLE AND NOT VISIT_DBIO_ONLY)
SET(OPENGL_glu_LIBRARY ${MESA_LIBRARY_DIR}/libMesaGLU${VISIT_PLUGIN_EXTENSION} CACHE INTERNAL "AGL lib for OSX")
ENDIF(APPLE AND NOT VISIT_DBIO_ONLY)
ENDIF(VISIT_MESA_DIR)
# We use libGLU for its tessellation abilities but it requires libGL sometimes.
IF(UNIX AND NOT APPLE)
SET(TESSELLATION_LIBRARY ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
ELSE(UNIX AND NOT APPLE)
SET(TESSELLATION_LIBRARY ${OPENGL_glu_LIBRARY})
ENDIF(UNIX AND NOT APPLE)
# Check for type sizes, endian
SET(SIZEOF_BOOLEAN ${CMAKE_SIZEOF_BOOLEAN})
......
......@@ -50,7 +50,8 @@
#include <vtkPPMWriter.h>
#include <vtkRGBWriter.h>
#include <vtkPNGWriter.h>
#include <vtkUnsignedCharArray.h>
#include <vtkBase64Utilities.h>
#include <DebugStream.h>
......@@ -344,3 +345,59 @@ avtImageFileWriter::CreateFilename(const char *base, bool family,
return str;
}
// ****************************************************************************
// Method: avtImageFileWriter::WriteToString
//
// Purpose:
// Writes image to byte array
//
// Arguments:
//
// Returns: string representation of image. Memory needs to be freed by the
// calling function.
//
//
// Programmer: Hari Krishnan
// Creation: October 13, 2012
//
// Modifications:
// ****************************************************************************
const char*
avtImageFileWriter::WriteToByteArray(avtImageRepresentation &imagerep,
int quality,
bool progressive,
size_t &len)
{
vtkJPEGWriter* writer = vtkJPEGWriter::New();
writer->SetWriteToMemory(true);
writer->SetInput(imagerep.GetImageVTK());
writer->SetQuality(quality);
writer->SetProgressive(progressive?1:0);
writer->Write();
vtkUnsignedCharArray* array = writer->GetResult();
char * result = NULL;
len = 0;
if(array)
{
vtkIdType size = array->GetSize();
if(size > 0)
{
len = size;
result = new char [len];
memcpy(result,array->GetVoidPointer(0),sizeof(char)*len);
}
}
writer->Delete();
return result;
}
......@@ -113,6 +113,10 @@ class AVTFILEWRITER_API avtImageFileWriter : public avtTerminatingImageSink
char *CreateFilename(const char *base, bool family,
ImageFileFormat format);
static const char* WriteToByteArray(avtImageRepresentation &imagerep,
int quality,
bool progressive,
size_t& len);
protected:
bool FileHasExtension(const char *filename, const char *ext)
const;
......
......@@ -47,6 +47,9 @@
#include <vtkAppendFilter.h>
#include <vtkDataSet.h>
#include <vtkDataSetWriter.h>
#include <vtkUnstructuredGrid.h>
#include <vtkAppendPolyData.h>
#include <vtkGeometryFilter.h>
#include <avtCommonDataFunctions.h>
#include <avtDataRepresentation.h>
......@@ -706,7 +709,7 @@ avtDataTree::GetNumberOfCells(int topoDim, bool polysOnly) const
}
// ****************************************************************************
// Method: avtDataTree::GetAllLeaves
// Method: avtDataTree::G
//
// Purpose:
// Returns as vtkDataSet * all leaves of this tree.
......@@ -1575,3 +1578,65 @@ avtDataTree::PruneTree(const string &label)
return PruneTree(sv);
}
// ****************************************************************************
// Method: avtDataTree::GetDataSetAsString
//
// Purpose:
// Returns DataSet As String with VTK Format
//
// Returns:
// The pruned tree.
//
// Arguments:
//
// Programmer: Hari Krishnan
// Creation: October 16, 2012
//
// Modifications:
//
// ****************************************************************************
std::string
avtDataTree::GetDatasetAsString()
{
int nLeaves = 0;
vtkDataSet **ds = GetAllLeaves(nLeaves);
if(nLeaves <= 0) return "";
// vtkDataSetWriter* writer = vtkDataSetWriter::New();
// writer->SetFileTypeToASCII();
// writer->WriteToOutputStringOn();
// writer->SetInput(ds[0]);
// writer->Write();
// std::string res = writer->GetOutputString();
// writer->Delete();
// return res;
vtkAppendFilter* vaf = vtkAppendFilter::New();
for(int i = 0; i < nLeaves; ++i)
vaf->AddInput(ds[i]);
vtkGeometryFilter* vu = vtkGeometryFilter::New();
vu->AddInput(vaf->GetOutput());
vtkDataSet* dataset = dynamic_cast<vtkDataSet*>(vu->GetOutput());
vtkDataSetWriter* writer = vtkDataSetWriter::New();
writer->SetFileTypeToASCII();
writer->WriteToOutputStringOn();
writer->SetInput(dataset);
writer->Write();
std::string res = writer->GetOutputString();
delete [] ds;
vaf->Delete();
vu->Delete();
writer->Delete();
return res;
}
......@@ -151,6 +151,7 @@ class PIPELINE_API avtDataTree
int GetNumberOfCells(int topoDim, bool polysOnly) const;
vtkDataSet *GetSingleLeaf(void);
std::string GetDatasetAsString();
int GetNumberOfLeaves(void);
void Merge(avtDataTree_p);
......
......@@ -717,4 +717,8 @@ avtDataset::RenumberDomainIDs(bool acrossAllProcs)
delete [] leaves;
}
std::string
avtDataset::GetDatasetAsString()
{
return dataTree->GetDatasetAsString();
}
......@@ -198,6 +198,7 @@ class PIPELINE_API avtDataset : public avtDataObject
void RenumberDomainIDs(bool acrossAllProcs = true);
virtual void DebugDump(avtWebpage *, const char *);
std::string GetDatasetAsString();
protected:
avtDataTree_p dataTree;
......
......@@ -71,6 +71,10 @@ Colleagues/avtText2DColleague.C
Colleagues/avtText3DColleague.C
Colleagues/avtTimeSliderColleague.C
)
IF(APPLE)
SET(COLLEAGUES_SOURCES ${COLLEAGUES_SOURCES} Colleagues/VisWinRenderingCocoaHideWindow.mm)
ENDIF(APPLE)
IF (NOT WIN32)
IF(MESA_FOUND)
SET_SOURCE_FILES_PROPERTIES(
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef VISWINRENDERINGCOCOAHIDEWINDOW_H
#define VISWINRENDERINGCOCOAHIDEWINDOW_H
// ****************************************************************************
// Class: VisWinRenderingCocoa
//
// Purpose:
// Hides the render window when the engines render window is not OSMesa
//
// Programmer: Hari Krishnan
// Creation: December 13, 2007
//
// Modifications:
//
// ****************************************************************************
class VisWinRenderingCocoa
{
public:
static void HideRenderWindow(void* window);
};
#endif
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VisWinRenderingCocoaHideWindow.h"
void
VisWinRenderingCocoa::HideRenderWindow(void* w)
{
NSWindow* window = (NSWindow*) w;
/// hide the window
[window orderOut:0];
}
......@@ -46,6 +46,26 @@
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#if __APPLE__
#include <vtkCocoaRenderWindow.h>
#include "VisWinRenderingCocoaHideWindow.h"
void UnMapWindow(vtkRenderWindow* v)
{
vtkCocoaRenderWindow* vx=dynamic_cast<vtkCocoaRenderWindow*>(v);
if(vx) VisWinRenderingCocoa::HideRenderWindow(vx->GetRootWindow());
}
#elif __unix__
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <vtkXOpenGLRenderWindow.h>
void UnMapWindow(vtkRenderWindow* v)
{
vtkXOpenGLRenderWindow* vx = dynamic_cast<vtkXOpenGLRenderWindow*>(v);
if(vx) XUnmapWindow(vx->GetDisplayId(),vx->GetWindowId());
}
#else //Windows does not show window OffScreenRenderingMode
void UnMapWindow(vtkRenderWindow* v) { /*do nothing..*/ }
#endif
// ****************************************************************************
// Method: VisWinRenderingWithoutWindow constructor
......@@ -73,7 +93,8 @@ VisWinRenderingWithoutWindow::VisWinRenderingWithoutWindow(
// Mesa that we are getting, but we don't care.
//
renWin = vtkRenderWindow::New();
renWin->OffScreenRenderingOn();
if(std::string(renWin->GetClassName()) == "vtkOSOpenGLRenderWindow")
renWin->OffScreenRenderingOn();
InitializeRenderWindow(renWin);
}
......@@ -140,6 +161,14 @@ VisWinRenderingWithoutWindow::RealizeRenderWindow(void)
// shouldn't be as heavy as it looks at first glance.
renWin->SetSize(300,300);
renWin->Render();
/// HKTODO: Verify this solution is robust
/// If not Mesa-based Offscreen rendering: the other
/// versions seem to popup an empty window, the UnMap logic
/// hides this Window, unfortunately without this window
/// the software rendering on Linux does not work
std::string cname = renWin->GetClassName();
if(cname != "vtkOSOpenGLRenderWindow") UnMapWindow(renWin);
}
// ****************************************************************************
......
......@@ -19,8 +19,13 @@ $0 = shift @ARGV;
# Due to the above "magic", we have to alter sys.argv
import os
import sys
_visitfelpython = sys.argv[0]
try:
os.unlink(_visitfelpython)
except:
pass
sys.argv = sys.argv[1:]
###############################################################################
......
......@@ -306,6 +306,7 @@ state/WindowAttributes.C
state/WindowInformation.C
state/Xfer.C
state/XMLNode.C
state/JSONNode.C
)
SET(UTILITY_SOURCES
......
......@@ -152,10 +152,11 @@ CommunicationHeader::WriteHeader(Connection *conn, const std::string &version,
// The first 4 bytes of the header are for the type representation.
TypeRepresentation localRep;
buffer[0] = localRep.IntFormat;
buffer[1] = localRep.LongFormat;
buffer[2] = localRep.FloatFormat;
buffer[3] = localRep.DoubleFormat;
buffer[0] = localRep.Format;
buffer[1] = localRep.IntFormat;
buffer[2] = localRep.LongFormat;
buffer[3] = localRep.FloatFormat;
buffer[4] = localRep.DoubleFormat;
// Set the failure code
// 0 : no failure
......@@ -164,16 +165,16 @@ CommunicationHeader::WriteHeader(Connection *conn, const std::string &version,
// 3 : CouldNotConnectException
// 4 : CancelledConnectException
//
buffer[4] = (failCode >= 0 && failCode < 5) ? ((unsigned char)failCode) : 3;
buffer[5] = (failCode >= 0 && failCode < 5) ? ((unsigned char)failCode) : 3;
// The next 10 bytes are for a NULL terminated version string.
strncpy((char *)(buffer+5), version.c_str(), 10);
strncpy((char *)(buffer+6), version.c_str(), 10);
// The next 21 bytes are for securityKey.
strncpy((char *)(buffer+5+10), securityKey.c_str(), 21);
strncpy((char *)(buffer+6+10), securityKey.c_str(), 21);
// The next 21 bytes are for socketKey.
strncpy((char *)(buffer+5+10+21), socketKey.c_str(), 21);
strncpy((char *)(buffer+6+10+21), socketKey.c_str(), 21);
#ifdef DEBUG_COMMUNICATION_HEADER
debug1 << "CommunicationHeader::WriteHeader: HEADER={";
......@@ -192,7 +193,7 @@ CommunicationHeader::WriteHeader(Connection *conn, const std::string &version,
// The rest of the bytes are reserved for future use.
// Write the message header to the file descriptor.
conn->DirectWrite(buffer, BUFFER_SIZE);
conn->WriteHeader(buffer, BUFFER_SIZE);
}
// ****************************************************************************
......@@ -238,13 +239,14 @@ CommunicationHeader::ReadHeader(Connection *conn, const std::string &version,
memset(buffer, 0, BUFFER_SIZE);
// Write the message header using the file descriptor.
conn->DirectRead(buffer, BUFFER_SIZE);
conn->ReadHeader(buffer, BUFFER_SIZE);
// Fill the local type representation "rep".
rep.IntFormat = buffer[0];
rep.LongFormat = buffer[1];
rep.FloatFormat = buffer[2];
rep.DoubleFormat = buffer[3];
rep.Format = buffer[0];
rep.IntFormat = buffer[1];
rep.LongFormat = buffer[2];
rep.FloatFormat = buffer[3];
rep.DoubleFormat = buffer[4];
#ifdef DEBUG_COMMUNICATION_HEADER
debug1 << "CommunicationHeader::ReadHeader: HEADER={";
......@@ -261,27 +263,27 @@ CommunicationHeader::ReadHeader(Connection *conn, const std::string &version,
#endif
// Check to see if the version numbers are compatible.
if(!VisItVersionsCompatible((const char *)(buffer+5), version.c_str()))
if(!VisItVersionsCompatible((const char *)(buffer+6), version.c_str()))
{
debug1 << "Versions are " << buffer << "(" << buffer+5 << "),"
debug1 << "Versions are " << buffer << "(" << buffer+6 << "),"
<< version << endl;
EXCEPTION0(IncompatibleVersionException);
}
// Check to see if any failure codes are set.
if(buffer[4] == 1)
if(buffer[5] == 1)
{
EXCEPTION0(IncompatibleVersionException);
}
else if(buffer[4] == 2)
else if(buffer[5] == 2)
{
EXCEPTION0(IncompatibleSecurityTokenException);
}
else if(buffer[4] == 3)
else if(buffer[5] == 3)
{
EXCEPTION0(CouldNotConnectException);
}
else if(buffer[4] == 4)
else if(buffer[5] == 4)
{
EXCEPTION0(CancelledConnectException);
}
......@@ -290,14 +292,14 @@ CommunicationHeader::ReadHeader(Connection *conn, const std::string &version,
// the same as the keys that were sent to the client.
if(checkKeys)
{
if((strcmp((const char *)(buffer+5+10), securityKey.c_str()) != 0) ||
(strcmp((const char *)(buffer+5+10+21), socketKey.c_str()) != 0))
if((strcmp((const char *)(buffer+6+10), securityKey.c_str()) != 0) ||
(strcmp((const char *)(buffer+6+10+21), socketKey.c_str()) != 0))
{
EXCEPTION0(IncompatibleSecurityTokenException);
}
}
securityKey = std::string((const char *)(buffer+5+10));
socketKey = std::string((const char *)(buffer+5+10+21));
securityKey = std::string((const char *)(buffer+6+10));
socketKey = std::string((const char *)(buffer+6+10+21));
#ifdef DEBUG_COMMUNICATION_HEADER
debug1 << "CommunicationHeader::ReadHeader: securityKey=" << securityKey.c_str() << endl;
......
......@@ -39,10 +39,30 @@
#include <visit-config.h>
#include <convert.h>
#include <Connection.h>
#include <AttributeSubject.h>
const bool Connection::SRC = false;
const bool Connection::DEST = true;
long Connection::ReadHeader(unsigned char *buf, long len)
{
return DirectRead(buf,len);
}
long Connection::WriteHeader(const unsigned char *buf, long len)
{
return DirectWrite(buf,len);
}
void Connection::Flush(AttributeSubject *subject)
{
// Write out the subject's guido and message size.
WriteInt(subject->GetGuido());
int sz = subject->CalculateMessageSize(*this);
WriteInt(sz);
subject->Write(*this);
Flush();
}
// *******************************************************************
// Method: Connection::Connection
//
......
......@@ -65,7 +65,7 @@
// I added convenience methods for reading/writing string.
//
// ****************************************************************************
class AttributeSubject;
class COMM_API Connection
{
public:
......@@ -78,7 +78,7 @@ public:
virtual int Fill() = 0;
virtual void Flush() = 0;
virtual long Size() = 0;
virtual void Flush(AttributeSubject*);
// These read or write a byte to whatever we're using
// as the connection.
virtual void Write(unsigned char value) = 0;
......@@ -86,8 +86,10 @@ public:
virtual void Append(const unsigned char *buf, int count) = 0;
virtual long DirectRead(unsigned char *buf, long len) = 0;
virtual long DirectWrite(const unsigned char *buf, long len) = 0;
virtual bool NeedsRead(bool = false) const { return true; };
virtual int GetDescriptor() const { return -1; };
virtual long ReadHeader(unsigned char *buf, long len);
virtual long WriteHeader(const unsigned char *buf, long len);
virtual bool NeedsRead(bool = false) const { return true; }
virtual int GetDescriptor() const { return -1; }
// These methods call the Write method after handling conversion issues.
void WriteChar(unsigned char c);
......@@ -97,7 +99,6 @@ public:
void WriteFloat(float val);
void WriteDouble(double val);
void WriteString(const std::string &);
// We should be able to read into a variable without conversion
// since conversion takes place on writes to the connection.
void ReadChar(unsigned char *c);
......
......@@ -65,6 +65,7 @@ FileConnection::FileConnection(const char *filename, bool writeMode_) :
fileStream = fopen(filename, "wb");