User Manual, Developers Guide and API Documentation

ReorderingWindow.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 
00028 #ifndef WNS_LDK_SAR_REASSEMBLY_REORDERINGWINDOW_HPP
00029 #define WNS_LDK_SAR_REASSEMBLY_REORDERINGWINDOW_HPP
00030 
00031 #include <WNS/pyconfig/View.hpp>
00032 #include <WNS/events/scheduler/IEvent.hpp>
00033 #include <WNS/logger/Logger.hpp>
00034 #include <WNS/ldk/Compound.hpp>
00035 
00036 #include <boost/signals.hpp>
00037 
00038 namespace wns { namespace ldk { namespace sar { namespace reassembly {
00039 
00040     class ReorderingWindow
00041     {
00042         class Segment
00043         {
00044         public:
00045             Segment(long sn, wns::ldk::CompoundPtr compound);
00046 
00047             long
00048             sn() const;
00049 
00050             wns::ldk::CompoundPtr
00051             compound() const;
00052 
00053         private:
00054             long sn_;
00055 
00056             wns::ldk::CompoundPtr compound_;
00057         };
00058 
00059         typedef std::deque<Segment> ContainerType;
00060 
00061         typedef boost::signal<void (long, wns::ldk::CompoundPtr)> reassemblySignalType;
00062         typedef reassemblySignalType::slot_type reassemblySlotType;
00063 
00064         typedef boost::signal<void (long, wns::ldk::CompoundPtr)> discardSignalType;
00065         typedef discardSignalType::slot_type discardSlotType;
00066 
00067     public:
00068         ReorderingWindow(wns::pyconfig::View config);
00069 
00070         ReorderingWindow(const ReorderingWindow&);
00071 
00072         void
00073         onSegment(long sn, wns::ldk::CompoundPtr compound);
00074 
00079         boost::signals::connection
00080         connectToReassemblySignal(const reassemblySlotType& slot);
00081 
00086         boost::signals::connection
00087         connectToDiscardSignal(const reassemblySlotType& slot);
00088 
00089     private:
00090 
00091         void
00092         onTReorderingExpired();
00093 
00094         bool
00095         isExpired(Segment s);
00096 
00097         bool
00098         isDuplicate(Segment s);
00099 
00100         bool
00101         isConsideredForReordering(Segment s);
00102 
00103         bool
00104         isWithinReorderingWindow(Segment s);
00105 
00106         void
00107         insert(Segment s);
00108 
00109         void
00110         discard(Segment s);
00111 
00112         Segment
00113         nextMissingSegment(Segment s);
00114 
00115         void
00116         updateReassemblyBuffer(long lower);
00117 
00118         int snFieldLength_;
00119 
00120         int windowSize_;
00121 
00122         double tReordering_;
00123 
00124         long vrUH_;
00125 
00126         long vrUR_;
00127 
00128         long vrUX_;
00129 
00130         ContainerType reorderWindow_;
00131 
00132         reassemblySignalType reassemble_;
00133 
00134         discardSignalType discard_;
00135 
00136         wns::events::scheduler::IEventPtr reorderingTimer_;
00137 
00138         wns::logger::Logger logger_;
00139     };
00140 
00141 } // reassembly
00142 } // sar
00143 } // ldk
00144 } // wns
00145 #endif // WNS_LDK_SAR_REASSEMBLY_REORDERINGWINDOW_HPP

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