line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::SPDY::Frame::Data; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Protocol::SPDY::Frame::Data::VERSION = '1.000'; |
4
|
|
|
|
|
|
|
} |
5
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
96
|
|
6
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
78
|
|
7
|
3
|
|
|
3
|
|
13
|
use parent qw(Protocol::SPDY::Frame); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
14
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Protocol::SPDY::Frame::Data - data frame support |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
version 1.000 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
See L and L. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
3
|
|
162
|
use Protocol::SPDY::Constants ':all'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1626
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 stream_id |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The stream ID for this data packet. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
1
|
11
|
sub stream_id { shift->{stream_id} } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 payload |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The bytes comprising this data packet. Note that there are no guarantees |
40
|
|
|
|
|
|
|
on boundaries: UTF-8 decoding for example could fail if this packet is |
41
|
|
|
|
|
|
|
processed in isolation. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
4
|
1
|
14
|
sub payload { shift->{payload} } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 from_data |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Generates an instance from the given data. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub from_data { |
54
|
2
|
|
|
2
|
1
|
6
|
my $class = shift; |
55
|
2
|
|
|
|
|
6
|
my %args = @_; |
56
|
2
|
|
|
|
|
14
|
my ($stream_id, $flags, $len, $len2) = unpack "N1C1n1c1", substr $args{data}, 0, 8, ''; |
57
|
2
|
|
|
|
|
5
|
$len = ($len << 8) | $len2; |
58
|
2
|
|
|
|
|
12
|
return $class->new( |
59
|
|
|
|
|
|
|
fin => $flags & FLAG_FIN, |
60
|
|
|
|
|
|
|
stream_id => $stream_id, |
61
|
|
|
|
|
|
|
payload => $args{data}, |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 as_packet |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns the scalar bytes representing this frame. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub as_packet { |
72
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
73
|
2
|
|
|
|
|
11
|
my $len = length(my $payload = $self->payload); |
74
|
2
|
50
|
|
|
|
21
|
my $pkt = pack 'N1C1n1C1', |
|
|
50
|
|
|
|
|
|
75
|
|
|
|
|
|
|
($self->is_control ? 0x80000000 : 0x00000000) | ($self->stream_id & 0x7FFFFFFF), |
76
|
|
|
|
|
|
|
($self->fin ? FLAG_FIN : 0), |
77
|
|
|
|
|
|
|
$len >> 8, |
78
|
|
|
|
|
|
|
$len & 0xFF; |
79
|
2
|
|
|
|
|
6
|
$pkt .= $payload; |
80
|
2
|
|
|
|
|
10
|
return $pkt; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 type_string |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns 'data' - data frames don't have a type field, so we pick a value |
86
|
|
|
|
|
|
|
that isn't going to conflict with any control frame types. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
1
|
|
sub type_string { 'data' } |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 type_name |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns 'data' - data frames don't have a type field, so we pick a value |
95
|
|
|
|
|
|
|
that isn't going to conflict with any control frame types. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
|
sub type_name { 'data' } |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 to_string |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
String representation, for debugging. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub to_string { |
108
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
$self->SUPER::to_string . ', stream=' . $self->stream_id . ', payload ' . length($self->payload) . " bytes"; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |