#ifndef ROOT_TXSocket
#define ROOT_TXSocket
#define DFLT_CONNECTMAXTRY           10
#ifndef ROOT_TMutex
#include "TMutex.h"
#endif
#ifndef ROOT_TSemaphore
#include "TSemaphore.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TMessage
#include "TMessage.h"
#endif
#ifndef ROOT_TUrl
#include "TUrl.h"
#endif
#ifndef ROOT_TSocket
#include "TSocket.h"
#endif
#ifndef ROOT_XrdProofConn
#include "XrdProofConn.h"
#endif
#ifndef XRC_UNSOLMSG_H
#include "XrdClient/XrdClientUnsolMsg.hh"
#endif
#include <list>
class TObjString;
class TXSockBuf;
class TXHandler;
class TXSocketHandler;
class XrdClientMessage;
typedef struct {
   Int_t   fInt1;
   Int_t   fInt2;
   Int_t   fInt3;
   Int_t   fInt4;
} XHandleIn_t;
class TXSocket  : public TSocket, public XrdClientAbsUnsolMsgHandler {
friend class TXProofMgr;
friend class TXProofServ;
friend class TXSlave;
friend class TXSocketHandler;
friend class TXUnixSocket;
private:
   char                fMode;          
   kXR_int32           fSendOpt;       
   Short_t             fSessionID;     
   TString             fUser;          
   TString             fHost;          
   Int_t               fPort;          
   Int_t               fLogLevel;      
   TString             fBuffer;        
   TObject            *fReference;     
   TXHandler          *fHandler;       
   XrdProofConn       *fConn;          
   
   TSemaphore          fASem;          
   TMutex             *fAMtx;          
   std::list<TXSockBuf *> fAQue;          
   Int_t               fByteLeft;      
   Int_t               fByteCur;       
   TXSockBuf          *fBufCur;        
   
   TMutex             *fIMtx;          
   kXR_int32           fILev;          
   
   Int_t               fPid;
   
   Bool_t              fDontTimeout;   
   
   Int_t               fXrdProofdVersion;
   
   static TList        fgReadySock;    
   static TMutex       fgReadyMtx;     
   static Int_t        fgPipe[2];      
   static TString      fgLoc;          
   static Bool_t       fgInitDone;     
   
   static TMutex       fgSMtx;          
   static std::list<TXSockBuf *> fgSQue; 
   
   Int_t               PickUpReady();
   TXSockBuf          *PopUpSpare(Int_t sz);
   void                PushBackSpare();
   
   Int_t               GetLowSocket() const { return (fConn ? fConn->GetLowSocket() : -1); }
   static Int_t        GetPipeRead(); 
   static Int_t        PostPipe(TSocket *s=0);  
   static Int_t        CleanPipe(TSocket *s=0); 
   static Int_t        FlushPipe(TSocket *s=0); 
   static void         InitEnvs(); 
   static void         DumpReadySock(); 
public:
   
   enum ECoordMsgType { kQuerySessions = 1000,
                        kSessionTag, kSessionAlias, kGetWorkers, kQueryWorkers,
                        kCleanupSessions,
                        kQueryLogPaths,
                        kReadBuffer,
                        kQueryROOTVersions,
                        kROOTVersion,
                        kGroupProperties };
   
   enum EUrgentMsgType { kStopProcess = 2000 };
   TXSocket(const char *url, Char_t mode = 'M', Int_t psid = -1, Char_t ver = -1,
            const char *logbuf = 0, Int_t loglevel = -1, TXHandler *handler = 0);
   TXSocket(const TXSocket &xs);
   TXSocket& operator=(const TXSocket& xs);
   virtual ~TXSocket();
   virtual void        Close(Option_t *opt = "");
   Bool_t              Create();
   void                DisconnectSession(Int_t id, Option_t *opt = "");
   void                DoError(int level,
                               const char *location, const char *fmt, va_list va) const;
   virtual UnsolRespProcResult ProcessUnsolicitedMsg(XrdClientUnsolMsgSender *s,
                                                     XrdClientMessage *msg);
   virtual Int_t       GetClientID() const { return -1; }
   virtual Int_t       GetClientIDSize() const { return 1; }
   Int_t               GetLogConnID() const { return (fConn ? fConn->GetLogConnID() : -1); }
   Int_t               GetOpenError() const { return (fConn ? fConn->GetOpenError() : -1); }
   Int_t               GetServType() const { return (fConn ? fConn->GetServType() : -1); }
   Int_t               GetSessionID() const { return (fConn ? fConn->GetSessionID() : -1); }
   Int_t               GetXrdProofdVersion() const { return fXrdProofdVersion; }
   Bool_t              IsValid() const { return (fConn ? (fConn->IsValid()) : kFALSE); }
   Bool_t              IsServProofd();
   virtual void        RemoveClientID() { }
   virtual void        SetClientID(Int_t) { }
   void                SetSendOpt(ESendRecvOptions o) { fSendOpt = o; }
   void                SetSessionID(Int_t id) { fSessionID = id; }
   
   Int_t               Send(const TMessage &mess);
   Int_t               Send(Int_t kind) { return TSocket::Send(kind); }
   Int_t               Send(Int_t status, Int_t kind)
                                        { return TSocket::Send(status, kind); }
   Int_t               Send(const char *mess, Int_t kind = kMESS_STRING)
                                        { return TSocket::Send(mess, kind); }
   Int_t               SendRaw(const void *buf, Int_t len,
                               ESendRecvOptions opt = kDontBlock);
   TObjString         *SendCoordinator(Int_t kind,
                                       const char *msg = 0, Int_t int2 = 0, Long64_t l64 = 0);
   
   Int_t               Recv(TMessage *&mess);
   Int_t               Recv(Int_t &status, Int_t &kind)
                                        { return TSocket::Recv(status, kind); }
   Int_t               Recv(char *mess, Int_t max)
                                        { return TSocket::Recv(mess, max); }
   Int_t               Recv(char *mess, Int_t max, Int_t &kind)
                                        { return TSocket::Recv(mess, max, kind); }
   Int_t               RecvRaw(void *buf, Int_t len,
                               ESendRecvOptions opt = kDefault);
   
   Int_t               SendInterrupt(Int_t type);
   Int_t               GetInterrupt();
   
   void                SendUrgent(Int_t type, Int_t int1, Int_t int2);
   
   void                SetInterrupt() { if (fConn) fConn->SetInterrupt(); }
   
   Int_t               Flush();
   
   Bool_t              Ping(Bool_t cleanpipe = kFALSE);
   
   Int_t               SetOption(ESockOptions, Int_t) { return 0; }
   
   void                DisableTimeout() { fDontTimeout = kTRUE; }
   void                EnableTimeout() { fDontTimeout = kFALSE; }
   ClassDef(TXSocket, 0) 
};
class TXSockBuf {
public:
   Int_t   fSiz;
   Int_t   fLen;
   Char_t *fBuf;
   Bool_t  fOwn;
   Int_t   fCid;
   TXSockBuf(Char_t *bp=0, Int_t sz=0, Bool_t own=1)
             { fBuf = fMem = bp; fSiz = fLen = sz; fOwn = own; fCid = -1; fgBuffMem += sz; }
  ~TXSockBuf() {if (fOwn && fMem) { free(fMem); fgBuffMem -= fSiz; }}
   void Resize(Int_t sz) { if (sz > fSiz)
                              if ((fMem = (Char_t *)realloc(fMem, sz))) { fgBuffMem += (sz - fSiz);
                                 fBuf = fMem; fSiz = sz; fLen = 0;}}
   static Long64_t BuffMem();
   static Long64_t GetMemMax();
   static void     SetMemMax(Long64_t memmax);
private:
   Char_t *fMem;
   static Long64_t fgBuffMem; 
   static Long64_t fgMemMax;  
};
#endif
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.