From 98e95eeaa26770e6ede0291753623e4744b6ede1 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 14 Apr 2026 05:35:13 -0500 Subject: [PATCH] Remote Shell Protobufs (#892) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add initial dmshell * Remove unused code * Internally use RemoteShell * Formatting fix * Clarify comment for REMOTE_SHELL_APP Co-authored-by: Thomas Göttgens --- meshtastic/mesh.options | 2 ++ meshtastic/mesh.proto | 70 +++++++++++++++++++++++++++++++++++++++ meshtastic/portnums.proto | 5 +++ 3 files changed, 77 insertions(+) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 1bae5eb..2341e6c 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -74,6 +74,8 @@ *StoreForwardPlusPlus.root_hash max_size:32 *StoreForwardPlusPlus.message max_size:240 +*RemoteShell.payload max_size:200 + *StatusMessage.status max_size:80 # MyMessage.name max_size:40 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index b2c6fa4..6ad24aa 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1288,6 +1288,76 @@ message StoreForwardPlusPlus { uint32 chain_count = 10; } +/* + * The actual over-the-mesh message doing RemoteShell + */ +message RemoteShell { + /* + * Frame op code for PTY session control and stream transport. + * + * Values 1-63 are client->server requests. + * Values 64-127 are server->client responses/events. + */ + enum OpCode { + OP_UNSET = 0; + + // Client -> server + OPEN = 1; + INPUT = 2; + RESIZE = 3; + CLOSE = 4; + PING = 5; + ACK = 6; + + // Server -> client + OPEN_OK = 64; + OUTPUT = 65; + CLOSED = 66; + ERROR = 67; + PONG = 68; + } + + /* + * Structured frame operation. + */ + OpCode op = 1; + + /* + * Logical PTY session identifier. + */ + uint32 session_id = 2; + + /* + * Monotonic sequence number for this frame. + */ + uint32 seq = 3; + + /* + * Cumulative ack sequence number. + */ + uint32 ack_seq = 4; + + /* + * Opaque bytes payload for INPUT/OUTPUT/ERROR and other frame bodies. + */ + bytes payload = 5; + + /* + * Terminal size columns used for OPEN/RESIZE signaling. + */ + uint32 cols = 6; + + /* + * Terminal size rows used for OPEN/RESIZE signaling. + */ + uint32 rows = 7; + + /* + * Bit flags for protocol extensions. + */ + uint32 flags = 8; +} + /* * Waypoint message, used to share arbitrary locations across the mesh */ diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index b6c9776..61412cf 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -115,6 +115,11 @@ enum PortNum { */ KEY_VERIFICATION_APP = 12; + /* + * Module/port for handling primitive remote shell access. + */ + REMOTE_SHELL_APP = 13; + /* * Provides a 'ping' service that replies to any packet it receives. * Also serves as a small example module.