SatCat5
satcat5::ip::Ping Class Referencefinal

Detailed Description

Automatic "ping" functionality using an ICMP dispatch object A simplified wrapper for basic "ping" functionality.

Sends ARPING (ARP query) or PING (ICMP echo request) messages to the designated IP-address once per second. Results are written to the system Log.

Definition at line 19 of file ip_ping.h.

#include <ip_ping.h>

Inheritance diagram for satcat5::ip::Ping:
[legend]
Collaboration diagram for satcat5::ip::Ping:
[legend]

Public Member Functions

 Ping (satcat5::ip::Dispatch *iface)
 Tie this Ping wrapper to an IP-dispatch object.
 
void arping (const satcat5::ip::Addr &dstaddr, unsigned qty=satcat5::ip::Ping::UNLIMITED)
 Begin sending ARPING queries (ARP query).
 
void ping (const satcat5::ip::Addr &dstaddr, unsigned qty=satcat5::ip::Ping::UNLIMITED)
 Begin sending PING queries (ICMP echo request).
 
void stop ()
 Stop any ongoing activities.
 
virtual void gateway_change (const satcat5::ip::Addr &dstaddr, const satcat5::ip::Addr &gateway)
 Callback for changes to gateway configuration. More...
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 

Static Public Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Static Public Attributes

static constexpr unsigned UNLIMITED = (unsigned)(-1)
 All requests can send N queries or until told to stop.
 

Private Member Functions

void arp_event (const satcat5::eth::MacAddr &mac, const satcat5::ip::Addr &ip) override
 Callback for any announced MAC/IP address pair. More...
 
void ping_event (const satcat5::ip::Addr &from, u32 elapsed_usec) override
 Callback method when a ping response is received. More...
 
void send_arping ()
 
void send_ping ()
 
void timer_event () override
 Child class MUST override this method.
 
void query (unsigned elapsed_msec)
 

Private Attributes

satcat5::ip::Dispatch *const m_iface
 
satcat5::ip::Address m_addr
 
satcat5::util::TimeVal m_arp_tref
 
unsigned m_arp_remct
 
unsigned m_icmp_remct
 
bool m_reply_rcvd
 
satcat5::eth::ArpListenerm_next
 
unsigned m_trem
 
unsigned m_tnext
 

Member Function Documentation

◆ arp_event()

void Ping::arp_event ( const satcat5::eth::MacAddr mac,
const satcat5::ip::Addr ip 
)
overrideprivatevirtual

Callback for any announced MAC/IP address pair.

Child class MUST override this method.

Implements satcat5::eth::ArpListener.

Definition at line 68 of file ip_ping.cc.

◆ gateway_change()

virtual void satcat5::eth::ArpListener::gateway_change ( const satcat5::ip::Addr dstaddr,
const satcat5::ip::Addr gateway 
)
inlinevirtualinherited

Callback for changes to gateway configuration.

Child class MAY override this method.

Reimplemented in satcat5::ip::Address, and satcat5::test::CountArpResponse.

Definition at line 56 of file eth_arp.h.

◆ ping_event()

void Ping::ping_event ( const satcat5::ip::Addr from,
u32  elapsed_usec 
)
overrideprivatevirtual

Callback method when a ping response is received.

Child class MUST override this method.

Implements satcat5::ip::PingListener.

Definition at line 80 of file ip_ping.cc.


The documentation for this class was generated from the following files: