ROOT
6.07/01
Reference Guide
|
Definition at line 58 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... | |
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 () |
const char * | GetLastErr () |
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 int | ReadRaw (void *buf, int len, XrdClientPhyConnection *p=0) |
Low level receive call. More... | |
virtual XrdClientMessage * | ReadMsg () |
Pickup message from the queue. More... | |
XrdClientMessage * | 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. 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... | |
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... | |
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... | |
void | ReConnect () |
Perform a reconnection attempt when a connection is not valid any more. More... | |
virtual int | TryConnect (int=-1) |
Connect to remote server. 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... | |
XrdClientMessage * | SendRecv (XPClientRequest *req, const void *reqData, char **answData) |
SendRecv sends a command to the server and to get a response. More... | |
void | SetInterrupt () |
Interrupt the underlying socket. More... | |
void | SetConnectInterrupt () |
Interrupt connection attempts. More... | |
bool | ConnectInterrupt () |
Check if interrupted during connect. More... | |
Private Attributes | |
char | fMode |
bool | fConnected |
int | fLogConnID |
kXR_unt16 | fStreamid |
int | fRemoteProtocol |
int | fServerProto |
ESrvType | fServerType |
short | fSessionID |
XrdOucString | fUser |
XrdOucString | fHost |
int | fPort |
XrdOucString | fLastErrMsg |
XErrorCode | fLastErr |
char | fCapVer |
XrdOucString | fLoginBuffer |
XrdSysRecMutex * | fMutex |
XrdSysRecMutex * | fConnectInterruptMtx |
bool | fConnectInterrupt |
XrdClientPhyConnection * | fPhyConn |
int | fOpenSockFD |
XrdClientAbsUnsolMsgHandler * | fUnsolMsgHandler |
XrdProofConnSender_t | fSender |
void * | fSenderArg |
XrdClientUrlInfo | fUrl |
Static Private Attributes | |
static XrdClientConnectionMgr * | fgConnMgr = 0 |
static int | fgMaxTry = 5 |
static int | fgTimeWait = 2 |
static XrdSysPlugin * | fgSecPlugin = 0 |
static void * | fgSecGetProtocol = 0 |
Friends | |
class | TXSocket |
class | TXUnixSocket |
class | XrdProofPhyConn |
#include <XrdProofConn.h>
Enumerator | |
---|---|
kSTError | |
kSTNone | |
kSTXProofd | |
kSTProofd |
Definition at line 66 of file XrdProofConn.h.
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.
|
virtual |
Destructor.
Definition at line 292 of file XrdProofConn.cxx.
|
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.
Referenced by Login().
|
private |
|
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.
Referenced by SendReq().
|
virtual |
Close connection.
Reimplemented in XrdProofPhyConn.
Definition at line 422 of file XrdProofConn.cxx.
Referenced by TXSocket::Close(), Connect(), GetAccessToSrv(), TXUnixSocket::Reconnect(), ReConnect(), and ~XrdProofConn().
|
privatevirtual |
Run the connection attempts: the result is stored in fConnected.
Reimplemented in XrdProofPhyConn.
Definition at line 201 of file XrdProofConn.cxx.
Referenced by Init(), TXUnixSocket::Reconnect(), and ReConnect().
|
private |
Check if interrupted during connect.
Definition at line 1462 of file XrdProofConn.cxx.
Referenced by Connect().
|
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.
Referenced by XrdProofPhyConn::GetAccessToSrv(), and GetAccessToSrv().
|
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.
Referenced by Connect().
|
inline |
Definition at line 146 of file XrdProofConn.h.
Referenced by Authenticate(), TXSocket::Create(), TXSocket::DisconnectSession(), Login(), TXSocket::Ping(), XrdProofdNetMgr::Send(), TXSocket::SendCoordinator(), TXSocket::SendInterrupt(), TXSocket::SendRaw(), TXSocket::SendUrgent(), and TXSocket::TXSocket().
|
inline |
Definition at line 140 of file XrdProofConn.h.
Referenced by Close(), TXSocket::GetLogConnID(), and TXSocket::Reconnect().
int XrdProofConn::GetLowSocket | ( | ) |
Return the socket descriptor of the underlying connection.
Definition at line 1067 of file XrdProofConn.cxx.
Referenced by TXSocket::GetLowSocket().
|
inline |
Definition at line 142 of file XrdProofConn.h.
Referenced by TXSocket::Create(), and TXSocket::GetOpenError().
|
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.
Referenced by XrdProofPhyConn::Connect(), TXUnixSocket::Reconnect(), and ReConnect().
|
inline |
Definition at line 143 of file XrdProofConn.h.
Referenced by Connect(), TXSocket::GetServType(), TXSocket::IsServProofd(), TXSocket::TXSocket(), and XrdProofConn().
|
inline |
Definition at line 144 of file XrdProofConn.h.
Referenced by TXSocket::GetSessionID().
|
inline |
Definition at line 145 of file XrdProofConn.h.
|
privatevirtual |
Initialization.
Reimplemented in XrdProofPhyConn.
Definition at line 159 of file XrdProofConn.cxx.
Referenced by XrdProofConn().
bool XrdProofConn::IsValid | ( | ) | const |
Test validity of this connection.
Definition at line 1477 of file XrdProofConn.cxx.
Referenced by XrdProofdNetMgr::BroadcastCtrlC(), XrdProofdNetMgr::GetProofConn(), TXSocket::IsValid(), XrdProofdNetMgr::ReadBufferRemote(), XrdProofdNetMgr::ReadLogPaths(), TXUnixSocket::Reconnect(), ReConnect(), TXSocket::Reconnect(), XrdProofdNetMgr::Send(), SendReq(), and TXSocket::TXSocket().
|
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.
Referenced by XrdProofPhyConn::GetAccessToSrv(), and GetAccessToSrv().
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.
Referenced by XrdProofdNetMgr::BroadcastCtrlC(), TXSocket::CtrlC(), TXSocket::Ping(), TXSocket::RemoteTouch(), and SendRecv().
|
private |
Check stream ID matching.
Definition at line 756 of file XrdProofConn.cxx.
Referenced by CheckResp().
|
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.
Definition at line 452 of file XrdProofConn.cxx.
|
virtual |
Pickup message from the queue.
Reimplemented in XrdProofPhyConn.
Definition at line 515 of file XrdProofConn.cxx.
Referenced by SendRecv().
|
virtual |
Low level receive call.
Reimplemented in XrdProofPhyConn.
Definition at line 949 of file XrdProofConn.cxx.
Referenced by DoHandShake().
|
private |
Perform a reconnection attempt when a connection is not valid any more.
Definition at line 316 of file XrdProofConn.cxx.
Referenced by TXSocket::Reconnect(), and SendReq().
|
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.
Referenced by 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.
Referenced by Authenticate(), TXSocket::Create(), TXSocket::DisconnectSession(), Login(), TXSocket::Ping(), XrdProofdNetMgr::ReadBufferRemote(), XrdProofdNetMgr::ReadLogPaths(), XrdProofdNetMgr::Send(), TXSocket::SendCoordinator(), TXSocket::SendInterrupt(), TXSocket::SendRaw(), and TXSocket::SendUrgent().
|
virtual |
Set handler of unsolicited responses.
Reimplemented in XrdProofPhyConn.
Definition at line 501 of file XrdProofConn.cxx.
Referenced by TXSocket::Close(), XrdProofdNetMgr::Send(), TXSocket::SetSessionID(), and TryConnect().
|
private |
Interrupt connection attempts.
Definition at line 1453 of file XrdProofConn.cxx.
Referenced by ~XrdProofConn().
|
private |
Interrupt the underlying socket.
Definition at line 1444 of file XrdProofConn.cxx.
Referenced by TXSocket::SetInterrupt().
|
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.
Referenced by XrdProofdNetMgr::Config(), TXSocket::InitEnvs(), TXUnixSocket::Reconnect(), and ReConnect().
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.
Referenced by Authenticate(), XrdProofdNetMgr::BroadcastCtrlC(), TXSocket::Create(), TXSocket::CtrlC(), TXSocket::DisconnectSession(), Login(), TXSocket::Ping(), XrdProofdNetMgr::ReadBufferRemote(), XrdProofdNetMgr::ReadLogPaths(), TXSocket::RemoteTouch(), XrdProofdNetMgr::Send(), TXSocket::SendCoordinator(), TXSocket::SendInterrupt(), TXSocket::SendRaw(), SendRecv(), and TXSocket::SendUrgent().
|
privatevirtual |
Connect to remote server.
Reimplemented in XrdProofPhyConn.
Definition at line 343 of file XrdProofConn.cxx.
Referenced by Connect().
|
virtual |
Low level write call.
Reimplemented in XrdProofPhyConn.
Definition at line 934 of file XrdProofConn.cxx.
Referenced by DoHandShake(), GetAccessToSrv(), LowWrite(), and TXProofMgr::PutFile().
|
friend |
Definition at line 60 of file XrdProofConn.h.
|
friend |
Definition at line 61 of file XrdProofConn.h.
|
friend |
Definition at line 62 of file XrdProofConn.h.
|
private |
Definition at line 84 of file XrdProofConn.h.
Referenced by Login().
|
private |
Definition at line 71 of file XrdProofConn.h.
Referenced by XrdProofPhyConn::Close(), Close(), XrdProofPhyConn::Connect(), Connect(), XrdProofPhyConn::Init(), Init(), IsValid(), XrdProofPhyConn::TryConnect(), and TryConnect().
|
private |
Definition at line 91 of file XrdProofConn.h.
Referenced by ConnectInterrupt(), and SetConnectInterrupt().
|
private |
Definition at line 90 of file XrdProofConn.h.
Referenced by ConnectInterrupt(), SetConnectInterrupt(), XrdProofConn(), and ~XrdProofConn().
|
staticprivate |
Definition at line 104 of file XrdProofConn.h.
Referenced by Close(), Init(), ReadMsg(), ReadRaw(), SetAsync(), TryConnect(), and WriteRaw().
|
staticprivate |
Definition at line 106 of file XrdProofConn.h.
Referenced by Connect(), GetRetryParam(), SendReq(), and SetRetryParam().
|
staticprivate |
Definition at line 110 of file XrdProofConn.h.
Referenced by Authenticate().
|
staticprivate |
Definition at line 109 of file XrdProofConn.h.
Referenced by Authenticate().
|
staticprivate |
Definition at line 107 of file XrdProofConn.h.
Referenced by Connect(), GetRetryParam(), and SetRetryParam().
|
private |
Definition at line 80 of file XrdProofConn.h.
Referenced by Authenticate(), XrdProofPhyConn::Init(), Init(), Login(), and TXSocket::TXSocket().
|
private |
Definition at line 83 of file XrdProofConn.h.
Referenced by Authenticate(), CheckErrorStatus(), XrdProofPhyConn::Connect(), Connect(), GetOpenError(), and XrdProofConn().
|
private |
Definition at line 82 of file XrdProofConn.h.
Referenced by Authenticate(), CheckErrorStatus(), XrdProofPhyConn::Connect(), Connect(), TXSocket::Create(), GetLastErr(), TXSocket::Reconnect(), and TXSocket::TXSocket().
|
private |
Definition at line 72 of file XrdProofConn.h.
Referenced by GetLogConnID(), ReadMsg(), ReadRaw(), SetAsync(), XrdProofPhyConn::TryConnect(), TryConnect(), and WriteRaw().
|
private |
Definition at line 86 of file XrdProofConn.h.
Referenced by Login().
|
private |
Definition at line 70 of file XrdProofConn.h.
Referenced by Login().
|
private |
Definition at line 88 of file XrdProofConn.h.
Referenced by TXUnixSocket::Reconnect(), XrdProofConn(), XrdProofPhyConn::XrdProofPhyConn(), and ~XrdProofConn().
|
private |
Definition at line 95 of file XrdProofConn.h.
|
private |
Definition at line 93 of file XrdProofConn.h.
Referenced by XrdProofPhyConn::Close(), Connect(), DoHandShake(), XrdProofPhyConn::GetAccessToSrv(), GetAccessToSrv(), GetLowSocket(), IsValid(), Login(), LowWrite(), XrdProofPhyConn::ReadMsg(), XrdProofPhyConn::ReadRaw(), ReConnect(), TXSocket::Reconnect(), SendReq(), XrdProofPhyConn::SetAsync(), SetInterrupt(), XrdProofPhyConn::TryConnect(), TryConnect(), XrdProofPhyConn::WriteRaw(), and ~XrdProofConn().
|
private |
Definition at line 81 of file XrdProofConn.h.
Referenced by Connect(), XrdProofPhyConn::Init(), Init(), and TXSocket::TXSocket().
|
private |
Definition at line 74 of file XrdProofConn.h.
Referenced by DoHandShake(), Login(), ReConnect(), TryConnect(), TXSocket::TXSocket(), and ~XrdProofConn().
|
private |
Definition at line 99 of file XrdProofConn.h.
Referenced by ProcessUnsolicitedMsg(), and SetAsync().
|
private |
Definition at line 100 of file XrdProofConn.h.
Referenced by ProcessUnsolicitedMsg(), and SetAsync().
|
private |
Definition at line 75 of file XrdProofConn.h.
|
private |
Definition at line 76 of file XrdProofConn.h.
Referenced by XrdProofPhyConn::GetAccessToSrv(), GetAccessToSrv(), and GetServType().
|
private |
Definition at line 78 of file XrdProofConn.h.
Referenced by GetSessionID(), and Login().
|
private |
Definition at line 73 of file XrdProofConn.h.
Referenced by MatchStreamID(), TXSocket::ProcessUnsolicitedMsg(), XrdProofPhyConn::ReadMsg(), SetSID(), XrdProofPhyConn::TryConnect(), and TryConnect().
|
private |
Definition at line 97 of file XrdProofConn.h.
Referenced by XrdProofPhyConn::TryConnect(), and TryConnect().
|
private |
Definition at line 102 of file XrdProofConn.h.
Referenced by Authenticate(), Connect(), GetUrl(), XrdProofPhyConn::Init(), Init(), Login(), XrdProofPhyConn::TryConnect(), TryConnect(), and TXSocket::TXSocket().
|
private |
Definition at line 79 of file XrdProofConn.h.
Referenced by XrdProofPhyConn::Init(), Init(), Login(), and TXSocket::TXSocket().