View | Details | Raw Unified | Return to bug 1702
Collapse All | Expand All

(-)a/src/internet/helper/ipv6-interface-container.cc (+7 lines)
 Lines 117-121    Link Here 
117
  routing->SetDefaultRoute (routerAddress, m_interfaces[i].second);
117
  routing->SetDefaultRoute (routerAddress, m_interfaces[i].second);
118
}
118
}
119
119
120
Ipv6Address Ipv6InterfaceContainer::GetLinkLocalAddress (uint32_t i)
121
{
122
  Ptr<Ipv6> ipv6 = m_interfaces[i].first;
123
  Ipv6Address address = ipv6->GetAddress (m_interfaces[i].second, 0).GetAddress ();
124
  return address;
125
}
126
120
} /* namespace ns3 */
127
} /* namespace ns3 */
121
128
(-)a/src/internet/helper/ipv6-interface-container.h (-2 / +10 lines)
 Lines 27-32    Link Here 
27
27
28
#include "ns3/ipv6.h"
28
#include "ns3/ipv6.h"
29
#include "ns3/ipv6-address.h"
29
#include "ns3/ipv6-address.h"
30
#include "ns3/deprecated.h"
30
31
31
namespace ns3
32
namespace ns3
32
{
33
{
 Lines 149-162    Link Here 
149
   * \param i index
150
   * \param i index
150
   * \param router true : is a router, false : is an host
151
   * \param router true : is a router, false : is an host
151
   */
152
   */
152
  void SetRouter (uint32_t i, bool router);
153
  void SetRouter (uint32_t i, bool router) NS_DEPRECATED;
153
154
154
  /**
155
  /**
155
   * \brief Set the default route for the specified index.
156
   * \brief Set the default route for the specified index.
156
   * \param i index
157
   * \param i index
157
   * \param router the default router
158
   * \param router the default router
158
   */
159
   */
159
  void SetDefaultRoute (uint32_t i, uint32_t router);
160
  void SetDefaultRoute (uint32_t i, uint32_t router) NS_DEPRECATED;
161
162
  /**
163
   * \brief Get the link-local address for the specified index.
164
   * \param i index
165
   * \return the link-local address
166
   */
167
  Ipv6Address GetLinkLocalAddress (uint32_t i);
160
168
161
private:
169
private:
162
  typedef std::vector<std::pair<Ptr<Ipv6>, uint32_t> > InterfaceVector;
170
  typedef std::vector<std::pair<Ptr<Ipv6>, uint32_t> > InterfaceVector;
(-)a/src/internet/helper/ipv6-static-routing-helper.cc (+37 lines)
 Lines 28-33    Link Here 
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
 Lines 211-214    Link Here 
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
(-)a/src/internet/helper/ipv6-static-routing-helper.h (+23 lines)
 Lines 116-121    Link Here 
116
  void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd);
116
  void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd);
117
  void SetDefaultMulticastRoute (std::string nName, std::string ndName);
117
  void SetDefaultMulticastRoute (std::string nName, std::string ndName);
118
#endif
118
#endif
119
120
  /**
121
   * \brief Set the default route for the specified node.
122
   * \param n Node
123
   * \param i output interface
124
   * \param router the default router address (must be link-local)
125
   */
126
  void SetDefaultRoute (Ptr<Node> n, uint32_t i, Ipv6Address routerAddr);
127
128
  /**
129
   * \brief Set the default route for a group of nodes.
130
   * \param ic the nodes' interfaces
131
   * \param router the default router address (must be link-local)
132
   */
133
  void SetDefaultRoute (Ipv6InterfaceContainer ic, Ipv6Address routerAddr);
134
135
  /**
136
   * \brief Set the default route for a group of nodes.
137
   * \param ic the nodes' interfaces
138
   * \param router the default router
139
   */
140
  void SetDefaultRoute (Ipv6InterfaceContainer ic, Ipv6InterfaceContainer router);
141
119
private:
142
private:
120
  /**
143
  /**
121
   * \internal
144
   * \internal

Return to bug 1702