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-end-point-demux.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
9
#ifndef IPV4_END_POINT_DEMUX_H
10
#define IPV4_END_POINT_DEMUX_H
11
12
#include "
ipv4-interface.h
"
13
14
#include "ns3/ipv4-address.h"
15
16
#include <list>
17
#include <stdint.h>
18
19
namespace
ns3
20
{
21
22
class
Ipv4EndPoint;
23
24
/**
25
* \ingroup ipv4
26
*
27
* \brief Demultiplexes packets to various transport layer endpoints
28
*
29
* This class serves as a lookup table to match partial or full information
30
* about a four-tuple to an ns3::Ipv4EndPoint. It internally contains a list
31
* of endpoints, and has APIs to add and find endpoints in this demux. This
32
* code is shared in common to TCP and UDP protocols in ns3. This demux
33
* sits between ns3's layer four and the socket layer
34
*/
35
36
class
Ipv4EndPointDemux
37
{
38
public
:
39
/**
40
* \brief Container of the IPv4 endpoints.
41
*/
42
typedef
std::list<Ipv4EndPoint*>
EndPoints
;
43
44
/**
45
* \brief Iterator to the container of the IPv4 endpoints.
46
*/
47
typedef
std::list<Ipv4EndPoint*>::iterator
EndPointsI
;
48
49
Ipv4EndPointDemux
();
50
~Ipv4EndPointDemux
();
51
52
/**
53
* \brief Get the entire list of end points registered.
54
* \return list of Ipv4EndPoint
55
*/
56
EndPoints
GetAllEndPoints
();
57
58
/**
59
* \brief Lookup for port local.
60
* \param port port to test
61
* \return true if a port local is in EndPoints, false otherwise
62
*/
63
bool
LookupPortLocal
(uint16_t
port
);
64
65
/**
66
* \brief Lookup for address and port.
67
* \param boundNetDevice Bound NetDevice (if any)
68
* \param addr address to test
69
* \param port port to test
70
* \return true if there is a match in EndPoints, false otherwise
71
*/
72
bool
LookupLocal
(
Ptr<NetDevice>
boundNetDevice,
Ipv4Address
addr, uint16_t
port
);
73
74
/**
75
* \brief lookup for a match with all the parameters.
76
*
77
* The function will return a list of most-matching EndPoints, in this order:
78
* -# Full match
79
* -# All but local address
80
* -# Only local port and local address match
81
* -# Only local port match
82
*
83
* EndPoint with disabled Rx are skipped.
84
*
85
* \param daddr destination address to test
86
* \param dport destination port to test
87
* \param saddr source address to test
88
* \param sport source port to test
89
* \param incomingInterface the incoming interface
90
* \return list of IPv4EndPoints (could be 0 element)
91
*/
92
EndPoints
Lookup
(
Ipv4Address
daddr,
93
uint16_t dport,
94
Ipv4Address
saddr,
95
uint16_t sport,
96
Ptr<Ipv4Interface>
incomingInterface);
97
98
/**
99
* \brief simple lookup for a match with all the parameters.
100
* \param daddr destination address to test
101
* \param dport destination port to test
102
* \param saddr source address to test
103
* \param sport source port to test
104
* \return IPv4EndPoint (0 if not found)
105
*/
106
Ipv4EndPoint
*
SimpleLookup
(
Ipv4Address
daddr,
107
uint16_t dport,
108
Ipv4Address
saddr,
109
uint16_t sport);
110
111
/**
112
* \brief Allocate a Ipv4EndPoint.
113
* \return an empty Ipv4EndPoint instance
114
*/
115
Ipv4EndPoint
*
Allocate
();
116
117
/**
118
* \brief Allocate a Ipv4EndPoint.
119
* \param address IPv4 address
120
* \return an Ipv4EndPoint instance
121
*/
122
Ipv4EndPoint
*
Allocate
(
Ipv4Address
address);
123
124
/**
125
* \brief Allocate a Ipv4EndPoint.
126
* \param boundNetDevice Bound NetDevice (if any)
127
* \param port local port
128
* \return an Ipv4EndPoint instance
129
*/
130
Ipv4EndPoint
*
Allocate
(
Ptr<NetDevice>
boundNetDevice, uint16_t
port
);
131
132
/**
133
* \brief Allocate a Ipv4EndPoint.
134
* \param boundNetDevice Bound NetDevice (if any)
135
* \param address local address
136
* \param port local port
137
* \return an Ipv4EndPoint instance
138
*/
139
Ipv4EndPoint
*
Allocate
(
Ptr<NetDevice>
boundNetDevice,
Ipv4Address
address, uint16_t
port
);
140
141
/**
142
* \brief Allocate a Ipv4EndPoint.
143
* \param boundNetDevice Bound NetDevice (if any)
144
* \param localAddress local address
145
* \param localPort local port
146
* \param peerAddress peer address
147
* \param peerPort peer port
148
* \return an Ipv4EndPoint instance
149
*/
150
Ipv4EndPoint
*
Allocate
(
Ptr<NetDevice>
boundNetDevice,
151
Ipv4Address
localAddress,
152
uint16_t localPort,
153
Ipv4Address
peerAddress,
154
uint16_t peerPort);
155
156
/**
157
* \brief Remove a end point.
158
* \param endPoint the end point to remove
159
*/
160
void
DeAllocate
(
Ipv4EndPoint
* endPoint);
161
162
private
:
163
/**
164
* \brief Allocate an ephemeral port.
165
* \returns the ephemeral port
166
*/
167
uint16_t
AllocateEphemeralPort
();
168
169
/**
170
* \brief The ephemeral port.
171
*/
172
uint16_t
m_ephemeral
;
173
174
/**
175
* \brief The last ephemeral port.
176
*/
177
uint16_t
m_portLast
;
178
179
/**
180
* \brief The first ephemeral port.
181
*/
182
uint16_t
m_portFirst
;
183
184
/**
185
* \brief A list of IPv4 end points.
186
*/
187
EndPoints
m_endPoints
;
188
};
189
190
}
// namespace ns3
191
192
#endif
/* IPV4_END_POINTS_H */
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4EndPointDemux
Demultiplexes packets to various transport layer endpoints.
Definition
ipv4-end-point-demux.h:37
ns3::Ipv4EndPointDemux::m_portFirst
uint16_t m_portFirst
The first ephemeral port.
Definition
ipv4-end-point-demux.h:182
ns3::Ipv4EndPointDemux::EndPointsI
std::list< Ipv4EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv4 endpoints.
Definition
ipv4-end-point-demux.h:47
ns3::Ipv4EndPointDemux::AllocateEphemeralPort
uint16_t AllocateEphemeralPort()
Allocate an ephemeral port.
Definition
ipv4-end-point-demux.cc:399
ns3::Ipv4EndPointDemux::m_endPoints
EndPoints m_endPoints
A list of IPv4 end points.
Definition
ipv4-end-point-demux.h:187
ns3::Ipv4EndPointDemux::m_portLast
uint16_t m_portLast
The last ephemeral port.
Definition
ipv4-end-point-demux.h:177
ns3::Ipv4EndPointDemux::SimpleLookup
Ipv4EndPoint * SimpleLookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport)
simple lookup for a match with all the parameters.
Definition
ipv4-end-point-demux.cc:357
ns3::Ipv4EndPointDemux::~Ipv4EndPointDemux
~Ipv4EndPointDemux()
Definition
ipv4-end-point-demux.cc:29
ns3::Ipv4EndPointDemux::LookupLocal
bool LookupLocal(Ptr< NetDevice > boundNetDevice, Ipv4Address addr, uint16_t port)
Lookup for address and port.
Definition
ipv4-end-point-demux.cc:55
ns3::Ipv4EndPointDemux::GetAllEndPoints
EndPoints GetAllEndPoints()
Get the entire list of end points registered.
Definition
ipv4-end-point-demux.cc:170
ns3::Ipv4EndPointDemux::m_ephemeral
uint16_t m_ephemeral
The ephemeral port.
Definition
ipv4-end-point-demux.h:172
ns3::Ipv4EndPointDemux::Ipv4EndPointDemux
Ipv4EndPointDemux()
Definition
ipv4-end-point-demux.cc:21
ns3::Ipv4EndPointDemux::Lookup
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
lookup for a match with all the parameters.
Definition
ipv4-end-point-demux.cc:189
ns3::Ipv4EndPointDemux::LookupPortLocal
bool LookupPortLocal(uint16_t port)
Lookup for port local.
Definition
ipv4-end-point-demux.cc:41
ns3::Ipv4EndPointDemux::DeAllocate
void DeAllocate(Ipv4EndPoint *endPoint)
Remove a end point.
Definition
ipv4-end-point-demux.cc:152
ns3::Ipv4EndPointDemux::Allocate
Ipv4EndPoint * Allocate()
Allocate a Ipv4EndPoint.
Definition
ipv4-end-point-demux.cc:70
ns3::Ipv4EndPointDemux::EndPoints
std::list< Ipv4EndPoint * > EndPoints
Container of the IPv4 endpoints.
Definition
ipv4-end-point-demux.h:42
ns3::Ipv4EndPoint
A representation of an internet endpoint/connection.
Definition
ipv4-end-point.h:41
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
port
uint16_t port
Definition
dsdv-manet.cc:33
ipv4-interface.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
ipv4-end-point-demux.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0