User Manual, Developers Guide and API Documentation

Keys.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiFiMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2007
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 16, D-52074 Aachen, Germany
00009  * phone: ++49-241-80-27910,
00010  * fax: ++49-241-80-22242
00011  * email: info@openwns.org
00012  * www: http://www.openwns.org
00013  * _____________________________________________________________________________
00014  *
00015  * openWNS is free software; you can redistribute it and/or modify it under the
00016  * terms of the GNU Lesser General Public License version 2 as published by the
00017  * Free Software Foundation;
00018  *
00019  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00020  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00021  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00022  * details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00026  *
00027  ******************************************************************************/
00028 
00029 #ifndef WIFIMAC_HELPER_KEYS_HPP
00030 #define WIFIMAC_HELPER_KEYS_HPP
00031 
00032 #include <WNS/ldk/Compound.hpp>
00033 #include <WNS/ldk/fun/FUN.hpp>
00034 #include <WNS/ldk/Key.hpp>
00035 
00036 #include <DLL/UpperConvergence.hpp>
00037 
00038 namespace wifimac { namespace helper {
00039 
00041     class NoKey :
00042         public wns::ldk::Key
00043     {
00044     public:
00045         bool operator<(const wns::ldk::Key& /*other*/) const
00046             {
00047                 return false;
00048             }
00049         std::string str() const // FIXME: should be streaming
00050             {
00051                 std::stringstream ss;
00052                 ss << "noKey";
00053                 return ss.str();
00054             }
00055     };
00056 
00058     class NoKeyBuilder :
00059         public wns::ldk::KeyBuilder
00060     {
00061     public:
00062         NoKeyBuilder(const wns::ldk::fun::FUN* /*fun*/, const wns::pyconfig::View& /*config*/){}; 
00063         virtual void onFUNCreated(){};
00064         virtual wns::ldk::ConstKeyPtr operator () (const wns::ldk::CompoundPtr& /*compound*/, int /*direction*/) const
00065             {
00066                 return wns::ldk::ConstKeyPtr(new NoKey());
00067             }
00068     };
00069 
00070     class LinkByReceiverBuilder;
00071 
00072     class LinkByReceiver:
00073         public wns::ldk::Key
00074     {
00075     public:
00076         LinkByReceiver(const LinkByReceiverBuilder* factory, const wns::ldk::CompoundPtr& compound, int /*direction*/);
00077         LinkByReceiver(wns::service::dll::UnicastAddress _linkId);
00078         bool operator<(const wns::ldk::Key& _other) const;
00079         std::string str() const;    // FIXME(fds): should be streaming
00080 
00081         wns::service::dll::UnicastAddress linkId;
00082     };
00083 
00085     class LinkByReceiverBuilder :
00086         public wns::ldk::KeyBuilder
00087     {
00088     public:
00089         LinkByReceiverBuilder(const wns::ldk::fun::FUN* _fun, const wns::pyconfig::View& config);
00090         virtual void onFUNCreated();
00091         virtual wns::ldk::ConstKeyPtr operator () (const wns::ldk::CompoundPtr& compound, int direction) const;
00092 
00093         const wns::ldk::fun::FUN* fun;
00094     };
00095 
00096     class LinkByTransmitterBuilder;
00097 
00098     class LinkByTransmitter:
00099         public wns::ldk::Key
00100     {
00101     public:
00102         LinkByTransmitter(const LinkByTransmitterBuilder* factory, const wns::ldk::CompoundPtr& compound, int /*direction*/);
00103         LinkByTransmitter(wns::service::dll::UnicastAddress _linkId);
00104         bool operator<(const wns::ldk::Key& _other) const;
00105         std::string str() const;    // FIXME(fds): should be streaming
00106 
00107         wns::service::dll::UnicastAddress linkId;
00108     };
00109 
00111     class LinkByTransmitterBuilder :
00112         public wns::ldk::KeyBuilder
00113     {
00114     public:
00115         LinkByTransmitterBuilder(const wns::ldk::fun::FUN* _fun, const wns::pyconfig::View& config);
00116         virtual void onFUNCreated();
00117         virtual wns::ldk::ConstKeyPtr operator () (const wns::ldk::CompoundPtr& compound, int direction) const;
00118 
00119         const wns::ldk::fun::FUN* fun;
00120     };
00121 
00122     class TransmitterReceiverBuilder;
00123     /* @brief derived from wns::ldk::Key to achieve Flow separation based on the
00124      * MAC Addresses of transmitter and receiver (extracted from unicast/broadcast command)
00125      */
00126 
00127     class TransmitterReceiver :
00128         public wns::ldk::Key
00129     {
00130     public:
00131         TransmitterReceiver(const TransmitterReceiverBuilder* factory, const wns::ldk::CompoundPtr& compound, int /*direction*/);
00132         TransmitterReceiver(wns::service::dll::UnicastAddress txAdr, wns::service::dll::UnicastAddress rxAdr);
00133         bool operator<(const wns::ldk::Key& _other) const;
00134         std::string str() const;    // FIXME(fds): should be streaming
00135 
00136         wns::service::dll::UnicastAddress tx;
00137         wns::service::dll::UnicastAddress rx;
00138     };
00139 
00141     class TransmitterReceiverBuilder :
00142         public wns::ldk::KeyBuilder
00143     {
00144     public:
00145         TransmitterReceiverBuilder(const wns::ldk::fun::FUN* _fun, const wns::pyconfig::View& config);
00146         virtual void onFUNCreated();
00147         virtual wns::ldk::ConstKeyPtr operator () (const wns::ldk::CompoundPtr& compound, int direction) const;
00148 
00149         const wns::ldk::fun::FUN* fun;
00150     };
00151 
00152 } // Helper
00153 } // WiFiMac
00154 
00155 #endif 

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