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

(-)a/src/helper/internet-stack-helper.cc (-8 / +18 lines)
 Lines 179-193    Link Here 
179
bool InternetStackHelper::m_isInitialized = false;
179
bool InternetStackHelper::m_isInitialized = false;
180
180
181
InternetStackHelper::InternetStackHelper ()
181
InternetStackHelper::InternetStackHelper ()
182
  : m_ipv4Enabled (true),
182
  : m_routing (0),
183
  m_routingv6 (0),
184
  m_ipv4Enabled (true),
183
  m_ipv6Enabled (true)
185
  m_ipv6Enabled (true)
184
{
186
{
185
  SetTcp ("ns3::TcpL4Protocol");
187
  SetTcp ("ns3::TcpL4Protocol");
186
  static Ipv4StaticRoutingHelper staticRouting;
188
  Ipv4StaticRoutingHelper staticRouting;
187
  static Ipv4GlobalRoutingHelper globalRouting;
189
  Ipv4GlobalRoutingHelper globalRouting;
188
  static Ipv4ListRoutingHelper listRouting;
190
  Ipv4ListRoutingHelper listRouting;
189
  static Ipv6ListRoutingHelper listRoutingv6;
191
  Ipv6ListRoutingHelper listRoutingv6;
190
  static Ipv6StaticRoutingHelper staticRoutingv6;
192
  Ipv6StaticRoutingHelper staticRoutingv6;
191
  if (m_isInitialized == false)
193
  if (m_isInitialized == false)
192
    {
194
    {
193
      // Only add these once
195
      // Only add these once
 Lines 203-218    Link Here 
203
  SetRoutingHelper (listRoutingv6);
205
  SetRoutingHelper (listRoutingv6);
204
}
206
}
205
207
208
InternetStackHelper::~InternetStackHelper ()
209
{
210
  delete m_routing;
211
  delete m_routingv6;
212
}
213
206
void 
214
void 
207
InternetStackHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing)
215
InternetStackHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing)
208
{
216
{
209
  m_routing = &routing;
217
  delete m_routing;
218
  m_routing = routing.Copy ();
210
}
219
}
211
220
212
void
221
void
213
InternetStackHelper::SetRoutingHelper (const Ipv6RoutingHelper &routing)
222
InternetStackHelper::SetRoutingHelper (const Ipv6RoutingHelper &routing)
214
{
223
{
215
  m_routingv6 = &routing;
224
  delete m_routingv6;
225
  m_routingv6 = routing.Copy ();
216
}
226
}
217
227
218
void
228
void
(-)a/src/helper/internet-stack-helper.h (+1 lines)
 Lines 53-58    Link Here 
53
   * such as ns3::OlsrHelper
53
   * such as ns3::OlsrHelper
54
   */
54
   */
55
  InternetStackHelper(void);
55
  InternetStackHelper(void);
56
  virtual ~InternetStackHelper(void);
56
57
57
  /**
58
  /**
58
   * \param routing a new routing helper
59
   * \param routing a new routing helper
(-)a/src/helper/ipv4-global-routing-helper.cc (+17 lines)
 Lines 29-34    Link Here 
29
29
30
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper ()
30
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper ()
31
{}
31
{}
32
33
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &o)
34
{
35
}
36
37
Ipv4GlobalRoutingHelper &
38
Ipv4GlobalRoutingHelper::operator = (const Ipv4GlobalRoutingHelper &o)
39
{
40
  return *this;
41
}
42
43
Ipv4GlobalRoutingHelper* 
44
Ipv4GlobalRoutingHelper::Copy (void) const 
45
{
46
  return new Ipv4GlobalRoutingHelper (*this); 
47
}
48
32
Ptr<Ipv4RoutingProtocol> 
49
Ptr<Ipv4RoutingProtocol> 
33
Ipv4GlobalRoutingHelper::Create (Ptr<Node> node) const
50
Ipv4GlobalRoutingHelper::Create (Ptr<Node> node) const
34
{
51
{
(-)a/src/helper/ipv4-global-routing-helper.h (+10 lines)
 Lines 32-37    Link Here 
32
{
32
{
33
public:
33
public:
34
  Ipv4GlobalRoutingHelper ();
34
  Ipv4GlobalRoutingHelper ();
35
  Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &);
36
  Ipv4GlobalRoutingHelper &operator = (const Ipv4GlobalRoutingHelper &o);
37
  /**
38
   * \returns pointer to clone of this Ipv4GlobalRoutingHelper
39
   *
40
   * This method is mainly for internal use by the other helpers;
41
   * clients are expected to free the dynamic memory allocated by this method
42
   */
43
  Ipv4GlobalRoutingHelper* Copy (void) const;
44
35
  /**
45
  /**
36
   * \param node the node on which the routing protocol will run
46
   * \param node the node on which the routing protocol will run
37
   * \returns a newly-created routing protocol
47
   * \returns a newly-created routing protocol
(-)a/src/helper/ipv4-list-routing-helper.cc (-2 / +43 lines)
 Lines 25-40    Link Here 
25
25
26
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper()
26
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper()
27
{}
27
{}
28
29
Ipv4ListRoutingHelper::~Ipv4ListRoutingHelper()
30
{
31
  for (std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::iterator i = m_list.begin ();
32
       i != m_list.end (); ++i)
33
    {
34
      delete i->first;
35
    }
36
}
37
38
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper (const Ipv4ListRoutingHelper &o)
39
{
40
  std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i;
41
  for (i = o.m_list.begin (); i != o.m_list.end (); ++i)
42
    {
43
      m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (i->first->Copy ()), i->second));
44
    }
45
}
46
47
Ipv4ListRoutingHelper &
48
Ipv4ListRoutingHelper::operator = (const Ipv4ListRoutingHelper &o)
49
{
50
  if (this == &o)
51
    {
52
      return *this;
53
    }
54
  std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i;
55
  for (i = o.m_list.begin (); i != o.m_list.end (); ++i)
56
    {
57
      m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (i->first->Copy ()), i->second));
58
    }
59
  return *this;
60
}
61
62
Ipv4ListRoutingHelper* 
63
Ipv4ListRoutingHelper::Copy (void) const 
64
{
65
  return new Ipv4ListRoutingHelper (*this); 
66
}
67
28
void 
68
void 
29
Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority)
69
Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority)
30
{
70
{
31
  m_list.push_back (std::make_pair(&routing,priority));
71
  m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (routing.Copy ()), priority));
32
}
72
}
73
33
Ptr<Ipv4RoutingProtocol> 
74
Ptr<Ipv4RoutingProtocol> 
34
Ipv4ListRoutingHelper::Create (Ptr<Node> node) const
75
Ipv4ListRoutingHelper::Create (Ptr<Node> node) const
35
{
76
{
36
  Ptr<Ipv4ListRouting> list = CreateObject<Ipv4ListRouting> ();
77
  Ptr<Ipv4ListRouting> list = CreateObject<Ipv4ListRouting> ();
37
  for (std::list<std::pair<const Ipv4RoutingHelper *,int16_t> >::const_iterator i = m_list.begin ();
78
  for (std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i = m_list.begin ();
38
       i != m_list.end (); ++i)
79
       i != m_list.end (); ++i)
39
    {
80
    {
40
      Ptr<Ipv4RoutingProtocol> prot = i->first->Create (node);
81
      Ptr<Ipv4RoutingProtocol> prot = i->first->Create (node);
(-)a/src/helper/ipv4-list-routing-helper.h (-1 / +12 lines)
 Lines 35-41    Link Here 
35
class Ipv4ListRoutingHelper : public Ipv4RoutingHelper
35
class Ipv4ListRoutingHelper : public Ipv4RoutingHelper
36
{
36
{
37
public:
37
public:
38
  Ipv4ListRoutingHelper();
38
  Ipv4ListRoutingHelper ();
39
  virtual ~Ipv4ListRoutingHelper ();
40
  Ipv4ListRoutingHelper (const Ipv4ListRoutingHelper &);
41
  Ipv4ListRoutingHelper &operator = (const Ipv4ListRoutingHelper &o);
42
  /**
43
   * \returns pointer to clone of this Ipv4ListRoutingHelper 
44
   * 
45
   * This method is mainly for internal use by the other helpers;
46
   * clients are expected to free the dynamic memory allocated by this method
47
   */
48
  Ipv4ListRoutingHelper* Copy (void) const;
49
39
  /**
50
  /**
40
   * \param routing a routing helper
51
   * \param routing a routing helper
41
   * \param priority the priority of the associated helper
52
   * \param priority the priority of the associated helper
(-)a/src/helper/ipv4-nix-vector-helper.cc (+22 lines)
 Lines 28-33    Link Here 
28
  m_agentFactory.SetTypeId ("ns3::Ipv4NixVectorRouting");
28
  m_agentFactory.SetTypeId ("ns3::Ipv4NixVectorRouting");
29
}
29
}
30
30
31
Ipv4NixVectorHelper::Ipv4NixVectorHelper (const Ipv4NixVectorHelper &o)
32
  : m_agentFactory (o.m_agentFactory)
33
{
34
}
35
36
Ipv4NixVectorHelper &
37
Ipv4NixVectorHelper::operator = (const Ipv4NixVectorHelper &o)
38
{
39
  if (this == &o)
40
    {
41
      return *this;
42
    }
43
  m_agentFactory = o.m_agentFactory;
44
  return *this;
45
}
46
47
Ipv4NixVectorHelper* 
48
Ipv4NixVectorHelper::Copy (void) const 
49
{
50
  return new Ipv4NixVectorHelper (*this); 
51
}
52
31
Ptr<Ipv4RoutingProtocol> 
53
Ptr<Ipv4RoutingProtocol> 
32
Ipv4NixVectorHelper::Create (Ptr<Node> node) const
54
Ipv4NixVectorHelper::Create (Ptr<Node> node) const
33
{
55
{
(-)a/src/helper/ipv4-nix-vector-helper.h (+9 lines)
 Lines 38-43    Link Here 
38
{
38
{
39
public:
39
public:
40
  Ipv4NixVectorHelper ();
40
  Ipv4NixVectorHelper ();
41
  Ipv4NixVectorHelper (const Ipv4NixVectorHelper &);
42
  Ipv4NixVectorHelper &operator = (const Ipv4NixVectorHelper &o);
43
  /**
44
   * \returns pointer to clone of this Ipv4NixVectorHelper 
45
   * 
46
   * This method is mainly for internal use by the other helpers;
47
   * clients are expected to free the dynamic memory allocated by this method
48
   */
49
  Ipv4NixVectorHelper* Copy (void) const;
41
50
42
  /**
51
  /**
43
  * \param node the node on which the routing protocol will run
52
  * \param node the node on which the routing protocol will run
(-)a/src/helper/ipv4-routing-helper.h (+10 lines)
 Lines 40-45    Link Here 
40
{
40
{
41
public:
41
public:
42
  virtual ~Ipv4RoutingHelper ();
42
  virtual ~Ipv4RoutingHelper ();
43
44
  /**
45
   * \brief virtual constructor
46
   * \returns pointer to clone of this Ipv4RoutingHelper 
47
   * 
48
   * This method is mainly for internal use by the other helpers;
49
   * clients are expected to free the dynamic memory allocated by this method
50
   */
51
  virtual Ipv4RoutingHelper* Copy (void) const = 0;
52
43
  /**
53
  /**
44
   * \param node the node within which the new routing protocol will run
54
   * \param node the node within which the new routing protocol will run
45
   * \returns a newly-created routing protocol
55
   * \returns a newly-created routing protocol
(-)a/src/helper/ipv4-static-routing-helper.cc (+17 lines)
 Lines 35-40    Link Here 
35
35
36
Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper()
36
Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper()
37
{}
37
{}
38
39
Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper (const Ipv4StaticRoutingHelper &o)
40
{
41
}
42
43
Ipv4StaticRoutingHelper &
44
Ipv4StaticRoutingHelper::operator = (const Ipv4StaticRoutingHelper &o)
45
{
46
  return *this;
47
}
48
49
Ipv4StaticRoutingHelper* 
50
Ipv4StaticRoutingHelper::Copy (void) const 
51
{
52
  return new Ipv4StaticRoutingHelper (*this); 
53
}
54
38
Ptr<Ipv4RoutingProtocol> 
55
Ptr<Ipv4RoutingProtocol> 
39
Ipv4StaticRoutingHelper::Create (Ptr<Node> node) const
56
Ipv4StaticRoutingHelper::Create (Ptr<Node> node) const
40
{
57
{
(-)a/src/helper/ipv4-static-routing-helper.h (-1 / +10 lines)
 Lines 40-46    Link Here 
40
class Ipv4StaticRoutingHelper : public Ipv4RoutingHelper
40
class Ipv4StaticRoutingHelper : public Ipv4RoutingHelper
41
{
41
{
42
public:
42
public:
43
  Ipv4StaticRoutingHelper();
43
  Ipv4StaticRoutingHelper ();
44
  Ipv4StaticRoutingHelper (const Ipv4StaticRoutingHelper &);
45
  Ipv4StaticRoutingHelper &operator = (const Ipv4StaticRoutingHelper &o);
46
  /**
47
   * \returns pointer to clone of this Ipv4StaticRoutingHelper
48
   *
49
   * This method is mainly for internal use by the other helpers;
50
   * clients are expected to free the dynamic memory allocated by this method
51
   */
52
  Ipv4StaticRoutingHelper* Copy (void) const;
44
53
45
  /**
54
  /**
46
   * \param node the node on which the routing protocol will run
55
   * \param node the node on which the routing protocol will run
(-)a/src/helper/ipv6-list-routing-helper.cc (-1 / +40 lines)
 Lines 27-36    Link Here 
27
27
28
Ipv6ListRoutingHelper::Ipv6ListRoutingHelper ()
28
Ipv6ListRoutingHelper::Ipv6ListRoutingHelper ()
29
{}
29
{}
30
31
Ipv6ListRoutingHelper::~Ipv6ListRoutingHelper()
32
{
33
  for (std::list<std::pair<const Ipv6RoutingHelper *, int16_t> >::iterator i = m_list.begin ();
34
       i != m_list.end (); ++i)
35
    {
36
      delete i->first;
37
    }
38
}
39
Ipv6ListRoutingHelper::Ipv6ListRoutingHelper (const Ipv6ListRoutingHelper &o)
40
{
41
  std::list<std::pair<const Ipv6RoutingHelper *, int16_t> >::const_iterator i;
42
  for (i = o.m_list.begin (); i != o.m_list.end (); ++i)
43
    {
44
      m_list.push_back (std::make_pair (const_cast<const Ipv6RoutingHelper *> (i->first->Copy ()), i->second));
45
    }
46
}
47
48
Ipv6ListRoutingHelper &
49
Ipv6ListRoutingHelper::operator = (const Ipv6ListRoutingHelper &o)
50
{
51
  if (this == &o)
52
    {
53
      return *this;
54
    }
55
  std::list<std::pair<const Ipv6RoutingHelper *, int16_t> >::const_iterator i;
56
  for (i = o.m_list.begin (); i != o.m_list.end (); ++i)
57
    {
58
      m_list.push_back (std::make_pair (const_cast<const Ipv6RoutingHelper *> (i->first->Copy ()), i->second));
59
    }
60
  return *this;
61
}
62
63
Ipv6ListRoutingHelper* 
64
Ipv6ListRoutingHelper::Copy (void) const 
65
{
66
  return new Ipv6ListRoutingHelper (*this); 
67
}
68
30
void 
69
void 
31
Ipv6ListRoutingHelper::Add (const Ipv6RoutingHelper &routing, int16_t priority)
70
Ipv6ListRoutingHelper::Add (const Ipv6RoutingHelper &routing, int16_t priority)
32
{
71
{
33
  m_list.push_back (std::make_pair (&routing,priority));
72
  m_list.push_back (std::make_pair (const_cast<const Ipv6RoutingHelper *> (routing.Copy ()), priority));
34
}
73
}
35
Ptr<Ipv6RoutingProtocol> 
74
Ptr<Ipv6RoutingProtocol> 
36
Ipv6ListRoutingHelper::Create (Ptr<Node> node) const
75
Ipv6ListRoutingHelper::Create (Ptr<Node> node) const
(-)a/src/helper/ipv6-list-routing-helper.h (+11 lines)
 Lines 38-43    Link Here 
38
{
38
{
39
public:
39
public:
40
  Ipv6ListRoutingHelper ();
40
  Ipv6ListRoutingHelper ();
41
  virtual ~Ipv6ListRoutingHelper ();
42
  Ipv6ListRoutingHelper (const Ipv6ListRoutingHelper &);
43
  Ipv6ListRoutingHelper &operator = (const Ipv6ListRoutingHelper &o);
44
  /**
45
   * \returns pointer to clone of this Ipv6ListRoutingHelper 
46
   * 
47
   * This method is mainly for internal use by the other helpers;
48
   * clients are expected to free the dynamic memory allocated by this method
49
   */
50
  Ipv6ListRoutingHelper* Copy (void) const;
51
41
  /**
52
  /**
42
   * \param routing a routing helper
53
   * \param routing a routing helper
43
   * \param priority the priority of the associated helper
54
   * \param priority the priority of the associated helper
(-)a/src/helper/ipv6-routing-helper.h (+10 lines)
 Lines 41-46    Link Here 
41
{
41
{
42
public:
42
public:
43
  virtual ~Ipv6RoutingHelper ();
43
  virtual ~Ipv6RoutingHelper ();
44
45
  /**
46
   * \brief virtual constructor
47
   * \returns pointer to clone of this Ipv6RoutingHelper 
48
   * 
49
   * This method is mainly for internal use by the other helpers;
50
   * clients are expected to free the dynamic memory allocated by this method
51
   */
52
  virtual Ipv6RoutingHelper* Copy (void) const = 0;
53
44
  /**
54
  /**
45
   * \param node the node within which the new routing protocol will run
55
   * \param node the node within which the new routing protocol will run
46
   * \returns a newly-created routing protocol
56
   * \returns a newly-created routing protocol
(-)a/src/helper/ipv6-static-routing-helper.cc (+17 lines)
 Lines 37-42    Link Here 
37
37
38
Ipv6StaticRoutingHelper::Ipv6StaticRoutingHelper ()
38
Ipv6StaticRoutingHelper::Ipv6StaticRoutingHelper ()
39
{}
39
{}
40
41
Ipv6StaticRoutingHelper::Ipv6StaticRoutingHelper (const Ipv6StaticRoutingHelper &o)
42
{
43
}
44
45
Ipv6StaticRoutingHelper &
46
Ipv6StaticRoutingHelper::operator = (const Ipv6StaticRoutingHelper &o)
47
{
48
  return *this;
49
}
50
51
Ipv6StaticRoutingHelper* 
52
Ipv6StaticRoutingHelper::Copy (void) const 
53
{
54
  return new Ipv6StaticRoutingHelper (*this); 
55
}
56
40
Ptr<Ipv6RoutingProtocol> 
57
Ptr<Ipv6RoutingProtocol> 
41
Ipv6StaticRoutingHelper::Create (Ptr<Node> node) const
58
Ipv6StaticRoutingHelper::Create (Ptr<Node> node) const
42
{
59
{
(-)a/src/helper/ipv6-static-routing-helper.h (+9 lines)
 Lines 45-50    Link Here 
45
   * \brief Constructor.
45
   * \brief Constructor.
46
   */
46
   */
47
  Ipv6StaticRoutingHelper ();
47
  Ipv6StaticRoutingHelper ();
48
  Ipv6StaticRoutingHelper (const Ipv6StaticRoutingHelper &);
49
  Ipv6StaticRoutingHelper &operator = (const Ipv6StaticRoutingHelper &o);
50
  /**
51
   * \returns pointer to clone of this Ipv6StaticRoutingHelper
52
   *
53
   * This method is mainly for internal use by the other helpers;
54
   * clients are expected to free the dynamic memory allocated by this method
55
   */
56
  Ipv6StaticRoutingHelper* Copy (void) const;
48
57
49
  /**
58
  /**
50
   * \param node the node on which the routing protocol will run
59
   * \param node the node on which the routing protocol will run
(-)a/src/helper/olsr-helper.cc (+22 lines)
 Lines 30-35    Link Here 
30
  m_agentFactory.SetTypeId ("ns3::olsr::RoutingProtocol");
30
  m_agentFactory.SetTypeId ("ns3::olsr::RoutingProtocol");
31
}
31
}
32
32
33
OlsrHelper::OlsrHelper (const OlsrHelper &o)
34
  : m_agentFactory (o.m_agentFactory)
35
{
36
}
37
38
OlsrHelper &
39
OlsrHelper::operator = (const OlsrHelper &o)
40
{
41
  if (this == &o)
42
    {
43
      return *this;
44
    }
45
  m_agentFactory = o.m_agentFactory;
46
  return *this;
47
}
48
49
OlsrHelper* 
50
OlsrHelper::Copy (void) const 
51
{
52
  return new OlsrHelper (*this); 
53
}
54
33
Ptr<Ipv4RoutingProtocol> 
55
Ptr<Ipv4RoutingProtocol> 
34
OlsrHelper::Create (Ptr<Node> node) const
56
OlsrHelper::Create (Ptr<Node> node) const
35
{
57
{
(-)a/src/helper/olsr-helper.h (+9 lines)
 Lines 37-42    Link Here 
37
{
37
{
38
public:
38
public:
39
  OlsrHelper ();
39
  OlsrHelper ();
40
  OlsrHelper (const OlsrHelper &);
41
  OlsrHelper &operator = (const OlsrHelper &o);
42
  /**
43
   * \returns pointer to clone of this OlsrHelper 
44
   * 
45
   * This method is mainly for internal use by the other helpers;
46
   * clients are expected to free the dynamic memory allocated by this method
47
   */
48
  OlsrHelper* Copy (void) const;
40
49
41
  /**
50
  /**
42
   * \param node the node on which the routing protocol will run
51
   * \param node the node on which the routing protocol will run

Return to bug 678