FreeNOS
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
NetSend Class Reference

Diagnostic program for sending network packets. More...

#include <NetSend.h>

Inheritance diagram for NetSend:
POSIXApplication Application

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

NetworkClientm_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...
 
ArgumentParserparser ()
 Get program arguments parser. More...
 
const ArgumentParserparser () const
 Get constant program arguments parser. More...
 
const ArgumentContainerarguments () 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...
 

Detailed Description

Diagnostic program for sending network packets.

Definition at line 33 of file NetSend.h.

Constructor & Destructor Documentation

◆ NetSend()

NetSend::NetSend ( int  argc,
char **  argv 
)

Class constructor.

Parameters
argcArgument count
argvArgument values

Definition at line 27 of file NetSend.cpp.

References Application::parser(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().

◆ ~NetSend()

NetSend::~NetSend ( )
virtual

Class destructor.

Definition at line 37 of file NetSend.cpp.

Member Function Documentation

◆ exec()

NetSend::Result NetSend::exec ( )
virtual

◆ initialize()

NetSend::Result NetSend::initialize ( )
virtual

◆ udpSendMultiple()

NetSend::Result NetSend::udpSendMultiple ( const struct iovec vec,
const Size  count,
const struct sockaddr addr 
) const
private

Send multiple UDP packets.

Parameters
vecI/O vector with multiple packets
countNumber of entries in the I/O vector
addrThe destination IP and port
Returns
Result code

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().

Field Documentation

◆ m_client

NetworkClient* NetSend::m_client
private

Network client.

Definition at line 91 of file NetSend.h.

Referenced by initialize().

◆ m_socket

int NetSend::m_socket
private

UDP socket.

Definition at line 94 of file NetSend.h.

Referenced by initialize(), and udpSendMultiple().

◆ PacketSize

const Size NetSend::PacketSize = 1448
staticprivate

Size of each packet to send in bytes.

Definition at line 38 of file NetSend.h.

Referenced by exec().

◆ QueueSize

const Size NetSend::QueueSize = NetworkQueue::MaxPackets
staticprivate

Number of packets to submit for transmission each iteration.

Definition at line 41 of file NetSend.h.

Referenced by exec().


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