sftp_server_packet.h
Go to the documentation of this file.
1 /**
2  * @file sftp_server_packet.h
3  * @brief SFTP packet parsing and formatting
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSH Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _SFTP_SERVER_PACKET_H
32 #define _SFTP_SERVER_PACKET_H
33 
34 //Dependencies
35 #include "sftp/sftp_server.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //SFTP server related functions
44  const uint8_t *packet, size_t length);
45 
47  const uint8_t *packet, size_t length);
48 
50  const uint8_t *packet, size_t length);
51 
53  const uint8_t *packet, size_t length);
54 
56  const uint8_t *packet, size_t fragLen, size_t totalLen);
57 
59  const uint8_t *packet, size_t length);
60 
62  const uint8_t *packet, size_t length);
63 
65  const uint8_t *packet, size_t length);
66 
68  const uint8_t *packet, size_t length);
69 
71  const uint8_t *packet, size_t length);
72 
74  const uint8_t *packet, size_t length);
75 
77  const uint8_t *packet, size_t length);
78 
80  const uint8_t *packet, size_t length);
81 
83  const uint8_t *packet, size_t length);
84 
86  const uint8_t *packet, size_t length);
87 
89  const uint8_t *packet, size_t length);
90 
92  const uint8_t *packet, size_t length);
93 
95 
96 error_t sftpFormatFxpStatus(SftpServerSession *session, uint32_t id,
97  uint32_t statusCode, const char_t *message);
98 
99 error_t sftpFormatFxpHandle(SftpServerSession *session, uint32_t id,
100  uint32_t handle);
101 
102 error_t sftpFormatFxpData(SftpServerSession *session, uint32_t id,
103  size_t dataLen);
104 
105 error_t sftpFormatFxpName(SftpServerSession *session, uint32_t id,
106  const SftpName *name);
107 
108 error_t sftpFormatFxpAttrs(SftpServerSession *session, uint32_t id,
109  const SftpFileAttrs *attributes);
110 
111 //C++ guard
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t version
Definition: coap_common.h:177
char char_t
Definition: compiler_port.h:48
error_t
Error codes.
Definition: error.h:43
uint8_t attributes[]
Definition: radius.h:88
char_t name[]
uint32_t dataLen
Definition: sftp_common.h:229
SFTP server.
#define SftpServerSession
Definition: sftp_server.h:120
error_t sftpServerParseFxpExtended(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_EXTENDED packet.
error_t sftpServerParseFxpOpenDir(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_OPENDIR packet.
error_t sftpFormatFxpHandle(SftpServerSession *session, uint32_t id, uint32_t handle)
Format SSH_FXP_HANDLE message.
error_t sftpServerParseFxpRead(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_READ packet.
error_t sftpServerParseFxpWrite(SftpServerSession *session, const uint8_t *packet, size_t fragLen, size_t totalLen)
Parse SSH_FXP_WRITE packet.
error_t sftpServerParseFxpSetFstat(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_FSETSTAT packet.
error_t sftpServerParseFxpSetStat(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_SETSTAT packet.
error_t sftpFormatFxpVersion(SftpServerSession *session, uint32_t version)
Format SSH_FXP_VERSION packet.
error_t sftpServerParseFxpRemove(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_REMOVE packet.
error_t sftpServerParseFxpClose(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_CLOSE packet.
error_t sftpServerParseFxpRename(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_RENAME packet.
error_t sftpFormatFxpAttrs(SftpServerSession *session, uint32_t id, const SftpFileAttrs *attributes)
Format SSH_FXP_ATTRS packet.
error_t sftpServerParseFxpRmDir(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_RMDIR packet.
error_t sftpFormatFxpName(SftpServerSession *session, uint32_t id, const SftpName *name)
Format SSH_FXP_NAME packet.
error_t sftpServerParseFxpFstat(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_FSTAT packet.
error_t sftpFormatFxpData(SftpServerSession *session, uint32_t id, size_t dataLen)
Format SSH_FXP_DATA message.
error_t sftpFormatFxpStatus(SftpServerSession *session, uint32_t id, uint32_t statusCode, const char_t *message)
Format SSH_FXP_STATUS message.
error_t sftpServerParseFxpInit(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_INIT packet.
error_t sftpServerParseFxpOpen(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_OPEN packet.
error_t sftpServerParseFxpStat(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_STAT packet.
error_t sftpServerParseFxpReadDir(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_READDIR packet.
error_t sftpServerParseFxpMkDir(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_MKDIR packet.
error_t sftpServerParseFxpRealPath(SftpServerSession *session, const uint8_t *packet, size_t length)
Parse SSH_FXP_REALPATH packet.
File attributes.
Definition: sftp_common.h:247
Name structure.
Definition: sftp_common.h:265
uint8_t length
Definition: tcp.h:368