Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / quic / test_tools / quic_connection_peer.h
blobd7bfe44486a1e7bc25771351b39174d4f0fecf77
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.
5 #ifndef NET_QUIC_TEST_TOOLS_QUIC_CONNECTION_PEER_H_
6 #define NET_QUIC_TEST_TOOLS_QUIC_CONNECTION_PEER_H_
8 #include "base/basictypes.h"
9 #include "net/base/ip_endpoint.h"
10 #include "net/quic/quic_connection_stats.h"
11 #include "net/quic/quic_protocol.h"
13 namespace net {
15 struct QuicAckFrame;
16 struct QuicPacketHeader;
17 class QuicAlarm;
18 class QuicConnection;
19 class QuicConnectionHelperInterface;
20 class QuicConnectionVisitorInterface;
21 class QuicEncryptedPacket;
22 class QuicFecGroup;
23 class QuicFramer;
24 class QuicPacketCreator;
25 class QuicPacketGenerator;
26 class QuicPacketWriter;
27 class QuicReceivedPacketManager;
28 class QuicSentPacketManager;
29 class SendAlgorithmInterface;
31 namespace test {
33 // Peer to make public a number of otherwise private QuicConnection methods.
34 class QuicConnectionPeer {
35 public:
36 static void SendAck(QuicConnection* connection);
38 static void SetSendAlgorithm(QuicConnection* connection,
39 SendAlgorithmInterface* send_algorithm);
41 static void PopulateAckFrame(QuicConnection* connection, QuicAckFrame* ack);
43 static void PopulateStopWaitingFrame(QuicConnection* connection,
44 QuicStopWaitingFrame* stop_waiting);
46 static QuicConnectionVisitorInterface* GetVisitor(
47 QuicConnection* connection);
49 static QuicPacketCreator* GetPacketCreator(QuicConnection* connection);
51 static QuicPacketGenerator* GetPacketGenerator(QuicConnection* connection);
53 static QuicSentPacketManager* GetSentPacketManager(
54 QuicConnection* connection);
56 static QuicTime::Delta GetNetworkTimeout(QuicConnection* connection);
58 static QuicPacketEntropyHash GetSentEntropyHash(
59 QuicConnection* connection,
60 QuicPacketNumber packet_number);
62 static QuicPacketEntropyHash PacketEntropy(QuicConnection* connection,
63 QuicPacketNumber packet_number);
65 static QuicPacketEntropyHash ReceivedEntropyHash(
66 QuicConnection* connection,
67 QuicPacketNumber packet_number);
69 static void SetPerspective(QuicConnection* connection,
70 Perspective perspective);
72 static void SetSelfAddress(QuicConnection* connection,
73 const IPEndPoint& self_address);
75 static void SetPeerAddress(QuicConnection* connection,
76 const IPEndPoint& peer_address);
78 static bool IsSilentCloseEnabled(QuicConnection* connection);
80 static void SwapCrypters(QuicConnection* connection, QuicFramer* framer);
82 static QuicConnectionHelperInterface* GetHelper(QuicConnection* connection);
84 static QuicFramer* GetFramer(QuicConnection* connection);
86 // Set last_header_->fec_group = fec_group and return connection->GetFecGroup
87 static QuicFecGroup* GetFecGroup(QuicConnection* connection, int fec_group);
89 static QuicAlarm* GetAckAlarm(QuicConnection* connection);
90 static QuicAlarm* GetPingAlarm(QuicConnection* connection);
91 static QuicAlarm* GetFecAlarm(QuicConnection* connection);
92 static QuicAlarm* GetResumeWritesAlarm(QuicConnection* connection);
93 static QuicAlarm* GetRetransmissionAlarm(QuicConnection* connection);
94 static QuicAlarm* GetSendAlarm(QuicConnection* connection);
95 static QuicAlarm* GetTimeoutAlarm(QuicConnection* connection);
96 static QuicAlarm* GetMtuDiscoveryAlarm(QuicConnection* connection);
98 static QuicPacketWriter* GetWriter(QuicConnection* connection);
99 // If |owns_writer| is true, takes ownership of |writer|.
100 static void SetWriter(QuicConnection* connection,
101 QuicPacketWriter* writer,
102 bool owns_writer);
103 static void CloseConnection(QuicConnection* connection);
104 static QuicEncryptedPacket* GetConnectionClosePacket(
105 QuicConnection* connection);
107 static QuicPacketHeader* GetLastHeader(QuicConnection* connection);
109 static void SetPacketNumberOfLastSentPacket(QuicConnection* connection,
110 QuicPacketNumber number);
112 static QuicConnectionStats* GetStats(QuicConnection* connection);
114 static QuicPacketCount GetPacketsBetweenMtuProbes(QuicConnection* connection);
116 static void SetPacketsBetweenMtuProbes(QuicConnection* connection,
117 QuicPacketCount packets);
118 static void SetNextMtuProbeAt(QuicConnection* connection,
119 QuicPacketNumber number);
121 private:
122 DISALLOW_COPY_AND_ASSIGN(QuicConnectionPeer);
125 } // namespace test
127 } // namespace net
129 #endif // NET_QUIC_TEST_TOOLS_QUIC_CONNECTION_PEER_H_