Skip to main content

LayerEnum

Enum LayerEnum 

Source
pub enum LayerEnum {
Show 30 variants Ethernet(EthernetLayer), Dot3(Dot3Layer), Arp(ArpLayer), Ipv4(Ipv4Layer), Ipv6(Ipv6Layer), Icmp(IcmpLayer), Icmpv6(Icmpv6Layer), Tcp(TcpLayer), Udp(UdpLayer), Dns(DnsLayer), Ssh(SshLayer), Tls(TlsLayer), Dot15d4(Dot15d4Layer), Dot15d4Fcs(Dot15d4FcsLayer), Dot11(Dot11Layer), Http(HttpLayer), Http2(Http2Layer), Quic(QuicLayer), L2tp(L2tpLayer), Mqtt(MqttLayer), MqttSn(MqttSnLayer), Modbus(ModbusLayer), ZWave(ZWaveLayer), Ftp(FtpLayer), Tftp(TftpLayer), Smtp(SmtpLayer), Pop3(Pop3Layer), Imap(ImapLayer), Dhcp(DhcpLayer), Raw(RawLayer),
}
Expand description

Enum dispatch for protocol layers.

The LayerDispatch trait is auto-implemented by enum_dispatch, eliminating manual match arms and enabling better inlining.

Variants§

Implementations§

Source§

impl LayerEnum

Source

pub fn kind(&self) -> LayerKind

Delegate to LayerDispatch::dispatch_kind (auto-generated by enum_dispatch).

Source

pub fn index(&self) -> &LayerIndex

Delegate to LayerDispatch::dispatch_index.

Source

pub fn summary(&self, buf: &[u8]) -> String

Delegate to LayerDispatch::dispatch_summary.

Source

pub fn hashret(&self, buf: &[u8]) -> Vec<u8>

Delegate to LayerDispatch::dispatch_hashret.

Source

pub fn header_len(&self, buf: &[u8]) -> usize

Delegate to LayerDispatch::dispatch_header_len.

Source

pub fn show_fields(&self, buf: &[u8]) -> Vec<(&'static str, String)>

Delegate to LayerDispatch::dispatch_show_fields.

Source

pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>

Delegate to LayerDispatch::dispatch_get_field.

Source

pub fn set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>

Delegate to LayerDispatch::dispatch_set_field.

Source

pub fn field_names(&self) -> &'static [&'static str]

Delegate to LayerDispatch::dispatch_field_names.

Trait Implementations§

Source§

impl Clone for LayerEnum

Source§

fn clone(&self) -> LayerEnum

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LayerEnum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ArpLayer> for LayerEnum

Source§

fn from(v: ArpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<DhcpLayer> for LayerEnum

Source§

fn from(v: DhcpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<DnsLayer> for LayerEnum

Source§

fn from(v: DnsLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Dot11Layer> for LayerEnum

Source§

fn from(v: Dot11Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Dot15d4FcsLayer> for LayerEnum

Source§

fn from(v: Dot15d4FcsLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Dot15d4Layer> for LayerEnum

Source§

fn from(v: Dot15d4Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Dot3Layer> for LayerEnum

Source§

fn from(v: Dot3Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<EthernetLayer> for LayerEnum

Source§

fn from(v: EthernetLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<FtpLayer> for LayerEnum

Source§

fn from(v: FtpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Http2Layer> for LayerEnum

Source§

fn from(v: Http2Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<HttpLayer> for LayerEnum

Source§

fn from(v: HttpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<IcmpLayer> for LayerEnum

Source§

fn from(v: IcmpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Icmpv6Layer> for LayerEnum

Source§

fn from(v: Icmpv6Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<ImapLayer> for LayerEnum

Source§

fn from(v: ImapLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Ipv4Layer> for LayerEnum

Source§

fn from(v: Ipv4Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Ipv6Layer> for LayerEnum

Source§

fn from(v: Ipv6Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<L2tpLayer> for LayerEnum

Source§

fn from(v: L2tpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<ModbusLayer> for LayerEnum

Source§

fn from(v: ModbusLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<MqttLayer> for LayerEnum

Source§

fn from(v: MqttLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<MqttSnLayer> for LayerEnum

Source§

fn from(v: MqttSnLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<Pop3Layer> for LayerEnum

Source§

fn from(v: Pop3Layer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<QuicLayer> for LayerEnum

Source§

fn from(v: QuicLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<RawLayer> for LayerEnum

Source§

fn from(v: RawLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<SmtpLayer> for LayerEnum

Source§

fn from(v: SmtpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<SshLayer> for LayerEnum

Source§

fn from(v: SshLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<TcpLayer> for LayerEnum

Source§

fn from(v: TcpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<TftpLayer> for LayerEnum

Source§

fn from(v: TftpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<TlsLayer> for LayerEnum

Source§

fn from(v: TlsLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<UdpLayer> for LayerEnum

Source§

fn from(v: UdpLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl From<ZWaveLayer> for LayerEnum

Source§

fn from(v: ZWaveLayer) -> LayerEnum

Converts to this type from the input type.
Source§

impl LayerDispatch for LayerEnum

Source§

fn dispatch_kind(&self) -> LayerKind

Get the kind of this layer.

Source§

fn dispatch_index(&self) -> &LayerIndex

Get the layer index (start/end offsets).

Source§

fn dispatch_summary(&self, __enum_dispatch_arg_0: &[u8]) -> String

Get a human-readable summary.

Source§

fn dispatch_header_len(&self, __enum_dispatch_arg_0: &[u8]) -> usize

Get the header length in bytes.

Source§

fn dispatch_hashret(&self, __enum_dispatch_arg_0: &[u8]) -> Vec<u8>

Compute a hash for packet matching.

Source§

fn dispatch_field_names(&self) -> &'static [&'static str]

Get field names for this layer type.

Source§

fn dispatch_get_field( &self, __enum_dispatch_arg_0: &[u8], __enum_dispatch_arg_1: &str, ) -> Option<Result<FieldValue, FieldError>>

Get a field value by name.

Source§

fn dispatch_set_field( &self, __enum_dispatch_arg_0: &mut [u8], __enum_dispatch_arg_1: &str, __enum_dispatch_arg_2: FieldValue, ) -> Option<Result<(), FieldError>>

Set a field value by name.

Source§

fn dispatch_show_fields( &self, __enum_dispatch_arg_0: &[u8], ) -> Vec<(&'static str, String)>

Get show-fields output.

Source§

impl TryInto<ArpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<ArpLayer, <Self as TryInto<ArpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<DhcpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<DhcpLayer, <Self as TryInto<DhcpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<DnsLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<DnsLayer, <Self as TryInto<DnsLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Dot11Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Dot11Layer, <Self as TryInto<Dot11Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<Dot15d4FcsLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<Dot15d4FcsLayer, <Self as TryInto<Dot15d4FcsLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Dot15d4Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<Dot15d4Layer, <Self as TryInto<Dot15d4Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<Dot3Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Dot3Layer, <Self as TryInto<Dot3Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<EthernetLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<EthernetLayer, <Self as TryInto<EthernetLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<FtpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<FtpLayer, <Self as TryInto<FtpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Http2Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Http2Layer, <Self as TryInto<Http2Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<HttpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<HttpLayer, <Self as TryInto<HttpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<IcmpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<IcmpLayer, <Self as TryInto<IcmpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Icmpv6Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Icmpv6Layer, <Self as TryInto<Icmpv6Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<ImapLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<ImapLayer, <Self as TryInto<ImapLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Ipv4Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ipv4Layer, <Self as TryInto<Ipv4Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<Ipv6Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ipv6Layer, <Self as TryInto<Ipv6Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<L2tpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<L2tpLayer, <Self as TryInto<L2tpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<ModbusLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<ModbusLayer, <Self as TryInto<ModbusLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<MqttLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<MqttLayer, <Self as TryInto<MqttLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<MqttSnLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<MqttSnLayer, <Self as TryInto<MqttSnLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<Pop3Layer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Pop3Layer, <Self as TryInto<Pop3Layer>>::Error>

Performs the conversion.
Source§

impl TryInto<QuicLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<QuicLayer, <Self as TryInto<QuicLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<RawLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<RawLayer, <Self as TryInto<RawLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<SmtpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<SmtpLayer, <Self as TryInto<SmtpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<SshLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<SshLayer, <Self as TryInto<SshLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<TcpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<TcpLayer, <Self as TryInto<TcpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<TftpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<TftpLayer, <Self as TryInto<TftpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<TlsLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<TlsLayer, <Self as TryInto<TlsLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<UdpLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<UdpLayer, <Self as TryInto<UdpLayer>>::Error>

Performs the conversion.
Source§

impl TryInto<ZWaveLayer> for LayerEnum

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<ZWaveLayer, <Self as TryInto<ZWaveLayer>>::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V