Interfaces/Details.pm

filter: Statementstmt 37.9% 22 / 58 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 42.8% 6 / 14 Podpod 100% 6 / 6 totaltotal 33.0% 34 / 103 CC 10 SCAR 20.5
CC
10
Cov
28%
IANAifType
20.0
new
12.0
AUTOLOAD
9.1
CRAP 7.8
« Interfaces.pm ↑ Summary
1 #*****************************************************************************
2 #* *
3 #* Gellyfish Software *
4 #* *
5 #* *
6 #*****************************************************************************
7 #* *
8 #* PROGRAM : Net::SNMP::Interfaces::Details *
9 #* *
10 #* AUTHOR : JNS *
11 #* *
12 #* DESCRIPTION : Provide object methods for a particular interface. *
13 #* *
14 #* *
15 #*****************************************************************************
16 #* *
17 #* $Log: Details.pm,v $
18 #* Revision 1.2 2005/01/10 21:34:47 jonathan
19 #* Moving files around
20 #*
21 #* Revision 1.1 2005/01/10 21:16:20 jonathan
22 #* * Fixed the DESTROY bug
23 #* * Reorganized the distribution
24 #*
25 #* Revision 0.3 2002/03/14 07:53:38 gellyfish
26 #* * Improvements in the error handling
27 #*
28 #* Revision 0.2 2002/03/14 07:09:47 gellyfish
29 #* * Added rfc2863 ifXTable stuff
30 #* * test.pl uses Test module
31 #*
32 #* *
33 #* *
34 #*****************************************************************************
35  
36 package Net::SNMP::Interfaces::Details;
37  
38 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 2 ▶no warnings qw(deprecated);
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 =head1 NAME
42  
43 Net::SNMP::Interfaces::Details - Object methods to obtain interface data.
44  
45 =head1 SYNOPSIS
46  
47 $in_octets = $interface->ifInOctets();
48  
49 =head1 DESCRIPTION
50  
51 This class represents an individual interface as discovered by
52 Net::SNMP::Interfaces. Although it is possible to call the contructor
53 directly it is primarily intended that these objects should be returned
54 by methods of Net::SNMP::Interfaces.
55  
56 =cut
57  
58 2 ▶use Net::SNMP;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 2 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
62 @ISA
63 $AUTOLOAD
64 $VERSION
65 2 );
66  
67 2 ($VERSION) = q$Revision: 1.4 $ =~ /([\d.]+)/;
68  
69 2 my %OIDS = (
70 ifInOctets => '1.3.6.1.2.1.2.2.1.10',
71 ifInUcastPkts => '1.3.6.1.2.1.2.2.1.11',
72 ifInNUcastPkts => '1.3.6.1.2.1.2.2.1.12',
73 ifInDiscards => '1.3.6.1.2.1.2.2.1.13',
74 ifInErrors => '1.3.6.1.2.1.2.2.1.14',
75 ifInUnknownProtos => '1.3.6.1.2.1.2.2.1.15',
76 ifOutOctets => '1.3.6.1.2.1.2.2.1.16',
77 ifOutUcastPkts => '1.3.6.1.2.1.2.2.1.17',
78 ifOutNUcastPkts => '1.3.6.1.2.1.2.2.1.18',
79 ifOutDiscards => '1.3.6.1.2.1.2.2.1.19',
80 ifDescr => '1.3.6.1.2.1.2.2.1.2',
81 ifOutErrors => '1.3.6.1.2.1.2.2.1.20',
82 ifOutQLen => '1.3.6.1.2.1.2.2.1.21',
83 ifSpecific => '1.3.6.1.2.1.2.2.1.22',
84 ifType => '1.3.6.1.2.1.2.2.1.3',
85 ifMtu => '1.3.6.1.2.1.2.2.1.4',
86 ifSpeed => '1.3.6.1.2.1.2.2.1.5',
87 ifPhysAddress => '1.3.6.1.2.1.2.2.1.6',
88 ifAdminHack => '1.3.6.1.2.1.2.2.1.7',
89 ifAdminStatus => '1.3.6.1.2.1.2.2.1.7',
90 ifOperHack => '1.3.6.1.2.1.2.2.1.8',
91 ifOperStatus => '1.3.6.1.2.1.2.2.1.8',
92 ifLastChange => '1.3.6.1.2.1.2.2.1.9',
93 ifName => '1.3.6.1.2.1.31.1.1.1.1',
94 ifInMulticastPkts => '1.3.6.1.2.1.31.1.1.1.2',
95 ifInBroadcastPkts => '1.3.6.1.2.1.31.1.1.1.3',
96 ifOutMulticastPkts => '1.3.6.1.2.1.31.1.1.1.4',
97 ifOutBroadcastPkts => '1.3.6.1.2.1.31.1.1.1.5',
98 ifHCInOctets => '1.3.6.1.2.1.31.1.1.1.6',
99 ifHCInUcastPkts => '1.3.6.1.2.1.31.1.1.1.7',
100 ifHCInMulticastPkts => '1.3.6.1.2.1.31.1.1.1.8',
101 ifHCInBroadcastPkts => '1.3.6.1.2.1.31.1.1.1.9',
102 ifHCOutOctets => '1.3.6.1.2.1.31.1.1.1.10',
103 ifHCOutUcastPkts => '1.3.6.1.2.1.31.1.1.1.11',
104 ifHCOutMulticastPkts => '1.3.6.1.2.1.31.1.1.1.12',
105 ifHCOutBroadcastPkts => '1.3.6.1.2.1.31.1.1.1.13',
106 ifLinkUpDownTrapEnable => '1.3.6.1.2.1.31.1.1.1.14',
107 ifHighSpeed => '1.3.6.1.2.1.31.1.1.1.15',
108 ifPromiscuousMode => '1.3.6.1.2.1.31.1.1.1.16',
109 ifConnectorPresent => '1.3.6.1.2.1.31.1.1.1.17',
110 ifAlias => '1.3.6.1.2.1.31.1.1.1.18',
111 ifCounterDiscontinuityTime => '1.3.6.1.2.1.31.1.1.1.19',
112 );
113  
114 2 my %IANAifType = (
115 1 => 'other',
116 2 => 'regular1822',
117 3 => 'hdh1822',
118 4 => 'ddnX25',
119 5 => 'rfc877x25',
120 6 => 'ethernetCsmacd',
121 7 => 'iso88023Csmacd',
122 8 => 'iso88024TokenBus',
123 9 => 'iso88025TokenRing',
124 10 => 'iso88026Man',
125 11 => 'starLan',
126 12 => 'proteon10Mbit',
127 13 => 'proteon80Mbit',
128 14 => 'hyperchannel',
129 15 => 'fddi',
130 16 => 'lapb',
131 17 => 'sdlc',
132 18 => 'ds1',
133 19 => 'e1',
134 20 => 'basicISDN',
135 21 => 'primaryISDN',
136 22 => 'propPointToPointSerial',
137 23 => 'ppp',
138 24 => 'softwareLoopback',
139 25 => 'eon',
140 26 => 'ethernet3Mbit',
141 27 => 'nsip',
142 28 => 'slip',
143 29 => 'ultra',
144 30 => 'ds3',
145 31 => 'sip',
146 32 => 'frameRelay',
147 33 => 'rs232',
148 34 => 'para',
149 35 => 'arcnet',
150 36 => 'arcnetPlus',
151 37 => 'atm',
152 38 => 'miox25',
153 39 => 'sonet',
154 40 => 'x25ple',
155 41 => 'iso88022llc',
156 42 => 'localTalk',
157 43 => 'smdsDxi',
158 44 => 'frameRelayService',
159 45 => 'v35',
160 46 => 'hssi',
161 47 => 'hippi',
162 48 => 'modem',
163 49 => 'aal5',
164 50 => 'sonetPath',
165 51 => 'sonetVT',
166 52 => 'smdsIcip',
167 53 => 'propVirtual',
168 54 => 'propMultiplexor',
169 55 => 'ieee80212',
170 56 => 'fibreChannel',
171 57 => 'hippiInterface',
172 58 => 'frameRelayInterconnect',
173 32 => 'frameRelay',
174 44 => 'frameRelayService',
175 59 => 'aflane8023',
176 60 => 'aflane8025',
177 61 => 'cctEmul',
178 62 => 'fastEther',
179 63 => 'isdn',
180 64 => 'v11',
181 65 => 'v36',
182 66 => 'g703at64k',
183 67 => 'g703at2mb',
184 68 => 'qllc',
185 69 => 'fastEtherFX',
186 70 => 'channel',
187 71 => 'ieee80211',
188 72 => 'ibm370parChan',
189 73 => 'escon',
190 74 => 'dlsw',
191 75 => 'isdns',
192 76 => 'isdnu',
193 77 => 'lapd',
194 78 => 'ipSwitch',
195 79 => 'rsrb',
196 80 => 'atmLogical',
197 81 => 'ds0',
198 82 => 'ds0Bundle',
199 83 => 'bsc',
200 84 => 'async',
201 85 => 'cnr',
202 86 => 'iso88025Dtr',
203 87 => 'eplrs',
204 88 => 'arap',
205 89 => 'propCnls',
206 90 => 'hostPad',
207 91 => 'termPad',
208 92 => 'frameRelayMPI',
209 93 => 'x213',
210 94 => 'adsl',
211 95 => 'radsl',
212 96 => 'sdsl',
213 97 => 'vdsl',
214 98 => 'iso88025CRFPInt',
215 99 => 'myrinet',
216 100 => 'voiceEM',
217 101 => 'voiceFXO',
218 102 => 'voiceFXS',
219 103 => 'voiceEncap',
220 104 => 'voiceOverIp',
221 105 => 'atmDxi',
222 106 => 'atmFuni',
223 107 => 'atmIma',
224 108 => 'pppMultilinkBundle',
225 109 => 'ipOverCdlc',
226 110 => 'ipOverClaw',
227 111 => 'stackToStack',
228 112 => 'virtualIpAddress',
229 113 => 'mpc',
230 114 => 'ipOverAtm',
231 115 => 'iso88025Fiber',
232 116 => 'tdlc',
233 117 => 'gigabitEthernet',
234 118 => 'hdlc',
235 119 => 'lapf',
236 120 => 'v37',
237 121 => 'x25mlp',
238 122 => 'x25huntGroup',
239 123 => 'trasnpHdlc',
240 124 => 'interleave',
241 125 => 'fast',
242 126 => 'ip',
243 127 => 'docsCableMaclayer',
244 128 => 'docsCableDownstream',
245 129 => 'docsCableUpstream',
246 130 => 'a12MppSwitch',
247 131 => 'tunnel',
248 132 => 'coffee',
249 133 => 'ces',
250 134 => 'atmSubInterface',
251 135 => 'l2vlan',
252 136 => 'l3ipvlan',
253 137 => 'l3ipxvlan',
254 138 => 'digitalPowerline',
255 139 => 'mediaMailOverIp',
256 140 => 'dtm',
257 141 => 'dcn',
258 142 => 'ipForward',
259 143 => 'msdsl',
260 144 => 'ieee1394',
261 145 => 'if-gsn',
262 146 => 'dvbRccMacLayer',
263 147 => 'dvbRccDownstream',
264 148 => 'dvbRccUpstream',
265 149 => 'atmVirtual',
266 150 => 'mplsTunnel',
267 151 => 'srp',
268 152 => 'voiceOverAtm',
269 153 => 'voiceOverFrameRelay',
270 154 => 'idsl',
271 155 => 'compositeLink',
272 156 => 'ss7SigLink',
273 157 => 'propWirelessP2P',
274 158 => 'frForward',
275 159 => 'rfc1483',
276 160 => 'usb',
277 161 => 'ieee8023adLag',
278 162 => 'bgppolicyaccounting',
279 163 => 'frf16MfrBundle',
280 164 => 'h323Gatekeeper',
281 165 => 'h323Proxy',
282 166 => 'mpls',
283 167 => 'mfSigLink',
284 168 => 'hdsl2',
285 169 => 'shdsl',
286 170 => 'ds1FDL',
287 171 => 'pos',
288 172 => 'dvbAsiln',
289 173 => 'dvbAsiOut',
290 174 => 'plc',
291 175 => 'nfas',
292 176 => 'tr008',
293 177 => 'gr303RDT',
294 178 => 'gr303IDT',
295 179 => 'isup',
296 180 => 'propDocsWirelessMaclayer',
297 181 => 'propDocsWirelessDownstream',
298 182 => 'propDocsWirelessUpstream',
299 183 => 'hiperlan2',
300 184 => 'propBWAp2Mp',
301 185 => 'sonetOverheadChannel',
302 186 => 'digitalWrapperOverheadChannel',
303 187 => 'aal2',
304 188 => 'radioMAC',
305 189 => 'atmRadio',
306 );
307 =head2 METHODS
308  
309 =over
310  
311 =item new HASH $args
312  
313 The constructor for the class. User code should probably never need to
314 call the constructor directly as Net::SNMP::Interface::Details objects
315 are returned by the Net::SNMP::Interfaces methods all_interfaces() and
316 interface().
317  
318 There are three mandatory arguments:
319  
320 =over
321  
322 =item Session
323  
324 A valid Net::SNMP object which will be used to make the requests for the
325 interface information. This Net::SNMP object should currently only be
326 of the blocking variety as no provision has been made for non-blocking
327 requests at present.
328  
329 =item Index
330  
331 The SNMP ifTable index for this interface.
332  
333 =item Name
334  
335 The name of this interface (e.g. 'eth0' ).
336  
337 =back
338  
339 The Name and Index arguments should have previously been obtained by
340 SNMP requests to the same host as the Session object has been created for.
341  
342 =cut
343  
344 sub new
345 0 ▶{
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
346 0 my ( $proto, %args ) = @_;
347  
348 0 my $self = {};
349  
350 0 ▶ unless ( exists $args{Session} and ref($args{Session}) eq 'Net::SNMP')
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $args{"Session"} and ref $args{"Session"} eq "Net::SNMP") 0 0 0
Condition0%0/3
exists $args{"Session"} and ref $args{"Session"} eq "Net::SNMP"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args{"Session"} and ref $args{"Session"} eq "Net::SNMP"
exists $args{"Session"} ref $args{"Session"} eq "Net::SNMP"
Truth table0%0/3
A and B
A= exists $args{"Session"}B= ref $args{"Session"} eq "Net::SNMP"
ABresult
0X0
100
111
351 {
352 0 croak "Session must be defined and be a Net::SNMP object";
353 }
354  
355 0 $self->{_session} = $args{Session};
356 0 $self->{_index} = $args{Index};
357 0 $self->{_name} = $args{Name};
358  
359 0 return bless $self, $proto;
360 }
361  
362 =item name
363  
364 Returns the name of this interface.
365  
366 =cut
367  
368 sub name
369 0 ▶{
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
370 0 my ( $self ) = @_;
371  
372 0 return $self->{_name};
373 }
374  
375 =item index
376  
377 Returns the index of this interface.
378  
379 =cut
380  
381 sub index
382 0 ▶{
Subroutine index: not called CC=1 SCAR=6.9
Pod documented
383 0 my ( $self ) = @_;
384  
385 0 return $self->{_index};
386 }
387  
388 =item session
389  
390 Returns the Net::SNMP session object that is being used to make requests
391 for this interface. This probably is not needed but is here for
392 completeness' sake.
393  
394 =cut
395  
396 sub session
397 0 ▶{
Subroutine session: not called CC=1 SCAR=6.9
Pod documented
398 0 my ( $self ) = @_;
399  
400 0 return $self->{_session};
401 }
402  
403 =item error
404  
405 Returns the text of the last error returned from SNMP session - will only
406 be meaningful if the last method call returned undef to indicate that an
407 error had occurred.
408  
409 =cut
410  
411 sub error
412 0 ▶{
Subroutine error: not called CC=2 SCAR=17.9
Pod documented
413 0 my ($self) = @_;
414 0 ▶ return $self->{_lasterror} || $self->session()->error();
Condition0%0/3
$self->{'_lasterror'} || $self->session->error
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'_lasterror'} || $self->session->error
$self->{'_lasterror'} $self->session->error
Truth table0%0/3
A || B
A= $self->{'_lasterror'}B= $self->session->error
ABresult
1X1
011
000
415 }
416  
417 =item IANAifType
418  
419 Converts from an IANAifType integer value as will be returned by ifType
420 to its text equivalent.
421  
422 =cut
423  
424 sub IANAifType
425 0 ▶{
Subroutine IANAifType: not called CC=4 SCAR=30.0
Pod documented
426 0 my ( $self, $iftype ) = @_;
427  
428 0 ▶ if ( defined $iftype )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $iftype) { } 0 0 0
429 {
430 0 ▶ return exists $IANAifType{$iftype} ? $IANAifType{$iftype} : 'other';
Branch: 1 branch
BranchTrueFalseTotal
exists $IANAifType{$iftype} ? : 0 0 0
431 }
432 else
433 {
434 0 ▶ return $IANAifType{$self->ifType()} || 'other';
Condition0%0/2
$IANAifType{$self->ifType} || 'other'
l!l
00
MC/DC0%0/1
$IANAifType{$self->ifType} || 'other'
$IANAifType{$self->ifType}
Truth table0%0/2
A
A= $IANAifType{$self->ifType}
Aresult
11
00
435 }
436 }
437  
438 =for pod
439  
440 =back
441  
442 The remainder of the methods are named after the literal names for the
443 SNMP entries for network interfaces. The following descriptions are
444 taken from the IF-MIB with some additional comment from the author where
445 necessary. If an error occurs in the SNMP session these methods will
446 return undef and the text of the error message can be determined by calling
447 the error() method.
448  
449 =over
450  
451 =item ifIndex
452  
453 A unique value, greater than zero, for each interface. It is
454 recommended that values are assigned contiguously starting from 1.
455 The value for each interface sub-layer must remain constant at least
456 from one re-initialization of the entity's network management system to
457 the next re-initialization.
458  
459  
460 =item ifDescr
461  
462 A textual string containing information about the interface. This string
463 should include the name of the manufacturer, the product name and the
464 version of the interface hardware/software.
465  
466 (In practice this will be name of the interface e.g. 'eth0')
467  
468 =item ifType
469  
470 The type of interface. Additional values for ifType are assigned by the
471 Internet Assigned Numbers Authority (IANA), through updating the syntax
472 of the IANAifType textual convention.
473  
474  
475 =item ifMtu
476  
477 The size of the largest packet which can be sent/received on the
478 interface, specified in octets. For interfaces that are used for
479 transmitting network datagrams, this is the size of the largest network
480 datagram that can be sent on the interface.
481  
482  
483 =item ifSpeed
484  
485 An estimate of the interface's current bandwidth in bits per second.
486 For interfaces which do not vary in bandwidth or for those where
487 no accurate estimation can be made, this object should contain the
488 nominal bandwidth. If the bandwidth of the interface is greater than the
489 maximum value reportable by this object then this object should report
490 its maximum value (4,294,967,295) and ifHighSpeed must be used to report
491 the interace's speed. For a sub-layer which has no concept of bandwidth,
492 this object should be zero.
493  
494  
495 =item ifPhysAddress
496  
497 The interface's address at its protocol sub-layer. For example,
498 for an 802.x interface, this object normally contains a MAC address.
499 The interface's media-specific MIB must define the bit and byte ordering
500 and the format of the value of this object. For interfaces which do not
501 have such an address (e.g., a serial line), this object should contain
502 an octet string of zero length.
503  
504  
505 =item ifAdminStatus
506  
507 The desired state of the interface. The testing(3) state indicates that
508 no operational packets can be passed. When a managed system initializes,
509 all interfaces start with ifAdminStatus in the down(2) state. As a result
510 of either explicit management action or per configuration information
511 retained by the managed system, ifAdminStatus is then changed to either
512 the up(1) or testing(3) states (or remains in the down(2) state).
513  
514  
515 =item ifOperStatus
516  
517 The current operational state of the interface. The testing(3) state
518 indicates that no operational packets can be passed. If ifAdminStatus
519 is down(2) then ifOperStatus should be down(2). If ifAdminStatus
520 is changed to up(1) then ifOperStatus should change to up(1) if the
521 interface is ready to transmit and receive network traffic; it should
522 change to dormant(5) if the interface is waiting for external actions
523 (such as a serial line waiting for an incoming connection); it should
524 remain in the down(2) state if and only if there is a fault that prevents
525 it from going to the up(1) state; it should remain in the notPresent(6)
526 state if the interface has missing (typically, hardware) components.
527  
528  
529 =item ifLastChange
530  
531 The value of sysUpTime at the time the interface entered its current
532 operational state. If the current state was entered prior to the last
533 re-initialization of the local network management subsystem, then this
534 object contains a zero value.
535  
536  
537 =item ifInOctets
538  
539 The total number of octets received on the interface, including framing
540 characters. Discontinuities in the value of this counter can occur
541 at re-initialization of the management system, and at other times as
542 indicated by the value of ifCounterDiscontinuityTime.
543  
544  
545 =item ifInUcastPkts
546  
547 The number of packets, delivered by this sub-layer to a higher
548 (sub-)layer, which were not addressed to a multicast or broadcast address
549 at this sub-layer. Discontinuities in the value of this counter can
550 occur at re-initialization of the management system, and at other times
551 as indicated by the value of ifCounterDiscontinuityTime.
552  
553  
554 =item ifInNUcastPkts
555  
556 The number of packets, delivered by this sub-layer to a higher
557 (sub-)layer, which were addressed to a multicast or broadcast address
558 at this sub-layer. Discontinuities in the value of this counter can
559 occur at re-initialization of the management system, and at other times
560 as indicated by the value of ifCounterDiscontinuityTime. This object
561 is deprecated in favour of ifInMulticastPkts and ifInBroadcastPkts.
562  
563  
564 =item ifInDiscards
565  
566 The number of inbound packets which were chosen to be discarded even
567 though no errors had been detected to prevent their being deliverable
568 to a higher-layer protocol. One possible reason for discarding such a
569 packet could be to free up buffer space. Discontinuities in the value of
570 this counter can occur at re-initialization of the management system, and
571 at other times as indicated by the value of ifCounterDiscontinuityTime.
572  
573  
574 =item ifInErrors
575  
576 For packet-oriented interfaces, the number of inbound packets that
577 contained errors preventing them from being deliverable to a higher-layer
578 protocol. For character-oriented or fixed-length interfaces, the number
579 of inbound transmission units that contained errors preventing them
580 from being deliverable to a higher-layer protocol. Discontinuities
581 in the value of this counter can occur at re-initialization of the
582 management system, and at other times as indicated by the value of
583 ifCounterDiscontinuityTime.
584  
585  
586 =item ifInUnknownProtos
587  
588 For packet-oriented interfaces, the number of packets received via
589 the interface which were discarded because of an unknown or unsupported
590 protocol. For character-oriented or fixed-length interfaces that support
591 protocol multiplexing the number of transmission units received via
592 the interface which were discarded because of an unknown or unsupported
593 protocol. For any interface that does not support protocol multiplexing,
594 this counter will always be 0. Discontinuities in the value of this
595 counter can occur at re-initialization of the management system, and at
596 other times as indicated by the value of ifCounterDiscontinuityTime.
597  
598  
599 =item ifOutOctets
600  
601 The total number of octets transmitted out of the interface, including
602 framing characters. Discontinuities in the value of this counter can
603 occur at re-initialization of the management system, and at other times
604 as indicated by the value of ifCounterDiscontinuityTime.
605  
606  
607 =item ifOutUcastPkts
608  
609 The total number of packets that higher-level protocols requested be
610 transmitted, and which were not addressed to a multicast or broadcast
611 address at this sub-layer, including those that were discarded or
612 not sent. Discontinuities in the value of this counter can occur
613 at re-initialization of the management system, and at other times as
614 indicated by the value of ifCounterDiscontinuityTime.
615  
616  
617 =item ifOutNUcastPkts
618  
619 The total number of packets that higher-level protocols requested be
620 transmitted, and which were addressed to a multicast or broadcast
621 address at this sub-layer, including those that were discarded or
622 not sent. Discontinuities in the value of this counter can occur
623 at re-initialization of the management system, and at other times as
624 indicated by the value of ifCounterDiscontinuityTime. This object is
625 deprecated in favour of ifOutMulticastPkts and ifOutBroadcastPkts.
626  
627  
628 =item ifOutDiscards
629  
630 The number of outbound packets which were chosen to be discarded even
631 though no errors had been detected to prevent their being transmitted.
632 One possible reason for discarding such a packet could be to free up
633 buffer space. Discontinuities in the value of this counter can occur
634 at re-initialization of the management system, and at other times as
635 indicated by the value of ifCounterDiscontinuityTime.
636  
637  
638 =item ifOutErrors
639  
640 For packet-oriented interfaces, the number of outbound packets that
641 could not be transmitted because of errors. For character-oriented
642 or fixed-length interfaces, the number of outbound transmission units
643 that could not be transmitted because of errors. Discontinuities
644 in the value of this counter can occur at re-initialization of the
645 management system, and at other times as indicated by the value of
646 ifCounterDiscontinuityTime.
647  
648  
649 =item ifOutQLen
650  
651 The length of the output packet queue (in packets). This object has been
652 deprecated as of rfc2863.
653  
654  
655 =item ifSpecific
656  
657 A reference to MIB definitions specific to the particular media being used
658 to realize the interface. It is recommended that this value point to an
659 instance of a MIB object in the media-specific MIB, i.e., that this object
660 have the semantics associated with the InstancePointer textual convention
661 defined in RFC 1903. In fact, it is recommended that the media- specific
662 MIB specify what value ifSpecific should/can take for values of ifType.
663 If no MIB definitions specific to the particular media are available,
664 the value should be set to the OBJECT IDENTIFIER { 0 0 }.
665  
666 =back
667  
668 These next methods are from the ifXTable as described in
669 rfc2863:
670  
671 This table contains objects that have been added to the Interface
672 MIB as a result of the Interface Evolution effort, or replacements
673 for objects of the original (MIB-II) ifTable that were deprecated
674 because the semantics of said objects have significantly changed.
675 This table also contains objects that were previously in the
676 ifExtnsTable.
677  
678 These methods may not be available from all network elements and
679 in those cases they will return undef.
680  
681 =item ifName
682  
683 The textual name of the interface. The value of this object should be
684 the name of the interface as assigned by the local device and should
685 be suitable for use in commands entered at the device's `console'.
686 This might be a text name, such as `le0' or a simple port number,
687 such as `1', depending on the interface naming syntax of the device.
688 If several entries in the ifTable together represent a single interface
689 as named by the device, then each will have the same value of ifName.
690 Note that for an agent which responds to SNMP queries concerning an
691 interface on some other (proxied) device, then the value of ifName for
692 such an interface is the proxied device's local name for it. If there
693 is no local name, or this object is otherwise not applicable, then this
694 object contains a zero-length string.
695  
696 =item ifInMulticastPkts
697  
698 The number of packets, delivered by this sub-layer to a higher
699 (sub-)layer, which were addressed to a multicast address at this
700 sub-layer. For a MAC layer protocol, this includes both Group and
701 Functional addresses. Discontinuities in the value of this counter can
702 occur at re-initialization of the management system, and at other times
703 as indicated by the value of ifCounterDiscontinuityTime.
704  
705  
706 =item ifInBroadcastPkts
707  
708 The number of packets, delivered by this sub-layer to a higher
709 (sub-)layer, which were addressed to a broadcast address at this
710 sub-layer. Discontinuities in the value of this counter can occur
711 at re-initialization of the management system, and at other times as
712 indicated by the value of ifCounterDiscontinuityTime.
713  
714  
715 =item ifOutMulticastPkts
716  
717 The total number of packets that higher-level protocols requested
718 be transmitted, and which were addressed to a multicast address at
719 this sub-layer, including those that were discarded or not sent.
720 For a MAC layer protocol, this includes both Group and Functional
721 addresses. Discontinuities in the value of this counter can occur
722 at re-initialization of the management system, and at other times as
723 indicated by the value of ifCounterDiscontinuityTime.
724  
725  
726 =item ifOutBroadcastPkts
727  
728 The total number of packets that higher-level protocols requested
729 be transmitted, and which were addressed to a broadcast address
730 at this sub-layer, including those that were discarded or not
731 sent. Discontinuities in the value of this counter can occur at
732 re-initialization of the management system, and at other times as
733 indicated by the value of ifCounterDiscontinuityTime.
734  
735  
736 =item ifHCInOctets
737  
738 The total number of octets received on the interface, including
739 framing characters. This object is a 64-bit version of ifInOctets.
740 Discontinuities in the value of this counter can occur at
741 re-initialization of the management system, and at other times as
742 indicated by the value of ifCounterDiscontinuityTime.
743  
744  
745 =item ifHCInUcastPkts
746  
747 The number of packets, delivered by this sub-layer to a higher
748 (sub-)layer, which were not addressed to a multicast or broadcast
749 address at this sub-layer. This object is a 64-bit version of
750 ifInUcastPkts. Discontinuities in the value of this counter can occur
751 at re-initialization of the management system, and at other times as
752 indicated by the value of ifCounterDiscontinuityTime.
753  
754  
755 =item ifHCInMulticastPkts
756  
757 The number of packets, delivered by this sub-layer to a higher
758 (sub-)layer, which were addressed to a multicast address at this
759 sub-layer. For a MAC layer protocol, this includes both Group
760 and Functional addresses. This object is a 64-bit version of
761 ifInMulticastPkts. Discontinuities in the value of this counter can
762 occur at re-initialization of the management system, and at other times
763 as indicated by the value of ifCounterDiscontinuityTime.
764  
765  
766 =item ifHCInBroadcastPkts
767  
768 The number of packets, delivered by this sub-layer to a higher
769 (sub-)layer, which were addressed to a broadcast address at this
770 sub-layer. This object is a 64-bit version of ifInBroadcastPkts.
771 Discontinuities in the value of this counter can occur at
772 re-initialization of the management system, and at other times as
773 indicated by the value of ifCounterDiscontinuityTime.
774  
775  
776 =item ifHCOutOctets
777  
778 The total number of octets transmitted out of the interface,
779 including framing characters. This object is a 64-bit version of
780 ifOutOctets. Discontinuities in the value of this counter can occur
781 at re-initialization of the management system, and at other times as
782 indicated by the value of ifCounterDiscontinuityTime.
783  
784  
785 =item ifHCOutUcastPkts
786  
787 The total number of packets that higher-level protocols requested be
788 transmitted, and which were not addressed to a multicast or broadcast
789 address at this sub-layer, including those that were discarded or not
790 sent. This object is a 64-bit version of ifOutUcastPkts. Discontinuities
791 in the value of this counter can occur at re-initialization of the
792 management system, and at other times as indicated by the value of
793 ifCounterDiscontinuityTime.
794  
795  
796 =item ifHCOutMulticastPkts
797  
798 The total number of packets that higher-level protocols requested be
799 transmitted, and which were addressed to a multicast address at this
800 sub-layer, including those that were discarded or not sent. For a
801 MAC layer protocol, this includes both Group and Functional addresses.
802 This object is a 64-bit version of ifOutMulticastPkts. Discontinuities
803 in the value of this counter can occur at re-initialization of the
804 management system, and at other times as indicated by the value of
805 ifCounterDiscontinuityTime.
806  
807  
808 =item ifHCOutBroadcastPkts
809  
810 The total number of packets that higher-level protocols requested
811 be transmitted, and which were addressed to a broadcast address
812 at this sub-layer, including those that were discarded or not sent.
813 This object is a 64-bit version of ifOutBroadcastPkts. Discontinuities
814 in the value of this counter can occur at re-initialization of the
815 management system, and at other times as indicated by the value of
816 ifCounterDiscontinuityTime.
817  
818  
819 =item ifLinkUpDownTrapEnable
820  
821 Indicates whether linkUp/linkDown traps should be generated for this
822 interface. By default, this object should have the value enabled(1)
823 for interfaces which do not operate on 'top' of any other interface
824 (as defined in the ifStackTable), and disabled(2) otherwise.
825  
826  
827 =item ifHighSpeed
828  
829 An estimate of the interface's current bandwidth in units of 1,000,000
830 bits per second. If this object reports a value of `n' then the
831 speed of the interface is somewhere in the range of `n-500,000' to
832 `n+499,999'. For interfaces which do not vary in bandwidth or for those
833 where no accurate estimation can be made, this object should contain the
834 nominal bandwidth. For a sub-layer which has no concept of bandwidth,
835 this object should be zero.
836  
837  
838 =item ifPromiscuousMode
839  
840 This object has a value of false(2) if this interface only accepts
841 packets/frames that are addressed to this station. This object
842 has a value of true(1) when the station accepts all packets/frames
843 transmitted on the media. The value true(1) is only legal on certain
844 types of media. If legal, setting this object to a value of true(1) may
845 require the interface to be reset before becoming effective. The value
846 of ifPromiscuousMode does not affect the reception of broadcast and
847 multicast packets/frames by the interface.
848  
849 =item ifConnectorPresent
850  
851 This object has the value 'true(1)' if the interface sublayer has a
852 physical connector and the value 'false(2)' otherwise.
853  
854 =item ifAlias
855  
856 This object is an 'alias' name for the interface as specified by a network
857 manager, and provides a non-volatile 'handle' for the interface. On the
858 first instantiation of an interface, the value of ifAlias associated with
859 that interface is the zero-length string. As and when a value is written
860 into an instance of ifAlias through a network management set operation,
861 then the agent must retain the supplied value in the ifAlias instance
862 associated with the same interface for as long as that interface remains
863 instantiated, including across all re- initializations/reboots of the
864 network management system, including those which result in a change of
865 the interface's ifIndex value. An example of the value which a network
866 manager might store in this object for a WAN interface is the (Telco's)
867 circuit number/identifier of the interface. Some agents may support
868 write-access only for interfaces having particular values of ifType.
869 An agent which supports write access to this object is required to keep
870 the value in non-volatile storage, but it may limit the length of new
871 values depending on how much storage is already occupied by the current
872 values for other interfaces.
873  
874 =item ifCounterDiscontinuityTime
875  
876 The value of sysUpTime on the most recent occasion at which any one or
877 more of this interface's counters suffered a discontinuity. The relevant
878 counters are the specific instances associated with this interface of
879 any Counter32 or Counter64 object contained in the ifTable or ifXTable.
880 If no such discontinuities have occurred since the last re- initialization
881 of the local management subsystem, then this object contains a zero value.
882  
883 =cut
884  
885 sub AUTOLOAD
886 0 ▶{
Subroutine AUTOLOAD: not called CC=3 SCAR=22.1
887 0 my ( $self ) = @_;
888  
889 0 ▶ return if $AUTOLOAD =~ /DESTROY$/;
Branch: 1 branch
BranchTrueFalseTotal
if $Net::SNMP::Interfaces::Details::AUTOLOAD =~ /DESTROY$/ 0 0 0
890  
891 0 my ($name) = $AUTOLOAD =~ /::([^:]+)$/;
892
893 0 ▶ if ( not exists $OIDS{$name} )
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $OIDS{$name}) { } 0 0 0
894 {
895 0 croak "Can't locate object method '$name' via package '" . __PACKAGE__ . "'";
896 }
897 else
898 {
899 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
900
901 0 *{$AUTOLOAD} =
902 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
903 0 my ( $self ) = @_;
904 0 my $oid = "$OIDS{$name}." . $self->index();
905  
906 0 my $response;
907  
908 0 ▶ if ( defined( $response = $self->session()->get_request($oid)) )
Branch: 1 branch
BranchTrueFalseTotal
if (defined($response = $self->session->get_request($oid))) { } 0 0 0
909 {
910 0 return $response->{$oid};
911 }
912 else
913 {
914 0 $self->{_lasterror} = $self->session()->error();
915 0 return undef;
916 }
917 0 };
918  
919 0 goto &{$AUTOLOAD};
920 }
921
922 }
923  
924 2 1;
925 __END__
« Interfaces.pm ↑ Summary