User Manual, Developers Guide and API Documentation

Routing.hpp

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 #ifndef IP_ROUTING_HPP
00029 #define IP_ROUTING_HPP
00030 
00031 #include <IP/IPHeader.hpp>
00032 #include <IP/container/RoutingTable.hpp>
00033 #include <IP/container/DataLink.hpp>
00034 
00035 #include <WNS/service/nl/Address.hpp>
00036 #include <WNS/service/dll/DataTransmission.hpp>
00037 
00038 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00039 #include <WNS/ldk/HasConnector.hpp>
00040 #include <WNS/ldk/HasReceptor.hpp>
00041 #include <WNS/ldk/HasDeliverer.hpp>
00042 #include <WNS/ldk/Processor.hpp>
00043 #include <WNS/ldk/Command.hpp>
00044 
00045 #include <WNS/logger/Logger.hpp>
00046 
00047 namespace ip {
00048 
00054     class Routing:
00055         public wns::ldk::CommandTypeSpecifier<>,
00056         public wns::ldk::HasReceptor<>,
00057         public wns::ldk::HasConnector<>,
00058         public wns::ldk::HasDeliverer<>,
00059         public wns::ldk::Processor<Routing>,
00060         public wns::Cloneable<Routing>
00061     {
00062         typedef wns::service::nl::Address Address;
00063         typedef wns::service::dll::UnicastDataTransmission DLLDataTransmission;
00064     public:
00071         Routing(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& _pyco);
00072 
00076         virtual
00077         ~Routing();
00078 
00083         void
00084         onFUNCreated();
00085 
00086         void
00087         addRoute(const wns::service::nl::Address& netAddress,
00088              const wns::service::nl::Address& gateway,
00089              const wns::service::nl::Address& netMask,
00090              std::string dllName);
00091 
00092         void
00093         printRoutingTable(const wns::service::nl::Address& highlight = Routing::defaultGateway) const;
00094 
00095         void
00096         processOutgoing(const wns::ldk::CompoundPtr&);
00097 
00098         void
00099         processIncoming(const wns::ldk::CompoundPtr&);
00100 
00101         void
00102         setDLLs(container::DataLinkContainer dlc);
00103 
00104     private:
00105         static wns::service::nl::Address defaultGateway;
00106 
00107         wns::ldk::CommandReaderInterface* ipHeaderReader;
00108 
00113         bool
00114         forwardViaRoutingTable(const wns::ldk::CompoundPtr& c);
00115 
00121         container::RoutingTable rt;
00122 
00126         wns::pyconfig::View pyco;
00127 
00131         wns::logger::Logger log;
00132 
00133         container::DataLinkContainer dlls;
00134 
00135     protected:
00139         wns::pyconfig::View
00140         getConfig();
00141     };
00142 
00143 } // ip
00144 #endif // NOT defined IP_ROUTING_HPP
00145 
00146 

Generated on Sun May 27 03:32:17 2012 for openWNS by  doxygen 1.5.5