Skip to main content

NotificationEnvelope

Struct NotificationEnvelope 

Source
pub struct NotificationEnvelope<'a> {
    pub source: SocketAddr,
    pub version: Version,
    pub community: Option<&'a Community>,
    pub username: Option<&'a [u8]>,
    pub security_level: Option<SecurityLevel>,
    pub pdu_class: NotificationPduClass,
    pub context_engine_id: Option<&'a [u8]>,
    pub context_name: Option<&'a [u8]>,
    pub uptime: u32,
    pub varbinds: &'a [VarBind],
    pub request_id: Option<i32>,
    pub decode_anomalies: &'a [DecodeAnomaly],
    /* private fields */
}
Expand description

A borrowed, normalized view of one fully processed notification.

Protocol decoding, configured community filtering, applicable USM authentication/decryption, and standard notification-prefix validation finish before this envelope is created. Its fields have the assurance indicated by security_level: v1/v2c community and content are cleartext and, without an allowlist, unverified; v3 username, context, and declared envelope content are authenticated only at SecurityLevel::AuthNoPriv or SecurityLevel::AuthPriv and are spoofable at SecurityLevel::NoAuthNoPriv. The policy decision is made before any Inform response attempt or delivery.

Fields§

§source: SocketAddr

Datagram source address; SNMP does not cryptographically authenticate it.

§version: Version

Protocol version.

§community: Option<&'a Community>

Community for v1/v2c, or None for v3.

The value is cleartext. Without a configured community allowlist it is an unverified claim; an allowlist checks equality but provides no message integrity.

§username: Option<&'a [u8]>

USM username for v3, or None for v1/v2c.

Authenticated only when security_level is AuthNoPriv or AuthPriv; spoofable when it is NoAuthNoPriv.

§security_level: Option<SecurityLevel>

Actual v3 wire security level, or None for v1/v2c.

§pdu_class: NotificationPduClass

Trap or Inform classification.

§context_engine_id: Option<&'a [u8]>

Scoped-PDU context engine ID for v3, or None for v1/v2c.

Authenticated only at AuthNoPriv or AuthPriv; spoofable at NoAuthNoPriv.

§context_name: Option<&'a [u8]>

Scoped-PDU context name for v3, or None for v1/v2c.

Authenticated only at AuthNoPriv or AuthPriv; spoofable at NoAuthNoPriv.

§uptime: u32

sysUpTime.0, or the v1 trap timestamp, in hundredths of a second.

This content is authenticated only for v3 AuthNoPriv/AuthPriv.

§varbinds: &'a [VarBind]

Notification-specific variable bindings, excluding the standard v2/v3 uptime and trap-OID prefix.

This content is authenticated only for v3 AuthNoPriv/AuthPriv.

§request_id: Option<i32>

Request ID for v2c/v3 notifications, or None for v1 traps.

§decode_anomalies: &'a [DecodeAnomaly]

Accepted BER/value deviations from the received message, in decode order.

Community and V3 NoAuthNoPriv anomalies are unauthenticated. For authenticated V3 messages, anomalies within the declared envelope are authenticated, but a top-level crate::DecodeAnomaly::TrailingBytes describes bytes outside that envelope and remains unauthenticated.

Implementations§

Source§

impl<'a> NotificationEnvelope<'a>

Source

pub fn trap_oid(&self) -> Result<Oid>

Return the normalized notification OID.

V1 trap OIDs are derived from the generic/specific trap fields and can fail when a decoded enterprise-specific trap cannot form a valid OID. Like the rest of the notification content, this value is authenticated only for v3 AuthNoPriv/AuthPriv messages.

Source

pub fn notification(&self) -> &'a Notification

Return the complete version-specific notification.

Consult Self::security_level before treating v3 identity, context, or content as authenticated. V1/v2c values have no cryptographic integrity.

Trait Implementations§

Source§

impl<'a> Clone for NotificationEnvelope<'a>

Source§

fn clone(&self) -> NotificationEnvelope<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for NotificationEnvelope<'a>

Source§

impl<'a> Debug for NotificationEnvelope<'a>

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