![]() |
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. 5, 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 #include <IP/tunnel/TunnelEntryComponent.hpp> 00029 00030 using namespace ip::tunnel; 00031 00032 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00033 TunnelEntryComponent, 00034 wns::node::component::Interface, 00035 "ip.tunnelEntry", 00036 wns::node::component::ConfigCreator); 00037 00038 TunnelEntryComponent::TunnelEntryComponent(wns::node::Interface* _node, const wns::pyconfig::View& _pyco) : 00039 wns::node::component::Component(_node, _pyco), 00040 ipService(NULL), 00041 log(_pyco.get("logger")) 00042 { 00043 } 00044 00045 void 00046 TunnelEntryComponent::doStartup() 00047 { 00048 this->tunnelEntryAddress = wns::service::nl::Address(getConfig().get<std::string>("tunnelEntryAddress")); 00049 this->tunnelExitAddress = wns::service::nl::Address(getConfig().get<std::string>("tunnelExitAddress")); 00050 00051 // We are a DLL, I got the transmission with me! 00052 addService(getConfig().get<std::string>("dataTransmission"), this); 00053 } 00054 00055 TunnelEntryComponent::~TunnelEntryComponent() 00056 { 00057 } 00058 00059 void 00060 TunnelEntryComponent::onNodeCreated() 00061 { 00062 MESSAGE_SINGLE(NORMAL, log, "Retrieving IP service to inject tunneled packets."); 00063 std::string ipname = getConfig().get<std::string>("ipService"); 00064 this->ipService = getService<wns::service::nl::Service*>(ipname); 00065 assure(this->ipService, "No IP Service could be found!"); 00066 } 00067 00068 void 00069 TunnelEntryComponent::onWorldCreated() 00070 { 00071 } 00072 00073 void 00074 TunnelEntryComponent::onShutdown() 00075 { 00076 } 00077 00078 void 00079 TunnelEntryComponent::sendData(const wns::service::dll::UnicastAddress&, 00080 const wns::osi::PDUPtr& data, 00081 wns::service::dll::protocolNumber, 00082 int /*_dllFlowID*/) 00083 { 00084 MESSAGE_SINGLE(NORMAL, log, "Tunneling a packet."); 00085 assure(this->ipService, "No IP Service could be found!"); 00086 this->ipService->sendData(this->tunnelEntryAddress, this->tunnelExitAddress, data, wns::service::nl::IP); 00087 } 00088 00089 wns::service::dll::UnicastAddress 00090 TunnelEntryComponent::getMACAddress() const 00091 { 00092 MESSAGE_SINGLE(NORMAL, log, "getMACAddress called"); 00093 return wns::service::dll::UnicastAddress(); 00094 }
1.5.5