From 0e9846217000b56e3a923a4510273dfa2630a348 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 9 Apr 2026 19:16:39 -0500 Subject: [PATCH 1/5] Add initial dmshell --- meshtastic/mesh.options | 2 ++ meshtastic/mesh.proto | 75 +++++++++++++++++++++++++++++++++++++++ meshtastic/portnums.proto | 5 +++ 3 files changed, 82 insertions(+) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 1bae5eb13..be76cff35 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -74,6 +74,8 @@ *StoreForwardPlusPlus.root_hash max_size:32 *StoreForwardPlusPlus.message max_size:240 +*DMShell.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 b2c6fa48f..715c91470 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1288,6 +1288,81 @@ message StoreForwardPlusPlus { uint32 chain_count = 10; } +/* + * The actual over-the-mesh message doing DMShell + */ +message DMShell { + /* + * 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; + } + + /* + * Legacy bytes tunnel payload. New clients should prefer structured fields below. + */ + // bytes ShellBytes = 1; + + /* + * 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 f4d22e2ca..8c8d15600 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -115,6 +115,11 @@ enum PortNum { */ KEY_VERIFICATION_APP = 12; + /* + * Module/port for handling key verification requests. + */ + DM_SHELL_APP = 13; + /* * Provides a 'ping' service that replies to any packet it receives. * Also serves as a small example module. From 8969fc2ff18476d7e0d74eedf3dbc3b51b36299a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 13 Apr 2026 19:02:40 -0500 Subject: [PATCH 2/5] Remove unused code --- meshtastic/mesh.proto | 4 ---- 1 file changed, 4 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 715c91470..f10d033b0 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1317,10 +1317,6 @@ message DMShell { PONG = 68; } - /* - * Legacy bytes tunnel payload. New clients should prefer structured fields below. - */ - // bytes ShellBytes = 1; /* * Structured frame operation. From 7f50897417adf95e9ed35c7f33aec475e0743680 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 13 Apr 2026 19:15:23 -0500 Subject: [PATCH 3/5] Internally use RemoteShell --- meshtastic/mesh.options | 2 +- meshtastic/mesh.proto | 4 ++-- meshtastic/portnums.proto | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index be76cff35..2341e6c8f 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -74,7 +74,7 @@ *StoreForwardPlusPlus.root_hash max_size:32 *StoreForwardPlusPlus.message max_size:240 -*DMShell.payload max_size:200 +*RemoteShell.payload max_size:200 *StatusMessage.status max_size:80 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index f10d033b0..f84206a29 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1289,9 +1289,9 @@ message StoreForwardPlusPlus { } /* - * The actual over-the-mesh message doing DMShell + * The actual over-the-mesh message doing RemoteShell */ -message DMShell { +message RemoteShell { /* * Frame op code for PTY session control and stream transport. * diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 8c8d15600..8426c153c 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -118,7 +118,7 @@ enum PortNum { /* * Module/port for handling key verification requests. */ - DM_SHELL_APP = 13; + REMOTE_SHELL_APP = 13; /* * Provides a 'ping' service that replies to any packet it receives. From 881c8d50e4cf28cefa12e504e62d904c358b1282 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 13 Apr 2026 19:21:54 -0500 Subject: [PATCH 4/5] Formatting fix --- meshtastic/mesh.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index f84206a29..6ad24aac2 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1317,7 +1317,6 @@ message RemoteShell { PONG = 68; } - /* * Structured frame operation. */ From 9ac6a6aaeb722b9196d641988d29f42fd0e920a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 14 Apr 2026 12:34:30 +0200 Subject: [PATCH 5/5] Clarify comment for REMOTE_SHELL_APP Updated the comment for REMOTE_SHELL_APP to clarify its purpose. --- meshtastic/portnums.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 8426c153c..7f16aa733 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -116,7 +116,7 @@ enum PortNum { KEY_VERIFICATION_APP = 12; /* - * Module/port for handling key verification requests. + * Module/port for handling primitive remote shell access. */ REMOTE_SHELL_APP = 13;