XRootD
XrdCksData Class Reference

#include <XrdCksData.hh>

+ Collaboration diagram for XrdCksData:

Public Member Functions

 XrdCksData ()
 
int Get (char *Buff, int Blen)
 
bool HasValue ()
 
int operator!= (const XrdCksData &oth)
 
int operator== (const XrdCksData &oth)
 
void Reset ()
 
int Set (const char *csName)
 
int Set (const char *csVal, int csLen)
 
int Set (const void *csVal, int csLen)
 

Public Attributes

union {
XrdOucEnvenvP
 
long long fmTime
 
}; 
 
int csTime
 
char Length
 
char Name [NameSize]
 
short Rsvd1
 
char Rsvd2
 
char Value [ValuSize]
 

Static Public Attributes

static const int NameSize = 16
 
static const int ValuSize = 64
 

Detailed Description

Definition at line 37 of file XrdCksData.hh.

Constructor & Destructor Documentation

◆ XrdCksData()

XrdCksData::XrdCksData ( )
inline

Definition at line 122 of file XrdCksData.hh.

123  {Reset();}
void Reset()
Definition: XrdCksData.hh:112

References Reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ Get()

int XrdCksData::Get ( char *  Buff,
int  Blen 
)
inline

Definition at line 69 of file XrdCksData.hh.

70  {const char *hv = "0123456789abcdef";
71  int i, j = 0;
72  if (Blen < Length*2+1) return 0;
73  for (i = 0; i < Length; i++)
74  {Buff[j++] = hv[(Value[i] >> 4) & 0x0f];
75  Buff[j++] = hv[ Value[i] & 0x0f];
76  }
77  Buff[j] = '\0';
78  return Length*2;
79  }
char Value[ValuSize]
Definition: XrdCksData.hh:53
char Length
Definition: XrdCksData.hh:52

References Length, and Value.

Referenced by XrdOfs::chksum(), XrdCl::CheckSumHelper::GetCheckSum(), XrdCl::Utils::GetLocalCheckSum(), and XrdCksAttrValue().

+ Here is the caller graph for this function:

◆ HasValue()

bool XrdCksData::HasValue ( )
inline

Definition at line 125 of file XrdCksData.hh.

126  {
127  return *Value;
128  }

References Value.

Referenced by XrdCpConfig::Config().

+ Here is the caller graph for this function:

◆ operator!=()

int XrdCksData::operator!= ( const XrdCksData oth)
inline

Definition at line 63 of file XrdCksData.hh.

64  {return (strncmp(Name, oth.Name, NameSize)
65  || Length != oth.Length
66  || memcmp(Value, oth.Value, Length));
67  }
static const int NameSize
Definition: XrdCksData.hh:41
char Name[NameSize]
Definition: XrdCksData.hh:44

References Length, Name, NameSize, and Value.

◆ operator==()

int XrdCksData::operator== ( const XrdCksData oth)
inline

Definition at line 56 of file XrdCksData.hh.

57  {return (!strncmp(Name, oth.Name, NameSize)
58  && Length == oth.Length
59  && !memcmp(Value, oth.Value, Length));
60  }

References Length, Name, NameSize, and Value.

◆ Reset()

void XrdCksData::Reset ( )
inline

Definition at line 112 of file XrdCksData.hh.

113  {memset(Name, 0, sizeof(Name));
114  memset(Value,0, sizeof(Value));
115  fmTime = 0;
116  csTime = 0;
117  Rsvd1 = 0;
118  Rsvd2 = 0;
119  Length = 0;
120  }
short Rsvd1
Definition: XrdCksData.hh:50
char Rsvd2
Definition: XrdCksData.hh:51

References csTime, Length, Name, Rsvd1, Rsvd2, and Value.

Referenced by XrdCksData().

+ Here is the caller graph for this function:

◆ Set() [1/3]

int XrdCksData::Set ( const char *  csName)
inline

Definition at line 81 of file XrdCksData.hh.

82  {size_t len = strlen(csName);
83  if (len >= sizeof(Name)) return 0;
84  memcpy(Name, csName, len);
85  Name[len]=0;
86  return 1;
87  }

References Name.

Referenced by XrdCksManager::Calc(), XrdCl::CheckSumManager::Calculate(), XrdOfs::chksum(), XrdCksManager::Get(), XrdPssCks::Get(), XrdCl::CheckSumHelper::GetCheckSum(), XrdCl::Utils::GetLocalCheckSum(), and XrdCksAttrData().

+ Here is the caller graph for this function:

◆ Set() [2/3]

int XrdCksData::Set ( const char *  csVal,
int  csLen 
)
inline

Definition at line 96 of file XrdCksData.hh.

97  {int n, i = 0, Odd = 0;
98  if (csLen > (int)sizeof(Value)*2 || (csLen & 1)) return 0;
99  Length = csLen/2;
100  while(csLen--)
101  { if (*csVal >= '0' && *csVal <= '9') n = *csVal-48;
102  else if (*csVal >= 'a' && *csVal <= 'f') n = *csVal-87;
103  else if (*csVal >= 'A' && *csVal <= 'F') n = *csVal-55;
104  else return 0;
105  if (Odd) Value[i++] |= n;
106  else Value[i ] = n << 4;
107  csVal++; Odd = ~Odd;
108  }
109  return 1;
110  }

References Length, and Value.

◆ Set() [3/3]

int XrdCksData::Set ( const void *  csVal,
int  csLen 
)
inline

Definition at line 89 of file XrdCksData.hh.

90  {if (csLen > ValuSize || csLen < 1) return 0;
91  memcpy(Value, csVal, csLen);
92  Length = csLen;
93  return 1;
94  }
static const int ValuSize
Definition: XrdCksData.hh:42

References Length, Value, and ValuSize.

Member Data Documentation

◆ 

union { ... }

◆ csTime

int XrdCksData::csTime

◆ Length

◆ Name

◆ NameSize

const int XrdCksData::NameSize = 16
static

◆ Rsvd1

short XrdCksData::Rsvd1

Definition at line 50 of file XrdCksData.hh.

Referenced by Reset().

◆ Rsvd2

char XrdCksData::Rsvd2

Definition at line 51 of file XrdCksData.hh.

Referenced by Reset().

◆ Value

char XrdCksData::Value[ValuSize]

◆ ValuSize

const int XrdCksData::ValuSize = 64
static

Definition at line 42 of file XrdCksData.hh.

Referenced by XrdCksManager::Get(), Set(), and XrdCksAttrValue().


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