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