![]() |
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_FORWARDING_HPP 00029 #define IP_FORWARDING_HPP 00030 00031 #include <IP/IPHeader.hpp> 00032 00033 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00034 #include <WNS/ldk/HasConnector.hpp> 00035 #include <WNS/ldk/HasReceptor.hpp> 00036 #include <WNS/ldk/HasDeliverer.hpp> 00037 #include <WNS/ldk/Dropper.hpp> 00038 #include <WNS/ldk/Command.hpp> 00039 #include <WNS/ldk/Delayed.hpp> 00040 00041 #include <WNS/logger/Logger.hpp> 00042 #include <WNS/service/nl/Address.hpp> 00043 00044 namespace ip { 00045 00049 class ForwardingCommand : 00050 public wns::ldk::Command 00051 { 00052 friend class Forwarding; 00053 public: 00054 struct { 00055 00056 } local; 00057 00058 struct { 00059 00060 } peer; 00061 00062 struct { 00063 } magic; 00064 }; 00065 00071 class Forwarding : 00072 public wns::ldk::CommandTypeSpecifier<ForwardingCommand>, 00073 public wns::ldk::HasReceptor<>, 00074 public wns::ldk::HasConnector<>, 00075 public wns::ldk::HasDeliverer<>, 00076 public wns::ldk::Delayed<Forwarding>, 00077 public wns::Cloneable<Forwarding> 00078 { 00079 typedef wns::service::nl::Address Address; 00080 typedef std::list<wns::service::nl::Address> AddressContainer; 00081 00082 public: 00089 Forwarding(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& _pyco); 00090 00094 virtual 00095 ~Forwarding() 00096 {} 00097 00098 virtual void 00099 onFUNCreated(); 00100 00101 virtual void processIncoming(const wns::ldk::CompoundPtr& compound); 00102 virtual void processOutgoing(const wns::ldk::CompoundPtr&); 00103 virtual bool hasCapacity() const; 00104 virtual const wns::ldk::CompoundPtr hasSomethingToSend() const; 00105 virtual wns::ldk::CompoundPtr getSomethingToSend(); 00106 00107 /* void 00108 doSendData(const wns::ldk::CompoundPtr& compound); 00109 00110 void 00111 doOnData(const wns::ldk::CompoundPtr& compound); 00112 00113 bool 00114 doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00115 00116 void 00117 doWakeup();*/ 00118 00119 void 00120 addListeningAddress(wns::service::nl::Address listenerAddress); 00121 00122 void 00123 removeListeningAddress(wns::service::nl::Address listenerAddress); 00124 00125 private: 00129 bool 00130 reachedDestination(const wns::ldk::CompoundPtr& compound); 00131 00135 bool 00136 putOnNextHop(const wns::ldk::CompoundPtr& compound); 00137 00138 wns::ldk::CommandReaderInterface* ipHeaderReader; 00139 00143 wns::pyconfig::View pyco; 00144 00148 wns::logger::Logger log; 00149 00154 bool isForwarding; 00155 00159 int ttl; 00160 00161 AddressContainer listeningAddresses; 00162 00163 wns::ldk::CompoundPtr buffer; 00164 00165 protected: 00169 wns::pyconfig::View 00170 getConfig(); 00171 00172 }; 00173 } // ip 00174 #endif //_IP_FORWARDING_HPP 00175 00176
1.5.5