Warning, file /include/root/TApplicationServer.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TApplicationServer
0013 #define ROOT_TApplicationServer
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TApplication.h"
0025 #include "TString.h"
0026 #include "TSysEvtHandler.h"
0027 #include "TUrl.h"
0028
0029 class TList;
0030 class TMessage;
0031 class TSocket;
0032 class TRemoteObject;
0033
0034 class TApplicationServer : public TApplication {
0035
0036 private:
0037 Int_t fProtocol;
0038 TUrl fUrl;
0039 TSocket *fSocket;
0040 Bool_t fIsValid;
0041 Bool_t fInterrupt;
0042
0043 TString fLogFilePath;
0044 FILE *fLogFile;
0045 Int_t fLogFileDes;
0046 Bool_t fRealTimeLog;
0047
0048 TString fSessId;
0049
0050 TString fWorkDir;
0051
0052 TList *fSentCanvases;
0053 TRemoteObject *fWorkingDir;
0054
0055 void ExecLogon();
0056 Int_t Setup();
0057 Int_t SendCanvases();
0058
0059 protected:
0060 void HandleCheckFile(TMessage *mess);
0061
0062 static void ErrorHandler(Int_t level, Bool_t abort, const char *location,
0063 const char *msg);
0064
0065 public:
0066 TApplicationServer(Int_t *argc, char **argv, FILE *flog, const char *logfile);
0067 virtual ~TApplicationServer();
0068
0069 void GetOptions(Int_t *argc, char **argv) override;
0070 Int_t GetProtocol() const { return fProtocol; }
0071 Int_t GetPort() const { return fUrl.GetPort(); }
0072 const char *GetUser() const { return fUrl.GetUser(); }
0073 const char *GetHost() const { return fUrl.GetHost(); }
0074 TSocket *GetSocket() const { return fSocket; }
0075
0076 void HandleSocketInput();
0077 void HandleUrgentData();
0078 void HandleSigPipe();
0079 void Interrupt() { fInterrupt = kTRUE; }
0080 Bool_t IsValid() const { return fIsValid; }
0081
0082 Longptr_t ProcessLine(const char *line, Bool_t = kFALSE, Int_t *err = nullptr) override;
0083
0084 void Reset(const char *dir);
0085 Int_t ReceiveFile(const char *file, Bool_t bin, Long64_t size);
0086 void Run(Bool_t retrn = kFALSE) override;
0087 void SendLogFile(Int_t status = 0, Int_t start = -1, Int_t end = -1);
0088 Int_t BrowseDirectory(const char *dirname);
0089 Int_t BrowseFile(const char *fname);
0090 Int_t BrowseKey(const char *keyname);
0091
0092 void Terminate(Int_t status) override;
0093
0094 ClassDefOverride(TApplicationServer,0)
0095 };
0096
0097
0098
0099
0100
0101 class TASLogHandler : public TFileHandler {
0102 private:
0103 TSocket *fSocket;
0104 FILE *fFile;
0105 TString fPfx;
0106
0107 static TString fgPfx;
0108 public:
0109 enum EStatusBits { kFileIsPipe = BIT(23) };
0110 TASLogHandler(const char *cmd, TSocket *s, const char *pfx = "");
0111 TASLogHandler(FILE *f, TSocket *s, const char *pfx = "");
0112 virtual ~TASLogHandler();
0113
0114 Bool_t IsValid() { return ((fFile && fSocket) ? kTRUE : kFALSE); }
0115
0116 Bool_t Notify() override;
0117 Bool_t ReadNotify() override { return Notify(); }
0118
0119 static void SetDefaultPrefix(const char *pfx);
0120 };
0121
0122
0123
0124 class TASLogHandlerGuard {
0125
0126 private:
0127 TASLogHandler *fExecHandler;
0128
0129 public:
0130 TASLogHandlerGuard(const char *cmd, TSocket *s,
0131 const char *pfx = "", Bool_t on = kTRUE);
0132 TASLogHandlerGuard(FILE *f, TSocket *s,
0133 const char *pfx = "", Bool_t on = kTRUE);
0134 virtual ~TASLogHandlerGuard();
0135 };
0136
0137 #endif