Helper functions for FTP server. More...
#include "ftp/ftp_server.h"
#include "ftp/ftp_server_control.h"
#include "ftp/ftp_server_data.h"
#include "ftp/ftp_server_misc.h"
#include "path.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL FTP_TRACE_LEVEL |
Functions | |
void | ftpServerTick (FtpServerContext *context) |
Handle periodic operations. More... | |
uint16_t | ftpServerGetPassivePort (FtpServerContext *context) |
Get a passive port number. More... | |
error_t | ftpServerGetPath (FtpClientConnection *connection, const char_t *inputPath, char_t *outputPath, size_t maxLen) |
Retrieve the full pathname. More... | |
uint_t | ftpServerGetFilePermissions (FtpClientConnection *connection, const char_t *path) |
Get permissions for the specified file or directory. More... | |
size_t | ftpServerFormatDirEntry (const FsDirEntry *dirEntry, uint_t perm, char_t *buffer) |
Format a directory entry in UNIX-style format. More... | |
const char_t * | ftpServerStripRootDir (FtpServerContext *context, const char_t *path) |
Strip root dir from specified pathname. More... | |
const char_t * | ftpServerStripHomeDir (FtpClientConnection *connection, const char_t *path) |
Strip home directory from specified pathname. More... | |
void | ftpServerCloseConnection (FtpClientConnection *connection) |
Close client connection properly. More... | |
Detailed Description
Helper functions for FTP server.
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_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL FTP_TRACE_LEVEL |
Definition at line 32 of file ftp_server_misc.c.
Function Documentation
◆ ftpServerCloseConnection()
void ftpServerCloseConnection | ( | FtpClientConnection * | connection | ) |
Close client connection properly.
- Parameters
-
[in] connection Pointer to the client connection to be closed
Definition at line 398 of file ftp_server_misc.c.
◆ ftpServerFormatDirEntry()
size_t ftpServerFormatDirEntry | ( | const FsDirEntry * | dirEntry, |
uint_t | perm, | ||
char_t * | buffer | ||
) |
Format a directory entry in UNIX-style format.
- Parameters
-
[in] dirEntry Pointer to the directory entry [in] perm Access rights for the specified file [out] buffer Buffer where to format the directory entry
- Returns
- Length of resulting string, in bytes
Definition at line 233 of file ftp_server_misc.c.
◆ ftpServerGetFilePermissions()
uint_t ftpServerGetFilePermissions | ( | FtpClientConnection * | connection, |
const char_t * | path | ||
) |
Get permissions for the specified file or directory.
- Parameters
-
[in] connection Pointer to the client connection [in] path Canonical path of the file
- Returns
- Access rights for the specified file
Definition at line 182 of file ftp_server_misc.c.
◆ ftpServerGetPassivePort()
uint16_t ftpServerGetPassivePort | ( | FtpServerContext * | context | ) |
Get a passive port number.
- Parameters
-
[in] context Pointer to the FTP server context
- Returns
- Passive port number
Definition at line 88 of file ftp_server_misc.c.
◆ ftpServerGetPath()
error_t ftpServerGetPath | ( | FtpClientConnection * | connection, |
const char_t * | inputPath, | ||
char_t * | outputPath, | ||
size_t | maxLen | ||
) |
Retrieve the full pathname.
- Parameters
-
[in] connection Pointer to the client connection [in] inputPath Relative or absolute path [out] outputPath Resulting full path [in] maxLen Maximum acceptable path length
- Returns
- Error code
Definition at line 130 of file ftp_server_misc.c.
◆ ftpServerStripHomeDir()
const char_t* ftpServerStripHomeDir | ( | FtpClientConnection * | connection, |
const char_t * | path | ||
) |
Strip home directory from specified pathname.
- Parameters
-
[in] connection Pointer to the client connection [in] path input pathname
- Returns
- Resulting pathname with home directory stripped
Definition at line 362 of file ftp_server_misc.c.
◆ ftpServerStripRootDir()
const char_t* ftpServerStripRootDir | ( | FtpServerContext * | context, |
const char_t * | path | ||
) |
Strip root dir from specified pathname.
- Parameters
-
[in] context Pointer to the FTP server context [in] path input pathname
- Returns
- Resulting pathname with root dir stripped
Definition at line 324 of file ftp_server_misc.c.
◆ ftpServerTick()
void ftpServerTick | ( | FtpServerContext * | context | ) |
Handle periodic operations.
- Parameters
-
[in] context Pointer to the FTP server context
Definition at line 51 of file ftp_server_misc.c.