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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 SpdyStreamId last_good_stream_id_; | 838 SpdyStreamId last_good_stream_id_; |
839 SpdyGoAwayStatus status_; | 839 SpdyGoAwayStatus status_; |
840 const base::StringPiece description_; | 840 const base::StringPiece description_; |
841 | 841 |
842 DISALLOW_COPY_AND_ASSIGN(SpdyGoAwayIR); | 842 DISALLOW_COPY_AND_ASSIGN(SpdyGoAwayIR); |
843 }; | 843 }; |
844 | 844 |
845 class NET_EXPORT_PRIVATE SpdyHeadersIR : public SpdyFrameWithNameValueBlockIR { | 845 class NET_EXPORT_PRIVATE SpdyHeadersIR : public SpdyFrameWithNameValueBlockIR { |
846 public: | 846 public: |
847 explicit SpdyHeadersIR(SpdyStreamId stream_id) | 847 explicit SpdyHeadersIR(SpdyStreamId stream_id) |
848 : SpdyFrameWithNameValueBlockIR(stream_id), | 848 : SpdyFrameWithNameValueBlockIR(stream_id), |
849 has_priority_(false), | 849 has_priority_(false), |
850 priority_(0) {} | 850 priority_(0), |
| 851 padded_(false), |
| 852 padding_payload_len_(0) {} |
851 | 853 |
852 void Visit(SpdyFrameVisitor* visitor) const override; | 854 void Visit(SpdyFrameVisitor* visitor) const override; |
853 | 855 |
854 bool has_priority() const { return has_priority_; } | 856 bool has_priority() const { return has_priority_; } |
855 void set_has_priority(bool has_priority) { has_priority_ = has_priority; } | 857 void set_has_priority(bool has_priority) { has_priority_ = has_priority; } |
856 uint32 priority() const { return priority_; } | 858 uint32 priority() const { return priority_; } |
857 void set_priority(SpdyPriority priority) { priority_ = priority; } | 859 void set_priority(SpdyPriority priority) { priority_ = priority; } |
858 | 860 |
| 861 bool padded() const { return padded_; } |
| 862 int padding_payload_len() const { return padding_payload_len_; } |
| 863 void set_padding_len(int padding_len) { |
| 864 DCHECK_GT(padding_len, 0); |
| 865 DCHECK_LE(padding_len, kPaddingSizePerFrame); |
| 866 padded_ = true; |
| 867 // The pad field takes one octet on the wire. |
| 868 padding_payload_len_ = padding_len - 1; |
| 869 } |
| 870 |
859 private: | 871 private: |
860 bool has_priority_; | 872 bool has_priority_; |
861 // 31-bit priority. | 873 // 31-bit priority. |
862 uint32 priority_; | 874 uint32 priority_; |
| 875 |
| 876 bool padded_; |
| 877 int padding_payload_len_; |
| 878 |
863 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersIR); | 879 DISALLOW_COPY_AND_ASSIGN(SpdyHeadersIR); |
864 }; | 880 }; |
865 | 881 |
866 class NET_EXPORT_PRIVATE SpdyWindowUpdateIR : public SpdyFrameWithStreamIdIR { | 882 class NET_EXPORT_PRIVATE SpdyWindowUpdateIR : public SpdyFrameWithStreamIdIR { |
867 public: | 883 public: |
868 SpdyWindowUpdateIR(SpdyStreamId stream_id, int32 delta) | 884 SpdyWindowUpdateIR(SpdyStreamId stream_id, int32 delta) |
869 : SpdyFrameWithStreamIdIR(stream_id) { | 885 : SpdyFrameWithStreamIdIR(stream_id) { |
870 set_delta(delta); | 886 set_delta(delta); |
871 } | 887 } |
872 int32 delta() const { return delta_; } | 888 int32 delta() const { return delta_; } |
(...skipping 21 matching lines...) Expand all Loading... |
894 | 910 |
895 private: | 911 private: |
896 DISALLOW_COPY_AND_ASSIGN(SpdyBlockedIR); | 912 DISALLOW_COPY_AND_ASSIGN(SpdyBlockedIR); |
897 }; | 913 }; |
898 | 914 |
899 class NET_EXPORT_PRIVATE SpdyPushPromiseIR | 915 class NET_EXPORT_PRIVATE SpdyPushPromiseIR |
900 : public SpdyFrameWithNameValueBlockIR { | 916 : public SpdyFrameWithNameValueBlockIR { |
901 public: | 917 public: |
902 SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id) | 918 SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id) |
903 : SpdyFrameWithNameValueBlockIR(stream_id), | 919 : SpdyFrameWithNameValueBlockIR(stream_id), |
904 promised_stream_id_(promised_stream_id) {} | 920 promised_stream_id_(promised_stream_id), |
| 921 padded_(false), |
| 922 padding_payload_len_(0) {} |
905 SpdyStreamId promised_stream_id() const { return promised_stream_id_; } | 923 SpdyStreamId promised_stream_id() const { return promised_stream_id_; } |
906 void set_promised_stream_id(SpdyStreamId id) { promised_stream_id_ = id; } | 924 void set_promised_stream_id(SpdyStreamId id) { promised_stream_id_ = id; } |
907 | 925 |
908 void Visit(SpdyFrameVisitor* visitor) const override; | 926 void Visit(SpdyFrameVisitor* visitor) const override; |
909 | 927 |
| 928 bool padded() const { return padded_; } |
| 929 int padding_payload_len() const { return padding_payload_len_; } |
| 930 void set_padding_len(int padding_len) { |
| 931 DCHECK_GT(padding_len, 0); |
| 932 DCHECK_LE(padding_len, kPaddingSizePerFrame); |
| 933 padded_ = true; |
| 934 // The pad field takes one octet on the wire. |
| 935 padding_payload_len_ = padding_len - 1; |
| 936 } |
| 937 |
910 private: | 938 private: |
911 SpdyStreamId promised_stream_id_; | 939 SpdyStreamId promised_stream_id_; |
| 940 |
| 941 bool padded_; |
| 942 int padding_payload_len_; |
| 943 |
912 DISALLOW_COPY_AND_ASSIGN(SpdyPushPromiseIR); | 944 DISALLOW_COPY_AND_ASSIGN(SpdyPushPromiseIR); |
913 }; | 945 }; |
914 | 946 |
915 // TODO(jgraettinger): This representation needs review. SpdyContinuationIR | 947 // TODO(jgraettinger): This representation needs review. SpdyContinuationIR |
916 // needs to frame a portion of a single, arbitrarily-broken encoded buffer. | 948 // needs to frame a portion of a single, arbitrarily-broken encoded buffer. |
917 class NET_EXPORT_PRIVATE SpdyContinuationIR | 949 class NET_EXPORT_PRIVATE SpdyContinuationIR |
918 : public SpdyFrameWithNameValueBlockIR { | 950 : public SpdyFrameWithNameValueBlockIR { |
919 public: | 951 public: |
920 explicit SpdyContinuationIR(SpdyStreamId stream_id) | 952 explicit SpdyContinuationIR(SpdyStreamId stream_id) |
921 : SpdyFrameWithNameValueBlockIR(stream_id), | 953 : SpdyFrameWithNameValueBlockIR(stream_id), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 SpdyFrameVisitor() {} | 1089 SpdyFrameVisitor() {} |
1058 virtual ~SpdyFrameVisitor() {} | 1090 virtual ~SpdyFrameVisitor() {} |
1059 | 1091 |
1060 private: | 1092 private: |
1061 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 1093 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
1062 }; | 1094 }; |
1063 | 1095 |
1064 } // namespace net | 1096 } // namespace net |
1065 | 1097 |
1066 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 1098 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |