45 if ((*i)->GetLocalPort() ==
port)
59 if ((*i)->GetLocalPort() ==
port && (*i)->GetLocalAddress() == addr &&
60 (*i)->GetBoundNetDevice() == boundNetDevice)
130 NS_LOG_FUNCTION(
this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
133 if ((*i)->GetLocalPort() == localPort && (*i)->GetLocalAddress() == localAddress &&
134 (*i)->GetPeerPort() == peerPort && (*i)->GetPeerAddress() == peerAddress &&
135 ((*i)->GetBoundNetDevice() == boundNetDevice || !(*i)->GetBoundNetDevice()))
141 auto endPoint =
new Ipv6EndPoint(localAddress, localPort);
142 endPoint->SetPeer(peerAddress, peerPort);
177 NS_LOG_FUNCTION(
this << daddr << dport << saddr << sport << incomingInterface);
184 NS_LOG_DEBUG(
"Looking up endpoint for destination address " << daddr);
196 <<
" because endpoint can not receive packets");
202 NS_LOG_LOGIC(
"Skipping endpoint " << &endP <<
" because endpoint dport "
204 <<
" does not match packet dport " << dport);
210 if (!incomingInterface)
217 << &endP <<
" because endpoint is bound to specific device and"
219 << incomingInterface->GetDevice());
229 bool localAddressMatchesAllRouters =
233 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
237 bool remotePeerMatchesExact = endP->
GetPeerPort() == sport;
238 bool remotePeerMatchesWildCard = endP->
GetPeerPort() == 0;
244 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
248 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
254 if (localAddressMatchesWildCard && remotePeerMatchesWildCard &&
255 remoteAddressMatchesWildCard)
257 retval1.push_back(endP);
259 if ((localAddressMatchesExact || (localAddressMatchesAllRouters)) &&
260 remotePeerMatchesWildCard && remoteAddressMatchesWildCard)
262 retval2.push_back(endP);
264 if (localAddressMatchesWildCard && remotePeerMatchesExact && remoteAddressMatchesExact)
266 retval3.push_back(endP);
268 if (localAddressMatchesExact && remotePeerMatchesExact && remoteAddressMatchesExact)
270 retval4.push_back(endP);
276 if (!retval4.empty())
280 else if (!retval3.empty())
284 else if (!retval2.empty())
294 "Too many endpoints - perhaps you created too many sockets without binding "
295 "them to different NetDevices.");
309 if ((*i)->GetLocalPort() != dport)
314 if ((*i)->GetLocalAddress() == dst && (*i)->GetPeerPort() == sport &&
315 (*i)->GetPeerAddress() == src)
331 if (tmp < genericity)
Describes an IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
static Ipv6Address GetAllRoutersMulticast()
Get the "all routers multicast" address.
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.
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.
uint16_t GetLocalPort() const
Get the local port.
Ipv6Address GetPeerAddress() const
Get the peer address.
Ipv6Address GetLocalAddress() const
Get the local address.
bool IsRxEnabled() const
Checks if the endpoint can receive packets.
Ptr< NetDevice > GetBoundNetDevice() const
Returns socket's bound netdevice, if any.
uint16_t GetPeerPort() const
Get the peer port.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Every class exported by the ns3 library is enclosed in the ns3 namespace.