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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 }; | 530 }; |
531 | 531 |
532 struct NET_EXPORT_PRIVATE QuicStreamFrame { | 532 struct NET_EXPORT_PRIVATE QuicStreamFrame { |
533 QuicStreamFrame(); | 533 QuicStreamFrame(); |
534 QuicStreamFrame(const QuicStreamFrame& frame); | 534 QuicStreamFrame(const QuicStreamFrame& frame); |
535 QuicStreamFrame(QuicStreamId stream_id, | 535 QuicStreamFrame(QuicStreamId stream_id, |
536 bool fin, | 536 bool fin, |
537 QuicStreamOffset offset, | 537 QuicStreamOffset offset, |
538 IOVector data); | 538 IOVector data); |
539 | 539 |
| 540 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 541 std::ostream& os, const QuicStreamFrame& s); |
| 542 |
540 // Returns a copy of the IOVector |data| as a heap-allocated string. | 543 // Returns a copy of the IOVector |data| as a heap-allocated string. |
541 // Caller must take ownership of the returned string. | 544 // Caller must take ownership of the returned string. |
542 std::string* GetDataAsString() const; | 545 std::string* GetDataAsString() const; |
543 | 546 |
544 QuicStreamId stream_id; | 547 QuicStreamId stream_id; |
545 bool fin; | 548 bool fin; |
546 QuicStreamOffset offset; // Location of this data in the stream. | 549 QuicStreamOffset offset; // Location of this data in the stream. |
547 IOVector data; | 550 IOVector data; |
548 | 551 |
549 // If this is set, then when this packet is ACKed the AckNotifier will be | 552 // If this is set, then when this packet is ACKed the AckNotifier will be |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 CongestionFeedbackMessageFixRate fix_rate; | 677 CongestionFeedbackMessageFixRate fix_rate; |
675 }; | 678 }; |
676 | 679 |
677 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { | 680 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
678 QuicRstStreamFrame() {} | 681 QuicRstStreamFrame() {} |
679 QuicRstStreamFrame(QuicStreamId stream_id, QuicRstStreamErrorCode error_code) | 682 QuicRstStreamFrame(QuicStreamId stream_id, QuicRstStreamErrorCode error_code) |
680 : stream_id(stream_id), error_code(error_code) { | 683 : stream_id(stream_id), error_code(error_code) { |
681 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); | 684 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); |
682 } | 685 } |
683 | 686 |
| 687 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 688 std::ostream& os, const QuicRstStreamFrame& r); |
| 689 |
684 QuicStreamId stream_id; | 690 QuicStreamId stream_id; |
685 QuicRstStreamErrorCode error_code; | 691 QuicRstStreamErrorCode error_code; |
686 std::string error_details; | 692 std::string error_details; |
687 }; | 693 }; |
688 | 694 |
689 struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame { | 695 struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame { |
| 696 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 697 std::ostream& os, const QuicConnectionCloseFrame& c); |
| 698 |
690 QuicErrorCode error_code; | 699 QuicErrorCode error_code; |
691 std::string error_details; | 700 std::string error_details; |
692 }; | 701 }; |
693 | 702 |
694 struct NET_EXPORT_PRIVATE QuicGoAwayFrame { | 703 struct NET_EXPORT_PRIVATE QuicGoAwayFrame { |
695 QuicGoAwayFrame() {} | 704 QuicGoAwayFrame() {} |
696 QuicGoAwayFrame(QuicErrorCode error_code, | 705 QuicGoAwayFrame(QuicErrorCode error_code, |
697 QuicStreamId last_good_stream_id, | 706 QuicStreamId last_good_stream_id, |
698 const std::string& reason); | 707 const std::string& reason); |
699 | 708 |
| 709 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 710 std::ostream& os, const QuicGoAwayFrame& g); |
| 711 |
700 QuicErrorCode error_code; | 712 QuicErrorCode error_code; |
701 QuicStreamId last_good_stream_id; | 713 QuicStreamId last_good_stream_id; |
702 std::string reason_phrase; | 714 std::string reason_phrase; |
703 }; | 715 }; |
704 | 716 |
705 // EncryptionLevel enumerates the stages of encryption that a QUIC connection | 717 // EncryptionLevel enumerates the stages of encryption that a QUIC connection |
706 // progresses through. When retransmitting a packet, the encryption level needs | 718 // progresses through. When retransmitting a packet, the encryption level needs |
707 // to be specified so that it is retransmitted at a level which the peer can | 719 // to be specified so that it is retransmitted at a level which the peer can |
708 // understand. | 720 // understand. |
709 enum EncryptionLevel { | 721 enum EncryptionLevel { |
(...skipping 28 matching lines...) Expand all Loading... |
738 } | 750 } |
739 explicit QuicFrame(QuicConnectionCloseFrame* frame) | 751 explicit QuicFrame(QuicConnectionCloseFrame* frame) |
740 : type(CONNECTION_CLOSE_FRAME), | 752 : type(CONNECTION_CLOSE_FRAME), |
741 connection_close_frame(frame) { | 753 connection_close_frame(frame) { |
742 } | 754 } |
743 explicit QuicFrame(QuicGoAwayFrame* frame) | 755 explicit QuicFrame(QuicGoAwayFrame* frame) |
744 : type(GOAWAY_FRAME), | 756 : type(GOAWAY_FRAME), |
745 goaway_frame(frame) { | 757 goaway_frame(frame) { |
746 } | 758 } |
747 | 759 |
| 760 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 761 std::ostream& os, const QuicFrame& frame); |
| 762 |
748 QuicFrameType type; | 763 QuicFrameType type; |
749 union { | 764 union { |
750 QuicPaddingFrame* padding_frame; | 765 QuicPaddingFrame* padding_frame; |
751 QuicStreamFrame* stream_frame; | 766 QuicStreamFrame* stream_frame; |
752 QuicAckFrame* ack_frame; | 767 QuicAckFrame* ack_frame; |
753 QuicCongestionFeedbackFrame* congestion_feedback_frame; | 768 QuicCongestionFeedbackFrame* congestion_feedback_frame; |
754 QuicRstStreamFrame* rst_stream_frame; | 769 QuicRstStreamFrame* rst_stream_frame; |
755 QuicConnectionCloseFrame* connection_close_frame; | 770 QuicConnectionCloseFrame* connection_close_frame; |
756 QuicGoAwayFrame* goaway_frame; | 771 QuicGoAwayFrame* goaway_frame; |
757 }; | 772 }; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 WriteStatus status; | 974 WriteStatus status; |
960 union { | 975 union { |
961 int bytes_written; // only valid when status is OK | 976 int bytes_written; // only valid when status is OK |
962 int error_code; // only valid when status is ERROR | 977 int error_code; // only valid when status is ERROR |
963 }; | 978 }; |
964 }; | 979 }; |
965 | 980 |
966 } // namespace net | 981 } // namespace net |
967 | 982 |
968 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 983 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |