#include <CHMwrapper.h>
Inheritance diagram for CHMwrapper:
This is a pure virtual class designed to make it easy to replace the wrapping mechanisms used to delimit messages - it stores the incoming message streams in a vector of buffers. Whenever a message is detected by the virtual method DetectMessage
the message chunk should be extracted and the OnMessage
method called. By default this method will pass the message to the CHMengine object that CHMwrapper has a pointer to.
The CHMengine object should then parse the message and possibly send a reply using its Reply
method. By default this reply method will call the SendResponseMessage
of the CHMwrapper object which pipes it back to the CHMtransport interface, etc.
Public Member Functions | |
CHMwrapper () | |
Constructor. | |
virtual | ~CHMwrapper () |
Destructor. | |
virtual void | AddWrapper (CHMstring &MessageData)=0 |
Wrap an outgoing message. | |
void | ClearData (size_t TransportIndex) |
Clear the buffer of the client at index TransportIndex . | |
virtual CHMboolean | DetectMessage (CHMstring &Buffer, CHMstring &Message)=0 |
Detect, and unwrap a message in an incoming stream. | |
CHMengine * | Engine () |
Get the CHMengine object assigned to this class. | |
virtual void | OnMessage (const CHMstring &MessageData, size_t TransportIndex) |
This method calls CHMengine to parse MessageData . | |
virtual size_t | ReceiveData (const CHMstring &Data, size_t TransportIndex) |
Receive data from the client at index TransportIndex . | |
void | SendResponseMessage (const CHMstring &MessageData, size_t TransportIndex) |
Send a response back to the sender. | |
void | SetEngine (CHMengine *pEngine) |
Assign a CHMengine object to this class. | |
CHMtransport * | Transport () |
Get the CHMtransport object assigned to the CHMengine associated with this class. |
|
Constructor.
|
|
Destructor.
|
|
Wrap an outgoing message.
Implemented in CHMllpWrapper. |
|
Clear the buffer of the client at index
|
|
Detect, and unwrap a message in an incoming stream.
This routine removes the read data from Implemented in CHMllpWrapper. |
|
Get the CHMengine object assigned to this class.
|
|
This method calls CHMengine to parse
|
|
Receive data from the client at index Returns the number of messages detected. |
|
Send a response back to the sender.
Message is routed back via the |
|
Assign a CHMengine object to this class.
|
|
Get the CHMtransport object assigned to the CHMengine associated with this class.
|