| 1 | # JCM::Net::Patricia - Patricia Trie perl module for fast IP address lookups | ||||||||||||||||||||||||||||
| 2 | # Copyright (C) 2000-2005 Dave Plonka | ||||||||||||||||||||||||||||
| 3 | # Copyright (C) 2009 Dave Plonka & Philip Prindeville | ||||||||||||||||||||||||||||
| 4 | # Parts Copyright(C) 2016 Joelle Maslak | ||||||||||||||||||||||||||||
| 5 | # Parts Copyright(C) 2021 Joelle Maslak | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | # the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | # (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||
| 12 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||
| 15 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 16 | # | ||||||||||||||||||||||||||||
| 17 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||
| 18 | # along with this program; if not, write to the Free Software | ||||||||||||||||||||||||||||
| 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||||||||||||||||||||||||||
| 20 | # MA 02110-1301, USA. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Joelle Maslak <jmaslak@antelope.net> | ||||||||||||||||||||||||||||
| 23 | # Dave Plonka <plonka@doit.wisc.edu> | ||||||||||||||||||||||||||||
| 24 | # Philip Prindeville <philipp@redfish-solutions.com> | ||||||||||||||||||||||||||||
| 25 | # Anton Berezin <tobez@tobez.org> | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | package JCM::Net::Patricia; | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 3 | require 5.008; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 3 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 3 | ▶ | use vars qw($VERSION @ISA @EXPORT); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | 3 | ▶ | use Socket qw(AF_INET AF_INET6); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 3 | require Exporter; | |||||||||||||||||||||||||||
| 41 | 3 | require DynaLoader; | |||||||||||||||||||||||||||
| 42 | 3 | @ISA = qw(Exporter DynaLoader); | |||||||||||||||||||||||||||
| 43 | 3 | @EXPORT = qw(AF_INET AF_INET6); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 3 | ▶ | '$Revision: 1.05 $' =~ m/(\d+)\.(\d+)((_\d+)|)/ && ( $VERSION = "$1.$2$3"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | bootstrap JCM::Net::Patricia $VERSION; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 7 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 7 | my ($class, $type) = @_; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 7 | ▶ | $type ||= AF_INET; | ||||||||||||||||||||||||||
|
Condition100%2/2
$type ||= 2
MC/DC100%1/1
$type ||= 2
$type
Truth table100%2/2
A
A= $type
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 7 | ▶ | if ($type == AF_INET) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 4 | return bless _new(32), 'JCM::Net::Patricia::AF_INET'; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 3 | ▶ | if ($type == AF_INET6) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 3 | ▶ | if (JCM::Net::Patricia::have_ipv6()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 3 | return bless _new(128), 'JCM::Net::Patricia::AF_INET6'; | |||||||||||||||||||||||||||
| 62 | } else { | ||||||||||||||||||||||||||||
| 63 | 0 | croak('IPv6 is not available on this platform'); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | croak "new: unimplemented type"; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | ## | ||||||||||||||||||||||||||||
| 71 | ## Compat functions | ||||||||||||||||||||||||||||
| 72 | ## | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 69 | ▶ | sub _ip_bits { | ||||||||||||||||||||||||||
|
Subroutine
_ip_bits: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 75 | 69 | my ($self, $str) = @_; | |||||||||||||||||||||||||||
| 76 | 69 | my $bits; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 69 | ▶ | if (ref ($self) eq 'JCM::Net::Patricia::AF_INET6') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 15 | ▶ | $bits = ($str =~ s|/(\d+)$||) ? $1 : 128; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||
| 81 | 54 | ▶ | $bits = ($str =~ s|/(\d+)$||) ? $1 : 32; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 69 | ($str,$bits); | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 38 | ▶ | sub add_string { | ||||||||||||||||||||||||||
|
Subroutine
add_string: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||
| 87 | 38 | ▶ | croak "add_string: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 88 | 38 | my ($self,$str,$data) = @_; | |||||||||||||||||||||||||||
| 89 | 38 | ▶ | $data = $str unless @_ > 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 38 | $self->add($self->_ip_bits($str),$data); | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 17 | ▶ | sub match_string { | ||||||||||||||||||||||||||
|
Subroutine
match_string: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | 17 | ▶ | croak "match_string: wrong number of args" if (@_ != 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 17 | my ($self,$str) = @_; | |||||||||||||||||||||||||||
| 96 | 17 | $self->match($self->_ip_bits($str)) | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 8 | ▶ | sub matching_prefix_string { | ||||||||||||||||||||||||||
|
Subroutine
matching_prefix_string: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | 8 | ▶ | croak "matching_prefix_string: wrong number of args" if (@_ != 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 8 | my ($self,$str) = @_; | |||||||||||||||||||||||||||
| 102 | 8 | $self->matching_prefix($self->_ip_bits($str)) | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 2 | ▶ | sub match_exact_string { | ||||||||||||||||||||||||||
|
Subroutine
match_exact_string: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | 2 | ▶ | croak "match_exact_string: wrong number of args" if (@_ != 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 2 | my ($self,$str) = @_; | |||||||||||||||||||||||||||
| 108 | 2 | $self->exact($self->_ip_bits($str)) | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 6 | ▶ | sub match_exact_integer { | ||||||||||||||||||||||||||
|
Subroutine
match_exact_integer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | 6 | shift->exact_integer(@_) | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 4 | ▶ | sub remove_string { | ||||||||||||||||||||||||||
|
Subroutine
remove_string: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 116 | 4 | ▶ | croak "remove_string: wrong number of args" if (@_ != 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 4 | my ($self,$str) = @_; | |||||||||||||||||||||||||||
| 118 | 4 | $self->remove($self->_ip_bits($str)) | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 122 | 3 | eval { | |||||||||||||||||||||||||||
| 123 | 3 | my $class = 'Net::CIDR::Lite'; | |||||||||||||||||||||||||||
| 124 | 3 | eval "require $class"; | |||||||||||||||||||||||||||
| 125 | }; | ||||||||||||||||||||||||||||
| 126 | 3 | ▶ | last if (@_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 1 | ▶ | sub add_cidr { | ||||||||||||||||||||||||||
|
Subroutine
add_cidr: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 129 | 1 | ▶ | croak "add_cidr: wrong number of args" if (@_ != 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 1 | my ($self, $range, $data) = @_; | |||||||||||||||||||||||||||
| 131 | 1 | my $cidr = Net::CIDR::Lite->new(); | |||||||||||||||||||||||||||
| 132 | 1 | $cidr->add_range($range); | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 1 | my @list = (); | |||||||||||||||||||||||||||
| 135 | 1 | for ($cidr->list()) { | |||||||||||||||||||||||||||
| 136 | 2 | ▶ | push(@list, $_) if ($self->add_string($_, $data)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | 1 | @list; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | ▶ | sub remove_cidr { | ||||||||||||||||||||||||||
|
Subroutine
remove_cidr: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 142 | 1 | ▶ | croak "remove_cidr: wrong number of args" if (@_ != 2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 1 | my ($self, $range) = @_; | |||||||||||||||||||||||||||
| 144 | 1 | my $cidr = Net::CIDR::Lite->new(); | |||||||||||||||||||||||||||
| 145 | 1 | $cidr->add_range($range); | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 1 | my @list = (); | |||||||||||||||||||||||||||
| 148 | 1 | for ($cidr->list()) { | |||||||||||||||||||||||||||
| 149 | 2 | ▶ | push(@list, $_) if ($self->remove_string($_)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | 1 | @list; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | ## | ||||||||||||||||||||||||||||
| 156 | ## AF_INET | ||||||||||||||||||||||||||||
| 157 | ## | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | package JCM::Net::Patricia::AF_INET; | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 162 | 3 | ▶ | use Socket qw(AF_INET inet_aton inet_ntoa); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 163 | 3 | ▶ | use vars qw(@ISA @EXPORT); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 166 | 3 | require Exporter; | |||||||||||||||||||||||||||
| 167 | 3 | require DynaLoader; | |||||||||||||||||||||||||||
| 168 | 3 | @ISA = qw(Exporter DynaLoader JCM::Net::Patricia); | |||||||||||||||||||||||||||
| 169 | 3 | @EXPORT = qw(AF_INET); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 29 | ▶ | sub add { | ||||||||||||||||||||||||||
|
Subroutine
add: called CC=9 SCAR=24.8
| |||||||||||||||||||||||||||||
| 173 | 29 | ▶ | croak "add: wrong number of args" if (@_ < 2 || @_ > 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 4
MC/DC0%0/2
@_ < 2 or @_ > 4
@_ < 2
@_ > 4
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 4
| |||||||||||||||||||||||||||||
| 174 | 29 | my ($self, $ip, $bits, $data) = @_; | |||||||||||||||||||||||||||
| 175 | 29 | ▶ | croak("invalid key") if ( scalar(split( /[\/.]/, $ip )) != 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 28 | ▶ | croak("invalid key") if ( grep { /^0[0-9]/ } split( /[\/.]/, $ip ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 28 | ▶ | $data = (defined $bits ? "$ip/$bits" : $ip) if (@_ < 4); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 178 | 28 | my $packed = inet_aton($ip); | |||||||||||||||||||||||||||
| 179 | 28 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 28 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 28 | $self->SUPER::_add(AF_INET, $packed, $bits, $data); | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub add_integer { | ||||||||||||||||||||||||||
|
Subroutine
add_integer: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 185 | 0 | ▶ | croak "add_integer: wrong number of args" if (@_ < 2 || @_ > 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 4
MC/DC0%0/2
@_ < 2 or @_ > 4
@_ < 2
@_ > 4
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 4
| |||||||||||||||||||||||||||||
| 186 | 0 | my ($self, $num, $bits, $data) = @_; | |||||||||||||||||||||||||||
| 187 | 0 | my $packed = pack("N", $num); | |||||||||||||||||||||||||||
| 188 | 0 | my $ip = inet_ntoa($packed); | |||||||||||||||||||||||||||
| 189 | 0 | ▶ | croak("invalid address") unless (defined $ip); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $data = (defined $bits ? "$ip/$bits" : $ip) if (@_ < 4); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | $self->SUPER::_add(AF_INET, $packed, $bits, $data); | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 6 | ▶ | sub match_integer { | ||||||||||||||||||||||||||
|
Subroutine
match_integer: called CC=4 SCAR=15.6
| |||||||||||||||||||||||||||||
| 196 | 6 | ▶ | croak "match_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 197 | 6 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 198 | 6 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 6 | $self->SUPER::_match(AF_INET, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | ▶ | sub matching_prefix_integer { | ||||||||||||||||||||||||||
|
Subroutine
matching_prefix_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | croak "matching_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 204 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 205 | 0 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | $self->SUPER::_matching_prefix(AF_INET, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 6 | ▶ | sub exact_integer { | ||||||||||||||||||||||||||
|
Subroutine
exact_integer: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||
| 210 | 6 | ▶ | croak "exact_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 211 | 6 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 212 | 6 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 6 | $self->SUPER::_exact(AF_INET, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 15 | ▶ | sub match { | ||||||||||||||||||||||||||
|
Subroutine
match: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||
| 217 | 15 | ▶ | croak "match: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 218 | 15 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 219 | 15 | ▶ | croak("invalid key") if ( scalar(split( /[\/.]/, $ip )) != 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | 15 | ▶ | croak("invalid key") if ( grep { /^0[0-9]/ } split( /[\/.]/, $ip ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 15 | my $packed = inet_aton($ip); | |||||||||||||||||||||||||||
| 222 | 15 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 15 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | 15 | $self->SUPER::_match(AF_INET, $packed, $bits); | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 4 | ▶ | sub matching_prefix { | ||||||||||||||||||||||||||
|
Subroutine
matching_prefix: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||
| 228 | 4 | ▶ | croak "matching_prefix: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 229 | 4 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 230 | 4 | ▶ | croak("invalid key") if ( scalar(split( /[\/.]/, $ip )) != 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 4 | ▶ | croak("invalid key") if ( grep { /^0[0-9]/ } split( /[\/.]/, $ip ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 4 | my $packed = inet_aton($ip); | |||||||||||||||||||||||||||
| 233 | 4 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 4 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 4 | $self->SUPER::_matching_prefix(AF_INET, $packed, $bits); | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 2 | ▶ | sub exact { | ||||||||||||||||||||||||||
|
Subroutine
exact: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||
| 239 | 2 | ▶ | croak "exact: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 240 | 2 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 241 | 2 | ▶ | croak("invalid key") if ( scalar(split( /[\/.]/, $ip )) != 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 2 | ▶ | croak("invalid key") if ( grep { /^0[0-9]/ } split( /[\/.]/, $ip ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | 2 | my $packed = inet_aton($ip); | |||||||||||||||||||||||||||
| 244 | 2 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 2 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 2 | $self->SUPER::_exact(AF_INET, $packed, $bits); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 4 | ▶ | sub remove { | ||||||||||||||||||||||||||
|
Subroutine
remove: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||
| 250 | 4 | ▶ | croak "remove: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 251 | 4 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 252 | 4 | ▶ | croak("invalid key") if ( scalar(split( /[\/.]/, $ip )) != 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | 4 | ▶ | croak("invalid key") if ( grep { /^0[0-9]/ } split( /[\/.]/, $ip ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | 4 | my $packed = inet_aton($ip); | |||||||||||||||||||||||||||
| 255 | 4 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 4 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 4 | $self->SUPER::_remove(AF_INET, $packed, $bits); | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | ▶ | sub remove_integer { | ||||||||||||||||||||||||||
|
Subroutine
remove_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 261 | 0 | ▶ | croak "remote_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 262 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 263 | 0 | ▶ | $bits = 32 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 0 | $self->SUPER::_remove(AF_INET, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | ## | ||||||||||||||||||||||||||||
| 268 | ## AF_INET6 | ||||||||||||||||||||||||||||
| 269 | ## | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | package JCM::Net::Patricia::AF_INET6; | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 274 | 3 | ▶ | use Socket qw(AF_INET6); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 275 | 3 | ▶ | use Socket6 qw(inet_pton inet_ntop); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 276 | 3 | ▶ | use vars qw(@ISA @EXPORT); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 279 | 3 | require Exporter; | |||||||||||||||||||||||||||
| 280 | 3 | require DynaLoader; | |||||||||||||||||||||||||||
| 281 | 3 | @ISA = qw(Exporter DynaLoader JCM::Net::Patricia); | |||||||||||||||||||||||||||
| 282 | 3 | @EXPORT = qw(AF_INET6); | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 9 | ▶ | sub add { | ||||||||||||||||||||||||||
|
Subroutine
add: called CC=7 SCAR=23.2
| |||||||||||||||||||||||||||||
| 286 | 9 | ▶ | croak "add: wrong number of args" if (@_ < 2 || @_ > 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 4
MC/DC0%0/2
@_ < 2 or @_ > 4
@_ < 2
@_ > 4
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 4
| |||||||||||||||||||||||||||||
| 287 | 9 | my ($self, $ip, $bits, $data) = @_; | |||||||||||||||||||||||||||
| 288 | 9 | ▶ | $data = (defined $bits ? "$ip/$bits" : $ip) if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 289 | 9 | my $packed = inet_pton(AF_INET6, $ip); | |||||||||||||||||||||||||||
| 290 | 9 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | 9 | ▶ | $bits = 128 if (@_ < 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | 9 | $self->SUPER::_add(AF_INET6, $packed, $bits, $data); | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub add_integer { | ||||||||||||||||||||||||||
|
Subroutine
add_integer: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 296 | 0 | ▶ | croak "add_integer: wrong number of args" if (@_ < 2 || @_ > 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 4
MC/DC0%0/2
@_ < 2 or @_ > 4
@_ < 2
@_ > 4
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 4
| |||||||||||||||||||||||||||||
| 297 | 0 | my ($self, $num, $bits, $data) = @_; | |||||||||||||||||||||||||||
| 298 | 0 | my $packed = pack("N", $num); | |||||||||||||||||||||||||||
| 299 | 0 | my $ip = inet_ntop(AF_INET6, $packed); | |||||||||||||||||||||||||||
| 300 | 0 | ▶ | croak("invalid address") unless (defined $ip); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $data = (defined $bits ? "$ip/$bits" : $ip) if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | $bits = 128 if (@_ < 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | 0 | $self->SUPER::_add(AF_INET6, $packed, $bits, $data); | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub match_integer { | ||||||||||||||||||||||||||
|
Subroutine
match_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 307 | 0 | ▶ | croak "match_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 308 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 309 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | 0 | $self->SUPER::_match(AF_INET6, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub matching_prefix_integer { | ||||||||||||||||||||||||||
|
Subroutine
matching_prefix_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | croak "matching_prefix_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 315 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 316 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 0 | $self->SUPER::_matching_prefix(AF_INET6, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub exact_integer { | ||||||||||||||||||||||||||
|
Subroutine
exact_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 321 | 0 | ▶ | croak "exact_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 322 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 323 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 324 | 0 | $self->SUPER::_exact(AF_INET6, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 2 | ▶ | sub match { | ||||||||||||||||||||||||||
|
Subroutine
match: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||
| 328 | 2 | ▶ | croak "match: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 329 | 2 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 330 | 2 | my $packed = inet_pton(AF_INET6, $ip); | |||||||||||||||||||||||||||
| 331 | 2 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | 2 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 333 | 2 | $self->SUPER::_match(AF_INET6, $packed, $bits); | |||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 4 | ▶ | sub matching_prefix { | ||||||||||||||||||||||||||
|
Subroutine
matching_prefix: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||
| 337 | 4 | ▶ | croak "matching_prefix: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 338 | 4 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 339 | 4 | my $packed = inet_pton(AF_INET6, $ip); | |||||||||||||||||||||||||||
| 340 | 4 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | 4 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 4 | $self->SUPER::_matching_prefix(AF_INET6, $packed, $bits); | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 0 | ▶ | sub exact { | ||||||||||||||||||||||||||
|
Subroutine
exact: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 346 | 0 | ▶ | croak "exact: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 347 | 0 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 348 | 0 | my $packed = inet_pton(AF_INET6, $ip); | |||||||||||||||||||||||||||
| 349 | 0 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 351 | 0 | $self->SUPER::_exact(AF_INET6, $packed, $bits); | |||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub remove { | ||||||||||||||||||||||||||
|
Subroutine
remove: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 355 | 0 | ▶ | croak "remove: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 356 | 0 | my ($self, $ip, $bits) = @_; | |||||||||||||||||||||||||||
| 357 | 0 | my $packed = inet_pton(AF_INET6, $ip); | |||||||||||||||||||||||||||
| 358 | 0 | ▶ | croak("invalid key") unless (defined $packed); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 359 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 360 | 0 | $self->SUPER::_remove(AF_INET6, $packed, $bits); | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub remove_integer { | ||||||||||||||||||||||||||
|
Subroutine
remove_integer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 364 | 0 | ▶ | croak "remote_integer: wrong number of args" if (@_ < 2 || @_ > 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ < 2 or @_ > 3
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2
@_ > 3
Truth table0%0/3
A or B
A= @_ < 2B= @_ > 3
| |||||||||||||||||||||||||||||
| 365 | 0 | my ($self, $num, $bits) = @_; | |||||||||||||||||||||||||||
| 366 | 0 | ▶ | $bits = 128 if (@_ < 3); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | 0 | $self->SUPER::_remove(AF_INET6, pack("N",$num), $bits); | |||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 3 | 1; | |||||||||||||||||||||||||||
| 371 | __END__ | ||||||||||||||||||||||||||||