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