SshChannelManager¶
Tracks channel state keyed by local channel id. The local id (the map key) is
the value we advertise to the peer as sender_channel; the peer echoes it
back as the recipient_channel of every message it sends us, so the
connection layer uses an inbound recipient_channel directly as the local
key. A channel's remote_id is stored only to fill the recipient_channel
field of messages we send to the peer. Anyone changing how outbound messages
are keyed must preserve this local-id == map-key == peer's recipient_channel
invariant, or inbound routing will look up the wrong channel.
Constructors¶
create¶
The receive window is at least 256 bytes, even for smaller inputs.
Parameters¶
- initial_window': U32 val = SshChannelWindow.initial()
Returns¶
- SshChannelManager ref^
Public fields¶
let initial_window: U32 val¶
Public Functions¶
open_channel¶
Allocate local channel ID and create pending state.
Parameters¶
- channel_type: String val
Returns¶
- U32 val
confirm_channel¶
Confirm a pending channel open. The peer accepting the channel we opened is what authorizes it, so this is where a channel of ours becomes usable.
fun ref confirm_channel(
local_id: U32 val,
remote_id: U32 val,
remote_window: U32 val,
max_packet_size: U32 val)
: (None val | SshChannelError)
Parameters¶
Returns¶
- (None val | SshChannelError)
accept_channel¶
Accept an incoming channel open from remote (server side).
fun ref accept_channel(
local_id: U32 val,
remote_id: U32 val,
remote_window: U32 val,
max_packet_size: U32 val,
channel_type: String val)
: (U32 val | SshChannelUnsupportedPacketSize val)
Parameters¶
- local_id: U32 val
- remote_id: U32 val
- remote_window: U32 val
- max_packet_size: U32 val
- channel_type: String val
Returns¶
- (U32 val | SshChannelUnsupportedPacketSize val)
channel_remote_id_if_open¶
Return the peer's channel ID when the local channel is open.
Parameters¶
- local_id: U32 val
Returns¶
- (U32 val | SshChannelError)
channel_data_admitted¶
Debit the peer window after a segment has been admitted to transport.
fun ref channel_data_admitted(
local_id: U32 val,
data_size: USize val)
: (None val | SshChannelError)
Parameters¶
Returns¶
- (None val | SshChannelError)
clear_send_blocked¶
Clear blocked-send state when the session ends.
Returns¶
- None val
channel_data_received¶
Account for received data against the receive window. Returns the remaining window on success, or SshWindowExhausted if the peer sent more than the window we advertised (a flow-control violation we must not silently absorb).
fun ref channel_data_received(
local_id: U32 val,
data_size: USize val)
: (U32 val | SshChannelError)
Parameters¶
Returns¶
- (U32 val | SshChannelError)
replenish_local_window¶
If the receive window has fallen below half its initial size, top it back up to the initial size and return the increment to advertise to the peer via SSH_MSG_CHANNEL_WINDOW_ADJUST. Returns None when no adjustment is due. Without this the peer's send window decays to zero and the channel stalls.
Parameters¶
- local_id: U32 val
Returns¶
window_adjust¶
Increase the remote send window for a channel. Saturates at U32 max rather than wrapping: a peer that sums WINDOW_ADJUSTs past 2^32 (which RFC 4254 ยง5.2 forbids) must not silently wrap our window back to a small value.
Parameters¶
Returns¶
- None val
close_channel¶
Remove channel state.
Parameters¶
- local_id: U32 val
Returns¶
- None val
get¶
Parameters¶
- local_id: U32 val
Returns¶
- (SshChannelState ref | None val)
channel_count¶
Returns¶
- USize val
at_capacity¶
True once the concurrent-channel cap is reached; reject further opens.
Returns¶
- Bool val