30 : m_ephemeral (49152),
53 if ((*i)->GetLocalPort () ==
port)
66 if ((*i)->GetLocalPort () == port
67 && (*i)->GetLocalAddress () == addr)
129 NS_LOG_FUNCTION (
this << localAddress << localPort << peerAddress << peerPort);
132 if ((*i)->GetLocalPort () == localPort
133 && (*i)->GetLocalAddress () == localAddress
134 && (*i)->GetPeerPort () == peerPort
135 && (*i)->GetPeerAddress () == peerAddress)
137 NS_LOG_WARN (
"No way we can allocate this end-point.");
143 endPoint->
SetPeer (peerAddress, peerPort);
174 NS_LOG_FUNCTION (
this << daddr << dport << saddr << sport << incomingInterface);
181 NS_LOG_DEBUG (
"Looking up endpoint for destination address " << daddr);
192 <<
" because endpoint dport "
194 <<
" does not match packet dport " << dport);
200 if (!incomingInterface)
207 <<
" because endpoint is bound to specific device and"
209 <<
" does not match packet device " << incomingInterface->
GetDevice ());
222 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
226 bool remotePeerMatchesExact = endP->
GetPeerPort () == sport;
227 bool remotePeerMatchesWildCard = endP->
GetPeerPort () == 0;
228 bool remoteAddressMatchesExact = endP->
GetPeerAddress () == saddr;
233 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
237 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
243 if (localAddressMatchesWildCard
244 && remotePeerMatchesWildCard
245 && remoteAddressMatchesWildCard)
247 retval1.push_back (endP);
249 if ((localAddressMatchesExact || (localAddressMatchesAllRouters))
250 && remotePeerMatchesWildCard
251 && remoteAddressMatchesWildCard)
253 retval2.push_back (endP);
255 if (localAddressMatchesWildCard
256 && remotePeerMatchesExact
257 && remoteAddressMatchesExact)
259 retval3.push_back (endP);
261 if (localAddressMatchesExact
262 && remotePeerMatchesExact
263 && remoteAddressMatchesExact)
265 retval4.push_back (endP);
270 if (!retval4.empty ())
274 if (!retval3.empty ())
278 if (!retval2.empty ())
287 uint32_t genericity = 3;
294 if ((*i)->GetLocalPort () != dport)
299 if ((*i)->GetLocalAddress () == dst && (*i)->GetPeerPort () == sport
300 && (*i)->GetPeerAddress () == src)
316 if (tmp < genericity)
Ipv6Address GetLocalAddress()
Get the local address.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::list< Ipv6EndPoint * > EndPoints
Container of the IPv6 endpoints.
EndPoints Lookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport, Ptr< Ipv6Interface > incomingInterface)
lookup for a match with all the parameters.
uint16_t m_ephemeral
The ephemeral port.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
std::list< Ipv6EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv6 endpoints.
EndPoints m_endPoints
A list of IPv6 end points.
bool LookupLocal(Ipv6Address addr, uint16_t port)
Lookup for address and port.
uint16_t GetPeerPort()
Get the peer port.
uint16_t GetLocalPort()
Get the local port.
Ipv6EndPoint * Allocate(void)
Allocate a Ipv6EndPoint.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
uint16_t m_portLast
The last ephemeral port.
void DeAllocate(Ipv6EndPoint *endPoint)
Remove a end point.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool LookupPortLocal(uint16_t port)
Lookup for port local.
Ipv6EndPoint * SimpleLookup(Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport)
Simple lookup for a four-tuple match.
uint16_t m_portFirst
The first ephemeral port.
Describes an IPv6 address.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Ipv6Address GetPeerAddress()
Get the peer address.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
A representation of an internet IPv6 endpoint/connection.
uint16_t AllocateEphemeralPort()
Allocate a ephemeral port.
Ptr< NetDevice > GetBoundNetDevice(void)
Returns socket's bound netdevice, if any.
EndPoints GetEndPoints() const
Get the entire list of end points registered.
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer informations (address and port).
static Ipv6Address GetAllRoutersMulticast()
Get the "all routers multicast" address.