A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-end-point-demux.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#ifndef IPV6_END_POINT_DEMUX_H
10#define IPV6_END_POINT_DEMUX_H
11
12#include "ipv6-interface.h"
13
14#include "ns3/ipv6-address.h"
15
16#include <list>
17#include <stdint.h>
18
19namespace ns3
20{
21
22class Ipv6EndPoint;
23
24/**
25 * @ingroup ipv6
26 *
27 * @brief Demultiplexer for end points.
28 */
30{
31 public:
32 /**
33 * @brief Container of the IPv6 endpoints.
34 */
35 typedef std::list<Ipv6EndPoint*> EndPoints;
36
37 /**
38 * @brief Iterator to the container of the IPv6 endpoints.
39 */
40 typedef std::list<Ipv6EndPoint*>::iterator EndPointsI;
41
44
45 /**
46 * @brief Lookup for port local.
47 * @param port port to test
48 * @return true if a port local is in EndPoints, false otherwise
49 */
50 bool LookupPortLocal(uint16_t port);
51
52 /**
53 * @brief Lookup for address and port.
54 * @param boundNetDevice Bound NetDevice (if any)
55 * @param addr address to test
56 * @param port port to test
57 * @return true if there is a match in EndPoints, false otherwise
58 */
59 bool LookupLocal(Ptr<NetDevice> boundNetDevice, Ipv6Address addr, uint16_t port);
60
61 /**
62 * @brief lookup for a match with all the parameters.
63 *
64 * The function will return a list of most-matching EndPoints, in this order:
65 * -# Full match
66 * -# All but local address
67 * -# Only local port and local address match
68 * -# Only local port match
69 *
70 * EndPoint with disabled Rx are skipped.
71 *
72 * @param dst destination address to test
73 * @param dport destination port to test
74 * @param src source address to test
75 * @param sport source port to test
76 * @param incomingInterface the incoming interface
77 * @return list of IPv6EndPoints (could be 0 element)
78 */
80 uint16_t dport,
81 Ipv6Address src,
82 uint16_t sport,
83 Ptr<Ipv6Interface> incomingInterface);
84
85 /**
86 * @brief Simple lookup for a four-tuple match.
87 * @param dst destination address to test
88 * @param dport destination port to test
89 * @param src source address to test
90 * @param sport source port to test
91 * @return match or 0 if not found
92 */
93 Ipv6EndPoint* SimpleLookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport);
94
95 /**
96 * @brief Allocate a Ipv6EndPoint.
97 * @return an empty Ipv6EndPoint instance
98 */
100
101 /**
102 * @brief Allocate a Ipv6EndPoint.
103 * @param address IPv6 address
104 * @return an Ipv6EndPoint instance
105 */
107
108 /**
109 * @brief Allocate a Ipv6EndPoint.
110 * @param boundNetDevice Bound NetDevice (if any)
111 * @param port local port
112 * @return an Ipv6EndPoint instance
113 */
114 Ipv6EndPoint* Allocate(Ptr<NetDevice> boundNetDevice, uint16_t port);
115
116 /**
117 * @brief Allocate a Ipv6EndPoint.
118 * @param boundNetDevice Bound NetDevice (if any)
119 * @param address local address
120 * @param port local port
121 * @return an Ipv6EndPoint instance
122 */
123 Ipv6EndPoint* Allocate(Ptr<NetDevice> boundNetDevice, Ipv6Address address, uint16_t port);
124
125 /**
126 * @brief Allocate a Ipv6EndPoint.
127 * @param boundNetDevice Bound NetDevice (if any)
128 * @param localAddress local address
129 * @param localPort local port
130 * @param peerAddress peer address
131 * @param peerPort peer port
132 * @return an Ipv6EndPoint instance
133 */
134 Ipv6EndPoint* Allocate(Ptr<NetDevice> boundNetDevice,
135 Ipv6Address localAddress,
136 uint16_t localPort,
137 Ipv6Address peerAddress,
138 uint16_t peerPort);
139
140 /**
141 * @brief Remove a end point.
142 * @param endPoint the end point to remove
143 */
144 void DeAllocate(Ipv6EndPoint* endPoint);
145
146 /**
147 * @brief Get the entire list of end points registered.
148 * @return list of Ipv6EndPoint
149 */
150 EndPoints GetEndPoints() const;
151
152 private:
153 /**
154 * @brief Allocate a ephemeral port.
155 * @return a port
156 */
157 uint16_t AllocateEphemeralPort();
158
159 /**
160 * @brief The ephemeral port.
161 */
162 uint16_t m_ephemeral;
163
164 /**
165 * @brief The first ephemeral port.
166 */
167 uint16_t m_portFirst;
168
169 /**
170 * @brief The last ephemeral port.
171 */
172 uint16_t m_portLast;
173
174 /**
175 * @brief A list of IPv6 end points.
176 */
178};
179
180} /* namespace ns3 */
181
182#endif /* IPV6_END_POINT_DEMUX_H */
Describes an IPv6 address.
Demultiplexer for end points.
EndPoints Lookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport, Ptr< Ipv6Interface > incomingInterface)
lookup for a match with all the parameters.
Ipv6EndPoint * Allocate()
Allocate a Ipv6EndPoint.
bool LookupLocal(Ptr< NetDevice > boundNetDevice, Ipv6Address addr, uint16_t port)
Lookup for address and port.
EndPoints m_endPoints
A list of IPv6 end points.
uint16_t m_ephemeral
The ephemeral port.
std::list< Ipv6EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv6 endpoints.
EndPoints GetEndPoints() const
Get the entire list of end points registered.
Ipv6EndPoint * SimpleLookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport)
Simple lookup for a four-tuple match.
bool LookupPortLocal(uint16_t port)
Lookup for port local.
uint16_t AllocateEphemeralPort()
Allocate a ephemeral port.
uint16_t m_portFirst
The first ephemeral port.
uint16_t m_portLast
The last ephemeral port.
void DeAllocate(Ipv6EndPoint *endPoint)
Remove a end point.
std::list< Ipv6EndPoint * > EndPoints
Container of the IPv6 endpoints.
A representation of an IPv6 endpoint/connection.
Smart pointer class similar to boost::intrusive_ptr.
uint16_t port
Definition dsdv-manet.cc:33
Every class exported by the ns3 library is enclosed in the ns3 namespace.