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-route.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*/
7
#ifndef IPV4_ROUTE_H
8
#define IPV4_ROUTE_H
9
10
#include "ns3/ipv4-address.h"
11
#include "ns3/simple-ref-count.h"
12
13
#include <list>
14
#include <map>
15
#include <ostream>
16
17
namespace
ns3
18
{
19
20
class
NetDevice;
21
22
/**
23
* \ingroup ipv4Routing
24
*
25
* \brief IPv4 route cache entry (similar to Linux struct rtable)
26
*
27
* This is a reference counted object. In the future, we will add other
28
* entries from struct dst_entry, struct rtable, and struct dst_ops as needed.
29
*/
30
class
Ipv4Route
:
public
SimpleRefCount
<Ipv4Route>
31
{
32
public
:
33
Ipv4Route
();
34
35
/**
36
* \param dest Destination Ipv4Address
37
*/
38
void
SetDestination
(
Ipv4Address
dest);
39
/**
40
* \return Destination Ipv4Address of the route
41
*/
42
Ipv4Address
GetDestination
()
const
;
43
44
/**
45
* \param src Source Ipv4Address
46
*/
47
void
SetSource
(
Ipv4Address
src);
48
/**
49
* \return Source Ipv4Address of the route
50
*/
51
Ipv4Address
GetSource
()
const
;
52
53
/**
54
* \param gw Gateway (next hop) Ipv4Address
55
*/
56
void
SetGateway
(
Ipv4Address
gw);
57
/**
58
* \return Ipv4Address of the gateway (next hop)
59
*/
60
Ipv4Address
GetGateway
()
const
;
61
62
/**
63
* Equivalent in Linux to dst_entry.dev
64
*
65
* \param outputDevice pointer to NetDevice for outgoing packets
66
*/
67
void
SetOutputDevice
(
Ptr<NetDevice>
outputDevice);
68
/**
69
* \return pointer to NetDevice for outgoing packets
70
*/
71
Ptr<NetDevice>
GetOutputDevice
()
const
;
72
73
#ifdef NOTYET
74
// rtable.idev
75
void
SetInputIfIndex(
uint32_t
iif);
76
uint32_t
GetInputIfIndex()
const
;
77
#endif
78
79
private
:
80
Ipv4Address
m_dest
;
//!< Destination address.
81
Ipv4Address
m_source
;
//!< Source address.
82
Ipv4Address
m_gateway
;
//!< Gateway address.
83
Ptr<NetDevice>
m_outputDevice
;
//!< Output device.
84
#ifdef NOTYET
85
uint32_t
m_inputIfIndex;
86
#endif
87
};
88
89
/**
90
* \brief Stream insertion operator.
91
*
92
* \param os the reference to the output stream
93
* \param route the Ipv4 route
94
* \returns the reference to the output stream
95
*/
96
std::ostream&
operator<<
(std::ostream& os,
const
Ipv4Route
& route);
97
98
/**
99
* \ingroup ipv4Routing
100
*
101
* \brief Ipv4 multicast route cache entry (similar to Linux struct mfc_cache)
102
*/
103
class
Ipv4MulticastRoute
:
public
SimpleRefCount
<Ipv4MulticastRoute>
104
{
105
public
:
106
Ipv4MulticastRoute
();
107
108
/**
109
* \param group Ipv4Address of the multicast group
110
*/
111
void
SetGroup
(
const
Ipv4Address
group);
112
/**
113
* \return Ipv4Address of the multicast group
114
*/
115
Ipv4Address
GetGroup
()
const
;
116
117
/**
118
* \param origin Ipv4Address of the origin address
119
*/
120
void
SetOrigin
(
const
Ipv4Address
origin);
121
/**
122
* \return Ipv4Address of the origin address
123
*/
124
Ipv4Address
GetOrigin
()
const
;
125
126
/**
127
* \param iif Parent (input interface) for this route
128
*/
129
void
SetParent
(
uint32_t
iif);
130
/**
131
* \return Parent (input interface) for this route
132
*/
133
uint32_t
GetParent
()
const
;
134
135
/**
136
* \param oif Outgoing interface index
137
* \param ttl time-to-live for this route
138
*/
139
void
SetOutputTtl
(
uint32_t
oif,
uint32_t
ttl);
140
141
/**
142
* \return map of output interface Ids and TTLs for this route
143
*/
144
std::map<uint32_t, uint32_t>
GetOutputTtlMap
()
const
;
145
146
static
const
uint32_t
MAX_INTERFACES
=
147
16;
//!< Maximum number of multicast interfaces on a router
148
static
const
uint32_t
MAX_TTL
= 255;
//!< Maximum time-to-live (TTL)
149
150
private
:
151
Ipv4Address
m_group
;
//!< Group
152
Ipv4Address
m_origin
;
//!< Source of packet
153
uint32_t
m_parent
;
//!< Source interface
154
std::map<uint32_t, uint32_t>
m_ttls
;
//!< Time to Live container
155
};
156
157
}
// namespace ns3
158
159
#endif
/* IPV4_ROUTE_H */
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4MulticastRoute
Ipv4 multicast route cache entry (similar to Linux struct mfc_cache)
Definition
ipv4-route.h:104
ns3::Ipv4MulticastRoute::GetParent
uint32_t GetParent() const
Definition
ipv4-route.cc:130
ns3::Ipv4MulticastRoute::m_group
Ipv4Address m_group
Group.
Definition
ipv4-route.h:151
ns3::Ipv4MulticastRoute::GetGroup
Ipv4Address GetGroup() const
Definition
ipv4-route.cc:102
ns3::Ipv4MulticastRoute::GetOutputTtlMap
std::map< uint32_t, uint32_t > GetOutputTtlMap() const
Definition
ipv4-route.cc:156
ns3::Ipv4MulticastRoute::GetOrigin
Ipv4Address GetOrigin() const
Definition
ipv4-route.cc:116
ns3::Ipv4MulticastRoute::SetOrigin
void SetOrigin(const Ipv4Address origin)
Definition
ipv4-route.cc:109
ns3::Ipv4MulticastRoute::m_origin
Ipv4Address m_origin
Source of packet.
Definition
ipv4-route.h:152
ns3::Ipv4MulticastRoute::SetOutputTtl
void SetOutputTtl(uint32_t oif, uint32_t ttl)
Definition
ipv4-route.cc:137
ns3::Ipv4MulticastRoute::SetGroup
void SetGroup(const Ipv4Address group)
Definition
ipv4-route.cc:95
ns3::Ipv4MulticastRoute::MAX_INTERFACES
static const uint32_t MAX_INTERFACES
Maximum number of multicast interfaces on a router.
Definition
ipv4-route.h:146
ns3::Ipv4MulticastRoute::m_parent
uint32_t m_parent
Source interface.
Definition
ipv4-route.h:153
ns3::Ipv4MulticastRoute::MAX_TTL
static const uint32_t MAX_TTL
Maximum time-to-live (TTL)
Definition
ipv4-route.h:148
ns3::Ipv4MulticastRoute::m_ttls
std::map< uint32_t, uint32_t > m_ttls
Time to Live container.
Definition
ipv4-route.h:154
ns3::Ipv4MulticastRoute::Ipv4MulticastRoute
Ipv4MulticastRoute()
Definition
ipv4-route.cc:88
ns3::Ipv4MulticastRoute::SetParent
void SetParent(uint32_t iif)
Definition
ipv4-route.cc:123
ns3::Ipv4Route
IPv4 route cache entry (similar to Linux struct rtable)
Definition
ipv4-route.h:31
ns3::Ipv4Route::m_source
Ipv4Address m_source
Source address.
Definition
ipv4-route.h:81
ns3::Ipv4Route::SetGateway
void SetGateway(Ipv4Address gw)
Definition
ipv4-route.cc:53
ns3::Ipv4Route::GetOutputDevice
Ptr< NetDevice > GetOutputDevice() const
Definition
ipv4-route.cc:74
ns3::Ipv4Route::GetGateway
Ipv4Address GetGateway() const
Definition
ipv4-route.cc:60
ns3::Ipv4Route::SetDestination
void SetDestination(Ipv4Address dest)
Definition
ipv4-route.cc:25
ns3::Ipv4Route::SetSource
void SetSource(Ipv4Address src)
Definition
ipv4-route.cc:39
ns3::Ipv4Route::GetSource
Ipv4Address GetSource() const
Definition
ipv4-route.cc:46
ns3::Ipv4Route::m_gateway
Ipv4Address m_gateway
Gateway address.
Definition
ipv4-route.h:82
ns3::Ipv4Route::SetOutputDevice
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Equivalent in Linux to dst_entry.dev.
Definition
ipv4-route.cc:67
ns3::Ipv4Route::GetDestination
Ipv4Address GetDestination() const
Definition
ipv4-route.cc:32
ns3::Ipv4Route::m_outputDevice
Ptr< NetDevice > m_outputDevice
Output device.
Definition
ipv4-route.h:83
ns3::Ipv4Route::Ipv4Route
Ipv4Route()
Definition
ipv4-route.cc:19
ns3::Ipv4Route::m_dest
Ipv4Address m_dest
Destination address.
Definition
ipv4-route.h:80
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
src
internet
model
ipv4-route.h
Generated on Sun Nov 3 2024 09:20:39 for ns-3 by
1.11.0