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 | |
| 21 | #ifndef CCNX_CONSUMER_HELPER_H |
| 22 | #define CCNX_CONSUMER_HELPER_H |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | #include <string> |
| 26 | #include "ns3/object-factory.h" |
| 27 | #include "ns3/address.h" |
| 28 | #include "ns3/attribute.h" |
| 29 | #include "ns3/net-device.h" |
| 30 | #include "ns3/node-container.h" |
| 31 | #include "ns3/application-container.h" |
| 32 | #include "ns3/ccnx-name-components.h" |
| 33 | #include "ns3/pointer.h" |
| 34 | #include "ns3/ccnx-local-face.h" |
| 35 | #include "ns3/callback.h" |
| 36 | #include "ns3/ccnx-consumer.h" |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 37 | #include "ns3/log.h" |
| 38 | #include "ns3/string.h" |
| 39 | #include "ns3/names.h" |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 40 | |
| 41 | namespace ns3 |
| 42 | { |
| 43 | /** |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 44 | * \brief A helper to make it easier to instantiate an ns3::CcnxConsumer Application |
| 45 | * on a set of nodes. |
| 46 | */ |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 47 | |
| 48 | class CcnxConsumerHelper |
| 49 | { |
| 50 | public: |
| 51 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 52 | /** |
| 53 | * \brief Create an CcnxConsumerHelper to make it easier to work with CcnxConsumer Apps |
| 54 | * |
| 55 | * \param prefix Prefix which will be requested by the consumer applications |
| 56 | */ |
| 57 | CcnxConsumerHelper (const std::string &prefix); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 58 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 59 | /** |
| 60 | * \brief Helper function used to set the underlying application attributes. |
| 61 | * |
| 62 | * \param name the name of the application attribute to set |
| 63 | * \param value the value of the application attribute to set |
| 64 | */ |
| 65 | void SetAttribute (std::string name, const AttributeValue &value); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 66 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 67 | /** |
| 68 | * Install an ns3::CcnxConsumer on each node of the input container |
| 69 | * configured with all the attributes set with SetAttribute. |
| 70 | * |
| 71 | * \param c NodeContainer of the set of nodes on which an CcnxConsumer |
| 72 | * will be installed. |
| 73 | * \returns Container of Ptr to the applications installed. |
| 74 | */ |
| 75 | ApplicationContainer Install (NodeContainer c); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 76 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 77 | /** |
| 78 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 79 | * attributes set with SetAttribute. |
| 80 | * |
| 81 | * \param node The node on which an CcnxConsumer will be installed. |
| 82 | * \returns Container of Ptr to the applications installed. |
| 83 | */ |
| 84 | ApplicationContainer Install (Ptr<Node> node); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 85 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 86 | /** |
| 87 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 88 | * attributes set with SetAttribute. |
| 89 | * |
| 90 | * \param nodeName The node on which an CcnxConsumer will be installed. |
| 91 | * \returns Container of Ptr to the applications installed. |
| 92 | */ |
| 93 | ApplicationContainer Install (std::string nodeName); |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 94 | |
| 95 | private: |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 96 | /** |
| 97 | * \internal |
| 98 | * Install an ns3::CcnxConsumer on the node configured with all the |
| 99 | * attributes set with SetAttribute. |
| 100 | * |
| 101 | * \param node The node on which an CcnxConsumer will be installed. |
| 102 | * \returns Ptr to the application installed. |
| 103 | */ |
| 104 | Ptr<Application> InstallPriv (Ptr<Node> node); |
| 105 | ObjectFactory m_factory; |
| 106 | }; |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 107 | |
Ilya Moiseenko | a121411 | 2011-08-29 13:03:55 -0700 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | #endif |
| 111 | |