Notification

Enum Notification 

Source
pub enum Notification {
    TrapV1 {
        community: Bytes,
        trap: TrapV1Pdu,
    },
    TrapV2c {
        community: Bytes,
        uptime: u32,
        trap_oid: Oid,
        varbinds: Vec<VarBind>,
        request_id: i32,
    },
    TrapV3 {
        username: Bytes,
        context_engine_id: Bytes,
        context_name: Bytes,
        uptime: u32,
        trap_oid: Oid,
        varbinds: Vec<VarBind>,
        request_id: i32,
    },
    InformV2c {
        community: Bytes,
        uptime: u32,
        trap_oid: Oid,
        varbinds: Vec<VarBind>,
        request_id: i32,
    },
    InformV3 {
        username: Bytes,
        context_engine_id: Bytes,
        context_name: Bytes,
        uptime: u32,
        trap_oid: Oid,
        varbinds: Vec<VarBind>,
        request_id: i32,
    },
}
Expand description

Received SNMP notification.

This enum represents all types of SNMP notifications that can be received:

  • SNMPv1 Trap (different PDU structure)
  • SNMPv2c/v3 Trap (standard PDU with sysUpTime.0 and snmpTrapOID.0)
  • InformRequest (confirmed notification, response will be sent automatically)

Variants§

§

TrapV1

SNMPv1 Trap with unique PDU structure.

Fields

§community: Bytes

Community string used for authentication

§trap: TrapV1Pdu

The trap PDU

§

TrapV2c

SNMPv2c Trap (unconfirmed notification).

Fields

§community: Bytes

Community string used for authentication

§uptime: u32

sysUpTime.0 value (hundredths of seconds since agent init)

§trap_oid: Oid

snmpTrapOID.0 value (trap type identifier)

§varbinds: Vec<VarBind>

Additional variable bindings

§request_id: i32

Original request ID (for logging/correlation)

§

TrapV3

SNMPv3 Trap (unconfirmed notification).

Fields

§username: Bytes

Username from USM

§context_engine_id: Bytes

Context engine ID

§context_name: Bytes

Context name

§uptime: u32

sysUpTime.0 value

§trap_oid: Oid

snmpTrapOID.0 value

§varbinds: Vec<VarBind>

Additional variable bindings

§request_id: i32

Original request ID

§

InformV2c

InformRequest (confirmed notification) - v2c.

A response is automatically sent when this notification is received.

Fields

§community: Bytes

Community string

§uptime: u32

sysUpTime.0 value

§trap_oid: Oid

snmpTrapOID.0 value

§varbinds: Vec<VarBind>

Additional variable bindings

§request_id: i32

Request ID (used in response)

§

InformV3

InformRequest (confirmed notification) - v3.

A response is automatically sent when this notification is received.

Fields

§username: Bytes

Username from USM

§context_engine_id: Bytes

Context engine ID

§context_name: Bytes

Context name

§uptime: u32

sysUpTime.0 value

§trap_oid: Oid

snmpTrapOID.0 value

§varbinds: Vec<VarBind>

Additional variable bindings

§request_id: i32

Request ID

Implementations§

Source§

impl Notification

Source

pub fn trap_oid(&self) -> &Oid

Get the trap/notification OID.

For TrapV1, this is derived from enterprise + generic/specific trap. For v2c/v3, this is the snmpTrapOID.0 value.

Source

pub fn uptime(&self) -> u32

Get the uptime value (sysUpTime.0 or time_stamp for v1).

Source

pub fn varbinds(&self) -> &[VarBind]

Get the variable bindings.

Source

pub fn is_confirmed(&self) -> bool

Check if this is a confirmed notification (InformRequest).

Source

pub fn version(&self) -> Version

Get the SNMP version of this notification.

Trait Implementations§

Source§

impl Clone for Notification

Source§

fn clone(&self) -> Notification

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 Notification

Source§

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

Formats the value using the given formatter. Read more

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more