Module: Net::SNMP::Wrapper
- Extended by:
- Debug, NiceFFI::Library
- Defined in:
- lib/net/snmp/wrapper.rb
Defined Under Namespace
Classes: Counter64, EnumList, IndexList, Module, ModuleImport, NetsnmpVardata, SnmpPdu, SnmpSession, TimeVal, Tree, VariableList
Class Method Summary
collapse
Methods included from Debug
debug, error, fatal, info, print_packet, time, warn
Class Method Details
.af ⇒ Object
253
|
# File 'lib/net/snmp/wrapper.rb', line 253
alias af attach_function
|
.attach_function(*args) ⇒ Object
254
255
256
257
258
|
# File 'lib/net/snmp/wrapper.rb', line 254
def attach_function(*args)
af(*args)
rescue Exception => ex
debug ex.message
end
|
.get_fd_set ⇒ Object
397
398
399
|
# File 'lib/net/snmp/wrapper.rb', line 397
def self.get_fd_set
FFI::MemoryPointer.new(:pointer, 128)
end
|
.print_pdu(p) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/net/snmp/wrapper.rb', line 57
def self.print_pdu(p)
puts "--------------PDU---------------"
puts %{
version = #{p.version}
command = #{p.command}
errstat = #{p.errstat}
errindex = #{p.errindex}
}
v = p.variables.pointer
puts "-----VARIABLES------"
while !v.null? do
var = VariableList.new v
print_varbind(var)
v = var.next_variable
end
end
|
.print_session(s) ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/net/snmp/wrapper.rb', line 118
def self.print_session(s)
puts "-------------------SESSION---------------------"
puts %{
peername = #{s.peername.read_string}
community = #{s..read_string(s.)}
s_errno = #{s.s_errno}
s_snmp_errno = #{s.s_snmp_errno}
securityAuthKey = #{s.securityAuthKey.to_ptr.read_string}
}
end
|
.print_varbind(v) ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'lib/net/snmp/wrapper.rb', line 31
def self.print_varbind(v)
puts "---------------------VARBIND------------------------"
puts %{
name_length #{v.name_length}
name #{v.name.read_array_of_long(v.name_length).join(".")}
type = #{v.type}
}
end
|