line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::BGP::ASPath::AS_SET; |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
48
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
2048
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
## Inheritance and Versioning ## |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@Net::BGP::ASPath::AS_SET::ISA = qw( Net::BGP::ASPath::AS ); |
10
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub type { |
13
|
7
|
|
|
7
|
0
|
13
|
return 1; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub length { |
17
|
39
|
|
|
39
|
0
|
55
|
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
|
39
|
100
|
|
|
|
113
|
if (scalar(keys %$this)) { |
24
|
37
|
|
|
|
|
79
|
return 1; |
25
|
|
|
|
|
|
|
} else { |
26
|
2
|
|
|
|
|
6
|
return 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
0
|
0
|
sub asstring { as_string(@_) } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub as_string { |
33
|
262
|
|
|
262
|
0
|
343
|
my $this = shift; |
34
|
262
|
|
|
|
|
360
|
return '{' . join(',', sort { $a <=> $b } keys %{$this}) . '}'; |
|
782
|
|
|
|
|
2017
|
|
|
262
|
|
|
|
|
1097
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub asarray { |
38
|
24
|
|
|
24
|
0
|
39
|
my $this = shift; |
39
|
24
|
|
|
|
|
31
|
return [ sort { $a <=> $b } keys %{$this} ]; |
|
52
|
|
|
|
|
159
|
|
|
24
|
|
|
|
|
82
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub merge { |
43
|
24
|
|
|
24
|
0
|
35
|
my $this = shift; |
44
|
24
|
|
|
|
|
42
|
foreach my $obj (@_) { |
45
|
24
|
|
|
|
|
30
|
foreach my $as (@{$obj}) { |
|
24
|
|
|
|
|
53
|
|
46
|
30
|
|
|
|
|
70
|
$this->{$as} = 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
24
|
|
|
|
|
47
|
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
|
|
|
|
|
|
|
|