Loading...
Searching...
No Matches
XrdOfsPrepGPI.cc File Reference
`#include <string>`
`#include <vector>`
`#include <stdio.h>`
`#include <unistd.h>`
`#include "Xrd/XrdJob.hh"`
`#include "Xrd/XrdScheduler.hh"`
`#include "XrdOfs/XrdOfsPrepare.hh"`
`#include "XrdOss/XrdOss.hh"`
`#include "XrdOuc/XrdOuca2x.hh"`
`#include "XrdOuc/XrdOucBuffer.hh"`
`#include "XrdOuc/XrdOucEnv.hh"`
`#include "XrdOuc/XrdOucErrInfo.hh"`
`#include "XrdOuc/XrdOucGatherConf.hh"`
`#include "XrdOuc/XrdOucProg.hh"`
`#include "XrdOuc/XrdOucStream.hh"`
`#include "XrdOuc/XrdOucString.hh"`
`#include "XrdOuc/XrdOucTList.hh"`
`#include "XrdSec/XrdSecEntity.hh"`
`#include "XrdSfs/XrdSfsInterface.hh"`
`#include "XrdSys/XrdSysError.hh"`
`#include "XrdSys/XrdSysE2T.hh"`
`#include "XrdSys/XrdSysPthread.hh"`
`#include "XrdSys/XrdSysTrace.hh"`
`#include "XrdVersion.hh"`
Include dependency graph for XrdOfsPrepGPI.cc:

Go to the source code of this file.

## Classes

class | XrdOfsPrepGPIReal::PrepGPI
class | XrdOfsPrepGPIReal::PrepGRun
struct | XrdOfsPrepGPIReal::PrepRequest

## Namespaces

namespace | XrdOfsPrepGPIReal

## Macros

#define | DEBUG(usr, x)
#define | EPNAME(x)

## Functions

XrdOfsPrepare * | XrdOfsgetPrepare (XrdOfsgetPrepareArguments)
| XrdVERSIONINFO (XrdOfsgetPrepare, PrepGPI)

## Variables

bool | XrdOfsPrepGPIReal::addCGI = false
XrdOucBuffPool * | XrdOfsPrepGPIReal::bPool = 0
bool | XrdOfsPrepGPIReal::Debug = false
XrdSysError * | XrdOfsPrepGPIReal::eLog = 0
XrdSysMutex | XrdOfsPrepGPIReal::gpiMutex
int | XrdOfsPrepGPIReal::maxFiles = 48
int | XrdOfsPrepGPIReal::maxResp = XrdOucEI::Max_Error_Len
static const int | XrdOfsPrepGPIReal::okAll = 0x1f
static const int | XrdOfsPrepGPIReal::okCancel = 0x01
static const int | XrdOfsPrepGPIReal::okEvict = 0x02
static const int | XrdOfsPrepGPIReal::okPrep = 0x04
static const int | XrdOfsPrepGPIReal::okQuery = 0x08
char | XrdOfsPrepGPIReal::okReq = 0
static const int | XrdOfsPrepGPIReal::okStage = 0x10
XrdOss * | XrdOfsPrepGPIReal::ossP = 0
XrdOucProg * | XrdOfsPrepGPIReal::pgmObj = 0
int | XrdOfsPrepGPIReal::qryAllow = 8
XrdSysCondVar | XrdOfsPrepGPIReal::qryCond (0, "prepG query")
static const int | XrdOfsPrepGPIReal::qryMaxWT = 33
int | XrdOfsPrepGPIReal::qryWait = 0
XrdScheduler * | XrdOfsPrepGPIReal::schedP = 0
XrdSysTrace | XrdOfsPrepGPIReal::SysTrace ("PrepGPI")
bool | XrdOfsPrepGPIReal::usePFN = false

## Macro Definition Documentation

## DEBUG

#define DEBUG | ( |  | usr,
|  |  | x )

Value:
if (Debug) SYSTRACE(SysTrace.,usr,EPName,0,x)
EPName
#define EPName(ep)
Definition XrdNetPMarkCfg.cc:71
SYSTRACE
#define SYSTRACE(obj, usr, epn, txt, dbg)
Definition XrdSysTrace.hh:45
XrdOfsPrepGPIReal::SysTrace
XrdSysTrace SysTrace("PrepGPI")
XrdOfsPrepGPIReal::Debug
bool Debug
Definition XrdOfsPrepGPI.cc:71

Definition at line 40 of file XrdOfsPrepGPI.cc.

## EPNAME

#define EPNAME | ( |  | x | ) |

Value:
const char *EPName=x

Definition at line 42 of file XrdOfsPrepGPI.cc.

## Function Documentation

## XrdOfsgetPrepare()

XrdOfsPrepare * XrdOfsgetPrepare | ( | XrdOfsgetPrepareArguments |  | ) |

Definition at line 821 of file XrdOfsPrepGPI.cc.

{
XrdOucGatherConf gpiConf("prepgpi.parms", eDest);
XrdOucString RunPgm, Token;
char *tokP;
int maxReq = 4;
// Save some of the arguments that we may need later
//
eLog = eDest;
ossP = theOss;
schedP = (XrdScheduler *)(envP->GetPtr("XrdScheduler*"));
// If parameters specified on the preplib directive, use them. Otherwise,
// get them from the config file.
//
if (!gpiConf.useData(parms)
&& gpiConf.Gather(confg, XrdOucGatherConf::only_body) < 0) return 0;
// Verify we actually have parameters (there is only one line of them).
//
if (!(tokP = gpiConf.GetLine()) || !*tokP)
{eLog->Emsg("PrepGPI", "Parameters not specified.");
return 0;
}
// Parse the parameters, they are space delimited
//
while((tokP = gpiConf.GetToken()))
{Token = tokP;
if (Token == "-admit")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-admit argument not specified.");
return 0;
}
XrdOucString Args(tokP);
int argPos = 0;
bool argOK = false;
while((argPos = Args.tokenize(Token, argPos, ',')) != -1)
{ if (Token == "cancel") okReq |= okCancel;
else if (Token == "evict") okReq |= okEvict;
else if (Token == "prep") okReq |= okPrep;
else if (Token == "query") okReq |= okQuery;
else if (Token == "stage") okReq |= okStage;
else if (Token == "all") okReq |= okAll;
else {eLog->Emsg("PrepGPI", "Invalid -admit request -",
Token.c_str());
return 0;
}
argOK = true;
}
if (!argOK)
{eLog->Emsg("PrepGPI", "invalid -admit request list");
return 0;
}
}
else if (Token == "-cgi") addCGI= true;
else if (Token == "-debug") Debug = true;
else if (Token == "-maxfiles")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-maxfiles argument not specified.");
return 0;
}
if (XrdOuca2x::a2i(*eLog, "PrepPGI -maxfiles", tokP,
&maxFiles, 1, 1024)) return 0;
}
else if (Token == "-maxquery")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-maxquery argument not specified.");
return 0;
}
if (XrdOuca2x::a2i(*eLog, "PrepPGI -maxquery", tokP,
&qryAllow, 1, 64)) return 0;
}
else if (Token == "-maxreq")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-maxreq argument not specified.");
return 0;
}
if (XrdOuca2x::a2i(*eLog, "PrepPGI -maxreq", tokP,
&maxReq, 1, 64)) return 0;
}
else if (Token == "-maxresp")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-maxresp argument not specified.");
return 0;
}
long long rspsz;
if (XrdOuca2x::a2sz(*eLog, "PrepPGI -maxresp", tokP,
&rspsz, 2048, 16777216)) return 0;
maxResp = static_cast<int>(rspsz);
}
else if (Token == "-pfn") usePFN = true;
else if (Token == "-run")
{if (!(tokP = gpiConf.GetToken()) || *tokP == '-')
{eLog->Emsg("PrepGPI", "-run argument not specified.");
return 0;
}
RunPgm = tokP;
}
else {eLog->Emsg("PrepGPI", "Invalid option -", Token.c_str());
return 0;
}
}
// Make sure at least one request was enabled
//
if (!(okReq & okAll))
{eLog->Emsg("PrepGPI", "'-admit' was not specified.");
return 0;
}
// Make sure the prepare program was specified
//
if (!RunPgm.length())
{eLog->Emsg("PrepGPI", "prepare program not specified.");
return 0;
}
// Create a buffer pool for query responses if we need to
//
if (maxResp > (int)XrdOucEI::Max_Error_Len)
bPool = new XrdOucBuffPool(maxResp, maxResp);
// Set final debug flags
//
if (!Debug) Debug = getenv("XRDDEBUG") != 0;
SysTrace.SetLogger(eLog->logger());
// Obtain an instance of the program object for this command. Note that
// all grun object will share this program as it's thread safe in the
// context in which we will use it (i.e. read/only).
//
pgmObj = new XrdOucProg(eLog, 0); // EFD????
if (pgmObj->Setup(RunPgm.c_str()))
{delete pgmObj;
eLog->Emsg("PrepGPI", "Unable to use prepare program", RunPgm.c_str());
return 0;
}
// Create as many run object as we need
//
PrepGRun *gRun;
while(maxReq--)
{gRun = new PrepGRun(*pgmObj);
gRun->next = PrepGRun::Q;
PrepGRun::Q = gRun;
}
// Create one additional such object for queries to pass to the plugin
//
gRun = new PrepGRun(*pgmObj);
// Return an instance of the prepare plugin
//
return new PrepGPI(*gRun);
}
eDest
static XrdSysError eDest(0,"crypto_")
XrdOfsPrepGPIReal::PrepGPI
Definition XrdOfsPrepGPI.cc:332
XrdOfsPrepGPIReal::PrepGRun
Definition XrdOfsPrepGPI.cc:136
XrdOfsPrepGPIReal::PrepGRun::Q
static PrepGRun * Q
Definition XrdOfsPrepGPI.cc:150
XrdOfsPrepGPIReal::PrepGRun::next
PrepGRun * next
Definition XrdOfsPrepGPI.cc:149
XrdOucBuffPool
Definition XrdOucBuffer.hh:55
XrdOucEnv::GetPtr
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdOucGatherConf
Definition XrdOucGatherConf.hh:36
XrdOucGatherConf::only_body
@ only_body
Only directive bodies as a string blob.
Definition XrdOucGatherConf.hh:86
XrdOucProg
Definition XrdOucProg.hh:38
XrdOucString
Definition XrdOucString.hh:252
XrdOucString::length
int length() const
Definition XrdOucString.hh:279
XrdOucString::c_str
const char * c_str() const
Definition XrdOucString.hh:278
XrdOuca2x::a2i
static int a2i(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
Definition XrdOuca2x.cc:45
XrdOuca2x::a2sz
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
XrdScheduler
Definition XrdScheduler.hh:47
XrdOfsPrepGPIReal::bPool
XrdOucBuffPool * bPool
Definition XrdOfsPrepGPI.cc:55
XrdOfsPrepGPIReal::usePFN
bool usePFN
Definition XrdOfsPrepGPI.cc:72
XrdOfsPrepGPIReal::qryAllow
int qryAllow
Definition XrdOfsPrepGPI.cc:63
XrdOfsPrepGPIReal::maxResp
int maxResp
Definition XrdOfsPrepGPI.cc:68
XrdOfsPrepGPIReal::okReq
char okReq
Definition XrdOfsPrepGPI.cc:73
XrdOfsPrepGPIReal::ossP
XrdOss * ossP
Definition XrdOfsPrepGPI.cc:57
XrdOfsPrepGPIReal::okCancel
static const int okCancel
Definition XrdOfsPrepGPI.cc:75
XrdOfsPrepGPIReal::pgmObj
XrdOucProg * pgmObj
Definition XrdOfsPrepGPI.cc:60
XrdOfsPrepGPIReal::eLog
XrdSysError * eLog
Definition XrdOfsPrepGPI.cc:59
XrdOfsPrepGPIReal::okEvict
static const int okEvict
Definition XrdOfsPrepGPI.cc:76
XrdOfsPrepGPIReal::schedP
XrdScheduler * schedP
Definition XrdOfsPrepGPI.cc:58
XrdOfsPrepGPIReal::okQuery
static const int okQuery
Definition XrdOfsPrepGPI.cc:78
XrdOfsPrepGPIReal::okStage
static const int okStage
Definition XrdOfsPrepGPI.cc:79
XrdOfsPrepGPIReal::addCGI
bool addCGI
Definition XrdOfsPrepGPI.cc:70
XrdOfsPrepGPIReal::maxFiles
int maxFiles
Definition XrdOfsPrepGPI.cc:67
XrdOfsPrepGPIReal::okAll
static const int okAll
Definition XrdOfsPrepGPI.cc:80
XrdOfsPrepGPIReal::okPrep
static const int okPrep
Definition XrdOfsPrepGPI.cc:77
XrdProxy::envP
XrdOucEnv * envP
Definition XrdPss.cc:109
XrdOucEI::Max_Error_Len
static const size_t Max_Error_Len
Definition XrdOucErrInfo.hh:51

References XrdOuca2x::a2i(), XrdOuca2x::a2sz(), XrdOfsPrepGPIReal::addCGI, XrdOfsPrepGPIReal::bPool, XrdOucString::c_str(), XrdOfsPrepGPIReal::Debug, eDest, XrdOfsPrepGPIReal::eLog, XrdOucGatherConf::Gather(), XrdOucGatherConf::GetLine(), XrdOucEnv::GetPtr(), XrdOucGatherConf::GetToken(), XrdOucString::length(), XrdOucEI::Max_Error_Len, XrdOfsPrepGPIReal::maxFiles, XrdOfsPrepGPIReal::maxResp, XrdOfsPrepGPIReal::PrepGRun::next, XrdOfsPrepGPIReal::okAll, XrdOfsPrepGPIReal::okCancel, XrdOfsPrepGPIReal::okEvict, XrdOfsPrepGPIReal::okPrep, XrdOfsPrepGPIReal::okQuery, XrdOfsPrepGPIReal::okReq, XrdOfsPrepGPIReal::okStage, XrdOucGatherConf::only_body, XrdOfsPrepGPIReal::ossP, XrdOfsPrepGPIReal::pgmObj, XrdOfsPrepGPIReal::PrepGRun::Q, XrdOfsPrepGPIReal::qryAllow, XrdOfsPrepGPIReal::schedP, XrdOfsPrepGPIReal::SysTrace, XrdOucString::tokenize(), XrdOucGatherConf::useData(), XrdOfsPrepGPIReal::usePFN, and XrdOfsgetPrepareArguments.

Referenced by XrdVERSIONINFO().

Here is the call graph for this function:
Here is the caller graph for this function:

## XrdVERSIONINFO()

XrdVERSIONINFO | ( | XrdOfsgetPrepare | ,
|  | PrepGPI | )

References XrdOfsgetPrepare().

Here is the call graph for this function: