Go to the documentation of this file.
25 #ifndef __XRD_CL_XROOTD_MSG_HANDLER_HH__
26 #define __XRD_CL_XROOTD_MSG_HANDLER_HH__
41 #include <arpa/inet.h>
47 #if __cplusplus >= 201103L
56 class LocalFileHandler;
92 case EntryRedirect:
return "Redirected from: " + fromstr +
" to: "
96 "Falling back to virtual redirector: " + tostr;
100 case EntryWait:
return "Waited at server request. Resending: "
104 return "Failed at: " + fromstr +
", retrying at: " + tostr;
130 std::shared_ptr<SIDManager> sidMgr,
189 log->
Debug(
ExDbgMsg,
"[%s] MsgHandler created: 0x%x (message: %s ).",
211 std::vector<Message *>::iterator it;
279 uint32_t &bytesRead );
313 uint32_t &bytesWritten );
426 uint32_t &bytesRead );
433 uint32_t &bytesRead );
440 uint32_t &bytesRead );
447 uint32_t &bytesRead );
456 uint32_t btsRead = 0;
459 bytesRead += btsRead;
470 while( toBeRead > 0 )
472 uint32_t btsRead = 0;
475 bytesRead += btsRead;
492 uint32_t toBeRead, uint32_t &bytesRead );
630 std::string &result );
717 #if __cplusplus >= 201103L
739 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:708
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:138
void DumpRedirectTraceBack()
Dump the redirect-trace-back into the log file.
URL to
Definition: XrdClXRootDMsgHandler.hh:79
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:667
std::array< char, 4 > pPgReadCksumBuff
Definition: XrdClXRootDMsgHandler.hh:689
bool RetriableErrorResponse(const Status &status)
Definition: XProtocol.hh:148
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:658
A network socket.
Definition: XrdClSocket.hh:42
Handle an async response.
Definition: XrdClXRootDResponses.hh:1037
std::vector< uint32_t > pPgReadCksums
Definition: XrdClXRootDMsgHandler.hh:690
Status ReadRawRead(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_read in raw mode.
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
Status ReadRawReadV(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_readv in raw mode.
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:185
void UpdateTriedCGI(uint32_t errNo=0)
Update the "tried=" part of the CGI of the current message.
@ EntryRetry
Definition: XrdClXRootDMsgHandler.hh:68
Definition: XrdClLocalFileHandler.hh:33
bool IsRetriable(Message *request)
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:705
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Status ReadRawPgRead(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle a kXR_pgread in raw mode.
bool pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:720
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:74
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:680
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:83
Status WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
Definition: XrdSysKernelBuffer.hh:46
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:704
kXR_int32 rlen
Definition: XProtocol.hh:490
bool OmitWait(Message *request, const URL &url)
readahead_list pReadVRawChunkHeader
Definition: XrdClXRootDMsgHandler.hh:697
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
Definition: XrdClBuffer.hh:72
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:735
@ EntryRedirectOnWait
Definition: XrdClXRootDMsgHandler.hh:67
bool pHasLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:670
virtual uint8_t OnStreamEvent(StreamEvent event, XRootDStatus status)
Status UnPackReadVResponse(Message *msg)
Unpack a single readv response.
Definition: XProtocol.hh:485
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:637
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:666
Handle diagnostics.
Definition: XrdClLog.hh:103
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:646
Definition: XProtocol.hh:636
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:678
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:687
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:127
URL from
Definition: XrdClXRootDMsgHandler.hh:78
@ EntryRedirect
Definition: XrdClXRootDMsgHandler.hh:66
static Log * GetLog()
Get default log.
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:99
kXR_unt16 requestid
Definition: XProtocol.hh:150
virtual void Process(Message *msg)
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:675
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
Definition: XrdClXRootDMsgHandler.hh:63
Message * pResponse
Definition: XrdClXRootDMsgHandler.hh:656
Status ReadFromBuffer(char *&buffer, size_t &buflen, size_t size, std::string &result)
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:661
void HandleResponse()
Unpack the message and call the response handler.
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:710
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:90
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:684
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:343
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:370
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:674
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:707
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:728
Message * pRequest
Definition: XrdClXRootDMsgHandler.hh:655
std::string GetLocation() const
Get location (protocol://host:port/path)
bool done
Definition: XrdClXRootDMsgHandler.hh:639
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:409
Status ReadPageAsync(Socket *socket, uint32_t &bytesRead)
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:113
Request status.
Definition: XrdClXRootDResponses.hh:215
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:662
Definition: XrdSysPthread.hh:79
Status PostProcessReadV(VectorReadInfo *vReadInfo)
Post process vector read.
@ EntryWait
Definition: XrdClXRootDMsgHandler.hh:69
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:677
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:966
virtual uint16_t Examine(Message *msg)
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:391
@ kXR_pgread
Definition: XProtocol.hh:141
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:676
static const int PageSize
Definition: XrdSysPageSize.hh:36
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:683
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:379
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:663
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:351
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:81
bool pReadVRawChunkHeaderDone
Definition: XrdClXRootDMsgHandler.hh:693
bool pReadVRawMsgDiscard
Definition: XrdClXRootDMsgHandler.hh:698
Message handler.
Definition: XrdClPostMasterInterfaces.hh:72
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:702
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:204
void HandleError(XRootDStatus status, Message *msg=0)
Recover error.
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:682
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:681
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:642
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:638
bool pReadVRawSizeError
Definition: XrdClXRootDMsgHandler.hh:695
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:453
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:72
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:672
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
bool pReadVRawChunkHeaderStarted
Definition: XrdClXRootDMsgHandler.hh:694
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:120
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:664
const uint16_t suRetry
Definition: XrdClStatus.hh:40
virtual uint16_t GetSid() const
virtual Status ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
Type type
Definition: XrdClXRootDMsgHandler.hh:80
uint32_t pReadVRawMsgOffset
Definition: XrdClXRootDMsgHandler.hh:692
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:334
virtual uint16_t InspectStatusRsp(Message *msg)
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1028
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:668
HostList * pHosts
Definition: XrdClXRootDMsgHandler.hh:669
Definition: XrdClAnyObject.hh:26
Status ReadRawOther(Message *msg, Socket *socket, uint32_t &bytesRead)
Handle anything other than kXR_read and kXR_readv in raw mode.
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1031
Status ParseResponse(AnyObject *&response)
virtual void OnStatusReady(const Message *message, XRootDStatus status)
The requested action has been performed and the status is available.
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:660
Vector read info.
Definition: XrdClXRootDResponses.hh:972
static PostMaster * GetPostMaster()
Get default post master.
std::vector< Message * > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:657
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:399
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:645
Status ReadPagesAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:467
Status RewriteRequestRedirect(const URL &newUrl)
Type
Definition: XrdClXRootDMsgHandler.hh:65
XRootDStatus * ProcessStatus()
Extract the status information from the stuff that we got.
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
Definition: XrdClXRootDMsgHandler.hh:359
URL pUrl
Definition: XrdClXRootDMsgHandler.hh:659
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
Definition: XrdClXRootDResponses.hh:1020
int32_t pReadVRawChunkIndex
Definition: XrdClXRootDMsgHandler.hh:696
bool pDirListWithStat
Definition: XrdClXRootDMsgHandler.hh:729
Procedure execution status.
Definition: XrdClStatus.hh:111
URL representation.
Definition: XrdClURL.hh:31
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:673
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:325
bool IsValid() const
Is the url valid.
Definition: XrdClXRootDMsgHandler.hh:636
Status ReadFromBuffer(char *&buffer, size_t &buflen, std::string &result)
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:686
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:671
static size_t NbPages(uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:648
virtual bool IsRaw() const
Are we a raw writer or not?
const uint64_t ExDbgMsg
Definition: XrdClConstants.hh:41
Definition: XrdClAnyObject.hh:33
static const size_t PageSize
Definition: XrdClXRootDMsgHandler.hh:644
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
void TakeDownTimeoutFence()
Take down the timeout fence after oksofar response has been handled.
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:404
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:700
void WaitDone(time_t now)
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:48
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:665
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:114