FreeNOS
|
Network send/receive (cat) application. More...
#include <NetCat.h>
Public Member Functions | |
NetCat (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~NetCat () |
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 | readLine () |
Read one line from standard input. More... | |
Result | udpSend () |
Send UDP packet. More... | |
Result | udpReceive () |
Result | printLine () |
Private Attributes | |
NetworkClient * | m_client |
Networking client. More... | |
int | m_socket |
Socket. More... | |
char | m_lineBuf [64] |
Line buffer. More... | |
Size | m_lineLen |
IPV4::Address | m_host |
Host IP. More... | |
u16 | m_port |
Host port. 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... | |
NetCat::NetCat | ( | int | argc, |
char ** | argv | ||
) |
Class constructor.
Definition at line 32 of file NetCat.cpp.
References Application::parser(), ArgumentParser::registerFlag(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().
|
virtual |
Class destructor.
Definition at line 49 of file NetCat.cpp.
|
virtual |
Execute the application event loop.
Implements Application.
Definition at line 92 of file NetCat.cpp.
References Application::arguments(), DEBUG, printLine(), readLine(), Application::Success, udpReceive(), and udpSend().
|
virtual |
Initialize the application.
Reimplemented from Application.
Definition at line 53 of file NetCat.cpp.
References Application::arguments(), atoi(), NetworkClient::bindSocket(), NetworkClient::createSocket(), DEBUG, ERROR, NetworkClient::initialize(), Application::IOError, m_client, m_host, m_port, m_socket, Application::Success, NetworkClient::Success, IPV4::toAddress(), and NetworkClient::UDP.
|
private |
Definition at line 121 of file NetCat.cpp.
References m_lineBuf, m_lineLen, printf(), and Application::Success.
Referenced by exec().
|
private |
|
private |
Definition at line 198 of file NetCat.cpp.
References sockaddr::addr, DEBUG, errno, ERROR, Application::IOError, m_lineBuf, m_socket, recvfrom(), strerror(), Application::Success, and ZERO.
Referenced by exec().
|
private |
Send UDP packet.
Definition at line 179 of file NetCat.cpp.
References sockaddr::addr, DEBUG, errno, ERROR, Application::IOError, m_host, m_lineBuf, m_lineLen, m_port, m_socket, sendto(), strerror(), and Application::Success.
Referenced by exec().
|
private |
|
private |
|
private |
Line buffer.
Definition at line 81 of file NetCat.h.
Referenced by printLine(), readLine(), udpReceive(), and udpSend().
|
private |
Definition at line 82 of file NetCat.h.
Referenced by printLine(), readLine(), and udpSend().
|
private |
|
private |
Socket.
Definition at line 78 of file NetCat.h.
Referenced by initialize(), udpReceive(), and udpSend().