FreeNOS
|
Diagnostic program for sending network packets. More...
#include <NetSend.h>
Public Member Functions | |
NetSend (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~NetSend () |
Class destructor. More... | |
virtual Result | initialize () |
Initialize the application. 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 | udpSendMultiple (const struct iovec *vec, const Size count, const struct sockaddr &addr) const |
Send multiple UDP packets. More... | |
Private Attributes | |
NetworkClient * | m_client |
Network client. More... | |
int | m_socket |
UDP socket. More... | |
Static Private Attributes | |
static const Size | PacketSize = 1448 |
Size of each packet to send in bytes. More... | |
static const Size | QueueSize = NetworkQueue::MaxPackets |
Number of packets to submit for transmission each iteration. 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 | 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... | |
NetSend::NetSend | ( | int | argc, |
char ** | argv | ||
) |
Class constructor.
Definition at line 27 of file NetSend.cpp.
References Application::parser(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().
|
virtual |
Class destructor.
Definition at line 37 of file NetSend.cpp.
|
virtual |
Execute the application event loop.
Implements Application.
Definition at line 81 of file NetSend.cpp.
References sockaddr::addr, Application::arguments(), DEBUG, ERROR, iovec::iov_base, iovec::iov_len, NetworkQueue::MaxPackets, PacketSize, NetworkQueue::PayloadBufferSize, sockaddr::port, QueueSize, MemoryBlock::set(), Application::Success, IPV4::toAddress(), String::toLong(), IPV4::toString(), and udpSendMultiple().
|
virtual |
Initialize the application.
Reimplemented from Application.
Definition at line 41 of file NetSend.cpp.
References Application::arguments(), NetworkClient::bindSocket(), NetworkClient::createSocket(), DEBUG, ERROR, ArgumentContainer::get(), NetworkClient::initialize(), Application::IOError, m_client, m_socket, Application::Success, NetworkClient::Success, String::toLong(), and NetworkClient::UDP.
|
private |
Send multiple UDP packets.
vec | I/O vector with multiple packets |
count | Number of entries in the I/O vector |
addr | The destination IP and port |
Definition at line 125 of file NetSend.cpp.
References sockaddr::addr, DEBUG, errno, ERROR, Application::IOError, m_socket, msghdr::msg_iov, msghdr::msg_iovlen, msghdr::msg_name, msghdr::msg_namelen, sockaddr::port, sendmsg(), strerror(), Application::Success, and IPV4::toString().
Referenced by exec().
|
private |
|
private |
UDP socket.
Definition at line 94 of file NetSend.h.
Referenced by initialize(), and udpSendMultiple().
|
staticprivate |
|
staticprivate |