12 #ifndef ROOT_XrdProofdProofServMgr 13 #define ROOT_XrdProofdProofServMgr 32 # include <sys/types.h> 33 # include <sys/socket.h> 34 # include "XrdNet/XrdNetPeer.hh" 36 # include "XrdNet/XrdNetAddr.hh" 38 #include "XrdOuc/XrdOucHash.hh" 39 #include "XrdOuc/XrdOucString.hh" 45 class XrdProtocol_Config;
51 #define PSMCNTOK(t) (t >= 0 && t < PSMMAXCNTS) 102 int ReadFromFile(
const char *
file);
104 int SaveToFile(
const char *file);
117 XpdEnv(
const char *
n,
const char *env,
const char *usr = 0,
const char *grp = 0,
118 int smi = -1,
int smx = -1,
int vmi = -1,
int vmx = -1) :
119 fName(n), fEnv(env), fUsers(usr), fGroups(grp),
120 fSvnMin(smi), fSvnMax(smx), fVerMin(vmi), fVerMax(vmx) { }
121 void Reset(
const char *
n,
const char *env,
const char *usr = 0,
const char *grp = 0,
122 int smi = -1,
int smx = -1,
int vmi = -1,
int vmx = -1) {
123 fName =
n; fEnv = env; fUsers = usr; fGroups = grp;
124 fSvnMin = smi; fSvnMax = smx; fVerMin = vmi; fVerMax = vmx; }
125 int Matches(
const char *usr,
const char *grp,
int ver = -1);
126 void Print(
const char *what);
127 static int ToVersCode(
int ver,
bool hex = 0);
178 int DoDirectiveProofServMgr(
char *, XrdOucStream *,
bool);
179 int DoDirectivePutEnv(
char *, XrdOucStream *,
bool);
180 int DoDirectivePutRc(
char *, XrdOucStream *,
bool);
181 int DoDirectiveShutdown(
char *, XrdOucStream *,
bool);
182 void ExtractEnv(
char *, XrdOucStream *,
183 XrdOucString &users, XrdOucString &groups,
184 XrdOucString &rcval, XrdOucString &rcnam,
185 int &smi,
int &smx,
int &vmi,
int &vmx,
bool &hex);
186 void FillEnvList(std::list<XpdEnv> *el,
const char *nam,
const char *val,
187 const char *usrs = 0,
const char *grps = 0,
188 int smi = -1,
int smx = -1,
int vmi = -1,
int vmx = -1,
bool hex = 0);
194 unsigned int seq, XrdOucString &emsg);
197 void *input,
const char *envfn,
const char *rcfn);
199 void *input,
const char *rcfn);
201 int SetupProtocol(XrdNetPeer &peerpsrv,
203 int SetupProtocol(XrdNetAddr &netaddr,
207 XrdOucString &tag, XrdOucString &ord,
208 XrdOucString &cffile, XrdOucString &uenvs,
212 int PrepareSessionRecovering();
213 int ResolveSession(
const char *fpid);
219 bool IsSessionSocket(
const char *fpid);
220 int RmSession(
const char *fpid);
221 int TouchSession(
const char *fpid,
const char *path = 0);
222 int VerifySession(
const char *fpid,
int to = -1,
const char *path = 0);
231 enum PSMProtocol { kSessionRemoval = 0, kClientDisconnect = 1, kCleanSessions = 2, kProcessReq = 3, kChgSessionSt = 4} ;
232 enum PSMCounters { kCreateCnt = 0, kCleanSessionsCnt = 1, kProcessCnt = 2} ;
236 int Config(
bool rcf = 0);
238 char *val, XrdOucStream *cfg,
bool rcf);
239 void RegisterDirectives();
250 bool IsReconnecting();
251 bool IsClientRecovering(
const char *usr,
const char *grp,
int &deadline);
252 void SetReconnectTime(
bool on = 1);
268 if (fCounters[t] < 0) fCounters[t] = 0;} }
273 void BroadcastClusterInfo();
274 int BroadcastPriorities();
275 int CurrentSessions(
bool recalculate = 0);
276 void DisconnectFromProofServ(
int pid);
281 int CleanupProofServ(
bool all = 0,
const char *usr = 0);
285 const char *sessiondir,
287 XrdOucString &outfn);
290 XrdOucString &sesstag, XrdOucString &topsesstag,
291 XrdOucString &sessiondir, XrdOucString &sesswrkdir);
302 int DeleteFromSessions(
const char *pid);
303 int MvSession(
const char *fpid);
304 int CheckActiveSessions(
bool verify = 1);
305 int CheckTerminatedSessions();
306 int CleanClientSessions(
const char *usr,
int srvtype);
307 int CleanupLostProofServ();
308 int RecoverActiveSessions();
325 void Set(
int *
c) { fCnt =
c;
if (fCnt) (*fCnt)++;}
void Reset(const char *n, const char *env, const char *usr=0, const char *grp=0, int smi=-1, int smx=-1, int vmi=-1, int vmx=-1)
int VerifyTimeOut() const
XrdOucHash< XrdProofdProofServ > fSessions
static constexpr double pi
std::list< XrdProofdProofServ * > * ActiveSessions()
unsigned int GetSeqSessionN()
std::map< XrdProofdProtocol *, int > fDestroyTimes
virtual ~XrdProofdProofServMgr()
void UpdateCounter(int t, int n)
XrdSysSemWait fProcessSem
XrdSysRecMutex fRecoverMutex
XrdOucString fParentExecs
XrdSysSemWait * ProcessSem()
XrdSecCredsSaver_t fCredsSaver
XpdSrvMgrCreateCnt(XrdProofdProofServMgr *m, int t)
std::list< XpdEnv > fProofServEnvs
XrdOucString fTermAdminPath
XrdSysRecMutex fEnvsMutex
std::list< XrdProofdProofServ * > fActiveSessions
std::list< XpdClientSessions * > * fRecoverClients
XrdProofdProofServMgr * fMgr
std::list< XrdProofdProofServ * > fProofServs
std::list< XpdEnv > fProofServRCs
int CheckFrequency() const
#define XrdSysMutexHelper
XpdClientSessions(XrdProofdClient *c=0)
void Reset(Detail::TBranchProxy *x)
int operator==(const XpdClientSessions c)
XrdOucString fProofPlugin
void Print(std::ostream &os, const OptionType &opt)
XpdEnv(const char *n, const char *env, const char *usr=0, const char *grp=0, int smi=-1, int smx=-1, int vmi=-1, int vmx=-1)
static constexpr double s
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
unsigned int fSeqSessionN
void SetNextSessionsCheck(int t)
XrdOucString fTopSessionTag
XrdOucString fActiAdminPath
XpdSrvMgrCreateGuard(int *c=0)
XrdProofdClient * fClient
int(* XrdSecCredsSaver_t)(XrdSecCredentials *, const char *fn, const XrdProofUI &ui)
XrdProofSessionInfo(const char *file)