Common Message Codec Filter class, a filter who can extract a common message(format: header + body) from incoming bytes.
More...
#include <MessageCodec.h>
|
enum | { STATE_WAIT_FOR_HEADER = 0,
STATE_WAIT_FOR_BODY = 1
} |
|
|
| MessageCodec () |
| Constructor function.
|
|
| MessageCodec (int headerSize) |
|
| MessageCodec (int headerSize, int bodySizePos) |
|
| MessageCodec (int headerSize, int bodySizePos, int bodySizeLength) |
|
| MessageCodec (int headerSize, int bodySizePos, int bodySizeLength, int maxBodySize) |
|
virtual | ~MessageCodec () |
| Destructor function.
|
|
virtual bool | Extract (SessionPtr session, IoBufferPtr data, std::vector< IoBufferPtr > &readylist) |
|
virtual IoBufferPtr | Encode (SessionPtr session, void *data) |
|
virtual void * | Decode (SessionPtr session, IoBufferPtr data) |
|
Common Message Codec Filter class, a filter who can extract a common message(format: header + body) from incoming bytes.
esnlib::MessageCodec::MessageCodec |
( |
int |
headerSize | ) |
|
|
explicit |
Constructor function
- Parameters
-
headerSize | The size(how many bytes) of the message header |
esnlib::MessageCodec::MessageCodec |
( |
int |
headerSize, |
|
|
int |
bodySizePos |
|
) |
| |
Constructor function
- Parameters
-
headerSize | The size(how many bytes) of the message header |
bodySizePos | An integer value's position in the message header, this value is the size of the message body |
esnlib::MessageCodec::MessageCodec |
( |
int |
headerSize, |
|
|
int |
bodySizePos, |
|
|
int |
bodySizeLength |
|
) |
| |
Constructor function
- Parameters
-
headerSize | The size(how many bytes) of the message header |
bodySizePos | A value's position in the message header, this value is the size of the message body |
bodySizeLength | How many bytes does the value (which indicates the size of the message body) have |
esnlib::MessageCodec::MessageCodec |
( |
int |
headerSize, |
|
|
int |
bodySizePos, |
|
|
int |
bodySizeLength, |
|
|
int |
maxBodySize |
|
) |
| |
Constructor function
- Parameters
-
headerSize | The size(how many bytes) of the message header |
bodySizePos | A value's position in the message header, this value is the size of the message body |
bodySizeLength | How many bytes does the value (which indicates the size of the message body) have |
maxBodySize | The maximum body size |
virtual void* esnlib::MessageCodec::Decode |
( |
SessionPtr |
session, |
|
|
IoBufferPtr |
data |
|
) |
| |
|
virtual |
Decode the IO buffer
- Parameters
-
session | Current session |
data | The pointer of the IO buffer encoded |
- Returns
- The original raw buffer (a common pointer)
Implements esnlib::IoFilter.
virtual IoBufferPtr esnlib::MessageCodec::Encode |
( |
SessionPtr |
session, |
|
|
void * |
data |
|
) |
| |
|
virtual |
Encode the raw buffer
- Parameters
-
session | Current session |
data | The pointer of the raw buffer |
- Returns
- The pointer of the IO buffer encoded
Implements esnlib::IoFilter.
virtual bool esnlib::MessageCodec::Extract |
( |
SessionPtr |
session, |
|
|
IoBufferPtr |
data, |
|
|
std::vector< IoBufferPtr > & |
readylist |
|
) |
| |
|
virtual |
Extract useful data (the message made up of header and body) from the incoming bytes
- Parameters
-
session | Current session |
data | The pointer of the incoming bytes |
readylist | The list used to save the useful data extracted |
- Returns
- Return true if some useful data has been extracted successfully
Implements esnlib::IoFilter.
The documentation for this class was generated from the following file: