|
|
| 28 |
#include "ns3/assert.h" |
28 |
#include "ns3/assert.h" |
| 29 |
#include "ns3/ipv6-address.h" |
29 |
#include "ns3/ipv6-address.h" |
| 30 |
#include "ns3/ipv6-routing-protocol.h" |
30 |
#include "ns3/ipv6-routing-protocol.h" |
|
|
31 |
#include "ns3/ipv6-interface-container.h" |
| 31 |
|
32 |
|
| 32 |
#include "ipv6-static-routing-helper.h" |
33 |
#include "ipv6-static-routing-helper.h" |
| 33 |
|
34 |
|
|
|
| 211 |
} |
212 |
} |
| 212 |
#endif |
213 |
#endif |
| 213 |
|
214 |
|
|
|
215 |
|
| 216 |
void Ipv6StaticRoutingHelper::SetDefaultRoute (Ptr<Node> n, uint32_t i, Ipv6Address routerAddr) |
| 217 |
{ |
| 218 |
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> (); |
| 219 |
Ptr<Ipv6StaticRouting> routing = GetStaticRouting (ipv6); |
| 220 |
routing->SetDefaultRoute (routerAddr, i); |
| 221 |
} |
| 222 |
|
| 223 |
void Ipv6StaticRoutingHelper::SetDefaultRoute (Ipv6InterfaceContainer ic, Ipv6Address routerAddr) |
| 224 |
{ |
| 225 |
Ipv6InterfaceContainer::Iterator iter; |
| 226 |
for (iter=ic.Begin(); iter!=ic.End(); iter++) |
| 227 |
{ |
| 228 |
Ptr<Ipv6> ipv6 = iter->first; |
| 229 |
Ptr<Ipv6StaticRouting> routing = GetStaticRouting (ipv6); |
| 230 |
routing->SetDefaultRoute (routerAddr, iter->second); |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
void Ipv6StaticRoutingHelper::SetDefaultRoute (Ipv6InterfaceContainer ic, uint32_t routerIndex) |
| 235 |
{ |
| 236 |
NS_ASSERT(ic.GetN () >= routerIndex); |
| 237 |
|
| 238 |
Ipv6InterfaceContainer::Iterator iter; |
| 239 |
Ipv6Address routerAddr = ic.GetLinkLocalAddress(routerIndex); |
| 240 |
uint32_t index; |
| 241 |
for (iter=ic.Begin(), index=0; iter!=ic.End(); iter++, index++) |
| 242 |
{ |
| 243 |
if (index != routerIndex) |
| 244 |
{ |
| 245 |
Ptr<Ipv6> ipv6 = iter->first; |
| 246 |
Ptr<Ipv6StaticRouting> routing = GetStaticRouting (ipv6); |
| 247 |
routing->SetDefaultRoute (routerAddr, iter->second); |
| 248 |
} |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 214 |
} // namespace ns3 |
252 |
} // namespace ns3 |