LEFT | RIGHT |
(no file at all) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle. |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu> |
| 19 */ |
| 20 |
| 21 #ifndef JAMMER_HELPER_H |
| 22 #define JAMMER_HELPER_H |
| 23 |
| 24 #include "ns3/attribute.h" |
| 25 #include "ns3/object-factory.h" |
| 26 #include "ns3/node-container.h" |
| 27 #include "ns3/ptr.h" |
| 28 #include "ns3/wireless-module-utility.h" |
| 29 #include "ns3/jammer.h" |
| 30 #include "wireless-module-utility-helper.h" |
| 31 #include "jammer-container.h" |
| 32 |
| 33 namespace ns3 { |
| 34 |
| 35 /** |
| 36 * \brief Creates Jammer objects \ref ns3::Jammer. |
| 37 * |
| 38 * Note that the jammer object depends on the WirelessModuleUtility object. The |
| 39 * helper will make sure a WirelessModuleUtility object is installed before |
| 40 * installing jammer. |
| 41 * |
| 42 * New types of jammers can reuse most of this base class by inheriting from |
| 43 * this base class and overwriting the DoInstall method. |
| 44 * |
| 45 * Note that this helper installs ns3::ConstantJammer by default. |
| 46 */ |
| 47 class JammerHelper |
| 48 { |
| 49 public: |
| 50 JammerHelper (); |
| 51 ~JammerHelper (); |
| 52 |
| 53 /** |
| 54 * \param type The type of jammer to create. |
| 55 * |
| 56 * Sets the type of jammer to create for Install method. |
| 57 */ |
| 58 void SetJammerType (std::string type); |
| 59 |
| 60 /** |
| 61 * \returns The name of the type of jammer to create. |
| 62 */ |
| 63 std::string GetJammerType (void) const; |
| 64 |
| 65 /** |
| 66 * \param name Name of attribute to set. |
| 67 * \param v Value of the attribute. |
| 68 * |
| 69 * Sets one of the attributes of underlying Jammer. |
| 70 */ |
| 71 void Set (std::string name, const AttributeValue &v); |
| 72 |
| 73 /** |
| 74 * \param node The node on which a jammer object must be created. |
| 75 * \returns Container contains all the Jammer object created by this method. |
| 76 */ |
| 77 JammerContainer Install (Ptr<Node> node) const; |
| 78 |
| 79 /** |
| 80 * \param c The set of nodes on which a jammer object must be created. |
| 81 * \returns Container contains all the Jammer object created by this method. |
| 82 */ |
| 83 JammerContainer Install (NodeContainer c) const; |
| 84 |
| 85 /** |
| 86 * \param nodeName The name of node on which a jammer object must be created. |
| 87 * \returns Container contains all the Jammer object created by this method. |
| 88 */ |
| 89 JammerContainer Install (std::string nodeName) const; |
| 90 |
| 91 /** |
| 92 * Helper to enable all Jammer log components with one statement. |
| 93 */ |
| 94 static void EnableLogComponents (void); |
| 95 |
| 96 |
| 97 private: |
| 98 /** |
| 99 * \brief Installs a Jammer onto the specified node. |
| 100 * |
| 101 * \param node Pointer to node to install the jammer. |
| 102 * \returns Pointer to the newly installed jammer. |
| 103 */ |
| 104 virtual Ptr<Jammer> DoInstall (Ptr<Node> node) const; |
| 105 |
| 106 private: |
| 107 ObjectFactory m_jammer; |
| 108 |
| 109 }; |
| 110 |
| 111 } // namespace ns3 |
| 112 |
| 113 #endif /* JAMMER_HELPER_H */ |
LEFT | RIGHT |