1
/*******************************************************************************
2
* This file is part of openWNS (open Wireless Network Simulator)
3
* _____________________________________________________________________________
5
* Copyright (C) 2004-2007
6
* Chair of Communication Networks (ComNets)
7
* Kopernikusstr. 5, D-52074 Aachen, Germany
8
* phone: ++49-241-80-27910,
9
* fax: ++49-241-80-22242
10
* email: info@openwns.org
11
* www: http://www.openwns.org
12
* _____________________________________________________________________________
14
* openWNS is free software; you can redistribute it and/or modify it under the
15
* terms of the GNU Lesser General Public License version 2 as published by the
16
* Free Software Foundation;
18
* openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
19
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
23
* You should have received a copy of the GNU Lesser General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
******************************************************************************/
28
#include <IP/tunnel/TunnelEntryComponent.hpp>
30
using namespace ip::tunnel;
32
STATIC_FACTORY_REGISTER_WITH_CREATOR(
34
wns::node::component::Interface,
36
wns::node::component::ConfigCreator);
38
TunnelEntryComponent::TunnelEntryComponent(wns::node::Interface* _node, const wns::pyconfig::View& _pyco) :
39
wns::node::component::Component(_node, _pyco),
41
log(_pyco.get("logger"))
46
TunnelEntryComponent::doStartup()
48
this->tunnelEntryAddress = wns::service::nl::Address(getConfig().get<std::string>("tunnelEntryAddress"));
49
this->tunnelExitAddress = wns::service::nl::Address(getConfig().get<std::string>("tunnelExitAddress"));
51
// We are a DLL, I got the transmission with me!
52
addService(getConfig().get<std::string>("dataTransmission"), this);
55
TunnelEntryComponent::~TunnelEntryComponent()
60
TunnelEntryComponent::onNodeCreated()
62
MESSAGE_SINGLE(NORMAL, log, "Retrieving IP service to inject tunneled packets.");
63
std::string ipname = getConfig().get<std::string>("ipService");
64
this->ipService = getService<wns::service::nl::Service*>(ipname);
65
assure(this->ipService, "No IP Service could be found!");
69
TunnelEntryComponent::onWorldCreated()
74
TunnelEntryComponent::onShutdown()
79
TunnelEntryComponent::sendData(const wns::service::dll::UnicastAddress&,
80
const wns::osi::PDUPtr& data,
81
wns::service::dll::protocolNumber)
83
MESSAGE_SINGLE(NORMAL, log, "Tunneling a packet.");
84
assure(this->ipService, "No IP Service could be found!");
85
this->ipService->sendData(this->tunnelEntryAddress, this->tunnelExitAddress, data, wns::service::nl::IP);
88
wns::service::dll::UnicastAddress
89
TunnelEntryComponent::getMACAddress() const
91
MESSAGE_SINGLE(NORMAL, log, "getMACAddress called");
92
return wns::service::dll::UnicastAddress();