| 1 | 9 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package Net::EGTS::Packet; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use List::MoreUtils qw(natatime any); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use Module::Load qw(load); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use Net::EGTS::Util qw(crc8 crc16 usize dumper_bitstring); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use Net::EGTS::Types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use Net::EGTS::Codes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 9 | require Net::EGTS::Record; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # Global packet identifier | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | our $PID = 0; | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # Packet types and classes | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 9 | our %TYPES = ( | |||||||||||||||||||||||||||||||||||||||||
| 22 | EGTS_PT_RESPONSE, 'Net::EGTS::Packet::Response', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | EGTS_PT_APPDATA, 'Net::EGTS::Packet::Appdata', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | EGTS_PT_SIGNED_APPDATA, 'Net::EGTS::Packet::SignedAppdata', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Protocol Version | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | has PRV => is => 'rw', isa => 'BYTE', default => 0x01; | |||||||||||||||||||||||||||||||||||||||||
| 29 | # Security Key ID | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | has SKID => is => 'rw', isa => 'BYTE', default => 0; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # Flags: | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # Prefix | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | has PRF => is => 'rw', isa => 'BIT2', default => 0b00; | |||||||||||||||||||||||||||||||||||||||||
| 35 | # Route | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 9 | has RTE => is => 'rw', isa => 'BIT1', default => 0b0; | |||||||||||||||||||||||||||||||||||||||||
| 37 | # Encryption Algorithm | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 9 | has ENA => is => 'rw', isa => 'BIT2', default => 0b00; | |||||||||||||||||||||||||||||||||||||||||
| 39 | # Compressed | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 9 | has CMP => is => 'rw', isa => 'BIT1', default => 0b0; | |||||||||||||||||||||||||||||||||||||||||
| 41 | # Priority | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | has PRIORITY => is => 'rw', isa => 'BIT2', default => 0b00; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # Header Length | ||||||||||||||||||||||||||||||||||||||||||
| 45 | has HL => | ||||||||||||||||||||||||||||||||||||||||||
| 46 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | isa => 'BYTE', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $length = 11; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $length += 2 if defined $self->PRA; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $length += 2 if defined $self->RCA; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $length += 1 if defined $self->TTL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return $length; | |||||||||||||||||||||||||||||||||||||||||
| 56 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 58 | # Header Encoding | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | has HE => is => 'rw', isa => 'BYTE', default => 0x0; | |||||||||||||||||||||||||||||||||||||||||
| 60 | # Frame Data Length | ||||||||||||||||||||||||||||||||||||||||||
| 61 | has FDL => | ||||||||||||||||||||||||||||||||||||||||||
| 62 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 63 | isa => 'USHORT', | ||||||||||||||||||||||||||||||||||||||||||
| 64 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 8 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 8 | ▶ | return 0 unless defined $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | ▶ | return 0 unless length $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 6 | return length $self->SFRD; | |||||||||||||||||||||||||||||||||||||||||
| 71 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 73 | # Packet Identifier | ||||||||||||||||||||||||||||||||||||||||||
| 74 | has PID => | ||||||||||||||||||||||||||||||||||||||||||
| 75 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 76 | isa => 'USHORT', | ||||||||||||||||||||||||||||||||||||||||||
| 77 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 8 | ▶ | my $pid = $PID; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 8 | ▶ | $PID = 0 unless ++$PID >= 0 && $PID <= 65535; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
++$Net::EGTS::Packet::PID >= 0 and $Net::EGTS::Packet::PID <= 65535
MC/DC0%0/2
++$Net::EGTS::Packet::PID >= 0 and $Net::EGTS::Packet::PID <= 65535
++$Net::EGTS::Packet::PID >= 0
$Net::EGTS::Packet::PID <= 65535
Truth table33%1/3
A and B
A= ++$Net::EGTS::Packet::PID >= 0B= $Net::EGTS::Packet::PID <= 65535
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 8 | return $pid; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 84 | # Packet Type | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | has PT => is => 'rw', isa => 'BYTE'; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | # Optional (set if RTE enabled): | ||||||||||||||||||||||||||||||||||||||||||
| 88 | # Peer Address | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 9 | has PRA => is => 'rw', isa => 'Maybe[USHORT]'; | |||||||||||||||||||||||||||||||||||||||||
| 90 | # Recipient Address | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 9 | has RCA => is => 'rw', isa => 'Maybe[USHORT]'; | |||||||||||||||||||||||||||||||||||||||||
| 92 | # Time To Live | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 9 | has TTL => is => 'rw', isa => 'Maybe[BYTE]'; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | # Header Check Sum | ||||||||||||||||||||||||||||||||||||||||||
| 96 | has HCS => | ||||||||||||||||||||||||||||||||||||||||||
| 97 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | isa => 'BYTE', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 12 | my $length = $self->HL - 1; # HL - HCS | |||||||||||||||||||||||||||||||||||||||||
| 104 | 12 | ▶ | die 'Binary too short to get CRC8' if $length > length $self->bin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 12 | return crc8( substr( $self->bin, 0 => $length ) ); | |||||||||||||||||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | # Service Frame Data | ||||||||||||||||||||||||||||||||||||||||||
| 110 | has SFRD => | ||||||||||||||||||||||||||||||||||||||||||
| 111 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 112 | isa => 'Maybe[BINARY]', | ||||||||||||||||||||||||||||||||||||||||||
| 113 | default => '', | ||||||||||||||||||||||||||||||||||||||||||
| 114 | trigger => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 20 | ▶ | my ($self, $value, $old) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 20 | ▶ | die 'Service Frame Data too long' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and length $value > 65517
MC/DC0%0/2
defined $value and length $value > 65517
defined $value
length $value > 65517
Truth table66%2/3
A and B
A= defined $valueB= length $value > 65517
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | if defined($value) && length($value) > 65517; | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 120 | # Service Frame Data Check Sum | ||||||||||||||||||||||||||||||||||||||||||
| 121 | has SFRCS => | ||||||||||||||||||||||||||||||||||||||||||
| 122 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 123 | isa => 'Maybe[USHORT]', | ||||||||||||||||||||||||||||||||||||||||||
| 124 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 16 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 16 | ▶ | die 'Binary too short to get CRC16' if $self->FDL > length $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 16 | ▶ | return undef unless defined $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 16 | ▶ | return undef unless length $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 16 | return crc16( $self->SFRD ); | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | # Private: | ||||||||||||||||||||||||||||||||||||||||||
| 136 | # Packet binary | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 9 | has bin => is => 'rw', isa => 'Str', default => ''; | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # Array of decoded records | ||||||||||||||||||||||||||||||||||||||||||
| 140 | has records => | ||||||||||||||||||||||||||||||||||||||||||
| 141 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 142 | isa => 'ArrayRef[Net::EGTS::Record]', | ||||||||||||||||||||||||||||||||||||||||||
| 143 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 144 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | ▶ | return [] unless defined $self->SDR; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | ▶ | return [] unless length $self->SDR; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 6 | return Net::EGTS::Record->decode_all( $self->SDR ); | |||||||||||||||||||||||||||||||||||||||||
| 149 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 9 | ; | |||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | #around BUILDARGS => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # my $orig = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 155 | # | ||||||||||||||||||||||||||||||||||||||||||
| 156 | # # simple scalar decoding support | ||||||||||||||||||||||||||||||||||||||||||
| 157 | # my $bin = @_ % 2 ? shift : undef; | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # my %opts = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # | ||||||||||||||||||||||||||||||||||||||||||
| 160 | # return $class->$orig( | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # bin => $bin, | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # %opts | ||||||||||||||||||||||||||||||||||||||||||
| 163 | # ) if $bin; | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # return $class->$orig( %opts ); | ||||||||||||||||||||||||||||||||||||||||||
| 165 | #}; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | #sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # my $args = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # $self->decode( \$self->bin ) if length $self->bin; | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # warn Dumper($self); | ||||||||||||||||||||||||||||||||||||||||||
| 173 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | # Store binary and count how mutch more bytes need | ||||||||||||||||||||||||||||||||||||||||||
| 176 | sub take { | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 128 | ▶ | my ($self, $bin, $mask, $length) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
take: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 128 | ▶ | $length //= usize($mask); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$length //= &usize($mask)
MC/DC0%0/2
$length //= &usize($mask)
$length
&usize($mask)
Truth table66%2/3
A //= B
A= $lengthB= &usize($mask)
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 128 | ▶ | confess "Can`t get chunk of length $length" if $length > length $$bin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 128 | my $chunk = substr $$bin, 0 => $length, ''; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 128 | $self->bin( $self->bin . $chunk ); | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 128 | return unpack $mask => $chunk; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | # Helper to get portion of data | ||||||||||||||||||||||||||||||||||||||||||
| 190 | sub nip { | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 21 | ▶ | my ($self, $bin, $mask, $length) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nip: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 21 | ▶ | $length //= usize($mask); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$length //= &usize($mask)
MC/DC0%0/2
$length //= &usize($mask)
$length
&usize($mask)
Truth table66%2/3
A //= B
A= $lengthB= &usize($mask)
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 21 | ▶ | confess "Can`t get chunk of length $length" if $length > length $$bin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 21 | my $chunk = substr $$bin, 0 => $length, ''; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 21 | return unpack $mask => $chunk; | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | =head2 stream \$bin | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | Parse incoming stream and creates packages from it. | ||||||||||||||||||||||||||||||||||||||||||
| 204 | If the data is not sufficient to create the package: returns the number | ||||||||||||||||||||||||||||||||||||||||||
| 205 | of data as many more as required. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | The buffer is trimmed by the size of the created package. | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | Return: | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | =item undef, $need | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | if decode in process and need more data | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | =item object | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | if the packet is fully decoded | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | =item error code | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | if there are any problems | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | sub stream { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 9 | ▶ | my ($class, $bin) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stream: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | # Need first 10 bytes | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 9 | my $need = 10; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 9 | ▶ | return (undef, $need) if $need > length $$bin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | # Packet size | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 8 | my $HL = unpack 'C' => substr $$bin, 3, usize('C'); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 8 | my $FDL = unpack 'S' => substr $$bin, 5, usize('S'); | |||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | # Need full package size | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 8 | ▶ | $need = $HL + $FDL + ($FDL ? 2 : 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 8 | ▶ | return (undef, $need) if $need > length $$bin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 7 | my $packet = substr $$bin, 0, $need, ''; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | # Packet type | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 7 | my $PT = unpack 'C' => substr $packet, 9, usize('C'); | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | # Create packet | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 7 | my $subclass = $TYPES{ $PT }; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 7 | load $subclass; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 7 | return $subclass->new->decode( \$packet ); | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | =head2 decode $bin | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | Decode binary stream I<$bin> into packet object. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | Return: | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | =item undef, $need | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | if decode in process and need more data | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | =item object | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | if the packet is fully decoded | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | =item error code | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | if there are any problems | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | sub decode { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 12 | ▶ | my ($self, $bin) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode: called CC=11 SCAR=26.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 12 | $self->PRV( $self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 281 | 12 | $self->SKID($self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | 12 | my $flags = $self->take($bin => 'C'); | |||||||||||||||||||||||||||||||||||||||||
| 284 | 12 | $self->PRF( ($flags & 0b11000000) >> 6 ); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | $self->RTE( ($flags & 0b00100000) >> 5 ); | |||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | $self->ENA( ($flags & 0b00011000) >> 3 ); | |||||||||||||||||||||||||||||||||||||||||
| 287 | 12 | $self->CMP( ($flags & 0b00000100) >> 2 ); | |||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | $self->PRIORITY( ($flags & 0b00000011) ); | |||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 12 | $self->HL( $self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | $self->HE( $self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | $self->FDL( $self->take($bin => 'S') ); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 12 | $self->PID( $self->take($bin => 'S') ); | |||||||||||||||||||||||||||||||||||||||||
| 294 | 12 | $self->PT( $self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 12 | ▶ | return EGTS_PC_UNS_PROTOCOL unless $self->PRV == 0x01; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 12 | ▶ | return EGTS_PC_INC_HEADERFORM unless $self->HL == 11 || $self->HL == 16; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->HL == 11 or $self->HL == 16
MC/DC0%0/2
$self->HL == 11 or $self->HL == 16
$self->HL == 11
$self->HL == 16
Truth table33%1/3
A or B
A= $self->HL == 11B= $self->HL == 16
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 12 | ▶ | return EGTS_PC_UNS_PROTOCOL unless $self->PRF == 0x00; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 12 | ▶ | if( $self->RTE ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $self->PRA( $self->take($bin => 'S') ); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->RCA( $self->take($bin => 'S') ); | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $self->TTL( $self->take($bin => 'C') ); | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | die 'RTE not supported'; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | # Header CRC8 | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 12 | my $hsc = $self->take($bin => 'C'); | |||||||||||||||||||||||||||||||||||||||||
| 310 | 12 | ▶ | return EGTS_PC_HEADERCRC_ERROR unless $self->HCS == $hsc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | # Complete package. No data. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 12 | ▶ | return $self unless $self->FDL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 10 | $self->SFRD( $self->take($bin => 'a*' => $self->FDL) ); | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 10 | my $sfrcs = $self->take($bin => 'S'); | |||||||||||||||||||||||||||||||||||||||||
| 318 | 10 | ▶ | return EGTS_PC_DATACRC_ERROR unless $self->SFRCS == $sfrcs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 10 | ▶ | unless( $self->ENA == 0x00 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | warn 'Encryption not supported yet'; | |||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return EGTS_PC_DECRYPT_ERROR; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 10 | ▶ | unless( $self->CMP == 0x00 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | warn 'Compression not supported yet'; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return EGTS_PC_INC_DATAFORM; | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | =head2 encode | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | Build packet as binary | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | sub encode { | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 11 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode: called CC=11 SCAR=27.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 11 | ▶ | croak 'Encryption not supported yet' if $self->ENA; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 11 | ▶ | croak 'Compression not supported yet' if $self->CMP; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 11 | ▶ | croak 'Packet Type required' unless defined $self->PT; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 11 | my $mask = 'C C B8 C C S S C'; | |||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | # Optional fields | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 11 | my @optional; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 11 | ▶ | if( $self->PRA || $self->RCA || $self->TTL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->PRA or $self->RCA or $self->TTL
$self->PRA or $self->RCA
MC/DC0%0/3
$self->PRA or $self->RCA or $self->TTL
$self->PRA
$self->RCA
$self->TTL
Truth table25%1/4
A or B or C
A= $self->PRAB= $self->RCAC= $self->TTL
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $mask .= ' S S C '; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | push @optional, $self->PRA; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | push @optional, $self->RCA; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | push @optional, $self->TTL; | |||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $self->RTE( 0x1 ); | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | # Header Length | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 11 | ▶ | $self->HL( 10 + ($self->RTE ? 5 : 0) + 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | # Build base header | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 11 | my $bin = pack $mask => | |||||||||||||||||||||||||||||||||||||||||
| 365 | $self->PRV, $self->SKID, | ||||||||||||||||||||||||||||||||||||||||||
| 366 | sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 367 | '%02b%b%02b%b%02b', | ||||||||||||||||||||||||||||||||||||||||||
| 368 | $self->PRF, $self->RTE, $self->ENA, $self->CMP, $self->PRIORITY, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 370 | $self->HL, $self->HE, $self->FDL, $self->PID, $self->PT, | ||||||||||||||||||||||||||||||||||||||||||
| 371 | @optional, | ||||||||||||||||||||||||||||||||||||||||||
| 372 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | # Header Check Sum | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 11 | $self->HCS( crc8 $bin ); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 11 | $bin .= pack 'C' => $self->HCS; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | # Service Frame Data | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 11 | ▶ | $bin .= $self->SFRD if defined $self->SFRD; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | # Service Frame Data Check Sum | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 11 | ▶ | if( $self->SFRD && $self->FDL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->SFRD and $self->FDL
MC/DC50%1/2
$self->SFRD and $self->FDL
$self->SFRD
$self->FDL
Truth table66%2/3
A and B
A= $self->SFRDB= $self->FDL
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 9 | $bin .= pack 'S' => $self->SFRCS; | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 11 | $self->bin( $bin ); | |||||||||||||||||||||||||||||||||||||||||
| 387 | 11 | return $bin; | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | =head2 as_debug | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | Return human readable string | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | sub as_debug { | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 9 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_debug: called CC=7 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 9 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 9 | my @bytes = ((unpack('B*', $self->bin)) =~ m{.{8}}g); | |||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 9 | my @str; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 9 | push @str => sprintf('PRV: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 404 | 9 | push @str => sprintf('SKID: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 405 | 9 | push @str => sprintf('FLAGS: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 9 | push @str => sprintf('HL: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 407 | 9 | push @str => sprintf('HE: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 408 | 9 | push @str => sprintf('FDL: %s %s', splice @bytes, 0 => usize('S')); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 9 | push @str => sprintf('PID: %s %s', splice @bytes, 0 => usize('S')); | |||||||||||||||||||||||||||||||||||||||||
| 410 | 9 | push @str => sprintf('PT: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 9 | ▶ | push @str => sprintf('PRA: %s %s', splice @bytes, 0 => usize('S')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | if defined $self->PRA; | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 9 | ▶ | push @str => sprintf('RCA: %s %s', splice @bytes, 0 => usize('S')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | if defined $self->RCA; | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 9 | ▶ | push @str => sprintf('TTL: %s', splice @bytes, 0 => usize('C')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | if defined $self->TTL; | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 9 | push @str => sprintf('HCS: %s', splice @bytes, 0 => usize('C')); | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 9 | ▶ | if( @bytes ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 6 | ▶ | if( my @qualify = inner() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 6 | splice @bytes, 0 => -2; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 6 | push @str => sprintf('SFRD =>'); | |||||||||||||||||||||||||||||||||||||||||
| 426 | 6 | push @str, @qualify; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 6 | push @str => sprintf('<======'); | |||||||||||||||||||||||||||||||||||||||||
| 428 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $it = natatime 4, splice @bytes, 0 => -2; | |||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my @chunks; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | while (my @vals = $it->()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | push @chunks, join(' ', @vals); | |||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | push @str => sprintf('SFRD: %s', join("\n ", @chunks)); | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | push @str => sprintf('SFRCS: %s %s', splice @bytes, 0 => 2); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 9 | push @str, sprintf '(Data %d bytes. Total %d bytes.)', | |||||||||||||||||||||||||||||||||||||||||
| 441 | $self->FDL, | ||||||||||||||||||||||||||||||||||||||||||
| 442 | length $self->bin | ||||||||||||||||||||||||||||||||||||||||||
| 443 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 9 | return join "\n", @str; | |||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | 9 | __PACKAGE__->meta->make_immutable(); | |||||||||||||||||||||||||||||||||||||||||