author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Sat, 04 Jul 2009 08:15:48 +0200 | |
changeset 4654 | 2eaebe77d66b |
parent 4147 | 5d8530130930 |
permissions | -rw-r--r-- |
2833
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
2 |
/* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
4 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
7 |
* published by the Free Software Foundation; |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
8 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
12 |
* GNU General Public License for more details. |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
13 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
17 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2731
diff
changeset
|
19 |
*/ |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#include "on-off-helper.h" |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#include "ns3/inet-socket-address.h" |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#include "ns3/packet-socket-address.h" |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
#include "ns3/string.h" |
4147
5d8530130930
rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents:
4140
diff
changeset
|
24 |
#include "ns3/names.h" |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
namespace ns3 { |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
|
2890
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
28 |
OnOffHelper::OnOffHelper (std::string protocol, Address address) |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
{ |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
m_factory.SetTypeId ("ns3::OnOffApplication"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2890
diff
changeset
|
31 |
m_factory.Set ("Protocol", StringValue (protocol)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2890
diff
changeset
|
32 |
m_factory.Set ("Remote", AddressValue (address)); |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
} |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
void |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2890
diff
changeset
|
36 |
OnOffHelper::SetAttribute (std::string name, const AttributeValue &value) |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
{ |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
m_factory.Set (name, value); |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
} |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
|
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
ApplicationContainer |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
42 |
OnOffHelper::Install (Ptr<Node> node) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
43 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
44 |
return ApplicationContainer (InstallPriv (node)); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
45 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
46 |
|
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
47 |
ApplicationContainer |
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
48 |
OnOffHelper::Install (std::string nodeName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
49 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
50 |
Ptr<Node> node = Names::Find<Node> (nodeName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
51 |
return ApplicationContainer (InstallPriv (node)); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
52 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
53 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
54 |
ApplicationContainer |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
55 |
OnOffHelper::Install (NodeContainer c) const |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
{ |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
ApplicationContainer apps; |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
{ |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
60 |
apps.Add (InstallPriv (*i)); |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
} |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
62 |
|
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
return apps; |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
} |
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
|
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
66 |
Ptr<Application> |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
67 |
OnOffHelper::InstallPriv (Ptr<Node> node) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
68 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
69 |
Ptr<Application> app = m_factory.Create<Application> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
70 |
node->AddApplication (app); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
71 |
|
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
72 |
return app; |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
2965
diff
changeset
|
73 |
} |
2731
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
|
9eb9988afd08
a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
} // namespace ns3 |