Commit 4f4b3716 authored by Steven Murray's avatar Steven Murray
Browse files

Moved the unmarshalling of an RCP job reply message to the Marshaller.

parent b7869655
...@@ -133,7 +133,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -133,7 +133,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::InvalidArgument ex; castor::exception::InvalidArgument ex;
ex.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
<< ": " << oss.str();
throw ex; throw ex;
} }
} }
...@@ -154,7 +155,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -154,7 +155,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::InvalidArgument ex; castor::exception::InvalidArgument ex;
ex.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
<< ": " << oss.str();
throw ex; throw ex;
} }
case ':': case ':':
...@@ -169,7 +171,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -169,7 +171,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::InvalidArgument ex; castor::exception::InvalidArgument ex;
ex.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
<< ": " << oss.str();
throw ex; throw ex;
} }
default: default:
...@@ -185,7 +188,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -185,7 +188,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::Internal ex; castor::exception::Internal ex;
ex.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
<< ": " << oss.str();
throw ex; throw ex;
} }
} }
...@@ -202,7 +206,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -202,7 +206,8 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::Internal ex; castor::exception::Internal ex;
ex.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
<< ": " << oss.str();
throw ex; throw ex;
} }
...@@ -219,9 +224,10 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine( ...@@ -219,9 +224,10 @@ void castor::tape::aggregator::AggregatorDaemon::parseCommandLine(
castor::dlf::Param("Reason" , oss.str())}; castor::dlf::Param("Reason" , oss.str())};
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR,
AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params); AGGREGATOR_FAILED_TO_PARSE_COMMAND_LINE, 2, params);
castor::exception::InvalidArgument e; castor::exception::InvalidArgument ex;
e.getMessage() << oss.str(); ex.getMessage() << __PRETTY_FUNCTION__
throw e; << ": " << oss.str();
throw ex;
} }
} }
...@@ -241,7 +247,8 @@ int castor::tape::aggregator::AggregatorDaemon::getVdqmListenPort() ...@@ -241,7 +247,8 @@ int castor::tape::aggregator::AggregatorDaemon::getVdqmListenPort()
castor::exception::InvalidConfigEntry ex("TAPEAGGREGATOR", "VDQMPORT", castor::exception::InvalidConfigEntry ex("TAPEAGGREGATOR", "VDQMPORT",
configEntry); configEntry);
ex.getMessage() << "Invalid configuration entry: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Invalid configuration entry: "
<< ex.getEntryCategory() << " " << ex.getEntryName() << " " << ex.getEntryCategory() << " " << ex.getEntryName() << " "
<< ex.getEntryValue(); << ex.getEntryValue();
...@@ -268,7 +275,8 @@ int castor::tape::aggregator::AggregatorDaemon::getRtcpdListenPort() ...@@ -268,7 +275,8 @@ int castor::tape::aggregator::AggregatorDaemon::getRtcpdListenPort()
castor::exception::InvalidConfigEntry ex("TAPEAGGREGATOR", "RTCPDPORT", castor::exception::InvalidConfigEntry ex("TAPEAGGREGATOR", "RTCPDPORT",
configEntry); configEntry);
ex.getMessage() << "Invalid configuration entry: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Invalid configuration entry: "
<< ex.getEntryCategory() << " " << ex.getEntryName() << " " << ex.getEntryCategory() << " " << ex.getEntryName() << " "
<< ex.getEntryValue(); << ex.getEntryValue();
......
...@@ -86,7 +86,8 @@ int main(int argc, char *argv[]) { ...@@ -86,7 +86,8 @@ int main(int argc, char *argv[]) {
if(vdqmRequestHandlerThreadPool == NULL) { if(vdqmRequestHandlerThreadPool == NULL) {
castor::exception::Internal ie; castor::exception::Internal ie;
ie.getMessage() << "Failed to get VdqmRequestHandlerThreadPool"; ie.getMessage() << __PRETTY_FUNCTION__
<< ": Failed to get VdqmRequestHandlerThreadPool";
throw ie; throw ie;
} }
vdqmRequestHandlerThreadPool->setNbThreads(0); vdqmRequestHandlerThreadPool->setNbThreads(0);
...@@ -108,7 +109,8 @@ int main(int argc, char *argv[]) { ...@@ -108,7 +109,8 @@ int main(int argc, char *argv[]) {
if(rtcpdHandlerThreadPool == NULL) { if(rtcpdHandlerThreadPool == NULL) {
castor::exception::Internal ie; castor::exception::Internal ie;
ie.getMessage() << "Failed to get RtcpdHandlerThreadPool"; ie.getMessage() << __PRETTY_FUNCTION__
<< ": Failed to get RtcpdHandlerThreadPool";
throw ie; throw ie;
} }
rtcpdHandlerThreadPool->setNbThreads(10); rtcpdHandlerThreadPool->setNbThreads(10);
......
...@@ -43,7 +43,8 @@ void castor::tape::aggregator::Marshaller::marshallUint8(uint8_t src, ...@@ -43,7 +43,8 @@ void castor::tape::aggregator::Marshaller::marshallUint8(uint8_t src,
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -64,7 +65,8 @@ void castor::tape::aggregator::Marshaller::marshallUint16(uint16_t src, ...@@ -64,7 +65,8 @@ void castor::tape::aggregator::Marshaller::marshallUint16(uint16_t src,
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -85,7 +87,8 @@ void castor::tape::aggregator::Marshaller::marshallUint32(uint32_t src, ...@@ -85,7 +87,8 @@ void castor::tape::aggregator::Marshaller::marshallUint32(uint32_t src,
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -100,20 +103,22 @@ void castor::tape::aggregator::Marshaller::marshallUint32(uint32_t src, ...@@ -100,20 +103,22 @@ void castor::tape::aggregator::Marshaller::marshallUint32(uint32_t src,
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// unmarshallInt32 // unmarshallInt32
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void castor::tape::aggregator::Marshaller::unmarshallUint32(char * &src, void castor::tape::aggregator::Marshaller::unmarshallUint32(const char * &src,
size_t &srcLen, uint32_t &dst) throw(castor::exception::Exception) { size_t &srcLen, uint32_t &dst) throw(castor::exception::Exception) {
if(src == NULL) { if(src == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to source buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to source buffer is NULL";
throw ex; throw ex;
} }
if(srcLen < sizeof(dst)) { if(srcLen < sizeof(dst)) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Source buffer length is too small: Expected length: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Source buffer length is too small: Expected length: "
<< sizeof(dst) << ": Actual length: " << srcLen; << sizeof(dst) << ": Actual length: " << srcLen;
throw ex; throw ex;
} }
...@@ -135,7 +140,8 @@ void castor::tape::aggregator::Marshaller::marshallString(const char * src, ...@@ -135,7 +140,8 @@ void castor::tape::aggregator::Marshaller::marshallString(const char * src,
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -154,7 +160,8 @@ void castor::tape::aggregator::Marshaller::marshallString( ...@@ -154,7 +160,8 @@ void castor::tape::aggregator::Marshaller::marshallString(
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -167,35 +174,39 @@ void castor::tape::aggregator::Marshaller::marshallString( ...@@ -167,35 +174,39 @@ void castor::tape::aggregator::Marshaller::marshallString(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// unmarshallString // unmarshallString
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void castor::tape::aggregator::Marshaller::unmarshallString(char * &src, void castor::tape::aggregator::Marshaller::unmarshallString(const char * &src,
size_t &srcLen, char *dst, const size_t dstLen) size_t &srcLen, char *dst, const size_t dstLen)
throw (castor::exception::Exception) { throw (castor::exception::Exception) {
if(src == NULL) { if(src == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to source buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to source buffer is NULL";
throw ex; throw ex;
} }
if(srcLen == 0) { if(srcLen == 0) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Source buffer length is 0"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Source buffer length is 0";
throw ex; throw ex;
} }
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
if(dstLen == 0) { if(dstLen == 0) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Destination buffer length is 0"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Destination buffer length is 0";
throw ex; throw ex;
} }
...@@ -225,7 +236,8 @@ void castor::tape::aggregator::Marshaller::unmarshallString(char * &src, ...@@ -225,7 +236,8 @@ void castor::tape::aggregator::Marshaller::unmarshallString(char * &src,
if(!strTerminatorReached) { if(!strTerminatorReached) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "String terminator of source buffer was not reached"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": String terminator of source buffer was not reached";
throw ex; throw ex;
} }
} }
...@@ -241,7 +253,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest( ...@@ -241,7 +253,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest(
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -262,7 +275,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest( ...@@ -262,7 +275,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest(
if(totalLen > dstLen) { if(totalLen > dstLen) {
castor::exception::Exception ex(EMSGSIZE); castor::exception::Exception ex(EMSGSIZE);
ex.getMessage() << "Buffer too small for job submission request message: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Buffer too small for job submission request message: "
"Required size: " << totalLen << " Actual size: " << dstLen; "Required size: " << totalLen << " Actual size: " << dstLen;
throw ex; throw ex;
...@@ -270,17 +284,17 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest( ...@@ -270,17 +284,17 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest(
// Marshall the whole message (header + body) // Marshall the whole message (header + body)
char *p = dst; char *p = dst;
marshallUint32(RTCOPY_MAGIC_OLD0 , p); marshallUint32(RTCOPY_MAGIC_OLD0 , p);
marshallUint32(VDQM_CLIENTINFO , p); marshallUint32(VDQM_CLIENTINFO , p);
marshallUint32(len , p); marshallUint32(len , p);
marshallUint32(request.tapeRequestID , p); marshallUint32(request.tapeRequestID , p);
marshallUint32(request.clientPort , p); marshallUint32(request.clientPort , p);
marshallUint32(request.clientEuid , p); marshallUint32(request.clientEuid , p);
marshallUint32(request.clientEgid , p); marshallUint32(request.clientEgid , p);
marshallString(request.clientHost , p); marshallString(request.clientHost , p);
marshallString(request.deviceGroupName , p); marshallString(request.deviceGroupName, p);
marshallString(request.tapeDriveName , p); marshallString(request.tapeDriveName , p);
marshallString(request.clientUserName , p); marshallString(request.clientUserName , p);
// Calculate the number of bytes actually marshalled // Calculate the number of bytes actually marshalled
const size_t nbBytesMarshalled = p - dst; const size_t nbBytesMarshalled = p - dst;
...@@ -289,7 +303,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest( ...@@ -289,7 +303,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest(
if(totalLen != nbBytesMarshalled) { if(totalLen != nbBytesMarshalled) {
castor::exception::Internal ie; castor::exception::Internal ie;
ie.getMessage() << "Mismatch between the expected total length of the " ie.getMessage() << __PRETTY_FUNCTION__
<< ": Mismatch between the expected total length of the "
"RCP job submission request message and the actual number of bytes " "RCP job submission request message and the actual number of bytes "
"marshalled: Expected length: " << totalLen << " Marshalled: " "marshalled: Expected length: " << totalLen << " Marshalled: "
<< nbBytesMarshalled; << nbBytesMarshalled;
...@@ -301,6 +316,33 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest( ...@@ -301,6 +316,33 @@ size_t castor::tape::aggregator::Marshaller::marshallRcpJobRequest(
} }
//-----------------------------------------------------------------------------
// unmarshallRcpJobReply
//-----------------------------------------------------------------------------
void castor::tape::aggregator::Marshaller::unmarshallRcpJobReply(
const char * &src, size_t &srcLen, RcpJobReply &dst)
throw(castor::exception::Exception) {
// Unmarshall the status number
Marshaller::unmarshallUint32(src, srcLen, dst.status);
// The error message will be right trimmed if it is too large
const size_t maxBytesToUnmarshall = srcLen < sizeof(dst.errorMessage) ?
srcLen : sizeof(dst.errorMessage);
// Unmarshall the error message
if(maxBytesToUnmarshall > 0) {
strncpy(dst.errorMessage, src, maxBytesToUnmarshall);
dst.errorMessage[maxBytesToUnmarshall - 1] = '\0';
src = src + strlen(dst.errorMessage) + 1;
srcLen = srcLen - strlen(dst.errorMessage) - 1;
} else {
dst.errorMessage[0] = '\0';
// No need to update src or srcLen
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// marshallRtcpAckn // marshallRtcpAckn
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -311,7 +353,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst, ...@@ -311,7 +353,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst,
if(dst == NULL) { if(dst == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to destination buffer is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to destination buffer is NULL";
throw ex; throw ex;
} }
...@@ -320,7 +363,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst, ...@@ -320,7 +363,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst,
if(dstLen < 4*sizeof(uint32_t) + 1) { if(dstLen < 4*sizeof(uint32_t) + 1) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Destination buffer length is too small: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Destination buffer length is too small: "
"Expected minimum length: " << (4*sizeof(uint32_t) + 1) "Expected minimum length: " << (4*sizeof(uint32_t) + 1)
<< ": Actual length: " << dstLen; << ": Actual length: " << dstLen;
throw ex; throw ex;
...@@ -329,7 +373,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst, ...@@ -329,7 +373,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst,
if(errorMsg == NULL) { if(errorMsg == NULL) {
castor::exception::Exception ex(EINVAL); castor::exception::Exception ex(EINVAL);
ex.getMessage() << "Pointer to error message is NULL"; ex.getMessage() << __PRETTY_FUNCTION__
<< ": Pointer to error message is NULL";
throw ex; throw ex;
} }
...@@ -368,7 +413,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst, ...@@ -368,7 +413,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst,
if(totalLen != nbBytesMarshalled) { if(totalLen != nbBytesMarshalled) {
castor::exception::Internal ie; castor::exception::Internal ie;
ie.getMessage() << "Mismatch between the expected total length of the " ie.getMessage() << __PRETTY_FUNCTION__
<< ": Mismatch between the expected total length of the "
"RTCP acknowledge message and the actual number of bytes marshalled: " "RTCP acknowledge message and the actual number of bytes marshalled: "
"Expected length: " << totalLen << " Marshalled: " << nbBytesMarshalled; "Expected length: " << totalLen << " Marshalled: " << nbBytesMarshalled;
...@@ -380,9 +426,9 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst, ...@@ -380,9 +426,9 @@ size_t castor::tape::aggregator::Marshaller::marshallRtcpAckn(char *const dst,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// marshallRTCPTapeRequest // marshallRtcpTapeRequest
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst, size_t castor::tape::aggregator::Marshaller::marshallRtcpTapeRequest(char *dst,
const size_t dstLen, const RtcpTapeRequest &request) const size_t dstLen, const RtcpTapeRequest &request)
throw (castor::exception::Exception) { throw (castor::exception::Exception) {
...@@ -401,7 +447,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst, ...@@ -401,7 +447,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst,
if(totalLen > dstLen) { if(totalLen > dstLen) {
castor::exception::Exception ex(EMSGSIZE); castor::exception::Exception ex(EMSGSIZE);
ex.getMessage() << "Buffer too small for tape request message: " ex.getMessage() << __PRETTY_FUNCTION__
<< ": Buffer too small for tape request message: "
"Required size: " << totalLen << " Actual size: " << dstLen; "Required size: " << totalLen << " Actual size: " << dstLen;
throw ex; throw ex;
...@@ -456,7 +503,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst, ...@@ -456,7 +503,8 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst,
if(totalLen != nbBytesMarshalled) { if(totalLen != nbBytesMarshalled) {
castor::exception::Internal ie; castor::exception::Internal ie;
ie.getMessage() << "Mismatch between the expected total length of the " ie.getMessage() << __PRETTY_FUNCTION__
<< ": Mismatch between the expected total length of the "
"RTCP tape request message and the actual number of bytes marshalled: " "RTCP tape request message and the actual number of bytes marshalled: "
"Expected length: " << totalLen << " Marshalled: " << nbBytesMarshalled; "Expected length: " << totalLen << " Marshalled: " << nbBytesMarshalled;
...@@ -465,3 +513,18 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst, ...@@ -465,3 +513,18 @@ size_t castor::tape::aggregator::Marshaller::marshallRTCPTapeRequest(char *dst,
return totalLen; return totalLen;
} }
//-----------------------------------------------------------------------------
// unmarshallRtcpTapeRequest
//-----------------------------------------------------------------------------
void castor::tape::aggregator::Marshaller::unmarshallRtcpTapeRequest(
const char * &src, size_t &srcLen, RtcpTapeRequest &request)
throw(castor::exception::Exception) {
castor::exception::Internal ie;
ie.getMessage() << __PRETTY_FUNCTION__
<< ": Not implemented";
throw ie;
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define CASTOR_TAPE_AGGREGATOR_MARSHALLER_HPP 1 #define CASTOR_TAPE_AGGREGATOR_MARSHALLER_HPP 1
#include "castor/exception/Exception.hpp" #include "castor/exception/Exception.hpp"
#include "castor/tape/aggregator/RcpJobReply.hpp"
#include "castor/tape/aggregator/RcpJobRequest.hpp" #include "castor/tape/aggregator/RcpJobRequest.hpp"
#include "castor/tape/aggregator/RtcpTapeRequest.hpp" #include "castor/tape/aggregator/RtcpTapeRequest.hpp"
...@@ -96,8 +97,8 @@ namespace aggregator { ...@@ -96,8 +97,8 @@ namespace aggregator {
* and on return is the number of bytes remaining in the source buffer * and on return is the number of bytes remaining in the source buffer
* @param dst the destination unsigned 32-bit integer * @param dst the destination unsigned 32-bit integer
*/ */
static void unmarshallUint32(char * &src, size_t &srcLen, uint32_t &dst) static void unmarshallUint32(const char * &src, size_t &srcLen,
throw(castor::exception::Exception); uint32_t &dst) throw(castor::exception::Exception);
/** /**
* Marshalls the specified string into the specified destination buffer. * Marshalls the specified string into the specified destination buffer.
...@@ -141,7 +142,7 @@ namespace aggregator { ...@@ -141,7 +142,7 @@ namespace aggregator {
* @param dstLen the length of the destination buffer where the string * @param dstLen the length of the destination buffer where the string