8 #ifndef SRC_XRDCL_XRDCLCHECKSUMHELPER_HH_
9 #define SRC_XRDCL_XRDCLCHECKSUMHELPER_HH_
32 const std::string &ckSumType ):
34 pCkSumType( ckSumType ),
51 if( pCkSumType.empty() )
77 void Update(
const void *buffer, uint32_t size )
80 pCksCalcObj->
Update( (
const char *)buffer, size );
87 std::string &checkSumType )
89 using namespace XrdCl;
93 auto st = GetCheckSumImpl( checkSumType, calcSize );
94 if( !st.IsOK() )
return st;
100 ckSum.
Set( checkSumType.c_str() );
101 ckSum.
Set( (
void*)pCksCalcObj->Final(), calcSize );
102 char *cksBuffer =
new char[265];
103 ckSum.
Get( cksBuffer, 256 );
104 checkSum = checkSumType +
":";
117 auto st = GetCheckSumImpl( checkSumType, calcSize );
118 if( !st.IsOK() )
return st;
119 if(
sizeof( T ) != calcSize )
121 "checksum size mismatch" );
122 value = *
reinterpret_cast<T*
>( pCksCalcObj->
Final() );
137 XRootDStatus GetCheckSumImpl(
const std::string &checkSumType,
140 using namespace XrdCl;
149 pCkSumType.c_str() );
153 std::string calcType = pCksCalcObj->Type( calcSize );
155 if( calcType != checkSumType )
158 "checksum: %s", pCkSumType.c_str(),
159 checkSumType.c_str() );
167 std::string pCkSumType;
virtual void Update(const char *Buff, int BLen)=0
int Set(const char *csName)
int Get(char *Buff, int Blen)
Check sum helper for stdio.
XRootDStatus Initialize()
Initialize.
XRootDStatus GetCheckSum(std::string &checkSum, std::string &checkSumType)
const std::string & GetType()
void Update(const void *buffer, uint32_t size)
virtual ~CheckSumHelper()
Destructor.
CheckSumHelper(const std::string &name, const std::string &ckSumType)
Constructor.
XRootDStatus GetRawCheckSum(const std::string &checkSumType, T &value)
Manage the checksum calc objects.
XrdCksCalc * GetCalculator(const std::string &algName)
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
static Log * GetLog()
Get default log.
void Error(uint64_t topic, const char *format,...)
Report an error.
void Dump(uint64_t topic, const char *format,...)
Print a dump message.
static std::string NormalizeChecksum(const std::string &name, const std::string &checksum)
Normalize checksum.
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errInternal
Internal error.
const uint64_t UtilityMsg
const uint16_t errInvalidArgs
const uint16_t errCheckSumError