pub struct CommunityMessage {
pub version: Version,
pub community: Bytes,
pub pdu: Pdu,
}Expand description
Community-based SNMP message (v1/v2c).
This unified type handles both SNMPv1 and SNMPv2c messages, which share identical structure but differ in version number.
Fields§
§version: VersionSNMP version (V1 or V2c)
community: BytesCommunity string for authentication
pdu: PduProtocol data unit
Implementations§
Source§impl CommunityMessage
impl CommunityMessage
Sourcepub fn v2c(community: impl Into<Bytes>, pdu: Pdu) -> Self
pub fn v2c(community: impl Into<Bytes>, pdu: Pdu) -> Self
Create a V2c message (convenience constructor).
Sourcepub fn v1(community: impl Into<Bytes>, pdu: Pdu) -> Self
pub fn v1(community: impl Into<Bytes>, pdu: Pdu) -> Self
Create a V1 message (convenience constructor).
Sourcepub fn decode(data: Bytes) -> Result<Self>
pub fn decode(data: Bytes) -> Result<Self>
Decode from BER.
Returns the message with the version parsed from the data.
Sourcepub fn encode_bulk(
version: Version,
community: impl Into<Bytes>,
pdu: &GetBulkPdu,
) -> Bytes
pub fn encode_bulk( version: Version, community: impl Into<Bytes>, pdu: &GetBulkPdu, ) -> Bytes
Encode a GETBULK request message (v2c/v3 only).
GETBULK is not supported in SNMPv1.
Trait Implementations§
Source§impl Clone for CommunityMessage
impl Clone for CommunityMessage
Source§fn clone(&self) -> CommunityMessage
fn clone(&self) -> CommunityMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommunityMessage
impl Debug for CommunityMessage
Source§impl From<CommunityMessage> for Message
impl From<CommunityMessage> for Message
Source§fn from(msg: CommunityMessage) -> Self
fn from(msg: CommunityMessage) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for CommunityMessage
impl RefUnwindSafe for CommunityMessage
impl Send for CommunityMessage
impl Sync for CommunityMessage
impl Unpin for CommunityMessage
impl UnwindSafe for CommunityMessage
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