23 #include "ns3/nstime.h" 
   24 #include "ns3/simulator.h" 
   25 #include "ns3/socket-factory.h" 
   26 #include "ns3/packet.h" 
   27 #include "ns3/socket.h" 
   28 #include "ns3/uinteger.h" 
   30 #include "ns3/ipv6-address.h" 
   31 #include "ns3/inet6-socket-address.h" 
   32 #include "ns3/icmpv6-header.h" 
   33 #include "ns3/ipv6-raw-socket-factory.h" 
   34 #include "ns3/ipv6-header.h" 
   35 #include "ns3/ipv6-extension-header.h" 
   49     .SetGroupName(
"Internet-Apps")
 
   50     .AddConstructor<
Ping6>()
 
   51     .AddAttribute (
"MaxPackets", 
 
   52                    "The maximum number of packets the application will send",
 
   55                    MakeUintegerChecker<uint32_t>())
 
   56     .AddAttribute (
"Interval", 
 
   57                    "The time to wait between packets",
 
   61     .AddAttribute (
"RemoteIpv6", 
 
   62                    "The Ipv6Address of the outbound packets",
 
   66     .AddAttribute (
"LocalIpv6", 
 
   67                    "Local Ipv6Address of the sender",
 
   71     .AddAttribute (
"PacketSize", 
 
   72                    "Size of packets generated",
 
   75                    MakeUintegerChecker<uint32_t>())
 
  193       NS_LOG_WARN (
"ICMPv6 echo request payload size must be >= 4");
 
  197   uint8_t* 
data = 
new uint8_t[size];
 
  198   memset(data, 0, size);
 
  249   while ((packet = socket->
RecvFrom (from)))
 
  262           packet->
CopyData (&type, 
sizeof(type));
 
  270                            " bytes from " << address.
GetIpv6 () <<
 
  271                            " id =  " << (uint16_t)reply.
GetId () <<
 
  272                            " seq = " << (uint16_t)reply.
GetSeq () <<
 
  273                            " Hop Count = " << (uint16_t) (64 - hdr.
GetHopLimit ()));
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
virtual ~Ping6()
Destructor. 
 
uint16_t GetId() const 
Get the ID of the packet. 
 
Ipv6Address GetIpv6(void) const 
Get the IPv6 address. 
 
Simulation virtual time values and global simulation resolution. 
 
Ptr< const AttributeChecker > MakeIpv6AddressChecker(void)
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
virtual void StopApplication()
Stop the application. 
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
Access to the IPv6 forwarding table, interfaces, and configuration. 
 
ICMPv6 Error Time Exceeded header. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
IPv6 address associated with an interface. 
 
void SetRouters(std::vector< Ipv6Address > routers)
Set routers for routing type 0 (loose routing). 
 
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. 
 
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
 
Callback< R > MakeNullCallback(void)
 
Time m_interval
Intervall between packets sent. 
 
void Send()
Send a packet. 
 
a polymophic address class 
 
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. 
 
void SetIfIndex(uint32_t ifIndex)
Set the out interface index. 
 
ICMPv6 Error Destination Unreachable header. 
 
Ipv6Address GetAddress() const 
Get the IPv6 address. 
 
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay. 
 
The base class for all ns3 applications. 
 
AttributeValue implementation for Time. 
 
Hold an unsigned integer type. 
 
Ptr< Node > GetNode() const 
 
uint32_t m_sent
Number of packets sent. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
virtual void StartApplication()
Start the application. 
 
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...
 
std::vector< Ipv6Address > m_routers
Routers addresses for routing type 0. 
 
void SetLocal(Ipv6Address ipv6)
Set the local address. 
 
uint16_t GetSeq() const 
Get the sequence number. 
 
uint32_t m_size
Size of the packet. 
 
bool IsInSameSubnet(Ipv6Address b) const 
Checks if the address is in the same subnet. 
 
virtual void DoDispose(void)
Destructor implementation. 
 
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. 
 
Ptr< Socket > m_socket
Local socket. 
 
AttributeValue implementation for Ipv6Address. 
 
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
Describes an IPv6 address. 
 
void SetRemote(Ipv6Address ipv6)
Set the remote peer. 
 
An identifier for simulation events. 
 
uint16_t m_seq
Sequence number. 
 
Ptr< const AttributeAccessor > MakeIpv6AddressAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
 
uint32_t m_ifIndex
Out interface (i.e. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress. 
 
Ipv6Address m_localAddress
Local address. 
 
static bool IsMatchingType(const Address &addr)
If the address match. 
 
void ScheduleTransmit(Time dt)
Schedule sending a packet. 
 
uint32_t CopyData(uint8_t *buffer, uint32_t size) const 
Copy the packet contents to a byte buffer. 
 
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer. 
 
virtual void DoDispose()
Dispose this object;. 
 
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. 
 
EventId m_sendEvent
Event ID. 
 
static TypeId GetTypeId()
Get the type ID. 
 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
 
bool IsExpired(void) const 
This method is syntactic sugar for the ns3::Simulator::IsExpired method. 
 
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. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
Ipv6Address m_peerAddress
Peer address. 
 
void AddHeader(const Header &header)
Add header to this packet. 
 
void HandleRead(Ptr< Socket > socket)
Receive method. 
 
static TypeId LookupByName(std::string name)
Get a TypeId by name. 
 
uint32_t m_count
Number of "Echo request" packets that will be sent.