This revision was automatically updated to reflect the committed changes.
Closed by commit rL306391: Move Connection and IOObject interfaces to Utility 
module (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D34400?vs=103971&id=104125#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34400

Files:
  lldb/trunk/include/lldb/Core/Connection.h
  lldb/trunk/include/lldb/Host/File.h
  lldb/trunk/include/lldb/Host/Host.h
  lldb/trunk/include/lldb/Host/IOObject.h
  lldb/trunk/include/lldb/Host/MainLoopBase.h
  lldb/trunk/include/lldb/Host/Socket.h
  lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
  lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
  lldb/trunk/include/lldb/Utility/Connection.h
  lldb/trunk/include/lldb/Utility/IOObject.h
  lldb/trunk/source/API/SBCommunication.cpp
  lldb/trunk/source/Core/CMakeLists.txt
  lldb/trunk/source/Core/Communication.cpp
  lldb/trunk/source/Core/Connection.cpp
  lldb/trunk/source/Host/CMakeLists.txt
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Host/common/IOObject.cpp
  lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/trunk/source/Utility/CMakeLists.txt
  lldb/trunk/source/Utility/Connection.cpp
  lldb/trunk/source/Utility/IOObject.cpp
  lldb/trunk/tools/lldb-server/Acceptor.h

Index: lldb/trunk/source/Utility/Connection.cpp
===================================================================
--- lldb/trunk/source/Utility/Connection.cpp
+++ lldb/trunk/source/Utility/Connection.cpp
@@ -0,0 +1,14 @@
+//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Utility/Connection.h"
+
+using namespace lldb_private;
+
+Connection::~Connection() = default;
Index: lldb/trunk/source/Utility/CMakeLists.txt
===================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt
+++ lldb/trunk/source/Utility/CMakeLists.txt
@@ -1,13 +1,15 @@
 add_lldb_library(lldbUtility
   Baton.cpp
+  Connection.cpp
   ConstString.cpp
   DataBufferHeap.cpp
   DataBufferLLVM.cpp
   DataEncoder.cpp
   DataExtractor.cpp
   FastDemangle.cpp
   FileSpec.cpp
   History.cpp
+  IOObject.cpp
   JSON.cpp
   LLDBAssert.cpp
   Log.cpp
Index: lldb/trunk/source/Utility/IOObject.cpp
===================================================================
--- lldb/trunk/source/Utility/IOObject.cpp
+++ lldb/trunk/source/Utility/IOObject.cpp
@@ -0,0 +1,15 @@
+//===-- IOObject.cpp --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Utility/IOObject.h"
+
+using namespace lldb_private;
+
+const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;
+IOObject::~IOObject() = default;
Index: lldb/trunk/source/Host/CMakeLists.txt
===================================================================
--- lldb/trunk/source/Host/CMakeLists.txt
+++ lldb/trunk/source/Host/CMakeLists.txt
@@ -13,7 +13,6 @@
   common/HostNativeThreadBase.cpp
   common/HostProcess.cpp
   common/HostThread.cpp
-  common/IOObject.cpp
   common/LockFileBase.cpp
   common/MainLoop.cpp
   common/MonitoringProcessLauncher.cpp
Index: lldb/trunk/source/Host/common/Host.cpp
===================================================================
--- lldb/trunk/source/Host/common/Host.cpp
+++ lldb/trunk/source/Host/common/Host.cpp
@@ -58,6 +58,7 @@
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Target/FileAction.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 #include "lldb/Target/UnixSignals.h"
@@ -73,6 +74,7 @@
 #include "llvm/Support/FileSystem.h"
 
 #if defined(_WIN32)
+#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
 #else
 #include "lldb/Host/posix/ProcessLauncherPosixFork.h"
@@ -624,6 +626,14 @@
   return s_unix_signals_sp;
 }
 
+std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) {
+#if defined(_WIN32)
+  if (url.startswith("file://"))
+    return std::unique_ptr<Connection>(new ConnectionGenericFile());
+#endif
+  return std::unique_ptr<Connection>(new ConnectionFileDescriptor());
+}
+
 #if defined(LLVM_ON_UNIX)
 WaitStatus WaitStatus::Decode(int wstatus) {
   if (WIFEXITED(wstatus))
Index: lldb/trunk/source/Host/common/IOObject.cpp
===================================================================
--- lldb/trunk/source/Host/common/IOObject.cpp
+++ lldb/trunk/source/Host/common/IOObject.cpp
@@ -1,14 +0,0 @@
-//===-- IOObject.cpp --------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Host/IOObject.h"
-
-using namespace lldb_private;
-
-const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;
Index: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
===================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -16,10 +16,10 @@
 
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Host/Config.h"
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Socket.h"
 #include "lldb/Host/SocketAddress.h"
 #include "lldb/Utility/SelectHelper.h"
+#include "lldb/Utility/Timeout.h"
 
 // C Includes
 #include <errno.h>
@@ -42,7 +42,6 @@
 #include "llvm/ADT/SmallVector.h"
 #endif
 // Project includes
-#include "lldb/Core/Communication.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Socket.h"
Index: lldb/trunk/source/API/SBCommunication.cpp
===================================================================
--- lldb/trunk/source/API/SBCommunication.cpp
+++ lldb/trunk/source/API/SBCommunication.cpp
@@ -11,6 +11,7 @@
 #include "lldb/API/SBBroadcaster.h"
 #include "lldb/Core/Communication.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Utility/Log.h"
 
 using namespace lldb;
@@ -51,7 +52,7 @@
 ConnectionStatus SBCommunication::Connect(const char *url) {
   if (m_opaque) {
     if (!m_opaque->HasConnection())
-      m_opaque->SetConnection(Connection::CreateDefaultConnection(url));
+      m_opaque->SetConnection(Host::CreateDefaultConnection(url).release());
     return m_opaque->Connect(url, NULL);
   }
   return eConnectionStatusNoConnection;
Index: lldb/trunk/source/Core/Communication.cpp
===================================================================
--- lldb/trunk/source/Core/Communication.cpp
+++ lldb/trunk/source/Core/Communication.cpp
@@ -9,11 +9,11 @@
 
 #include "lldb/Core/Communication.h"
 
-#include "lldb/Core/Connection.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Utility/Connection.h"
 #include "lldb/Utility/ConstString.h" // for ConstString
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Logging.h" // for LogIfAnyCategoriesSet, LIBLLDB...
Index: lldb/trunk/source/Core/CMakeLists.txt
===================================================================
--- lldb/trunk/source/Core/CMakeLists.txt
+++ lldb/trunk/source/Core/CMakeLists.txt
@@ -7,7 +7,6 @@
   ArchSpec.cpp
   Broadcaster.cpp
   Communication.cpp
-  Connection.cpp
   Debugger.cpp
   Disassembler.cpp
   DumpDataExtractor.cpp
Index: lldb/trunk/source/Core/Connection.cpp
===================================================================
--- lldb/trunk/source/Core/Connection.cpp
+++ lldb/trunk/source/Core/Connection.cpp
@@ -1,32 +0,0 @@
-//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/Connection.h"
-
-#if defined(_WIN32)
-#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
-#endif
-
-#include "lldb/Host/ConnectionFileDescriptor.h"
-
-#include <string.h> // for strstr
-
-using namespace lldb_private;
-
-Connection::Connection() {}
-
-Connection::~Connection() {}
-
-Connection *Connection::CreateDefaultConnection(const char *url) {
-#if defined(_WIN32)
-  if (strstr(url, "file://") == url)
-    return new ConnectionGenericFile();
-#endif
-  return new ConnectionFileDescriptor();
-}
Index: lldb/trunk/tools/lldb-server/Acceptor.h
===================================================================
--- lldb/trunk/tools/lldb-server/Acceptor.h
+++ lldb/trunk/tools/lldb-server/Acceptor.h
@@ -9,8 +9,8 @@
 #ifndef lldb_server_Acceptor_h_
 #define lldb_server_Acceptor_h_
 
-#include "lldb/Core/Connection.h"
 #include "lldb/Host/Socket.h"
+#include "lldb/Utility/Connection.h"
 #include "lldb/Utility/Status.h"
 
 #include <functional>
Index: lldb/trunk/include/lldb/Host/File.h
===================================================================
--- lldb/trunk/include/lldb/Host/File.h
+++ lldb/trunk/include/lldb/Host/File.h
@@ -10,8 +10,8 @@
 #ifndef liblldb_File_h_
 #define liblldb_File_h_
 
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private.h"
 
Index: lldb/trunk/include/lldb/Host/Host.h
===================================================================
--- lldb/trunk/include/lldb/Host/Host.h
+++ lldb/trunk/include/lldb/Host/Host.h
@@ -238,6 +238,9 @@
                                        uint32_t line_no);
 
   static size_t GetEnvironment(StringList &env);
+
+  static std::unique_ptr<Connection>
+  CreateDefaultConnection(llvm::StringRef url);
 };
 
 } // namespace lldb_private
Index: lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
===================================================================
--- lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
+++ lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
@@ -10,7 +10,7 @@
 #ifndef liblldb_Host_windows_ConnectionGenericFileWindows_h_
 #define liblldb_Host_windows_ConnectionGenericFileWindows_h_
 
-#include "lldb/Core/Connection.h"
+#include "lldb/Host/Connection.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/lldb-types.h"
 
Index: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
===================================================================
--- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -19,10 +19,10 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/Connection.h"
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/Predicate.h"
+#include "lldb/Utility/Connection.h"
+#include "lldb/Utility/IOObject.h"
 
 namespace lldb_private {
 
Index: lldb/trunk/include/lldb/Host/MainLoopBase.h
===================================================================
--- lldb/trunk/include/lldb/Host/MainLoopBase.h
+++ lldb/trunk/include/lldb/Host/MainLoopBase.h
@@ -10,12 +10,10 @@
 #ifndef lldb_Host_posix_MainLoopBase_h_
 #define lldb_Host_posix_MainLoopBase_h_
 
-#include <functional>
-
-#include "llvm/Support/ErrorHandling.h"
-
-#include "lldb/Host/IOObject.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <functional>
 
 namespace lldb_private {
 
Index: lldb/trunk/include/lldb/Host/Socket.h
===================================================================
--- lldb/trunk/include/lldb/Host/Socket.h
+++ lldb/trunk/include/lldb/Host/Socket.h
@@ -15,9 +15,9 @@
 
 #include "lldb/lldb-private.h"
 
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/SocketAddress.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
 
 #ifdef _WIN32
Index: lldb/trunk/include/lldb/Host/IOObject.h
===================================================================
--- lldb/trunk/include/lldb/Host/IOObject.h
+++ lldb/trunk/include/lldb/Host/IOObject.h
@@ -1,56 +0,0 @@
-//===-- IOObject.h ----------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Host_Common_IOObject_h_
-#define liblldb_Host_Common_IOObject_h_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-class IOObject {
-public:
-  typedef enum {
-    eFDTypeFile,   // Other FD requiring read/write
-    eFDTypeSocket, // Socket requiring send/recv
-  } FDType;
-
-  // TODO: On Windows this should be a HANDLE, and wait should use
-  // WaitForMultipleObjects
-  typedef int WaitableHandle;
-  static const WaitableHandle kInvalidHandleValue;
-
-  IOObject(FDType type, bool should_close)
-      : m_fd_type(type), m_should_close_fd(should_close) {}
-  virtual ~IOObject() {}
-
-  virtual Status Read(void *buf, size_t &num_bytes) = 0;
-  virtual Status Write(const void *buf, size_t &num_bytes) = 0;
-  virtual bool IsValid() const = 0;
-  virtual Status Close() = 0;
-
-  FDType GetFdType() const { return m_fd_type; }
-
-  virtual WaitableHandle GetWaitableHandle() = 0;
-
-protected:
-  FDType m_fd_type;
-  bool m_should_close_fd; // True if this class should close the file descriptor
-                          // when it goes away.
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(IOObject);
-};
-}
-
-#endif
Index: lldb/trunk/include/lldb/Utility/IOObject.h
===================================================================
--- lldb/trunk/include/lldb/Utility/IOObject.h
+++ lldb/trunk/include/lldb/Utility/IOObject.h
@@ -0,0 +1,56 @@
+//===-- IOObject.h ----------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_Common_IOObject_h_
+#define liblldb_Host_Common_IOObject_h_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class IOObject {
+public:
+  typedef enum {
+    eFDTypeFile,   // Other FD requiring read/write
+    eFDTypeSocket, // Socket requiring send/recv
+  } FDType;
+
+  // TODO: On Windows this should be a HANDLE, and wait should use
+  // WaitForMultipleObjects
+  typedef int WaitableHandle;
+  static const WaitableHandle kInvalidHandleValue;
+
+  IOObject(FDType type, bool should_close)
+      : m_fd_type(type), m_should_close_fd(should_close) {}
+  virtual ~IOObject();
+
+  virtual Status Read(void *buf, size_t &num_bytes) = 0;
+  virtual Status Write(const void *buf, size_t &num_bytes) = 0;
+  virtual bool IsValid() const = 0;
+  virtual Status Close() = 0;
+
+  FDType GetFdType() const { return m_fd_type; }
+
+  virtual WaitableHandle GetWaitableHandle() = 0;
+
+protected:
+  FDType m_fd_type;
+  bool m_should_close_fd; // True if this class should close the file descriptor
+                          // when it goes away.
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(IOObject);
+};
+} // namespace lldb_private
+
+#endif
Index: lldb/trunk/include/lldb/Utility/Connection.h
===================================================================
--- lldb/trunk/include/lldb/Utility/Connection.h
+++ lldb/trunk/include/lldb/Utility/Connection.h
@@ -0,0 +1,212 @@
+//===-- Connection.h --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Connection_h_
+#define liblldb_Connection_h_
+
+#include "lldb/lldb-defines.h"      // for DISALLOW_COPY_AND_ASSIGN
+#include "lldb/lldb-enumerations.h" // for ConnectionStatus
+#include "lldb/lldb-forward.h"      // for IOObjectSP
+
+#include "llvm/ADT/StringRef.h" // for StringRef
+
+#include <ratio> // for micro
+#include <string>
+
+#include <stddef.h> // for size_t
+
+namespace lldb_private {
+class Status;
+}
+namespace lldb_private {
+template <typename Ratio> class Timeout;
+}
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class Connection Connection.h "lldb/Utility/Connection.h"
+/// @brief A communication connection class.
+///
+/// A class that implements that actual communication functions for
+/// connecting/disconnecting, reading/writing, and waiting for bytes
+/// to become available from a two way communication connection.
+///
+/// This class is designed to only do very simple communication
+/// functions. Instances can be instantiated and given to a
+/// Communication class to perform communications where clients can
+/// listen for broadcasts, and perform other higher level communications.
+//----------------------------------------------------------------------
+class Connection {
+public:
+  //------------------------------------------------------------------
+  /// Default constructor
+  //------------------------------------------------------------------
+  Connection() = default;
+
+  //------------------------------------------------------------------
+  /// Virtual destructor since this class gets subclassed and handed
+  /// to a Communication object.
+  //------------------------------------------------------------------
+  virtual ~Connection();
+
+  //------------------------------------------------------------------
+  /// Connect using the connect string \a url.
+  ///
+  /// @param[in] url
+  ///     A string that contains all information needed by the
+  ///     subclass to connect to another client.
+  ///
+  /// @param[out] error_ptr
+  ///     A pointer to an error object that should be given an
+  ///     appropriate error value if this method returns false. This
+  ///     value can be NULL if the error value should be ignored.
+  ///
+  /// @return
+  ///     \b True if the connect succeeded, \b false otherwise. The
+  ///     internal error object should be filled in with an
+  ///     appropriate value based on the result of this function.
+  ///
+  /// @see Status& Communication::GetError ();
+  //------------------------------------------------------------------
+  virtual lldb::ConnectionStatus Connect(llvm::StringRef url,
+                                         Status *error_ptr) = 0;
+
+  //------------------------------------------------------------------
+  /// Disconnect the communications connection if one is currently
+  /// connected.
+  ///
+  /// @param[out] error_ptr
+  ///     A pointer to an error object that should be given an
+  ///     appropriate error value if this method returns false. This
+  ///     value can be NULL if the error value should be ignored.
+  ///
+  /// @return
+  ///     \b True if the disconnect succeeded, \b false otherwise. The
+  ///     internal error object should be filled in with an
+  ///     appropriate value based on the result of this function.
+  ///
+  /// @see Status& Communication::GetError ();
+  //------------------------------------------------------------------
+  virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0;
+
+  //------------------------------------------------------------------
+  /// Check if the connection is valid.
+  ///
+  /// @return
+  ///     \b True if this object is currently connected, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  virtual bool IsConnected() const = 0;
+
+  //------------------------------------------------------------------
+  /// The read function that attempts to read from the connection.
+  ///
+  /// @param[in] dst
+  ///     A destination buffer that must be at least \a dst_len bytes
+  ///     long.
+  ///
+  /// @param[in] dst_len
+  ///     The number of bytes to attempt to read, and also the max
+  ///     number of bytes that can be placed into \a dst.
+  ///
+  /// @param[in] timeout
+  ///     The number of microseconds to wait for the data.
+  ///
+  /// @param[out] status
+  ///     On return, indicates whether the call was successful or terminated
+  ///     due to some error condition.
+  ///
+  /// @param[out] error_ptr
+  ///     A pointer to an error object that should be given an
+  ///     appropriate error value if this method returns zero. This
+  ///     value can be NULL if the error value should be ignored.
+  ///
+  /// @return
+  ///     The number of bytes actually read.
+  ///
+  /// @see size_t Communication::Read (void *, size_t, uint32_t);
+  //------------------------------------------------------------------
+  virtual size_t Read(void *dst, size_t dst_len,
+                      const Timeout<std::micro> &timeout,
+                      lldb::ConnectionStatus &status, Status *error_ptr) = 0;
+
+  //------------------------------------------------------------------
+  /// The actual write function that attempts to write to the
+  /// communications protocol.
+  ///
+  /// Subclasses must override this function.
+  ///
+  /// @param[in] dst
+  ///     A desination buffer that must be at least \a dst_len bytes
+  ///     long.
+  ///
+  /// @param[in] dst_len
+  ///     The number of bytes to attempt to write, and also the
+  ///     number of bytes are currently available in \a dst.
+  ///
+  /// @param[out] error_ptr
+  ///     A pointer to an error object that should be given an
+  ///     appropriate error value if this method returns zero. This
+  ///     value can be NULL if the error value should be ignored.
+  ///
+  /// @return
+  ///     The number of bytes actually Written.
+  //------------------------------------------------------------------
+  virtual size_t Write(const void *dst, size_t dst_len,
+                       lldb::ConnectionStatus &status, Status *error_ptr) = 0;
+
+  //------------------------------------------------------------------
+  /// Returns a URI that describes this connection object
+  ///
+  /// Subclasses may override this function.
+  ///
+  /// @return
+  ///     Returns URI or an empty string if disconnecteds
+  //------------------------------------------------------------------
+  virtual std::string GetURI() = 0;
+
+  //------------------------------------------------------------------
+  /// Interrupts an ongoing Read() operation.
+  ///
+  /// If there is an ongoing read operation in another thread, this operation
+  /// return with status == eConnectionStatusInterrupted. Note that if there
+  /// data waiting to be read and an interrupt request is issued, the Read()
+  /// function will return the data immediately without processing the
+  /// interrupt request (which will remain queued for the next Read()
+  /// operation).
+  ///
+  /// @return
+  ///     Returns true is the interrupt request was successful.
+  //------------------------------------------------------------------
+  virtual bool InterruptRead() = 0;
+
+  //------------------------------------------------------------------
+  /// Returns the underlying IOObject used by the Connection.
+  ///
+  /// The IOObject can be used to wait for data to become available
+  /// on the connection. If the Connection does not use IOObjects (and
+  /// hence does not support waiting) this function should return a
+  /// null pointer.
+  ///
+  /// @return
+  ///     The underlying IOObject used for reading.
+  //------------------------------------------------------------------
+  virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
+
+private:
+  //------------------------------------------------------------------
+  // For Connection only
+  //------------------------------------------------------------------
+  DISALLOW_COPY_AND_ASSIGN(Connection);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Connection_h_
Index: lldb/trunk/include/lldb/Core/Connection.h
===================================================================
--- lldb/trunk/include/lldb/Core/Connection.h
+++ lldb/trunk/include/lldb/Core/Connection.h
@@ -1,214 +0,0 @@
-//===-- Connection.h --------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Connection_h_
-#define liblldb_Connection_h_
-
-#include "lldb/lldb-defines.h"      // for DISALLOW_COPY_AND_ASSIGN
-#include "lldb/lldb-enumerations.h" // for ConnectionStatus
-#include "lldb/lldb-forward.h"      // for IOObjectSP
-
-#include "llvm/ADT/StringRef.h" // for StringRef
-
-#include <ratio> // for micro
-#include <string>
-
-#include <stddef.h> // for size_t
-
-namespace lldb_private {
-class Status;
-}
-namespace lldb_private {
-template <typename Ratio> class Timeout;
-}
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class Connection Connection.h "lldb/Core/Connection.h"
-/// @brief A communication connection class.
-///
-/// A class that implements that actual communication functions for
-/// connecting/disconnecting, reading/writing, and waiting for bytes
-/// to become available from a two way communication connection.
-///
-/// This class is designed to only do very simple communication
-/// functions. Instances can be instantiated and given to a
-/// Communication class to perform communications where clients can
-/// listen for broadcasts, and perform other higher level communications.
-//----------------------------------------------------------------------
-class Connection {
-public:
-  //------------------------------------------------------------------
-  /// Default constructor
-  //------------------------------------------------------------------
-  Connection();
-
-  //------------------------------------------------------------------
-  /// Virtual destructor since this class gets subclassed and handed
-  /// to a Communication object.
-  //------------------------------------------------------------------
-  virtual ~Connection();
-
-  static Connection *CreateDefaultConnection(const char *url);
-
-  //------------------------------------------------------------------
-  /// Connect using the connect string \a url.
-  ///
-  /// @param[in] url
-  ///     A string that contains all information needed by the
-  ///     subclass to connect to another client.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns false. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     \b True if the connect succeeded, \b false otherwise. The
-  ///     internal error object should be filled in with an
-  ///     appropriate value based on the result of this function.
-  ///
-  /// @see Status& Communication::GetError ();
-  //------------------------------------------------------------------
-  virtual lldb::ConnectionStatus Connect(llvm::StringRef url,
-                                         Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Disconnect the communications connection if one is currently
-  /// connected.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns false. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     \b True if the disconnect succeeded, \b false otherwise. The
-  ///     internal error object should be filled in with an
-  ///     appropriate value based on the result of this function.
-  ///
-  /// @see Status& Communication::GetError ();
-  //------------------------------------------------------------------
-  virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Check if the connection is valid.
-  ///
-  /// @return
-  ///     \b True if this object is currently connected, \b false
-  ///     otherwise.
-  //------------------------------------------------------------------
-  virtual bool IsConnected() const = 0;
-
-  //------------------------------------------------------------------
-  /// The read function that attempts to read from the connection.
-  ///
-  /// @param[in] dst
-  ///     A destination buffer that must be at least \a dst_len bytes
-  ///     long.
-  ///
-  /// @param[in] dst_len
-  ///     The number of bytes to attempt to read, and also the max
-  ///     number of bytes that can be placed into \a dst.
-  ///
-  /// @param[in] timeout
-  ///     The number of microseconds to wait for the data.
-  ///
-  /// @param[out] status
-  ///     On return, indicates whether the call was successful or terminated
-  ///     due to some error condition.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns zero. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     The number of bytes actually read.
-  ///
-  /// @see size_t Communication::Read (void *, size_t, uint32_t);
-  //------------------------------------------------------------------
-  virtual size_t Read(void *dst, size_t dst_len,
-                      const Timeout<std::micro> &timeout,
-                      lldb::ConnectionStatus &status, Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// The actual write function that attempts to write to the
-  /// communications protocol.
-  ///
-  /// Subclasses must override this function.
-  ///
-  /// @param[in] dst
-  ///     A desination buffer that must be at least \a dst_len bytes
-  ///     long.
-  ///
-  /// @param[in] dst_len
-  ///     The number of bytes to attempt to write, and also the
-  ///     number of bytes are currently available in \a dst.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns zero. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     The number of bytes actually Written.
-  //------------------------------------------------------------------
-  virtual size_t Write(const void *dst, size_t dst_len,
-                       lldb::ConnectionStatus &status, Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Returns a URI that describes this connection object
-  ///
-  /// Subclasses may override this function.
-  ///
-  /// @return
-  ///     Returns URI or an empty string if disconnecteds
-  //------------------------------------------------------------------
-  virtual std::string GetURI() = 0;
-
-  //------------------------------------------------------------------
-  /// Interrupts an ongoing Read() operation.
-  ///
-  /// If there is an ongoing read operation in another thread, this operation
-  /// return with status == eConnectionStatusInterrupted. Note that if there
-  /// data waiting to be read and an interrupt request is issued, the Read()
-  /// function will return the data immediately without processing the
-  /// interrupt request (which will remain queued for the next Read()
-  /// operation).
-  ///
-  /// @return
-  ///     Returns true is the interrupt request was successful.
-  //------------------------------------------------------------------
-  virtual bool InterruptRead() = 0;
-
-  //------------------------------------------------------------------
-  /// Returns the underlying IOObject used by the Connection.
-  ///
-  /// The IOObject can be used to wait for data to become available
-  /// on the connection. If the Connection does not use IOObjects (and
-  /// hence does not support waiting) this function should return a
-  /// null pointer.
-  ///
-  /// @return
-  ///     The underlying IOObject used for reading.
-  //------------------------------------------------------------------
-  virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
-
-private:
-  //------------------------------------------------------------------
-  // For Connection only
-  //------------------------------------------------------------------
-  DISALLOW_COPY_AND_ASSIGN(Connection);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_Connection_h_
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to