FreeNOS
|
Network ping/pong application. More...
#include <NetPing.h>
Public Member Functions | |
NetPing (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~NetPing () |
Class destructor. More... | |
virtual Result | exec () |
Execute the application event loop. More... | |
Public Member Functions inherited from POSIXApplication | |
POSIXApplication (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~POSIXApplication () |
Class destructor. More... | |
Public Member Functions inherited from Application | |
Application (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~Application () |
Class destructor. More... | |
virtual int | run () |
Run the application. More... | |
Private Member Functions | |
Result | arpPing (const char *dev, const char *host) |
Send ARP ping/pong. More... | |
Result | icmpPing (const char *dev, const char *host) |
Send ICMP ping/pong. More... | |
Additional Inherited Members | |
Public Types inherited from Application | |
enum | Result { Success, NotFound, IOError, InvalidArgument, ShowUsage, TimedOut, OutOfMemory } |
Result codes. More... | |
Protected Member Functions inherited from POSIXApplication | |
virtual Result | output (const char *string) const |
Print text to output. More... | |
int | runProgram (const char *path, const char **argv) |
Runs an external program. More... | |
Protected Member Functions inherited from Application | |
virtual Result | initialize () |
Initialize the application. More... | |
virtual Result | output (String &string) const |
Print string to output. More... | |
ArgumentParser & | parser () |
Get program arguments parser. More... | |
const ArgumentParser & | parser () const |
Get constant program arguments parser. More... | |
const ArgumentContainer & | arguments () const |
Get program arguments. More... | |
void | setVersion (const String &version) |
Set program version. More... | |
Protected Attributes inherited from Application | |
int | m_argc |
Input argument count. More... | |
char ** | m_argv |
Input argument values. More... | |
NetPing::NetPing | ( | int | argc, |
char ** | argv | ||
) |
Class constructor.
Definition at line 31 of file NetPing.cpp.
References Application::parser(), ArgumentParser::registerFlag(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().
|
virtual |
Class destructor.
Definition at line 41 of file NetPing.cpp.
|
private |
Send ARP ping/pong.
Definition at line 67 of file NetPing.cpp.
References Ethernet::Address::addr, NetworkClient::ARP, NetworkClient::close(), NetworkClient::createSocket(), DEBUG, errno, ERROR, NetworkClient::initialize(), Application::IOError, printf(), read(), strerror(), Application::Success, NetworkClient::Success, IPV4::toAddress(), and write().
Referenced by exec().
|
virtual |
Execute the application event loop.
Implements Application.
Definition at line 45 of file NetPing.cpp.
References Application::arguments(), arpPing(), DEBUG, ArgumentContainer::get(), and icmpPing().
|
private |
Send ICMP ping/pong.
Definition at line 129 of file NetPing.cpp.
References ICMP::Header::checksum, IPV4::checksum(), close(), ICMP::Header::code, NetworkClient::connectSocket(), NetworkClient::createSocket(), DEBUG, ICMP::EchoReply, ICMP::EchoRequest, errno, ERROR, NetworkClient::ICMP, ICMP::Header::id, NetworkClient::initialize(), Application::IOError, printf(), read(), ICMP::Header::sequence, strerror(), Application::Success, NetworkClient::Success, IPV4::toAddress(), ICMP::Header::type, and write().
Referenced by exec().