LLDB mainline
|
A communication connection class. More...
#include "lldb/Utility/Connection.h"
Public Member Functions | |
Connection ()=default | |
Default constructor. | |
virtual | ~Connection () |
Virtual destructor since this class gets subclassed and handed to a Communication object. | |
virtual lldb::ConnectionStatus | Connect (llvm::StringRef url, Status *error_ptr)=0 |
Connect using the connect string url. | |
virtual lldb::ConnectionStatus | Disconnect (Status *error_ptr)=0 |
Disconnect the communications connection if one is currently connected. | |
virtual bool | IsConnected () const =0 |
Check if the connection is valid. | |
virtual size_t | Read (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr)=0 |
The read function that attempts to read from the connection. | |
virtual size_t | Write (const void *dst, size_t dst_len, lldb::ConnectionStatus &status, Status *error_ptr)=0 |
The actual write function that attempts to write to the communications protocol. | |
virtual std::string | GetURI ()=0 |
Returns a URI that describes this connection object. | |
virtual bool | InterruptRead ()=0 |
Interrupts an ongoing Read() operation. | |
virtual lldb::IOObjectSP | GetReadObject () |
Returns the underlying IOObject used by the Connection. | |
Private Member Functions | |
Connection (const Connection &)=delete | |
const Connection & | operator= (const Connection &)=delete |
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.
Definition at line 41 of file Connection.h.
|
default |
Default constructor.
|
virtualdefault |
Virtual destructor since this class gets subclassed and handed to a Communication object.
|
privatedelete |
|
pure virtual |
Connect using the connect string url.
[in] | url | A string that contains all information needed by the subclass to connect to another client. |
[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. |
Implemented in lldb_private::ConnectionGenericFile, and lldb_private::ConnectionFileDescriptor.
|
pure virtual |
Disconnect the communications connection if one is currently connected.
[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. |
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.
|
inlinevirtual |
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.
Reimplemented in lldb_private::ConnectionFileDescriptor.
Definition at line 174 of file Connection.h.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::StartSTDIOForwarding().
|
pure virtual |
Returns a URI that describes this connection object.
Subclasses may override this function.
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchGDBServer().
|
pure virtual |
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).
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.
|
pure virtual |
Check if the connection is valid.
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.
|
privatedelete |
|
pure virtual |
The read function that attempts to read from the connection.
[in] | dst | A destination buffer that must be at least dst_len bytes long. |
[in] | dst_len | The number of bytes to attempt to read, and also the max number of bytes that can be placed into dst. |
[in] | timeout | The number of microseconds to wait for the data. |
[out] | status | On return, indicates whether the call was successful or terminated due to some error condition. |
[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. |
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.
Referenced by ReadAllBytes().
|
pure virtual |
The actual write function that attempts to write to the communications protocol.
Subclasses must override this function.
[in] | dst | A destination buffer that must be at least dst_len bytes long. |
[in] | dst_len | The number of bytes to attempt to write, and also the number of bytes are currently available in dst. |
[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. |
Implemented in lldb_private::ConnectionFileDescriptor, and lldb_private::ConnectionGenericFile.