30 : m_ephemeral (49152), m_portLast (65535), m_portFirst (49152)
52 if ((*i)->GetLocalPort () ==
port)
66 if ((*i)->GetLocalPort () == port &&
67 (*i)->GetLocalAddress () == addr)
134 NS_LOG_FUNCTION (
this << localAddress << localPort << peerAddress << peerPort);
137 if ((*i)->GetLocalPort () == localPort &&
138 (*i)->GetLocalAddress () == localAddress &&
139 (*i)->GetPeerPort () == peerPort &&
140 (*i)->GetPeerAddress () == peerAddress)
142 NS_LOG_WARN (
"No way we can allocate this end-point.");
148 endPoint->
SetPeer (peerAddress, peerPort);
183 ret.push_back (endP);
199 NS_LOG_FUNCTION (
this << daddr << dport << saddr << sport << incomingInterface);
206 NS_LOG_DEBUG (
"Looking up endpoint for destination address " << daddr);
217 <<
" because endpoint dport "
219 <<
" does not match packet dport " << dport);
227 <<
" because endpoint is bound to specific device and"
229 <<
" does not match packet device " << incomingInterface->
GetDevice ());
233 bool subnetDirected =
false;
235 for (uint32_t i = 0; i < incomingInterface->
GetNAddresses (); i++)
241 subnetDirected =
true;
242 incomingInterfaceAddr = addr.
GetLocal ();
245 bool isBroadcast = (daddr.
IsBroadcast () || subnetDirected ==
true);
246 NS_LOG_DEBUG (
"dest addr " << daddr <<
" broadcast? " << isBroadcast);
247 bool localAddressMatchesWildCard =
259 incomingInterfaceAddr);
262 if (!(localAddressMatchesExact || localAddressMatchesWildCard))
264 bool remotePeerMatchesExact = endP->
GetPeerPort () == sport;
265 bool remotePeerMatchesWildCard = endP->
GetPeerPort () == 0;
266 bool remoteAddressMatchesExact = endP->
GetPeerAddress () == saddr;
271 if (!(remotePeerMatchesExact || remotePeerMatchesWildCard))
273 if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard))
277 if (localAddressMatchesWildCard &&
278 remotePeerMatchesWildCard &&
279 remoteAddressMatchesWildCard)
281 retval1.push_back (endP);
283 if ((localAddressMatchesExact || (isBroadcast && localAddressMatchesWildCard))&&
284 remotePeerMatchesWildCard &&
285 remoteAddressMatchesWildCard)
287 retval2.push_back (endP);
289 if (localAddressMatchesWildCard &&
290 remotePeerMatchesExact &&
291 remoteAddressMatchesExact)
293 retval3.push_back (endP);
295 if (localAddressMatchesExact &&
296 remotePeerMatchesExact &&
297 remoteAddressMatchesExact)
299 retval4.push_back (endP);
304 if (!retval4.empty ())
return retval4;
305 if (!retval3.empty ())
return retval3;
306 if (!retval2.empty ())
return retval2;
320 uint32_t genericity = 3;
324 if ((*i)->GetLocalPort () != dport)
328 if ((*i)->GetLocalAddress () == daddr &&
329 (*i)->GetPeerPort () == sport &&
330 (*i)->GetPeerAddress () == saddr)
344 if (tmp < genericity)
static Ipv4Address GetAny(void)
#define NS_LOG_FUNCTION(parameters)
Ipv4Mask GetMask(void) const
Ipv4Address GetLocal(void) const
EndPoints GetAllEndPoints(void)
bool LookupPortLocal(uint16_t port)
Ipv4Address CombineMask(Ipv4Mask const &mask) const
Combine this address with a network mask.
bool IsSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
Ipv4Address GetLocalAddress(void)
bool IsBroadcast(void) const
#define NS_LOG_LOGIC(msg)
Ipv4InterfaceAddress GetAddress(uint32_t index) const
Ptr< NetDevice > GetBoundNetDevice(void)
Ipv4EndPoint * SimpleLookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport)
bool LookupLocal(Ipv4Address addr, uint16_t port)
void SetPeer(Ipv4Address address, uint16_t port)
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
Ipv4 addresses are stored in host order in this class.
std::list< Ipv4EndPoint * > EndPoints
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
a class to store IPv4 address information on an interface
uint16_t GetLocalPort(void)
Ptr< NetDevice > GetDevice(void) const
#define NS_LOG_DEBUG(msg)
Ipv4Address GetPeerAddress(void)
uint16_t GetPeerPort(void)
std::list< Ipv4EndPoint * >::iterator EndPointsI
void DeAllocate(Ipv4EndPoint *endPoint)
uint32_t GetNAddresses(void) const
uint16_t AllocateEphemeralPort(void)
A representation of an internet endpoint/connection.
Ipv4EndPoint * Allocate(void)