assh/assh_packet.h header reference

Description [link] 

This header provides functions used to build and parse the packet format used the ssh2 protocol.

See also assh/assh_buffer.h.

Header inclusion [link] 

Members [link] 

Types [link] 

Functions [link] 

Macros [link] 

Members detail [link] 

void assh_packet_collect(struct assh_context_s *c) [link] 

This function is declared in assh/assh_packet.h source file, line 242.

This function forces garbage collect of packets. This does nothing when CONFIG_ASSH_PACKET_POOL is not defined.

enum assh_ssh_disconnect_e [link] 

This enum is declared in assh/assh_packet.h source file, line 199.

This enum specifies standard ssh2 disconnect reasons.

IdentifierValueDescription
SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT1
SSH_DISCONNECT_PROTOCOL_ERROR2
SSH_DISCONNECT_KEY_EXCHANGE_FAILED3
SSH_DISCONNECT_RESERVED4
SSH_DISCONNECT_MAC_ERROR5
SSH_DISCONNECT_COMPRESSION_ERROR6
SSH_DISCONNECT_SERVICE_NOT_AVAILABLE7
SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED8
SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE9
SSH_DISCONNECT_CONNECTION_LOST10
SSH_DISCONNECT_BY_APPLICATION11
SSH_DISCONNECT_TOO_MANY_CONNECTIONS12
SSH_DISCONNECT_AUTH_CANCELLED_BY_USER13
SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE14
SSH_DISCONNECT_ILLEGAL_USER_NAME15
SSH_DISCONNECT_PRIVATE0xfe000000

enum assh_ssh_msg_e [link] 

This enum is declared in assh/assh_packet.h source file, line 139.

This enum specifies the standard values for ssh2 message ids.

IdentifierValueDescription
SSH_MSG_INVALID0
SSH_MSG_DISCONNECT1 Transport layer related message
SSH_MSG_IGNORE2 Transport layer related message
SSH_MSG_UNIMPLEMENTED3 Transport layer related message
SSH_MSG_DEBUG4 Transport layer related message
SSH_MSG_SERVICE_REQUEST5 Transport layer related message
SSH_MSG_SERVICE_ACCEPT6 Transport layer related message
SSH_MSG_KEXINIT20 Generic key-exchange message
SSH_MSG_NEWKEYS21 Generic key-exchange message
SSH_MSG_KEX_DH_REQUEST30 Method specific key-exchange message
SSH_MSG_KEX_DH_REPLY31 Method specific key-exchange message
SSH_MSG_KEX_ECDH_INIT30 Method specific key-exchange message
SSH_MSG_KEX_ECDH_REPLY31 Method specific key-exchange message
SSH_MSG_KEX_DH_GEX_REQUEST_OLD30 Method specific key-exchange message
SSH_MSG_KEX_DH_GEX_GROUP31 Method specific key-exchange message
SSH_MSG_KEX_DH_GEX_INIT32 Method specific key-exchange message
SSH_MSG_KEX_DH_GEX_REPLY33 Method specific key-exchange message
SSH_MSG_KEX_DH_GEX_REQUEST34 Method specific key-exchange message
SSH_MSG_KEXRSA_PUBKEY30 Method specific key-exchange message
SSH_MSG_KEXRSA_SECRET31 Method specific key-exchange message
SSH_MSG_KEXRSA_DONE32 Method specific key-exchange message
SSH_MSG_USERAUTH_REQUEST50 User authentication related message
SSH_MSG_USERAUTH_FAILURE51 User authentication related message
SSH_MSG_USERAUTH_SUCCESS52 User authentication related message
SSH_MSG_USERAUTH_BANNER53 User authentication related message
SSH_MSG_USERAUTH_PK_OK60 User authentication related message
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ60 User authentication related message
SSH_MSG_USERAUTH_INFO_REQUEST60 User authentication related message
SSH_MSG_USERAUTH_INFO_RESPONSE61 User authentication related message
SSH_MSG_GLOBAL_REQUEST80 Connection protocol related message
SSH_MSG_REQUEST_SUCCESS81 Connection protocol related message
SSH_MSG_REQUEST_FAILURE82 Connection protocol related message
SSH_MSG_CHANNEL_OPEN90 Connection protocol related message
SSH_MSG_CHANNEL_OPEN_CONFIRMATION91 Connection protocol related message
SSH_MSG_CHANNEL_OPEN_FAILURE92 Connection protocol related message
SSH_MSG_CHANNEL_WINDOW_ADJUST93 Connection protocol related message
SSH_MSG_CHANNEL_DATA94 Connection protocol related message
SSH_MSG_CHANNEL_EXTENDED_DATA95 Connection protocol related message
SSH_MSG_CHANNEL_EOF96 Connection protocol related message
SSH_MSG_CHANNEL_CLOSE97 Connection protocol related message
SSH_MSG_CHANNEL_REQUEST98 Connection protocol related message
SSH_MSG_CHANNEL_SUCCESS99 Connection protocol related message
SSH_MSG_CHANNEL_FAILURE100 Connection protocol related message

#define ASSH_PACKET_MAX_OVERHEAD [link] 

This macro is for internal use only.

This macro is declared in assh/assh_packet.h source file, line 257.

This macro specifies the maximum difference between the size of the packet payload and the size of the whole packet buffer.

This macro expands to:

#define ASSH_PACKET_MIN_OVERHEAD [link] 

This macro is for internal use only.

This macro is declared in assh/assh_packet.h source file, line 264.

This macro specifies the maximum difference between the size of the packet payload and the size of the whole packet buffer when minimal padding policy is used. When the padding len is <= 3, we will add at most ASSH_MAX_BLOCK_SIZE bytes.

This macro expands to:

#define ASSH_PACKET_OVERHEAD(pad_len, mac_len) [link] 

This macro is for internal use only.

This macro is declared in assh/assh_packet.h source file, line 252.

This macro specifies the difference between the size of the packet payload and the size of the whole packet buffer.

This macro expands to:

(ASSH_PACKET_HEADLEN + pad_len + mac_len)

assh_status_t assh_packet_add_array(struct assh_packet_s *p, size_t len, uint8_t **result) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 290.

This function allocates an array of bytes in a packet and returns a pointer to the array. If there is not enough space left in the packet, an error is returned.

assh_status_t assh_packet_add_string(struct assh_packet_s *p, size_t len, uint8_t **result) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 302.

This function allocates a string in a packet and returns a pointer to the first char of the string. If there is not enough space left in the packet, and error is returned.

assh_status_t assh_packet_add_u32(struct assh_packet_s *p, uint32_t value) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 296.

This function allocates an unsigned 32 bits integer in a packet and sets its value. If there is not enough space left in the packet, an error is returned.

assh_status_t assh_packet_alloc(struct assh_context_s *c, uint8_t msg, size_t payload_size_m1, struct assh_packet_s **result) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 238.

This function allocates a new packet. The payload_size_m1 parameter specifies the size of the payload minus one. This is amount of bytes between the message id and the padding.

assh_status_t assh_packet_alloc_raw(struct assh_context_s *c, size_t raw_size, struct assh_packet_s **p) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 222.

This function allocates a new packet. The buffer_size parameter specifies total allocated size. The size is not limited.

assh_status_t assh_packet_check_array(const struct assh_packet_s *p, const uint8_t *array, size_t array_len, const uint8_t **next) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 336.

This function checks that an array is well inside packet bounds.

See also assh_check_array.

assh_status_t assh_packet_check_string(const struct assh_packet_s *p, const uint8_t *str, const uint8_t **next) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 330.

This function checks that a string is well inside packet bounds.

See also assh_check_string.

assh_status_t assh_packet_check_u32(const struct assh_packet_s *p, uint32_t *u32, const uint8_t *data, const uint8_t **next) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 343.

This function checks that a 32 bits integer is well inside packet bounds and converts the value from network byte order.

See also assh_packet_check_array.

assh_status_t assh_packet_dup(struct assh_packet_s *p, struct assh_packet_s **copy) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 284.

This function creates a copy of a packet.

assh_status_t assh_packet_enlarge_string(struct assh_packet_s *p, uint8_t *str, size_t len, uint8_t **result) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 311.

This function enlarges a string previously allocated in a packet and returns a pointer to the first additional char of the string. If there is not enough space left in the packet, an error is returned. The string must be the last allocated thing in the packet when this function is called.

struct assh_packet_head_s [link] 

This struct is for internal use only.

This struct is declared in assh/assh_packet.h source file, line 45.

ssh2 protocol packet header

FieldDescription
uint8_t pck_len[4];
uint8_t pad_len;
uint8_t msg;
uint8_t end[0];

void assh_packet_queue_cleanup(struct assh_queue_s *q) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 275.

This function removes all packets from the queue and calls the assh_packet_release function for each packet.

assh_status_t assh_packet_realloc_raw(struct assh_context_s *c, struct assh_packet_s **p_, size_t raw_size) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 230.

This function allocates a new packet is the specified size can't be stored in the current packet. The original packet is not released and the data are not copied.

struct assh_packet_s * assh_packet_refinc(struct assh_packet_s *p) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 279.

This function increase the reference counter of the packet.

void assh_packet_release(struct assh_packet_s *p) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 271.

This function decreases the reference counter of the packet and release the packet if the new counter value is zero.

struct assh_packet_s [link] 

This struct is for internal use only.

This struct is declared in assh/assh_packet.h source file, line 65.

ssh2 packet object

FieldDescription
union <anonymous> {
struct assh_queue_entry_s entry;Packet queue entry, valid when packet is allocated.
struct assh_packet_s * pool_next;Spare packet pool entry, valid when packet has been released.
};
struct assh_context_s * ctx;Associated assh context
uint32_t buffer_size;Size of the pre-allocated packet data buffer.
uint32_t alloc_size;Size of the allocated packet data buffer.
uint32_t data_size;Amount of valid packet data. This value is increased when adding data to the packet and is used when the packet is finally sent out.
uint32_t seq;For output packets, this is the output sequence number, valid only after sending. For input packets, this is the input sequence number. For input SSH_MSG_UNIMPLEMENTED packets, this is changed to the output sequence number of the associated packet before dispatch to the service or kex layer.
See also sent.
uint8_t sent:1;This is set when the packet has been sent, indicating that the seq field is valid. The packet is released when this happens, unless the assh_packet_refinc function has been used.
uint8_t last:1;This is set for outgoing SSH_MSG_DISCONNECT packets before encryption.
uint8_t ref_count:5;Number of references to this packet.
enum assh_padding_policy_e padding:2;Padding size policy
union <anonymous> {
uint8_t data[0];
struct assh_packet_head_s head;
};

void assh_packet_shrink_string(struct assh_packet_s *p, uint8_t *str, size_t new_len) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 318.

This function reduces the size of a string previously allocated in a packet. The string must be the last allocated thing in the packet when this function is called.

void assh_packet_string_resized(struct assh_packet_s *p, uint8_t *str) [link] 

This function is for internal use only.

This function is declared in assh/assh_packet.h source file, line 324.

This function update the size of the packet using the size header of the string. The string must be the last allocated thing in the packet when this function is called.

enum assh_padding_policy_e [link] 

This enum is for internal use only.

This enum is declared in assh/assh_packet.h source file, line 54.

Specifies the ssh2 packet padding size policy

IdentifierValueDescription
ASSH_PADDING_MIN0Minimal padding size
ASSH_PADDING_MAX1Use maximal padding size according to allocated buffer size. This allows hiding the size of actual data in the enciphered packet.

enum assh_ssh_msg_ranges_e [link] 

This enum is for internal use only.

This enum is declared in assh/assh_packet.h source file, line 122.

This enum specifies ranges of ssh2 message ids.

IdentifierValueDescription
SSH_MSG_TRGENERIC_FIRST1 Transport layer generic messages
SSH_MSG_TRGENERIC_LAST19 Transport layer generic messages
SSH_MSG_ALGONEG_FIRST20 Algorithm negotiation messages
SSH_MSG_ALGONEG_LAST29 Algorithm negotiation messages
SSH_MSG_KEXSPEC_FIRST30 Specific key exchange method messages
SSH_MSG_KEXSPEC_LAST49 Specific key exchange method messages
SSH_MSG_SERVICE_FIRST50 Service messages
Valid XHTML 1.0 StrictGenerated by diaxen on Sun Oct 25 23:31:03 2020 using MkDoc