User Manual, Developers Guide and API Documentation

eNB.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. 16, 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/eNB.hpp>
00029 #include <LTE/controlplane/flowmanagement/IFlowManager.hpp>
00030 
00031 #include <DLL/UpperConvergence.hpp>
00032 #include <DLL/StationManager.hpp>
00033 #include <DLL/Layer2.hpp>
00034 
00035 using namespace lte::rlc;
00036 
00037 STATIC_FACTORY_REGISTER_WITH_CREATOR(ENBRLC,
00038                      wns::ldk::FunctionalUnit,
00039                      "lte.rlc.eNB",
00040                      wns::ldk::FUNConfigCreator);
00041 
00042 
00043 ENBRLC::ENBRLC(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config) :
00044   wns::ldk::CommandTypeSpecifier<RLCCommand>(fun),
00045   wns::ldk::Processor<ENBRLC>(),
00046   logger(config.get("logger"))
00047 {
00048     friends.flowswitching = NULL;
00049     upperConvergenceReader = NULL;
00050 } // ENBRLC
00051 
00052 
00053 ENBRLC::~ENBRLC()
00054 {
00055 }
00056 
00057 void
00058 ENBRLC::onFUNCreated()
00059 {
00060     dll::ILayer2* layer2 = getFUN()->getLayer<dll::ILayer2*>();
00061 
00062     upperConvergenceReader = getFUN()->getCommandReader("upperConvergence");
00063 
00064     friends.flowswitching = layer2->getControlService<lte::controlplane::flowmanagement::IFlowSwitching>("FlowManagerBS");
00065 
00066     MESSAGE_SINGLE(VERBOSE, logger, "onFUNCreated(): complete");
00067 }
00068 
00069 void
00070 ENBRLC::processIncoming(const wns::ldk::CompoundPtr& compound)
00071 {
00072     lte::rlc::RLCCommand* command = getCommand(compound->getCommandPool());
00073     command->rang.flowID =  friends.flowswitching->getFlowIDout(command->peer.flowID);
00074 } // processIncoming
00075 
00076 
00077 void
00078 ENBRLC::processOutgoing(const wns::ldk::CompoundPtr& compound)
00079 {
00080     assure(upperConvergenceReader, "No reader for upper convergence set!");
00081     dll::UpperCommand* upper = upperConvergenceReader->readCommand<dll::UpperCommand>(compound->getCommandPool());
00082     assure(upper, "Erroneous Upper Convergence Command!");
00083 
00084     RLCCommand* command = activateCommand(compound->getCommandPool());
00085     wns::service::dll::FlowID flowID = friends.flowswitching->getFlowIDin(upper->local.dllFlowID /* RANG-to-BS */);
00086     wns::service::qos::QoSClass qosClass = friends.flowswitching->getQoSClassForBSFlowID(flowID);
00087     command->local.direction = PacketDirection::DOWNLINK();
00088     command->peer.source = getFUN()->getLayer<dll::ILayer2*>()->getDLLAddress();
00089     command->peer.destination = upper->peer.targetMACAddress;
00090 
00091     MESSAGE_SINGLE(NORMAL, logger, "processOutgoing(): incoming FlowID(DL)="<<upper->local.dllFlowID<<", outgoing FlowID="<<flowID<<", QoS="<<lte::helper::QoSClasses::toString(qosClass));
00092     command->peer.qosClass = qosClass;
00093     command->peer.flowID = flowID;
00094     command->rang.flowID = 0;
00095 } // processOutgoing
00096 
00097 wns::ldk::CommandPool*
00098 ENBRLC::createReply(const wns::ldk::CommandPool* original) const
00099 {
00100     wns::ldk::CommandPool* commandPool = getFUN()->createCommandPool();
00101     RLCCommand* inRLCCommand = getCommand(original);
00102     RLCCommand* outRLCCommand = activateCommand(commandPool);
00103 
00104     outRLCCommand->local.direction = PacketDirection::DOWNLINK();
00105     outRLCCommand->peer.source = getFUN()->getLayer<dll::ILayer2*>()->getDLLAddress();
00106     outRLCCommand->peer.destination = inRLCCommand->peer.source;
00107 
00108     outRLCCommand->peer.flowID = inRLCCommand->peer.flowID;
00109     outRLCCommand->rang.flowID = 0; // ControlPlaneFlowID
00110 
00111     return commandPool;
00112 } // createReply

Generated on Sun May 27 03:32:05 2012 for openWNS by  doxygen 1.5.5