libssh
|
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... | |
int | ssh_buffer_allocate_size (struct ssh_buffer_struct *buffer, uint32_t len) |
Ensure the buffer has at least a certain preallocated size. 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. |
Referenced by channel_read_buffer().
int ssh_buffer_allocate_size | ( | struct ssh_buffer_struct * | buffer, |
uint32_t | len | ||
) |
Ensure the buffer has at least a certain preallocated size.
[in] | buffer | The buffer to enlarge. |
[in] | len | The length to ensure as allocated. |
Referenced by sftp_attributes_free(), sftp_canonicalize_path(), sftp_fstat(), sftp_fstatvfs(), sftp_fsync(), sftp_opendir(), sftp_readdir(), sftp_readlink(), sftp_setstat(), and sftp_statvfs().
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_fstat(), sftp_fstatvfs(), sftp_get_error(), sftp_mkdir(), sftp_open(), sftp_opendir(), sftp_read(), sftp_readdir(), sftp_readlink(), sftp_rename(), sftp_rmdir(), sftp_setstat(), sftp_statvfs(), sftp_symlink(), sftp_unlink(), sftp_write(), and ssh_channel_new().
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. |
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().
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 sftp_write(), ssh_channel_is_eof(), ssh_channel_poll(), and ssh_channel_read_timeout().
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_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_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_break(), 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_new(), and ssh_pki_copy_cert_to_privkey().
int ssh_buffer_reinit | ( | struct ssh_buffer_struct * | buffer | ) |
Reinitialize a SSH buffer.
[in] | buffer | The buffer to reinitialize. |
Referenced by channel_read_buffer().
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. |
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. |
Referenced by ssh_buffer_get_data().