]> git.sesse.net Git - cubemap/blobdiff - acceptor.h
Create $(libdir) on make install.
[cubemap] / acceptor.h
index fe62c31396d119ea97addc6bdafae262fef8d452..969ea65889419a38efd6683072be36bf60e9dc35 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <netinet/in.h>
 
+#include <string>
+
 #include "thread.h"
 
 enum SocketType {
@@ -20,12 +22,25 @@ sockaddr_in6 extract_address_from_acceptor_proto(const AcceptorProto &proto);
 // and hands them off to the server pool.
 class Acceptor : public Thread {
 public:
-       Acceptor(int server_sock, const sockaddr_in6 &addr);
+       Acceptor(int server_sock, const sockaddr_in6 &addr,
+                const std::string &certificate_chain, const std::string &private_key);
 
        // Serialization/deserialization.
        Acceptor(const AcceptorProto &serialized);
        AcceptorProto serialize() const;
 
+       bool is_tls() const { return !certificate_chain.empty(); }
+
+       std::string get_certificate_chain() const {
+               assert(is_tls());
+               return certificate_chain;
+       }
+
+       std::string get_private_key() const {
+               assert(is_tls());
+               return private_key;
+       }
+
        void close_socket();
 
 private:
@@ -33,6 +48,7 @@ private:
 
        int server_sock;
        sockaddr_in6 addr;
+       std::string certificate_chain, private_key;  // Both empty for no TLS.
 };
 
 #endif  // !defined(_ACCEPTOR_H)