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
Source§impl LayerDispatch for SshLayer
impl LayerDispatch for SshLayer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Get the kind of this layer.
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Get the layer index (start/end offsets).
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Get a human-readable summary.
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Get the header length in bytes.
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Get field names for this layer type.
Source§fn dispatch_get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
fn dispatch_get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Get a field value by name.
Source§fn dispatch_set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
fn dispatch_set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Set a field value by name.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more