version 1.1, 2008/11/25 19:27:27
|
version 1.19, 2013/10/15 18:43:44
|
|
|
//%2006//////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Licensed to The Open Group (TOG) under one or more contributor license |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
// this work for additional information regarding copyright ownership. |
// IBM Corp.; EMC Corporation, The Open Group. |
// Each contributor licenses this file to you under the OpenPegasus Open |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// Source License; you may not use this file except in compliance with the |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// License. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// |
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// copy of this software and associated documentation files (the "Software"), |
// EMC Corporation; Symantec Corporation; The Open Group. |
// to deal in the Software without restriction, including without limitation |
// |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// and/or sell copies of the Software, and to permit persons to whom the |
// of this software and associated documentation files (the "Software"), to |
// Software is furnished to do so, subject to the following conditions: |
// deal in the Software without restriction, including without limitation the |
// |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// The above copyright notice and this permission notice shall be included |
// sell copies of the Software, and to permit persons to whom the Software is |
// in all copies or substantial portions of the Software. |
// furnished to do so, subject to the following conditions: |
// |
// |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// 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. |
|
// | // |
//============================================================================== |
////////////////////////////////////////////////////////////////////////// |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
OP_DeleteQualifier, | OP_DeleteQualifier, |
OP_EnumerateQualifiers, | OP_EnumerateQualifiers, |
OP_InvokeMethod, | OP_InvokeMethod, |
OP_Count, |
OP_Count |
}; |
|
|
|
struct CIMBufferReleaser |
|
{ |
|
CIMBufferReleaser(CIMBuffer& buf) : _buf(buf) |
|
{ |
|
} |
|
|
|
~CIMBufferReleaser() |
|
{ |
|
_buf.release(); |
|
} |
|
|
|
private: |
|
CIMBuffer& _buf; |
|
}; | }; |
| |
static Operation _NameToOp(const CIMName& name) | static Operation _NameToOp(const CIMName& name) |
|
|
| |
Uint32 flags = 0; | Uint32 flags = 0; |
| |
if (msg->localOnly) |
|
flags |= LOCAL_ONLY; |
|
|
|
if (msg->deepInheritance) | if (msg->deepInheritance) |
flags |= DEEP_INHERITANCE; | flags |= DEEP_INHERITANCE; |
| |
|
|
STAT_GETSTARTTIME | STAT_GETSTARTTIME |
| |
Boolean deepInheritance = flags & DEEP_INHERITANCE; | Boolean deepInheritance = flags & DEEP_INHERITANCE; |
|
#ifndef PEGASUS_DISABLE_INSTANCE_QUALIFIERS |
Boolean includeQualifiers = flags & INCLUDE_QUALIFIERS; | Boolean includeQualifiers = flags & INCLUDE_QUALIFIERS; |
|
#endif |
Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; | Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; |
| |
// [NAMESPACE] | // [NAMESPACE] |
|
|
nameSpace, | nameSpace, |
className, | className, |
deepInheritance, | deepInheritance, |
false, // Bug 1985 localOnly is deprecated |
|
#ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS | #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS |
false, | false, |
#else | #else |
|
|
| |
static void _encodeEnumerateInstancesResponseBody( | static void _encodeEnumerateInstancesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMEnumerateInstancesResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) |
CIMName& name, |
|
bool isFirst) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
| |
static const CIMName NAME("EnumerateInstances"); | static const CIMName NAME("EnumerateInstances"); |
name = NAME; | name = NAME; |
| |
if (msg->resolveCallback && msg->binaryEncoding) |
// Only write the property list on the first provider response |
|
if (isFirst) |
{ | { |
const Array<Uint8>& data = msg->binaryData; |
// [PROPERTY-LIST] |
out.putBytes((char*)data.getData(), data.size()); |
out.putPropertyList(data.getPropertyList()); |
} |
|
else |
|
{ |
|
out.putInstanceA(msg->getNamedInstances(), false); |
|
} | } |
|
data.encodeBinaryResponse(out); |
} | } |
| |
static CIMEnumerateInstancesResponseMessage* _decodeEnumerateInstancesResponse( | static CIMEnumerateInstancesResponseMessage* _decodeEnumerateInstancesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
|
Array<CIMInstance> instances; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMInstance> tmp; |
|
|
|
if (!in.getInstanceA(tmp)) |
|
return 0; |
|
|
|
instances.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMEnumerateInstancesResponseMessage* msg; | CIMEnumerateInstancesResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
msg->setNamedInstances(instances); |
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
|
|
// [PROPERTY-LIST] |
|
CIMPropertyList propertyList; |
|
if (!in.getPropertyList(propertyList)) |
|
{ |
|
return 0; |
|
} |
|
responseData.setPropertyList(propertyList); |
|
|
|
responseData.setRemainingBinaryData(in); |
|
|
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
} | } |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
STAT_GETSTARTTIME | STAT_GETSTARTTIME |
|
|
static CIMEnumerateInstanceNamesResponseMessage* | static CIMEnumerateInstanceNamesResponseMessage* |
_decodeEnumerateInstanceNamesResponse( | _decodeEnumerateInstanceNamesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
Array<CIMObjectPath> instanceNames; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObjectPath> tmp; |
|
|
|
if (!in.getObjectPathA(tmp)) |
|
return 0; |
|
|
|
instanceNames.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMEnumerateInstanceNamesResponseMessage* msg; | CIMEnumerateInstanceNamesResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMEnumerateInstanceNamesResponseMessage( | msg = new CIMEnumerateInstanceNamesResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
instanceNames); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getInstanceNames, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
|
|
| |
static void _encodeEnumerateInstanceNamesResponseBody( | static void _encodeEnumerateInstanceNamesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMEnumerateInstanceNamesResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
static const CIMName NAME("EnumerateInstanceNames"); | static const CIMName NAME("EnumerateInstanceNames"); |
name = NAME; | name = NAME; |
| |
out.putObjectPathA(msg->instanceNames, false); |
data.encodeBinaryResponse(out); |
} | } |
| |
//============================================================================== | //============================================================================== |
|
|
STAT_GETSTARTTIME | STAT_GETSTARTTIME |
| |
// [FLAGS] | // [FLAGS] |
|
#ifndef PEGASUS_DISABLE_INSTANCE_QUALIFIERS |
Boolean includeQualifiers = flags & INCLUDE_QUALIFIERS; | Boolean includeQualifiers = flags & INCLUDE_QUALIFIERS; |
|
#endif |
Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; | Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; |
| |
// [NAMESPACE] | // [NAMESPACE] |
|
|
messageId, | messageId, |
nameSpace, | nameSpace, |
instanceName, | instanceName, |
false, // Bug 1985 localOnly is deprecated |
|
#ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS | #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS |
false, | false, |
#else | #else |
|
|
| |
static CIMGetInstanceResponseMessage* _decodeGetInstanceResponse( | static CIMGetInstanceResponseMessage* _decodeGetInstanceResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
CIMInstance instance; |
|
|
|
if (!in.getInstance(instance)) |
|
return 0; |
|
|
|
CIMGetInstanceResponseMessage* msg; | CIMGetInstanceResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
msg->setCimInstance(instance); |
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
|
|
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
} | } |
|
|
| |
Uint32 flags = 0; | Uint32 flags = 0; |
| |
if (msg->localOnly) |
|
flags |= LOCAL_ONLY; |
|
|
|
if (msg->includeQualifiers) | if (msg->includeQualifiers) |
flags |= INCLUDE_QUALIFIERS; | flags |= INCLUDE_QUALIFIERS; |
| |
|
|
| |
static void _encodeGetInstanceResponseBody( | static void _encodeGetInstanceResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMGetInstanceResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
static const CIMName NAME("GetInstance"); | static const CIMName NAME("GetInstance"); |
name = NAME; | name = NAME; |
| |
if (msg->resolveCallback && msg->binaryEncoding) |
data.encodeBinaryResponse(out); |
{ |
|
const Array<Uint8>& data = msg->binaryData; |
|
out.putBytes((char*)data.getData(), data.size()); |
|
} |
|
else |
|
{ |
|
out.putInstance(msg->getCimInstance(), false, false); |
|
} |
|
} | } |
| |
//============================================================================== | //============================================================================== |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
STAT_GETSTARTTIME | STAT_GETSTARTTIME |
|
|
| |
static CIMCreateInstanceResponseMessage* _decodeCreateInstanceResponse( | static CIMCreateInstanceResponseMessage* _decodeCreateInstanceResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
CIMObjectPath instanceName; | CIMObjectPath instanceName; |
|
|
} | } |
| |
static void _encodeModifyInstanceResponseBody( | static void _encodeModifyInstanceResponseBody( |
CIMBuffer& out, |
|
CIMModifyInstanceResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
| |
static CIMModifyInstanceResponseMessage* _decodeModifyInstanceResponse( | static CIMModifyInstanceResponseMessage* _decodeModifyInstanceResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeDeleteInstanceResponseBody( | static void _encodeDeleteInstanceResponseBody( |
CIMBuffer& out, |
|
CIMDeleteInstanceResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMDeleteInstanceResponseMessage* _decodeDeleteInstanceResponse( | static CIMDeleteInstanceResponseMessage* _decodeDeleteInstanceResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
| |
static void _encodeAssociatorsResponseBody( | static void _encodeAssociatorsResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMAssociatorsResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
static const CIMName NAME("Associators"); | static const CIMName NAME("Associators"); |
name = NAME; | name = NAME; |
| |
out.putObjectA(msg->cimObjects); |
|
|
data.encodeBinaryResponse(out); |
} | } |
| |
static CIMAssociatorsResponseMessage* _decodeAssociatorsResponse( | static CIMAssociatorsResponseMessage* _decodeAssociatorsResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
|
Array<CIMObject> cimObjects; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObject> tmp; |
|
|
|
if (!in.getObjectA(tmp)) |
|
return 0; |
|
|
|
cimObjects.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMAssociatorsResponseMessage* msg; | CIMAssociatorsResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMAssociatorsResponseMessage( | msg = new CIMAssociatorsResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
cimObjects); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static void _encodeAssociatorNamesResponseBody( | static void _encodeAssociatorNamesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMAssociatorNamesResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
| |
static const CIMName NAME("AssociatorNames"); | static const CIMName NAME("AssociatorNames"); |
name = NAME; | name = NAME; |
|
data.encodeBinaryResponse(out); |
out.putObjectPathA(msg->objectNames); |
|
} | } |
| |
static CIMAssociatorNamesResponseMessage* _decodeAssociatorNamesResponse( | static CIMAssociatorNamesResponseMessage* _decodeAssociatorNamesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
|
Array<CIMObjectPath> objectNames; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObjectPath> tmp; |
|
|
|
if (!in.getObjectPathA(tmp)) |
|
return 0; |
|
|
|
objectNames.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMAssociatorNamesResponseMessage* msg; | CIMAssociatorNamesResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMAssociatorNamesResponseMessage( | msg = new CIMAssociatorNamesResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
objectNames); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
|
|
| |
static void _encodeReferencesResponseBody( | static void _encodeReferencesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMReferencesResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
static const CIMName NAME("References"); | static const CIMName NAME("References"); |
name = NAME; | name = NAME; |
| |
out.putObjectA(msg->cimObjects); |
data.encodeBinaryResponse(out); |
} | } |
| |
static CIMReferencesResponseMessage* _decodeReferencesResponse( | static CIMReferencesResponseMessage* _decodeReferencesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
|
Array<CIMObject> cimObjects; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObject> tmp; |
|
|
|
if (!in.getObjectA(tmp)) |
|
{ |
|
return 0; |
|
} |
|
|
|
cimObjects.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMReferencesResponseMessage* msg; | CIMReferencesResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMReferencesResponseMessage( | msg = new CIMReferencesResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
cimObjects); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static void _encodeReferenceNamesResponseBody( | static void _encodeReferenceNamesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMReferenceNamesResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
| |
static const CIMName NAME("ReferenceNames"); | static const CIMName NAME("ReferenceNames"); |
name = NAME; | name = NAME; |
|
data.encodeBinaryResponse(out); |
out.putObjectPathA(msg->objectNames); |
|
} | } |
| |
static CIMReferenceNamesResponseMessage* _decodeReferenceNamesResponse( | static CIMReferenceNamesResponseMessage* _decodeReferenceNamesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
| |
Array<CIMObjectPath> objectNames; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObjectPath> tmp; |
|
|
|
if (!in.getObjectPathA(tmp)) |
|
return 0; |
|
|
|
objectNames.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMReferenceNamesResponseMessage* msg; | CIMReferenceNamesResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMReferenceNamesResponseMessage( | msg = new CIMReferenceNamesResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
objectNames); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
|
|
return msg; | return msg; |
} | } |
| |
|
|
| |
static CIMGetClassResponseMessage* _decodeGetClassResponse( | static CIMGetClassResponseMessage* _decodeGetClassResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
| |
static CIMEnumerateClassesResponseMessage* _decodeEnumerateClassesResponse( | static CIMEnumerateClassesResponseMessage* _decodeEnumerateClassesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
static CIMEnumerateClassNamesResponseMessage* | static CIMEnumerateClassNamesResponseMessage* |
_decodeEnumerateClassNamesResponse( | _decodeEnumerateClassNamesResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeCreateClassResponseBody( | static void _encodeCreateClassResponseBody( |
CIMBuffer& out, |
|
CIMCreateClassResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMCreateClassResponseMessage* _decodeCreateClassResponse( | static CIMCreateClassResponseMessage* _decodeCreateClassResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeDeleteClassResponseBody( | static void _encodeDeleteClassResponseBody( |
CIMBuffer& out, |
|
CIMDeleteClassResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMDeleteClassResponseMessage* _decodeDeleteClassResponse( | static CIMDeleteClassResponseMessage* _decodeDeleteClassResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeModifyClassResponseBody( | static void _encodeModifyClassResponseBody( |
CIMBuffer& out, |
|
CIMModifyClassResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMModifyClassResponseMessage* _decodeModifyClassResponse( | static CIMModifyClassResponseMessage* _decodeModifyClassResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeSetQualifierResponseBody( | static void _encodeSetQualifierResponseBody( |
CIMBuffer& out, |
|
CIMSetQualifierResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMSetQualifierResponseMessage* _decodeSetQualifierResponse( | static CIMSetQualifierResponseMessage* _decodeSetQualifierResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static CIMGetQualifierResponseMessage* _decodeGetQualifierResponse( | static CIMGetQualifierResponseMessage* _decodeGetQualifierResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeDeleteQualifierResponseBody( | static void _encodeDeleteQualifierResponseBody( |
CIMBuffer& out, |
|
CIMDeleteQualifierResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMDeleteQualifierResponseMessage* _decodeDeleteQualifierResponse( | static CIMDeleteQualifierResponseMessage* _decodeDeleteQualifierResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
static CIMEnumerateQualifiersResponseMessage* | static CIMEnumerateQualifiersResponseMessage* |
_decodeEnumerateQualifiersResponse( | _decodeEnumerateQualifiersResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static CIMGetPropertyResponseMessage* _decodeGetPropertyResponse( | static CIMGetPropertyResponseMessage* _decodeGetPropertyResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
} | } |
| |
static void _encodeSetPropertyResponseBody( | static void _encodeSetPropertyResponseBody( |
CIMBuffer& out, |
|
CIMSetPropertyResponseMessage* msg, |
|
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
} | } |
| |
static CIMSetPropertyResponseMessage* _decodeSetPropertyResponse( | static CIMSetPropertyResponseMessage* _decodeSetPropertyResponse( |
CIMBuffer& in, |
|
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static CIMInvokeMethodResponseMessage* _decodeInvokeMethodResponse( | static CIMInvokeMethodResponseMessage* _decodeInvokeMethodResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ | /* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
CIMBuffer& in, | CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId, | Uint32 returnQueueId, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Server/CIMOperationRequestDecoder.cpp */ | /* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
| |
static void _encodeExecQueryResponseBody( | static void _encodeExecQueryResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMExecQueryResponseMessage* msg, |
CIMResponseData& data, |
CIMName& name) | CIMName& name) |
{ | { |
/* See ../Server/CIMOperationResponseEncoder.cpp */ | /* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
static const CIMName NAME("ExecQuery"); | static const CIMName NAME("ExecQuery"); |
name = NAME; | name = NAME; |
| |
out.putObjectA(msg->cimObjects, false); |
data.encodeBinaryResponse(out); |
} | } |
| |
static CIMExecQueryResponseMessage* _decodeExecQueryResponse( | static CIMExecQueryResponseMessage* _decodeExecQueryResponse( |
CIMBuffer& in, | CIMBuffer& in, |
Uint32 flags, |
|
const String& messageId) | const String& messageId) |
{ | { |
/* See ../Client/CIMOperationResponseDecoder.cpp */ |
|
|
|
Array<CIMObject> cimObjects; |
|
|
|
while (in.more()) |
|
{ |
|
Array<CIMObject> tmp; |
|
|
|
if (!in.getObjectA(tmp)) |
|
return 0; |
|
|
|
cimObjects.append(tmp.getData(), tmp.size()); |
|
} |
|
|
|
CIMExecQueryResponseMessage* msg; | CIMExecQueryResponseMessage* msg; |
CIMException cimException; | CIMException cimException; |
| |
msg = new CIMExecQueryResponseMessage( | msg = new CIMExecQueryResponseMessage( |
messageId, | messageId, |
cimException, | cimException, |
QueueIdStack(), |
QueueIdStack()); |
cimObjects); |
|
|
// Instead of resolving the binary data right here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to getNamedInstances, which is going to resolve the binary |
|
// data when the callback function is registered. |
|
// This allows an alternate client implementation to gain direct access |
|
// to the binary data and pass this for example to the JNI implementation |
|
// of the JSR48 CIM Client for Java. |
|
CIMResponseData& responseData = msg->getResponseData(); |
|
responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
|
|
| |
//============================================================================== | //============================================================================== |
// | // |
// BinaryCodec::hexDump() |
|
// |
|
//============================================================================== |
|
|
|
#if defined(PEGASUS_DEBUG) |
|
|
|
void BinaryCodec::hexDump(const void* data, size_t size) |
|
{ |
|
unsigned char* p = (unsigned char*)data; |
|
unsigned char buf[16]; |
|
size_t n = 0; |
|
|
|
for (size_t i = 0, col = 0; i < size; i++) |
|
{ |
|
unsigned char c = p[i]; |
|
buf[n++] = c; |
|
|
|
if (col == 0) |
|
printf("%06X ", (unsigned int)i); |
|
|
|
printf("%02X ", c); |
|
|
|
if (col + 1 == sizeof(buf) || i + 1 == size) |
|
{ |
|
for (size_t j = col + 1; j < sizeof(buf); j++) |
|
printf(" "); |
|
|
|
for (size_t j = 0; j < n; j++) |
|
{ |
|
c = buf[j]; |
|
|
|
if (c >= ' ' && c <= '~') |
|
printf("%c", buf[j]); |
|
else |
|
printf("."); |
|
} |
|
|
|
printf("\n"); |
|
n = 0; |
|
} |
|
|
|
if (col + 1 == sizeof(buf)) |
|
col = 0; |
|
else |
|
col++; |
|
} |
|
|
|
printf("\n"); |
|
} |
|
|
|
#endif /* defined(PEGASUS_DEBUG) */ |
|
|
|
//============================================================================== |
|
// |
|
// BinaryCodec::decodeRequest() | // BinaryCodec::decodeRequest() |
// | // |
//============================================================================== | //============================================================================== |
| |
CIMOperationRequestMessage* BinaryCodec::decodeRequest( | CIMOperationRequestMessage* BinaryCodec::decodeRequest( |
const Buffer& in, |
CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId) | Uint32 returnQueueId) |
{ | { |
CIMBuffer buf((char*)in.getData(), in.size()); |
|
CIMBufferReleaser buf_(buf); |
|
| |
// Turn on validation: | // Turn on validation: |
#if defined(ENABLE_VALIDATION) | #if defined(ENABLE_VALIDATION) |
buf.setValidate(true); |
in.setValidate(true); |
#endif | #endif |
| |
Uint32 flags; | Uint32 flags; |
|
|
Operation operation; | Operation operation; |
| |
| |
if (!_getHeader(buf, flags, messageId, operation)) |
if (!_getHeader(in, flags, messageId, operation)) |
{ | { |
return 0; | return 0; |
} | } |
|
|
{ | { |
case OP_EnumerateInstances: | case OP_EnumerateInstances: |
return _decodeEnumerateInstancesRequest( | return _decodeEnumerateInstancesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_EnumerateInstanceNames: | case OP_EnumerateInstanceNames: |
return _decodeEnumerateInstanceNamesRequest( | return _decodeEnumerateInstanceNamesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_GetInstance: | case OP_GetInstance: |
return _decodeGetInstanceRequest( | return _decodeGetInstanceRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_CreateInstance: | case OP_CreateInstance: |
return _decodeCreateInstanceRequest( | return _decodeCreateInstanceRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_ModifyInstance: | case OP_ModifyInstance: |
return _decodeModifyInstanceRequest( | return _decodeModifyInstanceRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_DeleteInstance: | case OP_DeleteInstance: |
return _decodeDeleteInstanceRequest( | return _decodeDeleteInstanceRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_Associators: | case OP_Associators: |
return _decodeAssociatorsRequest( | return _decodeAssociatorsRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_AssociatorNames: | case OP_AssociatorNames: |
return _decodeAssociatorNamesRequest( | return _decodeAssociatorNamesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_References: | case OP_References: |
return _decodeReferencesRequest( | return _decodeReferencesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_ReferenceNames: | case OP_ReferenceNames: |
return _decodeReferenceNamesRequest( | return _decodeReferenceNamesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_GetClass: | case OP_GetClass: |
return _decodeGetClassRequest( | return _decodeGetClassRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_EnumerateClasses: | case OP_EnumerateClasses: |
return _decodeEnumerateClassesRequest( | return _decodeEnumerateClassesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_EnumerateClassNames: | case OP_EnumerateClassNames: |
return _decodeEnumerateClassNamesRequest( | return _decodeEnumerateClassNamesRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, flags, messageId); |
case OP_CreateClass: | case OP_CreateClass: |
return _decodeCreateClassRequest( | return _decodeCreateClassRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_DeleteClass: | case OP_DeleteClass: |
return _decodeDeleteClassRequest( | return _decodeDeleteClassRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_ModifyClass: | case OP_ModifyClass: |
return _decodeModifyClassRequest( | return _decodeModifyClassRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_SetQualifier: | case OP_SetQualifier: |
return _decodeSetQualifierRequest( | return _decodeSetQualifierRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_GetQualifier: | case OP_GetQualifier: |
return _decodeGetQualifierRequest( | return _decodeGetQualifierRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_DeleteQualifier: | case OP_DeleteQualifier: |
return _decodeDeleteQualifierRequest( | return _decodeDeleteQualifierRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_EnumerateQualifiers: | case OP_EnumerateQualifiers: |
return _decodeEnumerateQualifiersRequest( | return _decodeEnumerateQualifiersRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_GetProperty: | case OP_GetProperty: |
return _decodeGetPropertyRequest( | return _decodeGetPropertyRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_SetProperty: | case OP_SetProperty: |
return _decodeSetPropertyRequest( | return _decodeSetPropertyRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_InvokeMethod: | case OP_InvokeMethod: |
return _decodeInvokeMethodRequest( | return _decodeInvokeMethodRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
case OP_ExecQuery: | case OP_ExecQuery: |
return _decodeExecQueryRequest( | return _decodeExecQueryRequest( |
buf, queueId, returnQueueId, flags, messageId); |
in, queueId, returnQueueId, messageId); |
default: | default: |
// Unexpected message type |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
PEGASUS_ASSERT(0); |
|
return 0; | return 0; |
} | } |
} | } |
|
|
// | // |
//============================================================================== | //============================================================================== |
| |
|
|
CIMResponseMessage* BinaryCodec::decodeResponse( | CIMResponseMessage* BinaryCodec::decodeResponse( |
const Buffer& in) |
CIMBuffer& buf) |
{ | { |
CIMBuffer buf((char*)in.getData(), in.size()); |
// Turn on validation: This is a debugging tool |
CIMBufferReleaser buf_(buf); |
|
|
|
// Turn on validation: |
|
#if defined(ENABLE_VALIDATION) | #if defined(ENABLE_VALIDATION) |
buf.setValidate(true); | buf.setValidate(true); |
#endif | #endif |
|
|
switch (operation) | switch (operation) |
{ | { |
case OP_EnumerateInstances: | case OP_EnumerateInstances: |
msg = _decodeEnumerateInstancesResponse(buf, flags, messageId); |
msg = _decodeEnumerateInstancesResponse(buf, messageId); |
break; | break; |
case OP_EnumerateInstanceNames: | case OP_EnumerateInstanceNames: |
msg = _decodeEnumerateInstanceNamesResponse(buf, flags, messageId); |
msg = _decodeEnumerateInstanceNamesResponse(buf, messageId); |
break; | break; |
case OP_GetInstance: | case OP_GetInstance: |
msg = _decodeGetInstanceResponse(buf, flags, messageId); |
msg = _decodeGetInstanceResponse(buf, messageId); |
break; | break; |
case OP_CreateInstance: | case OP_CreateInstance: |
msg = _decodeCreateInstanceResponse(buf, flags, messageId); |
msg = _decodeCreateInstanceResponse(buf, messageId); |
break; | break; |
case OP_ModifyInstance: | case OP_ModifyInstance: |
msg = _decodeModifyInstanceResponse(buf, flags, messageId); |
msg = _decodeModifyInstanceResponse(buf, messageId); |
break; | break; |
case OP_DeleteInstance: | case OP_DeleteInstance: |
msg = _decodeDeleteInstanceResponse(buf, flags, messageId); |
msg = _decodeDeleteInstanceResponse(messageId); |
break; | break; |
case OP_Associators: | case OP_Associators: |
msg = _decodeAssociatorsResponse(buf, flags, messageId); |
msg = _decodeAssociatorsResponse(buf, messageId); |
break; | break; |
case OP_AssociatorNames: | case OP_AssociatorNames: |
msg = _decodeAssociatorNamesResponse(buf, flags, messageId); |
msg = _decodeAssociatorNamesResponse(buf, messageId); |
break; | break; |
case OP_References: | case OP_References: |
msg = _decodeReferencesResponse(buf, flags, messageId); |
msg = _decodeReferencesResponse(buf, messageId); |
break; | break; |
case OP_ReferenceNames: | case OP_ReferenceNames: |
msg = _decodeReferenceNamesResponse(buf, flags, messageId); |
msg = _decodeReferenceNamesResponse(buf, messageId); |
break; | break; |
case OP_GetClass: | case OP_GetClass: |
msg = _decodeGetClassResponse(buf, flags, messageId); |
msg = _decodeGetClassResponse(buf, messageId); |
break; | break; |
case OP_EnumerateClasses: | case OP_EnumerateClasses: |
msg = _decodeEnumerateClassesResponse(buf, flags, messageId); |
msg = _decodeEnumerateClassesResponse(buf, messageId); |
break; | break; |
case OP_EnumerateClassNames: | case OP_EnumerateClassNames: |
msg = _decodeEnumerateClassNamesResponse(buf, flags, messageId); |
msg = _decodeEnumerateClassNamesResponse(buf, messageId); |
break; | break; |
case OP_CreateClass: | case OP_CreateClass: |
msg = _decodeCreateClassResponse(buf, flags, messageId); |
msg = _decodeCreateClassResponse(messageId); |
break; | break; |
case OP_DeleteClass: | case OP_DeleteClass: |
msg = _decodeDeleteClassResponse(buf, flags, messageId); |
msg = _decodeDeleteClassResponse(messageId); |
break; | break; |
case OP_ModifyClass: | case OP_ModifyClass: |
msg = _decodeModifyClassResponse(buf, flags, messageId); |
msg = _decodeModifyClassResponse(messageId); |
break; | break; |
case OP_SetQualifier: | case OP_SetQualifier: |
msg = _decodeSetQualifierResponse(buf, flags, messageId); |
msg = _decodeSetQualifierResponse(messageId); |
break; | break; |
case OP_GetQualifier: | case OP_GetQualifier: |
msg = _decodeGetQualifierResponse(buf, flags, messageId); |
msg = _decodeGetQualifierResponse(buf, messageId); |
break; | break; |
case OP_DeleteQualifier: | case OP_DeleteQualifier: |
msg = _decodeDeleteQualifierResponse(buf, flags, messageId); |
msg = _decodeDeleteQualifierResponse(messageId); |
break; | break; |
case OP_EnumerateQualifiers: | case OP_EnumerateQualifiers: |
msg = _decodeEnumerateQualifiersResponse(buf, flags, messageId); |
msg = _decodeEnumerateQualifiersResponse(buf, messageId); |
break; | break; |
case OP_GetProperty: | case OP_GetProperty: |
msg = _decodeGetPropertyResponse(buf, flags, messageId); |
msg = _decodeGetPropertyResponse(buf, messageId); |
break; | break; |
case OP_SetProperty: | case OP_SetProperty: |
msg = _decodeSetPropertyResponse(buf, flags, messageId); |
msg = _decodeSetPropertyResponse(messageId); |
break; | break; |
case OP_InvokeMethod: | case OP_InvokeMethod: |
msg = _decodeInvokeMethodResponse(buf, flags, messageId); |
msg = _decodeInvokeMethodResponse(buf, messageId); |
break; | break; |
case OP_ExecQuery: | case OP_ExecQuery: |
msg = _decodeExecQueryResponse(buf, flags, messageId); |
msg = _decodeExecQueryResponse(buf, messageId); |
break; | break; |
default: | default: |
// Unexpected message type | // Unexpected message type |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
break; | break; |
} | } |
| |
|
|
const Buffer& body, | const Buffer& body, |
Uint64 serverResponseTime, | Uint64 serverResponseTime, |
Boolean isFirst, | Boolean isFirst, |
Boolean isLast) |
Boolean) |
{ | { |
Buffer out; | Buffer out; |
| |
|
|
XmlWriter::appendMethodResponseHeader(out, httpMethod, | XmlWriter::appendMethodResponseHeader(out, httpMethod, |
httpContentLanguages, 0, serverResponseTime, true); | httpContentLanguages, 0, serverResponseTime, true); |
| |
|
for (size_t i=out.size(), k=CIMBuffer::round(i); i<k;i++) |
|
{ |
|
out.append('\0'); |
|
} |
// Binary message header: | // Binary message header: |
CIMBuffer cb(128); | CIMBuffer cb(128); |
_putHeader(cb, 0, messageId, _NameToOp(iMethodName)); | _putHeader(cb, 0, messageId, _NameToOp(iMethodName)); |
|
|
| |
default: | default: |
// Unexpected message type | // Unexpected message type |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
return false; | return false; |
} | } |
| |
|
|
true, /* binaryRequest */ | true, /* binaryRequest */ |
binaryResponse); | binaryResponse); |
| |
|
// Need to pad the Buffer to the 64bit border since CIMBuffer is 64bit |
|
// aligned, but Buffer only 8bit |
|
Uint32 extraAlignBytes = CIMBuffer::round(out.size()) - out.size(); |
|
for (Uint32 i=0; i < extraAlignBytes;i++) |
|
{ |
|
out.append('\0'); |
|
} |
|
// Need fix-up Content-length value... |
|
char * contentLengthValueStart = |
|
(char*) strstr(out.getData(), "content-length"); |
|
contentLengthValueStart += sizeof("content-length: ")-1; |
|
// using sprintf to stay equal to the macro OUTPUT_CONTENTLENGTH definition |
|
// defined in XMLGenerator.h |
|
char contentLengthP[11]; |
|
sprintf(contentLengthP,"%.10u", (unsigned int)buf.size()+extraAlignBytes); |
|
memcpy(contentLengthValueStart,contentLengthP,10); |
|
|
out.append(buf.getData(), buf.size()); | out.append(buf.getData(), buf.size()); |
| |
return true; | return true; |
|
|
{ | { |
case CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE: | case CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE: |
{ | { |
_encodeEnumerateInstancesResponseBody(buf, |
_encodeEnumerateInstancesResponseBody( |
(CIMEnumerateInstancesResponseMessage*)msg, name); |
buf, |
|
((CIMEnumerateInstancesResponseMessage*)msg)->getResponseData(), |
|
name, |
|
(msg->getIndex() == 0)); |
break; | break; |
} | } |
| |
case CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE: | case CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE: |
{ | { |
_encodeEnumerateInstanceNamesResponseBody(buf, |
_encodeEnumerateInstanceNamesResponseBody( |
(CIMEnumerateInstanceNamesResponseMessage*)msg, name); |
buf, |
|
((CIMEnumerateInstanceNamesResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
case CIM_GET_INSTANCE_RESPONSE_MESSAGE: | case CIM_GET_INSTANCE_RESPONSE_MESSAGE: |
{ | { |
_encodeGetInstanceResponseBody(buf, |
_encodeGetInstanceResponseBody( |
(CIMGetInstanceResponseMessage*)msg, name); |
buf, |
|
((CIMGetInstanceResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
|
|
| |
case CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE: | case CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE: |
{ | { |
_encodeModifyInstanceResponseBody(buf, |
_encodeModifyInstanceResponseBody(name); |
(CIMModifyInstanceResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
case CIM_DELETE_INSTANCE_RESPONSE_MESSAGE: | case CIM_DELETE_INSTANCE_RESPONSE_MESSAGE: |
{ | { |
_encodeDeleteInstanceResponseBody(buf, |
_encodeDeleteInstanceResponseBody(name); |
(CIMDeleteInstanceResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
case CIM_ASSOCIATORS_RESPONSE_MESSAGE: | case CIM_ASSOCIATORS_RESPONSE_MESSAGE: |
{ | { |
_encodeAssociatorsResponseBody(buf, |
_encodeAssociatorsResponseBody( |
(CIMAssociatorsResponseMessage*)msg, name); |
buf, |
|
((CIMAssociatorsResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
case CIM_ASSOCIATOR_NAMES_RESPONSE_MESSAGE: | case CIM_ASSOCIATOR_NAMES_RESPONSE_MESSAGE: |
{ | { |
_encodeAssociatorNamesResponseBody(buf, |
_encodeAssociatorNamesResponseBody( |
(CIMAssociatorNamesResponseMessage*)msg, name); |
buf, |
|
((CIMAssociatorNamesResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
case CIM_REFERENCES_RESPONSE_MESSAGE: | case CIM_REFERENCES_RESPONSE_MESSAGE: |
{ | { |
_encodeReferencesResponseBody(buf, |
_encodeReferencesResponseBody( |
(CIMReferencesResponseMessage*)msg, name); |
buf, |
|
((CIMReferencesResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
case CIM_REFERENCE_NAMES_RESPONSE_MESSAGE: | case CIM_REFERENCE_NAMES_RESPONSE_MESSAGE: |
{ | { |
_encodeReferenceNamesResponseBody(buf, |
_encodeReferenceNamesResponseBody( |
(CIMReferenceNamesResponseMessage*)msg, name); |
buf, |
|
((CIMReferenceNamesResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
|
|
| |
case CIM_CREATE_CLASS_RESPONSE_MESSAGE: | case CIM_CREATE_CLASS_RESPONSE_MESSAGE: |
{ | { |
_encodeCreateClassResponseBody(buf, |
_encodeCreateClassResponseBody(name); |
(CIMCreateClassResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
case CIM_DELETE_CLASS_RESPONSE_MESSAGE: | case CIM_DELETE_CLASS_RESPONSE_MESSAGE: |
{ | { |
_encodeDeleteClassResponseBody(buf, |
_encodeDeleteClassResponseBody(name); |
(CIMDeleteClassResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
case CIM_MODIFY_CLASS_RESPONSE_MESSAGE: | case CIM_MODIFY_CLASS_RESPONSE_MESSAGE: |
{ | { |
_encodeModifyClassResponseBody(buf, |
_encodeModifyClassResponseBody(name); |
(CIMModifyClassResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
case CIM_SET_QUALIFIER_RESPONSE_MESSAGE: | case CIM_SET_QUALIFIER_RESPONSE_MESSAGE: |
{ | { |
_encodeSetQualifierResponseBody(buf, |
_encodeSetQualifierResponseBody(name); |
(CIMSetQualifierResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
|
|
| |
case CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE: | case CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE: |
{ | { |
_encodeDeleteQualifierResponseBody(buf, |
_encodeDeleteQualifierResponseBody(name); |
(CIMDeleteQualifierResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
|
|
| |
case CIM_SET_PROPERTY_RESPONSE_MESSAGE: | case CIM_SET_PROPERTY_RESPONSE_MESSAGE: |
{ | { |
_encodeSetPropertyResponseBody(buf, |
_encodeSetPropertyResponseBody(name); |
(CIMSetPropertyResponseMessage*)msg, name); |
|
break; | break; |
} | } |
| |
|
|
| |
case CIM_EXEC_QUERY_RESPONSE_MESSAGE: | case CIM_EXEC_QUERY_RESPONSE_MESSAGE: |
{ | { |
_encodeExecQueryResponseBody(buf, |
_encodeExecQueryResponseBody( |
(CIMExecQueryResponseMessage*)msg, name); |
buf, |
|
((CIMExecQueryResponseMessage*)msg)->getResponseData(), |
|
name); |
break; | break; |
} | } |
| |
default: | default: |
// Unexpected message type | // Unexpected message type |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
return false; | return false; |
} | } |
| |