File operations. More...
#include "sftp/sftp_server.h"Go to the source code of this file.
Detailed Description
File operations.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2019-2025 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.5.4
Definition in file sftp_server_file.h.
Function Documentation
◆ sftpServerCloseFile()
| error_t sftpServerCloseFile | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle | ||
| ) |
Close a file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle File handle returned by SSH_FXP_OPEN
- Returns
- Error code
Definition at line 780 of file sftp_server_file.c.
◆ sftpServerFindFile()
| SftpFileObject* sftpServerFindFile | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle | ||
| ) |
Find the file that matches a given handle.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle Opaque variable-length string
- Returns
- Pointer to the matching file object
Definition at line 821 of file sftp_server_file.c.
◆ sftpServerGetFileStat()
| error_t sftpServerGetFileStat | ( | SftpServerSession * | session, |
| const SshString * | path, | ||
| SftpFileAttrs * | attributes | ||
| ) |
Retrieve file attributes.
- Parameters
-
[in] session Handle referencing an SFTP session [in] path Path name of the file for which status is to be returned [out] attributes File attributes
- Returns
- Error code
Definition at line 93 of file sftp_server_file.c.
◆ sftpServerGetFileStatEx()
| error_t sftpServerGetFileStatEx | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle, | ||
| SftpFileAttrs * | attributes | ||
| ) |
Retrieve file attributes.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle Opaque value that identifies the file [out] attributes File attributes
- Returns
- Error code
Definition at line 191 of file sftp_server_file.c.
◆ sftpServerGetRealPath()
| error_t sftpServerGetRealPath | ( | SftpServerSession * | session, |
| const SshString * | path, | ||
| SftpName * | name | ||
| ) |
Canonicalize a given path name to an absolute path.
- Parameters
-
[in] session Handle referencing an SFTP session [in] path Path name to be canonicalized [out] name Name in canonical form
- Returns
- Error code
Definition at line 53 of file sftp_server_file.c.
◆ sftpServerOpenFile()
| error_t sftpServerOpenFile | ( | SftpServerSession * | session, |
| const SshString * | path, | ||
| uint32_t | pflags, | ||
| const SftpFileAttrs * | attributes, | ||
| uint32_t * | handle | ||
| ) |
Open a file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] path Path name of the file [in] pflags Bitmask that specifies the desired access mode [in] attributes Initial attributes for the file [out] handle Opaque value that identifies the file
- Returns
- Error code
Definition at line 397 of file sftp_server_file.c.
◆ sftpServerReadData()
| error_t sftpServerReadData | ( | SftpServerSession * | session | ) |
Read data from the specified file.
- Parameters
-
[in] session Handle referencing an SFTP session
- Returns
- error
Definition at line 731 of file sftp_server_file.c.
◆ sftpServerReadFile()
| error_t sftpServerReadFile | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle, | ||
| uint64_t | offset, | ||
| uint32_t * | length | ||
| ) |
Read the specified file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle Opaque value that identifies the file [in] offset Offset relative to the beginning of the file from where to start reading [in,out] length Maximum number of bytes to read (input value) and actual length of the data (output value)
- Returns
- Error code
Definition at line 660 of file sftp_server_file.c.
◆ sftpServerRemoveFile()
| error_t sftpServerRemoveFile | ( | SftpServerSession * | session, |
| const SshString * | path | ||
| ) |
Remove a file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] path Pathname of the file to be removed
- Returns
- Error code
Definition at line 356 of file sftp_server_file.c.
◆ sftpServerRenameFile()
| error_t sftpServerRenameFile | ( | SftpServerSession * | session, |
| const SshString * | oldPath, | ||
| const SshString * | newPath | ||
| ) |
Rename the specified file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] oldPath Pathname of the file to be renamed [in] newPath New filename
- Returns
- Error code
Definition at line 302 of file sftp_server_file.c.
◆ sftpServerSetFileStat()
| error_t sftpServerSetFileStat | ( | SftpServerSession * | session, |
| const SshString * | path, | ||
| const SftpFileAttrs * | attributes | ||
| ) |
Modify file attributes.
- Parameters
-
[in] session Handle referencing an SFTP session [in] path Path name of the file [in] attributes File attributes
- Returns
- Error code
Definition at line 231 of file sftp_server_file.c.
◆ sftpServerSetFileStatEx()
| error_t sftpServerSetFileStatEx | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle, | ||
| const SftpFileAttrs * | attributes | ||
| ) |
Modify file attributes.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle Opaque value that identifies the file [in] attributes File attributes
- Returns
- Error code
Definition at line 267 of file sftp_server_file.c.
◆ sftpServerWriteData()
| error_t sftpServerWriteData | ( | SftpServerSession * | session | ) |
Write data to the specified file.
- Parameters
-
[in] session Handle referencing an SFTP session
- Returns
- Error code
Definition at line 623 of file sftp_server_file.c.
◆ sftpServerWriteFile()
| error_t sftpServerWriteFile | ( | SftpServerSession * | session, |
| const SshBinaryString * | handle, | ||
| uint64_t | offset, | ||
| const uint8_t * | data, | ||
| uint32_t | fragLen, | ||
| uint32_t | totalLen | ||
| ) |
Write the specified file.
- Parameters
-
[in] session Handle referencing an SFTP session [in] handle Opaque value that identifies the file [in] offset Offset from the beginning of the file where to start writing [in] data Data to be written [in] fragLen Number of bytes available on hand [in] totalLen Total length of the data, in bytes
- Returns
- Error code
Definition at line 561 of file sftp_server_file.c.
