#include <DataLink.h>
Inheritance diagram for OpenDDS::DCPS::DataLink:


Public Types | |
| DISCONNECTED | |
| RECONNECTED | |
| LOST | |
| enum | ConnectionNotice { DISCONNECTED, RECONNECTED, LOST } |
Public Member Functions | |
| DataLink (TransportImpl *impl) | |
| Only called by our TransportImpl object. | |
| virtual | ~DataLink () |
| void | resume_send () |
| int | make_reservation (RepoId subscriber_id, RepoId publisher_id) |
| This is for a remote subscriber_id and local publisher_id. | |
| int | make_reservation (RepoId publisher_id, RepoId subscriber_id, TransportReceiveListener *receive_listener) |
| Only called by our TransportImpl object. | |
| void | release_reservations (RepoId remote_id, RepoId local_id, DataLinkSetMap &released_locals) |
| virtual void | fully_associated () |
| void | send_start () |
| void | send (TransportQueueElement *element) |
| void | send_stop () |
| int | remove_sample (const DataSampleListElement *sample, bool dropped_by_transport) |
| void | remove_all_control_msgs (RepoId pub_id) |
| int | data_received (ReceivedDataSample &sample) |
| DataLinkIdType | id () const |
| Obtain a unique identifier for this DataLink object. | |
| void | transport_shutdown () |
| void | notify (enum ConnectionNotice notice) |
| void | notify_connection_deleted () |
| virtual void | pre_stop_i () |
| ACE_Message_Block * | marshal_acks (bool byte_order) |
| bool | release_resources () |
| void | terminate_send () |
| bool | is_target (const RepoId &sub_id) |
| bool | exist (const RepoId &remote_id, const RepoId &local_id, const bool &pub_side, bool &last) |
| void | clear_associations () |
| int | handle_timeout (const ACE_Time_Value &tv, const void *arg=0) |
Protected Types | |
| typedef ACE_Guard< LockType > | GuardType |
Protected Member Functions | |
| int | start (TransportSendStrategy *send_strategy, TransportReceiveStrategy *receive_strategy) |
| virtual void | stop_i ()=0 |
| void | send_start_i () |
| void | send_i (TransportQueueElement *element, bool relink=true) |
| void | send_stop_i () |
Static Protected Member Functions | |
| static ACE_UINT64 | get_next_datalink_id () |
| Used to provide unique Ids to all DataLink methods. | |
Protected Attributes | |
| TransportReceiveStrategy_rch | receive_strategy_ |
| The transport receive strategy object for this DataLink. | |
| TransportSendStrategy_rch | send_strategy_ |
| The transport send strategy object for this DataLink. | |
| LockType | strategy_lock_ |
| ACE_Time_Value | datalink_release_delay_ |
Private Types | |
| typedef ACE_SYNCH_MUTEX | LockType |
Private Member Functions | |
| const char * | connection_notice_as_str (enum ConnectionNotice notice) |
| Helper function to output the enum as a string to help debugging. | |
| void | release_remote_subscriber (RepoId subscriber_id, RepoId publisher_id, RepoIdSet_rch &pubid_set, DataLinkSetMap &released_publishers) |
| void | release_remote_publisher (RepoId publisher_id, RepoId subscriber_id, ReceiveListenerSet_rch &listener_set, DataLinkSetMap &released_subscribers) |
| void | prepare_release () |
Private Attributes | |
| ReceiveListenerSetMap | pub_map_ |
| LockType | pub_map_lock_ |
| RepoIdSetMap | sub_map_ |
| LockType | sub_map_lock_ |
| TransportImpl_rch | impl_ |
| A (smart) pointer to the TransportImpl that created this DataLink. | |
| ACE_UINT64 | id_ |
| The id for this DataLink. | |
| ThreadPerConnectionSendTask * | thr_per_con_send_task_ |
| RepoIdSet | released_local_pubs_ |
| RepoIdSet | released_local_subs_ |
| LockType | released_local_lock_ |
| ReceiveListenerSetMap | pub_map_releasing_ |
| RepoIdSetMap | sub_map_releasing_ |
Friends | |
| class | DataLinkCleanupTask |
| class | ThreadPerConnectionSendTask |
Notes about object ownership: 1) Own the send strategy object and receive strategy object. 2) Own ThreadPerConnectionSendTask object which is used when thread_per_connection is enabled.
typedef ACE_Guard<LockType> OpenDDS::DCPS::DataLink::GuardType [protected] |
typedef ACE_SYNCH_MUTEX OpenDDS::DCPS::DataLink::LockType [private] |
| OpenDDS::DCPS::DataLink::DataLink | ( | TransportImpl * | impl | ) |
Only called by our TransportImpl object.
A DataLink object is always created by a TransportImpl object. Thus, the TransportImpl object passed-in here is the object that created this DataLink.
| OpenDDS::DCPS::DataLink::~DataLink | ( | ) | [virtual] |
| void OpenDDS::DCPS::DataLink::clear_associations | ( | ) |
This is called by DataLinkCleanupTask thread to remove the associations based on the snapshot in release_resources().
| ACE_INLINE const char * OpenDDS::DCPS::DataLink::connection_notice_as_str | ( | enum ConnectionNotice | notice | ) | [private] |
Helper function to output the enum as a string to help debugging.
| int OpenDDS::DCPS::DataLink::data_received | ( | ReceivedDataSample & | sample | ) |
This is called by our TransportReceiveStrategy object when it has received a complete data sample. This method will cause the appropriate TransportReceiveListener objects to be told that data_received().
| bool OpenDDS::DCPS::DataLink::exist | ( | const RepoId & | remote_id, | |
| const RepoId & | local_id, | |||
| const bool & | pub_side, | |||
| bool & | last | |||
| ) |
Check if the remote_id/local_id is associated with this link and if they are the last assoication using this link.
| ACE_INLINE void OpenDDS::DCPS::DataLink::fully_associated | ( | ) | [virtual] |
A hook for the concrete transport to do something special on subscriber side after both add_associations is received and the connection is established.
Reimplemented in OpenDDS::DCPS::SimpleTcpDataLink.
| ACE_UINT64 OpenDDS::DCPS::DataLink::get_next_datalink_id | ( | ) | [static, protected] |
Used to provide unique Ids to all DataLink methods.
| int OpenDDS::DCPS::DataLink::handle_timeout | ( | const ACE_Time_Value & | tv, | |
| const void * | arg = 0 | |||
| ) |
| ACE_INLINE OpenDDS::DCPS::DataLinkIdType OpenDDS::DCPS::DataLink::id | ( | ) | const |
Obtain a unique identifier for this DataLink object.
We use our "this" pointer for our id. Note that the "this" pointer is a DataLink* as far as we are concerned. This *is* different (due to virtual tables) than the "this" pointer when in a DataLink subclass. But since this is the only place where a DataLink provides its "id", this should all work out (comparing ids for equality/inequality).
| bool OpenDDS::DCPS::DataLink::is_target | ( | const RepoId & | sub_id | ) |
This is called on publisher side to see if this link communicates with the provided sub.
| int OpenDDS::DCPS::DataLink::make_reservation | ( | RepoId | publisher_id, | |
| RepoId | subscriber_id, | |||
| TransportReceiveListener * | receive_listener | |||
| ) |
Only called by our TransportImpl object.
This is for a remote publisher_id and a local subscriber_id. The TransportReceiveListener is associated with the local subscriber_id.
This is for a remote subscriber_id and local publisher_id.
Only called by our TransportImpl object.
Return Codes: 0 means successful reservation made. -1 means failure.
| ACE_Message_Block * OpenDDS::DCPS::DataLink::marshal_acks | ( | bool | byte_order | ) |
This is called on subscriber side to serialize the associated publication and subscriptions.
| void OpenDDS::DCPS::DataLink::notify | ( | enum ConnectionNotice | notice | ) |
Notify the datawriters and datareaders that the connection is disconnected, lost, or reconnected. The datareader/datawriter will notify the corresponding listener.
| void OpenDDS::DCPS::DataLink::notify_connection_deleted | ( | ) |
| void OpenDDS::DCPS::DataLink::pre_stop_i | ( | ) | [virtual] |
Called before release the datalink or before shutdown to let the concrete DataLink to do anything necessary.
Reimplemented in OpenDDS::DCPS::SimpleTcpDataLink.
| void OpenDDS::DCPS::DataLink::prepare_release | ( | ) | [private] |
Save current sub and pub association maps for releasing and create empty maps for new associations.
| void OpenDDS::DCPS::DataLink::release_remote_publisher | ( | RepoId | publisher_id, | |
| RepoId | subscriber_id, | |||
| ReceiveListenerSet_rch & | listener_set, | |||
| DataLinkSetMap & | released_subscribers | |||
| ) | [private] |
Used by release_reservations() once it has determined that the remote_id/local_id being released is, in fact, a remote publisher id/a local subscriber.
| void OpenDDS::DCPS::DataLink::release_remote_subscriber | ( | RepoId | subscriber_id, | |
| RepoId | publisher_id, | |||
| RepoIdSet_rch & | pubid_set, | |||
| DataLinkSetMap & | released_publishers | |||
| ) | [private] |
Used by release_reservations() once it has determined that the remote_id/local_id being released is, in fact, a remote subscriber id/a local publisher id.
| void OpenDDS::DCPS::DataLink::release_reservations | ( | RepoId | remote_id, | |
| RepoId | local_id, | |||
| DataLinkSetMap & | released_locals | |||
| ) |
This will release reservations that were made by one of the make_reservation() methods. All we know is that the supplied RepoId is considered to be a remote id. It could be a remote subscriber or a remote publisher.
| bool OpenDDS::DCPS::DataLink::release_resources | ( | ) |
| ACE_INLINE void OpenDDS::DCPS::DataLink::remove_all_control_msgs | ( | RepoId | pub_id | ) |
| ACE_INLINE int OpenDDS::DCPS::DataLink::remove_sample | ( | const DataSampleListElement * | sample, | |
| bool | dropped_by_transport | |||
| ) |
This method is essentially an "undo_send()" method. It's goal is to remove all traces of the sample from this DataLink (if the sample is even known to the DataLink). A return value of -1 indicates that a fatal error was encountered while trying to carry out the remove_sample operation. A return value of 0 indicates that there was no fatal error, and that this DataLink no longer references the sample (if it ever did).
| void OpenDDS::DCPS::DataLink::resume_send | ( | ) |
The resume_send is used in the case of reconnection on the subscriber's side, e.g.,to send out the FULLY_ASSOCIATED message to publisher.
| ACE_INLINE void OpenDDS::DCPS::DataLink::send | ( | TransportQueueElement * | element | ) |
| ACE_INLINE void OpenDDS::DCPS::DataLink::send_i | ( | TransportQueueElement * | element, | |
| bool | relink = true | |||
| ) | [protected] |
| ACE_INLINE void OpenDDS::DCPS::DataLink::send_start | ( | ) |
Called by the TransportInterface objects that reference this DataLink. Used by the TransportInterface to send a sample, or to send a control message. These functions either give the request to the PerThreadConnectionSendTask when thread_per_connection configuration is true or just simply delegate to the send strategy.
| ACE_INLINE void OpenDDS::DCPS::DataLink::send_start_i | ( | ) | [protected] |
The implementation of the functions that accomplish the sample or control message delivery. IThey just simply delegate to the send strategy.
| ACE_INLINE void OpenDDS::DCPS::DataLink::send_stop | ( | ) |
| ACE_INLINE void OpenDDS::DCPS::DataLink::send_stop_i | ( | ) | [protected] |
| ACE_INLINE int OpenDDS::DCPS::DataLink::start | ( | TransportSendStrategy * | send_strategy, | |
| TransportReceiveStrategy * | receive_strategy | |||
| ) | [protected] |
This is how the subclass "announces" to this DataLink base class that this DataLink has now been "connected" and should start the supplied strategy objects. This start method is also going to keep a "copy" of the references to the strategy objects. Also note that it is acceptable to pass-in a NULL (0) TransportReceiveStrategy*, but it is assumed that the TransportSendStrategy* argument is not NULL.
If the start() method fails to start either strategy, then a -1 is returned. Otherwise, a 0 is returned. In the failure case, if one of the strategy objects was started successfully, then it will be stopped before the start() method returns -1.
| virtual void OpenDDS::DCPS::DataLink::stop_i | ( | ) | [protected, pure virtual] |
This announces the "stop" event to our subclass. The "stop" event will occur when this DataLink is handling a release_reservations() call and determines that it has just released all of the remaining reservations on this DataLink. The "stop" event will also occur when the TransportImpl is being shutdown() - we call stop_i() from our transport_shutdown() method to handle this case.
Implemented in OpenDDS::DCPS::ReliableMulticastDataLink, OpenDDS::DCPS::SimpleTcpDataLink, and OpenDDS::DCPS::SimpleUnreliableDgramDataLink.
| ACE_INLINE void OpenDDS::DCPS::DataLink::terminate_send | ( | ) |
| void OpenDDS::DCPS::DataLink::transport_shutdown | ( | ) |
Our TransportImpl will inform us if it is being shutdown() by calling this method.
friend class DataLinkCleanupTask [friend] |
friend class ThreadPerConnectionSendTask [friend] |
ACE_Time_Value OpenDDS::DCPS::DataLink::datalink_release_delay_ [protected] |
Configurable delay in milliseconds that the datalink should be released after all associations are removed.
ACE_UINT64 OpenDDS::DCPS::DataLink::id_ [private] |
The id for this DataLink.
A (smart) pointer to the TransportImpl that created this DataLink.
Map associating each publisher_id with a set of TransportReceiveListener objects (each with an associated subscriber_id). This map is used for delivery of incoming (aka, received) data samples.
The transport receive strategy object for this DataLink.
Reimplemented in OpenDDS::DCPS::ReliableMulticastDataLink.
The transport send strategy object for this DataLink.
Reimplemented in OpenDDS::DCPS::ReliableMulticastDataLink.
LockType OpenDDS::DCPS::DataLink::strategy_lock_ [protected] |
Map associating each subscriber_id with the set of publisher_ids. In essence, the pub_map_ and sub_map_ are the "mirror image" of each other, where we have a many (publishers) to many (subscribers) association being managed here.
The task used to do the sending. This ThreadPerConnectionSendTask object is created when the thread_per_connection configuration is true. It only dedicate to this datalink.
1.4.7