A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
three-gpp-http-helper.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
4
* Copyright (c) 2013 Magister Solutions
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Original work author (from packet-sink-helper.cc):
20
* - Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21
*
22
* Converted to 3GPP HTTP web browsing traffic models by:
23
* - Budiarto Herman <budiarto.herman@magister.fi>
24
*
25
*/
26
27
#include <ns3/names.h>
28
#include "
three-gpp-http-helper.h
"
29
30
namespace
ns3
{
31
32
33
// 3GPP HTTP CLIENT HELPER /////////////////////////////////////////////////////////
34
35
ThreeGppHttpClientHelper::ThreeGppHttpClientHelper
(
const
Address
&
address
)
36
{
37
m_factory
.
SetTypeId
(
"ns3::ThreeGppHttpClient"
);
38
m_factory
.
Set
(
"RemoteServerAddress"
,
AddressValue
(
address
));
39
}
40
41
void
42
ThreeGppHttpClientHelper::SetAttribute
(
const
std::string &name,
43
const
AttributeValue
&value)
44
{
45
m_factory
.
Set
(name, value);
46
}
47
48
ApplicationContainer
49
ThreeGppHttpClientHelper::Install
(
Ptr<Node>
node)
const
50
{
51
return
ApplicationContainer
(
InstallPriv
(node));
52
}
53
54
ApplicationContainer
55
ThreeGppHttpClientHelper::Install
(
const
std::string &nodeName)
const
56
{
57
Ptr<Node>
node = Names::Find<Node> (nodeName);
58
return
ApplicationContainer
(
InstallPriv
(node));
59
}
60
61
ApplicationContainer
62
ThreeGppHttpClientHelper::Install
(
NodeContainer
c)
const
63
{
64
ApplicationContainer
apps;
65
for
(
NodeContainer::Iterator
i = c.
Begin
(); i != c.
End
(); ++i)
66
{
67
apps.
Add
(
InstallPriv
(*i));
68
}
69
70
return
apps;
71
}
72
73
Ptr<Application>
74
ThreeGppHttpClientHelper::InstallPriv
(
Ptr<Node>
node)
const
75
{
76
Ptr<Application>
app =
m_factory
.
Create
<
Application
> ();
77
node->
AddApplication
(app);
78
79
return
app;
80
}
81
82
83
// HTTP SERVER HELPER /////////////////////////////////////////////////////////
84
85
ThreeGppHttpServerHelper::ThreeGppHttpServerHelper
(
const
Address
&
address
)
86
{
87
m_factory
.
SetTypeId
(
"ns3::ThreeGppHttpServer"
);
88
m_factory
.
Set
(
"LocalAddress"
,
AddressValue
(
address
));
89
}
90
91
void
92
ThreeGppHttpServerHelper::SetAttribute
(
const
std::string &name,
93
const
AttributeValue
&value)
94
{
95
m_factory
.
Set
(name, value);
96
}
97
98
ApplicationContainer
99
ThreeGppHttpServerHelper::Install
(
Ptr<Node>
node)
const
100
{
101
return
ApplicationContainer
(
InstallPriv
(node));
102
}
103
104
ApplicationContainer
105
ThreeGppHttpServerHelper::Install
(
const
std::string &nodeName)
const
106
{
107
Ptr<Node>
node = Names::Find<Node> (nodeName);
108
return
ApplicationContainer
(
InstallPriv
(node));
109
}
110
111
ApplicationContainer
112
ThreeGppHttpServerHelper::Install
(
NodeContainer
c)
const
113
{
114
ApplicationContainer
apps;
115
for
(
NodeContainer::Iterator
i = c.
Begin
(); i != c.
End
(); ++i)
116
{
117
apps.
Add
(
InstallPriv
(*i));
118
}
119
120
return
apps;
121
}
122
123
Ptr<Application>
124
ThreeGppHttpServerHelper::InstallPriv
(
Ptr<Node>
node)
const
125
{
126
Ptr<Application>
app =
m_factory
.
Create
<
Application
> ();
127
node->
AddApplication
(app);
128
129
return
app;
130
}
131
132
133
}
// end of `namespace ns3`
ns3::ThreeGppHttpServerHelper::SetAttribute
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes, but not the socket attributes.
Definition:
three-gpp-http-helper.cc:92
ns3::ThreeGppHttpServerHelper::Install
ApplicationContainer Install(NodeContainer c) const
Install an ThreeGppHttpServer on each node of the input container configured with all the attributes ...
Definition:
three-gpp-http-helper.cc:112
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::AddressValue
AttributeValue implementation for Address.
Definition:
address.h:278
ns3::ThreeGppHttpClientHelper::SetAttribute
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes, but not the socket attributes.
Definition:
three-gpp-http-helper.cc:42
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:69
ns3::ThreeGppHttpClientHelper::Install
ApplicationContainer Install(NodeContainer c) const
Install a ThreeGppHttpClient on each node of the input container configured with all the attributes s...
Definition:
three-gpp-http-helper.cc:62
ns3::ApplicationContainer::Add
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Definition:
application-container.cc:67
ns3::ThreeGppHttpServerHelper::ThreeGppHttpServerHelper
ThreeGppHttpServerHelper(const Address &address)
Create a ThreeGppHttpServerHelper to make it easier to work with ThreeGppHttpServer applications.
Definition:
three-gpp-http-helper.cc:85
ns3::Ptr< Node >
ns3::ThreeGppHttpClientHelper::InstallPriv
Ptr< Application > InstallPriv(Ptr< Node > node) const
Definition:
three-gpp-http-helper.cc:74
three-gpp-http-helper.h
ns3::Address
a polymophic address class
Definition:
address.h:91
ns3::NodeContainer::Begin
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Definition:
node-container.cc:77
ns3::Node::AddApplication
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition:
node.cc:159
first.address
address
Definition:
first.py:44
ns3::ThreeGppHttpClientHelper::ThreeGppHttpClientHelper
ThreeGppHttpClientHelper(const Address &address)
Create a ThreeGppHttpClientHelper to make it easier to work with ThreeGppHttpClient applications.
Definition:
three-gpp-http-helper.cc:35
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition:
node-container.h:42
ns3::ThreeGppHttpServerHelper::InstallPriv
Ptr< Application > InstallPriv(Ptr< Node > node) const
Definition:
three-gpp-http-helper.cc:124
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition:
application-container.h:43
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition:
object-factory.h:223
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:39
ns3::ThreeGppHttpServerHelper::m_factory
ObjectFactory m_factory
Used to instantiate a ThreeGppHttpServer instance.
Definition:
three-gpp-http-helper.h:164
ns3::NodeContainer::End
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Definition:
node-container.cc:82
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition:
object-factory.cc:40
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition:
object-factory.cc:98
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:61
ns3::ThreeGppHttpClientHelper::m_factory
ObjectFactory m_factory
Used to instantiate an ThreeGppHttpClient instance.
Definition:
three-gpp-http-helper.h:98
src
applications
helper
three-gpp-http-helper.cc
Generated on Fri Oct 1 2021 17:02:54 for ns-3 by
1.8.20