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 // This file contains some protocol structures for use with SPDY 2 and 3 | 5 // This file contains some protocol structures for use with SPDY 2 and 3 |
6 // The SPDY 2 spec can be found at: | 6 // The SPDY 2 spec can be found at: |
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 | 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 |
8 // The SPDY 3 spec can be found at: | 8 // The SPDY 3 spec can be found at: |
9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 | 9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 |
10 | 10 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // for this value as opposed to a constant. | 488 // for this value as opposed to a constant. |
489 static size_t GetDataFrameMinimumSize(); | 489 static size_t GetDataFrameMinimumSize(); |
490 | 490 |
491 // Size, in bytes, of the control frame header. | 491 // Size, in bytes, of the control frame header. |
492 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); | 492 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); |
493 | 493 |
494 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); | 494 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); |
495 | 495 |
496 static size_t GetFrameMaximumSize(SpdyMajorVersion version); | 496 static size_t GetFrameMaximumSize(SpdyMajorVersion version); |
497 | 497 |
| 498 // Returns the size of a header block size field. Valid only for SPDY |
| 499 // versions <= 3. |
| 500 static size_t GetSizeOfSizeField(SpdyMajorVersion version); |
| 501 |
498 static SpdyMajorVersion ParseMajorVersion(int version_number); | 502 static SpdyMajorVersion ParseMajorVersion(int version_number); |
499 | 503 |
500 static int SerializeMajorVersion(SpdyMajorVersion version); | 504 static int SerializeMajorVersion(SpdyMajorVersion version); |
501 | 505 |
502 static std::string GetVersionString(SpdyMajorVersion version); | 506 static std::string GetVersionString(SpdyMajorVersion version); |
503 }; | 507 }; |
504 | 508 |
505 class SpdyFrame; | 509 class SpdyFrame; |
506 typedef SpdyFrame SpdySerializedFrame; | 510 typedef SpdyFrame SpdySerializedFrame; |
507 | 511 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 SpdyGoAwayStatus status_; | 823 SpdyGoAwayStatus status_; |
820 const base::StringPiece description_; | 824 const base::StringPiece description_; |
821 | 825 |
822 DISALLOW_COPY_AND_ASSIGN(SpdyGoAwayIR); | 826 DISALLOW_COPY_AND_ASSIGN(SpdyGoAwayIR); |
823 }; | 827 }; |
824 | 828 |
825 class NET_EXPORT_PRIVATE SpdyHeadersIR : public SpdyFrameWithNameValueBlockIR { | 829 class NET_EXPORT_PRIVATE SpdyHeadersIR : public SpdyFrameWithNameValueBlockIR { |
826 public: | 830 public: |
827 explicit SpdyHeadersIR(SpdyStreamId stream_id) | 831 explicit SpdyHeadersIR(SpdyStreamId stream_id) |
828 : SpdyFrameWithNameValueBlockIR(stream_id), | 832 : SpdyFrameWithNameValueBlockIR(stream_id), |
829 end_headers_(true), | |
830 has_priority_(false), | 833 has_priority_(false), |
831 priority_(0) {} | 834 priority_(0) {} |
832 | 835 |
833 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; | 836 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; |
834 | 837 |
835 bool end_headers() const { return end_headers_; } | |
836 void set_end_headers(bool end_headers) {end_headers_ = end_headers;} | |
837 bool has_priority() const { return has_priority_; } | 838 bool has_priority() const { return has_priority_; } |
838 void set_has_priority(bool has_priority) { has_priority_ = has_priority; } | 839 void set_has_priority(bool has_priority) { has_priority_ = has_priority; } |
839 uint32 priority() const { return priority_; } | 840 uint32 priority() const { return priority_; } |
840 void set_priority(SpdyPriority priority) { priority_ = priority; } | 841 void set_priority(SpdyPriority priority) { priority_ = priority; } |
841 | 842 |
842 private: | 843 private: |
843 bool end_headers_; | |
844 bool has_priority_; | 844 bool has_priority_; |
845 // 31-bit priority. | 845 // 31-bit priority. |
846 uint32 priority_; | 846 uint32 priority_; |
847 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersIR); | 847 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersIR); |
848 }; | 848 }; |
849 | 849 |
850 class NET_EXPORT_PRIVATE SpdyWindowUpdateIR : public SpdyFrameWithStreamIdIR { | 850 class NET_EXPORT_PRIVATE SpdyWindowUpdateIR : public SpdyFrameWithStreamIdIR { |
851 public: | 851 public: |
852 SpdyWindowUpdateIR(SpdyStreamId stream_id, int32 delta) | 852 SpdyWindowUpdateIR(SpdyStreamId stream_id, int32 delta) |
853 : SpdyFrameWithStreamIdIR(stream_id) { | 853 : SpdyFrameWithStreamIdIR(stream_id) { |
(...skipping 24 matching lines...) Expand all Loading... |
878 | 878 |
879 private: | 879 private: |
880 DISALLOW_COPY_AND_ASSIGN(SpdyBlockedIR); | 880 DISALLOW_COPY_AND_ASSIGN(SpdyBlockedIR); |
881 }; | 881 }; |
882 | 882 |
883 class NET_EXPORT_PRIVATE SpdyPushPromiseIR | 883 class NET_EXPORT_PRIVATE SpdyPushPromiseIR |
884 : public SpdyFrameWithNameValueBlockIR { | 884 : public SpdyFrameWithNameValueBlockIR { |
885 public: | 885 public: |
886 SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id) | 886 SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id) |
887 : SpdyFrameWithNameValueBlockIR(stream_id), | 887 : SpdyFrameWithNameValueBlockIR(stream_id), |
888 promised_stream_id_(promised_stream_id), | 888 promised_stream_id_(promised_stream_id) {} |
889 end_push_promise_(true) {} | |
890 SpdyStreamId promised_stream_id() const { return promised_stream_id_; } | 889 SpdyStreamId promised_stream_id() const { return promised_stream_id_; } |
891 void set_promised_stream_id(SpdyStreamId id) { promised_stream_id_ = id; } | 890 void set_promised_stream_id(SpdyStreamId id) { promised_stream_id_ = id; } |
892 bool end_push_promise() const { return end_push_promise_; } | |
893 void set_end_push_promise(bool end_push_promise) { | |
894 end_push_promise_ = end_push_promise; | |
895 } | |
896 | 891 |
897 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; | 892 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; |
898 | 893 |
899 private: | 894 private: |
900 SpdyStreamId promised_stream_id_; | 895 SpdyStreamId promised_stream_id_; |
901 bool end_push_promise_; | |
902 DISALLOW_COPY_AND_ASSIGN(SpdyPushPromiseIR); | 896 DISALLOW_COPY_AND_ASSIGN(SpdyPushPromiseIR); |
903 }; | 897 }; |
904 | 898 |
905 // TODO(jgraettinger): This representation needs review. SpdyContinuationIR | 899 // TODO(jgraettinger): This representation needs review. SpdyContinuationIR |
906 // needs to frame a portion of a single, arbitrarily-broken encoded buffer. | 900 // needs to frame a portion of a single, arbitrarily-broken encoded buffer. |
907 class NET_EXPORT_PRIVATE SpdyContinuationIR | 901 class NET_EXPORT_PRIVATE SpdyContinuationIR |
908 : public SpdyFrameWithNameValueBlockIR { | 902 : public SpdyFrameWithNameValueBlockIR { |
909 public: | 903 public: |
910 explicit SpdyContinuationIR(SpdyStreamId stream_id) | 904 explicit SpdyContinuationIR(SpdyStreamId stream_id) |
911 : SpdyFrameWithNameValueBlockIR(stream_id), | 905 : SpdyFrameWithNameValueBlockIR(stream_id), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 SpdyFrameVisitor() {} | 981 SpdyFrameVisitor() {} |
988 virtual ~SpdyFrameVisitor() {} | 982 virtual ~SpdyFrameVisitor() {} |
989 | 983 |
990 private: | 984 private: |
991 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 985 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
992 }; | 986 }; |
993 | 987 |
994 } // namespace net | 988 } // namespace net |
995 | 989 |
996 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 990 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |