xrootd
Static Public Member Functions | List of all members
XrdClTests::Utils Class Reference

A bunch of useful functions. More...

#include <Utils.hh>

Static Public Member Functions

static bool CRC32TextToInt (uint32_t &result, const std::string &text)
 
static ssize_t GetRandomBytes (char *buffer, size_t size)
 
static uint32_t GetInitialCRC32 ()
 Get initial CRC32 value. More...
 
static uint32_t ComputeCRC32 (const void *buffer, uint64_t len)
 
static uint32_t UpdateCRC32 (uint32_t crc, const void *buffer, uint64_t len)
 
static uint32_t CombineCRC32 (uint32_t crc1, uint32_t crc2, uint64_t len2)
 

Detailed Description

A bunch of useful functions.

Member Function Documentation

static uint32_t XrdClTests::Utils::CombineCRC32 ( uint32_t  crc1,
uint32_t  crc2,
uint64_t  len2 
)
inlinestatic

Combine two crc32 checksums

Parameters
crc1checksum of the first data block
crc2checksum of the second data block
len2size of the second data block

Referenced by ThreadingTest::ReadTestFunc().

static uint32_t XrdClTests::Utils::ComputeCRC32 ( const void *  buffer,
uint64_t  len 
)
inlinestatic

Compute crc32 checksum out of a buffer

Parameters
bufferdata buffer
lensize of the data buffer

References GetInitialCRC32().

Referenced by XrdClTests::ClientHandler::ClientHandler(), FileTest::ReadTest(), ThreadingTest::ReadTestFunc(), runChild(), SocketHandler::UpdateTransferMap(), FileTest::VectorReadTest(), and FileTest::WriteTest().

bool XrdClTests::Utils::CRC32TextToInt ( uint32_t &  result,
const std::string &  text 
)
static

Convert string representation of a crc checksum to int

Parameters
resultthe resulting integer
textinput sting
Returns
status of the conversion

References XrdCl::Utils::splitString().

static uint32_t XrdClTests::Utils::GetInitialCRC32 ( )
inlinestatic

Get initial CRC32 value.

Referenced by ComputeCRC32(), and ThreadingTest::ReadTestFunc().

ssize_t XrdClTests::Utils::GetRandomBytes ( char *  buffer,
size_t  size 
)
static

Fill the buffer with random data

Parameters
bufferthe buffer to be filled
sizesize of the buffer
Returns
number of ranom bytes actually generated, -1 on error

References close(), open(), and read().

Referenced by RandomHandler::HandleConnection(), RandomPumpHandler::HandleConnection(), SocketTest::TransferTest(), and FileTest::WriteTest().

static uint32_t XrdClTests::Utils::UpdateCRC32 ( uint32_t  crc,
const void *  buffer,
uint64_t  len 
)
inlinestatic

Update a crc32 checksum

Parameters
crcold checksum
bufferdata buffer
lensize of the data buffer

Referenced by DataReader(), XrdClTests::ClientHandler::UpdateReceivedData(), XrdClTests::ClientHandler::UpdateSentData(), SocketHandler::UpdateTransferMap(), and FileTest::WriteTest().


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