#ifndef ROOT_TSecContext
#define ROOT_TSecContext
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TDatime
#include "TDatime.h"
#endif
const TDatime kROOTTZERO = 788914800;
class TSecContextCleanup;
class TPwdCtx;
class TSecContext : public TObject {
friend class TRootSecContext;
private:
void *fContext;
TList *fCleanup;
TDatime fExpDate;
TString fHost;
TString fID;
Int_t fMethod;
TString fMethodName;
Int_t fOffSet;
TString fToken;
TString fUser;
virtual Bool_t CleanupSecContext(Bool_t all);
void Cleanup();
protected:
TSecContext(const TSecContext&);
TSecContext& operator=(const TSecContext&);
public:
TSecContext(const char *url, Int_t meth, Int_t offset,
const char *id, const char *token,
TDatime expdate = kROOTTZERO, void *ctx = 0);
TSecContext(const char *user, const char *host, Int_t meth, Int_t offset,
const char *id, const char *token,
TDatime expdate = kROOTTZERO, void *ctx = 0);
virtual ~TSecContext();
void AddForCleanup(Int_t port, Int_t proto, Int_t type);
virtual const char *AsString(TString &out);
virtual void DeActivate(Option_t *opt = "CR");
void *GetContext() const { return fContext; }
TDatime GetExpDate() const { return fExpDate; }
const char *GetHost() const { return fHost; }
const char *GetID() const { return fID; }
Int_t GetMethod() const { return fMethod; }
const char *GetMethodName() const { return fMethodName; }
Int_t GetOffSet() const { return fOffSet; }
TList *GetSecContextCleanup() const { return fCleanup; }
const char *GetToken() const { return fToken; }
const char *GetUser() const { return fUser; }
Bool_t IsA(const char *methodname);
Bool_t IsActive() const;
virtual void Print(Option_t *option = "F") const;
void SetExpDate(TDatime expdate) { fExpDate= expdate; }
void SetID(const char *id) { fID= id; }
void SetOffSet(Int_t offset) { fOffSet = offset; }
void SetUser(const char *user) { fUser = user; }
ClassDef(TSecContext,0)
};
class TSecContextCleanup : public TObject {
private:
Int_t fPort;
Int_t fServerProtocol;
Int_t fServerType;
public:
TSecContextCleanup(Int_t port, Int_t proto, Int_t type) :
fPort(port), fServerProtocol(proto), fServerType(type) { };
virtual ~TSecContextCleanup() { };
Int_t GetPort() const { return fPort; }
Int_t GetProtocol() const { return fServerProtocol; }
Int_t GetType() const { return fServerType; }
ClassDef(TSecContextCleanup,0)
};
class TPwdCtx {
private:
TString fPasswd;
Bool_t fPwHash;
public:
TPwdCtx(const char *pwd, Bool_t pwh): fPasswd(pwd), fPwHash(pwh) {};
virtual ~TPwdCtx() {};
const char *GetPasswd() const { return fPasswd; }
Bool_t IsPwHash() const { return fPwHash; }
};
#endif