assh/assh_transport.h header reference
Description [link]
This header file contains declarations related to the transport layer component of the ssh2 protocol.
Header inclusion [link]
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
- enum assh_stream_in_state_e
- enum assh_stream_out_state_e
- enum assh_transport_state_e
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)
- assh_status_t assh_transport_dispatch(struct assh_session_s *s, struct assh_event_s *e)
- void assh_transport_push(struct assh_session_s *s, struct assh_packet_s *p)
- assh_status_t assh_transport_read(struct assh_session_s *s, struct assh_event_s *e)
- assh_status_t assh_transport_unimp(struct assh_session_s *s, struct assh_packet_s *pin)
- assh_status_t assh_transport_write(struct assh_session_s *s, struct assh_event_s *e)
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_transport.h source file, line 177.
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 229.
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 223.
This function returns true if there is pending output ssh stream. When this is the case, an ASSH_EVENT_WRITE event will be reported.
enum assh_stream_in_state_e [link]
This enum is for internal use only.
This enum is declared in assh/assh_transport.h source file, line 72.
This enum specifies state of the input stream parser
Identifier | Value | Description |
---|---|---|
ASSH_TR_IN_IDENT | 0 | |
ASSH_TR_IN_IDENT_DONE | 1 | |
ASSH_TR_IN_HEAD | 2 | |
ASSH_TR_IN_HEAD_DONE | 3 | |
ASSH_TR_IN_PAYLOAD | 4 | |
ASSH_TR_IN_PAYLOAD_DONE | 5 | |
ASSH_TR_IN_CLOSED | 6 |
enum assh_stream_out_state_e [link]
This enum is for internal use only.
This enum is declared in assh/assh_transport.h source file, line 84.
This enum specifies state of the output stream generator
Identifier | Value | Description |
---|---|---|
ASSH_TR_OUT_IDENT | 0 | |
ASSH_TR_OUT_IDENT_PAUSE | 1 | |
ASSH_TR_OUT_IDENT_DONE | 2 | |
ASSH_TR_OUT_PACKETS | 3 | |
ASSH_TR_OUT_PACKETS_ENCIPHERED | 4 | |
ASSH_TR_OUT_PACKETS_PAUSE | 5 | |
ASSH_TR_OUT_PACKETS_DONE | 6 | |
ASSH_TR_OUT_CLOSED | 7 |
assh_status_t assh_transport_dispatch(struct assh_session_s *s, struct assh_event_s *e) [link]
This function is for internal use only.
This function is declared in assh/assh_transport.h source file, line 217.
This function dispatches an incoming packets to the appropriate state machine (tranport, kex or service). It is called from the assh_event_get function.
void assh_transport_push(struct assh_session_s *s, struct assh_packet_s *p) [link]
This function is for internal use only.
This function is declared in assh/assh_transport.h source file, line 188.
This function puts a packet in the output queue. The packet will be released once it has been enciphered and sent.
assh_status_t assh_transport_read(struct assh_session_s *s, struct assh_event_s *e) [link]
This function is for internal use only.
This function is declared in assh/assh_transport.h source file, line 210.
This function executes the transport input FSM code which extracts packets from the stream and decipher them. It may report the ASSH_EVENT_WRITE event. It is called from the assh_event_get function.
enum assh_transport_state_e [link]
This enum is for internal use only.
This enum is declared in assh/assh_transport.h source file, line 45.
This enum specifies the transport status of an ssh session.
Identifier | Value | Description |
---|---|---|
ASSH_TR_INIT | 0 | Session just initilized, first call to assh_event_get expected. |
ASSH_TR_IDENT | 1 | Wait for end of identification string exchange |
ASSH_TR_KEX_INIT | 2 | send a SSH_MSG_KEXINIT packet then go to ASSH_TR_KEX_WAIT |
ASSH_TR_KEX_WAIT | 3 | We wait for a SSH_MSG_KEXINIT packet. |
ASSH_TR_KEX_SKIP | 4 | The next received SSH_MSG_KEXINIT packet must be ignored due to a bad guess. |
ASSH_TR_KEX_RUNNING | 5 | Both SSH_MSG_KEXINIT packet were sent, the key exchange is taking place. |
ASSH_TR_NEWKEY | 6 | The key exchange is over and a SSH_MSG_NEWKEYS packet is expected. |
ASSH_TR_SERVICE | 7 | No key exchange is running, service packets are allowed. |
ASSH_TR_SERVICE_KEX | 8 | Key re-exchange packet sent but not received, service packets are allowed. |
ASSH_TR_DISCONNECT | 9 | Only outgoing packets are processed so that a disconnection packet can be sent. |
ASSH_TR_CLOSED | 10 | Session closed, no more event will be reported. |
assh_status_t assh_transport_unimp(struct assh_session_s *s, struct assh_packet_s *pin) [link]
This function is for internal use only.
This function is declared in assh/assh_transport.h source file, line 194.
This function sends an SSH_MSG_UNIMPLEMENTED packet in response to the pin packet.
assh_status_t assh_transport_write(struct assh_session_s *s, struct assh_event_s *e) [link]
This function is for internal use only.
This function is declared in assh/assh_transport.h source file, line 202.
This function executes the transport output FSM code which enciphers packets and builds the output stream. It may report the ASSH_EVENT_READ event. It is called from the assh_event_get function.