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