BBS:      TELESC.NET.BR
Assunto:  src/ssh/design-channel-io-api.md
De:       Deuc¨
Data:     Sun, 29 Mar 2026 10:21:44 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/73b7f48b88ccdbc7afa7fa4d
Modified Files:
	src/ssh/design-channel-io-api.md
Log Message:
Server-side accept API: callback-driven setup, shared params struct

Complete server-side channel API design:

- dssh_chan_accept() blocks until incoming channel setup completes.
  Library drives the setup state machine; app provides per-request
  callbacks (pty_req, env, shell, exec, subsystem).
- Library populates dssh_chan_params internally during accept using
  the same builder functions the client uses. Every callback receives
  the accumulated params struct showing all setup state so far.
  Channel owns the params after accept; getters read from it.
- Same struct round-trips through the wire  in selftests, client's
  builder-constructed params and server's wire-populated params can
  be compared directly for round-trip verification.
- NULL callback semantics: only pty_req auto-accepts (benign).
  Everything else auto-rejects: env (RFC s6.4 security hazard 
  uncontrolled env vars like LD_PRELOAD), shell, exec, subsystem.
  App must explicitly declare what it accepts. No accidental
  open-everything servers, no unfiltered env vars.
- Terminal request callbacks receive pre-filled dssh_chan_accept_result
  for I/O model selection (stream vs ZC, max_window). ZC requires
  the callback (only way to provide zc_cb).
- pty_req/env reject = non-fatal (CHANNEL_FAILURE, continue setup).
  Terminal request reject = close channel, keep waiting.
- Lifecycle enforcement: env before terminal request (RFC s6.4),
  one terminal request per channel (RFC s6.5), second pty-req =
  disconnect (OpenSSH convention), post-setup only window-change/
  break/signal.
- Getters work for both client-opened and server-accepted channels.
  Returned pointers valid for channel lifetime.
- Accept copies session-level event callback default; post-setup
  events arrive through normal event queue/callback.
- Server initiating channels uses dssh_chan_open (side-neutral API).
- Parse helpers eliminated  library populates params internally.
- All open items resolved (client and server).

Co-Authored-By: Claude Opus 4.6 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]