|
ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
|
SSH server-to-client compression: a context-takeover DEFLATE stream (no heap). More...
Go to the source code of this file.
SSH server-to-client compression: a context-takeover DEFLATE stream (no heap).
SSH zlib / zlib@openssh.com (RFC 4253 sec 6.2) compress the packet payload with a single zlib stream per direction that is kept alive for the whole session - a persistent sliding window carried across packets ("context takeover"), sync-flushed at each packet boundary. This is the OPPOSITE of the WebSocket permessage-deflate codec (presentation/deflate), which is stateless per message (no_context_takeover); the two cannot share an instance.
This file is the SERVER->CLIENT (deflate) half. It emits a zlib stream (RFC 1950 2-byte header once, then RFC 1951 fixed-Huffman blocks) with a Z_SYNC_FLUSH boundary after every packet: the block is byte-aligned and the empty stored block 00 00 ff ff is KEPT on the wire (unlike permessage-deflate, which strips it). A standard zlib inflate() - as in OpenSSH - decodes it. The CLIENT->SERVER (inflate) half lives in ssh_inflate.h: OpenSSH compresses its outbound with Z_PARTIAL_FLUSH, so that side is a resumable, context-takeover inflate carrying bit state + the window across packets.
All state and buffers are caller-supplied; the codec allocates nothing. See ssh_zlib.cpp for the work-buffer / hash-table sizing helpers (SSH_ZLIB_* macros).
Definition in file ssh_zlib.h.