libssh
0.8.0
|
Functions to handle SSH buffers. More...
Functions | |
int | ssh_buffer_add_data (struct ssh_buffer_struct *buffer, const void *data, uint32_t len) |
Add data at the tail of a buffer. More... | |
void | ssh_buffer_free (struct ssh_buffer_struct *buffer) |
Deallocate a SSH buffer. More... | |
void * | ssh_buffer_get (struct ssh_buffer_struct *buffer) |
Get a pointer to the head of a buffer at the current position. More... | |
uint32_t | ssh_buffer_get_data (struct ssh_buffer_struct *buffer, void *data, uint32_t len) |
Get the remaining data out of the buffer and adjust the read pointer. More... | |
uint32_t | ssh_buffer_get_len (struct ssh_buffer_struct *buffer) |
Get the length of the buffer from the current position. More... | |
struct ssh_buffer_struct * | ssh_buffer_new (void) |
Create a new SSH buffer. More... | |
int | ssh_buffer_reinit (struct ssh_buffer_struct *buffer) |
Reinitialize a SSH buffer. More... | |
void | ssh_buffer_set_secure (ssh_buffer buffer) |
Sets the buffer as secure. More... | |
int | ssh_buffer_validate_length (struct ssh_buffer_struct *buffer, size_t len) |
Valdiates that the given length can be obtained from the buffer. More... | |
Functions to handle SSH buffers.
int ssh_buffer_add_data | ( | struct ssh_buffer_struct * | buffer, |
const void * | data, | ||
uint32_t | len | ||
) |
Add data at the tail of a buffer.
[in] | buffer | The buffer to add the data. |
[in] | data | A pointer to the data to add. |
[in] | len | The length of the data to add. |
References ssh_buffer_get(), ssh_buffer_get_len(), and ssh_string_len().
Referenced by channel_read_buffer(), sftp_free(), sftp_get_error(), ssh_buffer_validate_length(), ssh_channel_new(), ssh_channel_request_auth_agent(), ssh_channel_set_blocking(), ssh_pki_copy_cert_to_privkey(), and ssh_pki_import_pubkey_base64().
void ssh_buffer_free | ( | struct ssh_buffer_struct * | buffer | ) |
Deallocate a SSH buffer.
[in] | buffer | The buffer to free. |
Referenced by sftp_async_read_begin(), sftp_attributes_free(), sftp_canonicalize_path(), sftp_closedir(), sftp_free(), sftp_fstat(), sftp_fstatvfs(), sftp_fsync(), sftp_get_error(), sftp_init(), sftp_mkdir(), sftp_open(), sftp_opendir(), sftp_read(), sftp_readdir(), sftp_readlink(), sftp_rename(), sftp_rmdir(), sftp_server_init(), sftp_setstat(), sftp_statvfs(), sftp_symlink(), sftp_unlink(), sftp_write(), ssh_channel_cancel_forward(), ssh_channel_change_pty_size(), ssh_channel_free(), ssh_channel_listen_forward(), ssh_channel_new(), ssh_channel_open_forward(), ssh_channel_open_reverse_forward(), ssh_channel_open_x11(), ssh_channel_request_env(), ssh_channel_request_exec(), ssh_channel_request_pty_size(), ssh_channel_request_send_exit_signal(), ssh_channel_request_send_exit_status(), ssh_channel_request_send_signal(), ssh_channel_request_subsystem(), ssh_channel_request_x11(), ssh_free(), ssh_gssapi_get_creds(), ssh_key_clean(), ssh_message_free(), ssh_pki_copy_cert_to_privkey(), ssh_pki_export_privkey_file(), and ssh_pki_import_pubkey_base64().
void* ssh_buffer_get | ( | struct ssh_buffer_struct * | buffer | ) |
Get a pointer to the head of a buffer at the current position.
[in] | buffer | The buffer to get the head pointer. |
Referenced by sftp_free(), sftp_get_error(), ssh_buffer_add_data(), ssh_channel_new(), ssh_channel_read_timeout(), ssh_channel_request_auth_agent(), ssh_channel_set_blocking(), ssh_gssapi_get_creds(), ssh_message_free(), and ssh_pki_copy_cert_to_privkey().
uint32_t ssh_buffer_get_data | ( | struct ssh_buffer_struct * | buffer, |
void * | data, | ||
uint32_t | len | ||
) |
Get the remaining data out of the buffer and adjust the read pointer.
[in] | buffer | The buffer to read. |
[in] | data | The data buffer where to store the data. |
[in] | len | The length to read from the buffer. |
References ssh_buffer_validate_length().
Referenced by ssh_buffer_validate_length().
uint32_t ssh_buffer_get_len | ( | struct ssh_buffer_struct * | buffer | ) |
Get the length of the buffer from the current position.
[in] | buffer | The buffer to get the length from. |
Referenced by channel_read_buffer(), sftp_free(), sftp_get_error(), sftp_write(), ssh_buffer_add_data(), ssh_buffer_validate_length(), ssh_channel_get_exit_status(), ssh_channel_is_eof(), ssh_channel_new(), ssh_channel_poll(), ssh_channel_poll_timeout(), ssh_channel_read_timeout(), ssh_channel_request_auth_agent(), ssh_channel_set_blocking(), ssh_gssapi_get_creds(), ssh_message_free(), and ssh_pki_copy_cert_to_privkey().
struct ssh_buffer_struct* ssh_buffer_new | ( | void | ) |
Create a new SSH buffer.
Referenced by sftp_async_read_begin(), sftp_attributes_free(), sftp_canonicalize_path(), sftp_free(), sftp_fstat(), sftp_fstatvfs(), sftp_fsync(), sftp_get_error(), sftp_init(), sftp_mkdir(), sftp_open(), sftp_opendir(), sftp_read(), sftp_readdir(), sftp_readlink(), sftp_rename(), sftp_rmdir(), sftp_server_init(), sftp_setstat(), sftp_statvfs(), sftp_symlink(), sftp_unlink(), sftp_write(), ssh_channel_cancel_forward(), ssh_channel_change_pty_size(), ssh_channel_listen_forward(), ssh_channel_new(), ssh_channel_open_forward(), ssh_channel_open_reverse_forward(), ssh_channel_open_x11(), ssh_channel_request_env(), ssh_channel_request_exec(), ssh_channel_request_pty_size(), ssh_channel_request_send_exit_signal(), ssh_channel_request_send_exit_status(), ssh_channel_request_send_signal(), ssh_channel_request_subsystem(), ssh_channel_request_x11(), ssh_message_free(), ssh_new(), ssh_pki_copy_cert_to_privkey(), ssh_pki_export_privkey_file(), and ssh_pki_import_pubkey_base64().
int ssh_buffer_reinit | ( | struct ssh_buffer_struct * | buffer | ) |
Reinitialize a SSH buffer.
[in] | buffer | The buffer to reinitialize. |
Referenced by channel_read_buffer(), ssh_channel_close(), ssh_channel_new(), ssh_channel_request_auth_agent(), ssh_channel_send_eof(), ssh_channel_set_blocking(), ssh_disconnect(), ssh_gssapi_get_creds(), ssh_send_debug(), ssh_send_ignore(), ssh_set_message_callback(), ssh_userauth_none(), ssh_userauth_password(), ssh_userauth_publickey(), and ssh_userauth_try_publickey().
void ssh_buffer_set_secure | ( | ssh_buffer | buffer | ) |
Sets the buffer as secure.
A secure buffer will never leave cleartext data in the heap after being reallocated or freed.
[in] | buffer | buffer to set secure. |
Referenced by ssh_pki_copy_cert_to_privkey().
int ssh_buffer_validate_length | ( | struct ssh_buffer_struct * | buffer, |
size_t | len | ||
) |
Valdiates that the given length can be obtained from the buffer.
[in] | buffer | The buffer to read from. |
[in] | len | The length to be checked. |
References ssh_buffer_add_data(), ssh_buffer_get_data(), ssh_buffer_get_len(), ssh_string_data(), and ssh_string_new().
Referenced by ssh_buffer_get_data().