sftp_server_packet.h File Reference

SFTP packet parsing and formatting. More...

#include "sftp/sftp_server.h"

Go to the source code of this file.

Functions

error_t sftpServerParseFxpInit (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_INIT packet. More...
 
error_t sftpServerParseFxpOpen (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_OPEN packet. More...
 
error_t sftpServerParseFxpClose (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_CLOSE packet. More...
 
error_t sftpServerParseFxpRead (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_READ packet. More...
 
error_t sftpServerParseFxpWrite (SftpServerSession *session, const uint8_t *packet, size_t fragLen, size_t totalLen)
 Parse SSH_FXP_WRITE packet. More...
 
error_t sftpServerParseFxpOpenDir (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_OPENDIR packet. More...
 
error_t sftpServerParseFxpReadDir (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_READDIR packet. More...
 
error_t sftpServerParseFxpRemove (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_REMOVE packet. More...
 
error_t sftpServerParseFxpMkDir (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_MKDIR packet. More...
 
error_t sftpServerParseFxpRmDir (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_RMDIR packet. More...
 
error_t sftpServerParseFxpRealPath (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_REALPATH packet. More...
 
error_t sftpServerParseFxpStat (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_STAT packet. More...
 
error_t sftpServerParseFxpFstat (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_FSTAT packet. More...
 
error_t sftpServerParseFxpSetStat (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_SETSTAT packet. More...
 
error_t sftpServerParseFxpSetFstat (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_FSETSTAT packet. More...
 
error_t sftpServerParseFxpRename (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_RENAME packet. More...
 
error_t sftpServerParseFxpExtended (SftpServerSession *session, const uint8_t *packet, size_t length)
 Parse SSH_FXP_EXTENDED packet. More...
 
error_t sftpFormatFxpVersion (SftpServerSession *session, uint32_t version)
 Format SSH_FXP_VERSION packet. More...
 
error_t sftpFormatFxpStatus (SftpServerSession *session, uint32_t id, uint32_t statusCode, const char_t *message)
 Format SSH_FXP_STATUS message. More...
 
error_t sftpFormatFxpHandle (SftpServerSession *session, uint32_t id, uint32_t handle)
 Format SSH_FXP_HANDLE message. More...
 
error_t sftpFormatFxpData (SftpServerSession *session, uint32_t id, size_t dataLen)
 Format SSH_FXP_DATA message. More...
 
error_t sftpFormatFxpName (SftpServerSession *session, uint32_t id, const SftpName *name)
 Format SSH_FXP_NAME packet. More...
 
error_t sftpFormatFxpAttrs (SftpServerSession *session, uint32_t id, const SftpFileAttrs *attributes)
 Format 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file sftp_server_packet.h.

Function Documentation

◆ sftpFormatFxpAttrs()

error_t sftpFormatFxpAttrs ( SftpServerSession session,
uint32_t  id,
const SftpFileAttrs attributes 
)

Format SSH_FXP_ATTRS packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]idRequest identifier
[in]attributesFile attributes
Returns
Error code

Definition at line 1637 of file sftp_server_packet.c.

◆ sftpFormatFxpData()

error_t sftpFormatFxpData ( SftpServerSession session,
uint32_t  id,
size_t  dataLen 
)

Format SSH_FXP_DATA message.

Parameters
[in]sessionHandle referencing an SFTP session
[in]idRequest identifier
[in]dataLenLength of the data string, in bytes
Returns
Error code

Definition at line 1507 of file sftp_server_packet.c.

◆ sftpFormatFxpHandle()

error_t sftpFormatFxpHandle ( SftpServerSession session,
uint32_t  id,
uint32_t  handle 
)

Format SSH_FXP_HANDLE message.

Parameters
[in]sessionHandle referencing an SFTP session
[in]idRequest identifier
[in]handleOpaque value that identifies a file or directory
Returns
Error code

Definition at line 1445 of file sftp_server_packet.c.

◆ sftpFormatFxpName()

error_t sftpFormatFxpName ( SftpServerSession session,
uint32_t  id,
const SftpName name 
)

Format SSH_FXP_NAME packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]idRequest identifier
[in]namePointer to the name structure
Returns
Error code

Definition at line 1567 of file sftp_server_packet.c.

◆ sftpFormatFxpStatus()

error_t sftpFormatFxpStatus ( SftpServerSession session,
uint32_t  id,
uint32_t  statusCode,
const char_t message 
)

Format SSH_FXP_STATUS message.

Parameters
[in]sessionHandle referencing an SFTP session
[in]idRequest identifier
[in]statusCodeResult of the requested operation
[in]messageNULL-terminating description string
Returns
Error code

Definition at line 1365 of file sftp_server_packet.c.

◆ sftpFormatFxpVersion()

error_t sftpFormatFxpVersion ( SftpServerSession session,
uint32_t  version 
)

Format SSH_FXP_VERSION packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]versionProtocol version number
Returns
Error code

Definition at line 1313 of file sftp_server_packet.c.

◆ sftpServerParseFxpClose()

error_t sftpServerParseFxpClose ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_CLOSE packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 195 of file sftp_server_packet.c.

◆ sftpServerParseFxpExtended()

error_t sftpServerParseFxpExtended ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_EXTENDED packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 1262 of file sftp_server_packet.c.

◆ sftpServerParseFxpFstat()

error_t sftpServerParseFxpFstat ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_FSTAT packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 959 of file sftp_server_packet.c.

◆ sftpServerParseFxpInit()

error_t sftpServerParseFxpInit ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_INIT packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 56 of file sftp_server_packet.c.

◆ sftpServerParseFxpMkDir()

error_t sftpServerParseFxpMkDir ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_MKDIR packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 679 of file sftp_server_packet.c.

◆ sftpServerParseFxpOpen()

error_t sftpServerParseFxpOpen ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_OPEN packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 98 of file sftp_server_packet.c.

◆ sftpServerParseFxpOpenDir()

error_t sftpServerParseFxpOpenDir ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_OPENDIR packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 462 of file sftp_server_packet.c.

◆ sftpServerParseFxpRead()

error_t sftpServerParseFxpRead ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_READ packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 269 of file sftp_server_packet.c.

◆ sftpServerParseFxpReadDir()

error_t sftpServerParseFxpReadDir ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_READDIR packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 534 of file sftp_server_packet.c.

◆ sftpServerParseFxpRealPath()

error_t sftpServerParseFxpRealPath ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_REALPATH packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 825 of file sftp_server_packet.c.

◆ sftpServerParseFxpRemove()

error_t sftpServerParseFxpRemove ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_REMOVE packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 612 of file sftp_server_packet.c.

◆ sftpServerParseFxpRename()

error_t sftpServerParseFxpRename ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_RENAME packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 1184 of file sftp_server_packet.c.

◆ sftpServerParseFxpRmDir()

error_t sftpServerParseFxpRmDir ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_RMDIR packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 758 of file sftp_server_packet.c.

◆ sftpServerParseFxpSetFstat()

error_t sftpServerParseFxpSetFstat ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_FSETSTAT packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 1105 of file sftp_server_packet.c.

◆ sftpServerParseFxpSetStat()

error_t sftpServerParseFxpSetStat ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_SETSTAT packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 1025 of file sftp_server_packet.c.

◆ sftpServerParseFxpStat()

error_t sftpServerParseFxpStat ( SftpServerSession session,
const uint8_t *  packet,
size_t  length 
)

Parse SSH_FXP_STAT packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 892 of file sftp_server_packet.c.

◆ sftpServerParseFxpWrite()

error_t sftpServerParseFxpWrite ( SftpServerSession session,
const uint8_t *  packet,
size_t  fragLen,
size_t  totalLen 
)

Parse SSH_FXP_WRITE packet.

Parameters
[in]sessionHandle referencing an SFTP session
[in]packetPointer to packet
[in]fragLenNumber of bytes available on hand
[in]totalLenTotal length of the packet, in bytes
Returns
Error code

Definition at line 375 of file sftp_server_packet.c.