FreeNOS
NetCat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __BIN_NETCAT_H
19 #define __BIN_NETCAT_H
20 
21 #include <IPV4.h>
22 #include <Ethernet.h>
23 #include <NetworkClient.h>
24 #include <POSIXApplication.h>
25 
34 class NetCat : public POSIXApplication
35 {
36  public:
37 
41  NetCat(int argc, char **argv);
42 
46  virtual ~NetCat();
47 
51  virtual Result initialize();
52 
56  virtual Result exec();
57 
58  private:
59 
63  Result readLine();
64 
68  Result udpSend();
69 
71 
72  Result printLine();
73 
76 
78  int m_socket;
79 
81  char m_lineBuf[64];
83 
86 
89 };
90 
95 #endif /* __BIN_NETCAT_H */
NetCat::udpSend
Result udpSend()
Send UDP packet.
Definition: NetCat.cpp:179
Ethernet.h
POSIXApplication
POSIX-compatible application.
Definition: POSIXApplication.h:35
NetCat::m_port
u16 m_port
Host port.
Definition: NetCat.h:88
NetCat::m_host
IPV4::Address m_host
Host IP.
Definition: NetCat.h:85
NetCat::readLine
Result readLine()
Read one line from standard input.
Definition: NetCat.cpp:129
NetCat::m_socket
int m_socket
Socket.
Definition: NetCat.h:78
NetCat::m_client
NetworkClient * m_client
Networking client.
Definition: NetCat.h:75
POSIXApplication.h
NetCat
Network send/receive (cat) application.
Definition: NetCat.h:34
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
NetCat::initialize
virtual Result initialize()
Initialize the application.
Definition: NetCat.cpp:53
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Application::Result
Result
Result codes.
Definition: Application.h:53
NetCat::~NetCat
virtual ~NetCat()
Class destructor.
Definition: NetCat.cpp:49
IPV4::Address
u32 Address
IP-address.
Definition: IPV4.h:47
NetworkClient
Networking Client implementation.
Definition: NetworkClient.h:44
IPV4.h
NetCat::m_lineBuf
char m_lineBuf[64]
Line buffer.
Definition: NetCat.h:81
NetCat::m_lineLen
Size m_lineLen
Definition: NetCat.h:82
NetCat::udpReceive
Result udpReceive()
Definition: NetCat.cpp:198
NetCat::printLine
Result printLine()
Definition: NetCat.cpp:121
NetworkClient.h
NetCat::exec
virtual Result exec()
Execute the application event loop.
Definition: NetCat.cpp:92
NetCat::NetCat
NetCat(int argc, char **argv)
Class constructor.
Definition: NetCat.cpp:32