56 if ((*i)->GetLocalPort() ==
port)
70 if ((*i)->GetLocalPort() ==
port && (*i)->GetLocalAddress() == addr &&
71 (*i)->GetBoundNetDevice() == boundNetDevice)
141 NS_LOG_FUNCTION(
this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
144 if ((*i)->GetLocalPort() == localPort && (*i)->GetLocalAddress() == localAddress &&
145 (*i)->GetPeerPort() == peerPort && (*i)->GetPeerAddress() == peerAddress &&
146 ((*i)->GetBoundNetDevice() == boundNetDevice || !(*i)->GetBoundNetDevice()))
153 endPoint->
SetPeer(peerAddress, peerPort);
188 NS_LOG_FUNCTION(
this << daddr << dport << saddr << sport << incomingInterface);
195 NS_LOG_DEBUG(
"Looking up endpoint for destination address " << daddr);
207 <<
" because endpoint can not receive packets");
213 NS_LOG_LOGIC(
"Skipping endpoint " << &endP <<
" because endpoint dport "
215 <<
" does not match packet dport " << dport);
221 if (!incomingInterface)
228 << &endP <<
" because endpoint is bound to specific device and"
230 << incomingInterface->GetDevice());
240 bool localAddressMatchesAllRouters =
244 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
248 bool remotePeerMatchesExact = endP->
GetPeerPort() == sport;
249 bool remotePeerMatchesWildCard = endP->
GetPeerPort() == 0;
255 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
259 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
265 if (localAddressMatchesWildCard && remotePeerMatchesWildCard &&
266 remoteAddressMatchesWildCard)
268 retval1.push_back(endP);
270 if ((localAddressMatchesExact || (localAddressMatchesAllRouters)) &&
271 remotePeerMatchesWildCard && remoteAddressMatchesWildCard)
273 retval2.push_back(endP);
275 if (localAddressMatchesWildCard && remotePeerMatchesExact && remoteAddressMatchesExact)
277 retval3.push_back(endP);
279 if (localAddressMatchesExact && remotePeerMatchesExact && remoteAddressMatchesExact)
281 retval4.push_back(endP);
287 if (!retval4.empty())
291 else if (!retval3.empty())
295 else if (!retval2.empty())
305 "Too many endpoints - perhaps you created too many sockets without binding "
306 "them to different NetDevices.");
320 if ((*i)->GetLocalPort() != dport)
325 if ((*i)->GetLocalAddress() == dst && (*i)->GetPeerPort() == sport &&
326 (*i)->GetPeerAddress() == src)
342 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.
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.
uint16_t GetLocalPort() const
Get the local port.
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer information (address and 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.