ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ssh_scp.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_SCP_H
5#define PROTOCORE_SSH_SCP_H
6
7#include "protocore_config.h" // the entry point: protocore_types.h for the widths
8
10
11/**
12 * @file ssh_scp.h
13 * @brief SCP server - the rcp SINK state machine over an SSH exec channel (PROTOCORE_ENABLE_SSH_SCP).
14 *
15 * Drives the SCP/RCP codec (network_drivers/session/scp) over an SSH `exec "scp …"` channel so a
16 * client can drop a file onto the device: `scp localfile admin@device:/path`. v1 serves the SINK
17 * direction (client -> device, `scp -t`); the SOURCE direction (`scp -f`, device -> client) is a
18 * follow-up - use SFTP `get` to download.
19 *
20 * Storage is reached through the filesystem accessor (server/storage/filesystem.h), so this file
21 * names no vendor type and holds no mount, no root, and no path buffer. Mount the backend and set
22 * the root once with protocore_mnt_mount() + protocore_fs_begin(); every server over that storage then answers
23 * from the same root by construction rather than by each being told the same string.
24 *
25 * Streamed writes, fixed buffers, no heap. Call protocore_ssh_scp_begin() once after protocore_ssh_conn_setup().
26 *
27 * @c work is PROTOCORE_SSH_SCP_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so
28 * nothing here aliases it. How those bytes are carved is this module's and is never named here.
29 *
30 * @author Douglas Quigg (dstroy0)
31 * @date 2026
32 */
33
34/** @brief Dispatch table. Addressed by offset, so the layout is asserted below. */
35typedef struct
36{
37 void (*begin)(uint8_t *);
38} SshScpNs;
40
41/**
42 * @brief Serve SCP uploads onto the mounted filesystem. Installs the channel .
43 * @param work PROTOCORE_SSH_SCP_BORROW bytes the caller took. Not held past the call.
44 */
45void protocore_ssh_scp_begin(uint8_t *work);
46
47/**
48 * @brief The PROTOCORE_SSH_SCP_BORROW bytes this module's state lives in.
49 *
50 * Stated beside the namespace rather than on it: an entry takes a borrow, and this is where
51 * that borrow comes from. Taken once from the end of the pool, which no mark and no release
52 * walks, so the state lasts the life of the program.
53 *
54 * @return the span.
55 */
57
58/** @brief Module namespace. */
60
62
63#endif // PROTOCORE_SSH_SCP_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.
void protocore_ssh_scp_begin(uint8_t *work)
Serve SCP uploads onto the mounted filesystem. Installs the channel .
PROTOCORE_NS SshScpNs SshScp PROTOCORE_UNUSED
Module namespace.
Definition ssh_scp.h:59
uint8_t * protocore_ssh_scp_span(void)
The PROTOCORE_SSH_SCP_BORROW bytes this module's state lives in.
Dispatch table. Addressed by offset, so the layout is asserted below.
Definition ssh_scp.h:36
void(* begin)(uint8_t *)
Definition ssh_scp.h:37
#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