A ping6 application. More...
#include <ping6.h>
Public Member Functions | |
Ping6 () | |
Constructor. More... | |
virtual | ~Ping6 () |
Destructor. More... | |
void | SetIfIndex (uint32_t ifIndex) |
Set the out interface index. More... | |
void | SetLocal (Ipv6Address ipv6) |
Set the local address. More... | |
void | SetRemote (Ipv6Address ipv6) |
Set the remote peer. More... | |
void | SetRouters (std::vector< Ipv6Address > routers) |
Set routers for routing type 0 (loose routing). More... | |
Public Member Functions inherited from ns3::Application | |
Application () | |
virtual | ~Application () |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
void | SetStartTime (Time start) |
Specify application start time. More... | |
void | SetStopTime (Time stop) |
Specify application stop time. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Application | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose this object;. More... | |
Protected Member Functions inherited from ns3::Application | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Private Member Functions | |
void | HandleRead (Ptr< Socket > socket) |
Receive method. More... | |
void | ScheduleTransmit (Time dt) |
Schedule sending a packet. More... | |
void | Send () |
Send a packet. More... | |
virtual void | StartApplication () |
Start the application. More... | |
virtual void | StopApplication () |
Stop the application. More... | |
Private Attributes | |
Ipv6Address | m_address |
Peer IPv6 address. More... | |
uint32_t | m_count |
Number of "Echo request" packets that will be sent. More... | |
uint32_t | m_ifIndex |
Out interface (i.e. More... | |
Time | m_interval |
Intervall between packets sent. More... | |
Ipv6Address | m_localAddress |
Local address. More... | |
Ipv6Address | m_peerAddress |
Peer address. More... | |
std::vector< Ipv6Address > | m_routers |
Routers addresses for routing type 0. More... | |
EventId | m_sendEvent |
Event ID. More... | |
uint32_t | m_sent |
Number of packets sent. More... | |
uint16_t | m_seq |
Sequence number. More... | |
uint32_t | m_size |
Size of the packet. More... | |
Ptr< Socket > | m_socket |
Local socket. More... | |
Additional Inherited Members | |
Protected Attributes inherited from ns3::Application | |
Ptr< Node > | m_node |
EventId | m_startEvent |
The simulation time that the appliacation will end. More... | |
Time | m_startTime |
The node that this application is installed on. More... | |
EventId | m_stopEvent |
The event that will fire at m_startTime to start the application. More... | |
Time | m_stopTime |
The simulation time that the appliacation will start. More... | |
A ping6 application.
ns3::Ping6 is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
ns3::Ping6::Ping6 | ( | ) |
Constructor.
Definition at line 81 of file ping6.cc.
References m_sendEvent, m_sent, m_seq, m_socket, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Destructor.
Definition at line 90 of file ping6.cc.
References m_socket, and NS_LOG_FUNCTION_NOARGS.
|
protectedvirtual |
Dispose this object;.
Reimplemented from ns3::Application.
Definition at line 96 of file ping6.cc.
References ns3::Application::DoDispose(), and NS_LOG_FUNCTION_NOARGS.
|
static |
Get the type ID.
Definition at line 47 of file ping6.cc.
References m_count, m_interval, m_localAddress, m_peerAddress, m_size, ns3::MakeTimeChecker(), and ns3::TypeId::SetParent().
Referenced by ns3::Ping6Helper::Ping6Helper().
Receive method.
socket | socket that receive a packet |
Definition at line 239 of file ping6.cc.
References first::address, ns3::Inet6SocketAddress::ConvertFrom(), ns3::Packet::CopyData(), ns3::Icmpv6Echo::GetId(), ns3::Inet6SocketAddress::GetIpv6(), ns3::Icmpv6Echo::GetSeq(), ns3::Packet::GetSize(), ns3::Icmpv6Header::ICMPV6_ECHO_REPLY, ns3::Inet6SocketAddress::IsMatchingType(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Socket::RecvFrom(), and ns3::Packet::RemoveHeader().
Referenced by StartApplication().
|
private |
Schedule sending a packet.
dt | interval between packet |
Definition at line 151 of file ping6.cc.
References m_sendEvent, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and Send().
Referenced by Send(), and StartApplication().
|
private |
Send a packet.
Definition at line 162 of file ping6.cc.
References ns3::Socket::Bind(), data, ns3::Ipv6::GetAddress(), ns3::Application::GetNode(), ns3::Object::GetObject(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Ipv6Header::IPV6_EXT_ROUTING, ns3::Ipv6Header::IPV6_ICMPV6, ns3::EventId::IsExpired(), m_count, m_ifIndex, m_interval, m_localAddress, m_peerAddress, m_routers, m_sendEvent, m_sent, m_seq, m_size, m_socket, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, NS_LOG_INFO, ScheduleTransmit(), ns3::Socket::Send(), ns3::ObjectBase::SetAttribute(), ns3::Icmpv6Echo::SetId(), ns3::Ipv6ExtensionHeader::SetLength(), ns3::Ipv6ExtensionHeader::SetNextHeader(), ns3::Ipv6ExtensionLooseRoutingHeader::SetRoutersAddress(), ns3::Ipv6ExtensionRoutingHeader::SetSegmentsLeft(), ns3::Icmpv6Echo::SetSeq(), and ns3::Ipv6ExtensionRoutingHeader::SetTypeRouting().
Referenced by ScheduleTransmit().
void ns3::Ping6::SetIfIndex | ( | uint32_t | ifIndex | ) |
void ns3::Ping6::SetLocal | ( | Ipv6Address | ipv6 | ) |
Set the local address.
ipv6 | the local IPv6 address |
Definition at line 122 of file ping6.cc.
References m_localAddress, and NS_LOG_FUNCTION.
void ns3::Ping6::SetRemote | ( | Ipv6Address | ipv6 | ) |
Set the remote peer.
ipv6 | IPv6 address of the peer |
Definition at line 128 of file ping6.cc.
References m_peerAddress, and NS_LOG_FUNCTION.
void ns3::Ping6::SetRouters | ( | std::vector< Ipv6Address > | routers | ) |
|
privatevirtual |
Start the application.
Reimplemented from ns3::Application.
Definition at line 102 of file ping6.cc.
References ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::Socket::CreateSocket(), ns3::Application::GetNode(), HandleRead(), ns3::Ipv6Header::IPV6_ICMPV6, ns3::TypeId::LookupByName(), m_localAddress, m_peerAddress, m_socket, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION_NOARGS, ScheduleTransmit(), ns3::ObjectBase::SetAttribute(), and ns3::Socket::SetRecvCallback().
|
privatevirtual |
Stop the application.
Reimplemented from ns3::Application.
Definition at line 134 of file ping6.cc.
References ns3::Simulator::Cancel(), m_sendEvent, m_socket, ns3::MakeNullCallback(), NS_LOG_FUNCTION_NOARGS, and ns3::Socket::SetRecvCallback().
|
private |
|
private |
Number of "Echo request" packets that will be sent.
Definition at line 132 of file ping6.h.
Referenced by GetTypeId(), and Send().
|
private |
Out interface (i.e.
for link-local communication).
Definition at line 177 of file ping6.h.
Referenced by Send(), and SetIfIndex().
|
private |
Intervall between packets sent.
Definition at line 147 of file ping6.h.
Referenced by GetTypeId(), and Send().
|
private |
Local address.
Definition at line 152 of file ping6.h.
Referenced by GetTypeId(), Send(), SetLocal(), and StartApplication().
|
private |
Peer address.
Definition at line 157 of file ping6.h.
Referenced by GetTypeId(), Send(), SetRemote(), and StartApplication().
|
private |
Routers addresses for routing type 0.
Definition at line 182 of file ping6.h.
Referenced by Send(), and SetRouters().
|
private |
Event ID.
Definition at line 172 of file ping6.h.
Referenced by Ping6(), ScheduleTransmit(), Send(), and StopApplication().
|
private |
|
private |
|
private |
Local socket.
Definition at line 162 of file ping6.h.
Referenced by Ping6(), Send(), StartApplication(), StopApplication(), and ~Ping6().