Loading...
Searching...
No Matches
XrdXmlMetaLink.hh
Go to the documentation of this file.
#ifndef __XRDXMLMETALINK_HH__
#define __XRDXMLMETALINK_HH__
/******************************************************************************/
/* */
/* X r d X m l M e t a L i n k . h h */
/* */
/* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <cstdlib>
#include <cstring>
#include "XrdOuc/XrdOucFileInfo.hh"
#include "XrdXml/XrdXmlReader.hh"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class XrdXmlMetaLink
{
public:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
XrdOucFileInfo *Convert(const char *fbuff, int blen=0);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
XrdOucFileInfo **ConvertAll(const char *fbuff, int &count, int blen=0);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static void DeleteAll(XrdOucFileInfo **vecp, int vecn);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *GetStatus(int &ecode) {ecode = eCode; return eText;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
XrdXmlMetaLink(const char *protos="root:xroot:",
const char *rdprot="xroot:",
const char *rdhost=0,
const char *encode=0
) : reader(0),
fileList(0), lastFile(0), currFile(0),
prots(protos ? strdup(protos) : 0),
encType(encode ? strdup(encode) : 0),
rdProt(rdprot), rdHost(rdhost),
fileCnt(0), eCode(0),
doAll(false), noUrl(true)
{*eText = 0; *tmpFn = 0;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
~XrdXmlMetaLink() {if (prots) free(prots);
if (encType) free(encType);
}
private:
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);
XrdXmlReader *reader;
XrdOucFileInfo *fileList;
XrdOucFileInfo *lastFile;
XrdOucFileInfo *currFile;
char *prots;
char *encType;
const char *rdProt;
const char *rdHost;
int fileCnt;
int eCode;
bool doAll;
bool noUrl;
char tmpFn[64];
char eText[256];
};
#endif
XrdOucFileInfo.hh
XrdXmlReader.hh
XrdOucFileInfo
Definition XrdOucFileInfo.hh:46
XrdXmlMetaLink::XrdXmlMetaLink
XrdXmlMetaLink(const char *protos="root:xroot:", const char *rdprot="xroot:", const char *rdhost=0, const char *encode=0)
Definition XrdXmlMetaLink.hh:136
XrdXmlMetaLink::ConvertAll
XrdOucFileInfo ** ConvertAll(const char *fbuff, int &count, int blen=0)
Definition XrdXmlMetaLink.cc:231
XrdXmlMetaLink::GetStatus
const char * GetStatus(int &ecode)
Definition XrdXmlMetaLink.hh:115
XrdXmlMetaLink::DeleteAll
static void DeleteAll(XrdOucFileInfo **vecp, int vecn)
Definition XrdXmlMetaLink.cc:277
XrdXmlMetaLink::Convert
XrdOucFileInfo * Convert(const char *fbuff, int blen=0)
Definition XrdXmlMetaLink.cc:104
XrdXmlMetaLink::~XrdXmlMetaLink
~XrdXmlMetaLink()
Destructor.
Definition XrdXmlMetaLink.hh:153
XrdXmlReader
Definition XrdXmlReader.hh:41