00001 #ifndef __XRDSSISESSREAL_HH__
00002 #define __XRDSSISESSREAL_HH__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <string.h>
00033
00034 #include "XrdCl/XrdClFile.hh"
00035
00036 #include "XrdSsi/XrdSsiAtomics.hh"
00037 #include "XrdSsi/XrdSsiEvent.hh"
00038
00039 #include "XrdSys/XrdSysPthread.hh"
00040
00041 class XrdSsiServReal;
00042 class XrdSsiTaskReal;
00043
00044 class XrdSsiSessReal : public XrdSsiEvent
00045 {
00046 public:
00047
00048 XrdSsiSessReal *nextSess;
00049
00050 const char *GetKey() {return resKey;}
00051
00052 void InitSession(XrdSsiServReal *servP,
00053 const char *sName,
00054 int uent,
00055 bool hold);
00056
00057 void Lock() {sessMutex.Lock();}
00058
00059 XrdSsiMutex *MutexP() {return &sessMutex;}
00060
00061 bool Provision(XrdSsiRequest *reqP, const char *epURL);
00062
00063 bool Run(XrdSsiRequest *reqP);
00064
00065 void SetKey(const char *key)
00066 {if (resKey) free(resKey);
00067 resKey = (key ? strdup(key) : 0);
00068 }
00069
00070 void TaskFinished(XrdSsiTaskReal *tP);
00071
00072 void UnHold(bool cleanup=true);
00073
00074 void UnLock() {sessMutex.UnLock();}
00075
00076 void Unprovision();
00077
00078 bool XeqEvent(XrdCl::XRootDStatus *status,
00079 XrdCl::AnyObject **respP);
00080
00081 XrdSsiSessReal(XrdSsiServReal *servP,
00082 const char *sName,
00083 int uent,
00084 bool hold=false)
00085 : XrdSsiEvent("SessReal"),
00086 sessMutex(XrdSsiMutex::Recursive),
00087 resKey(0), sessName(0), sessNode(0)
00088 {InitSession(servP, sName, uent, hold);}
00089
00090 ~XrdSsiSessReal();
00091
00092 XrdCl::File epFile;
00093
00094 private:
00095 XrdSsiTaskReal *NewTask(XrdSsiRequest *reqP);
00096 void RelTask(XrdSsiTaskReal *tP);
00097 void Shutdown(XrdCl::XRootDStatus &epStatus, bool onClose);
00098
00099 XrdSsiMutex sessMutex;
00100 XrdSsiServReal *myService;
00101 XrdSsiTaskReal *attBase;
00102 XrdSsiTaskReal *freeTask;
00103 XrdSsiRequest *requestP;
00104 char *resKey;
00105 char *sessName;
00106 char *sessNode;
00107 uint32_t nextTID;
00108 uint32_t alocLeft;
00109 int16_t uEnt;
00110 bool isHeld;
00111 bool inOpen;
00112 bool noReuse;
00113 };
00114 #endif