Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #ifndef OPENDDS_DCPS_ASSOCIATIONDATA_H 9 : #define OPENDDS_DCPS_ASSOCIATIONDATA_H 10 : 11 : #include "GuidUtils.h" 12 : #include "NetworkResource.h" 13 : #include "Time_Helper.h" 14 : #include "transport/framework/TransportDefs.h" 15 : 16 : #include <dds/DdsDcpsInfoUtilsC.h> 17 : 18 : #include <ace/INET_Addr.h> 19 : 20 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 21 : 22 : namespace OpenDDS { 23 : namespace DCPS { 24 : 25 : struct AssociationData { 26 : GUID_t remote_id_; 27 : TransportLocatorSeq remote_data_; 28 : TransportLocator discovery_locator_; 29 : MonotonicTime_t participant_discovered_at_; 30 : ACE_CDR::ULong remote_transport_context_; 31 : Priority publication_transport_priority_; 32 : bool remote_reliable_, remote_durable_; 33 : 34 0 : AssociationData() 35 0 : : remote_id_(GUID_UNKNOWN) 36 0 : , discovery_locator_() 37 0 : , participant_discovered_at_(monotonic_time_zero()) 38 0 : , remote_transport_context_(0) 39 0 : , publication_transport_priority_(0) 40 0 : , remote_reliable_(false) 41 0 : , remote_durable_(false) 42 0 : {} 43 : 44 : static ACE_INET_Addr get_remote_address(const TransportBLOB& remote) 45 : { 46 : ACE_INET_Addr remote_address; 47 : NetworkResource network_resource; 48 : 49 : // Get the remote address from the "blob" in the remote_info struct. 50 : ACE_InputCDR cdr((const char*)remote.get_buffer(), 51 : remote.length()); 52 : 53 : if ((cdr >> network_resource) == 0) { 54 : ACE_ERROR((LM_ERROR, 55 : ACE_TEXT("(%P|%t) ERROR: AssociationData::get_remote_address") 56 : ACE_TEXT(" failed to de-serialize the NetworkResource\n"))); 57 : } else { 58 : network_resource.to_addr(remote_address); 59 : } 60 : 61 : return remote_address; 62 : } 63 : }; 64 : 65 : } // namespace DCPS 66 : } // namespace OpenDDS 67 : 68 : OPENDDS_END_VERSIONED_NAMESPACE_DECL 69 : 70 : #endif /* OPENDDS_DCPS_ASSOCIATIONDATA_H */