User Manual, Developers Guide and API Documentation

TcpServerListenerBinding.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * TCP Listener Binding                                                       *
00003  * __________________________________________________________________________ *
00004  *                                                                            *
00005  * Copyright (C) 2005                                                         *
00006  * Lehrstuhl fuer Kommunikationsnetze (ComNets)                               *
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany                                 *
00008  * phone: ++49-241-80-27910 (phone), fax: ++49-241-80-22242                   *
00009  * email: wns@comnetsrwth-aachen.de, www: http://wns.comnets.rwth-aachen.de/  *
00010  ******************************************************************************/
00011 
00012 #ifndef CONSTANZE_TCPLISTENERBINDING_HPP
00013 #define CONSTANZE_TCPLISTENERBINDING_HPP
00014 
00015 #include <CONSTANZE/Binding.hpp>
00016 #include <CONSTANZE/Generator.hpp>
00017 #include <CONSTANZE/Listener.hpp>
00018 
00019 #include <WNS/service/nl/Service.hpp>
00020 #include <WNS/service/nl/Address.hpp>
00021 //#include <WNS/service/nl/DataHandler.hpp>
00022 #include <WNS/service/tl/Service.hpp>
00023 #include <WNS/service/tl/ConnectionHandler.hpp>
00024 #include <WNS/service/tl/DataHandler.hpp>
00025 #include <WNS/service/tl/Connection.hpp>
00026 #include <WNS/service/tl/PortPool.hpp>
00027 #include <WNS/PyConfigViewCreator.hpp>
00028 
00029 #include <WNS/logger/Logger.hpp>
00030 #include <WNS/module/Base.hpp>
00031 
00032 #include <WNS/container/Registry.hpp>
00033 
00034 
00035 namespace constanze
00036 {
00037     class TcpServerListenerBinding:
00038         public Binding,
00039         public wns::service::tl::ConnectionHandler,
00040         public wns::service::tl::DataHandler
00041     {
00042     public:
00043         TcpServerListenerBinding(const wns::pyconfig::View& _pyco);
00044         virtual ~TcpServerListenerBinding();
00045 
00046         // from Binding
00047         virtual void
00048         registerComponent(wns::node::component::Component* _component);
00049 
00050         virtual void
00051         sendData(const wns::osi::PDUPtr& _data);
00052 
00053         virtual void
00054         initBinding(constanze::StartTrigger* _trgger);
00055 
00056         virtual void
00057         releaseBinding(constanze::StopTrigger* _trigger);
00058 
00059         virtual void
00060         registerListener(constanze::Listener* _listener);
00061 
00062         // from ConnectionHandler
00063 
00064         virtual void
00065         onConnectionEstablished(wns::service::nl::Address _sourceIpAddress, wns::service::tl::Connection* _newConnection);
00066 
00067         virtual void
00068         onConnectionClosed(wns::service::tl::Connection* _connection);
00069 
00070         virtual void
00071         onConnectionClosedByPeer(wns::service::tl::Connection* _connection);
00072 
00073         virtual void
00074         onConnectionLost(wns::service::tl::Connection* _connection);
00075 
00076         // from DataHandler
00077         virtual void
00078         onData(const wns::osi::PDUPtr& _data);
00079 
00080         virtual std::string printAddress() const;
00081 
00082     protected:
00083         wns::pyconfig::View pyco;
00084 
00086         wns::logger::Logger log;
00087 
00088         wns::service::nl::Address ownAddress;
00089         wns::service::nl::Address peerAddress;
00090         wns::service::nl::DNSService* dns;
00091         wns::service::tl::Port listenPort;
00092         wns::service::tl::Service* tcpService;
00093         wns::service::tl::ConnectionHandler* connectionHandler;
00094 
00095         constanze::Listener* listener;
00096         wns::node::component::Component* component;
00097 
00098     private:
00099         wns::pyconfig::View generatorConfig;
00100         GeneratorBase::Creator* c;
00101         std::list<GeneratorBase*> generatorList;
00102     };
00103 } //constanze
00104 
00105 #endif

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