blob: 8fde311af431e9e57c78d9b34f693e3d5de0c132 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -07002//
3// ndn_stupidinterestgenerator_helper.cpp
4// Abstraction
5//
6// Created by Ilya Moiseenko on 05.08.11.
7// Copyright 2011 UCLA. All rights reserved.
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07008//w
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -07009
10#include "ndn_stupidinterestgenerator_helper.h"
11#include "ns3/inet-socket-address.h"
12#include "ns3/packet-socket-address.h"
13#include "ns3/string.h"
14#include "ns3/names.h"
15
16
17namespace ns3 {
18
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070019StupidInterestGeneratorHelper::StupidInterestGeneratorHelper (std::string protocol, Address address)
20{
21 m_factory.SetTypeId ("ns3::StupidInterestGenerator");
22 m_factory.Set ("Protocol", StringValue (protocol));
23 m_factory.Set ("Remote", AddressValue (address));
24}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070025
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070026void
27StupidInterestGeneratorHelper::SetAttribute (std::string name, const AttributeValue &value)
28{
29 m_factory.Set (name, value);
30}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070031
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070032ApplicationContainer
33StupidInterestGeneratorHelper::Install (Ptr<Node> node) const
34{
35 return ApplicationContainer (InstallPriv (node));
36}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070037
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070038ApplicationContainer
39StupidInterestGeneratorHelper::Install (std::string nodeName) const
40{
41 Ptr<Node> node = Names::Find<Node> (nodeName);
42 return ApplicationContainer (InstallPriv (node));
43}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070044
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070045ApplicationContainer
46StupidInterestGeneratorHelper::Install (NodeContainer c) const
47{
48 ApplicationContainer apps;
49 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
50 {
51 apps.Add (InstallPriv (*i));
52 }
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070053
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070054 return apps;
55}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070056
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070057Ptr<Application>
58StupidInterestGeneratorHelper::InstallPriv (Ptr<Node> node) const
59{
60 Ptr<Application> app = m_factory.Create<Application> ();
61 node->AddApplication (app);
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070062
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070063 return app;
64}
Ilya Moiseenko9b273ce2011-08-05 20:24:12 -070065
66} // namespace ns3