line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPClient::Inet6Lease; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
673
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::ISC::DHCPClient - ISC dhclient inet6 lease object |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
23
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
24
|
0
|
|
|
|
|
|
my $self = {}; |
25
|
0
|
|
|
|
|
|
$self->{INTERFACE} = undef; |
26
|
0
|
|
|
|
|
|
$self->{IA} = {}; |
27
|
0
|
|
|
|
|
|
$self->{OPTION} = {}; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
bless ($self, $class); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $self; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub interface($) { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
0
|
|
|
|
|
if (@_) { $self->{INTERFACE} = shift } |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->{INTERFACE}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
sub ias($$) { |
40
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
return keys(%{$self->{IA}}); |
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub address($$) { |
45
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $ia_addr_info = $self->_get_ia_addr_info($ia); |
48
|
0
|
0
|
|
|
|
|
return undef if (!$ia_addr_info); |
49
|
0
|
|
|
|
|
|
return $ia_addr_info->{addr}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
sub starts($$) { |
52
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $ia_info = $self->_get_ia_info($ia); |
55
|
0
|
0
|
|
|
|
|
return undef if (!$ia_info); |
56
|
0
|
|
|
|
|
|
return $ia_info->{starts}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
sub renew($$) { |
59
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $ia_info = $self->_get_ia_info($ia); |
62
|
0
|
0
|
|
|
|
|
return undef if (!$ia_info); |
63
|
0
|
|
|
|
|
|
return $ia_info->{renew}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
sub rebind($$) { |
66
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $ia_info = $self->_get_ia_info($ia); |
69
|
0
|
0
|
|
|
|
|
return undef if (!$ia_info); |
70
|
0
|
|
|
|
|
|
return $ia_info->{rebind}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
sub preferred_life($$) { |
73
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $ia_addr_info = $self->_get_ia_addr_info($ia); |
76
|
0
|
0
|
|
|
|
|
return undef if (!$ia_addr_info); |
77
|
0
|
|
|
|
|
|
return $ia_addr_info->{'preferred-life'}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
sub max_life($$) { |
80
|
0
|
|
|
0
|
0
|
|
my ($self, $ia) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $ia_addr_info = $self->_get_ia_addr_info($ia); |
83
|
0
|
0
|
|
|
|
|
return undef if (!$ia_addr_info); |
84
|
0
|
|
|
|
|
|
return $ia_addr_info->{'max-life'}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
sub option($;$) { |
87
|
0
|
|
|
0
|
0
|
|
my ($self, $opt) = @_; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
return keys(%{$self->{OPTION}}) if (!$opt); |
|
0
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return $self->{OPTION}->{$opt}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _get_ia_info($$) |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
|
|
my ($self, $ia) = @_; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
return undef if (!$self->{IA}->{$ia}); |
99
|
0
|
|
|
|
|
|
return $self->{IA}->{$ia}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
sub _get_ia_addr_info($$) |
102
|
|
|
|
|
|
|
{ |
103
|
0
|
|
|
0
|
|
|
my ($self, $ia) = @_; |
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
return undef if (!$self->{IA}->{$ia}); |
106
|
0
|
0
|
|
|
|
|
if ($ia eq 'non-temporary') { |
|
|
0
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return $self->{IA}->{$ia}->{iaaddr}; |
108
|
|
|
|
|
|
|
} elsif ($ia eq 'prefix') { |
109
|
0
|
|
|
|
|
|
return $self->{IA}->{$ia}->{iaprefix}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
return undef; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4 expandtab: |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |