| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ |
| 6 #define NET_SPDY_SPDY_FRAMER_H_ | 6 #define NET_SPDY_SPDY_FRAMER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace net { | 30 namespace net { |
| 31 | 31 |
| 32 class HttpProxyClientSocketPoolTest; | 32 class HttpProxyClientSocketPoolTest; |
| 33 class HttpNetworkLayer; | 33 class HttpNetworkLayer; |
| 34 class HttpNetworkTransactionTest; | 34 class HttpNetworkTransactionTest; |
| 35 class SpdyHttpStreamTest; | 35 class SpdyHttpStreamTest; |
| 36 class SpdyNetworkTransactionTest; | 36 class SpdyNetworkTransactionTest; |
| 37 class SpdyProxyClientSocketTest; | 37 class SpdyProxyClientSocketTest; |
| 38 class SpdySessionTest; | 38 class SpdySessionTest; |
| 39 class SpdyStreamTest; | 39 class SpdyStreamTest; |
| 40 class SpdyWebSocketStreamTest; | |
| 41 class WebSocketJobTest; | |
| 42 | 40 |
| 43 class SpdyFramer; | 41 class SpdyFramer; |
| 44 class SpdyFrameBuilder; | 42 class SpdyFrameBuilder; |
| 45 class SpdyFramerTest; | 43 class SpdyFramerTest; |
| 46 | 44 |
| 47 namespace test { | 45 namespace test { |
| 48 | 46 |
| 49 class TestSpdyVisitor; | 47 class TestSpdyVisitor; |
| 50 | 48 |
| 51 } // namespace test | 49 } // namespace test |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Called when a PING frame has been parsed. | 228 // Called when a PING frame has been parsed. |
| 231 virtual void OnPing(SpdyPingId unique_id, bool is_ack) = 0; | 229 virtual void OnPing(SpdyPingId unique_id, bool is_ack) = 0; |
| 232 | 230 |
| 233 // Called when a GOAWAY frame has been parsed. | 231 // Called when a GOAWAY frame has been parsed. |
| 234 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, | 232 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, |
| 235 SpdyGoAwayStatus status) = 0; | 233 SpdyGoAwayStatus status) = 0; |
| 236 | 234 |
| 237 // Called when a HEADERS frame is received. | 235 // Called when a HEADERS frame is received. |
| 238 // Note that header block data is not included. See | 236 // Note that header block data is not included. See |
| 239 // OnControlFrameHeaderData(). | 237 // OnControlFrameHeaderData(). |
| 240 virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) = 0; | 238 virtual void OnHeaders(SpdyStreamId stream_id, |
| 239 bool has_priority, |
| 240 SpdyPriority priority, |
| 241 bool fin, |
| 242 bool end) = 0; |
| 241 | 243 |
| 242 // Called when a WINDOW_UPDATE frame has been parsed. | 244 // Called when a WINDOW_UPDATE frame has been parsed. |
| 243 virtual void OnWindowUpdate(SpdyStreamId stream_id, | 245 virtual void OnWindowUpdate(SpdyStreamId stream_id, |
| 244 uint32 delta_window_size) = 0; | 246 uint32 delta_window_size) = 0; |
| 245 | 247 |
| 246 // Called when a goaway frame opaque data is available. | 248 // Called when a goaway frame opaque data is available. |
| 247 // |goaway_data| A buffer containing the opaque GOAWAY data chunk received. | 249 // |goaway_data| A buffer containing the opaque GOAWAY data chunk received. |
| 248 // |len| The length of the header data buffer. A length of zero indicates | 250 // |len| The length of the header data buffer. A length of zero indicates |
| 249 // that the header data block has been completely sent. | 251 // that the header data block has been completely sent. |
| 250 // When this function returns true the visitor indicates that it accepted | 252 // When this function returns true the visitor indicates that it accepted |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 CreatePushPromiseThenContinuationUncompressed); | 607 CreatePushPromiseThenContinuationUncompressed); |
| 606 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ReadLargeSettingsFrame); | 608 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ReadLargeSettingsFrame); |
| 607 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, | 609 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 608 ReadLargeSettingsFrameInSmallChunks); | 610 ReadLargeSettingsFrameInSmallChunks); |
| 609 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ControlFrameAtMaxSizeLimit); | 611 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ControlFrameAtMaxSizeLimit); |
| 610 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ControlFrameTooLarge); | 612 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ControlFrameTooLarge); |
| 611 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, | 613 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 612 TooLargeHeadersFrameUsesContinuation); | 614 TooLargeHeadersFrameUsesContinuation); |
| 613 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, | 615 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 614 TooLargePushPromiseFrameUsesContinuation); | 616 TooLargePushPromiseFrameUsesContinuation); |
| 615 friend class net::HttpNetworkLayer; // This is temporary for the server. | 617 friend class HttpNetworkLayer; // This is temporary for the server. |
| 616 friend class net::HttpNetworkTransactionTest; | 618 friend class HttpNetworkTransactionTest; |
| 617 friend class net::HttpProxyClientSocketPoolTest; | 619 friend class HttpProxyClientSocketPoolTest; |
| 618 friend class net::SpdyHttpStreamTest; | 620 friend class SpdyHttpStreamTest; |
| 619 friend class net::SpdyNetworkTransactionTest; | 621 friend class SpdyNetworkTransactionTest; |
| 620 friend class net::SpdyProxyClientSocketTest; | 622 friend class SpdyProxyClientSocketTest; |
| 621 friend class net::SpdySessionTest; | 623 friend class SpdySessionTest; |
| 622 friend class net::SpdyStreamTest; | 624 friend class SpdyStreamTest; |
| 623 friend class net::SpdyWebSocketStreamTest; | |
| 624 friend class net::WebSocketJobTest; | |
| 625 friend class test::TestSpdyVisitor; | 625 friend class test::TestSpdyVisitor; |
| 626 | 626 |
| 627 private: | 627 private: |
| 628 // Internal breakouts from ProcessInput. Each returns the number of bytes | 628 // Internal breakouts from ProcessInput. Each returns the number of bytes |
| 629 // consumed from the data. | 629 // consumed from the data. |
| 630 size_t ProcessCommonHeader(const char* data, size_t len); | 630 size_t ProcessCommonHeader(const char* data, size_t len); |
| 631 size_t ProcessControlFramePayload(const char* data, size_t len); | 631 size_t ProcessControlFramePayload(const char* data, size_t len); |
| 632 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); | 632 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); |
| 633 // HPACK data is re-encoded as SPDY3 and re-entrantly delivered through | 633 // HPACK data is re-encoded as SPDY3 and re-entrantly delivered through |
| 634 // |ProcessControlFrameHeaderBlock()|. |is_hpack_header_block| controls | 634 // |ProcessControlFrameHeaderBlock()|. |is_hpack_header_block| controls |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM | 801 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM |
| 802 // flag is still carried in the HEADERS frame. If it's set, flip this so that | 802 // flag is still carried in the HEADERS frame. If it's set, flip this so that |
| 803 // we know to terminate the stream when the entire header block has been | 803 // we know to terminate the stream when the entire header block has been |
| 804 // processed. | 804 // processed. |
| 805 bool end_stream_when_done_; | 805 bool end_stream_when_done_; |
| 806 }; | 806 }; |
| 807 | 807 |
| 808 } // namespace net | 808 } // namespace net |
| 809 | 809 |
| 810 #endif // NET_SPDY_SPDY_FRAMER_H_ | 810 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |