pub struct SshLayer {
pub index: LayerIndex,
}Expand description
SSH protocol layer view into a packet buffer.
Fields§
§index: LayerIndexImplementations§
Source§impl SshLayer
impl SshLayer
Sourcepub fn is_version_exchange(&self, buf: &[u8]) -> bool
pub fn is_version_exchange(&self, buf: &[u8]) -> bool
Check if this SSH data is a version exchange (starts with “SSH-”).
Sourcepub fn version_string<'a>(&self, buf: &'a [u8]) -> Option<&'a str>
pub fn version_string<'a>(&self, buf: &'a [u8]) -> Option<&'a str>
Extract the version string from a version exchange message.
Returns the version string without the trailing CRLF.
Sourcepub fn packet_length(&self, buf: &[u8]) -> Result<u32, FieldError>
pub fn packet_length(&self, buf: &[u8]) -> Result<u32, FieldError>
Read the packet_length field (first 4 bytes of binary packet).
Sourcepub fn padding_length(&self, buf: &[u8]) -> Result<u8, FieldError>
pub fn padding_length(&self, buf: &[u8]) -> Result<u8, FieldError>
Read the padding_length field (byte at offset 4 of binary packet).
Sourcepub fn message_type(&self, buf: &[u8]) -> Result<Option<u8>, FieldError>
pub fn message_type(&self, buf: &[u8]) -> Result<Option<u8>, FieldError>
Read the message type (first byte of payload, at offset 5).
Sourcepub fn payload_data<'a>(&self, buf: &'a [u8]) -> &'a [u8] ⓘ
pub fn payload_data<'a>(&self, buf: &'a [u8]) -> &'a [u8] ⓘ
Get the payload data (after padding_length byte, before random_padding).
Sourcepub fn get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Get a field value by name.
Sourcepub fn set_field(
&self,
_buf: &mut [u8],
_name: &str,
_value: FieldValue,
) -> Option<Result<(), FieldError>>
pub fn set_field( &self, _buf: &mut [u8], _name: &str, _value: FieldValue, ) -> Option<Result<(), FieldError>>
Set a field value by name (limited support for SSH).
Sourcepub fn field_names(&self) -> &'static [&'static str]
pub fn field_names(&self) -> &'static [&'static str]
Get field names.
Trait Implementations§
Source§impl Layer for SshLayer
impl Layer for SshLayer
Source§fn header_len(&self, data: &[u8]) -> usize
fn header_len(&self, data: &[u8]) -> usize
Get the header length for this layer
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Get the list of field names for this layer
Auto Trait Implementations§
impl Freeze for SshLayer
impl RefUnwindSafe for SshLayer
impl Send for SshLayer
impl Sync for SshLayer
impl Unpin for SshLayer
impl UnsafeUnpin for SshLayer
impl UnwindSafe for SshLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more