LLDB mainline
Transport.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_PROTOCOL_MCP_TRANSPORT_H
10#define LLDB_PROTOCOL_MCP_TRANSPORT_H
11
14#include "lldb/lldb-forward.h"
15#include "llvm/ADT/FunctionExtras.h"
16#include "llvm/ADT/StringRef.h"
17
18namespace lldb_protocol::mcp {
19
20/// Generic transport that uses the MCP protocol.
22
23/// Generic logging callback, to allow the MCP server / client / transport layer
24/// to be independent of the lldb log implementation.
25using LogCallback = llvm::unique_function<void(llvm::StringRef message)>;
26
27class Transport final
28 : public lldb_private::JSONRPCTransport<Request, Response, Notification> {
29public:
31 LogCallback log_callback = {});
32 virtual ~Transport() = default;
33
34 /// Transport is not copyable.
35 /// @{
36 Transport(const Transport &) = delete;
37 void operator=(const Transport &) = delete;
38 /// @}
39
40 void Log(llvm::StringRef message) override;
41
42private:
44};
45
46} // namespace lldb_protocol::mcp
47
48#endif
A transport class for JSON RPC.
A transport is responsible for maintaining the connection to a client application,...
Transport(lldb::IOObjectSP in, lldb::IOObjectSP out, LogCallback log_callback={})
Definition Transport.cpp:16
virtual ~Transport()=default
void operator=(const Transport &)=delete
void Log(llvm::StringRef message) override
Transport(const Transport &)=delete
Transport is not copyable.
lldb_private::Transport< Request, Response, Notification > MCPTransport
Generic transport that uses the MCP protocol.
Definition Transport.h:21
llvm::unique_function< void(llvm::StringRef message)> LogCallback
Generic logging callback, to allow the MCP server / client / transport layer to be independent of the...
Definition Transport.h:25
std::shared_ptr< lldb_private::IOObject > IOObjectSP