UdpReceiveStrategy.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_UDPRECEIVESTRATEGY_H
00009 #define DCPS_UDPRECEIVESTRATEGY_H
00010 
00011 #include "Udp_Export.h"
00012 
00013 #include "ace/INET_Addr.h"
00014 
00015 #include "dds/DCPS/transport/framework/TransportReceiveStrategy_T.h"
00016 #include "dds/DCPS/RcEventHandler.h"
00017 
00018 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace OpenDDS {
00021 namespace DCPS {
00022 
00023 class UdpDataLink;
00024 
00025 class OpenDDS_Udp_Export UdpReceiveStrategy
00026   : public TransportReceiveStrategy<>,
00027     public RcEventHandler
00028 {
00029 public:
00030   explicit UdpReceiveStrategy(UdpDataLink* link);
00031 
00032   virtual ACE_HANDLE get_handle() const;
00033   virtual int handle_input(ACE_HANDLE fd);
00034 
00035 protected:
00036   virtual ssize_t receive_bytes(iovec iov[],
00037                                 int n,
00038                                 ACE_INET_Addr& remote_address,
00039                                 ACE_HANDLE fd);
00040 
00041   virtual void deliver_sample(ReceivedDataSample& sample,
00042                               const ACE_INET_Addr& remote_address);
00043 
00044   virtual int start_i();
00045   virtual void stop_i();
00046 
00047   virtual bool check_header(const TransportHeader& header);
00048 
00049   virtual bool check_header(const DataSampleHeader& header)
00050   {
00051     return TransportReceiveStrategy<>::check_header(header);
00052   }
00053 
00054 private:
00055 
00056   virtual bool reassemble(ReceivedDataSample& data);
00057 
00058   UdpDataLink* link_;
00059   SequenceNumber expected_;
00060   ACE_INET_Addr remote_address_; // of the current datagram
00061 
00062   typedef std::pair<TransportReassembly, SequenceNumber> ReassemblyInfo;
00063   typedef OPENDDS_MAP(ACE_INET_Addr, ReassemblyInfo) ReassemblyMap;
00064   ReassemblyMap reassembly_;
00065 };
00066 
00067 } // namespace DCPS
00068 } // namespace OpenDDS
00069 
00070 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00071 
00072 #endif  /* DCPS_UDPRECEIVESTRATEGY_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1