Go to the documentation of this file.
31 #ifndef _SFTP_COMMON_H
32 #define _SFTP_COMMON_H
39 #define SFTP_180_DAYS (180 * 86400)
42 #define SSH_FXF_READ 0x00000001
43 #define SSH_FXF_WRITE 0x00000002
44 #define SSH_FXF_APPEND 0x00000004
45 #define SSH_FXF_CREAT 0x00000008
46 #define SSH_FXF_TRUNC 0x00000010
47 #define SSH_FXF_EXCL 0x00000020
50 #define SSH_FILEXFER_ATTR_SIZE 0x00000001
51 #define SSH_FILEXFER_ATTR_UIDGID 0x00000002
52 #define SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
53 #define SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
54 #define SSH_FILEXFER_ATTR_ACCESSTIME 0x00000008
55 #define SSH_FILEXFER_ATTR_CREATETIME 0x00000010
56 #define SSH_FILEXFER_ATTR_MODIFYTIME 0x00000020
57 #define SSH_FILEXFER_ATTR_ACL 0x00000040
58 #define SSH_FILEXFER_ATTR_OWNERGROUP 0x00000080
59 #define SSH_FILEXFER_ATTR_SUBSECOND_TIMES 0x00000100
60 #define SSH_FILEXFER_ATTR_BITS 0x00000200
61 #define SSH_FILEXFER_ATTR_ALLOCATION_SIZE 0x00000400
62 #define SSH_FILEXFER_ATTR_TEXT_HINT 0x00000800
63 #define SSH_FILEXFER_ATTR_MIME_TYPE 0x00001000
64 #define SSH_FILEXFER_ATTR_LINK_COUNT 0x00002000
65 #define SSH_FILEXFER_ATTR_UNTRANLATED_NAME 0x00004000
66 #define SSH_FILEXFER_ATTR_EXTENDED 0x80000000
69 #define SSH_FILEXFER_ATTR_FLAGS_READONLY 0x00000001
70 #define SSH_FILEXFER_ATTR_FLAGS_SYSTEM 0x00000002
71 #define SSH_FILEXFER_ATTR_FLAGS_HIDDEN 0x00000004
72 #define SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE 0x00000008
73 #define SSH_FILEXFER_ATTR_FLAGS_ARCHIVE 0x00000010
74 #define SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED 0x00000020
75 #define SSH_FILEXFER_ATTR_FLAGS_COMPRESSED 0x00000040
76 #define SSH_FILEXFER_ATTR_FLAGS_SPARSE 0x00000080
77 #define SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY 0x00000100
78 #define SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE 0x00000200
79 #define SSH_FILEXFER_ATTR_FLAGS_SYNC 0x00000400
80 #define SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR 0x00000800
83 #define SFTP_MODE_IXOTH 0x0001
84 #define SFTP_MODE_IWOTH 0x0002
85 #define SFTP_MODE_IROTH 0x0004
86 #define SFTP_MODE_IRWXO 0x0007
87 #define SFTP_MODE_IXGRP 0x0008
88 #define SFTP_MODE_IWGRP 0x0010
89 #define SFTP_MODE_IRGRP 0x0020
90 #define SFTP_MODE_IRWXG 0x0038
91 #define SFTP_MODE_IXUSR 0x0040
92 #define SFTP_MODE_IWUSR 0x0080
93 #define SFTP_MODE_IRUSR 0x0100
94 #define SFTP_MODE_IRWXU 0x01C0
95 #define SFTP_MODE_ISVTX 0x0200
96 #define SFTP_MODE_ISGID 0x0400
97 #define SFTP_MODE_ISUID 0x0800
98 #define SFTP_MODE_IFMT 0xF000
99 #define SFTP_MODE_IFIFO 0x1000
100 #define SFTP_MODE_IFCHR 0x2000
101 #define SFTP_MODE_IFDIR 0x4000
102 #define SFTP_MODE_IFBLK 0x6000
103 #define SFTP_MODE_IFREG 0x8000
104 #define SFTP_MODE_IFLNK 0xA000
105 #define SFTP_MODE_IFSOCK 0xC000
203 #if defined(__CCRX__)
205 #elif defined(__CWCC__) || defined(_WIN32)
206 #pragma pack(push, 1)
235 #if defined(__CCRX__)
237 #elif defined(__CWCC__) || defined(_WIN32)
274 uint8_t *
p,
size_t *written);
283 size_t length,
size_t *consumed);
286 const uint8_t *
data,
size_t length,
size_t *consumed);
Date and time management.
@ SSH_FX_PERMISSION_DENIED
SftpPacketType
SFTP packet types.
error_t sftpFormatName(SftpVersion version, const SftpName *name, uint8_t *p, size_t *written)
Format name structure.
@ SSH_FILEXFER_TYPE_CHAR_DEVICE
SftpStatusCode
Status codes.
@ SSH_FILEXFER_TYPE_REGULAR
error_t sftpFormatAttributes(SftpVersion version, const SftpFileAttrs *attributes, uint8_t *p, size_t *written)
Format file attributes.
SftpFileType sftpConvertPermToFileType(uint32_t permissions)
Extract file type from permission bits.
@ SSH_FILEXFER_TYPE_SPECIAL
@ SSH_FILEXFER_TYPE_UNKNOWN
Date and time representation.
error_t sftpParseAttributes(SftpVersion version, SftpFileAttrs *attributes, const uint8_t *data, size_t length, size_t *consumed)
Parse file attributes.
@ SSH_FILEXFER_TYPE_SOCKET
error_t sftpFormatLongFilename(const SshString *filename, const SftpFileAttrs *attributes, char_t *p, size_t *written)
Format long file name.
typedef __packed_struct
SFTP packet header.
@ SSH_FILEXFER_TYPE_INVALID
error_t sftpParseName(SftpVersion version, SftpName *name, const uint8_t *data, size_t length, size_t *consumed)
Parse name structure.
@ SSH_FILEXFER_TYPE_DIRECTORY
SftpVersion
SFTP protocol version.
@ SSH_FILEXFER_TYPE_BLOCK_DEVICE
@ SSH_FILEXFER_TYPE_SYMLINK
uint32_t sftpConvertFileTypeToPerm(SftpFileType type)
Convert file type to permission bits.