Chromium Code Reviews| Index: net/spdy/spdy_framer.h |
| =================================================================== |
| --- net/spdy/spdy_framer.h (revision 80449) |
| +++ net/spdy/spdy_framer.h (working copy) |
| @@ -74,6 +74,16 @@ |
| virtual void OnStreamFrameData(SpdyStreamId stream_id, |
| const char* data, |
| size_t len) = 0; |
| + |
| + // Returns true if the underlying socket's transport protocol is SCTP. |
| + virtual bool using_sctp() { return false; } |
|
Mike Belshe
2011/04/06 18:32:53
const functions
|
| + |
| + // Returns true if the underlying socker transport protocol if SCTP and SPDY |
| + // control frames are send on SCTP stream 0. |
| + virtual bool using_sctp_control_stream() { return false; } |
|
Mike Belshe
2011/04/06 18:32:53
const
|
| + |
| + // Maps a SPDY stream number to an SCTP stream ID. |
| + virtual uint16 MapSpdyToSctp(uint32 stream_id) { return 0; } |
|
Mike Belshe
2011/04/06 18:32:53
const
|
| }; |
| class SpdyFramer { |
| @@ -246,6 +256,30 @@ |
| // Returns true if a frame could be compressed. |
| bool IsCompressible(const SpdyFrame& frame) const; |
| + // Returns true if underlying socket transport protocol is SCTP. |
| + bool using_sctp() { |
| + if (visitor_) |
| + return visitor_->using_sctp(); |
| + else |
| + // TODO(jtl): return sctp_enabled() here? |
| + return false; |
| + } |
| + |
| + // Returns true if the underlying socker transport protocol if SCTP and SPDY |
| + // control frames are send on SCTP stream 0. |
| + bool using_sctp_control_stream() { |
| + if (visitor_) |
| + return visitor_->using_sctp_control_stream(); |
| + else |
| + // TODO(jtl): return sctp_enabled() here? |
| + return false; |
| + } |
| + |
| + // Maps a SPDY stream number of an SCTP stream ID. |
| + uint16 MapSpdyToSctp(uint32 stream_id) { |
| + return visitor_->MapSpdyToSctp(stream_id); |
| + } |
| + |
| // For debugging. |
| static const char* StateToString(int state); |
| static const char* ErrorCodeToString(int error_code); |
| @@ -300,11 +334,13 @@ |
| size_t ProcessDataFramePayload(const char* data, size_t len); |
| // Get (and lazily initialize) the ZLib state. |
| - z_stream* GetHeaderCompressor(); |
| - z_stream* GetHeaderDecompressor(); |
| + z_stream* GetHeaderCompressor(int index); |
| + z_stream* GetHeaderDecompressor(int index); |
| z_stream* GetStreamCompressor(SpdyStreamId id); |
| z_stream* GetStreamDecompressor(SpdyStreamId id); |
| + uint16 GetDictionaryIndex(const SpdyControlFrame& control_frame); |
| + |
| // Compression helpers |
| SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame); |
| SpdyDataFrame* CompressDataFrame(const SpdyDataFrame& frame); |
| @@ -317,6 +353,7 @@ |
| void CleanupCompressorForStream(SpdyStreamId id); |
| void CleanupDecompressorForStream(SpdyStreamId id); |
| void CleanupStreamCompressorsAndDecompressors(); |
| + void CleanupHeaderCompressorsAndDecompressors(); |
| // Not used (yet) |
| size_t BytesSafeToRead() const; |
| @@ -345,10 +382,11 @@ |
| size_t current_frame_capacity_; |
| bool enable_compression_; // Controls all compression |
| - // SPDY header compressors. |
| - scoped_ptr<z_stream> header_compressor_; |
| - scoped_ptr<z_stream> header_decompressor_; |
| + // SPDY header compressors (possbily per-stream when using SCTP). |
| + CompressorMap header_compressors_; |
| + CompressorMap header_decompressors_; |
| + |
| // Per-stream data compressors. |
| CompressorMap stream_compressors_; |
| CompressorMap stream_decompressors_; |