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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 558 |
559 // Returns the prefix length for the given frame type. | 559 // Returns the prefix length for the given frame type. |
560 size_t GetPrefixLength(SpdyFrameType type) const; | 560 size_t GetPrefixLength(SpdyFrameType type) const; |
561 | 561 |
562 // For debugging. | 562 // For debugging. |
563 static const char* StateToString(int state); | 563 static const char* StateToString(int state); |
564 static const char* ErrorCodeToString(int error_code); | 564 static const char* ErrorCodeToString(int error_code); |
565 static const char* StatusCodeToString(int status_code); | 565 static const char* StatusCodeToString(int status_code); |
566 static const char* FrameTypeToString(SpdyFrameType type); | 566 static const char* FrameTypeToString(SpdyFrameType type); |
567 | 567 |
568 SpdyMajorVersion protocol_version() const { return spdy_version_; } | 568 SpdyMajorVersion protocol_version() const { return protocol_version_; } |
569 | 569 |
570 bool probable_http_response() const { return probable_http_response_; } | 570 bool probable_http_response() const { return probable_http_response_; } |
571 | 571 |
572 SpdyStreamId expect_continuation() const { return expect_continuation_; } | 572 SpdyStreamId expect_continuation() const { return expect_continuation_; } |
573 | 573 |
574 SpdyPriority GetLowestPriority() const { | 574 SpdyPriority GetLowestPriority() const { |
575 return spdy_version_ < SPDY3 ? 3 : 7; | 575 return protocol_version_ < SPDY3 ? 3 : 7; |
576 } | 576 } |
577 | 577 |
578 SpdyPriority GetHighestPriority() const { return 0; } | 578 SpdyPriority GetHighestPriority() const { return 0; } |
579 | 579 |
580 // Interpolates SpdyPriority values into SPDY4/HTTP2 priority weights, | 580 // Interpolates SpdyPriority values into SPDY4/HTTP2 priority weights, |
581 // and vice versa. | 581 // and vice versa. |
582 static uint8 MapPriorityToWeight(SpdyPriority priority); | 582 static uint8 MapPriorityToWeight(SpdyPriority priority); |
583 static SpdyPriority MapWeightToPriority(uint8 weight); | 583 static SpdyPriority MapWeightToPriority(uint8 weight); |
584 | 584 |
585 // Deliver the given control frame's compressed headers block to the visitor | 585 // Deliver the given control frame's compressed headers block to the visitor |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 scoped_ptr<z_stream> header_decompressor_; | 767 scoped_ptr<z_stream> header_decompressor_; |
768 | 768 |
769 scoped_ptr<HpackEncoder> hpack_encoder_; | 769 scoped_ptr<HpackEncoder> hpack_encoder_; |
770 scoped_ptr<HpackDecoder> hpack_decoder_; | 770 scoped_ptr<HpackDecoder> hpack_decoder_; |
771 | 771 |
772 SpdyFramerVisitorInterface* visitor_; | 772 SpdyFramerVisitorInterface* visitor_; |
773 SpdyFramerDebugVisitorInterface* debug_visitor_; | 773 SpdyFramerDebugVisitorInterface* debug_visitor_; |
774 | 774 |
775 std::string display_protocol_; | 775 std::string display_protocol_; |
776 | 776 |
777 // The major SPDY version to be spoken/understood by this framer. | 777 // The protocol version to be spoken/understood by this framer. |
778 const SpdyMajorVersion spdy_version_; | 778 const SpdyMajorVersion protocol_version_; |
779 | 779 |
780 // Tracks if we've ever gotten far enough in framing to see a control frame of | 780 // Tracks if we've ever gotten far enough in framing to see a control frame of |
781 // type SYN_STREAM or SYN_REPLY. | 781 // type SYN_STREAM or SYN_REPLY. |
782 // | 782 // |
783 // If we ever get something which looks like a data frame before we've had a | 783 // If we ever get something which looks like a data frame before we've had a |
784 // SYN, we explicitly check to see if it looks like we got an HTTP response | 784 // SYN, we explicitly check to see if it looks like we got an HTTP response |
785 // to a SPDY request. This boolean lets us do that. | 785 // to a SPDY request. This boolean lets us do that. |
786 bool syn_frame_processed_; | 786 bool syn_frame_processed_; |
787 | 787 |
788 // If we ever get a data frame before a SYN frame, we check to see if it | 788 // If we ever get a data frame before a SYN frame, we check to see if it |
(...skipping 12 matching lines...) Expand all Loading... |
801 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM | 801 // If a HEADERS frame is followed by a CONTINUATION frame, the FIN/END_STREAM |
802 // flag is still carried in the HEADERS frame. If it's set, flip this so that | 802 // flag is still carried in the HEADERS frame. If it's set, flip this so that |
803 // we know to terminate the stream when the entire header block has been | 803 // we know to terminate the stream when the entire header block has been |
804 // processed. | 804 // processed. |
805 bool end_stream_when_done_; | 805 bool end_stream_when_done_; |
806 }; | 806 }; |
807 | 807 |
808 } // namespace net | 808 } // namespace net |
809 | 809 |
810 #endif // NET_SPDY_SPDY_FRAMER_H_ | 810 #endif // NET_SPDY_SPDY_FRAMER_H_ |
OLD | NEW |