RtpsUdpSendStrategy.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 DCPS_RTPSUDPSENDSTRATEGY_H
00009 #define DCPS_RTPSUDPSENDSTRATEGY_H
00010 
00011 #include "Rtps_Udp_Export.h"
00012 
00013 #include "dds/DCPS/transport/framework/TransportSendStrategy.h"
00014 
00015 #include "dds/DCPS/RTPS/MessageTypes.h"
00016 
00017 #include "ace/INET_Addr.h"
00018 
00019 namespace OpenDDS {
00020 namespace DCPS {
00021 
00022 class RtpsUdpDataLink;
00023 
00024 class OpenDDS_Rtps_Udp_Export RtpsUdpSendStrategy
00025   : public TransportSendStrategy {
00026 public:
00027   explicit RtpsUdpSendStrategy(RtpsUdpDataLink* link);
00028 
00029   virtual void stop_i();
00030 
00031   struct OverrideToken {
00032     explicit OverrideToken(RtpsUdpSendStrategy* outer) : outer_(outer) {}
00033     ~OverrideToken();
00034     RtpsUdpSendStrategy* outer_;
00035   };
00036   friend struct OverrideToken;
00037 
00038   OverrideToken override_destinations(const ACE_INET_Addr& destination);
00039   OverrideToken override_destinations(
00040     const OPENDDS_SET(ACE_INET_Addr)& destinations);
00041 
00042   void send_rtps_control(ACE_Message_Block& submessages,
00043                          const ACE_INET_Addr& destination);
00044   void send_rtps_control(ACE_Message_Block& submessages,
00045                          const OPENDDS_SET(ACE_INET_Addr)& destinations);
00046 
00047 protected:
00048   virtual ssize_t send_bytes_i(const iovec iov[], int n);
00049 
00050   virtual size_t max_message_size() const
00051   {
00052     return UDP_MAX_MESSAGE_SIZE;
00053   }
00054   virtual void add_delayed_notification(TransportQueueElement* element);
00055   virtual RemoveResult do_remove_sample(const RepoId& pub_id,
00056     const TransportQueueElement::MatchCriteria& criteria);
00057 
00058 private:
00059   void marshal_transport_header(ACE_Message_Block* mb);
00060   ssize_t send_multi_i(const iovec iov[], int n,
00061                        const OPENDDS_SET(ACE_INET_Addr)& addrs);
00062   ssize_t send_single_i(const iovec iov[], int n,
00063                         const ACE_INET_Addr& addr);
00064 
00065   RtpsUdpDataLink* link_;
00066   const OPENDDS_SET(ACE_INET_Addr)* override_dest_;
00067   const ACE_INET_Addr* override_single_dest_;
00068 
00069   OpenDDS::RTPS::Header rtps_header_;
00070   char rtps_header_data_[RTPS::RTPSHDR_SZ];
00071   ACE_Data_Block rtps_header_db_;
00072   ACE_Message_Block rtps_header_mb_;
00073 };
00074 
00075 } // namespace DCPS
00076 } // namespace OpenDDS
00077 
00078 #endif /* DCPS_RTPSUDPSENDSTRATEGY_H */

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