xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/tools/quic_toy_client.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 // A toy client, which connects to a specified port and sends QUIC
6 // requests to that endpoint.
7 
8 #ifndef QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_
9 #define QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_
10 
11 #include "quiche/quic/tools/quic_client_factory.h"
12 
13 namespace quic {
14 
15 class QuicToyClient {
16  public:
17   // Constructs a new toy client that will use |client_factory| to create the
18   // actual QuicSpdyClientBase instance.
19   QuicToyClient(ClientFactoryInterface* client_factory);
20 
21   // Connects to the QUIC server based on the various flags defined in the
22   // .cc file, sends requests and prints the responses. Returns 0 on success
23   // and non-zero otherwise.
24   int SendRequestsAndPrintResponses(std::vector<std::string> urls);
25 
26   // Compatibility alias
27   using ClientFactory = ClientFactoryInterface;
28 
29  private:
30   ClientFactoryInterface* client_factory_;  // Unowned.
31 };
32 
33 }  // namespace quic
34 
35 #endif  // QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_
36