void ExProcessIdsOfFrag::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { ex_assert(objType == ESP_PROCESS_IDS_OF_FRAG AND objVersion == CurrProcessIdsOfFragVersion AND sameEndianness AND objSize >= baseClassPackedLength() + sizeof(fragmentId_) + sizeof(CollIndex), "Received invalid ProcessIdsOfFrag object"); unpackBaseClass(buffer); // unpack fragment id and number of entries Int32 np; buffer += sizeof(spare_); str_cpy_all((char *) &fragmentId_, buffer, sizeof(fragmentId_)); buffer += sizeof(fragmentId_); str_cpy_all((char *) &np, buffer, sizeof(np)); buffer += sizeof(np); // unpack the process ids for (CollIndex i = 0; i < (CollIndex) np; i++) { alignBufferForNextObj(buffer); processIds_.insert(IpcProcessId()); processIds_[i].unpackDependentObjFromBuffer(buffer,sameEndianness); } }
void TupMsgBuffer::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { ex_assert((objType == ESP_INPUT_SQL_BUFFER OR objType == ESP_OUTPUT_SQL_BUFFER) AND objVersion == 100 AND sameEndianness AND objSize > sizeof(IpcMessageObj), "invalid type or version for TupMsgBuffer::unpackObj()"); unpackBaseClass(buffer); IpcMessageObjSize sqlBufferSize = objSize - sizeof(IpcMessageObj); ex_assert(allocSize_ >= (Lng32) sqlBufferSize, "TupMsgBuffer too small for unpack"); #pragma nowarn(1506) // warning elimination str_cpy_all((char *) theBuffer_, buffer, sqlBufferSize); #pragma warn(1506) // warning elimination // convert offsets in buffer to pointers theBuffer_->driveUnpack(); // just checking whether we really got the right size info ex_assert(sqlBufferSize == theBuffer_->get_buffer_size(), "Buffer size mismatch"); }
void ExMsgResourceInfo::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { ExScratchFileOptions *sfo; IpcConstMessageBufferPtr start = buffer; ex_assert(objType == ESP_RESOURCE_INFO AND objVersion == 100 AND sameEndianness AND objSize > sizeof(IpcMessageObj), "invalid type or version for ExMsgResourceInfo::unpackObj()"); unpackBaseClass(buffer); str_cpy_all((char *) &totalNameLength_,buffer,sizeof(totalNameLength_)); buffer += sizeof(totalNameLength_); buffer += sizeof(spare_); if (bufferForDependentObjects_) { getHeap()->deallocateMemory(bufferForDependentObjects_); bufferForDependentObjects_ = NULL; } sfo = new(getHeap()) ExScratchFileOptions; // sfo_ is const sfo_ = sfo; sfo->ipcUnpackObj(objSize - (buffer-start), buffer, getHeap(), totalNameLength_, bufferForDependentObjects_); }
void CmpMessageObj::unpackMyself(IpcMessageObjType, IpcMessageObjVersion, NABoolean, IpcMessageObjSize, IpcConstMessageBufferPtr& buffer) { unpackBaseClass(buffer); unpackBuffer(buffer, id_); }
void ExSMDownloadInfo::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { ex_assert(objType == ESP_SM_DOWNLOAD_INFO && objVersion == 100 && sameEndianness && objSize > sizeof(IpcMessageObj), "Invalid type or version for ExSMDownloadInfo::unpackObj()"); unpackBaseClass(buffer); unpackBuffer(buffer, smQueryID_); unpackBuffer(buffer, smTraceLevel_); unpackBuffer(buffer, flags_); unpackBuffer(buffer, smTraceFilePrefix_, getHeap()); }
void ExMsgTimeoutData::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { IpcConstMessageBufferPtr start = buffer; ex_assert(objType == ESP_TIMEOUT_DATA AND objVersion == 100 AND sameEndianness AND objSize > sizeof(IpcMessageObj), "invalid type or version for ExMsgTimeoutData::unpackObj()"); unpackBaseClass(buffer); timeoutData_ = new ( getHeap() ) TimeoutData( getHeap() ) ; timeoutData_->unpackObj(buffer); iOwnTD_ = TRUE; // on the ESP side; I own the newly allocated timeoutData_ }
void ExMsgFragment::unpackObj(IpcMessageObjType objType, IpcMessageObjVersion objVersion, NABoolean sameEndianness, IpcMessageObjSize objSize, IpcConstMessageBufferPtr buffer) { // See description of packed format in packedLength() method // get rid of existing data members if (fragment_ AND f_.iOwnTheFragment_) getHeap()->deallocateMemory(fragment_); ex_assert(objType == ESP_FRAGMENT AND objVersion == CurrFragmentVersion AND sameEndianness, "Invalid object presented to ExMsgFragment::unpackObj()"); // Unpack the base class unpackBaseClass(buffer); alignBufferForNextObj(buffer); // Before copying from buffer into f_, first release any // memory pointed to by f_. Currently the only memory // pointed to is f_.userName_. if (f_.userName_ != NULL) { getHeap()->deallocateMemory(f_.userName_); f_.userName_ = NULL; } // Unpack the fixed length field fields str_cpy_all((char *) &f_,buffer,sizeof(f_)); buffer += sizeof(f_); alignBufferForNextObj(buffer); // Unpack the query ID. If a query ID is present in this request, // f_.queryId_ will contain an address from the sending process. if (f_.queryId_ != NULL) { f_.queryId_ = new (getHeap()) char[f_.queryIdLen_ + 1]; str_cpy_all(f_.queryId_, buffer, f_.queryIdLen_); f_.queryId_[f_.queryIdLen_] = '\0'; buffer += f_.queryIdLen_; alignBufferForNextObj(buffer); } // Unpack the user name. If a user name is present in this request, // f_.userName_ will contain an address from the sending process. if (f_.userName_ != NULL) { f_.userName_ = new (getHeap()) char[f_.userNameLen_]; str_cpy_all(f_.userName_, buffer, f_.userNameLen_); buffer += f_.userNameLen_; alignBufferForNextObj(buffer); } // Unpack the fragment itself fragment_ = new(getHeap()) char[f_.fragmentLength_]; f_.iOwnTheFragment_ = TRUE; if (f_.compressedLength_ > 0 && f_.compressedLength_ < f_.fragmentLength_) { size_t decpSize = str_decompress(fragment_,buffer,f_.compressedLength_); ex_assert(decpSize == f_.fragmentLength_, "Error during uncompress a downloaded fragment"); buffer += f_.compressedLength_; } else { #pragma nowarn(1506) // warning elimination str_cpy_all(fragment_, buffer,f_.fragmentLength_); #pragma warn(1506) // warning elimination buffer += f_.fragmentLength_; } alignBufferForNextObj(buffer); // Unpack the fragment key key_.unpackDependentObjFromBuffer(buffer,sameEndianness); ex_assert(objSize == packedLength(), "Error during unpacking a downloaded fragment"); }