| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Protocol::HTTP2::Frame::Ping; | 
| 2 | 10 |  |  | 10 |  | 43 | use strict; | 
|  | 10 |  |  |  |  | 15 |  | 
|  | 10 |  |  |  |  | 313 |  | 
| 3 | 10 |  |  | 10 |  | 41 | use warnings; | 
|  | 10 |  |  |  |  | 13 |  | 
|  | 10 |  |  |  |  | 250 |  | 
| 4 | 10 |  |  | 10 |  | 43 | use Protocol::HTTP2::Constants qw(:flags :errors); | 
|  | 10 |  |  |  |  | 14 |  | 
|  | 10 |  |  |  |  | 1748 |  | 
| 5 | 10 |  |  | 10 |  | 53 | use Protocol::HTTP2::Trace qw(tracer); | 
|  | 10 |  |  |  |  | 13 |  | 
|  | 10 |  |  |  |  | 1857 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | sub decode { | 
| 8 | 2 |  |  | 2 | 0 | 3 | my ( $con, $buf_ref, $buf_offset, $length ) = @_; | 
| 9 | 2 |  |  |  |  | 4 | my $frame_ref = $con->decode_context->{frame}; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # PING associated with connection | 
| 12 | 2 | 50 | 33 |  |  | 12 | if ( | 
| 13 |  |  |  |  |  |  | $frame_ref->{stream} != 0 | 
| 14 |  |  |  |  |  |  | || | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | # payload is 8 octets | 
| 17 |  |  |  |  |  |  | $length != 8 | 
| 18 |  |  |  |  |  |  | ) | 
| 19 |  |  |  |  |  |  | { | 
| 20 | 0 |  |  |  |  | 0 | $con->error(PROTOCOL_ERROR); | 
| 21 | 0 |  |  |  |  | 0 | return undef; | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 2 | 100 |  |  |  | 10 | $con->ack_ping( \substr $$buf_ref, $buf_offset, $length ) | 
| 25 |  |  |  |  |  |  | unless $frame_ref->{flags} & ACK; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 2 |  |  |  |  | 6 | return $length; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub encode { | 
| 31 | 4 |  |  | 4 | 0 | 6 | my ( $con, $flags_ref, $stream, $data_ref ) = @_; | 
| 32 | 4 | 50 |  |  |  | 10 | if ( length($$data_ref) != 8 ) { | 
| 33 | 0 |  |  |  |  | 0 | $con->error(INTERNAL_ERROR); | 
| 34 | 0 |  |  |  |  | 0 | return undef; | 
| 35 |  |  |  |  |  |  | } | 
| 36 | 4 |  |  |  |  | 14 | return $$data_ref; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | 1; |