| 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 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
| 6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 QuicGoAwayFrame() {} | 454 QuicGoAwayFrame() {} |
| 455 QuicGoAwayFrame(QuicErrorCode error_code, | 455 QuicGoAwayFrame(QuicErrorCode error_code, |
| 456 QuicStreamId last_good_stream_id, | 456 QuicStreamId last_good_stream_id, |
| 457 const std::string& reason); | 457 const std::string& reason); |
| 458 | 458 |
| 459 QuicErrorCode error_code; | 459 QuicErrorCode error_code; |
| 460 QuicStreamId last_good_stream_id; | 460 QuicStreamId last_good_stream_id; |
| 461 std::string reason_phrase; | 461 std::string reason_phrase; |
| 462 }; | 462 }; |
| 463 | 463 |
| 464 // EncryptionLevel enumerates the stages of encryption that a QUIC connection |
| 465 // progresses through. When retransmitting a packet, the encryption level needs |
| 466 // to be specified so that it is retransmitted at a level which the peer can |
| 467 // understand. |
| 468 enum EncryptionLevel { |
| 469 ENCRYPTION_NONE = 0, |
| 470 ENCRYPTION_INITIAL = 1, |
| 471 ENCRYPTION_FORWARD_SECURE = 2, |
| 472 |
| 473 NUM_ENCRYPTION_LEVELS, |
| 474 }; |
| 475 |
| 464 struct NET_EXPORT_PRIVATE QuicFrame { | 476 struct NET_EXPORT_PRIVATE QuicFrame { |
| 465 QuicFrame() {} | 477 QuicFrame() {} |
| 466 explicit QuicFrame(QuicPaddingFrame* padding_frame) | 478 explicit QuicFrame(QuicPaddingFrame* padding_frame) |
| 467 : type(PADDING_FRAME), | 479 : type(PADDING_FRAME), |
| 468 padding_frame(padding_frame) { | 480 padding_frame(padding_frame) { |
| 469 } | 481 } |
| 470 explicit QuicFrame(QuicStreamFrame* stream_frame) | 482 explicit QuicFrame(QuicStreamFrame* stream_frame) |
| 471 : type(STREAM_FRAME), | 483 : type(STREAM_FRAME), |
| 472 stream_frame(stream_frame) { | 484 stream_frame(stream_frame) { |
| 473 } | 485 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 ~RetransmittableFrames(); | 633 ~RetransmittableFrames(); |
| 622 | 634 |
| 623 // Allocates a local copy of the referenced StringPiece has QuicStreamFrame | 635 // Allocates a local copy of the referenced StringPiece has QuicStreamFrame |
| 624 // use it. | 636 // use it. |
| 625 // Takes ownership of |stream_frame|. | 637 // Takes ownership of |stream_frame|. |
| 626 const QuicFrame& AddStreamFrame(QuicStreamFrame* stream_frame); | 638 const QuicFrame& AddStreamFrame(QuicStreamFrame* stream_frame); |
| 627 // Takes ownership of the frame inside |frame|. | 639 // Takes ownership of the frame inside |frame|. |
| 628 const QuicFrame& AddNonStreamFrame(const QuicFrame& frame); | 640 const QuicFrame& AddNonStreamFrame(const QuicFrame& frame); |
| 629 const QuicFrames& frames() const { return frames_; } | 641 const QuicFrames& frames() const { return frames_; } |
| 630 | 642 |
| 643 void set_encryption_level(EncryptionLevel level); |
| 644 EncryptionLevel encryption_level() const { |
| 645 return encryption_level_; |
| 646 } |
| 647 |
| 631 private: | 648 private: |
| 632 QuicFrames frames_; | 649 QuicFrames frames_; |
| 650 EncryptionLevel encryption_level_; |
| 633 // Data referenced by the StringPiece of a QuicStreamFrame. | 651 // Data referenced by the StringPiece of a QuicStreamFrame. |
| 634 std::vector<std::string*> stream_data_; | 652 std::vector<std::string*> stream_data_; |
| 635 | 653 |
| 636 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames); | 654 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames); |
| 637 }; | 655 }; |
| 638 | 656 |
| 639 struct NET_EXPORT_PRIVATE SerializedPacket { | 657 struct NET_EXPORT_PRIVATE SerializedPacket { |
| 640 SerializedPacket(QuicPacketSequenceNumber sequence_number, | 658 SerializedPacket(QuicPacketSequenceNumber sequence_number, |
| 641 QuicPacket* packet, | 659 QuicPacket* packet, |
| 642 QuicPacketEntropyHash entropy_hash, | 660 QuicPacketEntropyHash entropy_hash, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 667 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 685 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 668 std::ostream& os, const QuicConsumedData& s); | 686 std::ostream& os, const QuicConsumedData& s); |
| 669 | 687 |
| 670 size_t bytes_consumed; | 688 size_t bytes_consumed; |
| 671 bool fin_consumed; | 689 bool fin_consumed; |
| 672 }; | 690 }; |
| 673 | 691 |
| 674 } // namespace net | 692 } // namespace net |
| 675 | 693 |
| 676 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 694 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |