================
@@ -0,0 +1,56 @@
+//===-- Transport.h 
-------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Debug Adapter Protocol transport layer for encoding and decoding protocol
+// messages.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TOOLS_LLDB_DAP_TRANSPORT_H
+#define LLDB_TOOLS_LLDB_DAP_TRANSPORT_H
+
+#include "Protocol.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+#include <fstream>
+
+namespace lldb_dap {
+
+/// A transport class that performs the Debug Adapter Protocol communication
+/// with the client.
+class Transport {
+public:
+  Transport(llvm::StringRef client_name, lldb::IOObjectSP input,
+            lldb::IOObjectSP output);
+  ~Transport() = default;
+
+  Transport(const Transport &rhs) = delete;
+  void operator=(const Transport &rhs) = delete;
+
+  static const lldb_private::Status::ValueType kEOF =
+      0x1001; ///< ValueObject::GetError() returns this if EOF is encountered.
+
+  /// Writes a Debug Adater Protocol message to the output stream.
+  lldb_private::Status Write(std::ofstream *log, const protocol::Message &M);
+
+  /// Reads the next Debug Adater Protocol message from the input stream.
+  lldb_private::Status Read(std::ofstream *log, protocol::Message &M);
+
+  /// Closes the transport.
+  void CloseOutput();
+
+private:
+  llvm::StringRef m_client_name;
----------------
ashgti wrote:

Updated.

https://github.com/llvm/llvm-project/pull/130026
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to