A Discrete-Event Network Simulator
API
ipv6-routing-helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #ifndef IPV6_ROUTING_HELPER_H
21 #define IPV6_ROUTING_HELPER_H
22 
23 #include "ns3/ipv6-list-routing.h"
24 #include "ns3/nstime.h"
25 #include "ns3/output-stream-wrapper.h"
26 #include "ns3/ptr.h"
27 
28 namespace ns3
29 {
30 
31 class Ipv6RoutingProtocol;
32 class Node;
33 
46 {
47  public:
51  virtual ~Ipv6RoutingHelper();
52 
60  virtual Ipv6RoutingHelper* Copy() const = 0;
61 
66  virtual Ptr<Ipv6RoutingProtocol> Create(Ptr<Node> node) const = 0;
67 
78  static void PrintRoutingTableAllAt(Time printTime,
80  Time::Unit unit = Time::S);
81 
92  static void PrintRoutingTableAllEvery(Time printInterval,
94  Time::Unit unit = Time::S);
95 
107  static void PrintRoutingTableAt(Time printTime,
108  Ptr<Node> node,
110  Time::Unit unit = Time::S);
111 
123  static void PrintRoutingTableEvery(Time printInterval,
124  Ptr<Node> node,
126  Time::Unit unit = Time::S);
127 
142  static void PrintNeighborCacheAllAt(Time printTime,
144  Time::Unit unit = Time::S);
145 
161  static void PrintNeighborCacheAllEvery(Time printInterval,
163  Time::Unit unit = Time::S);
164 
180  static void PrintNeighborCacheAt(Time printTime,
181  Ptr<Node> node,
183  Time::Unit unit = Time::S);
184 
201  static void PrintNeighborCacheEvery(Time printInterval,
202  Ptr<Node> node,
204  Time::Unit unit = Time::S);
205 
215  template <class T>
216  static Ptr<T> GetRouting(Ptr<Ipv6RoutingProtocol> protocol);
217 
218  private:
229  static void Print(Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit);
230 
242  static void PrintEvery(Time printInterval,
243  Ptr<Node> node,
245  Time::Unit unit);
246 
261  static void PrintNdiscCache(Ptr<Node> node,
263  Time::Unit unit = Time::S);
264 
281  static void PrintNdiscCacheEvery(Time printInterval,
282  Ptr<Node> node,
284  Time::Unit unit = Time::S);
285 };
286 
287 template <class T>
288 Ptr<T>
290 {
291  Ptr<T> ret = DynamicCast<T>(protocol);
292  if (!ret)
293  {
294  // trying to check if protocol is a list routing
295  Ptr<Ipv6ListRouting> lrp = DynamicCast<Ipv6ListRouting>(protocol);
296  if (lrp)
297  {
298  for (uint32_t i = 0; i < lrp->GetNRoutingProtocols(); i++)
299  {
300  int16_t priority;
301  ret = GetRouting<T>(lrp->GetRoutingProtocol(
302  i,
303  priority)); // potential recursion, if inside ListRouting is ListRouting
304  if (ret)
305  {
306  break;
307  }
308  }
309  }
310  }
311 
312  return ret;
313 }
314 
315 } // namespace ns3
316 
317 #endif /* IPV6_ROUTING_HELPER_H */
A factory to create ns3::Ipv6RoutingProtocol objects.
static void PrintRoutingTableAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing tables of all nodes at a particular time.
static void PrintNdiscCacheEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of a node at regular intervals specified by user.
static void PrintNeighborCacheAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at a particular time.
static void PrintNdiscCache(Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of a node.
static Ptr< T > GetRouting(Ptr< Ipv6RoutingProtocol > protocol)
Request a specified routing protocol <T> from Ipv6RoutingProtocol protocol.
virtual Ipv6RoutingHelper * Copy() const =0
virtual constructor
static void PrintNeighborCacheAllEvery(Time printInterval, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at regular intervals specified by user.
static void PrintRoutingTableAt(Time printTime, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing tables of a node at a particular time.
static void PrintRoutingTableAllEvery(Time printInterval, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing tables of all nodes at regular intervals specified by user.
static void PrintNeighborCacheEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of a node at regular intervals specified by user.
static void PrintRoutingTableEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing tables of a node at regular intervals specified by user.
virtual ~Ipv6RoutingHelper()
Destroy an Ipv6 Ipv6RoutingHelper.
static void Print(Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit)
prints the routing tables of a node.
static void PrintNeighborCacheAt(Time printTime, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of a node at a particular time.
virtual Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const =0
static void PrintEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream, Time::Unit unit)
prints the routing tables of a node at regular intervals specified by user.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:111
@ S
second
Definition: nstime.h:116
Every class exported by the ns3 library is enclosed in the ns3 namespace.