Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

msg_connection Class Reference

base class for all types of connections More...

#include <msg_conn.h>

Inheritance diagram for msg_connection:

msg_queue_processor msg_base msg_queue< 3 > terimber_thread_employer msg_rpc_connection msg_sock_connection msg_user_connection

List of all members.

Public Member Functions

 msg_connection (msg_communicator *communicator, const conf_listener &linfo, const conf_connection &info)
 constructor for receiver
 msg_connection (msg_communicator *communicator, const conf_connection &info)
 constructor for initiator
virtual ~msg_connection ()
 destructor
virtual void push_msg (msg_cpp *msg)
 before pushing message into connection queue assigns the session id of this connection
const room_byte_tget_crypt_key ()
 returns private symmetric crypt key
void set_last_activity ()
 refreshes the last activity date
bool is_last_activity_timeout ()
 checks if it's time for ping
virtual void ping_notify ()
 inserts ping message into output queue
const conf_connectionget_info ()
 returns the connection info
const rsa * get_rsa () const
 returns RSA object pointer (optional)
bool is_connected () const
msg_cppprepare_handshake_msg ()
 prepares handshake message as a initiator
msg_cppprepare_handshake_reply (msg_cpp *msg)
 prepares handshake reply as a receiver
void validate_handshake_reply (msg_cpp *msg)
 validates handshake reply as a initiator
void process_incoming_message (msg_cpp *msg)

Protected Types

enum  msg_conn_state { CONN_STATE_CLOSE, CONN_STATE_HANDSHAKE_INITIATOR, CONN_STATE_HANDSHAKE_RECEIVER, CONN_STATE_CONNECTED }

Protected Member Functions

virtual void wakeup ()
 overrides the base functionality

Protected Attributes

conf_connection _info
 connection info
conf_listener _linfo
 listener acceptence settings
msg_conn_state _state
 connection state
rsa _rsa
 crypto object

Private Attributes

date _last_activity
 keep last activity date


Detailed Description

base class for all types of connections

Definition at line 44 of file msg_conn.h.


Member Enumeration Documentation

Enumerator:
CONN_STATE_CLOSE  close state
CONN_STATE_HANDSHAKE_INITIATOR  connection established, handshake in progress
CONN_STATE_HANDSHAKE_RECEIVER  connection accepted, handshake in progress
CONN_STATE_CONNECTED  connection is ready for sending/receiving messages

Definition at line 48 of file msg_conn.h.


Constructor & Destructor Documentation

msg_connection::msg_connection ( msg_communicator communicator,
const conf_listener linfo,
const conf_connection info 
)

constructor for receiver

Parameters:
communicator  pointer to communicator
linfo  listener acceptence settings
info  connection info

Definition at line 40 of file msg_conn.cpp.

References msg_base::_communicator, conf_connection::_crypt_external, conf_connection::_crypt_private, _info, conf_connection::_session, conf_connection::_support_crypt, and msg_communicator::get_msg_key().

msg_connection::msg_connection ( msg_communicator communicator,
const conf_connection info 
)

constructor for initiator

Parameters:
communicator  pointer to communicator
info  connection info

Definition at line 53 of file msg_conn.cpp.

References msg_base::_communicator, conf_connection::_crypt_external, conf_connection::_crypt_private, _info, conf_connection::_session, conf_connection::_support_crypt, and msg_communicator::get_msg_key().

msg_connection::~msg_connection (  )  [virtual]

destructor

Definition at line 67 of file msg_conn.cpp.

References msg_base::_communicator, msg_communicator::destroy_msg(), and msg_queue< 3 >::pop().


Member Function Documentation

void msg_connection::push_msg ( msg_cpp msg  )  [virtual]

before pushing message into connection queue assigns the session id of this connection

Parameters:
msg  message pointer

Reimplemented in msg_user_connection.

Definition at line 109 of file msg_conn.cpp.

References _info, conf_connection::_session, msg_cpp::_sessionid, and msg_queue< 3 >::push().

Referenced by ping_notify(), msg_user_connection::push_msg(), and msg_communicator::v_do_job().

const room_byte_t* msg_connection::get_crypt_key (  )  [inline]

void msg_connection::set_last_activity (  )  [inline]

bool msg_connection::is_last_activity_timeout (  )  [inline]

checks if it's time for ping

Definition at line 91 of file msg_conn.h.

References _info, _last_activity, msg_base::_mtx_res, conf_connection::_ping, and date::is_time_over().

void msg_connection::ping_notify (  )  [virtual]

inserts ping message into output queue

Reimplemented in msg_user_connection.

Definition at line 79 of file msg_conn.cpp.

References conf_connection::_address, msg_base::_communicator, _info, msg_communicator::construct_ping(), smart_pointer< C >::detach(), push_msg(), and set_last_activity().

const conf_connection& msg_connection::get_info (  )  [inline]

const rsa* msg_connection::get_rsa (  )  const [inline]

returns RSA object pointer (optional)

Definition at line 109 of file msg_conn.h.

References _info, _rsa, and conf_connection::_support_crypt.

Referenced by prepare_handshake_msg(), process_incoming_message(), ServerPostBlock(), and validate_handshake_reply().

bool msg_connection::is_connected (  )  const [inline]

Definition at line 115 of file msg_conn.h.

References _state, and CONN_STATE_CONNECTED.

msg_cpp * msg_connection::prepare_handshake_msg (  ) 

void msg_connection::validate_handshake_reply ( msg_cpp msg  ) 

void msg_connection::wakeup (  )  [protected, virtual]


Member Data Documentation

listener acceptence settings

Definition at line 144 of file msg_conn.h.

Referenced by prepare_handshake_reply(), and process_incoming_message().

rsa msg_connection::_rsa [protected]

crypto object

Definition at line 146 of file msg_conn.h.

Referenced by get_rsa().

keep last activity date

Definition at line 148 of file msg_conn.h.

Referenced by is_last_activity_timeout(), and set_last_activity().


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


© Copyright Terimber 2003-.