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);
194 <<
" because endpoint can not receive packets");
201 <<
" because endpoint dport "
203 <<
" does not match packet dport " << dport);
209 if (!incomingInterface)
216 <<
" because endpoint is bound to specific device and"
218 <<
" does not match packet device " << incomingInterface->
GetDevice ());
231 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
235 bool remotePeerMatchesExact = endP->
GetPeerPort () == sport;
236 bool remotePeerMatchesWildCard = endP->
GetPeerPort () == 0;
237 bool remoteAddressMatchesExact = endP->
GetPeerAddress () == saddr;
242 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
246 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
252 if (localAddressMatchesWildCard
253 && remotePeerMatchesWildCard
254 && remoteAddressMatchesWildCard)
256 retval1.push_back (endP);
258 if ((localAddressMatchesExact || (localAddressMatchesAllRouters))
259 && remotePeerMatchesWildCard
260 && remoteAddressMatchesWildCard)
262 retval2.push_back (endP);
264 if (localAddressMatchesWildCard
265 && remotePeerMatchesExact
266 && remoteAddressMatchesExact)
268 retval3.push_back (endP);
270 if (localAddressMatchesExact
271 && remotePeerMatchesExact
272 && remoteAddressMatchesExact)
274 retval4.push_back (endP);
279 if (!retval4.empty ())
283 if (!retval3.empty ())
287 if (!retval2.empty ())
296 uint32_t genericity = 3;
303 if ((*i)->GetLocalPort () != dport)
308 if ((*i)->GetLocalAddress () == dst && (*i)->GetPeerPort () == sport
309 && (*i)->GetPeerAddress () == src)
325 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.
bool IsRxEnabled(void)
Checks if the endpoint can receive packets.
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.