25 #ifndef __XRD_CL_XROOTD_MSG_HANDLER_HH__
26 #define __XRD_CL_XROOTD_MSG_HANDLER_HH__
46 #include <arpa/inet.h>
59 class LocalFileHandler;
76 from( from ), to( to ), type( type )
95 case EntryRedirect:
return "Redirected from: " + fromstr +
" to: "
99 "Falling back to virtual redirector: " + tostr;
103 case EntryWait:
return "Waited at server request. Resending: "
107 return "Failed at: " + fromstr +
", retrying at: " + tostr;
132 std::shared_ptr<SIDManager> sidMgr,
191 log->
Debug(
ExDbgMsg,
"[%s] MsgHandler created: 0x%x (message: %s ).",
200 ntohl( pgrdreq->
rlen ) ) );
239 virtual uint16_t
Examine( std::shared_ptr<Message> &msg );
258 virtual uint16_t
GetSid()
const;
280 uint32_t &bytesRead );
301 virtual bool IsRaw()
const;
314 uint32_t &bytesWritten );
442 uint32_t &bytesRead );
448 uint32_t &bytesRead );
457 uint32_t btsRead = 0;
459 pAsyncOffset += btsRead;
460 bytesRead += btsRead;
468 uint32_t toBeRead, uint32_t &bytesRead );
596 std::string &result );
614 inline static size_t NbPgPerRsp( uint64_t offset, uint32_t dlen )
722 #endif // __XRD_CL_XROOTD_MSG_HANDLER_HH__
Status ParseXAttrResponse(char *data, size_t len, AnyObject *&response)
uint32_t pAsyncChunkIndex
Definition: XrdClXRootDMsgHandler.hh:660
bool pOtherRawStarted
Definition: XrdClXRootDMsgHandler.hh:675
Definition: XrdClAnyObject.hh:32
URL to
Definition: XrdClXRootDMsgHandler.hh:82
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:95
void UpdateTriedCGI(uint32_t errNo=0)
Update the "tried=" part of the CGI of the current message.
const uint64_t ExDbgMsg
Definition: XrdClConstants.hh:44
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:1046
Status RetryAtServer(const URL &url, RedirectEntry::Type entryType)
Retry the request at another server.
PostMaster * pPostMaster
Definition: XrdClXRootDMsgHandler.hh:638
virtual bool IsRaw() const
Are we a raw writer or not?
Status RewriteRequestWait()
Some requests need to be rewritten also after getting kXR_wait - sigh.
Status ReadRawRead(Socket *socket, uint32_t &bytesRead)
Handle a kXR_read in raw mode.
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
bool pRspStatusBodyUnMarshaled
Definition: XrdClXRootDMsgHandler.hh:717
std::string GetLocation() const
Get location (protocol://host:port/path)
ChunkStatus()
Definition: XrdClXRootDMsgHandler.hh:603
bool RetriableErrorResponse(const Status &status)
Status ReadRawOther(Socket *socket, uint32_t &bytesRead)
Handle anything other than kXR_read and kXR_readv in raw mode.
bool IsValid() const
Is the url valid.
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
Definition: XrdClXRootDMsgHandler.hh:414
bool pReadRawStarted
Definition: XrdClXRootDMsgHandler.hh:665
~XRootDMsgHandler()
Destructor.
Definition: XrdClXRootDMsgHandler.hh:212
std::atomic< bool > pTimeoutFence
Definition: XrdClXRootDMsgHandler.hh:692
std::unique_ptr< AsyncPageReader > pPageReader
Definition: XrdClXRootDMsgHandler.hh:668
void SetFollowMetalink(bool followMetalink)
Definition: XrdClXRootDMsgHandler.hh:419
Buffer pPgWrtCksumBuff
Definition: XrdClXRootDMsgHandler.hh:671
RedirectTraceBack pRedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:683
static const size_t PageWithCksum
Definition: XrdClXRootDMsgHandler.hh:611
URL from
Definition: XrdClXRootDMsgHandler.hh:81
LocalFileHandler * pLFileHandler
Definition: XrdClXRootDMsgHandler.hh:640
uint16_t pNotAuthorizedCounter
Definition: XrdClXRootDMsgHandler.hh:656
std::string ToString(bool prevok=true)
Definition: XrdClXRootDMsgHandler.hh:86
virtual uint16_t Examine(std::shared_ptr< Message > &msg)
std::shared_ptr< Message > pResponse
Definition: XrdClXRootDMsgHandler.hh:633
Message handler.
Definition: XrdClPostMasterInterfaces.hh:50
virtual XRootDStatus ReadMessageBody(Message *msg, Socket *socket, uint32_t &bytesRead)
std::vector< ChunkStatus > pChunkStatus
Definition: XrdClXRootDMsgHandler.hh:654
kXR_unt16 requestid
Definition: XProtocol.hh:157
Definition: XrdClXRootDMsgHandler.hh:601
XRootDMsgHandler(Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler)
Definition: XrdClXRootDMsgHandler.hh:129
kXR_int32 rlen
Definition: XProtocol.hh:506
friend class HandleRspJob
Definition: XrdClXRootDMsgHandler.hh:116
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
Definition: XrdClXRootDMsgHandler.hh:406
static Status ReadBytesAsync(Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead)
Read a buffer asynchronously.
Status ParseResponse(AnyObject *&response)
virtual uint16_t GetSid() const
static size_t NbPgPerRsp(uint64_t offset, uint32_t dlen)
Definition: XrdClXRootDMsgHandler.hh:614
bool pFollowMetalink
Definition: XrdClXRootDMsgHandler.hh:677
Status ReadFromBuffer(char *&buffer, size_t &buflen, T &result)
bool done
Definition: XrdClXRootDMsgHandler.hh:605
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
Definition: XrdClBuffer.hh:72
Procedure execution status.
Definition: XrdClStatus.hh:113
static const size_t CksumSize
Definition: XrdClXRootDMsgHandler.hh:610
Status RewriteRequestRedirect(const URL &newUrl)
URL pUrl
Definition: XrdClXRootDMsgHandler.hh:636
StreamEvent
Events that may have occurred to the stream.
Definition: XrdClPostMasterInterfaces.hh:78
virtual void OnStatusReady(const Message *message, XRootDStatus status)
The requested action has been performed and the status is available.
Message * pRequest
Definition: XrdClXRootDMsgHandler.hh:632
Definition: XrdClXRootDMsgHandler.hh:70
time_t pExpiration
Definition: XrdClXRootDMsgHandler.hh:643
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:326
uint16_t pRedirectCounter
Definition: XrdClXRootDMsgHandler.hh:655
std::shared_ptr< SIDManager > pSidMgr
Definition: XrdClXRootDMsgHandler.hh:639
static Log * GetLog()
Get default log.
XRootDStatus WriteMessageBody(Socket *socket, uint32_t &bytesWritten)
bool pHasSessionId
Definition: XrdClXRootDMsgHandler.hh:649
ChunkList * pChunkList
Definition: XrdClXRootDMsgHandler.hh:651
Definition: XrdClXRootDResponses.hh:1099
char * pAsyncReadBuffer
Definition: XrdClXRootDMsgHandler.hh:662
bool pRspPgWrtRetrnsmReqUnMarshalled
Definition: XrdClXRootDMsgHandler.hh:718
Definition: XProtocol.hh:501
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1111
bool pOksofarAsAnswer
Definition: XrdClXRootDMsgHandler.hh:645
static const size_t MaxSslErrRetry
Definition: XrdClXRootDMsgHandler.hh:612
bool pDirListWithStat
Definition: XrdClXRootDMsgHandler.hh:700
std::list< std::unique_ptr< RedirectEntry > > RedirectTraceBack
Definition: XrdClXRootDMsgHandler.hh:608
Definition: XrdSysPthread.hh:78
XrdSys::KernelBuffer * pKBuff
Definition: XrdClXRootDMsgHandler.hh:653
Object for reading out data from the VectorRead response.
Definition: XrdClAsyncVectorReader.hh:32
static const int PageSize
Definition: XrdSysPageSize.hh:36
RedirectEntry(const URL &from, const URL &to, Type type)
Definition: XrdClXRootDMsgHandler.hh:75
XRootDStatus pStatus
Definition: XrdClXRootDMsgHandler.hh:641
XRootDStatus status
Definition: XrdClXRootDMsgHandler.hh:84
Request status.
Definition: XrdClXRootDResponses.hh:218
URL * pEffectiveDataServerUrl
Definition: XrdClXRootDMsgHandler.hh:637
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
Definition: XrdClURL.hh:94
Type type
Definition: XrdClXRootDMsgHandler.hh:83
int pAggregatedWaitTime
Definition: XrdClXRootDMsgHandler.hh:680
void SwitchOnRefreshFlag()
Switch on the refresh flag for some requests.
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
Definition: XrdClXRootDMsgHandler.hh:387
bool pDirListStarted
Definition: XrdClXRootDMsgHandler.hh:699
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:111
virtual uint16_t InspectStatusRsp()
void SetRedirectAsAnswer(bool redirectAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:343
Definition: XProtocol.hh:142
std::unique_ptr< HostList > pHosts
Definition: XrdClXRootDMsgHandler.hh:646
std::string pRedirectUrl
Definition: XrdClXRootDMsgHandler.hh:650
Definition: XrdSysKernelBuffer.hh:45
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1108
uint32_t pPgWrtCurrentPageNb
Definition: XrdClXRootDMsgHandler.hh:673
Definition: XProtocol.hh:155
bool OmitWait(Message &request, const URL &url)
bool sizeError
Definition: XrdClXRootDMsgHandler.hh:604
bool pRedirectAsAnswer
Definition: XrdClXRootDMsgHandler.hh:644
bool pStateful
Definition: XrdClXRootDMsgHandler.hh:679
void HandleLocalRedirect(URL *url)
Handle a redirect to a local file.
const Message * GetRequest() const
Get the request pointer.
Definition: XrdClXRootDMsgHandler.hh:360
Handle an async response.
Definition: XrdClXRootDResponses.hh:1116
void SetStateful(bool stateful)
Definition: XrdClXRootDMsgHandler.hh:424
uint32_t pPgWrtCurrentPageOffset
Definition: XrdClXRootDMsgHandler.hh:672
Definition: XrdClLocalFileHandler.hh:32
uint32_t pAsyncMsgSize
Definition: XrdClXRootDMsgHandler.hh:663
uint32_t pAsyncReadSize
Definition: XrdClXRootDMsgHandler.hh:661
URL representation.
Definition: XrdClURL.hh:30
uint32_t pAsyncOffset
Definition: XrdClXRootDMsgHandler.hh:658
std::vector< std::shared_ptr< Message > > pPartialResps
Definition: XrdClXRootDMsgHandler.hh:634
std::unique_ptr< RedirectEntry > pRdirEntry
Definition: XrdClXRootDMsgHandler.hh:682
Definition: XrdClXRootDMsgHandler.hh:69
kXR_int64 offset
Definition: XProtocol.hh:505
std::unique_ptr< AsyncVectorReader > pVectorReader
Definition: XrdClXRootDMsgHandler.hh:669
void WaitDone(time_t now)
size_t pSslErrCnt
Definition: XrdClXRootDMsgHandler.hh:711
virtual uint8_t OnStreamEvent(StreamEvent event, XRootDStatus status)
XRootDStatus * ProcessStatus()
Extract the status information from the stuff that we got.
Status pLastError
Definition: XrdClXRootDMsgHandler.hh:642
uint32_t pReadRawCurrentOffset
Definition: XrdClXRootDMsgHandler.hh:666
time_t GetExpiration()
Get a timestamp after which we give up.
Definition: XrdClXRootDMsgHandler.hh:334
Definition: XrdClXRootDMsgHandler.hh:72
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
Type
Definition: XrdClXRootDMsgHandler.hh:67
HostInfo pLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:648
static PostMaster * GetPostMaster()
Get default post master.
Handle/Process/Forward XRootD messages.
Definition: XrdClXRootDMsgHandler.hh:114
XrdSysCondVar pCV
Definition: XrdClXRootDMsgHandler.hh:706
void HandleError(XRootDStatus status)
Recover error.
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
void SetCrc32cDigests(std::vector< uint32_t > &&crc32cDigests)
Definition: XrdClXRootDMsgHandler.hh:398
void HandleResponse()
Unpack the message and call the response handler.
bool pHasLoadBalancer
Definition: XrdClXRootDMsgHandler.hh:647
ResponseHandler * pResponseHandler
Definition: XrdClXRootDMsgHandler.hh:635
Definition: XrdClXRootDMsgHandler.hh:65
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.
std::vector< uint32_t > pCrc32cDigests
Definition: XrdClXRootDMsgHandler.hh:652
bool pMsgInFly
Definition: XrdClXRootDMsgHandler.hh:685
Status ReadAsync(Socket *socket, uint32_t &bytesRead)
Definition: XrdClXRootDMsgHandler.hh:454
A network socket.
Definition: XrdClSocket.hh:42
Definition: XProtocol.hh:137
void SetOksofarAsAnswer(bool oksofarAsAnswer)
Definition: XrdClXRootDMsgHandler.hh:352
void DumpRedirectTraceBack()
Dump the redirect-trace-back into the log file.
Handle diagnostics.
Definition: XrdClLog.hh:100
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
Definition: XrdClXRootDMsgHandler.hh:368
Binary blob representation.
Definition: XrdClBuffer.hh:33
uint32_t pAsyncChunkOffset
Definition: XrdClXRootDMsgHandler.hh:659
Definition: XrdClXRootDMsgHandler.hh:71
void SetHostList(HostList *hostList)
Set host list.
Definition: XrdClXRootDMsgHandler.hh:379