author | Tom Henderson <tomh@tomh.org> |
Sun, 20 May 2012 15:19:52 -0700 | |
changeset 8798 | 5d8dfd7c6609 |
parent 7815 | 1ff10ed6e878 |
child 9063 | 32755d0516f4 |
permissions | -rw-r--r-- |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
2 |
/* |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
3 |
* This program is free software; you can redistribute it and/or modify |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
4 |
* it under the terms of the GNU General Public License version 2 as |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
5 |
* published by the Free Software Foundation; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
6 |
* |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
7 |
* This program is distributed in the hope that it will be useful, |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
10 |
* GNU General Public License for more details. |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
11 |
* |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
12 |
* You should have received a copy of the GNU General Public License |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
13 |
* along with this program; if not, write to the Free Software |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
15 |
*/ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
16 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
17 |
#include <iostream> |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
18 |
#include <sstream> |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
19 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
20 |
// ns3 includes |
7815
1ff10ed6e878
no one needs animation-interface.h here.
Mathieu Lacage <mathieu.lacage@cutebugs.net>
parents:
7717
diff
changeset
|
21 |
#include "ns3/log.h" |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
22 |
#include "ns3/point-to-point-star.h" |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
23 |
#include "ns3/constant-position-mobility-model.h" |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
24 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
25 |
#include "ns3/node-list.h" |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
26 |
#include "ns3/point-to-point-net-device.h" |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
27 |
#include "ns3/vector.h" |
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
28 |
#include "ns3/ipv6-address-generator.h" |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
29 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7187
diff
changeset
|
30 |
NS_LOG_COMPONENT_DEFINE ("PointToPointStarHelper"); |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
31 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
32 |
namespace ns3 { |
7132
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
33 |
|
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
34 |
PointToPointStarHelper::PointToPointStarHelper (uint32_t numSpokes, |
7132
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
35 |
PointToPointHelper p2pHelper) |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
36 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
37 |
m_hub.Create (1); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
38 |
m_spokes.Create (numSpokes); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
39 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
40 |
for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
41 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
42 |
NetDeviceContainer nd = p2pHelper.Install (m_hub.Get (0), m_spokes.Get (i)); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
43 |
m_hubDevices.Add (nd.Get (0)); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
44 |
m_spokeDevices.Add (nd.Get (1)); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
45 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
46 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
47 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
48 |
PointToPointStarHelper::~PointToPointStarHelper () |
7187
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
49 |
{ |
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
50 |
} |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
51 |
|
7187
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
52 |
Ptr<Node> |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
53 |
PointToPointStarHelper::GetHub () const |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
54 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
55 |
return m_hub.Get (0); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
56 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
57 |
|
7187
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
58 |
Ptr<Node> |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
59 |
PointToPointStarHelper::GetSpokeNode (uint32_t i) const |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
60 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
61 |
return m_spokes.Get (i); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
62 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
63 |
|
7187
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
64 |
Ipv4Address |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
65 |
PointToPointStarHelper::GetHubIpv4Address (uint32_t i) const |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
66 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
67 |
return m_hubInterfaces.GetAddress (i); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
68 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
69 |
|
7187
4b94384be695
point-to-point-layout coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7132
diff
changeset
|
70 |
Ipv4Address |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
71 |
PointToPointStarHelper::GetSpokeIpv4Address (uint32_t i) const |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
72 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
73 |
return m_spokeInterfaces.GetAddress (i); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
74 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
75 |
|
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
76 |
Ipv6Address |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
77 |
PointToPointStarHelper::GetHubIpv6Address (uint32_t i) const |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
78 |
{ |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
79 |
return m_hubInterfaces6.GetAddress (i, 1); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
80 |
} |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
81 |
|
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
82 |
Ipv6Address |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
83 |
PointToPointStarHelper::GetSpokeIpv6Address (uint32_t i) const |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
84 |
{ |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
85 |
return m_spokeInterfaces6.GetAddress (i, 1); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
86 |
} |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
87 |
|
7132
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
88 |
uint32_t |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
89 |
PointToPointStarHelper::SpokeCount () const |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
90 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
91 |
return m_spokes.GetN (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
92 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
93 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
94 |
void |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
95 |
PointToPointStarHelper::InstallStack (InternetStackHelper stack) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
96 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
97 |
stack.Install (m_hub); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
98 |
stack.Install (m_spokes); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
99 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
100 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
101 |
void |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
102 |
PointToPointStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
103 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
104 |
for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
105 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
106 |
m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
107 |
m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
108 |
address.NewNetwork (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
109 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
110 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
111 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
112 |
void |
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
113 |
PointToPointStarHelper::AssignIpv6Addresses (Ipv6Address addrBase, Ipv6Prefix prefix) |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
114 |
{ |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
115 |
Ipv6AddressGenerator::Init (addrBase, prefix); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
116 |
Ipv6Address v6network; |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
117 |
Ipv6AddressHelper addressHelper; |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
118 |
|
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
119 |
for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
120 |
{ |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
121 |
v6network = Ipv6AddressGenerator::GetNetwork (prefix); |
8798
5d8dfd7c6609
bug 1432: Align Ipv6AddressHelper API with Ipv4AddressHelper API
Tom Henderson <tomh@tomh.org>
parents:
7815
diff
changeset
|
122 |
addressHelper.SetBase (v6network, prefix); |
7717
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
123 |
|
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
124 |
Ipv6InterfaceContainer ic = addressHelper.Assign (m_hubDevices.Get (i)); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
125 |
m_hubInterfaces6.Add (ic); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
126 |
ic = addressHelper.Assign (m_spokeDevices.Get (i)); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
127 |
m_spokeInterfaces6.Add (ic); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
128 |
|
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
129 |
Ipv6AddressGenerator::NextNetwork (prefix); |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
130 |
} |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
131 |
} |
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
132 |
|
cfa1741013dd
Add support for IPv6 transport protocols
Ken Renard <kdrenard2@gmail.com>
parents:
7256
diff
changeset
|
133 |
void |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
134 |
PointToPointStarHelper::BoundingBox (double ulx, double uly, |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
135 |
double lrx, double lry) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
136 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
137 |
double xDist; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
138 |
double yDist; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
139 |
if (lrx > ulx) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
140 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
141 |
xDist = lrx - ulx; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
142 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
143 |
else |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
144 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
145 |
xDist = ulx - lrx; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
146 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
147 |
if (lry > uly) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
148 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
149 |
yDist = lry - uly; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
150 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
151 |
else |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
152 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
153 |
yDist = uly - lry; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
154 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
155 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
156 |
// Place the hub |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
157 |
Ptr<Node> hub = m_hub.Get (0); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
158 |
Ptr<ConstantPositionMobilityModel> hubLoc = hub->GetObject<ConstantPositionMobilityModel> (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
159 |
if (hubLoc == 0) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
160 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
161 |
hubLoc = CreateObject<ConstantPositionMobilityModel> (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
162 |
hub->AggregateObject (hubLoc); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
163 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
164 |
Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
165 |
hubLoc->SetPosition (hubVec); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
166 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
167 |
double spokeDist; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
168 |
if (xDist > yDist) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
169 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
170 |
spokeDist = yDist/4.0; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
171 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
172 |
else |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
173 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
174 |
spokeDist = xDist/4.0; |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
175 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
176 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
177 |
double theta = 2*M_PI/m_spokes.GetN (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
178 |
for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
179 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
180 |
Ptr<Node> spokeNode = m_spokes.Get (i); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
181 |
Ptr<ConstantPositionMobilityModel> spokeLoc = spokeNode->GetObject<ConstantPositionMobilityModel> (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
182 |
if (spokeLoc == 0) |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
183 |
{ |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
184 |
spokeLoc = CreateObject<ConstantPositionMobilityModel> (); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
185 |
spokeNode->AggregateObject (spokeLoc); |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
186 |
} |
7132
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
187 |
Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, |
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
188 |
hubVec.y + sin (theta*i) * spokeDist, |
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
189 |
0); |
c7c8d07fb48a
Point-to-point-layout code-style changes
John Abraham<john.abraham@gatech.edu>
parents:
7089
diff
changeset
|
190 |
spokeLoc->SetPosition (spokeVec); |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
191 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
192 |
} |
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
193 |
|
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
diff
changeset
|
194 |
} // namespace ns3 |