ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ssh_sftp.h
Go to the documentation of this file.
1// ProtoCore v1.0.16 - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4#ifndef PROTOCORE_SSH_SFTP_H
5#define PROTOCORE_SSH_SFTP_H
6
7#include "protocore_config.h" // the entry point: protocore_types.h for the widths
8
10
11/**
12 * @file ssh_sftp.h
13 * @brief SFTP v3 server subsystem - the SSH_FXP_* state machine over an SSH session channel
14(PROTOCORE_ENABLE_SSH_SFTP).
15 *
16 * Drives the pure SFTP v3 codec (network_drivers/application/sftp) over an SSH session channel: when a
17 * client requests the "sftp" subsystem, this serves SSH_FXP_* requests (open/read/write/opendir/
18 * readdir/stat/mkdir/rmdir/remove/rename/realpath) with a fixed handle table and streamed
19 * reads/writes.
20 *
21 * Storage is reached through the filesystem accessor (server/storage/filesystem.h), so this file
22 * names no vendor type and holds no mount, no root, and no path buffer: a request path goes to an
23 * operation as the bytes the client sent, and the accessor frames it onto the mount root and
24 * rejects `..`. Mount the backend and set the root once with protocore_mnt_mount() + protocore_fs_begin().
25 *
26 * Call protocore_ssh_sftp_begin() once after protocore_ssh_conn_setup(); it installs the channel subsystem + data
27 * callbacks.
28 *
29 * @c work is PROTOCORE_SSH_SFTP_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so
30nothing here aliases it. How those bytes are
31 * carved is this module's and is never named here.
32 *
33 * @author Douglas Quigg (dstroy0)
34 * @date 2026
35 */
36
37/** @brief Dispatch table. Addressed by offset, so the layout is asserted below. */
38typedef struct
39{
40 void (*begin)(uint8_t *);
41} SshSftpNs;
43
44/**
45 * @brief Serve the SFTP subsystem from the mounted filesystem. Installs the .
46 * @param work PROTOCORE_SSH_SFTP_BORROW bytes the caller took. Not held past the call.
47 */
48void protocore_ssh_sftp_begin(uint8_t *work);
49
50/**
51 * @brief The PROTOCORE_SSH_SFTP_BORROW bytes this module's state lives in.
52 *
53 * Stated beside the namespace rather than on it: an entry takes a borrow, and this is where
54 * that borrow comes from. Taken once from the end of the pool, which no mark and no release
55 * walks, so the state lasts the life of the program.
56 *
57 * @return the span.
58 */
60
61/** @brief Module namespace. */
63
65
66#endif // PROTOCORE_SSH_SFTP_H
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
PROTOCORE_NS SshSftpNs SshSftp PROTOCORE_UNUSED
Module namespace.
Definition ssh_sftp.h:62
uint8_t * protocore_ssh_sftp_span(void)
The PROTOCORE_SSH_SFTP_BORROW bytes this module's state lives in.
void protocore_ssh_sftp_begin(uint8_t *work)
Serve the SFTP subsystem from the mounted filesystem. Installs the .
Dispatch table. Addressed by offset, so the layout is asserted below.
Definition ssh_sftp.h:39
void(* begin)(uint8_t *)
Definition ssh_sftp.h:40
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
Definition types.h:96
#define PROTOCORE_END_DECLS
Definition types.h:97