| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class SpdyFramer; | 42 class SpdyFramer; |
| 43 class SpdyFrameBuilder; | 43 class SpdyFrameBuilder; |
| 44 | 44 |
| 45 namespace test { | 45 namespace test { |
| 46 | 46 |
| 47 class TestSpdyVisitor; | 47 class TestSpdyVisitor; |
| 48 class SpdyFramerPeer; | 48 class SpdyFramerPeer; |
| 49 | 49 |
| 50 } // namespace test | 50 } // namespace test |
| 51 | 51 |
| 52 // A datastructure for holding a set of headers from a HEADERS, PUSH_PROMISE, | |
| 53 // SYN_STREAM, or SYN_REPLY frame. | |
| 54 typedef std::map<std::string, std::string> SpdyHeaderBlock; | |
| 55 | |
| 56 // A datastructure for holding the ID and flag fields for SETTINGS. | 52 // A datastructure for holding the ID and flag fields for SETTINGS. |
| 57 // Conveniently handles converstion to/from wire format. | 53 // Conveniently handles converstion to/from wire format. |
| 58 class NET_EXPORT_PRIVATE SettingsFlagsAndId { | 54 class NET_EXPORT_PRIVATE SettingsFlagsAndId { |
| 59 public: | 55 public: |
| 60 static SettingsFlagsAndId FromWireFormat(SpdyMajorVersion version, | 56 static SettingsFlagsAndId FromWireFormat(SpdyMajorVersion version, |
| 61 uint32 wire); | 57 uint32 wire); |
| 62 | 58 |
| 63 SettingsFlagsAndId() : flags_(0), id_(0) {} | 59 SettingsFlagsAndId() : flags_(0), id_(0) {} |
| 64 | 60 |
| 65 // TODO(hkhalil): restrict to enums instead of free-form ints. | 61 // TODO(hkhalil): restrict to enums instead of free-form ints. |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 // data (pointer and length). Returns the number of bytes | 665 // data (pointer and length). Returns the number of bytes |
| 670 // read, and: | 666 // read, and: |
| 671 // *data is advanced the number of bytes read. | 667 // *data is advanced the number of bytes read. |
| 672 // *len is reduced by the number of bytes read. | 668 // *len is reduced by the number of bytes read. |
| 673 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, | 669 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, |
| 674 size_t max_bytes); | 670 size_t max_bytes); |
| 675 | 671 |
| 676 void WriteHeaderBlockToZ(const SpdyHeaderBlock* headers, | 672 void WriteHeaderBlockToZ(const SpdyHeaderBlock* headers, |
| 677 z_stream* out) const; | 673 z_stream* out) const; |
| 678 | 674 |
| 679 void SerializeNameValueBlockWithoutCompression( | 675 void SerializeHeaderBlockWithoutCompression( |
| 680 SpdyFrameBuilder* builder, | 676 SpdyFrameBuilder* builder, |
| 681 const SpdyNameValueBlock& name_value_block) const; | 677 const SpdyHeaderBlock& header_block) const; |
| 682 | 678 |
| 683 // Compresses automatically according to enable_compression_. | 679 // Compresses automatically according to enable_compression_. |
| 684 void SerializeNameValueBlock( | 680 void SerializeHeaderBlock(SpdyFrameBuilder* builder, |
| 685 SpdyFrameBuilder* builder, | 681 const SpdyFrameWithHeaderBlockIR& frame); |
| 686 const SpdyFrameWithNameValueBlockIR& frame); | |
| 687 | 682 |
| 688 // Set the error code and moves the framer into the error state. | 683 // Set the error code and moves the framer into the error state. |
| 689 void set_error(SpdyError error); | 684 void set_error(SpdyError error); |
| 690 | 685 |
| 691 // The size of the control frame buffer. | 686 // The size of the control frame buffer. |
| 692 // Since this is only used for control frame headers, the maximum control | 687 // Since this is only used for control frame headers, the maximum control |
| 693 // frame header size (SYN_STREAM) is sufficient; all remaining control | 688 // frame header size (SYN_STREAM) is sufficient; all remaining control |
| 694 // frame data is streamed to the visitor. | 689 // frame data is streamed to the visitor. |
| 695 static const size_t kControlFrameBufferSize; | 690 static const size_t kControlFrameBufferSize; |
| 696 | 691 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // processed. | 780 // processed. |
| 786 bool end_stream_when_done_; | 781 bool end_stream_when_done_; |
| 787 | 782 |
| 788 // Last acknowledged value for SETTINGS_HEADER_TABLE_SIZE. | 783 // Last acknowledged value for SETTINGS_HEADER_TABLE_SIZE. |
| 789 size_t header_table_size_bound_; | 784 size_t header_table_size_bound_; |
| 790 }; | 785 }; |
| 791 | 786 |
| 792 } // namespace net | 787 } // namespace net |
| 793 | 788 |
| 794 #endif // NET_SPDY_SPDY_FRAMER_H_ | 789 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |