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: SocketAddrDatagram source address; SNMP does not cryptographically authenticate it.
version: VersionProtocol 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: NotificationPduClassTrap 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: u32sysUpTime.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>
impl<'a> NotificationEnvelope<'a>
Sourcepub fn trap_oid(&self) -> Result<Oid>
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.
Sourcepub fn notification(&self) -> &'a Notification
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>
impl<'a> Clone for NotificationEnvelope<'a>
Source§fn clone(&self) -> NotificationEnvelope<'a>
fn clone(&self) -> NotificationEnvelope<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more