FTP server (File Transfer Protocol) More...
#include "core/net.h"
#include "core/socket.h"
#include "fs_port.h"
#include "core/crypto.h"
#include "tls.h"
#include "tls_ticket.h"
Go to the source code of this file.
Data Structures | |
struct | FtpServerSettings |
FTP server settings. More... | |
struct | FtpServerChannel |
Control or data channel. More... | |
struct | _FtpClientConnection |
FTP client connection. More... | |
struct | _FtpServerContext |
FTP server context. More... | |
Typedefs | |
typedef error_t(* | FtpServerConnectCallback) (FtpClientConnection *connection, const IpAddr *clientIpAddr, uint16_t clientPort) |
Connection callback function. More... | |
typedef void(* | FtpServerDisconnectCallback) (FtpClientConnection *connection, const IpAddr *clientIpAddr, uint16_t clientPort) |
Disconnection callback function. More... | |
typedef error_t(* | FtpServerTlsInitCallback) (FtpClientConnection *connection, TlsContext *tlsContext) |
TLS initialization callback function. More... | |
typedef uint_t(* | FtpServerCheckUserCallback) (FtpClientConnection *connection, const char_t *user) |
User verification callback function. More... | |
typedef uint_t(* | FtpServerCheckPasswordCallback) (FtpClientConnection *connection, const char_t *user, const char_t *password) |
Password verification callback function. More... | |
typedef uint_t(* | FtpServerGetFilePermCallback) (FtpClientConnection *connection, const char_t *user, const char_t *path) |
Callback used to retrieve file permissions. More... | |
typedef error_t(* | FtpServerUnknownCommandCallback) (FtpClientConnection *connection, const char_t *command, const char_t *param) |
Unknown command callback function. More... | |
Functions | |
void | ftpServerGetDefaultSettings (FtpServerSettings *settings) |
Initialize settings with default values. More... | |
error_t | ftpServerInit (FtpServerContext *context, const FtpServerSettings *settings) |
FTP server initialization. More... | |
error_t | ftpServerStart (FtpServerContext *context) |
Start FTP server. More... | |
error_t | ftpServerStop (FtpServerContext *context) |
Stop FTP server. More... | |
error_t | ftpServerSetHomeDir (FtpClientConnection *connection, const char_t *homeDir) |
Set home directory. More... | |
void | ftpServerTask (FtpServerContext *context) |
FTP server task. More... | |
void | ftpServerDeinit (FtpServerContext *context) |
Release FTP server context. More... | |
Detailed Description
FTP server (File Transfer Protocol)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file ftp_server.h.
Macro Definition Documentation
◆ FTP_DATA_PORT
#define FTP_DATA_PORT 20 |
Definition at line 199 of file ftp_server.h.
◆ FTP_PORT
#define FTP_PORT 21 |
Definition at line 197 of file ftp_server.h.
◆ FTP_SERVER_BACKLOG
#define FTP_SERVER_BACKLOG 4 |
Definition at line 88 of file ftp_server.h.
◆ FTP_SERVER_BUFFER_SIZE
#define FTP_SERVER_BUFFER_SIZE 1024 |
Definition at line 102 of file ftp_server.h.
◆ FTP_SERVER_MAX_CONNECTIONS
#define FTP_SERVER_MAX_CONNECTIONS 10 |
Definition at line 67 of file ftp_server.h.
◆ FTP_SERVER_MAX_HOME_DIR_LEN
#define FTP_SERVER_MAX_HOME_DIR_LEN 63 |
Definition at line 116 of file ftp_server.h.
◆ FTP_SERVER_MAX_LINE_LEN
#define FTP_SERVER_MAX_LINE_LEN 255 |
Definition at line 95 of file ftp_server.h.
◆ FTP_SERVER_MAX_PATH_LEN
#define FTP_SERVER_MAX_PATH_LEN 255 |
Definition at line 130 of file ftp_server.h.
◆ FTP_SERVER_MAX_ROOT_DIR_LEN
#define FTP_SERVER_MAX_ROOT_DIR_LEN 63 |
Definition at line 109 of file ftp_server.h.
◆ FTP_SERVER_MAX_TCP_BUFFER_SIZE
#define FTP_SERVER_MAX_TCP_BUFFER_SIZE 2860 |
Definition at line 144 of file ftp_server.h.
◆ FTP_SERVER_MAX_TLS_RX_BUFFER_SIZE
#define FTP_SERVER_MAX_TLS_RX_BUFFER_SIZE 16384 |
Definition at line 165 of file ftp_server.h.
◆ FTP_SERVER_MAX_USERNAME_LEN
#define FTP_SERVER_MAX_USERNAME_LEN 63 |
Definition at line 123 of file ftp_server.h.
◆ FTP_SERVER_MIN_TCP_BUFFER_SIZE
#define FTP_SERVER_MIN_TCP_BUFFER_SIZE 1430 |
Definition at line 137 of file ftp_server.h.
◆ FTP_SERVER_MIN_TLS_RX_BUFFER_SIZE
#define FTP_SERVER_MIN_TLS_RX_BUFFER_SIZE 2048 |
Definition at line 158 of file ftp_server.h.
◆ FTP_SERVER_PASSIVE_PORT_MAX
#define FTP_SERVER_PASSIVE_PORT_MAX 49151 |
Definition at line 179 of file ftp_server.h.
◆ FTP_SERVER_PASSIVE_PORT_MIN
#define FTP_SERVER_PASSIVE_PORT_MIN 48128 |
Definition at line 172 of file ftp_server.h.
◆ FTP_SERVER_PRIORITY
#define FTP_SERVER_PRIORITY OS_TASK_PRIORITY_NORMAL |
Definition at line 62 of file ftp_server.h.
◆ FTP_SERVER_PRIVATE_CONTEXT
#define FTP_SERVER_PRIVATE_CONTEXT |
Definition at line 186 of file ftp_server.h.
◆ FTP_SERVER_STACK_SIZE
#define FTP_SERVER_STACK_SIZE 650 |
Definition at line 55 of file ftp_server.h.
◆ FTP_SERVER_SUPPORT
#define FTP_SERVER_SUPPORT ENABLED |
Definition at line 41 of file ftp_server.h.
◆ FTP_SERVER_TICK_INTERVAL
#define FTP_SERVER_TICK_INTERVAL 1000 |
Definition at line 81 of file ftp_server.h.
◆ FTP_SERVER_TIMEOUT
#define FTP_SERVER_TIMEOUT 60000 |
Definition at line 74 of file ftp_server.h.
◆ FTP_SERVER_TLS_SUPPORT
#define FTP_SERVER_TLS_SUPPORT DISABLED |
Definition at line 48 of file ftp_server.h.
◆ FTP_SERVER_TLS_TX_BUFFER_SIZE
#define FTP_SERVER_TLS_TX_BUFFER_SIZE 4096 |
Definition at line 151 of file ftp_server.h.
◆ FtpClientConnection
#define FtpClientConnection struct _FtpClientConnection |
Definition at line 212 of file ftp_server.h.
◆ FTPS_DATA_PORT
#define FTPS_DATA_PORT 989 |
Definition at line 204 of file ftp_server.h.
◆ FTPS_PORT
#define FTPS_PORT 990 |
Definition at line 202 of file ftp_server.h.
◆ FtpServerContext
#define FtpServerContext struct _FtpServerContext |
Definition at line 208 of file ftp_server.h.
Typedef Documentation
◆ FtpServerCheckPasswordCallback
typedef uint_t(* FtpServerCheckPasswordCallback) (FtpClientConnection *connection, const char_t *user, const char_t *password) |
Password verification callback function.
Definition at line 326 of file ftp_server.h.
◆ FtpServerCheckUserCallback
typedef uint_t(* FtpServerCheckUserCallback) (FtpClientConnection *connection, const char_t *user) |
User verification callback function.
Definition at line 318 of file ftp_server.h.
◆ FtpServerConnectCallback
typedef error_t(* FtpServerConnectCallback) (FtpClientConnection *connection, const IpAddr *clientIpAddr, uint16_t clientPort) |
Connection callback function.
Definition at line 289 of file ftp_server.h.
◆ FtpServerDisconnectCallback
typedef void(* FtpServerDisconnectCallback) (FtpClientConnection *connection, const IpAddr *clientIpAddr, uint16_t clientPort) |
Disconnection callback function.
Definition at line 297 of file ftp_server.h.
◆ FtpServerGetFilePermCallback
typedef uint_t(* FtpServerGetFilePermCallback) (FtpClientConnection *connection, const char_t *user, const char_t *path) |
Callback used to retrieve file permissions.
Definition at line 334 of file ftp_server.h.
◆ FtpServerTlsInitCallback
typedef error_t(* FtpServerTlsInitCallback) (FtpClientConnection *connection, TlsContext *tlsContext) |
TLS initialization callback function.
Definition at line 308 of file ftp_server.h.
◆ FtpServerUnknownCommandCallback
typedef error_t(* FtpServerUnknownCommandCallback) (FtpClientConnection *connection, const char_t *command, const char_t *param) |
Unknown command callback function.
Definition at line 342 of file ftp_server.h.
Enumeration Type Documentation
◆ FtpAccessStatus
enum FtpAccessStatus |
FTP server access status.
Enumerator | |
---|---|
FTP_ACCESS_DENIED | |
FTP_ACCESS_ALLOWED | |
FTP_PASSWORD_REQUIRED |
Definition at line 265 of file ftp_server.h.
◆ FtpFilePerm
enum FtpFilePerm |
File permissions.
Enumerator | |
---|---|
FTP_FILE_PERM_LIST | |
FTP_FILE_PERM_READ | |
FTP_FILE_PERM_WRITE |
Definition at line 277 of file ftp_server.h.
◆ FtpServerChannelState
Channel state.
Definition at line 224 of file ftp_server.h.
◆ FtpServerMode
enum FtpServerMode |
Security modes.
Enumerator | |
---|---|
FTP_SERVER_MODE_PLAINTEXT | |
FTP_SERVER_MODE_IMPLICIT_TLS | |
FTP_SERVER_MODE_EXPLICIT_TLS |
Definition at line 253 of file ftp_server.h.
Function Documentation
◆ ftpServerDeinit()
void ftpServerDeinit | ( | FtpServerContext * | context | ) |
Release FTP server context.
- Parameters
-
[in] context Pointer to the FTP server context
Definition at line 541 of file ftp_server.c.
◆ ftpServerGetDefaultSettings()
void ftpServerGetDefaultSettings | ( | FtpServerSettings * | settings | ) |
Initialize settings with default values.
- Parameters
-
[out] settings Structure that contains FTP server settings
Definition at line 60 of file ftp_server.c.
◆ ftpServerInit()
error_t ftpServerInit | ( | FtpServerContext * | context, |
const FtpServerSettings * | settings | ||
) |
FTP server initialization.
- Parameters
-
[in] context Pointer to the FTP server context [in] settings FTP server specific settings
- Returns
- Error code
Definition at line 120 of file ftp_server.c.
◆ ftpServerSetHomeDir()
error_t ftpServerSetHomeDir | ( | FtpClientConnection * | connection, |
const char_t * | homeDir | ||
) |
Set home directory.
- Parameters
-
[in] connection Pointer to the client connection [in] homeDir NULL-terminated string specifying the home directory
- Returns
- Error code
Definition at line 370 of file ftp_server.c.
◆ ftpServerStart()
error_t ftpServerStart | ( | FtpServerContext * | context | ) |
Start FTP server.
- Parameters
-
[in] context Pointer to the FTP server context
- Returns
- Error code
Definition at line 210 of file ftp_server.c.
◆ ftpServerStop()
error_t ftpServerStop | ( | FtpServerContext * | context | ) |
Stop FTP server.
- Parameters
-
[in] context Pointer to the FTP server context
- Returns
- Error code
Definition at line 319 of file ftp_server.c.
◆ ftpServerTask()
void ftpServerTask | ( | FtpServerContext * | context | ) |
FTP server task.
- Parameters
-
[in] context Pointer to the FTP server context
Definition at line 397 of file ftp_server.c.