15#include "ns3/event-id.h"
16#include "ns3/inet-socket-address.h"
17#include "ns3/inet6-socket-address.h"
19#include "ns3/traced-callback.h"
21#include <unordered_map>
170 NS_ABORT_MSG(
"PacketSink: unexpected address type, neither IPv4 nor IPv6");
a polymophic address class
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
static bool IsMatchingType(const Address &addr)
If the address match.
Ipv6Address GetIpv6() const
Get the IPv6 address.
static bool IsMatchingType(const Address &address)
Ipv4Address GetIpv4() const
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Class providing an hash for IPv4 addresses.
Hash function class for IPv6 addresses.
static TypeId GetTypeId()
Get the type ID.
std::unordered_map< Address, Ptr< Packet >, AddressHash > m_buffer
Buffer for received packets.
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_rxTraceWithAddresses
Callback for tracing the packet Rx events, includes source and destination addresses.
void StopApplication() override
Application specific shutdown code.
TypeId m_tid
Protocol TypeId.
Ptr< Socket > GetListeningSocket() const
std::list< Ptr< Socket > > m_socketList
the accepted sockets
Ptr< Socket > m_socket6
IPv6 Socket (used if only port is specified)
void HandleRead(Ptr< Socket > socket)
Handle a packet received by the application.
uint64_t GetTotalRx() const
void HandleAccept(Ptr< Socket > socket, const Address &from)
Handle an incoming connection.
void HandlePeerError(Ptr< Socket > socket)
Handle an connection error.
TracedCallback< Ptr< const Packet >, const Address &, const Address &, const SeqTsSizeHeader & > m_rxTraceWithSeqTsSize
Callbacks for tracing the packet Rx events, includes source, destination addresses,...
void(* SeqTsSizeCallback)(Ptr< const Packet > p, const Address &from, const Address &to, const SeqTsSizeHeader &header)
TracedCallback signature for a reception with addresses and SeqTsSizeHeader.
uint64_t m_totalRx
Total bytes received.
void StartApplication() override
Application specific startup code.
void DoDispose() override
Destructor implementation.
bool m_enableSeqTsSizeHeader
Enable or disable the export of SeqTsSize header.
std::list< Ptr< Socket > > GetAcceptedSockets() const
void HandlePeerClose(Ptr< Socket > socket)
Handle an connection close.
Ptr< Socket > m_socket
Socket.
void PacketReceived(const Ptr< Packet > &p, const Address &from, const Address &localAddress)
Packet received: assemble byte stream to extract SeqTsSizeHeader.
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced Callback: received packets, source address.
Smart pointer class similar to boost::intrusive_ptr.
SinkApplication(uint16_t defaultPort=0)
Constructor.
A low-level Socket API based loosely on the BSD Socket API.
Forward calls to a chain of Callback.
a unique identifier for an interface.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hashing for the Address class.
size_t operator()(const Address &x) const
operator ()