A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
ipv4-routing-table-entry.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 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
#ifndef IPV4_ROUTING_TABLE_ENTRY_H
20
#define IPV4_ROUTING_TABLE_ENTRY_H
21
22
#include "ns3/ipv4-address.h"
23
24
#include <list>
25
#include <ostream>
26
#include <vector>
27
28
namespace
ns3
29
{
30
31
/**
32
* \ingroup ipv4Routing
33
*
34
* A record of an IPv4 routing table entry for Ipv4GlobalRouting and
35
* Ipv4StaticRouting. This is not a reference counted object.
36
*/
37
class
Ipv4RoutingTableEntry
38
{
39
public
:
40
/**
41
* \brief This constructor does nothing
42
*/
43
Ipv4RoutingTableEntry
();
44
/**
45
* \brief Copy Constructor
46
* \param route The route to copy
47
*/
48
Ipv4RoutingTableEntry
(
const
Ipv4RoutingTableEntry
& route);
49
/**
50
* \brief Copy Constructor
51
* \param route The route to copy
52
*/
53
Ipv4RoutingTableEntry
(
const
Ipv4RoutingTableEntry
* route);
54
/**
55
* \return True if this route is a host route (mask of all ones); false otherwise
56
*/
57
bool
IsHost
()
const
;
58
/**
59
* \return True if this route is not a host route (mask is not all ones); false otherwise
60
*
61
* This method is implemented as !IsHost ().
62
*/
63
bool
IsNetwork
()
const
;
64
/**
65
* \return True if this route is a default route; false otherwise
66
*/
67
bool
IsDefault
()
const
;
68
/**
69
* \return True if this route is a gateway route; false otherwise
70
*/
71
bool
IsGateway
()
const
;
72
/**
73
* \return address of the gateway stored in this entry
74
*/
75
Ipv4Address
GetGateway
()
const
;
76
/**
77
* \return The IPv4 address of the destination of this route
78
*/
79
Ipv4Address
GetDest
()
const
;
80
/**
81
* \return The IPv4 network number of the destination of this route
82
*/
83
Ipv4Address
GetDestNetwork
()
const
;
84
/**
85
* \return The IPv4 network mask of the destination of this route
86
*/
87
Ipv4Mask
GetDestNetworkMask
()
const
;
88
/**
89
* \return The Ipv4 interface number used for sending outgoing packets
90
*/
91
uint32_t
GetInterface
()
const
;
92
/**
93
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
94
* \param dest Ipv4Address of the destination
95
* \param nextHop Ipv4Address of the next hop
96
* \param interface Outgoing interface
97
*/
98
static
Ipv4RoutingTableEntry
CreateHostRouteTo
(
Ipv4Address
dest,
99
Ipv4Address
nextHop,
100
uint32_t
interface);
101
/**
102
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
103
* \param dest Ipv4Address of the destination
104
* \param interface Outgoing interface
105
*/
106
static
Ipv4RoutingTableEntry
CreateHostRouteTo
(
Ipv4Address
dest,
uint32_t
interface);
107
/**
108
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
109
* \param network Ipv4Address of the destination network
110
* \param networkMask Ipv4Mask of the destination network mask
111
* \param nextHop Ipv4Address of the next hop
112
* \param interface Outgoing interface
113
*/
114
static
Ipv4RoutingTableEntry
CreateNetworkRouteTo
(
Ipv4Address
network,
115
Ipv4Mask
networkMask,
116
Ipv4Address
nextHop,
117
uint32_t
interface);
118
/**
119
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
120
* \param network Ipv4Address of the destination network
121
* \param networkMask Ipv4Mask of the destination network mask
122
* \param interface Outgoing interface
123
*/
124
static
Ipv4RoutingTableEntry
CreateNetworkRouteTo
(
Ipv4Address
network,
125
Ipv4Mask
networkMask,
126
uint32_t
interface);
127
/**
128
* \return An Ipv4RoutingTableEntry object corresponding to the input
129
* parameters. This route is distinguished; it will match any
130
* destination for which a more specific route does not exist.
131
* \param nextHop Ipv4Address of the next hop
132
* \param interface Outgoing interface
133
*/
134
static
Ipv4RoutingTableEntry
CreateDefaultRoute
(
Ipv4Address
nextHop,
uint32_t
interface);
135
136
private
:
137
/**
138
* \brief Constructor.
139
* \param network network address
140
* \param mask network mask
141
* \param gateway the gateway
142
* \param interface the interface index
143
*/
144
Ipv4RoutingTableEntry
(
Ipv4Address
network,
145
Ipv4Mask
mask,
146
Ipv4Address
gateway,
147
uint32_t
interface);
148
/**
149
* \brief Constructor.
150
* \param dest destination address
151
* \param mask network mask
152
* \param interface the interface index
153
*/
154
Ipv4RoutingTableEntry
(
Ipv4Address
dest,
Ipv4Mask
mask,
uint32_t
interface);
155
/**
156
* \brief Constructor.
157
* \param dest destination address
158
* \param gateway the gateway
159
* \param interface the interface index
160
*/
161
Ipv4RoutingTableEntry
(
Ipv4Address
dest,
Ipv4Address
gateway,
uint32_t
interface);
162
/**
163
* \brief Constructor.
164
* \param dest destination address
165
* \param interface the interface index
166
*/
167
Ipv4RoutingTableEntry
(
Ipv4Address
dest,
uint32_t
interface);
168
169
Ipv4Address
m_dest
;
//!< destination address
170
Ipv4Mask
m_destNetworkMask
;
//!< destination network mask
171
Ipv4Address
m_gateway
;
//!< gateway
172
uint32_t
m_interface
;
//!< output interface
173
};
174
175
/**
176
* \brief Stream insertion operator.
177
*
178
* \param os the reference to the output stream
179
* \param route the Ipv4 routing table entry
180
* \returns the reference to the output stream
181
*/
182
std::ostream&
operator<<
(std::ostream& os,
const
Ipv4RoutingTableEntry
& route);
183
184
/**
185
* \brief Equality operator.
186
*
187
* \param a lhs
188
* \param b rhs
189
* \returns true if operands are equal, false otherwise
190
*/
191
bool
operator==
(
const
Ipv4RoutingTableEntry
a,
const
Ipv4RoutingTableEntry
b);
192
193
/**
194
* \ingroup ipv4Routing
195
*
196
* \brief A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting
197
*/
198
class
Ipv4MulticastRoutingTableEntry
199
{
200
public
:
201
/**
202
* \brief This constructor does nothing
203
*/
204
Ipv4MulticastRoutingTableEntry
();
205
206
/**
207
* \brief Copy Constructor
208
* \param route The route to copy
209
*/
210
Ipv4MulticastRoutingTableEntry
(
const
Ipv4MulticastRoutingTableEntry
& route);
211
/**
212
* \brief Copy Constructor
213
* \param route The route to copy
214
*/
215
Ipv4MulticastRoutingTableEntry
(
const
Ipv4MulticastRoutingTableEntry
* route);
216
/**
217
* \return The IPv4 address of the source of this route
218
*/
219
Ipv4Address
GetOrigin
()
const
;
220
/**
221
* \return The IPv4 address of the multicast group of this route
222
*/
223
Ipv4Address
GetGroup
()
const
;
224
/**
225
* \return The IPv4 address of the input interface of this route
226
*/
227
uint32_t
GetInputInterface
()
const
;
228
/**
229
* \return The number of output interfaces of this route
230
*/
231
uint32_t
GetNOutputInterfaces
()
const
;
232
/**
233
* \param n interface index
234
* \return A specified output interface.
235
*/
236
uint32_t
GetOutputInterface
(
uint32_t
n)
const
;
237
/**
238
* \return A vector of all of the output interfaces of this route.
239
*/
240
std::vector<uint32_t>
GetOutputInterfaces
()
const
;
241
/**
242
* \return Ipv4MulticastRoutingTableEntry corresponding to the input parameters.
243
* \param origin Source address for the multicast route
244
* \param group Group destination address for the multicast route
245
* \param inputInterface Input interface that multicast datagram must be received on
246
* \param outputInterfaces vector of output interfaces to copy and forward the datagram to
247
*/
248
static
Ipv4MulticastRoutingTableEntry
CreateMulticastRoute
(
249
Ipv4Address
origin,
250
Ipv4Address
group,
251
uint32_t
inputInterface,
252
std::vector<uint32_t> outputInterfaces);
253
254
private
:
255
/**
256
* \brief Constructor.
257
* \param origin source address
258
* \param group destination address
259
* \param inputInterface input interface
260
* \param outputInterfaces output interfaces
261
*/
262
Ipv4MulticastRoutingTableEntry
(
Ipv4Address
origin,
263
Ipv4Address
group,
264
uint32_t
inputInterface,
265
std::vector<uint32_t> outputInterfaces);
266
267
Ipv4Address
m_origin
;
//!< source address
268
Ipv4Address
m_group
;
//!< destination address
269
uint32_t
m_inputInterface
;
//!< input interface
270
std::vector<uint32_t>
m_outputInterfaces
;
//!< output interfaces
271
};
272
273
/**
274
* \brief Stream insertion operator.
275
*
276
* \param os the reference to the output stream
277
* \param route the Ipv4 multicast routing table entry
278
* \returns the reference to the output stream
279
*/
280
std::ostream&
operator<<
(std::ostream& os,
const
Ipv4MulticastRoutingTableEntry
& route);
281
282
/**
283
* \brief Equality operator.
284
*
285
* \param a lhs
286
* \param b rhs
287
* \returns true if operands are equal, false otherwise
288
*/
289
bool
operator==
(
const
Ipv4MulticastRoutingTableEntry
a,
const
Ipv4MulticastRoutingTableEntry
b);
290
291
}
// namespace ns3
292
293
#endif
/* IPV4_ROUTING_TABLE_ENTRY_H */
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:42
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition:
ipv4-address.h:257
ns3::Ipv4MulticastRoutingTableEntry
A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting.
Definition:
ipv4-routing-table-entry.h:199
ns3::Ipv4MulticastRoutingTableEntry::m_origin
Ipv4Address m_origin
source address
Definition:
ipv4-routing-table-entry.h:267
ns3::Ipv4MulticastRoutingTableEntry::GetGroup
Ipv4Address GetGroup() const
Definition:
ipv4-routing-table-entry.cc:298
ns3::Ipv4MulticastRoutingTableEntry::GetOrigin
Ipv4Address GetOrigin() const
Definition:
ipv4-routing-table-entry.cc:291
ns3::Ipv4MulticastRoutingTableEntry::m_outputInterfaces
std::vector< uint32_t > m_outputInterfaces
output interfaces
Definition:
ipv4-routing-table-entry.h:270
ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterfaces
std::vector< uint32_t > GetOutputInterfaces() const
Definition:
ipv4-routing-table-entry.cc:329
ns3::Ipv4MulticastRoutingTableEntry::m_group
Ipv4Address m_group
destination address
Definition:
ipv4-routing-table-entry.h:268
ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterface
uint32_t GetOutputInterface(uint32_t n) const
Definition:
ipv4-routing-table-entry.cc:319
ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry
Ipv4MulticastRoutingTableEntry()
This constructor does nothing.
Definition:
ipv4-routing-table-entry.cc:252
ns3::Ipv4MulticastRoutingTableEntry::CreateMulticastRoute
static Ipv4MulticastRoutingTableEntry CreateMulticastRoute(Ipv4Address origin, Ipv4Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)
Definition:
ipv4-routing-table-entry.cc:336
ns3::Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces
uint32_t GetNOutputInterfaces() const
Definition:
ipv4-routing-table-entry.cc:312
ns3::Ipv4MulticastRoutingTableEntry::GetInputInterface
uint32_t GetInputInterface() const
Definition:
ipv4-routing-table-entry.cc:305
ns3::Ipv4MulticastRoutingTableEntry::m_inputInterface
uint32_t m_inputInterface
input interface
Definition:
ipv4-routing-table-entry.h:269
ns3::Ipv4RoutingTableEntry
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Definition:
ipv4-routing-table-entry.h:38
ns3::Ipv4RoutingTableEntry::GetDest
Ipv4Address GetDest() const
Definition:
ipv4-routing-table-entry.cc:106
ns3::Ipv4RoutingTableEntry::GetGateway
Ipv4Address GetGateway() const
Definition:
ipv4-routing-table-entry.cc:148
ns3::Ipv4RoutingTableEntry::CreateDefaultRoute
static Ipv4RoutingTableEntry CreateDefaultRoute(Ipv4Address nextHop, uint32_t interface)
Definition:
ipv4-routing-table-entry.cc:195
ns3::Ipv4RoutingTableEntry::IsHost
bool IsHost() const
Definition:
ipv4-routing-table-entry.cc:99
ns3::Ipv4RoutingTableEntry::m_dest
Ipv4Address m_dest
destination address
Definition:
ipv4-routing-table-entry.h:169
ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry
Ipv4RoutingTableEntry()
This constructor does nothing.
Definition:
ipv4-routing-table-entry.cc:34
ns3::Ipv4RoutingTableEntry::IsNetwork
bool IsNetwork() const
Definition:
ipv4-routing-table-entry.cc:113
ns3::Ipv4RoutingTableEntry::m_interface
uint32_t m_interface
output interface
Definition:
ipv4-routing-table-entry.h:172
ns3::Ipv4RoutingTableEntry::IsGateway
bool IsGateway() const
Definition:
ipv4-routing-table-entry.cc:141
ns3::Ipv4RoutingTableEntry::m_destNetworkMask
Ipv4Mask m_destNetworkMask
destination network mask
Definition:
ipv4-routing-table-entry.h:170
ns3::Ipv4RoutingTableEntry::GetDestNetwork
Ipv4Address GetDestNetwork() const
Definition:
ipv4-routing-table-entry.cc:127
ns3::Ipv4RoutingTableEntry::GetInterface
uint32_t GetInterface() const
Definition:
ipv4-routing-table-entry.cc:155
ns3::Ipv4RoutingTableEntry::m_gateway
Ipv4Address m_gateway
gateway
Definition:
ipv4-routing-table-entry.h:171
ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo
static Ipv4RoutingTableEntry CreateNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
Definition:
ipv4-routing-table-entry.cc:176
ns3::Ipv4RoutingTableEntry::CreateHostRouteTo
static Ipv4RoutingTableEntry CreateHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface)
Definition:
ipv4-routing-table-entry.cc:162
ns3::Ipv4RoutingTableEntry::IsDefault
bool IsDefault() const
Definition:
ipv4-routing-table-entry.cc:120
ns3::Ipv4RoutingTableEntry::GetDestNetworkMask
Ipv4Mask GetDestNetworkMask() const
Definition:
ipv4-routing-table-entry.cc:134
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition:
event-id.h:166
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:159
src
internet
model
ipv4-routing-table-entry.h
Generated on Tue May 28 2024 23:35:52 for ns-3 by
1.9.6