12 #ifndef ROOT_XrdProofdClient
13 #define ROOT_XrdProofdClient
30 #include "XrdOuc/XrdOucString.hh"
37 #define XPC_DEFMAXOLDLOGS 10
43 class XrdProofdClient {
46 XrdProofdClient(XrdProofUI ui,
47 bool master,
bool changeown, XrdSysError *edest,
const char *tmp,
int rtime);
49 virtual ~XrdProofdClient();
51 inline const char *Group()
const {
return fUI.fGroup.c_str(); }
52 inline const char *User()
const {
return fUI.fUser.c_str(); }
53 inline bool IsValid()
const {
return fIsValid; }
54 bool Match(
const char *usr,
const char *grp = 0);
55 inline XrdSysRecMutex *Mutex()
const {
return (XrdSysRecMutex *)&fMutex; }
56 inline XrdROOT *ROOT()
const {
return fROOT; }
57 inline XrdProofdSandbox *Sandbox()
const {
return (XrdProofdSandbox *)&fSandbox; }
58 inline XrdProofUI UI()
const {
return fUI; }
60 XrdProofdProofServ *GetServer(
int psid);
61 XrdProofdProofServ *GetServer(XrdProofdProtocol *p);
62 void EraseServer(
int psid);
65 int ResetClientSlot(
int ic);
66 XrdProofdProtocol *GetProtocol(
int ic);
68 int GetClientID(XrdProofdProtocol *p);
69 int ReserveClientID(
int cid);
70 int SetClientID(
int cid, XrdProofdProtocol *p);
71 XrdProofdProofServ *GetFreeServObj();
72 XrdProofdProofServ *GetServObj(
int id);
74 void Broadcast(
const char *msg);
76 XrdOucString ExportSessions(XrdOucString &emsg, XrdProofdResponse *r = 0);
77 void SkipSessionsCheck(std::list<XrdProofdProofServ *> *active,
78 XrdOucString &emsg, XrdProofdResponse *r = 0);
79 void TerminateSessions(
int srvtype, XrdProofdProofServ *ref,
80 const char *msg, XrdProofdPipe *pipe,
bool changeown);
81 bool VerifySession(XrdProofdProofServ *xps, XrdProofdResponse *r = 0);
85 void SetGroup(
const char *g) { fUI.fGroup = g; }
86 void SetROOT(XrdROOT *r) { fROOT = r; }
88 void SetValid(
bool valid = 1) { fIsValid = valid; }
90 int Size()
const {
return fClients.size(); }
92 int Touch(
bool reset = 0);
94 int TrimSessionDirs() {
return fSandbox.TrimSessionDirs(); }
96 const char *AdminPath()
const {
return fAdminPath.c_str(); }
100 XrdSysRecMutex fMutex;
105 int fReconnectTimeOut;
110 XrdProofdSandbox fSandbox;
112 XrdOucString fAdminPath;
114 std::vector<XrdProofdProofServ *> fProofServs;
115 std::vector<XrdClientID *> fClients;
129 XrdProofdProtocol *fP;
130 XrdProofdResponse *fR;
134 void SetR() { fR = (fP && fSid > 0) ? fP->Response(fSid) : 0;}
136 XrdClientID(XrdProofdProtocol *pt = 0,
unsigned short id = 0)
137 { fP = pt; fSid = id; SetR(); fResetTime = -1; }
140 XrdProofdClient *C()
const {
return fP->Client(); }
141 bool IsValid()
const {
return (fP != 0); }
142 XrdProofdProtocol *P()
const {
return fP; }
143 XrdProofdResponse *R()
const {
return fR; }
144 void Reset() { fP = 0; fSid = 0; SetR(); fResetTime = time(0); }
145 int ResetTime() {
return fResetTime; }
146 void SetP(XrdProofdProtocol *p) { fP = p; SetR();}
147 void SetSid(
unsigned short sid) { fSid = sid; SetR();}
148 unsigned short Sid()
const {
return fSid; }