version 1.12, 2011/01/07 02:17:20
|
version 1.12.2.6, 2013/06/11 23:17:43
|
|
|
#define INCLUDE_QUALIFIERS (1 << 1) | #define INCLUDE_QUALIFIERS (1 << 1) |
#define INCLUDE_CLASS_ORIGIN (1 << 2) | #define INCLUDE_CLASS_ORIGIN (1 << 2) |
#define DEEP_INHERITANCE (1 << 3) | #define DEEP_INHERITANCE (1 << 3) |
|
#define CONTINUE_ON_ERROR (1 << 4) |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
OP_DeleteQualifier, | OP_DeleteQualifier, |
OP_EnumerateQualifiers, | OP_EnumerateQualifiers, |
OP_InvokeMethod, | OP_InvokeMethod, |
|
// EXP_PULL_BEGIN |
|
OP_OpenEnumerateInstances, |
|
OP_OpenEnumerateInstancePaths, |
|
OP_OpenReferenceInstances, |
|
OP_OpenReferenceInstancePaths, |
|
OP_OpenAssociatorInstances, |
|
OP_OpenAssociatorInstancePaths, |
|
OP_PullInstancesWithPath, |
|
OP_PullInstancePaths, |
|
OP_CloseEnumeration, |
|
OP_EnumerationCount, |
|
OP_OpenQueryInstances, |
|
// EXP_PULL_END |
OP_Count | OP_Count |
}; | }; |
| |
|
|
return OP_CreateInstance; | return OP_CreateInstance; |
if (_EQUAL(s, "CreateClass")) | if (_EQUAL(s, "CreateClass")) |
return OP_CreateClass; | return OP_CreateClass; |
|
//EXP_PULL_BEGIN |
|
if (_EQUAL(s, "CloseEnumeration")) |
|
return OP_CloseEnumeration; |
|
// EXP_PULL_END |
break; | break; |
case 'D': | case 'D': |
if (_EQUAL(s, "DeleteInstance")) | if (_EQUAL(s, "DeleteInstance")) |
|
|
if (_EQUAL(s, "ModifyClass")) | if (_EQUAL(s, "ModifyClass")) |
return OP_ModifyClass; | return OP_ModifyClass; |
break; | break; |
|
// EXP_PULL_BEGIN |
|
case 'O': |
|
if (_EQUAL(s, "OpenEnumerateInstances")) |
|
return OP_OpenEnumerateInstances; |
|
if (_EQUAL(s, "OpenEnumerateInstancePaths")) |
|
return OP_OpenEnumerateInstancePaths; |
|
if (_EQUAL(s, "OpenReferenceInstances")) |
|
return OP_OpenReferenceInstances; |
|
if (_EQUAL(s, "OpenReferenceInstancePaths")) |
|
return OP_OpenReferenceInstancePaths; |
|
if (_EQUAL(s, "OpenAssociatorInstances")) |
|
return OP_OpenAssociatorInstances; |
|
if (_EQUAL(s, "OpenAssociatorInstancePaths")) |
|
return OP_OpenAssociatorInstancePaths; |
|
if (_EQUAL(s, "OpenQueryInstances")) |
|
return OP_OpenQueryInstances;; |
|
break; |
|
case 'P': |
|
if (_EQUAL(s, "PullInstancesWithPath")) |
|
return OP_PullInstancesWithPath; |
|
if (_EQUAL(s, "PullInstancePaths")) |
|
return OP_PullInstancePaths; |
|
break; |
|
// EXP_PULL_END |
case 'R': | case 'R': |
if (_EQUAL(s, "References")) | if (_EQUAL(s, "References")) |
return OP_References; | return OP_References; |
|
|
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] |
|
|
static void _encodeEnumerateInstancesResponseBody( | static void _encodeEnumerateInstancesResponseBody( |
CIMBuffer& out, | CIMBuffer& out, |
CIMResponseData& data, | 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; |
| |
|
// Only write the property list on the first provider response |
|
if (isFirst) |
|
{ |
|
// [PROPERTY-LIST] |
|
out.putPropertyList(data.getPropertyList()); |
|
} |
data.encodeBinaryResponse(out); | data.encodeBinaryResponse(out); |
} | } |
| |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getNamedInstances, which is going to resolve the binary |
// a call to CIMResponseData::getInstances, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
CIMResponseData& responseData = msg->getResponseData(); | CIMResponseData& responseData = msg->getResponseData(); |
|
|
|
// [PROPERTY-LIST] |
|
CIMPropertyList propertyList; |
|
if (!in.getPropertyList(propertyList)) |
|
{ |
|
return 0; |
|
} |
|
responseData.setPropertyList(propertyList); |
|
|
responseData.setRemainingBinaryData(in); | responseData.setRemainingBinaryData(in); |
| |
msg->binaryRequest=true; | msg->binaryRequest=true; |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getInstanceNames, which is going to resolve the binary |
// a call to CIMResponseData::getInstanceNames, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
|
|
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] |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getNamedInstances, which is going to resolve the binary |
// a call to CIMResponseData::getInstances, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getNamedInstances, which is going to resolve the binary |
// a call to CIMResponseData::getObjects, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getNamedInstances, which is going to resolve the binary |
// a call to CIMResponseData::getInstanceNames, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
|
|
cimException, | cimException, |
QueueIdStack()); | QueueIdStack()); |
| |
// Instead of resolving the binary data right here, we delegate this |
// Instead of resolving the binary data here, we delegate this |
// to a later point in time when the data is actually retrieved through | // to a later point in time when the data is actually retrieved through |
// a call to getNamedInstances, which is going to resolve the binary |
// a call to CIMResponseData::getInstanceNames, which |
// data when the callback function is registered. |
// resolves the binary data as it is passed to the next interface. |
// This allows an alternate client implementation to gain direct access | // This allows an alternate client implementation to gain direct access |
// to the binary data and pass this for example to the JNI implementation | // to the binary data and pass this for example to the JNI implementation |
// of the JSR48 CIM Client for Java. | // of the JSR48 CIM Client for Java. |
|
|
msg->binaryRequest = true; | msg->binaryRequest = true; |
return msg; | return msg; |
} | } |
|
// EXP_PULL_BEGIN |
//============================================================================== | //============================================================================== |
// | // |
// BinaryCodec::hexDump() |
// OpenEnumerateInstances |
// | // |
//============================================================================== | //============================================================================== |
| |
#if defined(PEGASUS_DEBUG) |
static void _encodeOpenEnumerateInstancesRequest( |
|
CIMBuffer& buf, |
void BinaryCodec::hexDump(const void* data, size_t size) |
CIMOpenEnumerateInstancesRequestMessage* msg, |
|
CIMName& name) |
{ | { |
unsigned char* p = (unsigned char*)data; |
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
unsigned char buf[16]; |
|
size_t n = 0; |
|
| |
for (size_t i = 0, col = 0; i < size; i++) |
static const CIMName NAME("OpenEnumerateInstances"); |
{ |
name = NAME; |
unsigned char c = p[i]; |
|
buf[n++] = c; |
|
| |
if (col == 0) |
// [HEADER] |
printf("%06X ", (unsigned int)i); |
|
| |
printf("%02X ", c); |
Uint32 flags = 0; |
| |
if (col + 1 == sizeof(buf) || i + 1 == size) |
if (msg->deepInheritance) |
{ |
flags |= DEEP_INHERITANCE; |
for (size_t j = col + 1; j < sizeof(buf); j++) |
|
printf(" "); |
|
| |
for (size_t j = 0; j < n; j++) |
if (msg->includeClassOrigin) |
{ |
flags |= INCLUDE_CLASS_ORIGIN; |
c = buf[j]; |
|
| |
if (c >= ' ' && c <= '~') |
if (msg->continueOnError) |
printf("%c", buf[j]); |
flags |= CONTINUE_ON_ERROR; |
else |
|
printf("."); |
|
} |
|
| |
printf("\n"); |
_putHeader(buf, flags, msg->messageId, OP_OpenEnumerateInstances); |
n = 0; |
|
} |
|
| |
if (col + 1 == sizeof(buf)) |
// [NAMESPACE] |
col = 0; |
buf.putNamespaceName(msg->nameSpace); |
else |
|
col++; |
|
} |
|
| |
printf("\n"); |
// [CLASSNAME] |
} |
buf.putName(msg->className); |
| |
#endif /* defined(PEGASUS_DEBUG) */ |
// [PROPERTY-LIST] |
|
buf.putPropertyList(msg->propertyList); |
| |
//============================================================================== |
buf.putUint32(msg->maxObjectCount); |
// |
buf.putUint32Arg(msg->operationTimeout); |
// BinaryCodec::decodeRequest() |
buf.putString(msg->filterQueryLanguage); |
// |
buf.putString(msg->filterQuery); |
//============================================================================== |
} |
| |
CIMOperationRequestMessage* BinaryCodec::decodeRequest( |
static CIMOpenEnumerateInstancesRequestMessage* |
const Buffer& in, |
_decodeOpenEnumerateInstancesRequest( |
|
CIMBuffer& in, |
Uint32 queueId, | Uint32 queueId, |
Uint32 returnQueueId) |
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
{ | { |
CIMBuffer buf((char*)in.getData(), in.size()); |
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
CIMBufferReleaser buf_(buf); |
|
| |
// Turn on validation: |
STAT_GETSTARTTIME |
#if defined(ENABLE_VALIDATION) |
|
buf.setValidate(true); |
|
#endif |
|
| |
Uint32 flags; |
Boolean deepInheritance = flags & DEEP_INHERITANCE; |
String messageId; |
Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; |
Operation operation; |
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
| |
|
// [NAMESPACE] |
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
| |
if (!_getHeader(buf, flags, messageId, operation)) |
// [CLASSNAME] |
{ |
CIMName className; |
|
if (!in.getName(className)) |
return 0; | return 0; |
} |
|
| |
switch (operation) |
// [PROPERTY-LIST] |
{ |
CIMPropertyList propertyList; |
case OP_EnumerateInstances: |
if (!in.getPropertyList(propertyList)) |
return _decodeEnumerateInstancesRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateInstanceNames: |
|
return _decodeEnumerateInstanceNamesRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_GetInstance: |
|
return _decodeGetInstanceRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_CreateInstance: |
|
return _decodeCreateInstanceRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_ModifyInstance: |
|
return _decodeModifyInstanceRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_DeleteInstance: |
|
return _decodeDeleteInstanceRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_Associators: |
|
return _decodeAssociatorsRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_AssociatorNames: |
|
return _decodeAssociatorNamesRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_References: |
|
return _decodeReferencesRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_ReferenceNames: |
|
return _decodeReferenceNamesRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_GetClass: |
|
return _decodeGetClassRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateClasses: |
|
return _decodeEnumerateClassesRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateClassNames: |
|
return _decodeEnumerateClassNamesRequest( |
|
buf, queueId, returnQueueId, flags, messageId); |
|
case OP_CreateClass: |
|
return _decodeCreateClassRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_DeleteClass: |
|
return _decodeDeleteClassRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_ModifyClass: |
|
return _decodeModifyClassRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_SetQualifier: |
|
return _decodeSetQualifierRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_GetQualifier: |
|
return _decodeGetQualifierRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_DeleteQualifier: |
|
return _decodeDeleteQualifierRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_EnumerateQualifiers: |
|
return _decodeEnumerateQualifiersRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_GetProperty: |
|
return _decodeGetPropertyRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_SetProperty: |
|
return _decodeSetPropertyRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_InvokeMethod: |
|
return _decodeInvokeMethodRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
case OP_ExecQuery: |
|
return _decodeExecQueryRequest( |
|
buf, queueId, returnQueueId, messageId); |
|
default: |
|
// Unexpected message type |
|
PEGASUS_ASSERT(0); |
|
return 0; | return 0; |
} |
|
} |
|
| |
//============================================================================== |
// These can all be one common function. |
// |
Uint32 maxObjectCount; |
// BinaryCodec::decodeResponse() |
if (!in.getUint32(maxObjectCount)) |
// |
return 0; |
//============================================================================== |
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
| |
CIMResponseMessage* BinaryCodec::decodeResponse( |
AutoPtr<CIMOpenEnumerateInstancesRequestMessage> request( |
const Buffer& in) |
new CIMOpenEnumerateInstancesRequestMessage( |
|
messageId, |
|
nameSpace, |
|
className, |
|
deepInheritance, |
|
includeClassOrigin, |
|
propertyList, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodeOpenEnumerateInstancesResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenEnumerateInstancesResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
{ | { |
CIMBuffer buf((char*)in.getData(), in.size()); |
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
CIMBufferReleaser buf_(buf); |
|
| |
return decodeResponse(buf); |
static const CIMName NAME("OpenEnumerateInstances"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
} | } |
| |
CIMResponseMessage* BinaryCodec::decodeResponse( |
static CIMOpenEnumerateInstancesResponseMessage* |
CIMBuffer& buf) |
_decodeOpenEnumerateInstancesResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
{ | { |
|
CIMException cimException; |
|
|
|
// KS_TODO Should we set validation??? |
// Turn on validation: This is a debugging tool | // Turn on validation: This is a debugging tool |
#if defined(ENABLE_VALIDATION) |
//#if defined(ENABLE_VALIDATION) |
buf.setValidate(true); |
// buf.setValidate(true); |
#endif |
//#endif |
| |
Uint32 flags; |
Boolean endOfSequence; |
String messageId; |
if (!in.getBoolean(endOfSequence)) |
Operation operation; |
return 0; |
| |
if (!_getHeader(buf, flags, messageId, operation)) |
String enumerationContext; |
{ |
if (!in.getString(enumerationContext)) |
throw CIMException(CIM_ERR_FAILED, "Corrupt binary message header"); |
|
return 0; | return 0; |
|
|
|
CIMOpenEnumerateInstancesResponseMessage* msg = |
|
new CIMOpenEnumerateInstancesResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// Instead of resolving the binary data here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to CIMResponseData::getInstances, which |
|
// resolves the binary data as it is passed to the next interface. |
|
// 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; |
|
return msg; |
} | } |
| |
CIMResponseMessage* msg = 0; |
//============================================================================== |
|
// |
|
// OpenEnumerateInstancesPaths |
|
// |
|
//============================================================================== |
| |
switch (operation) |
static void _encodeOpenEnumerateInstancePathsRequest( |
|
CIMBuffer& buf, |
|
CIMOpenEnumerateInstancePathsRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenEnumerateInstancePaths"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenEnumerateInstancePaths); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [CLASSNAME] |
|
buf.putName(msg->className); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
buf.putString(msg->filterQueryLanguage); |
|
buf.putString(msg->filterQuery); |
|
} |
|
|
|
static CIMOpenEnumerateInstancePathsRequestMessage* |
|
_decodeOpenEnumerateInstancePathsRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [CLASSNAME] |
|
CIMName className; |
|
if (!in.getName(className)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
|
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenEnumerateInstancePathsRequestMessage> request( |
|
new CIMOpenEnumerateInstancePathsRequestMessage( |
|
messageId, |
|
nameSpace, |
|
className, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodeOpenEnumerateInstancePathsResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenEnumerateInstancePathsResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenEnumerateInstancePaths"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenEnumerateInstancePathsResponseMessage* |
|
_decodeOpenEnumerateInstancePathsResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
{ |
|
return 0; |
|
} |
|
CIMOpenEnumerateInstancePathsResponseMessage* msg = |
|
new CIMOpenEnumerateInstancePathsResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// Instead of resolving the binary data here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to CIMResponseData::getInstanceNames, which |
|
// resolves the binary data as it is passed to the next interface. |
|
// 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; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// OpenReferenceInstances |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeOpenReferenceInstancesRequest( |
|
CIMBuffer& buf, |
|
CIMOpenReferenceInstancesRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenReferenceInstances"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
if (msg->includeClassOrigin) |
|
flags |= INCLUDE_CLASS_ORIGIN; |
|
|
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenReferenceInstances); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [OBJECT-NAME] |
|
buf.putObjectPath(msg->objectName); |
|
|
|
// [RESULT-CLASS] |
|
buf.putName(msg->resultClass); |
|
|
|
// [ROLE] |
|
buf.putString(msg->role); |
|
|
|
// [PROPERTY-LIST] |
|
buf.putPropertyList(msg->propertyList); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
buf.putString(msg->filterQueryLanguage); |
|
buf.putString(msg->filterQuery); |
|
} |
|
|
|
static CIMOpenReferenceInstancesRequestMessage* |
|
_decodeOpenReferenceInstancesRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; |
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [OBJECT-NAME] |
|
|
|
CIMObjectPath objectName; |
|
|
|
if (!in.getObjectPath(objectName)) |
|
return 0; |
|
|
|
// [RESULT-CLASS] |
|
|
|
CIMName resultClass; |
|
|
|
if (!in.getName(resultClass)) |
|
return 0; |
|
|
|
// [ROLE] |
|
|
|
String role; |
|
|
|
if (!in.getString(role)) |
|
return 0; |
|
|
|
// [PROPERTY-LIST] |
|
CIMPropertyList propertyList; |
|
if (!in.getPropertyList(propertyList)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenReferenceInstancesRequestMessage> request( |
|
new CIMOpenReferenceInstancesRequestMessage( |
|
messageId, |
|
nameSpace, |
|
objectName, |
|
resultClass, |
|
role, |
|
includeClassOrigin, |
|
propertyList, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodeOpenReferenceInstancesResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenReferenceInstancesResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenReferenceInstances"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenReferenceInstancesResponseMessage* |
|
_decodeOpenReferenceInstancesResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMOpenReferenceInstancesResponseMessage* msg = |
|
new CIMOpenReferenceInstancesResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// Instead of resolving the binary data here, we delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to CIMResponseData::getInstances, which |
|
// resolves the binary data is passed to the next interface. |
|
// 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; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// OpenReferenceInstancePaths |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeOpenReferenceInstancePathsRequest( |
|
CIMBuffer& buf, |
|
CIMOpenReferenceInstancePathsRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenReferenceInstancePaths"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenReferenceInstancePaths); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [OBJECT-NAME] |
|
buf.putObjectPath(msg->objectName); |
|
|
|
// [RESULT-CLASS] |
|
buf.putName(msg->resultClass); |
|
|
|
// [ROLE] |
|
buf.putString(msg->role); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
buf.putString(msg->filterQueryLanguage); |
|
buf.putString(msg->filterQuery); |
|
} |
|
|
|
static CIMOpenReferenceInstancePathsRequestMessage* |
|
_decodeOpenReferenceInstancePathsRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../ |
|
Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [OBJECT-NAME] |
|
|
|
CIMObjectPath objectName; |
|
if (!in.getObjectPath(objectName)) |
|
return 0; |
|
|
|
// [RESULT-CLASS] |
|
|
|
CIMName resultClass; |
|
if (!in.getName(resultClass)) |
|
return 0; |
|
|
|
// [ROLE] |
|
|
|
String role; |
|
if (!in.getString(role)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenReferenceInstancePathsRequestMessage> request( |
|
new CIMOpenReferenceInstancePathsRequestMessage( |
|
messageId, |
|
nameSpace, |
|
objectName, |
|
resultClass, |
|
role, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodeOpenReferenceInstancePathsResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenReferenceInstancePathsResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenReferenceInstancePaths"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenReferenceInstancePathsResponseMessage* |
|
_decodeOpenReferenceInstancePathsResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMOpenReferenceInstancePathsResponseMessage* msg = |
|
new CIMOpenReferenceInstancePathsResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// 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; |
|
return msg; |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// OpenAssociatorInstances |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeOpenAssociatorInstancesRequest( |
|
CIMBuffer& buf, |
|
CIMOpenAssociatorInstancesRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenAssociatorInstances"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
if (msg->includeClassOrigin) |
|
flags |= INCLUDE_CLASS_ORIGIN; |
|
|
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenAssociatorInstances); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [OBJECT-NAME] |
|
buf.putObjectPath(msg->objectName); |
|
|
|
// [ASSOC-CLASS] |
|
buf.putName(msg->assocClass); |
|
|
|
// [RESULT-CLASS] |
|
buf.putName(msg->resultClass); |
|
|
|
// [ROLE] |
|
buf.putString(msg->role); |
|
|
|
// [RESULT-ROLE] |
|
buf.putString(msg->resultRole); |
|
|
|
// [PROPERTY-LIST] |
|
buf.putPropertyList(msg->propertyList); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
buf.putString(msg->filterQueryLanguage); |
|
buf.putString(msg->filterQuery); |
|
} |
|
|
|
static CIMOpenAssociatorInstancesRequestMessage* |
|
_decodeOpenAssociatorInstancesRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean includeClassOrigin = flags & INCLUDE_CLASS_ORIGIN; |
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [OBJECT-NAME] |
|
|
|
CIMObjectPath objectName; |
|
|
|
if (!in.getObjectPath(objectName)) |
|
return 0; |
|
|
|
// [ASSOC-CLASS] |
|
|
|
CIMName assocClass; |
|
|
|
if (!in.getName(assocClass)) |
|
return 0; |
|
|
|
// [RESULT-CLASS] |
|
|
|
CIMName resultClass; |
|
|
|
if (!in.getName(resultClass)) |
|
return 0; |
|
|
|
// [ROLE] |
|
|
|
String role; |
|
|
|
if (!in.getString(role)) |
|
return 0; |
|
|
|
// [RESULT-ROLE] |
|
|
|
String resultRole; |
|
|
|
if (!in.getString(resultRole)) |
|
return 0; |
|
|
|
// [PROPERTY-LIST] |
|
CIMPropertyList propertyList; |
|
if (!in.getPropertyList(propertyList)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenAssociatorInstancesRequestMessage> request( |
|
new CIMOpenAssociatorInstancesRequestMessage( |
|
messageId, |
|
nameSpace, |
|
objectName, |
|
assocClass, |
|
resultClass, |
|
role, |
|
resultRole, |
|
includeClassOrigin, |
|
propertyList, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodeOpenAssociatorInstancesResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenAssociatorInstancesResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenAssociatorInstances"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenAssociatorInstancesResponseMessage* |
|
_decodeOpenAssociatorInstancesResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMOpenAssociatorInstancesResponseMessage* msg = |
|
new CIMOpenAssociatorInstancesResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// 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; |
|
return msg; |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// OpenAssociatorInstancePaths |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeOpenAssociatorInstancePathsRequest( |
|
CIMBuffer& buf, |
|
CIMOpenAssociatorInstancePathsRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenAssociatorInstancePaths"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenAssociatorInstancePaths); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [OBJECT-NAME] |
|
buf.putObjectPath(msg->objectName); |
|
|
|
// [ASSOC-CLASS] |
|
buf.putName(msg->assocClass); |
|
|
|
// [RESULT-CLASS] |
|
buf.putName(msg->resultClass); |
|
|
|
// [ROLE] |
|
buf.putString(msg->role); |
|
|
|
// [RESULT-ROLE] |
|
buf.putString(msg->resultRole); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
buf.putString(msg->filterQueryLanguage); |
|
buf.putString(msg->filterQuery); |
|
} |
|
|
|
static CIMOpenAssociatorInstancePathsRequestMessage* |
|
_decodeOpenAssociatorInstancePathsRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [OBJECT-NAME] |
|
|
|
CIMObjectPath objectName; |
|
if (!in.getObjectPath(objectName)) |
|
return 0; |
|
|
|
// [ASSOC-CLASS] |
|
|
|
CIMName assocClass; |
|
if (!in.getName(assocClass)) |
|
return 0; |
|
|
|
// [RESULT-CLASS] |
|
|
|
CIMName resultClass; |
|
if (!in.getName(resultClass)) |
|
return 0; |
|
|
|
// [ROLE] |
|
|
|
String role; |
|
if (!in.getString(role)) |
|
return 0; |
|
|
|
// [RESULT-ROLE] |
|
|
|
String resultRole; |
|
if (!in.getString(resultRole)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenAssociatorInstancePathsRequestMessage> request( |
|
new CIMOpenAssociatorInstancePathsRequestMessage( |
|
messageId, |
|
nameSpace, |
|
objectName, |
|
assocClass, |
|
resultClass, |
|
role, |
|
resultRole, |
|
filterQueryLanguage, |
|
filterQuery, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
static void _encodeOpenAssociatorInstancePathsResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenAssociatorInstancePathsResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenAssociatorInstancePaths"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenAssociatorInstancePathsResponseMessage* |
|
_decodeOpenAssociatorInstancePathsResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMOpenAssociatorInstancePathsResponseMessage* msg = |
|
new CIMOpenAssociatorInstancePathsResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// 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; |
|
return msg; |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// PullInstancesWithPath |
|
// |
|
//============================================================================== |
|
|
|
static void _encodePullInstancesWithPathRequest( |
|
CIMBuffer& buf, |
|
CIMPullInstancesWithPathRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("PullInstancesWithPath"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_PullInstancesWithPath); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [EnumerationContext] |
|
buf.putString(msg->enumerationContext); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
} |
|
|
|
static CIMPullInstancesWithPathRequestMessage* |
|
_decodePullInstancesWithPathRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [EnumerationContext] |
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
{ |
|
return 0; |
|
} |
|
|
|
// [MACTCOUNT] |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
|
|
AutoPtr<CIMPullInstancesWithPathRequestMessage> request( |
|
new CIMPullInstancesWithPathRequestMessage( |
|
messageId, |
|
nameSpace, |
|
enumerationContext, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodePullInstancesWithPathResponseBody( |
|
CIMBuffer& out, |
|
CIMPullInstancesWithPathResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("PullInstancesWithPath"); |
|
name = NAME; |
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMPullInstancesWithPathResponseMessage* |
|
_decodePullInstancesWithPathResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMPullInstancesWithPathResponseMessage* msg = |
|
new CIMPullInstancesWithPathResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// 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; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// PullInstancePaths |
|
// |
|
//============================================================================== |
|
|
|
static void _encodePullInstancePathsRequest( |
|
CIMBuffer& buf, |
|
CIMPullInstancePathsRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("PullInstancePaths"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_PullInstancePaths); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [EnumerationContext] |
|
buf.putString(msg->enumerationContext); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
} |
|
|
|
static CIMPullInstancePathsRequestMessage* |
|
_decodePullInstancePathsRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [EnumerationContext] |
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
{ |
|
return 0; |
|
} |
|
|
|
// [MAXOBJECTCOUNT] |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
|
|
AutoPtr<CIMPullInstancePathsRequestMessage> request( |
|
new CIMPullInstancePathsRequestMessage( |
|
messageId, |
|
nameSpace, |
|
enumerationContext, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
// For the pull Response messages the interface is the message and the, |
|
// not just the responseData. |
|
static void _encodePullInstancePathsResponseBody( |
|
CIMBuffer& out, |
|
CIMPullInstancePathsResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("PullInstancePaths"); |
|
name = NAME; |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMPullInstancePathsResponseMessage* |
|
_decodePullInstancePathsResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMPullInstancePathsResponseMessage* msg = |
|
new CIMPullInstancePathsResponseMessage( |
|
messageId, |
|
cimException, |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// 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; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// CloseEnumeration |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeCloseEnumerationRequest( |
|
CIMBuffer& buf, |
|
CIMCloseEnumerationRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("CloseEnumeration"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_CloseEnumeration); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [EnumerationContext] |
|
buf.putString(msg->enumerationContext); |
|
} |
|
|
|
static CIMCloseEnumerationRequestMessage* _decodeCloseEnumerationRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [EnumerationContext] |
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
{ |
|
return 0; |
|
} |
|
|
|
AutoPtr<CIMCloseEnumerationRequestMessage> request( |
|
new CIMCloseEnumerationRequestMessage( |
|
messageId, |
|
nameSpace, |
|
enumerationContext, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
static void _encodeCloseEnumerationResponseBody( |
|
CIMBuffer& out, |
|
CIMCloseEnumerationResponseMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("CloseEnumeration"); |
|
name = NAME; |
|
} |
|
|
|
static CIMCloseEnumerationResponseMessage* |
|
_decodeCloseEnumerationResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
CIMCloseEnumerationResponseMessage* msg = |
|
new CIMCloseEnumerationResponseMessage( |
|
messageId, |
|
cimException, |
|
QueueIdStack()); |
|
|
|
msg->binaryRequest=true; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// EnumerationCount |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeEnumerationCountRequest( |
|
CIMBuffer& buf, |
|
CIMEnumerationCountRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("EnumerationCount"); |
|
name = NAME; |
|
|
|
// [HEADER] |
|
Uint32 flags = 0; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_EnumerationCount); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [EnumerationContext] |
|
buf.putString(msg->enumerationContext); |
|
} |
|
|
|
static CIMEnumerationCountRequestMessage* _decodeEnumerationCountRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
// [NAMESPACE] |
|
|
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [EnumerationContext] |
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
{ |
|
return 0; |
|
} |
|
|
|
AutoPtr<CIMEnumerationCountRequestMessage> request( |
|
new CIMEnumerationCountRequestMessage( |
|
messageId, |
|
nameSpace, |
|
enumerationContext, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
static void _encodeEnumerationCountResponseBody( |
|
CIMBuffer& out, |
|
CIMEnumerationCountResponseMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
static const CIMName NAME("EnumerationCount"); |
|
name = NAME; |
|
|
|
// [count] |
|
out.putUint64Arg(msg->count); |
|
} |
|
|
|
static CIMEnumerationCountResponseMessage* |
|
_decodeEnumerationCountResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
Uint64 count; |
|
if (!in.getUint64(count)) |
|
return 0; |
|
|
|
CIMEnumerationCountResponseMessage* msg = |
|
new CIMEnumerationCountResponseMessage( |
|
messageId, |
|
cimException, |
|
QueueIdStack(), |
|
count); |
|
|
|
msg->binaryRequest=true; |
|
return msg; |
|
} |
|
//============================================================================== |
|
// |
|
// OpenQueryInstances |
|
// |
|
//============================================================================== |
|
|
|
static void _encodeOpenQueryInstancesRequest( |
|
CIMBuffer& buf, |
|
CIMOpenQueryInstancesRequestMessage* msg, |
|
CIMName& name) |
|
{ |
|
/* See ../Client/CIMOperationRequestEncoder.cpp */ |
|
|
|
static const CIMName NAME("OpenQueryInstances"); |
|
|
|
// [HEADER] |
|
|
|
Uint32 flags = 0; |
|
|
|
if (msg->continueOnError) |
|
flags |= CONTINUE_ON_ERROR; |
|
|
|
_putHeader(buf, flags, msg->messageId, OP_OpenQueryInstances); |
|
|
|
// [NAMESPACE] |
|
buf.putNamespaceName(msg->nameSpace); |
|
|
|
// [filterQuery and filterQueryLanguage] |
|
buf.putString(msg->filterQuery); |
|
buf.putString(msg->filterQueryLanguage); |
|
|
|
// [returnQueryResultClass] |
|
buf.putBoolean(msg->returnQueryResultClass); |
|
|
|
buf.putUint32(msg->maxObjectCount); |
|
buf.putUint32Arg(msg->operationTimeout); |
|
} |
|
|
|
static CIMOpenQueryInstancesRequestMessage* |
|
_decodeOpenQueryInstancesRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId, |
|
Uint32 flags, |
|
const String& messageId) |
|
{ |
|
/* See ../Server/CIMOperationRequestDecoder.cpp */ |
|
|
|
STAT_GETSTARTTIME |
|
|
|
Boolean continueOnError = flags & CONTINUE_ON_ERROR; |
|
|
|
// [NAMESPACE] |
|
CIMNamespaceName nameSpace; |
|
if (!in.getNamespaceName(nameSpace)) |
|
return 0; |
|
|
|
// [FILTERQUERY and FILTERQUERYSTRING] |
|
String filterQuery; |
|
if (!in.getString(filterQuery)) |
|
return 0; |
|
String filterQueryLanguage; |
|
if (!in.getString(filterQueryLanguage)) |
|
return 0; |
|
|
|
// [RETURNQUERYRESULTCLASS] |
|
Boolean returnQueryResultClass; |
|
if (!in.getBoolean(returnQueryResultClass)) |
|
return 0; |
|
|
|
// These can all be one common function. |
|
Uint32 maxObjectCount; |
|
if (!in.getUint32(maxObjectCount)) |
|
return 0; |
|
Uint32Arg operationTimeout; |
|
if (!in.getUint32Arg(operationTimeout)) |
|
return 0; |
|
|
|
AutoPtr<CIMOpenQueryInstancesRequestMessage> request( |
|
new CIMOpenQueryInstancesRequestMessage( |
|
messageId, |
|
nameSpace, |
|
filterQuery, |
|
filterQueryLanguage, |
|
returnQueryResultClass, |
|
operationTimeout, |
|
continueOnError, |
|
maxObjectCount, |
|
QueueIdStack(queueId, returnQueueId))); |
|
|
|
request->binaryRequest = true; |
|
|
|
STAT_SERVERSTART |
|
|
|
return request.release(); |
|
} |
|
|
|
static void _encodeOpenQueryInstancesResponseBody( |
|
CIMBuffer& out, |
|
CIMOpenQueryInstancesResponseMessage* msg, |
|
CIMResponseData& data, |
|
CIMName& name) |
|
{ |
|
/* See ../Server/CIMOperationResponseEncoder.cpp */ |
|
|
|
out.putClass(msg->queryResultClass); |
|
|
|
// [endOfSequence] |
|
out.putBoolean(msg->endOfSequence); |
|
|
|
// [enumerationContext] |
|
out.putString(msg->enumerationContext); |
|
|
|
data.encodeBinaryResponse(out); |
|
} |
|
|
|
static CIMOpenQueryInstancesResponseMessage* |
|
_decodeOpenQueryInstancesResponse( |
|
CIMBuffer& in, |
|
const String& messageId) |
|
{ |
|
CIMException cimException; |
|
|
|
// KS_TODO Should we set validation??? |
|
// Turn on validation: This is a debugging tool |
|
//#if defined(ENABLE_VALIDATION) |
|
// buf.setValidate(true); |
|
//#endif |
|
|
|
Boolean endOfSequence; |
|
if (!in.getBoolean(endOfSequence)) |
|
return 0; |
|
|
|
String enumerationContext; |
|
if (!in.getString(enumerationContext)) |
|
return 0; |
|
|
|
CIMOpenQueryInstancesResponseMessage* msg = |
|
new CIMOpenQueryInstancesResponseMessage( |
|
messageId, |
|
cimException, |
|
CIMClass(), |
|
endOfSequence, |
|
enumerationContext, |
|
QueueIdStack()); |
|
|
|
// Instead of resolving the binary data here, delegate this |
|
// to a later point in time when the data is actually retrieved through |
|
// a call to CIMResponseData::getInstances, which |
|
// resolves the binary data as it is passed to the next interface. |
|
// 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; |
|
return msg; |
|
} |
|
|
|
// EXP_PULL_END |
|
|
|
|
|
//============================================================================== |
|
// |
|
// 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() |
|
// |
|
//============================================================================== |
|
|
|
CIMOperationRequestMessage* BinaryCodec::decodeRequest( |
|
CIMBuffer& in, |
|
Uint32 queueId, |
|
Uint32 returnQueueId) |
|
{ |
|
|
|
// Turn on validation: |
|
#if defined(ENABLE_VALIDATION) |
|
in.setValidate(true); |
|
#endif |
|
|
|
Uint32 flags; |
|
String messageId; |
|
Operation operation; |
|
|
|
|
|
if (!_getHeader(in, flags, messageId, operation)) |
|
{ |
|
return 0; |
|
} |
|
|
|
switch (operation) |
|
{ |
|
case OP_EnumerateInstances: |
|
return _decodeEnumerateInstancesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateInstanceNames: |
|
return _decodeEnumerateInstanceNamesRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_GetInstance: |
|
return _decodeGetInstanceRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_CreateInstance: |
|
return _decodeCreateInstanceRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_ModifyInstance: |
|
return _decodeModifyInstanceRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_DeleteInstance: |
|
return _decodeDeleteInstanceRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_Associators: |
|
return _decodeAssociatorsRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_AssociatorNames: |
|
return _decodeAssociatorNamesRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_References: |
|
return _decodeReferencesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_ReferenceNames: |
|
return _decodeReferenceNamesRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_GetClass: |
|
return _decodeGetClassRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateClasses: |
|
return _decodeEnumerateClassesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_EnumerateClassNames: |
|
return _decodeEnumerateClassNamesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
case OP_CreateClass: |
|
return _decodeCreateClassRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_DeleteClass: |
|
return _decodeDeleteClassRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_ModifyClass: |
|
return _decodeModifyClassRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_SetQualifier: |
|
return _decodeSetQualifierRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_GetQualifier: |
|
return _decodeGetQualifierRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_DeleteQualifier: |
|
return _decodeDeleteQualifierRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_EnumerateQualifiers: |
|
return _decodeEnumerateQualifiersRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_GetProperty: |
|
return _decodeGetPropertyRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_SetProperty: |
|
return _decodeSetPropertyRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_InvokeMethod: |
|
return _decodeInvokeMethodRequest( |
|
in, queueId, returnQueueId, messageId); |
|
case OP_ExecQuery: |
|
return _decodeExecQueryRequest( |
|
in, queueId, returnQueueId, messageId); |
|
//EXP_PULL_BEGIN |
|
case OP_OpenEnumerateInstances: |
|
return _decodeOpenEnumerateInstancesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_OpenEnumerateInstancePaths: |
|
return _decodeOpenEnumerateInstancePathsRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_OpenReferenceInstances: |
|
return _decodeOpenReferenceInstancesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_OpenReferenceInstancePaths: |
|
return _decodeOpenReferenceInstancePathsRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_OpenAssociatorInstances: |
|
return _decodeOpenAssociatorInstancesRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_OpenAssociatorInstancePaths: |
|
return _decodeOpenAssociatorInstancePathsRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_PullInstancesWithPath: |
|
return _decodePullInstancesWithPathRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_PullInstancePaths: |
|
return _decodePullInstancePathsRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_CloseEnumeration: |
|
return _decodeCloseEnumerationRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
case OP_EnumerationCount: |
|
return _decodeEnumerationCountRequest( |
|
in, queueId, returnQueueId, flags, messageId); |
|
break; |
|
//EXP_PULL_END |
|
default: |
|
// Unexpected message type |
|
PEGASUS_ASSERT(0); |
|
return 0; |
|
} |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// BinaryCodec::decodeResponse() |
|
// |
|
//============================================================================== |
|
|
|
CIMResponseMessage* BinaryCodec::decodeResponse( |
|
const Buffer& in) |
|
{ |
|
CIMBuffer buf((char*)in.getData(), in.size()); |
|
CIMBufferReleaser buf_(buf); |
|
|
|
return decodeResponse(buf); |
|
} |
|
|
|
CIMResponseMessage* BinaryCodec::decodeResponse( |
|
CIMBuffer& buf) |
|
{ |
|
// Turn on validation: This is a debugging tool |
|
#if defined(ENABLE_VALIDATION) |
|
buf.setValidate(true); |
|
#endif |
|
|
|
Uint32 flags; |
|
String messageId; |
|
Operation operation; |
|
|
|
if (!_getHeader(buf, flags, messageId, operation)) |
|
{ |
|
throw CIMException(CIM_ERR_FAILED, "Corrupt binary message header"); |
|
return 0; |
|
} |
|
|
|
CIMResponseMessage* msg = 0; |
|
|
|
switch (operation) |
{ | { |
case OP_EnumerateInstances: | case OP_EnumerateInstances: |
msg = _decodeEnumerateInstancesResponse(buf, messageId); | msg = _decodeEnumerateInstancesResponse(buf, messageId); |
|
|
case OP_ExecQuery: | case OP_ExecQuery: |
msg = _decodeExecQueryResponse(buf, messageId); | msg = _decodeExecQueryResponse(buf, messageId); |
break; | break; |
|
//EXP_PULL_BEGIN |
|
case OP_OpenEnumerateInstances: |
|
msg = _decodeOpenEnumerateInstancesResponse(buf, messageId); |
|
break; |
|
case OP_OpenEnumerateInstancePaths: |
|
msg = _decodeOpenEnumerateInstancePathsResponse(buf, messageId); |
|
break; |
|
case OP_OpenReferenceInstances: |
|
msg = _decodeOpenReferenceInstancesResponse(buf, messageId); |
|
break; |
|
case OP_OpenReferenceInstancePaths: |
|
msg = _decodeOpenReferenceInstancePathsResponse(buf, messageId); |
|
break; |
|
case OP_OpenAssociatorInstances: |
|
msg = _decodeOpenAssociatorInstancesResponse(buf, messageId); |
|
break; |
|
case OP_OpenAssociatorInstancePaths: |
|
msg = _decodeOpenAssociatorInstancePathsResponse(buf, messageId); |
|
break; |
|
case OP_PullInstancesWithPath: |
|
msg = _decodePullInstancesWithPathResponse(buf, messageId); |
|
break; |
|
case OP_PullInstancePaths: |
|
msg = _decodePullInstancePathsResponse(buf, messageId); |
|
break; |
|
case OP_CloseEnumeration: |
|
msg = _decodeCloseEnumerationResponse(buf, messageId); |
|
break; |
|
case OP_OpenQueryInstances: |
|
msg = _decodeCloseEnumerationResponse(buf, messageId); |
|
break; |
|
//EXP_PULL_END |
default: | default: |
// Unexpected message type | // Unexpected message type |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
break; | break; |
} | } |
| |
|
|
const String& messageId, | const String& messageId, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
const ContentLanguageList& httpContentLanguages, | const ContentLanguageList& httpContentLanguages, |
|
const Buffer& rtnParams, |
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)); |
|
|
{ | { |
out.append(body.getData(), body.size()); | out.append(body.getData(), body.size()); |
} | } |
|
// EXP_PULL TODO - TBD Review this. |
|
// If there are any parameters include them here. |
|
// Assumes that it is prebuilt with all components |
|
// |
|
if (rtnParams.size() != 0) |
|
{ |
|
out << rtnParams; |
|
} |
|
// |
|
// //EXP_PULL_END |
| |
return out; | return out; |
} | } |
|
|
break; | break; |
} | } |
| |
|
//EXP_PULL_BEGIN |
|
case CIM_OPEN_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenEnumerateInstancesRequest(buf, |
|
(CIMOpenEnumerateInstancesRequestMessage*)msg, name); |
|
break; |
|
} |
|
|
|
case CIM_OPEN_ENUMERATE_INSTANCE_PATHS_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenEnumerateInstancePathsRequest(buf, |
|
(CIMOpenEnumerateInstancePathsRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_OPEN_ASSOCIATOR_INSTANCES_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenAssociatorInstancesRequest(buf, |
|
(CIMOpenAssociatorInstancesRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_OPEN_ASSOCIATOR_INSTANCE_PATHS_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenAssociatorInstancePathsRequest(buf, |
|
(CIMOpenAssociatorInstancePathsRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_OPEN_REFERENCE_INSTANCES_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenReferenceInstancesRequest(buf, |
|
(CIMOpenReferenceInstancesRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_OPEN_REFERENCE_INSTANCE_PATHS_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenReferenceInstancePathsRequest(buf, |
|
(CIMOpenReferenceInstancePathsRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_PULL_INSTANCES_WITH_PATH_REQUEST_MESSAGE: |
|
{ |
|
_encodePullInstancesWithPathRequest(buf, |
|
(CIMPullInstancesWithPathRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_PULL_INSTANCE_PATHS_REQUEST_MESSAGE: |
|
{ |
|
_encodePullInstancePathsRequest(buf, |
|
(CIMPullInstancePathsRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_CLOSE_ENUMERATION_REQUEST_MESSAGE: |
|
{ |
|
_encodeCloseEnumerationRequest(buf, |
|
(CIMCloseEnumerationRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_ENUMERATION_COUNT_REQUEST_MESSAGE: |
|
{ |
|
_encodeEnumerationCountRequest(buf, |
|
(CIMEnumerationCountRequestMessage*)msg, name); |
|
break; |
|
} |
|
case CIM_OPEN_QUERY_INSTANCES_REQUEST_MESSAGE: |
|
{ |
|
_encodeOpenQueryInstancesRequest(buf, |
|
(CIMOpenQueryInstancesRequestMessage*)msg, name); |
|
break; |
|
} |
|
//EXP_PULL_END |
|
|
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; |
|
|
_encodeEnumerateInstancesResponseBody( | _encodeEnumerateInstancesResponseBody( |
buf, | buf, |
((CIMEnumerateInstancesResponseMessage*)msg)->getResponseData(), | ((CIMEnumerateInstancesResponseMessage*)msg)->getResponseData(), |
name); |
name, |
|
(msg->getIndex() == 0)); |
break; | break; |
} | } |
| |
|
|
break; | break; |
} | } |
| |
|
//EXP_PULL_BEGIN |
|
case CIM_OPEN_ENUMERATE_INSTANCES_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenEnumerateInstancesResponseBody(buf, |
|
(CIMOpenEnumerateInstancesResponseMessage*)msg, |
|
((CIMOpenEnumerateInstancesResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_OPEN_ENUMERATE_INSTANCE_PATHS_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenEnumerateInstancePathsResponseBody(buf, |
|
(CIMOpenEnumerateInstancePathsResponseMessage*)msg, |
|
((CIMOpenEnumerateInstancePathsResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_OPEN_REFERENCE_INSTANCES_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenReferenceInstancesResponseBody(buf, |
|
(CIMOpenReferenceInstancesResponseMessage*)msg, |
|
((CIMOpenReferenceInstancesResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_OPEN_REFERENCE_INSTANCE_PATHS_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenReferenceInstancePathsResponseBody(buf, |
|
(CIMOpenReferenceInstancePathsResponseMessage*)msg, |
|
((CIMOpenReferenceInstancePathsResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
case CIM_OPEN_ASSOCIATOR_INSTANCES_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenAssociatorInstancesResponseBody(buf, |
|
(CIMOpenAssociatorInstancesResponseMessage*)msg, |
|
((CIMOpenAssociatorInstancesResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_OPEN_ASSOCIATOR_INSTANCE_PATHS_RESPONSE_MESSAGE: |
|
{ |
|
_encodeOpenAssociatorInstancePathsResponseBody(buf, |
|
(CIMOpenAssociatorInstancePathsResponseMessage*)msg, |
|
((CIMOpenAssociatorInstancePathsResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_PULL_INSTANCES_WITH_PATH_RESPONSE_MESSAGE: |
|
{ |
|
_encodePullInstancesWithPathResponseBody(buf, |
|
(CIMPullInstancesWithPathResponseMessage*)msg, |
|
((CIMPullInstancesWithPathResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
|
|
case CIM_PULL_INSTANCE_PATHS_RESPONSE_MESSAGE: |
|
{ |
|
_encodePullInstancePathsResponseBody(buf, |
|
(CIMPullInstancePathsResponseMessage*)msg, |
|
((CIMPullInstancePathsResponseMessage*)msg)-> |
|
getResponseData(), |
|
name); |
|
break; |
|
} |
|
case CIM_CLOSE_ENUMERATION_RESPONSE_MESSAGE: |
|
{ |
|
_encodeCloseEnumerationResponseBody(buf, |
|
(CIMCloseEnumerationResponseMessage*)msg, |
|
name); |
|
break; |
|
} |
|
case CIM_ENUMERATION_COUNT_RESPONSE_MESSAGE: |
|
{ |
|
_encodeEnumerationCountResponseBody(buf, |
|
(CIMEnumerationCountResponseMessage*)msg, |
|
name); |
|
break; |
|
} |
|
//EXP_PULL_END |
|
|
default: | default: |
// Unexpected message type | // Unexpected message type |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
return false; | return false; |
} | } |
| |