SNMP subset of ASN.1 data types

The pysnmp.asn1 module implements a set of tools for handling ASN.1 data types used in SNMP.

class INTEGER([value])
class UNSIGNED32([value])
class TIMETICKS([value])
class COUNTER32([value])
class GAUGE32([value])
class COUNTER64([value])
class OPAQUE([value])
class OCTETSTRING([value])
class OBJECTID([value])
class IPADDRESS([value])
class NULL([value])

Instances of these classes represent a value of corresponding ASN.1 type. The optional value parameter may be used to assign an initial value.

def decode(data)

The decode function takes an ASN.1 value carried in a BER-encoded octet-stream data, and decodes it into a asn1.* object of matching type.

A tuple of (asn1_object, rest) is returned where asn1_object is an instance of one of asn1.py classes, and the rest is the unprocessed part of input.

exception Error

Exception raised on any error in the pysnmp.asn1 module and derivatives. The reason for the exception is passed to the constructor as a string.

See documentation on the error.General base class for usage details.

The following exceptions are derived from this class:

exception UnknownTag

Unknown BER tag passed to an asn1.* method occurred.

exception OverFlow

Data item does not fit the BER octet-stream.

exception UnderRun

Short BER octet-stream.

exception BadEncoding

Malformed BER octet-stream.

exception BadArgument

Inappropriate argument given.

exception TypeError

Inappropriate type for an ASN.1 object value.


Subsections


ilya@glas.net