line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::SPDY::Frame::Control::SETTINGS; |
2
|
|
|
|
|
|
|
$Protocol::SPDY::Frame::Control::SETTINGS::VERSION = '1.001'; |
3
|
3
|
|
|
3
|
|
12
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
4
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
64
|
|
5
|
3
|
|
|
3
|
|
9
|
use parent qw(Protocol::SPDY::Frame::Control); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
19
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Protocol::SPDY::Frame::Control::SETTINGS - connection settings information |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
version 1.001 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
See L and L. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
3
|
|
143
|
use Protocol::SPDY::Constants ':all'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1524
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 type_name |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The string type for this frame ('SETTINGS'). |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
7
|
1
|
45
|
sub type_name { 'SETTINGS' } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 setting |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Look up the given setting and return the current value. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub setting { |
40
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
41
|
4
|
|
|
|
|
7
|
my $k = shift; |
42
|
4
|
|
|
|
|
10
|
$k =~ s/^SETTINGS_//; |
43
|
4
|
50
|
|
|
|
21
|
my $id = SETTINGS_BY_NAME->{$k} or die "unknown setting $k"; |
44
|
4
|
|
|
|
|
9
|
my ($v) = grep $_->[0] == $id, @{$self->{settings}}; |
|
4
|
|
|
|
|
26
|
|
45
|
4
|
|
|
|
|
20
|
$v->[2] |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 all_settings |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Returns a list of all settings: |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
[ id, flags, value ] |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
1
|
0
|
sub all_settings { @{shift->{settings}} } |
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 from_data |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Instantiate from data. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub from_data { |
65
|
2
|
|
|
2
|
1
|
5
|
my $class = shift; |
66
|
2
|
|
|
|
|
9
|
my %args = @_; |
67
|
2
|
|
|
|
|
12
|
my ($count) = unpack "N1", substr $args{data}, 0, 4, ''; |
68
|
2
|
|
|
|
|
4
|
my @settings; |
69
|
2
|
|
|
|
|
7
|
for (1..$count) { |
70
|
4
|
|
|
|
|
18
|
my ($flags, $id, $id2, $v) = unpack 'C1n1C1N1', substr $args{data}, 0, 8, ''; |
71
|
4
|
|
|
|
|
7
|
$id = ($id << 8) | $id2; |
72
|
4
|
|
|
|
|
16
|
push @settings, [ $id, $flags, $v ]; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
$class->new( |
75
|
2
|
|
|
|
|
27
|
%args, |
76
|
|
|
|
|
|
|
settings => \@settings, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 as_packet |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns the byte data corresponding to this frame. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub as_packet { |
87
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
3
|
my @settings = @{$self->{settings}}; |
|
1
|
|
|
|
|
5
|
|
90
|
1
|
|
|
|
|
7
|
my $payload = pack 'N1', scalar @settings; |
91
|
1
|
|
|
|
|
4
|
for (1..@settings) { |
92
|
2
|
|
|
|
|
4
|
my $item = shift @settings; |
93
|
2
|
|
|
|
|
6
|
my $v = $item->[0] & 0x00FFFFFF; |
94
|
2
|
|
33
|
|
|
5
|
$v ||= ($item->[1] & 0xFF) << 24; |
95
|
2
|
|
|
|
|
11
|
$payload .= pack 'N1N1', $v, $item->[2]; |
96
|
|
|
|
|
|
|
} |
97
|
1
|
|
|
|
|
14
|
return $self->SUPER::as_packet( |
98
|
|
|
|
|
|
|
payload => $payload, |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 to_string |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
String representation, for debugging. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub to_string { |
109
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
110
|
2
|
|
50
|
|
|
18
|
$self->SUPER::to_string . ', ' . join ',', map { (SETTINGS_BY_ID->{$_->[0]} or die "unknown setting $_->[0]") . '=' . $_->[2] } @{$self->{settings}}; |
|
4
|
|
|
|
|
38
|
|
|
2
|
|
|
|
|
7
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |