Loading...
Searching...
No Matches
XrdSsiSfsConfig Class Reference

`#include <XrdSsiSfsConfig.hh>`

Collaboration diagram for XrdSsiSfsConfig:

## Public Member Functions

| XrdSsiSfsConfig (bool iscms=false)
| ~XrdSsiSfsConfig ()
bool | Configure (const char *cFN, XrdOucEnv *envP)
bool | Configure (XrdOucEnv *envP)

## Public Attributes

bool | isCms
bool | isServer
const char * | myHost
const char * | myInsName
int | myPort
const char * | myProg
char * | myRole
XrdVersionInfo * | myVersion
XrdSsiCluster * | SsiCms

## Detailed Description

Definition at line 38 of file XrdSsiSfsConfig.hh.

## Constructor & Destructor Documentation

## XrdSsiSfsConfig()

XrdSsiSfsConfig::XrdSsiSfsConfig | ( | bool | iscms = false | ) |

Definition at line 121 of file XrdSsiSfsConfig.cc.

{
static XrdVERSIONINFODEF(myVer, ssi, XrdVNUMBER, XrdVERSION);
char *bp;
// Establish defaults
//
ConfigFN = 0;
CmsLib = 0;
CmsParms = 0;
SsiCms = 0;
SvcLib = 0;
SvcParms = 0;
myRole = 0;
respWT = 0x7fffffff;
isServer = true;
isCms = iscms;
myHost = getenv("XRDHOST");
myProg = getenv("XRDPROG");
myInsName = XrdOucUtils::InstName(1);
myVersion = &myVer;
myPort = (bp = getenv("XRDPORT")) ? strtol(bp, (char **)NULL, 10) : 0;
}
XrdVERSIONINFODEF
static XrdVERSIONINFODEF(compiledVer, XrdHttpProtocolTest, XrdVNUMBER, XrdVERSION)
XrdOucUtils::InstName
static const char * InstName(int TranOpt=0)
Definition XrdOucUtils.cc:809
XrdSsiSfsConfig::isCms
bool isCms
Definition XrdSsiSfsConfig.hh:50
XrdSsiSfsConfig::myPort
int myPort
Definition XrdSsiSfsConfig.hh:48
XrdSsiSfsConfig::myRole
char * myRole
Definition XrdSsiSfsConfig.hh:46
XrdSsiSfsConfig::myHost
const char * myHost
Definition XrdSsiSfsConfig.hh:43
XrdSsiSfsConfig::isServer
bool isServer
Definition XrdSsiSfsConfig.hh:49
XrdSsiSfsConfig::myVersion
XrdVersionInfo * myVersion
Definition XrdSsiSfsConfig.hh:42
XrdSsiSfsConfig::myInsName
const char * myInsName
Definition XrdSsiSfsConfig.hh:45
XrdSsiSfsConfig::myProg
const char * myProg
Definition XrdSsiSfsConfig.hh:44
XrdSsiSfsConfig::SsiCms
XrdSsiCluster * SsiCms
Definition XrdSsiSfsConfig.hh:47
XrdSsi::respWT
int respWT
Definition XrdSsiSfsConfig.cc:101

References XrdOucUtils::InstName(), isCms, isServer, myHost, myInsName, myPort, myProg, myRole, myVersion, XrdSsi::respWT, SsiCms, and XrdVERSIONINFODEF().

Here is the call graph for this function:

## ~XrdSsiSfsConfig()

XrdSsiSfsConfig::~XrdSsiSfsConfig | ( |  | ) |

Definition at line 149 of file XrdSsiSfsConfig.cc.

{
if (ConfigFN) free(ConfigFN);
if (CmsLib) free(CmsLib);
if (CmsParms) free(CmsParms);
if (SvcLib) free(SvcLib);
if (SvcParms) free(SvcParms);
}

## Member Function Documentation

## Configure() [1/2]

bool XrdSsiSfsConfig::Configure | ( | const char * | cFN,
|  | XrdOucEnv * | envP )

Definition at line 162 of file XrdSsiSfsConfig.cc.

{
char *var;
const char *tmp;
int cfgFD, retc, NoGo = 0;
XrdOucEnv myEnv;
XrdOucStream cStrm(&Log, getenv("XRDINSTANCE"), &myEnv, "=====> ");
// Print warm-up message
//
Log.Say("++++++ ssi initialization started.");
// Preset all variables with common defaults
//
if (getenv("XRDDEBUG") || getenv("XRDSSIDEBUG"))
Trace.What = TRACESSI_ALL | TRACESSI_Debug;
// If there is no config file, return with an error.
//
if( !cFN || !*cFN)
{Log.Emsg("Config", "Configuration file not specified.");
return false;
}
// Try to open the configuration file.
//
ConfigFN = strdup(cFN);
if ( (cfgFD = open(cFN, O_RDONLY, 0)) < 0)
{Log.Emsg("Config", errno, "open config file", cFN);
return false;
}
cStrm.Attach(cfgFD);
static const char *cvec[] = { "*** ssi (sfs) plugin config:", 0 };
cStrm.Capture(cvec);
// Now start reading records until eof.
//
cFile = &cStrm;
while((var = cFile->GetMyFirstWord()))
{if (!strncmp(var, "ssi.", 4)
|| !strcmp(var, "all.role"))
{if (ConfigXeq(var+4)) {cFile->Echo(); NoGo=1;}}
}
// Now check if any errors occurred during file i/o
//
if ((retc = cStrm.LastError()))
NoGo = Log.Emsg("Config", -retc, "read config file", cFN);
cStrm.Close();
// Make sure we are configured as a server
//
if (!isServer)
{Log.Emsg("Config", "ssi only supports server roles but role is not "
"defined as 'server'.");
return false;
}
// Configure filesystem callout as needed
//
if ((fsChk = FSPath.NotEmpty()))
{if (!theFS && !isCms)
{Log.Emsg("Config", "Specifying an fspath requires SSI to be stacked "
"with a file system!");
return false;
}
if (isServer && !theFS && !isCms) fsChk = false;
}
// Perform historical phase 2 initialization
//
if (!NoGo) NoGo = !Configure(envP);
// All done
//
tmp = (NoGo ? " failed." : " completed.");
Log.Say("------ ssi initialization", tmp);
return !NoGo;
}
open
#define open
Definition XrdPosix.hh:76
TRACESSI_Debug
#define TRACESSI_Debug
Definition XrdSsiTrace.hh:34
TRACESSI_ALL
#define TRACESSI_ALL
Definition XrdSsiTrace.hh:33
XrdOucPListAnchor::NotEmpty
int NotEmpty()
Definition XrdOucPList.hh:141
XrdSsiSfsConfig::Configure
bool Configure(const char *cFN, XrdOucEnv *envP)
Definition XrdSsiSfsConfig.cc:162
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdSysError::Say
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition XrdSysError.cc:141
XrdSysTrace::What
int What
Definition XrdSysTrace.hh:64
XrdSsi::theFS
XrdSfsFileSystem * theFS
Definition XrdSsiFile.cc:54
XrdSsi::fsChk
bool fsChk
Definition XrdSsiFile.cc:56
XrdSsi::Trace
XrdSysTrace Trace
Definition XrdSsiSfs.cc:107
XrdSsi::Log
XrdSysError Log
Definition XrdSsiFileReq.cc:66
XrdSsi::FSPath
XrdOucPListAnchor FSPath
Definition XrdSsiFile.cc:55

References XrdOucStream::Attach(), XrdOucStream::Capture(), XrdOucStream::Close(), Configure(), XrdSsi::fsChk, XrdSsi::FSPath, isCms, isServer, XrdOucStream::LastError(), XrdSsi::Log, open, XrdSsi::theFS, XrdSsi::Trace, TRACESSI_ALL, and TRACESSI_Debug.

Referenced by Configure(), and XrdSfsGetFileSystem2().

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

## Configure() [2/2]

bool XrdSsiSfsConfig::Configure | ( | XrdOucEnv * | envP | ) |

Definition at line 244 of file XrdSsiSfsConfig.cc.

{
static char theSSI[] = {'s', 's', 'i', 0};
static char **myArgv = 0, *dfltArgv[] = {0, 0};
XrdOucEnv *xrdEnvP;
int myArgc = 0, NoGo;
// Now find the scheduler
//
if (envP && !(Sched = (XrdScheduler *)envP->GetPtr("XrdScheduler*")))
{Log.Emsg("Config", "Scheduler pointer is undefined!");
NoGo = 1;
} else NoGo = 0;
// Find our arguments, if any
//
if ((xrdEnvP = (XrdOucEnv *)envP->GetPtr("xrdEnv*"))
&& (myArgv = (char **)xrdEnvP->GetPtr("xrdssi.argv**")))
myArgc = xrdEnvP->GetInt("xrdssi.argc");
// Verify that we have some and substitute if not
//
if (!myArgv || myArgc < 1)
{if (!(dfltArgv[0] = (char *)xrdEnvP->GetPtr("argv[0]")))
dfltArgv[0] = theSSI;
myArgv = dfltArgv;
myArgc = 1;
}
// Establish the network interface that the caller must provide
//
if (!isCms && (!envP || !(myIF = (XrdNetIF *)envP->GetPtr("XrdNetIF*"))))
{Log.Emsg("Finder", "Network i/f undefined; unable to self-locate.");
NoGo = 1;
}
// Now configure management functions and the cms if we are not the cms
//
if (!NoGo && !isCms && envP)
{if (ConfigObj() || ConfigCms(envP)) NoGo = 1;}
// Now configure the server
//
if (!NoGo && ConfigSvc(myArgv, myArgc)) NoGo = 1;
// All done
//
return !NoGo;
}
XrdOucEnv::GetInt
long GetInt(const char *varname)
Definition XrdOucEnv.cc:235
XrdOucEnv::GetPtr
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdProxy::envP
XrdOucEnv * envP
Definition XrdPss.cc:109
XrdSsi::myIF
XrdNetIF * myIF
Definition XrdSsiSfsConfig.cc:93
XrdSsi::Sched
XrdScheduler * Sched
Definition XrdSsiSfsConfig.cc:87

References XrdOucEnv::GetInt(), XrdOucEnv::GetPtr(), isCms, XrdSsi::Log, XrdSsi::myIF, and XrdSsi::Sched.

Here is the call graph for this function:

## Member Data Documentation

## isCms

bool XrdSsiSfsConfig::isCms

Definition at line 50 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig(), Configure(), and Configure().

## isServer

bool XrdSsiSfsConfig::isServer

Definition at line 49 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig(), and Configure().

## myHost

const char* XrdSsiSfsConfig::myHost

Definition at line 43 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## myInsName

const char* XrdSsiSfsConfig::myInsName

Definition at line 45 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## myPort

int XrdSsiSfsConfig::myPort

Definition at line 48 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## myProg

const char* XrdSsiSfsConfig::myProg

Definition at line 44 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## myRole

char* XrdSsiSfsConfig::myRole

Definition at line 46 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## myVersion

XrdVersionInfo* XrdSsiSfsConfig::myVersion

Definition at line 42 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

## SsiCms

XrdSsiCluster* XrdSsiSfsConfig::SsiCms

Definition at line 47 of file XrdSsiSfsConfig.hh.

Referenced by XrdSsiSfsConfig().

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

- XrdSsiSfsConfig.hh
- XrdSsiSfsConfig.cc