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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 }; | 345 }; |
346 | 346 |
347 // Constant for invalid (or unknown) stream IDs. | 347 // Constant for invalid (or unknown) stream IDs. |
348 static const SpdyStreamId kInvalidStream; | 348 static const SpdyStreamId kInvalidStream; |
349 | 349 |
350 // The maximum size of header data chunks delivered to the framer visitor | 350 // The maximum size of header data chunks delivered to the framer visitor |
351 // through OnControlFrameHeaderData. (It is exposed here for unit test | 351 // through OnControlFrameHeaderData. (It is exposed here for unit test |
352 // purposes.) | 352 // purposes.) |
353 static const size_t kHeaderDataChunkMaxSize; | 353 static const size_t kHeaderDataChunkMaxSize; |
354 | 354 |
355 // Serializes a SpdyHeaderBlock. | 355 void SerializeHeaderBlockWithoutCompression( |
356 static void WriteHeaderBlock(SpdyFrameBuilder* frame, | 356 SpdyFrameBuilder* builder, |
357 const SpdyMajorVersion spdy_version, | 357 const SpdyHeaderBlock& header_block) const; |
358 const SpdyHeaderBlock* headers); | |
359 | 358 |
360 // Retrieve serialized length of SpdyHeaderBlock. | 359 // Retrieve serialized length of SpdyHeaderBlock. |
361 // TODO(hkhalil): Remove, or move to quic code. | 360 // TODO(hkhalil): Remove, or move to quic code. |
362 static size_t GetSerializedLength( | 361 static size_t GetSerializedLength( |
363 const SpdyMajorVersion spdy_version, | 362 const SpdyMajorVersion spdy_version, |
364 const SpdyHeaderBlock* headers); | 363 const SpdyHeaderBlock* headers); |
365 | 364 |
366 // Create a new Framer, provided a SPDY version. | 365 // Create a new Framer, provided a SPDY version. |
367 explicit SpdyFramer(SpdyMajorVersion version); | 366 explicit SpdyFramer(SpdyMajorVersion version); |
368 virtual ~SpdyFramer(); | 367 virtual ~SpdyFramer(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 // data (pointer and length). Returns the number of bytes | 683 // data (pointer and length). Returns the number of bytes |
685 // read, and: | 684 // read, and: |
686 // *data is advanced the number of bytes read. | 685 // *data is advanced the number of bytes read. |
687 // *len is reduced by the number of bytes read. | 686 // *len is reduced by the number of bytes read. |
688 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, | 687 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, |
689 size_t max_bytes); | 688 size_t max_bytes); |
690 | 689 |
691 void WriteHeaderBlockToZ(const SpdyHeaderBlock* headers, | 690 void WriteHeaderBlockToZ(const SpdyHeaderBlock* headers, |
692 z_stream* out) const; | 691 z_stream* out) const; |
693 | 692 |
694 void SerializeHeaderBlockWithoutCompression( | |
695 SpdyFrameBuilder* builder, | |
696 const SpdyHeaderBlock& header_block) const; | |
697 | |
698 // Compresses automatically according to enable_compression_. | 693 // Compresses automatically according to enable_compression_. |
699 void SerializeHeaderBlock(SpdyFrameBuilder* builder, | 694 void SerializeHeaderBlock(SpdyFrameBuilder* builder, |
700 const SpdyFrameWithHeaderBlockIR& frame); | 695 const SpdyFrameWithHeaderBlockIR& frame); |
701 | 696 |
702 // Set the error code and moves the framer into the error state. | 697 // Set the error code and moves the framer into the error state. |
703 void set_error(SpdyError error); | 698 void set_error(SpdyError error); |
704 | 699 |
705 // The size of the control frame buffer. | 700 // The size of the control frame buffer. |
706 // Since this is only used for control frame headers, the maximum control | 701 // Since this is only used for control frame headers, the maximum control |
707 // frame header size (SYN_STREAM) is sufficient; all remaining control | 702 // frame header size (SYN_STREAM) is sufficient; all remaining control |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 bool end_stream_when_done_; | 793 bool end_stream_when_done_; |
799 | 794 |
800 // If true, then ProcessInput returns after processing a full frame, | 795 // If true, then ProcessInput returns after processing a full frame, |
801 // rather than reading all available input. | 796 // rather than reading all available input. |
802 bool process_single_input_frame_ = false; | 797 bool process_single_input_frame_ = false; |
803 }; | 798 }; |
804 | 799 |
805 } // namespace net | 800 } // namespace net |
806 | 801 |
807 #endif // NET_SPDY_SPDY_FRAMER_H_ | 802 #endif // NET_SPDY_SPDY_FRAMER_H_ |
OLD | NEW |