summaryrefslogtreecommitdiff
path: root/src/proxy.hh
blob: 6545152ffd95e48edecb75fd48371365000db950 (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
// -*- mode: c++; c-basic-offset: 2; -*-

#ifndef PROXY_HH
#define PROXY_HH

#include <string>

class Config;
class Logger;

class Proxy {
public:
  virtual ~Proxy() {}

  static Proxy* create(Config* config, std::string const& cwd,
                       char const* configfile,
                       char const* logfile,
                       Logger* logger,
                       int accept_fd, int monitor_fd);
  static int setup_accept_socket(Config* config, Logger* logger);
  static int setup_monitor_socket(Config* config, Logger* logger);

  // Called from signal handler, ask the proxy to exit as soon as possible
  virtual void quit() = 0;

  // Called from signal handler, ask the proxy to reload config as soon
  // as possible
  virtual void reload() = 0;

  virtual bool run() = 0;

protected:
  Proxy() {}
  Proxy(Proxy const&) = delete;
};

#endif  // PROXY_HH