|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Open a server-initiated "forwarded-tcpip" channel (RFC 4254 §7.2, ssh -R). More...
#include <connection.h>
Public Attributes | |
| char | term [PROTOCORE_SSH_PTY_TERM_MAX] |
| TERM value, null-terminated, truncated to fit. | |
| uint32_t | width_chars |
| terminal width, characters | |
| uint32_t | height_rows |
| terminal height, rows | |
| uint32_t | width_px |
| terminal width, pixels | |
| uint32_t | height_px |
| terminal height, pixels | |
| const uint8_t * | modes |
| encoded terminal modes, pointing into the request | |
| uint32_t | modes_len |
| length of modes | |
Open a server-initiated "forwarded-tcpip" channel (RFC 4254 §7.2, ssh -R).
Allocates a local channel on connection i (state = pending, awaiting the client's confirmation) and builds the SSH_MSG_CHANNEL_OPEN in out. conn_addr / conn_port are the forward's bound address/port (the "address
that was connected"); orig_addr / orig_port are the peer that connected.
out too small). On success the caller emits out and, on the eventual confirm, bridges bytes on the returned channel.Handle SSH_MSG_CHANNEL_OPEN_CONFIRMATION for a channel we opened (ssh -R).
Matches the pending channel by our recipient id, records the peer's channel id / window / max-packet, and marks it open. Fires the confirm callback (ok = true).
Handle SSH_MSG_CHANNEL_OPEN_FAILURE for a channel we opened (ssh -R).
Frees the pending channel and fires the confirm callback (ok = false).
Handle SSH_MSG_GLOBAL_REQUEST (RFC 4254 §4).
Parses the request name and want_reply flag. "tcpip-forward" / "cancel-tcpip-forward" are routed to the remote-forward seam above (accepted only when a callback is installed); a "tcpip-forward" that bound port 0 gets its allocated port echoed in the reply (RFC 4254 §7.1). Any other request name is unrecognized: per §4 it is answered with SSH_MSG_REQUEST_FAILURE when want_reply is set, and silently ignored otherwise (never SSH_MSG_UNIMPLEMENTED - GLOBAL_REQUEST is a known message type; only the request name is unknown).
out with *out_len bytes, or *out_len is 0 when no reply is due), -1 if the message is malformed.Bind a sec 6.5 file-transfer service to an open channel.
The channel was opened as "session" (sec 5.1); the request that names the service arrives later, and this records which one so inbound CHANNEL_DATA routes to its binding rather than to the channel-data callback. This layer owns the channel record, so the request handler above it asks rather than writes.
Reset channel state for slot i.
The open channel id on connection i, or null. Local id == slot index.
First free channel slot on connection i, or -1 if the pool is full. A pending (opened-but-unconfirmed) channel is in use just like an open one.
Handle SSH_MSG_CHANNEL_OPEN and emit CHANNEL_OPEN_CONFIRMATION.
Accepts a "session" channel; any other type yields CHANNEL_OPEN_FAILURE.
Read n consecutive strings from off: true when every one is present and whole.
RFC 4254 sec 6.2: string TERM, four uint32 dimensions, string encoded terminal modes.
The terminal a "pty-req" asked for, as sec 6.2 orders its fields.
"Zero dimension parameters MUST be ignored. The character/row dimensions override the pixel dimensions (when nonzero)." Both pairs are kept as they arrived; a consumer applies that rule.
Definition at line 344 of file connection.h.
| char SshPtyRequest::term[PROTOCORE_SSH_PTY_TERM_MAX] |
TERM value, null-terminated, truncated to fit.
Definition at line 346 of file connection.h.
| uint32_t SshPtyRequest::width_chars |
terminal width, characters
Definition at line 347 of file connection.h.
| uint32_t SshPtyRequest::height_rows |
terminal height, rows
Definition at line 348 of file connection.h.
| uint32_t SshPtyRequest::width_px |
terminal width, pixels
Definition at line 349 of file connection.h.
| uint32_t SshPtyRequest::height_px |
terminal height, pixels
Definition at line 350 of file connection.h.
| const uint8_t* SshPtyRequest::modes |
encoded terminal modes, pointing into the request
Definition at line 351 of file connection.h.
| uint32_t SshPtyRequest::modes_len |
length of modes
Definition at line 352 of file connection.h.