00001 // @(#)root/proofd:$Id: XrdProofdSandbox.h 29612 2009-07-29 11:18:13Z ganis $ 00002 // Author: G. Ganis Jan 2008 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_XrdProofdSandbox 00013 #define ROOT_XrdProofdSandbox 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // XrdProofdSandbox // 00018 // // 00019 // Authors: G. Ganis, CERN, 2008 // 00020 // // 00021 // Create and manage a Unix sandbox. // 00022 // // 00023 ////////////////////////////////////////////////////////////////////////// 00024 00025 #include <list> 00026 00027 #include "XrdProofdAux.h" 00028 #include "XrdOuc/XrdOucString.hh" 00029 00030 class XrdProofdSandbox { 00031 00032 private: 00033 00034 bool fChangeOwn; 00035 XrdOucString fDir; 00036 XrdOucString fErrMsg; 00037 bool fValid; 00038 XrdProofUI fUI; 00039 00040 00041 static int fgMaxOldSessions; 00042 static XrdOucString fgWorkdir; 00043 static XrdProofUI fgUI; 00044 00045 public: 00046 XrdProofdSandbox(XrdProofUI ui, bool full, bool changeown); 00047 00048 const char *Dir() const { return fDir.c_str(); } 00049 00050 int GuessTag(XrdOucString &tag, int ridx = 1); 00051 00052 const char *ErrMsg() const { return fErrMsg.c_str(); } 00053 bool IsValid() const { return fValid; } 00054 00055 // Active sessions file management 00056 int AddSession(const char *tag); 00057 int RemoveSession(const char *tag); 00058 00059 //Parse the session dirs 00060 int GetSessionDirs(int opt, std::list<XrdOucString *> *sdirs, 00061 XrdOucString *tag = 0); 00062 int TrimSessionDirs(); 00063 00064 // The manager uses these to set configurable members 00065 static void SetMaxOldSessions(int mxses) { fgMaxOldSessions = mxses; } 00066 static void SetWorkdir(const char *wdir) { fgWorkdir = wdir; } 00067 }; 00068 #endif