| 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 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 36 | |||||||||||
| 37 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 38 | |||||||||||
| 39 | #our $VERSION = '0.01'; | ||||||||||
| 40 | |||||||||||
| 41 | 1 | our $AUTOLOAD; | |||||||||
| 42 | |||||||||||
| 43 | 1 | 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 | 0 | ▶ | { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | 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 | 0 | ▶ | { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=4 SCAR=30.0
| |||||||||||
| 118 | 0 | my $self = shift; | |||||||||
| 119 | |||||||||||
| 120 | |||||||||||
| 121 | 0 | ▶ | return if $AUTOLOAD =~ /DESTROY$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | |||||||||||
| 123 | 0 | my ($name) = $AUTOLOAD =~ /::([^:]+)$/; | |||||||||
| 124 | #print "Called $name\n"; | ||||||||||
| 125 | |||||||||||
| 126 | 0 | ▶ | if (!exists $oids{$name}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | if ($response) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 137 | 0 | return $response->{$oid}; | |||||||||
| 138 | } else { | ||||||||||
| 139 | 0 | return undef; | |||||||||
| 140 | } | ||||||||||
| 141 | } | ||||||||||
| 142 | |||||||||||
| 143 | 1 | 1; | |||||||||
| 144 | |||||||||||
| 145 | __END__ | ||||||||||