#ifndef ROOT_TApplicationRemote
#define ROOT_TApplicationRemote
#ifndef ROOT_RRemoteProtocol
#include "RRemoteProtocol.h"
#endif
#ifndef ROOT_TApplication
#include "TApplication.h"
#endif
#ifndef ROOT_TMD5
#include "TMD5.h"
#endif
#ifndef ROOT_TUrl
#include "TUrl.h"
#endif
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TMessage
#include "TMessage.h"
#endif
#ifndef ROOT_TSysEvtHandler
#include "TSysEvtHandler.h"
#endif
class THashList;
class TMonitor;
class TSocket;
class TBrowser;
class TRemoteObject;
class TSeqCollection;
class TApplicationRemote : public TApplication {
public:
enum ESendFileOpt {
kAscii = 0x0,
kBinary = 0x1,
kForce = 0x2
};
enum EStatusBits {
kCollecting = BIT(16)
};
private:
class TARFileStat : public TNamed {
public:
TARFileStat(const char *fn, TMD5 *md5, Long_t mt) :
TNamed(fn,fn), fMD5(*md5), fModtime(mt) { }
TMD5 fMD5;
Long_t fModtime;
};
TString fName;
Int_t fProtocol;
TUrl fUrl;
TSocket *fSocket;
TMonitor *fMonitor;
Bool_t fInterrupt;
TSignalHandler *fIntHandler;
TString fLogFilePath;
THashList *fFileList;
TObject *fReceivedObject;
TSeqCollection *fRootFiles;
TRemoteObject *fWorkingDir;
static Int_t fgPortAttempts;
static Int_t fgPortLower;
static Int_t fgPortUpper;
Int_t Broadcast(const TMessage &mess);
Int_t Broadcast(const char *mess, Int_t kind = kMESS_STRING, Int_t type = kRRT_Undef);
Int_t Broadcast(Int_t kind, Int_t type = kRRT_Undef) { return Broadcast(0, kind, type); }
Int_t BroadcastObject(const TObject *obj, Int_t kind = kMESS_OBJECT);
Int_t BroadcastRaw(const void *buffer, Int_t length);
Bool_t CheckFile(const char *file, Long_t modtime);
Int_t Collect(Long_t timeout = -1);
Int_t CollectInput();
void RecvLogFile(Int_t size);
public:
TApplicationRemote(const char *url, Int_t debug = 0, const char *script = 0);
virtual ~TApplicationRemote();
virtual void Browse(TBrowser *b);
Bool_t IsFolder() const { return kTRUE; }
const char *ApplicationName() const { return fName; }
Long_t ProcessLine(const char *line, Bool_t = kFALSE, Int_t *error = 0);
Int_t SendFile(const char *file, Int_t opt = kAscii,
const char *rfile = 0);
Int_t SendObject(const TObject *obj);
void Interrupt(Int_t type = kRRI_Hard);
Bool_t IsValid() const { return (fSocket) ? kTRUE : kFALSE; }
void Print(Option_t *option="") const;
void Terminate(Int_t status = 0);
static void SetPortParam(Int_t lower = -1, Int_t upper = -1, Int_t attempts = -1);
ClassDef(TApplicationRemote,0)
};
class TARInterruptHandler : public TSignalHandler {
private:
TApplicationRemote *fApplicationRemote;
public:
TARInterruptHandler(TApplicationRemote *r)
: TSignalHandler(kSigInterrupt, kFALSE), fApplicationRemote(r) { }
Bool_t Notify();
};
#endif