| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SNMP::Insight::Session; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#ABSTRACT: Role for SNMP client implementantions |
|
4
|
4
|
|
|
4
|
|
785380
|
use Moose::Role; |
|
|
4
|
|
|
|
|
13805
|
|
|
|
4
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.001'; #TRIAL VERSION: |
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
18202
|
use namespace::autoclean; |
|
|
4
|
|
|
|
|
2486
|
|
|
|
4
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
211
|
use Carp; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
219
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
18
|
use Moose::Util::TypeConstraints; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
22
|
|
|
13
|
|
|
|
|
|
|
enum 'SnmpVersion' => [qw(1 2c 3)]; |
|
14
|
4
|
|
|
4
|
|
6157
|
no Moose::Util::TypeConstraints; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
17
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
requires |
|
17
|
|
|
|
|
|
|
'get_scalar', |
|
18
|
|
|
|
|
|
|
'get_subtree'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has hostname => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
isa => 'Str', |
|
23
|
|
|
|
|
|
|
required => 1, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has port => ( |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
isa => 'Int', |
|
29
|
|
|
|
|
|
|
default => '161' |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has version => ( |
|
33
|
|
|
|
|
|
|
is => 'ro', |
|
34
|
|
|
|
|
|
|
isa => 'SnmpVersion', |
|
35
|
|
|
|
|
|
|
required => 1, |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'timeout' => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
isa => 'Int', |
|
41
|
|
|
|
|
|
|
default => 5 |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has 'retries' => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => 'Int', |
|
47
|
|
|
|
|
|
|
default => 5 |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has 'community' => ( |
|
51
|
|
|
|
|
|
|
is => 'ro', |
|
52
|
|
|
|
|
|
|
isa => 'Str', |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has 'username' => ( |
|
56
|
|
|
|
|
|
|
is => 'ro', |
|
57
|
|
|
|
|
|
|
isa => 'Str', |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
has 'authkey' => ( |
|
61
|
|
|
|
|
|
|
is => 'ro', |
|
62
|
|
|
|
|
|
|
isa => 'Str', |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has 'authpassword' => ( |
|
66
|
|
|
|
|
|
|
is => 'ro', |
|
67
|
|
|
|
|
|
|
isa => 'Str', |
|
68
|
|
|
|
|
|
|
); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has 'authprotocol' => ( |
|
71
|
|
|
|
|
|
|
is => 'ro', |
|
72
|
|
|
|
|
|
|
isa => 'Str', |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
has 'privkey' => ( |
|
76
|
|
|
|
|
|
|
is => 'ro', |
|
77
|
|
|
|
|
|
|
isa => 'Str', |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has 'privpassword' => ( |
|
81
|
|
|
|
|
|
|
is => 'ro', |
|
82
|
|
|
|
|
|
|
isa => 'Str', |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
has 'privprotocol' => ( |
|
86
|
|
|
|
|
|
|
is => 'ro', |
|
87
|
|
|
|
|
|
|
isa => 'Str', |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# Local Variables: |
|
93
|
|
|
|
|
|
|
# mode: cperl |
|
94
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
|
95
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
|
96
|
|
|
|
|
|
|
# cperl-indent-parens-as-block: t |
|
97
|
|
|
|
|
|
|
# End: |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
SNMP::Insight::Session - Role for SNMP client implementantions |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 VERSION |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
version 0.001 |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 hostname |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Required. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 port |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Default 161 |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 localaddr |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Optional. Can be used to set local address to bind to. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
= |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
has localaddr => ( |
|
128
|
|
|
|
|
|
|
is => 'ro', |
|
129
|
|
|
|
|
|
|
isa => 'Str', |
|
130
|
|
|
|
|
|
|
); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 localaddr |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Optional. Can be used to set local port to bind to. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
= |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
has localport => ( |
|
139
|
|
|
|
|
|
|
is => 'ro', |
|
140
|
|
|
|
|
|
|
isa => 'Int', |
|
141
|
|
|
|
|
|
|
); |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 version |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Required, should be on of "1", "2c", "3". |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 timeout |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Transport layer timeout in seconds. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 retries |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Number of times to retry sending a SNMP message to the remote host. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 community |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The SNMP community name to be used for SNMPv1 and SNMPv2c security model. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 username |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
securityName for SNMPv3 |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 METHODS |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 get_scalar($oid) |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Required method. Should return the value at $oid.0. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 get_subtree($oid) |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Required method. Should return all the values at $oid in a list of [ oid, value ] pairs. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 AUTHOR |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Gabriele Mambrini <g.mambrini@gmail.com> |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Gabriele Mambrini. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
182
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |