| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 NEGOTIATION_IN_PROGRESS, | 683 NEGOTIATION_IN_PROGRESS, |
| 684 // This indicates this endpoint has received a packet from the peer with a | 684 // This indicates this endpoint has received a packet from the peer with a |
| 685 // version this endpoint supports. Version negotiation is complete, and the | 685 // version this endpoint supports. Version negotiation is complete, and the |
| 686 // version number will no longer be sent with future packets. | 686 // version number will no longer be sent with future packets. |
| 687 NEGOTIATED_VERSION | 687 NEGOTIATED_VERSION |
| 688 }; | 688 }; |
| 689 | 689 |
| 690 typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; | 690 typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; |
| 691 | 691 |
| 692 // A padding frame contains no payload. | 692 // A padding frame contains no payload. |
| 693 struct NET_EXPORT_PRIVATE QuicPaddingFrame { | 693 struct NET_EXPORT_PRIVATE QuicPaddingFrame {}; |
| 694 }; | |
| 695 | 694 |
| 696 // A ping frame contains no payload, though it is retransmittable, | 695 // A ping frame contains no payload, though it is retransmittable, |
| 697 // and ACK'd just like other normal frames. | 696 // and ACK'd just like other normal frames. |
| 698 struct NET_EXPORT_PRIVATE QuicPingFrame { | 697 struct NET_EXPORT_PRIVATE QuicPingFrame {}; |
| 699 }; | |
| 700 | 698 |
| 701 // A path MTU discovery frame contains no payload and is serialized as a ping | 699 // A path MTU discovery frame contains no payload and is serialized as a ping |
| 702 // frame. | 700 // frame. |
| 703 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; | 701 struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {}; |
| 704 | 702 |
| 705 typedef scoped_ptr<char[]> UniqueStreamBuffer; | 703 typedef scoped_ptr<char[]> UniqueStreamBuffer; |
| 706 | 704 |
| 707 // Allocates memory of size |size| for a QUIC stream buffer. | 705 // Allocates memory of size |size| for a QUIC stream buffer. |
| 708 UniqueStreamBuffer NewStreamBuffer(size_t size); | 706 UniqueStreamBuffer NewStreamBuffer(size_t size); |
| 709 | 707 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 enum EncryptionLevel { | 990 enum EncryptionLevel { |
| 993 ENCRYPTION_NONE = 0, | 991 ENCRYPTION_NONE = 0, |
| 994 ENCRYPTION_INITIAL = 1, | 992 ENCRYPTION_INITIAL = 1, |
| 995 ENCRYPTION_FORWARD_SECURE = 2, | 993 ENCRYPTION_FORWARD_SECURE = 2, |
| 996 | 994 |
| 997 NUM_ENCRYPTION_LEVELS, | 995 NUM_ENCRYPTION_LEVELS, |
| 998 }; | 996 }; |
| 999 | 997 |
| 1000 struct NET_EXPORT_PRIVATE QuicFrame { | 998 struct NET_EXPORT_PRIVATE QuicFrame { |
| 1001 QuicFrame(); | 999 QuicFrame(); |
| 1002 explicit QuicFrame(QuicPaddingFrame* padding_frame); | 1000 explicit QuicFrame(QuicPaddingFrame padding_frame); |
| 1001 explicit QuicFrame(QuicMtuDiscoveryFrame frame); |
| 1002 explicit QuicFrame(QuicPingFrame frame); |
| 1003 explicit QuicFrame(QuicBlockedFrame frame); |
| 1004 |
| 1003 explicit QuicFrame(QuicStreamFrame* stream_frame); | 1005 explicit QuicFrame(QuicStreamFrame* stream_frame); |
| 1004 explicit QuicFrame(QuicAckFrame* frame); | 1006 explicit QuicFrame(QuicAckFrame* frame); |
| 1005 explicit QuicFrame(QuicMtuDiscoveryFrame* frame); | |
| 1006 | |
| 1007 explicit QuicFrame(QuicRstStreamFrame* frame); | 1007 explicit QuicFrame(QuicRstStreamFrame* frame); |
| 1008 explicit QuicFrame(QuicConnectionCloseFrame* frame); | 1008 explicit QuicFrame(QuicConnectionCloseFrame* frame); |
| 1009 explicit QuicFrame(QuicStopWaitingFrame* frame); | 1009 explicit QuicFrame(QuicStopWaitingFrame* frame); |
| 1010 explicit QuicFrame(QuicPingFrame* frame); | |
| 1011 explicit QuicFrame(QuicGoAwayFrame* frame); | 1010 explicit QuicFrame(QuicGoAwayFrame* frame); |
| 1012 explicit QuicFrame(QuicWindowUpdateFrame* frame); | 1011 explicit QuicFrame(QuicWindowUpdateFrame* frame); |
| 1013 explicit QuicFrame(QuicBlockedFrame* frame); | |
| 1014 | 1012 |
| 1015 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 1013 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 1016 std::ostream& os, const QuicFrame& frame); | 1014 std::ostream& os, const QuicFrame& frame); |
| 1017 | 1015 |
| 1018 QuicFrameType type; | 1016 QuicFrameType type; |
| 1019 union { | 1017 union { |
| 1020 QuicPaddingFrame* padding_frame; | 1018 // Frames smaller than a pointer are inline. |
| 1019 QuicPaddingFrame padding_frame; |
| 1020 QuicMtuDiscoveryFrame mtu_discovery_frame; |
| 1021 QuicPingFrame ping_frame; |
| 1022 QuicBlockedFrame blocked_frame; |
| 1023 |
| 1024 // Frames larger than a pointer. |
| 1021 QuicStreamFrame* stream_frame; | 1025 QuicStreamFrame* stream_frame; |
| 1022 QuicAckFrame* ack_frame; | 1026 QuicAckFrame* ack_frame; |
| 1023 QuicMtuDiscoveryFrame* mtu_discovery_frame; | |
| 1024 | |
| 1025 QuicStopWaitingFrame* stop_waiting_frame; | 1027 QuicStopWaitingFrame* stop_waiting_frame; |
| 1026 | |
| 1027 QuicPingFrame* ping_frame; | |
| 1028 QuicRstStreamFrame* rst_stream_frame; | 1028 QuicRstStreamFrame* rst_stream_frame; |
| 1029 QuicConnectionCloseFrame* connection_close_frame; | 1029 QuicConnectionCloseFrame* connection_close_frame; |
| 1030 QuicGoAwayFrame* goaway_frame; | 1030 QuicGoAwayFrame* goaway_frame; |
| 1031 QuicWindowUpdateFrame* window_update_frame; | 1031 QuicWindowUpdateFrame* window_update_frame; |
| 1032 QuicBlockedFrame* blocked_frame; | |
| 1033 }; | 1032 }; |
| 1034 }; | 1033 }; |
| 1034 // QuicFrameType consumes 8 bytes with padding. |
| 1035 static_assert(sizeof(QuicFrame) <= 16, |
| 1036 "Frames larger than 8 bytes should be referenced by pointer."); |
| 1035 | 1037 |
| 1036 typedef std::vector<QuicFrame> QuicFrames; | 1038 typedef std::vector<QuicFrame> QuicFrames; |
| 1037 | 1039 |
| 1038 struct NET_EXPORT_PRIVATE QuicFecData { | 1040 struct NET_EXPORT_PRIVATE QuicFecData { |
| 1039 QuicFecData(); | 1041 QuicFecData(); |
| 1040 | 1042 |
| 1041 // The FEC group number is also the packet number of the first | 1043 // The FEC group number is also the packet number of the first |
| 1042 // FEC protected packet. The last protected packet's packet number will | 1044 // FEC protected packet. The last protected packet's packet number will |
| 1043 // be one less than the packet number of the FEC packet. | 1045 // be one less than the packet number of the FEC packet. |
| 1044 QuicFecGroupNumber fec_group; | 1046 QuicFecGroupNumber fec_group; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1215 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
| 1214 | 1216 |
| 1215 const struct iovec* iov; | 1217 const struct iovec* iov; |
| 1216 const int iov_count; | 1218 const int iov_count; |
| 1217 const size_t total_length; | 1219 const size_t total_length; |
| 1218 }; | 1220 }; |
| 1219 | 1221 |
| 1220 } // namespace net | 1222 } // namespace net |
| 1221 | 1223 |
| 1222 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1224 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |