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