1//===-- Transport.h -------------------------------------------------------===//
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// Debug Adapter Protocol transport layer for encoding and decoding protocol
10// messages.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLDB_TOOLS_LLDB_DAP_TRANSPORT_H
15#define LLDB_TOOLS_LLDB_DAP_TRANSPORT_H
16
17#include "DAPForward.h"
18#include "lldb/Host/JSONTransport.h"
19#include "lldb/lldb-forward.h"
20#include "llvm/ADT/StringRef.h"
21
22namespace lldb_dap {
23
24/// A transport class that performs the Debug Adapter Protocol communication
25/// with the client.
26class Transport : public lldb_private::HTTPDelimitedJSONTransport {
27public:
28 Transport(llvm::StringRef client_name, lldb_dap::Log *log,
29 lldb::IOObjectSP input, lldb::IOObjectSP output);
30 virtual ~Transport() = default;
31
32 virtual void Log(llvm::StringRef message) override;
33
34 /// Returns the name of this transport client, for example `stdin/stdout` or
35 /// `client_1`.
36 llvm::StringRef GetClientName() { return m_client_name; }
37
38private:
39 llvm::StringRef m_client_name;
40 lldb_dap::Log *m_log;
41};
42
43} // namespace lldb_dap
44
45#endif
46

source code of lldb/tools/lldb-dap/Transport.h