21#ifndef PROTOCORE_SFTP_H
22#define PROTOCORE_SFTP_H
26#if PROTOCORE_ENABLE_SSH_SFTP
34#define PROTOCORE_SFTP_VERSION 3
37#define PROTOCORE_SSH_FXP_INIT 1
38#define PROTOCORE_SSH_FXP_OPEN 3
39#define PROTOCORE_SSH_FXP_CLOSE 4
40#define PROTOCORE_SSH_FXP_READ 5
41#define PROTOCORE_SSH_FXP_WRITE 6
42#define PROTOCORE_SSH_FXP_LSTAT 7
43#define PROTOCORE_SSH_FXP_FSTAT 8
44#define PROTOCORE_SSH_FXP_SETSTAT 9
45#define PROTOCORE_SSH_FXP_FSETSTAT 10
46#define PROTOCORE_SSH_FXP_OPENDIR 11
47#define PROTOCORE_SSH_FXP_READDIR 12
48#define PROTOCORE_SSH_FXP_REMOVE 13
49#define PROTOCORE_SSH_FXP_MKDIR 14
50#define PROTOCORE_SSH_FXP_RMDIR 15
51#define PROTOCORE_SSH_FXP_REALPATH 16
52#define PROTOCORE_SSH_FXP_STAT 17
53#define PROTOCORE_SSH_FXP_RENAME 18
56#define PROTOCORE_SSH_FXP_VERSION 2
57#define PROTOCORE_SSH_FXP_STATUS 101
58#define PROTOCORE_SSH_FXP_HANDLE 102
59#define PROTOCORE_SSH_FXP_DATA 103
60#define PROTOCORE_SSH_FXP_NAME 104
61#define PROTOCORE_SSH_FXP_ATTRS 105
64#define PROTOCORE_SSH_FX_OK 0
65#define PROTOCORE_SSH_FX_EOF 1
66#define PROTOCORE_SSH_FX_NO_SUCH_FILE 2
67#define PROTOCORE_SSH_FX_PERMISSION_DENIED 3
68#define PROTOCORE_SSH_FX_FAILURE 4
69#define PROTOCORE_SSH_FX_BAD_MESSAGE 5
70#define PROTOCORE_SSH_FX_OP_UNSUPPORTED 8
73#define PROTOCORE_SSH_FXF_READ 0x00000001
74#define PROTOCORE_SSH_FXF_WRITE 0x00000002
75#define PROTOCORE_SSH_FXF_APPEND 0x00000004
76#define PROTOCORE_SSH_FXF_CREAT 0x00000008
77#define PROTOCORE_SSH_FXF_TRUNC 0x00000010
78#define PROTOCORE_SSH_FXF_EXCL 0x00000020
81#define PROTOCORE_SSH_FILEXFER_ATTR_SIZE 0x00000001
82#define PROTOCORE_SSH_FILEXFER_ATTR_UIDGID 0x00000002
83#define PROTOCORE_SSH_FILEXFER_ATTR_PERMS 0x00000004
84#define PROTOCORE_SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
85#define PROTOCORE_SSH_FILEXFER_ATTR_EXTENDED 0x80000000
88#define PROTOCORE_SFTP_S_IFDIR 0040000
89#define PROTOCORE_SFTP_S_IFREG 0100000
121 const uint8_t *payload;
243} SftpBuildVersionArgs;
253} SftpBuildStatusArgs;
263} SftpBuildHandleArgs;
289 const char *longname;
305} SftpFormatLongnameArgs;
379 SftpRdInitArgs rd_init_args;
380 SftpRdU8Args rd_u8_args;
381 SftpRdU32Args rd_u32_args;
382 SftpRdU64Args rd_u64_args;
383 SftpRdStringArgs rd_string_args;
384 SftpRdAttrsArgs rd_attrs_args;
385 SftpWrInitArgs wr_init_args;
386 SftpWrU8Args wr_u8_args;
387 SftpWrU32Args wr_u32_args;
388 SftpWrU64Args wr_u64_args;
389 SftpWrBytesArgs wr_bytes_args;
390 SftpWrStringArgs wr_string_args;
391 SftpWrAttrsArgs wr_attrs_args;
392 SftpWrFinishArgs wr_finish_args;
393 SftpWrPosArgs wr_pos_args;
394 SftpWrPatchU32Args wr_patch_u32_args;
395 SftpFrameLenArgs frame_len_args;
396 SftpBuildVersionArgs build_version_args;
397 SftpBuildStatusArgs build_status_args;
398 SftpBuildHandleArgs build_handle_args;
399 SftpBuildAttrsArgs build_attrs_args;
400 SftpBuildDataArgs build_data_args;
401 SftpBuildName1Args build_name1_args;
402 SftpFormatLongnameArgs format_longname_args;
411extern SftpVars SftpV;
416 void (*
const rd_init)(uint8_t *work);
417 void (*
const rd_u8)(uint8_t *work);
418 void (*
const rd_u32)(uint8_t *work);
419 void (*
const rd_u64)(uint8_t *work);
420 void (*
const rd_string)(uint8_t *work);
421 void (*
const rd_attrs)(uint8_t *work);
422 void (*
const wr_init)(uint8_t *work);
423 void (*
const wr_u8)(uint8_t *work);
424 void (*
const wr_u32)(uint8_t *work);
425 void (*
const wr_u64)(uint8_t *work);
426 void (*
const wr_bytes)(uint8_t *work);
427 void (*
const wr_string)(uint8_t *work);
428 void (*
const wr_attrs)(uint8_t *work);
429 void (*
const wr_finish)(uint8_t *work);
430 void (*
const wr_pos)(uint8_t *work);
431 void (*
const wr_patch_u32)(uint8_t *work);
432 void (*
const frame_len)(uint8_t *work);
433 void (*
const build_version)(uint8_t *work);
434 void (*
const build_status)(uint8_t *work);
435 void (*
const build_handle)(uint8_t *work);
436 void (*
const build_attrs)(uint8_t *work);
437 void (*
const build_data)(uint8_t *work);
438 void (*
const build_name1)(uint8_t *work);
439 void (*
const format_longname)(uint8_t *work);
444void protocore_sftp_rd_init(uint8_t *work);
445void protocore_sftp_rd_u8(uint8_t *work);
446void protocore_sftp_rd_u32(uint8_t *work);
447void protocore_sftp_rd_u64(uint8_t *work);
448void protocore_sftp_rd_string(uint8_t *work);
449void protocore_sftp_rd_attrs(uint8_t *work);
450void protocore_sftp_wr_init(uint8_t *work);
451void protocore_sftp_wr_u8(uint8_t *work);
452void protocore_sftp_wr_u32(uint8_t *work);
453void protocore_sftp_wr_u64(uint8_t *work);
454void protocore_sftp_wr_bytes(uint8_t *work);
455void protocore_sftp_wr_string(uint8_t *work);
456void protocore_sftp_wr_attrs(uint8_t *work);
457void protocore_sftp_wr_finish(uint8_t *work);
458void protocore_sftp_wr_pos(uint8_t *work);
459void protocore_sftp_wr_patch_u32(uint8_t *work);
460void protocore_sftp_frame_len(uint8_t *work);
461void protocore_sftp_build_version(uint8_t *work);
462void protocore_sftp_build_status(uint8_t *work);
463void protocore_sftp_build_handle(uint8_t *work);
464void protocore_sftp_build_attrs(uint8_t *work);
465void protocore_sftp_build_data(uint8_t *work);
466void protocore_sftp_build_name1(uint8_t *work);
467void protocore_sftp_format_longname(uint8_t *work);
473static const SftpNs Sftp __attribute__((unused)) = {
474 .rd_init = protocore_sftp_rd_init,
475 .rd_u8 = protocore_sftp_rd_u8,
476 .rd_u32 = protocore_sftp_rd_u32,
477 .rd_u64 = protocore_sftp_rd_u64,
478 .rd_string = protocore_sftp_rd_string,
479 .rd_attrs = protocore_sftp_rd_attrs,
480 .wr_init = protocore_sftp_wr_init,
481 .wr_u8 = protocore_sftp_wr_u8,
482 .wr_u32 = protocore_sftp_wr_u32,
483 .wr_u64 = protocore_sftp_wr_u64,
484 .wr_bytes = protocore_sftp_wr_bytes,
485 .wr_string = protocore_sftp_wr_string,
486 .wr_attrs = protocore_sftp_wr_attrs,
487 .wr_finish = protocore_sftp_wr_finish,
488 .wr_pos = protocore_sftp_wr_pos,
489 .wr_patch_u32 = protocore_sftp_wr_patch_u32,
490 .frame_len = protocore_sftp_frame_len,
491 .build_version = protocore_sftp_build_version,
492 .build_status = protocore_sftp_build_status,
493 .build_handle = protocore_sftp_build_handle,
494 .build_attrs = protocore_sftp_build_attrs,
495 .build_data = protocore_sftp_build_data,
496 .build_name1 = protocore_sftp_build_name1,
497 .format_longname = protocore_sftp_format_longname,
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS