| 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 #include "net/spdy/spdy_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( | 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( |
| 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} | 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // SYN_STREAM is the first valid frame. | 35 // SYN_STREAM is the first valid frame. |
| 36 if (frame_type_field < SerializeFrameType(version, SYN_STREAM)) { | 36 if (frame_type_field < SerializeFrameType(version, SYN_STREAM)) { |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // WINDOW_UPDATE is the last valid frame. | 40 // WINDOW_UPDATE is the last valid frame. |
| 41 if (frame_type_field > SerializeFrameType(version, WINDOW_UPDATE)) { | 41 if (frame_type_field > SerializeFrameType(version, WINDOW_UPDATE)) { |
| 42 return false; | 42 return false; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // The valid range is non-contiguous. | |
| 46 if (frame_type_field == NOOP) { | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 return true; | 45 return true; |
| 51 case SPDY4: | 46 case SPDY4: |
| 52 case SPDY5: | 47 case SPDY5: |
| 53 // DATA is the first valid frame. | 48 // DATA is the first valid frame. |
| 54 if (frame_type_field < SerializeFrameType(version, DATA)) { | 49 if (frame_type_field < SerializeFrameType(version, DATA)) { |
| 55 return false; | 50 return false; |
| 56 } | 51 } |
| 57 | 52 |
| 58 // BLOCKED is the last valid frame. | 53 // BLOCKED is the last valid frame. |
| 59 if (frame_type_field > SerializeFrameType(version, BLOCKED)) { | 54 if (frame_type_field > SerializeFrameType(version, BLOCKED)) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 default: | 177 default: |
| 183 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type; | 178 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type; |
| 184 return -1; | 179 return -1; |
| 185 } | 180 } |
| 186 } | 181 } |
| 187 | 182 |
| 188 LOG(DFATAL) << "Unhandled SPDY version " << version; | 183 LOG(DFATAL) << "Unhandled SPDY version " << version; |
| 189 return -1; | 184 return -1; |
| 190 } | 185 } |
| 191 | 186 |
| 187 int SpdyConstants::DataFrameType(SpdyMajorVersion version) { |
| 188 switch (version) { |
| 189 case SPDY2: |
| 190 case SPDY3: |
| 191 return 0; |
| 192 case SPDY4: |
| 193 case SPDY5: |
| 194 return SerializeFrameType(version, DATA); |
| 195 } |
| 196 |
| 197 LOG(DFATAL) << "Unhandled SPDY version " << version; |
| 198 return 0; |
| 199 } |
| 200 |
| 192 bool SpdyConstants::IsValidSettingId(SpdyMajorVersion version, | 201 bool SpdyConstants::IsValidSettingId(SpdyMajorVersion version, |
| 193 int setting_id_field) { | 202 int setting_id_field) { |
| 194 switch (version) { | 203 switch (version) { |
| 195 case SPDY2: | 204 case SPDY2: |
| 196 case SPDY3: | 205 case SPDY3: |
| 197 // UPLOAD_BANDWIDTH is the first valid setting id. | 206 // UPLOAD_BANDWIDTH is the first valid setting id. |
| 198 if (setting_id_field < | 207 if (setting_id_field < |
| 199 SerializeSettingId(version, SETTINGS_UPLOAD_BANDWIDTH)) { | 208 SerializeSettingId(version, SETTINGS_UPLOAD_BANDWIDTH)) { |
| 200 return false; | 209 return false; |
| 201 } | 210 } |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 SpdyAltSvcIR::SpdyAltSvcIR(SpdyStreamId stream_id) | 820 SpdyAltSvcIR::SpdyAltSvcIR(SpdyStreamId stream_id) |
| 812 : SpdyFrameWithStreamIdIR(stream_id), | 821 : SpdyFrameWithStreamIdIR(stream_id), |
| 813 max_age_(0), | 822 max_age_(0), |
| 814 port_(0) {} | 823 port_(0) {} |
| 815 | 824 |
| 816 void SpdyAltSvcIR::Visit(SpdyFrameVisitor* visitor) const { | 825 void SpdyAltSvcIR::Visit(SpdyFrameVisitor* visitor) const { |
| 817 return visitor->VisitAltSvc(*this); | 826 return visitor->VisitAltSvc(*this); |
| 818 } | 827 } |
| 819 | 828 |
| 820 } // namespace net | 829 } // namespace net |
| OLD | NEW |