15#include "ns3/inet-socket-address.h" 
   16#include "ns3/inet6-socket-address.h" 
   17#include "ns3/ipv4-address.h" 
   19#include "ns3/nstime.h" 
   20#include "ns3/packet.h" 
   21#include "ns3/simulator.h" 
   22#include "ns3/socket-factory.h" 
   23#include "ns3/socket.h" 
   24#include "ns3/uinteger.h" 
   39            .SetGroupName(
"Applications")
 
   41            .AddAttribute(
"PacketWindowSize",
 
   42                          "The size of the window used to compute the packet loss. This value " 
   43                          "should be a multiple of 8.",
 
   49                            "A packet has been received",
 
   51                            "ns3::Packet::TracedCallback")
 
   52            .AddTraceSource(
"RxWithAddresses",
 
   53                            "A packet has been received",
 
   55                            "ns3::Packet::TwoAddressTracedCallback");
 
 
  112        if (local.IsInvalid())
 
 
  174    while (
auto packet = socket->RecvFrom(from))
 
  177        socket->GetSockName(localAddress);
 
  180        if (packet->GetSize() > 0)
 
  182            const auto receivedSize = packet->GetSize();
 
  184            packet->RemoveHeader(seqTs);
 
  185            const auto currentSequenceNumber = seqTs.
GetSeq();
 
  188                NS_LOG_INFO(
"TraceDelay: RX " << receivedSize << 
" bytes from " 
  190                                              << 
" Sequence Number: " << currentSequenceNumber
 
  191                                              << 
" Uid: " << packet->GetUid() << 
" TXtime: " 
  197                NS_LOG_INFO(
"TraceDelay: RX " << receivedSize << 
" bytes from " 
  199                                              << 
" Sequence Number: " << currentSequenceNumber
 
  200                                              << 
" Uid: " << packet->GetUid() << 
" TXtime: " 
 
a polymophic address class
Ptr< Node > GetNode() const
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.
static Ipv4Address GetAny()
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
static bool IsMatchingType(const Address &address)
If the Address matches the type.
void NotifyReceived(uint32_t seq)
Record a successfully received packet.
void SetBitMapSize(uint16_t size)
Set the size of the window used to compute the packet loss.
uint16_t GetBitMapSize() const
Return the size of the window used to compute the packet loss.
uint32_t GetLost() const
Get the number of lost packets.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Base class for sink applications.
Address m_local
Local address to bind to (address and port)
uint32_t m_port
Local port to bind to.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
A UDP server, receives UDP packets from a remote host.
Ptr< Socket > m_socket6
IPv6 Socket (used if only port is specified)
TracedCallback< Ptr< const Packet > > m_rxTrace
Callbacks for tracing the packet Rx events.
uint64_t GetReceived() const
Returns the number of received packets.
void StartApplication() override
Application specific startup code.
Ptr< Socket > m_socket
Socket.
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
static TypeId GetTypeId()
Get the type ID.
PacketLossCounter m_lossCounter
Lost packet counter.
void SetPacketWindowSize(uint16_t size)
Set the size of the window used for checking loss.
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_rxTraceWithAddresses
Callbacks for tracing the packet Rx events, includes source and destination addresses.
uint32_t GetLost() const
Returns the number of lost packets.
uint64_t m_received
Number of received packets.
uint16_t GetPacketWindowSize() const
Returns the size of the window used for checking loss.
void StopApplication() override
Application specific shutdown code.
Hold an unsigned integer type.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Callback< R, Args... > MakeNullCallback()
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...