XRootD
XrdHttpTapeApi.cc File Reference
#include "XrdHttp/XrdHttpExtHandler.hh"
#include "XrdHttpTapeApiStore.hh"
#include "XrdOuc/XrdOuca2x.hh"
#include "XrdOuc/XrdOucJson.hh"
#include "XrdOuc/XrdOucTUtils.hh"
#include "XrdOuc/XrdOucTokenizer.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdVersion.hh"
#include <climits>
#include <cstdlib>
#include <exception>
#include <string>
+ Include dependency graph for XrdHttpTapeApi.cc:

Go to the source code of this file.

Functions

XrdHttpExtHandler * XrdHttpGetExtHandler (XrdSysError *eDest, const char *confg, const char *parms, XrdOucEnv *)
 
 XrdVERSIONINFO (XrdHttpGetExtHandler, TapeApi)
 

Function Documentation

◆ XrdHttpGetExtHandler()

XrdHttpExtHandler* XrdHttpGetExtHandler ( XrdSysError *  eDest,
const char *  confg,
const char *  parms,
XrdOucEnv *   
)

Definition at line 382 of file XrdHttpTapeApi.cc.

385 {
386  if(!parms || !*parms)
387  {
388  eDest->Emsg("TapeApiInitialize",
389  "Tape API handler requires a local state directory");
390  return nullptr;
391  }
392 
393  std::string parameters(parms);
394  XrdOucTokenizer options(parameters.data());
395  options.GetLine();
396  const char *root = options.GetToken();
397  const char *maxRequestSizeOption = options.GetToken();
398  if(!root || !*root)
399  {
400  eDest->Emsg("TapeApiInitialize",
401  "Tape API handler requires a local state directory");
402  return nullptr;
403  }
404 
405  long long maxRequestSize = kDefaultMaxRequestSize;
406  if(maxRequestSizeOption
407  && XrdOuca2x::a2sz(*eDest, "Tape API maximum request size",
408  maxRequestSizeOption, &maxRequestSize, 1, INT_MAX))
409  {
410  return nullptr;
411  }
412  if(options.GetToken())
413  {
414  eDest->Emsg("TapeApiInitialize",
415  "Tape API handler received unexpected parameters");
416  return nullptr;
417  }
418 
419  const char *siteName = std::getenv("XRDSITE");
420  if(!siteName || !*siteName)
421  {
422  eDest->Emsg("TapeApiInitialize",
423  "all.sitename must be configured for the Tape API handler");
424  return nullptr;
425  }
426 
427  auto *handler = new TapeApiHandler(root, maxRequestSize, siteName);
428  if(handler->Init(confg) != 0)
429  {
430  eDest->Emsg("TapeApiInitialize", handler->InitializationError().c_str());
431  delete handler;
432  return nullptr;
433  }
434  return handler;
435 }
XrdSysError eDest(0, "HttpMon")
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
Definition: XrdOuca2x.cc:257
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:116

References XrdOuca2x::a2sz(), eDest, XrdSysError::Emsg(), XrdOucTokenizer::GetLine(), and XrdOucTokenizer::GetToken().

+ Here is the call graph for this function:

◆ XrdVERSIONINFO()

XrdVERSIONINFO ( XrdHttpGetExtHandler  ,
TapeApi   
)