library: libNetx #include "TXPhyConnection.h"

# TXPhyConnection

class description - source file - inheritance tree (.pdf)

## class TXPhyConnection : public TXUnsolicitedMsgSender

| Inheritance Chart:
`TXUnsolicitedMsgSender`
| <- | `TXPhyConnection` |

        private:

          void HandleUnsolicited(TXMessage* m)

        public:

                           TXPhyConnection(TXAbsUnsolicitedMsgHandler* h)
                           TXPhyConnection(const TXPhyConnection&)
                   virtual ~TXPhyConnection()
                TXMessage* BuildXMessage(ESendRecvOptions opt, Bool_t IgnoreTimeouts, Bool_t Enqueue)
                      void CheckAutoTerm()
            static TClass* Class()
                    Bool_t Connect(TString TcpAddress, Int_t TcpPort, Int_t TcpWindowSize)
                      void Disconnect()
                    Bool_t ExpiredTTL()
                    UInt_t GetBytesRecv()
                    UInt_t GetBytesSent()
                    UInt_t GetSocketBytesRecv()
                    UInt_t GetSocketBytesSent()
                    Long_t GetTTL() const
           virtual TClass* IsA() const
                    Bool_t IsAddress(TString& addr)
               ELoginState IsLogged() const
                    Bool_t IsPort(Int_t port) const
                    Bool_t IsValid() const
                      void LockChannel()
          TXPhyConnection& operator=(const TXPhyConnection&)
                      void ReaderStarted()
                    Bool_t ReaderThreadKilled() const
                     Int_t ReadRaw(void* buffer, Int_t BufferLength, ESendRecvOptions opt = kDefault)
                TXMessage* ReadXMessage(Int_t streamid)
                    Bool_t ReConnect(TString TcpAddress, Int_t TcpPort, Int_t TcpWindowSize)
                  TSocket* SaveSocket()
                      void SetLogged(ELoginState status)
                      void SetTTL(Long_t ttl)
              virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      void StartReader()
              virtual void Streamer(TBuffer& b)
                      void StreamerNVirtual(TBuffer& b)
                      void Touch()
                      void UnlockChannel()
                     Int_t WriteRaw(const void* buffer, Int_t BufferLength, ESendRecvOptions opt = kDefault)

### Data Members

        private:

                 time_t fLastUseTimestamp
            ELoginState fLogged               only 1 login/auth is needed for physical
          TXInputBuffer fMsgQ                 The queue used to hold incoming messages
                  Int_t fRequestTimeout
                TMutex* fRwMutex              Lock before using the physical channel
                TMutex* fMutex
               TThread* fReaderthreadhandler  The thread which is going to pump
                 Bool_t fReaderthreadrunning
                 Bool_t fReaderthreadkilled
                TString fRemoteAddress
                  Int_t fRemotePort
              TXSocket* fSocket
            TCondition* fReaderCV

        public:

          ERemoteServer fServer
                 Long_t fTTLsec

## Class Description

     TXPhyConnection

     Class handling physical connections to xrootd servers.

TXPhyConnection(TXAbsUnsolicitedMsgHandler *h)

     Constructor

~TXPhyConnection()

     Destructor

Bool_t Connect(TString TcpAddress, Int_t TcpPort, Int_t TcpWindowSize)

     Connect to remote server

void StartReader()

     Start reader thread

void ReaderStarted()

     Called inside SocketReaderThread to flag the running status
     of the thread

Bool_t ReConnect(TString TcpAddress, Int_t TcpPort, Int_t TcpWindowSize)

     Re-connection attempt

TSocket* SaveSocket()

     Return copy of the TSocket part of the existing socket
     Used to save an open connection to rootd daemons

void Disconnect()

     Terminate connection

void Touch()

     Set last-use-time to present time

Int_t ReadRaw(void *buf, Int_t len, ESendRecvOptions opt)

     Receive 'len' bytes from the connected server and store them in 'buf'.
     Return number of bytes received.

TXMessage* ReadXMessage(Int_t streamid)

     Gets a full loaded TXMessage from this phyconn.
     May be a pure msg pick from a queue

TXMessage* BuildXMessage(ESendRecvOptions opt, Bool_t IgnoreTimeouts, Bool_t Enqueue)

     Builds an TXMessage, and makes it read its header/data from the socket
     Also put automatically the msg into the queue

void CheckAutoTerm()

     Check if auto-termination is needed

void HandleUnsolicited(TXMessage *m)

     Local processing of unsolicited responses is done here

Int_t WriteRaw(const void *buf, Int_t len, ESendRecvOptions opt)

     Send 'len' bytes located at 'buf' to the connected server.
     Return number of bytes sent.

UInt_t GetBytesSent()

     Return number of bytes sent

UInt_t GetBytesRecv()

     Return number of bytes received

UInt_t GetSocketBytesSent()

     Return number of bytes sent

UInt_t GetSocketBytesRecv()

     Return number of bytes received

Bool_t ExpiredTTL()

     Check expiration time

void LockChannel()

     Lock

void UnlockChannel()

     Unlock

### Inline Functions

                      Long_t GetTTL() const
                      Bool_t IsAddress(TString& addr)
                      Bool_t ReaderThreadKilled() const
                 ELoginState IsLogged() const
                      Bool_t IsPort(Int_t port) const
                      Bool_t IsValid() const
                        void SetLogged(ELoginState status)
                        void SetTTL(Long_t ttl)
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
             TXPhyConnection TXPhyConnection(const TXPhyConnection&)
            TXPhyConnection& operator=(const TXPhyConnection&)

Author: Alvise Dorigo, Fabrizio Furano
Last update: root/netx:$Name: $:$Id: TXPhyConnection.cxx,v 1.6 2005/01/05 01:55:13 rdm Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *