![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiFiMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2007 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 16, D-52074 Aachen, Germany 00009 * phone: ++49-241-80-27910, 00010 * fax: ++49-241-80-22242 00011 * email: info@openwns.org 00012 * www: http://www.openwns.org 00013 * _____________________________________________________________________________ 00014 * 00015 * openWNS is free software; you can redistribute it and/or modify it under the 00016 * terms of the GNU Lesser General Public License version 2 as published by the 00017 * Free Software Foundation; 00018 * 00019 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00021 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00022 * details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 * 00027 ******************************************************************************/ 00028 00029 #ifndef WIFIMAC_DRAFTN_DEAGGREGATION_HPP 00030 #define WIFIMAC_DRAFTN_DEAGGREGATION_HPP 00031 00032 #include <WIFIMAC/lowerMAC/Manager.hpp> 00033 #include <WIFIMAC/management/ProtocolCalculator.hpp> 00034 00035 #include <WIFIMAC/convergence/TxDurationSetter.hpp> 00036 #include <WIFIMAC/convergence/ITxStartEnd.hpp> 00037 00038 #include <WNS/ldk/fu/Plain.hpp> 00039 #include <WNS/ldk/Delayed.hpp> 00040 00041 #include <WNS/events/CanTimeout.hpp> 00042 #include <WNS/Observer.hpp> 00043 00044 namespace wifimac { namespace draftn { 00045 00046 class DeAggregationCommand: 00047 public wns::ldk::Command, 00048 public wifimac::convergence::TxDurationProviderCommand 00049 { 00050 public: 00051 DeAggregationCommand() 00052 { 00053 local.txDuration = 0; 00054 peer.finalFragment = true; 00055 peer.singleFragment = true; 00056 }; 00057 00058 struct { 00059 wns::simulator::Time txDuration; 00060 } local; 00061 00062 struct { 00063 bool finalFragment; 00064 bool singleFragment; 00065 } peer; 00066 00067 struct {} magic; 00068 00069 wns::simulator::Time getDuration() const { return local.txDuration; } 00070 }; 00071 00095 class DeAggregation : 00096 public wns::ldk::fu::Plain<DeAggregation, DeAggregationCommand>, 00097 public wns::ldk::Delayed<DeAggregation>, 00098 public wns::events::CanTimeout, 00099 public wifimac::convergence::TxStartEndNotification, 00100 public wns::Observer<wifimac::convergence::ITxStartEnd> 00101 { 00102 public: 00103 00104 DeAggregation(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00105 00106 virtual 00107 ~DeAggregation(); 00108 00112 void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const; 00113 00116 void 00117 onTxStart(const wns::ldk::CompoundPtr& compound); 00118 00121 void 00122 onTxEnd(const wns::ldk::CompoundPtr& compound); 00123 00124 private: 00129 void 00130 processIncoming(const wns::ldk::CompoundPtr& compound); 00131 00139 void 00140 processOutgoing(const wns::ldk::CompoundPtr& compound); 00141 00143 bool 00144 hasCapacity() const; 00145 00147 const wns::ldk::CompoundPtr 00148 hasSomethingToSend() const; 00149 00151 wns::ldk::CompoundPtr 00152 getSomethingToSend(); 00153 00155 void onFUNCreated(); 00156 00158 void onTimeout(); 00159 00160 const std::string managerName; 00161 const std::string protocolCalculatorName; 00162 const std::string txStartEndName; 00163 const std::string aggregationCommandName; 00164 00166 std::deque<wns::ldk::CompoundPtr> txQueue; 00167 00169 wns::ldk::CompoundPtr currentTxCompound; 00170 00174 wns::ldk::CompoundPtr currentRxContainer; 00175 00177 bool doSignalTxStart; 00178 00180 int numEntries; 00181 00182 wns::logger::Logger logger; 00183 00186 wifimac::management::ProtocolCalculator *protocolCalculator; 00187 00188 struct Friends 00189 { 00190 wifimac::lowerMAC::Manager* manager; 00191 } friends; 00192 }; 00193 } // draftn 00194 } // wifimac 00195 00196 #endif // WIFIMAC_DRAFTN_DEAGGREGATION_HPP
1.5.5