XRootD
XrdCksCalccrc32 Class Reference

#include <XrdCksCalccrc32.hh>

+ Inheritance diagram for XrdCksCalccrc32:
+ Collaboration diagram for XrdCksCalccrc32:

Public Member Functions

 XrdCksCalccrc32 ()
 
virtual ~XrdCksCalccrc32 ()
 
char * Final ()
 
void Init ()
 
XrdCksCalcNew ()
 
const char * Type (int &csSz)
 
void Update (const char *Buff, int BLen)
 
- Public Member Functions inherited from XrdCksCalc
 XrdCksCalc ()
 Constructor. More...
 
virtual ~XrdCksCalc ()
 Destructor. More...
 
virtual char * Calc (const char *Buff, int BLen)
 
virtual char * Current ()
 
virtual void Recycle ()
 Recycle the checksum object as it is no longer needed. A default is given. More...
 

Detailed Description

Definition at line 41 of file XrdCksCalccrc32.hh.

Constructor & Destructor Documentation

◆ XrdCksCalccrc32()

XrdCksCalccrc32::XrdCksCalccrc32 ( )
inline

Definition at line 67 of file XrdCksCalccrc32.hh.

67 {Init();}

References Init().

Referenced by New().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~XrdCksCalccrc32()

virtual XrdCksCalccrc32::~XrdCksCalccrc32 ( )
inlinevirtual

Definition at line 68 of file XrdCksCalccrc32.hh.

68 {}

Member Function Documentation

◆ Final()

char* XrdCksCalccrc32::Final ( )
inlinevirtual

Get the actual checksum in binary format.

Returns
the checksum value in binary format. The pointer to the value becomes invalid once the associated object is deleted.

Implements XrdCksCalc.

Definition at line 45 of file XrdCksCalccrc32.hh.

45  {char buff[sizeof(long long)];
46  long long tLcs = TotLen;
47  int i = 0;
48  if (tLcs)
49  {while(tLcs) {buff[i++] = tLcs & 0xff ; tLcs >>= 8;}
50  Update(buff, i);
51  }
52  TheResult = C32Result ^ CRC32_XOROT;
53 #ifndef Xrd_Big_Endian
54  TheResult = htonl(TheResult);
55 #endif
56  return (char *)&TheResult;
57  }
void Update(const char *Buff, int BLen)

References Update().

+ Here is the call graph for this function:

◆ Init()

void XrdCksCalccrc32::Init ( )
inlinevirtual

Initializes data structures (must be called by constructor). This is always called to reuse the object for a new checksum.

Implements XrdCksCalc.

Definition at line 59 of file XrdCksCalccrc32.hh.

59 {C32Result = CRC32_XINIT; TotLen = 0;}

Referenced by XrdCksCalccrc32().

+ Here is the caller graph for this function:

◆ New()

XrdCksCalc* XrdCksCalccrc32::New ( )
inlinevirtual

Get a new instance of the underlying checksum calculation object.

Returns
the checksum calculation object.

Implements XrdCksCalc.

Definition at line 61 of file XrdCksCalccrc32.hh.

References XrdCksCalccrc32().

+ Here is the call graph for this function:

◆ Type()

const char* XrdCksCalccrc32::Type ( int &  csSize)
inlinevirtual

Get the checksum object algorithm name and the number bytes (i.e. size) required for the checksum value.

Parameters
csSize-> Parameter to hold the size of the checksum value.
Returns
the checksum algorithm's name. The name persists event after the checksum object is deleted.

Implements XrdCksCalc.

Definition at line 65 of file XrdCksCalccrc32.hh.

65 {csSz = sizeof(TheResult); return "crc32";}

◆ Update()

void XrdCksCalccrc32::Update ( const char *  Buff,
int  BLen 
)
virtual

Compute a running checksum. This method may be called repeatedly for data segments; with Final() returning the full checksum.

Parameters
Buff-> Data to be checksummed.
BLen-> Length of the data in Buff.

Implements XrdCksCalc.

Definition at line 169 of file XrdCksCalccrc32.cc.

170 {
171 
172 // Process each byte
173 //
174  TotLen += reclen;
175  while(reclen-- > 0)
176  C32Result = (C32Result<<8)
177  ^ crctable[(unsigned char)((C32Result>>24)^*p++)];
178 }

Referenced by Final().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: