37 #include <sys/types.h>
104 const std::string &contact,
117 const char *contact=0
118 ) {
return notPresent;}
120 virtual void SetCBThreads(
int cbNum,
int ntNum);
123 std::string &optname,
int optvalue);
125 virtual void SetSpread(
short ssz);
127 virtual void SetTimeout(tmoType what,
int tmoval);
142 const std::string &contact,
145 static const int maxTMO = 0x7fffffff;
148 const char *eText = 0;
156 if (!
schedP) SetScheduler();
171 {eInfo.
Set(
"Contact not specified.", EINVAL);
return 0;}
176 if (contact.find(
',') != std::string::npos
178 {
int cNum = contactN++;
182 eText = (
eMsg.size() ?
eMsg.c_str() :
"reason unknown");
186 if (!(eText = netAddr.
Set(contact.c_str()))
188 eText =
"formatting failed";
194 {snprintf(buff,
sizeof(buff),
"Unable to validate contact; %s", eText);
195 eInfo.
Set(buff, EINVAL);
213 {
if (cbNum > 32767) cbNum = 32767;
214 if (ntNum < 1) ntNum = cbNum*10/100;
215 if (ntNum < 3) ntNum = 0;
216 else if (ntNum > 100) ntNum = 100;
218 maxTCB =
static_cast<short>(cbNum);
219 maxCLW =
static_cast<short>(ntNum);
229 std::string &optname,
int optvalue)
233 if (optname ==
"cbThreads")
235 {eInfo.
Set(
"invalid cbThreads value.", EINVAL);
return false;}
236 if (optvalue > 32767) optvalue = 32767;
238 maxTCB =
static_cast<short>(optvalue);
241 else if (optname ==
"hiResTime")
hiResTime =
true;
242 else if (optname ==
"netThreads")
244 {eInfo.
Set(
"invalid netThreads value.", EINVAL);
return false;}
245 if (optvalue > 32767) optvalue = 32767;
247 maxCLW =
static_cast<short>(optvalue);
250 else if (optname ==
"pollers")
252 {eInfo.
Set(
"invalid pollers value.", EINVAL);
return false;}
253 if (optvalue > 32767) optvalue = 32767;
255 maxPEL =
static_cast<short>(optvalue);
258 else if (optname ==
"reqDispatch")
265 else {eInfo.
Set(
"invalid option name.", EINVAL);
return false;}
274 void XrdSsiClientProvider::SetLogger()
280 #if ( defined(__linux__) || defined(__GNU__) ) && defined(F_DUPFD_CLOEXEC)
281 eFD =
fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 0);
283 eFD = dup(STDERR_FILENO);
284 fcntl(eFD, F_SETFD, FD_CLOEXEC);
312 void XrdSsiClientProvider::SetScheduler()
359 if (tmoval <= 0)
return;
369 {
case connect_N:
clEnvP->
PutInt(
"ConnectionRetry", tmoval);
371 case connect_T:
clEnvP->
PutInt(
"ConnectionWindow", tmoval);
373 case idleClose:
clEnvP->
PutInt(
"DataServerTTL", tmoval);
376 case request_T:
clEnvP->
PutInt(
"RequestTimeout", tmoval);
int fcntl(int fd, int cmd,...)
XrdSsiProvider * XrdSsiProviderClient
static Env * GetEnv()
Get default client environment.
bool PutInt(const std::string &key, int value)
int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
@ fmtName
Hostname if it is resolvable o/w use fmtAddr.
const char * Set(const char *hSpec, int pNum=PortInSpec)
static bool Register(const char *hName, const char *hList[], int hLNum, std::string *eText=0, bool rotate=false)
static const char pfx
Registry names must start with this character.
static bool Singleton(const char *hSpec, const char **eText=0)
void setParms(int minw, int maxw, int avlt, int maxi, int once=0)
virtual void SetSpread(short ssz)
virtual bool SetConfig(XrdSsiErrInfo &eInfo, std::string &optname, int optvalue)
virtual ~XrdSsiClientProvider()
virtual rStat QueryResource(const char *rName, const char *contact=0)
virtual void SetCBThreads(int cbNum, int ntNum)
XrdSsiService * GetService(XrdSsiErrInfo &eInfo, const std::string &contact, int oHold=256)
virtual void SetTimeout(tmoType what, int tmoval)
virtual bool Init(XrdSsiLogger *logP, XrdSsiCluster *clsP, std::string cfgFn, std::string parms, int argc, char **argv)
void Set(const char *eMsg=0, int eNum=0, int eArg=0)
void() MCB_t(struct timeval const &mtime, unsigned long tID, const char *msg, int mlen)
Length of message text.
void setSpread(short sval)
XrdSysLogger * logger(XrdSysLogger *lp=0)
void setHiRes()
Set log file timstamp to high resolution (hh:mm:ss.uuuu).
static bool Configure(XrdSysLogger &logr, Parms &parms)
void SetLogger(XrdSysLogger *logp)
XrdSsiLogger::MCB_t * msgCB
XrdSsiLogger::MCB_t * msgCBCl
static const int rDispRand
static const int rDispNone
Parameters to be passed to configure.
XrdSysLogPI_t logpi
-> log plugin object or nil if none
int bufsz
size of message buffer, -1 default, or 0