line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cisco::Accounting::Interface; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## ---------------------------------------------------------------------------------------------- |
4
|
|
|
|
|
|
|
## Cisco::Accounting::Interface |
5
|
|
|
|
|
|
|
## |
6
|
|
|
|
|
|
|
## Cisco::Accounting::Interface object to store information for one interface |
7
|
|
|
|
|
|
|
## |
8
|
|
|
|
|
|
|
## $Id: Interface.pm 101 2007-08-03 23:10:17Z mwallraf $ |
9
|
|
|
|
|
|
|
## $Author: mwallraf $ |
10
|
|
|
|
|
|
|
## $Date: 2007-08-04 01:10:17 +0200 (Sat, 04 Aug 2007) $ |
11
|
|
|
|
|
|
|
## |
12
|
|
|
|
|
|
|
## This program is free software; you can redistribute it and/or |
13
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself. |
14
|
|
|
|
|
|
|
## ---------------------------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
20
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
21
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
675
|
|
22
|
|
|
|
|
|
|
#use Data::Dumper; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $DEBUG = 0; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
0
|
|
|
0
|
0
|
|
my ($this, $id, $interface, $accounting_status) = @_; |
29
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
30
|
0
|
|
|
|
|
|
my $self = {}; |
31
|
0
|
|
|
|
|
|
bless($self, $class); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{'interface'} = $interface; |
34
|
0
|
|
|
|
|
|
$self->{'accounting_status'} = $accounting_status; |
35
|
0
|
|
|
|
|
|
$self->{'id'} = $id; |
36
|
0
|
|
|
|
|
|
$self->{'description'} = ""; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
&_init($class); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return($self); |
41
|
|
|
|
|
|
|
} # end sub new |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# initialization : set up logging |
45
|
|
|
|
|
|
|
sub _init { |
46
|
0
|
|
|
0
|
|
|
my $class=shift; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
## |
50
|
|
|
|
|
|
|
## return the interface name |
51
|
|
|
|
|
|
|
## |
52
|
|
|
|
|
|
|
sub get_interface() { |
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
54
|
0
|
|
|
|
|
|
return $self->{'interface'}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
## |
58
|
|
|
|
|
|
|
## return the interface status : IP Accounting enabled or disabled ? |
59
|
|
|
|
|
|
|
## |
60
|
|
|
|
|
|
|
sub get_accounting_status() { |
61
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
62
|
0
|
|
|
|
|
|
return $self->{'accounting_status'}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
## |
67
|
|
|
|
|
|
|
## set the name of the interface |
68
|
|
|
|
|
|
|
## |
69
|
|
|
|
|
|
|
sub set_interface() { |
70
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
71
|
0
|
|
|
|
|
|
my $int = shift; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$self->{'interface'} = $int; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
## |
77
|
|
|
|
|
|
|
## set the interface status : IP Accounting enabled or disabled |
78
|
|
|
|
|
|
|
## |
79
|
|
|
|
|
|
|
sub set_accounting_status() { |
80
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
81
|
0
|
|
|
|
|
|
my $status = shift; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->{'set_accounting_status'} = $status; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
## |
87
|
|
|
|
|
|
|
## get the id of this interface |
88
|
|
|
|
|
|
|
## |
89
|
|
|
|
|
|
|
sub get_id() { |
90
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return $self->{'id'}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
## |
96
|
|
|
|
|
|
|
## set the id of this interface |
97
|
|
|
|
|
|
|
## |
98
|
|
|
|
|
|
|
sub set_id() { |
99
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
my $id = shift; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
$self->{'id'} = $id; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
## |
106
|
|
|
|
|
|
|
## get the description if it exists |
107
|
|
|
|
|
|
|
## |
108
|
|
|
|
|
|
|
sub get_description() { |
109
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
return $self->{'description'}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
## |
115
|
|
|
|
|
|
|
## set the interface description if it exists |
116
|
|
|
|
|
|
|
## |
117
|
|
|
|
|
|
|
sub set_description() { |
118
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
119
|
0
|
|
|
|
|
|
my $descr = shift; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$self->{'description'} = $descr; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
__END__ |