![]() |
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 #ifndef TCP_SERVICE_HPP 00029 #define TCP_SERVICE_HPP 00030 00031 #include <set> 00032 00033 #include <TCP/HandshakeStrategyHandlerInterface.hpp> 00034 #include <TCP/FlowHandler.hpp> 00035 00036 #include <WNS/container/Registry.hpp> 00037 #include <WNS/service/tl/Service.hpp> 00038 #include <WNS/service/tl/PortPool.hpp> 00039 #include <WNS/service/nl/Service.hpp> 00040 #include <WNS/service/tl/FlowID.hpp> 00041 #include <WNS/service/dll/FlowEstablishmentAndRelease.hpp> 00042 #include <WNS/service/dll/FlowID.hpp> 00043 #include <WNS/service/qos/QoSClasses.hpp> 00044 #include <WNS/ldk/Group.hpp> 00045 #include <WNS/ldk/FlowSeparator.hpp> 00046 00047 00048 namespace tcp { 00049 00050 class Connection; 00051 class UpperConvergence; 00052 class LowerConvergence; 00053 class HandshakeStrategyInterface; 00054 class FlowHandler; 00055 00061 class Service: 00062 virtual public wns::service::tl::Service, 00063 virtual public HandshakeStrategyHandlerInterface, 00064 public wns::ldk::ControlService, 00065 virtual public wns::ldk::flowseparator::FlowInfoProvider 00066 { 00067 public: 00068 Service(UpperConvergence* _upperConvergence, 00069 LowerConvergence* _lowerConvergence, 00070 wns::ldk::FlowSeparator* _flowSeparator, 00071 const wns::pyconfig::View& _pyco, 00072 tcp::FlowHandler* _tcpFlowHandler, 00073 wns::service::dll::FlowEstablishmentAndRelease* _fear, 00074 wns::ldk::ControlServiceRegistry* _csr); 00075 00076 virtual 00077 ~Service(); 00078 00079 virtual void 00080 listenOnPort( 00081 wns::service::tl::Port _port, 00082 wns::service::tl::ConnectionHandler* _ch); 00083 00092 virtual void 00093 openConnection( 00094 wns::service::tl::Port _port, 00095 wns::service::nl::FQDN _source, 00096 wns::service::nl::FQDN _peerAddress, 00097 wns::service::qos::QoSClass _qosClass, 00098 wns::service::tl::ConnectionHandler* _ch); 00099 00100 virtual void 00101 openConnectionContinue( 00102 wns::service::tl::FlowID flowID, wns::service::dll::FlowID dllFlowID = 0); 00103 00104 void 00105 dllFlowChanged(wns::service::tl::FlowID flowID, wns::service::dll::FlowID dllFlowID); 00106 00107 virtual void 00108 closeConnection(wns::service::tl::Connection* _connection); 00109 00119 void 00120 passiveOpenConnection(const wns::service::tl::FlowID& _flowID); 00121 00126 void 00127 stopListenOnPort(wns::service::tl::Port _port); 00128 00132 void 00133 setDataTransmissionService(wns::service::nl::Service* service); 00134 00135 void 00136 setDNSService(wns::service::nl::DNSService* service); 00137 00138 void 00139 setTcpFlowHandlerService(tcp::FlowHandler* service); 00140 00145 bool 00146 isListening(wns::service::tl::Port _port); 00147 00152 wns::service::nl::Service* 00153 getIPService(); 00154 00155 void 00156 deleteFlowSeparatorInstance(const wns::service::tl::FlowID& _flowID); 00157 00162 virtual void 00163 connectionEstablished(const wns::service::tl::FlowID& _flowID); 00164 00165 virtual void 00166 connectionClosed(const wns::service::tl::FlowID& _flowID); 00167 00172 virtual void 00173 passiveClosed(const wns::service::tl::FlowID& _flowID); 00174 00181 void 00182 addFlowSeparatorInstance(const wns::service::tl::FlowID& _flowID); 00183 00187 HandshakeStrategyInterface* 00188 getHandshakeStrategyFU(const wns::service::tl::FlowID& _flowID); 00189 00194 Connection* 00195 getConnection(const wns::service::tl::FlowID& _flowID); 00196 00200 virtual bool 00201 isValidFlow(const wns::ldk::ConstKeyPtr& _key) const; 00202 00203 private: 00207 class RemoveFlowSeparatorInstance 00208 { 00209 public: 00216 RemoveFlowSeparatorInstance(Service* _tlService, const wns::service::tl::FlowID& _flowID) 00217 { 00218 assure(_tlService, "No valid instance of TL service!"); 00219 tlService = _tlService; 00220 flowID = _flowID; 00221 } 00222 00227 void 00228 operator()() 00229 { 00230 tlService->deleteFlowSeparatorInstance(flowID); 00231 } 00232 00233 private: 00237 Service* tlService; 00238 00242 wns::service::tl::FlowID flowID; 00243 }; 00244 00248 simTimeType removeDelay; 00249 00253 wns::service::nl::Service* ipService; 00254 00255 wns::service::nl::DNSService* dns; 00256 00257 tcp::FlowHandler* tcpFlowHandler; 00258 00262 wns::container::Registry< 00263 wns::service::tl::FlowID, 00264 Connection*, 00265 wns::container::registry::NoneOnErase> flowIDToConnections; 00266 00270 wns::container::Registry< 00271 wns::service::tl::FlowID, 00272 wns::service::tl::ConnectionHandler*, 00273 wns::container::registry::NoneOnErase> flowIDToConnectionHandler; 00274 00278 wns::container::Registry<wns::service::tl::Port, wns::service::tl::ConnectionHandler*> listeners; 00279 00283 wns::service::tl::PortPool portPool; 00284 00288 wns::logger::Logger logger; 00289 00290 wns::pyconfig::View pyco; 00291 00295 UpperConvergence* upperConvergence; 00296 00300 LowerConvergence* lowerConvergence; 00301 00305 wns::ldk::FlowSeparator* flowSeparator; 00306 wns::service::dll::FlowEstablishmentAndRelease* flowEstablishmentAndRelease; 00307 }; 00308 } // namespace tcp 00309 00310 #endif // NOT defined TCP_SERVICE_HPP
1.5.5