1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2008 INRIA 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 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 19 */ 20 #ifndef OLSR_HELPER_H 21 #define OLSR_HELPER_H 22 23 #include "ns3/object-factory.h" 24 #include "ns3/node.h" 25 #include "ns3/node-container.h" 26 #include "ns3/ipv4-routing-helper.h" 27 #include <map> 28 #include <set> 29 30 namespace ns3 { 31 32 /** 33 * \ingroup olsr 34 * 35 * \brief Helper class that adds OLSR routing to nodes. 36 * 37 * This class is expected to be used in conjunction with 38 * ns3::InternetStackHelper::SetRoutingHelper 39 */ 40 class OlsrHelper : public Ipv4RoutingHelper 41 { 42 public: 43 /** 44 * Create an OlsrHelper that makes life easier for people who want to install 45 * OLSR routing to nodes. 46 */ 47 OlsrHelper (); 48 49 /** 50 * \brief Construct an OlsrHelper from another previously initialized instance 51 * (Copy Constructor). 52 * 53 * \param o object to copy 54 */ 55 OlsrHelper (const OlsrHelper &o); 56 57 /** 58 * \returns pointer to clone of this OlsrHelper 59 * 60 * This method is mainly for internal use by the other helpers; 61 * clients are expected to free the dynamic memory allocated by this method 62 */ 63 OlsrHelper* Copy (void) const; 64 65 /** 66 * \param node the node for which an exception is to be defined 67 * \param interface an interface of node on which OLSR is not to be installed 68 * 69 * This method allows the user to specify an interface on which OLSR is not to be installed on 70 */ 71 void ExcludeInterface (Ptr<Node> node, uint32_t interface); 72 73 /** 74 * \param node the node on which the routing protocol will run 75 * \returns a newly-created routing protocol 76 * 77 * This method will be called by ns3::InternetStackHelper::Install 78 */ 79 virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const; 80 81 /** 82 * \param name the name of the attribute to set 83 * \param value the value of the attribute to set. 84 * 85 * This method controls the attributes of ns3::olsr::RoutingProtocol 86 */ 87 void Set (std::string name, const AttributeValue &value); 88 89 /** 90 * Assign a fixed random variable stream number to the random variables 91 * used by this model. Return the number of streams (possibly zero) that 92 * have been assigned. The Install() method of the InternetStackHelper 93 * should have previously been called by the user. 94 * 95 * \param stream first stream index to use 96 * \param c NodeContainer of the set of nodes for which the OlsrRoutingProtocol 97 * should be modified to use a fixed stream 98 * \return the number of stream indices assigned by this helper 99 */ 100 int64_t AssignStreams (NodeContainer c, int64_t stream); 101 102 private: 103 /** 104 * \brief Assignment operator declared private and not implemented to disallow 105 * assignment and prevent the compiler from happily inserting its own. 106 * \return nothing 107 */ 108 OlsrHelper &operator = (const OlsrHelper &); 109 ObjectFactory m_agentFactory; //!< Object factory 110 111 std::map< Ptr<Node>, std::set<uint32_t> > m_interfaceExclusions; //!< container of interfaces excluded from OLSR operations 112 }; 113 114 } // namespace ns3 115 116 #endif /* OLSR_HELPER_H */ 117