Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; c-set-offset 'innamespace 0; -*- */ |
Ilya Moiseenko | 9b273ce | 2011-08-05 20:24:12 -0700 | [diff] [blame] | 2 | // |
| 3 | // ndn_stupidinterestgenerator_helper.h |
| 4 | // Abstraction |
| 5 | // |
| 6 | // Created by Ilya Moiseenko on 05.08.11. |
| 7 | // Copyright 2011 UCLA. All rights reserved. |
| 8 | // |
| 9 | |
| 10 | #include "ns3/object-factory.h" |
| 11 | #include "ns3/ipv4-address.h" |
| 12 | #include "ns3/node-container.h" |
| 13 | #include "ns3/application-container.h" |
| 14 | |
| 15 | namespace ns3 { |
| 16 | |
| 17 | /** |
| 18 | * \brief A helper to make it easier to instantiate an ns3::OnOffApplication |
| 19 | * on a set of nodes. |
| 20 | */ |
| 21 | class StupidInterestGeneratorHelper |
| 22 | { |
| 23 | public: |
| 24 | /** |
| 25 | * Create an OnOffHelper to make it easier to work with OnOffApplications |
| 26 | * |
| 27 | * \param protocol the name of the protocol to use to send traffic |
| 28 | * by the applications. This string identifies the socket |
| 29 | * factory type used to create sockets for the applications. |
| 30 | * A typical value would be ns3::UdpSocketFactory. |
| 31 | * \param address the address of the remote node to send traffic |
| 32 | * to. |
| 33 | */ |
| 34 | StupidInterestGeneratorHelper (std::string protocol, Address address); |
| 35 | |
| 36 | /** |
| 37 | * Helper function used to set the underlying application attributes. |
| 38 | * |
| 39 | * \param name the name of the application attribute to set |
| 40 | * \param value the value of the application attribute to set |
| 41 | */ |
| 42 | void SetAttribute (std::string name, const AttributeValue &value); |
| 43 | |
| 44 | /** |
| 45 | * Install an ns3::OnOffApplication on each node of the input container |
| 46 | * configured with all the attributes set with SetAttribute. |
| 47 | * |
| 48 | * \param c NodeContainer of the set of nodes on which an OnOffApplication |
| 49 | * will be installed. |
| 50 | * \returns Container of Ptr to the applications installed. |
| 51 | */ |
| 52 | ApplicationContainer Install (NodeContainer c) const; |
| 53 | |
| 54 | /** |
| 55 | * Install an ns3::OnOffApplication on the node configured with all the |
| 56 | * attributes set with SetAttribute. |
| 57 | * |
| 58 | * \param node The node on which an OnOffApplication will be installed. |
| 59 | * \returns Container of Ptr to the applications installed. |
| 60 | */ |
| 61 | ApplicationContainer Install (Ptr<Node> node) const; |
| 62 | |
| 63 | /** |
| 64 | * Install an ns3::OnOffApplication on the node configured with all the |
| 65 | * attributes set with SetAttribute. |
| 66 | * |
| 67 | * \param nodeName The node on which an OnOffApplication will be installed. |
| 68 | * \returns Container of Ptr to the applications installed. |
| 69 | */ |
| 70 | ApplicationContainer Install (std::string nodeName) const; |
| 71 | |
| 72 | private: |
| 73 | /** |
| 74 | * \internal |
| 75 | * Install an ns3::OnOffApplication on the node configured with all the |
| 76 | * attributes set with SetAttribute. |
| 77 | * |
| 78 | * \param node The node on which an OnOffApplication will be installed. |
| 79 | * \returns Ptr to the application installed. |
| 80 | */ |
| 81 | Ptr<Application> InstallPriv (Ptr<Node> node) const; |
| 82 | std::string m_protocol; |
| 83 | Address m_remote; |
| 84 | ObjectFactory m_factory; |
| 85 | }; |
| 86 | |
| 87 | } // namespace ns3 |