blob: d885e2ee03140c972f068234f1267ce0050ab726 [file] [log] [blame]
Ilya Moiseenkoa1214112011-08-29 13:03:55 -07001/* -*- 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"
37
38namespace ns3
39{
40/**
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070041 * \brief A helper to make it easier to instantiate an ns3::CcnxConsumer Application
42 * on a set of nodes.
43 */
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070044
45class CcnxConsumerHelper
46{
47public:
48
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070049 /**
50 * \brief Create an CcnxConsumerHelper to make it easier to work with CcnxConsumer Apps
51 *
52 * \param prefix Prefix which will be requested by the consumer applications
53 */
54 CcnxConsumerHelper (const std::string &prefix);
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070055
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070056 /**
57 * \brief Helper function used to set the underlying application attributes.
58 *
59 * \param name the name of the application attribute to set
60 * \param value the value of the application attribute to set
61 */
62 void SetAttribute (std::string name, const AttributeValue &value);
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070063
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070064 /**
65 * Install an ns3::CcnxConsumer on each node of the input container
66 * configured with all the attributes set with SetAttribute.
67 *
68 * \param c NodeContainer of the set of nodes on which an CcnxConsumer
69 * will be installed.
70 * \returns Container of Ptr to the applications installed.
71 */
72 ApplicationContainer Install (NodeContainer c);
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070073
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070074 /**
75 * Install an ns3::CcnxConsumer on the node configured with all the
76 * attributes set with SetAttribute.
77 *
78 * \param node The node on which an CcnxConsumer will be installed.
79 * \returns Container of Ptr to the applications installed.
80 */
81 ApplicationContainer Install (Ptr<Node> node);
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070082
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070083 /**
84 * Install an ns3::CcnxConsumer on the node configured with all the
85 * attributes set with SetAttribute.
86 *
87 * \param nodeName The node on which an CcnxConsumer will be installed.
88 * \returns Container of Ptr to the applications installed.
89 */
90 ApplicationContainer Install (std::string nodeName);
Ilya Moiseenkoa1214112011-08-29 13:03:55 -070091
92private:
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070093 /**
94 * \internal
95 * Install an ns3::CcnxConsumer on the node configured with all the
96 * attributes set with SetAttribute.
97 *
98 * \param node The node on which an CcnxConsumer will be installed.
99 * \returns Ptr to the application installed.
100 */
101 Ptr<Application> InstallPriv (Ptr<Node> node);
102 ObjectFactory m_factory;
103};
Ilya Moiseenkoa1214112011-08-29 13:03:55 -0700104
Ilya Moiseenkoa1214112011-08-29 13:03:55 -0700105}
106
107#endif
108