tftp_server_misc.h
Go to the documentation of this file.
1 /**
2  * @file tftp_server_misc.h
3  * @brief Helper functions for TFTP server
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 #ifndef _TFTP_SERVER_MISC_H
32 #define _TFTP_SERVER_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "tftp/tftp_server.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //TFTP server related functions
44 void tftpServerTick(TftpServerContext *context);
45 
47  const IpAddr *clientIpAddr, uint16_t clientPort);
48 
50 
52 
54  TftpClientConnection *connection);
55 
56 void tftpServerProcessRrqPacket(TftpServerContext *context, const IpAddr *clientIpAddr,
57  uint16_t clientPort, const TftpRrqPacket *rrqPacket, size_t length);
58 
59 void tftpServerProcessWrqPacket(TftpServerContext *context, const IpAddr *clientIpAddr,
60  uint16_t clientPort, const TftpWrqPacket *wrqPacket, size_t length);
61 
63  const TftpDataPacket *dataPacket, size_t length);
64 
66  const TftpAckPacket *ackPacket, size_t length);
67 
69  const TftpErrorPacket *errorPacket, size_t length);
70 
73 
75  uint16_t errorCode, const char_t *errorMsg);
76 
78 
79 //C++ guard
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
char_t errorMsg[]
Definition: tftp_common.h:137
void tftpServerProcessDataPacket(TftpClientConnection *connection, const TftpDataPacket *dataPacket, size_t length)
Process incoming DATA packet.
__start_packed struct @295 TftpRrqPacket
Read request packet (RRQ)
error_t tftpServerRetransmitPacket(TftpClientConnection *connection)
Retransmit the last packet.
uint8_t length
Definition: dtls_misc.h:149
void tftpServerProcessAckPacket(TftpClientConnection *connection, const TftpAckPacket *ackPacket, size_t length)
Process incoming ACK packet.
__start_packed struct @298 TftpAckPacket
Acknowledgment packet (ACK)
IP network address.
Definition: ip.h:71
error_t tftpServerSendDataPacket(TftpClientConnection *connection)
Send DATA packet.
error_t tftpServerSendErrorPacket(TftpClientConnection *connection, uint16_t errorCode, const char_t *errorMsg)
Send ERROR packet.
#define TftpServerContext
Definition: tftp_server.h:108
void tftpServerCloseConnection(TftpClientConnection *connection)
Close client connection.
uint16_t errorCode
Definition: tftp_common.h:136
__start_packed struct @299 TftpErrorPacket
Error packet (ERROR)
TFTP server.
void tftpServerAcceptRequest(TftpServerContext *context)
Accept connection request.
error_t
Error codes.
Definition: error.h:42
void tftpServerProcessRrqPacket(TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpRrqPacket *rrqPacket, size_t length)
Process incoming RRQ packet.
void tftpServerTick(TftpServerContext *context)
Handle periodic operations.
void tftpServerProcessWrqPacket(TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpWrqPacket *wrqPacket, size_t length)
Process incoming WRQ packet.
char char_t
Definition: compiler_port.h:43
void tftpServerProcessErrorPacket(TftpClientConnection *connection, const TftpErrorPacket *errorPacket, size_t length)
Process incoming ERROR packet.
#define TftpClientConnection
Definition: tftp_server.h:104
error_t tftpServerSendAckPacket(TftpClientConnection *connection)
Send ACK packet.
__start_packed struct @296 TftpWrqPacket
Write request packet (WRQ)
TftpClientConnection * tftpServerOpenConnection(TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort)
Create client connection.
TCP/IP stack core.
void tftpServerProcessPacket(TftpServerContext *context, TftpClientConnection *connection)
Process incoming packet.
__start_packed struct @297 TftpDataPacket
Data packet (DATA)