PySNMP: ASN.1: Base classes

### Base classes for ASN.1 objects

The pysnmp.asn1.base module implements base classes for various ASN.1 types as defined by ASN.1 standard.

class Asn1Object()

  This is the base class for all ASN.1 objects. It defines ASN.1-specific object properties and behaviour. See Subsections for details.

class SimpleAsn1Object([value])

  This is the base class for all "simple", that is non-structured ASN.1 objects. It's a subclass of Asn1Object class, with additional methods (see below) and the following deviations from the base class:

  - ASN.1 tag format set to tagFormats['SIMPLE']

  The optional value argument may used to assign initial value to ASN.1 object. The type of value must be the same as accepted by particular ASN.1 object implementation.

class RecordTypeAsn1Object([**kwargs ])

  This is a base class for structured ASN.1 objects holding named component types. It's a subclass of Asn1Object class, with additional methods (see below) and the following deviations from the base class:

  - ASN.1 tag format set to tagFormats['CONSTRUCTED']

  Instances of this class implement mapping object protocol (Python dictionary) for storing and managing its component types. Embedded type names serve as keys while its values are references to instances of component objects.

  The optional kwargs keyword arguments may used to assign initial key-value pairs to ASN.1 object. The allowed keys and values types are specific to ASN.1 object implementation.

class ChoiceTypeAsn1Object([**kwargs ])

  This is a base class for structured ASN.1 objects holding only a single named component chosen from a set of possible values. It's a subclass of Asn1Object class, with additional methods (see below) and the following deviations from the base class:

  - ASN.1 tag format set to tagFormats['CONSTRUCTED']

  Instances of this class implement mapping object protocol (Python dictionary) for storing and managing its component types. Embedded type names serve as keys while its values are references to instances of component objects.

  The optional kwargs keyword arguments may used to assign initial key-value pair to ASN.1 object. The allowed key and value type is specific to ASN.1 object implementation.

class VariableTypeAsn1Object([args])

  This is a base class for structured ASN.1 objects holding a set of unnamed components of a single ASN.1 type. It's a subclass of Asn1Object class, with additional methods (see below) and the following deviations from the base class:

  - ASN.1 tag format set to tagFormats['CONSTRUCTED']

  Instances of this class implement sequence object protocol (Python list) for storing and managing its components (class instances).

  The optional args argument may used to assign set of values (a list of class instances) to ASN.1 object. The allowed value type is specific to ASN.1 object implementation.

The following set of dictionaries hold various constants as defined by the ASN.1 standard:

tagClasses

  This dictionary holds ASN.1 class identifiers indexed by the following keys: 'UNIVERSAL', 'APPLICATION', 'CONTEXT', 'PRIVATE'.

tagFormats

  This dictionary holds ASN.1 tag formats indexed by the following keys: 'SIMPLE', 'CONSTRUCTED'.

tagCategories

  This dictionary holds ASN.1 tag category identifiers (tagging methods) indexed by the following keys: 'IMPLICIT', 'EXPLICIT', 'UNTAGGED'.

Methods of the above classes may raise exceptions based on error.Asn1Error base class.

Subsections

- Objects of Asn1Object class.
- Objects of SimpleAsn1Object class.
- Objects of RecordTypeAsn1Object class.
- Objects of ChoiceTypeAsn1Object class.
- Objects of VariableTypeAsn1Object class.