| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 case 4: | 78 case 4: |
| 79 return SETTINGS; | 79 return SETTINGS; |
| 80 case 6: | 80 case 6: |
| 81 return PING; | 81 return PING; |
| 82 case 7: | 82 case 7: |
| 83 return GOAWAY; | 83 return GOAWAY; |
| 84 case 8: | 84 case 8: |
| 85 return HEADERS; | 85 return HEADERS; |
| 86 case 9: | 86 case 9: |
| 87 return WINDOW_UPDATE; | 87 return WINDOW_UPDATE; |
| 88 default: | |
| 89 return DATA; | |
| 90 } | 88 } |
| 91 case SPDY4: | 89 case SPDY4: |
| 92 switch (frame_type_field) { | 90 switch (frame_type_field) { |
| 93 case 0: | 91 case 0: |
| 94 return DATA; | 92 return DATA; |
| 95 case 1: | 93 case 1: |
| 96 return HEADERS; | 94 return HEADERS; |
| 97 // TODO(hkhalil): Add PRIORITY. | 95 // TODO(hkhalil): Add PRIORITY. |
| 98 case 3: | 96 case 3: |
| 99 return RST_STREAM; | 97 return RST_STREAM; |
| 100 case 4: | 98 case 4: |
| 101 return SETTINGS; | 99 return SETTINGS; |
| 102 case 5: | 100 case 5: |
| 103 return PUSH_PROMISE; | 101 return PUSH_PROMISE; |
| 104 case 6: | 102 case 6: |
| 105 return PING; | 103 return PING; |
| 106 case 7: | 104 case 7: |
| 107 return GOAWAY; | 105 return GOAWAY; |
| 108 case 8: | 106 case 8: |
| 109 return WINDOW_UPDATE; | 107 return WINDOW_UPDATE; |
| 110 case 9: | 108 case 9: |
| 111 return CONTINUATION; | 109 return CONTINUATION; |
| 112 case 10: | 110 case 10: |
| 113 return BLOCKED; | 111 return BLOCKED; |
| 114 default: | |
| 115 return DATA; | |
| 116 } | 112 } |
| 117 } | 113 } |
| 114 |
| 115 LOG(DFATAL) << "Unhandled frame type " << frame_type_field; |
| 118 return DATA; | 116 return DATA; |
| 119 } | 117 } |
| 120 | 118 |
| 121 int SpdyConstants::SerializeFrameType(SpdyMajorVersion version, | 119 int SpdyConstants::SerializeFrameType(SpdyMajorVersion version, |
| 122 SpdyFrameType frame_type) { | 120 SpdyFrameType frame_type) { |
| 123 switch (version) { | 121 switch (version) { |
| 124 case SPDY2: | 122 case SPDY2: |
| 125 case SPDY3: | 123 case SPDY3: |
| 126 switch (frame_type) { | 124 switch (frame_type) { |
| 127 case SYN_STREAM: | 125 case SYN_STREAM: |
| 128 return 1; | 126 return 1; |
| 129 case SYN_REPLY: | 127 case SYN_REPLY: |
| 130 return 2; | 128 return 2; |
| 131 case RST_STREAM: | 129 case RST_STREAM: |
| 132 return 3; | 130 return 3; |
| 133 case SETTINGS: | 131 case SETTINGS: |
| 134 return 4; | 132 return 4; |
| 135 case PING: | 133 case PING: |
| 136 return 6; | 134 return 6; |
| 137 case GOAWAY: | 135 case GOAWAY: |
| 138 return 7; | 136 return 7; |
| 139 case HEADERS: | 137 case HEADERS: |
| 140 return 8; | 138 return 8; |
| 141 case WINDOW_UPDATE: | 139 case WINDOW_UPDATE: |
| 142 return 9; | 140 return 9; |
| 143 default: | 141 default: |
| 142 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type; |
| 144 return -1; | 143 return -1; |
| 145 } | 144 } |
| 146 case SPDY4: | 145 case SPDY4: |
| 147 switch (frame_type) { | 146 switch (frame_type) { |
| 148 case DATA: | 147 case DATA: |
| 149 return 0; | 148 return 0; |
| 150 case HEADERS: | 149 case HEADERS: |
| 151 return 1; | 150 return 1; |
| 152 // TODO(hkhalil): Add PRIORITY. | 151 // TODO(hkhalil): Add PRIORITY. |
| 153 case RST_STREAM: | 152 case RST_STREAM: |
| 154 return 3; | 153 return 3; |
| 155 case SETTINGS: | 154 case SETTINGS: |
| 156 return 4; | 155 return 4; |
| 157 case PUSH_PROMISE: | 156 case PUSH_PROMISE: |
| 158 return 5; | 157 return 5; |
| 159 case PING: | 158 case PING: |
| 160 return 6; | 159 return 6; |
| 161 case GOAWAY: | 160 case GOAWAY: |
| 162 return 7; | 161 return 7; |
| 163 case WINDOW_UPDATE: | 162 case WINDOW_UPDATE: |
| 164 return 8; | 163 return 8; |
| 165 case CONTINUATION: | 164 case CONTINUATION: |
| 166 return 9; | 165 return 9; |
| 167 case BLOCKED: | 166 case BLOCKED: |
| 168 return 10; | 167 return 10; |
| 169 default: | 168 default: |
| 169 LOG(DFATAL) << "Serializing unhandled frame type " << frame_type; |
| 170 return -1; | 170 return -1; |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { | 175 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { |
| 176 return visitor->VisitData(*this); | 176 return visitor->VisitData(*this); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { | 179 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { | 245 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { |
| 246 return visitor->VisitPushPromise(*this); | 246 return visitor->VisitPushPromise(*this); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { | 249 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { |
| 250 return visitor->VisitContinuation(*this); | 250 return visitor->VisitContinuation(*this); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace net | 253 } // namespace net |
| OLD | NEW |