FreeNOS
NetSend.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 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_NETSEND_NETSEND_H
19#define __BIN_NETSEND_NETSEND_H
20
21#include <NetworkClient.h>
22#include <NetworkQueue.h>
23#include <POSIXApplication.h>
24
34{
35 private:
36
38 static const Size PacketSize = 1448;
39
42
43 public:
44
51 NetSend(int argc,
52 char **argv);
53
57 virtual ~NetSend();
58
64 virtual Result initialize();
65
71 virtual Result exec();
72
73 private:
74
84 Result udpSendMultiple(const struct iovec *vec,
85 const Size count,
86 const struct sockaddr & addr) const;
87
88 private:
89
92
95};
96
101#endif /* __BIN_NETSEND_NETSEND_H */
Result
Result codes.
Definition Application.h:54
Diagnostic program for sending network packets.
Definition NetSend.h:34
virtual Result exec()
Execute the application event loop.
Definition NetSend.cpp:81
virtual Result initialize()
Initialize the application.
Definition NetSend.cpp:41
Result udpSendMultiple(const struct iovec *vec, const Size count, const struct sockaddr &addr) const
Send multiple UDP packets.
Definition NetSend.cpp:125
int m_socket
UDP socket.
Definition NetSend.h:94
static const Size PacketSize
Size of each packet to send in bytes.
Definition NetSend.h:38
static const Size QueueSize
Number of packets to submit for transmission each iteration.
Definition NetSend.h:41
virtual ~NetSend()
Class destructor.
Definition NetSend.cpp:37
NetworkClient * m_client
Network client.
Definition NetSend.h:91
Networking Client implementation.
static const Size MaxPackets
Maximum number of packets available.
POSIX-compatible application.
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Input/Output vector for multi-packet operations.
Definition socket.h:45
Defines a socket address and port pair.
Definition socket.h:36