1 //===-- Acceptor.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 #ifndef lldb_server_Acceptor_h_
10 #define lldb_server_Acceptor_h_
12 #include "lldb/Host/Socket.h"
13 #include "lldb/Utility/Connection.h"
14 #include "lldb/Utility/Status.h"
24 namespace lldb_private {
25 namespace lldb_server {
29 virtual ~Acceptor() = default;
31 Status Listen(int backlog);
33 Status Accept(const bool child_processes_inherit, Connection *&conn);
35 static std::unique_ptr<Acceptor> Create(llvm::StringRef name,
36 const bool child_processes_inherit,
39 Socket::SocketProtocol GetSocketProtocol() const;
41 const char *GetSocketScheme() const;
43 // Returns either TCP port number as string or domain socket path.
44 // Empty string is returned in case of error.
45 std::string GetLocalSocketId() const;
48 typedef std::function<std::string()> LocalSocketIdFunc;
50 Acceptor(std::unique_ptr<Socket> &&listener_socket, llvm::StringRef name,
51 const LocalSocketIdFunc &local_socket_id);
53 const std::unique_ptr<Socket> m_listener_socket_up;
54 const std::string m_name;
55 const LocalSocketIdFunc m_local_socket_id;
58 } // namespace lldb_server
59 } // namespace lldb_private
61 #endif // lldb_server_Acceptor_h_