netsnmp 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +4 -4
- data/Gemfile +5 -1
- data/README.md +124 -63
- data/lib/netsnmp.rb +66 -10
- data/lib/netsnmp/client.rb +93 -75
- data/lib/netsnmp/encryption/aes.rb +84 -0
- data/lib/netsnmp/encryption/des.rb +80 -0
- data/lib/netsnmp/encryption/none.rb +17 -0
- data/lib/netsnmp/errors.rb +1 -3
- data/lib/netsnmp/message.rb +81 -0
- data/lib/netsnmp/oid.rb +18 -137
- data/lib/netsnmp/pdu.rb +106 -64
- data/lib/netsnmp/scoped_pdu.rb +23 -0
- data/lib/netsnmp/security_parameters.rb +198 -0
- data/lib/netsnmp/session.rb +84 -275
- data/lib/netsnmp/v3_session.rb +81 -0
- data/lib/netsnmp/varbind.rb +65 -156
- data/lib/netsnmp/version.rb +2 -1
- data/netsnmp.gemspec +2 -8
- data/spec/client_spec.rb +147 -99
- data/spec/handlers/celluloid_spec.rb +33 -20
- data/spec/oid_spec.rb +11 -5
- data/spec/pdu_spec.rb +22 -22
- data/spec/security_parameters_spec.rb +40 -0
- data/spec/session_spec.rb +0 -23
- data/spec/support/celluloid.rb +24 -0
- data/spec/support/request_examples.rb +36 -0
- data/spec/support/start_docker.sh +15 -1
- data/spec/v3_session_spec.rb +21 -0
- data/spec/varbind_spec.rb +2 -51
- metadata +30 -76
- data/lib/netsnmp/core.rb +0 -12
- data/lib/netsnmp/core/client.rb +0 -15
- data/lib/netsnmp/core/constants.rb +0 -153
- data/lib/netsnmp/core/inline.rb +0 -20
- data/lib/netsnmp/core/libc.rb +0 -48
- data/lib/netsnmp/core/libsnmp.rb +0 -44
- data/lib/netsnmp/core/structures.rb +0 -167
- data/lib/netsnmp/core/utilities.rb +0 -13
- data/lib/netsnmp/handlers/celluloid.rb +0 -27
- data/lib/netsnmp/handlers/em.rb +0 -56
- data/spec/core/libc_spec.rb +0 -2
- data/spec/core/libsnmp_spec.rb +0 -32
- data/spec/core/structures_spec.rb +0 -54
- data/spec/handlers/em_client_spec.rb +0 -34
data/lib/netsnmp/core.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'ffi'
|
2
|
-
|
3
|
-
require 'netsnmp/core/libc'
|
4
|
-
require 'netsnmp/core/constants'
|
5
|
-
require 'netsnmp/core/structures'
|
6
|
-
require 'netsnmp/core/libsnmp'
|
7
|
-
require 'netsnmp/core/inline'
|
8
|
-
require 'netsnmp/core/utilities'
|
9
|
-
|
10
|
-
module NETSNMP::Core
|
11
|
-
LibSNMP.init_snmp("snmp")
|
12
|
-
end
|
data/lib/netsnmp/core/client.rb
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
module NETSNMP::Core
|
2
|
-
# Sets all the constants necessary to recognize from the structures
|
3
|
-
module Constants
|
4
|
-
MAX_OID_LEN = 128
|
5
|
-
|
6
|
-
# Return values of various send functions
|
7
|
-
STAT_SUCCESS = 0
|
8
|
-
STAT_ERROR = 1
|
9
|
-
STAT_TIMEOUT = 2
|
10
|
-
|
11
|
-
SNMP_VERSION_1 = 0
|
12
|
-
SNMP_VERSION_2c = 1
|
13
|
-
SNMP_VERSION_3 = 3
|
14
|
-
|
15
|
-
|
16
|
-
USM_AUTH_KU_LEN = 32
|
17
|
-
USM_PRIV_KU_LEN = 32
|
18
|
-
|
19
|
-
# SNMPv3 Security Levels
|
20
|
-
SNMP_SEC_LEVEL_NOAUTH = 1
|
21
|
-
SNMP_SEC_LEVEL_AUTHNOPRIV = 2
|
22
|
-
SNMP_SEC_LEVEL_AUTHPRIV = 3
|
23
|
-
|
24
|
-
# SNMP Errors
|
25
|
-
SNMPERR_SUCCESS = (0)
|
26
|
-
SNMPERR_GENERR = (-1)
|
27
|
-
SNMPERR_BAD_LOCPORT = (-2)
|
28
|
-
SNMPERR_BAD_ADDRESS = (-3)
|
29
|
-
SNMPERR_BAD_SESSION = (-4)
|
30
|
-
SNMPERR_TOO_LONG = (-5)
|
31
|
-
SNMPERR_NO_SOCKET = (-6)
|
32
|
-
SNMPERR_V2_IN_V1 = (-7)
|
33
|
-
SNMPERR_V1_IN_V2 = (-8)
|
34
|
-
SNMPERR_BAD_REPEATERS = (-9)
|
35
|
-
SNMPERR_BAD_REPETITIONS = (-10)
|
36
|
-
SNMPERR_BAD_ASN1_BUILD = (-11)
|
37
|
-
SNMPERR_BAD_SENDTO = (-12)
|
38
|
-
SNMPERR_BAD_PARSE = (-13)
|
39
|
-
SNMPERR_BAD_VERSION = (-14)
|
40
|
-
SNMPERR_BAD_SRC_PARTY = (-15)
|
41
|
-
SNMPERR_BAD_DST_PARTY = (-16)
|
42
|
-
SNMPERR_BAD_CONTEXT = (-17)
|
43
|
-
SNMPERR_BAD_COMMUNITY = (-18)
|
44
|
-
SNMPERR_NOAUTH_DESPRIV = (-19)
|
45
|
-
SNMPERR_BAD_ACL = (-20)
|
46
|
-
SNMPERR_BAD_PARTY = (-21)
|
47
|
-
SNMPERR_ABORT = (-22)
|
48
|
-
SNMPERR_UNKNOWN_PDU = (-23)
|
49
|
-
SNMPERR_TIMEOUT = (-24)
|
50
|
-
SNMPERR_BAD_RECVFROM = (-25)
|
51
|
-
SNMPERR_BAD_ENG_ID = (-26)
|
52
|
-
SNMPERR_BAD_SEC_NAME = (-27)
|
53
|
-
SNMPERR_BAD_SEC_LEVEL = (-28)
|
54
|
-
SNMPERR_ASN_PARSE_ERR = (-29)
|
55
|
-
SNMPERR_UNKNOWN_SEC_MODEL = (-30)
|
56
|
-
SNMPERR_INVALID_MSG = (-31)
|
57
|
-
SNMPERR_UNKNOWN_ENG_ID = (-32)
|
58
|
-
SNMPERR_UNKNOWN_USER_NAME = (-33)
|
59
|
-
SNMPERR_UNSUPPORTED_SEC_LEVEL = (-34)
|
60
|
-
SNMPERR_AUTHENTICATION_FAILURE = (-35)
|
61
|
-
SNMPERR_NOT_IN_TIME_WINDOW = (-36)
|
62
|
-
SNMPERR_DECRYPTION_ERR = (-37)
|
63
|
-
SNMPERR_SC_GENERAL_FAILURE = (-38)
|
64
|
-
SNMPERR_SC_NOT_CONFIGURED = (-39)
|
65
|
-
SNMPERR_KT_NOT_AVAILABLE = (-40)
|
66
|
-
SNMPERR_UNKNOWN_REPORT = (-41)
|
67
|
-
SNMPERR_USM_GENERICERROR = (-42)
|
68
|
-
SNMPERR_USM_UNKNOWNSECURITYNAME = (-43)
|
69
|
-
SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL = (-44)
|
70
|
-
SNMPERR_USM_ENCRYPTIONERROR = (-45)
|
71
|
-
SNMPERR_USM_AUTHENTICATIONFAILURE = (-46)
|
72
|
-
SNMPERR_USM_PARSEERROR = (-47)
|
73
|
-
SNMPERR_USM_UNKNOWNENGINEID = (-48)
|
74
|
-
SNMPERR_USM_NOTINTIMEWINDOW = (-49)
|
75
|
-
SNMPERR_USM_DECRYPTIONERROR = (-50)
|
76
|
-
SNMPERR_NOMIB = (-51)
|
77
|
-
SNMPERR_RANGE = (-52)
|
78
|
-
SNMPERR_MAX_SUBID = (-53)
|
79
|
-
SNMPERR_BAD_SUBID = (-54)
|
80
|
-
SNMPERR_LONG_OID = (-55)
|
81
|
-
SNMPERR_BAD_NAME = (-56)
|
82
|
-
SNMPERR_VALUE = (-57)
|
83
|
-
SNMPERR_UNKNOWN_OBJID = (-58)
|
84
|
-
SNMPERR_NULL_PDU = (-59)
|
85
|
-
SNMPERR_NO_VARS = (-60)
|
86
|
-
SNMPERR_VAR_TYPE = (-61)
|
87
|
-
SNMPERR_MALLOC = (-62)
|
88
|
-
SNMPERR_KRB5 = (-63)
|
89
|
-
SNMPERR_PROTOCOL = (-64)
|
90
|
-
SNMPERR_OID_NONINCREASING = (-65)
|
91
|
-
SNMPERR_MAX = (-65)
|
92
|
-
|
93
|
-
# PDU variable types
|
94
|
-
ASN_BOOLEAN = 0x01
|
95
|
-
ASN_INTEGER = 0x02
|
96
|
-
ASN_BIT_STR = 0x03
|
97
|
-
ASN_OCTET_STR = 0x04
|
98
|
-
ASN_NULL = 0x05
|
99
|
-
ASN_OBJECT_ID = 0x06
|
100
|
-
ASN_SEQUENCE = 0x10
|
101
|
-
ASN_SET = 0x11
|
102
|
-
|
103
|
-
ASN_UNIVERSAL = 0x00
|
104
|
-
ASN_APPLICATION = 0x40
|
105
|
-
ASN_CONTEXT = 0x80
|
106
|
-
ASN_PRIVATE = 0xC0
|
107
|
-
|
108
|
-
ASN_PRIMITIVE = 0x00
|
109
|
-
ASN_CONSTRUCTOR = 0x20
|
110
|
-
|
111
|
-
ASN_LONG_LEN = 0x80
|
112
|
-
ASN_EXTENSION_ID = 0x1F
|
113
|
-
ASN_BIT8 = 0x80
|
114
|
-
|
115
|
-
|
116
|
-
ASN_IPADDRESS = (ASN_APPLICATION | 0)
|
117
|
-
ASN_COUNTER = (ASN_APPLICATION | 1)
|
118
|
-
ASN_GAUGE = (ASN_APPLICATION | 2)
|
119
|
-
ASN_UNSIGNED = (ASN_APPLICATION | 2) # RFC 1902 - same as GAUGE
|
120
|
-
ASN_TIMETICKS = (ASN_APPLICATION | 3)
|
121
|
-
ASN_OPAQUE = (ASN_APPLICATION | 4)
|
122
|
-
ASN_NSAP = (ASN_APPLICATION | 5) # historic - don't use
|
123
|
-
ASN_COUNTER64 = (ASN_APPLICATION | 6)
|
124
|
-
ASN_UINTEGER = (ASN_APPLICATION | 7) # historic - don't use
|
125
|
-
|
126
|
-
# Exception types for SNMPv2 and SNMPv3 (no value needed)
|
127
|
-
SNMP_NOSUCHOBJECT = (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)
|
128
|
-
SNMP_NOSUCHINSTANCE = (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)
|
129
|
-
SNMP_ENDOFMIBVIEW = (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)
|
130
|
-
|
131
|
-
|
132
|
-
# PDU types
|
133
|
-
SNMP_MSG_GET = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
|
134
|
-
SNMP_MSG_GETNEXT = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
|
135
|
-
SNMP_MSG_RESPONSE = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
|
136
|
-
SNMP_MSG_SET = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
|
137
|
-
SNMP_MSG_TRAP = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)
|
138
|
-
SNMP_MSG_GETBULK = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
|
139
|
-
SNMP_MSG_INFORM = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
|
140
|
-
SNMP_MSG_TRAP2 = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
|
141
|
-
SNMP_MSG_REPORT = (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
|
142
|
-
|
143
|
-
|
144
|
-
# Callback status codes
|
145
|
-
NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE = 1
|
146
|
-
NETSNMP_CALLBACK_OP_TIMED_OUT = 2
|
147
|
-
NETSNMP_CALLBACK_OP_SEND_FAILED = 3
|
148
|
-
NETSNMP_CALLBACK_OP_CONNECT = 4
|
149
|
-
NETSNMP_CALLBACK_OP_DISCONNECT = 5
|
150
|
-
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
data/lib/netsnmp/core/inline.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module NETSNMP::Core
|
2
|
-
module Inline
|
3
|
-
if RUBY_PLATFORM == "java"
|
4
|
-
def self.oid_size ; FFI::Pointer.size ; end
|
5
|
-
else
|
6
|
-
require 'inline'
|
7
|
-
inline do |builder|
|
8
|
-
# builder.include "sys/select.h"
|
9
|
-
builder.include "<net-snmp/net-snmp-config.h>"
|
10
|
-
builder.include "<net-snmp/types.h>"
|
11
|
-
#builder.include "stdio.h"
|
12
|
-
builder.c_singleton %q{
|
13
|
-
int oid_size() {
|
14
|
-
return sizeof(oid);
|
15
|
-
}
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/netsnmp/core/libc.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module NETSNMP::Core
|
2
|
-
module C
|
3
|
-
extend FFI::Library
|
4
|
-
ffi_lib(FFI::Library::LIBC).first
|
5
|
-
|
6
|
-
typedef :pointer, :FILE
|
7
|
-
typedef :uint32, :in_addr_t
|
8
|
-
typedef :uint16, :in_port_t
|
9
|
-
|
10
|
-
unless FFI::Platform::IS_WINDOWS
|
11
|
-
attach_function :getdtablesize, [], :int
|
12
|
-
end
|
13
|
-
|
14
|
-
class Timeval < FFI::Struct
|
15
|
-
if FFI::Platform::IS_WINDOWS
|
16
|
-
layout(
|
17
|
-
:sec, :long,
|
18
|
-
:usec, :long
|
19
|
-
)
|
20
|
-
else
|
21
|
-
layout(
|
22
|
-
:tv_sec, :time_t,
|
23
|
-
:tv_usec, :suseconds_t
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class FDSet < ::FFI::Struct
|
29
|
-
if FFI::Platform::IS_WINDOWS
|
30
|
-
layout(
|
31
|
-
:fd_count, :uint,
|
32
|
-
# TODO: Make it future proof by dynamically grabbing FD_SETSIZE.
|
33
|
-
:fd_array, [:uint, 2048]
|
34
|
-
)
|
35
|
-
def clear; self[:fd_count] = 0; end
|
36
|
-
else
|
37
|
-
# FD Set size.
|
38
|
-
FD_SETSIZE = C.getdtablesize
|
39
|
-
layout(
|
40
|
-
:fds_bits, [:long, FD_SETSIZE / FFI::Type::LONG.size]
|
41
|
-
)
|
42
|
-
|
43
|
-
# :nodoc:
|
44
|
-
def clear; super; end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/lib/netsnmp/core/libsnmp.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
module NETSNMP::Core
|
2
|
-
module LibSNMP
|
3
|
-
extend FFI::Library
|
4
|
-
ffi_lib ["libnetsnmp", "netsnmp"]
|
5
|
-
|
6
|
-
callback(:snmp_callback, [ :int, :pointer, :int, :pointer, :pointer ], :int)
|
7
|
-
callback(:netsnmp_callback, [ :int, :pointer, :int, :pointer, :pointer ], :int)
|
8
|
-
|
9
|
-
# checks whether the oid is supported
|
10
|
-
attach_function :read_objid, [:string, :pointer, :pointer], :int, blocking: true
|
11
|
-
# checks whether the mib is supported
|
12
|
-
attach_function :get_node, [:string, :pointer, :pointer], :int, blocking: true
|
13
|
-
|
14
|
-
# initializes internal stuff, loads mibs, etc etc etc...
|
15
|
-
attach_function :init_snmp, [ :string ], :void, blocking: true
|
16
|
-
|
17
|
-
# PDU API
|
18
|
-
attach_function :snmp_clone_pdu, [ :pointer ], :pointer
|
19
|
-
attach_function :snmp_pdu_type, [ :int ], :string
|
20
|
-
attach_function :snmp_pdu_add_variable, [ :pointer, :pointer, :uint, :u_char, :pointer, :size_t ], :pointer, blocking: true
|
21
|
-
attach_function :snmp_free_pdu, [ :pointer ], :void, blocking: true
|
22
|
-
attach_function :snmp_pdu_create, [:int], :pointer, blocking: true
|
23
|
-
|
24
|
-
# session handling
|
25
|
-
attach_function :generate_Ku, [:pointer, :int, :string, :int, :pointer, :pointer], :int, blocking: true
|
26
|
-
attach_function :snmp_sess_init, [ :pointer ], :void, blocking: true
|
27
|
-
attach_function :snmp_sess_open, [ :pointer ], :pointer, blocking: true
|
28
|
-
attach_function :snmp_sess_session, [ :pointer ], :pointer, blocking: true
|
29
|
-
attach_function :snmp_sess_close, [ :pointer ], :int, blocking: true
|
30
|
-
|
31
|
-
# send/receive API
|
32
|
-
attach_function :snmp_sess_send, [ :pointer, :pointer ], :int
|
33
|
-
attach_function :snmp_sess_async_send, [ :pointer, :pointer, :snmp_callback, :pointer ], :int, blocking: true
|
34
|
-
attach_function :snmp_sess_select_info, [ :pointer, :pointer, :pointer, :pointer, :pointer ], :int, blocking: true
|
35
|
-
attach_function :snmp_sess_read, [ :pointer, :pointer ], :int, blocking: true
|
36
|
-
attach_function :snmp_sess_timeout, [ :pointer ], :void
|
37
|
-
attach_function :snmp_sess_synch_response, [:pointer, :pointer, :pointer], :int, blocking: true
|
38
|
-
|
39
|
-
|
40
|
-
attach_function :snmp_perror, [ :string ], :void
|
41
|
-
|
42
|
-
attach_function :netsnmp_get_version, [], :string
|
43
|
-
end
|
44
|
-
end
|
@@ -1,167 +0,0 @@
|
|
1
|
-
module NETSNMP::Core
|
2
|
-
# Maps to the relevant netsnmp C library structs.
|
3
|
-
module Structures
|
4
|
-
extend FFI::Library
|
5
|
-
typedef :u_long, :oid
|
6
|
-
|
7
|
-
callback(:snmp_callback, [ :int, :pointer, :int, :pointer, :pointer ], :int)
|
8
|
-
callback(:netsnmp_callback, [ :int, :pointer, :int, :pointer, :pointer ], :int)
|
9
|
-
|
10
|
-
class SessionList < FFI::Struct
|
11
|
-
layout(
|
12
|
-
:next, :pointer,
|
13
|
-
:session, :pointer,
|
14
|
-
:transport, :pointer,
|
15
|
-
:internal, :pointer
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
class Transport < FFI::Struct
|
20
|
-
layout(
|
21
|
-
:domain, :pointer,
|
22
|
-
:domain_length, :int,
|
23
|
-
:local, :pointer,
|
24
|
-
:local_length, :int,
|
25
|
-
:remote, :pointer,
|
26
|
-
:remote_length, :int,
|
27
|
-
:sock, :int,
|
28
|
-
:flags, :u_int,
|
29
|
-
:data, :pointer,
|
30
|
-
:data_length, :int,
|
31
|
-
:msgMaxSize, :size_t,
|
32
|
-
:base_transport, :pointer
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
class Session < FFI::Struct
|
37
|
-
layout(
|
38
|
-
:version, :long,
|
39
|
-
:retries, :int,
|
40
|
-
:timeout, :long,
|
41
|
-
:flags, :u_long,
|
42
|
-
:subsession, :pointer,
|
43
|
-
:next, :pointer,
|
44
|
-
:peername, :pointer,
|
45
|
-
:remote_port, :u_short,
|
46
|
-
:localname, :pointer,
|
47
|
-
:local_port, :u_short,
|
48
|
-
:authenticator, callback([ :pointer, :pointer, :pointer, :uint ], :pointer),
|
49
|
-
:callback, :netsnmp_callback,
|
50
|
-
:callback_magic, :pointer,
|
51
|
-
:s_errno, :int,
|
52
|
-
:s_snmp_errno, :int,
|
53
|
-
:sessid, :long,
|
54
|
-
:community, :pointer,
|
55
|
-
:community_len, :size_t,
|
56
|
-
:rcvMsgMaxSize, :size_t,
|
57
|
-
:sndMsgMaxSize, :size_t,
|
58
|
-
:isAuthoritative, :u_char,
|
59
|
-
:contextEngineID, :pointer,
|
60
|
-
:contextEngineIDLen, :size_t,
|
61
|
-
:engineBoots, :u_int,
|
62
|
-
:engineTime, :u_int,
|
63
|
-
:contextName, :pointer,
|
64
|
-
:contextNameLen, :size_t,
|
65
|
-
:securityEngineID, :pointer,
|
66
|
-
:securityEngineIDLen, :size_t,
|
67
|
-
:securityName, :pointer,
|
68
|
-
:securityNameLen, :size_t,
|
69
|
-
:securityAuthProto, :pointer,
|
70
|
-
:securityAuthProtoLen, :size_t,
|
71
|
-
:securityAuthKey, [:u_char, 32],
|
72
|
-
:securityAuthKeyLen, :size_t,
|
73
|
-
:securityAuthLocalKey, :pointer,
|
74
|
-
:securityAuthLocalKeyLen, :size_t,
|
75
|
-
:securityPrivProto, :pointer,
|
76
|
-
:securityPrivProtoLen, :size_t,
|
77
|
-
:securityPrivKey, [:u_char, 32],
|
78
|
-
:securityPrivKeyLen, :size_t,
|
79
|
-
:securityPrivLocalKey, :pointer,
|
80
|
-
:securityPrivLocalKeyLen, :size_t,
|
81
|
-
:securityModel, :int,
|
82
|
-
:securityLevel, :int,
|
83
|
-
:paramName, :pointer,
|
84
|
-
:securityInfo, :pointer,
|
85
|
-
:myvoid, :pointer
|
86
|
-
)
|
87
|
-
end
|
88
|
-
|
89
|
-
class Vardata < FFI::Union
|
90
|
-
layout(
|
91
|
-
:integer, :pointer,
|
92
|
-
:string, :pointer,
|
93
|
-
:objid, :pointer,
|
94
|
-
:bitstring, :pointer,
|
95
|
-
:counter64, :pointer,
|
96
|
-
:float, :pointer,
|
97
|
-
:double, :pointer
|
98
|
-
)
|
99
|
-
end
|
100
|
-
|
101
|
-
class VariableList < FFI::Struct
|
102
|
-
layout(
|
103
|
-
:next_variable, :pointer,#VariableList.typed_pointer,
|
104
|
-
:name, :pointer,
|
105
|
-
:name_length, :size_t,
|
106
|
-
:type, :u_char,
|
107
|
-
:val, Vardata,
|
108
|
-
:val_len, :size_t,
|
109
|
-
:name_loc, [:oid, Constants::MAX_OID_LEN],
|
110
|
-
:buf, [:u_char, 40],
|
111
|
-
:data, :pointer,
|
112
|
-
:dataFreeHook, callback([ :pointer ], :void),
|
113
|
-
:index, :int
|
114
|
-
)
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
class PDU < FFI::Struct
|
119
|
-
layout(
|
120
|
-
:version, :long,
|
121
|
-
:command, :int,
|
122
|
-
:reqid, :long,
|
123
|
-
:msgid, :long,
|
124
|
-
:transid, :long,
|
125
|
-
:sessid, :long,
|
126
|
-
:errstat, :long,
|
127
|
-
:errindex, :long,
|
128
|
-
:time, :u_long,
|
129
|
-
:flags, :u_long,
|
130
|
-
:securityModel, :int,
|
131
|
-
:securityLevel, :int,
|
132
|
-
:msgParseModel, :int,
|
133
|
-
:transport_data, :pointer,
|
134
|
-
:transport_data_length, :int,
|
135
|
-
:tDomain, :pointer,
|
136
|
-
:tDomainLen, :size_t,
|
137
|
-
:variables, :pointer,
|
138
|
-
:community, :pointer,
|
139
|
-
:community_len, :size_t,
|
140
|
-
:enterprise, :pointer,
|
141
|
-
:enterprise_length, :size_t,
|
142
|
-
:trap_type, :long,
|
143
|
-
:specific_type, :long,
|
144
|
-
:agent_addr, [:uchar, 4],
|
145
|
-
:contextEngineID, :pointer,
|
146
|
-
:contextEngineIDLen, :size_t,
|
147
|
-
:contextName, :pointer,
|
148
|
-
:contextNameLen, :size_t,
|
149
|
-
:securityEngineID, :pointer,
|
150
|
-
:securityEngineIDLen, :size_t,
|
151
|
-
:securityName, :pointer,
|
152
|
-
:securityNameLen, :size_t,
|
153
|
-
:priority, :int,
|
154
|
-
:range_subid, :int,
|
155
|
-
:securityStateRef, :pointer
|
156
|
-
)
|
157
|
-
end
|
158
|
-
|
159
|
-
class Counter64 < FFI::Struct
|
160
|
-
layout(
|
161
|
-
:high, :u_long,
|
162
|
-
:low, :u_long
|
163
|
-
)
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
end
|