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/quic/quic_framer.h" | 5 #include "net/quic/quic_framer.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 break; | 369 break; |
370 case STOP_WAITING_FRAME: | 370 case STOP_WAITING_FRAME: |
371 if (!AppendStopWaitingFrame( | 371 if (!AppendStopWaitingFrame( |
372 header, *frame.stop_waiting_frame, &writer)) { | 372 header, *frame.stop_waiting_frame, &writer)) { |
373 LOG(DFATAL) << "AppendStopWaitingFrame failed"; | 373 LOG(DFATAL) << "AppendStopWaitingFrame failed"; |
374 return kNoPacket; | 374 return kNoPacket; |
375 } | 375 } |
376 break; | 376 break; |
377 case PING_FRAME: | 377 case PING_FRAME: |
378 if (quic_version_ == QUIC_VERSION_16) { | |
379 LOG(DFATAL) << "Attempt to add a PingFrame in " | |
380 << QuicVersionToString(quic_version_); | |
381 return kNoPacket; | |
382 } | |
383 // Ping has no payload. | 378 // Ping has no payload. |
384 break; | 379 break; |
385 case RST_STREAM_FRAME: | 380 case RST_STREAM_FRAME: |
386 if (!AppendRstStreamFrame(*frame.rst_stream_frame, &writer)) { | 381 if (!AppendRstStreamFrame(*frame.rst_stream_frame, &writer)) { |
387 LOG(DFATAL) << "AppendRstStreamFrame failed"; | 382 LOG(DFATAL) << "AppendRstStreamFrame failed"; |
388 return kNoPacket; | 383 return kNoPacket; |
389 } | 384 } |
390 break; | 385 break; |
391 case CONNECTION_CLOSE_FRAME: | 386 case CONNECTION_CLOSE_FRAME: |
392 if (!AppendConnectionCloseFrame( | 387 if (!AppendConnectionCloseFrame( |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 return RaiseError(QUIC_INVALID_STOP_WAITING_DATA); | 1224 return RaiseError(QUIC_INVALID_STOP_WAITING_DATA); |
1230 } | 1225 } |
1231 if (!visitor_->OnStopWaitingFrame(stop_waiting_frame)) { | 1226 if (!visitor_->OnStopWaitingFrame(stop_waiting_frame)) { |
1232 DVLOG(1) << "Visitor asked to stop further processing."; | 1227 DVLOG(1) << "Visitor asked to stop further processing."; |
1233 // Returning true since there was no parsing error. | 1228 // Returning true since there was no parsing error. |
1234 return true; | 1229 return true; |
1235 } | 1230 } |
1236 continue; | 1231 continue; |
1237 } | 1232 } |
1238 case PING_FRAME: { | 1233 case PING_FRAME: { |
1239 if (quic_version_ == QUIC_VERSION_16) { | |
1240 LOG(DFATAL) << "Trying to read a Ping in " | |
1241 << QuicVersionToString(quic_version_); | |
1242 return RaiseError(QUIC_INTERNAL_ERROR); | |
1243 } | |
1244 // Ping has no payload. | 1234 // Ping has no payload. |
1245 QuicPingFrame ping_frame; | 1235 QuicPingFrame ping_frame; |
1246 if (!visitor_->OnPingFrame(ping_frame)) { | 1236 if (!visitor_->OnPingFrame(ping_frame)) { |
1247 DVLOG(1) << "Visitor asked to stop further processing."; | 1237 DVLOG(1) << "Visitor asked to stop further processing."; |
1248 // Returning true since there was no parsing error. | 1238 // Returning true since there was no parsing error. |
1249 return true; | 1239 return true; |
1250 } | 1240 } |
1251 continue; | 1241 continue; |
1252 } | 1242 } |
1253 | 1243 |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 | 2317 |
2328 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2318 bool QuicFramer::RaiseError(QuicErrorCode error) { |
2329 DVLOG(1) << "Error detail: " << detailed_error_; | 2319 DVLOG(1) << "Error detail: " << detailed_error_; |
2330 set_error(error); | 2320 set_error(error); |
2331 visitor_->OnError(this); | 2321 visitor_->OnError(this); |
2332 reader_.reset(NULL); | 2322 reader_.reset(NULL); |
2333 return false; | 2323 return false; |
2334 } | 2324 } |
2335 | 2325 |
2336 } // namespace net | 2326 } // namespace net |
OLD | NEW |