Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: net/spdy/spdy_framer.h

Issue 199843005: Implement padding for SPDY4/HTTP2 DATA frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nullptr => NULL & discard padding at SpdySession visitor call. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_frame_builder.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 10 #include <string>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 public: 274 public:
275 // SPDY states. 275 // SPDY states.
276 // TODO(mbelshe): Can we move these into the implementation 276 // TODO(mbelshe): Can we move these into the implementation
277 // and avoid exposing through the header. (Needed for test) 277 // and avoid exposing through the header. (Needed for test)
278 enum SpdyState { 278 enum SpdyState {
279 SPDY_ERROR, 279 SPDY_ERROR,
280 SPDY_RESET, 280 SPDY_RESET,
281 SPDY_AUTO_RESET, 281 SPDY_AUTO_RESET,
282 SPDY_READING_COMMON_HEADER, 282 SPDY_READING_COMMON_HEADER,
283 SPDY_CONTROL_FRAME_PAYLOAD, 283 SPDY_CONTROL_FRAME_PAYLOAD,
284 SPDY_READ_PADDING_LENGTH,
285 SPDY_CONSUME_PADDING,
284 SPDY_IGNORE_REMAINING_PAYLOAD, 286 SPDY_IGNORE_REMAINING_PAYLOAD,
285 SPDY_FORWARD_STREAM_FRAME, 287 SPDY_FORWARD_STREAM_FRAME,
286 SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK, 288 SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK,
287 SPDY_CONTROL_FRAME_HEADER_BLOCK, 289 SPDY_CONTROL_FRAME_HEADER_BLOCK,
288 SPDY_GOAWAY_FRAME_PAYLOAD, 290 SPDY_GOAWAY_FRAME_PAYLOAD,
289 SPDY_RST_STREAM_FRAME_PAYLOAD, 291 SPDY_RST_STREAM_FRAME_PAYLOAD,
290 SPDY_SETTINGS_FRAME_PAYLOAD, 292 SPDY_SETTINGS_FRAME_PAYLOAD,
291 }; 293 };
292 294
293 // SPDY error codes. 295 // SPDY error codes.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // consumed from the data. 539 // consumed from the data.
538 size_t ProcessCommonHeader(const char* data, size_t len); 540 size_t ProcessCommonHeader(const char* data, size_t len);
539 size_t ProcessControlFramePayload(const char* data, size_t len); 541 size_t ProcessControlFramePayload(const char* data, size_t len);
540 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); 542 size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len);
541 // HPACK data is re-encoded as SPDY3 and re-entrantly delivered through 543 // HPACK data is re-encoded as SPDY3 and re-entrantly delivered through
542 // |ProcessControlFrameHeaderBlock()|. |is_hpack_header_block| controls 544 // |ProcessControlFrameHeaderBlock()|. |is_hpack_header_block| controls
543 // whether data is treated as HPACK- vs SPDY3-encoded. 545 // whether data is treated as HPACK- vs SPDY3-encoded.
544 size_t ProcessControlFrameHeaderBlock(const char* data, 546 size_t ProcessControlFrameHeaderBlock(const char* data,
545 size_t len, 547 size_t len,
546 bool is_hpack_header_block); 548 bool is_hpack_header_block);
549 size_t ProcessFramePaddingLength(const char* data, size_t len);
550 size_t ProcessFramePadding(const char* data, size_t len);
547 size_t ProcessDataFramePayload(const char* data, size_t len); 551 size_t ProcessDataFramePayload(const char* data, size_t len);
548 size_t ProcessGoAwayFramePayload(const char* data, size_t len); 552 size_t ProcessGoAwayFramePayload(const char* data, size_t len);
549 size_t ProcessRstStreamFramePayload(const char* data, size_t len); 553 size_t ProcessRstStreamFramePayload(const char* data, size_t len);
550 size_t ProcessSettingsFramePayload(const char* data, size_t len); 554 size_t ProcessSettingsFramePayload(const char* data, size_t len);
551 555
552 // TODO(jgraettinger): To be removed with migration to 556 // TODO(jgraettinger): To be removed with migration to
553 // SpdyHeadersHandlerInterface. 557 // SpdyHeadersHandlerInterface.
554 // Serializes the last-processed header block of |hpack_decoder_| as 558 // Serializes the last-processed header block of |hpack_decoder_| as
555 // a SPDY3 format block, and delivers it to the visitor via reentrant 559 // a SPDY3 format block, and delivers it to the visitor via reentrant
556 // call to ProcessControlFrameHeaderBlock(). 560 // call to ProcessControlFrameHeaderBlock().
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 625
622 // The size of the control frame buffer. 626 // The size of the control frame buffer.
623 // Since this is only used for control frame headers, the maximum control 627 // Since this is only used for control frame headers, the maximum control
624 // frame header size (SYN_STREAM) is sufficient; all remaining control 628 // frame header size (SYN_STREAM) is sufficient; all remaining control
625 // frame data is streamed to the visitor. 629 // frame data is streamed to the visitor.
626 static const size_t kControlFrameBufferSize; 630 static const size_t kControlFrameBufferSize;
627 631
628 SpdyState state_; 632 SpdyState state_;
629 SpdyState previous_state_; 633 SpdyState previous_state_;
630 SpdyError error_code_; 634 SpdyError error_code_;
635
636 // Note that for DATA frame, remaining_data_length_ is sum of lengths of
637 // frame header, padding length field (optional), data payload (optional) and
638 // padding payload (optional).
631 size_t remaining_data_length_; 639 size_t remaining_data_length_;
632 640
641 // The length (in bytes) of the padding payload to be processed.
642 size_t remaining_padding_payload_length_;
643
644 // The length (in bytes) of the padding length field to be processed.
645 size_t remaining_padding_length_fields_;
646
633 // The number of bytes remaining to read from the current control frame's 647 // The number of bytes remaining to read from the current control frame's
634 // headers. Note that header data blocks (for control types that have them) 648 // headers. Note that header data blocks (for control types that have them)
635 // are part of the frame's payload, and not the frame's headers. 649 // are part of the frame's payload, and not the frame's headers.
636 size_t remaining_control_header_; 650 size_t remaining_control_header_;
637 651
638 scoped_ptr<char[]> current_frame_buffer_; 652 scoped_ptr<char[]> current_frame_buffer_;
639 // Number of bytes read into the current_frame_buffer_. 653 // Number of bytes read into the current_frame_buffer_.
640 size_t current_frame_buffer_length_; 654 size_t current_frame_buffer_length_;
641 655
642 // The type of the frame currently being read. 656 // The type of the frame currently being read.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM 710 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM
697 // flag is still carried in the HEADERS frame. If it's set, flip this so that 711 // flag is still carried in the HEADERS frame. If it's set, flip this so that
698 // we know to terminate the stream when the entire header block has been 712 // we know to terminate the stream when the entire header block has been
699 // processed. 713 // processed.
700 bool end_stream_when_done_; 714 bool end_stream_when_done_;
701 }; 715 };
702 716
703 } // namespace net 717 } // namespace net
704 718
705 #endif // NET_SPDY_SPDY_FRAMER_H_ 719 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698