![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * TCP 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 #include <CONSTANZE/TcpServerBinding.hpp> 00013 00014 using namespace constanze; 00015 00016 TcpServerBinding::TcpServerBinding(wns::service::nl::Address _address, wns::service::tl::Connection* _connection, wns::logger::Logger& logger): 00017 peerAddress(_address), 00018 connection(_connection), 00019 log(logger) 00020 { 00021 startTrigger = NULL; 00022 stopTrigger = NULL; 00023 //tcpService = NULL; 00024 component = NULL; 00025 MESSAGE_SINGLE(NORMAL, log, "New TcpServerBinding created (peer="<<peerAddress<<")"); 00026 } 00027 00028 void TcpServerBinding::sendData(const wns::osi::PDUPtr& _data) 00029 { 00030 assure(connection, "No connection available."); 00031 MESSAGE_SINGLE(NORMAL, log, "TcpServerBinding ->sendData "); 00032 connection->sendData(_data); 00033 } 00034 00035 void TcpServerBinding::registerComponent(wns::node::component::Component* /*_component*/) 00036 { 00037 /* component = _component; 00038 tcpService = 00039 component->getService<wns::service::tl::Service*>(pyco.get<std::string>("tcpService")); 00040 */ 00041 } 00042 00043 void TcpServerBinding::onConnectionEstablished(wns::service::nl::Address, wns::service::tl::Connection* _connection) 00044 { 00045 connection = _connection; 00046 startTrigger->bindingReady(); 00047 } 00048 00049 void TcpServerBinding::initBinding(constanze::StartTrigger* _startTrigger) 00050 { 00051 startTrigger = _startTrigger; 00052 // openConnection not needed at TcpServerBinding, because connection 00053 // already established; Servers don't start connections 00054 // tcpService->openConnection( destinationPort, domainName, destinationDomainName, this); 00055 } 00056 00057 void TcpServerBinding::releaseBinding(constanze::StopTrigger* _stopTrigger) 00058 { 00059 // closeConnection not needed, 00060 // tcpService->closeConnection( connection ); 00061 stopTrigger = _stopTrigger; 00062 stopTrigger->bindingReady(); 00063 } 00064 00065 void TcpServerBinding::registerListener(constanze::Listener* ) 00066 { 00067 // intentionally left empty 00068 } 00069 void TcpServerBinding::onConnectionClosed(wns::service::tl::Connection*) 00070 { 00071 // intentionally left empty 00072 } 00073 00074 void TcpServerBinding::onConnectionClosedByPeer(wns::service::tl::Connection*) 00075 { 00076 // intentionally left empty 00077 } 00078 00079 void TcpServerBinding::onConnectionLost(wns::service::tl::Connection*) 00080 { 00081 // intentionally left empty 00082 } 00083 00084 std::string 00085 TcpServerBinding::printAddress() const 00086 { 00087 std::ostringstream tmp; 00088 //tmp << ownAddress << ":" << listenPort; 00089 tmp << peerAddress; 00090 return tmp.str(); 00091 } 00092 00093 00094 00095
1.5.5