35#define PROTOCORE_SCP_ACK_OK 0
36#define PROTOCORE_SCP_ACK_WARN 1
37#define PROTOCORE_SCP_ACK_ERROR 2
50 ScpMode (*parse_cmd)(uint8_t *,
const char *, size_t,
char *, size_t);
51 proto_bool (*parse_cline)(uint8_t *,
const char *, size_t, uint32_t *, uint64_t *,
char *, size_t);
52 size_t (*build_cline)(uint8_t *, uint32_t, uint64_t,
const char *,
char *, size_t);
78 uint64_t *size_out,
char *name_out,
size_t name_cap);
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
#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.
enum PROTO_ENUM_PACKED ScpMode
The role of an scp invocation, parsed from the exec command.
proto_bool protocore_scp_parse_cline(uint8_t *work, const char *line, size_t len, uint32_t *mode_out, uint64_t *size_out, char *name_out, size_t name_cap)
Parse a control line C<mode> <size> <name> (a trailing ' ' .
size_t protocore_scp_build_cline(uint8_t *work, uint32_t mode, uint64_t size, const char *name, char *out, size_t cap)
Build a control line C<mode> <size> <name>\n for a source .
ScpMode protocore_scp_parse_cmd(uint8_t *work, const char *cmd, size_t cmd_len, char *path_out, size_t path_cap)
Parse an exec command scp [-v] [-r] [-p] [-d] -t|-f <path> into .
@ SCP_MODE_SINK
scp -t <path>: the client sends a file TO the device (device receives)
@ SCP_MODE_SOURCE
scp -f <path>: the client fetches a file FROM the device (device sends)
PROTOCORE_NS ScpNs Scp PROTOCORE_UNUSED
Module namespace.
Dispatch table. Addressed by offset, so the layout is asserted below.
ScpMode(* parse_cmd)(uint8_t *, const char *, size_t, char *, size_t)
#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