assh/assh_transport.h header reference
Description [link]
This header file contains declarations related to the transport layer component of the ssh2 protocol.
Members [link]
Types [link]
- struct assh_event_transport_debug_s
- struct assh_event_transport_disconnect_s
- struct assh_event_transport_read_s
- union assh_event_transport_u
- struct assh_event_transport_write_s
Functions [link]
- assh_status_t assh_transport_debug(struct assh_session_s *s, assh_bool_t display, const char *msg, const char *lang)
- assh_bool_t assh_transport_has_output(struct assh_session_s *s)
- size_t assh_transport_output_size(struct assh_session_s *s)
Members detail [link]
struct assh_event_transport_debug_s [link]
This struct is declared in assh/assh_transport.h source file, line 164.
The ASSH_EVENT_DEBUG event is reported when the remote host transmitted an SSH_MSG_DEBUG message.
Field | Description |
---|---|
const assh_bool_t display; | Set when the debug message should be displayed. (ro) |
const struct assh_cbuffer_s msg; | The actual debug message. (ro) |
const struct assh_cbuffer_s lang; | Tha language tag. (ro) |
struct assh_event_transport_disconnect_s [link]
This struct is declared in assh/assh_transport.h source file, line 150.
The ASSH_EVENT_DISCONNECT event is reported when the remote host transmitted an SSH_MSG_DISCONNECT message. This may not occur if the connection is dropped or if we already sent such a message.
Field | Description |
---|---|
const enum assh_ssh_disconnect_e reason; | Disconnect reason as specified in rfc4250. (ro) |
const struct assh_cbuffer_s desc; | Human readable disconnect reason. (ro) |
const struct assh_cbuffer_s lang; | Tha language tag. (ro) |
struct assh_event_transport_read_s [link]
This struct is declared in assh/assh_transport.h source file, line 112.
The ASSH_EVENT_READ event is reported in order to gather incoming ssh stream data from the remote host.
The buf field have to be filled with incoming data stream. The assh_event_done function must be called once the data have been copied to the buffer and the transferred field have been set to the amount of available data.
If not enough data is available, it's ok to provide less than requested or even no data. The buffer will be provided again the next time this event is reported.
When the underlying communication channel is not able to provide more data, the ASSH_ERR_IO error has to be reported to the assh_event_done function.
Field | Description |
---|---|
const struct assh_buffer_s buf; | Must be filled with the incoming ssh2 stream. (rw) |
size_t transferred; | Must be set to the amount of data copied to the buffer. (rw) |
union assh_event_transport_u [link]
This union is declared in assh/assh_event.h source file, line 137.
This union contains all transport related event structures.
Field | Description |
---|---|
struct assh_event_transport_read_s read; | |
struct assh_event_transport_write_s write; | |
struct assh_event_transport_disconnect_s disconnect; | |
struct assh_event_transport_debug_s debug; |
struct assh_event_transport_write_s [link]
This struct is declared in assh/assh_transport.h source file, line 137.
The ASSH_EVENT_WRITE event is reported when some ssh stream data is available for sending to the remote host. The buf field provides a buffer which contain the output data. The transferred field must be set to the amount of data sent. The assh_event_done function can then be called once the output data have been sent so that the packet buffer is released.
It's ok to set the transferred field to a value less than the buffer size. If no data at all can be sent, the default value of the field can be left untouched. The buffer will remain valid and will be provided again the next time this event is returned.
When the underlying communication channel is closed and it is not possible to send more data, the ASSH_ERR_IO error has to be reported to the assh_event_done function.
Field | Description |
---|---|
const struct assh_cbuffer_s buf; | Contains the outgoing ssh2 stream. (ro) |
size_t transferred; | Must be set to the amount of data copied from the buffer. (rw) |
assh_status_t assh_transport_debug(struct assh_session_s *s, assh_bool_t display, const char *msg, const char *lang) [link]
This function is declared in assh/assh_transport.h source file, line 255.
This function sends a SSH_MSG_DEBUG message.
assh_bool_t assh_transport_has_output(struct assh_session_s *s) [link]
This function is declared in assh/assh_transport.h source file, line 249.
This function returns true if there is pending output ssh stream. When this is the case, the assh_transport_output_buffer function will return a buffer and an ASSH_EVENT_WRITE event should be reported at some point.
size_t assh_transport_output_size(struct assh_session_s *s) [link]
This function is declared in assh/assh_transport.h source file, line 281.
This function returns the number of bytes that are pending in the output queue. This can be used to prevent the output queue from growing too much. In order to do so, refrain from calling functions that generate new output (like the assh_channel_data_send function) until the value returned by this function is below a limit of your choice. The returned value is expected to decrease when the ASSH_EVENT_WRITE event is acknowledged.