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

#include <XrdXmlMetaLink.hh>

Collaboration diagram for XrdXmlMetaLink:
Collaboration graph
[legend]

Public Member Functions

XrdOucFileInfoConvert (const char *fbuff, int blen=0)
 
XrdOucFileInfo ** ConvertAll (const char *fbuff, int &count, int blen=0)
 
const char * GetStatus (int &ecode)
 
 XrdXmlMetaLink (const char *protos="root:xroot:", const char *rdprot="xroot:", const char *rdhost=0, const char *encode=0)
 
 ~XrdXmlMetaLink ()
 Destructor.
 

Static Public Member Functions

static void DeleteAll (XrdOucFileInfo **vecp, int vecn)
 

Private Member Functions

bool GetFile (const char *scope)
 
bool GetFileInfo (const char *scope)
 
bool GetGLfn ()
 
bool GetHash ()
 
void GetRdrError (const char *why)
 
bool GetSize ()
 
bool GetUrl ()
 
void GetName ()
 
bool PutFile (const char *buff, int blen)
 
bool UrlOK (char *url)
 

Private Attributes

XrdXmlReaderreader
 
XrdOucFileInfofileList
 
XrdOucFileInfolastFile
 
XrdOucFileInfocurrFile
 
char * prots
 
char * encType
 
const char * rdProt
 
const char * rdHost
 
int fileCnt
 
int eCode
 
bool doAll
 
bool noUrl
 
char tmpFn [64]
 
char eText [256]
 

Detailed Description

The XrdXmlMetaLink object provides a uniform interface to convert metalink XML specifications to one or more XrdOucFileInfo objects. This object does not do a rigorous syntactic check of the metalink specification. Specifications that technically violate RFC 5854 (v4 metalinks) or the metalink.org v3 metalinks may be accepted and yield valid information.

Constructor & Destructor Documentation

◆ XrdXmlMetaLink()

XrdXmlMetaLink::XrdXmlMetaLink ( const char *  protos = "root:xroot:",
const char *  rdprot = "xroot:",
const char *  rdhost = 0,
const char *  encode = 0 
)
inline

Constructor

Parameters
protosPointer to the list of desired protocols. Each protocol ends with a colon. They are specified without embedded spaces. Only urls using one of the listed protocols is returned. A nil pointer returns all urls regardless of the protocol.
rdprotThe protocol to be used when constructing the global file entry. If nil, the first protocol in protos is used. If nil, a global file is not constructed.
rdhostThe "<host>[<port>]" to use when constructing the global file. A global file entry is constructed only if rdhost is specified and a protocol is available, and a global file element exists in the xml file.
encodeSpecifies the xml encoding. Currently, only UTF-8 is is supported and is signified by a nil pointer.

References eText, and tmpFn.

◆ ~XrdXmlMetaLink()

XrdXmlMetaLink::~XrdXmlMetaLink ( )
inline

Destructor.

References encType, and prots.

Member Function Documentation

◆ Convert()

XrdOucFileInfo * XrdXmlMetaLink::Convert ( const char *  fbuff,
int  blen = 0 
)

Convert an XML metalink specification to a file info object. Only the first file entry is converted (see ConvertAll()).

Parameters
fbuffPointer to the filepath that contains the metalink specification when blen is 0. Otherwise, fbuff points to a memory buffer of length blen containing the specification.
blenLength of the buffer. When <=0, the first argument is a file path. Otherwise, it is a memory buffer of length blen whose contents are written into a file in /tmp, converted, and then deleted.
Returns
Pointer to the corresponding file info object upon success. Otherwise, a null pointer is returned indicating that the metalink specification was invalid or had no required protocols. Use the GetStatus() method to obtain the description of the problem.

◆ ConvertAll()

XrdOucFileInfo ** XrdXmlMetaLink::ConvertAll ( const char *  fbuff,
int &  count,
int  blen = 0 
)

Convert an XML metalink specification to a file info object. All file entries are converted.

Parameters
fbuffPointer to the filepath that contains the metalink specification when blen is 0. Otherwise, fbuff points to a memory buffer of length blen containing the specification.
countPlace where the number of array elements is returned.
blenLength of the buffer. When <=0, the first argument is a file path. Otherwise, it is a memory buffer of length blen whose contents are written into a file in /tmp, converted, and then deleted.
Returns
Pointer to the array of corresponding fil info objects upon success. Otherwise, Otherwise, a null pointer is returned indicating that the metalink specification was invalid or had no required protocols. Use the GetStatus() method to obtain the description of the problem. Be aware that you must first delete each file info object before deleting the array. You can do this via DeleteAll().

◆ DeleteAll()

static void XrdXmlMetaLink::DeleteAll ( XrdOucFileInfo **  vecp,
int  vecn 
)
static

Delete a vector of file info objects and the vector itself as well.

Parameters
vecpPointer to the array.
vecnNumber of elements in the vector.

◆ GetFile()

bool XrdXmlMetaLink::GetFile ( const char *  scope)
private

◆ GetFileInfo()

bool XrdXmlMetaLink::GetFileInfo ( const char *  scope)
private

◆ GetGLfn()

bool XrdXmlMetaLink::GetGLfn ( )
private

◆ GetHash()

bool XrdXmlMetaLink::GetHash ( )
private

◆ GetName()

void XrdXmlMetaLink::GetName ( )
private

◆ GetRdrError()

void XrdXmlMetaLink::GetRdrError ( const char *  why)
private

◆ GetSize()

bool XrdXmlMetaLink::GetSize ( )
private

◆ GetStatus()

const char * XrdXmlMetaLink::GetStatus ( int &  ecode)
inline

Obtain ending status of previous conversion.

Parameters
ecodePlace to return the error code, if any.
Returns
Pointer to the error text describing the error. The string becomes invalid if Convert() is called or the object is deleted. If no error was encountered, a null string is returned with ecode == 0.

References eCode, and eText.

◆ GetUrl()

bool XrdXmlMetaLink::GetUrl ( )
private

◆ PutFile()

bool XrdXmlMetaLink::PutFile ( const char *  buff,
int  blen 
)
private

◆ UrlOK()

bool XrdXmlMetaLink::UrlOK ( char *  url)
private

Member Data Documentation

◆ currFile

XrdOucFileInfo* XrdXmlMetaLink::currFile
private

◆ doAll

bool XrdXmlMetaLink::doAll
private

◆ eCode

int XrdXmlMetaLink::eCode
private

Referenced by GetStatus().

◆ encType

char* XrdXmlMetaLink::encType
private

Referenced by ~XrdXmlMetaLink().

◆ eText

char XrdXmlMetaLink::eText[256]
private

Referenced by GetStatus(), and XrdXmlMetaLink().

◆ fileCnt

int XrdXmlMetaLink::fileCnt
private

◆ fileList

XrdOucFileInfo* XrdXmlMetaLink::fileList
private

◆ lastFile

XrdOucFileInfo* XrdXmlMetaLink::lastFile
private

◆ noUrl

bool XrdXmlMetaLink::noUrl
private

◆ prots

char* XrdXmlMetaLink::prots
private

Referenced by ~XrdXmlMetaLink().

◆ rdHost

const char* XrdXmlMetaLink::rdHost
private

◆ rdProt

const char* XrdXmlMetaLink::rdProt
private

◆ reader

XrdXmlReader* XrdXmlMetaLink::reader
private

◆ tmpFn

char XrdXmlMetaLink::tmpFn[64]
private

Referenced by XrdXmlMetaLink().


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