Wolframe, 0.0.3

_Wolframe::cmdbind::ProtocolHandler Class Referenceabstract

Protocol handler interface. More...

#include <protocolHandler.hpp>

Public Types

enum  Operation { READ =cmdbind::CommandHandler::READ, WRITE =cmdbind::CommandHandler::WRITE, CLOSE =cmdbind::CommandHandler::CLOSE }
 Operation type. More...
 

Public Member Functions

 ProtocolHandler ()
 Default constructor. More...
 
virtual ~ProtocolHandler ()
 Destructor. More...
 
virtual void setPeer (const net::RemoteEndpointR &)
 Set the client connection end point. More...
 
virtual void setLocalEndPoint (const net::LocalEndpointR &)
 Set the local connection end point. More...
 
virtual void setInputBuffer (void *buf, std::size_t allocsize)=0
 Define the input buffer for processing the command. More...
 
virtual void setOutputBuffer (void *buf, std::size_t size, std::size_t pos)=0
 Define the input buffer for processing the command. More...
 
virtual Operation nextOperation ()=0
 Get the next operation to do for the connection handler. More...
 
virtual void putInput (const void *begin, std::size_t bytesTransferred)=0
 Passes the network input to the command handler (READ operation) More...
 
virtual void putEOF ()
 Tell the protocol handler that EOF has been reached, if implemented. More...
 
virtual void getInputBlock (void *&begin, std::size_t &maxBlockSize)=0
 Get the input block request (READ operation) More...
 
virtual void getOutput (const void *&begin, std::size_t &bytesToTransfer)=0
 Get the next output chunk from the command handler (WRITE operation) More...
 
virtual void getDataLeft (const void *&begin, std::size_t &nofBytes)=0
 Get the data left unprocessed after close. The data belongs to the caller to process. More...
 
const char * lastError () const
 Get the last error message of command execution to be returned to the client. More...
 
void setLastError (const std::string &msg)
 Set the last error message of command execution to be returned to the client. More...
 
void setExecContext (proc::ExecContext *c)
 Pass the reference to the execution context to the command handler. More...
 
proc::ExecContextexecContext ()
 Get the reference to the processor provider. More...
 
virtual void setArgumentString (const std::string &)
 Pass arguments to protocol handler. More...
 
virtual const char * interruptDataSessionMarker () const
 Get the termination marker to send for an abort of a running data session. More...
 

Private Attributes

std::string m_lastError
 
proc::ExecContextm_execContext
 

Detailed Description

Protocol handler interface.

Member Enumeration Documentation

Operation type.

Enumerator
READ 
WRITE 

<request to read data

CLOSE 

<request to write data

Constructor & Destructor Documentation

_Wolframe::cmdbind::ProtocolHandler::ProtocolHandler ( )
inline

Default constructor.

virtual _Wolframe::cmdbind::ProtocolHandler::~ProtocolHandler ( )
inlinevirtual

Destructor.

Member Function Documentation

proc::ExecContext* _Wolframe::cmdbind::ProtocolHandler::execContext ( )
inline

Get the reference to the processor provider.

Returns
the reference to the processor provider
virtual void _Wolframe::cmdbind::ProtocolHandler::getDataLeft ( const void *&  begin,
std::size_t &  nofBytes 
)
pure virtual

Get the data left unprocessed after close. The data belongs to the caller to process.

Parameters
[out]beginreturned start of the data chunk
[out]nofBytessize of the returned data chunk in bytes
virtual void _Wolframe::cmdbind::ProtocolHandler::getInputBlock ( void *&  begin,
std::size_t &  maxBlockSize 
)
pure virtual

Get the input block request (READ operation)

Parameters
[out]beginstart of the network input buffer
[out]maxBlockSizemaximum size of data in bytes to pass with the subsequent putInput(const void*,std::size_t) call
virtual void _Wolframe::cmdbind::ProtocolHandler::getOutput ( const void *&  begin,
std::size_t &  bytesToTransfer 
)
pure virtual

Get the next output chunk from the command handler (WRITE operation)

Parameters
[out]beginstart of the output chunk
[out]bytesToTransfersize of the output chunk to send in bytes
virtual const char* _Wolframe::cmdbind::ProtocolHandler::interruptDataSessionMarker ( ) const
inlinevirtual

Get the termination marker to send for an abort of a running data session.

const char* _Wolframe::cmdbind::ProtocolHandler::lastError ( ) const
inline

Get the last error message of command execution to be returned to the client.

virtual Operation _Wolframe::cmdbind::ProtocolHandler::nextOperation ( )
pure virtual

Get the next operation to do for the connection handler.

Returns
the next operation for the connection handler
virtual void _Wolframe::cmdbind::ProtocolHandler::putEOF ( )
inlinevirtual

Tell the protocol handler that EOF has been reached, if implemented.

virtual void _Wolframe::cmdbind::ProtocolHandler::putInput ( const void *  begin,
std::size_t  bytesTransferred 
)
pure virtual

Passes the network input to the command handler (READ operation)

Parameters
[in]beginstart of the network input block.
[in]bytesTransferrednumber of bytes passed in the input block
virtual void _Wolframe::cmdbind::ProtocolHandler::setArgumentString ( const std::string &  )
inlinevirtual

Pass arguments to protocol handler.

void _Wolframe::cmdbind::ProtocolHandler::setExecContext ( proc::ExecContext c)
inline

Pass the reference to the execution context to the command handler.

Parameters
[in]cthe reference to the execution context owned by the caller (connection)
virtual void _Wolframe::cmdbind::ProtocolHandler::setInputBuffer ( void *  buf,
std::size_t  allocsize 
)
pure virtual

Define the input buffer for processing the command.

Parameters
[in]bufbuffer for the data to process
[in]allocsizeallocation size of the buffer for the data to process in bytes
void _Wolframe::cmdbind::ProtocolHandler::setLastError ( const std::string &  msg)
inline

Set the last error message of command execution to be returned to the client.

virtual void _Wolframe::cmdbind::ProtocolHandler::setLocalEndPoint ( const net::LocalEndpointR )
inlinevirtual

Set the local connection end point.

Parameters
[in]localthe local point to set
virtual void _Wolframe::cmdbind::ProtocolHandler::setOutputBuffer ( void *  buf,
std::size_t  size,
std::size_t  pos 
)
pure virtual

Define the input buffer for processing the command.

Parameters
[in]bufbuffer for the data to process
[in]sizesize of the buffer for the data to process in bytes
[in]poscursor position in the buffer defining byte position of the start of the the data to process
virtual void _Wolframe::cmdbind::ProtocolHandler::setPeer ( const net::RemoteEndpointR )
inlinevirtual

Set the client connection end point.

Parameters
[in]remotethe end point to set

Member Data Documentation

proc::ExecContext* _Wolframe::cmdbind::ProtocolHandler::m_execContext
private
std::string _Wolframe::cmdbind::ProtocolHandler::m_lastError
private

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