|
|
|
Home / Open source / Terimber 2.0
msg_cpp Class Referencemessage class internal message representation
More...
#include <msg_cpp.h>
List of all members.
|
Public Member Functions |
void | pack_msg (const room_byte_t *key) |
| packs message prepares block - continuant part of message for block sending
|
void | unpack_msg (const room_byte_t *key) |
| unpacks message fill msg_cpp fields taking information from block part
|
bool | resize (size_t size_) |
| resizes body size save previous part, if any
|
size_t | get_size () const |
| returns the body size
|
const ub1_t * | get_body () const |
| returns pointer to body - read only
|
ub1_t * | get_body () |
| returns pointer to body - writable version
|
const ub1_t * | get_block () const |
| returns pointer to block - read only
|
ub1_t * | get_block () |
| returna pointer to block - writable version
|
Static Public Member Functions |
static msg_cpp * | construct (byte_allocator *allocator_, size_t size_) |
| "static" constructor
|
static byte_allocator * | destroy (msg_cpp *msg) |
| "static" destructor
|
static size_t | estimate_size (size_t size_) |
| estimates the size of whole message with body size
|
static size_t | crypt_size (size_t size_) |
| culculate crypt size
|
static size_t | block_size (size_t size_) |
| returns the block size for body size
|
static ub4_t | reverse32 (ub4_t value) |
| network byte order 4 bytes
|
static ub2_t | reverse16 (ub2_t value) |
| network byte order 2 bytes
|
static size_t | pack32 (ub1_t *&dest, ub4_t x) |
| copies 4 bytes to the buffer in network format and move pointer to the buffer
|
static size_t | unpack32 (const ub1_t *&x, ub4_t &dest) |
| copies 4 bytes from the buffer in host format and move pointer to the buffer
|
static size_t | pack16 (ub1_t *&dest, ub2_t x) |
| copies 2 bytes to the buffer in network format and move pointer to the buffer
|
static size_t | unpack16 (const ub1_t *&x, ub2_t &dest) |
| copies 2 bytes from the buffer in host format and move pointer to the buffer
|
static size_t | packaddr (ub1_t *&dest, const guid_t &x) |
| copies 32 bytes (GUID format) to the buffer in network format and move pointer to the buffer
|
static size_t | unpackaddr (const ub1_t *&x, guid_t &dest) |
| copies 32 bytes (GUID format) from the buffer in host format and move pointer to the buffer
|
static size_t | pack64 (ub1_t *&dest, const ub8_t &x) |
| copies 8 bytes (double format) to the buffer in network format and move pointer to the buffer
|
static size_t | unpack64 (const ub1_t *&x, ub8_t &dest) |
| copies 8 bytes (double format) from the buffer in host format and move pointer to the buffer
|
Public Attributes |
ub4_t | _type |
| type of message (system, handshake, user ...)
|
guid_t | _marker |
| marker for identification of the reply message
|
sb8_t | _timestamp |
| date&time of message
|
guid_t | _sender |
| message sender
|
guid_t | _receiver |
| message receiver
|
guid_t | _sessionid |
| connection session identificator
|
Private Member Functions |
| msg_cpp (byte_allocator *allocator_, size_t size_) |
| hidden constructor
|
virtual | ~msg_cpp () |
| hidden destructor
|
Static Private Member Functions |
static size_t | _block_body_offset () |
| returns the offset of body from the begining of the msg_cpp class instance
|
Private Attributes |
ub4_t | _size |
| size of message body
|
byte_allocator * | _allocator |
| pointer to allocator
|
ub1_t * | _body |
| poiter to message body
|
ub1_t * | _block |
| pointer to the block
|
Detailed Description
message class internal message representation
Definition at line 97 of file msg_cpp.h.
Constructor & Destructor Documentation
msg_cpp::msg_cpp |
( |
byte_allocator * |
allocator_, |
|
|
size_t |
size_ | |
|
) |
| | [private] |
msg_cpp::~msg_cpp |
( |
|
) |
[private, virtual] |
Member Function Documentation
packs message prepares block - continuant part of message for block sending
- Parameters:
-
key |
private symmetric key, optional |
Definition at line 74 of file msg_cpp.cpp.
References _block, _body, _marker, _receiver, _sender, _sessionid, _size, _timestamp, _type, msg_t::majver, msg_t::minver, msg_t::msgid, pack32(), pack64(), packaddr(), msg_t::priority, room_array< T >::size(), and msg_t::timeout.
Referenced by msg_rpc_connection::send_msg(), and msg_sock_connection::v_do_job().
unpacks message fill msg_cpp fields taking information from block part
- Parameters:
-
key |
private symmetric key, optional |
Definition at line 109 of file msg_cpp.cpp.
References _block, _block_body_offset(), _body, _marker, _receiver, _sender, _sessionid, _size, exception::_throw(), _timestamp, _type, block_size(), crypt_size(), msg_t::majver, msg_t::minver, MSG_RESULT_INVALID_MSGFORMAT, msg_t::msgid, msgMsgTable, msg_t::priority, room_array< T >::size(), msg_t::timeout, unpack32(), unpack64(), and unpackaddr().
Referenced by msg_sock_connection::v_on_receive().
bool msg_cpp::resize |
( |
size_t |
size_ |
) |
|
resizes body size save previous part, if any
- Parameters:
-
Definition at line 168 of file msg_cpp.cpp.
References _allocator, _block, _block_body_offset(), _body, _size, byte_allocator::allocate(), block_size(), and pack32().
Referenced by msg_pack::make_error_msg(), msg_cpp(), and msg_communicator::resize_msg().
size_t msg_cpp::get_size |
( |
|
) |
const [inline] |
const ub1_t* msg_cpp::get_body |
( |
|
) |
const [inline] |
ub1_t* msg_cpp::get_body |
( |
|
) |
[inline] |
returns pointer to body - writable version
Definition at line 172 of file msg_cpp.h.
References _body.
const ub1_t* msg_cpp::get_block |
( |
|
) |
const [inline] |
ub1_t* msg_cpp::get_block |
( |
|
) |
[inline] |
returna pointer to block - writable version
Definition at line 186 of file msg_cpp.h.
References _block.
static size_t msg_cpp::estimate_size |
( |
size_t |
size_ |
) |
[inline, static] |
static size_t msg_cpp::crypt_size |
( |
size_t |
size_ |
) |
[inline, static] |
static size_t msg_cpp::block_size |
( |
size_t |
size_ |
) |
[inline, static] |
static size_t msg_cpp::_block_body_offset |
( |
|
) |
[inline, static, private] |
static ub4_t msg_cpp::reverse32 |
( |
ub4_t |
value |
) |
[inline, static] |
network byte order 4 bytes
- Parameters:
-
Definition at line 237 of file msg_cpp.h.
static ub2_t msg_cpp::reverse16 |
( |
ub2_t |
value |
) |
[inline, static] |
network byte order 2 bytes
- Parameters:
-
Definition at line 247 of file msg_cpp.h.
static size_t msg_cpp::pack32 |
( |
ub1_t *& |
dest, |
|
|
ub4_t |
x | |
|
) |
| | [inline, static] |
copies 4 bytes to the buffer in network format and move pointer to the buffer
- Parameters:
-
dest |
buffer pointer |
x |
input value |
Definition at line 258 of file msg_cpp.h.
Referenced by pack_msg(), packaddr(), and resize().
static size_t msg_cpp::unpack32 |
( |
const ub1_t *& |
x, |
|
|
ub4_t & |
dest | |
|
) |
| | [inline, static] |
copies 4 bytes from the buffer in host format and move pointer to the buffer
- Parameters:
-
x |
input buffer pointer |
dest |
[out] value |
Definition at line 272 of file msg_cpp.h.
Referenced by unpack_msg(), and unpackaddr().
static size_t msg_cpp::pack16 |
( |
ub1_t *& |
dest, |
|
|
ub2_t |
x | |
|
) |
| | [inline, static] |
copies 2 bytes to the buffer in network format and move pointer to the buffer
- Parameters:
-
dest |
output buffer pointer |
x |
input value |
Definition at line 287 of file msg_cpp.h.
Referenced by packaddr().
static size_t msg_cpp::unpack16 |
( |
const ub1_t *& |
x, |
|
|
ub2_t & |
dest | |
|
) |
| | [inline, static] |
copies 2 bytes from the buffer in host format and move pointer to the buffer
- Parameters:
-
x |
input buffer pointer |
dest |
[out] value |
Definition at line 302 of file msg_cpp.h.
Referenced by unpackaddr().
static size_t msg_cpp::packaddr |
( |
ub1_t *& |
dest, |
|
|
const guid_t & |
x | |
|
) |
| | [inline, static] |
static size_t msg_cpp::unpackaddr |
( |
const ub1_t *& |
x, |
|
|
guid_t & |
dest | |
|
) |
| | [inline, static] |
static size_t msg_cpp::pack64 |
( |
ub1_t *& |
dest, |
|
|
const ub8_t & |
x | |
|
) |
| | [inline, static] |
copies 8 bytes (double format) to the buffer in network format and move pointer to the buffer
- Parameters:
-
dest |
output buffer pointer |
x |
input value |
Definition at line 355 of file msg_cpp.h.
Referenced by pack_msg().
static size_t msg_cpp::unpack64 |
( |
const ub1_t *& |
x, |
|
|
ub8_t & |
dest | |
|
) |
| | [inline, static] |
copies 8 bytes (double format) from the buffer in host format and move pointer to the buffer
- Parameters:
-
x |
input buffer pointer |
dest |
[out] value |
Definition at line 371 of file msg_cpp.h.
Referenced by unpack_msg().
Member Data Documentation
type of message (system, handshake, user ...)
Definition at line 382 of file msg_cpp.h.
Referenced by msg_communicator::check_handshake(), msg_communicator::comm_msg(), msg_communicator::construct_handshake(), msg_communicator::construct_ping(), msg_communicator::copy_msg(), msg_pack::make_reply_msg(), pack_msg(), msg_connection::process_incoming_message(), msg_user_connection::push_msg(), msg_communicator::reply_handshake(), msg_rpc_connection::send_msg(), unpack_msg(), and msg_sock_connection::v_do_job().
message sender
Definition at line 385 of file msg_cpp.h.
Referenced by msg_communicator::construct_handshake(), msg_communicator::construct_ping(), msg_communicator::copy_msg(), msg_communicator::get_sender(), msg_communicator::log_msg(), msg_pack::make_reply_msg(), pack_msg(), msg_connection::prepare_handshake_reply(), msg_user_connection::process_income_message(), msg_connection::process_incoming_message(), msg_communicator::reply_handshake(), unpack_msg(), and msg_connection::validate_handshake_reply().
message receiver
Definition at line 386 of file msg_cpp.h.
Referenced by msg_communicator::check_handshake(), msg_communicator::copy_msg(), msg_communicator::log_msg(), msg_pack::make_reply_msg(), pack_msg(), msg_user_connection::post(), msg_connection::prepare_handshake_msg(), msg_communicator::reply_handshake(), msg_user_connection::send(), msg_user_connection::send_async(), msg_communicator::set_receiver(), and unpack_msg().
connection session identificator
Definition at line 387 of file msg_cpp.h.
Referenced by msg_communicator::check_handshake(), msg_communicator::comm_msg(), msg_communicator::construct_handshake(), msg_communicator::copy_msg(), pack_msg(), msg_connection::prepare_handshake_msg(), msg_connection::prepare_handshake_reply(), msg_connection::process_incoming_message(), msg_connection::push_msg(), msg_communicator::reply_handshake(), unpack_msg(), and msg_sock_connection::v_do_job().
The documentation for this class was generated from the following files:
|
|
|
|