snmp 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -0
- data/Rakefile +1 -1
- data/lib/snmp/ber.rb +1 -0
- data/lib/snmp/manager.rb +5 -5
- data/lib/snmp/version.rb +1 -1
- data/test/test_ber.rb +4 -2
- data/test/test_pdu.rb +1 -1
- data/test/test_retry.rb +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
|
@@ -26,6 +26,10 @@ examples below for more details.
|
|
|
26
26
|
|
|
27
27
|
== Changes
|
|
28
28
|
|
|
29
|
+
Changes for version 1.1.1:
|
|
30
|
+
|
|
31
|
+
* Incorporate various small pull requests
|
|
32
|
+
|
|
29
33
|
Changes for version 1.1.0:
|
|
30
34
|
|
|
31
35
|
* Added MIB support to ObjectId and Varbind, so that to_s can return symbolic information
|
data/Rakefile
CHANGED
data/lib/snmp/ber.rb
CHANGED
data/lib/snmp/manager.rb
CHANGED
|
@@ -473,6 +473,10 @@ module SNMP
|
|
|
473
473
|
@@request_id.force_next(request_id)
|
|
474
474
|
end
|
|
475
475
|
|
|
476
|
+
def load_modules(module_list, mib_dir)
|
|
477
|
+
module_list.each { |m| @mib.load_module(m, mib_dir) }
|
|
478
|
+
end
|
|
479
|
+
|
|
476
480
|
private
|
|
477
481
|
|
|
478
482
|
def warn(message)
|
|
@@ -481,10 +485,6 @@ module SNMP
|
|
|
481
485
|
Kernel::warn "#{location}: warning: #{message}"
|
|
482
486
|
end
|
|
483
487
|
|
|
484
|
-
def load_modules(module_list, mib_dir)
|
|
485
|
-
module_list.each { |m| @mib.load_module(m, mib_dir) }
|
|
486
|
-
end
|
|
487
|
-
|
|
488
488
|
def try_request(request, community=@community, host=@host, port=@port)
|
|
489
489
|
(@retries + 1).times do |n|
|
|
490
490
|
send_request(request, community, host, port)
|
|
@@ -537,7 +537,7 @@ module SNMP
|
|
|
537
537
|
|
|
538
538
|
def recvfrom(max_bytes)
|
|
539
539
|
data, host_info = @socket.recvfrom(max_bytes)
|
|
540
|
-
|
|
540
|
+
_, host_port, _, host_ip = host_info
|
|
541
541
|
return data, host_ip, host_port
|
|
542
542
|
end
|
|
543
543
|
end
|
data/lib/snmp/version.rb
CHANGED
data/test/test_ber.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: ascii-8bit
|
|
2
|
+
|
|
1
3
|
require 'test/unit'
|
|
2
4
|
require 'snmp/varbind'
|
|
3
5
|
require 'snmp/ber'
|
|
@@ -118,7 +120,7 @@ class ASN1_Test < Test::Unit::TestCase
|
|
|
118
120
|
|
|
119
121
|
# Decode ASN.1 octet string
|
|
120
122
|
def test_decode_octet_string
|
|
121
|
-
s,
|
|
123
|
+
s, _ = decode_octet_string("\004\202\000\005hello")
|
|
122
124
|
assert_equal("hello",s)
|
|
123
125
|
assert_raise(InvalidTag) {
|
|
124
126
|
decode_octet_string("\005\202\000\005hello")
|
|
@@ -126,7 +128,7 @@ class ASN1_Test < Test::Unit::TestCase
|
|
|
126
128
|
end
|
|
127
129
|
|
|
128
130
|
def test_decode_ip_address
|
|
129
|
-
ip,
|
|
131
|
+
ip, _ = decode_ip_address("@\004\001\002\003\004")
|
|
130
132
|
assert_equal(ip, "\001\002\003\004")
|
|
131
133
|
assert_raise(InvalidTag) {
|
|
132
134
|
decode_ip_address("\004\004\001\002\003\004")
|
data/test/test_pdu.rb
CHANGED
|
@@ -28,7 +28,7 @@ class TestProtocol < Test::Unit::TestCase
|
|
|
28
28
|
|
|
29
29
|
def test_message_decoder_v3
|
|
30
30
|
assert_raise(SNMP::UnsupportedVersion) do
|
|
31
|
-
|
|
31
|
+
SNMP::Message.decode("0>\002\001\0030\021\002\004&\266\342\314\002\003\000\377\343\004\001\004\002\001\003\004\0200\016\004\000\002\001\000\002\001\000\004\000\004\000\004\0000\024\004\000\004\000\240\016\002\004\v\3623\233\002\001\000\002\001\0000\000")
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
data/test/test_retry.rb
CHANGED
|
@@ -40,10 +40,10 @@ class MismatchIdTransport
|
|
|
40
40
|
|
|
41
41
|
def send(data, host, port)
|
|
42
42
|
bad_id_data = data.dup
|
|
43
|
-
bad_msg = SNMP::Message.decode(
|
|
43
|
+
bad_msg = SNMP::Message.decode(bad_id_data)
|
|
44
44
|
bad_msg.pdu.request_id -= 3 # corrupt request_id
|
|
45
45
|
@data << bad_msg.encode # insert corrupted PDU before real data
|
|
46
|
-
@data <<
|
|
46
|
+
@data << bad_id_data
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def recv(max_bytes)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snmp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: A Ruby implementation of SNMP (the Simple Network Management Protocol).
|
|
15
15
|
email: hallidave@gmail.com
|
|
@@ -340,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
340
340
|
version: '0'
|
|
341
341
|
requirements: []
|
|
342
342
|
rubyforge_project: snmplib
|
|
343
|
-
rubygems_version: 1.8.
|
|
343
|
+
rubygems_version: 1.8.23
|
|
344
344
|
signing_key:
|
|
345
345
|
specification_version: 3
|
|
346
346
|
summary: A Ruby implementation of SNMP (the Simple Network Management Protocol).
|