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

A framework for implementing Basic Encoding Rules (BER) en/decoders
for ASN.1 data types.
 
Copyright 1999-2002 by Ilya Etingof <ilya@glas.net>. See LICENSE for
details.

 
Modules
       
pysnmp.asn1.encoding.ber.error

 
Classes
       
BerObject
SimpleAsn1Object
StructuredAsn1Object
FixedTypeAsn1Object
OrderedFixedTypeAsn1Object
SingleFixedTypeAsn1Object
UnorderedFixedTypeAsn1Object
VariableTypeAsn1Object
OrderedVariableTypeAsn1Object
UnorderedVariableTypeAsn1Object

 
class BerObject
    Base class for BER en/decoding classes
 
  Methods defined here:
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 defined here:
tagClass = 0
tagFormat = 0
tagId = 0

 
class FixedTypeAsn1Object(StructuredAsn1Object)
    BER for fixed-type ASN.1 objects
 
 
Method resolution order:
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods defined here:
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)

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 SimpleAsn1Object:
berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.
decode = berDecode(self, input)
berDecode(input) -> (value, rest)
 
BER decode input (octet string) into ASN1 object payload,
return the rest of input stream.

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 OrderedFixedTypeAsn1Object(FixedTypeAsn1Object)
    BER for ordered, fixed-type ASN.1 objects
 
 
Method resolution order:
OrderedFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods defined here:
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)

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 OrderedVariableTypeAsn1Object(VariableTypeAsn1Object)
    BER for ordered, variable-type ASN.1 objects
 
 
Method resolution order:
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 SimpleAsn1Object(BerObject)
    BER packet header encoders & decoders for simple (that is non-structured
ASN.1 objects)
 
  Methods defined here:
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)
encode = berEncode(self, value=None)

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 SingleFixedTypeAsn1Object(FixedTypeAsn1Object)
    BER for a single, fixed-type ASN.1 objects
 
 
Method resolution order:
SingleFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods defined here:
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 StructuredAsn1Object(SimpleAsn1Object)
    BER for structured ASN.1 objects
 
 
Method resolution order:
StructuredAsn1Object
SimpleAsn1Object
BerObject

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

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 UnorderedFixedTypeAsn1Object(FixedTypeAsn1Object)
    BER for unordered, fixed-type ASN.1 objects
 
 
Method resolution order:
UnorderedFixedTypeAsn1Object
FixedTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods defined here:
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)

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 UnorderedVariableTypeAsn1Object(VariableTypeAsn1Object)
    BER for unordered, variable-type ASN.1 objects
 
 
Method resolution order:
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

 
class VariableTypeAsn1Object(StructuredAsn1Object)
    BER for variable-type ASN.1 objects
 
 
Method resolution order:
VariableTypeAsn1Object
StructuredAsn1Object
SimpleAsn1Object
BerObject

Methods defined here:
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)
encode = berEncode(self, args=[])

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

 
Functions
       
decodeTag(input, where='decodeTag')
Decode first octet of input octet stream into int tag

 
Data
        __all__ = ['SimpleAsn1Object', 'OrderedFixedTypeAsn1Object', 'UnorderedFixedTypeAsn1Object', 'SingleFixedTypeAsn1Object', 'OrderedVariableTypeAsn1Object', 'UnorderedVariableTypeAsn1Object']
tagCategories = {'EXPLICIT': 2, 'IMPLICIT': 1, 'UNTAGGED': 4}