| 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 #include "net/quic/test_tools/quic_connection_peer.h" | 5 #include "net/quic/test_tools/quic_connection_peer.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/congestion_control/send_algorithm_interface.h" | 8 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
| 10 #include "net/quic/quic_packet_writer.h" | 10 #include "net/quic/quic_packet_writer.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return &connection->packet_generator_; | 60 return &connection->packet_generator_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( | 64 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( |
| 65 QuicConnection* connection) { | 65 QuicConnection* connection) { |
| 66 return &connection->sent_packet_manager_; | 66 return &connection->sent_packet_manager_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 QuicReceivedPacketManager* QuicConnectionPeer::GetReceivedPacketManager( | |
| 71 QuicConnection* connection) { | |
| 72 return &connection->received_packet_manager_; | |
| 73 } | |
| 74 | |
| 75 // static | |
| 76 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( | 70 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( |
| 77 QuicConnection* connection) { | 71 QuicConnection* connection) { |
| 78 return connection->idle_network_timeout_; | 72 return connection->idle_network_timeout_; |
| 79 } | 73 } |
| 80 | 74 |
| 81 // static | 75 // static |
| 82 bool QuicConnectionPeer::IsSavedForRetransmission( | |
| 83 QuicConnection* connection, | |
| 84 QuicPacketSequenceNumber sequence_number) { | |
| 85 return connection->sent_packet_manager_.IsUnacked(sequence_number) && | |
| 86 connection->sent_packet_manager_.HasRetransmittableFrames( | |
| 87 sequence_number); | |
| 88 } | |
| 89 | |
| 90 // static | |
| 91 bool QuicConnectionPeer::IsRetransmission( | |
| 92 QuicConnection* connection, | |
| 93 QuicPacketSequenceNumber sequence_number) { | |
| 94 return QuicSentPacketManagerPeer::IsRetransmission( | |
| 95 &connection->sent_packet_manager_, sequence_number); | |
| 96 } | |
| 97 | |
| 98 // static | |
| 99 // TODO(ianswett): Create a GetSentEntropyHash which accepts an AckFrame. | 76 // TODO(ianswett): Create a GetSentEntropyHash which accepts an AckFrame. |
| 100 QuicPacketEntropyHash QuicConnectionPeer::GetSentEntropyHash( | 77 QuicPacketEntropyHash QuicConnectionPeer::GetSentEntropyHash( |
| 101 QuicConnection* connection, | 78 QuicConnection* connection, |
| 102 QuicPacketSequenceNumber sequence_number) { | 79 QuicPacketSequenceNumber sequence_number) { |
| 103 QuicSentEntropyManager::CumulativeEntropy last_entropy_copy = | 80 QuicSentEntropyManager::CumulativeEntropy last_entropy_copy = |
| 104 connection->sent_entropy_manager_.last_cumulative_entropy_; | 81 connection->sent_entropy_manager_.last_cumulative_entropy_; |
| 105 connection->sent_entropy_manager_.UpdateCumulativeEntropy(sequence_number, | 82 connection->sent_entropy_manager_.UpdateCumulativeEntropy(sequence_number, |
| 106 &last_entropy_copy); | 83 &last_entropy_copy); |
| 107 return last_entropy_copy.entropy; | 84 return last_entropy_copy.entropy; |
| 108 } | 85 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 connection->connected_ = false; | 210 connection->connected_ = false; |
| 234 } | 211 } |
| 235 | 212 |
| 236 // static | 213 // static |
| 237 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( | 214 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( |
| 238 QuicConnection* connection) { | 215 QuicConnection* connection) { |
| 239 return connection->connection_close_packet_.get(); | 216 return connection->connection_close_packet_.get(); |
| 240 } | 217 } |
| 241 | 218 |
| 242 // static | 219 // static |
| 243 void QuicConnectionPeer::SetSupportedVersions(QuicConnection* connection, | |
| 244 QuicVersionVector versions) { | |
| 245 connection->framer_.SetSupportedVersions(versions); | |
| 246 } | |
| 247 | |
| 248 // static | |
| 249 QuicPacketHeader* QuicConnectionPeer::GetLastHeader( | 220 QuicPacketHeader* QuicConnectionPeer::GetLastHeader( |
| 250 QuicConnection* connection) { | 221 QuicConnection* connection) { |
| 251 return &connection->last_header_; | 222 return &connection->last_header_; |
| 252 } | 223 } |
| 253 | 224 |
| 254 // static | 225 // static |
| 255 void QuicConnectionPeer::SetSequenceNumberOfLastSentPacket( | 226 void QuicConnectionPeer::SetSequenceNumberOfLastSentPacket( |
| 256 QuicConnection* connection, QuicPacketSequenceNumber number) { | 227 QuicConnection* connection, QuicPacketSequenceNumber number) { |
| 257 connection->sequence_number_of_last_sent_packet_ = number; | 228 connection->sequence_number_of_last_sent_packet_ = number; |
| 258 } | 229 } |
| 259 | 230 |
| 260 // static | 231 // static |
| 261 QuicConnectionStats* QuicConnectionPeer::GetStats(QuicConnection* connection) { | 232 QuicConnectionStats* QuicConnectionPeer::GetStats(QuicConnection* connection) { |
| 262 return &connection->stats_; | 233 return &connection->stats_; |
| 263 } | 234 } |
| 264 | 235 |
| 265 } // namespace test | 236 } // namespace test |
| 266 } // namespace net | 237 } // namespace net |
| OLD | NEW |