PySNMP Project Logo

Project diary
Documentation
Examples
License
Download
Mailing lists

Projects using PySNMP
TwistedSNMP
Zenoss


Relevant projects
SNMPy
YAPSNMP
LibSMI
Scotty software

SourceForge Logo

Objects of the asn1.INTEGER, asn1.UNSIGNED32, asn1.TIMETICKS, asn1.COUNTER32, asn1.COUNTER64 and asn1.GAUGE32 classes.

Instances of these classes have the following methods:

encode([value])

The encode method converts the content of the class instance into BER octet-stream (string).

The value parameter, whenever given for last-minute payload assignment to class instance, must be:

  • a signed 32-bit integer for instances of asn1.INTEGER class
  • an unsigned 64-bit integer for instances of asn1.COUNTER64 class
  • an unsigned 32-bit integer for instances of the rest of the classes
decode(data)

The decode method attempts to convert the data octet-stream (string) into an integer value of the following flavor:

  • a signed 32-bit integer for instances of asn1.INTEGER class
  • an unsigned 64-bit integer for instances of asn1.COUNTER64 class
  • an unsigned 32-bit integer for instances of the rest of the classes.

This method returns a tuple of (a_class_instance, rest), where rest (string) holds the rest of unprocessed input data.

The data octet-stream must carry an ASN.1 value which type matches class dedication or an error.TypeError exception would be thrown.

update(value)

The update method assigns the value to class instance payload.

The value parameter must be:

  • a signed 32-bit integer for instances of asn1.INTEGER class
  • an unsigned 64-bit integer for instances of asn1.COUNTER64 class
  • an unsigned 32-bit integer for instances of the rest of the classes.

__call__()

Class instance invocation would return currently stored payload.

__cmp__(other)

Class instances may be compared against each other. The comparation would return negative if other is greater, zero on equivalence, positive if other is less.

__repr__()

Returns the canonical string representation of the class instance.

__str__()

Returns a nice string representation of the class instance.


Need help? Try PySNMP mailing lists.