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

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