XRootD
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
 
XrdSsiClusterSsiCms
 

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.

122{
123 static XrdVERSIONINFODEF(myVer, ssi, XrdVNUMBER, XrdVERSION);
124 char *bp;
125
126// Establish defaults
127//
128 ConfigFN = 0;
129 CmsLib = 0;
130 CmsParms = 0;
131 SsiCms = 0;
132 SvcLib = 0;
133 SvcParms = 0;
134 myRole = 0;
135 respWT = 0x7fffffff;
136 isServer = true;
137 isCms = iscms;
138 myHost = getenv("XRDHOST");
139 myProg = getenv("XRDPROG");
141 myVersion = &myVer;
142 myPort = (bp = getenv("XRDPORT")) ? strtol(bp, (char **)NULL, 10) : 0;
143}
static XrdVERSIONINFODEF(compiledVer, XrdHttpProtocolTest, XrdVNUMBER, XrdVERSION)
static const char * InstName(int TranOpt=0)
const char * myHost
XrdVersionInfo * myVersion
const char * myInsName
const char * myProg
XrdSsiCluster * SsiCms

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.

150{
151 if (ConfigFN) free(ConfigFN);
152 if (CmsLib) free(CmsLib);
153 if (CmsParms) free(CmsParms);
154 if (SvcLib) free(SvcLib);
155 if (SvcParms) free(SvcParms);
156}

Member Function Documentation

◆ Configure() [1/2]

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

Definition at line 162 of file XrdSsiSfsConfig.cc.

163{
164 char *var;
165 const char *tmp;
166 int cfgFD, retc, NoGo = 0;
167 XrdOucEnv myEnv;
168 XrdOucStream cStrm(&Log, getenv("XRDINSTANCE"), &myEnv, "=====> ");
169
170// Print warm-up message
171//
172 Log.Say("++++++ ssi initialization started.");
173
174// Preset all variables with common defaults
175//
176 if (getenv("XRDDEBUG") || getenv("XRDSSIDEBUG"))
178
179// If there is no config file, return with an error.
180//
181 if( !cFN || !*cFN)
182 {Log.Emsg("Config", "Configuration file not specified.");
183 return false;
184 }
185
186// Try to open the configuration file.
187//
188 ConfigFN = strdup(cFN);
189 if ( (cfgFD = open(cFN, O_RDONLY, 0)) < 0)
190 {Log.Emsg("Config", errno, "open config file", cFN);
191 return false;
192 }
193 cStrm.Attach(cfgFD);
194 static const char *cvec[] = { "*** ssi (sfs) plugin config:", 0 };
195 cStrm.Capture(cvec);
196
197// Now start reading records until eof.
198//
199 cFile = &cStrm;
200 while((var = cFile->GetMyFirstWord()))
201 {if (!strncmp(var, "ssi.", 4)
202 || !strcmp(var, "all.role"))
203 {if (ConfigXeq(var+4)) {cFile->Echo(); NoGo=1;}}
204 }
205
206// Now check if any errors occurred during file i/o
207//
208 if ((retc = cStrm.LastError()))
209 NoGo = Log.Emsg("Config", -retc, "read config file", cFN);
210 cStrm.Close();
211
212// Make sure we are configured as a server
213//
214 if (!isServer)
215 {Log.Emsg("Config", "ssi only supports server roles but role is not "
216 "defined as 'server'.");
217 return false;
218 }
219
220// Configure filesystem callout as needed
221//
222 if ((fsChk = FSPath.NotEmpty()))
223 {if (!theFS && !isCms)
224 {Log.Emsg("Config", "Specifying an fspath requires SSI to be stacked "
225 "with a file system!");
226 return false;
227 }
228 if (isServer && !theFS && !isCms) fsChk = false;
229 }
230
231// Perform historical phase 2 initialization
232//
233 if (!NoGo) NoGo = !Configure(envP);
234
235// All done
236//
237 tmp = (NoGo ? " failed." : " completed.");
238 Log.Say("------ ssi initialization", tmp);
239 return !NoGo;
240}
#define open
Definition XrdPosix.hh:71
#define TRACESSI_Debug
#define TRACESSI_ALL
char * GetMyFirstWord(int lowcase=0)
bool Configure(const char *cFN, XrdOucEnv *envP)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
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)
XrdSfsFileSystem * theFS
Definition XrdSsiFile.cc:54
bool fsChk
Definition XrdSsiFile.cc:56
XrdSysTrace Trace
Definition XrdSsiSfs.cc:107
XrdSysError Log
XrdOucPListAnchor FSPath
Definition XrdSsiFile.cc:55

References XrdOucStream::Attach(), XrdOucStream::Capture(), XrdOucStream::Close(), Configure(), XrdOucStream::Echo(), XrdSysError::Emsg(), XrdSsi::fsChk, XrdSsi::FSPath, XrdOucStream::GetMyFirstWord(), isCms, isServer, XrdOucStream::LastError(), XrdSsi::Log, XrdOucPListAnchor::NotEmpty(), open, XrdSysError::Say(), XrdSsi::theFS, XrdSsi::Trace, TRACESSI_ALL, TRACESSI_Debug, and XrdSysTrace::What.

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.

245{
246 static char theSSI[] = {'s', 's', 'i', 0};
247 static char **myArgv = 0, *dfltArgv[] = {0, 0};
248 XrdOucEnv *xrdEnvP;
249 int myArgc = 0, NoGo;
250
251// Now find the scheduler
252//
253 if (envP && !(Sched = (XrdScheduler *)envP->GetPtr("XrdScheduler*")))
254 {Log.Emsg("Config", "Scheduler pointer is undefined!");
255 NoGo = 1;
256 } else NoGo = 0;
257
258// Find our arguments, if any
259//
260 if ((xrdEnvP = (XrdOucEnv *)envP->GetPtr("xrdEnv*"))
261 && (myArgv = (char **)xrdEnvP->GetPtr("xrdssi.argv**")))
262 myArgc = xrdEnvP->GetInt("xrdssi.argc");
263
264// Verify that we have some and substitute if not
265//
266 if (!myArgv || myArgc < 1)
267 {if (!(dfltArgv[0] = (char *)xrdEnvP->GetPtr("argv[0]")))
268 dfltArgv[0] = theSSI;
269 myArgv = dfltArgv;
270 myArgc = 1;
271 }
272
273// Establish the network interface that the caller must provide
274//
275 if (!isCms && (!envP || !(myIF = (XrdNetIF *)envP->GetPtr("XrdNetIF*"))))
276 {Log.Emsg("Finder", "Network i/f undefined; unable to self-locate.");
277 NoGo = 1;
278 }
279
280// Now configure management functions and the cms if we are not the cms
281//
282 if (!NoGo && !isCms && envP)
283 {if (ConfigObj() || ConfigCms(envP)) NoGo = 1;}
284
285// Now configure the server
286//
287 if (!NoGo && ConfigSvc(myArgv, myArgc)) NoGo = 1;
288
289// All done
290//
291 return !NoGo;
292}
long GetInt(const char *varname)
Definition XrdOucEnv.cc:235
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdOucEnv * envP
Definition XrdPss.cc:109
XrdNetIF * myIF
XrdScheduler * Sched

References XrdSysError::Emsg(), 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: