Enum csnmp::message::SnmpMessageError
source · pub enum SnmpMessageError {
Show 13 variants
Asn1Decoding(ASN1DecodeErr),
Asn1Encoding(ASN1EncodeErr),
Length {
expected: usize,
obtained: usize,
},
TooShort {
expected: usize,
obtained: usize,
},
UnexpectedType {
expected: ExpectedAsn1Type,
obtained: ASN1Block,
},
IntegerPrimitiveRange {
primitive_type: &'static str,
obtained: ASN1Block,
},
IncorrectVersion {
expected: i64,
obtained: i64,
},
UnexpectedTag {
obtained: BigUint,
},
UnexpectedTagClass {
expected: Vec<ASN1Class>,
obtained: ASN1Class,
},
UntaggedValue {
obtained: ASN1Block,
},
EnumRange {
enum_name: &'static str,
obtained: ASN1Block,
},
OidDecode {
oid: OID,
error: ObjectIdentifierConversionError,
},
OidEncode {
oid: ObjectIdentifier,
error: ObjectIdentifierConversionError,
},
}
Expand description
An error that has occurred while attempting to read an SNMP message.
Variants§
Asn1Decoding(ASN1DecodeErr)
An error has occurred while attempting to parse the ASN.1 message.
Asn1Encoding(ASN1EncodeErr)
An error has occurred while attempting to encode the ASN.1 message.
Length
The message, or a part of it, has an incorrect length. A specific length is expected.
expected
and obtained
are in units of ASN.1 blocks.
TooShort
The message, or a part of it, was too short. A minimum length is expected.
expected
and obtained
are in units of ASN.1 blocks.
UnexpectedType
While decoding the message, a different type was read than expected.
IntegerPrimitiveRange
While decoding an integer, it did not fit in the range of a primitive type.
IncorrectVersion
The SNMP message has an incorrect version.
UnexpectedTag
A value was tagged by an unexpected tag.
UnexpectedTagClass
A value was tagged by a tag of an unexpected class.
UntaggedValue
A value was expected to be tagged but wasn’t.
EnumRange
An out-of-range value has been obtained for an enumeration.
OidDecode
An object identifier has been encountered which is a valid ASN.1 object identifier but not a valid SNMP object identifier.
OidEncode
An object identifier has been encountered which is a valid SNMP object identifier but not a valid ASN.1 object identifier.
Implementations§
source§impl SnmpMessageError
impl SnmpMessageError
sourcepub fn check_min_length(
blocks: &[ASN1Block],
expected: usize
) -> Result<(), SnmpMessageError>
pub fn check_min_length( blocks: &[ASN1Block], expected: usize ) -> Result<(), SnmpMessageError>
Checks whether the given slice of ASN1Block
s has at least the given number of
elements. Returns Ok(())
if it does and Err(_)
with an appropriate SnmpMessageError
variant if it does not.
sourcepub fn check_length(
blocks: &[ASN1Block],
expected: usize
) -> Result<(), SnmpMessageError>
pub fn check_length( blocks: &[ASN1Block], expected: usize ) -> Result<(), SnmpMessageError>
Checks whether the given slice of ASN1Block
s has exactly the given number of
elements. Returns Ok(())
if it does and Err(_)
with an appropriate SnmpMessageError
variant if it does not.
sourcepub fn check_tag_class(
obtained: ASN1Class,
expected: ASN1Class
) -> Result<(), SnmpMessageError>
pub fn check_tag_class( obtained: ASN1Class, expected: ASN1Class ) -> Result<(), SnmpMessageError>
Checks whether the given ASN1Class
has the given value. Returns Ok(())
if it does and
Err(_)
with an appropriate SnmpMessageError
variant if it does not.
Trait Implementations§
source§impl Clone for SnmpMessageError
impl Clone for SnmpMessageError
source§fn clone(&self) -> SnmpMessageError
fn clone(&self) -> SnmpMessageError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SnmpMessageError
impl Debug for SnmpMessageError
source§impl Display for SnmpMessageError
impl Display for SnmpMessageError
source§impl Error for SnmpMessageError
impl Error for SnmpMessageError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<ASN1DecodeErr> for SnmpMessageError
impl From<ASN1DecodeErr> for SnmpMessageError
source§fn from(e: ASN1DecodeErr) -> Self
fn from(e: ASN1DecodeErr) -> Self
source§impl From<ASN1EncodeErr> for SnmpMessageError
impl From<ASN1EncodeErr> for SnmpMessageError
source§fn from(e: ASN1EncodeErr) -> Self
fn from(e: ASN1EncodeErr) -> Self
source§impl PartialEq for SnmpMessageError
impl PartialEq for SnmpMessageError
source§fn eq(&self, other: &SnmpMessageError) -> bool
fn eq(&self, other: &SnmpMessageError) -> bool
self
and other
values to be equal, and is used
by ==
.