netsnmp 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netsnmp/pdu.rb +2 -0
- data/lib/netsnmp/scoped_pdu.rb +2 -6
- data/lib/netsnmp/varbind.rb +14 -1
- data/lib/netsnmp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcad05ae1ce9ca55fc653ab0f11d97887229b2e
|
4
|
+
data.tar.gz: e3bdc4c01e957884fea362c5b6a9c0ba79221ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6557ae719bc1492de34849ed911aee5c5d7bdb246eefec39295ec6cc6e61d42dc39f6fc561d375e7edb76c6cf34f0dc5fcbec9d83fd22955a02e290caf7cb13e
|
7
|
+
data.tar.gz: 1a3599d249d30381276e0aea4c8317ab0e288a97bc5b8cff7fba787d7f8e0dc5f09148f05e9ac40bdf7ae8018d5d8741316d3eacd333dce90de245e984140fc4
|
data/lib/netsnmp/pdu.rb
CHANGED
data/lib/netsnmp/scoped_pdu.rb
CHANGED
@@ -5,13 +5,9 @@ module NETSNMP
|
|
5
5
|
|
6
6
|
attr_reader :engine_id
|
7
7
|
|
8
|
-
def initialize(type: , headers:,
|
9
|
-
request_id: nil,
|
10
|
-
error_status: 0,
|
11
|
-
error_index: 0,
|
12
|
-
varbinds: [])
|
8
|
+
def initialize(type: , headers:, **options)
|
13
9
|
@engine_id, @context = headers
|
14
|
-
super(type: type, headers: [3, nil],
|
10
|
+
super(type: type, headers: [3, nil], **options)
|
15
11
|
end
|
16
12
|
|
17
13
|
def encode_headers_asn
|
data/lib/netsnmp/varbind.rb
CHANGED
@@ -6,7 +6,7 @@ module NETSNMP
|
|
6
6
|
|
7
7
|
attr_reader :oid, :value
|
8
8
|
|
9
|
-
def initialize(oid , value: nil, type: nil)
|
9
|
+
def initialize(oid , value: nil, type: nil, **opts)
|
10
10
|
@oid = OID.build(oid)
|
11
11
|
@type = type
|
12
12
|
@value = convert_val(value) if value
|
@@ -47,6 +47,19 @@ module NETSNMP
|
|
47
47
|
|
48
48
|
def convert_val(asn_value)
|
49
49
|
case asn_value
|
50
|
+
when OpenSSL::ASN1::OctetString
|
51
|
+
# yes, we are forcing all output to UTF-8
|
52
|
+
# it's kind of common in snmp, some stuff can't be converted,
|
53
|
+
# like Hexa Strings. Parse them into a readable format a la netsnmp
|
54
|
+
val = asn_value.value
|
55
|
+
begin
|
56
|
+
val.encode("UTF-8")
|
57
|
+
rescue Encoding::UndefinedConversionError,
|
58
|
+
Encoding::ConverterNotFoundError,
|
59
|
+
Encoding::InvalidByteSequenceError
|
60
|
+
# hexdump me!
|
61
|
+
val.unpack("H*")[0].upcase.scan(/../).join(" ")
|
62
|
+
end
|
50
63
|
when OpenSSL::ASN1::Primitive
|
51
64
|
val = asn_value.value
|
52
65
|
val = val.to_i if val.is_a?(OpenSSL::BN)
|
data/lib/netsnmp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsnmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|