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/Core/Connection.h"
13 #include "lldb/Core/Error.h"
14 #include "lldb/Host/Socket.h"
25 namespace lldb_private {
26 namespace lldb_server {
31 virtual ~Acceptor() = default;
37 Accept(const bool child_processes_inherit, Connection *&conn);
39 static std::unique_ptr<Acceptor>
40 Create(llvm::StringRef name, const bool child_processes_inherit, Error &error);
42 Socket::SocketProtocol
43 GetSocketProtocol() const;
46 GetSocketScheme() const;
48 // Returns either TCP port number as string or domain socket path.
49 // Empty string is returned in case of error.
51 GetLocalSocketId() const;
54 typedef std::function<std::string()> LocalSocketIdFunc;
56 Acceptor(std::unique_ptr<Socket> &&listener_socket,
58 const LocalSocketIdFunc &local_socket_id);
60 const std::unique_ptr<Socket> m_listener_socket_up;
61 const std::string m_name;
62 const LocalSocketIdFunc m_local_socket_id;
65 } // namespace lldb_server
66 } // namespace lldb_private
68 #endif // lldb_server_Acceptor_h_