SFTP server. More...
Go to the source code of this file.
Data Structures | |
struct | SftpFileObject |
File or directory object. More... | |
struct | SftpServerSettings |
SFTP server settings. More... | |
struct | _SftpServerSession |
SFTP session. More... | |
struct | _SftpServerContext |
SFTP server context. More... | |
Macros | |
#define | SFTP_SERVER_SUPPORT DISABLED |
#define | SFTP_SERVER_STACK_SIZE 650 |
#define | SFTP_SERVER_PRIORITY OS_TASK_PRIORITY_NORMAL |
#define | SFTP_SERVER_MAX_SESSIONS 10 |
#define | SFTP_SERVER_TICK_INTERVAL 1000 |
#define | SFTP_SERVER_MIN_VERSION 1 |
#define | SFTP_SERVER_MAX_VERSION 3 |
#define | SFTP_SERVER_BUFFER_SIZE 1024 |
#define | SFTP_SERVER_MAX_ROOT_DIR_LEN 63 |
#define | SFTP_SERVER_MAX_HOME_DIR_LEN 63 |
#define | SFTP_SERVER_MAX_PATH_LEN 255 |
#define | SftpServerContext struct _SftpServerContext |
#define | SftpServerSession struct _SftpServerSession |
Typedefs | |
typedef SftpAccessStatus(* | SftpServerCheckUserCallback) (SftpServerSession *session, const char_t *user) |
User verification callback function. More... | |
typedef uint_t(* | SftpServerGetFilePermCallback) (SftpServerSession *session, const char_t *user, const char_t *path) |
Callback used to retrieve file permissions. More... | |
Enumerations | |
enum | SftpAccessStatus { SFTP_ACCESS_DENIED = 0, SFTP_ACCESS_ALLOWED = 1 } |
Access status. More... | |
enum | SFtpFilePerm { SFTP_FILE_PERM_LIST = 0x01, SFTP_FILE_PERM_READ = 0x02, SFTP_FILE_PERM_WRITE = 0x04 } |
File permissions. More... | |
enum | SftpServerSessionState { SFTP_SERVER_SESSION_STATE_CLOSED = 0, SFTP_SERVER_SESSION_STATE_RECEIVING = 1, SFTP_SERVER_SESSION_STATE_SENDING = 2, SFTP_SERVER_SESSION_STATE_RECEIVING_DATA = 3, SFTP_SERVER_SESSION_STATE_SENDING_DATA = 4 } |
SFTP session state. More... | |
Functions | |
void | sftpServerGetDefaultSettings (SftpServerSettings *settings) |
Initialize settings with default values. More... | |
error_t | sftpServerInit (SftpServerContext *context, const SftpServerSettings *settings) |
Initialize SFTP server context. More... | |
error_t | sftpServerStart (SftpServerContext *context) |
Start SFTP server. More... | |
error_t | sftpServerStop (SftpServerContext *context) |
Stop SFTP server. More... | |
error_t | sftpServerSetRootDir (SftpServerSession *session, const char_t *rootDir) |
Set user's root directory. More... | |
error_t | sftpServerSetHomeDir (SftpServerSession *session, const char_t *homeDir) |
Set user's home directory. More... | |
void | sftpServerTask (void *param) |
SFTP server task. More... | |
void | sftpServerDeinit (SftpServerContext *context) |
Release SFTP server context. More... | |
Detailed Description
SFTP server.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneSSH 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 sftp_server.h.
Macro Definition Documentation
◆ SFTP_SERVER_BUFFER_SIZE
#define SFTP_SERVER_BUFFER_SIZE 1024 |
Definition at line 88 of file sftp_server.h.
◆ SFTP_SERVER_MAX_HOME_DIR_LEN
#define SFTP_SERVER_MAX_HOME_DIR_LEN 63 |
Definition at line 102 of file sftp_server.h.
◆ SFTP_SERVER_MAX_PATH_LEN
#define SFTP_SERVER_MAX_PATH_LEN 255 |
Definition at line 109 of file sftp_server.h.
◆ SFTP_SERVER_MAX_ROOT_DIR_LEN
#define SFTP_SERVER_MAX_ROOT_DIR_LEN 63 |
Definition at line 95 of file sftp_server.h.
◆ SFTP_SERVER_MAX_SESSIONS
#define SFTP_SERVER_MAX_SESSIONS 10 |
Definition at line 60 of file sftp_server.h.
◆ SFTP_SERVER_MAX_VERSION
#define SFTP_SERVER_MAX_VERSION 3 |
Definition at line 81 of file sftp_server.h.
◆ SFTP_SERVER_MIN_VERSION
#define SFTP_SERVER_MIN_VERSION 1 |
Definition at line 74 of file sftp_server.h.
◆ SFTP_SERVER_PRIORITY
#define SFTP_SERVER_PRIORITY OS_TASK_PRIORITY_NORMAL |
Definition at line 55 of file sftp_server.h.
◆ SFTP_SERVER_STACK_SIZE
#define SFTP_SERVER_STACK_SIZE 650 |
Definition at line 48 of file sftp_server.h.
◆ SFTP_SERVER_SUPPORT
#define SFTP_SERVER_SUPPORT DISABLED |
Definition at line 41 of file sftp_server.h.
◆ SFTP_SERVER_TICK_INTERVAL
#define SFTP_SERVER_TICK_INTERVAL 1000 |
Definition at line 67 of file sftp_server.h.
◆ SftpServerContext
#define SftpServerContext struct _SftpServerContext |
Definition at line 116 of file sftp_server.h.
◆ SftpServerSession
#define SftpServerSession struct _SftpServerSession |
Definition at line 120 of file sftp_server.h.
Typedef Documentation
◆ SftpServerCheckUserCallback
typedef SftpAccessStatus(* SftpServerCheckUserCallback) (SftpServerSession *session, const char_t *user) |
User verification callback function.
Definition at line 169 of file sftp_server.h.
◆ SftpServerGetFilePermCallback
typedef uint_t(* SftpServerGetFilePermCallback) (SftpServerSession *session, const char_t *user, const char_t *path) |
Callback used to retrieve file permissions.
Definition at line 177 of file sftp_server.h.
Enumeration Type Documentation
◆ SftpAccessStatus
enum SftpAccessStatus |
Access status.
Enumerator | |
---|---|
SFTP_ACCESS_DENIED | |
SFTP_ACCESS_ALLOWED |
Definition at line 132 of file sftp_server.h.
◆ SFtpFilePerm
enum SFtpFilePerm |
File permissions.
Enumerator | |
---|---|
SFTP_FILE_PERM_LIST | |
SFTP_FILE_PERM_READ | |
SFTP_FILE_PERM_WRITE |
Definition at line 143 of file sftp_server.h.
◆ SftpServerSessionState
SFTP session state.
Enumerator | |
---|---|
SFTP_SERVER_SESSION_STATE_CLOSED | |
SFTP_SERVER_SESSION_STATE_RECEIVING | |
SFTP_SERVER_SESSION_STATE_SENDING | |
SFTP_SERVER_SESSION_STATE_RECEIVING_DATA | |
SFTP_SERVER_SESSION_STATE_SENDING_DATA |
Definition at line 155 of file sftp_server.h.
Function Documentation
◆ sftpServerDeinit()
void sftpServerDeinit | ( | SftpServerContext * | context | ) |
Release SFTP server context.
- Parameters
-
[in] context Pointer to the SFTP server context
Definition at line 457 of file sftp_server.c.
◆ sftpServerGetDefaultSettings()
void sftpServerGetDefaultSettings | ( | SftpServerSettings * | settings | ) |
Initialize settings with default values.
- Parameters
-
[out] settings Structure that contains SFTP server settings
Definition at line 50 of file sftp_server.c.
◆ sftpServerInit()
error_t sftpServerInit | ( | SftpServerContext * | context, |
const SftpServerSettings * | settings | ||
) |
Initialize SFTP server context.
- Parameters
-
[in] context Pointer to the SFTP server context [in] settings SFTP server specific settings
- Returns
- Error code
Definition at line 85 of file sftp_server.c.
◆ sftpServerSetHomeDir()
error_t sftpServerSetHomeDir | ( | SftpServerSession * | session, |
const char_t * | homeDir | ||
) |
Set user's home directory.
- Parameters
-
[in] session Handle referencing an SFTP session [in] homeDir NULL-terminated string specifying the home directory
- Returns
- Error code
Definition at line 331 of file sftp_server.c.
◆ sftpServerSetRootDir()
error_t sftpServerSetRootDir | ( | SftpServerSession * | session, |
const char_t * | rootDir | ||
) |
Set user's root directory.
- Parameters
-
[in] session Handle referencing an SFTP session [in] rootDir NULL-terminated string specifying the root directory
- Returns
- Error code
Definition at line 297 of file sftp_server.c.
◆ sftpServerStart()
error_t sftpServerStart | ( | SftpServerContext * | context | ) |
Start SFTP server.
- Parameters
-
[in] context Pointer to the SFTP server context
- Returns
- Error code
Definition at line 183 of file sftp_server.c.
◆ sftpServerStop()
error_t sftpServerStop | ( | SftpServerContext * | context | ) |
Stop SFTP server.
- Parameters
-
[in] context Pointer to the SFTP server context
- Returns
- Error code
Definition at line 242 of file sftp_server.c.
◆ sftpServerTask()
void sftpServerTask | ( | void * | param | ) |
SFTP server task.
- Parameters
-
[in] param Pointer to the SFTP server context
Definition at line 360 of file sftp_server.c.