![]() |
XRootD
|
#include <XrdCksManager.hh>
Public Types | |
enum | { Cks_nomtchk = 0x00000001 } |
Public Member Functions | |
XrdCksManager (XrdSysError *erP, int iosz, XrdVersionInfo &vInfo, bool autoload=false) | |
virtual | ~XrdCksManager () |
virtual int | Calc (const char *Pfn, XrdCksData &Cks, int doSet=1) |
virtual int | Config (const char *Token, char *Line) |
virtual int | Del (const char *Pfn, XrdCksData &Cks) |
virtual int | Get (const char *Pfn, XrdCksData &Cks) |
virtual int | Init (const char *ConfigFN, const char *AddCalc=0) |
virtual char * | List (const char *Pfn, char *Buff, int Blen, char Sep=' ') |
virtual const char * | Name (int seqNum=0) |
virtual XrdCksCalc * | Object (const char *name) |
virtual int | Set (const char *Pfn, XrdCksData &Cks, int myTime=0) |
void | SetOpts (int opt) |
virtual int | Size (const char *Name=0) |
virtual int | Ver (const char *Pfn, XrdCksData &Cks) |
![]() | |
XrdCks (XrdSysError *erP) | |
Constructor. | |
virtual | ~XrdCks () |
Destructor. | |
virtual int | Calc (const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP, int doSet=1) |
virtual int | Ver (const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP) |
Protected Member Functions | |
virtual int | Calc (const char *Pfn, time_t &MTime, XrdCksCalc *CksObj) |
virtual int | ModTime (const char *Pfn, time_t &MTime) |
Additional Inherited Members | |
![]() | |
XrdSysError * | eDest |
Definition at line 48 of file XrdCksManager.hh.
anonymous enum |
XrdCksManager::XrdCksManager | ( | XrdSysError * | erP, |
int | iosz, | ||
XrdVersionInfo & | vInfo, | ||
bool | autoload = false |
||
) |
Definition at line 75 of file XrdCksManager.cc.
References Name().
|
virtual |
Definition at line 103 of file XrdCksManager.cc.
References Path.
|
protectedvirtual |
Reimplemented in XrdCksManOss.
Definition at line 161 of file XrdCksManager.cc.
References close, XrdCks::eDest, XrdSysError::Emsg(), fstat, open, Stat, stat, and XrdCksCalc::Update().
|
virtual |
Calculate a new checksum for a physical file using the checksum algorithm named in the Cks parameter.
Xfn | The logical or physical name of the file to be checksumed. |
Cks | For input, it specifies the checksum algorithm to be used. For output, the checksum value is returned upon success. |
doSet | When true, the new value must replace any existing value in the Xfn's extended file attributes. |
pcbP | In the second form, the pointer to the callback object. A nil pointer does not invoke any callback. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 119 of file XrdCksManager.cc.
References Calc(), XrdCksData::csTime, XrdCksCalc::Final(), XrdCksData::Length, XrdCksData::Name, XrdCksCalc::New(), XrdCksCalc::Recycle(), XrdCksData::Set(), XrdCksData::Value, and xCS.
Referenced by XrdCksManOss::Calc(), Calc(), and Ver().
|
virtual |
Parse a configuration directives specific to the checksum manager.
Token | Points to the directive that triggered the call. |
Line | All the characters after the directive. |
Implements XrdCks.
Definition at line 225 of file XrdCksManager.cc.
References XrdCks::eDest, XrdSysError::Emsg(), Name(), XrdCksData::NameSize, Path, and XrdOucUtils::toLower().
Referenced by Init().
|
virtual |
Delete the checksum from the Xfn's xattrs.
Xfn | The logical or physical name of the file to be checksumed. |
Cks | Specifies the checksum type to delete. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 446 of file XrdCksManager.cc.
References XrdOucXAttr< T >::Attr, XrdCksData::Name, and xCS.
Referenced by XrdCksManOss::Del().
|
virtual |
Retreive the checksum from the Xfn's xattrs and return it and indicate whether or not it is stale (i.e. the file modification has changed or the name and length are not the expected values).
Xfn | The logical or physical name of the file to be checksumed. |
Cks | For input, it specifies the checksum type to return. For output, the checksum value is returned upon success. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 463 of file XrdCksManager.cc.
References Cks_nomtchk, ENOATTR, XrdCksData::Length, ModTime(), Name(), XrdCksData::Name, XrdCksData::Set(), XrdCksData::ValuSize, and xCS.
Referenced by XrdCksManOss::Get().
|
virtual |
Fully initialize the manager which includes loading any plugins.
ConfigFN | Points to the configuration file path. |
DfltCalc | Is the default checksum and should be defaulted if NULL. The default implementation defaults this to adler32. A default is only needed should the checksum name in the XrdCksData object be omitted. |
Implements XrdCks.
Definition at line 278 of file XrdCksManager.cc.
References Config(), XrdCks::eDest, XrdSysError::Emsg(), Name(), and Path.
|
virtual |
List names of the checksums associated with a Xfn or all supported ones.
Xfn | The logical or physical file name whose checksum names are to be returned. When Xfn is null, return all supported checksum algorithm names. |
Buff | Points to a buffer, at least 64 bytes in length, to hold a "Sep" separated list of checksum names. |
Blen | The length of the buffer. |
Sep | The separation character to be used between adjacent names. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 501 of file XrdCksManager.cc.
References XrdSysXAttr::Free(), List(), Name(), XrdSysXAttr::AList::Name, XrdSysXAttr::AList::Next, XrdSysXAttr::AList::Nlen, and XrdSysFAttr::Xat.
Referenced by XrdCksManOss::List(), and List().
|
protectedvirtual |
Reimplemented in XrdCksManOss.
Definition at line 554 of file XrdCksManager.cc.
Referenced by Get(), Set(), and Ver().
|
virtual |
Get the name of the checksums associated with a sequence number. Note that Name() may be called prior to final config to see if there are any chksums to configure and avoid unintended errors.
seqNum | The sequence number. Zero signifies the default name. Higher numbers are alternates. |
Implements XrdCks.
Definition at line 568 of file XrdCksManager.cc.
Referenced by XrdCksManager(), Config(), Get(), Init(), List(), and Size().
|
virtual |
Get a new XrdCksCalc object that can calculate the checksum corresponding to the specified name or the default object if name is a null pointer. The object can be used to compute checksums on the fly. The object's Recycle() method must be used to delete it.
name | The name of the checksum algorithm. If null, use the default one. |
Reimplemented from XrdCks.
Definition at line 578 of file XrdCksManager.cc.
|
virtual |
Set a file's checksum in the extended attributes along with the file's mtime and the time of setting.
Xfn | The logical or physical name of the file to be set. |
Cks | Specifies the checksum name and value. |
myTime | When true then the fmTime and gmTime in the Cks structure are to be used; as opposed to the current time. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 602 of file XrdCksManager.cc.
References XrdCksData::Length, ModTime(), XrdCksData::Name, and xCS.
Referenced by XrdCksManOss::Set().
void XrdCksManager::SetOpts | ( | int | opt | ) |
Definition at line 632 of file XrdCksManager.cc.
|
virtual |
Get the binary length of the checksum with the corresponding name.
Name | The checksum algorithm name. If null, use the default name. |
Implements XrdCks.
Definition at line 592 of file XrdCksManager.cc.
References Name().
|
virtual |
Retreive the checksum from the Xfn's xattrs and compare it to the supplied checksum. If the checksum is not available or is stale, a new checksum is calculated and written to the extended attributes.
Xfn | The logical or physical name of the file to be verified. |
Cks | Specifies the checksum name and value. |
pcbP | In the second form, the pointer to the callback object. A nil pointer does not invoke any callback. |
Implements XrdCks.
Reimplemented in XrdCksManOss.
Definition at line 638 of file XrdCksManager.cc.
References Calc(), XrdCksData::Length, ModTime(), XrdCksData::Name, XrdCksData::Value, and xCS.
Referenced by XrdCksManOss::Ver().