OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 { | 76 { |
77 return m_hubInterfaces.GetAddress (i); | 77 return m_hubInterfaces.GetAddress (i); |
78 } | 78 } |
79 | 79 |
80 Ipv4Address· | 80 Ipv4Address· |
81 CsmaStarHelper::GetSpokeIpv4Address (uint32_t i) const | 81 CsmaStarHelper::GetSpokeIpv4Address (uint32_t i) const |
82 { | 82 { |
83 return m_spokeInterfaces.GetAddress (i); | 83 return m_spokeInterfaces.GetAddress (i); |
84 } | 84 } |
85 | 85 |
| 86 Ipv6Address |
| 87 CsmaStarHelper::GetHubIpv6Address (uint32_t i) const |
| 88 { |
| 89 return m_hubInterfaces6.GetAddress (i, 1); |
| 90 } |
| 91 |
| 92 Ipv6Address |
| 93 CsmaStarHelper::GetSpokeIpv6Address (uint32_t i) const |
| 94 { |
| 95 return m_spokeInterfaces6.GetAddress (i, 1); |
| 96 } |
| 97 |
86 uint32_t | 98 uint32_t |
87 CsmaStarHelper::SpokeCount () const | 99 CsmaStarHelper::SpokeCount () const |
88 { | 100 { |
89 return m_spokes.GetN (); | 101 return m_spokes.GetN (); |
90 } | 102 } |
91 | 103 |
92 void· | 104 void· |
93 CsmaStarHelper::InstallStack (InternetStackHelper stack) | 105 CsmaStarHelper::InstallStack (InternetStackHelper stack) |
94 { | 106 { |
95 stack.Install (m_hub); | 107 stack.Install (m_hub); |
96 stack.Install (m_spokes); | 108 stack.Install (m_spokes); |
97 } | 109 } |
98 | 110 |
99 void· | 111 void· |
100 CsmaStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) | 112 CsmaStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) |
101 { | 113 { |
102 for (uint32_t i = 0; i < m_spokes.GetN (); ++i) | 114 for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
103 { | 115 { |
104 m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); | 116 m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); |
105 m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); | 117 m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); |
106 address.NewNetwork (); | 118 address.NewNetwork (); |
107 } | 119 } |
108 } | 120 } |
109 | 121 |
| 122 void· |
| 123 CsmaStarHelper::AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix) |
| 124 { |
| 125 Ipv6AddressGenerator::Init(network, prefix); |
| 126 Ipv6Address v6network; |
| 127 Ipv6AddressHelper addressHelper; |
| 128 |
| 129 for (uint32_t i = 0; i < m_spokes.GetN (); ++i) |
| 130 { |
| 131 v6network = Ipv6AddressGenerator::GetNetwork (prefix); |
| 132 addressHelper.NewNetwork(v6network, prefix); |
| 133 |
| 134 Ipv6InterfaceContainer ic = addressHelper.Assign (m_hubDevices.Get (i)); |
| 135 m_hubInterfaces6.Add (ic); |
| 136 ic = addressHelper.Assign (m_spokeDevices.Get (i)); |
| 137 m_spokeInterfaces6.Add (ic); |
| 138 |
| 139 Ipv6AddressGenerator::NextNetwork (prefix); |
| 140 } |
| 141 } |
| 142 |
110 } // namespace ns3 | 143 } // namespace ns3 |
OLD | NEW |