version 1.3, 2005/01/16 01:52:55
|
version 1.14, 2008/08/28 17:24:36
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; | // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================== |
//============================================================================= |
// | // |
// Author: Carol Ann Krug Graves, Hewlett-Packard Company |
//%//////////////////////////////////////////////////////////////////////////// |
// (carolann_graves@hp.com) |
|
// |
|
// Modified By: David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// |
|
| |
#include <Pegasus/Common/CIMMessageSerializer.h> | #include <Pegasus/Common/CIMMessageSerializer.h> |
#include <Pegasus/Common/CIMMessageDeserializer.h> | #include <Pegasus/Common/CIMMessageDeserializer.h> |
|
|
#if defined (PEGASUS_OS_TYPE_WINDOWS) | #if defined (PEGASUS_OS_TYPE_WINDOWS) |
# include "AnonymousPipeWindows.cpp" | # include "AnonymousPipeWindows.cpp" |
#elif defined (PEGASUS_OS_TYPE_UNIX) | #elif defined (PEGASUS_OS_TYPE_UNIX) |
# include "AnonymousPipeUnix.cpp" |
# include "AnonymousPipePOSIX.cpp" |
|
#elif defined (PEGASUS_OS_VMS) |
|
# include "AnonymousPipePOSIX.cpp" |
#else | #else |
# error "Unsupported platform" | # error "Unsupported platform" |
#endif | #endif |
|
|
// | // |
// Serialize the request | // Serialize the request |
// | // |
Array<char> messageBuffer; |
Buffer messageBuffer; |
messageBuffer.reserveCapacity (4096); | messageBuffer.reserveCapacity (4096); |
try | try |
{ | { |
|
|
} | } |
catch (Exception & e) | catch (Exception & e) |
{ | { |
PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE((TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
"Failed to serialize message: " + e.getMessage ()); |
"Failed to serialize message: %s", |
|
(const char*)e.getMessage().getCString())); |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
throw; | throw; |
} | } |
|
|
// | // |
// Write the serialized message to the pipe | // Write the serialized message to the pipe |
// | // |
Status writeStatus; |
|
try |
|
{ |
|
Uint32 messageLength = messageBuffer.size (); | Uint32 messageLength = messageBuffer.size (); |
const char * messageData = messageBuffer.getData (); | const char * messageData = messageBuffer.getData (); |
| |
writeStatus = writeBuffer ((const char *) &messageLength, |
Status writeStatus = |
sizeof (Uint32)); |
writeBuffer((const char*) &messageLength, sizeof(Uint32)); |
| |
if (writeStatus == STATUS_SUCCESS) | if (writeStatus == STATUS_SUCCESS) |
{ | { |
writeStatus = writeBuffer (messageBuffer.getData (), |
writeStatus = writeBuffer(messageData, messageLength); |
messageLength); |
|
} |
|
} |
|
catch (...) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} | } |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
|
|
// | // |
// De-serialization failed | // De-serialization failed |
// | // |
PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE ((TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
"Failed to de-serialize message: " + e.getMessage ()); |
"Failed to de-serialize message: %s", |
|
(const char*)e.getMessage().getCString())); |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
throw; | throw; |
} | } |