30 : m_ephemeral (49152),
53 if ((*i)->GetLocalPort () ==
port)
66 if ((*i)->GetLocalPort () ==
port &&
67 (*i)->GetLocalAddress () == addr &&
68 (*i)->GetBoundNetDevice () == boundNetDevice)
131 NS_LOG_FUNCTION (
this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
134 if ((*i)->GetLocalPort () == localPort &&
135 (*i)->GetLocalAddress () == localAddress &&
136 (*i)->GetPeerPort () == peerPort &&
137 (*i)->GetPeerAddress () == peerAddress &&
138 ((*i)->GetBoundNetDevice () == boundNetDevice || (*i)->GetBoundNetDevice () == 0))
145 endPoint->
SetPeer (peerAddress, peerPort);
176 NS_LOG_FUNCTION (
this << daddr << dport << saddr << sport << incomingInterface);
183 NS_LOG_DEBUG (
"Looking up endpoint for destination address " << daddr);
196 <<
" because endpoint can not receive packets");
203 <<
" because endpoint dport "
205 <<
" does not match packet dport " << dport);
211 if (!incomingInterface)
218 <<
" because endpoint is bound to specific device and"
220 <<
" does not match packet device " << incomingInterface->
GetDevice ());
233 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
237 bool remotePeerMatchesExact = endP->
GetPeerPort () == sport;
238 bool remotePeerMatchesWildCard = endP->
GetPeerPort () == 0;
239 bool remoteAddressMatchesExact = endP->
GetPeerAddress () == saddr;
244 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
248 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
254 if (localAddressMatchesWildCard
255 && remotePeerMatchesWildCard
256 && remoteAddressMatchesWildCard)
258 retval1.push_back (endP);
260 if ((localAddressMatchesExact || (localAddressMatchesAllRouters))
261 && remotePeerMatchesWildCard
262 && remoteAddressMatchesWildCard)
264 retval2.push_back (endP);
266 if (localAddressMatchesWildCard
267 && remotePeerMatchesExact
268 && remoteAddressMatchesExact)
270 retval3.push_back (endP);
272 if (localAddressMatchesExact
273 && remotePeerMatchesExact
274 && remoteAddressMatchesExact)
276 retval4.push_back (endP);
282 if (!retval4.empty ()) retval = retval4;
283 else if (!retval3.empty ()) retval = retval3;
284 else if (!retval2.empty ()) retval = retval2;
285 else retval = retval1;
287 NS_ABORT_MSG_IF (retval.size () > 1,
"Too many endpoints - perhaps you created too many sockets without binding them to different NetDevices.");
293 uint32_t genericity = 3;
300 if ((*i)->GetLocalPort () != dport)
305 if ((*i)->GetLocalAddress () == dst && (*i)->GetPeerPort () == sport
306 && (*i)->GetPeerAddress () == src)
322 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.
bool LookupLocal(Ptr< NetDevice > boundNetDevice, Ipv6Address addr, uint16_t port)
Lookup for address and port.
std::list< Ipv6EndPoint * > EndPoints
Container of the IPv6 endpoints.
EndPoints m_endPoints
A list of IPv6 end points.
uint16_t m_ephemeral
The ephemeral port.
Ipv6EndPoint * Allocate(void)
Allocate a Ipv6EndPoint.
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.
A representation of an IPv6 endpoint/connection.
Ipv6Address GetLocalAddress()
Get the local address.
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer information (address and port).
uint16_t GetLocalPort()
Get the local port.
Ptr< NetDevice > GetBoundNetDevice(void)
Returns socket's bound netdevice, if any.
bool IsRxEnabled(void)
Checks if the endpoint can receive packets.
Ipv6Address GetPeerAddress()
Get the peer address.
uint16_t GetPeerPort()
Get the peer port.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
#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.