23 #include "ns3/ipv4-address.h" 
   24 #include "ns3/nstime.h" 
   25 #include "ns3/inet-socket-address.h" 
   26 #include "ns3/inet6-socket-address.h" 
   27 #include "ns3/socket.h" 
   28 #include "ns3/simulator.h" 
   29 #include "ns3/socket-factory.h" 
   30 #include "ns3/packet.h" 
   31 #include "ns3/uinteger.h" 
   49     .SetGroupName(
"Applications")
 
   51     .AddAttribute (
"Port",
 
   52                    "Port on which we listen for incoming packets.",
 
   55                    MakeUintegerChecker<uint16_t> ())
 
   56     .AddAttribute (
"PacketWindowSize",
 
   57                    "The size of the window used to compute the packet loss. This value should be a multiple of 8.",
 
   61                    MakeUintegerChecker<uint16_t> (8,256))
 
  165   while ((packet = socket->
RecvFrom (from)))
 
  171           uint32_t currentSequenceNumber = seqTs.
GetSeq ();
 
  176                            " Sequence Number: " << currentSequenceNumber <<
 
  177                            " Uid: " << packet->
GetUid () <<
 
  178                            " TXtime: " << seqTs.
GetTs () <<
 
  186                            " Sequence Number: " << currentSequenceNumber <<
 
  187                            " Uid: " << packet->
GetUid () <<
 
  188                            " TXtime: " << seqTs.
GetTs () <<
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
Ipv6Address GetIpv6(void) const 
Get the IPv6 address. 
 
Ipv4Address GetIpv4(void) const 
 
static Ipv4Address GetAny(void)
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
void NotifyReceived(uint32_t seq)
Record a successfully received packet. 
 
uint16_t GetPacketWindowSize() const 
Returns the size of the window used for checking loss. 
 
uint32_t GetLost(void) const 
Returns the number of lost packets. 
 
uint64_t GetUid(void) const 
Returns the packet's Uid. 
 
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address. 
 
void SetPacketWindowSize(uint16_t size)
Set the size of the window used for checking loss. 
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
void HandleRead(Ptr< Socket > socket)
Handle a packet reception. 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
Callback< R > MakeNullCallback(void)
 
uint16_t m_port
Port on which we listen for incoming packets. 
 
a polymophic address class 
 
virtual void StartApplication(void)
Application specific startup code. 
 
The base class for all ns3 applications. 
 
Hold an unsigned integer type. 
 
uint32_t GetLost(void) const 
Get the number of lost packets. 
 
Ptr< Node > GetNode() const 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
void SetRecvCallback(Callback< void, Ptr< Socket > >)
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 void StopApplication(void)
Application specific shutdown code. 
 
uint64_t m_received
Number of received packets. 
 
virtual void DoDispose(void)
Destructor implementation. 
 
void SetBitMapSize(uint16_t size)
Set the size of the window used to compute the packet loss. 
 
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
static TypeId GetTypeId(void)
Get the type ID. 
 
Ptr< Socket > m_socket6
IPv6 Socket. 
 
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress. 
 
static bool IsMatchingType(const Address &addr)
If the address match. 
 
Ptr< Socket > m_socket
IPv4 Socket. 
 
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address. 
 
A UDP server, receives UDP packets from a remote host. 
 
virtual void DoDispose(void)
Destructor implementation. 
 
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
a unique identifier for an interface. 
 
uint64_t GetReceived(void) const 
Returns the number of received packets. 
 
uint16_t GetBitMapSize(void) const 
Return the size of the window used to compute the packet loss. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
PacketLossCounter m_lossCounter
Lost packet counter. 
 
static bool IsMatchingType(const Address &address)
 
static TypeId LookupByName(std::string name)
Get a TypeId by name.