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