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
ipv4-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 IPV4_ROUTING_HELPER_H
22
#define IPV4_ROUTING_HELPER_H
23
24
#include "ns3/ptr.h"
25
#include "ns3/nstime.h"
26
#include "ns3/output-stream-wrapper.h"
27
#include "ns3/ipv4-list-routing.h"
28
29
namespace
ns3 {
30
31
class
Ipv4RoutingProtocol;
32
class
Node;
33
43
class
Ipv4RoutingHelper
44
{
45
public
:
46
/*
47
* Destroy an instance of an Ipv4RoutingHelper
48
*/
49
virtual
~Ipv4RoutingHelper
();
50
58
virtual
Ipv4RoutingHelper
*
Copy
(
void
)
const
= 0;
59
64
virtual
Ptr<Ipv4RoutingProtocol>
Create
(
Ptr<Node>
node)
const
= 0;
65
75
void
PrintRoutingTableAllAt
(
Time
printTime,
Ptr<OutputStreamWrapper>
stream)
const
;
76
86
void
PrintRoutingTableAllEvery
(
Time
printInterval,
Ptr<OutputStreamWrapper>
stream)
const
;
87
98
void
PrintRoutingTableAt
(
Time
printTime,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
;
99
110
void
PrintRoutingTableEvery
(
Time
printInterval,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
;
111
121
template
<
class
T>
122
static
Ptr<T>
GetRouting
(
Ptr<Ipv4RoutingProtocol>
protocol);
123
124
private
:
125
void
Print
(
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
;
126
void
PrintEvery
(
Time
printInterval,
Ptr<Node>
node,
Ptr<OutputStreamWrapper>
stream)
const
;
127
};
128
129
130
template
<
class
T>
131
Ptr<T>
Ipv4RoutingHelper::GetRouting
(
Ptr<Ipv4RoutingProtocol>
protocol)
132
{
133
Ptr<T>
ret = DynamicCast<T> (protocol);
134
if
(ret == 0)
135
{
136
// trying to check if protocol is a list routing
137
Ptr<Ipv4ListRouting>
lrp = DynamicCast<Ipv4ListRouting> (protocol);
138
if
(lrp != 0)
139
{
140
for
(uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
141
{
142
int16_t priority;
143
ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority));
// potential recursion, if inside ListRouting is ListRouting
144
if
(ret != 0)
145
break
;
146
}
147
}
148
}
149
150
return
ret;
151
}
152
153
}
// namespace ns3
154
155
156
#endif
/* IPV4_ROUTING_HELPER_H */
src
internet
helper
ipv4-routing-helper.h
Generated on Fri Aug 30 2013 01:42:50 for ns-3 by
1.8.1.2