![]() |
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 CONSTANZE_TCPLISTENERBINDING_HPP 00029 #define CONSTANZE_TCPLISTENERBINDING_HPP 00030 00031 #include <CONSTANZE/Binding.hpp> 00032 #include <CONSTANZE/Generator.hpp> 00033 #include <CONSTANZE/Listener.hpp> 00034 00035 #include <WNS/service/nl/Address.hpp> 00036 #include <WNS/service/tl/Service.hpp> 00037 #include <WNS/service/tl/ConnectionHandler.hpp> 00038 #include <WNS/service/tl/DataHandler.hpp> 00039 #include <WNS/service/tl/Connection.hpp> 00040 #include <WNS/service/tl/PortPool.hpp> 00041 #include <WNS/PyConfigViewCreator.hpp> 00042 00043 #include <WNS/logger/Logger.hpp> 00044 #include <WNS/module/Base.hpp> 00045 00046 00047 namespace constanze 00048 { 00049 class TcpListenerBinding: 00050 public Binding, 00051 public wns::service::tl::ConnectionHandler, 00052 public wns::service::tl::DataHandler 00053 { 00054 public: 00055 TcpListenerBinding(const wns::pyconfig::View& _pyco); 00056 virtual ~TcpListenerBinding() {}; 00057 00058 // from Binding 00059 virtual void 00060 registerComponent(wns::node::component::Component* _component); 00061 00062 virtual void 00063 sendData(const wns::osi::PDUPtr& _data); 00064 00065 virtual void 00066 initBinding(constanze::StartTrigger* _trgger); 00067 00068 virtual void 00069 releaseBinding(constanze::StopTrigger* _trigger); 00070 00071 virtual void 00072 registerListener(constanze::Listener* _listener); 00073 00074 // from ConnectionHandler 00075 00076 virtual void 00077 onConnectionEstablished(wns::service::nl::Address _sourceIpAddress, wns::service::tl::Connection* _newConnection); 00078 00079 virtual void 00080 onConnectionClosed(wns::service::tl::Connection* _connection); 00081 00082 virtual void 00083 onConnectionClosedByPeer(wns::service::tl::Connection* _connection); 00084 00085 virtual void 00086 onConnectionLost(wns::service::tl::Connection* _connection); 00087 00088 // from DataHandler 00089 virtual void 00090 onData(const wns::osi::PDUPtr& _data); 00091 00092 protected: 00093 wns::pyconfig::View pyco; 00094 00095 wns::service::nl::Address ownAddress; 00096 00097 wns::service::tl::Port listenPort; 00098 00099 wns::service::tl::Service* tcpService; 00100 00101 wns::service::tl::ConnectionHandler* connectionHandler; 00102 00103 constanze::Listener* listener; 00104 00105 wns::node::component::Component* component; 00106 00107 00108 00112 wns::logger::Logger log; 00113 00114 virtual std::string printAddress() const; 00115 00116 }; 00117 } //constanze 00118 00119 #endif
1.5.5