Go to the documentation of this file.
32 #define TRACE_LEVEL SFTP_TRACE_LEVEL
51 uint8_t *
p,
size_t *written)
84 p +=
sizeof(uint32_t) +
n;
85 *written +=
sizeof(uint32_t) +
n;
119 static const char_t months[13][4] =
142 n =
osSprintf(
p,
"---------- 1 owner group %10" PRIu32,
147 n =
osSprintf(
p,
"---------- 1 owner group %10" PRIu64,
214 n +=
osSprintf(
p +
n,
" %s %02" PRIu8
" %02" PRIu8
":%02" PRIu8,
259 uint32_t permissions;
268 p +=
sizeof(uint32_t);
269 *written +=
sizeof(uint32_t);
279 p +=
sizeof(uint8_t);
280 *written +=
sizeof(uint8_t);
290 p +=
sizeof(uint64_t);
291 *written +=
sizeof(uint64_t);
301 p +=
sizeof(uint32_t);
302 *written +=
sizeof(uint32_t);
308 p +=
sizeof(uint32_t);
309 *written +=
sizeof(uint32_t);
329 p +=
sizeof(uint32_t);
330 *written +=
sizeof(uint32_t);
342 p +=
sizeof(uint32_t);
343 *written +=
sizeof(uint32_t);
351 p +=
sizeof(uint32_t);
352 *written +=
sizeof(uint32_t);
371 size_t length,
size_t *consumed)
390 p +=
sizeof(uint32_t) +
name->filename.length;
391 length -=
sizeof(uint32_t) +
name->filename.length;
403 p +=
sizeof(uint32_t) +
name->longname.length;
404 length -=
sizeof(uint32_t) +
name->longname.length;
422 name->longname.length > 0)
425 if(
name->longname.value[0] ==
'd')
437 *consumed =
p -
data;
455 const uint8_t *
data,
size_t length,
size_t *consumed)
460 uint32_t extendedCount;
472 if(
length <
sizeof(uint32_t))
479 p +=
sizeof(uint32_t);
480 length -=
sizeof(uint32_t);
487 if(
length <
sizeof(uint8_t))
494 p +=
sizeof(uint8_t);
495 length -=
sizeof(uint8_t);
507 if(
length <
sizeof(uint64_t))
514 p +=
sizeof(uint64_t);
515 length -=
sizeof(uint64_t);
522 if(
length <
sizeof(uint32_t))
529 p +=
sizeof(uint32_t);
530 length -=
sizeof(uint32_t);
533 if(
length <
sizeof(uint32_t))
540 p +=
sizeof(uint32_t);
541 length -=
sizeof(uint32_t);
548 if(
length <
sizeof(uint32_t))
562 p +=
sizeof(uint32_t);
563 length -=
sizeof(uint32_t);
570 if(
length <
sizeof(uint32_t))
579 p +=
sizeof(uint32_t);
580 length -=
sizeof(uint32_t);
583 if(
length <
sizeof(uint32_t))
592 p +=
sizeof(uint32_t);
593 length -=
sizeof(uint32_t);
600 if(
length <
sizeof(uint32_t))
607 p +=
sizeof(uint32_t);
608 length -=
sizeof(uint32_t);
618 for(i = 0; i < extendedCount; i++)
628 p +=
sizeof(uint32_t) + extendedType.
length;
638 p +=
sizeof(uint32_t) + extendedData.
length;
643 *consumed =
p -
data;
710 uint32_t permissions;
#define SSH_FILEXFER_ATTR_EXTENDED
time_t convertDateToUnixTime(const DateTime *date)
Convert date to Unix timestamp.
error_t sftpFormatName(SftpVersion version, const SftpName *name, uint8_t *p, size_t *written)
Format name structure.
error_t sshParseString(const uint8_t *p, size_t length, SshString *string)
Parse a string.
void convertUnixTimeToDate(time_t t, DateTime *date)
Convert Unix timestamp to date.
@ SSH_FILEXFER_TYPE_CHAR_DEVICE
#define SSH_FILEXFER_ATTR_SIZE
error_t sshFormatBinaryString(const void *value, size_t valueLen, uint8_t *p, size_t *written)
Format a binary string.
@ SSH_FILEXFER_TYPE_REGULAR
#define osMemcpy(dest, src, length)
#define osSprintf(dest,...)
error_t sftpParseAttributes(SftpVersion version, SftpFileAttrs *attributes, const uint8_t *data, size_t length, size_t *consumed)
Parse file attributes.
error_t sftpParseName(SftpVersion version, SftpName *name, const uint8_t *data, size_t length, size_t *consumed)
Parse name structure.
error_t sftpFormatAttributes(SftpVersion version, const SftpFileAttrs *attributes, uint8_t *p, size_t *written)
Format file attributes.
@ SSH_FILEXFER_TYPE_UNKNOWN
SftpFileType sftpConvertPermToFileType(uint32_t permissions)
Extract file type from permission bits.
#define SSH_FILEXFER_ATTR_ACMODTIME
@ SSH_FILEXFER_TYPE_SOCKET
error_t sftpFormatLongFilename(const SshString *filename, const SftpFileAttrs *attributes, char_t *p, size_t *written)
Format long file name.
#define SSH_FILEXFER_ATTR_PERMISSIONS
@ SSH_FILEXFER_TYPE_DIRECTORY
Definitions common to SFTP client and server.
SftpVersion
SFTP protocol version.
@ SSH_FILEXFER_TYPE_BLOCK_DEVICE
uint32_t sftpConvertFileTypeToPerm(SftpFileType type)
Convert file type to permission bits.
@ SSH_FILEXFER_TYPE_SYMLINK
#define osMemset(p, value, length)
__weak_func time_t getCurrentUnixTime(void)
Get current time.
#define SSH_FILEXFER_ATTR_UIDGID