xrootd
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
XrdCl::Utils Class Reference

Random utilities. More...

#include <XrdClUtils.hh>

Public Types

enum  AddressType {
  IPAuto = 0 , IPAll = 1 , IPv6 = 2 , IPv4 = 3 ,
  IPv4Mapped6 = 4
}
 Address type. More...
 

Static Public Member Functions

template<class Container >
static void splitString (Container &result, const std::string &input, const std::string &delimiter)
 Split a string.
 
static int GetIntParameter (const URL &url, const std::string &name, int defaultVal)
 Get a parameter either from the environment or URL.
 
static std::string GetStringParameter (const URL &url, const std::string &name, const std::string &defaultVal)
 Get a parameter either from the environment or URL.
 
static AddressType String2AddressType (const std::string &addressType)
 Interpret a string as address type, default to IPAll.
 
static Status GetHostAddresses (std::vector< XrdNetAddr > &addresses, const URL &url, AddressType type)
 Resolve IP addresses.
 
static void LogHostAddresses (Log *log, uint64_t type, const std::string &hostId, std::vector< XrdNetAddr > &addresses)
 Log all the addresses on the list.
 
static std::string TimeToString (time_t timestamp)
 Convert timestamp to a string.
 
static uint64_t GetElapsedMicroSecs (timeval start, timeval end)
 Get the elapsed microseconds between two timevals.
 
static XRootDStatus GetRemoteCheckSum (std::string &checkSum, const std::string &checkSumType, const URL &url)
 Get a checksum from a remote xrootd server.
 
static XRootDStatus GetLocalCheckSum (std::string &checkSum, const std::string &checkSumType, const std::string &path)
 Get a checksum from local file.
 
static std::string BytesToString (uint64_t bytes)
 Convert bytes to a human readable string.
 
static XRootDStatus CheckTPC (const std::string &server, uint16_t timeout=0)
 Check if peer supports tpc.
 
static XRootDStatus CheckTPCLite (const std::string &server, uint16_t timeout=0)
 
static std::string FQDNToCC (const std::string &fqdn)
 Convert the fully qualified host name to country code.
 
static Status GetDirectoryEntries (std::vector< std::string > &entries, const std::string &path)
 Get directory entries.
 
static Status ProcessConfig (std::map< std::string, std::string > &config, const std::string &file)
 Process a config file and return key-value pairs.
 
static Status ProcessConfigDir (std::map< std::string, std::string > &config, const std::string &dir)
 Process a config directory and return key-value pairs.
 
static void Trim (std::string &str)
 Trim a string.
 
static void LogPropertyList (Log *log, uint64_t topic, const char *format, const PropertyList &list)
 Log property list.
 
static std::string Char2Hex (uint8_t *array, uint16_t size)
 Print a char array as hex.
 
static std::string NormalizeChecksum (const std::string &name, const std::string &checksum)
 Normalize checksum.
 
static std::vector< std::string > GetSupportedCheckSums (const XrdCl::URL &url)
 Get supported checksum types for given URL.
 
static std::string InferChecksumType (const XrdCl::URL &source, const XrdCl::URL &destination, bool zip=false)
 
static bool CheckEC (const Message *req, const URL &url)
 Check if this client can support given EC redirect.
 
static XrdCl::XRootDStatus GetProtocolVersion (const XrdCl::URL url, int &protver)
 
static bool HasXAttr (const XrdCl::URL &url)
 
static bool HasPgRW (const XrdCl::URL &url)
 
static void SplitChunks (std::vector< ChunkList > &listsvec, const ChunkList &chunks, const uint32_t maxcs, const size_t maxc)
 

Detailed Description

Random utilities.

Member Enumeration Documentation

◆ AddressType

Address type.

Enumerator
IPAuto 
IPAll 
IPv6 
IPv4 
IPv4Mapped6 

Member Function Documentation

◆ BytesToString()

static std::string XrdCl::Utils::BytesToString ( uint64_t  bytes)
static

Convert bytes to a human readable string.

◆ Char2Hex()

static std::string XrdCl::Utils::Char2Hex ( uint8_t *  array,
uint16_t  size 
)
static

Print a char array as hex.

◆ CheckEC()

static bool XrdCl::Utils::CheckEC ( const Message req,
const URL url 
)
static

Check if this client can support given EC redirect.

◆ CheckTPC()

static XRootDStatus XrdCl::Utils::CheckTPC ( const std::string &  server,
uint16_t  timeout = 0 
)
static

Check if peer supports tpc.

◆ CheckTPCLite()

static XRootDStatus XrdCl::Utils::CheckTPCLite ( const std::string &  server,
uint16_t  timeout = 0 
)
static

Check if peer supports tpc / tpc lite

Returns
: suDone if TPC lite is supported, suPartial if plain TPC is supported, stError otherwise

◆ FQDNToCC()

static std::string XrdCl::Utils::FQDNToCC ( const std::string &  fqdn)
static

Convert the fully qualified host name to country code.

◆ GetDirectoryEntries()

static Status XrdCl::Utils::GetDirectoryEntries ( std::vector< std::string > &  entries,
const std::string &  path 
)
static

Get directory entries.

◆ GetElapsedMicroSecs()

static uint64_t XrdCl::Utils::GetElapsedMicroSecs ( timeval  start,
timeval  end 
)
static

Get the elapsed microseconds between two timevals.

◆ GetHostAddresses()

static Status XrdCl::Utils::GetHostAddresses ( std::vector< XrdNetAddr > &  addresses,
const URL url,
AddressType  type 
)
static

Resolve IP addresses.

◆ GetIntParameter()

static int XrdCl::Utils::GetIntParameter ( const URL url,
const std::string &  name,
int  defaultVal 
)
static

Get a parameter either from the environment or URL.

◆ GetLocalCheckSum()

static XRootDStatus XrdCl::Utils::GetLocalCheckSum ( std::string &  checkSum,
const std::string &  checkSumType,
const std::string &  path 
)
static

Get a checksum from local file.

◆ GetProtocolVersion()

static XrdCl::XRootDStatus XrdCl::Utils::GetProtocolVersion ( const XrdCl::URL  url,
int &  protver 
)
inlinestatic

Get protocol version of the given server

Parameters
url: URL pointing to the server
protver: protocol version (output parameter)
Returns
: operation status

References XrdCl::AnyObject::Get(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Status::IsOK(), and XrdCl::XRootDQuery::ProtocolVersion.

Referenced by HasPgRW(), and HasXAttr().

◆ GetRemoteCheckSum()

static XRootDStatus XrdCl::Utils::GetRemoteCheckSum ( std::string &  checkSum,
const std::string &  checkSumType,
const URL url 
)
static

Get a checksum from a remote xrootd server.

◆ GetStringParameter()

static std::string XrdCl::Utils::GetStringParameter ( const URL url,
const std::string &  name,
const std::string &  defaultVal 
)
static

Get a parameter either from the environment or URL.

◆ GetSupportedCheckSums()

static std::vector< std::string > XrdCl::Utils::GetSupportedCheckSums ( const XrdCl::URL url)
static

Get supported checksum types for given URL.

◆ HasPgRW()

static bool XrdCl::Utils::HasPgRW ( const XrdCl::URL url)
inlinestatic

Check if given server supports pgread/pgwrite

Parameters
url: URL pointing to the server
Returns
: true if yes, false otherwise

References GetProtocolVersion(), XrdCl::URL::IsLocalFile(), and kXR_PROTPGRWVERSION.

◆ HasXAttr()

static bool XrdCl::Utils::HasXAttr ( const XrdCl::URL url)
inlinestatic

Check if given server supports extended file attributes

Parameters
url: URL pointing to the server
Returns
: true if yes, false otherwise

References GetProtocolVersion(), XrdCl::URL::IsLocalFile(), and kXR_PROTXATTVERSION.

◆ InferChecksumType()

static std::string XrdCl::Utils::InferChecksumType ( const XrdCl::URL source,
const XrdCl::URL destination,
bool  zip = false 
)
static

Automatically infer the right checksum type

Parameters
source: source URL
destination: destination URL
zip: true if the source file is being extracted from a ZIP archive, false otherwise
Returns
: checksum type

◆ LogHostAddresses()

static void XrdCl::Utils::LogHostAddresses ( Log log,
uint64_t  type,
const std::string &  hostId,
std::vector< XrdNetAddr > &  addresses 
)
static

Log all the addresses on the list.

◆ LogPropertyList()

static void XrdCl::Utils::LogPropertyList ( Log log,
uint64_t  topic,
const char *  format,
const PropertyList list 
)
static

Log property list.

◆ NormalizeChecksum()

static std::string XrdCl::Utils::NormalizeChecksum ( const std::string &  name,
const std::string &  checksum 
)
static

Normalize checksum.

Referenced by XrdCl::CheckSumHelper::GetCheckSum().

◆ ProcessConfig()

static Status XrdCl::Utils::ProcessConfig ( std::map< std::string, std::string > &  config,
const std::string &  file 
)
static

Process a config file and return key-value pairs.

◆ ProcessConfigDir()

static Status XrdCl::Utils::ProcessConfigDir ( std::map< std::string, std::string > &  config,
const std::string &  dir 
)
static

Process a config directory and return key-value pairs.

◆ SplitChunks()

static void XrdCl::Utils::SplitChunks ( std::vector< ChunkList > &  listsvec,
const ChunkList chunks,
const uint32_t  maxcs,
const size_t  maxc 
)
static

Split chunks in a ChunkList into one or more ChunkLists

Parameters
listsvec: output vector of ChunkLists
chunks: input ChunkLisits
maxcs: maximum size of a ChunkInfo in output
maxc: maximum number of ChunkInfo in each ChunkList

◆ splitString()

template<class Container >
static void XrdCl::Utils::splitString ( Container &  result,
const std::string &  input,
const std::string &  delimiter 
)
inlinestatic

Split a string.

References XrdOucTUtils::splitString().

◆ String2AddressType()

static AddressType XrdCl::Utils::String2AddressType ( const std::string &  addressType)
static

Interpret a string as address type, default to IPAll.

◆ TimeToString()

static std::string XrdCl::Utils::TimeToString ( time_t  timestamp)
static

Convert timestamp to a string.

◆ Trim()

static void XrdCl::Utils::Trim ( std::string &  str)
static

Trim a string.


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