User Manual, Developers Guide and API Documentation

RTSCTS.cpp

Go to the documentation of this file.
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 #include <WIFIMAC/lowerMAC/RTSCTS.hpp>
00030 #include <WIFIMAC/convergence/PhyMode.hpp>
00031 #include <DLL/Layer2.hpp>
00032 #include <WNS/probe/bus/utils.hpp>
00033 #include <WNS/ldk/Port.hpp>
00034 
00035 using namespace wifimac::lowerMAC;
00036 
00037 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00038     wifimac::lowerMAC::RTSCTS,
00039     wns::ldk::FunctionalUnit,
00040     "wifimac.lowerMAC.RTSCTS",
00041     wns::ldk::FUNConfigCreator);
00042 
00043 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00044     wifimac::lowerMAC::RTSCTS,
00045     wns::ldk::probe::Probe,
00046     "wifimac.lowerMAC.RTSCTS",
00047     wns::ldk::FUNConfigCreator);
00048 
00049 RTSCTS::RTSCTS(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config_) :
00050     wns::ldk::fu::Plain<RTSCTS, RTSCTSCommand>(fun),
00051     phyUserName(config_.get<std::string>("phyUserName")),
00052     managerName(config_.get<std::string>("managerName")),
00053     protocolCalculatorName(config_.get<std::string>("protocolCalculatorName")),
00054     arqName(config_.get<std::string>("arqName")),
00055     navName(config_.get<std::string>("navName")),
00056     rxsName(config_.get<std::string>("rxStartName")),
00057     txStartEndName(config_.get<std::string>("txStartEndName")),
00058 
00059     sifsDuration(config_.get<wns::simulator::Time>("myConfig.sifsDuration")),
00060     maximumACKDuration(config_.get<wns::simulator::Time>("myConfig.maximumACKDuration")),
00061     maximumCTSDuration(config_.get<wns::simulator::Time>("myConfig.maximumCTSDuration")),
00062     preambleProcessingDelay(config_.get<wns::simulator::Time>("myConfig.preambleProcessingDelay")),
00063     ctsTimeout(config_.get<wns::simulator::Time>("myConfig.ctsTimeout")),
00064     rtsctsPhyMode(config_.getView("myConfig.rtsctsPhyMode")),
00065     rtsBits(config_.get<Bit>("myConfig.rtsBits")),
00066     ctsBits(config_.get<Bit>("myConfig.ctsBits")),
00067     rtsctsThreshold(config_.get<Bit>("myConfig.rtsctsThreshold")),
00068     rtsctsOnTxopData(config_.get<bool>("myConfig.rtsctsOnTxopData")),
00069 
00070     nav(false),
00071     navSetter(),
00072     logger(config_.get("logger")),
00073 
00074     pendingRTS(),
00075     pendingCTS(),
00076     pendingMPDU(),
00077 
00078     state(idle)
00079 {
00080     MESSAGE_SINGLE(NORMAL, this->logger, "created, threshold: " << rtsctsThreshold << "b");
00081 
00082     protocolCalculator = NULL;
00083     friends.phyUser = NULL;
00084     friends.manager = NULL;
00085     friends.arq = NULL;
00086 
00087     this->ctsPrepared = 0;
00088     this->lastTimeout = 0;
00089 
00090     // read the local IDs from the config
00091     wns::probe::bus::ContextProviderCollection localContext(&fun->getLayer()->getContextProviderCollection());
00092     for (int ii = 0; ii<config_.len("localIDs.keys()"); ++ii)
00093     {
00094         std::string key = config_.get<std::string>("localIDs.keys()",ii);
00095         unsigned long int value  = config_.get<unsigned long int>("localIDs.values()",ii);
00096         localContext.addProvider(wns::probe::bus::contextprovider::Constant(key, value));
00097         MESSAGE_SINGLE(VERBOSE, logger, "Using Local IDName '"<<key<<"' with value: "<<value);
00098     }
00099     rtsSuccessProbe = wns::probe::bus::collector(localContext, config_, "rtsSuccessProbeName");
00100 }
00101 
00102 
00103 RTSCTS::~RTSCTS()
00104 {
00105 }
00106 
00107 void RTSCTS::onFUNCreated()
00108 {
00109     MESSAGE_SINGLE(NORMAL, this->logger, "onFUNCreated() started");
00110 
00111     friends.phyUser = getFUN()->findFriend<wifimac::convergence::PhyUser*>(phyUserName);
00112     assure(friends.phyUser, "Could not get phyUser from my FUN");
00113 
00114     friends.manager = getFUN()->findFriend<wifimac::lowerMAC::Manager*>(managerName);
00115 
00116     friends.arq = getFUN()->findFriend<wifimac::lowerMAC::ITransmissionCounter*>(arqName);
00117 
00118     // Observe NAV
00119     this->wns::Observer<INetworkAllocationVector>::startObserving(getFUN()->findFriend<wifimac::convergence::NAVNotification*>(navName));
00120 
00121     // Observe rxStartEnd
00122     this->wns::Observer<wifimac::convergence::IRxStartEnd>::startObserving
00123         (getFUN()->findFriend<wifimac::convergence::RxStartEndNotification*>(rxsName));
00124 
00125     // Observe txStartEnd
00126     this->wns::Observer<wifimac::convergence::ITxStartEnd>::startObserving
00127         (getFUN()->findFriend<wifimac::convergence::TxStartEndNotification*>(txStartEndName));
00128 
00129     protocolCalculator = getFUN()->getLayer<dll::ILayer2*>()->getManagementService<wifimac::management::ProtocolCalculator>(protocolCalculatorName);
00130 }
00131 
00132 bool
00133 RTSCTS::doIsAccepting(const wns::ldk::CompoundPtr& compound) const
00134 {
00135     switch(friends.manager->getFrameType(compound->getCommandPool()))
00136     {
00137     case DATA_TXOP:
00138         if(not this->rtsctsOnTxopData)
00139         {
00140             return(getConnector()->hasAcceptor(compound));
00141         }
00142     case DATA:
00143         if(compound->getLengthInBits() < this->rtsctsThreshold)
00144         {
00145             return(getConnector()->hasAcceptor(compound));
00146         }
00147         else
00148         {
00149             return (this->pendingMPDU == wns::ldk::CompoundPtr());
00150         }
00151     default:
00152         throw wns::Exception("Unknown frame type");
00153         break;
00154     }
00155 }
00156 
00157 void
00158 RTSCTS::doSendData(const wns::ldk::CompoundPtr& compound)
00159 {
00160     assure(this->pendingMPDU == wns::ldk::CompoundPtr(),
00161            "Cannot have two MPDUs");
00162     assure(this->pendingRTS == wns::ldk::CompoundPtr(),
00163            "Cannot have two RTSs");
00164 
00165     switch(friends.manager->getFrameType(compound->getCommandPool()))
00166     {
00167     case DATA_TXOP:
00168         if(not this->rtsctsOnTxopData)
00169         {
00170             break;
00171         }
00172         // fall through to DATA if RTS/CTS during TXOP is activ
00173     case DATA:
00174         if(compound->getLengthInBits() < this->rtsctsThreshold)
00175         {
00176             MESSAGE_SINGLE(NORMAL, this->logger,
00177                            "Outgoing DATA with size " << compound->getLengthInBits() << ", below threshold");
00178         }
00179         else
00180         {
00181             MESSAGE_SINGLE(NORMAL, this->logger,
00182                            "Outgoing DATA with size " << compound->getLengthInBits() << "-> Save and send RTS");
00183             this->pendingMPDU = compound;
00184             this->pendingRTS = this->prepareRTS(this->pendingMPDU);
00185 
00186             // RTS/CTS initializes mini-TXOP for compound, it can be send
00187             // directly after SIFS
00188             friends.manager->setFrameType(this->pendingMPDU->getCommandPool(), DATA_TXOP);
00189 
00190             // try to send RTS
00191             if(getConnector()->hasAcceptor(this->pendingRTS))
00192             {
00193                 state = transmitRTS;
00194                 getConnector()->getAcceptor(compound)->sendData(this->pendingRTS);
00195                 this->pendingRTS = wns::ldk::CompoundPtr();
00196             }
00197             return;
00198         }
00199         break;
00200     default:
00201         throw wns::Exception("Unknown frame type");
00202         break;
00203     }
00204 
00205     // try to send data
00206     if(getConnector()->hasAcceptor(compound))
00207     {
00208         getConnector()->getAcceptor(compound)->sendData(compound);
00209     }
00210     else
00211     {
00212         this->pendingMPDU = compound;
00213     }
00214 }
00215 
00216 void
00217 RTSCTS::doWakeup()
00218 {
00219     if(this->pendingCTS)
00220     {
00221         throw wns::Exception("Received wakeup, but CTS is pending");
00222 
00223         /*
00224         MESSAGE_SINGLE(NORMAL, this->logger, "CTS to "<< friends.manager->getReceiverAddress(this->pendingCTS->getCommandPool()) << " pending");
00225         if(getConnector()->hasAcceptor(this->pendingCTS))
00226         {
00227             MESSAGE_SINGLE(NORMAL, this->logger, "Sending CTS frame to "<< friends.manager->getReceiverAddress(this->pendingCTS->getCommandPool()));
00228             assure(this->ctsPrepared == wns::simulator::getEventScheduler()->getTime(),
00229                    "ctsPrepared is " << this->ctsPrepared << ", but time is " <<  wns::simulator::getEventScheduler()->getTime());
00230             getConnector()->getAcceptor(this->pendingCTS)->sendData(this->pendingCTS->copy());
00231             this->pendingCTS =  wns::ldk::CompoundPtr();
00232         }
00233         else
00234         {
00235             return;
00236         }
00237         */
00238     }
00239 
00240     if(this->pendingRTS)
00241     {
00242         assure(this->pendingMPDU, "pendingRTS but no pendingMPDU");
00243         MESSAGE_SINGLE(NORMAL, this->logger, "RTS to "<< friends.manager->getReceiverAddress(this->pendingRTS->getCommandPool()) << " pending");
00244         if(getConnector()->hasAcceptor(this->pendingRTS))
00245         {
00246             MESSAGE_SINGLE(NORMAL, this->logger, "Sending RTS frame to "<< friends.manager->getReceiverAddress(this->pendingRTS->getCommandPool()));
00247             state = transmitRTS;
00248             getConnector()->getAcceptor(this->pendingRTS)->sendData(this->pendingRTS->copy());
00249             this->pendingRTS =  wns::ldk::CompoundPtr();
00250         }
00251         else
00252         {
00253             return;
00254         }
00255     }
00256 
00257     if(this->pendingMPDU)
00258     {
00259         if(state == idle)
00260         {
00261             throw wns::Exception("Received wakeup, but MPDU is pending");
00262         }
00263         else
00264         {
00265             // waiting for CTS...
00266             return;
00267         }
00268         /*
00269         MESSAGE_SINGLE(NORMAL, this->logger, "MPDU to "<< friends.manager->getReceiverAddress(this->pendingMPDU->getCommandPool()) << " pending");
00270         if(getConnector()->hasAcceptor(this->pendingMPDU))
00271         {
00272             MESSAGE_SINGLE(NORMAL, this->logger, "Sending MPDU to "<< friends.manager->getReceiverAddress(this->pendingMPDU->getCommandPool()));
00273             getConnector()->getAcceptor(this->pendingMPDU)->sendData(this->pendingMPDU->copy());
00274             this->pendingMPDU =  wns::ldk::CompoundPtr();
00275             getReceptor()->wakeup();
00276         }
00277         else
00278         {
00279             return;
00280         }
00281         */
00282     }
00283     getReceptor()->wakeup();
00284 }
00285 
00286 void
00287 RTSCTS::doOnData(const wns::ldk::CompoundPtr& compound)
00288 {
00289     if(not getFUN()->getProxy()->commandIsActivated(compound->getCommandPool(), this))
00290     {
00291         // deliver frame
00292         MESSAGE_SINGLE(NORMAL, this->logger, "Received frame -> deliver");
00293         getDeliverer()->getAcceptor(compound)->onData(compound);
00294         return;
00295     } // no RTSCTS command
00296 
00297     if(getCommand(compound->getCommandPool())->peer.isRTS)
00298     {
00299         if(nav)
00300         {
00301             if(friends.manager->getTransmitterAddress(compound->getCommandPool()) == navSetter)
00302             {
00303                 MESSAGE_BEGIN(NORMAL, this->logger, m, "Incoming RTS from ");
00304                 m << friends.manager->getTransmitterAddress(compound->getCommandPool());
00305                 m << ", nav busy from " << navSetter;
00306                 m << " -> reply with CTS";
00307                 MESSAGE_END();
00308 
00309                 assure(this->pendingCTS == wns::ldk::CompoundPtr(),
00310                        "Old pending CTS not transmitted");
00311                 this->pendingCTS = this->prepareCTS(compound);
00312             }
00313             else
00314             {
00315                 MESSAGE_BEGIN(NORMAL, this->logger, m, "Incoming RTS from ");
00316                 m << friends.manager->getTransmitterAddress(compound->getCommandPool());
00317                 m << ", nav busy from " << navSetter;
00318                 m << " -> Drop";
00319                 MESSAGE_END();
00320                 return;
00321             }
00322         }
00323         else
00324         {
00325             MESSAGE_SINGLE(NORMAL, this->logger, "Incoming RTS, nav idle -> reply with CTS");
00326             assure(this->pendingCTS == wns::ldk::CompoundPtr(),
00327                    "Old pending CTS not transmitted");
00328             this->pendingCTS = this->prepareCTS(compound); 
00329         }
00330 
00331         // try to send CTS
00332         assure(this->pendingCTS, "CTS should be pending now");
00333         if(getConnector()->hasAcceptor(this->pendingCTS))
00334         {
00335             getConnector()->getAcceptor(this->pendingCTS)->sendData(this->pendingCTS);
00336             this->pendingCTS = wns::ldk::CompoundPtr();
00337         }
00338         else
00339         {
00340             throw wns::Exception("pending CTS is not accepted");
00341         }
00342     } // is RTS
00343     else
00344     {
00345         // received CTS on transmitted RTS --> successfully reserved the channel
00346         // for data
00347         assure(this->pendingMPDU, "Received CTS, but no pending MPDU");
00348         if(state != receptionFinished)
00349         {
00350             MESSAGE_BEGIN(NORMAL, this->logger, m, "received CTS although state is not receptionFinished, now: ");
00351             m << wns::simulator::getEventScheduler()->getTime();
00352             m << ", last timeout: " << this->lastTimeout << "\n";
00353             if(state == transmitRTS)
00354                 m << "state is transmitRTS\n";
00355             if(state == waitForCTS)
00356                 m << "state is waitForCTS\n";
00357             if(state == receiveCTS)
00358                 m << "state is receiveCTS\n";
00359             if(state == idle)
00360                 m << "state is idle\n";
00361             MESSAGE_END();
00362         }
00363         assure(state == receptionFinished,
00364                "received CTS although state is idle, now: " << wns::simulator::getEventScheduler()->getTime() << ", last timeout: " << this->lastTimeout);
00365         if(friends.manager->getTransmitterAddress(compound->getCommandPool())
00366            != friends.manager->getReceiverAddress(this->pendingMPDU->getCommandPool()))
00367         {
00368                 MESSAGE_SINGLE(NORMAL, this->logger,
00369                                "Incoming CTS does not match the receiver's address on the pending MPDU -> do nothing");
00370                 return;
00371         }
00372         else
00373         {
00374             assure(this->pendingMPDU, "Received CTS, but no pendingMPDU");
00375             MESSAGE_SINGLE(NORMAL, this->logger, "Received CTS, sending MPDU to "<< friends.manager->getReceiverAddress(this->pendingMPDU->getCommandPool()));
00376             rtsSuccessProbe->put(this->pendingMPDU, 1);
00377             state = idle;
00378             if(this->hasTimeoutSet())
00379             {
00380                 this->cancelTimeout();
00381             }
00382             if(getConnector()->hasAcceptor(this->pendingMPDU))
00383             {
00384                 getConnector()->getAcceptor(this->pendingMPDU)->sendData(this->pendingMPDU->copy());
00385                 this->pendingMPDU =  wns::ldk::CompoundPtr();
00386                 // ready for new MPDU
00387                 getReceptor()->wakeup();
00388             }
00389             else
00390             {
00391                 throw wns::Exception("pending MPDU is not accepted");
00392             }
00393         }
00394     }
00395 }
00396 
00397 void
00398 RTSCTS::onTxStart(const wns::ldk::CompoundPtr& /*compound*/)
00399 {
00400 
00401 }
00402 
00403 void
00404 RTSCTS::onTxEnd(const wns::ldk::CompoundPtr& compound)
00405 {
00406     if(this->pendingMPDU and
00407        (getFUN()->getProxy()->commandIsActivated(compound->getCommandPool(), this)) and
00408        (getCommand(compound->getCommandPool())->peer.isRTS) and
00409        (state == transmitRTS))
00410     {
00411         state = waitForCTS;
00412         setNewTimeout(ctsTimeout);
00413         MESSAGE_BEGIN(NORMAL, logger, m, "RTS to ");
00414         m << friends.manager->getReceiverAddress(compound->getCommandPool());
00415         m << " is sent, waiting for CTS for ";
00416         m << ctsTimeout;
00417         MESSAGE_END();
00418     }
00419 }
00420 
00421 void
00422 RTSCTS::onRxStart(wns::simulator::Time /*expRxTime*/)
00423 {
00424     if(state == waitForCTS)
00425     {
00426         assure(this->hasTimeoutSet(), "state waitForCTS but no timeout set?");
00427         assure(this->pendingMPDU, "state waitForCTS but no pendingMPDU?");
00428         //cancelTimeout();
00429         MESSAGE_SINGLE(NORMAL, logger,
00430                        "got rxStartIndication, cancel timeout");
00431         state = receiveCTS;
00432     }
00433 }
00434 
00435 void
00436 RTSCTS::onRxEnd()
00437 {
00438     if(state == receiveCTS)
00439     {
00440         assure(this->pendingMPDU, "state receiveCTS but no pendingMPDU?");
00441         MESSAGE_SINGLE(NORMAL, logger,
00442                        "onRxEnd and waiting for CTS -> set short timeout");
00443         state = receptionFinished;
00444 
00445         // wait some time for the delivery
00446         setNewTimeout(10e-9);
00447     }
00448 }
00449 
00450 void
00451 RTSCTS::onRxError()
00452 {
00453     if(state == receiveCTS)
00454     {
00455         assure(this->pendingMPDU, "state waitForCTS/receiveCTS but no pendingMPDU?");
00456         MESSAGE_SINGLE(NORMAL, logger,
00457                        "onRxError and waiting for CTS -> failure!");
00458         state = waitForCTS;
00459 
00460         if(not hasTimeoutSet())
00461         {
00462             // waiting period is over
00463             this->onTimeout();
00464         }
00465     }
00466 }
00467 
00468 void RTSCTS::onNAVBusy(const wns::service::dll::UnicastAddress setter)
00469 {
00470     nav = true;
00471     navSetter = setter;
00472     MESSAGE_SINGLE(NORMAL, logger, "onNAVBusy from " << navSetter);
00473 }
00474 
00475 void RTSCTS::onNAVIdle()
00476 {
00477     nav = false;
00478     MESSAGE_SINGLE(NORMAL, logger, "onNAVIdle");
00479 }
00480 
00481 void
00482 RTSCTS::onTimeout()
00483 {
00484     if(state == receiveCTS)
00485     {
00486         MESSAGE_SINGLE(NORMAL, this->logger, "Started reception during wait for CTS -> wait for delivery");
00487         return;
00488     }
00489     assure(state != idle, "onTimeout although state is idle");
00490 
00491     // reception of cts has failed --> frame has failed
00492     MESSAGE_SINGLE(NORMAL, this->logger, "No CTS received -> transmission has failed");
00493 
00494     rtsSuccessProbe->put(this->pendingMPDU, 0);
00495 
00496     // re-convert MPDU type from DATA_TXOP to DATA
00497     friends.manager->setFrameType(this->pendingMPDU->getCommandPool(), DATA);
00498     friends.arq->onTransmissionHasFailed(this->pendingMPDU);
00499 
00500     this->pendingMPDU = wns::ldk::CompoundPtr();
00501     state = idle;
00502 
00503     this->lastTimeout = wns::simulator::getEventScheduler()->getTime();
00504 
00505     getReceptor()->wakeup();
00506 }
00507 
00508 wns::ldk::CompoundPtr
00509 RTSCTS::prepareRTS(const wns::ldk::CompoundPtr& mpdu)
00510 {
00511     // Calculate duration of the mpdu for NAV setting
00512 
00513     wns::simulator::Time duration =
00514         protocolCalculator->getDuration()->MPDU_PPDU(mpdu->getLengthInBits(),
00515                                                      friends.manager->getPhyMode(mpdu->getCommandPool()));
00516 
00517     wns::simulator::Time nav =
00518         sifsDuration
00519         + maximumCTSDuration
00520         + sifsDuration
00521         + duration
00522         + sifsDuration
00523         + maximumACKDuration;
00524 
00525     wns::ldk::CompoundPtr rts =
00526         friends.manager->createCompound(friends.manager->getTransmitterAddress(mpdu->getCommandPool()),   // tx address
00527                                         friends.manager->getReceiverAddress(mpdu->getCommandPool()),      // rx address
00528                                         friends.manager->getFrameType(mpdu->getCommandPool()),            // frame type
00529                                         nav,               // NAV
00530                                         ctsTimeout);  // requires direct reply after timeout
00531 
00532     wns::ldk::CommandPool* rtsCP = rts->getCommandPool();
00533     friends.manager->setPhyMode(rtsCP, rtsctsPhyMode);
00534     RTSCTSCommand* rtsctsC = this->activateCommand(rtsCP);
00535     rtsctsC->peer.isRTS = true;
00536 
00537     /* set the transmission counter to the same value as the mpdu */
00538     friends.arq->copyTransmissionCounter(mpdu, rts);
00539 
00540     MESSAGE_BEGIN(NORMAL, this->logger, m, "Prepare RTS frame");
00541     m << " to " << friends.manager->getReceiverAddress(rtsCP);
00542     m << " with NAV " << nav;
00543     MESSAGE_END();
00544 
00545     return(rts);
00546 }
00547 
00548 wns::ldk::CompoundPtr
00549 RTSCTS::prepareCTS(const wns::ldk::CompoundPtr& rts)
00550 {
00551     wns::ldk::CommandPool* rtsCP = rts->getCommandPool();
00552 
00553     // calculate nav from rts
00554     wns::simulator::Time nav = friends.manager->getFrameExchangeDuration(rtsCP) - sifsDuration - maximumCTSDuration;
00555     wns::ldk::CompoundPtr cts = friends.manager->createCompound(friends.manager->getReceiverAddress(rtsCP),
00556                                                                 friends.manager->getTransmitterAddress(rtsCP),
00557                                                                 ACK,
00558                                                                 nav,
00559                                                                 sifsDuration + preambleProcessingDelay);
00560     friends.manager->setPhyMode(cts->getCommandPool(), rtsctsPhyMode);
00561     RTSCTSCommand* rtsctsC = this->activateCommand(cts->getCommandPool());
00562     rtsctsC->peer.isRTS = false;
00563 
00564     MESSAGE_BEGIN(NORMAL, this->logger, m, "Prepare CTS frame");
00565     m << " to " << friends.manager->getTransmitterAddress(rtsCP);
00566     m << " with NAV " << nav;
00567     MESSAGE_END();
00568 
00569     this->ctsPrepared = wns::simulator::getEventScheduler()->getTime();
00570 
00571     return(cts);
00572 }
00573 
00574 void
00575 RTSCTS::calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const
00576 {
00577     if(getFUN()->getProxy()->commandIsActivated(commandPool, this))
00578     {
00579         if(getCommand(commandPool)->peer.isRTS)
00580         {
00581             commandPoolSize = this->rtsBits;
00582             dataSize = 0;
00583             MESSAGE_SINGLE(VERBOSE, this->logger, "Calculate size for RTS: " << rtsBits);
00584         }
00585         else
00586         {
00587             commandPoolSize = this->ctsBits;
00588             dataSize = 0;
00589             MESSAGE_SINGLE(VERBOSE, this->logger, "Calculate size for CTS: " << ctsBits);
00590         }
00591     }
00592     else
00593     {
00594         getFUN()->getProxy()->calculateSizes(commandPool, commandPoolSize, dataSize, this);
00595     }
00596 }
00597 

Generated on Fri May 25 03:32:12 2012 for openWNS by  doxygen 1.5.5