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