![]() |
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] |
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
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] |
Definition at line 1359 of file tp_over_tcp.cpp.
References protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, protlib::Thread::lock(), Log, protlib::log::LOG_CRIT, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCP::receiver_thread_starter(), protlib::TPoverTCP::recv_thread_argmap, protlib::AssocData::thread_ID, protlib::TPoverTCP::tpparam, and protlib::Thread::unlock().
Referenced by protlib::TPoverTCP::main_loop(), and protlib::TPoverTCP::master_listener_thread().
void protlib::TPoverTCP::create_new_sender_thread | ( | FastQueue * | senderqueue | ) | [private, inherited] |
Definition at line 1338 of file tp_over_tcp.cpp.
References protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, Log, protlib::log::LOG_CRIT, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCP::sender_thread_starter(), and protlib::TPoverTCP::tpparam.
Referenced by protlib::TPoverTCP::send().
AssocData * protlib::TPoverTCP::get_connection_to | ( | const appladdress & | addr | ) | [private, inherited] |
returns already existing connection or establishes a new one
get_connection_to() checks for already existing connections. If a connection exists, it returns "AssocData" and saves it in "connmap" for further use If no connection exists, a new connection to "addr" is created.
Definition at line 85 of file tp_over_tcp.cpp.
References protlib::log::color, protlib::TPoverTCP::connmap, protlib::log::DEBUG_LOG, ERRCLog, ERRLog, protlib::hostaddress::get_ip_str(), protlib::appladdress::get_port(), protlib::appladdress::get_sockaddr(), protlib::Thread::get_time_of_day(), protlib::in6_addrstr, protlib::ConnectionMap::insert(), protlib::Thread::lock(), Log, protlib::log::LOG_UNIMP, protlib::ConnectionMap::lookup(), protlib::ThreadParam::name, protlib::log::off, protlib::log::red, protlib::AssocData::shutdown, protlib::ThreadParam::sleep_time, protlib::TPoverTCPParam::source, protlib::TPoverTCPMsg::start, status, protlib::TPoverTCP::tpparam, protlib::Thread::unlock(), and protlib::Thread::wait_cond().
Referenced by protlib::TPoverTCP::tcpsend().
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:
nr | number of current thread instance |
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] |
main listener thread procedure
master listener thread: waits for incoming connections at the well-known tcp port when a connection request is received this thread spawns a receiver_thread for receiving packets from the peer at the new socket.
Definition at line 1421 of file tp_over_tcp.cpp.
References protlib::log::color, protlib::TPoverTCP::connmap, protlib::TPoverTCP::create_new_receiver_thread(), protlib::log::DEBUG_LOG, protlib::log::ERROR_LOG, protlib::log::EVENT_LOG, protlib::hostaddress::get_ip_str(), protlib::appladdress::get_port(), protlib::Thread::get_state(), protlib::log::green, protlib::in6_addrstr, protlib::log::INFO_LOG, protlib::ConnectionMap::insert(), protlib::Thread::lock(), Log, protlib::log::LOG_CRIT, protlib::log::LOG_EMERG, protlib::log::LOG_NORMAL, protlib::log::LOG_UNIMP, max_listen_queue_size, protlib::ThreadParam::name, protlib::log::off, protlib::TPoverTCPParam::port, protlib::ThreadParam::sleep_time, protlib::Thread::STATE_ABORT, protlib::Thread::STATE_STOP, status, protlib::TPoverTCP::terminate(), protlib::TPoverTCP::tpparam, and protlib::Thread::unlock().
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.
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.
argp | - assoc data and flags sig_terminate and terminated |
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.
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
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] |
receiver thread for a specific socket
Definition at line 604 of file tp_over_tcp.cpp.
References protlib::FastQueue::dequeue(), ERRLog, EVLog, protlib::Thread::fq, protlib::TPoverTCPMsg::get_appladdr(), protlib::TPoverTCPMsg::get_msgtype(), protlib::TPoverTCPMsg::get_netmsg(), protlib::TPErrorSendFailed::get_reason(), protlib::message::get_type_name(), protlib::ThreadParam::name, protlib::TPoverTCPMsg::send_data, protlib::TPoverTCPMsg::stop, protlib::TPoverTCP::tcpsend(), protlib::TPoverTCP::terminate(), protlib::TPoverTCP::tpparam, and protlib::TPError::what().
Referenced by protlib::TPoverTCP::sender_thread_starter().
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.
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
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] |
send a message to the network via TCP
sends a NetMsg to the network.
both parameters are deleted after the message was sent
Definition at line 415 of file tp_over_tcp.cpp.
References protlib::TP::check_send_args(), protlib::log::color, protlib::hostaddress::convert_to_ipv6(), protlib::TPoverTCP::debug_pdu, DLog, ERRCLog, ERRLog, EVLog, protlib::NetMsg::get_buffer(), protlib::TPoverTCP::get_connection_to(), protlib::hostaddress::get_ip_str(), protlib::appladdress::get_port(), protlib::NetMsg::get_pos(), protlib::NetMsg::get_size(), protlib::NetMsg::hexdump(), Log, protlib::log::LOG_ALERT, protlib::ThreadParam::name, protlib::log::red, protlib::TPoverTCP::send(), protlib::AssocData::shutdown, ariba::utility::Helper::sleep(), protlib::AssocData::socketfd, TCP_SEND_FAILURE, TCP_SUCCESS, protlib::TPoverTCP::tpparam, and protlib::log::WARNING_LOG.
Referenced by protlib::TPoverTCP::sender_thread().
void protlib::TPoverTCP::terminate | ( | const address & | in_addr | ) | [virtual, inherited] |
terminates a signaling association/connection
Implements protlib::TP.
Definition at line 258 of file tp_over_tcp.cpp.
References protlib::TPoverTCP::connmap, protlib::address::copy(), ERRLog, EVLog, protlib::Thread::lock(), protlib::ConnectionMap::lookup(), protlib::ThreadParam::name, protlib::AssocData::shutdown, protlib::AssocData::socketfd, protlib::TPoverTCP::stop_receiver_thread(), protlib::TPoverTCP::tpparam, protlib::Thread::unlock(), and WLog.
Referenced by protlib::TPoverTCP::master_listener_thread(), protlib::TPoverTCP::sender_thread(), and ariba::transport::tcpip::terminate().
void protlib::TPoverTCP::terminate_all_threads | ( | ) | [private, inherited] |
terminates all active receiver or sender threads
Definition at line 1232 of file tp_over_tcp.cpp.
References protlib::TPoverTCP::connmap, protlib::log::DEBUG_LOG, protlib::ConnectionMap::erase(), Log, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::peer_assoc, protlib::TPoverTCP::recv_thread_argmap, protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::sig_terminate, protlib::TPoverTCP::terminate_sender_thread(), protlib::TPoverTCP::TPoverTCP::receiver_thread_arg::terminated, and protlib::TPoverTCP::tpparam.
Referenced by protlib::TPoverTCP::main_loop().
void protlib::TPoverTCP::terminate_sender_thread | ( | const AssocData * | assoc | ) | [private, inherited] |
terminates a sender thread
Definition at line 1196 of file tp_over_tcp.cpp.
References protlib::log::ERROR_LOG, Log, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::AssocData::peer, protlib::message::send(), protlib::TPoverTCP::senderthread_queuemap, protlib::TPoverTCPParam::source, protlib::TPoverTCPMsg::stop, protlib::TPoverTCP::tpparam, and protlib::log::WARNING_LOG.
Referenced by protlib::TPoverTCP::cleanup_receiver_thread(), and protlib::TPoverTCP::terminate_all_threads().
protlib::TPoverTCP::~TPoverTCP | ( | ) | [virtual, inherited] |
virtual destructor
Definition at line 1647 of file tp_over_tcp.cpp.
References protlib::log::DEBUG_LOG, protlib::TP::init, protlib::QueueManager::instance(), Log, protlib::log::LOG_NORMAL, protlib::ThreadParam::name, protlib::TPoverTCPParam::source, protlib::TPoverTCP::tpparam, and protlib::QueueManager::unregister_queue().
char protlib::in6_addrstr[INET6_ADDRSTRLEN+1] |
Definition at line 72 of file tp_over_tcp.cpp.
Referenced by protlib::TPoverTCP::get_connection_to(), and protlib::TPoverTCP::master_listener_thread().