• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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_TOOLS_FLIP_SERVER_FLIP_CONFIG_H_
6 #define NET_TOOLS_FLIP_SERVER_FLIP_CONFIG_H_
7 
8 #include <arpa/inet.h>
9 
10 #include <string>
11 #include <vector>
12 
13 #include "base/logging.h"
14 #include "net/tools/flip_server/create_listener.h"
15 
16 namespace net {
17 
18 enum FlipHandlerType {
19   FLIP_HANDLER_PROXY,
20   FLIP_HANDLER_SPDY_SERVER,
21   FLIP_HANDLER_HTTP_SERVER
22 };
23 
24 class FlipAcceptor {
25  public:
26   FlipAcceptor(enum FlipHandlerType flip_handler_type,
27                std::string listen_ip,
28                std::string listen_port,
29                std::string ssl_cert_filename,
30                std::string ssl_key_filename,
31                std::string http_server_ip,
32                std::string http_server_port,
33                std::string https_server_ip,
34                std::string https_server_port,
35                int spdy_only,
36                int accept_backlog_size,
37                bool disable_nagle,
38                int accepts_per_wake,
39                bool reuseport,
40                bool wait_for_iface,
41                void* memory_cache);
42   ~FlipAcceptor();
43 
44   enum FlipHandlerType flip_handler_type_;
45   std::string listen_ip_;
46   std::string listen_port_;
47   std::string ssl_cert_filename_;
48   std::string ssl_key_filename_;
49   std::string http_server_ip_;
50   std::string http_server_port_;
51   std::string https_server_ip_;
52   std::string https_server_port_;
53   int spdy_only_;
54   int accept_backlog_size_;
55   bool disable_nagle_;
56   int accepts_per_wake_;
57   int listen_fd_;
58   void* memory_cache_;
59   int ssl_session_expiry_;
60   bool ssl_disable_compression_;
61   int idle_socket_timeout_s_;
62 };
63 
64 class FlipConfig {
65  public:
66   FlipConfig();
67   ~FlipConfig();
68 
69   void AddAcceptor(enum FlipHandlerType flip_handler_type,
70                    std::string listen_ip,
71                    std::string listen_port,
72                    std::string ssl_cert_filename,
73                    std::string ssl_key_filename,
74                    std::string http_server_ip,
75                    std::string http_server_port,
76                    std::string https_server_ip,
77                    std::string https_server_port,
78                    int spdy_only,
79                    int accept_backlog_size,
80                    bool disable_nagle,
81                    int accepts_per_wake,
82                    bool reuseport,
83                    bool wait_for_iface,
84                    void* memory_cache);
85 
86   std::vector<FlipAcceptor*> acceptors_;
87   double server_think_time_in_s_;
88   enum logging::LoggingDestination log_destination_;
89   std::string log_filename_;
90   bool wait_for_iface_;
91   int ssl_session_expiry_;
92   bool ssl_disable_compression_;
93   int idle_socket_timeout_s_;
94 };
95 
96 }  // namespace net
97 
98 #endif  // NET_TOOLS_FLIP_SERVER_FLIP_CONFIG_H_
99