![]() |
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_BLOCKUNTILREPLY_HPP 00030 #define WIFIMAC_DRAFTN_BLOCKUNTILREPLY_HPP 00031 00032 #include <WIFIMAC/lowerMAC/Manager.hpp> 00033 #include <WIFIMAC/convergence/IRxStartEnd.hpp> 00034 #include <WIFIMAC/convergence/ITxStartEnd.hpp> 00035 00036 #include <WNS/ldk/fu/Plain.hpp> 00037 #include <WNS/events/CanTimeout.hpp> 00038 00039 namespace wifimac { namespace draftn { 00040 00052 class BlockUntilReply: 00053 public wns::ldk::fu::Plain<BlockUntilReply, wns::ldk::EmptyCommand>, 00054 public wns::events::CanTimeout, 00055 public wns::Observer<wifimac::convergence::ITxStartEnd>, 00056 public wns::Observer<wifimac::convergence::IRxStartEnd> 00057 { 00058 public: 00059 BlockUntilReply(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00060 virtual ~BlockUntilReply(); 00061 00063 void onFUNCreated(); 00064 00066 void doSendData(const wns::ldk::CompoundPtr& compound); 00067 void doOnData(const wns::ldk::CompoundPtr& compound); 00068 bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00069 void doWakeup(); 00070 00072 void onTimeout(); 00073 00075 void onTxStart(const wns::ldk::CompoundPtr& compound); 00076 void onTxEnd(const wns::ldk::CompoundPtr& compound); 00077 00079 void onRxStart(wns::simulator::Time expRxTime); 00080 void onRxEnd(); 00081 void onRxError(); 00082 00083 private: 00084 const wns::simulator::Time sifsDuration; 00085 const std::string managerName; 00086 const std::string txStartEndName; 00087 const std::string rxStartEndName; 00088 00089 bool blocked; 00090 enum TxStatus { 00091 waiting, 00092 transmitting, 00093 finished }; 00094 TxStatus txStatus; 00095 wns::Birthmark blockedBy; 00096 00097 wns::logger::Logger logger; 00098 00099 struct Friends 00100 { 00101 wifimac::lowerMAC::Manager* manager; 00102 } friends; 00103 }; 00104 } // end namespace draftn 00105 } // end namespace wifimac 00106 00107 #endif // ifndef WIFIMAC_DRAFTN_BLOCKUNTILREPLY_HPP
1.5.5