line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SNMP::HostInfo::IpAddrEntry;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::SNMP::HostInfo::IpAddrEntry - An entry in the ipAddrTable of a MIB-II host
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Net::SNMP::HostInfo;
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$host = shift || 'localhost';
|
12
|
|
|
|
|
|
|
$hostinfo = Net::SNMP::HostInfo->new(Hostname => $host);
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
print "\nAddress Table:\n";
|
15
|
|
|
|
|
|
|
printf "%-15s %-3s %-15s %-5s %5s\n",
|
16
|
|
|
|
|
|
|
qw/Addr If NetMask Bcast ReasmMaxSize/;
|
17
|
|
|
|
|
|
|
for $addr ($hostinfo->ipAddrTable) {
|
18
|
|
|
|
|
|
|
printf "%-15s %-3s %-15s %-5s %5s\n",
|
19
|
|
|
|
|
|
|
$addr->ipAdEntAddr,
|
20
|
|
|
|
|
|
|
$addr->ipAdEntIfIndex,
|
21
|
|
|
|
|
|
|
$addr->ipAdEntNetMask,
|
22
|
|
|
|
|
|
|
$addr->ipAdEntBcastAddr,
|
23
|
|
|
|
|
|
|
$addr->ipAdEntReasmMaxSize;
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
"The addressing information for one of this
|
29
|
|
|
|
|
|
|
entity's IP addresses."
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut
|
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
16
|
use 5.006;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
204
|
|
34
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
35
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
5
|
use Carp;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
731
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#our $VERSION = '0.01';
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our $AUTOLOAD;
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my %oids = (
|
44
|
|
|
|
|
|
|
ipAdEntAddr => '1.3.6.1.2.1.4.20.1.1',
|
45
|
|
|
|
|
|
|
ipAdEntIfIndex => '1.3.6.1.2.1.4.20.1.2',
|
46
|
|
|
|
|
|
|
ipAdEntNetMask => '1.3.6.1.2.1.4.20.1.3',
|
47
|
|
|
|
|
|
|
ipAdEntBcastAddr => '1.3.6.1.2.1.4.20.1.4',
|
48
|
|
|
|
|
|
|
ipAdEntReasmMaxSize => '1.3.6.1.2.1.4.20.1.5',
|
49
|
|
|
|
|
|
|
);
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Preloaded methods go here.
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new
|
60
|
|
|
|
|
|
|
{
|
61
|
0
|
|
|
0
|
0
|
|
my $class = shift;
|
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my %args = @_;
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $self = {};
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->{_session} = $args{Session};
|
68
|
0
|
|
|
|
|
|
$self->{_decode} = $args{Decode};
|
69
|
0
|
|
|
|
|
|
$self->{_index} = $args{Index};
|
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
bless $self, $class;
|
72
|
0
|
|
|
|
|
|
return $self;
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item ipAdEntAddr
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
"The IP address to which this entry's addressing
|
78
|
|
|
|
|
|
|
information pertains."
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item ipAdEntIfIndex
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
"The index value which uniquely identifies the
|
83
|
|
|
|
|
|
|
interface to which this entry is applicable. The
|
84
|
|
|
|
|
|
|
interface identified by a particular value of this
|
85
|
|
|
|
|
|
|
index is the same interface as identified by the
|
86
|
|
|
|
|
|
|
same value of ifIndex."
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item ipAdEntNetMask
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
"The subnet mask associated with the IP address of
|
91
|
|
|
|
|
|
|
this entry. The value of the mask is an IP
|
92
|
|
|
|
|
|
|
address with all the network bits set to 1 and all
|
93
|
|
|
|
|
|
|
the hosts bits set to 0."
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item ipAdEntBcastAddr
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
"The value of the least-significant bit in the IP
|
98
|
|
|
|
|
|
|
broadcast address used for sending datagrams on
|
99
|
|
|
|
|
|
|
the (logical) interface associated with the IP
|
100
|
|
|
|
|
|
|
address of this entry. For example, when the
|
101
|
|
|
|
|
|
|
Internet standard all-ones broadcast address is
|
102
|
|
|
|
|
|
|
used, the value will be 1. This value applies to
|
103
|
|
|
|
|
|
|
both the subnet and network broadcasts addresses
|
104
|
|
|
|
|
|
|
used by the entity on this (logical) interface."
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item ipAdEntReasmMaxSize
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
"The size of the largest IP datagram which this
|
109
|
|
|
|
|
|
|
entity can re-assemble from incoming IP fragmented
|
110
|
|
|
|
|
|
|
datagrams received on this interface."
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub AUTOLOAD
|
117
|
|
|
|
|
|
|
{
|
118
|
0
|
|
|
0
|
|
|
my $self = shift;
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
return if $AUTOLOAD =~ /DESTROY$/;
|
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my ($name) = $AUTOLOAD =~ /::([^:]+)$/;
|
124
|
|
|
|
|
|
|
#print "Called $name\n";
|
125
|
|
|
|
|
|
|
|
126
|
0
|
0
|
|
|
|
|
if (!exists $oids{$name}) {
|
127
|
0
|
|
|
|
|
|
croak "Can't locate object method '$name'";
|
128
|
|
|
|
|
|
|
}
|
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my $oid = $oids{$name} . '.' . $self->{_index};
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#print "Trying $oid\n";
|
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $response = $self->{_session}->get_request($oid);
|
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
if ($response) {
|
137
|
0
|
|
|
|
|
|
return $response->{$oid};
|
138
|
|
|
|
|
|
|
} else {
|
139
|
0
|
|
|
|
|
|
return undef;
|
140
|
|
|
|
|
|
|
}
|
141
|
|
|
|
|
|
|
}
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1;
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__END__
|