![]() |
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-2009 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * email: info@openwns.org 00009 * www: http://www.openwns.org 00010 * _____________________________________________________________________________ 00011 * 00012 * openWNS is free software; you can redistribute it and/or modify it under the 00013 * terms of the GNU Lesser General Public License version 2 as published by the 00014 * Free Software Foundation; 00015 * 00016 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00017 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00018 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00019 * details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public License 00022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 * 00024 ******************************************************************************/ 00025 00026 #ifndef WIMAC_UPPERCONVERGENCE_HPP 00027 #define WIMAC_UPPERCONVERGENCE_HPP 00028 00029 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00030 #include <WNS/ldk/Forwarding.hpp> 00031 #include <WNS/ldk/FUNConfigCreator.hpp> 00032 #include <WNS/ldk/HasConnector.hpp> 00033 #include <WNS/ldk/HasReceptor.hpp> 00034 #include <WNS/ldk/HasDeliverer.hpp> 00035 #include <WNS/ldk/Forwarding.hpp> 00036 #include <WNS/ldk/FirstServeConnector.hpp> 00037 #include <WNS/logger/Logger.hpp> 00038 #include <WNS/ldk/tools/UpUnconnectable.hpp> 00039 #include <WNS/ldk/tools/DownUnconnectable.hpp> 00040 00041 #include <WNS/service/dll/DataTransmission.hpp> 00042 #include <WNS/service/dll/Handler.hpp> 00043 #include <WNS/service/dll/FlowEstablishmentAndRelease.hpp> 00044 #include <WNS/pyconfig/View.hpp> 00045 00046 #include <WIMAC/RANG.hpp> 00047 #include <WIMAC/ConnectionIdentifier.hpp> 00048 00049 namespace wimac { 00050 00055 class UpperCommand : 00056 public wns::ldk::Command 00057 { 00058 public: 00059 UpperCommand() 00060 { 00061 peer.sourceMACAddress = wns::service::dll::UnicastAddress(); 00062 peer.targetMACAddress = wns::service::dll::UnicastAddress(); 00063 local.qosClass = ConnectionIdentifier::BE; 00064 } 00065 00066 struct { 00067 wns::service::dll::FlowID dllFlowID; 00068 ConnectionIdentifier::QoSCategory qosClass; 00069 } local; 00070 struct { 00071 wns::service::dll::UnicastAddress sourceMACAddress; 00072 wns::service::dll::UnicastAddress targetMACAddress; 00073 } peer; 00075 struct {} magic; 00076 }; 00077 00086 class UpperConvergence : 00087 public virtual wns::ldk::FunctionalUnit, 00088 public virtual wns::service::dll::UnicastDataTransmission, 00089 public virtual wns::service::dll::Notification, 00090 public virtual wns::service::dll::FlowEstablishmentAndRelease, 00091 public wns::ldk::CommandTypeSpecifier<UpperCommand>, 00092 public wns::ldk::HasReceptor<>, 00093 public wns::ldk::HasConnector<wns::ldk::FirstServeConnector>, 00094 public wns::ldk::HasDeliverer<>, 00095 public wns::Cloneable<UpperConvergence> 00096 { 00097 public: 00098 UpperConvergence(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00099 00100 // DataTransmission service 00101 virtual void 00102 sendData( 00103 const wns::service::dll::UnicastAddress& _peer, 00104 const wns::SmartPtr<wns::osi::PDU>& _data, 00105 wns::service::dll::protocolNumber protocol, 00106 wns::service::dll::FlowID _dllFlowID = 0);//************* 00107 00108 virtual std::string 00109 getSubnetIdentifier() { return "WIMAC";} 00110 00111 virtual void 00112 setMACAddress(const wns::service::dll::UnicastAddress& sourceMACAddress); 00113 00114 virtual wns::service::dll::UnicastAddress 00115 getMACAddress() const; 00116 00117 virtual void 00118 onFUNCreated(); 00119 00120 virtual wns::ldk::CommandPool* 00121 createReply(const wns::ldk::CommandPool* original) const; 00122 00123 virtual void 00124 registerHandler(wns::service::dll::protocolNumber protocol, 00125 wns::service::dll::Handler* _dh); 00126 00127 void 00128 doOnData(const wns::ldk::CompoundPtr& compound); 00129 00130 void 00131 doSendData(const wns::ldk::CompoundPtr& compound); 00132 00133 bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00134 00135 void doWakeup(); 00136 00137 virtual void 00138 registerFlowHandler(wns::service::dll::FlowHandler*); 00139 00140 virtual void 00141 registerIRuleControl(wns::service::dll::IRuleControl*){}; 00142 00143 virtual void 00144 establishFlow(wns::service::tl::FlowID flowID, wns::service::qos::QoSClass qosClass); 00145 00146 virtual void 00147 releaseFlow(wns::service::tl::FlowID flowID){}; 00148 00149 protected: 00150 wns::service::dll::UnicastAddress sourceMACAddress_; 00151 00152 wns::service::dll::Handler* dataHandler_; 00153 wns::service::dll::FlowHandler* tlFlowHandler; 00154 00155 std::map<long int, ConnectionIdentifier::QoSCategory> flowID2QosClass; 00156 00157 static long int dllFlowID; 00158 00159 wimac::RANG* rang_; 00160 }; 00161 00170 class NoUpperConvergence : 00171 public virtual wns::ldk::FunctionalUnit, 00172 public wns::ldk::tools::UpUnconnectable, 00173 public wns::ldk::tools::DownUnconnectable, 00174 public wns::ldk::CommandTypeSpecifier<UpperCommand>, 00175 public wns::Cloneable<NoUpperConvergence> 00176 { 00177 public: 00178 NoUpperConvergence(wns::ldk::fun::FUN* fun, const wns::pyconfig::View&) : 00179 wns::ldk::CommandTypeSpecifier<UpperCommand>(fun) 00180 {} 00181 }; 00182 } 00183 00184 #endif 00185 00186
1.5.5