XRootD
XrdCl::MsgHandler Class Referenceabstract

Message handler. More...

#include <XrdClPostMasterInterfaces.hh>

+ Inheritance diagram for XrdCl::MsgHandler:
+ Collaboration diagram for XrdCl::MsgHandler:

Public Types

enum  Action {
  None = 0x0000 ,
  Nop = 0x0001 ,
  Ignore = 0x0002 ,
  RemoveHandler = 0x0004 ,
  Raw = 0x0008 ,
  NoProcess = 0x0010 ,
  Corrupted = 0x0020 ,
  More = 0x0040
}
 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 ~MsgHandler ()
 Event types that the message handler may receive. More...
 
virtual uint16_t Examine (std::shared_ptr< Message > &msg)=0
 
virtual time_t GetExpiration ()=0
 
virtual uint16_t GetSid () const =0
 
virtual uint16_t InspectStatusRsp ()=0
 
virtual bool IsRaw () const
 
virtual void OnReadyToSend (Message *msg)
 
virtual void OnStatusReady (const Message *message, XRootDStatus status)=0
 The requested action has been performed and the status is available. More...
 
virtual uint8_t OnStreamEvent (StreamEvent event, XRootDStatus status)
 
virtual void Process ()
 
virtual XRootDStatus ReadMessageBody (Message *msg, Socket *socket, uint32_t &bytesRead)
 
virtual XRootDStatus WriteMessageBody (Socket *socket, uint32_t &bytesWritten)
 

Detailed Description

Message handler.

Definition at line 50 of file XrdClPostMasterInterfaces.hh.

Member Enumeration Documentation

◆ Action

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

Enumerator
None 
Nop 

A place holder.

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

More 

there are more (non-raw) data to be read

Definition at line 56 of file XrdClPostMasterInterfaces.hh.

57  {
58  None = 0x0000,
59  Nop = 0x0001,
60  Ignore = 0x0002,
61  RemoveHandler = 0x0004,
63  Raw = 0x0008,
66  NoProcess = 0x0010,
69  Corrupted = 0x0020,
72  More = 0x0040
73  };
@ More
there are more (non-raw) data to be read
@ Ignore
Ignore the message.

◆ 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.

Definition at line 78 of file XrdClPostMasterInterfaces.hh.

79  {
80  Ready = 1,
81  Broken = 2,
82  Timeout = 3,
83  FatalError = 4
84  };
@ FatalError
Stream has been broken and won't be recovered.
@ Timeout
The declared timeout has occurred.
@ Ready
The stream has become connected.
@ Broken
The stream is broken.

Constructor & Destructor Documentation

◆ ~MsgHandler()

virtual XrdCl::MsgHandler::~MsgHandler ( )
inlinevirtual

Event types that the message handler may receive.

Definition at line 90 of file XrdClPostMasterInterfaces.hh.

90 {}

Member Function Documentation

◆ Examine()

virtual uint16_t XrdCl::MsgHandler::Examine ( std::shared_ptr< 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.

Referenced by XrdCl::InQueue::GetHandlerForMessage(), and XrdCl::RedirectJob::Run().

+ Here is the caller graph for this function:

◆ GetExpiration()

virtual time_t XrdCl::MsgHandler::GetExpiration ( )
pure virtual

Implemented in XrdCl::XRootDMsgHandler.

Referenced by XrdCl::Stream::OnMessageSent().

+ Here is the caller graph for this function:

◆ GetSid()

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

Get handler sid

return sid of the corresponding request, otherwise 0

Implemented in XrdCl::XRootDMsgHandler.

Referenced by XrdCl::InQueue::AddMessageHandler(), XrdCl::InQueue::ReAddMessageHandler(), and XrdCl::InQueue::RemoveMessageHandler().

+ Here is the caller graph for this function:

◆ InspectStatusRsp()

virtual uint16_t XrdCl::MsgHandler::InspectStatusRsp ( )
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.

Referenced by XrdCl::Stream::InspectStatusRsp().

+ Here is the caller graph for this function:

◆ IsRaw()

virtual bool XrdCl::MsgHandler::IsRaw ( ) const
inlinevirtual

Determines whether the handler wants to write some data directly to the socket after the message (or message header) has been sent, WriteMessageBody will be called

Reimplemented in XrdCl::XRootDMsgHandler.

Definition at line 184 of file XrdClPostMasterInterfaces.hh.

184 { return false; }

Referenced by XrdCl::AsyncMsgWriter::Write().

+ Here is the caller graph for this function:

◆ OnReadyToSend()

virtual void XrdCl::MsgHandler::OnReadyToSend ( Message msg)
inlinevirtual

Called just before the message is going to be sent through a valid connection, so that the user can still make some modifications that were impossible before (ie. protocol version dependent adjustments)

Parameters
msgmessage concerned

Definition at line 174 of file XrdClPostMasterInterfaces.hh.

175  {
176  (void)msg;
177  };

Referenced by XrdCl::Stream::OnReadyToWrite().

+ Here is the caller graph for this function:

◆ OnStatusReady()

virtual void XrdCl::MsgHandler::OnStatusReady ( const Message message,
XRootDStatus  status 
)
pure virtual

The requested action has been performed and the status is available.

Implemented in XrdCl::XRootDMsgHandler.

Referenced by XrdCl::Stream::OnMessageSent().

+ Here is the caller graph for this function:

◆ OnStreamEvent()

virtual uint8_t XrdCl::MsgHandler::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.

Definition at line 153 of file XrdClPostMasterInterfaces.hh.

155  {
156  (void)event; (void)status;
157  return 0;
158  };

◆ Process()

virtual void XrdCl::MsgHandler::Process ( )
inlinevirtual

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

Parameters
msgthe message to be processed

Reimplemented in XrdCl::XRootDMsgHandler.

Definition at line 125 of file XrdClPostMasterInterfaces.hh.

125 {};

Referenced by XrdCl::RedirectJob::Run().

+ Here is the caller graph for this function:

◆ ReadMessageBody()

virtual XRootDStatus XrdCl::MsgHandler::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.

Definition at line 138 of file XrdClPostMasterInterfaces.hh.

141  {
142  (void)msg; (void)socket; (void)bytesRead;
143  return Status( stOK, suDone );
144  };
const uint16_t stOK
Everything went OK.
Definition: XrdClStatus.hh:31
const uint16_t suDone
Definition: XrdClStatus.hh:38

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

Referenced by XrdCl::AsyncMsgReader::Read().

+ Here is the caller graph for this function:

◆ WriteMessageBody()

virtual XRootDStatus XrdCl::MsgHandler::WriteMessageBody ( Socket socket,
uint32_t &  bytesWritten 
)
inlinevirtual

Write message body directly to a socket - called if IsRaw returns true - only socket related errors may be returned here

Parameters
socketthe socket to read from
bytesWrittennumber of bytes written by the method
Returns
stOK & suDone if the whole body has been processed stOK & suRetry if more data needs to be written stError on failure

Reimplemented in XrdCl::XRootDMsgHandler.

Definition at line 196 of file XrdClPostMasterInterfaces.hh.

198  {
199  (void)socket; (void)bytesWritten;
200  return Status();
201  }

Referenced by XrdCl::AsyncMsgWriter::Write().

+ Here is the caller graph for this function:

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