![]() |
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 #ifndef IP_IPTABLES_CHAIN_HPP 00029 #define IP_IPTABLES_CHAIN_HPP 00030 00031 #include <IP/IPHeader.hpp> 00032 #include <IP/iptables/filters/FilterInterface.hpp> 00033 #include <IP/iptables/targets/TargetInterface.hpp> 00034 #include <IP/iptables/Rule.hpp> 00035 #include <IP/iptables/IRuleControl.hpp> 00036 00037 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00038 #include <WNS/ldk/HasConnector.hpp> 00039 #include <WNS/ldk/HasReceptor.hpp> 00040 #include <WNS/ldk/HasDeliverer.hpp> 00041 #include <WNS/ldk/Processor.hpp> 00042 #include <WNS/ldk/Command.hpp> 00043 00044 #include <WNS/ldk/fun/FUN.hpp> 00045 #include <WNS/service/dll/DataTransmission.hpp> 00046 #include <WNS/service/dll/Handler.hpp> 00047 #include <WNS/service/tl/TCPHeader.hpp> 00048 00049 //#include <list> 00050 #include <map> 00051 00052 namespace ip { namespace iptables { 00053 00057 class Chain: 00058 public wns::ldk::CommandTypeSpecifier<>, 00059 public wns::ldk::HasReceptor<>, 00060 public wns::ldk::HasConnector<>, 00061 public wns::ldk::HasDeliverer<>, 00062 virtual public wns::ldk::FunctionalUnit, 00063 public ip::iptables::IRuleControl 00064 { 00065 public: 00066 typedef std::list<ip::iptables::Rule> RuleContainer; 00067 00068 Chain(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& _pyco); 00069 00070 virtual 00071 ~Chain(); 00072 00073 virtual void 00074 onFUNCreated(); 00075 00076 virtual bool 00077 doIsAccepting(const wns::ldk::CompoundPtr&) const; 00078 00079 virtual void 00080 doSendData(const wns::ldk::CompoundPtr&); 00081 00082 virtual void 00083 doWakeup(); 00084 00085 virtual void 00086 doOnData(const wns::ldk::CompoundPtr&); 00087 00088 targets::TargetResult 00089 activateChain(IPCommand*, wns::service::tl::ITCPHeader*, wns::service::tl::IUDPHeader*); 00090 00095 virtual bool 00096 activateOutgoing(const IPCommand&) = 0; 00097 00102 virtual bool 00103 activateIncoming(const IPCommand&) = 0; 00104 00105 00113 virtual void 00114 addRule(ip::iptables::Rule); 00115 00119 virtual void 00120 removeRules(ip::iptables::Rule::RuleTag ruleTag); 00121 00122 virtual bool 00123 hasRules(ip::iptables::Rule::RuleTag ruleTag); 00124 00125 virtual ip::iptables::Rule 00126 getRule(ip::iptables::Rule::RuleTag ruleTag); 00127 00128 virtual void 00129 showRules(); 00130 00131 protected: 00135 wns::logger::Logger log; 00136 00137 private: 00138 wns::ldk::CommandReaderInterface* ipHeaderReader; 00139 RuleContainer rules; 00140 }; 00141 00142 00143 }// iptables 00144 }// ip 00145 00146 #endif // IP_IPTABLES_CHAIN_HPP
1.5.5