![]() |
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_CRC_CRC_HPP 00029 #define WNS_LDK_CRC_CRC_HPP 00030 00031 #include <WNS/ldk/fu/Plain.hpp> 00032 #include <WNS/ldk/SuspendableInterface.hpp> 00033 #include <WNS/ldk/SuspendSupport.hpp> 00034 #include <WNS/probe/bus/ContextCollector.hpp> 00035 #include <WNS/pyconfig/View.hpp> 00036 #include <WNS/logger/Logger.hpp> 00037 #include <WNS/distribution/Uniform.hpp> 00038 00039 namespace wns { namespace ldk { namespace crc { 00040 00041 class CRCCommand : 00042 public Command 00043 { 00044 public: 00045 CRCCommand() 00046 { 00047 local.checkOK = false; 00048 } 00049 00050 /* 00051 * I - Information Frame 00052 * RR - Receiver Ready (ACK) 00053 */ 00054 struct { 00055 bool checkOK; 00056 } local; 00057 struct {} peer; 00058 struct {} magic; 00059 00060 }; 00061 00062 00067 class CRC : 00068 public fu::Plain<CRC, CRCCommand>, 00069 virtual public SuspendableInterface, 00070 public SuspendSupport 00071 { 00072 public: 00073 // FUNConfigCreator interface realisation 00074 CRC(fun::FUN* fuNet, const wns::pyconfig::View& config); 00075 ~CRC(); 00076 00077 virtual void onFUNCreated(); 00078 00079 // SDU and PCI size calculation 00080 void calculateSizes(const CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const; 00081 00082 bool 00083 isMarking() const; 00084 00085 private: 00086 virtual void 00087 doSendData(const CompoundPtr& compound); 00088 00089 virtual void 00090 doOnData(const CompoundPtr& compound); 00091 00092 virtual bool 00093 doIsAccepting(const CompoundPtr& compound) const; 00094 00095 virtual void 00096 doWakeup() 00097 { 00098 getReceptor()->wakeup(); 00099 } // wakeup 00100 00101 virtual bool 00102 onSuspend() const 00103 { 00104 return true; 00105 } // onSuspend 00106 00111 wns::distribution::StandardUniform dis; 00112 00117 int checkSumLength; 00118 00119 std::string PERProviderName; 00120 00128 typedef enum { DROPPING, MARKING } Behaviour; 00129 Behaviour behaviour; 00130 00131 struct Friends { 00132 FunctionalUnit* PERProvider; 00133 } friends; 00134 00135 logger::Logger logger; 00136 00137 // Probe variables 00138 wns::probe::bus::ContextCollectorPtr lossRatio; 00139 }; 00140 00141 } // crc 00142 } // ldk 00143 } // wns 00144 00145 #endif // NOT defined WNS_LDK_CRC_CRC_HPP 00146 00147
1.5.5