[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef NET_QUIC_TEST_TOOLS_QUIC_CONNECTION_PEER_H_ |
| 6 | #define NET_QUIC_TEST_TOOLS_QUIC_CONNECTION_PEER_H_ |
| 7 | |
| 8 | #include "base/basictypes.h" |
[email protected] | 4e49b6a | 2013-06-18 16:39:28 | [diff] [blame] | 9 | #include "net/base/ip_endpoint.h" |
[email protected] | 54612dc | 2013-08-17 00:46:42 | [diff] [blame] | 10 | #include "net/quic/quic_connection_stats.h" |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 11 | #include "net/quic/quic_protocol.h" |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 12 | |
| 13 | namespace net { |
| 14 | |
| 15 | struct QuicAckFrame; |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 16 | struct QuicPacketHeader; |
[email protected] | 965dbe6 | 2013-08-09 21:34:31 | [diff] [blame] | 17 | class QuicAlarm; |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 18 | class QuicConnection; |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 19 | class QuicConnectionHelperInterface; |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 20 | class QuicConnectionVisitorInterface; |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 21 | class QuicFecGroup; |
[email protected] | 2532de1 | 2013-05-09 12:29:33 | [diff] [blame] | 22 | class QuicFramer; |
[email protected] | c995c57 | 2013-01-18 05:43:20 | [diff] [blame] | 23 | class QuicPacketCreator; |
[email protected] | cbd731e | 2013-10-24 00:20:39 | [diff] [blame] | 24 | class QuicPacketWriter; |
[email protected] | e6ccc1a6 | 2013-12-02 07:02:12 | [diff] [blame] | 25 | class QuicReceivedPacketManager; |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 26 | class ReceiveAlgorithmInterface; |
| 27 | class SendAlgorithmInterface; |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 28 | |
| 29 | namespace test { |
| 30 | |
[email protected] | cbd731e | 2013-10-24 00:20:39 | [diff] [blame] | 31 | class QuicTestWriter; |
| 32 | |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 33 | // Peer to make public a number of otherwise private QuicConnection methods. |
| 34 | class QuicConnectionPeer { |
| 35 | public: |
| 36 | static void SendAck(QuicConnection* connection); |
| 37 | |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 38 | static void SetReceiveAlgorithm(QuicConnection* connection, |
| 39 | ReceiveAlgorithmInterface* receive_algorithm); |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 40 | |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 41 | static void SetSendAlgorithm(QuicConnection* connection, |
| 42 | SendAlgorithmInterface* send_algorithm); |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 43 | |
[email protected] | 3e60db8 | 2013-08-05 19:43:06 | [diff] [blame] | 44 | static QuicAckFrame* CreateAckFrame(QuicConnection* connection); |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 45 | |
| 46 | static QuicConnectionVisitorInterface* GetVisitor( |
| 47 | QuicConnection* connection); |
| 48 | |
[email protected] | c995c57 | 2013-01-18 05:43:20 | [diff] [blame] | 49 | static QuicPacketCreator* GetPacketCreator(QuicConnection* connection); |
| 50 | |
[email protected] | e6ccc1a6 | 2013-12-02 07:02:12 | [diff] [blame] | 51 | static QuicReceivedPacketManager* GetReceivedPacketManager( |
| 52 | QuicConnection* connection); |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 53 | |
[email protected] | b06431078 | 2013-05-30 21:12:17 | [diff] [blame] | 54 | static QuicTime::Delta GetNetworkTimeout(QuicConnection* connection); |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 55 | |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 56 | static bool IsSavedForRetransmission( |
| 57 | QuicConnection* connection, |
| 58 | QuicPacketSequenceNumber sequence_number); |
| 59 | |
[email protected] | 0ac0c5b | 2013-11-20 05:55:58 | [diff] [blame] | 60 | static bool IsRetransmission(QuicConnection* connection, |
| 61 | QuicPacketSequenceNumber sequence_number); |
[email protected] | fee17f7 | 2013-02-03 07:47:41 | [diff] [blame] | 62 | |
[email protected] | 9db44391 | 2013-02-25 05:27:03 | [diff] [blame] | 63 | static QuicPacketEntropyHash GetSentEntropyHash( |
| 64 | QuicConnection* connection, |
| 65 | QuicPacketSequenceNumber sequence_number); |
| 66 | |
| 67 | static bool IsValidEntropy(QuicConnection* connection, |
| 68 | QuicPacketSequenceNumber largest_observed, |
| 69 | const SequenceNumberSet& missing_packets, |
| 70 | QuicPacketEntropyHash entropy_hash); |
| 71 | |
| 72 | static QuicPacketEntropyHash ReceivedEntropyHash( |
| 73 | QuicConnection* connection, |
| 74 | QuicPacketSequenceNumber sequence_number); |
| 75 | |
[email protected] | 0741d71 | 2013-10-08 00:10:11 | [diff] [blame] | 76 | static bool IsWriteBlocked(QuicConnection* connection); |
| 77 | |
| 78 | static void SetIsWriteBlocked(QuicConnection* connection, bool write_blocked); |
| 79 | |
[email protected] | 14e8106c | 2013-03-14 16:25:33 | [diff] [blame] | 80 | static bool IsServer(QuicConnection* connection); |
| 81 | |
| 82 | static void SetIsServer(QuicConnection* connection, bool is_server); |
| 83 | |
[email protected] | 4e49b6a | 2013-06-18 16:39:28 | [diff] [blame] | 84 | static void SetSelfAddress(QuicConnection* connection, |
| 85 | const IPEndPoint& self_address); |
| 86 | |
[email protected] | 97cf302 | 2013-09-05 14:30:16 | [diff] [blame] | 87 | static void SetPeerAddress(QuicConnection* connection, |
| 88 | const IPEndPoint& peer_address); |
| 89 | |
[email protected] | 2532de1 | 2013-05-09 12:29:33 | [diff] [blame] | 90 | static void SwapCrypters(QuicConnection* connection, QuicFramer* framer); |
| 91 | |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 92 | static QuicConnectionHelperInterface* GetHelper(QuicConnection* connection); |
| 93 | |
[email protected] | ec64011 | 2013-08-09 03:56:18 | [diff] [blame] | 94 | static QuicFramer* GetFramer(QuicConnection* connection); |
| 95 | |
[email protected] | 89995165 | 2013-05-16 12:52:39 | [diff] [blame] | 96 | // Set last_header_->fec_group = fec_group and return connection->GetFecGroup |
| 97 | static QuicFecGroup* GetFecGroup(QuicConnection* connection, int fec_group); |
| 98 | |
[email protected] | 965dbe6 | 2013-08-09 21:34:31 | [diff] [blame] | 99 | static QuicAlarm* GetAckAlarm(QuicConnection* connection); |
| 100 | static QuicAlarm* GetRetransmissionAlarm(QuicConnection* connection); |
[email protected] | d89f186 | 2013-11-26 21:21:27 | [diff] [blame] | 101 | static QuicAlarm* GetAbandonFecAlarm(QuicConnection* connection); |
[email protected] | 965dbe6 | 2013-08-09 21:34:31 | [diff] [blame] | 102 | static QuicAlarm* GetSendAlarm(QuicConnection* connection); |
[email protected] | 0741d71 | 2013-10-08 00:10:11 | [diff] [blame] | 103 | static QuicAlarm* GetResumeWritesAlarm(QuicConnection* connection); |
[email protected] | 965dbe6 | 2013-08-09 21:34:31 | [diff] [blame] | 104 | static QuicAlarm* GetTimeoutAlarm(QuicConnection* connection); |
| 105 | |
[email protected] | cbd731e | 2013-10-24 00:20:39 | [diff] [blame] | 106 | static QuicPacketWriter* GetWriter(QuicConnection* connection); |
| 107 | static void SetWriter(QuicConnection* connection, QuicTestWriter* writer); |
| 108 | |
[email protected] | b1f287d | 2012-12-22 17:25:39 | [diff] [blame] | 109 | private: |
| 110 | DISALLOW_COPY_AND_ASSIGN(QuicConnectionPeer); |
| 111 | }; |
| 112 | |
| 113 | } // namespace test |
| 114 | } // namespace net |
| 115 | |
| 116 | #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PEER_H_ |