diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 23:02:18 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 23:02:18 +0000 |
commit | b9c4b6e28a0e311342387903b82a2f43f02810d5 (patch) | |
tree | aa467acc2c443ea731ad79b04e1b39693c0906ee /net/spdy/spdy_protocol.h | |
parent | 456e9b09d076bc129e4360ef75b547de383e62bf (diff) | |
download | chromium_src-b9c4b6e28a0e311342387903b82a2f43f02810d5.zip chromium_src-b9c4b6e28a0e311342387903b82a2f43f02810d5.tar.gz chromium_src-b9c4b6e28a0e311342387903b82a2f43f02810d5.tar.bz2 |
SPDY: Add support for WINDOW_UPDATE frame.
This provides the really basic serialization/deserialization of the frame, and does introduce a behavior change.
BUG=48100
TEST=net_unittests --gtest_filter="SpdyProtocolTest.ControlFrameStructs"
Review URL: http://codereview.chromium.org/2886009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_protocol.h')
-rw-r--r-- | net/spdy/spdy_protocol.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h index a7a5ab7..5bdc2b3 100644 --- a/net/spdy/spdy_protocol.h +++ b/net/spdy/spdy_protocol.h @@ -103,6 +103,18 @@ // +----------------------------------+ // |X| Last-accepted-stream-id | // +----------------------------------+ +// +// Control Frame: WINDOW_UPDATE +// +----------------------------------+ +// |1|000000000000001|0000000000001001| +// +----------------------------------+ +// | flags (8) | Length (24 bits) | = 8 +// +----------------------------------+ +// |X| Stream-ID (31 bits) | +// +----------------------------------+ +// | Delta-Window-Size (32 bits) | +// +----------------------------------+ + namespace spdy { @@ -123,6 +135,7 @@ enum SpdyControlType { PING, GOAWAY, HEADERS, + WINDOW_UPDATE, NUM_CONTROL_FRAME_TYPES }; @@ -258,6 +271,12 @@ struct SpdySettingsControlFrameBlock : SpdyFrameBlock { // Variable data here. }; +// A WINDOW_UPDATE Control Frame structure +struct SpdyWindowUpdateControlFrameBlock : SpdyFrameBlock { + SpdyStreamId stream_id_; + uint32 delta_window_size_; +}; + #pragma pack(pop) // ------------------------------------------------------------------------- @@ -594,6 +613,44 @@ class SpdySettingsControlFrame : public SpdyControlFrame { DISALLOW_COPY_AND_ASSIGN(SpdySettingsControlFrame); }; +// A WINDOW_UPDATE frame. +class SpdyWindowUpdateControlFrame : public SpdyControlFrame { + public: + SpdyWindowUpdateControlFrame() : SpdyControlFrame(size()) {} + SpdyWindowUpdateControlFrame(char* data, bool owns_buffer) + : SpdyControlFrame(data, owns_buffer) {} + + SpdyStreamId stream_id() const { + return ntohl(block()->stream_id_) & kStreamIdMask; + } + + void set_stream_id(SpdyStreamId id) { + mutable_block()->stream_id_ = htonl(id & kStreamIdMask); + } + + uint32 delta_window_size() const { + return ntohl(block()->delta_window_size_); + } + + void set_delta_window_size(uint32 delta_window_size) { + mutable_block()->delta_window_size_ = htonl(delta_window_size); + } + + // Returns the size of the SpdyWindowUpdateControlFrameBlock structure. + // Note: this is not the size of the SpdyWindowUpdateControlFrame class. + static size_t size() { return sizeof(SpdyWindowUpdateControlFrameBlock); } + + private: + const struct SpdyWindowUpdateControlFrameBlock* block() const { + return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); + } + struct SpdyWindowUpdateControlFrameBlock* mutable_block() { + return static_cast<SpdyWindowUpdateControlFrameBlock*>(frame_); + } + + DISALLOW_COPY_AND_ASSIGN(SpdyWindowUpdateControlFrame); +}; + } // namespace spdy #endif // NET_SPDY_SPDY_PROTOCOL_H_ |