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
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
64
69
71
73
76
79
81 char m_lineBuf[64];
83
86
89};
90
95#endif /* __BIN_NETCAT_H */
Result
Result codes.
Definition Application.h:54
u32 Address
IP-address.
Definition IPV4.h:47
Network send/receive (cat) application.
Definition NetCat.h:35
virtual Result initialize()
Initialize the application.
Definition NetCat.cpp:53
Size m_lineLen
Definition NetCat.h:82
char m_lineBuf[64]
Line buffer.
Definition NetCat.h:81
virtual Result exec()
Execute the application event loop.
Definition NetCat.cpp:92
virtual ~NetCat()
Class destructor.
Definition NetCat.cpp:49
int m_socket
Socket.
Definition NetCat.h:78
Result udpReceive()
Definition NetCat.cpp:198
Result printLine()
Definition NetCat.cpp:121
Result udpSend()
Send UDP packet.
Definition NetCat.cpp:179
IPV4::Address m_host
Host IP.
Definition NetCat.h:85
u16 m_port
Host port.
Definition NetCat.h:88
NetworkClient * m_client
Networking client.
Definition NetCat.h:75
Result readLine()
Read one line from standard input.
Definition NetCat.cpp:129
Networking Client implementation.
POSIX-compatible application.
unsigned short u16
Unsigned 16-bit number.
Definition Types.h:56
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128