AssociationData.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_ASSOCIATIONDATA_H
00009 #define OPENDDS_DCPS_ASSOCIATIONDATA_H
00010 
00011 #include "dds/DdsDcpsInfoUtilsC.h"
00012 #include "dds/DCPS/transport/framework/NetworkAddress.h"
00013 #include "dds/DCPS/transport/framework/TransportDefs.h"
00014 #include "ace/INET_Addr.h"
00015 
00016 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00017 
00018 namespace OpenDDS {
00019 namespace DCPS {
00020 
00021 struct AssociationData {
00022   RepoId               remote_id_;
00023   TransportLocatorSeq  remote_data_;
00024   Priority             publication_transport_priority_;
00025   bool                 remote_reliable_, remote_durable_;
00026 
00027   AssociationData()
00028     : remote_id_(GUID_UNKNOWN)
00029     , publication_transport_priority_(0)
00030     , remote_reliable_(false)
00031     , remote_durable_(false)
00032   {}
00033 
00034   static ACE_INET_Addr get_remote_address(const TransportBLOB& remote)
00035   {
00036     ACE_INET_Addr remote_address;
00037     NetworkAddress network_order_address;
00038 
00039     // Get the remote address from the "blob" in the remote_info struct.
00040     ACE_InputCDR cdr((const char*)remote.get_buffer(),
00041                                   remote.length());
00042 
00043     if ((cdr >> network_order_address) == 0) {
00044       ACE_ERROR((LM_ERROR,
00045                  ACE_TEXT("(%P|%t) ERROR: AssociationData::get_remote_address")
00046                  ACE_TEXT(" failed to de-serialize the NetworkAddress\n")));
00047     } else {
00048       network_order_address.to_addr(remote_address);
00049     }
00050 
00051     return remote_address;
00052   }
00053 };
00054 
00055 } // namespace DCPS
00056 } // namespace OpenDDS
00057 
00058 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00059 
00060 #endif  /* OPENDDS_DCPS_ASSOCIATIONDATA_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1