TP over TCP

Collaboration diagram for TP over TCP:

Classes

class  protlib::ConnectionMap
class  protlib::ConnectionMapUDS

Namespaces

namespace  protlib

Functions

AssocData * protlib::TPoverTCP::get_connection_to (const appladdress &addr)
 returns already existing connection or establishes a new one
virtual void protlib::TPoverTCP::terminate (const address &addr)
virtual void protlib::TPoverTCP::send (NetMsg *msg, const address &addr, bool use_existing_connection)
 sends a network message, spawns receiver thread if necessary
void protlib::TPoverTCP::tcpsend (NetMsg *msg, appladdress *addr)
 send a message to the network via TCP
void protlib::TPoverTCP::sender_thread (void *argp)
 receiver thread for a specific socket
void protlib::TPoverTCP::receiver_thread (void *argp)
 receiver thread for a specific socket
void protlib::TPoverTCP::stop_receiver_thread (AssocData *peer_assoc)
 terminates particular thread
void protlib::TPoverTCP::cleanup_receiver_thread (AssocData *peer_assoc)
 cleans up thread management structures
void protlib::TPoverTCP::terminate_sender_thread (const AssocData *assoc)
 terminates a sender thread
void protlib::TPoverTCP::terminate_all_threads ()
 terminates all active receiver or sender threads
static void * protlib::TPoverTCP::sender_thread_starter (void *argp)
 sender thread starter for a specific socket
static void * protlib::TPoverTCP::receiver_thread_starter (void *argp)
 receiver thread starter for a specific socket
void protlib::TPoverTCP::create_new_sender_thread (FastQueue *senderqueue)
void protlib::TPoverTCP::create_new_receiver_thread (AssocData *peer_assoc)
static void * protlib::TPoverTCP::master_listener_thread_starter (void *argp)
 a static starter method to invoke the actual main listener
void protlib::TPoverTCP::master_listener_thread ()
 main listener thread procedure
virtual protlib::TPoverTCP::~TPoverTCP ()
 virtual destructor
virtual void protlib::TPoverTCP::main_loop (uint32 nr)
 main loop

Variables

char protlib::in6_addrstr [INET6_ADDRSTRLEN+1]

Function Documentation

void protlib::TPoverTCP::cleanup_receiver_thread ( AssocData peer_assoc  )  [private, inherited]

cleans up thread management structures

cleans up left over structures (assoc,receiver_thread_arg) from already terminated receiver_thread usually called by the master_thread after the receiver_thread terminated

Note:
clean_up_receiver_thread() should be only called when an outer lock ensures that peer_assoc is still valid

Definition at line 1139 of file tp_over_tcp.cpp.

References protlib::TPoverTCP::connmap, protlib::log::DEBUG_LOG, protlib::ConnectionMap::erase(), protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, Log, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCP::recv_thread_argmap, protlib::TPoverTCP::terminate_sender_thread(), protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::terminated, protlib::AssocData::thread_ID, and protlib::TPoverTCP::tpparam.

Referenced by protlib::TPoverTCP::main_loop().

void protlib::TPoverTCP::create_new_receiver_thread ( AssocData peer_assoc  )  [private, inherited]

void protlib::TPoverTCP::create_new_sender_thread ( FastQueue senderqueue  )  [private, inherited]

AssocData * protlib::TPoverTCP::get_connection_to ( const appladdress addr  )  [private, inherited]

void protlib::TPoverTCP::main_loop ( uint32  nr  )  [virtual, inherited]

main loop

TPoverTCP Thread main loop. This loop checks for internal messages of either a send() call to start a new receiver thread, or, of a receiver_thread() that signals its own termination for proper cleanup of control structures. It also handles the following internal TPoverTCPMsg types:

Implements protlib::Thread.

Definition at line 1667 of file tp_over_tcp.cpp.

References protlib::TPoverTCP::cleanup_receiver_thread(), protlib::TPoverTCP::create_new_receiver_thread(), protlib::log::DEBUG_LOG, protlib::FastQueue::dequeue_timedwait(), protlib::log::ERROR_LOG, protlib::Thread::fq, protlib::Thread::get_fqueue(), protlib::TPoverTCPMsg::get_msgtype(), protlib::TPoverTCPMsg::get_peer_assoc(), protlib::message::get_source(), protlib::Thread::get_state(), protlib::log::INFO_LOG, protlib::QueueManager::instance(), protlib::Thread::lock(), Log, protlib::log::LOG_CRIT, protlib::log::LOG_NORMAL, protlib::TPoverTCP::master_listener_thread_starter(), protlib::ThreadParam::name, protlib::QueueManager::register_queue(), protlib::FastQueue::shutdown(), protlib::TPoverTCPParam::source, protlib::TPoverTCPMsg::start, protlib::Thread::STATE_ABORT, protlib::Thread::STATE_STOP, protlib::TPoverTCPMsg::stop, protlib::TPoverTCP::terminate_all_threads(), protlib::AssocData::thread_ID, protlib::TPoverTCP::tpparam, and protlib::Thread::unlock().

void protlib::TPoverTCP::master_listener_thread (  )  [private, inherited]

void * protlib::TPoverTCP::master_listener_thread_starter ( void *  argp  )  [static, private, inherited]

a static starter method to invoke the actual main listener

master listener thread starter: just a static starter method to allow starting the actual master_listener_thread() method.

Parameters:
argp - pointer to the current TPoverTCP object instance

Definition at line 1403 of file tp_over_tcp.cpp.

Referenced by protlib::TPoverTCP::main_loop().

void protlib::TPoverTCP::receiver_thread ( void *  argp  )  [private, inherited]

receiver thread for a specific socket

receiver thread listens at a TCP socket for incoming PDUs and passes complete PDUs to the coordinator. Incomplete PDUs due to aborted connections or buffer overflows are discarded.

Parameters:
argp - assoc data and flags sig_terminate and terminated
Note:
this is a static member function, so you cannot use class variables

receive data from socket buffer (recv will not block)

< buffer space exhausted now

< common header not parsed

Definition at line 679 of file tp_over_tcp.cpp.

References protlib::TP::common_header_length, protlib::appladdress::copy(), protlib::log::DEBUG_LOG, protlib::TPoverTCP::debug_pdu, protlib::TPoverTCPParam::dest, DLog, ERRCLog, protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, EVLog, protlib::NetMsg::get_buffer(), protlib::message::get_id(), protlib::TPMsg::get_peeraddress(), protlib::message::get_qaddr_name(), protlib::NetMsg::get_size(), protlib::TP::getmsglength, protlib::NetMsg::hexdump(), Log, protlib::log::LOG_CRIT, protlib::log::LOG_NORMAL, protlib::log::LOG_UNIMP, protlib::NetMsg::max_size, protlib::ThreadParam::name, protlib::AssocData::ownaddr, protlib::AssocData::peer, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::peer_assoc, protlib::message::qaddr_tp_over_tcp, protlib::message::send(), protlib::message::send_to(), protlib::AssocData::shutdown, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::sig_terminate, protlib::ThreadParam::sleep_time, protlib::AssocData::socketfd, protlib::TPoverTCPParam::source, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::terminated, protlib::TPoverTCP::tpparam, protlib::NetMsg::truncate(), protlib::log::WARNING_LOG, and WLog.

Referenced by protlib::TPoverTCP::receiver_thread_starter().

void * protlib::TPoverTCP::receiver_thread_starter ( void *  argp  )  [static, private, inherited]

receiver thread starter for a specific socket

receiver thread starter: just a static starter method to allow starting the actual receiver_thread() method.

Parameters:
argp - pointer to the current TPoverTCP object instance and receiver_thread_arg_t struct

Definition at line 1317 of file tp_over_tcp.cpp.

References protlib::log::ERROR_LOG, protlib::TPoverTCP::TPoverTCP::receiver_thread_start_arg_t::instance, Log, protlib::log::LOG_CRIT, protlib::TPoverTCP::receiver_thread(), and protlib::TPoverTCP::TPoverTCP::receiver_thread_start_arg_t::rtargp.

Referenced by protlib::TPoverTCP::create_new_receiver_thread().

void protlib::TPoverTCP::send ( NetMsg netmsg,
const address in_addr,
bool  use_existing_connection 
) [virtual, inherited]

sends a network message, spawns receiver thread if necessary

generates and internal TPoverTCP message to send a NetMsg to the network

  • it is necessary to let a thread do this, because the caller may get blocked if the connect() or send() call hangs for a while
  • the sending thread will call TPoverTCP::tcpsend()
  • if no connection exists, creates a new one (unless use_existing_connection is true)
    Note:
    the netmsg is deleted by the send() method when it is not used anymore

Implements protlib::TP.

Definition at line 324 of file tp_over_tcp.cpp.

References protlib::TPoverTCP::connmap, protlib::address::copy(), protlib::TPoverTCP::create_new_sender_thread(), DLog, ERRCLog, protlib::address::get_type(), protlib::Thread::lock(), protlib::ConnectionMap::lookup(), protlib::ThreadParam::name, protlib::message::send(), protlib::TPoverTCP::senderthread_queuemap, protlib::AssocData::shutdown, protlib::AssocData::socketfd, protlib::TPoverTCPParam::source, protlib::TPoverTCP::tpparam, protlib::Thread::unlock(), and WLog.

Referenced by ariba::transport::tcpip::send(), and protlib::TPoverTCP::tcpsend().

void protlib::TPoverTCP::sender_thread ( void *  argp  )  [private, inherited]

void * protlib::TPoverTCP::sender_thread_starter ( void *  argp  )  [static, private, inherited]

sender thread starter for a specific socket

sender thread starter: just a static starter method to allow starting the actual sender_thread() method.

Parameters:
argp - pointer to the current TPoverTCP object instance and receiver_thread_arg_t struct

Definition at line 1282 of file tp_over_tcp.cpp.

References protlib::log::ERROR_LOG, protlib::TPoverTCP::TPoverTCP::sender_thread_start_arg_t::instance, Log, protlib::log::LOG_CRIT, protlib::TPoverTCP::sender_thread(), and protlib::TPoverTCP::TPoverTCP::sender_thread_start_arg_t::sender_thread_queue.

Referenced by protlib::TPoverTCP::create_new_sender_thread().

void protlib::TPoverTCP::stop_receiver_thread ( AssocData peer_assoc  )  [private, inherited]

terminates particular thread

this signals a terminate to a thread and wait for the thread to stop

Note:
it is not safe to access any thread related data after this method returned, because the receiver thread will initiate a cleanup_receiver_thread() method which may erase all relevant thread data.

Definition at line 1096 of file tp_over_tcp.cpp.

References protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, Log, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCP::recv_thread_argmap, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::sig_terminate, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::terminated, protlib::AssocData::thread_ID, and protlib::TPoverTCP::tpparam.

Referenced by protlib::TPoverTCP::terminate().

void protlib::TPoverTCP::tcpsend ( NetMsg netmsg,
appladdress addr 
) [private, inherited]

void protlib::TPoverTCP::terminate ( const address in_addr  )  [virtual, inherited]

void protlib::TPoverTCP::terminate_all_threads (  )  [private, inherited]

void protlib::TPoverTCP::terminate_sender_thread ( const AssocData assoc  )  [private, inherited]

protlib::TPoverTCP::~TPoverTCP (  )  [virtual, inherited]


Variable Documentation

char protlib::in6_addrstr[INET6_ADDRSTRLEN+1]


Generated on Fri Aug 14 23:38:34 2009 for Ariba by  doxygen 1.5.8