File: asn1-integer-objects.html

package info (click to toggle)
python-pysnmp2 2.0.9-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 476 kB
  • ctags: 471
  • sloc: python: 2,091; makefile: 8
file content (112 lines) | stat: -rw-r--r-- 3,043 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<HTML>
<HEAD>
<TITLE>PySNMP: SNMP message: ASN.1: INTEGER et al: Objects</TITLE>
</HEAD>

<BODY BGCOLOR="#ffffff" TEXT="#000000"
      LINK="#0000bb"  VLINK="#551a8b" ALINK="#ff0000">
<H3>
Objects of the
<STRONG>asn1.INTEGER</STRONG>,
<STRONG>asn1.UNSIGNED32</STRONG>,
<STRONG>asn1.TIMETICKS</STRONG>,
<STRONG>asn1.COUNTER32</STRONG>,
<STRONG>asn1.COUNTER64</STRONG> and
<STRONG>asn1.GAUGE32</STRONG> classes.
</H3>

<P>
Instances of these classes have the following methods:
</P>

<DL>

<DT><STRONG>encode</STRONG>([<STRONG>value</STRONG>])</DT>
<P>
The <STRONG>encode</STRONG> method converts the content of the class
instance into BER octet-stream (string).
</P>
<P>
The <STRONG>value</STRONG> parameter, whenever given for last-minute payload
assignment to class instance, must be:
</P>
<UL>
<LI>a signed 32-bit integer for instances of <STRONG>asn1.INTEGER</STRONG> class
<LI>an unsigned 64-bit integer for instances of <STRONG>asn1.COUNTER64</STRONG>
class
<LI>an unsigned 32-bit integer for instances of the rest of the classes
</UL>

<DT><STRONG>decode</STRONG>(<STRONG>data</STRONG>)</DT>
<P>
The <STRONG>decode</STRONG> method attempts to convert the
<STRONG>data</STRONG> octet-stream (string) into an integer value
of the following flavor:
</P>
<UL>
<LI>a signed 32-bit integer for instances of <STRONG>asn1.INTEGER</STRONG> class
<LI>an unsigned 64-bit integer for instances of <STRONG>asn1.COUNTER64</STRONG>
class
<LI>an unsigned 32-bit integer for instances of the rest of the classes.
</UL>

<P>
This method returns a tuple of (<STRONG>a_class_instance</STRONG>,
<STRONG>rest</STRONG>), where <STRONG>rest</STRONG> (string) holds the rest of
unprocessed input <STRONG>data</STRONG>.
</P>
<P>
The <STRONG>data</STRONG> octet-stream must carry an ASN.1 value
which type matches class dedication or an <A HREF=errors.html">error.TypeError
</A> exception would be thrown.
</P>

<DT><STRONG>update</STRONG>(<STRONG>value</STRONG>)</DT>
<P>
The <STRONG>update</STRONG> method assigns the <STRONG>value</STRONG>
to class instance payload.
</P>

<P>
The <STRONG>value</STRONG> parameter must be:
</P>
<UL>
<LI>a signed 32-bit integer for instances of <STRONG>asn1.INTEGER</STRONG> class
<LI>an unsigned 64-bit integer for instances of <STRONG>asn1.COUNTER64</STRONG>
class
<LI>an unsigned 32-bit integer for instances of the rest of the classes.
</UL>
</P>

<DT><STRONG>__call__</STRONG>()</DT>
<P>
Class instance invocation would return currently stored payload.
</P>

<DT><STRONG>__cmp__</STRONG>(<STRONG>other</STRONG>)</DT>
<P>
Class instances may be compared against each <STRONG>other</STRONG>. The
comparation would return negative if <STRONG>other</STRONG> is greater, zero 
on equivalence, positive if <STRONG>other</STRONG> is less.
</P>

<DT><STRONG>__repr__</STRONG>()</DT>
<P>
Returns the canonical string representation of the class instance.
</P>

<DT><STRONG>__str__</STRONG>()</DT>
<P>
Returns a nice string representation of the class instance.
</P>

</DL>

<HR>

<ADDRESS>
ilya@glas.net
</ADDRESS>

</BODY>
</HTML>