XRootD
XrdCksCalcadler32 Class Reference

#include <XrdCksCalcadler32.hh>

+ Inheritance diagram for XrdCksCalcadler32:
+ Collaboration diagram for XrdCksCalcadler32:

Public Member Functions

 XrdCksCalcadler32 ()
 
virtual ~XrdCksCalcadler32 ()
 
char * Final ()
 
void Init ()
 
XrdCksCalcNew ()
 
const char * Type (int &csSize)
 
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 81 of file XrdCksCalcadler32.hh.

Constructor & Destructor Documentation

◆ XrdCksCalcadler32()

XrdCksCalcadler32::XrdCksCalcadler32 ( )
inline

Definition at line 111 of file XrdCksCalcadler32.hh.

111 {Init();}

References Init().

Referenced by New().

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

◆ ~XrdCksCalcadler32()

virtual XrdCksCalcadler32::~XrdCksCalcadler32 ( )
inlinevirtual

Definition at line 112 of file XrdCksCalcadler32.hh.

112 {}

Member Function Documentation

◆ Final()

char* XrdCksCalcadler32::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 85 of file XrdCksCalcadler32.hh.

86  {AdlerValue = (unSum2 << 16) | unSum1;
87 #ifndef Xrd_Big_Endian
88  AdlerValue = htonl(AdlerValue);
89 #endif
90  return (char *)&AdlerValue;
91  }

◆ Init()

void XrdCksCalcadler32::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 93 of file XrdCksCalcadler32.hh.

93 {unSum1 = AdlerStart; unSum2 = 0;}

Referenced by XrdCksCalcadler32().

+ Here is the caller graph for this function:

◆ New()

XrdCksCalc* XrdCksCalcadler32::New ( )
inlinevirtual

Get a new instance of the underlying checksum calculation object.

Returns
the checksum calculation object.

Implements XrdCksCalc.

Definition at line 95 of file XrdCksCalcadler32.hh.

References XrdCksCalcadler32().

+ Here is the call graph for this function:

◆ Type()

const char* XrdCksCalcadler32::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 109 of file XrdCksCalcadler32.hh.

109 {csSize = sizeof(AdlerValue); return "adler32";}

◆ Update()

void XrdCksCalcadler32::Update ( const char *  Buff,
int  BLen 
)
inlinevirtual

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 97 of file XrdCksCalcadler32.hh.

98  {int k;
99  unsigned char *buff = (unsigned char *)Buff;
100  while(BLen > 0)
101  {k = (BLen < AdlerNMax ? BLen : AdlerNMax);
102  BLen -= k;
103  while(k >= 16) {DO16(buff); k -= 16;}
104  if (k != 0) do {DO1(buff);} while (--k);
105  unSum1 %= AdlerBase; unSum2 %= AdlerBase;
106  }
107  }
#define DO16(buf)
#define DO1(buf)

References DO1, and DO16.


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