A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ipv6-routing-helper.cc
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
#include "ns3/node.h"
22
#include "ns3/node-list.h"
23
#include "ns3/simulator.h"
24
#include "ns3/ipv6-routing-protocol.h"
25
#include "ns3/ipv6-list-routing.h"
26
#include "
ipv6-routing-helper.h
"
27
28
namespace
ns3 {
29
30
Ipv6RoutingHelper::~Ipv6RoutingHelper
()
31
{
32
}
33
34
void
35
Ipv6RoutingHelper::PrintRoutingTableAllAt
(
Time
printTime,
Ptr<OutputStreamWrapper>
stream)
const
36
{
37
for
(uint32_t i = 0; i <
NodeList::GetNNodes
(); i++)
38
{
39
Ptr<Node>
node =
NodeList::GetNode
(i);
40
Simulator::Schedule
(printTime, &
Ipv6RoutingHelper::Print
,
this
, node, stream);
41
}
42
}
43
44
void
45
Ipv6RoutingHelper::PrintRoutingTableAllEvery
(
Time
printInterval,
Ptr<OutputStreamWrapper>
stream)
const
46
{
47
for
(uint32_t i = 0; i <
NodeList::GetNNodes
(); i++)
48
{
49
Ptr<Node>
node =
NodeList::GetNode
(i);
50
Simulator::Schedule
(printInterval, &
Ipv6RoutingHelper::PrintEvery
,
this
, printInterval, node, stream);
51
}
52
}
53
54
void
55
Ipv6RoutingHelper::PrintRoutingTableAt
(
Time
printTime,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
56
{
57
Simulator::Schedule
(printTime, &
Ipv6RoutingHelper::Print
,
this
, node, stream);
58
}
59
60
void
61
Ipv6RoutingHelper::PrintRoutingTableEvery
(
Time
printInterval,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
62
{
63
Simulator::Schedule
(printInterval, &
Ipv6RoutingHelper::PrintEvery
,
this
, printInterval, node, stream);
64
}
65
66
void
67
Ipv6RoutingHelper::Print
(
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
68
{
69
Ptr<Ipv6>
ipv6 = node->
GetObject
<
Ipv6
> ();
70
Ptr<Ipv6RoutingProtocol>
rp = ipv6->GetRoutingProtocol ();
71
NS_ASSERT
(rp);
72
rp->PrintRoutingTable (stream);
73
}
74
75
void
76
Ipv6RoutingHelper::PrintEvery
(
Time
printInterval,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
77
{
78
Ptr<Ipv6>
ipv6 = node->
GetObject
<
Ipv6
> ();
79
Ptr<Ipv6RoutingProtocol>
rp = ipv6->GetRoutingProtocol ();
80
NS_ASSERT
(rp);
81
rp->PrintRoutingTable (stream);
82
Simulator::Schedule
(printInterval, &
Ipv6RoutingHelper::PrintEvery
,
this
, printInterval, node, stream);
83
}
84
85
}
// namespace ns3
ns3::Ipv6RoutingHelper::~Ipv6RoutingHelper
virtual ~Ipv6RoutingHelper()
Destroy an Ipv6 Ipv6RoutingHelper.
Definition:
ipv6-routing-helper.cc:30
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< OutputStreamWrapper >
ns3::NodeList::GetNNodes
static uint32_t GetNNodes(void)
Definition:
node-list.cc:198
ns3::Ipv6
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition:
ipv6.h:79
ns3::NodeList::GetNode
static Ptr< Node > GetNode(uint32_t n)
Definition:
node-list.cc:192
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
ns3::Simulator::Schedule
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Definition:
simulator.h:824
ns3::Ipv6RoutingHelper::PrintRoutingTableAllEvery
void PrintRoutingTableAllEvery(Time printInterval, Ptr< OutputStreamWrapper > stream) const
prints the routing tables of all nodes at regular intervals specified by user.
Definition:
ipv6-routing-helper.cc:45
ns3::Ipv6RoutingHelper::PrintRoutingTableAt
void PrintRoutingTableAt(Time printTime, Ptr< Node > node, Ptr< OutputStreamWrapper > stream) const
prints the routing tables of a node at a particular time.
Definition:
ipv6-routing-helper.cc:55
ns3::Ipv6RoutingHelper::Print
void Print(Ptr< Node > node, Ptr< OutputStreamWrapper > stream) const
Definition:
ipv6-routing-helper.cc:67
ipv6-routing-helper.h
ns3::Ipv6RoutingHelper::PrintEvery
void PrintEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream) const
Definition:
ipv6-routing-helper.cc:76
ns3::Ipv6RoutingHelper::PrintRoutingTableEvery
void PrintRoutingTableEvery(Time printInterval, Ptr< Node > node, Ptr< OutputStreamWrapper > stream) const
prints the routing tables of a node at regular intervals specified by user.
Definition:
ipv6-routing-helper.cc:61
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Definition:
object.h:360
ns3::Ipv6RoutingHelper::PrintRoutingTableAllAt
void PrintRoutingTableAllAt(Time printTime, Ptr< OutputStreamWrapper > stream) const
prints the routing tables of all nodes at a particular time.
Definition:
ipv6-routing-helper.cc:35
src
internet
helper
ipv6-routing-helper.cc
Generated on Sat Nov 16 2013 12:55:27 for ns-3 by
1.8.5