TransportReassembly.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_TRANSPORTREASSEMBLY
00009 #define OPENDDS_DCPS_TRANSPORTREASSEMBLY
00010
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "dds/DCPS/Definitions.h"
00013 #include "ReceivedDataSample.h"
00014 #include "dds/DCPS/PoolAllocator.h"
00015
00016 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 namespace OpenDDS {
00019 namespace DCPS {
00020
00021 class OpenDDS_Dcps_Export TransportReassembly {
00022 public:
00023
00024
00025
00026
00027 bool reassemble(const SequenceNumber& transportSeq, bool firstFrag,
00028 ReceivedDataSample& data);
00029
00030 bool reassemble(const SequenceRange& seqRange, ReceivedDataSample& data);
00031
00032
00033
00034
00035 void data_unavailable(const SequenceRange& transportSeqDropped);
00036
00037 void data_unavailable(const SequenceNumber& dataSampleSeq,
00038 const RepoId& pub_id);
00039
00040
00041
00042 bool has_frags(const SequenceNumber& seq, const RepoId& pub_id) const;
00043
00044
00045
00046
00047 CORBA::ULong get_gaps(const SequenceNumber& msg_seq, const RepoId& pub_id,
00048 CORBA::Long bitmap[], CORBA::ULong length,
00049 CORBA::ULong& numBits) const;
00050
00051 private:
00052
00053 bool reassemble_i(const SequenceRange& seqRange, bool firstFrag,
00054 ReceivedDataSample& data);
00055
00056
00057
00058
00059
00060
00061 struct FragKey {
00062 FragKey(const PublicationId& pubId, const SequenceNumber& dataSampleSeq);
00063
00064 bool operator<(const FragKey& rhs) const
00065 {
00066 if (compare_(this->publication_, rhs.publication_)) return true;
00067 if (compare_(rhs.publication_, this->publication_)) return false;
00068 return this->data_sample_seq_ < rhs.data_sample_seq_;
00069 }
00070
00071 static GUID_tKeyLessThan compare_;
00072 PublicationId publication_;
00073 SequenceNumber data_sample_seq_;
00074 };
00075
00076
00077
00078
00079 struct FragRange {
00080 FragRange(const SequenceRange& seqRange,
00081 const ReceivedDataSample& data);
00082
00083 SequenceRange transport_seq_;
00084 ReceivedDataSample rec_ds_;
00085 };
00086
00087
00088
00089
00090
00091 typedef OPENDDS_MAP(FragKey, OPENDDS_LIST(FragRange) ) FragMap;
00092 FragMap fragments_;
00093
00094 OPENDDS_SET(FragKey) have_first_;
00095
00096 static bool insert(OPENDDS_LIST(FragRange)& flist,
00097 const SequenceRange& seqRange,
00098 ReceivedDataSample& data);
00099 };
00100
00101 }
00102 }
00103
00104 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00105
00106 #endif