• src/ssh/client.c deucessh-conn.h server.c ssh-conn.c ssh-internal.h ss

    From Deuc¿@VERT to Git commit to main/sbbs/master on Mon Mar 30 10:39:12 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/865598d5c622bc7c04f79abb
    Modified Files:
    src/ssh/client.c deucessh-conn.h server.c ssh-conn.c ssh-internal.h ssh-trans.c ssh-trans.h src/ssh/test/dssh_test_internal.h test_alloc.c test_chan.c test_conn.c test_selftest.c
    Log Message:
    Implement channel I/O redesign (TODO item 101, stream API)

    Replaces the old split dssh_session_*/dssh_channel_* channel API with
    a unified dssh_chan_* API per the design in design-channel-io-api.md.

    Transport layer:
    - tx_packet/rx_packet gain 4-byte seq prefix, making MAC input
    contiguous; tx_mac_scratch and rx_mac_scratch eliminated (2 fewer
    mallocs per session, 2 fewer memcpy per packet)

    New public API (deucessh-conn.h):
    - dssh_chan_params builder (init/free + 9 setters) with mode dedup
    - dssh_chan_open(sess, params) -- full setup: env, pty-req, shell/exec/subsystem
    - dssh_chan_read/write(ch, stream, ...) -- stream param replaces _ext variants - dssh_chan_poll(ch, events, timeout) -- adds DSSH_POLL_EVENT
    - dssh_chan_read_event(ch, event) -- 7 event types (signalfd model)
    - dssh_chan_close(ch, int64_t exit_code) -- negative = no exit-status
    - dssh_chan_shutwr(ch) -- half-close (EOF)
    - dssh_chan_send_signal/send_window_change/send_break
    - dssh_chan_accept(sess, cbs, timeout) -- callback-driven server setup
    - dssh_chan_get_type/get_command/get_subsystem/has_pty -- getters

    Demux dispatch:
    - New-model channels (io_model != DSSH_IO_OLD) get events pushed to
    an event queue instead of the old signal queue + window-change callback
    - EOF and CLOSE generate DSSH_EVENT_EOF / DSSH_EVENT_CLOSE events
    - Old-model channel paths preserved for backward compat during transition

    Deleted from public API:
    - dssh_session_open_shell/open_exec, dssh_channel_open_subsystem
    - dssh_session_read/read_ext/write/write_ext/poll/close
    - dssh_channel_read/write/poll/close
    - dssh_session_read_signal/send_signal/send_window_change
    - dssh_session_accept/reject/accept_channel, dssh_channel_accept_raw
    - dssh_parse_pty_req_data/env_data/exec_data/subsystem_data
    - struct dssh_pty_req, struct dssh_server_session_cbs, DSSH_POLL_SIGNAL

    Parse helpers converted to static (renamed, NULL checks removed).
    client.c and server.c migrated to new API.
    All test files updated; 1758 CTest runs pass.

    Zero-copy API (dssh_chan_zc_*) and event callbacks
    (dssh_chan_set_event_cb) deferred -- typedefs present, functions not
    yet implemented.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net