File Coverage

blib/lib/Protocol/TLS/ChangeCipherSpec.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 4 50.0
condition 1 3 33.3
subroutine 6 6 100.0
pod 0 2 0.0
total 28 34 82.3


line stmt bran cond sub pod time code
1             package Protocol::TLS::ChangeCipherSpec;
2 2     2   11 use strict;
  2         4  
  2         57  
3 2     2   11 use warnings;
  2         4  
  2         63  
4 2     2   11 use Protocol::TLS::Trace qw(tracer);
  2         3  
  2         100  
5 2     2   12 use Protocol::TLS::Constants qw(:c_types);
  2         3  
  2         510  
6              
7             sub decode {
8 3     3 0 9 my ( $ctx, $buf_ref, $buf_offset, $length ) = @_;
9 3 50       19 return 0 if length($$buf_ref) - $buf_offset < 1;
10 3         13 my ($type) = unpack "x${buf_offset}C", $$buf_ref;
11 3 50 33     33 return undef unless $type == 1 && $length == 1;
12              
13 3         18 $ctx->state_machine( 'recv', CTYPE_CHANGE_CIPHER_SPEC, 1 );
14 3         12 1;
15             }
16              
17             sub encode {
18 3     3 0 15 chr 1;
19             }
20              
21             1