OpenDDS
Snapshot(2023/04/07-19:43)
|
#include <TransportImpl.h>
Classes | |
struct | AcceptConnectResult |
struct | ConnectionAttribs |
struct | DoClear |
struct | RemoteTransport |
Public Attributes | |
LockType | lock_ |
Lock to protect the config_ and reactor_task_ data members. More... | |
WeakRcHandle< TransportInst > | config_ |
ReactorTask_rch | reactor_task_ |
EventDispatcher_rch | event_dispatcher_ |
smart ptr to the associated DL cleanup task More... | |
unique_ptr< Monitor > | monitor_ |
Monitor object for this entity. More... | |
Protected Types | |
typedef ACE_SYNCH_MUTEX | LockType |
typedef ACE_Guard< LockType > | GuardType |
Protected Member Functions | |
TransportImpl (TransportInst_rch config) | |
bool | open () |
virtual AcceptConnectResult | connect_datalink (const RemoteTransport &remote, const ConnectionAttribs &attribs, const TransportClient_rch &client)=0 |
virtual AcceptConnectResult | accept_datalink (const RemoteTransport &remote, const ConnectionAttribs &attribs, const TransportClient_rch &client)=0 |
virtual void | stop_accepting_or_connecting (const TransportClient_wrch &client, const GUID_t &remote_id, bool disassociate, bool association_failed)=0 |
virtual void | shutdown_i ()=0 |
typedef | OPENDDS_MULTIMAP (TransportClient_wrch, DataLink_rch) PendConnMap |
void | add_pending_connection (const TransportClient_rch &client, DataLink_rch link) |
void | shutdown () |
![]() | |
RcObject () | |
Protected Attributes | |
LockType | pending_connections_lock_ |
Lock to protect the pending_connections_ data member. More... | |
PendConnMap | pending_connections_ |
AtomicBool | is_shut_down_ |
Id of the last link established. More... | |
Private Member Functions | |
virtual void | release_datalink (DataLink *link)=0 |
virtual void | client_stop (const GUID_t &) |
DataLink * | find_connect_i (const GUID_t &local_id, const AssociationData &remote_association, const ConnectionAttribs &attribs, bool active, bool connect) |
virtual void | local_crypto_handle (DDS::Security::ParticipantCryptoHandle) |
Friends | |
class | TransportInst |
class | TransportClient |
class | DataLink |
The TransportImpl class includes the abstract methods that must be implemented by any implementation to provide data delivery service to the DCPS implementation. This includes methods to send data, received data, configure the operation, and manage associations and datalinks between local and remote objects of the implementation.
Notes about object ownership: 1)Has longer lifetime than the publisher and subscriber objects. The publishers and subscribers are owned by the DomainParticipant and transport factory shutdown is always after DomainParticipant factory shutdown. 2)The concrete transport object owns the datalink objects. 3)Own a DataLinkCleanup object. 4)Reference to TransportInst object and TransportReactorTask object owned by TransportRegistry. 5)During transport shutdown, if this object does not have ownership of an object but has a references via smart pointer then the reference should be freed; if this object has ownership of task objects then the tasks should be closed.
Definition at line 64 of file TransportImpl.h.
|
protected |
Definition at line 228 of file TransportImpl.h.
|
protected |
Definition at line 227 of file TransportImpl.h.
|
virtual |
Definition at line 44 of file TransportImpl.cpp.
References DBG_ENTRY_LVL, event_dispatcher_, and OpenDDS::DCPS::EventDispatcher::shutdown().
|
protected |
Definition at line 33 of file TransportImpl.cpp.
References DBG_ENTRY_LVL, monitor_, and TheServiceParticipant.
|
protectedpure virtual |
accept_datalink() is called from TransportClient to initiate an association as the passive peer. A DataLink may be returned if one is already connected and ready to use, otherwise passively wait for a physical connection from the active side (either in the form of a connection event or handshaking message). Upon completion of the physical connection, the transport calls back to TransportClient::use_datalink().
Implemented in OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by OpenDDS::DCPS::TransportClient::associate().
int OpenDDS::DCPS::TransportImpl::acquire | ( | ) |
Called by our friends, the TransportClient, and the DataLink. Since this TransportImpl can be attached to many TransportClient objects, and each TransportClient object could be "running" in a separate thread, we need to protect all of the "reservation" methods with a lock. The protocol is that a client of ours must "acquire" our reservation_lock_ before it can proceed to call any methods that affect the DataLink reservations. It should release the reservation_lock_ as soon as it is done.
|
protected |
Definition at line 93 of file TransportImpl.cpp.
References pending_connections_, and pending_connections_lock_.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::accept_datalink(), OpenDDS::DCPS::TcpTransport::accept_datalink(), OpenDDS::DCPS::ShmemTransport::connect_datalink(), OpenDDS::DCPS::RtpsUdpTransport::connect_datalink(), and OpenDDS::DCPS::TcpTransport::connect_datalink().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 114 of file TransportImpl.h.
References name, and OPENDDS_STRING.
|
inlineprivatevirtual |
Reimplemented in OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::RtpsUdpTransport, and OpenDDS::DCPS::MulticastTransport.
Definition at line 258 of file TransportImpl.h.
References connect().
Referenced by OpenDDS::DCPS::TransportClient::transport_stop().
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE OpenDDS::DCPS::TransportInst_rch OpenDDS::DCPS::TransportImpl::config | ( | ) | const |
Expose the configuration information so others can see what we can do.
Definition at line 19 of file TransportImpl.inl.
References ACE_INLINE, and config_.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::config(), OpenDDS::DCPS::UdpTransport::config(), OpenDDS::DCPS::MulticastTransport::config(), OpenDDS::DCPS::ShmemTransport::config(), OpenDDS::DCPS::TcpTransport::config(), OpenDDS::DCPS::DataLink::DataLink(), and OpenDDS::DCPS::TransportSendStrategy::TransportSendStrategy().
|
protectedpure virtual |
connect_datalink() is called from TransportClient to initiate an association as the active peer. A DataLink may be returned if one is already connected and ready to use, otherwise initiate a connection to the passive side and return from this method. Upon completion of the physical connection, the transport calls back to TransportClient::use_datalink().
Implemented in OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by OpenDDS::DCPS::TransportClient::initiate_connect_i().
ACE_INLINE bool OpenDDS::DCPS::TransportImpl::connection_info | ( | TransportLocator & | local_info, |
ConnectionInfoFlags | flags | ||
) | const |
Called by our friend, the TransportClient. Accessor for the TransportInterfaceInfo. Accepts a reference to a TransportInterfaceInfo object that will be "populated" with this TransportImpl's connection information (ie, how another process would connect to this TransportImpl).
Definition at line 52 of file TransportImpl.inl.
References connection_info_i(), and OPENDDS_END_VERSIONED_NAMESPACE_DECL.
Referenced by OpenDDS::DCPS::TransportClient::populate_connection_info(), and reactor_owner().
|
pure virtual |
Called by our connection_info() method to allow the concrete TransportImpl subclass to do the dirty work since it really is the one that knows how to populate the supplied TransportLocator object.
Implemented in OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by connection_info().
void OpenDDS::DCPS::TransportImpl::create_reactor_task | ( | bool | useAsyncSend = false , |
const OPENDDS_STRING & | name = "" |
||
) |
Create the reactor task using sync send or optionally async send by parameter on supported Windows platforms only.
Definition at line 100 of file TransportImpl.cpp.
References OpenDDS::DCPS::RcHandle< T >::in(), is_shut_down_, name, OpenDDS::DCPS::ReactorTask::open_reactor_task(), reactor_task_, and TheServiceParticipant.
Referenced by OpenDDS::DCPS::UdpTransport::configure_i(), OpenDDS::DCPS::MulticastTransport::configure_i(), OpenDDS::DCPS::ShmemTransport::configure_i(), OpenDDS::DCPS::RtpsUdpTransport::configure_i(), and OpenDDS::DCPS::TcpTransport::configure_i().
void OpenDDS::DCPS::TransportImpl::dump | ( | void | ) |
Diagnostic aid.
Definition at line 143 of file TransportImpl.cpp.
References ACE_DEBUG, ACE_TEXT(), dump_to_str(), LM_DEBUG, and OPENDDS_STRING.
Referenced by OpenDDS::DCPS::TransportSendStrategy::direct_send().
OPENDDS_STRING OpenDDS::DCPS::TransportImpl::dump_to_str | ( | ) |
Definition at line 151 of file TransportImpl.cpp.
References config_, OpenDDS::DCPS::TransportInst::dump_to_str(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, and OPENDDS_STRING.
Referenced by dump(), and open().
|
inline |
Definition at line 182 of file TransportImpl.h.
References open().
Referenced by OpenDDS::DCPS::TransportInst::event_dispatcher().
|
private |
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 172 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::get_ice_endpoint(), OpenDDS::DCPS::TransportInst::get_ice_endpoint(), and OpenDDS::DCPS::RtpsUdpDataLink::get_ice_endpoint().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 110 of file TransportImpl.h.
bool OpenDDS::DCPS::TransportImpl::is_shut_down | ( | ) | const |
Definition at line 51 of file TransportImpl.cpp.
References is_shut_down_.
Referenced by OpenDDS::DCPS::UdpTransport::accept_datalink(), OpenDDS::DCPS::RtpsUdpTransport::accept_datalink(), OpenDDS::DCPS::TcpTransport::accept_datalink(), OpenDDS::DCPS::TransportClient::associate(), OpenDDS::DCPS::UdpTransport::connect_datalink(), OpenDDS::DCPS::RtpsUdpTransport::connect_datalink(), OpenDDS::DCPS::TcpTransport::connect_datalink(), OpenDDS::DCPS::TcpTransport::fresh_link(), OpenDDS::DCPS::RtpsUdpTransport::get_last_recv_locator(), OpenDDS::DCPS::TcpTransport::passive_connection(), OpenDDS::DCPS::ShmemTransport::read_from_links(), OpenDDS::DCPS::RtpsUdpTransport::register_for_reader(), OpenDDS::DCPS::RtpsUdpTransport::register_for_writer(), OpenDDS::DCPS::TransportSendStrategy::send_delayed_notifications(), OpenDDS::DCPS::ShmemTransport::signal_semaphore(), and OpenDDS::DCPS::RtpsUdpTransport::update_locators().
|
inlineprivatevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 266 of file TransportImpl.h.
References OPENDDS_STRING, and release().
Referenced by OpenDDS::DCPS::TransportClient::enable_transport_using_config().
|
protected |
Definition at line 75 of file TransportImpl.cpp.
References ACE_DEBUG, ACE_TEXT(), dump_to_str(), LM_DEBUG, monitor_, and OpenDDS::DCPS::Transport_debug_level.
Referenced by OpenDDS::DCPS::MulticastTransport::MulticastTransport(), OpenDDS::DCPS::RtpsUdpTransport::RtpsUdpTransport(), OpenDDS::DCPS::ShmemTransport::ShmemTransport(), OpenDDS::DCPS::TcpTransport::TcpTransport(), and OpenDDS::DCPS::UdpTransport::UdpTransport().
|
protected |
ACE_INLINE ACE_Reactor * OpenDDS::DCPS::TransportImpl::reactor | ( | void | ) | const |
Definition at line 38 of file TransportImpl.inl.
References ACE_INLINE, OpenDDS::DCPS::ReactorTask::get_reactor(), OpenDDS::DCPS::RcHandle< T >::is_nil(), and reactor_task_.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i(), and timer().
ACE_INLINE ACE_thread_t OpenDDS::DCPS::TransportImpl::reactor_owner | ( | ) | const |
Definition at line 45 of file TransportImpl.inl.
References ACE_INLINE, connection_info(), OpenDDS::DCPS::ReactorTask::get_reactor_owner(), ACE_OS::NULL_thread, and reactor_task_.
ACE_INLINE OpenDDS::DCPS::ReactorTask_rch OpenDDS::DCPS::TransportImpl::reactor_task | ( | ) |
Accessor to obtain a "copy" of the reference to the reactor task. Caller is responsible for the "copy" of the reference that is returned.
Definition at line 25 of file TransportImpl.inl.
References ACE_INLINE, DBG_ENTRY_LVL, and reactor_task_.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i(), OpenDDS::DCPS::TcpTransport::configure_i(), OpenDDS::DCPS::TcpTransport::connect_tcp_datalink(), OpenDDS::DCPS::UdpTransport::make_datalink(), OpenDDS::DCPS::MulticastTransport::make_datalink(), OpenDDS::DCPS::RtpsUdpTransport::make_datalink(), OpenDDS::DCPS::DataLink::notify_reactor(), and OpenDDS::DCPS::TransportInst::reactor_task().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 87 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::register_for_reader().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 97 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::register_for_writer().
int OpenDDS::DCPS::TransportImpl::release | ( | ) |
|
privatepure virtual |
Called by the TransportRegistry when this TransportImpl object is released while the TransportRegistry is handling a release() "event". The DataLink itself calls this method when it thinks it is no longer used for any associations. This occurs during a "remove associations" operation being performed by some TransportClient that uses this TransportImpl. The TransportClient is known to have acquired our reservation_lock_, so there won't be any reserve_datalink() calls being made from any other threads while we perform this release.
Implemented in OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by OpenDDS::DCPS::DataLink::release_reservations().
bool OpenDDS::DCPS::TransportImpl::release_link_resources | ( | DataLink * | link | ) |
Callback from the DataLink to clean up any associated resources. This usually is done when the DataLink is lost. The call is made with no transport/DCPS locks held.
Definition at line 124 of file TransportImpl.cpp.
References DBG_ENTRY_LVL, OpenDDS::DCPS::EventDispatcher::dispatch(), event_dispatcher_, and OpenDDS::DCPS::rchandle_from().
Referenced by OpenDDS::DCPS::DataLink::release_resources().
int OpenDDS::DCPS::TransportImpl::remove | ( | ) |
void OpenDDS::DCPS::TransportImpl::report | ( | ) |
Definition at line 135 of file TransportImpl.cpp.
References monitor_.
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 113 of file TransportImpl.h.
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 173 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportInst::rtps_relay_only_now().
|
protected |
Definition at line 57 of file TransportImpl.cpp.
References DBG_ENTRY_LVL, event_dispatcher_, OpenDDS::DCPS::RcHandle< T >::is_nil(), is_shut_down_, reactor_task_, OpenDDS::DCPS::EventDispatcher::shutdown(), shutdown_i(), and OpenDDS::DCPS::ReactorTask::stop().
Referenced by OpenDDS::DCPS::TransportInst::shutdown(), and OpenDDS::DCPS::TcpTransport::TcpTransport().
|
protectedpure virtual |
Called during the shutdown() method in order to give the concrete TransportImpl subclass a chance to do something when the shutdown "event" occurs.
Implemented in OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by shutdown().
|
protectedpure virtual |
stop_accepting_or_connecting() is called from TransportClient to terminate the accepting process begun by accept_datalink() or connect_datalink(). This allows the TransportImpl to clean up any resources associated with this pending connection. The TransportClient* passed in to accept or connect is not valid after this method is called.
Implemented in OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by OpenDDS::DCPS::TransportClient::disassociate(), OpenDDS::DCPS::TransportClient::stop_associating(), OpenDDS::DCPS::TransportClient::use_datalink_i(), and OpenDDS::DCPS::TransportClient::~TransportClient().
ACE_INLINE ACE_Reactor_Timer_Interface * OpenDDS::DCPS::TransportImpl::timer | ( | void | ) | const |
Interface to the transport's reactor for scheduling timers.
Definition at line 32 of file TransportImpl.inl.
References ACE_INLINE, and reactor().
Referenced by OpenDDS::DCPS::DataLink::handle_exception(), and OpenDDS::DCPS::DataLink::transport_shutdown().
|
pure virtual |
Implemented in OpenDDS::DCPS::RtpsUdpTransport, OpenDDS::DCPS::TcpTransport, OpenDDS::DCPS::ShmemTransport, OpenDDS::DCPS::MulticastTransport, and OpenDDS::DCPS::UdpTransport.
Referenced by OpenDDS::DCPS::DataReaderImpl::add_link(), OpenDDS::DCPS::TransportClient::associate(), and OpenDDS::DCPS::TransportClient::PendingAssoc::initiate_connect().
int OpenDDS::DCPS::TransportImpl::tryacquire | ( | ) |
|
virtual |
Remove any pending_release mappings.
Reimplemented in OpenDDS::DCPS::TcpTransport.
Definition at line 117 of file TransportImpl.cpp.
References DBG_ENTRY_LVL.
Referenced by OpenDDS::DCPS::DataLink::handle_timeout().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 93 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::unregister_for_reader().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 103 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::unregister_for_writer().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 107 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportClient::update_locators().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 175 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportInst::use_ice_now().
|
inlinevirtual |
Reimplemented in OpenDDS::DCPS::RtpsUdpTransport.
Definition at line 174 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::TransportInst::use_rtps_relay_now().
|
friend |
Definition at line 244 of file TransportImpl.h.
|
friend |
Definition at line 243 of file TransportImpl.h.
|
friend |
We have a few friends in the transport framework so that they can access our private methods. We do this to avoid pollution of our public interface with internal framework methods.
Definition at line 242 of file TransportImpl.h.
WeakRcHandle<TransportInst> OpenDDS::DCPS::TransportImpl::config_ |
A reference to the TransportInst object that was supplied to us during our configure() method.
Definition at line 297 of file TransportImpl.h.
Referenced by config(), and dump_to_str().
EventDispatcher_rch OpenDDS::DCPS::TransportImpl::event_dispatcher_ |
smart ptr to the associated DL cleanup task
Definition at line 316 of file TransportImpl.h.
Referenced by release_link_resources(), shutdown(), and ~TransportImpl().
|
protected |
Id of the last link established.
Definition at line 323 of file TransportImpl.h.
Referenced by create_reactor_task(), is_shut_down(), and shutdown().
|
mutable |
Lock to protect the config_ and reactor_task_ data members.
Definition at line 293 of file TransportImpl.h.
unique_ptr<Monitor> OpenDDS::DCPS::TransportImpl::monitor_ |
Monitor object for this entity.
Definition at line 319 of file TransportImpl.h.
Referenced by open(), report(), and TransportImpl().
|
protected |
Definition at line 234 of file TransportImpl.h.
Referenced by add_pending_connection(), OpenDDS::DCPS::TcpTransport::shutdown_i(), OpenDDS::DCPS::ShmemTransport::stop_accepting_or_connecting(), OpenDDS::DCPS::RtpsUdpTransport::stop_accepting_or_connecting(), and OpenDDS::DCPS::TcpTransport::stop_accepting_or_connecting().
|
mutableprotected |
Lock to protect the pending_connections_ data member.
Definition at line 231 of file TransportImpl.h.
Referenced by add_pending_connection(), OpenDDS::DCPS::TcpTransport::shutdown_i(), OpenDDS::DCPS::ShmemTransport::stop_accepting_or_connecting(), OpenDDS::DCPS::RtpsUdpTransport::stop_accepting_or_connecting(), and OpenDDS::DCPS::TcpTransport::stop_accepting_or_connecting().
ReactorTask_rch OpenDDS::DCPS::TransportImpl::reactor_task_ |
The reactor (task) object - may not even be used if the concrete subclass (of TransportImpl) doesn't require a reactor.
Definition at line 301 of file TransportImpl.h.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i(), create_reactor_task(), OpenDDS::DCPS::RtpsUdpTransport::make_datalink(), reactor(), reactor_owner(), reactor_task(), shutdown(), OpenDDS::DCPS::RtpsUdpTransport::start_ice(), and OpenDDS::DCPS::RtpsUdpTransport::stop_ice().