| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class SpdySessionTest; | 31 class SpdySessionTest; |
| 32 class SpdyStreamTest; | 32 class SpdyStreamTest; |
| 33 class SpdyWebSocketStreamTest; | 33 class SpdyWebSocketStreamTest; |
| 34 class WebSocketJobTest; | 34 class WebSocketJobTest; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace spdy { | 37 namespace spdy { |
| 38 | 38 |
| 39 class SpdyFramer; | 39 class SpdyFramer; |
| 40 class SpdyFrameBuilder; | 40 class SpdyFrameBuilder; |
| 41 class SpdyFramerSpdy2Test; | 41 class SpdyFramerTest; |
| 42 class SpdyFramerSpdy3Test; | |
| 43 | 42 |
| 44 namespace test_spdy2 { | 43 namespace test { |
| 45 | 44 |
| 46 class TestSpdyVisitor; | 45 class TestSpdyVisitor; |
| 47 | 46 |
| 48 } // namespace test_spdy2 | 47 } // namespace test |
| 49 | |
| 50 namespace test_spdy3 { | |
| 51 | |
| 52 class TestSpdyVisitor; | |
| 53 | |
| 54 } // namespace test_spdy3 | |
| 55 | 48 |
| 56 // A datastructure for holding a set of headers from either a | 49 // A datastructure for holding a set of headers from either a |
| 57 // SYN_STREAM or SYN_REPLY frame. | 50 // SYN_STREAM or SYN_REPLY frame. |
| 58 typedef std::map<std::string, std::string> SpdyHeaderBlock; | 51 typedef std::map<std::string, std::string> SpdyHeaderBlock; |
| 59 | 52 |
| 60 // A datastructure for holding the ID and flag fields for SETTINGS. | 53 // A datastructure for holding the ID and flag fields for SETTINGS. |
| 61 // Conveniently handles converstion to/from wire format. | 54 // Conveniently handles converstion to/from wire format. |
| 62 class NET_EXPORT_PRIVATE SettingsFlagsAndId { | 55 class NET_EXPORT_PRIVATE SettingsFlagsAndId { |
| 63 public: | 56 public: |
| 64 static SettingsFlagsAndId FromWireFormat(int version, uint32 wire); | 57 static SettingsFlagsAndId FromWireFormat(int version, uint32 wire); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // TODO(hkhalil): Remove SpdyFramer::set_protocol_version() | 412 // TODO(hkhalil): Remove SpdyFramer::set_protocol_version() |
| 420 void set_protocol_version(int version) { spdy_version_= version; } | 413 void set_protocol_version(int version) { spdy_version_= version; } |
| 421 int protocol_version() const { return spdy_version_; } | 414 int protocol_version() const { return spdy_version_; } |
| 422 | 415 |
| 423 bool probable_http_response() { return probable_http_response_; } | 416 bool probable_http_response() { return probable_http_response_; } |
| 424 | 417 |
| 425 SpdyPriority GetLowestPriority() const { return spdy_version_ < 3 ? 3 : 7; } | 418 SpdyPriority GetLowestPriority() const { return spdy_version_ < 3 ? 3 : 7; } |
| 426 SpdyPriority GetHighestPriority() const { return 0; } | 419 SpdyPriority GetHighestPriority() const { return 0; } |
| 427 | 420 |
| 428 protected: | 421 protected: |
| 429 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, BasicCompression); | 422 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, BasicCompression); |
| 430 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, ControlFrameSizesAreValidated); | 423 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ControlFrameSizesAreValidated); |
| 431 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, HeaderCompression); | 424 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, HeaderCompression); |
| 432 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, DecompressUncompressedFrame); | 425 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, DecompressUncompressedFrame); |
| 433 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, ExpandBuffer_HeapSmash); | 426 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ExpandBuffer_HeapSmash); |
| 434 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, HugeHeaderBlock); | 427 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, HugeHeaderBlock); |
| 435 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, UnclosedStreamDataCompressors); | 428 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, UnclosedStreamDataCompressors); |
| 436 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, | 429 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 437 UnclosedStreamDataCompressorsOneByteAtATime); | 430 UnclosedStreamDataCompressorsOneByteAtATime); |
| 438 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, | 431 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 439 UncompressLargerThanFrameBufferInitialSize); | 432 UncompressLargerThanFrameBufferInitialSize); |
| 440 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, ReadLargeSettingsFrame); | 433 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ReadLargeSettingsFrame); |
| 441 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy2Test, | 434 FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, |
| 442 ReadLargeSettingsFrameInSmallChunks); | |
| 443 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, BasicCompression); | |
| 444 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, ControlFrameSizesAreValidated); | |
| 445 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, HeaderCompression); | |
| 446 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, DecompressUncompressedFrame); | |
| 447 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, ExpandBuffer_HeapSmash); | |
| 448 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, HugeHeaderBlock); | |
| 449 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, UnclosedStreamDataCompressors); | |
| 450 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, | |
| 451 UnclosedStreamDataCompressorsOneByteAtATime); | |
| 452 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, | |
| 453 UncompressLargerThanFrameBufferInitialSize); | |
| 454 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, ReadLargeSettingsFrame); | |
| 455 FRIEND_TEST_ALL_PREFIXES(SpdyFramerSpdy3Test, | |
| 456 ReadLargeSettingsFrameInSmallChunks); | 435 ReadLargeSettingsFrameInSmallChunks); |
| 457 friend class net::HttpNetworkLayer; // This is temporary for the server. | 436 friend class net::HttpNetworkLayer; // This is temporary for the server. |
| 458 friend class net::HttpNetworkTransactionTest; | 437 friend class net::HttpNetworkTransactionTest; |
| 459 friend class net::HttpProxyClientSocketPoolTest; | 438 friend class net::HttpProxyClientSocketPoolTest; |
| 460 friend class net::SpdyHttpStreamTest; | 439 friend class net::SpdyHttpStreamTest; |
| 461 friend class net::SpdyNetworkTransactionTest; | 440 friend class net::SpdyNetworkTransactionTest; |
| 462 friend class net::SpdyProxyClientSocketTest; | 441 friend class net::SpdyProxyClientSocketTest; |
| 463 friend class net::SpdySessionTest; | 442 friend class net::SpdySessionTest; |
| 464 friend class net::SpdyStreamTest; | 443 friend class net::SpdyStreamTest; |
| 465 friend class net::SpdyWebSocketStreamTest; | 444 friend class net::SpdyWebSocketStreamTest; |
| 466 friend class net::WebSocketJobTest; | 445 friend class net::WebSocketJobTest; |
| 467 friend class test_spdy2::TestSpdyVisitor; | 446 friend class test::TestSpdyVisitor; |
| 468 friend class test_spdy3::TestSpdyVisitor; | |
| 469 | 447 |
| 470 private: | 448 private: |
| 471 typedef std::map<SpdyStreamId, z_stream*> CompressorMap; | 449 typedef std::map<SpdyStreamId, z_stream*> CompressorMap; |
| 472 | 450 |
| 473 // Internal breakouts from ProcessInput. Each returns the number of bytes | 451 // Internal breakouts from ProcessInput. Each returns the number of bytes |
| 474 // consumed from the data. | 452 // consumed from the data. |
| 475 size_t ProcessCommonHeader(const char* data, size_t len); | 453 size_t ProcessCommonHeader(const char* data, size_t len); |
| 476 size_t ProcessControlFramePayload(const char* data, size_t len); | 454 size_t ProcessControlFramePayload(const char* data, size_t len); |
| 477 size_t ProcessCredentialFramePayload(const char* data, size_t len); | 455 size_t ProcessCredentialFramePayload(const char* data, size_t len); |
| 478 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); | 456 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 // corrupt data that just looks like HTTP, but deterministic checking requires | 592 // corrupt data that just looks like HTTP, but deterministic checking requires |
| 615 // a lot more state. | 593 // a lot more state. |
| 616 bool probable_http_response_; | 594 bool probable_http_response_; |
| 617 | 595 |
| 618 static bool compression_default_; | 596 static bool compression_default_; |
| 619 }; | 597 }; |
| 620 | 598 |
| 621 } // namespace spdy | 599 } // namespace spdy |
| 622 | 600 |
| 623 #endif // NET_SPDY_SPDY_FRAMER_H_ | 601 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |