| 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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 // uninitialize memory. So we need to teach gtest how to print this object. | 1127 // uninitialize memory. So we need to teach gtest how to print this object. |
| 1128 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 1128 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 1129 std::ostream& os, const QuicEncryptedPacket& s); | 1129 std::ostream& os, const QuicEncryptedPacket& s); |
| 1130 | 1130 |
| 1131 private: | 1131 private: |
| 1132 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 1132 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
| 1133 }; | 1133 }; |
| 1134 | 1134 |
| 1135 class NET_EXPORT_PRIVATE RetransmittableFrames { | 1135 class NET_EXPORT_PRIVATE RetransmittableFrames { |
| 1136 public: | 1136 public: |
| 1137 explicit RetransmittableFrames(EncryptionLevel level); | 1137 RetransmittableFrames(); |
| 1138 ~RetransmittableFrames(); | 1138 ~RetransmittableFrames(); |
| 1139 | 1139 |
| 1140 // Takes ownership of the frame inside |frame|. | 1140 // Takes ownership of the frame inside |frame|. |
| 1141 const QuicFrame& AddFrame(const QuicFrame& frame); | 1141 const QuicFrame& AddFrame(const QuicFrame& frame); |
| 1142 // Takes ownership of the frame inside |frame| and |buffer|. | 1142 // Takes ownership of the frame inside |frame| and |buffer|. |
| 1143 const QuicFrame& AddFrame(const QuicFrame& frame, UniqueStreamBuffer buffer); | 1143 const QuicFrame& AddFrame(const QuicFrame& frame, UniqueStreamBuffer buffer); |
| 1144 // Removes all stream frames associated with |stream_id|. | 1144 // Removes all stream frames associated with |stream_id|. |
| 1145 void RemoveFramesForStream(QuicStreamId stream_id); | 1145 void RemoveFramesForStream(QuicStreamId stream_id); |
| 1146 | 1146 |
| 1147 const QuicFrames& frames() const { return frames_; } | 1147 const QuicFrames& frames() const { return frames_; } |
| 1148 | 1148 |
| 1149 IsHandshake HasCryptoHandshake() const { | 1149 IsHandshake HasCryptoHandshake() const { |
| 1150 return has_crypto_handshake_; | 1150 return has_crypto_handshake_; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 EncryptionLevel encryption_level() const { | |
| 1154 return encryption_level_; | |
| 1155 } | |
| 1156 | |
| 1157 bool needs_padding() const { return needs_padding_; } | 1153 bool needs_padding() const { return needs_padding_; } |
| 1158 | 1154 |
| 1159 void set_needs_padding(bool needs_padding) { needs_padding_ = needs_padding; } | 1155 void set_needs_padding(bool needs_padding) { needs_padding_ = needs_padding; } |
| 1160 | 1156 |
| 1161 private: | 1157 private: |
| 1162 QuicFrames frames_; | 1158 QuicFrames frames_; |
| 1163 const EncryptionLevel encryption_level_; | |
| 1164 IsHandshake has_crypto_handshake_; | 1159 IsHandshake has_crypto_handshake_; |
| 1165 bool needs_padding_; | 1160 bool needs_padding_; |
| 1166 // Data referenced by the StringPiece of a QuicStreamFrame. | 1161 // Data referenced by the StringPiece of a QuicStreamFrame. |
| 1167 // | 1162 // |
| 1168 // TODO(rtenneti): Change const char* to UniqueStreamBuffer once chrome has | 1163 // TODO(rtenneti): Change const char* to UniqueStreamBuffer once chrome has |
| 1169 // c++11 library support. | 1164 // c++11 library support. |
| 1170 // std::vector<UniqueStreamBuffer> stream_data_; | 1165 // std::vector<UniqueStreamBuffer> stream_data_; |
| 1171 std::vector<const char*> stream_data_; | 1166 std::vector<const char*> stream_data_; |
| 1172 | 1167 |
| 1173 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames); | 1168 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 std::list<AckListenerWrapper> listeners; | 1211 std::list<AckListenerWrapper> listeners; |
| 1217 }; | 1212 }; |
| 1218 | 1213 |
| 1219 struct NET_EXPORT_PRIVATE TransmissionInfo { | 1214 struct NET_EXPORT_PRIVATE TransmissionInfo { |
| 1220 // Used by STL when assigning into a map. | 1215 // Used by STL when assigning into a map. |
| 1221 TransmissionInfo(); | 1216 TransmissionInfo(); |
| 1222 | 1217 |
| 1223 // Constructs a Transmission with a new all_tranmissions set | 1218 // Constructs a Transmission with a new all_tranmissions set |
| 1224 // containing |packet_number|. | 1219 // containing |packet_number|. |
| 1225 TransmissionInfo(RetransmittableFrames* retransmittable_frames, | 1220 TransmissionInfo(RetransmittableFrames* retransmittable_frames, |
| 1221 EncryptionLevel level, |
| 1226 QuicPacketNumberLength packet_number_length, | 1222 QuicPacketNumberLength packet_number_length, |
| 1227 TransmissionType transmission_type, | 1223 TransmissionType transmission_type, |
| 1228 QuicTime sent_time, | 1224 QuicTime sent_time, |
| 1229 QuicPacketLength bytes_sent, | 1225 QuicPacketLength bytes_sent, |
| 1230 bool is_fec_packet); | 1226 bool is_fec_packet); |
| 1231 | 1227 |
| 1232 ~TransmissionInfo(); | 1228 ~TransmissionInfo(); |
| 1233 | 1229 |
| 1234 RetransmittableFrames* retransmittable_frames; | 1230 RetransmittableFrames* retransmittable_frames; |
| 1231 EncryptionLevel encryption_level; |
| 1235 QuicPacketNumberLength packet_number_length; | 1232 QuicPacketNumberLength packet_number_length; |
| 1236 QuicPacketLength bytes_sent; | 1233 QuicPacketLength bytes_sent; |
| 1237 uint16 nack_count; | 1234 uint16 nack_count; |
| 1238 QuicTime sent_time; | 1235 QuicTime sent_time; |
| 1239 // Reason why this packet was transmitted. | 1236 // Reason why this packet was transmitted. |
| 1240 TransmissionType transmission_type; | 1237 TransmissionType transmission_type; |
| 1241 // In flight packets have not been abandoned or lost. | 1238 // In flight packets have not been abandoned or lost. |
| 1242 bool in_flight; | 1239 bool in_flight; |
| 1243 // True if the packet can never be acked, so it can be removed. | 1240 // True if the packet can never be acked, so it can be removed. |
| 1244 bool is_unackable; | 1241 bool is_unackable; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1264 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1261 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
| 1265 | 1262 |
| 1266 const struct iovec* iov; | 1263 const struct iovec* iov; |
| 1267 const int iov_count; | 1264 const int iov_count; |
| 1268 const size_t total_length; | 1265 const size_t total_length; |
| 1269 }; | 1266 }; |
| 1270 | 1267 |
| 1271 } // namespace net | 1268 } // namespace net |
| 1272 | 1269 |
| 1273 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1270 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |