|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
RFC 4253 sec 6.2 compression: the negotiated stream, both directions. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | CompNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Typedefs | |
| typedef enum PROTO_ENUM_PACKED | SshCompAlg |
| Negotiated compression algorithm, held per direction. | |
Enumerations | |
| enum | PROTO_ENUM_PACKED { SSH_COMP_NONE = 0 , SSH_COMP_ZLIB = 1 , SSH_COMP_ZLIB_DELAYED = 2 } |
| Negotiated compression algorithm, held per direction. More... | |
Functions | |
| PROTOCORE_NS_LAYOUT (CompNs, reset, set_s2c, on_newkeys, on_auth_success, s2c_active, s2c, set_c2s, c2s_active, c2s) | |
| void | protocore_comp_reset (uint8_t *work, uint8_t i) |
| Reset compression state for slot i (fresh connection). Does NOT run . | |
| void | protocore_comp_set_s2c (uint8_t *work, uint8_t i, SshCompAlg alg) |
| Record the s2c algorithm negotiated in KEXINIT (SshCompAlg). | |
| void | protocore_comp_on_newkeys (uint8_t *work, uint8_t i) |
NEWKEYS completed: start the stream now if zlib was negotiated . | |
| void | protocore_comp_on_auth_success (uint8_t *work, uint8_t i) |
| SSH_MSG_USERAUTH_SUCCESS sent: start the stream if . | |
| proto_bool | protocore_comp_s2c_active (uint8_t *work, uint8_t i) |
| True once the s2c stream is active and outbound payloads must be . | |
| int | protocore_comp_s2c (uint8_t *work, uint8_t i, const uint8_t *src, size_t src_len, uint8_t *dst, size_t dst_cap, size_t *out_len) |
| Compress one outbound payload, continuing the session's zlib stream. | |
| void | protocore_comp_set_c2s (uint8_t *work, uint8_t i, SshCompAlg alg) |
| Record the client-to-server algorithm negotiated in KEXINIT . | |
| proto_bool | protocore_comp_c2s_active (uint8_t *work, uint8_t i) |
| True once the c2s stream is active and inbound payloads must be . | |
| int | protocore_comp_c2s (uint8_t *work, uint8_t i, const uint8_t *src, size_t src_len, uint8_t *dst, size_t dst_cap, size_t *out_len) |
| Decompress one inbound payload, continuing the session's . | |
| uint8_t * | protocore_ssh_comp_span (void) |
| The bytes every entry here runs out of: one compressor per SSH connection. | |
Variables | |
| PROTOCORE_NS CompNs Comp | PROTOCORE_UNUSED |
| Module namespace. | |
RFC 4253 sec 6.2 compression: the negotiated stream, both directions.
work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.
Definition in file comp.h.
| typedef enum PROTO_ENUM_PACKED SshCompAlg |
Negotiated compression algorithm, held per direction.
| enum PROTO_ENUM_PACKED |
| PROTOCORE_NS_LAYOUT | ( | CompNs | , |
| reset | , | ||
| set_s2c | , | ||
| on_newkeys | , | ||
| on_auth_success | , | ||
| s2c_active | , | ||
| s2c | , | ||
| set_c2s | , | ||
| c2s_active | , | ||
| c2s | |||
| ) |
| void protocore_comp_reset | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
Reset compression state for slot i (fresh connection). Does NOT run .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| void protocore_comp_set_s2c | ( | uint8_t * | work, |
| uint8_t | i, | ||
| SshCompAlg | alg | ||
| ) |
Record the s2c algorithm negotiated in KEXINIT (SshCompAlg).
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| alg | Alg |
| void protocore_comp_on_newkeys | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
NEWKEYS completed: start the stream now if zlib was negotiated .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| void protocore_comp_on_auth_success | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
SSH_MSG_USERAUTH_SUCCESS sent: start the stream if .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| proto_bool protocore_comp_s2c_active | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
True once the s2c stream is active and outbound payloads must be .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| int protocore_comp_s2c | ( | uint8_t * | work, |
| uint8_t | i, | ||
| const uint8_t * | src, | ||
| size_t | src_len, | ||
| uint8_t * | dst, | ||
| size_t | dst_cap, | ||
| size_t * | out_len | ||
| ) |
Compress one outbound payload, continuing the session's zlib stream.
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| src | Src |
| src_len | Src len |
| dst | Dst |
| dst_cap | Dst cap |
| out_len | Out len |
| void protocore_comp_set_c2s | ( | uint8_t * | work, |
| uint8_t | i, | ||
| SshCompAlg | alg | ||
| ) |
Record the client-to-server algorithm negotiated in KEXINIT .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| alg | Alg |
| proto_bool protocore_comp_c2s_active | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
True once the c2s stream is active and inbound payloads must be .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| int protocore_comp_c2s | ( | uint8_t * | work, |
| uint8_t | i, | ||
| const uint8_t * | src, | ||
| size_t | src_len, | ||
| uint8_t * | dst, | ||
| size_t | dst_cap, | ||
| size_t * | out_len | ||
| ) |
Decompress one inbound payload, continuing the session's .
| work | PROTOCORE_COMP_BORROW bytes the caller took. Not held past the call. |
| i | I |
| src | Src |
| src_len | Src len |
| dst | Dst |
| dst_cap | Dst cap |
| out_len | Out len |
| uint8_t * protocore_ssh_comp_span | ( | void | ) |
The bytes every entry here runs out of: one compressor per SSH connection.
Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. The transport and the server both drive the same connection's streams, so the bytes belong to this module rather than to either caller. Taken once from the end of the plaintext pool, which no mark and no release walks, because a zlib@.nosp@m.open.nosp@m.ssh.c.nosp@m.om stream takes its window over from one packet to the next.
| PROTOCORE_NS CompNs Comp PROTOCORE_UNUSED |
Module namespace.