4 #include <netinet/in.h>
14 int create_server_socket(const sockaddr_in6 &addr, SocketType socket_type);
18 sockaddr_in6 create_any_address(int port);
19 sockaddr_in6 extract_address_from_acceptor_proto(const AcceptorProto &proto);
21 // A thread that accepts new connections on a given socket,
22 // and hands them off to the server pool.
23 class Acceptor : public Thread {
25 Acceptor(int server_sock, const sockaddr_in6 &addr,
26 const std::string &certificate_chain, const std::string &private_key);
28 // Serialization/deserialization.
29 Acceptor(const AcceptorProto &serialized);
30 AcceptorProto serialize() const;
32 bool is_tls() const { return !certificate_chain.empty(); }
34 std::string get_certificate_chain() const {
36 return certificate_chain;
39 std::string get_private_key() const {
47 virtual void do_work();
51 std::string certificate_chain, private_key; // Both empty for no TLS.
54 #endif // !defined(_ACCEPTOR_H)