Files
clang-p2996/lldb/tools/lldb-server/Acceptor.h
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00

61 lines
1.7 KiB
C++

//===-- Acceptor.h ----------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef lldb_server_Acceptor_h_
#define lldb_server_Acceptor_h_
#include "lldb/Host/Socket.h"
#include "lldb/Utility/Connection.h"
#include "lldb/Utility/Status.h"
#include <functional>
#include <memory>
#include <string>
namespace llvm {
class StringRef;
}
namespace lldb_private {
namespace lldb_server {
class Acceptor {
public:
virtual ~Acceptor() = default;
Status Listen(int backlog);
Status Accept(const bool child_processes_inherit, Connection *&conn);
static std::unique_ptr<Acceptor> Create(llvm::StringRef name,
const bool child_processes_inherit,
Status &error);
Socket::SocketProtocol GetSocketProtocol() const;
const char *GetSocketScheme() const;
// Returns either TCP port number as string or domain socket path.
// Empty string is returned in case of error.
std::string GetLocalSocketId() const;
private:
typedef std::function<std::string()> LocalSocketIdFunc;
Acceptor(std::unique_ptr<Socket> &&listener_socket, llvm::StringRef name,
const LocalSocketIdFunc &local_socket_id);
const std::unique_ptr<Socket> m_listener_socket_up;
const std::string m_name;
const LocalSocketIdFunc m_local_socket_id;
};
} // namespace lldb_server
} // namespace lldb_private
#endif // lldb_server_Acceptor_h_