Check sum helper for stdio.
More...
#include <XrdClCheckSumHelper.hh>
Check sum helper for stdio.
Definition at line 25 of file XrdClCheckSumHelper.hh.
◆ CheckSumHelper()
XrdCl::CheckSumHelper::CheckSumHelper |
( |
const std::string & | name, |
|
|
const std::string & | ckSumType ) |
|
inline |
Constructor.
Definition at line 31 of file XrdClCheckSumHelper.hh.
32 :
33 pName( name ),
34 pCkSumType( ckSumType ),
35 pCksCalcObj( 0 )
36 {};
◆ ~CheckSumHelper()
virtual XrdCl::CheckSumHelper::~CheckSumHelper |
( |
| ) |
|
|
inlinevirtual |
◆ GetCheckSum()
XRootDStatus XrdCl::CheckSumHelper::GetCheckSum |
( |
std::string & | checkSum, |
|
|
std::string & | checkSumType ) |
|
inline |
Definition at line 86 of file XrdClCheckSumHelper.hh.
88 {
89 using namespace XrdCl;
91
92 int calcSize = 0;
93 auto st = GetCheckSumImpl( checkSumType, calcSize );
94 if( !st.IsOK() ) return st;
95
96
97
98
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 + ":";
106 delete [] cksBuffer;
107
109 checkSum.c_str() );
111 }
int Set(const char *csName)
int Get(char *Buff, int Blen)
static Log * GetLog()
Get default log.
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 uint64_t UtilityMsg
References XrdCl::Log::Dump(), XrdCksCalc::Final(), XrdCksData::Get(), XrdCl::DefaultEnv::GetLog(), XrdCl::Utils::NormalizeChecksum(), XrdCksData::Set(), and XrdCl::UtilityMsg.
◆ GetRawCheckSum()
template<typename T >
XRootDStatus XrdCl::CheckSumHelper::GetRawCheckSum |
( |
const std::string & | checkSumType, |
|
|
T & | value ) |
|
inline |
Definition at line 114 of file XrdClCheckSumHelper.hh.
115 {
116 int calcSize = 0;
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() );
123 return XRootDStatus();
124 }
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errInvalidArgs
References XrdCl::errInvalidArgs, XrdCksCalc::Final(), and XrdCl::stError.
◆ GetType()
const std::string & XrdCl::CheckSumHelper::GetType |
( |
| ) |
|
|
inline |
◆ Initialize()
Initialize.
Definition at line 49 of file XrdClCheckSumHelper.hh.
50 {
51 if( pCkSumType.empty() )
52 return XRootDStatus();
53
56
57 if( !cksMan )
58 {
59 log->Error(
UtilityMsg,
"Unable to get the checksum manager" );
61 }
62
63 pCksCalcObj = cksMan->GetCalculator( pCkSumType );
64 if( !pCksCalcObj )
65 {
66 log->Error(
UtilityMsg,
"Unable to get a calculator for %s",
67 pCkSumType.c_str() );
69 }
70
71 return XRootDStatus();
72 }
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
const uint16_t errInternal
Internal error.
const uint16_t errCheckSumError
References XrdCl::errCheckSumError, XrdCl::errInternal, XrdCl::Log::Error(), XrdCl::CheckSumManager::GetCalculator(), XrdCl::DefaultEnv::GetCheckSumManager(), XrdCl::DefaultEnv::GetLog(), XrdCl::stError, and XrdCl::UtilityMsg.
◆ Update()
void XrdCl::CheckSumHelper::Update |
( |
const void * | buffer, |
|
|
uint32_t | size ) |
|
inline |
The documentation for this class was generated from the following file: