![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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 <TCP/FlowIDBuilder.hpp> 00029 #include <TCP/UpperConvergence.hpp> 00030 00031 #include <WNS/ldk/FlowSeparator.hpp> 00032 00033 00034 using namespace tcp; 00035 00036 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00037 FlowIDBuilder, 00038 wns::ldk::KeyBuilder, 00039 "tcp.FlowIDBuilder", 00040 wns::ldk::FUNConfigCreator); 00041 00042 FlowIDBuilder::FlowIDBuilder(wns::ldk::fun::FUN* _fun, 00043 const wns::pyconfig::View& _config) : 00044 config(_config), 00045 fun(_fun), 00046 tcpHeaderReader(NULL) 00047 { 00048 } 00049 00050 FlowIDKey::FlowIDKey(const wns::service::tl::FlowID& flowID): 00051 flowID_(flowID) 00052 { 00053 } 00054 00055 bool 00056 FlowIDKey::operator<(const Key& _other) const 00057 { 00058 assureType(&_other, const FlowIDKey*); 00059 const FlowIDKey* other = static_cast<const FlowIDKey*>(&_other); 00060 00061 return flowID_ < other->flowID_; 00062 } 00063 00064 std::string 00065 FlowIDKey::str() const 00066 { 00067 return flowID_.doToString(); 00068 } 00069 00070 void 00071 FlowIDBuilder::onFUNCreated() 00072 { 00073 tcpHeaderReader = fun->getCommandReader("tcp.tcpHeader"); 00074 assure(tcpHeaderReader, "No reader for the TCP Header available!"); 00075 } 00076 00077 wns::ldk::ConstKeyPtr 00078 FlowIDBuilder::operator()(const wns::ldk::CompoundPtr& _compound, int /*_direction*/) const 00079 { 00080 assure(tcpHeaderReader, "No reader for the TCP Header available!"); 00081 TCPCommand* tcpHeader = tcpHeaderReader->readCommand<TCPCommand>( 00082 _compound->getCommandPool()); 00083 00084 wns::ldk::ConstKeyPtr key = wns::ldk::ConstKeyPtr(new FlowIDKey(tcpHeader->peer.flowID)); 00085 00086 return key; 00087 }
1.5.5