summaryrefslogtreecommitdiff
path: root/chromium/net/tools/flip_server/flip_config.h
blob: 454c4bf64698564cbc442f6252810cbc3647f067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_TOOLS_FLIP_PROXY_CONFIG_H
#define NET_TOOLS_FLIP_PROXY_CONFIG_H

#include <arpa/inet.h>  // in_addr_t

#include <string>
#include <vector>

#include "base/logging.h"
#include "net/tools/flip_server/create_listener.h"

namespace net {

enum FlipHandlerType {
    FLIP_HANDLER_PROXY,
    FLIP_HANDLER_SPDY_SERVER,
    FLIP_HANDLER_HTTP_SERVER
};

class FlipAcceptor {
 public:
  FlipAcceptor(enum FlipHandlerType flip_handler_type,
               std::string listen_ip,
               std::string listen_port,
               std::string ssl_cert_filename,
               std::string ssl_key_filename,
               std::string http_server_ip,
               std::string http_server_port,
               std::string https_server_ip,
               std::string https_server_port,
               int spdy_only,
               int accept_backlog_size,
               bool disable_nagle,
               int accepts_per_wake,
               bool reuseport,
               bool wait_for_iface,
               void *memory_cache);
  ~FlipAcceptor();

  enum FlipHandlerType flip_handler_type_;
  std::string listen_ip_;
  std::string listen_port_;
  std::string ssl_cert_filename_;
  std::string ssl_key_filename_;
  std::string http_server_ip_;
  std::string http_server_port_;
  std::string https_server_ip_;
  std::string https_server_port_;
  int spdy_only_;
  int accept_backlog_size_;
  bool disable_nagle_;
  int accepts_per_wake_;
  int listen_fd_;
  void* memory_cache_;
  int ssl_session_expiry_;
  bool ssl_disable_compression_;
  int idle_socket_timeout_s_;
};

class FlipConfig {
 public:
  FlipConfig();
  ~FlipConfig();

  void AddAcceptor(enum FlipHandlerType flip_handler_type,
                   std::string listen_ip,
                   std::string listen_port,
                   std::string ssl_cert_filename,
                   std::string ssl_key_filename,
                   std::string http_server_ip,
                   std::string http_server_port,
                   std::string https_server_ip,
                   std::string https_server_port,
                   int spdy_only,
                   int accept_backlog_size,
                   bool disable_nagle,
                   int accepts_per_wake,
                   bool reuseport,
                   bool wait_for_iface,
                   void *memory_cache);

  std::vector<FlipAcceptor*> acceptors_;
  double server_think_time_in_s_;
  enum logging::LoggingDestination log_destination_;
  std::string log_filename_;
  bool wait_for_iface_;
  int ssl_session_expiry_;
  bool ssl_disable_compression_;
  int idle_socket_timeout_s_;
};

}  // namespace

#endif  // NET_TOOLS_FLIP_PROXY_CONFIG_H