xrootd
Public Types | Public Member Functions | List of all members
XrdCl::IncomingMsgHandler Class Referenceabstract

Message handler. More...

#include <XrdClPostMasterInterfaces.hh>

Inheritance diagram for XrdCl::IncomingMsgHandler:
Inheritance graph
[legend]

Public Types

enum  Action {
  None = 0x0000, Take = 0x0001, Ignore = 0x0002, RemoveHandler = 0x0004,
  Raw = 0x0008, NoProcess = 0x0010, Corrupted = 0x0020
}
 Actions to be taken after a message is processed by the handler. More...
 
enum  StreamEvent { Ready = 1, Broken = 2, Timeout = 3, FatalError = 4 }
 Events that may have occurred to the stream. More...
 

Public Member Functions

virtual ~IncomingMsgHandler ()
 Event types that the message handler may receive. More...
 
virtual uint16_t Examine (Message *msg)=0
 
virtual uint16_t InspectStatusRsp (Message *msg)=0
 
virtual uint16_t GetSid () const =0
 
virtual void Process (Message *msg)
 
virtual Status ReadMessageBody (Message *msg, Socket *socket, uint32_t &bytesRead)
 
virtual uint8_t OnStreamEvent (StreamEvent event, XRootDStatus status)
 

Detailed Description

Message handler.

Member Enumeration Documentation

◆ Action

Actions to be taken after a message is processed by the handler.

Enumerator
None 
Take 

Take ownership over the message.

Ignore 

Ignore the message.

RemoveHandler 

Remove the handler from the notification list

Raw 

the handler is interested in reading the message body directly from the socket

NoProcess 

don't call the processing callback even if the message belongs to this handler

Corrupted 

the handler discovered that the message header is corrupted, we will have to tear down the socket

◆ StreamEvent

Events that may have occurred to the stream.

Enumerator
Ready 

The stream has become connected.

Broken 

The stream is broken.

Timeout 

The declared timeout has occurred.

FatalError 

Stream has been broken and won't be recovered.

Constructor & Destructor Documentation

◆ ~IncomingMsgHandler()

virtual XrdCl::IncomingMsgHandler::~IncomingMsgHandler ( )
inlinevirtual

Event types that the message handler may receive.

Member Function Documentation

◆ Examine()

virtual uint16_t XrdCl::IncomingMsgHandler::Examine ( Message msg)
pure virtual

Examine an incoming message, and decide on the action to be taken

Parameters
msgthe message, may be zero if receive failed
Returns
action type that needs to be take wrt the message and the handler

Implemented in XrdCl::XRootDMsgHandler.

◆ GetSid()

virtual uint16_t XrdCl::IncomingMsgHandler::GetSid ( ) const
pure virtual

Get handler sid

return sid of the corresponding request, otherwise 0

Implemented in XrdCl::XRootDMsgHandler.

◆ InspectStatusRsp()

virtual uint16_t XrdCl::IncomingMsgHandler::InspectStatusRsp ( Message msg)
pure virtual

Reexamine the incoming message, and decide on the action to be taken

In case of kXR_status the message can be only fully examined after reading the whole body (without raw data).

Parameters
msgthe message, may be zero if receive failed
Returns
action type that needs to be take wrt the message and the handler

Implemented in XrdCl::XRootDMsgHandler.

◆ OnStreamEvent()

virtual uint8_t XrdCl::IncomingMsgHandler::OnStreamEvent ( StreamEvent  event,
XRootDStatus  status 
)
inlinevirtual

Handle an event other that a message arrival

Parameters
eventtype of the event
statusstatus info
Returns
Action::RemoveHandler or 0

Reimplemented in XrdCl::XRootDMsgHandler.

◆ Process()

virtual void XrdCl::IncomingMsgHandler::Process ( Message msg)
inlinevirtual

Process the message if it was "taken" by the examine action

Parameters
msgthe message to be processed

Reimplemented in XrdCl::XRootDMsgHandler.

Referenced by XrdCl::Stream::HandleIncMsgJob::Run().

◆ ReadMessageBody()

virtual Status XrdCl::IncomingMsgHandler::ReadMessageBody ( Message msg,
Socket socket,
uint32_t &  bytesRead 
)
inlinevirtual

Read message body directly from a socket - called if Examine returns Raw flag - only socket related errors may be returned here

Parameters
msgthe corresponding message header
socketthe socket to read from
bytesReadnumber of bytes read by the method
Returns
stOK & suDone if the whole body has been processed stOK & suRetry if more data is needed stError on failure

Reimplemented in XrdCl::XRootDMsgHandler.

References XrdCl::stOK, and XrdCl::suDone.


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