User Manual, Developers Guide and API Documentation

UnacknowledgedMode.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #include <LTE/rlc/UnacknowledgedMode.hpp>
00029 #include <LTE/rlc/RLCCommand.hpp>
00030 #include <DLL/StationManager.hpp>
00031 
00032 using namespace lte::rlc;
00033 
00034 #define A2N(a) layer2->getStationManager()->getStationByMAC(a)->getName()
00035 
00036 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00037     UnacknowledgedMode,
00038     wns::ldk::FunctionalUnit, "lte.rlc.UnacknowledgedMode",
00039     wns::ldk::FUNConfigCreator);
00040 
00041 UnacknowledgedMode::UnacknowledgedMode(wns::ldk::fun::FUN* fun,
00042                                        const wns::pyconfig::View& config):
00043     wns::ldk::sar::SegAndConcat(fun, config),
00044     layer2(NULL)
00045 {
00046     layer2 = fun->getLayer<dll::ILayer2*>();
00047 }
00048 
00049 UnacknowledgedMode::~UnacknowledgedMode()
00050 {
00051 }
00052 
00053 void
00054 UnacknowledgedMode::processIncoming(const wns::ldk::CompoundPtr& compound)
00055 {
00056     SegAndConcat::processIncoming(compound);
00057 
00058     MESSAGE_BEGIN(NORMAL, logger_, m, "processIncoming");
00059     wns::ldk::CommandPool* commandPool = compound->getCommandPool();
00060     wns::ldk::CommandReaderInterface* rlcReader = getFUN()->getCommandReader("rlc");
00061     lte::rlc::RLCCommand* rlcCommand = rlcReader->readCommand<lte::rlc::RLCCommand>(commandPool);
00062     wns::service::dll::FlowID flowID = rlcCommand->peer.flowID;
00063     wns::ldk::sar::SegAndConcatCommand* command;
00064 
00065     command = SegAndConcat::getCommandReader()->readCommand<wns::ldk::sar::SegAndConcatCommand>(commandPool);
00066     m << "(flowID=" << flowID << ",from=" << A2N(rlcCommand->peer.source) << ",sn=" << command->peer.sn_;
00067     m << ",len=" << compound->getLengthInBits() << ")";
00068     MESSAGE_END();
00069 }
00070 
00071 void
00072 UnacknowledgedMode::processOutgoing(const wns::ldk::CompoundPtr& sdu)
00073 {
00074     SegAndConcat::processOutgoing(sdu);
00075 
00076     if(isSegmenting_)
00077     {
00078         MESSAGE_BEGIN(NORMAL, logger_, m, "processOutgoing");
00079         wns::ldk::CommandPool* commandPool = sdu->getCommandPool();
00080         wns::ldk::CommandReaderInterface* rlcReader = getFUN()->getCommandReader("rlc");
00081         lte::rlc::RLCCommand* rlcCommand = rlcReader->readCommand<lte::rlc::RLCCommand>(commandPool);
00082         wns::service::dll::FlowID flowID = rlcCommand->peer.flowID;
00083         wns::ldk::sar::SegAndConcatCommand* command;
00084     command = SegAndConcat::getCommandReader()->readCommand<wns::ldk::sar::SegAndConcatCommand>(commandPool);
00085         m << "(flowID=" << flowID << ",to=" << A2N(rlcCommand->peer.destination) << ",sn=" << command->peer.sn_;
00086         m << ",len=" << sdu->getLengthInBits() << ")";
00087         MESSAGE_END();
00088     }
00089 }

Generated on Sat May 26 03:32:02 2012 for openWNS by  doxygen 1.5.5