A Discrete-Event Network Simulator
API
ipv6-routing-helper.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20
21#ifndef IPV6_ROUTING_HELPER_H
22#define IPV6_ROUTING_HELPER_H
23
24#include "ns3/ptr.h"
25#include "ns3/nstime.h"
26#include "ns3/output-stream-wrapper.h"
27#include "ns3/ipv6-list-routing.h"
28
29namespace ns3 {
30
31class Ipv6RoutingProtocol;
32class Node;
33
46{
47public:
48
52 virtual ~Ipv6RoutingHelper ();
53
61 virtual Ipv6RoutingHelper* Copy (void) const = 0;
62
67 virtual Ptr<Ipv6RoutingProtocol> Create (Ptr<Node> node) const = 0;
68
79 static void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
80
91 static void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
92
104 static void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
105
117 static void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
118
133 static void PrintNeighborCacheAllAt (Time printTime, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
134
149 static void PrintNeighborCacheAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
150
166 static void PrintNeighborCacheAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
167
183 static void PrintNeighborCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
184
194 template<class T>
196
197private:
208 static void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit);
209
221 static void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit);
222
237 static void PrintNdiscCache (Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
238
254 static void PrintNdiscCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
255};
256
266template<class T>
268{
269 Ptr<T> ret = DynamicCast<T> (protocol);
270 if (ret == 0)
271 {
272 // trying to check if protocol is a list routing
273 Ptr<Ipv6ListRouting> lrp = DynamicCast<Ipv6ListRouting> (protocol);
274 if (lrp != 0)
275 {
276 for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
277 {
278 int16_t priority;
279 ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting
280 if (ret != 0)
281 break;
282 }
283 }
284 }
285
286 return ret;
287}
288
289} // namespace ns3
290
291
292#endif /* IPV6_ROUTING_HELPER_H */
293
A factory to create ns3::Ipv6RoutingProtocol objects.
virtual Ipv6RoutingHelper * Copy(void) const =0
virtual constructor
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.
virtual Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const =0
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.
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.
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:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:109
@ S
second
Definition: nstime.h:114
Every class exported by the ns3 library is enclosed in the ns3 namespace.