![]() |
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_MANAGEMENT_BEACONEVALUATOR_H 00030 #define WIMEMAC_MANAGEMENT_BEACONEVALUATOR_H 00031 00032 #include <WNS/service/dll/Address.hpp> 00033 #include <WNS/container/Registry.hpp> 00034 #include <WIMEMAC/management/BeaconCommand.hpp> 00035 #include <WIMEMAC/drp/DRPmap.hpp> 00036 #include <WIMEMAC/drp/DRPManager.hpp> 00037 #include <WNS/logger/Logger.hpp> 00038 00039 #include <WIMEMAC/helper/IDRPQueueInterface.hpp> 00040 #include <vector> 00041 00042 namespace wimemac { namespace drp { 00043 class DRPManager; 00044 }} 00045 00046 namespace wimemac { namespace lowerMAC { 00047 class Manager; 00048 }} 00049 00050 namespace wimemac { namespace management { 00051 typedef std::vector<bool> Vector; 00052 00060 class BeaconEvaluator 00061 { 00062 public: 00063 BeaconEvaluator(); 00065 void BeaconExamination(wns::service::dll::UnicastAddress tx, wns::service::dll::UnicastAddress iam, BeaconCommand* BeaconCommand, 00066 wns::logger::Logger _logger); 00067 00069 void setFriend(helper::IDRPQueueInterface* QueueInterface); 00070 00072 void setManagerFriend(wimemac::lowerMAC::Manager* manager_); 00073 00075 int CollectDRPmaps(wns::simulator::Time BPDuration); 00076 00077 void CreateDRPMaps(); 00078 void EvaluateConnection(); 00079 00080 void CreateDRPManager(wns::service::dll::UnicastAddress rx, int CompoundspSF, int BitspSF, int MaxCompoundSize, wimemac::convergence::PhyMode DefPhyMode); 00081 void UpdateDRPManager(wns::service::dll::UnicastAddress rx, int CompoundspSF, int BitspSF, int MaxCompoundSize); 00082 00083 bool CreateDRPIE(BeaconCommand* BeaconCommand); 00084 bool CreateBPOIE(BeaconCommand* BeaconCommand); 00085 bool CreateProbeIE(BeaconCommand* BeaconCommand); 00086 00088 void RequestIE(wns::service::dll::UnicastAddress rx, BeaconCommand::ProbeElementID elementID); 00089 00090 void UpdateGlobalHardDRPMap(Vector SoftDRPMap); 00091 void UpdateGlobalSoftDRPMap(Vector HardDRPMap); 00092 void UpdateGlobalDRPMap(Vector DRPMap); 00093 void SetLogger(wns::logger::Logger _logger); 00094 00095 bool UpdateMapWithPeerAvailabilityMap(wns::service::dll::UnicastAddress rx , Vector& DRPMap); 00096 00098 wimemac::convergence::PhyMode 00099 getPhyMode(wns::service::dll::UnicastAddress rx, int masNumber); 00100 00101 void SetBPDuration(wns::simulator::Time duration); 00102 void evaluatePERforConnections(); 00103 Vector getReservedMASs(); 00104 00105 00106 00107 protected: 00108 drp::DRPmap* DRPmapManager; 00109 wns::simulator::Time BPDuration; 00110 int NumberOfBPSlots; 00111 00113 struct Probes 00114 { 00115 int drpAvailability; 00116 } requestedProbes; 00117 00118 Vector getAllocatedMASs(); 00119 00120 wns::simulator::Time BPStartTime; 00121 00122 private: 00123 00124 int calp; 00125 typedef wns::container::Registry<wns::service::dll::UnicastAddress, drp::DRPManager*> ContainerType; 00127 ContainerType DRPIncomingConnections; 00128 ContainerType DRPOutgoingConnections; 00129 ContainerType::const_iterator it; 00130 00131 drp::DRPManager* DRPmanager; 00132 Vector tmpAllocatedMAS; // For allocated MAS probe in beaconbuilder destructor 00133 00134 00135 int getBeaconSlot(); 00136 00137 void ExamineBeaconPeriodOccupancy(wns::service::dll::UnicastAddress tx, BeaconCommand* BeaconCommand); 00138 void InsertInNeighoursBPoccupancy(wns::service::dll::UnicastAddress tx, BeaconCommand* BeaconCommand); 00139 00141 std::vector<wns::service::dll::UnicastAddress> BPoccupancy; 00142 00143 struct BPallocation 00144 { 00145 BPallocation(): 00146 source(wns::service::dll::UnicastAddress::UnicastAddress()) 00147 {} 00148 00149 wns::service::dll::UnicastAddress source; 00150 std::vector<wns::service::dll::UnicastAddress> BPoccupancy; 00151 }; 00152 00154 std::vector<BPallocation> NeighboursBPoccupancy; 00155 00156 wns::container::Registry<wns::service::dll::UnicastAddress, Vector> rxAvailabilityBitmap; 00158 bool hasPendingProbe; 00159 bool FirstEval; 00160 wns::container::Registry<wns::service::dll::UnicastAddress, std::queue<BeaconCommand::ProbeElementID> > pendingProbe; 00161 wns::logger::Logger logger; 00162 helper::IDRPQueueInterface* queueInterface; 00163 00164 struct Friends 00165 { 00166 helper::IDRPQueueInterface* QueueInterface; 00167 wimemac::lowerMAC::Manager* manager; 00168 } friends; 00169 00170 }; 00171 }//management 00172 }//wimemac 00173 #endif
1.5.5