version 1.5.2.16, 2013/11/21 17:59:42
|
version 1.5.2.23, 2014/04/14 17:33:11
|
|
|
return false; | return false; |
} | } |
#endif | #endif |
PEG_TRACE((TRC_XML, Tracer::LEVEL4, |
//// KS TODO Remove this diagnostic completely |
"CIMResponseData Size _size=%u", _size)); |
//// PEG_TRACE((TRC_XML, Tracer::LEVEL4, |
|
//// "CIMResponseData Size _size=%u", _size)); |
return true; | return true; |
} | } |
| |
|
|
bool CIMResponseData::setBinary(CIMBuffer& in) | bool CIMResponseData::setBinary(CIMBuffer& in) |
{ | { |
PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setBinary"); | PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setBinary"); |
//// AutoMutex autoMut(testLock); |
|
| |
// Append all serial data from the CIMBuffer to the local data store. | // Append all serial data from the CIMBuffer to the local data store. |
// Returns error if input not a serialized Uint8A | // Returns error if input not a serialized Uint8A |
|
|
| |
bool CIMResponseData::setRemainingBinaryData(CIMBuffer& in) | bool CIMResponseData::setRemainingBinaryData(CIMBuffer& in) |
{ | { |
//// AutoMutex autoMut(testLock); |
|
PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setRemainingBinaryData"); | PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setRemainingBinaryData"); |
| |
// Append any data that has not been deserialized already from | // Append any data that has not been deserialized already from |
|
|
| |
// Return the number of CIM objects in the CIM Response data object | // Return the number of CIM objects in the CIM Response data object |
// | // |
#define TEMPLOG PEG_TRACE((TRC_XML, Tracer::LEVEL4, \ |
////#define TEMPLOG PEG_TRACE((TRC_XML, Tracer::LEVEL4, \ |
"rtnSize %u size %u line %u", rtnSize, _size, __LINE__)) |
//// "rtnSize %u size %u line %u", rtnSize, _size, __LINE__)) |
//#define TEMPLOG cout << "rtnSize " << rtnSize << " _size " << _size |
#define TEMPLOG |
//<< " line " << __LINE__ << endl |
|
| |
Uint32 CIMResponseData::size() | Uint32 CIMResponseData::size() |
{ | { |
|
|
TEMPLOG; | TEMPLOG; |
} | } |
// Test of actual count against _size variable. KS_TODO diagnostic | // Test of actual count against _size variable. KS_TODO diagnostic |
if (rtnSize != _size) |
Uint32 lsize = _size; |
|
if (rtnSize != lsize) |
{ | { |
TEMPLOG; | TEMPLOG; |
TEST_SIZE_VALID; | TEST_SIZE_VALID; |
PEG_TRACE((TRC_XML, Tracer::LEVEL1, | PEG_TRACE((TRC_XML, Tracer::LEVEL1, |
"CIMResponseData::size ERROR. debug size mismatch." | "CIMResponseData::size ERROR. debug size mismatch." |
"Computed = %u. variable = %u",rtnSize, _size )); |
"Computed = %u. variable = %u inc binary %s",rtnSize, _size, |
|
boolToString(RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) |
|
)); |
// KS_TEMP | // KS_TEMP |
cout << "Size err Computed(rtnsize)=" << rtnSize << " _size=" << _size |
cout << "Size err Computed(rtnsize)=" << rtnSize << " _size=" << lsize |
<< " diff=" << (rtnSize - _size) << endl; |
<< " diff=" << (rtnSize - lsize) |
|
<< " inc Binary= " |
|
<< boolToString(RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) |
|
<< endl; |
TEMPLOG; | TEMPLOG; |
} | } |
PEG_TRACE((TRC_XML, Tracer::LEVEL1, "ReturnSize=%u", _size )); | PEG_TRACE((TRC_XML, Tracer::LEVEL1, "ReturnSize=%u", _size )); |
|
|
_nameSpacesData.appendArray(x._nameSpacesData); | _nameSpacesData.appendArray(x._nameSpacesData); |
_size += x._instanceData.size(); | _size += x._instanceData.size(); |
| |
|
|
|
|
// transfer property list | // transfer property list |
_propertyList = x._propertyList; | _propertyList = x._propertyList; |
| |
|
|
// KS_TODO | // KS_TODO |
if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) | if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) |
{ | { |
PEGASUS_ASSERT(false); // KS_TEMP |
|
|
|
// Binary does NOT need a marker as it consists of C++ and SCMO | // Binary does NOT need a marker as it consists of C++ and SCMO |
const Array<Uint8>& data = _binaryData; | const Array<Uint8>& data = _binaryData; |
out.putBytes(data.getData(), data.size()); | out.putBytes(data.getData(), data.size()); |
|
|
"CIMResponseData::encodeXmlResponse"); | "CIMResponseData::encodeXmlResponse"); |
| |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, | PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::encodeXmlResponse(encoding=%X,dataType=%X, pull= %s)", |
"CIMResponseData::encodeXmlResponse(encoding=%X,dataType=%X, isPull= %s" |
|
" encodeInstanceOnly= %s)", |
_encoding, | _encoding, |
_dataType, | _dataType, |
(isPullResponse? "true" : "false"))); |
boolToString(isPullResponse), |
|
boolToString(encodeInstanceOnly) )); |
| |
// already existing Internal XML does not need to be encoded further | // already existing Internal XML does not need to be encoded further |
// binary input is not actually impossible here, but we have an established | // binary input is not actually impossible here, but we have an established |
|
|
| |
for (Uint32 i = 0, n = a.size(); i < n; i++) | for (Uint32 i = 0, n = a.size(); i < n; i++) |
{ | { |
|
if (isPullResponse) |
|
{ |
|
out << STRLIT("<VALUE.INSTANCEWITHPATH>\n"); |
|
} |
|
else |
|
{ |
out << STRLIT("<VALUE.OBJECTWITHPATH>\n"); | out << STRLIT("<VALUE.OBJECTWITHPATH>\n"); |
|
} |
out << STRLIT("<INSTANCEPATH>\n"); | out << STRLIT("<INSTANCEPATH>\n"); |
XmlWriter::appendNameSpacePathElement( | XmlWriter::appendNameSpacePathElement( |
out, | out, |
_hostsData[i], | _hostsData[i], |
_nameSpacesData[i]); | _nameSpacesData[i]); |
|
|
|
if (isPullResponse) |
|
{ |
|
out.append((char*)b[i].getData(),b[i].size()-1); |
|
} |
|
else |
|
{ |
// Leave out the surrounding tags "<VALUE.REFERENCE>\n" | // Leave out the surrounding tags "<VALUE.REFERENCE>\n" |
// and "</VALUE.REFERENCE>\n" which are 18 and 19 characters |
// and "</VALUE.REFERENCE>\n" which are 18 and 19 |
// long |
// characters long |
|
//// KS_TODO Should be able to do this by properly |
|
//// building in the CIMXmlInternalEncoder |
out.append( | out.append( |
((char*)b[i].getData())+18, | ((char*)b[i].getData())+18, |
b[i].size() - 1 - 18 -19); | b[i].size() - 1 - 18 -19); |
|
} |
|
|
out << STRLIT("</INSTANCEPATH>\n"); | out << STRLIT("</INSTANCEPATH>\n"); |
// append instance body | // append instance body |
out.append((char*)a[i].getData(), a[i].size() - 1); | out.append((char*)a[i].getData(), a[i].size() - 1); |
|
if (isPullResponse) |
|
{ |
|
out << STRLIT("</VALUE.INSTANCEWITHPATH>\n"); |
|
} |
|
else |
|
{ |
out << STRLIT("</VALUE.OBJECTWITHPATH>\n"); | out << STRLIT("</VALUE.OBJECTWITHPATH>\n"); |
} | } |
|
} |
break; | break; |
} | } |
// internal xml encoding of instance names and object paths not | // internal xml encoding of instance names and object paths not |
|
|
{ | { |
CIMInstance x = (CIMInstance)_objects[i]; | CIMInstance x = (CIMInstance)_objects[i]; |
XmlWriter::appendValueInstanceWithPathElement( | XmlWriter::appendValueInstanceWithPathElement( |
out, x, |
out, |
|
x, |
_includeQualifiers, | _includeQualifiers, |
_includeClassOrigin, | _includeClassOrigin, |
_propertyList); | _propertyList); |
|
|
for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++) | for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++) |
{ | { |
// ObjectPaths come from providers for pull operations | // ObjectPaths come from providers for pull operations |
// but are encoded as instancePathElements |
// but are encoded as instancePathElements. If pull |
|
// only instances allowed. |
if (isPullResponse) | if (isPullResponse) |
|
|
{ | { |
XmlWriter::appendInstancePathElement(out, |
XmlWriter::appendInstancePathElement( |
|
out, |
_instanceNames[i]); | _instanceNames[i]); |
} | } |
else | else |
{ | { |
|
//Append The path element (Class or instance) |
out << "<OBJECTPATH>\n"; | out << "<OBJECTPATH>\n"; |
XmlWriter::appendValueReferenceElement( |
XmlWriter::appendClassOrInstancePathElement( |
out, | out, |
_instanceNames[i], | _instanceNames[i], |
_isClassOperation, |
_isClassOperation); |
false); |
|
out << "</OBJECTPATH>\n"; | out << "</OBJECTPATH>\n"; |
} | } |
} | } |
|
|
else | else |
{ | { |
out << "<OBJECTPATH>\n"; | out << "<OBJECTPATH>\n"; |
SCMOXmlWriter::appendValueReferenceElement( |
SCMOXmlWriter::appendClassOrInstancePathElement( |
out, _scmoInstances[i], |
out, _scmoInstances[i]); |
false); |
|
out << "</OBJECTPATH>\n"; | out << "</OBJECTPATH>\n"; |
} | } |
} | } |
|
|
} | } |
} | } |
} | } |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
// contrary to encodeXmlResponse this function encodes the Xml in a format | // contrary to encodeXmlResponse this function encodes the Xml in a format |
// not usable by clients | // not usable by clients |
void CIMResponseData::encodeInternalXmlResponse(CIMBuffer& out) |
void CIMResponseData::encodeInternalXmlResponse(CIMBuffer& out, |
|
Boolean isPullOperation) |
{ | { |
PEG_METHOD_ENTER(TRC_DISPATCHER, | PEG_METHOD_ENTER(TRC_DISPATCHER, |
"CIMResponseData::encodeInternalXmlResponse"); | "CIMResponseData::encodeInternalXmlResponse"); |
| |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, | PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::encodeInternalXmlResponse(encoding=%X,content=%X)", |
"CIMResponseData::encodeInternalXmlResponse(encoding=%X,content=%X" |
|
" isPullOperation=%s)", |
_encoding, | _encoding, |
_dataType)); |
_dataType, |
|
boolToString(isPullOperation))); |
|
|
// For mixed (CIM+SCMO) responses, we need to tell the receiver the | // For mixed (CIM+SCMO) responses, we need to tell the receiver the |
// total number of instances. The totalSize variable is used to keep track | // total number of instances. The totalSize variable is used to keep track |
// of this. | // of this. |
|
|
out.putUint32(totalSize); | out.putUint32(totalSize); |
for (Uint32 i = 0; i < n; i++) | for (Uint32 i = 0; i < n; i++) |
{ | { |
|
// if is pull map to instances. |
|
if (isPullOperation) |
|
{ |
|
CIMInternalXmlEncoder::_putXMLNamedInstance( |
|
out, |
|
(CIMInstance)_objects[i], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
|
} |
|
else |
|
{ |
CIMInternalXmlEncoder::_putXMLObject( | CIMInternalXmlEncoder::_putXMLObject( |
out, | out, |
_objects[i], | _objects[i], |
|
|
_includeClassOrigin, | _includeClassOrigin, |
_propertyList); | _propertyList); |
} | } |
|
} |
break; | break; |
} | } |
// internal xml encoding of instance names and object paths not | // internal xml encoding of instance names and object paths not |
|
|
{ | { |
out.putUint32(n); | out.putUint32(n); |
} | } |
|
// if is pull map to instances. |
|
if (isPullOperation) |
|
{ |
|
SCMOInternalXmlEncoder::_putXMLNamedInstance( |
|
out, |
|
_scmoInstances, |
|
_propertyList); |
|
} |
|
else |
|
{ |
SCMOInternalXmlEncoder::_putXMLObject( | SCMOInternalXmlEncoder::_putXMLObject( |
out, | out, |
_scmoInstances, | _scmoInstances, |
_propertyList); | _propertyList); |
|
} |
break; | break; |
} | } |
// internal xml encoding of instance names and object paths not | // internal xml encoding of instance names and object paths not |
|
|
_isClassOperation = b; | _isClassOperation = b; |
} | } |
| |
//// KS_TODO Remove. Diagnostic Display |
//// KS_TODO Remove. Diagnostic Displays below before commit to head |
void CIMResponseData::traceResponseData() | void CIMResponseData::traceResponseData() |
{ | { |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, | PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
|
"%s", (const char*)toStringTraceResponseData().getCString() )); |
|
} |
|
String CIMResponseData::toStringTraceResponseData() |
|
{ |
|
int rtnSize; |
|
char *p; |
|
|
|
int allocSize = 256; |
|
|
|
if ((p = (char*)malloc(allocSize)) == NULL) |
|
{ |
|
return String(); |
|
} |
|
|
|
do |
|
{ |
|
rtnSize = snprintf(p, allocSize, |
"CIMResponseData::traceResponseData(encoding=%X,dataType=%X " | "CIMResponseData::traceResponseData(encoding=%X,dataType=%X " |
" size=%u C++instNamecount=%u c++Instances=%u c++Objects=%u " | " size=%u C++instNamecount=%u c++Instances=%u c++Objects=%u " |
"scomInstances=%u XMLInstData=%u binaryData=%u " | "scomInstances=%u XMLInstData=%u binaryData=%u " |
|
|
_instanceNames.size(),_instances.size(), _objects.size(), | _instanceNames.size(),_instances.size(), _objects.size(), |
_scmoInstances.size(),_instanceData.size(),_binaryData.size(), | _scmoInstances.size(),_instanceData.size(),_binaryData.size(), |
_referencesData.size(), _instanceData.size(), _hostsData.size(), | _referencesData.size(), _instanceData.size(), _hostsData.size(), |
_nameSpacesData.size() )); |
_nameSpacesData.size()); |
|
|
|
// return if successful if not negative and |
|
// returns less than allocated size. |
|
if (rtnSize > -1 && rtnSize < allocSize) |
|
{ |
|
break; |
} | } |
| |
|
// increment alloc size. Assumes that positive return is |
|
// expected size and negative is error. |
|
allocSize = (rtnSize > -1)? (rtnSize + 1) : allocSize * 2; |
|
|
|
} while((p = (char*)peg_inln_realloc(p, allocSize)) != NULL); |
|
|
|
// Free allocated memory and return formatted output in String |
|
String rtnStr(p); |
|
free(p); |
|
return(rtnStr); |
|
} |
|
|
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |