xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/tools/quic_server_bin.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 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 binary wrapper for QuicServer.  It listens forever on --port
6 // (default 6121) until it's killed or ctrl-cd to death.
7 
8 #include <vector>
9 
10 #include "quiche/quic/tools/quic_server_factory.h"
11 #include "quiche/quic/tools/quic_toy_server.h"
12 #include "quiche/common/platform/api/quiche_command_line_flags.h"
13 #include "quiche/common/platform/api/quiche_system_event_loop.h"
14 
main(int argc,char * argv[])15 int main(int argc, char* argv[]) {
16   quiche::QuicheSystemEventLoop event_loop("quic_server");
17   const char* usage = "Usage: quic_server [options]";
18   std::vector<std::string> non_option_args =
19       quiche::QuicheParseCommandLineFlags(usage, argc, argv);
20   if (!non_option_args.empty()) {
21     quiche::QuichePrintCommandLineFlagHelp(usage);
22     exit(0);
23   }
24 
25   quic::QuicToyServer::MemoryCacheBackendFactory backend_factory;
26   quic::QuicServerFactory server_factory;
27   quic::QuicToyServer server(&backend_factory, &server_factory);
28   return server.Start();
29 }
30