| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // Used only in log messages. | 512 // Used only in log messages. |
| 513 void set_display_protocol(const std::string& protocol) { | 513 void set_display_protocol(const std::string& protocol) { |
| 514 display_protocol_ = protocol; | 514 display_protocol_ = protocol; |
| 515 } | 515 } |
| 516 | 516 |
| 517 void set_max_decode_buffer_size_bytes(size_t max_decode_buffer_size_bytes) { | 517 void set_max_decode_buffer_size_bytes(size_t max_decode_buffer_size_bytes) { |
| 518 GetHpackDecoder()->set_max_decode_buffer_size_bytes( | 518 GetHpackDecoder()->set_max_decode_buffer_size_bytes( |
| 519 max_decode_buffer_size_bytes); | 519 max_decode_buffer_size_bytes); |
| 520 } | 520 } |
| 521 | 521 |
| 522 size_t send_frame_size_limit() const { return send_frame_size_limit_; } |
| 523 |
| 524 void set_send_frame_size_limit(size_t send_frame_size_limit) { |
| 525 send_frame_size_limit_ = send_frame_size_limit; |
| 526 } |
| 527 |
| 522 void set_recv_frame_size_limit(size_t recv_frame_size_limit) { | 528 void set_recv_frame_size_limit(size_t recv_frame_size_limit) { |
| 523 recv_frame_size_limit_ = recv_frame_size_limit; | 529 recv_frame_size_limit_ = recv_frame_size_limit; |
| 524 } | 530 } |
| 525 | 531 |
| 526 void SetDecoderHeaderTableDebugVisitor( | 532 void SetDecoderHeaderTableDebugVisitor( |
| 527 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); | 533 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); |
| 528 | 534 |
| 529 void SetEncoderHeaderTableDebugVisitor( | 535 void SetEncoderHeaderTableDebugVisitor( |
| 530 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); | 536 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); |
| 531 | 537 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 // frame header size (SYN_STREAM) is sufficient; all remaining control | 738 // frame header size (SYN_STREAM) is sufficient; all remaining control |
| 733 // frame data is streamed to the visitor. | 739 // frame data is streamed to the visitor. |
| 734 static const size_t kControlFrameBufferSize; | 740 static const size_t kControlFrameBufferSize; |
| 735 | 741 |
| 736 // The maximum size of the control frames that we send, including the size of | 742 // The maximum size of the control frames that we send, including the size of |
| 737 // the header. This limit is arbitrary. We can enforce it here or at the | 743 // the header. This limit is arbitrary. We can enforce it here or at the |
| 738 // application layer. We chose the framing layer, but this can be changed (or | 744 // application layer. We chose the framing layer, but this can be changed (or |
| 739 // removed) if necessary later down the line. | 745 // removed) if necessary later down the line. |
| 740 // TODO(diannahu): Rename to make it clear that this limit is for sending. | 746 // TODO(diannahu): Rename to make it clear that this limit is for sending. |
| 741 static const size_t kMaxControlFrameSize; | 747 static const size_t kMaxControlFrameSize; |
| 748 // The maximum size for the payload of DATA frames to send. |
| 749 static const size_t kMaxDataPayloadSendSize; |
| 742 | 750 |
| 743 SpdyState state_; | 751 SpdyState state_; |
| 744 SpdyState previous_state_; | 752 SpdyState previous_state_; |
| 745 SpdyError error_code_; | 753 SpdyError error_code_; |
| 746 | 754 |
| 747 // Note that for DATA frame, remaining_data_length_ is sum of lengths of | 755 // Note that for DATA frame, remaining_data_length_ is sum of lengths of |
| 748 // frame header, padding length field (optional), data payload (optional) and | 756 // frame header, padding length field (optional), data payload (optional) and |
| 749 // padding payload (optional). | 757 // padding payload (optional). |
| 750 size_t remaining_data_length_; | 758 size_t remaining_data_length_; |
| 751 | 759 |
| 752 // The length (in bytes) of the padding payload to be processed. | 760 // The length (in bytes) of the padding payload to be processed. |
| 753 size_t remaining_padding_payload_length_; | 761 size_t remaining_padding_payload_length_; |
| 754 | 762 |
| 755 // The number of bytes remaining to read from the current control frame's | 763 // The number of bytes remaining to read from the current control frame's |
| 756 // headers. Note that header data blocks (for control types that have them) | 764 // headers. Note that header data blocks (for control types that have them) |
| 757 // are part of the frame's payload, and not the frame's headers. | 765 // are part of the frame's payload, and not the frame's headers. |
| 758 size_t remaining_control_header_; | 766 size_t remaining_control_header_; |
| 759 | 767 |
| 760 // The limit on HTTP/2 payload size as specified in the | 768 // The limit on the size of sent HTTP/2 payloads as specified in the |
| 761 // SETTINGS_MAX_FRAME_SIZE advertised to peer | 769 // SETTINGS_MAX_FRAME_SIZE received from peer. |
| 770 size_t send_frame_size_limit_ = kSpdyInitialFrameSizeLimit; |
| 771 |
| 772 // The limit on the size of received HTTP/2 payloads as specified in the |
| 773 // SETTINGS_MAX_FRAME_SIZE advertised to peer. |
| 762 size_t recv_frame_size_limit_ = kSpdyInitialFrameSizeLimit; | 774 size_t recv_frame_size_limit_ = kSpdyInitialFrameSizeLimit; |
| 763 | 775 |
| 764 CharBuffer current_frame_buffer_; | 776 CharBuffer current_frame_buffer_; |
| 765 | 777 |
| 766 // The type of the frame currently being read. | 778 // The type of the frame currently being read. |
| 767 SpdyFrameType current_frame_type_; | 779 SpdyFrameType current_frame_type_; |
| 768 | 780 |
| 769 // The total length of the frame currently being read, including frame header. | 781 // The total length of the frame currently being read, including frame header. |
| 770 uint32_t current_frame_length_; | 782 uint32_t current_frame_length_; |
| 771 | 783 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 // rather than reading all available input. | 849 // rather than reading all available input. |
| 838 bool process_single_input_frame_ = false; | 850 bool process_single_input_frame_ = false; |
| 839 | 851 |
| 840 bool enforce_max_frame_size_ = | 852 bool enforce_max_frame_size_ = |
| 841 FLAGS_chromium_http2_flag_enforce_max_frame_size; | 853 FLAGS_chromium_http2_flag_enforce_max_frame_size; |
| 842 }; | 854 }; |
| 843 | 855 |
| 844 } // namespace net | 856 } // namespace net |
| 845 | 857 |
| 846 #endif // NET_SPDY_SPDY_FRAMER_H_ | 858 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |