User Manual, Developers Guide and API Documentation

ReassemblyBuffer.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 #ifndef WNS_LDK_SAR_REASSEMBLY_REASSEMBLYBUFFER_HPP
00028 #define WNS_LDK_SAR_REASSEMBLY_REASSEMBLYBUFFER_HPP
00029 
00030 #include <WNS/ldk/Compound.hpp>
00031 #include <WNS/ldk/CommandReaderInterface.hpp>
00032 #include <WNS/probe/bus/ContextCollector.hpp>
00033 
00034 #include <set>
00035 #include <map>
00036 
00037 namespace wns { namespace ldk { class FunctionalUnit;}}
00038 namespace wns { namespace ldk { namespace sar { class SegAndConcatCommand; }}}
00039 
00040 namespace wns { namespace ldk { namespace sar { namespace reassembly {
00041 
00042 namespace tests { class ReassemblyBufferTest; }
00043 
00044 class ReassemblyBuffer
00045 {
00046     friend class tests::ReassemblyBufferTest;
00047 
00048 public:
00049     typedef std::deque<wns::ldk::CompoundPtr> SegmentContainer;
00050 
00051     ReassemblyBuffer();
00052 
00053     void
00054     initialize(wns::ldk::CommandReaderInterface*);
00055 
00056     bool
00057     isEmpty();
00058 
00059     long
00060     getNextExpectedSN();
00061 
00062     bool
00063     isNextExpectedSegment(const wns::ldk::CompoundPtr& c);
00064 
00065     bool
00066     accepts(const wns::ldk::CompoundPtr&);
00067 
00068     void
00069     insert(wns::ldk::CompoundPtr);
00070 
00071     std::string
00072     dump();
00073 
00074     void
00075     clear();
00076 
00077     size_t
00078     size();
00079 
00080     SegmentContainer
00081     getReassembledSegments(int &reassembledSegmentCounter);
00082 
00083     void
00084     enableDelayProbing(const wns::probe::bus::ContextCollectorPtr& minDelayCC,
00085         const wns::probe::bus::ContextCollectorPtr& maxDelayCC,
00086         wns::ldk::CommandReaderInterface* cmdReader);
00087 
00088 private:
00089     bool delayProbingEnabled_;
00090     std::map<int, std::set<wns::simulator::Time> > delays_;
00091     wns::probe::bus::ContextCollectorPtr minDelayCC_;
00092     wns::probe::bus::ContextCollectorPtr maxDelayCC_;
00093     wns::ldk::CommandReaderInterface* probeCmdReader_;
00094 
00095     void
00096     prepareForProbing(int position,
00097         const wns::ldk::CompoundPtr& segment);
00098 
00099     void 
00100     probe(const SegmentContainer& sc);
00101 
00102     bool
00103     integrityCheck();
00104 
00105     wns::ldk::sar::SegAndConcatCommand*
00106     readCommand(const wns::ldk::CompoundPtr&);
00107 
00108     int
00109     dropSegmentsOfSDU(int index = 0);
00110 
00111     SegmentContainer buffer_;
00112 
00113     wns::ldk::CommandReaderInterface* commandReader_;
00114 };
00115 
00116 } // reassembly
00117 } // sar
00118 } // ldk
00119 } // wns 
00120 
00121 #endif // WNS_LDK_SAR_REASSEMBLY_REASSEMBLYBUFFER_HPP

Generated on Fri May 25 03:31:46 2012 for openWNS by  doxygen 1.5.5