User Manual, Developers Guide and API Documentation

IPHeader.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_IPHEADER_HPP
00029 #define IP_IPHEADER_HPP
00030 
00031 //#include <WNS/ldk/CommandTypeSpecifier.hpp>
00032 //#include <WNS/ldk/Forwarding.hpp>
00033 #include <WNS/ldk/fu/Plain.hpp>
00034 
00035 //#include <WNS/ldk/FUNConfigCreator.hpp>
00036 //#include <WNS/ldk/HasReceptor.hpp>
00037 //#include <WNS/ldk/HasConnector.hpp>
00038 //#include <WNS/ldk/HasDeliverer.hpp>
00039 
00040 #include <WNS/service/nl/Service.hpp>
00041 #include <WNS/service/nl/Address.hpp>
00042 #include <WNS/service/dll/Address.hpp>
00043 #include <WNS/service/dll/DataTransmission.hpp>
00044 #include <WNS/service/dll/FlowID.hpp>
00045 
00046 namespace ip {
00047 
00048     class IPCommand :
00049         public wns::ldk::Command,
00050         public wns::IOutputStreamable
00051     {
00052     public:
00053         IPCommand()
00054         {
00055             this->local.dllName = "";
00056             this->local.isForwarded = false;
00057             this->peer.TTL = 255;
00058         }
00059 
00061         struct Local
00062         {
00063             wns::service::nl::Address nextHop;
00064             wns::service::dll::UnicastAddress destinationDLLAddress;
00065             std::string dllName;
00066             std::string arpZone;
00067             bool isForwarded;
00068             wns::service::dll::UnicastAddress macID;
00069             wns::service::dll::FlowID dllFlowID;
00070         };
00071         Local local;
00072 
00074         struct Peer
00075         {
00076             wns::service::nl::Address source;
00077             wns::service::nl::Address destination;
00078             wns::service::nl::protocolNumber protocol;
00079             int TTL;
00080 //          wns::service::dll::FlowID dllFlowID;
00081         };
00082         Peer peer;
00083 
00084         struct Magic
00085         {
00086         };
00087         Magic magic;
00088 
00089     private:
00090         virtual std::string
00091         doToString() const
00092         {
00093             std::stringstream str;
00094             str << "S: " << peer.source << " D: " << peer.destination
00095                 << " TTL: " << peer.TTL << " Prot: " << peer.protocol
00096                 << " Next: " << local.nextHop << " Via : " << local.dllName << " Forw: " << (local.isForwarded ? "True":"False");
00097             return str.str();
00098         }
00099 
00100     };
00101 
00107     class IPHeader :
00108         public wns::ldk::fu::Plain<IPHeader, IPCommand>
00109     {
00110     public:
00111         IPHeader(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00112 
00113         virtual ~IPHeader() {}
00114 
00115         // We are blackboard, Resistance is futile
00116         virtual bool
00117         doIsAccepting(const wns::ldk::CompoundPtr&) const { return true; }
00118 
00119         virtual void
00120         doSendData(const wns::ldk::CompoundPtr&) {}
00121 
00122         virtual void
00123         doWakeup() {}
00124 
00125         virtual void
00126         doOnData(const wns::ldk::CompoundPtr&) {}
00127 
00128         virtual void
00129         calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00130 
00131     private:
00136         Bit headerSize;
00137 
00138 
00139 
00140     };
00141 } // ip
00142 
00143 
00144 #endif // IP_IPHEADER_HPP

Generated on Thu May 24 03:32:15 2012 for openWNS by  doxygen 1.5.5