Demultiplexes packets to various transport layer endpoints. More...
#include "ipv4-end-point-demux.h"
Public Types | |
typedef std::list< Ipv4EndPoint * > | EndPoints |
Container of the IPv4 endpoints. | |
typedef std::list< Ipv4EndPoint * >::iterator | EndPointsI |
Iterator to the container of the IPv4 endpoints. | |
Public Member Functions | |
Ipv4EndPointDemux () | |
~Ipv4EndPointDemux () | |
Ipv4EndPoint * | Allocate () |
Allocate a Ipv4EndPoint. | |
Ipv4EndPoint * | Allocate (Ipv4Address address) |
Allocate a Ipv4EndPoint. | |
Ipv4EndPoint * | Allocate (Ptr< NetDevice > boundNetDevice, Ipv4Address address, uint16_t port) |
Allocate a Ipv4EndPoint. | |
Ipv4EndPoint * | Allocate (Ptr< NetDevice > boundNetDevice, Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) |
Allocate a Ipv4EndPoint. | |
Ipv4EndPoint * | Allocate (Ptr< NetDevice > boundNetDevice, uint16_t port) |
Allocate a Ipv4EndPoint. | |
void | DeAllocate (Ipv4EndPoint *endPoint) |
Remove a end point. | |
EndPoints | GetAllEndPoints () |
Get the entire list of end points registered. | |
EndPoints | Lookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface) |
lookup for a match with all the parameters. | |
bool | LookupLocal (Ptr< NetDevice > boundNetDevice, Ipv4Address addr, uint16_t port) |
Lookup for address and port. | |
bool | LookupPortLocal (uint16_t port) |
Lookup for port local. | |
Ipv4EndPoint * | SimpleLookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport) |
simple lookup for a match with all the parameters. | |
Private Member Functions | |
uint16_t | AllocateEphemeralPort () |
Allocate an ephemeral port. | |
Private Attributes | |
EndPoints | m_endPoints |
A list of IPv4 end points. | |
uint16_t | m_ephemeral |
The ephemeral port. | |
uint16_t | m_portFirst |
The first ephemeral port. | |
uint16_t | m_portLast |
The last ephemeral port. | |
Demultiplexes packets to various transport layer endpoints.
This class serves as a lookup table to match partial or full information about a four-tuple to an ns3::Ipv4EndPoint. It internally contains a list of endpoints, and has APIs to add and find endpoints in this demux. This code is shared in common to TCP and UDP protocols in ns3. This demux sits between ns3's layer four and the socket layer
Definition at line 36 of file ipv4-end-point-demux.h.
typedef std::list<Ipv4EndPoint*> ns3::Ipv4EndPointDemux::EndPoints |
Container of the IPv4 endpoints.
Definition at line 42 of file ipv4-end-point-demux.h.
typedef std::list<Ipv4EndPoint*>::iterator ns3::Ipv4EndPointDemux::EndPointsI |
Iterator to the container of the IPv4 endpoints.
Definition at line 47 of file ipv4-end-point-demux.h.
ns3::Ipv4EndPointDemux::Ipv4EndPointDemux | ( | ) |
Definition at line 21 of file ipv4-end-point-demux.cc.
References NS_LOG_FUNCTION.
ns3::Ipv4EndPointDemux::~Ipv4EndPointDemux | ( | ) |
Definition at line 29 of file ipv4-end-point-demux.cc.
References m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPoint * ns3::Ipv4EndPointDemux::Allocate | ( | ) |
Allocate a Ipv4EndPoint.
Definition at line 70 of file ipv4-end-point-demux.cc.
References AllocateEphemeralPort(), ns3::Ipv4Address::GetAny(), m_endPoints, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and port.
Referenced by Allocate(), ns3::TcpL4Protocol::Allocate(), ns3::TcpL4Protocol::Allocate(), ns3::TcpL4Protocol::Allocate(), ns3::TcpL4Protocol::Allocate(), ns3::TcpL4Protocol::Allocate(), ns3::UdpL4Protocol::Allocate(), ns3::UdpL4Protocol::Allocate(), ns3::UdpL4Protocol::Allocate(), ns3::UdpL4Protocol::Allocate(), and ns3::UdpL4Protocol::Allocate().
Ipv4EndPoint * ns3::Ipv4EndPointDemux::Allocate | ( | Ipv4Address | address | ) |
Allocate a Ipv4EndPoint.
address | IPv4 address |
Definition at line 86 of file ipv4-end-point-demux.cc.
References AllocateEphemeralPort(), m_endPoints, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and port.
Ipv4EndPoint * ns3::Ipv4EndPointDemux::Allocate | ( | Ptr< NetDevice > | boundNetDevice, |
Ipv4Address | address, | ||
uint16_t | port ) |
Allocate a Ipv4EndPoint.
boundNetDevice | Bound NetDevice (if any) |
address | local address |
port | local port |
Definition at line 110 of file ipv4-end-point-demux.cc.
References LookupLocal(), m_endPoints, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and port.
Ipv4EndPoint * ns3::Ipv4EndPointDemux::Allocate | ( | Ptr< NetDevice > | boundNetDevice, |
Ipv4Address | localAddress, | ||
uint16_t | localPort, | ||
Ipv4Address | peerAddress, | ||
uint16_t | peerPort ) |
Allocate a Ipv4EndPoint.
boundNetDevice | Bound NetDevice (if any) |
localAddress | local address |
localPort | local port |
peerAddress | peer address |
peerPort | peer port |
Definition at line 125 of file ipv4-end-point-demux.cc.
References m_endPoints, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_WARN.
Ipv4EndPoint * ns3::Ipv4EndPointDemux::Allocate | ( | Ptr< NetDevice > | boundNetDevice, |
uint16_t | port ) |
Allocate a Ipv4EndPoint.
boundNetDevice | Bound NetDevice (if any) |
port | local port |
Definition at line 102 of file ipv4-end-point-demux.cc.
References Allocate(), ns3::Ipv4Address::GetAny(), NS_LOG_FUNCTION, and port.
|
private |
Allocate an ephemeral port.
Definition at line 399 of file ipv4-end-point-demux.cc.
References LookupPortLocal(), m_ephemeral, m_portFirst, m_portLast, NS_LOG_FUNCTION, and port.
Referenced by Allocate(), and Allocate().
void ns3::Ipv4EndPointDemux::DeAllocate | ( | Ipv4EndPoint * | endPoint | ) |
Remove a end point.
endPoint | the end point to remove |
Definition at line 152 of file ipv4-end-point-demux.cc.
References m_endPoints, and NS_LOG_FUNCTION.
Referenced by ns3::TcpL4Protocol::DeAllocate(), and ns3::UdpL4Protocol::DeAllocate().
Ipv4EndPointDemux::EndPoints ns3::Ipv4EndPointDemux::GetAllEndPoints | ( | ) |
Get the entire list of end points registered.
Definition at line 170 of file ipv4-end-point-demux.cc.
References m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPointDemux::EndPoints ns3::Ipv4EndPointDemux::Lookup | ( | Ipv4Address | daddr, |
uint16_t | dport, | ||
Ipv4Address | saddr, | ||
uint16_t | sport, | ||
Ptr< Ipv4Interface > | incomingInterface ) |
lookup for a match with all the parameters.
The function will return a list of most-matching EndPoints, in this order:
EndPoint with disabled Rx are skipped.
daddr | destination address to test |
dport | destination port to test |
saddr | source address to test |
sport | source port to test |
incomingInterface | the incoming interface |
Definition at line 189 of file ipv4-end-point-demux.cc.
References ns3::Ipv4Address::CombineMask(), ns3::Ipv4Address::GetAny(), ns3::Ipv4EndPoint::GetBoundNetDevice(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv4Mask::GetPrefixLength(), ns3::Ipv4EndPoint::IsRxEnabled(), m_endPoints, NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::TcpL4Protocol::Receive(), and ns3::UdpL4Protocol::Receive().
bool ns3::Ipv4EndPointDemux::LookupLocal | ( | Ptr< NetDevice > | boundNetDevice, |
Ipv4Address | addr, | ||
uint16_t | port ) |
Lookup for address and port.
boundNetDevice | Bound NetDevice (if any) |
addr | address to test |
port | port to test |
Definition at line 55 of file ipv4-end-point-demux.cc.
References m_endPoints, NS_LOG_FUNCTION, and port.
Referenced by Allocate().
bool ns3::Ipv4EndPointDemux::LookupPortLocal | ( | uint16_t | port | ) |
Lookup for port local.
port | port to test |
Definition at line 41 of file ipv4-end-point-demux.cc.
References m_endPoints, NS_LOG_FUNCTION, and port.
Referenced by AllocateEphemeralPort().
Ipv4EndPoint * ns3::Ipv4EndPointDemux::SimpleLookup | ( | Ipv4Address | daddr, |
uint16_t | dport, | ||
Ipv4Address | saddr, | ||
uint16_t | sport ) |
simple lookup for a match with all the parameters.
daddr | destination address to test |
dport | destination port to test |
saddr | source address to test |
sport | source port to test |
Definition at line 357 of file ipv4-end-point-demux.cc.
References ns3::Ipv4Address::GetAny(), m_endPoints, and NS_LOG_FUNCTION.
Referenced by ns3::TcpL4Protocol::ReceiveIcmp(), and ns3::UdpL4Protocol::ReceiveIcmp().
|
private |
A list of IPv4 end points.
Definition at line 187 of file ipv4-end-point-demux.h.
Referenced by ~Ipv4EndPointDemux(), Allocate(), Allocate(), Allocate(), Allocate(), DeAllocate(), GetAllEndPoints(), Lookup(), LookupLocal(), LookupPortLocal(), and SimpleLookup().
|
private |
The ephemeral port.
Definition at line 172 of file ipv4-end-point-demux.h.
Referenced by AllocateEphemeralPort().
|
private |
The first ephemeral port.
Definition at line 182 of file ipv4-end-point-demux.h.
Referenced by AllocateEphemeralPort().
|
private |
The last ephemeral port.
Definition at line 177 of file ipv4-end-point-demux.h.
Referenced by AllocateEphemeralPort().