blob: 982f2830b8542178175f6888e81292922a6f8656 [file] [log] [blame]
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -07001//
2// ndn_stupidinterestgenerator_helper.cpp
3// Abstraction
4//
5// Created by Ilya Moiseenko on 05.08.11.
6// Copyright 2011 UCLA. All rights reserved.
7//
8
9#include "ndn_stupidinterestgenerator_helper.h"
10#include "ns3/inet-socket-address.h"
11#include "ns3/packet-socket-address.h"
12#include "ns3/string.h"
13#include "ns3/names.h"
14
15
16namespace ns3 {
17
18 StupidInterestGeneratorHelper::StupidInterestGeneratorHelper (std::string protocol, Address address)
19 {
20 m_factory.SetTypeId ("ns3::StupidInterestGenerator");
21 m_factory.Set ("Protocol", StringValue (protocol));
22 m_factory.Set ("Remote", AddressValue (address));
23 }
24
25 void
26 StupidInterestGeneratorHelper::SetAttribute (std::string name, const AttributeValue &value)
27 {
28 m_factory.Set (name, value);
29 }
30
31 ApplicationContainer
32 StupidInterestGeneratorHelper::Install (Ptr<Node> node) const
33 {
34 return ApplicationContainer (InstallPriv (node));
35 }
36
37 ApplicationContainer
38 StupidInterestGeneratorHelper::Install (std::string nodeName) const
39 {
40 Ptr<Node> node = Names::Find<Node> (nodeName);
41 return ApplicationContainer (InstallPriv (node));
42 }
43
44 ApplicationContainer
45 StupidInterestGeneratorHelper::Install (NodeContainer c) const
46 {
47 ApplicationContainer apps;
48 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
49 {
50 apps.Add (InstallPriv (*i));
51 }
52
53 return apps;
54 }
55
56 Ptr<Application>
57 StupidInterestGeneratorHelper::InstallPriv (Ptr<Node> node) const
58 {
59 Ptr<Application> app = m_factory.Create<Application> ();
60 node->AddApplication (app);
61
62 return app;
63 }
64
65} // namespace ns3