![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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_CONCATENATION_HPP 00029 #define WNS_LDK_CONCATENATION_HPP 00030 00031 #include <WNS/ldk/fu/Plain.hpp> 00032 #include <WNS/ldk/Delayed.hpp> 00033 00034 #include <WNS/pyconfig/View.hpp> 00035 #include <WNS/logger/Logger.hpp> 00036 00037 #include <list> 00038 00039 namespace wns { namespace ldk { namespace concatenation { 00040 00041 class ConcatenationCommand : 00042 public Command 00043 { 00044 public: 00045 struct {} local; 00046 struct { 00048 std::vector<CompoundPtr> compounds; 00049 } peer; 00050 struct {} magic; 00051 00052 ConcatenationCommand() 00053 { 00054 peer.compounds = std::vector<CompoundPtr>(); 00055 } 00056 ~ConcatenationCommand() 00057 { 00058 peer.compounds.clear(); 00059 } 00060 }; 00061 00066 class Concatenation : 00067 public fu::Plain<Concatenation, ConcatenationCommand>, 00068 public Delayed<Concatenation> 00069 { 00070 public: 00071 Concatenation(fun::FUN* fuNet, const wns::pyconfig::View& config); 00072 ~Concatenation(); 00073 00075 virtual void processIncoming(const CompoundPtr& compound); 00076 virtual bool hasCapacity() const; 00077 virtual void processOutgoing(const CompoundPtr& compound); 00078 virtual const CompoundPtr hasSomethingToSend() const; 00079 virtual CompoundPtr getSomethingToSend(); 00080 00082 virtual void calculateSizes(const CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const; 00083 00084 protected: 00086 CompoundPtr createContainer(const CompoundPtr& firstEntry); 00087 00089 Bit calculatePadding(Bit pduSize, Bit paddingBoundary) const; 00090 00092 const Bit maxSize; 00093 00095 Bit currentSDUSize; 00096 00098 Bit currentCommandPoolSize; 00099 00101 CompoundPtr currentCompound; 00102 // If the last compound is accepted while not sufficent bufferspace is available, then it will be store in full 00103 CompoundPtr nextCompound; 00104 00106 int maxEntries; 00108 int currentEntries; 00109 00111 const Bit numBitsIfConcatenated; 00113 const Bit numBitsPerEntry; 00115 const Bit numBitsIfNotConcatenated; 00116 00118 const bool countPCISizeOfEntries; 00120 const Bit entryPaddingBoundary; 00121 00122 logger::Logger logger; 00123 }; 00124 }}} 00125 00126 #endif // NOT defined WNS_LDK_CONCATENATION_HPP 00127 00128
1.5.5