ftp_server_misc.h
Go to the documentation of this file.
1 /**
2  * @file ftp_server_misc.h
3  * @brief Helper functions for FTP server
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 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 2.4.4
29  **/
30 
31 #ifndef _FTP_SERVER_MISC_H
32 #define _FTP_SERVER_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ftp/ftp_server.h"
37 
38 //Time constant
39 #define FTP_SERVER_180_DAYS (180 * 86400)
40 
41 //C++ guard
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 //FTP server related functions
47 void ftpServerTick(FtpServerContext *context);
48 
49 uint16_t ftpServerGetPassivePort(FtpServerContext *context);
50 
52  const char_t *inputPath, char_t *outputPath, size_t maxLen);
53 
55  const char_t *path);
56 
57 size_t ftpServerFormatDirEntry(const FsDirEntry *dirEntry, uint_t perm,
58  char_t *buffer);
59 
61  const char_t *path);
62 
64  const char_t *path);
65 
67 
68 //C++ guard
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
#define FtpServerContext
Definition: ftp_server.h:208
const char_t * ftpServerStripRootDir(FtpServerContext *context, const char_t *path)
Strip root dir from specified pathname.
void ftpServerCloseConnection(FtpClientConnection *connection)
Close client connection properly.
uint_t ftpServerGetFilePermissions(FtpClientConnection *connection, const char_t *path)
Get permissions for the specified file or directory.
uint16_t ftpServerGetPassivePort(FtpServerContext *context)
Get a passive port number.
error_t
Error codes.
Definition: error.h:43
const char_t * ftpServerStripHomeDir(FtpClientConnection *connection, const char_t *path)
Strip home directory from specified pathname.
void ftpServerTick(FtpServerContext *context)
Handle periodic operations.
error_t ftpServerGetPath(FtpClientConnection *connection, const char_t *inputPath, char_t *outputPath, size_t maxLen)
Retrieve the full pathname.
char char_t
Definition: compiler_port.h:48
Directory entry.
Definition: fs_port.h:108
FTP server (File Transfer Protocol)
#define FtpClientConnection
Definition: ftp_server.h:212
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
size_t ftpServerFormatDirEntry(const FsDirEntry *dirEntry, uint_t perm, char_t *buffer)
Format a directory entry in UNIX-style format.