Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 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: Ilya Moiseenko <iliamo@cs.ucla.edu> |
| 19 | */ |
| 20 | |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 21 | #ifndef CCNX_APP_HELPER_H |
| 22 | #define CCNX_APP_HELPER_H |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 23 | |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 24 | #include "ns3/object-factory.h" |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 25 | #include "ns3/attribute.h" |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 26 | #include "ns3/node-container.h" |
| 27 | #include "ns3/application-container.h" |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 28 | #include "ns3/ptr.h" |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 29 | |
| 30 | namespace ns3 |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 31 | { |
| 32 | |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 33 | /** |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 34 | * \brief A helper to make it easier to instantiate an ns3::CcnxConsumer Application |
| 35 | * on a set of nodes. |
| 36 | */ |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 37 | class CcnxAppHelper |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 38 | { |
| 39 | public: |
| 40 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 41 | /** |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 42 | * \brief Create an CcnxAppHelper to make it easier to work with CCNx apps |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 43 | * |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 44 | * \param app Class of the application |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 45 | */ |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 46 | CcnxAppHelper (const std::string &prefix); |
Alexander Afanasyev | 120bf31 | 2011-12-19 01:24:47 -0800 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * @brief Set the prefix consumer will be requesting |
| 50 | */ |
| 51 | void |
| 52 | SetPrefix (const std::string &prefix); |
| 53 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 54 | /** |
| 55 | * \brief Helper function used to set the underlying application attributes. |
| 56 | * |
| 57 | * \param name the name of the application attribute to set |
| 58 | * \param value the value of the application attribute to set |
| 59 | */ |
| 60 | void SetAttribute (std::string name, const AttributeValue &value); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 61 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 62 | /** |
| 63 | * Install an ns3::CcnxConsumer on each node of the input container |
| 64 | * configured with all the attributes set with SetAttribute. |
| 65 | * |
| 66 | * \param c NodeContainer of the set of nodes on which an CcnxConsumer |
| 67 | * will be installed. |
| 68 | * \returns Container of Ptr to the applications installed. |
| 69 | */ |
| 70 | ApplicationContainer Install (NodeContainer c); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 71 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 72 | /** |
| 73 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 74 | * attributes set with SetAttribute. |
| 75 | * |
| 76 | * \param node The node on which an CcnxConsumer will be installed. |
| 77 | * \returns Container of Ptr to the applications installed. |
| 78 | */ |
| 79 | ApplicationContainer Install (Ptr<Node> node); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 80 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 81 | /** |
| 82 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 83 | * attributes set with SetAttribute. |
| 84 | * |
| 85 | * \param nodeName The node on which an CcnxConsumer will be installed. |
| 86 | * \returns Container of Ptr to the applications installed. |
| 87 | */ |
| 88 | ApplicationContainer Install (std::string nodeName); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 89 | |
| 90 | private: |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 91 | /** |
| 92 | * \internal |
| 93 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 94 | * attributes set with SetAttribute. |
| 95 | * |
| 96 | * \param node The node on which an CcnxConsumer will be installed. |
| 97 | * \returns Ptr to the application installed. |
| 98 | */ |
| 99 | Ptr<Application> InstallPriv (Ptr<Node> node); |
| 100 | ObjectFactory m_factory; |
| 101 | }; |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 102 | |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 103 | } // namespace ns3 |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 104 | |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 105 | #endif // CCNX_APP_HELPER_H |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 106 | |