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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 // Zero when the packet is serialized, non-zero once it's sent. | 1039 // Zero when the packet is serialized, non-zero once it's sent. |
1040 QuicByteCount bytes_sent; | 1040 QuicByteCount bytes_sent; |
1041 size_t nack_count; | 1041 size_t nack_count; |
1042 // Stores the sequence numbers of all transmissions of this packet. | 1042 // Stores the sequence numbers of all transmissions of this packet. |
1043 // Can never be null. | 1043 // Can never be null. |
1044 SequenceNumberSet* all_transmissions; | 1044 SequenceNumberSet* all_transmissions; |
1045 // In flight packets have not been abandoned or lost. | 1045 // In flight packets have not been abandoned or lost. |
1046 bool in_flight; | 1046 bool in_flight; |
1047 }; | 1047 }; |
1048 | 1048 |
1049 // A struct for functions which consume data payloads and fins. | |
1050 struct NET_EXPORT_PRIVATE QuicConsumedData { | |
1051 QuicConsumedData(size_t bytes_consumed, bool fin_consumed); | |
1052 | |
1053 // By default, gtest prints the raw bytes of an object. The bool data | |
1054 // member causes this object to have padding bytes, which causes the | |
1055 // default gtest object printer to read uninitialize memory. So we need | |
1056 // to teach gtest how to print this object. | |
1057 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | |
1058 std::ostream& os, const QuicConsumedData& s); | |
1059 | |
1060 // How many bytes were consumed. | |
1061 size_t bytes_consumed; | |
1062 | |
1063 // True if an incoming fin was consumed. | |
1064 bool fin_consumed; | |
1065 }; | |
1066 | |
1067 enum WriteStatus { | |
1068 WRITE_STATUS_OK, | |
1069 WRITE_STATUS_BLOCKED, | |
1070 WRITE_STATUS_ERROR, | |
1071 }; | |
1072 | |
1073 // A struct used to return the result of write calls including either the number | |
1074 // of bytes written or the error code, depending upon the status. | |
1075 struct NET_EXPORT_PRIVATE WriteResult { | |
1076 WriteResult(WriteStatus status, int bytes_written_or_error_code); | |
1077 WriteResult(); | |
1078 | |
1079 WriteStatus status; | |
1080 union { | |
1081 int bytes_written; // only valid when status is OK | |
1082 int error_code; // only valid when status is ERROR | |
1083 }; | |
1084 }; | |
1085 | |
1086 } // namespace net | 1049 } // namespace net |
1087 | 1050 |
1088 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1051 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |