|
|
| 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, Ipv6InterfaceContainer routerIc) |
| 235 |
{ |
| 236 |
|
| 237 |
NS_ASSERT_MSG(routerIc.GetN () == 1, "Can add only one default router"); |
| 238 |
|
| 239 |
Ipv6InterfaceContainer::Iterator iter; |
| 240 |
Ptr<Ipv6> ipv6Router = routerIc.Begin()->first; |
| 241 |
Ipv6Address routerAddr = ipv6Router->GetAddress (routerIc.Begin()->second, 0).GetAddress (); |
| 242 |
|
| 243 |
for (iter=ic.Begin(); iter!=ic.End(); iter++) |
| 244 |
{ |
| 245 |
Ptr<Ipv6> ipv6 = iter->first; |
| 246 |
Ptr<Ipv6StaticRouting> routing = GetStaticRouting (ipv6); |
| 247 |
routing->SetDefaultRoute (routerAddr, iter->second); |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 214 |
} // namespace ns3 |
251 |
} // namespace ns3 |