32 : m_ephemeral (49152), m_portLast (65535), m_portFirst (49152)
54 if ((*i)->GetLocalPort () ==
port)
68 if ((*i)->GetLocalPort () ==
port &&
69 (*i)->GetLocalAddress () == addr &&
70 (*i)->GetBoundNetDevice () == boundNetDevice)
138 NS_LOG_FUNCTION (
this << localAddress << localPort << peerAddress << peerPort << boundNetDevice);
141 if ((*i)->GetLocalPort () == localPort &&
142 (*i)->GetLocalAddress () == localAddress &&
143 (*i)->GetPeerPort () == peerPort &&
144 (*i)->GetPeerAddress () == peerAddress &&
145 ((*i)->GetBoundNetDevice () == boundNetDevice || (*i)->GetBoundNetDevice () == 0))
152 endPoint->
SetPeer (peerAddress, peerPort);
187 ret.push_back (endP);
203 NS_LOG_FUNCTION (
this << daddr << dport << saddr << sport << incomingInterface);
210 NS_LOG_DEBUG (
"Looking up endpoint for destination address " << daddr <<
":" << dport);
223 <<
" because endpoint can not receive packets");
230 <<
" because endpoint dport "
232 <<
" does not match packet dport " << dport);
240 <<
" because endpoint is bound to specific device and"
242 <<
" does not match packet device " << incomingInterface->
GetDevice ());
247 bool localAddressMatchesExact =
false;
248 bool localAddressIsAny =
false;
249 bool localAddressIsSubnetAny =
false;
259 localAddressMatchesExact =
true;
264 localAddressIsAny =
true;
269 for (uint32_t i = 0; i < incomingInterface->
GetNAddresses (); i++)
279 if (addrNetpart == daddrNetPart)
281 localAddressIsSubnetAny =
true;
287 if (!localAddressIsSubnetAny)
291 bool remotePortMatchesExact = endP->
GetPeerPort () == sport;
292 bool remotePortMatchesWildCard = endP->
GetPeerPort () == 0;
293 bool remoteAddressMatchesExact = endP->
GetPeerAddress () == saddr;
298 if (!(remotePortMatchesExact || remotePortMatchesWildCard))
300 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
303 bool localAddressMatchesWildCard = localAddressIsAny || localAddressIsSubnetAny;
305 if (localAddressMatchesExact && remoteAddressMatchesExact && remotePortMatchesExact)
308 retval4.push_back (endP);
310 if (localAddressMatchesWildCard && remoteAddressMatchesExact && remotePortMatchesExact)
313 retval3.push_back (endP);
315 if (localAddressMatchesExact && remoteAddressMatchesWildCard && remotePortMatchesWildCard)
318 retval2.push_back (endP);
320 if (localAddressMatchesWildCard && remoteAddressMatchesWildCard && remotePortMatchesWildCard)
323 retval1.push_back (endP);
329 if (!retval4.empty ()) retval = retval4;
330 else if (!retval3.empty ()) retval = retval3;
331 else if (!retval2.empty ()) retval = retval2;
332 else retval = retval1;
334 NS_ABORT_MSG_IF (retval.size () > 1,
"Too many endpoints - perhaps you created too many sockets without binding them to different NetDevices.");
348 uint32_t genericity = 3;
352 if ((*i)->GetLocalPort () != dport)
356 if ((*i)->GetLocalAddress () == daddr &&
357 (*i)->GetPeerPort () == sport &&
358 (*i)->GetPeerAddress () == saddr)
372 if (tmp < genericity)