User Manual, Developers Guide and API Documentation

PostroutingChain.cpp

Go to the documentation of this file.
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/iptables/PostroutingChain.hpp>
00029 
00030 using namespace ip::iptables;
00031 
00032 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00033     PostroutingChain,
00034     wns::ldk::FunctionalUnit,
00035     "ip.iptables.postroutingchain",
00036     wns::ldk::FUNConfigCreator);
00037 
00038 
00039 PostroutingChain::PostroutingChain(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& _pyco):
00040     Chain(fun, _pyco),
00041     wns::Cloneable<PostroutingChain>(),
00042     dllFlowIDTarget(NULL)
00043 {
00044 }
00045 
00046 void
00047 PostroutingChain::onFlowRemoved(wns::service::dll::FlowID flowID)
00048 {
00049     if(hasRules(flowID))
00050     {
00051         removeRules(flowID);
00052         removeFromDLLFlowIDTarget(flowID);
00053     }
00054     else
00055     {
00056         //rules are created when a packet with its Ruletag (flowID) arrive.
00057         //if no packet has ever arrived with this flowID there will be no Rule
00058         //with this RUletag (flowID)!!
00059 
00060         MESSAGE_BEGIN(NORMAL, log, m, "");
00061         m << "Warning! There are no Rules with this RuleTag: " << flowID;
00062         MESSAGE_END();
00063     }
00064 }
00065 
00066 void
00067 PostroutingChain::registerDLLFlowIDTarget(targets::DLLFlowIDTarget* target)
00068 {
00069     dllFlowIDTarget = target;
00070     assure(dllFlowIDTarget, "dllFlowIDTarget not set.");
00071 }
00072 
00073 void
00074 PostroutingChain::removeFromDLLFlowIDTarget(wns::service::dll::FlowID flowID)
00075 {
00076     dllFlowIDTarget->ruleErased(flowID);
00077 }

Generated on Fri May 25 03:32:18 2012 for openWNS by  doxygen 1.5.5