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 "ace/INET_Addr.h"
00014 
00015 namespace OpenDDS {
00016 namespace DCPS {
00017 
00018 struct AssociationData {
00019   RepoId               remote_id_;
00020   TransportLocatorSeq  remote_data_;
00021   Priority          publication_transport_priority_;
00022   bool                 remote_reliable_, remote_durable_;
00023 
00024   AssociationData()
00025     : remote_id_(GUID_UNKNOWN)
00026     , publication_transport_priority_(0)
00027     , remote_reliable_(false)
00028     , remote_durable_(false)
00029   {}
00030 
00031   static ACE_INET_Addr get_remote_address(const TransportBLOB& remote)
00032   {
00033     ACE_INET_Addr remote_address;
00034     NetworkAddress network_order_address;
00035 
00036     // Get the remote address from the "blob" in the remote_info struct.
00037     ACE_InputCDR cdr((const char*)remote.get_buffer(),
00038                                   remote.length());
00039 
00040     if ((cdr >> network_order_address) == 0) {
00041       ACE_ERROR((LM_ERROR,
00042                  ACE_TEXT("(%P|%t) ERROR: AssociationData::get_remote_address")
00043                  ACE_TEXT(" failed to de-serialize the NetworkAddress\n")));
00044     } else {
00045       network_order_address.to_addr(remote_address);
00046     }
00047 
00048     return remote_address;
00049   }
00050 };
00051 
00052 } // namespace DCPS
00053 } // namespace OpenDDS
00054 
00055 #endif  /* OPENDDS_DCPS_ASSOCIATIONDATA_H */

Generated on Fri Feb 12 20:05:18 2016 for OpenDDS by  doxygen 1.4.7