pysnmp.asn1.encoding.ber.univ
index
/home/mcfletch/pylive/pysnmp/asn1/encoding/ber/univ.py

Basic Encoding Rules implementation for "universal" ASN.1 data types.
 
Copyright 1999-2002 by Ilya Etingof <ilya@glas.net>. See LICENSE for
details.
 
The BER processing part of this code has been partially derived
from Simon Leinen's <simon@switch.ch> BER Perl module.

 
Modules
       
pysnmp.asn1.encoding.ber.base
pysnmp.asn1.encoding.ber.error
pysnmp.asn1.oid
pysnmp.asn1.univ

 
Classes
       
OrderedFixedTypeAsn1Object(FixedTypeAsn1Object)
SequenceMixIn
OrderedVariableTypeAsn1Object(VariableTypeAsn1Object)
SequenceOfMixIn
SimpleAsn1Object(BerObject)
BooleanMixIn
IntegerMixIn
EnumeratedMixIn
NullMixIn
ObjectIdentifierMixIn
OctetStringMixIn
BitStringMixIn
RealMixIn
SingleFixedTypeAsn1Object(FixedTypeAsn1Object)
ChoiceMixIn
ChoiceMixIn
UnorderedFixedTypeAsn1Object(FixedTypeAsn1Object)
SetMixIn
UnorderedVariableTypeAsn1Object(VariableTypeAsn1Object)
SetOfMixIn

 
class BitStringMixIn(OctetStringMixIn)
    BER for ASN.1 BITSTRING type
 
 
Method resolution order:
BitStringMixIn
OctetStringMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class BooleanMixIn(SimpleAsn1Object)
    Implements BER processing for an ASN.1 boolean object
 
 
Method resolution order:
BooleanMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class ChoiceMixIn(SingleFixedTypeAsn1Object)
    Implements BER processing for an ASN.1 CHOICE object
 
 
Method resolution order:
ChoiceMixIn
SingleFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from SingleFixedTypeAsn1Object:
berDecode(self, input)
decode = berDecode(self, input)

Methods inherited from FixedTypeAsn1Object:
berEncode(self)
Choose optimised version of berEncode for this class
berEncodeWOutSub(self)
berEncodeWSub() -> octet string
 
For classes which do *not* have a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
berEncodeWSub(self)
berEncodeWSub() -> octet string
 
For classes which *have* a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
encode = berEncode(self)
Choose optimised version of berEncode for this class

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class EnumeratedMixIn(IntegerMixIn)
    Same as Integer
 
 
Method resolution order:
EnumeratedMixIn
IntegerMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class IntegerMixIn(SimpleAsn1Object)
    Implements BER processing for an ASN.1 integer object
 
 
Method resolution order:
IntegerMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class NullMixIn(SimpleAsn1Object)
    BER for ASN.1 NULL object
 
 
Method resolution order:
NullMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class ObjectIdentifierMixIn(SimpleAsn1Object)
    BER for ASN.1 OBJECTIDENTIFIER object
 
 
Method resolution order:
ObjectIdentifierMixIn
SimpleAsn1Object
BerObject

Class methods defined here:
berInternEncoding(cls, oid) from __builtin__.classobj
Given an OID value, cache the BER encoded values for reference

Data and other attributes defined here:
BER_BACKWARD_CACHE = {}
BER_FORWARD_CACHE = {}

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class OctetStringMixIn(SimpleAsn1Object)
    Implements BER processing for an ASN.1 OCTETSTRING object
 
 
Method resolution order:
OctetStringMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class RealMixIn(SimpleAsn1Object)
    BER for ASN.1 REAL object
 
 
Method resolution order:
RealMixIn
SimpleAsn1Object
BerObject

Methods inherited from SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, value=None)
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class SequenceMixIn(OrderedFixedTypeAsn1Object)
    Implements BER processing for an ASN.1 SEQUENCE object
 
 
Method resolution order:
SequenceMixIn
OrderedFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from OrderedFixedTypeAsn1Object:
berDecode(self, input)
berDecode(input) -> rest
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
decode = berDecode(self, input)
berDecode(input) -> rest
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.

Methods inherited from FixedTypeAsn1Object:
berEncode(self)
Choose optimised version of berEncode for this class
berEncodeWOutSub(self)
berEncodeWSub() -> octet string
 
For classes which do *not* have a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
berEncodeWSub(self)
berEncodeWSub() -> octet string
 
For classes which *have* a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
encode = berEncode(self)
Choose optimised version of berEncode for this class

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class SequenceOfMixIn(OrderedVariableTypeAsn1Object)
    Implements BER processing for an ASN.1 SEQUENCE OF object
 
 
Method resolution order:
SequenceOfMixIn
OrderedVariableTypeAsn1Object
VariableTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from VariableTypeAsn1Object:
berDecode(self, input)
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, args=[])
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, args=[])
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class SetMixIn(UnorderedFixedTypeAsn1Object)
    Implements BER processing for an ASN.1 SET object
 
 
Method resolution order:
SetMixIn
UnorderedFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from UnorderedFixedTypeAsn1Object:
berDecode(self, input)
berDecode(input) -> rest
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
decode = berDecode(self, input)
berDecode(input) -> rest
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.

Methods inherited from FixedTypeAsn1Object:
berEncode(self)
Choose optimised version of berEncode for this class
berEncodeWOutSub(self)
berEncodeWSub() -> octet string
 
For classes which do *not* have a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
berEncodeWSub(self)
berEncodeWSub() -> octet string
 
For classes which *have* a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
encode = berEncode(self)
Choose optimised version of berEncode for this class

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
class SetOfMixIn(UnorderedVariableTypeAsn1Object)
    Implements BER processing for an ASN.1 SET OF object
 
 
Method resolution order:
SetOfMixIn
UnorderedVariableTypeAsn1Object
VariableTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from VariableTypeAsn1Object:
berDecode(self, input)
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
berEncode(self, args=[])
berEncode() -> octet string
 
BER encode object payload whenever possible
decode = berDecode(self, input)
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
encode = berEncode(self, args=[])
berEncode() -> octet string
 
BER encode object payload whenever possible

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
mixIn = class ChoiceMixIn(SingleFixedTypeAsn1Object)
    Implements BER processing for an ASN.1 CHOICE object
 
 
Method resolution order:
ChoiceMixIn
SingleFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods inherited from SingleFixedTypeAsn1Object:
berDecode(self, input)
decode = berDecode(self, input)

Methods inherited from FixedTypeAsn1Object:
berEncode(self)
Choose optimised version of berEncode for this class
berEncodeWOutSub(self)
berEncodeWSub() -> octet string
 
For classes which do *not* have a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
berEncodeWSub(self)
berEncodeWSub() -> octet string
 
For classes which *have* a _berEncode only!
 
Note:
    This should be bound by a metaclass on looking
    at the final class, *not* as is done now by
    binding at time-of-use.
encode = berEncode(self)
Choose optimised version of berEncode for this class

Methods inherited from StructuredAsn1Object:
berUnwrapHeader(self, input)
Decode BER header, return (data, rest)
berWrapHeader(self, input)
Add BER header to data chunk if needed

Methods inherited from BerObject:
berDecodeLength(self, input)
berDecodeLength(input) -> (length, size)
 
Return the data item's length (integer) and the size of length
data (integer).
berEncodeLength(self, length)
berEncodeLength(length) -> octet string
 
BER encode ASN.1 data item length (integer).
berEncodeTag(self, (tagClass, tagFormat, tagId)=(None, None, None))
BER encode ASN.1 type tag

Data and other attributes inherited from BerObject:
tagClass = 0
tagFormat = 0
tagId = 0

 
Data
        __all__ = ['BooleanMixIn', 'IntegerMixIn', 'BitStringMixIn', 'OctetStringMixIn', 'NullMixIn', 'ObjectIdentifierMixIn', 'RealMixIn', 'EnumeratedMixIn', 'SequenceMixIn', 'SequenceOfMixIn', 'SetMixIn', 'SetOfMixIn', 'ChoiceMixIn']
mixInComps = [(<class pysnmp.asn1.univ.Boolean>, <class pysnmp.asn1.encoding.ber.univ.BooleanMixIn>), (<class pysnmp.asn1.univ.Integer>, <class pysnmp.asn1.encoding.ber.univ.IntegerMixIn>), (<class pysnmp.asn1.univ.BitString>, <class pysnmp.asn1.encoding.ber.univ.BitStringMixIn>), (<class pysnmp.asn1.univ.OctetString>, <class pysnmp.asn1.encoding.ber.univ.OctetStringMixIn>), (<class pysnmp.asn1.univ.Null>, <class pysnmp.asn1.encoding.ber.univ.NullMixIn>), (<class pysnmp.asn1.univ.ObjectIdentifier>, <class pysnmp.asn1.encoding.ber.univ.ObjectIdentifierMixIn>), (<class pysnmp.asn1.univ.Real>, <class pysnmp.asn1.encoding.ber.univ.RealMixIn>), (<class pysnmp.asn1.univ.Enumerated>, <class pysnmp.asn1.encoding.ber.univ.EnumeratedMixIn>), (<class pysnmp.asn1.univ.Sequence>, <class pysnmp.asn1.encoding.ber.univ.SequenceMixIn>), (<class pysnmp.asn1.univ.SequenceOf>, <class pysnmp.asn1.encoding.ber.univ.SequenceOfMixIn>), (<class pysnmp.asn1.univ.Set>, <class pysnmp.asn1.encoding.ber.univ.SetMixIn>), (<class pysnmp.asn1.univ.SetOf>, <class pysnmp.asn1.encoding.ber.univ.SetOfMixIn>), (<class pysnmp.asn1.univ.Choice>, <class pysnmp.asn1.encoding.ber.univ.ChoiceMixIn>)]