24#include "ns3/application.h"
25#include "ns3/event-id.h"
27#include "ns3/traced-callback.h"
28#include "ns3/address.h"
29#include "ns3/inet-socket-address.h"
30#include "ns3/inet6-socket-address.h"
31#include "ns3/seq-ts-size-header.h"
32#include <unordered_map>
178 NS_ABORT_MSG (
"PacketSink: unexpected address type, neither IPv4 nor IPv6");
a polymophic address class
The base class for all ns3 applications.
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
static bool IsMatchingType(const Address &addr)
If the address match.
Ipv6Address GetIpv6(void) const
Get the IPv6 address.
Ipv4Address GetIpv4(void) const
static bool IsMatchingType(const Address &address)
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.
Receive and consume traffic generated to an IP address and port.
virtual void DoDispose(void)
Destructor implementation.
std::unordered_map< Address, Ptr< Packet >, AddressHash > m_buffer
Buffer for received packets.
Ptr< Socket > GetListeningSocket(void) const
TypeId m_tid
Protocol TypeId.
static TypeId GetTypeId(void)
Get the type ID.
uint16_t m_localPort
Local port to bind to.
Address m_local
Local address to bind to (address and port)
std::list< Ptr< Socket > > GetAcceptedSockets(void) const
virtual void StartApplication(void)
Application specific startup code.
std::list< Ptr< Socket > > m_socketList
the accepted sockets
virtual void StopApplication(void)
Application specific shutdown code.
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 & > m_rxTrace
Traced Callback: received packets, source address.
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_rxTraceWithAddresses
Callback for tracing the packet Rx events, includes source and 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.
bool m_enableSeqTsSizeHeader
Enable or disable the export of SeqTsSize header.
TracedCallback< Ptr< const Packet >, const Address &, const Address &, const SeqTsSizeHeader & > m_rxTraceWithSeqTsSize
Callbacks for tracing the packet Rx events, includes source, destination addresses,...
void HandlePeerClose(Ptr< Socket > socket)
Handle an connection close.
Ptr< Socket > m_socket
Listening socket.
void PacketReceived(const Ptr< Packet > &p, const Address &from, const Address &localAddress)
Packet received: assemble byte stream to extract SeqTsSizeHeader.
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 ()