![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiMeMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2011 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 5, 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 WIMEMAC_DRP_DRPMANAGER_H 00030 #define WIMEMAC_DRP_DRPMANAGER_H 00031 00032 #include <WNS/service/dll/Address.hpp> 00033 #include <WIMEMAC/management/BeaconCommand.hpp> 00034 00035 #include <boost/bind.hpp> 00036 00037 #include <WNS/events/scheduler/Callable.hpp> 00038 #include <WNS/events/scheduler/Interface.hpp> 00039 #include <WNS/simulator/Time.hpp> 00040 #include <WNS/simulator/ISimulator.hpp> 00041 #include <WIMEMAC/helper/IDRPQueueInterface.hpp> 00042 #include <WIMEMAC/drp/DRPPatternCreator.hpp> 00043 00044 #include <WNS/logger/Logger.hpp> 00045 00046 #include <vector> 00047 #include <algorithm> 00048 00049 namespace wimemac { namespace drp { 00050 00051 typedef std::vector<bool> Vector; 00052 00053 class DRPManager: 00054 00055 public DRPPatternCreator 00056 { 00057 public: 00058 DRPManager(wns::service::dll::UnicastAddress TargetAddress, 00059 wimemac::management::BeaconCommand::ReservationType InitialType, wimemac::management::BeaconCommand::ReasonCode InitialReason, 00060 wimemac::management::BeaconCommand::DeviceType InitialDevice, Vector DRPSlotMap, 00061 helper::IDRPQueueInterface* QueueInterface, wns::logger::Logger logger_, wimemac::lowerMAC::Manager* manager_, 00062 int numberOfBPSlots_, bool useRateAdaptation_, double patternPEROffset_, wimemac::convergence::PhyMode DefPhyMode); 00063 00064 DRPManager(wns::service::dll::UnicastAddress TargetAddress, 00065 wimemac::management::BeaconCommand::ReservationType InitialType, wimemac::management::BeaconCommand::ReasonCode InitialReason, 00066 wimemac::management::BeaconCommand::DeviceType InitialDevice, Vector DRPSlotMap, helper::IDRPQueueInterface* QueueInterface, wns::logger::Logger logger_, wimemac::lowerMAC::Manager* manager_, int numberOfBPSlots_, bool useRateAdaptation_, double patternPEROffset_); 00067 00068 wns::service::dll::UnicastAddress GetAddress(); 00069 00070 void SetReservationType(wimemac::management::BeaconCommand::ReservationType); 00071 wimemac::management::BeaconCommand::ReservationType GetReservationType(); 00072 00073 void SetReasonCode(wimemac::management::BeaconCommand::ReasonCode); 00074 wimemac::management::BeaconCommand::ReasonCode GetReasonCode(); 00075 00076 void SetMergeReasonCode(wimemac::management::BeaconCommand::ReasonCode); 00077 wimemac::management::BeaconCommand::ReasonCode GetMergeReasonCode(); 00078 00079 void SetDeviceType(wimemac::management::BeaconCommand::DeviceType deviceType); 00080 wimemac::management::BeaconCommand::DeviceType GetDeviceType(); 00081 00082 bool areMASsAvailable(Vector DRPGlobal); 00083 00084 void FindNewPattern(Vector DRPGlobal); 00085 void CreateAdditionalPattern(Vector DRPGlobal); 00086 00087 void SetPattern(Vector DRPreservation); 00088 Vector GetPattern(); 00089 void SetMergePattern(Vector DRPreservation); 00090 Vector GetMergePattern(); 00091 00092 void ResolveConflict(); 00093 void ResolveMergeConflict(); 00094 00095 void RegisterReservation(wns::simulator::Time BPDuration); 00096 void StartRegisterReservation(wns::simulator::Time BPDuration); 00097 00098 void SetStatus(bool ConnectionStatus); 00099 bool GetStatus(); 00100 void SetMergeStatus(bool ConnectionStatus); 00101 bool GetMergeStatus(); 00102 00103 void AddReservation(wimemac::management::BeaconCommand::ReasonCode mergeReasonCode_, Vector mergeMap_); 00104 void MergePatterns(); 00105 00106 bool IsMapCreated(); 00107 bool NeedsAdditionalPattern(); 00108 bool HasPendingDRPMerge(); 00109 void Transmit(wns::simulator::Time duration); 00110 00111 void UpdatePhyModeDown(wimemac::convergence::PhyMode phyMode_); 00112 00113 private: 00114 00115 enum wimemac::management::BeaconCommand::ReservationType reservationtype; 00116 enum wimemac::management::BeaconCommand::ReasonCode reasoncode; 00117 enum wimemac::management::BeaconCommand::ReasonCode mergereasoncode; 00118 enum wimemac::management::BeaconCommand::DeviceType devicetype; 00119 00120 bool connectionstatus; 00121 bool mergeconnectionstatus; 00122 bool needsAdditionalPattern; 00123 bool hasPendingDRPMerge; 00124 int waitSFsForNewAvailIE; 00125 00126 const bool useRateAdaptation; 00127 00128 Vector DRPAllocMap; 00129 Vector tmpDRPAllocMap; 00130 Vector tmpDRPMergeMap; 00131 Vector::iterator it; 00132 wns::service::dll::UnicastAddress peerAddress; 00133 wns::simulator::Time duration; 00134 wns::simulator::Time ReservationStart; 00135 00136 wns::events::scheduler::Interface* scheduler; 00137 wns::events::scheduler::Callable call; 00138 00139 wns::logger::Logger logger; 00140 wns::service::dll::UnicastAddress test; 00141 00142 helper::IDRPQueueInterface* QueueInterface; 00143 00144 }; 00145 }//drp 00146 }//wimemac 00147 #endif
1.5.5