SFTP packet parsing and formatting. More...
#include "ssh/ssh.h"
#include "ssh/ssh_misc.h"
#include "sftp/sftp_client_packet.h"
#include "sftp/sftp_client_misc.h"
#include "path.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL SFTP_TRACE_LEVEL |
Functions | |
error_t | sftpClientFormatFxpInit (SftpClientContext *context, uint32_t version) |
Format SSH_FXP_INIT packet. More... | |
error_t | sftpClientFormatFxpOpen (SftpClientContext *context, const char_t *filename, uint32_t pflags) |
Format SSH_FXP_OPEN packet. More... | |
error_t | sftpClientFormatFxpClose (SftpClientContext *context, const uint8_t *handle, size_t handleLen) |
Format SSH_FXP_CLOSE packet. More... | |
error_t | sftpClientFormatFxpRead (SftpClientContext *context, const uint8_t *handle, size_t handleLen, uint64_t offset, uint32_t dataLen) |
Format SSH_FXP_READ packet. More... | |
error_t | sftpClientFormatFxpWrite (SftpClientContext *context, const uint8_t *handle, size_t handleLen, uint64_t offset, uint32_t dataLen) |
Format SSH_FXP_WRITE packet. More... | |
error_t | sftpClientFormatFxpOpenDir (SftpClientContext *context, const char_t *path) |
Format SSH_FXP_OPENDIR packet. More... | |
error_t | sftpClientFormatFxpReadDir (SftpClientContext *context, const uint8_t *handle, size_t handleLen) |
Format SSH_FXP_READDIR packet. More... | |
error_t | sftpClientFormatFxpRemove (SftpClientContext *context, const char_t *filename) |
Format SSH_FXP_REMOVE packet. More... | |
error_t | sftpClientFormatFxpMkDir (SftpClientContext *context, const char_t *path) |
Format SSH_FXP_MKDIR packet. More... | |
error_t | sftpClientFormatFxpRmDir (SftpClientContext *context, const char_t *path) |
Format SSH_FXP_RMDIR packet. More... | |
error_t | sftpClientFormatFxpRealPath (SftpClientContext *context, const char_t *path) |
Format SSH_FXP_REALPATH packet. More... | |
error_t | sftpClientFormatFxpStat (SftpClientContext *context, const char_t *path) |
Format SSH_FXP_STAT packet. More... | |
error_t | sftpClientFormatFxpRename (SftpClientContext *context, const char_t *oldPath, const char_t *newPath) |
Format SSH_FXP_RENAME packet. More... | |
error_t | sftpClientParseFxpVersion (SftpClientContext *context, const uint8_t *packet, size_t length) |
Parse SSH_FXP_VERSION packet. More... | |
error_t | sftpClientParseFxpStatus (SftpClientContext *context, const uint8_t *packet, size_t length) |
Parse SSH_FXP_STATUS packet. More... | |
error_t | sftpClientParseFxpHandle (SftpClientContext *context, const uint8_t *packet, size_t length) |
Parse SSH_FXP_HANDLE packet. More... | |
error_t | sftpClientParseFxpData (SftpClientContext *context, const uint8_t *packet, size_t fragLen, size_t totalLen) |
Parse SSH_FXP_DATA packet. More... | |
error_t | sftpClientParseFxpName (SftpClientContext *context, const uint8_t *packet, size_t fragLen, size_t totalLen) |
Parse SSH_FXP_NAME packet. More... | |
error_t | sftpClientParseFxpAttrs (SftpClientContext *context, const uint8_t *packet, size_t length) |
Parse SSH_FXP_ATTRS packet. More... | |
Detailed Description
SFTP packet parsing and formatting.
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_client_packet.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL SFTP_TRACE_LEVEL |
Definition at line 32 of file sftp_client_packet.c.
Function Documentation
◆ sftpClientFormatFxpClose()
error_t sftpClientFormatFxpClose | ( | SftpClientContext * | context, |
const uint8_t * | handle, | ||
size_t | handleLen | ||
) |
Format SSH_FXP_CLOSE packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] handle File handle returned by SSH_FXP_OPEN or SSH_FXP_OPENDIR [in] handleLen Length of the handle string, in bytes
- Returns
- Error code
Definition at line 197 of file sftp_client_packet.c.
◆ sftpClientFormatFxpInit()
error_t sftpClientFormatFxpInit | ( | SftpClientContext * | context, |
uint32_t | version | ||
) |
Format SSH_FXP_INIT packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] version Protocol version number
- Returns
- Error code
Definition at line 53 of file sftp_client_packet.c.
◆ sftpClientFormatFxpMkDir()
error_t sftpClientFormatFxpMkDir | ( | SftpClientContext * | context, |
const char_t * | path | ||
) |
Format SSH_FXP_MKDIR packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] path Directory to be created
- Returns
- Error code
Definition at line 652 of file sftp_client_packet.c.
◆ sftpClientFormatFxpOpen()
error_t sftpClientFormatFxpOpen | ( | SftpClientContext * | context, |
const char_t * | filename, | ||
uint32_t | pflags | ||
) |
Format SSH_FXP_OPEN packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] filename Name to the file to be be opened or created [in] pflags File access mode
- Returns
- Error code
Definition at line 106 of file sftp_client_packet.c.
◆ sftpClientFormatFxpOpenDir()
error_t sftpClientFormatFxpOpenDir | ( | SftpClientContext * | context, |
const char_t * | path | ||
) |
Format SSH_FXP_OPENDIR packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] path Path name of the directory to be listed
- Returns
- Error code
Definition at line 446 of file sftp_client_packet.c.
◆ sftpClientFormatFxpRead()
error_t sftpClientFormatFxpRead | ( | SftpClientContext * | context, |
const uint8_t * | handle, | ||
size_t | handleLen, | ||
uint64_t | offset, | ||
uint32_t | dataLen | ||
) |
Format SSH_FXP_READ packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] handle File handle returned by SSH_FXP_OPEN [in] handleLen Length of the handle string, in bytes [in] offset Offset relative to the beginning of the file from where to start reading [in] dataLen Maximum number of bytes to read
- Returns
- Error code
Definition at line 270 of file sftp_client_packet.c.
◆ sftpClientFormatFxpReadDir()
error_t sftpClientFormatFxpReadDir | ( | SftpClientContext * | context, |
const uint8_t * | handle, | ||
size_t | handleLen | ||
) |
Format SSH_FXP_READDIR packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] handle File handle returned by SSH_FXP_OPENDIR [in] handleLen Length of the handle string, in bytes
- Returns
- Error code
Definition at line 515 of file sftp_client_packet.c.
◆ sftpClientFormatFxpRealPath()
error_t sftpClientFormatFxpRealPath | ( | SftpClientContext * | context, |
const char_t * | path | ||
) |
Format SSH_FXP_REALPATH packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] path Path name to be canonicalized
- Returns
- Error code
Definition at line 802 of file sftp_client_packet.c.
◆ sftpClientFormatFxpRemove()
error_t sftpClientFormatFxpRemove | ( | SftpClientContext * | context, |
const char_t * | filename | ||
) |
Format SSH_FXP_REMOVE packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] filename Name of the file to be removed
- Returns
- Error code
Definition at line 584 of file sftp_client_packet.c.
◆ sftpClientFormatFxpRename()
error_t sftpClientFormatFxpRename | ( | SftpClientContext * | context, |
const char_t * | oldPath, | ||
const char_t * | newPath | ||
) |
Format SSH_FXP_RENAME packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] oldPath Name of an existing file or directory [in] newPath New name for the file or directory
- Returns
- Error code
Definition at line 940 of file sftp_client_packet.c.
◆ sftpClientFormatFxpRmDir()
error_t sftpClientFormatFxpRmDir | ( | SftpClientContext * | context, |
const char_t * | path | ||
) |
Format SSH_FXP_RMDIR packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] path Directory to be removed
- Returns
- Error code
Definition at line 734 of file sftp_client_packet.c.
◆ sftpClientFormatFxpStat()
error_t sftpClientFormatFxpStat | ( | SftpClientContext * | context, |
const char_t * | path | ||
) |
Format SSH_FXP_STAT packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] path File system object for which status is to be returned
- Returns
- Error code
Definition at line 870 of file sftp_client_packet.c.
◆ sftpClientFormatFxpWrite()
error_t sftpClientFormatFxpWrite | ( | SftpClientContext * | context, |
const uint8_t * | handle, | ||
size_t | handleLen, | ||
uint64_t | offset, | ||
uint32_t | dataLen | ||
) |
Format SSH_FXP_WRITE packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] handle File handle returned by SSH_FXP_OPEN [in] handleLen Length of the handle string, in bytes [in] offset Offset relative to the beginning of the file from where to start writing [in] dataLen Length of the data to be written
- Returns
- Error code
Definition at line 360 of file sftp_client_packet.c.
◆ sftpClientParseFxpAttrs()
error_t sftpClientParseFxpAttrs | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | length | ||
) |
Parse SSH_FXP_ATTRS packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] length Length of the packet, in bytes
- Returns
- Error code
Definition at line 1469 of file sftp_client_packet.c.
◆ sftpClientParseFxpData()
error_t sftpClientParseFxpData | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | fragLen, | ||
size_t | totalLen | ||
) |
Parse SSH_FXP_DATA packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] fragLen Number of bytes available on hand [in] totalLen Total length of the packet, in bytes
- Returns
- Error code
Definition at line 1293 of file sftp_client_packet.c.
◆ sftpClientParseFxpHandle()
error_t sftpClientParseFxpHandle | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | length | ||
) |
Parse SSH_FXP_HANDLE packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] length Length of the packet, in bytes
- Returns
- Error code
Definition at line 1214 of file sftp_client_packet.c.
◆ sftpClientParseFxpName()
error_t sftpClientParseFxpName | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | fragLen, | ||
size_t | totalLen | ||
) |
Parse SSH_FXP_NAME packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] fragLen Number of bytes available on hand [in] totalLen Total length of the packet, in bytes
- Returns
- Error code
Definition at line 1368 of file sftp_client_packet.c.
◆ sftpClientParseFxpStatus()
error_t sftpClientParseFxpStatus | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | length | ||
) |
Parse SSH_FXP_STATUS packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] length Length of the packet, in bytes
- Returns
- Error code
Definition at line 1095 of file sftp_client_packet.c.
◆ sftpClientParseFxpVersion()
error_t sftpClientParseFxpVersion | ( | SftpClientContext * | context, |
const uint8_t * | packet, | ||
size_t | length | ||
) |
Parse SSH_FXP_VERSION packet.
- Parameters
-
[in] context Pointer to the SFTP client context [in] packet Pointer to packet [in] length Length of the packet, in bytes
- Returns
- Error code
Definition at line 1019 of file sftp_client_packet.c.