|
|
|
Home / Open source / Terimber 2.0
aiomsg Class Referenceimplements terimber_aiomsg interface
More...
#include <msgimpl.h>
List of all members.
|
Public Member Functions |
| aiomsg () |
| constructor
|
virtual | ~aiomsg () |
| destructor
|
virtual bool | init (const char *info, const char *ini_key) |
| initial functions to activate and deactivate message transport
|
virtual bool | init (const void *buffer, size_t len) |
| initial functions to activate and deactivate message transport
|
virtual bool | uninit () |
| function uninitializes the message port
|
virtual bool | start (msg_callback_notify *callback, size_t additional_thread_count) |
| function for activate and deactivate callback port it make sense to specify additional_thread_count > 0 if the order incoming messages doesn't matter otherwise specify additional_thread_count = 0 and process incoming messages one by one in order as they arrived
|
virtual bool | stop () |
| function stops message processing
|
virtual const char * | get_port_error () const |
| messages port error function
|
virtual const guid_t & | get_port_address () const |
| returns the port address - comes from init file
|
virtual msg_t * | construct (size_t size) |
| internal allocate, reallocate, and free memory caller has to create ALL messages through construct function and call destroy function to free memory returns pointer to the message object or null
|
virtual bool | resize (msg_t *msg, size_t size) |
| resizes the message the old memory will be preserved
|
virtual bool | destroy (msg_t *msg) |
| destroys message
|
virtual size_t | get_size (const msg_t *msg) const |
| messages content management functions function returns the message size
|
virtual bool | write_buffer (msg_t *msg, size_t offset, const void *buf, size_t len) |
| function returns true if offset + len <= message size (see resize function)
|
virtual const void * | get_buffer (const msg_t *msg) const |
| constant variant of previous function
|
virtual bool | set_receiver (msg_t *msg, const guid_t &receiver) |
| messages from/to settings
|
virtual bool | get_sender (const msg_t *msg, guid_t &sender) const |
| gets sender address
|
virtual bool | send (bool copy, msg_t *msg, msg_t **reply) |
| function sends message and waits for the reply for timeout milliseconds (garantee delivery) if function returns false the caller is still responsible for message destruction regardless the copy parameter value
|
virtual guid_t | send_async (bool copy, msg_t *msg) |
| function sends message asynchronically (garantee delivery) and returns unique identificator (zero means error) which will be used as input parameter for asynchronous callback function if function returns zero the caller is still responsible for message destruction regardless the copy parameter value retun value, if non zero is unique identificator, which will be used for firing asynchronous reply, see above
|
virtual bool | post (bool copy, msg_t *msg) |
| function post message and don't wait for a reply - this is a non-garantee delivery if function returns false the caller is still responsible for message destruction regardless the copy parameter value
|
virtual bool | add_connection (const char *xml_description) |
| additional functionality to manage connections dynamically - xml string describes connection as xml node of follow XDTD extended DTD <!ENTITY % kind "(rpc | sock | p2p)"> <!ELEMENT connection EMPTY> <!ATTLIST connection address CTYPE vt_guid REQUIRED port CTYPE vt_ub2 IMPLIED network CDATA IMPLIED ping CTYPE vt_ub4 IMPLIED info CDATA IMPLIED security CTYPE vt_bool IMPLIED password CDATA IMPLIED > encpytion is reserved for production version
|
virtual bool | add_listener (const char *xml_description) |
| additional functionality to manage listeners dynamically extended DTD <!ELEMENT listener (accept | reject)?> <!ELEMENT reject (peer)+> <!ELEMENT accept (peer)+> <!ELEMENT peer EMPTY> <!ATTLIST peer address CTYPE vt_guid REQUIRED security CTYPE vt_bool IMPLIED password CDATA IMPLIED > <!ATTLIST listener port CTYPE vt_ub2 IMPLIED network CDATA IMPLIED connections CTYPE vt_ub4 IMPLIED ping CTYPE vt_ub4 IMPLIED waste CTYPE vt_ub4 IMPLIED info CDATA IMPLIED security CTYPE vt_bool IMPLIED password CDATA IMPLIED >
|
virtual bool | remove_connection (const guid_t &address) |
| removes connection dynamically
|
virtual bool | remove_listener (const char *type) |
| removes listener dynamically
|
virtual void | doxray () |
| do xray
|
Private Member Functions |
void | check_on () const |
| checks if communicator is on NB!!! throws exception
|
void | check_ident () const |
| checks validity of user connection NB!!! throws exception
|
Private Attributes |
msg_communicator | _communicator |
| messages communicator
|
string_t | _error |
| last error
|
mutex | _mtx |
| mutex
|
msg_user_connection * | _user_conn |
| pointer to user connection
|
Detailed Description
implements terimber_aiomsg interface
Definition at line 40 of file msgimpl.h.
Constructor & Destructor Documentation
BEGIN_TERIMBER_NAMESPACE aiomsg::aiomsg |
( |
|
) |
|
aiomsg::~aiomsg |
( |
|
) |
[virtual] |
Member Function Documentation
bool aiomsg::init |
( |
const char * |
info, |
|
|
const char * |
ini_key | |
|
) |
| | [virtual] |
bool aiomsg::init |
( |
const void * |
buffer, |
|
|
size_t |
len | |
|
) |
| | [virtual] |
bool aiomsg::uninit |
( |
|
) |
[virtual] |
bool aiomsg::start |
( |
msg_callback_notify * |
callback, |
|
|
size_t |
additional_thread_count | |
|
) |
| | [virtual] |
function for activate and deactivate callback port it make sense to specify additional_thread_count > 0 if the order incoming messages doesn't matter otherwise specify additional_thread_count = 0 and process incoming messages one by one in order as they arrived
- Parameters:
-
callback |
pointer to the callback class instance |
additional_thread_count |
user defines how many threads can call incoming callback function at the same time |
Implements terimber_aiomsg.
Definition at line 169 of file msgimpl.cpp.
References conf_connection::_address, _communicator, _error, _mtx, conf_connection::_ping, _user_conn, check_on(), msg_user_connection::connect(), msg_communicator::get_address(), msg_base::on(), and stop().
bool aiomsg::stop |
( |
|
) |
[virtual] |
const char * aiomsg::get_port_error |
( |
|
) |
const [virtual] |
const guid_t & aiomsg::get_port_address |
( |
|
) |
const [virtual] |
msg_t * aiomsg::construct |
( |
size_t |
size |
) |
[virtual] |
bool aiomsg::resize |
( |
msg_t * |
msg, |
|
|
size_t |
size | |
|
) |
| | [virtual] |
bool aiomsg::destroy |
( |
msg_t * |
msg |
) |
[virtual] |
size_t aiomsg::get_size |
( |
const msg_t * |
msg |
) |
const [virtual] |
bool aiomsg::write_buffer |
( |
msg_t * |
msg, |
|
|
size_t |
offset, |
|
|
const void * |
buf, |
|
|
size_t |
len | |
|
) |
| | [virtual] |
const void * aiomsg::get_buffer |
( |
const msg_t * |
msg |
) |
const [virtual] |
bool aiomsg::set_receiver |
( |
msg_t * |
msg, |
|
|
const guid_t & |
receiver | |
|
) |
| | [virtual] |
bool aiomsg::get_sender |
( |
const msg_t * |
msg, |
|
|
guid_t & |
sender | |
|
) |
| | const [virtual] |
bool aiomsg::send |
( |
bool |
copy, |
|
|
msg_t * |
msg, |
|
|
msg_t ** |
reply | |
|
) |
| | [virtual] |
function sends message and waits for the reply for timeout milliseconds (garantee delivery) if function returns false the caller is still responsible for message destruction regardless the copy parameter value
Transport functions - Parameters:
-
copy |
if set to true, the function will make a copy of the message and caller can reuse message again |
msg |
otherwise message port will take care about it pointer to message to be sent, if function returns true and copy == false then message port is responsible for message destruction |
reply |
returns the reply from receiver, caller is responsible to destroy the reply message |
Implements terimber_aiomsg.
Definition at line 366 of file msgimpl.cpp.
References _communicator, _error, _mtx, _user_conn, msg_communicator::cast(), check_ident(), check_on(), msg_communicator::destroy_msg(), msg_user_connection::get_last_error(), and msg_user_connection::send().
guid_t aiomsg::send_async |
( |
bool |
copy, |
|
|
msg_t * |
msg | |
|
) |
| | [virtual] |
function sends message asynchronically (garantee delivery) and returns unique identificator (zero means error) which will be used as input parameter for asynchronous callback function if function returns zero the caller is still responsible for message destruction regardless the copy parameter value retun value, if non zero is unique identificator, which will be used for firing asynchronous reply, see above
- Parameters:
-
copy |
if set to true, the function will make a copy of the message and caller can reuse message again |
msg |
otherwise message port will take care about it pointer to message to be sent, if function returns true and copy == false then message port is responsible for message destruction |
Implements terimber_aiomsg.
Definition at line 395 of file msgimpl.cpp.
References _communicator, _error, _mtx, _user_conn, msg_communicator::cast(), check_ident(), check_on(), msg_user_connection::get_last_error(), null_uuid, and msg_user_connection::send_async().
bool aiomsg::post |
( |
bool |
copy, |
|
|
msg_t * |
msg | |
|
) |
| | [virtual] |
bool aiomsg::add_connection |
( |
const char * |
xml_description |
) |
[virtual] |
bool aiomsg::add_listener |
( |
const char * |
xml_description |
) |
[virtual] |
bool aiomsg::remove_connection |
( |
const guid_t & |
address |
) |
[virtual] |
bool aiomsg::remove_listener |
( |
const char * |
type |
) |
[virtual] |
void aiomsg::doxray |
( |
|
) |
[virtual] |
void aiomsg::check_on |
( |
|
) |
const [private] |
checks if communicator is on NB!!! throws exception
Definition at line 565 of file msgimpl.cpp.
References _communicator, and msg_base::is_on().
Referenced by add_connection(), add_listener(), construct(), destroy(), get_buffer(), get_sender(), get_size(), post(), remove_connection(), remove_listener(), resize(), send(), send_async(), set_receiver(), start(), and write_buffer().
void aiomsg::check_ident |
( |
|
) |
const [private] |
Member Data Documentation
messages communicator
Definition at line 248 of file msgimpl.h.
Referenced by add_connection(), add_listener(), check_ident(), check_on(), construct(), destroy(), doxray(), get_port_address(), init(), remove_connection(), remove_listener(), resize(), send(), send_async(), start(), stop(), and uninit().
last error
Definition at line 249 of file msgimpl.h.
Referenced by add_connection(), add_listener(), construct(), destroy(), get_buffer(), get_port_error(), get_sender(), get_size(), init(), post(), remove_connection(), remove_listener(), resize(), send(), send_async(), set_receiver(), start(), stop(), uninit(), and write_buffer().
mutex
Definition at line 250 of file msgimpl.h.
Referenced by add_connection(), add_listener(), construct(), destroy(), get_buffer(), get_sender(), get_size(), init(), post(), remove_connection(), remove_listener(), resize(), send(), send_async(), set_receiver(), start(), stop(), uninit(), and write_buffer().
The documentation for this class was generated from the following files:
|
|
|
|