line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::BGP::ASPath::AS_SET; |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
26
|
use strict; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
1848
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
## Inheritance and Versioning ## |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@Net::BGP::ASPath::AS_SET::ISA = qw( Net::BGP::ASPath::AS ); |
10
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub type { |
13
|
7
|
|
|
7
|
0
|
19
|
return 1; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub length { |
17
|
41
|
|
|
41
|
0
|
38
|
my $this = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# We really shouldn't see empty ones of these, but if we do, |
20
|
|
|
|
|
|
|
# we will treat them as zero. But otherwise, RFC indicates |
21
|
|
|
|
|
|
|
# that in path computations, any AS_SET is equal to one hop. |
22
|
|
|
|
|
|
|
|
23
|
41
|
100
|
|
|
|
131
|
if (scalar(keys %$this)) { |
24
|
39
|
|
|
|
|
94
|
return 1; |
25
|
|
|
|
|
|
|
} else { |
26
|
2
|
|
|
|
|
7
|
return 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
0
|
0
|
sub asstring { as_string(@_) } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub as_string { |
33
|
262
|
|
|
262
|
0
|
229
|
my $this = shift; |
34
|
262
|
|
|
|
|
237
|
return '{' . join(',', sort { $a <=> $b } keys %{$this}) . '}'; |
|
756
|
|
|
|
|
1675
|
|
|
262
|
|
|
|
|
1017
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub asarray { |
38
|
24
|
|
|
24
|
0
|
23
|
my $this = shift; |
39
|
24
|
|
|
|
|
25
|
return [ sort { $a <=> $b } keys %{$this} ]; |
|
51
|
|
|
|
|
104
|
|
|
24
|
|
|
|
|
79
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub merge { |
43
|
24
|
|
|
24
|
0
|
25
|
my $this = shift; |
44
|
24
|
|
|
|
|
34
|
foreach my $obj (@_) { |
45
|
24
|
|
|
|
|
22
|
foreach my $as (@{$obj}) { |
|
24
|
|
|
|
|
47
|
|
46
|
30
|
|
|
|
|
63
|
$this->{$as} = 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
24
|
|
|
|
|
49
|
return $this; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub count { |
53
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return scalar(@{$this}); |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|