Path: blob/main/contrib/llvm-project/lldb/tools/lldb-server/Acceptor.h
34879 views
//===-- Acceptor.h ----------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7#ifndef LLDB_TOOLS_LLDB_SERVER_ACCEPTOR_H8#define LLDB_TOOLS_LLDB_SERVER_ACCEPTOR_H910#include "lldb/Host/Socket.h"11#include "lldb/Utility/Connection.h"12#include "lldb/Utility/Status.h"1314#include <functional>15#include <memory>16#include <string>1718namespace llvm {19class StringRef;20}2122namespace lldb_private {23namespace lldb_server {2425class Acceptor {26public:27virtual ~Acceptor() = default;2829Status Listen(int backlog);3031Status Accept(const bool child_processes_inherit, Connection *&conn);3233static std::unique_ptr<Acceptor> Create(llvm::StringRef name,34const bool child_processes_inherit,35Status &error);3637Socket::SocketProtocol GetSocketProtocol() const;3839const char *GetSocketScheme() const;4041// Returns either TCP port number as string or domain socket path.42// Empty string is returned in case of error.43std::string GetLocalSocketId() const;4445private:46typedef std::function<std::string()> LocalSocketIdFunc;4748Acceptor(std::unique_ptr<Socket> &&listener_socket, llvm::StringRef name,49const LocalSocketIdFunc &local_socket_id);5051const std::unique_ptr<Socket> m_listener_socket_up;52const std::string m_name;53const LocalSocketIdFunc m_local_socket_id;54};5556} // namespace lldb_server57} // namespace lldb_private5859#endif // LLDB_TOOLS_LLDB_SERVER_ACCEPTOR_H606162