
Net::SPDY::Framer - SPDY protocol implementation

Please read carefully: This is an ALPHA stage software. In particular this means that even though it probably won't kill your cat, re-elect George W. Bush nor install Solaris 11 Express edition to your hard drive, it is in active development, functionality is missing and no APIs are stable.
See TODO file in the distribution to learn about missing and planned functionality. You are more than welcome to join the development and submit patches with fixes or enhancements. Bug reports are probably not very useful at this point.

use Net::SPDY::Framer;
my $framer = new Net::SPDY::Framer ({
compressor => new Net::SPDY::Compressor,
socket => $socket,
});
$framer->write_frame(
type => Net::SPDY::Framer::PING,
data => 'chuj',
);
while (my %frame = $framer->read_frame) {
last if $frame{control} and $frame{type} eq Net::SPDY::Framer::PING;
}

Net::SPDY::Framer provides SPDY protocol access on top of a network socket. It serializes and deserializes packets as they are, without implementing any other logic. For session management, see Net::SPDY::Session.

For the actual values refer to the protocol specification.
SYN_STREAM, SYN_REPLY, RST_STREAM, SETTINGS, PING, GOAWAY, HEADERS, WINDOW_UPDATE, CREDENTIAL.
FLAG_FIN, FLAG_UNIDIRECTIONAL.

Net::SPDY::Compressor object representing the Zlib streams (one in each direction) used by the framer.
IO::Handle instance that is used for actual network communication.

These are the data structures that are consumed by write_frame() and produced by read_frame() methods. Their purpose is to coveniently represent the fields of serialized SPDY frames. Please refer to the protocol specification ("SEE ALSO" section) for descriptions of the actual fields.
Not all fields are mandatory at all occassions. Serializer may assume sane values for certain fields, that are marked as Input only below, or provided with defaults.
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::SYN_STREAM,
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for SYN_STREAM
stream_id => <stream_id>,
associated_stream_id => <associated_stream_id>,
priority => <priority>,
slot => <slot>,
headers => {
':version' => <version>, # E.g. 'HTTP/1.1'
':scheme' => <scheme>, # E.g. 'https'
':host' => <host>, # E.g. 'example.net:443',
':method' => <method>, # E.g. 'GET', 'HEAD',...
':path' => <path>, # E.g. '/something',
... # HTTP headers, e.g. Accept => 'text/plain'
},
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::SYN_REPLY,
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for SYN_REPLY
stream_id => <stream_id>,
headers => {
':version' => <version>, # E.g. 'HTTP/1.1'
':status' => <status>, # E.g. '500 Front Fell Off',
... # HTTP headers, e.g. 'Content-Type' => 'text/plain'
},
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::RST_STREAM
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for RST_STREAM
stream_id => <stream_id>,
status => <status>,
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::SYN_SETTINGS
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for SETTINGS
entries => <entries>, # Input only
id_values => [
{
flags => <flags>,
id => <id>,
value => <value>,
},
...
],
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::PING
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for PING
data => data, # E.g. 'abcd'
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::GOAWAY
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for GOAWAY
last_good_stream_id => <last_good_stream_id>,
status => <status>,
)
(
# Common to control frames
control => 1, # Input only
version => 3, # Input only
type => Net::SPDY::Framer::HEADERS,
flags => <flags>, # Defaults to 0
length => <length>, # Input only
# Specific for HEADERS
stream_id => <stream_id>,
headers => {
... # HTTP headers, e.g. Accept => 'text/plain'
},
)

Creates a new framer instance. You need to create and pass both the socket for the network communication and the compressor instance.
Serializes frame and writes it to the network socket.
Reads frame from the network socket and returns it deserialized.


Source code for Net::SPDY is kept in a public GIT repository. Visit https://github.com/lkundrak/net-spdy.
Bugs reports and feature enhancement requests are tracked at https://rt.cpan.org/Public/Dist/Display.html?Name=Net::SPDY.

Copyright 2012, Lubomir Rintel
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Lubomir Rintel lkundrak@v3.sk