xrootd
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
XrdOucCRC Class Reference

#include <XrdOucCRC.hh>

Public Member Functions

 XrdOucCRC ()
 
 ~XrdOucCRC ()
 

Static Public Member Functions

static uint32_t CRC32 (const unsigned char *data, int count)
 
static uint32_t Calc32C (const void *data, size_t count, uint32_t prevcs=0)
 
static void Calc32C (const void *data, size_t count, uint32_t *csval)
 
static bool Ver32C (const void *data, size_t count, const uint32_t csval, uint32_t *csbad=0)
 
static int Ver32C (const void *data, size_t count, const uint32_t *csval, uint32_t &valcs)
 
static bool Ver32C (const void *data, size_t count, const uint32_t *csval, bool *valok)
 
static bool Ver32C (const void *data, size_t count, const uint32_t *csval, uint32_t *valcs)
 

Static Private Attributes

static unsigned int crctable [256]
 

Constructor & Destructor Documentation

◆ XrdOucCRC()

XrdOucCRC::XrdOucCRC ( )
inline

◆ ~XrdOucCRC()

XrdOucCRC::~XrdOucCRC ( )
inline

Member Function Documentation

◆ Calc32C() [1/2]

static void XrdOucCRC::Calc32C ( const void *  data,
size_t  count,
uint32_t *  csval 
)
static

Compute a CRC32C page checksums using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be computed.
countThe number of bytes pointed to by data.
csvalPointer to a vector to hold individual page checksums. The vector must be sized: (count/XrdSys::PageSize + (countXrdSys::PageSize != 0)). On return, each element of csval holds the checksum for the associated page.

◆ Calc32C() [2/2]

static uint32_t XrdOucCRC::Calc32C ( const void *  data,
size_t  count,
uint32_t  prevcs = 0 
)
static

Compute a CRC32C checksum using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be computed.
countThe number of bytes pointed to by data.
prevcsThe previous checksum value. The initial checksum of checksum sequence should be zero, the default.
Returns
The CRC32C checksum.

Referenced by XrdOssCsiCrcUtils::crc32c_combine(), XrdOssCsiCrcUtils::crc32c_extendwith_zero(), XrdOssCsiCrcUtils::crc32c_split2(), XrdCl::EcPgReadResponseHandler::HandleResponse(), and XrdOssCsiTagstoreFile::MarshallAndWriteHeader().

◆ CRC32()

static uint32_t XrdOucCRC::CRC32 ( const unsigned char *  data,
int  count 
)
static

Compute a CRC32 checksum.

Note
This is a historical method as it uses the very slow CRC32 algoritm.
Parameters
dataPointer to the data whose checksum it to be computed.
countThe number of bytes pointed to by data.
Returns
The CRC32 checksum.

Referenced by XrdOfsHanKey::XrdOfsHanKey().

◆ Ver32C() [1/4]

static bool XrdOucCRC::Ver32C ( const void *  data,
size_t  count,
const uint32_t *  csval,
bool *  valok 
)
static

Verify a CRC32C page checksums using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be verified.
countThe number of bytes pointed to by data.
csvalPointer to a vector of expected page checksums. The vector must be sized (count/PageSize+(countPageSize != 0)).
valokPointer to a vector of the same size as csval to hold the results of the comparison (true matches, o/w false).
Returns
True if all the checksums match with each element of valok set to true. Otherwise, false is returned and false is set in valok for each page that did not match the expected checksum.

◆ Ver32C() [2/4]

static int XrdOucCRC::Ver32C ( const void *  data,
size_t  count,
const uint32_t *  csval,
uint32_t &  valcs 
)
static

Verify a CRC32C page checksums using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be verified.
countThe number of bytes pointed to by data.
csvalPointer to a vector of expected page checksums. The vector must be sized: (count/XrdSys::PageSize + (countXrdSys::PageSize != 0)).
valcsWhere the computed checksum is returned for the page whose verification failed; otherwise it is untouched.
Returns
-1 if all the checksums match. Otherwise, the non-negative index into csval whose checksum does not match.

◆ Ver32C() [3/4]

static bool XrdOucCRC::Ver32C ( const void *  data,
size_t  count,
const uint32_t *  csval,
uint32_t *  valcs 
)
static

Verify a CRC32C page checksums using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be verified.
countThe number of bytes pointed to by data.
csvalPointer to a vector of expected page checksums. The vector must be sized (count/PageSize+(countPageSize != 0)).
valcsPointer to a vector of the same size as csval to hold the computed checksum.
Returns
True if all the checksums match; false otherwise.

◆ Ver32C() [4/4]

static bool XrdOucCRC::Ver32C ( const void *  data,
size_t  count,
const uint32_t  csval,
uint32_t *  csbad = 0 
)
static

Verify a CRC32C checksum using hardware assist if available.

Parameters
dataPointer to the data whose checksum it to be verified.
countThe number of bytes pointed to by data.
csvalThe expected checksum.
csbadIf csbad is not nil, the computed checksum is returned.
Returns
True if the expected checksum equals the actual checksum; otherwise, false is returned.

Member Data Documentation

◆ crctable

unsigned int XrdOucCRC::crctable[256]
staticprivate

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