| Index: net/spdy/spdy_framer.h
|
| diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
|
| index f8073dcd7394c7252aedda9f9bc3a319e5e20a35..a75fa921fd6a355b97e004899ac4f1a960430255 100644
|
| --- a/net/spdy/spdy_framer.h
|
| +++ b/net/spdy/spdy_framer.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <list>
|
| #include <map>
|
| +#include <memory>
|
| #include <string>
|
| #include <utility>
|
| #include <vector>
|
| @@ -14,6 +15,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/strings/string_piece.h"
|
| #include "base/sys_byteorder.h"
|
| #include "net/base/net_export.h"
|
| #include "net/spdy/hpack_decoder.h"
|
| @@ -101,6 +103,38 @@ struct NET_EXPORT_PRIVATE SpdySettingsScratch {
|
| int last_setting_id;
|
| };
|
|
|
| +// Scratch space necessary for processing ALTSVC frames.
|
| +struct NET_EXPORT_PRIVATE SpdyAltSvcScratch {
|
| + SpdyAltSvcScratch();
|
| + ~SpdyAltSvcScratch();
|
| +
|
| + void Reset() {
|
| + max_age = 0;
|
| + port = 0;
|
| + pid_len = 0;
|
| + host_len = 0;
|
| + origin_len = 0;
|
| + pid_buf_len = 0;
|
| + host_buf_len = 0;
|
| + origin_buf_len = 0;
|
| + protocol_id.reset();
|
| + host.reset();
|
| + origin.reset();
|
| + }
|
| +
|
| + uint32 max_age;
|
| + uint16 port;
|
| + uint8 pid_len;
|
| + uint8 host_len;
|
| + size_t origin_len;
|
| + size_t pid_buf_len;
|
| + size_t host_buf_len;
|
| + size_t origin_buf_len;
|
| + scoped_ptr<char[]> protocol_id;
|
| + scoped_ptr<char[]> host;
|
| + scoped_ptr<char[]> origin;
|
| +};
|
| +
|
| // SpdyFramerVisitorInterface is a set of callbacks for the SpdyFramer.
|
| // Implement this interface to receive event callbacks as frames are
|
| // decoded from the framer.
|
| @@ -242,6 +276,14 @@ class NET_EXPORT_PRIVATE SpdyFramerVisitorInterface {
|
| // Note that header block data is not included. See
|
| // OnControlFrameHeaderData().
|
| virtual void OnContinuation(SpdyStreamId stream_id, bool end) = 0;
|
| +
|
| + // Called when an ALTSVC frame has been parsed.
|
| + virtual void OnAltSvc(SpdyStreamId stream_id,
|
| + uint32 max_age,
|
| + uint16 port,
|
| + base::StringPiece protocol_id,
|
| + base::StringPiece host,
|
| + base::StringPiece origin) {}
|
| };
|
|
|
| // Optionally, and in addition to SpdyFramerVisitorInterface, a class supporting
|
| @@ -291,6 +333,7 @@ class NET_EXPORT_PRIVATE SpdyFramer {
|
| SPDY_GOAWAY_FRAME_PAYLOAD,
|
| SPDY_RST_STREAM_FRAME_PAYLOAD,
|
| SPDY_SETTINGS_FRAME_PAYLOAD,
|
| + SPDY_ALTSVC_FRAME_PAYLOAD,
|
| };
|
|
|
| // SPDY error codes.
|
| @@ -431,6 +474,10 @@ class NET_EXPORT_PRIVATE SpdyFramer {
|
| SpdySerializedFrame* SerializeContinuation(
|
| const SpdyContinuationIR& continuation);
|
|
|
| + // Serializes an ALTSVC frame. The ALTSVC frame advertises the
|
| + // availability of an alternative service to the client.
|
| + SpdySerializedFrame* SerializeAltSvc(const SpdyAltSvcIR& altsvc);
|
| +
|
| // Serialize a frame of unknown type.
|
| SpdySerializedFrame* SerializeFrame(const SpdyFrameIR& frame);
|
|
|
| @@ -476,6 +523,7 @@ class NET_EXPORT_PRIVATE SpdyFramer {
|
| size_t GetBlockedSize() const;
|
| size_t GetPushPromiseMinimumSize() const;
|
| size_t GetContinuationMinimumSize() const;
|
| + size_t GetAltSvcMinimumSize() const;
|
|
|
| // Returns the minimum size a frame can be (data or control).
|
| size_t GetFrameMinimumSize() const;
|
| @@ -570,6 +618,7 @@ class NET_EXPORT_PRIVATE SpdyFramer {
|
| size_t ProcessGoAwayFramePayload(const char* data, size_t len);
|
| size_t ProcessRstStreamFramePayload(const char* data, size_t len);
|
| size_t ProcessSettingsFramePayload(const char* data, size_t len);
|
| + size_t ProcessAltSvcFramePayload(const char* data, size_t len);
|
| size_t ProcessIgnoredControlFramePayload(/*const char* data,*/ size_t len);
|
|
|
| // TODO(jgraettinger): To be removed with migration to
|
| @@ -700,6 +749,8 @@ class NET_EXPORT_PRIVATE SpdyFramer {
|
| // current_frame_buffer_.
|
| SpdySettingsScratch settings_scratch_;
|
|
|
| + SpdyAltSvcScratch altsvc_scratch_;
|
| +
|
| bool enable_compression_; // Controls all compression
|
| // SPDY header compressors.
|
| scoped_ptr<z_stream> header_compressor_;
|
|
|