Logo ROOT   6.14/05
Reference Guide
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
XrdProofConn Class Reference

Definition at line 48 of file XrdProofConn.h.

Public Types

enum  ESrvType { kSTError = -1, kSTNone, kSTXProofd, kSTProofd }
 

Public Member Functions

 XrdProofConn (const char *url, char mode='M', int psid=-1, char ver=-1, XrdClientAbsUnsolMsgHandler *uh=0, const char *logbuf=0)
 Constructor. More...
 
virtual ~XrdProofConn ()
 Destructor. More...
 
virtual void Close (const char *opt="")
 Close connection. More...
 
const char * GetLastErr ()
 
int GetLogConnID () const
 
int GetLowSocket ()
 Return the socket descriptor of the underlying connection. More...
 
int GetOpenError () const
 
int GetServType () const
 
short GetSessionID () const
 
const char * GetUrl ()
 
bool IsValid () const
 Test validity of this connection. More...
 
XReqErrorType LowWrite (XPClientRequest *, const void *, int)
 Send request to server (NB: req is marshalled at this point, so we need also the plain reqDataLen) More...
 
virtual UnsolRespProcResult ProcessUnsolicitedMsg (XrdClientUnsolMsgSender *s, XrdClientMessage *m)
 We are here if an unsolicited response comes from a logical conn The response comes in the form of an XrdClientMessage *, that must NOT be destroyed after processing. More...
 
virtual XrdClientMessageReadMsg ()
 Pickup message from the queue. More...
 
virtual int ReadRaw (void *buf, int len, XrdClientPhyConnection *p=0)
 Low level receive call. More...
 
XrdClientMessageSendReq (XPClientRequest *req, const void *reqData, char **answData, const char *CmdName, bool notifyerr=1)
 SendReq tries to send a single command for a number of times. More...
 
virtual void SetAsync (XrdClientAbsUnsolMsgHandler *uh, XrdProofConnSender_t=0, void *=0)
 Set handler of unsolicited responses. More...
 
void SetSID (kXR_char *sid)
 Set our stream id, to match against that one in the server's response. More...
 
virtual int WriteRaw (const void *buf, int len, XrdClientPhyConnection *p=0)
 Low level write call. More...
 
- Public Member Functions inherited from XrdClientAbsUnsolMsgHandler
virtual ~XrdClientAbsUnsolMsgHandler ()
 

Static Public Member Functions

static void GetRetryParam (int &maxtry, int &timewait)
 Retrieve current values of the retry control parameters, numer of retries and wait time between attempts (in seconds). More...
 
static void SetRetryParam (int maxtry=5, int timewait=2)
 Change values of the retry control parameters, numer of retries and wait time between attempts (in seconds). More...
 

Private Member Functions

XrdSecProtocol * Authenticate (char *plist, int lsiz)
 Negotiate authentication with the remote server. More...
 
bool CheckErrorStatus (XrdClientMessage *, int &, const char *, bool)
 Check error status. More...
 
bool CheckResp (struct ServerResponseHeader *resp, const char *met, bool)
 Checks if the server's response is ours. More...
 
virtual void Connect (int=-1)
 Run the connection attempts: the result is stored in fConnected. More...
 
bool ConnectInterrupt ()
 Check if interrupted during connect. More...
 
ESrvType DoHandShake (XrdClientPhyConnection *p=0)
 Performs initial hand-shake with the server in order to understand which kind of server is there at the other side. More...
 
virtual bool GetAccessToSrv (XrdClientPhyConnection *p=0)
 Gets access to the connected server. More...
 
virtual bool Init (const char *url=0, int=-1)
 Initialization. More...
 
bool Login ()
 This method perform the loggin-in into the server just after the hand-shake. More...
 
bool MatchStreamID (struct ServerResponseHeader *resp)
 Check stream ID matching. More...
 
void ReConnect ()
 Perform a reconnection attempt when a connection is not valid any more. More...
 
XrdClientMessageSendRecv (XPClientRequest *req, const void *reqData, char **answData)
 SendRecv sends a command to the server and to get a response. More...
 
void SetConnectInterrupt ()
 Interrupt connection attempts. More...
 
void SetInterrupt ()
 Interrupt the underlying socket. More...
 
virtual int TryConnect (int=-1)
 Connect to remote server. More...
 

Private Attributes

char fCapVer
 
bool fConnected
 
bool fConnectInterrupt
 
XrdSysRecMutexfConnectInterruptMtx
 
XrdOucString fHost
 
XErrorCode fLastErr
 
XrdOucString fLastErrMsg
 
int fLogConnID
 
XrdOucString fLoginBuffer
 
char fMode
 
XrdSysRecMutexfMutex
 
int fOpenSockFD
 
XrdClientPhyConnectionfPhyConn
 
int fPort
 
int fRemoteProtocol
 
XrdProofConnSender_t fSender
 
voidfSenderArg
 
int fServerProto
 
ESrvType fServerType
 
short fSessionID
 
kXR_unt16 fStreamid
 
XrdClientAbsUnsolMsgHandlerfUnsolMsgHandler
 
XrdClientUrlInfo fUrl
 
XrdOucString fUser
 

Static Private Attributes

static XrdClientConnectionMgrfgConnMgr = 0
 
static int fgMaxTry = 5
 
static voidfgSecGetProtocol = 0
 
static XrdSysPluginfgSecPlugin = 0
 
static int fgTimeWait = 2
 

Friends

class TXSocket
 
class TXUnixSocket
 
class XrdProofPhyConn
 

#include <XrdProofConn.h>

Inheritance diagram for XrdProofConn:
[legend]

Member Enumeration Documentation

◆ ESrvType

Enumerator
kSTError 
kSTNone 
kSTXProofd 
kSTProofd 

Definition at line 56 of file XrdProofConn.h.

Constructor & Destructor Documentation

◆ XrdProofConn()

XrdProofConn::XrdProofConn ( const char *  url,
char  m = 'M',
int  psid = -1,
char  capver = -1,
XrdClientAbsUnsolMsgHandler uh = 0,
const char *  logbuf = 0 
)

Constructor.

Open the connection to a remote XrdProofd instance. The mode 'm' indicates the role of this connection: 'a' Administrator; used by an XPD to contact the head XPD 'i' Internal; used by a TXProofServ to call back its creator (see XrdProofUnixConn) 'M' Client contacting a top master 'm' Top master contacting a submaster 's' Master contacting a slave The buffer 'logbuf' is a null terminated string to be sent over at login. In case of need, internally it is overwritten with a token needed during redirection.

Definition at line 112 of file XrdProofConn.cxx.

◆ ~XrdProofConn()

XrdProofConn::~XrdProofConn ( )
virtual

Destructor.

Definition at line 292 of file XrdProofConn.cxx.

Member Function Documentation

◆ Authenticate()

XrdSecProtocol * XrdProofConn::Authenticate ( char *  plist,
int  plsiz 
)
private

Negotiate authentication with the remote server.

Tries in turn all available protocols proposed by the server (in plist), starting from the first.

Definition at line 1264 of file XrdProofConn.cxx.

◆ CheckErrorStatus()

bool XrdProofConn::CheckErrorStatus ( XrdClientMessage mex,
int &  Retry,
const char *  CmdName,
bool  notifyerr 
)
private

Check error status.

Definition at line 811 of file XrdProofConn.cxx.

◆ CheckResp()

bool XrdProofConn::CheckResp ( struct ServerResponseHeader *  resp,
const char *  method,
bool  notifyerr 
)
private

Checks if the server's response is ours.

If the response's status is "OK" returns 1; if the status is "redirect", it means that the max number of redirections has been achieved, so returns 0.

Definition at line 727 of file XrdProofConn.cxx.

◆ Close()

void XrdProofConn::Close ( const char *  opt = "")
virtual

Close connection.

Reimplemented in XrdProofPhyConn.

Definition at line 422 of file XrdProofConn.cxx.

◆ Connect()

void XrdProofConn::Connect ( int  = -1)
privatevirtual

Run the connection attempts: the result is stored in fConnected.

Reimplemented in XrdProofPhyConn.

Definition at line 201 of file XrdProofConn.cxx.

◆ ConnectInterrupt()

bool XrdProofConn::ConnectInterrupt ( )
private

Check if interrupted during connect.

Definition at line 1466 of file XrdProofConn.cxx.

◆ DoHandShake()

XrdProofConn::ESrvType XrdProofConn::DoHandShake ( XrdClientPhyConnection p = 0)
private

Performs initial hand-shake with the server in order to understand which kind of server is there at the other side.

Definition at line 965 of file XrdProofConn.cxx.

◆ GetAccessToSrv()

bool XrdProofConn::GetAccessToSrv ( XrdClientPhyConnection p = 0)
privatevirtual

Gets access to the connected server.

The login and authorization steps are performed here.

Reimplemented in XrdProofPhyConn.

Definition at line 879 of file XrdProofConn.cxx.

◆ GetLastErr()

const char* XrdProofConn::GetLastErr ( )
inline

Definition at line 136 of file XrdProofConn.h.

◆ GetLogConnID()

int XrdProofConn::GetLogConnID ( ) const
inline

Definition at line 130 of file XrdProofConn.h.

◆ GetLowSocket()

int XrdProofConn::GetLowSocket ( )

Return the socket descriptor of the underlying connection.

Definition at line 1067 of file XrdProofConn.cxx.

◆ GetOpenError()

int XrdProofConn::GetOpenError ( ) const
inline

Definition at line 132 of file XrdProofConn.h.

◆ GetRetryParam()

void XrdProofConn::GetRetryParam ( int &  maxtry,
int &  timewait 
)
static

Retrieve current values of the retry control parameters, numer of retries and wait time between attempts (in seconds).

Definition at line 140 of file XrdProofConn.cxx.

◆ GetServType()

int XrdProofConn::GetServType ( ) const
inline

Definition at line 133 of file XrdProofConn.h.

◆ GetSessionID()

short XrdProofConn::GetSessionID ( ) const
inline

Definition at line 134 of file XrdProofConn.h.

◆ GetUrl()

const char* XrdProofConn::GetUrl ( )
inline

Definition at line 135 of file XrdProofConn.h.

◆ Init()

bool XrdProofConn::Init ( const char *  url = 0,
int  = -1 
)
privatevirtual

Initialization.

Reimplemented in XrdProofPhyConn.

Definition at line 159 of file XrdProofConn.cxx.

◆ IsValid()

bool XrdProofConn::IsValid ( ) const

Test validity of this connection.

Definition at line 1481 of file XrdProofConn.cxx.

◆ Login()

bool XrdProofConn::Login ( )
private

This method perform the loggin-in into the server just after the hand-shake.

It also calls the Authenticate() method

Definition at line 1076 of file XrdProofConn.cxx.

◆ LowWrite()

XReqErrorType XrdProofConn::LowWrite ( XPClientRequest req,
const void reqData,
int  reqDataLen 
)

Send request to server (NB: req is marshalled at this point, so we need also the plain reqDataLen)

Definition at line 777 of file XrdProofConn.cxx.

◆ MatchStreamID()

bool XrdProofConn::MatchStreamID ( struct ServerResponseHeader *  resp)
private

Check stream ID matching.

Definition at line 756 of file XrdProofConn.cxx.

◆ ProcessUnsolicitedMsg()

UnsolRespProcResult XrdProofConn::ProcessUnsolicitedMsg ( XrdClientUnsolMsgSender s,
XrdClientMessage m 
)
virtual

We are here if an unsolicited response comes from a logical conn The response comes in the form of an XrdClientMessage *, that must NOT be destroyed after processing.

It is destroyed by the first sender. Remember that we are in a separate thread, since unsolicited responses are asynchronous by nature.

Implements XrdClientAbsUnsolMsgHandler.

Definition at line 452 of file XrdProofConn.cxx.

◆ ReadMsg()

XrdClientMessage * XrdProofConn::ReadMsg ( )
virtual

Pickup message from the queue.

Reimplemented in XrdProofPhyConn.

Definition at line 515 of file XrdProofConn.cxx.

◆ ReadRaw()

int XrdProofConn::ReadRaw ( void buf,
int  len,
XrdClientPhyConnection p = 0 
)
virtual

Low level receive call.

Reimplemented in XrdProofPhyConn.

Definition at line 949 of file XrdProofConn.cxx.

◆ ReConnect()

void XrdProofConn::ReConnect ( )
private

Perform a reconnection attempt when a connection is not valid any more.

Definition at line 316 of file XrdProofConn.cxx.

◆ SendRecv()

XrdClientMessage * XrdProofConn::SendRecv ( XPClientRequest req,
const void reqData,
char **  answData 
)
private

SendRecv sends a command to the server and to get a response.

The header of the last response is returned as pointer to a XrdClientMessage. The data, if any, are returned in *answData; if *answData == 0 in input, the buffer is internally allocated and must be freed by the caller. If (*answData != 0) the program assumes that the caller has allocated enough bytes to contain the reply.

Definition at line 528 of file XrdProofConn.cxx.

◆ SendReq()

XrdClientMessage * XrdProofConn::SendReq ( XPClientRequest req,
const void reqData,
char **  answData,
const char *  CmdName,
bool  notifyerr = 1 
)

SendReq tries to send a single command for a number of times.

Definition at line 636 of file XrdProofConn.cxx.

◆ SetAsync()

void XrdProofConn::SetAsync ( XrdClientAbsUnsolMsgHandler uh,
XrdProofConnSender_t  sender = 0,
void arg = 0 
)
virtual

Set handler of unsolicited responses.

Reimplemented in XrdProofPhyConn.

Definition at line 501 of file XrdProofConn.cxx.

◆ SetConnectInterrupt()

void XrdProofConn::SetConnectInterrupt ( )
private

Interrupt connection attempts.

Definition at line 1457 of file XrdProofConn.cxx.

◆ SetInterrupt()

void XrdProofConn::SetInterrupt ( )
private

Interrupt the underlying socket.

Definition at line 1448 of file XrdProofConn.cxx.

◆ SetRetryParam()

void XrdProofConn::SetRetryParam ( int  maxtry = 5,
int  timewait = 2 
)
static

Change values of the retry control parameters, numer of retries and wait time between attempts (in seconds).

Definition at line 150 of file XrdProofConn.cxx.

◆ SetSID()

void XrdProofConn::SetSID ( kXR_char *  sid)

Set our stream id, to match against that one in the server's response.

Definition at line 769 of file XrdProofConn.cxx.

◆ TryConnect()

int XrdProofConn::TryConnect ( int  = -1)
privatevirtual

Connect to remote server.

Reimplemented in XrdProofPhyConn.

Definition at line 343 of file XrdProofConn.cxx.

◆ WriteRaw()

int XrdProofConn::WriteRaw ( const void buf,
int  len,
XrdClientPhyConnection p = 0 
)
virtual

Low level write call.

Reimplemented in XrdProofPhyConn.

Definition at line 934 of file XrdProofConn.cxx.

Friends And Related Function Documentation

◆ TXSocket

friend class TXSocket
friend

Definition at line 50 of file XrdProofConn.h.

◆ TXUnixSocket

friend class TXUnixSocket
friend

Definition at line 51 of file XrdProofConn.h.

◆ XrdProofPhyConn

friend class XrdProofPhyConn
friend

Definition at line 52 of file XrdProofConn.h.

Member Data Documentation

◆ fCapVer

char XrdProofConn::fCapVer
private

Definition at line 74 of file XrdProofConn.h.

◆ fConnected

bool XrdProofConn::fConnected
private

Definition at line 61 of file XrdProofConn.h.

◆ fConnectInterrupt

bool XrdProofConn::fConnectInterrupt
private

Definition at line 81 of file XrdProofConn.h.

◆ fConnectInterruptMtx

XrdSysRecMutex* XrdProofConn::fConnectInterruptMtx
private

Definition at line 80 of file XrdProofConn.h.

◆ fgConnMgr

XrdClientConnectionMgr * XrdProofConn::fgConnMgr = 0
staticprivate

Definition at line 94 of file XrdProofConn.h.

◆ fgMaxTry

int XrdProofConn::fgMaxTry = 5
staticprivate

Definition at line 96 of file XrdProofConn.h.

◆ fgSecGetProtocol

void * XrdProofConn::fgSecGetProtocol = 0
staticprivate

Definition at line 100 of file XrdProofConn.h.

◆ fgSecPlugin

XrdSysPlugin * XrdProofConn::fgSecPlugin = 0
staticprivate

Definition at line 99 of file XrdProofConn.h.

◆ fgTimeWait

int XrdProofConn::fgTimeWait = 2
staticprivate

Definition at line 97 of file XrdProofConn.h.

◆ fHost

XrdOucString XrdProofConn::fHost
private

Definition at line 70 of file XrdProofConn.h.

◆ fLastErr

XErrorCode XrdProofConn::fLastErr
private

Definition at line 73 of file XrdProofConn.h.

◆ fLastErrMsg

XrdOucString XrdProofConn::fLastErrMsg
private

Definition at line 72 of file XrdProofConn.h.

◆ fLogConnID

int XrdProofConn::fLogConnID
private

Definition at line 62 of file XrdProofConn.h.

◆ fLoginBuffer

XrdOucString XrdProofConn::fLoginBuffer
private

Definition at line 76 of file XrdProofConn.h.

◆ fMode

char XrdProofConn::fMode
private

Definition at line 60 of file XrdProofConn.h.

◆ fMutex

XrdSysRecMutex* XrdProofConn::fMutex
private

Definition at line 78 of file XrdProofConn.h.

◆ fOpenSockFD

int XrdProofConn::fOpenSockFD
private

Definition at line 85 of file XrdProofConn.h.

◆ fPhyConn

XrdClientPhyConnection* XrdProofConn::fPhyConn
private

Definition at line 83 of file XrdProofConn.h.

◆ fPort

int XrdProofConn::fPort
private

Definition at line 71 of file XrdProofConn.h.

◆ fRemoteProtocol

int XrdProofConn::fRemoteProtocol
private

Definition at line 64 of file XrdProofConn.h.

◆ fSender

XrdProofConnSender_t XrdProofConn::fSender
private

Definition at line 89 of file XrdProofConn.h.

◆ fSenderArg

void* XrdProofConn::fSenderArg
private

Definition at line 90 of file XrdProofConn.h.

◆ fServerProto

int XrdProofConn::fServerProto
private

Definition at line 65 of file XrdProofConn.h.

◆ fServerType

ESrvType XrdProofConn::fServerType
private

Definition at line 66 of file XrdProofConn.h.

◆ fSessionID

short XrdProofConn::fSessionID
private

Definition at line 68 of file XrdProofConn.h.

◆ fStreamid

kXR_unt16 XrdProofConn::fStreamid
private

Definition at line 63 of file XrdProofConn.h.

◆ fUnsolMsgHandler

XrdClientAbsUnsolMsgHandler* XrdProofConn::fUnsolMsgHandler
private

Definition at line 87 of file XrdProofConn.h.

◆ fUrl

XrdClientUrlInfo XrdProofConn::fUrl
private

Definition at line 92 of file XrdProofConn.h.

◆ fUser

XrdOucString XrdProofConn::fUser
private

Definition at line 69 of file XrdProofConn.h.

Libraries for XrdProofConn:
[legend]

The documentation for this class was generated from the following files: