snmp 0.6.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +17 -10
- data/Rakefile +1 -1
- data/lib/snmp/varbind.rb +18 -0
- data/test/test_varbind.rb +20 -1
- metadata +2 -2
data/README
CHANGED
@@ -9,13 +9,13 @@ that Ruby can run.
|
|
9
9
|
|
10
10
|
See snmplib.rubyforge.org[http://snmplib.rubyforge.org/] for more info.
|
11
11
|
|
12
|
-
Version 0.
|
12
|
+
Version 1.0.0 of this software supports the following:
|
13
13
|
|
14
14
|
* The GetRequest, GetNextRequest, GetBulkRequest, SetRequest, Response
|
15
15
|
SNMPv1_Trap, SNMPv2_Trap, and Inform PDUs
|
16
16
|
* All of the ASN.1 data types defined by SNMPv1 and SNMPv2c
|
17
17
|
* Sending informs and v1 and v2 traps
|
18
|
-
* Trap handling for v1 and v2 traps
|
18
|
+
* Trap handling for informs and v1 and v2 traps
|
19
19
|
* Symbolic OID values (ie. "ifTable" instead of "1.3.6.1.2.1.2.2") as
|
20
20
|
parameters to the SNMP.Manager API
|
21
21
|
* Includes symbol data files for all current IETF MIBs
|
@@ -25,11 +25,18 @@ examples below for more details.
|
|
25
25
|
|
26
26
|
== Changes
|
27
27
|
|
28
|
-
Changes for version 0.
|
29
|
-
|
30
|
-
*
|
31
|
-
|
32
|
-
|
28
|
+
Changes for version 1.0.0:
|
29
|
+
|
30
|
+
* Added to_s method to TimeTicks. Displays time in human-readable form
|
31
|
+
instead of just a number. The to_i method can still be used to get the
|
32
|
+
number of ticks.
|
33
|
+
|
34
|
+
Changes for version 0.6.1:
|
35
|
+
|
36
|
+
* Made decoding of unsigned integers more liberal, so that they are
|
37
|
+
interpreted as positive integers even if the high bit is set.
|
38
|
+
* Added support for receiving InformRequest PDUs from the TrapListener class.
|
39
|
+
|
33
40
|
Changes for version 0.6.0:
|
34
41
|
|
35
42
|
* Added support for sending informs and traps for SNMPv2c and traps for
|
@@ -102,19 +109,19 @@ formats.
|
|
102
109
|
From the .gem file you can install using
|
103
110
|
RubyGems[http://rubyforge.org/projects/rubygems].
|
104
111
|
|
105
|
-
gem install snmp-0.
|
112
|
+
gem install snmp-1.0.0.gem
|
106
113
|
|
107
114
|
From the .tgz or .zip file you can install using
|
108
115
|
setup.rb[http://i.loveruby.net/en/prog/setup.html]. Uncompress the archive
|
109
116
|
and then run setup.
|
110
117
|
|
111
|
-
cd snmp-0.
|
118
|
+
cd snmp-1.0.0
|
112
119
|
ruby setup.rb (may require root privilege)
|
113
120
|
|
114
121
|
== Testing
|
115
122
|
|
116
123
|
This library has received limited testing:
|
117
|
-
* The unit tests have been executed with Ruby 1.8.
|
124
|
+
* The unit tests have been executed with Ruby 1.8.4 on Mac OS X 10.4.
|
118
125
|
* Basic interoperability testing has been done with the
|
119
126
|
net-snmp[http://www.net-snmp.org/] tools.
|
120
127
|
|
data/Rakefile
CHANGED
data/lib/snmp/varbind.rb
CHANGED
@@ -355,6 +355,24 @@ class TimeTicks < UnsignedInteger
|
|
355
355
|
def encode
|
356
356
|
encode_tagged_integer(TimeTicks_TAG, @value)
|
357
357
|
end
|
358
|
+
|
359
|
+
def to_s
|
360
|
+
days, remainder = @value.divmod(8640000)
|
361
|
+
hours, remainder = remainder.divmod(360000)
|
362
|
+
minutes, remainder = remainder.divmod(6000)
|
363
|
+
seconds, hundredths = remainder.divmod(100)
|
364
|
+
case
|
365
|
+
when days < 1
|
366
|
+
sprintf('%02d:%02d:%02d.%02d',
|
367
|
+
hours, minutes, seconds, hundredths)
|
368
|
+
when days == 1
|
369
|
+
sprintf('1 day, %02d:%02d:%02d.%02d',
|
370
|
+
hours, minutes, seconds, hundredths)
|
371
|
+
when days > 1
|
372
|
+
sprintf('%d days, %02d:%02d:%02d.%02d',
|
373
|
+
days, hours, minutes, seconds, hundredths)
|
374
|
+
end
|
375
|
+
end
|
358
376
|
end
|
359
377
|
|
360
378
|
class Opaque < OctetString
|
data/test/test_varbind.rb
CHANGED
@@ -319,5 +319,24 @@ class TestVarBind < Test::Unit::TestCase
|
|
319
319
|
assert_equal(type.asn1_type, type.to_s)
|
320
320
|
end
|
321
321
|
end
|
322
|
-
|
322
|
+
|
323
|
+
def test_timeticks
|
324
|
+
assert_equal("00:00:00.00", TimeTicks.new(0).to_s)
|
325
|
+
assert_equal("00:00:00.01", TimeTicks.new(1).to_s)
|
326
|
+
assert_equal("00:00:01.00", TimeTicks.new(100).to_s)
|
327
|
+
assert_equal("00:01:00.00", TimeTicks.new(60 * 100).to_s)
|
328
|
+
assert_equal("01:00:00.00", TimeTicks.new(60 * 60 * 100).to_s)
|
329
|
+
assert_equal("23:59:59.99", TimeTicks.new(24 * 60 * 60 * 100 - 1).to_s)
|
330
|
+
assert_equal("1 day, 00:00:00.00", TimeTicks.new(24 * 60 * 60 * 100).to_s)
|
331
|
+
assert_equal("1 day, 23:59:59.99", TimeTicks.new(48 * 60 * 60 * 100 - 1).to_s)
|
332
|
+
assert_equal("2 days, 00:00:00.00", TimeTicks.new(48 * 60 * 60 * 100).to_s)
|
333
|
+
assert_equal("497 days, 02:27:52.95", TimeTicks.new(4294967295).to_s)
|
334
|
+
assert_equal(4294967295, TimeTicks.new(4294967295).to_i)
|
335
|
+
assert_raise(ArgumentError) {
|
336
|
+
TimeTicks.new(4294967296)
|
337
|
+
}
|
338
|
+
assert_raise(ArgumentError) {
|
339
|
+
TimeTicks.new(-1)
|
340
|
+
}
|
341
|
+
end
|
323
342
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: snmp
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-02
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2006-03-02 00:00:00 -05:00
|
8
8
|
summary: A Ruby implementation of SNMP (the Simple Network Management Protocol).
|
9
9
|
require_paths:
|
10
10
|
- lib
|